aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig9
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/include/asm/linkage.h4
-rw-r--r--arch/alpha/include/asm/thread_info.h2
-rw-r--r--arch/alpha/include/asm/unistd.h12
-rw-r--r--arch/alpha/kernel/process.c20
-rw-r--r--arch/alpha/kernel/smp.c3
-rw-r--r--arch/alpha/kernel/srm_env.c93
-rw-r--r--arch/alpha/kernel/sys_nautilus.c5
-rw-r--r--arch/alpha/kernel/traps.c7
-rw-r--r--arch/alpha/mm/init.c24
-rw-r--r--arch/alpha/mm/numa.c3
-rw-r--r--arch/arc/kernel/disasm.c2
-rw-r--r--arch/arc/kernel/process.c27
-rw-r--r--arch/arc/kernel/smp.c2
-rw-r--r--arch/arc/kernel/stacktrace.c7
-rw-r--r--arch/arc/kernel/troubleshoot.c3
-rw-r--r--arch/arc/mm/init.c23
-rw-r--r--arch/arc/plat-arcfpga/Kconfig2
-rw-r--r--arch/arm/Kconfig210
-rw-r--r--arch/arm/Kconfig.debug63
-rw-r--r--arch/arm/Makefile6
-rw-r--r--arch/arm/boot/compressed/Makefile3
-rw-r--r--arch/arm/boot/compressed/debug.S12
-rw-r--r--arch/arm/boot/compressed/misc.c8
-rw-r--r--arch/arm/boot/dts/Makefile25
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts17
-rw-r--r--arch/arm/boot/dts/armada-370-mirabox.dts64
-rw-r--r--arch/arm/boot/dts/armada-370-rd.dts11
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi45
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi58
-rw-r--r--arch/arm/boot/dts/armada-xp-db.dts33
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts50
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78230.dtsi104
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi122
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi188
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts38
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi6
-rw-r--r--arch/arm/boot/dts/at91-ariag25.dts171
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi59
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi40
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts12
-rw-r--r--arch/arm/boot/dts/at91sam9g15.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g15ek.dts2
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi12
-rw-r--r--arch/arm/boot/dts/at91sam9g25.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g25ek.dts9
-rw-r--r--arch/arm/boot/dts/at91sam9g35.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g35ek.dts9
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi43
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts12
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi40
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts12
-rw-r--r--arch/arm/boot/dts/at91sam9x25.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9x25ek.dts14
-rw-r--r--arch/arm/boot/dts/at91sam9x35.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9x35ek.dts9
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi110
-rw-r--r--arch/arm/boot/dts/at91sam9x5cm.dtsi20
-rw-r--r--arch/arm/boot/dts/at91sam9x5ek.dtsi25
-rw-r--r--arch/arm/boot/dts/atlas6-evb.dts78
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi668
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi13
-rw-r--r--arch/arm/boot/dts/bcm2835.dtsi22
-rw-r--r--arch/arm/boot/dts/cros5250-common.dtsi138
-rw-r--r--arch/arm/boot/dts/da850-evm.dts70
-rw-r--r--arch/arm/boot/dts/da850.dtsi15
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi7
-rw-r--r--arch/arm/boot/dts/dove.dtsi5
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi58
-rw-r--r--arch/arm/boot/dts/exynos4210-origen.dts18
-rw-r--r--arch/arm/boot/dts/exynos4210-smdkv310.dts18
-rw-r--r--arch/arm/boot/dts/exynos4210-trats.dts12
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi36
-rw-r--r--arch/arm/boot/dts/exynos4212.dtsi22
-rw-r--r--arch/arm/boot/dts/exynos4412-odroidx.dts111
-rw-r--r--arch/arm/boot/dts/exynos4412-origen.dts432
-rw-r--r--arch/arm/boot/dts/exynos4412-smdk4412.dts25
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi26
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts129
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts20
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts11
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi149
-rw-r--r--arch/arm/boot/dts/exynos5440-ssdk5440.dts19
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi67
-rw-r--r--arch/arm/boot/dts/href.dtsi1
-rw-r--r--arch/arm/boot/dts/hrefprev60.dts10
-rw-r--r--arch/arm/boot/dts/imx23.dtsi5
-rw-r--r--arch/arm/boot/dts/imx25-karo-tx25.dts2
-rw-r--r--arch/arm/boot/dts/imx25-pdk.dts2
-rw-r--r--arch/arm/boot/dts/imx25.dtsi2
-rw-r--r--arch/arm/boot/dts/imx27-apf27.dts2
-rw-r--r--arch/arm/boot/dts/imx27-apf27dev.dts60
-rw-r--r--arch/arm/boot/dts/imx27-pdk.dts2
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore.dts8
-rw-r--r--arch/arm/boot/dts/imx27.dtsi82
-rw-r--r--arch/arm/boot/dts/imx28.dtsi5
-rw-r--r--arch/arm/boot/dts/imx31-bug.dts2
-rw-r--r--arch/arm/boot/dts/imx31.dtsi18
-rw-r--r--arch/arm/boot/dts/imx35-pinfunc.h970
-rw-r--r--arch/arm/boot/dts/imx51-apf51.dts2
-rw-r--r--arch/arm/boot/dts/imx51-apf51dev.dts97
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts16
-rw-r--r--arch/arm/boot/dts/imx51-pinfunc.h773
-rw-r--r--arch/arm/boot/dts/imx51.dtsi343
-rw-r--r--arch/arm/boot/dts/imx53-ard.dts70
-rw-r--r--arch/arm/boot/dts/imx53-evk.dts18
-rw-r--r--arch/arm/boot/dts/imx53-mba53.dts82
-rw-r--r--arch/arm/boot/dts/imx53-pinfunc.h1189
-rw-r--r--arch/arm/boot/dts/imx53-qsb.dts22
-rw-r--r--arch/arm/boot/dts/imx53-smd.dts16
-rw-r--r--arch/arm/boot/dts/imx53-tqma53.dtsi32
-rw-r--r--arch/arm/boot/dts/imx53.dtsi256
-rw-r--r--arch/arm/boot/dts/imx6dl-pinfunc.h1085
-rw-r--r--arch/arm/boot/dts/imx6dl-sabreauto.dts31
-rw-r--r--arch/arm/boot/dts/imx6dl-sabresd.dts35
-rw-r--r--arch/arm/boot/dts/imx6dl-wandboard.dts44
-rw-r--r--arch/arm/boot/dts/imx6dl.dtsi125
-rw-r--r--arch/arm/boot/dts/imx6q-arm2.dts8
-rw-r--r--arch/arm/boot/dts/imx6q-pinfunc.h1041
-rw-r--r--arch/arm/boot/dts/imx6q-sabreauto.dts33
-rw-r--r--arch/arm/boot/dts/imx6q-sabrelite.dts18
-rw-r--r--arch/arm/boot/dts/imx6q-sabresd.dts67
-rw-r--r--arch/arm/boot/dts/imx6q-sbc6x.dts44
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi280
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabreauto.dtsi38
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi87
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi33
-rw-r--r--arch/arm/boot/dts/imx6sl-pinfunc.h1077
l---------arch/arm/boot/dts/include/dt-bindings1
-rw-r--r--arch/arm/boot/dts/kirkwood-6282.dtsi6
-rw-r--r--arch/arm/boot/dts/kirkwood-cloudbox.dts89
-rw-r--r--arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts4
-rw-r--r--arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts180
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2mini.dts1
-rw-r--r--arch/arm/boot/dts/mmp2.dtsi2
-rw-r--r--arch/arm/boot/dts/mpa1600.dts69
-rw-r--r--arch/arm/boot/dts/msm8660-surf.dts26
-rw-r--r--arch/arm/boot/dts/msm8960-cdp.dts28
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts71
-rw-r--r--arch/arm/boot/dts/omap3.dtsi31
-rw-r--r--arch/arm/boot/dts/omap4.dtsi30
-rw-r--r--arch/arm/boot/dts/orion5x.dtsi33
-rw-r--r--arch/arm/boot/dts/pxa168.dtsi2
-rw-r--r--arch/arm/boot/dts/pxa910.dtsi2
-rw-r--r--arch/arm/boot/dts/r8a7779-marzen-reference.dts47
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi98
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi1031
-rw-r--r--arch/arm/boot/dts/sama5d31ek.dts51
-rw-r--r--arch/arm/boot/dts/sama5d33ek.dts44
-rw-r--r--arch/arm/boot/dts/sama5d34ek.dts61
-rw-r--r--arch/arm/boot/dts/sama5d35ek.dts56
-rw-r--r--arch/arm/boot/dts/sama5d3xcm.dtsi91
-rw-r--r--arch/arm/boot/dts/sama5d3xdm.dtsi42
-rw-r--r--arch/arm/boot/dts/sama5d3xmb.dtsi166
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts66
-rw-r--r--arch/arm/boot/dts/sh73a0-reference.dtsi24
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi44
-rw-r--r--arch/arm/boot/dts/skeleton64.dtsi13
-rw-r--r--arch/arm/boot/dts/snowball.dts4
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi157
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5.dts8
-rw-r--r--arch/arm/boot/dts/socfpga_vt.dts8
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi4
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi4
-rw-r--r--arch/arm/boot/dts/spear310.dtsi4
-rw-r--r--arch/arm/boot/dts/spear320.dtsi4
-rw-r--r--arch/arm/boot/dts/stuib.dtsi2
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts32
-rw-r--r--arch/arm/boot/dts/sun4i-a10-hackberry.dts6
-rw-r--r--arch/arm/boot/dts/sun4i-a10-mini-xplus.dts32
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi253
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino.dts24
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi193
-rw-r--r--arch/arm/boot/dts/sunxi.dtsi82
-rw-r--r--arch/arm/boot/dts/tegra114-dalmore.dts14
-rw-r--r--arch/arm/boot/dts/tegra114-pluto.dts14
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi12
-rw-r--r--arch/arm/boot/dts/tegra20-colibri-512.dtsi15
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts17
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts15
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts15
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi15
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts15
-rw-r--r--arch/arm/boot/dts/tegra20-ventana.dts15
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts14
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi4
-rw-r--r--arch/arm/boot/dts/tegra30-beaver.dts15
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi15
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi6
-rw-r--r--arch/arm/boot/dts/tps6507x.dtsi47
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts2
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts2
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca5s.dts2
-rw-r--r--arch/arm/boot/dts/vt8500-bv07.dts34
-rw-r--r--arch/arm/boot/dts/vt8500.dtsi14
-rw-r--r--arch/arm/boot/dts/wm8505-ref.dts34
-rw-r--r--arch/arm/boot/dts/wm8505.dtsi45
-rw-r--r--arch/arm/boot/dts/wm8650-mid.dts36
-rw-r--r--arch/arm/boot/dts/wm8650.dtsi14
-rw-r--r--arch/arm/boot/dts/wm8850-w70v2.dts40
-rw-r--r--arch/arm/boot/dts/wm8850.dtsi14
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi52
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts10
-rw-r--r--arch/arm/common/Makefile5
-rw-r--r--arch/arm/common/firmware.c18
-rw-r--r--arch/arm/common/mcpm_entry.c263
-rw-r--r--arch/arm/common/mcpm_head.S219
-rw-r--r--arch/arm/common/mcpm_platsmp.c92
-rw-r--r--arch/arm/common/vlock.S108
-rw-r--r--arch/arm/common/vlock.h29
-rw-r--r--arch/arm/configs/ape6evm_defconfig95
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig8
-rw-r--r--arch/arm/configs/at91_dt_defconfig2
-rw-r--r--arch/arm/configs/at91sam9260_defconfig2
-rw-r--r--arch/arm/configs/at91sam9g20_defconfig2
-rw-r--r--arch/arm/configs/at91sam9g45_defconfig3
-rw-r--r--arch/arm/configs/bcm2835_defconfig11
-rw-r--r--arch/arm/configs/cns3420vb_defconfig3
-rw-r--r--arch/arm/configs/da8xx_omapl_defconfig1
-rw-r--r--arch/arm/configs/davinci_all_defconfig1
-rw-r--r--arch/arm/configs/dove_defconfig2
-rw-r--r--arch/arm/configs/h7201_defconfig27
-rw-r--r--arch/arm/configs/h7202_defconfig47
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig1
-rw-r--r--arch/arm/configs/kirkwood_defconfig56
-rw-r--r--arch/arm/configs/kzm9g_defconfig2
-rw-r--r--arch/arm/configs/lpc32xx_defconfig22
-rw-r--r--arch/arm/configs/mackerel_defconfig4
-rw-r--r--arch/arm/configs/marzen_defconfig8
-rw-r--r--arch/arm/configs/msm_defconfig155
-rw-r--r--arch/arm/configs/multi_v7_defconfig23
-rw-r--r--arch/arm/configs/mvebu_defconfig9
-rw-r--r--arch/arm/configs/mxs_defconfig8
-rw-r--r--arch/arm/configs/nhk8815_defconfig42
-rw-r--r--arch/arm/configs/omap1_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/arm/configs/sama5_defconfig181
-rw-r--r--arch/arm/configs/spear3xx_defconfig2
-rw-r--r--arch/arm/configs/spear6xx_defconfig1
-rw-r--r--arch/arm/configs/tegra_defconfig18
-rw-r--r--arch/arm/configs/u8500_defconfig4
-rw-r--r--arch/arm/include/asm/atomic.h24
-rw-r--r--arch/arm/include/asm/cacheflush.h75
-rw-r--r--arch/arm/include/asm/cp15.h16
-rw-r--r--arch/arm/include/asm/cputype.h61
-rw-r--r--arch/arm/include/asm/firmware.h66
-rw-r--r--arch/arm/include/asm/glue-df.h20
-rw-r--r--arch/arm/include/asm/idmap.h1
-rw-r--r--arch/arm/include/asm/irq.h5
-rw-r--r--arch/arm/include/asm/kvm_arm.h4
-rw-r--r--arch/arm/include/asm/kvm_asm.h2
-rw-r--r--arch/arm/include/asm/kvm_emulate.h107
-rw-r--r--arch/arm/include/asm/kvm_host.h57
-rw-r--r--arch/arm/include/asm/kvm_mmu.h87
-rw-r--r--arch/arm/include/asm/kvm_vgic.h1
-rw-r--r--arch/arm/include/asm/mach/irq.h36
-rw-r--r--arch/arm/include/asm/mach/pci.h11
-rw-r--r--arch/arm/include/asm/mcpm.h209
-rw-r--r--arch/arm/include/asm/pgtable.h9
-rw-r--r--arch/arm/include/asm/smp_twd.h8
-rw-r--r--arch/arm/include/asm/system_misc.h3
-rw-r--r--arch/arm/include/asm/thread_info.h1
-rw-r--r--arch/arm/include/asm/tlbflush.h2
-rw-r--r--arch/arm/include/asm/unistd.h8
-rw-r--r--arch/arm/include/debug/bcm2835.S (renamed from arch/arm/mach-bcm2835/include/mach/debug-macro.S)3
-rw-r--r--arch/arm/include/debug/cns3xxx.S (renamed from arch/arm/mach-cns3xxx/include/mach/debug-macro.S)0
-rw-r--r--arch/arm/include/debug/exynos.S (renamed from arch/arm/mach-exynos/include/mach/debug-macro.S)12
-rw-r--r--arch/arm/include/debug/mxs.S (renamed from arch/arm/mach-mxs/include/mach/debug-macro.S)9
-rw-r--r--arch/arm/include/debug/nomadik.S (renamed from arch/arm/mach-nomadik/include/mach/debug-macro.S)0
-rw-r--r--arch/arm/include/debug/pxa.S33
-rw-r--r--arch/arm/include/debug/samsung.S (renamed from arch/arm/plat-samsung/include/plat/debug-macro.S)0
-rw-r--r--arch/arm/include/debug/sirf.S (renamed from arch/arm/mach-prima2/include/mach/uart.h)29
-rw-r--r--arch/arm/include/debug/uncompress.h7
-rw-r--r--arch/arm/include/debug/ux500.S48
-rw-r--r--arch/arm/include/uapi/asm/kvm.h12
-rw-r--r--arch/arm/kernel/asm-offsets.c14
-rw-r--r--arch/arm/kernel/atags_proc.c28
-rw-r--r--arch/arm/kernel/bios32.c6
-rw-r--r--arch/arm/kernel/early_printk.c17
-rw-r--r--arch/arm/kernel/entry-armv.S59
-rw-r--r--arch/arm/kernel/entry-common.S8
-rw-r--r--arch/arm/kernel/entry-header.S66
-rw-r--r--arch/arm/kernel/etm.c2
-rw-r--r--arch/arm/kernel/head-common.S9
-rw-r--r--arch/arm/kernel/head-nommu.S8
-rw-r--r--arch/arm/kernel/irq.c6
-rw-r--r--arch/arm/kernel/process.c121
-rw-r--r--arch/arm/kernel/return_address.c5
-rw-r--r--arch/arm/kernel/setup.c4
-rw-r--r--arch/arm/kernel/smp.c44
-rw-r--r--arch/arm/kernel/smp_scu.c2
-rw-r--r--arch/arm/kernel/smp_tlb.c9
-rw-r--r--arch/arm/kernel/smp_twd.c17
-rw-r--r--arch/arm/kernel/swp_emulate.c43
-rw-r--r--arch/arm/kernel/topology.c2
-rw-r--r--arch/arm/kernel/traps.c7
-rw-r--r--arch/arm/kernel/vmlinux.lds.S7
-rw-r--r--arch/arm/kvm/Kconfig6
-rw-r--r--arch/arm/kvm/Makefile4
-rw-r--r--arch/arm/kvm/arch_timer.c7
-rw-r--r--arch/arm/kvm/arm.c315
-rw-r--r--arch/arm/kvm/coproc.c28
-rw-r--r--arch/arm/kvm/coproc.h4
-rw-r--r--arch/arm/kvm/emulate.c75
-rw-r--r--arch/arm/kvm/guest.c17
-rw-r--r--arch/arm/kvm/handle_exit.c164
-rw-r--r--arch/arm/kvm/init.S78
-rw-r--r--arch/arm/kvm/interrupts.S13
-rw-r--r--arch/arm/kvm/mmio.c46
-rw-r--r--arch/arm/kvm/mmu.c543
-rw-r--r--arch/arm/kvm/perf.c68
-rw-r--r--arch/arm/kvm/vgic.c2
-rw-r--r--arch/arm/mach-at91/Kconfig453
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt399
-rw-r--r--arch/arm/mach-at91/Makefile11
-rw-r--r--arch/arm/mach-at91/at91_rstc.h2
-rw-r--r--arch/arm/mach-at91/at91_shdwc.h2
-rw-r--r--arch/arm/mach-at91/at91rm9200.c3
-rw-r--r--arch/arm/mach-at91/at91sam9260.c4
-rw-r--r--arch/arm/mach-at91/at91sam9261.c4
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9263.c3
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c6
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c20
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c3
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c4
-rw-r--r--arch/arm/mach-at91/at91x40_time.c2
-rw-r--r--arch/arm/mach-at91/board-dt-rm9200.c (renamed from arch/arm/mach-at91/board-rm9200-dt.c)0
-rw-r--r--arch/arm/mach-at91/board-dt-sam9.c (renamed from arch/arm/mach-at91/board-dt.c)0
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c86
-rw-r--r--arch/arm/mach-at91/clock.c109
-rw-r--r--arch/arm/mach-at91/clock.h2
-rw-r--r--arch/arm/mach-at91/cpuidle.c18
-rw-r--r--arch/arm/mach-at91/gpio.c3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_dbgu.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_matrix.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h18
-rw-r--r--arch/arm/mach-at91/include/mach/at91_st.h2
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h20
-rw-r--r--arch/arm/mach-at91/include/mach/sama5d3.h73
-rw-r--r--arch/arm/mach-at91/sama5d3.c377
-rw-r--r--arch/arm/mach-at91/setup.c35
-rw-r--r--arch/arm/mach-at91/soc.h7
-rw-r--r--arch/arm/mach-bcm/Kconfig1
-rw-r--r--arch/arm/mach-bcm/Makefile4
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.c118
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.h80
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc_asm.S41
-rw-r--r--arch/arm/mach-bcm/board_bcm.c26
-rw-r--r--arch/arm/mach-bcm2835/Kconfig15
-rw-r--r--arch/arm/mach-bcm2835/Makefile.boot1
-rw-r--r--arch/arm/mach-bcm2835/bcm2835.c6
-rw-r--r--arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h29
-rw-r--r--arch/arm/mach-bcm2835/include/mach/gpio.h1
-rw-r--r--arch/arm/mach-bcm2835/include/mach/timex.h26
-rw-r--r--arch/arm/mach-bcm2835/include/mach/uncompress.h44
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig12
-rw-r--r--arch/arm/mach-cns3xxx/Makefile8
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c6
-rw-r--r--arch/arm/mach-cns3xxx/cns3xxx.h (renamed from arch/arm/mach-cns3xxx/include/mach/cns3xxx.h)34
-rw-r--r--arch/arm/mach-cns3xxx/core.c131
-rw-r--r--arch/arm/mach-cns3xxx/devices.c5
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/irqs.h24
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/timex.h12
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/uncompress.h53
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c2
-rw-r--r--arch/arm/mach-cns3xxx/pm.c4
-rw-r--r--arch/arm/mach-cns3xxx/pm.h (renamed from arch/arm/mach-cns3xxx/include/mach/pm.h)0
-rw-r--r--arch/arm/mach-davinci/Makefile1
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c7
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c19
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c72
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c167
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c34
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c9
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c16
-rw-r--r--arch/arm/mach-davinci/board-omapl138-hawk.c7
-rw-r--r--arch/arm/mach-davinci/board-tnetv107x-evm.c1
-rw-r--r--arch/arm/mach-davinci/clock.c21
-rw-r--r--arch/arm/mach-davinci/clock.h2
-rw-r--r--arch/arm/mach-davinci/cpufreq.c248
-rw-r--r--arch/arm/mach-davinci/cpuidle.c29
-rw-r--r--arch/arm/mach-davinci/da830.c2
-rw-r--r--arch/arm/mach-davinci/da850.c50
-rw-r--r--arch/arm/mach-davinci/da8xx-dt.c5
-rw-r--r--arch/arm/mach-davinci/davinci.h11
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c92
-rw-r--r--arch/arm/mach-davinci/devices-tnetv107x.c4
-rw-r--r--arch/arm/mach-davinci/devices.c8
-rw-r--r--arch/arm/mach-davinci/dm355.c178
-rw-r--r--arch/arm/mach-davinci/dm365.c199
-rw-r--r--arch/arm/mach-davinci/dm644x.c13
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h5
-rw-r--r--arch/arm/mach-davinci/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-davinci/pm.c1
-rw-r--r--arch/arm/mach-davinci/pm_domain.c2
-rw-r--r--arch/arm/mach-davinci/sram.c4
-rw-r--r--arch/arm/mach-davinci/tnetv107x.c4
-rw-r--r--arch/arm/mach-davinci/usb.c3
-rw-r--r--arch/arm/mach-exynos/Kconfig38
-rw-r--r--arch/arm/mach-exynos/Makefile12
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c1601
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.h35
-rw-r--r--arch/arm/mach-exynos/clock-exynos4210.c187
-rw-r--r--arch/arm/mach-exynos/clock-exynos4212.c201
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c1645
-rw-r--r--arch/arm/mach-exynos/common.c125
-rw-r--r--arch/arm/mach-exynos/common.h12
-rw-r--r--arch/arm/mach-exynos/cpuidle.c59
-rw-r--r--arch/arm/mach-exynos/dev-ohci.c2
-rw-r--r--arch/arm/mach-exynos/dev-uart.c1
-rw-r--r--arch/arm/mach-exynos/exynos-smc.S22
-rw-r--r--arch/arm/mach-exynos/firmware.c70
-rw-r--r--arch/arm/mach-exynos/hotplug.c1
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h24
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h4
-rw-r--r--arch/arm/mach-exynos/include/mach/pm-core.h9
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-mct.h53
-rw-r--r--arch/arm/mach-exynos/mach-armlex4210.c4
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c123
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c141
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c8
-rw-r--r--arch/arm/mach-exynos/mach-origen.c8
-rw-r--r--arch/arm/mach-exynos/mach-smdk4x12.c6
-rw-r--r--arch/arm/mach-exynos/mach-smdkv310.c10
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c36
-rw-r--r--arch/arm/mach-exynos/mct.c485
-rw-r--r--arch/arm/mach-exynos/platsmp.c40
-rw-r--r--arch/arm/mach-exynos/setup-sdhci-gpio.c2
-rw-r--r--arch/arm/mach-exynos/setup-usb-phy.c8
-rw-r--r--arch/arm/mach-exynos/smc.h31
-rw-r--r--arch/arm/mach-gemini/Makefile2
-rw-r--r--arch/arm/mach-gemini/board-nas4220b.c1
-rw-r--r--arch/arm/mach-gemini/board-rut1xx.c2
-rw-r--r--arch/arm/mach-gemini/board-wbd111.c1
-rw-r--r--arch/arm/mach-gemini/board-wbd222.c1
-rw-r--r--arch/arm/mach-gemini/common.h2
-rw-r--r--arch/arm/mach-gemini/gpio.c19
-rw-r--r--arch/arm/mach-gemini/idle.c4
-rw-r--r--arch/arm/mach-gemini/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-gemini/irq.c8
-rw-r--r--arch/arm/mach-gemini/mm.c22
-rw-r--r--arch/arm/mach-gemini/reset.c (renamed from arch/arm/mach-gemini/include/mach/system.h)2
-rw-r--r--arch/arm/mach-h720x/Kconfig40
-rw-r--r--arch/arm/mach-h720x/Makefile16
-rw-r--r--arch/arm/mach-h720x/Makefile.boot2
-rw-r--r--arch/arm/mach-h720x/common.c268
-rw-r--r--arch/arm/mach-h720x/common.h30
-rw-r--r--arch/arm/mach-h720x/cpu-h7201.c57
-rw-r--r--arch/arm/mach-h720x/cpu-h7202.c225
-rw-r--r--arch/arm/mach-h720x/h7201-eval.c38
-rw-r--r--arch/arm/mach-h720x/h7202-eval.c81
-rw-r--r--arch/arm/mach-h720x/include/mach/boards.h53
-rw-r--r--arch/arm/mach-h720x/include/mach/debug-macro.S40
-rw-r--r--arch/arm/mach-h720x/include/mach/entry-macro.S57
-rw-r--r--arch/arm/mach-h720x/include/mach/h7201-regs.h67
-rw-r--r--arch/arm/mach-h720x/include/mach/h7202-regs.h155
-rw-r--r--arch/arm/mach-h720x/include/mach/hardware.h190
-rw-r--r--arch/arm/mach-h720x/include/mach/irqs.h116
-rw-r--r--arch/arm/mach-h720x/include/mach/isa-dma.h19
-rw-r--r--arch/arm/mach-h720x/include/mach/uncompress.h36
-rw-r--r--arch/arm/mach-highbank/Kconfig1
-rw-r--r--arch/arm/mach-highbank/highbank.c5
-rw-r--r--arch/arm/mach-highbank/hotplug.c1
-rw-r--r--arch/arm/mach-highbank/platsmp.c7
-rw-r--r--arch/arm/mach-imx/Kconfig25
-rw-r--r--arch/arm/mach-imx/Makefile5
-rw-r--r--arch/arm/mach-imx/Makefile.boot35
-rw-r--r--arch/arm/mach-imx/avic.c6
-rw-r--r--arch/arm/mach-imx/clk-busy.c4
-rw-r--r--arch/arm/mach-imx/clk-gate2.c1
-rw-r--r--arch/arm/mach-imx/clk-imx27.c13
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c9
-rw-r--r--arch/arm/mach-imx/clk-pllv1.c2
-rw-r--r--arch/arm/mach-imx/clk-pllv2.c2
-rw-r--r--arch/arm/mach-imx/clk.c1
-rw-r--r--arch/arm/mach-imx/common.h3
-rw-r--r--arch/arm/mach-imx/cpu-imx5.c1
-rw-r--r--arch/arm/mach-imx/cpu.c1
-rw-r--r--arch/arm/mach-imx/cpu_op-mx51.c31
-rw-r--r--arch/arm/mach-imx/cpu_op-mx51.h14
-rw-r--r--arch/arm/mach-imx/cpufreq.c206
-rw-r--r--arch/arm/mach-imx/cpuidle-imx5.c37
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6q.c26
-rw-r--r--arch/arm/mach-imx/cpuidle.c80
-rw-r--r--arch/arm/mach-imx/cpuidle.h10
-rw-r--r--arch/arm/mach-imx/devices/Kconfig4
-rw-r--r--arch/arm/mach-imx/devices/Makefile1
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h10
-rw-r--r--arch/arm/mach-imx/devices/devices.c2
-rw-r--r--arch/arm/mach-imx/devices/platform-ahci-imx.c157
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c4
-rw-r--r--arch/arm/mach-imx/gpc.c1
-rw-r--r--arch/arm/mach-imx/hardware.h1
-rw-r--r--arch/arm/mach-imx/hotplug.c2
-rw-r--r--arch/arm/mach-imx/imx27-dt.c22
-rw-r--r--arch/arm/mach-imx/imx51-dt.c3
-rw-r--r--arch/arm/mach-imx/iomux-imx31.c2
-rw-r--r--arch/arm/mach-imx/irq-common.c19
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c4
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c5
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c9
-rw-r--r--arch/arm/mach-imx/mach-mx51_babbage.c4
-rw-r--r--arch/arm/mach-imx/mm-imx3.c2
-rw-r--r--arch/arm/mach-imx/mm-imx5.c2
-rw-r--r--arch/arm/mach-imx/mx6q.h31
-rw-r--r--arch/arm/mach-imx/platsmp.c12
-rw-r--r--arch/arm/mach-imx/pm-imx5.c30
-rw-r--r--arch/arm/mach-imx/src.c5
-rw-r--r--arch/arm/mach-imx/tzic.c2
-rw-r--r--arch/arm/mach-integrator/Makefile1
-rw-r--r--arch/arm/mach-integrator/cpu.c224
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c6
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c7
-rw-r--r--arch/arm/mach-ixp4xx/common.c3
-rw-r--r--arch/arm/mach-kirkwood/Kconfig334
-rw-r--r--arch/arm/mach-kirkwood/Makefile42
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c18
-rw-r--r--arch/arm/mach-kirkwood/board-guruplug.c6
-rw-r--r--arch/arm/mach-kirkwood/board-ns2.c3
-rw-r--r--arch/arm/mach-kirkwood/board-readynas.c28
-rw-r--r--arch/arm/mach-kirkwood/common.h12
-rw-r--r--arch/arm/mach-l7200/include/mach/debug-macro.S38
-rw-r--r--arch/arm/mach-mmp/aspenite.c13
-rw-r--r--arch/arm/mach-mmp/avengers_lite.c7
-rw-r--r--arch/arm/mach-mmp/brownstone.c7
-rw-r--r--arch/arm/mach-mmp/clock-mmp2.c2
-rw-r--r--arch/arm/mach-mmp/clock-pxa168.c2
-rw-r--r--arch/arm/mach-mmp/clock-pxa910.c2
-rw-r--r--arch/arm/mach-mmp/flint.c7
-rw-r--r--arch/arm/mach-mmp/gplugd.c7
-rw-r--r--arch/arm/mach-mmp/include/mach/debug-macro.S30
-rw-r--r--arch/arm/mach-mmp/jasper.c8
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c4
-rw-r--r--arch/arm/mach-mmp/mmp2-dt.c2
-rw-r--r--arch/arm/mach-mmp/mmp2.c2
-rw-r--r--arch/arm/mach-mmp/pxa168.c2
-rw-r--r--arch/arm/mach-mmp/pxa910.c2
-rw-r--r--arch/arm/mach-mmp/tavorevb.c7
-rw-r--r--arch/arm/mach-mmp/teton_bga.c7
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c13
-rw-r--r--arch/arm/mach-msm/Kconfig7
-rw-r--r--arch/arm/mach-msm/board-halibut.c1
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c1
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c1
-rw-r--r--arch/arm/mach-msm/board-trout.c1
-rw-r--r--arch/arm/mach-msm/devices-msm7x00.c31
-rw-r--r--arch/arm/mach-msm/devices-msm7x30.c31
-rw-r--r--arch/arm/mach-msm/devices-qsd8x50.c31
-rw-r--r--arch/arm/mach-msm/devices.h4
-rw-r--r--arch/arm/mach-msm/dma.c26
-rw-r--r--arch/arm/mach-msm/hotplug.c4
-rw-r--r--arch/arm/mach-msm/include/mach/cpu.h54
-rw-r--r--arch/arm/mach-msm/include/mach/dma.h26
-rw-r--r--arch/arm/mach-msm/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-msm/last_radio_log.c20
-rw-r--r--arch/arm/mach-msm/platsmp.c8
-rw-r--r--arch/arm/mach-msm/timer.c110
-rw-r--r--arch/arm/mach-mvebu/irq-armada-370-xp.c2
-rw-r--r--arch/arm/mach-mxs/Kconfig24
-rw-r--r--arch/arm/mach-mxs/Makefile6
-rw-r--r--arch/arm/mach-mxs/Makefile.boot1
-rw-r--r--arch/arm/mach-mxs/icoll.c125
-rw-r--r--arch/arm/mach-mxs/include/mach/common.h29
-rw-r--r--arch/arm/mach-mxs/include/mach/digctl.h22
-rw-r--r--arch/arm/mach-mxs/include/mach/hardware.h23
-rw-r--r--arch/arm/mach-mxs/include/mach/mx23.h169
-rw-r--r--arch/arm/mach-mxs/include/mach/mx28.h225
-rw-r--r--arch/arm/mach-mxs/include/mach/mxs.h117
-rw-r--r--arch/arm/mach-mxs/include/mach/timex.h21
-rw-r--r--arch/arm/mach-mxs/include/mach/uncompress.h76
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c188
-rw-r--r--arch/arm/mach-mxs/mm.c52
-rw-r--r--arch/arm/mach-mxs/ocotp.c93
-rw-r--r--arch/arm/mach-mxs/pm.c4
-rw-r--r--arch/arm/mach-mxs/pm.h (renamed from arch/arm/mach-h720x/include/mach/timex.h)9
-rw-r--r--arch/arm/mach-mxs/system.c139
-rw-r--r--arch/arm/mach-mxs/timer.c306
-rw-r--r--arch/arm/mach-nomadik/Kconfig25
-rw-r--r--arch/arm/mach-nomadik/Makefile.boot4
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c1
-rw-r--r--arch/arm/mach-nomadik/include/mach/irqs.h79
-rw-r--r--arch/arm/mach-nomadik/include/mach/timex.h6
-rw-r--r--arch/arm/mach-nomadik/include/mach/uncompress.h60
-rw-r--r--arch/arm/mach-omap1/Kconfig6
-rw-r--r--arch/arm/mach-omap1/dma.h41
-rw-r--r--arch/arm/mach-omap1/include/mach/usb.h2
-rw-r--r--arch/arm/mach-omap1/pm.c84
-rw-r--r--arch/arm/mach-omap1/usb.c6
-rw-r--r--arch/arm/mach-omap2/Kconfig12
-rw-r--r--arch/arm/mach-omap2/Makefile3
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c4
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c23
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c21
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c6
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c24
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c20
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c23
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c22
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c11
-rw-r--r--arch/arm/mach-omap2/board-generic.c2
-rw-r--r--arch/arm/mach-omap2/board-h4.c4
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c34
-rw-r--r--arch/arm/mach-omap2/board-ldp.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c36
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c27
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c21
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c20
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c17
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c55
-rw-r--r--arch/arm/mach-omap2/board-overo.c19
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c4
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c56
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c53
-rw-r--r--arch/arm/mach-omap2/board-zoom.c16
-rw-r--r--arch/arm/mach-omap2/cclock2420_data.c283
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c313
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c181
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c687
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c517
-rw-r--r--arch/arm/mach-omap2/clock.c19
-rw-r--r--arch/arm/mach-omap2/clock.h20
-rw-r--r--arch/arm/mach-omap2/common.h16
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c55
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c92
-rw-r--r--arch/arm/mach-omap2/devices.c149
-rw-r--r--arch/arm/mach-omap2/dma.h70
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c30
-rw-r--r--arch/arm/mach-omap2/dsp.c4
-rw-r--r--arch/arm/mach-omap2/dss-common.c4
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c42
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c122
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c30
-rw-r--r--arch/arm/mach-omap2/gpmc.c548
-rw-r--r--arch/arm/mach-omap2/gpmc.h43
-rw-r--r--arch/arm/mach-omap2/id.c111
-rw-r--r--arch/arm/mach-omap2/io.c43
-rw-r--r--arch/arm/mach-omap2/omap-hotplug.c6
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c14
-rw-r--r--arch/arm/mach-omap2/omap-smp.c78
-rw-r--r--arch/arm/mach-omap2/omap4-common.c26
-rw-r--r--arch/arm/mach-omap2/omap4-sar-layout.h28
-rw-r--r--arch/arm/mach-omap2/omap54xx.h1
-rw-r--r--arch/arm/mach-omap2/omap_device.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c15
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c36
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c81
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c107
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c172
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h4
-rw-r--r--arch/arm/mach-omap2/pm-debug.c6
-rw-r--r--arch/arm/mach-omap2/pm.c14
-rw-r--r--arch/arm/mach-omap2/pm24xx.c11
-rw-r--r--arch/arm/mach-omap2/pm34xx.c9
-rw-r--r--arch/arm/mach-omap2/pm44xx.c24
-rw-r--r--arch/arm/mach-omap2/powerdomain.c20
-rw-r--r--arch/arm/mach-omap2/prm44xx.c6
-rw-r--r--arch/arm/mach-omap2/soc.h2
-rw-r--r--arch/arm/mach-omap2/timer.c129
-rw-r--r--arch/arm/mach-omap2/usb-host.c160
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c62
-rw-r--r--arch/arm/mach-omap2/usb.h9
-rw-r--r--arch/arm/mach-orion5x/board-dt.c3
-rw-r--r--arch/arm/mach-orion5x/common.c3
-rw-r--r--arch/arm/mach-orion5x/pci.c7
-rw-r--r--arch/arm/mach-prima2/Kconfig23
-rw-r--r--arch/arm/mach-prima2/Makefile5
-rw-r--r--arch/arm/mach-prima2/common.c37
-rw-r--r--arch/arm/mach-prima2/common.h4
-rw-r--r--arch/arm/mach-prima2/hotplug.c3
-rw-r--r--arch/arm/mach-prima2/include/mach/clkdev.h15
-rw-r--r--arch/arm/mach-prima2/include/mach/debug-macro.S29
-rw-r--r--arch/arm/mach-prima2/include/mach/entry-macro.S22
-rw-r--r--arch/arm/mach-prima2/include/mach/hardware.h15
-rw-r--r--arch/arm/mach-prima2/include/mach/irqs.h17
-rw-r--r--arch/arm/mach-prima2/include/mach/map.h18
-rw-r--r--arch/arm/mach-prima2/include/mach/timex.h14
-rw-r--r--arch/arm/mach-prima2/include/mach/uncompress.h41
-rw-r--r--arch/arm/mach-prima2/irq.c129
-rw-r--r--arch/arm/mach-prima2/lluart.c14
-rw-r--r--arch/arm/mach-prima2/platsmp.c9
-rw-r--r--arch/arm/mach-prima2/timer-marco.c316
-rw-r--r--arch/arm/mach-prima2/timer-prima2.c241
-rw-r--r--arch/arm/mach-pxa/Kconfig2
-rw-r--r--arch/arm/mach-pxa/Makefile6
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa2xx.c494
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa3xx.c258
-rw-r--r--arch/arm/mach-pxa/devices.c29
-rw-r--r--arch/arm/mach-pxa/devices.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/debug-macro.S23
-rw-r--r--arch/arm/mach-pxa/include/mach/generic.h1
-rw-r--r--arch/arm/mach-pxa/pxa25x.c11
-rw-r--r--arch/arm/mach-pxa/pxa27x.c7
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c23
-rw-r--r--arch/arm/mach-pxa/pxa930.c17
-rw-r--r--arch/arm/mach-realview/Kconfig8
-rw-r--r--arch/arm/mach-realview/hotplug.c2
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig29
-rw-r--r--arch/arm/mach-s3c24xx/Makefile8
-rw-r--r--arch/arm/mach-s3c24xx/bast-irq.c2
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2412.c1
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2440.c5
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/common-smdk.c3
-rw-r--r--arch/arm/mach-s3c24xx/common-smdk.h (renamed from arch/arm/plat-samsung/include/plat/common-smdk.h)3
-rw-r--r--arch/arm/mach-s3c24xx/common.c12
-rw-r--r--arch/arm/mach-s3c24xx/common.h94
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq.c8
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2410.c3
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2412.c3
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2440.c3
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2443.c3
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/dma.h1
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/entry-macro.S70
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/irqs.h58
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-sdi.h127
-rw-r--r--arch/arm/mach-s3c24xx/irq-pm.c7
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2412.c215
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2440.c128
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c244x.c142
-rw-r--r--arch/arm/mach-s3c24xx/irq.c822
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c7
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c12
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c8
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c11
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c8
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-otom.c7
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c8
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c7
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx3715.c11
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2410.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c19
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c8
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2440.c11
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-tct_hammer.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-vr1000.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c9
-rw-r--r--arch/arm/mach-s3c24xx/pm-s3c2412.c9
-rw-r--r--arch/arm/mach-s3c24xx/regs-dsc.h203
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2440.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2442.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c2
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig5
-rw-r--r--arch/arm/mach-s3c64xx/Makefile1
-rw-r--r--arch/arm/mach-s3c64xx/cpuidle.c15
-rw-r--r--arch/arm/mach-s3c64xx/dma.c1
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/dma.h1
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410-module.c5
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-hmt.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-ncp.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-real6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq5.c3
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq7.c3
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6400.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/setup-usb-phy.c4
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig4
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c6
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c6
-rw-r--r--arch/arm/mach-s5pc100/Kconfig1
-rw-r--r--arch/arm/mach-s5pc100/common.h9
-rw-r--r--arch/arm/mach-s5pc100/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c4
-rw-r--r--arch/arm/mach-s5pc100/setup-sdhci-gpio.c1
-rw-r--r--arch/arm/mach-s5pv210/Kconfig2
-rw-r--r--arch/arm/mach-s5pv210/common.h9
-rw-r--r--arch/arm/mach-s5pv210/include/mach/debug-macro.S2
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c6
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c6
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c6
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c6
-rw-r--r--arch/arm/mach-s5pv210/mach-torbreck.c6
-rw-r--r--arch/arm/mach-s5pv210/setup-sdhci-gpio.c1
-rw-r--r--arch/arm/mach-s5pv210/setup-usb-phy.c4
-rw-r--r--arch/arm/mach-sa1100/Kconfig26
-rw-r--r--arch/arm/mach-sa1100/Makefile3
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c249
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1110.c408
-rw-r--r--arch/arm/mach-sa1100/include/mach/generic.h1
-rw-r--r--arch/arm/mach-shark/core.c3
-rw-r--r--arch/arm/mach-shmobile/Kconfig29
-rw-r--r--arch/arm/mach-shmobile/Makefile9
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c172
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c91
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c313
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c52
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c208
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c107
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c252
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c116
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c75
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c87
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c13
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c8
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c7
-rw-r--r--arch/arm/mach-shmobile/cpuidle.c23
-rw-r--r--arch/arm/mach-shmobile/headsmp-scu.S (renamed from arch/arm/mach-shmobile/headsmp-sh73a0.S)15
-rw-r--r--arch/arm/mach-shmobile/hotplug.c68
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h25
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7740.h74
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h324
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h29
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h363
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7779.c78
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c125
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c6
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c4
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c104
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c162
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c93
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c136
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c51
-rw-r--r--arch/arm/mach-shmobile/suspend.c6
-rw-r--r--arch/arm/mach-socfpga/core.h11
-rw-r--r--arch/arm/mach-socfpga/platsmp.c15
-rw-r--r--arch/arm/mach-socfpga/socfpga.c16
-rw-r--r--arch/arm/mach-spear/Kconfig105
-rw-r--r--arch/arm/mach-spear/Makefile26
-rw-r--r--arch/arm/mach-spear/Makefile.boot (renamed from arch/arm/mach-spear13xx/Makefile.boot)0
-rw-r--r--arch/arm/mach-spear/generic.h (renamed from arch/arm/mach-spear13xx/include/mach/generic.h)30
-rw-r--r--arch/arm/mach-spear/headsmp.S (renamed from arch/arm/mach-spear13xx/headsmp.S)0
-rw-r--r--arch/arm/mach-spear/hotplug.c (renamed from arch/arm/mach-spear13xx/hotplug.c)2
-rw-r--r--arch/arm/mach-spear/include/mach/debug-macro.S (renamed from arch/arm/plat-spear/include/plat/debug-macro.S)0
-rw-r--r--arch/arm/mach-spear/include/mach/irqs.h (renamed from arch/arm/mach-spear6xx/include/mach/irqs.h)22
-rw-r--r--arch/arm/mach-spear/include/mach/misc_regs.h (renamed from arch/arm/mach-spear3xx/include/mach/misc_regs.h)2
-rw-r--r--arch/arm/mach-spear/include/mach/spear.h95
-rw-r--r--arch/arm/mach-spear/include/mach/timex.h (renamed from arch/arm/plat-spear/include/plat/timex.h)0
-rw-r--r--arch/arm/mach-spear/include/mach/uncompress.h (renamed from arch/arm/plat-spear/include/plat/uncompress.h)0
-rw-r--r--arch/arm/mach-spear/pl080.c (renamed from arch/arm/plat-spear/pl080.c)0
-rw-r--r--arch/arm/mach-spear/pl080.h (renamed from arch/arm/plat-spear/include/plat/pl080.h)0
-rw-r--r--arch/arm/mach-spear/platsmp.c (renamed from arch/arm/mach-spear13xx/platsmp.c)10
-rw-r--r--arch/arm/mach-spear/restart.c (renamed from arch/arm/plat-spear/restart.c)5
-rw-r--r--arch/arm/mach-spear/spear1310.c (renamed from arch/arm/mach-spear13xx/spear1310.c)4
-rw-r--r--arch/arm/mach-spear/spear1340.c (renamed from arch/arm/mach-spear13xx/spear1340.c)5
-rw-r--r--arch/arm/mach-spear/spear13xx-dma.h (renamed from arch/arm/mach-spear13xx/include/mach/dma.h)0
-rw-r--r--arch/arm/mach-spear/spear13xx.c (renamed from arch/arm/mach-spear13xx/spear13xx.c)13
-rw-r--r--arch/arm/mach-spear/spear300.c (renamed from arch/arm/mach-spear3xx/spear300.c)4
-rw-r--r--arch/arm/mach-spear/spear310.c (renamed from arch/arm/mach-spear3xx/spear310.c)4
-rw-r--r--arch/arm/mach-spear/spear320.c (renamed from arch/arm/mach-spear3xx/spear320.c)7
-rw-r--r--arch/arm/mach-spear/spear3xx.c (renamed from arch/arm/mach-spear3xx/spear3xx.c)17
-rw-r--r--arch/arm/mach-spear/spear6xx.c (renamed from arch/arm/mach-spear6xx/spear6xx.c)25
-rw-r--r--arch/arm/mach-spear/time.c (renamed from arch/arm/plat-spear/time.c)2
-rw-r--r--arch/arm/mach-spear13xx/Kconfig20
-rw-r--r--arch/arm/mach-spear13xx/Makefile10
-rw-r--r--arch/arm/mach-spear13xx/include/mach/debug-macro.S14
-rw-r--r--arch/arm/mach-spear13xx/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-spear13xx/include/mach/irqs.h20
-rw-r--r--arch/arm/mach-spear13xx/include/mach/spear.h54
-rw-r--r--arch/arm/mach-spear13xx/include/mach/timex.h19
-rw-r--r--arch/arm/mach-spear13xx/include/mach/uncompress.h19
-rw-r--r--arch/arm/mach-spear3xx/Kconfig26
-rw-r--r--arch/arm/mach-spear3xx/Makefile15
-rw-r--r--arch/arm/mach-spear3xx/Makefile.boot3
-rw-r--r--arch/arm/mach-spear3xx/include/mach/debug-macro.S14
-rw-r--r--arch/arm/mach-spear3xx/include/mach/generic.h36
-rw-r--r--arch/arm/mach-spear3xx/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-spear3xx/include/mach/irqs.h19
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear.h60
-rw-r--r--arch/arm/mach-spear3xx/include/mach/timex.h19
-rw-r--r--arch/arm/mach-spear3xx/include/mach/uncompress.h19
-rw-r--r--arch/arm/mach-spear6xx/Kconfig10
-rw-r--r--arch/arm/mach-spear6xx/Makefile6
-rw-r--r--arch/arm/mach-spear6xx/Makefile.boot3
-rw-r--r--arch/arm/mach-spear6xx/include/mach/debug-macro.S14
-rw-r--r--arch/arm/mach-spear6xx/include/mach/generic.h23
-rw-r--r--arch/arm/mach-spear6xx/include/mach/hardware.h1
-rw-r--r--arch/arm/mach-spear6xx/include/mach/misc_regs.h22
-rw-r--r--arch/arm/mach-spear6xx/include/mach/spear.h46
-rw-r--r--arch/arm/mach-spear6xx/include/mach/timex.h19
-rw-r--r--arch/arm/mach-spear6xx/include/mach/uncompress.h19
-rw-r--r--arch/arm/mach-sunxi/Kconfig5
-rw-r--r--arch/arm/mach-sunxi/sunxi.c74
-rw-r--r--arch/arm/mach-tegra/Kconfig37
-rw-r--r--arch/arm/mach-tegra/Makefile8
-rw-r--r--arch/arm/mach-tegra/Makefile.boot3
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra114.c46
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra30.c60
-rw-r--r--arch/arm/mach-tegra/board-harmony-pcie.c13
-rw-r--r--arch/arm/mach-tegra/board.h5
-rw-r--r--arch/arm/mach-tegra/common.c33
-rw-r--r--arch/arm/mach-tegra/common.h1
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c293
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra114.c28
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c78
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra30.c39
-rw-r--r--arch/arm/mach-tegra/fuse.c4
-rw-r--r--arch/arm/mach-tegra/fuse.h7
-rw-r--r--arch/arm/mach-tegra/headsmp.S3
-rw-r--r--arch/arm/mach-tegra/hotplug.c33
-rw-r--r--arch/arm/mach-tegra/include/mach/powergate.h54
-rw-r--r--arch/arm/mach-tegra/include/mach/timex.h26
-rw-r--r--arch/arm/mach-tegra/include/mach/uncompress.h175
-rw-r--r--arch/arm/mach-tegra/irq.c96
-rw-r--r--arch/arm/mach-tegra/irq.h6
-rw-r--r--arch/arm/mach-tegra/pcie.c3
-rw-r--r--arch/arm/mach-tegra/platsmp.c128
-rw-r--r--arch/arm/mach-tegra/pm.c162
-rw-r--r--arch/arm/mach-tegra/pm.h17
-rw-r--r--arch/arm/mach-tegra/pmc.c310
-rw-r--r--arch/arm/mach-tegra/pmc.h18
-rw-r--r--arch/arm/mach-tegra/powergate.c7
-rw-r--r--arch/arm/mach-tegra/reset-handler.S49
-rw-r--r--arch/arm/mach-tegra/sleep-tegra20.S2
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S4
-rw-r--r--arch/arm/mach-tegra/sleep.h12
-rw-r--r--arch/arm/mach-tegra/tegra.c (renamed from arch/arm/mach-tegra/board-dt-tegra20.c)50
-rw-r--r--arch/arm/mach-tegra/tegra114_speedo.c104
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.c2
-rw-r--r--arch/arm/mach-u300/include/mach/u300-regs.h2
-rw-r--r--arch/arm/mach-ux500/Kconfig16
-rw-r--r--arch/arm/mach-ux500/Makefile4
-rw-r--r--arch/arm/mach-ux500/board-mop500-audio.c7
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c36
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c788
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.h8
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c55
-rw-r--r--arch/arm/mach-ux500/board-mop500-u8500uib.c9
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c1
-rw-r--r--arch/arm/mach-ux500/board-mop500.c116
-rw-r--r--arch/arm/mach-ux500/board-mop500.h4
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c6
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c13
-rw-r--r--arch/arm/mach-ux500/cpu.c38
-rw-r--r--arch/arm/mach-ux500/cpuidle.c63
-rw-r--r--arch/arm/mach-ux500/db8500-regs.h (renamed from arch/arm/mach-ux500/include/mach/db8500-regs.h)28
-rw-r--r--arch/arm/mach-ux500/devices-common.c3
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c8
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h3
-rw-r--r--arch/arm/mach-ux500/devices.c5
-rw-r--r--arch/arm/mach-ux500/devices.h (renamed from arch/arm/mach-ux500/include/mach/devices.h)0
-rw-r--r--arch/arm/mach-ux500/hotplug.c5
-rw-r--r--arch/arm/mach-ux500/id.c4
-rw-r--r--arch/arm/mach-ux500/include/mach/debug-macro.S39
-rw-r--r--arch/arm/mach-ux500/include/mach/hardware.h47
-rw-r--r--arch/arm/mach-ux500/include/mach/msp.h27
-rw-r--r--arch/arm/mach-ux500/include/mach/timex.h6
-rw-r--r--arch/arm/mach-ux500/include/mach/uncompress.h57
-rw-r--r--arch/arm/mach-ux500/irqs-board-mop500.h (renamed from arch/arm/mach-ux500/include/mach/irqs-board-mop500.h)0
-rw-r--r--arch/arm/mach-ux500/irqs-db8500.h (renamed from arch/arm/mach-ux500/include/mach/irqs-db8500.h)25
-rw-r--r--arch/arm/mach-ux500/irqs.h (renamed from arch/arm/mach-ux500/include/mach/irqs.h)6
-rw-r--r--arch/arm/mach-ux500/platsmp.c12
-rw-r--r--arch/arm/mach-ux500/pm.c167
-rw-r--r--arch/arm/mach-ux500/setup.h (renamed from arch/arm/mach-ux500/include/mach/setup.h)0
-rw-r--r--arch/arm/mach-ux500/timer.c9
-rw-r--r--arch/arm/mach-ux500/usb.c2
-rw-r--r--arch/arm/mach-vexpress/Kconfig5
-rw-r--r--arch/arm/mach-vexpress/Makefile2
-rw-r--r--arch/arm/mach-vexpress/hotplug.c2
-rw-r--r--arch/arm/mach-vexpress/reset.c141
-rw-r--r--arch/arm/mach-vexpress/v2m.c19
-rw-r--r--arch/arm/mach-virt/platsmp.c8
-rw-r--r--arch/arm/mach-vt8500/Kconfig1
-rw-r--r--arch/arm/mach-vt8500/Makefile2
-rw-r--r--arch/arm/mach-vt8500/common.h6
-rw-r--r--arch/arm/mach-vt8500/irq.c253
-rw-r--r--arch/arm/mach-vt8500/vt8500.c14
-rw-r--r--arch/arm/mach-w90x900/dev.c3
-rw-r--r--arch/arm/mach-zynq/Kconfig3
-rw-r--r--arch/arm/mach-zynq/Makefile2
-rw-r--r--arch/arm/mach-zynq/common.c3
-rw-r--r--arch/arm/mach-zynq/common.h2
-rw-r--r--arch/arm/mach-zynq/timer.c324
-rw-r--r--arch/arm/mm/Kconfig9
-rw-r--r--arch/arm/mm/alignment.c2
-rw-r--r--arch/arm/mm/dma-mapping.c15
-rw-r--r--arch/arm/mm/flush.c15
-rw-r--r--arch/arm/mm/idmap.c32
-rw-r--r--arch/arm/mm/init.c50
-rw-r--r--arch/arm/mm/mmu.c17
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/proc-v7-2level.S3
-rw-r--r--arch/arm/mm/proc-v7-3level.S3
-rw-r--r--arch/arm/mm/proc-v7.S7
-rw-r--r--arch/arm/plat-omap/dmtimer.c12
-rw-r--r--arch/arm/plat-orion/Makefile6
-rw-r--r--arch/arm/plat-orion/pcie.c10
-rw-r--r--arch/arm/plat-samsung/Kconfig20
-rw-r--r--arch/arm/plat-samsung/Makefile3
-rw-r--r--arch/arm/plat-samsung/devs.c64
-rw-r--r--arch/arm/plat-samsung/dma-ops.c10
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h15
-rw-r--r--arch/arm/plat-samsung/include/plat/dma-ops.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/dma-pl330.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/fb.h50
-rw-r--r--arch/arm/plat-samsung/include/plat/irq.h116
-rw-r--r--arch/arm/plat-samsung/include/plat/map-s5p.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-ac97.h67
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-iic.h56
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-iis.h70
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-onenand.h63
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-rtc.h71
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-sdhci.h87
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-serial.h282
-rw-r--r--arch/arm/plat-samsung/include/plat/rtc-core.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2410.h31
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2412.h32
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2416.h37
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c2443.h36
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c244x.h42
-rw-r--r--arch/arm/plat-samsung/include/plat/s5p-time.h40
-rw-r--r--arch/arm/plat-samsung/include/plat/samsung-time.h53
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h60
-rw-r--r--arch/arm/plat-samsung/include/plat/usb-phy.h5
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c4
-rw-r--r--arch/arm/plat-samsung/pm.c1
-rw-r--r--arch/arm/plat-samsung/s5p-dev-mfc.c42
-rw-r--r--arch/arm/plat-samsung/s5p-irq-gpioint.c3
-rw-r--r--arch/arm/plat-samsung/s5p-irq.c1
-rw-r--r--arch/arm/plat-samsung/s5p-sleep.S9
-rw-r--r--arch/arm/plat-samsung/samsung-time.c (renamed from arch/arm/plat-samsung/s5p-time.c)138
-rw-r--r--arch/arm/plat-samsung/setup-mipiphy.c3
-rw-r--r--arch/arm/plat-samsung/time.c287
-rw-r--r--arch/arm/plat-spear/Kconfig47
-rw-r--r--arch/arm/plat-spear/Makefile9
-rw-r--r--arch/arm/plat-versatile/platsmp.c8
-rw-r--r--arch/arm/tools/mach-types991
-rw-r--r--arch/arm64/Kconfig11
-rw-r--r--arch/arm64/boot/dts/Makefile2
-rw-r--r--arch/arm64/boot/dts/foundation-v8.dts230
-rw-r--r--arch/arm64/boot/dts/rtsm_ve-aemv8a.dts159
-rw-r--r--arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi234
-rw-r--r--arch/arm64/boot/dts/skeleton.dtsi13
-rw-r--r--arch/arm64/configs/defconfig4
-rw-r--r--arch/arm64/include/asm/Kbuild2
-rw-r--r--arch/arm64/include/asm/bitops.h18
-rw-r--r--arch/arm64/include/asm/cmpxchg.h3
-rw-r--r--arch/arm64/include/asm/compat.h22
-rw-r--r--arch/arm64/include/asm/cputype.h30
-rw-r--r--arch/arm64/include/asm/esr.h55
-rw-r--r--arch/arm64/include/asm/exception.h1
-rw-r--r--arch/arm64/include/asm/hardirq.h5
-rw-r--r--arch/arm64/include/asm/io.h4
-rw-r--r--arch/arm64/include/asm/irq.h1
-rw-r--r--arch/arm64/include/asm/smp_plat.h (renamed from arch/arm64/lib/bitops.c)25
-rw-r--r--arch/arm64/include/asm/string.h37
-rw-r--r--arch/arm64/kernel/arm64ksyms.c21
-rw-r--r--arch/arm64/kernel/early_printk.c35
-rw-r--r--arch/arm64/kernel/entry.S53
-rw-r--r--arch/arm64/kernel/head.S4
-rw-r--r--arch/arm64/kernel/irq.c19
-rw-r--r--arch/arm64/kernel/process.c58
-rw-r--r--arch/arm64/kernel/setup.c12
-rw-r--r--arch/arm64/kernel/smp.c115
-rw-r--r--arch/arm64/kernel/smp_psci.c5
-rw-r--r--arch/arm64/kernel/sys32.S7
-rw-r--r--arch/arm64/kernel/traps.c7
-rw-r--r--arch/arm64/lib/Makefile4
-rw-r--r--arch/arm64/lib/bitops.S68
-rw-r--r--arch/arm64/lib/memchr.S44
-rw-r--r--arch/arm64/lib/memcpy.S53
-rw-r--r--arch/arm64/lib/memmove.S57
-rw-r--r--arch/arm64/lib/memset.S53
-rw-r--r--arch/arm64/lib/strchr.S42
-rw-r--r--arch/arm64/lib/strrchr.S43
-rw-r--r--arch/arm64/mm/fault.c6
-rw-r--r--arch/arm64/mm/init.c26
-rw-r--r--arch/arm64/mm/mmu.c13
-rw-r--r--arch/avr32/Kconfig13
-rw-r--r--arch/avr32/configs/atngw100_defconfig2
-rw-r--r--arch/avr32/configs/atngw100_evklcd100_defconfig2
-rw-r--r--arch/avr32/configs/atngw100_evklcd101_defconfig2
-rw-r--r--arch/avr32/configs/atngw100_mrmt_defconfig2
-rw-r--r--arch/avr32/configs/atngw100mkii_defconfig2
-rw-r--r--arch/avr32/configs/atngw100mkii_evklcd100_defconfig2
-rw-r--r--arch/avr32/configs/atngw100mkii_evklcd101_defconfig2
-rw-r--r--arch/avr32/configs/atstk1002_defconfig2
-rw-r--r--arch/avr32/configs/atstk1003_defconfig2
-rw-r--r--arch/avr32/configs/atstk1004_defconfig2
-rw-r--r--arch/avr32/configs/atstk1006_defconfig2
-rw-r--r--arch/avr32/configs/favr-32_defconfig3
-rw-r--r--arch/avr32/configs/hammerhead_defconfig2
-rw-r--r--arch/avr32/configs/merisc_defconfig1
-rw-r--r--arch/avr32/configs/mimc200_defconfig2
-rw-r--r--arch/avr32/include/asm/unistd.h8
-rw-r--r--arch/avr32/kernel/process.c26
-rw-r--r--arch/avr32/kernel/time.c9
-rw-r--r--arch/avr32/mach-at32ap/Makefile1
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c6
-rw-r--r--arch/avr32/mach-at32ap/cpufreq.c124
-rw-r--r--arch/avr32/mach-at32ap/include/mach/pm.h24
-rw-r--r--arch/avr32/mach-at32ap/pm-at32ap700x.S7
-rw-r--r--arch/avr32/mm/init.c24
-rw-r--r--arch/blackfin/Kconfig5
-rw-r--r--arch/blackfin/include/asm/bfin_sport3.h2
-rw-r--r--arch/blackfin/include/asm/unistd.h8
-rw-r--r--arch/blackfin/kernel/cplbinfo.c4
-rw-r--r--arch/blackfin/kernel/dumpstack.c1
-rw-r--r--arch/blackfin/kernel/early_printk.c2
-rw-r--r--arch/blackfin/kernel/process.c32
-rw-r--r--arch/blackfin/kernel/trace.c2
-rw-r--r--arch/blackfin/mach-bf609/boards/ezkit.c8
-rw-r--r--arch/blackfin/mach-common/Makefile1
-rw-r--r--arch/blackfin/mach-common/cpufreq.c258
-rw-r--r--arch/blackfin/mach-common/smp.c2
-rw-r--r--arch/blackfin/mm/init.c22
-rw-r--r--arch/c6x/kernel/process.c28
-rw-r--r--arch/c6x/kernel/traps.c10
-rw-r--r--arch/c6x/mm/init.c30
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c301
-rw-r--r--arch/cris/arch-v10/kernel/process.c6
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c299
-rw-r--r--arch/cris/arch-v32/kernel/process.c15
-rw-r--r--arch/cris/arch-v32/kernel/smp.c4
-rw-r--r--arch/cris/arch-v32/mach-a3/Makefile1
-rw-r--r--arch/cris/arch-v32/mach-a3/cpufreq.c152
-rw-r--r--arch/cris/arch-v32/mach-fs/Makefile1
-rw-r--r--arch/cris/arch-v32/mach-fs/cpufreq.c145
-rw-r--r--arch/cris/include/asm/processor.h7
-rw-r--r--arch/cris/include/asm/unistd.h8
-rw-r--r--arch/cris/kernel/process.c49
-rw-r--r--arch/cris/kernel/traps.c7
-rw-r--r--arch/cris/mm/init.c16
-rw-r--r--arch/frv/include/asm/unistd.h10
-rw-r--r--arch/frv/kernel/process.c27
-rw-r--r--arch/frv/kernel/traps.c14
-rw-r--r--arch/frv/mm/init.c38
-rw-r--r--arch/h8300/Kconfig5
-rw-r--r--arch/h8300/include/asm/linkage.h2
-rw-r--r--arch/h8300/include/asm/unistd.h7
-rw-r--r--arch/h8300/kernel/gpio.c35
-rw-r--r--arch/h8300/kernel/process.c37
-rw-r--r--arch/h8300/kernel/traps.c7
-rw-r--r--arch/h8300/mm/init.c30
-rw-r--r--arch/hexagon/Kconfig33
-rw-r--r--arch/hexagon/Makefile17
-rw-r--r--arch/hexagon/include/asm/Kbuild2
-rw-r--r--arch/hexagon/include/asm/atomic.h22
-rw-r--r--arch/hexagon/include/asm/elf.h23
-rw-r--r--arch/hexagon/include/asm/hexagon_vm.h56
-rw-r--r--arch/hexagon/include/asm/io.h16
-rw-r--r--arch/hexagon/include/asm/mem-layout.h28
-rw-r--r--arch/hexagon/include/asm/page.h12
-rw-r--r--arch/hexagon/include/asm/processor.h51
-rw-r--r--arch/hexagon/include/asm/vm_mmu.h11
-rw-r--r--arch/hexagon/include/uapi/asm/ptrace.h5
-rw-r--r--arch/hexagon/include/uapi/asm/registers.h17
-rw-r--r--arch/hexagon/include/uapi/asm/signal.h4
-rw-r--r--arch/hexagon/include/uapi/asm/unistd.h3
-rw-r--r--arch/hexagon/include/uapi/asm/user.h6
-rw-r--r--arch/hexagon/kernel/Makefile2
-rw-r--r--arch/hexagon/kernel/asm-offsets.c5
-rw-r--r--arch/hexagon/kernel/dma.c27
-rw-r--r--arch/hexagon/kernel/head.S107
-rw-r--r--arch/hexagon/kernel/kgdb.c4
-rw-r--r--arch/hexagon/kernel/process.c65
-rw-r--r--arch/hexagon/kernel/ptrace.c26
-rw-r--r--arch/hexagon/kernel/setup.c9
-rw-r--r--arch/hexagon/kernel/signal.c45
-rw-r--r--arch/hexagon/kernel/smp.c2
-rw-r--r--arch/hexagon/kernel/topology.c52
-rw-r--r--arch/hexagon/kernel/traps.c44
-rw-r--r--arch/hexagon/kernel/vm_entry.S282
-rw-r--r--arch/hexagon/kernel/vm_events.c6
-rw-r--r--arch/hexagon/kernel/vm_vectors.S4
-rw-r--r--arch/hexagon/kernel/vmlinux.lds.S12
-rw-r--r--arch/hexagon/mm/init.c35
-rw-r--r--arch/hexagon/mm/vm_fault.c4
-rw-r--r--arch/ia64/Kconfig9
-rw-r--r--arch/ia64/hp/sim/simserial.c16
-rw-r--r--arch/ia64/include/asm/futex.h5
-rw-r--r--arch/ia64/include/asm/hugetlb.h1
-rw-r--r--arch/ia64/include/asm/irqflags.h1
-rw-r--r--arch/ia64/include/asm/kvm_host.h1
-rw-r--r--arch/ia64/include/asm/linkage.h4
-rw-r--r--arch/ia64/include/asm/mca.h1
-rw-r--r--arch/ia64/include/asm/numa.h5
-rw-r--r--arch/ia64/include/asm/thread_info.h2
-rw-r--r--arch/ia64/include/asm/unistd.h10
-rw-r--r--arch/ia64/include/uapi/asm/kvm.h1
-rw-r--r--arch/ia64/kernel/Makefile1
-rw-r--r--arch/ia64/kernel/cpufreq/Kconfig29
-rw-r--r--arch/ia64/kernel/cpufreq/Makefile2
-rw-r--r--arch/ia64/kernel/cpufreq/acpi-cpufreq.c437
-rw-r--r--arch/ia64/kernel/fsys.S49
-rw-r--r--arch/ia64/kernel/iosapic.c34
-rw-r--r--arch/ia64/kernel/irq.c8
-rw-r--r--arch/ia64/kernel/mca.c37
-rw-r--r--arch/ia64/kernel/mca_drv.c2
-rw-r--r--arch/ia64/kernel/palinfo.c502
-rw-r--r--arch/ia64/kernel/perfmon.c14
-rw-r--r--arch/ia64/kernel/process.c90
-rw-r--r--arch/ia64/kernel/salinfo.c57
-rw-r--r--arch/ia64/kernel/setup.c1
-rw-r--r--arch/ia64/kernel/smpboot.c2
-rw-r--r--arch/ia64/kvm/Kconfig14
-rw-r--r--arch/ia64/kvm/Makefile6
-rw-r--r--arch/ia64/kvm/kvm-ia64.c35
-rw-r--r--arch/ia64/kvm/lapic.h6
-rw-r--r--arch/ia64/kvm/vtlb.c2
-rw-r--r--arch/ia64/mm/contig.c2
-rw-r--r--arch/ia64/mm/discontig.c9
-rw-r--r--arch/ia64/mm/init.c23
-rw-r--r--arch/ia64/mm/ioremap.c14
-rw-r--r--arch/ia64/mm/numa.c20
-rw-r--r--arch/ia64/pci/pci.c11
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c146
-rw-r--r--arch/ia64/sn/kernel/tiocx.c5
-rw-r--r--arch/m32r/include/asm/unistd.h10
-rw-r--r--arch/m32r/kernel/process.c20
-rw-r--r--arch/m32r/kernel/smpboot.c2
-rw-r--r--arch/m32r/kernel/traps.c15
-rw-r--r--arch/m32r/mm/init.c26
-rw-r--r--arch/m68k/Kconfig.bus10
-rw-r--r--arch/m68k/Kconfig.devices24
-rw-r--r--arch/m68k/atari/ataints.c152
-rw-r--r--arch/m68k/atari/config.c239
-rw-r--r--arch/m68k/include/asm/atarihw.h6
-rw-r--r--arch/m68k/include/asm/atariints.h11
-rw-r--r--arch/m68k/include/asm/cmpxchg.h3
-rw-r--r--arch/m68k/include/asm/delay.h23
-rw-r--r--arch/m68k/include/asm/io_mm.h136
-rw-r--r--arch/m68k/include/asm/irq.h6
-rw-r--r--arch/m68k/include/asm/raw_io.h109
-rw-r--r--arch/m68k/include/asm/string.h14
-rw-r--r--arch/m68k/include/asm/unistd.h8
-rw-r--r--arch/m68k/kernel/process.c32
-rw-r--r--arch/m68k/kernel/setup_mm.c6
-rw-r--r--arch/m68k/kernel/traps.c12
-rw-r--r--arch/m68k/lib/string.c2
-rw-r--r--arch/m68k/mm/init.c24
-rw-r--r--arch/metag/Kconfig9
-rw-r--r--arch/metag/Makefile2
-rw-r--r--arch/metag/boot/dts/Makefile10
-rw-r--r--arch/metag/configs/meta1_defconfig1
-rw-r--r--arch/metag/configs/meta2_defconfig1
-rw-r--r--arch/metag/configs/meta2_smp_defconfig1
-rw-r--r--arch/metag/include/asm/metag_mem.h3
-rw-r--r--arch/metag/include/asm/thread_info.h2
-rw-r--r--arch/metag/include/uapi/asm/Kbuild1
-rw-r--r--arch/metag/include/uapi/asm/ech.h15
-rw-r--r--arch/metag/kernel/cachepart.c16
-rw-r--r--arch/metag/kernel/da.c2
-rw-r--r--arch/metag/kernel/head.S8
-rw-r--r--arch/metag/kernel/perf/perf_event.c74
-rw-r--r--arch/metag/kernel/process.c37
-rw-r--r--arch/metag/kernel/ptrace.c34
-rw-r--r--arch/metag/kernel/setup.c1
-rw-r--r--arch/metag/kernel/smp.c117
-rw-r--r--arch/metag/kernel/traps.c6
-rw-r--r--arch/metag/mm/Kconfig8
-rw-r--r--arch/metag/mm/init.c31
-rw-r--r--arch/metag/oprofile/Makefile17
-rw-r--r--arch/metag/oprofile/backtrace.c63
-rw-r--r--arch/metag/oprofile/backtrace.h6
-rw-r--r--arch/metag/oprofile/common.c66
-rw-r--r--arch/microblaze/Kconfig4
-rw-r--r--arch/microblaze/include/asm/processor.h5
-rw-r--r--arch/microblaze/include/asm/setup.h1
-rw-r--r--arch/microblaze/include/asm/thread_info.h1
-rw-r--r--arch/microblaze/include/asm/unistd.h8
-rw-r--r--arch/microblaze/kernel/early_printk.c26
-rw-r--r--arch/microblaze/kernel/process.c67
-rw-r--r--arch/microblaze/kernel/traps.c6
-rw-r--r--arch/microblaze/mm/init.c34
-rw-r--r--arch/mips/Kconfig13
-rw-r--r--arch/mips/bcm63xx/dev-spi.c11
-rw-r--r--arch/mips/include/asm/hugetlb.h1
-rw-r--r--arch/mips/include/asm/linkage.h3
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h1
-rw-r--r--arch/mips/include/asm/page.h2
-rw-r--r--arch/mips/include/asm/unistd.h8
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cpufreq/Kconfig41
-rw-r--r--arch/mips/kernel/cpufreq/Makefile5
-rw-r--r--arch/mips/kernel/cpufreq/loongson2_cpufreq.c255
-rw-r--r--arch/mips/kernel/early_printk.c12
-rw-r--r--arch/mips/kernel/linux32.c119
-rw-r--r--arch/mips/kernel/process.c48
-rw-r--r--arch/mips/kernel/scall64-n32.S8
-rw-r--r--arch/mips/kernel/scall64-o32.S6
-rw-r--r--arch/mips/kernel/smp.c2
-rw-r--r--arch/mips/kernel/smtc-proc.c64
-rw-r--r--arch/mips/kernel/traps.c15
-rw-r--r--arch/mips/lasat/picvue_proc.c4
-rw-r--r--arch/mips/mm/init.c38
-rw-r--r--arch/mips/pci/ops-pmcmsp.c95
-rw-r--r--arch/mips/pci/pci.c8
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c4
-rw-r--r--arch/mips/sibyte/sb1250/bus_watcher.c81
-rw-r--r--arch/mn10300/include/asm/thread_info.h2
-rw-r--r--arch/mn10300/include/asm/unistd.h10
-rw-r--r--arch/mn10300/kernel/process.c71
-rw-r--r--arch/mn10300/kernel/smp.c7
-rw-r--r--arch/mn10300/kernel/traps.c11
-rw-r--r--arch/mn10300/mm/init.c23
-rw-r--r--arch/openrisc/Kconfig3
-rw-r--r--arch/openrisc/include/asm/thread_info.h2
-rw-r--r--arch/openrisc/kernel/Makefile2
-rw-r--r--arch/openrisc/kernel/idle.c73
-rw-r--r--arch/openrisc/kernel/process.c1
-rw-r--r--arch/openrisc/kernel/traps.c11
-rw-r--r--arch/openrisc/mm/init.c27
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/Kconfig.debug14
-rw-r--r--arch/parisc/Makefile6
-rw-r--r--arch/parisc/include/asm/cacheflush.h5
-rw-r--r--arch/parisc/include/asm/pgtable.h47
-rw-r--r--arch/parisc/include/asm/thread_info.h2
-rw-r--r--arch/parisc/include/asm/uaccess.h14
-rw-r--r--arch/parisc/include/asm/unistd.h8
-rw-r--r--arch/parisc/kernel/cache.c5
-rw-r--r--arch/parisc/kernel/parisc_ksyms.c2
-rw-r--r--arch/parisc/kernel/pdc_chassis.c47
-rw-r--r--arch/parisc/kernel/process.c22
-rw-r--r--arch/parisc/kernel/smp.c2
-rw-r--r--arch/parisc/kernel/sys_parisc32.c41
-rw-r--r--arch/parisc/kernel/syscall_table.S8
-rw-r--r--arch/parisc/kernel/traps.c10
-rw-r--r--arch/parisc/lib/Makefile3
-rw-r--r--arch/parisc/lib/ucmpdi2.c25
-rw-r--r--arch/parisc/mm/init.c25
-rw-r--r--arch/powerpc/Kconfig21
-rw-r--r--arch/powerpc/boot/dts/ac14xx.dts392
-rw-r--r--arch/powerpc/boot/dts/b4420qds.dts50
-rw-r--r--arch/powerpc/boot/dts/b4860qds.dts61
-rw-r--r--arch/powerpc/boot/dts/b4qds.dts169
-rw-r--r--arch/powerpc/boot/dts/fsl/b4420si-post.dtsi98
-rw-r--r--arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi73
-rw-r--r--arch/powerpc/boot/dts/fsl/b4860si-post.dtsi142
-rw-r--r--arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi83
-rw-r--r--arch/powerpc/boot/dts/fsl/b4si-post.dtsi268
-rw-r--r--arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/e6500_power_isa.dtsi65
-rw-r--r--arch/powerpc/boot/dts/fsl/p1023si-post.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/p2041si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p3041si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p4080si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p5020si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p5040si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi41
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-gpio-1.dtsi41
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-gpio-2.dtsi41
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-gpio-3.dtsi41
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-sec4.0-0.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-sec4.2-0.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-sec5.0-0.dtsi (renamed from arch/powerpc/boot/dts/fsl/qoriq-sec4.1-0.dtsi)27
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi1
-rw-r--r--arch/powerpc/boot/dts/fsl/qoriq-sec5.3-0.dtsi119
-rw-r--r--arch/powerpc/boot/dts/fsl/t4240si-post.dtsi442
-rw-r--r--arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi128
-rw-r--r--arch/powerpc/boot/dts/mpc5121.dtsi4
-rw-r--r--arch/powerpc/boot/dts/mpc5121ads.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc5125twr.dts233
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds_36b.dts6
-rw-r--r--arch/powerpc/boot/dts/p1021rdb-pc.dtsi12
-rw-r--r--arch/powerpc/boot/dts/p1025rdb_36b.dts5
-rw-r--r--arch/powerpc/boot/dts/pdm360ng.dts2
-rw-r--r--arch/powerpc/boot/dts/t4240qds.dts224
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig46
-rw-r--r--arch/powerpc/configs/mpc512x_defconfig2
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig40
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig32
-rw-r--r--arch/powerpc/configs/ps3_defconfig2
-rw-r--r--arch/powerpc/include/asm/bitops.h11
-rw-r--r--arch/powerpc/include/asm/cputable.h13
-rw-r--r--arch/powerpc/include/asm/dma.h5
-rw-r--r--arch/powerpc/include/asm/elf.h1
-rw-r--r--arch/powerpc/include/asm/exception-64s.h2
-rw-r--r--arch/powerpc/include/asm/firmware.h6
-rw-r--r--arch/powerpc/include/asm/hardirq.h3
-rw-r--r--arch/powerpc/include/asm/hugetlb.h31
-rw-r--r--arch/powerpc/include/asm/hvcall.h3
-rw-r--r--arch/powerpc/include/asm/hw_irq.h16
-rw-r--r--arch/powerpc/include/asm/io.h4
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h4
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h7
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h13
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h8
-rw-r--r--arch/powerpc/include/asm/kvm_booke.h2
-rw-r--r--arch/powerpc/include/asm/kvm_host.h41
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h114
-rw-r--r--arch/powerpc/include/asm/linkage.h13
-rw-r--r--arch/powerpc/include/asm/machdep.h6
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h22
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h60
-rw-r--r--arch/powerpc/include/asm/opal.h2
-rw-r--r--arch/powerpc/include/asm/page.h19
-rw-r--r--arch/powerpc/include/asm/page_64.h3
-rw-r--r--arch/powerpc/include/asm/parport.h4
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h19
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h9
-rw-r--r--arch/powerpc/include/asm/pgalloc-32.h45
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h158
-rw-r--r--arch/powerpc/include/asm/pgalloc.h46
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-64k.h6
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h3
-rw-r--r--arch/powerpc/include/asm/pgtable.h8
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h12
-rw-r--r--arch/powerpc/include/asm/processor.h12
-rw-r--r--arch/powerpc/include/asm/prom.h69
-rw-r--r--arch/powerpc/include/asm/ptrace.h3
-rw-r--r--arch/powerpc/include/asm/reg.h24
-rw-r--r--arch/powerpc/include/asm/rtas.h6
-rw-r--r--arch/powerpc/include/asm/smp.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h10
-rw-r--r--arch/powerpc/include/asm/thread_info.h2
-rw-r--r--arch/powerpc/include/asm/topology.h5
-rw-r--r--arch/powerpc/include/asm/unistd.h6
-rw-r--r--arch/powerpc/include/asm/uprobes.h1
-rw-r--r--arch/powerpc/include/asm/xics.h1
-rw-r--r--arch/powerpc/include/uapi/asm/cputable.h9
-rw-r--r--arch/powerpc/include/uapi/asm/kvm.h94
-rw-r--r--arch/powerpc/include/uapi/asm/linkage.h6
-rw-r--r--arch/powerpc/include/uapi/asm/ptrace.h1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c7
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S16
-rw-r--r--arch/powerpc/kernel/cpu_setup_power.S31
-rw-r--r--arch/powerpc/kernel/cputable.c23
-rw-r--r--arch/powerpc/kernel/crash_dump.c5
-rw-r--r--arch/powerpc/kernel/dbell.c2
-rw-r--r--arch/powerpc/kernel/entry_64.S20
-rw-r--r--arch/powerpc/kernel/epapr_hcalls.S2
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S47
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S22
-rw-r--r--arch/powerpc/kernel/fadump.c5
-rw-r--r--arch/powerpc/kernel/head_44x.S2
-rw-r--r--arch/powerpc/kernel/head_64.S1
-rw-r--r--arch/powerpc/kernel/head_booke.h21
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S2
-rw-r--r--arch/powerpc/kernel/idle.c89
-rw-r--r--arch/powerpc/kernel/idle_book3e.S32
-rw-r--r--arch/powerpc/kernel/iommu.c2
-rw-r--r--arch/powerpc/kernel/irq.c12
-rw-r--r--arch/powerpc/kernel/kgdb.c2
-rw-r--r--arch/powerpc/kernel/kvm.c7
-rw-r--r--arch/powerpc/kernel/lparcfg.c12
-rw-r--r--arch/powerpc/kernel/nvram_64.c3
-rw-r--r--arch/powerpc/kernel/pci-common.c157
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c2
-rw-r--r--arch/powerpc/kernel/proc_powerpc.c21
-rw-r--r--arch/powerpc/kernel/process.c22
-rw-r--r--arch/powerpc/kernel/prom_init.c98
-rw-r--r--arch/powerpc/kernel/ptrace.c31
-rw-r--r--arch/powerpc/kernel/ptrace32.c15
-rw-r--r--arch/powerpc/kernel/rtas_flash.c497
-rw-r--r--arch/powerpc/kernel/rtas_pci.c4
-rw-r--r--arch/powerpc/kernel/rtasd.c49
-rw-r--r--arch/powerpc/kernel/setup-common.c6
-rw-r--r--arch/powerpc/kernel/setup_64.c4
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c109
-rw-r--r--arch/powerpc/kernel/sysfs.c2
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kernel/traps.c10
-rw-r--r--arch/powerpc/kernel/udbg.c6
-rw-r--r--arch/powerpc/kernel/uprobes.c29
-rw-r--r--arch/powerpc/kernel/vdso.c4
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S26
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S1
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S26
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S1
-rw-r--r--arch/powerpc/kvm/44x.c12
-rw-r--r--arch/powerpc/kvm/Kconfig26
-rw-r--r--arch/powerpc/kvm/Makefile12
-rw-r--r--arch/powerpc/kvm/book3s.c36
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c2
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c122
-rw-r--r--arch/powerpc/kvm/book3s_64_vio.c2
-rw-r--r--arch/powerpc/kvm/book3s_emulate.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv.c102
-rw-r--r--arch/powerpc/kvm/book3s_hv_interrupts.S6
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c11
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_xics.c406
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S228
-rw-r--r--arch/powerpc/kvm/book3s_pr.c9
-rw-r--r--arch/powerpc/kvm/book3s_pr_papr.c21
-rw-r--r--arch/powerpc/kvm/book3s_rtas.c274
-rw-r--r--arch/powerpc/kvm/book3s_xics.c1270
-rw-r--r--arch/powerpc/kvm/book3s_xics.h130
-rw-r--r--arch/powerpc/kvm/booke.c158
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S42
-rw-r--r--arch/powerpc/kvm/e500.c14
-rw-r--r--arch/powerpc/kvm/e500.h22
-rw-r--r--arch/powerpc/kvm/e500_emulate.c19
-rw-r--r--arch/powerpc/kvm/e500_mmu.c192
-rw-r--r--arch/powerpc/kvm/e500mc.c16
-rw-r--r--arch/powerpc/kvm/emulate.c2
-rw-r--r--arch/powerpc/kvm/irq.h20
-rw-r--r--arch/powerpc/kvm/mpic.c1853
-rw-r--r--arch/powerpc/kvm/powerpc.c133
-rw-r--r--arch/powerpc/mm/gup.c18
-rw-r--r--arch/powerpc/mm/hash_low_64.S22
-rw-r--r--arch/powerpc/mm/hash_native_64.c178
-rw-r--r--arch/powerpc/mm/hash_utils_64.c184
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c33
-rw-r--r--arch/powerpc/mm/hugetlbpage.c192
-rw-r--r--arch/powerpc/mm/icswx.c2
-rw-r--r--arch/powerpc/mm/init_64.c14
-rw-r--r--arch/powerpc/mm/mem.c38
-rw-r--r--arch/powerpc/mm/mmu_context_hash64.c37
-rw-r--r--arch/powerpc/mm/numa.c288
-rw-r--r--arch/powerpc/mm/pgtable_64.c118
-rw-r--r--arch/powerpc/mm/slice.c223
-rw-r--r--arch/powerpc/mm/tlb_nohash.c18
-rw-r--r--arch/powerpc/perf/Makefile5
-rw-r--r--arch/powerpc/perf/bhrb.S44
-rw-r--r--arch/powerpc/perf/core-book3s.c231
-rw-r--r--arch/powerpc/perf/power5+-pmu.c2
-rw-r--r--arch/powerpc/perf/power5-pmu.c1
-rw-r--r--arch/powerpc/perf/power8-pmu.c592
-rw-r--r--arch/powerpc/platforms/40x/Kconfig7
-rw-r--r--arch/powerpc/platforms/44x/Kconfig2
-rw-r--r--arch/powerpc/platforms/512x/Kconfig10
-rw-r--r--arch/powerpc/platforms/512x/Makefile2
-rw-r--r--arch/powerpc/platforms/512x/clock.c9
-rw-r--r--arch/powerpc/platforms/512x/mpc512x.h1
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_generic.c (renamed from arch/powerpc/platforms/512x/mpc5121_generic.c)12
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c38
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig34
-rw-r--r--arch/powerpc/platforms/85xx/Makefile2
-rw-r--r--arch/powerpc/platforms/85xx/b4_qds.c102
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c5
-rw-r--r--arch/powerpc/platforms/85xx/smp.c2
-rw-r--r--arch/powerpc/platforms/85xx/t4240_qds.c98
-rw-r--r--arch/powerpc/platforms/Kconfig4
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype2
-rw-r--r--arch/powerpc/platforms/cell/Kconfig26
-rw-r--r--arch/powerpc/platforms/cell/Makefile3
-rw-r--r--arch/powerpc/platforms/cell/beat_htab.c26
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.c209
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.h24
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c115
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c156
-rw-r--r--arch/powerpc/platforms/cell/iommu.c2
-rw-r--r--arch/powerpc/platforms/cell/pmu.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig5
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc10x.h11
-rw-r--r--arch/powerpc/platforms/pasemi/cpufreq.c5
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c14
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c5
-rw-r--r--arch/powerpc/platforms/powermac/pci.c2
-rw-r--r--arch/powerpc/platforms/powernv/Kconfig5
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S1
-rw-r--r--arch/powerpc/platforms/powernv/opal.c15
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c317
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c15
-rw-r--r--arch/powerpc/platforms/powernv/pci.c113
-rw-r--r--arch/powerpc/platforms/powernv/pci.h26
-rw-r--r--arch/powerpc/platforms/powernv/smp.c4
-rw-r--r--arch/powerpc/platforms/prep/Kconfig23
-rw-r--r--arch/powerpc/platforms/ps3/htab.c8
-rw-r--r--arch/powerpc/platforms/ps3/time.c4
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c54
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c12
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c26
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c8
-rw-r--r--arch/powerpc/platforms/pseries/mobility.c41
-rw-r--r--arch/powerpc/platforms/pseries/msi.c21
-rw-r--r--arch/powerpc/platforms/pseries/pci.c53
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h15
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c34
-rw-r--r--arch/powerpc/platforms/pseries/pseries.h9
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c2
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c32
-rw-r--r--arch/powerpc/platforms/pseries/setup.c42
-rw-r--r--arch/powerpc/platforms/wsp/Kconfig5
-rw-r--r--arch/powerpc/platforms/wsp/wsp_pci.c2
-rw-r--r--arch/powerpc/sysdev/Kconfig1
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c4
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c125
-rw-r--r--arch/powerpc/sysdev/fsl_pci.h13
-rw-r--r--arch/powerpc/sysdev/indirect_pci.c10
-rw-r--r--arch/powerpc/sysdev/mpic.c14
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c15
-rw-r--r--arch/powerpc/sysdev/qe_lib/Kconfig2
-rw-r--r--arch/powerpc/sysdev/rtc_cmos_setup.c5
-rw-r--r--arch/powerpc/sysdev/xics/icp-native.c10
-rw-r--r--arch/powerpc/xmon/xmon.c4
-rw-r--r--arch/s390/Kconfig15
-rw-r--r--arch/s390/Kconfig.debug14
-rw-r--r--arch/s390/Makefile10
-rw-r--r--arch/s390/hypfs/hypfs_dbfs.c4
-rw-r--r--arch/s390/include/asm/bitops.h117
-rw-r--r--arch/s390/include/asm/ccwdev.h3
-rw-r--r--arch/s390/include/asm/cio.h2
-rw-r--r--arch/s390/include/asm/compat.h57
-rw-r--r--arch/s390/include/asm/elf.h23
-rw-r--r--arch/s390/include/asm/hugetlb.h56
-rw-r--r--arch/s390/include/asm/pci.h1
-rw-r--r--arch/s390/include/asm/pci_debug.h9
-rw-r--r--arch/s390/include/asm/pci_insn.h203
-rw-r--r--arch/s390/include/asm/pci_io.h16
-rw-r--r--arch/s390/include/asm/pgtable.h163
-rw-r--r--arch/s390/include/asm/processor.h3
-rw-r--r--arch/s390/include/asm/ptrace.h6
-rw-r--r--arch/s390/include/asm/setup.h9
-rw-r--r--arch/s390/include/asm/syscall.h1
-rw-r--r--arch/s390/include/asm/thread_info.h6
-rw-r--r--arch/s390/include/asm/unistd.h8
-rw-r--r--arch/s390/include/uapi/asm/Kbuild1
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h20
-rw-r--r--arch/s390/include/uapi/asm/statfs.h63
-rw-r--r--arch/s390/include/uapi/asm/virtio-ccw.h21
-rw-r--r--arch/s390/kernel/Makefile17
-rw-r--r--arch/s390/kernel/asm-offsets.c1
-rw-r--r--arch/s390/kernel/compat_linux.c86
-rw-r--r--arch/s390/kernel/compat_linux.h5
-rw-r--r--arch/s390/kernel/compat_signal.c2
-rw-r--r--arch/s390/kernel/compat_wrapper.S80
-rw-r--r--arch/s390/kernel/crash_dump.c6
-rw-r--r--arch/s390/kernel/dis.c9
-rw-r--r--arch/s390/kernel/dumpstack.c212
-rw-r--r--arch/s390/kernel/early.c1
-rw-r--r--arch/s390/kernel/entry.S39
-rw-r--r--arch/s390/kernel/entry.h1
-rw-r--r--arch/s390/kernel/entry64.S43
-rw-r--r--arch/s390/kernel/irq.c8
-rw-r--r--arch/s390/kernel/machine_kexec.c30
-rw-r--r--arch/s390/kernel/mem_detect.c145
-rw-r--r--arch/s390/kernel/os_info.c1
-rw-r--r--arch/s390/kernel/process.c32
-rw-r--r--arch/s390/kernel/setup.c74
-rw-r--r--arch/s390/kernel/smp.c18
-rw-r--r--arch/s390/kernel/suspend.c31
-rw-r--r--arch/s390/kernel/swsusp_asm64.S29
-rw-r--r--arch/s390/kernel/sys_s390.c14
-rw-r--r--arch/s390/kernel/syscalls.S22
-rw-r--r--arch/s390/kernel/traps.c250
-rw-r--r--arch/s390/kernel/vtime.c5
-rw-r--r--arch/s390/kvm/Kconfig1
-rw-r--r--arch/s390/kvm/Makefile2
-rw-r--r--arch/s390/kvm/diag.c26
-rw-r--r--arch/s390/kvm/gaccess.h429
-rw-r--r--arch/s390/kvm/intercept.c18
-rw-r--r--arch/s390/kvm/interrupt.c245
-rw-r--r--arch/s390/kvm/kvm-s390.c43
-rw-r--r--arch/s390/kvm/kvm-s390.h12
-rw-r--r--arch/s390/kvm/priv.c270
-rw-r--r--arch/s390/kvm/trace.h4
-rw-r--r--arch/s390/lib/Makefile1
-rw-r--r--arch/s390/lib/uaccess_pt.c3
-rw-r--r--arch/s390/lib/usercopy.c8
-rw-r--r--arch/s390/mm/Makefile2
-rw-r--r--arch/s390/mm/cmm.c8
-rw-r--r--arch/s390/mm/fault.c9
-rw-r--r--arch/s390/mm/hugetlbpage.c2
-rw-r--r--arch/s390/mm/init.c56
-rw-r--r--arch/s390/mm/mem_detect.c134
-rw-r--r--arch/s390/mm/pageattr.c24
-rw-r--r--arch/s390/mm/pgtable.c332
-rw-r--r--arch/s390/mm/vmem.c23
-rw-r--r--arch/s390/net/bpf_jit_comp.c3
-rw-r--r--arch/s390/oprofile/init.c1
-rw-r--r--arch/s390/pci/Makefile4
-rw-r--r--arch/s390/pci/pci.c153
-rw-r--r--arch/s390/pci/pci_clp.c13
-rw-r--r--arch/s390/pci/pci_debug.c7
-rw-r--r--arch/s390/pci/pci_dma.c9
-rw-r--r--arch/s390/pci/pci_insn.c202
-rw-r--r--arch/s390/pci/pci_msi.c10
-rw-r--r--arch/score/kernel/process.c18
-rw-r--r--arch/score/kernel/traps.c12
-rw-r--r--arch/score/mm/init.c35
-rw-r--r--arch/sh/Kconfig22
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c4
-rw-r--r--arch/sh/drivers/dma/dma-api.c28
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c2
-rw-r--r--arch/sh/include/asm/hugetlb.h1
-rw-r--r--arch/sh/include/asm/suspend.h4
-rw-r--r--arch/sh/include/asm/thread_info.h2
-rw-r--r--arch/sh/include/asm/unistd.h8
-rw-r--r--arch/sh/kernel/Makefile1
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c13
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c13
-rw-r--r--arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c11
-rw-r--r--arch/sh/kernel/cpu/sh3/pinmux-sh7720.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c13
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c13
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c14
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-shx3.c17
-rw-r--r--arch/sh/kernel/cpu/shmobile/cpuidle.c101
-rw-r--r--arch/sh/kernel/cpu/shmobile/pm.c3
-rw-r--r--arch/sh/kernel/cpufreq.c201
-rw-r--r--arch/sh/kernel/dumpstack.c6
-rw-r--r--arch/sh/kernel/idle.c101
-rw-r--r--arch/sh/kernel/process_32.c6
-rw-r--r--arch/sh/kernel/process_64.c1
-rw-r--r--arch/sh/kernel/sh_bios.c4
-rw-r--r--arch/sh/kernel/smp.c2
-rw-r--r--arch/sh/mm/Kconfig7
-rw-r--r--arch/sh/mm/alignment.c2
-rw-r--r--arch/sh/mm/init.c26
-rw-r--r--arch/sparc/Kconfig46
-rw-r--r--arch/sparc/Makefile1
-rw-r--r--arch/sparc/include/asm/cmpxchg_64.h1
-rw-r--r--arch/sparc/include/asm/head_32.h6
-rw-r--r--arch/sparc/include/asm/hibernate.h23
-rw-r--r--arch/sparc/include/asm/hugetlb.h1
-rw-r--r--arch/sparc/include/asm/leon_pci.h1
-rw-r--r--arch/sparc/include/asm/mmu_context_64.h2
-rw-r--r--arch/sparc/include/asm/processor_64.h3
-rw-r--r--arch/sparc/include/asm/thread_info_32.h2
-rw-r--r--arch/sparc/include/asm/thread_info_64.h2
-rw-r--r--arch/sparc/include/asm/unistd.h8
-rw-r--r--arch/sparc/kernel/Makefile6
-rw-r--r--arch/sparc/kernel/asm-offsets.c15
-rw-r--r--arch/sparc/kernel/hvtramp.S3
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/leon_kernel.c10
-rw-r--r--arch/sparc/kernel/leon_pci.c2
-rw-r--r--arch/sparc/kernel/leon_pci_grpci1.c724
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c5
-rw-r--r--arch/sparc/kernel/leon_pmc.c4
-rw-r--r--arch/sparc/kernel/process_32.c44
-rw-r--r--arch/sparc/kernel/process_64.c55
-rw-r--r--arch/sparc/kernel/smp_32.c2
-rw-r--r--arch/sparc/kernel/smp_64.c2
-rw-r--r--arch/sparc/kernel/sun4d_irq.c1
-rw-r--r--arch/sparc/kernel/sys32.S4
-rw-r--r--arch/sparc/kernel/sys_sparc32.c75
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c6
-rw-r--r--arch/sparc/kernel/systbls_64.S8
-rw-r--r--arch/sparc/kernel/trampoline_64.S3
-rw-r--r--arch/sparc/kernel/traps_64.c7
-rw-r--r--arch/sparc/kernel/us2e_cpufreq.c413
-rw-r--r--arch/sparc/kernel/us3_cpufreq.c274
-rw-r--r--arch/sparc/kernel/vio.c1
-rw-r--r--arch/sparc/lib/Makefile1
-rw-r--r--arch/sparc/lib/usercopy.c9
-rw-r--r--arch/sparc/mm/init_32.c12
-rw-r--r--arch/sparc/mm/init_64.c14
-rw-r--r--arch/sparc/mm/tlb.c3
-rw-r--r--arch/sparc/power/Makefile3
-rw-r--r--arch/sparc/power/hibernate.c42
-rw-r--r--arch/sparc/power/hibernate_asm.S131
-rw-r--r--arch/tile/Kconfig26
-rw-r--r--arch/tile/include/asm/atomic.h21
-rw-r--r--arch/tile/include/asm/hugetlb.h1
-rw-r--r--arch/tile/include/asm/ptrace.h3
-rw-r--r--arch/tile/include/asm/syscall.h6
-rw-r--r--arch/tile/include/asm/syscalls.h6
-rw-r--r--arch/tile/include/asm/thread_info.h10
-rw-r--r--arch/tile/include/asm/uaccess.h7
-rw-r--r--arch/tile/include/uapi/asm/unistd.h2
-rw-r--r--arch/tile/kernel/compat.c6
-rw-r--r--arch/tile/kernel/early_printk.c27
-rw-r--r--arch/tile/kernel/hardwall.c2
-rw-r--r--arch/tile/kernel/intvec_32.S10
-rw-r--r--arch/tile/kernel/intvec_64.S24
-rw-r--r--arch/tile/kernel/process.c68
-rw-r--r--arch/tile/kernel/ptrace.c39
-rw-r--r--arch/tile/kernel/smpboot.c4
-rw-r--r--arch/tile/kernel/time.c6
-rw-r--r--arch/tile/lib/uaccess.c8
-rw-r--r--arch/tile/mm/pgtable.c7
-rw-r--r--arch/um/drivers/chan_kern.c6
-rw-r--r--arch/um/drivers/line.c8
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/include/shared/common-offsets.h4
-rw-r--r--arch/um/kernel/early_printk.c8
-rw-r--r--arch/um/kernel/mem.c26
-rw-r--r--arch/um/kernel/process.c27
-rw-r--r--arch/um/kernel/sysrq.c12
-rw-r--r--arch/um/os-Linux/time.c2
-rw-r--r--arch/um/sys-ppc/sysrq.c2
-rw-r--r--arch/unicore32/kernel/Makefile1
-rw-r--r--arch/unicore32/kernel/cpu-ucv2.c93
-rw-r--r--arch/unicore32/kernel/early_printk.c12
-rw-r--r--arch/unicore32/kernel/process.c27
-rw-r--r--arch/unicore32/kernel/traps.c6
-rw-r--r--arch/unicore32/mm/init.c31
-rw-r--r--arch/unicore32/mm/ioremap.c17
-rw-r--r--arch/x86/Kconfig94
-rw-r--r--arch/x86/Kconfig.debug16
-rw-r--r--arch/x86/boot/compressed/eboot.c4
-rw-r--r--arch/x86/boot/compressed/head_64.S2
-rw-r--r--arch/x86/crypto/Makefile57
-rw-r--r--arch/x86/crypto/aesni-intel_asm.S117
-rw-r--r--arch/x86/crypto/aesni-intel_glue.c80
-rw-r--r--arch/x86/crypto/blowfish-avx2-asm_64.S449
-rw-r--r--arch/x86/crypto/blowfish_avx2_glue.c585
-rw-r--r--arch/x86/crypto/blowfish_glue.c32
-rw-r--r--arch/x86/crypto/camellia-aesni-avx-asm_64.S180
-rw-r--r--arch/x86/crypto/camellia-aesni-avx2-asm_64.S1368
-rw-r--r--arch/x86/crypto/camellia_aesni_avx2_glue.c586
-rw-r--r--arch/x86/crypto/camellia_aesni_avx_glue.c104
-rw-r--r--arch/x86/crypto/cast6-avx-x86_64-asm_64.S48
-rw-r--r--arch/x86/crypto/cast6_avx_glue.c91
-rw-r--r--arch/x86/crypto/crc32-pclmul_asm.S6
-rw-r--r--arch/x86/crypto/crc32c-pcl-intel-asm_64.S10
-rw-r--r--arch/x86/crypto/glue_helper-asm-avx.S61
-rw-r--r--arch/x86/crypto/glue_helper-asm-avx2.S180
-rw-r--r--arch/x86/crypto/glue_helper.c97
-rw-r--r--arch/x86/crypto/serpent-avx-x86_64-asm_64.S45
-rw-r--r--arch/x86/crypto/serpent-avx2-asm_64.S800
-rw-r--r--arch/x86/crypto/serpent_avx2_glue.c562
-rw-r--r--arch/x86/crypto/serpent_avx_glue.c145
-rw-r--r--arch/x86/crypto/sha256-avx-asm.S496
-rw-r--r--arch/x86/crypto/sha256-avx2-asm.S772
-rw-r--r--arch/x86/crypto/sha256-ssse3-asm.S506
-rw-r--r--arch/x86/crypto/sha256_ssse3_glue.c275
-rw-r--r--arch/x86/crypto/sha512-avx-asm.S423
-rw-r--r--arch/x86/crypto/sha512-avx2-asm.S743
-rw-r--r--arch/x86/crypto/sha512-ssse3-asm.S421
-rw-r--r--arch/x86/crypto/sha512_ssse3_glue.c282
-rw-r--r--arch/x86/crypto/twofish-avx-x86_64-asm_64.S48
-rw-r--r--arch/x86/crypto/twofish-avx2-asm_64.S600
-rw-r--r--arch/x86/crypto/twofish_avx2_glue.c584
-rw-r--r--arch/x86/crypto/twofish_avx_glue.c101
-rw-r--r--arch/x86/ia32/Makefile3
-rw-r--r--arch/x86/ia32/ia32_aout.c31
-rw-r--r--arch/x86/ia32/ipc32.c54
-rw-r--r--arch/x86/ia32/sys_ia32.c37
-rw-r--r--arch/x86/include/asm/bug.h3
-rw-r--r--arch/x86/include/asm/cmpxchg.h2
-rw-r--r--arch/x86/include/asm/context_tracking.h21
-rw-r--r--arch/x86/include/asm/cpufeature.h24
-rw-r--r--arch/x86/include/asm/crypto/blowfish.h43
-rw-r--r--arch/x86/include/asm/crypto/camellia.h19
-rw-r--r--arch/x86/include/asm/crypto/glue_helper.h24
-rw-r--r--arch/x86/include/asm/crypto/serpent-avx.h29
-rw-r--r--arch/x86/include/asm/crypto/twofish.h18
-rw-r--r--arch/x86/include/asm/entry_arch.h4
-rw-r--r--arch/x86/include/asm/fixmap.h7
-rw-r--r--arch/x86/include/asm/hardirq.h3
-rw-r--r--arch/x86/include/asm/hugetlb.h1
-rw-r--r--arch/x86/include/asm/hw_irq.h1
-rw-r--r--arch/x86/include/asm/hypervisor.h16
-rw-r--r--arch/x86/include/asm/irq_remapping.h9
-rw-r--r--arch/x86/include/asm/irq_vectors.h5
-rw-r--r--arch/x86/include/asm/kvm_host.h26
-rw-r--r--arch/x86/include/asm/lguest.h17
-rw-r--r--arch/x86/include/asm/mce.h4
-rw-r--r--arch/x86/include/asm/msr.h14
-rw-r--r--arch/x86/include/asm/page_64_types.h1
-rw-r--r--arch/x86/include/asm/paravirt.h4
-rw-r--r--arch/x86/include/asm/paravirt_types.h2
-rw-r--r--arch/x86/include/asm/perf_event_p4.h62
-rw-r--r--arch/x86/include/asm/pgtable_types.h1
-rw-r--r--arch/x86/include/asm/processor.h25
-rw-r--r--arch/x86/include/asm/rwsem.h28
-rw-r--r--arch/x86/include/asm/suspend_32.h2
-rw-r--r--arch/x86/include/asm/suspend_64.h5
-rw-r--r--arch/x86/include/asm/sys_ia32.h12
-rw-r--r--arch/x86/include/asm/syscalls.h4
-rw-r--r--arch/x86/include/asm/thread_info.h2
-rw-r--r--arch/x86/include/asm/unistd.h8
-rw-r--r--arch/x86/include/asm/uprobes.h1
-rw-r--r--arch/x86/include/asm/vmx.h18
-rw-r--r--arch/x86/include/uapi/asm/kvm.h1
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h7
-rw-r--r--arch/x86/include/uapi/asm/vmx.h5
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
-rw-r--r--arch/x86/kernel/acpi/wakeup_32.S5
-rw-r--r--arch/x86/kernel/alternative.c2
-rw-r--r--arch/x86/kernel/amd_nb.c5
-rw-r--r--arch/x86/kernel/aperture_64.c2
-rw-r--r--arch/x86/kernel/apm_32.c1
-rw-r--r--arch/x86/kernel/asm-offsets_32.c3
-rw-r--r--arch/x86/kernel/asm-offsets_64.c1
-rw-r--r--arch/x86/kernel/cpu/Makefile9
-rw-r--r--arch/x86/kernel/cpu/amd.c48
-rw-r--r--arch/x86/kernel/cpu/bugs.c34
-rw-r--r--arch/x86/kernel/cpu/common.c4
-rw-r--r--arch/x86/kernel/cpu/cyrix.c5
-rw-r--r--arch/x86/kernel/cpu/intel.c34
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c39
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c25
-rw-r--r--arch/x86/kernel/cpu/mkcapflags.pl48
-rw-r--r--arch/x86/kernel/cpu/mkcapflags.sh41
-rw-r--r--arch/x86/kernel/cpu/perf_event.c89
-rw-r--r--arch/x86/kernel/cpu/perf_event.h56
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c138
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_uncore.c547
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c51
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c182
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c27
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c895
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h64
-rw-r--r--arch/x86/kernel/cpu/perf_event_knc.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c9
-rw-r--r--arch/x86/kernel/cpu/perf_event_p6.c2
-rw-r--r--arch/x86/kernel/cpu/proc.c6
-rw-r--r--arch/x86/kernel/cpu/scattered.c3
-rw-r--r--arch/x86/kernel/doublefault_32.c2
-rw-r--r--arch/x86/kernel/dumpstack.c28
-rw-r--r--arch/x86/kernel/dumpstack_32.c4
-rw-r--r--arch/x86/kernel/dumpstack_64.c6
-rw-r--r--arch/x86/kernel/early-quirks.c20
-rw-r--r--arch/x86/kernel/early_printk.c21
-rw-r--r--arch/x86/kernel/entry_64.S5
-rw-r--r--arch/x86/kernel/head64.c9
-rw-r--r--arch/x86/kernel/head_64.S1
-rw-r--r--arch/x86/kernel/irq.c26
-rw-r--r--arch/x86/kernel/irqinit.c4
-rw-r--r--arch/x86/kernel/kprobes/core.c6
-rw-r--r--arch/x86/kernel/kvm.c8
-rw-r--r--arch/x86/kernel/kvmclock.c9
-rw-r--r--arch/x86/kernel/paravirt.c1
-rw-r--r--arch/x86/kernel/process.c131
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c1
-rw-r--r--arch/x86/kernel/quirks.c18
-rw-r--r--arch/x86/kernel/rtc.c69
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/kernel/smpboot.c2
-rw-r--r--arch/x86/kernel/tls.c14
-rw-r--r--arch/x86/kernel/traps.c77
-rw-r--r--arch/x86/kernel/tsc.c6
-rw-r--r--arch/x86/kernel/uprobes.c29
-rw-r--r--arch/x86/kernel/vmlinux.lds.S4
-rw-r--r--arch/x86/kvm/Kconfig14
-rw-r--r--arch/x86/kvm/Makefile5
-rw-r--r--arch/x86/kvm/emulate.c31
-rw-r--r--arch/x86/kvm/i8254.c4
-rw-r--r--arch/x86/kvm/lapic.c189
-rw-r--r--arch/x86/kvm/lapic.h22
-rw-r--r--arch/x86/kvm/mmu.c108
-rw-r--r--arch/x86/kvm/mmu.h11
-rw-r--r--arch/x86/kvm/paging_tmpl.h2
-rw-r--r--arch/x86/kvm/pmu.c14
-rw-r--r--arch/x86/kvm/svm.c42
-rw-r--r--arch/x86/kvm/vmx.c1079
-rw-r--r--arch/x86/kvm/x86.c243
-rw-r--r--arch/x86/lguest/Kconfig3
-rw-r--r--arch/x86/lib/checksum_32.S2
-rw-r--r--arch/x86/lib/memcpy_32.c6
-rw-r--r--arch/x86/lib/memcpy_64.S2
-rw-r--r--arch/x86/lib/memmove_64.S6
-rw-r--r--arch/x86/lib/usercopy_32.c6
-rw-r--r--arch/x86/mm/amdtopology.c3
-rw-r--r--arch/x86/mm/fault.c10
-rw-r--r--arch/x86/mm/highmem_32.c1
-rw-r--r--arch/x86/mm/init.c5
-rw-r--r--arch/x86/mm/init_32.c10
-rw-r--r--arch/x86/mm/init_64.c76
-rw-r--r--arch/x86/mm/ioremap.c7
-rw-r--r--arch/x86/mm/numa.c9
-rw-r--r--arch/x86/mm/pageattr-test.c5
-rw-r--r--arch/x86/mm/pageattr.c9
-rw-r--r--arch/x86/pci/common.c11
-rw-r--r--arch/x86/pci/xen.c6
-rw-r--r--arch/x86/platform/efi/efi.c44
-rw-r--r--arch/x86/platform/efi/efi_64.c1
-rw-r--r--arch/x86/platform/mrst/mrst.c3
-rw-r--r--arch/x86/platform/mrst/vrtc.c44
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-sci.c4
-rw-r--r--arch/x86/platform/uv/uv_time.c3
-rw-r--r--arch/x86/power/cpu.c28
-rw-r--r--arch/x86/power/hibernate_asm_32.S4
-rw-r--r--arch/x86/power/hibernate_asm_64.S3
-rw-r--r--arch/x86/syscalls/syscall_32.tbl10
-rw-r--r--arch/x86/tools/Makefile1
-rw-r--r--arch/x86/tools/relocs.c783
-rw-r--r--arch/x86/tools/relocs.h36
-rw-r--r--arch/x86/tools/relocs_32.c17
-rw-r--r--arch/x86/tools/relocs_64.c17
-rw-r--r--arch/x86/tools/relocs_common.c76
-rw-r--r--arch/x86/um/tls_32.c5
-rw-r--r--arch/x86/xen/Kconfig2
-rw-r--r--arch/x86/xen/enlighten.c58
-rw-r--r--arch/x86/xen/mmu.c4
-rw-r--r--arch/x86/xen/smp.c23
-rw-r--r--arch/x86/xen/spinlock.c25
-rw-r--r--arch/x86/xen/time.c13
-rw-r--r--arch/xtensa/include/asm/unistd.h8
-rw-r--r--arch/xtensa/kernel/process.c14
-rw-r--r--arch/xtensa/kernel/traps.c10
-rw-r--r--arch/xtensa/mm/init.c21
-rw-r--r--arch/xtensa/platforms/iss/simdisk.c36
2001 files changed, 64868 insertions, 40029 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 1455579791ec..dd0e8eb8042f 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -157,9 +157,6 @@ config ARCH_USE_BUILTIN_BSWAP
157 instructions should set this. And it shouldn't hurt to set it 157 instructions should set this. And it shouldn't hurt to set it
158 on architectures that don't have such instructions. 158 on architectures that don't have such instructions.
159 159
160config HAVE_SYSCALL_WRAPPERS
161 bool
162
163config KRETPROBES 160config KRETPROBES
164 def_bool y 161 def_bool y
165 depends on KPROBES && HAVE_KRETPROBES 162 depends on KPROBES && HAVE_KRETPROBES
@@ -384,6 +381,12 @@ config MODULES_USE_ELF_REL
384 Modules only use ELF REL relocations. Modules with ELF RELA 381 Modules only use ELF REL relocations. Modules with ELF RELA
385 relocations will give an error. 382 relocations will give an error.
386 383
384config HAVE_UNDERSCORE_SYMBOL_PREFIX
385 bool
386 help
387 Some architectures generate an _ in front of C symbols; things like
388 module loading and assembly files need to know about this.
389
387# 390#
388# ABI hall of shame 391# ABI hall of shame
389# 392#
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 8a33ba01301f..8629127640cf 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -4,7 +4,6 @@ config ALPHA
4 select HAVE_AOUT 4 select HAVE_AOUT
5 select HAVE_IDE 5 select HAVE_IDE
6 select HAVE_OPROFILE 6 select HAVE_OPROFILE
7 select HAVE_SYSCALL_WRAPPERS
8 select HAVE_PCSPKR_PLATFORM 7 select HAVE_PCSPKR_PLATFORM
9 select HAVE_PERF_EVENTS 8 select HAVE_PERF_EVENTS
10 select HAVE_DMA_ATTRS 9 select HAVE_DMA_ATTRS
diff --git a/arch/alpha/include/asm/linkage.h b/arch/alpha/include/asm/linkage.h
index 291c2d01c44f..7cfd06e8c935 100644
--- a/arch/alpha/include/asm/linkage.h
+++ b/arch/alpha/include/asm/linkage.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
5#define SYSCALL_ALIAS(alias, name) \
6 asm ( #alias " = " #name "\n\t.globl " #alias)
5 7
6#endif 8#endif
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
index 1f8c72959fb6..52cd2a4a3ff4 100644
--- a/arch/alpha/include/asm/thread_info.h
+++ b/arch/alpha/include/asm/thread_info.h
@@ -95,8 +95,6 @@ register struct thread_info *__current_thread_info __asm__("$8");
95#define TS_POLLING 0x0010 /* idle task polling need_resched, 95#define TS_POLLING 0x0010 /* idle task polling need_resched,
96 skip sending interrupt */ 96 skip sending interrupt */
97 97
98#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
99
100#ifndef __ASSEMBLY__ 98#ifndef __ASSEMBLY__
101#define HAVE_SET_RESTORE_SIGMASK 1 99#define HAVE_SET_RESTORE_SIGMASK 1
102static inline void set_restore_sigmask(void) 100static inline void set_restore_sigmask(void)
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 6d6fe7ab5473..43baee17acdf 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -18,16 +18,4 @@
18#define __ARCH_WANT_SYS_VFORK 18#define __ARCH_WANT_SYS_VFORK
19#define __ARCH_WANT_SYS_CLONE 19#define __ARCH_WANT_SYS_CLONE
20 20
21/* "Conditional" syscalls. What we want is
22
23 __attribute__((weak,alias("sys_ni_syscall")))
24
25 but that raises the problem of what type to give the symbol. If we use
26 a prototype, it'll conflict with the definition given in this file and
27 others. If we use __typeof, we discover that not all symbols actually
28 have declarations. If we use no prototype, then we get warnings from
29 -Wstrict-prototypes. Ho hum. */
30
31#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
32
33#endif /* _ALPHA_UNISTD_H */ 21#endif /* _ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 63d27fb9b023..ab80a80d38a2 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -46,25 +46,6 @@
46void (*pm_power_off)(void) = machine_power_off; 46void (*pm_power_off)(void) = machine_power_off;
47EXPORT_SYMBOL(pm_power_off); 47EXPORT_SYMBOL(pm_power_off);
48 48
49void
50cpu_idle(void)
51{
52 current_thread_info()->status |= TS_POLLING;
53
54 while (1) {
55 /* FIXME -- EV6 and LCA45 know how to power down
56 the CPU. */
57
58 rcu_idle_enter();
59 while (!need_resched())
60 cpu_relax();
61
62 rcu_idle_exit();
63 schedule_preempt_disabled();
64 }
65}
66
67
68struct halt_info { 49struct halt_info {
69 int mode; 50 int mode;
70 char *restart_cmd; 51 char *restart_cmd;
@@ -194,6 +175,7 @@ machine_power_off(void)
194void 175void
195show_regs(struct pt_regs *regs) 176show_regs(struct pt_regs *regs)
196{ 177{
178 show_regs_print_info(KERN_DEFAULT);
197 dik_show_regs(regs, NULL); 179 dik_show_regs(regs, NULL);
198} 180}
199 181
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 9603bc234b47..7b60834fb4b2 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -167,8 +167,7 @@ smp_callin(void)
167 cpuid, current, current->active_mm)); 167 cpuid, current, current->active_mm));
168 168
169 preempt_disable(); 169 preempt_disable();
170 /* Do nothing. */ 170 cpu_startup_entry(CPUHP_ONLINE);
171 cpu_idle();
172} 171}
173 172
174/* Wait until hwrpb->txrdy is clear for cpu. Return -1 on timeout. */ 173/* Wait until hwrpb->txrdy is clear for cpu. Return -1 on timeout. */
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index e64559f0a82d..ffe996a54fad 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -51,13 +51,11 @@ MODULE_LICENSE("GPL");
51typedef struct _srm_env { 51typedef struct _srm_env {
52 char *name; 52 char *name;
53 unsigned long id; 53 unsigned long id;
54 struct proc_dir_entry *proc_entry;
55} srm_env_t; 54} srm_env_t;
56 55
57static struct proc_dir_entry *base_dir; 56static struct proc_dir_entry *base_dir;
58static struct proc_dir_entry *named_dir; 57static struct proc_dir_entry *named_dir;
59static struct proc_dir_entry *numbered_dir; 58static struct proc_dir_entry *numbered_dir;
60static char number[256][4];
61 59
62static srm_env_t srm_named_entries[] = { 60static srm_env_t srm_named_entries[] = {
63 { "auto_action", ENV_AUTO_ACTION }, 61 { "auto_action", ENV_AUTO_ACTION },
@@ -77,21 +75,18 @@ static srm_env_t srm_named_entries[] = {
77 { "tty_dev", ENV_TTY_DEV }, 75 { "tty_dev", ENV_TTY_DEV },
78 { NULL, 0 }, 76 { NULL, 0 },
79}; 77};
80static srm_env_t srm_numbered_entries[256];
81
82 78
83static int srm_env_proc_show(struct seq_file *m, void *v) 79static int srm_env_proc_show(struct seq_file *m, void *v)
84{ 80{
85 unsigned long ret; 81 unsigned long ret;
86 srm_env_t *entry; 82 unsigned long id = (unsigned long)m->private;
87 char *page; 83 char *page;
88 84
89 entry = m->private;
90 page = (char *)__get_free_page(GFP_USER); 85 page = (char *)__get_free_page(GFP_USER);
91 if (!page) 86 if (!page)
92 return -ENOMEM; 87 return -ENOMEM;
93 88
94 ret = callback_getenv(entry->id, page, PAGE_SIZE); 89 ret = callback_getenv(id, page, PAGE_SIZE);
95 90
96 if ((ret >> 61) == 0) { 91 if ((ret >> 61) == 0) {
97 seq_write(m, page, ret); 92 seq_write(m, page, ret);
@@ -104,14 +99,14 @@ static int srm_env_proc_show(struct seq_file *m, void *v)
104 99
105static int srm_env_proc_open(struct inode *inode, struct file *file) 100static int srm_env_proc_open(struct inode *inode, struct file *file)
106{ 101{
107 return single_open(file, srm_env_proc_show, PDE(inode)->data); 102 return single_open(file, srm_env_proc_show, PDE_DATA(inode));
108} 103}
109 104
110static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer, 105static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
111 size_t count, loff_t *pos) 106 size_t count, loff_t *pos)
112{ 107{
113 int res; 108 int res;
114 srm_env_t *entry = PDE(file_inode(file))->data; 109 unsigned long id = (unsigned long)PDE_DATA(file_inode(file));
115 char *buf = (char *) __get_free_page(GFP_USER); 110 char *buf = (char *) __get_free_page(GFP_USER);
116 unsigned long ret1, ret2; 111 unsigned long ret1, ret2;
117 112
@@ -127,7 +122,7 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
127 goto out; 122 goto out;
128 buf[count] = '\0'; 123 buf[count] = '\0';
129 124
130 ret1 = callback_setenv(entry->id, buf, count); 125 ret1 = callback_setenv(id, buf, count);
131 if ((ret1 >> 61) == 0) { 126 if ((ret1 >> 61) == 0) {
132 do 127 do
133 ret2 = callback_save_env(); 128 ret2 = callback_save_env();
@@ -149,52 +144,6 @@ static const struct file_operations srm_env_proc_fops = {
149 .write = srm_env_proc_write, 144 .write = srm_env_proc_write,
150}; 145};
151 146
152static void
153srm_env_cleanup(void)
154{
155 srm_env_t *entry;
156 unsigned long var_num;
157
158 if (base_dir) {
159 /*
160 * Remove named entries
161 */
162 if (named_dir) {
163 entry = srm_named_entries;
164 while (entry->name != NULL && entry->id != 0) {
165 if (entry->proc_entry) {
166 remove_proc_entry(entry->name,
167 named_dir);
168 entry->proc_entry = NULL;
169 }
170 entry++;
171 }
172 remove_proc_entry(NAMED_DIR, base_dir);
173 }
174
175 /*
176 * Remove numbered entries
177 */
178 if (numbered_dir) {
179 for (var_num = 0; var_num <= 255; var_num++) {
180 entry = &srm_numbered_entries[var_num];
181
182 if (entry->proc_entry) {
183 remove_proc_entry(entry->name,
184 numbered_dir);
185 entry->proc_entry = NULL;
186 entry->name = NULL;
187 }
188 }
189 remove_proc_entry(NUMBERED_DIR, base_dir);
190 }
191
192 remove_proc_entry(BASE_DIR, NULL);
193 }
194
195 return;
196}
197
198static int __init 147static int __init
199srm_env_init(void) 148srm_env_init(void)
200{ 149{
@@ -213,19 +162,13 @@ srm_env_init(void)
213 } 162 }
214 163
215 /* 164 /*
216 * Init numbers
217 */
218 for (var_num = 0; var_num <= 255; var_num++)
219 sprintf(number[var_num], "%ld", var_num);
220
221 /*
222 * Create base directory 165 * Create base directory
223 */ 166 */
224 base_dir = proc_mkdir(BASE_DIR, NULL); 167 base_dir = proc_mkdir(BASE_DIR, NULL);
225 if (!base_dir) { 168 if (!base_dir) {
226 printk(KERN_ERR "Couldn't create base dir /proc/%s\n", 169 printk(KERN_ERR "Couldn't create base dir /proc/%s\n",
227 BASE_DIR); 170 BASE_DIR);
228 goto cleanup; 171 return -ENOMEM;
229 } 172 }
230 173
231 /* 174 /*
@@ -254,9 +197,8 @@ srm_env_init(void)
254 */ 197 */
255 entry = srm_named_entries; 198 entry = srm_named_entries;
256 while (entry->name && entry->id) { 199 while (entry->name && entry->id) {
257 entry->proc_entry = proc_create_data(entry->name, 0644, named_dir, 200 if (!proc_create_data(entry->name, 0644, named_dir,
258 &srm_env_proc_fops, entry); 201 &srm_env_proc_fops, (void *)entry->id))
259 if (!entry->proc_entry)
260 goto cleanup; 202 goto cleanup;
261 entry++; 203 entry++;
262 } 204 }
@@ -265,15 +207,11 @@ srm_env_init(void)
265 * Create all numbered nodes 207 * Create all numbered nodes
266 */ 208 */
267 for (var_num = 0; var_num <= 255; var_num++) { 209 for (var_num = 0; var_num <= 255; var_num++) {
268 entry = &srm_numbered_entries[var_num]; 210 char name[4];
269 entry->name = number[var_num]; 211 sprintf(name, "%ld", var_num);
270 212 if (!proc_create_data(name, 0644, numbered_dir,
271 entry->proc_entry = proc_create_data(entry->name, 0644, numbered_dir, 213 &srm_env_proc_fops, (void *)var_num))
272 &srm_env_proc_fops, entry);
273 if (!entry->proc_entry)
274 goto cleanup; 214 goto cleanup;
275
276 entry->id = var_num;
277 } 215 }
278 216
279 printk(KERN_INFO "%s: version %s loaded successfully\n", NAME, 217 printk(KERN_INFO "%s: version %s loaded successfully\n", NAME,
@@ -282,18 +220,15 @@ srm_env_init(void)
282 return 0; 220 return 0;
283 221
284cleanup: 222cleanup:
285 srm_env_cleanup(); 223 remove_proc_subtree(BASE_DIR, NULL);
286
287 return -ENOMEM; 224 return -ENOMEM;
288} 225}
289 226
290static void __exit 227static void __exit
291srm_env_exit(void) 228srm_env_exit(void)
292{ 229{
293 srm_env_cleanup(); 230 remove_proc_subtree(BASE_DIR, NULL);
294 printk(KERN_INFO "%s: unloaded successfully\n", NAME); 231 printk(KERN_INFO "%s: unloaded successfully\n", NAME);
295
296 return;
297} 232}
298 233
299module_init(srm_env_init); 234module_init(srm_env_init);
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 1383f8601a93..1d4aabfcf9a1 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -185,7 +185,6 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
185 mb(); 185 mb();
186} 186}
187 187
188extern void free_reserved_mem(void *, void *);
189extern void pcibios_claim_one_bus(struct pci_bus *); 188extern void pcibios_claim_one_bus(struct pci_bus *);
190 189
191static struct resource irongate_io = { 190static struct resource irongate_io = {
@@ -239,8 +238,8 @@ nautilus_init_pci(void)
239 if (pci_mem < memtop) 238 if (pci_mem < memtop)
240 memtop = pci_mem; 239 memtop = pci_mem;
241 if (memtop > alpha_mv.min_mem_address) { 240 if (memtop > alpha_mv.min_mem_address) {
242 free_reserved_mem(__va(alpha_mv.min_mem_address), 241 free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address),
243 __va(memtop)); 242 (unsigned long)__va(memtop), 0, NULL);
244 printk("nautilus_init_pci: %ldk freed\n", 243 printk("nautilus_init_pci: %ldk freed\n",
245 (memtop - alpha_mv.min_mem_address) >> 10); 244 (memtop - alpha_mv.min_mem_address) >> 10);
246 } 245 }
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index 4037461a6493..affccb959a9e 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -169,13 +169,6 @@ void show_stack(struct task_struct *task, unsigned long *sp)
169 dik_show_trace(sp); 169 dik_show_trace(sp);
170} 170}
171 171
172void dump_stack(void)
173{
174 show_stack(NULL, NULL);
175}
176
177EXPORT_SYMBOL(dump_stack);
178
179void 172void
180die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15) 173die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
181{ 174{
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 1ad6ca74bed2..0ba85ee4a466 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -31,6 +31,7 @@
31#include <asm/console.h> 31#include <asm/console.h>
32#include <asm/tlb.h> 32#include <asm/tlb.h>
33#include <asm/setup.h> 33#include <asm/setup.h>
34#include <asm/sections.h>
34 35
35extern void die_if_kernel(char *,struct pt_regs *,long); 36extern void die_if_kernel(char *,struct pt_regs *,long);
36 37
@@ -281,8 +282,6 @@ printk_memory_info(void)
281{ 282{
282 unsigned long codesize, reservedpages, datasize, initsize, tmp; 283 unsigned long codesize, reservedpages, datasize, initsize, tmp;
283 extern int page_is_ram(unsigned long) __init; 284 extern int page_is_ram(unsigned long) __init;
284 extern char _text, _etext, _data, _edata;
285 extern char __init_begin, __init_end;
286 285
287 /* printk all informations */ 286 /* printk all informations */
288 reservedpages = 0; 287 reservedpages = 0;
@@ -318,32 +317,15 @@ mem_init(void)
318#endif /* CONFIG_DISCONTIGMEM */ 317#endif /* CONFIG_DISCONTIGMEM */
319 318
320void 319void
321free_reserved_mem(void *start, void *end)
322{
323 void *__start = start;
324 for (; __start < end; __start += PAGE_SIZE) {
325 ClearPageReserved(virt_to_page(__start));
326 init_page_count(virt_to_page(__start));
327 free_page((long)__start);
328 totalram_pages++;
329 }
330}
331
332void
333free_initmem(void) 320free_initmem(void)
334{ 321{
335 extern char __init_begin, __init_end; 322 free_initmem_default(0);
336
337 free_reserved_mem(&__init_begin, &__init_end);
338 printk ("Freeing unused kernel memory: %ldk freed\n",
339 (&__init_end - &__init_begin) >> 10);
340} 323}
341 324
342#ifdef CONFIG_BLK_DEV_INITRD 325#ifdef CONFIG_BLK_DEV_INITRD
343void 326void
344free_initrd_mem(unsigned long start, unsigned long end) 327free_initrd_mem(unsigned long start, unsigned long end)
345{ 328{
346 free_reserved_mem((void *)start, (void *)end); 329 free_reserved_area(start, end, 0, "initrd");
347 printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
348} 330}
349#endif 331#endif
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 3973ae395772..33885048fa36 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -17,6 +17,7 @@
17 17
18#include <asm/hwrpb.h> 18#include <asm/hwrpb.h>
19#include <asm/pgalloc.h> 19#include <asm/pgalloc.h>
20#include <asm/sections.h>
20 21
21pg_data_t node_data[MAX_NUMNODES]; 22pg_data_t node_data[MAX_NUMNODES];
22EXPORT_SYMBOL(node_data); 23EXPORT_SYMBOL(node_data);
@@ -325,8 +326,6 @@ void __init mem_init(void)
325{ 326{
326 unsigned long codesize, reservedpages, datasize, initsize, pfn; 327 unsigned long codesize, reservedpages, datasize, initsize, pfn;
327 extern int page_is_ram(unsigned long) __init; 328 extern int page_is_ram(unsigned long) __init;
328 extern char _text, _etext, _data, _edata;
329 extern char __init_begin, __init_end;
330 unsigned long nid, i; 329 unsigned long nid, i;
331 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 330 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
332 331
diff --git a/arch/arc/kernel/disasm.c b/arch/arc/kernel/disasm.c
index 2f390289a792..d14764ae2c60 100644
--- a/arch/arc/kernel/disasm.c
+++ b/arch/arc/kernel/disasm.c
@@ -535,4 +535,4 @@ int __kprobes disasm_next_pc(unsigned long pc, struct pt_regs *regs,
535 return instr.is_branch; 535 return instr.is_branch;
536} 536}
537 537
538#endif /* CONFIG_KGDB || CONFIG_MISALIGN_ACCESS || CONFIG_KPROBES */ 538#endif /* CONFIG_KGDB || CONFIG_ARC_MISALIGN_ACCESS || CONFIG_KPROBES */
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
index 0a7531d99294..cad66851e0c4 100644
--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -41,37 +41,12 @@ SYSCALL_DEFINE0(arc_gettls)
41 return task_thread_info(current)->thr_ptr; 41 return task_thread_info(current)->thr_ptr;
42} 42}
43 43
44static inline void arch_idle(void) 44void arch_cpu_idle(void)
45{ 45{
46 /* sleep, but enable all interrupts before committing */ 46 /* sleep, but enable all interrupts before committing */
47 __asm__("sleep 0x3"); 47 __asm__("sleep 0x3");
48} 48}
49 49
50void cpu_idle(void)
51{
52 /* Since we SLEEP in idle loop, TIF_POLLING_NRFLAG can't be set */
53
54 /* endless idle loop with no priority at all */
55 while (1) {
56 tick_nohz_idle_enter();
57 rcu_idle_enter();
58
59doze:
60 local_irq_disable();
61 if (!need_resched()) {
62 arch_idle();
63 goto doze;
64 } else {
65 local_irq_enable();
66 }
67
68 rcu_idle_exit();
69 tick_nohz_idle_exit();
70
71 schedule_preempt_disabled();
72 }
73}
74
75asmlinkage void ret_from_fork(void); 50asmlinkage void ret_from_fork(void);
76 51
77/* Layout of Child kernel mode stack as setup at the end of this function is 52/* Layout of Child kernel mode stack as setup at the end of this function is
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index 3af3e06dcf02..5c7fd603d216 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -141,7 +141,7 @@ void __cpuinit start_kernel_secondary(void)
141 141
142 local_irq_enable(); 142 local_irq_enable();
143 preempt_disable(); 143 preempt_disable();
144 cpu_idle(); 144 cpu_startup_entry(CPUHP_ONLINE);
145} 145}
146 146
147/* 147/*
diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
index a63ff842564b..ca0207b9d5b6 100644
--- a/arch/arc/kernel/stacktrace.c
+++ b/arch/arc/kernel/stacktrace.c
@@ -220,13 +220,6 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
220 show_stacktrace(tsk, NULL); 220 show_stacktrace(tsk, NULL);
221} 221}
222 222
223/* Expected by Rest of kernel code */
224void dump_stack(void)
225{
226 show_stacktrace(NULL, NULL);
227}
228EXPORT_SYMBOL(dump_stack);
229
230/* Another API expected by schedular, shows up in "ps" as Wait Channel 223/* Another API expected by schedular, shows up in "ps" as Wait Channel
231 * Ofcourse just returning schedule( ) would be pointless so unwind until 224 * Ofcourse just returning schedule( ) would be pointless so unwind until
232 * the function is not in schedular code 225 * the function is not in schedular code
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 7c10873c311f..0aec01985bf9 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -71,7 +71,7 @@ void print_task_path_n_nm(struct task_struct *tsk, char *buf)
71 } 71 }
72 72
73done: 73done:
74 pr_info("%s, TGID %u\n", path_nm, tsk->tgid); 74 pr_info("Path: %s\n", path_nm);
75} 75}
76EXPORT_SYMBOL(print_task_path_n_nm); 76EXPORT_SYMBOL(print_task_path_n_nm);
77 77
@@ -163,6 +163,7 @@ void show_regs(struct pt_regs *regs)
163 return; 163 return;
164 164
165 print_task_path_n_nm(tsk, buf); 165 print_task_path_n_nm(tsk, buf);
166 show_regs_print_info(KERN_INFO);
166 167
167 if (current->thread.cause_code) 168 if (current->thread.cause_code)
168 show_ecr_verbose(regs); 169 show_ecr_verbose(regs);
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index caf797de23fc..727d4794ea0f 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -144,37 +144,18 @@ void __init mem_init(void)
144 PAGES_TO_KB(reserved_pages)); 144 PAGES_TO_KB(reserved_pages));
145} 145}
146 146
147static void __init free_init_pages(const char *what, unsigned long begin,
148 unsigned long end)
149{
150 unsigned long addr;
151
152 pr_info("Freeing %s: %ldk [%lx] to [%lx]\n",
153 what, TO_KB(end - begin), begin, end);
154
155 /* need to check that the page we free is not a partial page */
156 for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) {
157 ClearPageReserved(virt_to_page(addr));
158 init_page_count(virt_to_page(addr));
159 free_page(addr);
160 totalram_pages++;
161 }
162}
163
164/* 147/*
165 * free_initmem: Free all the __init memory. 148 * free_initmem: Free all the __init memory.
166 */ 149 */
167void __init_refok free_initmem(void) 150void __init_refok free_initmem(void)
168{ 151{
169 free_init_pages("unused kernel memory", 152 free_initmem_default(0);
170 (unsigned long)__init_begin,
171 (unsigned long)__init_end);
172} 153}
173 154
174#ifdef CONFIG_BLK_DEV_INITRD 155#ifdef CONFIG_BLK_DEV_INITRD
175void __init free_initrd_mem(unsigned long start, unsigned long end) 156void __init free_initrd_mem(unsigned long start, unsigned long end)
176{ 157{
177 free_init_pages("initrd memory", start, end); 158 free_reserved_area(start, end, 0, "initrd");
178} 159}
179#endif 160#endif
180 161
diff --git a/arch/arc/plat-arcfpga/Kconfig b/arch/arc/plat-arcfpga/Kconfig
index b41e786cdbc0..295cefeb25d3 100644
--- a/arch/arc/plat-arcfpga/Kconfig
+++ b/arch/arc/plat-arcfpga/Kconfig
@@ -53,7 +53,7 @@ menuconfig ARC_HAS_BVCI_LAT_UNIT
53 bool "BVCI Bus Latency Unit" 53 bool "BVCI Bus Latency Unit"
54 depends on ARC_BOARD_ML509 || ARC_BOARD_ANGEL4 54 depends on ARC_BOARD_ML509 || ARC_BOARD_ANGEL4
55 help 55 help
56 IP to add artifical latency to BVCI Bus Based FPGA builds. 56 IP to add artificial latency to BVCI Bus Based FPGA builds.
57 The default latency (even worst case) for FPGA is non-realistic 57 The default latency (even worst case) for FPGA is non-realistic
58 (~10 SDRAM, ~5 SSRAM). 58 (~10 SDRAM, ~5 SSRAM).
59 59
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1cacda426a0e..1e31dac36a5f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -15,6 +15,7 @@ config ARM
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
16 select GENERIC_PCI_IOMAP 16 select GENERIC_PCI_IOMAP
17 select GENERIC_SMP_IDLE_THREAD 17 select GENERIC_SMP_IDLE_THREAD
18 select GENERIC_IDLE_POLL_SETUP
18 select GENERIC_STRNCPY_FROM_USER 19 select GENERIC_STRNCPY_FROM_USER
19 select GENERIC_STRNLEN_USER 20 select GENERIC_STRNLEN_USER
20 select HARDIRQS_SW_RESEND 21 select HARDIRQS_SW_RESEND
@@ -58,6 +59,7 @@ config ARM
58 select CLONE_BACKWARDS 59 select CLONE_BACKWARDS
59 select OLD_SIGSUSPEND3 60 select OLD_SIGSUSPEND3
60 select OLD_SIGACTION 61 select OLD_SIGACTION
62 select HAVE_CONTEXT_TRACKING
61 help 63 help
62 The ARM series is a line of low-power-consumption RISC chip designs 64 The ARM series is a line of low-power-consumption RISC chip designs
63 licensed by ARM Ltd and targeted at embedded applications and 65 licensed by ARM Ltd and targeted at embedded applications and
@@ -361,37 +363,6 @@ config ARCH_AT91
361 This enables support for systems based on Atmel 363 This enables support for systems based on Atmel
362 AT91RM9200 and AT91SAM9* processors. 364 AT91RM9200 and AT91SAM9* processors.
363 365
364config ARCH_BCM2835
365 bool "Broadcom BCM2835 family"
366 select ARCH_REQUIRE_GPIOLIB
367 select ARM_AMBA
368 select ARM_ERRATA_411920
369 select ARM_TIMER_SP804
370 select CLKDEV_LOOKUP
371 select CLKSRC_OF
372 select COMMON_CLK
373 select CPU_V6
374 select GENERIC_CLOCKEVENTS
375 select MULTI_IRQ_HANDLER
376 select PINCTRL
377 select PINCTRL_BCM2835
378 select SPARSE_IRQ
379 select USE_OF
380 help
381 This enables support for the Broadcom BCM2835 SoC. This SoC is
382 use in the Raspberry Pi, and Roku 2 devices.
383
384config ARCH_CNS3XXX
385 bool "Cavium Networks CNS3XXX family"
386 select ARM_GIC
387 select CPU_V6K
388 select GENERIC_CLOCKEVENTS
389 select MIGHT_HAVE_CACHE_L2X0
390 select MIGHT_HAVE_PCI
391 select PCI_DOMAINS if PCI
392 help
393 Support for Cavium Networks CNS3XXX platform.
394
395config ARCH_CLPS711X 366config ARCH_CLPS711X
396 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 367 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
397 select ARCH_REQUIRE_GPIOLIB 368 select ARCH_REQUIRE_GPIOLIB
@@ -410,25 +381,11 @@ config ARCH_GEMINI
410 bool "Cortina Systems Gemini" 381 bool "Cortina Systems Gemini"
411 select ARCH_REQUIRE_GPIOLIB 382 select ARCH_REQUIRE_GPIOLIB
412 select ARCH_USES_GETTIMEOFFSET 383 select ARCH_USES_GETTIMEOFFSET
384 select NEED_MACH_GPIO_H
413 select CPU_FA526 385 select CPU_FA526
414 help 386 help
415 Support for the Cortina Systems Gemini family SoCs 387 Support for the Cortina Systems Gemini family SoCs
416 388
417config ARCH_SIRF
418 bool "CSR SiRF"
419 select ARCH_REQUIRE_GPIOLIB
420 select AUTO_ZRELADDR
421 select COMMON_CLK
422 select GENERIC_CLOCKEVENTS
423 select GENERIC_IRQ_CHIP
424 select MIGHT_HAVE_CACHE_L2X0
425 select NO_IOPORT
426 select PINCTRL
427 select PINCTRL_SIRF
428 select USE_OF
429 help
430 Support for CSR SiRFprimaII/Marco/Polo platforms
431
432config ARCH_EBSA110 389config ARCH_EBSA110
433 bool "EBSA-110" 390 bool "EBSA-110"
434 select ARCH_USES_GETTIMEOFFSET 391 select ARCH_USES_GETTIMEOFFSET
@@ -468,21 +425,6 @@ config ARCH_FOOTBRIDGE
468 Support for systems based on the DC21285 companion chip 425 Support for systems based on the DC21285 companion chip
469 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. 426 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
470 427
471config ARCH_MXS
472 bool "Freescale MXS-based"
473 select ARCH_REQUIRE_GPIOLIB
474 select CLKDEV_LOOKUP
475 select CLKSRC_MMIO
476 select COMMON_CLK
477 select GENERIC_CLOCKEVENTS
478 select HAVE_CLK_PREPARE
479 select MULTI_IRQ_HANDLER
480 select PINCTRL
481 select SPARSE_IRQ
482 select USE_OF
483 help
484 Support for Freescale MXS-based family of processors
485
486config ARCH_NETX 428config ARCH_NETX
487 bool "Hilscher NetX based" 429 bool "Hilscher NetX based"
488 select ARM_VIC 430 select ARM_VIC
@@ -492,14 +434,6 @@ config ARCH_NETX
492 help 434 help
493 This enables support for systems based on the Hilscher NetX Soc 435 This enables support for systems based on the Hilscher NetX Soc
494 436
495config ARCH_H720X
496 bool "Hynix HMS720x-based"
497 select ARCH_USES_GETTIMEOFFSET
498 select CPU_ARM720T
499 select ISA_DMA_API
500 help
501 This enables support for systems based on the Hynix HMS720x
502
503config ARCH_IOP13XX 437config ARCH_IOP13XX
504 bool "IOP13xx-based" 438 bool "IOP13xx-based"
505 depends on MMU 439 depends on MMU
@@ -549,6 +483,8 @@ config ARCH_IXP4XX
549 select GENERIC_CLOCKEVENTS 483 select GENERIC_CLOCKEVENTS
550 select MIGHT_HAVE_PCI 484 select MIGHT_HAVE_PCI
551 select NEED_MACH_IO_H 485 select NEED_MACH_IO_H
486 select USB_EHCI_BIG_ENDIAN_MMIO
487 select USB_EHCI_BIG_ENDIAN_DESC
552 help 488 help
553 Support for Intel's IXP4XX (XScale) family of processors. 489 Support for Intel's IXP4XX (XScale) family of processors.
554 490
@@ -661,24 +597,6 @@ config ARCH_LPC32XX
661 help 597 help
662 Support for the NXP LPC32XX family of processors 598 Support for the NXP LPC32XX family of processors
663 599
664config ARCH_TEGRA
665 bool "NVIDIA Tegra"
666 select ARCH_HAS_CPUFREQ
667 select ARCH_REQUIRE_GPIOLIB
668 select CLKDEV_LOOKUP
669 select CLKSRC_MMIO
670 select CLKSRC_OF
671 select COMMON_CLK
672 select GENERIC_CLOCKEVENTS
673 select HAVE_CLK
674 select HAVE_SMP
675 select MIGHT_HAVE_CACHE_L2X0
676 select SPARSE_IRQ
677 select USE_OF
678 help
679 This enables support for NVIDIA Tegra based systems (Tegra APX,
680 Tegra 6xx and Tegra 2 series).
681
682config ARCH_PXA 600config ARCH_PXA
683 bool "PXA2xx/PXA3xx-based" 601 bool "PXA2xx/PXA3xx-based"
684 depends on MMU 602 depends on MMU
@@ -716,6 +634,8 @@ config ARCH_SHMOBILE
716 bool "Renesas SH-Mobile / R-Mobile" 634 bool "Renesas SH-Mobile / R-Mobile"
717 select CLKDEV_LOOKUP 635 select CLKDEV_LOOKUP
718 select GENERIC_CLOCKEVENTS 636 select GENERIC_CLOCKEVENTS
637 select HAVE_ARM_SCU if SMP
638 select HAVE_ARM_TWD if LOCAL_TIMERS
719 select HAVE_CLK 639 select HAVE_CLK
720 select HAVE_MACH_CLKDEV 640 select HAVE_MACH_CLKDEV
721 select HAVE_SMP 641 select HAVE_SMP
@@ -769,12 +689,15 @@ config ARCH_SA1100
769config ARCH_S3C24XX 689config ARCH_S3C24XX
770 bool "Samsung S3C24XX SoCs" 690 bool "Samsung S3C24XX SoCs"
771 select ARCH_HAS_CPUFREQ 691 select ARCH_HAS_CPUFREQ
772 select ARCH_USES_GETTIMEOFFSET 692 select ARCH_REQUIRE_GPIOLIB
773 select CLKDEV_LOOKUP 693 select CLKDEV_LOOKUP
694 select CLKSRC_MMIO
695 select GENERIC_CLOCKEVENTS
774 select HAVE_CLK 696 select HAVE_CLK
775 select HAVE_S3C2410_I2C if I2C 697 select HAVE_S3C2410_I2C if I2C
776 select HAVE_S3C2410_WATCHDOG if WATCHDOG 698 select HAVE_S3C2410_WATCHDOG if WATCHDOG
777 select HAVE_S3C_RTC if RTC_CLASS 699 select HAVE_S3C_RTC if RTC_CLASS
700 select MULTI_IRQ_HANDLER
778 select NEED_MACH_GPIO_H 701 select NEED_MACH_GPIO_H
779 select NEED_MACH_IO_H 702 select NEED_MACH_IO_H
780 help 703 help
@@ -787,10 +710,11 @@ config ARCH_S3C64XX
787 bool "Samsung S3C64XX" 710 bool "Samsung S3C64XX"
788 select ARCH_HAS_CPUFREQ 711 select ARCH_HAS_CPUFREQ
789 select ARCH_REQUIRE_GPIOLIB 712 select ARCH_REQUIRE_GPIOLIB
790 select ARCH_USES_GETTIMEOFFSET
791 select ARM_VIC 713 select ARM_VIC
792 select CLKDEV_LOOKUP 714 select CLKDEV_LOOKUP
715 select CLKSRC_MMIO
793 select CPU_V6 716 select CPU_V6
717 select GENERIC_CLOCKEVENTS
794 select HAVE_CLK 718 select HAVE_CLK
795 select HAVE_S3C2410_I2C if I2C 719 select HAVE_S3C2410_I2C if I2C
796 select HAVE_S3C2410_WATCHDOG if WATCHDOG 720 select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -824,9 +748,11 @@ config ARCH_S5P64X0
824 748
825config ARCH_S5PC100 749config ARCH_S5PC100
826 bool "Samsung S5PC100" 750 bool "Samsung S5PC100"
827 select ARCH_USES_GETTIMEOFFSET 751 select ARCH_REQUIRE_GPIOLIB
828 select CLKDEV_LOOKUP 752 select CLKDEV_LOOKUP
753 select CLKSRC_MMIO
829 select CPU_V7 754 select CPU_V7
755 select GENERIC_CLOCKEVENTS
830 select HAVE_CLK 756 select HAVE_CLK
831 select HAVE_S3C2410_I2C if I2C 757 select HAVE_S3C2410_I2C if I2C
832 select HAVE_S3C2410_WATCHDOG if WATCHDOG 758 select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -859,6 +785,7 @@ config ARCH_EXYNOS
859 select ARCH_HAS_HOLES_MEMORYMODEL 785 select ARCH_HAS_HOLES_MEMORYMODEL
860 select ARCH_SPARSEMEM_ENABLE 786 select ARCH_SPARSEMEM_ENABLE
861 select CLKDEV_LOOKUP 787 select CLKDEV_LOOKUP
788 select COMMON_CLK
862 select CPU_V7 789 select CPU_V7
863 select GENERIC_CLOCKEVENTS 790 select GENERIC_CLOCKEVENTS
864 select HAVE_CLK 791 select HAVE_CLK
@@ -901,51 +828,6 @@ config ARCH_U300
901 help 828 help
902 Support for ST-Ericsson U300 series mobile platforms. 829 Support for ST-Ericsson U300 series mobile platforms.
903 830
904config ARCH_U8500
905 bool "ST-Ericsson U8500 Series"
906 depends on MMU
907 select ARCH_HAS_CPUFREQ
908 select ARCH_REQUIRE_GPIOLIB
909 select ARM_AMBA
910 select CLKDEV_LOOKUP
911 select CPU_V7
912 select GENERIC_CLOCKEVENTS
913 select HAVE_SMP
914 select MIGHT_HAVE_CACHE_L2X0
915 select SPARSE_IRQ
916 help
917 Support for ST-Ericsson's Ux500 architecture
918
919config ARCH_NOMADIK
920 bool "STMicroelectronics Nomadik"
921 select ARCH_REQUIRE_GPIOLIB
922 select ARM_AMBA
923 select ARM_VIC
924 select CLKSRC_NOMADIK_MTU
925 select COMMON_CLK
926 select CPU_ARM926T
927 select GENERIC_CLOCKEVENTS
928 select MIGHT_HAVE_CACHE_L2X0
929 select USE_OF
930 select PINCTRL
931 select PINCTRL_STN8815
932 select SPARSE_IRQ
933 help
934 Support for the Nomadik platform by ST-Ericsson
935
936config PLAT_SPEAR
937 bool "ST SPEAr"
938 select ARCH_HAS_CPUFREQ
939 select ARCH_REQUIRE_GPIOLIB
940 select ARM_AMBA
941 select CLKDEV_LOOKUP
942 select CLKSRC_MMIO
943 select COMMON_CLK
944 select GENERIC_CLOCKEVENTS
945 select HAVE_CLK
946 help
947 Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx).
948
949config ARCH_DAVINCI 831config ARCH_DAVINCI
950 bool "TI DaVinci" 832 bool "TI DaVinci"
951 select ARCH_HAS_HOLES_MEMORYMODEL 833 select ARCH_HAS_HOLES_MEMORYMODEL
@@ -1037,6 +919,8 @@ source "arch/arm/mach-at91/Kconfig"
1037 919
1038source "arch/arm/mach-bcm/Kconfig" 920source "arch/arm/mach-bcm/Kconfig"
1039 921
922source "arch/arm/mach-bcm2835/Kconfig"
923
1040source "arch/arm/mach-clps711x/Kconfig" 924source "arch/arm/mach-clps711x/Kconfig"
1041 925
1042source "arch/arm/mach-cns3xxx/Kconfig" 926source "arch/arm/mach-cns3xxx/Kconfig"
@@ -1051,8 +935,6 @@ source "arch/arm/mach-footbridge/Kconfig"
1051 935
1052source "arch/arm/mach-gemini/Kconfig" 936source "arch/arm/mach-gemini/Kconfig"
1053 937
1054source "arch/arm/mach-h720x/Kconfig"
1055
1056source "arch/arm/mach-highbank/Kconfig" 938source "arch/arm/mach-highbank/Kconfig"
1057 939
1058source "arch/arm/mach-integrator/Kconfig" 940source "arch/arm/mach-integrator/Kconfig"
@@ -1104,7 +986,7 @@ source "arch/arm/plat-samsung/Kconfig"
1104 986
1105source "arch/arm/mach-socfpga/Kconfig" 987source "arch/arm/mach-socfpga/Kconfig"
1106 988
1107source "arch/arm/plat-spear/Kconfig" 989source "arch/arm/mach-spear/Kconfig"
1108 990
1109source "arch/arm/mach-s3c24xx/Kconfig" 991source "arch/arm/mach-s3c24xx/Kconfig"
1110 992
@@ -1173,7 +1055,6 @@ config PLAT_VERSATILE
1173config ARM_TIMER_SP804 1055config ARM_TIMER_SP804
1174 bool 1056 bool
1175 select CLKSRC_MMIO 1057 select CLKSRC_MMIO
1176 select HAVE_SCHED_CLOCK
1177 1058
1178source arch/arm/mm/Kconfig 1059source arch/arm/mm/Kconfig
1179 1060
@@ -1532,7 +1413,6 @@ config SMP
1532 depends on GENERIC_CLOCKEVENTS 1413 depends on GENERIC_CLOCKEVENTS
1533 depends on HAVE_SMP 1414 depends on HAVE_SMP
1534 depends on MMU 1415 depends on MMU
1535 select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
1536 select USE_GENERIC_SMP_HELPERS 1416 select USE_GENERIC_SMP_HELPERS
1537 help 1417 help
1538 This enables support for systems with more than one CPU. If you have 1418 This enables support for systems with more than one CPU. If you have
@@ -1603,9 +1483,18 @@ config HAVE_ARM_ARCH_TIMER
1603config HAVE_ARM_TWD 1483config HAVE_ARM_TWD
1604 bool 1484 bool
1605 depends on SMP 1485 depends on SMP
1486 select CLKSRC_OF if OF
1606 help 1487 help
1607 This options enables support for the ARM timer and watchdog unit 1488 This options enables support for the ARM timer and watchdog unit
1608 1489
1490config MCPM
1491 bool "Multi-Cluster Power Management"
1492 depends on CPU_V7 && SMP
1493 help
1494 This option provides the common power management infrastructure
1495 for (multi-)cluster based systems, such as big.LITTLE based
1496 systems.
1497
1609choice 1498choice
1610 prompt "Memory split" 1499 prompt "Memory split"
1611 default VMSPLIT_3G 1500 default VMSPLIT_3G
@@ -1656,7 +1545,6 @@ config LOCAL_TIMERS
1656 bool "Use local timer interrupts" 1545 bool "Use local timer interrupts"
1657 depends on SMP 1546 depends on SMP
1658 default y 1547 default y
1659 select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT)
1660 help 1548 help
1661 Enable support for local timers on SMP platforms, rather then the 1549 Enable support for local timers on SMP platforms, rather then the
1662 legacy IPI broadcast method. Local timers allows the system 1550 legacy IPI broadcast method. Local timers allows the system
@@ -1670,8 +1558,9 @@ config ARCH_NR_GPIO
1670 int 1558 int
1671 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1559 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
1672 default 512 if SOC_OMAP5 1560 default 512 if SOC_OMAP5
1673 default 355 if ARCH_U8500 1561 default 392 if ARCH_U8500
1674 default 288 if ARCH_VT8500 || ARCH_SUNXI 1562 default 352 if ARCH_VT8500
1563 default 288 if ARCH_SUNXI
1675 default 264 if MACH_H4700 1564 default 264 if MACH_H4700
1676 default 0 1565 default 0
1677 help 1566 help
@@ -1693,8 +1582,9 @@ config SCHED_HRTICK
1693 def_bool HIGH_RES_TIMERS 1582 def_bool HIGH_RES_TIMERS
1694 1583
1695config THUMB2_KERNEL 1584config THUMB2_KERNEL
1696 bool "Compile the kernel in Thumb-2 mode" 1585 bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
1697 depends on CPU_V7 && !CPU_V6 && !CPU_V6K 1586 depends on CPU_V7 && !CPU_V6 && !CPU_V6K
1587 default y if CPU_THUMBONLY
1698 select AEABI 1588 select AEABI
1699 select ARM_ASM_UNIFIED 1589 select ARM_ASM_UNIFIED
1700 select ARM_UNWIND 1590 select ARM_UNWIND
@@ -2160,40 +2050,8 @@ endmenu
2160menu "CPU Power Management" 2050menu "CPU Power Management"
2161 2051
2162if ARCH_HAS_CPUFREQ 2052if ARCH_HAS_CPUFREQ
2163
2164source "drivers/cpufreq/Kconfig" 2053source "drivers/cpufreq/Kconfig"
2165 2054
2166config CPU_FREQ_IMX
2167 tristate "CPUfreq driver for i.MX CPUs"
2168 depends on ARCH_MXC && CPU_FREQ
2169 select CPU_FREQ_TABLE
2170 help
2171 This enables the CPUfreq driver for i.MX CPUs.
2172
2173config CPU_FREQ_SA1100
2174 bool
2175
2176config CPU_FREQ_SA1110
2177 bool
2178
2179config CPU_FREQ_INTEGRATOR
2180 tristate "CPUfreq driver for ARM Integrator CPUs"
2181 depends on ARCH_INTEGRATOR && CPU_FREQ
2182 default y
2183 help
2184 This enables the CPUfreq driver for ARM Integrator CPUs.
2185
2186 For details, take a look at <file:Documentation/cpu-freq>.
2187
2188 If in doubt, say Y.
2189
2190config CPU_FREQ_PXA
2191 bool
2192 depends on CPU_FREQ && ARCH_PXA && PXA25x
2193 default y
2194 select CPU_FREQ_DEFAULT_GOV_USERSPACE
2195 select CPU_FREQ_TABLE
2196
2197config CPU_FREQ_S3C 2055config CPU_FREQ_S3C
2198 bool 2056 bool
2199 help 2057 help
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 9b31f4311ea2..f57a6ba26e04 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -89,6 +89,10 @@ choice
89 bool "Kernel low-level debugging on 9263 and 9g45" 89 bool "Kernel low-level debugging on 9263 and 9g45"
90 depends on HAVE_AT91_DBGU1 90 depends on HAVE_AT91_DBGU1
91 91
92 config DEBUG_BCM2835
93 bool "Kernel low-level debugging on BCM2835 PL011 UART"
94 depends on ARCH_BCM2835
95
92 config DEBUG_CLPS711X_UART1 96 config DEBUG_CLPS711X_UART1
93 bool "Kernel low-level debugging messages via UART1" 97 bool "Kernel low-level debugging messages via UART1"
94 depends on ARCH_CLPS711X 98 depends on ARCH_CLPS711X
@@ -103,6 +107,13 @@ choice
103 Say Y here if you want the debug print routines to direct 107 Say Y here if you want the debug print routines to direct
104 their output to the second serial port on these devices. 108 their output to the second serial port on these devices.
105 109
110 config DEBUG_CNS3XXX
111 bool "Kernel Kernel low-level debugging on Cavium Networks CNS3xxx"
112 depends on ARCH_CNS3XXX
113 help
114 Say Y here if you want the debug print routines to direct
115 their output to the CNS3xxx UART0.
116
106 config DEBUG_DAVINCI_DA8XX_UART1 117 config DEBUG_DAVINCI_DA8XX_UART1
107 bool "Kernel low-level debugging on DaVinci DA8XX using UART1" 118 bool "Kernel low-level debugging on DaVinci DA8XX using UART1"
108 depends on ARCH_DAVINCI_DA8XX 119 depends on ARCH_DAVINCI_DA8XX
@@ -298,6 +309,13 @@ choice
298 Say Y here if you want kernel low-level debugging support 309 Say Y here if you want kernel low-level debugging support
299 on MVEBU based platforms. 310 on MVEBU based platforms.
300 311
312 config DEBUG_NOMADIK_UART
313 bool "Kernel low-level debugging messages via NOMADIK UART"
314 depends on ARCH_NOMADIK
315 help
316 Say Y here if you want kernel low-level debugging support
317 on NOMADIK based platforms.
318
301 config DEBUG_OMAP2PLUS_UART 319 config DEBUG_OMAP2PLUS_UART
302 bool "Kernel low-level debugging messages via OMAP2PLUS UART" 320 bool "Kernel low-level debugging messages via OMAP2PLUS UART"
303 depends on ARCH_OMAP2PLUS 321 depends on ARCH_OMAP2PLUS
@@ -312,6 +330,13 @@ choice
312 Say Y here if you want kernel low-level debugging support 330 Say Y here if you want kernel low-level debugging support
313 on PicoXcell based platforms. 331 on PicoXcell based platforms.
314 332
333 config DEBUG_PXA_UART1
334 depends on ARCH_PXA
335 bool "Use PXA UART1 for low-level debug"
336 help
337 Say Y here if you want kernel low-level debugging support
338 on PXA UART1.
339
315 config DEBUG_REALVIEW_STD_PORT 340 config DEBUG_REALVIEW_STD_PORT
316 bool "RealView Default UART" 341 bool "RealView Default UART"
317 depends on ARCH_REALVIEW 342 depends on ARCH_REALVIEW
@@ -330,6 +355,7 @@ choice
330 355
331 config DEBUG_S3C_UART0 356 config DEBUG_S3C_UART0
332 depends on PLAT_SAMSUNG 357 depends on PLAT_SAMSUNG
358 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
333 bool "Use S3C UART 0 for low-level debug" 359 bool "Use S3C UART 0 for low-level debug"
334 help 360 help
335 Say Y here if you want the debug print routines to direct 361 Say Y here if you want the debug print routines to direct
@@ -341,6 +367,7 @@ choice
341 367
342 config DEBUG_S3C_UART1 368 config DEBUG_S3C_UART1
343 depends on PLAT_SAMSUNG 369 depends on PLAT_SAMSUNG
370 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
344 bool "Use S3C UART 1 for low-level debug" 371 bool "Use S3C UART 1 for low-level debug"
345 help 372 help
346 Say Y here if you want the debug print routines to direct 373 Say Y here if you want the debug print routines to direct
@@ -352,6 +379,7 @@ choice
352 379
353 config DEBUG_S3C_UART2 380 config DEBUG_S3C_UART2
354 depends on PLAT_SAMSUNG 381 depends on PLAT_SAMSUNG
382 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
355 bool "Use S3C UART 2 for low-level debug" 383 bool "Use S3C UART 2 for low-level debug"
356 help 384 help
357 Say Y here if you want the debug print routines to direct 385 Say Y here if you want the debug print routines to direct
@@ -363,6 +391,7 @@ choice
363 391
364 config DEBUG_S3C_UART3 392 config DEBUG_S3C_UART3
365 depends on PLAT_SAMSUNG && ARCH_EXYNOS 393 depends on PLAT_SAMSUNG && ARCH_EXYNOS
394 select DEBUG_EXYNOS_UART
366 bool "Use S3C UART 3 for low-level debug" 395 bool "Use S3C UART 3 for low-level debug"
367 help 396 help
368 Say Y here if you want the debug print routines to direct 397 Say Y here if you want the debug print routines to direct
@@ -414,6 +443,13 @@ choice
414 Say Y here if you want the debug print routines to direct 443 Say Y here if you want the debug print routines to direct
415 their output to the uart1 port on SiRFmarco devices. 444 their output to the uart1 port on SiRFmarco devices.
416 445
446 config DEBUG_UX500_UART
447 depends on ARCH_U8500
448 bool "Use Ux500 UART for low-level debug"
449 help
450 Say Y here if you want kernel low-level debugging support
451 on Ux500 based platforms.
452
417 config DEBUG_VEXPRESS_UART0_DETECT 453 config DEBUG_VEXPRESS_UART0_DETECT
418 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" 454 bool "Autodetect UART0 on Versatile Express Cortex-A core tiles"
419 depends on ARCH_VEXPRESS && CPU_CP15_MMU 455 depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -485,6 +521,9 @@ choice
485 521
486endchoice 522endchoice
487 523
524config DEBUG_EXYNOS_UART
525 bool
526
488config DEBUG_IMX_UART_PORT 527config DEBUG_IMX_UART_PORT
489 int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \ 528 int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
490 DEBUG_IMX25_UART || \ 529 DEBUG_IMX25_UART || \
@@ -580,6 +619,10 @@ endchoice
580 619
581config DEBUG_LL_INCLUDE 620config DEBUG_LL_INCLUDE
582 string 621 string
622 default "debug/bcm2835.S" if DEBUG_BCM2835
623 default "debug/cns3xxx.S" if DEBUG_CNS3XXX
624 default "debug/exynos.S" if DEBUG_EXYNOS_UART
625 default "debug/highbank.S" if DEBUG_HIGHBANK_UART
583 default "debug/icedcc.S" if DEBUG_ICEDCC 626 default "debug/icedcc.S" if DEBUG_ICEDCC
584 default "debug/imx.S" if DEBUG_IMX1_UART || \ 627 default "debug/imx.S" if DEBUG_IMX1_UART || \
585 DEBUG_IMX25_UART || \ 628 DEBUG_IMX25_UART || \
@@ -589,19 +632,35 @@ config DEBUG_LL_INCLUDE
589 DEBUG_IMX51_UART || \ 632 DEBUG_IMX51_UART || \
590 DEBUG_IMX53_UART ||\ 633 DEBUG_IMX53_UART ||\
591 DEBUG_IMX6Q_UART 634 DEBUG_IMX6Q_UART
592 default "debug/highbank.S" if DEBUG_HIGHBANK_UART
593 default "debug/mvebu.S" if DEBUG_MVEBU_UART 635 default "debug/mvebu.S" if DEBUG_MVEBU_UART
636 default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART
637 default "debug/nomadik.S" if DEBUG_NOMADIK_UART
594 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 638 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
595 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART 639 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
640 default "debug/pxa.S" if DEBUG_PXA_UART1 || DEBUG_MMP_UART2 || \
641 DEBUG_MMP_UART3
642 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
596 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART 643 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
597 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1 644 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
645 default "debug/tegra.S" if DEBUG_TEGRA_UART
646 default "debug/ux500.S" if DEBUG_UX500_UART
598 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ 647 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
599 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 648 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1
600 default "debug/vt8500.S" if DEBUG_VT8500_UART0 649 default "debug/vt8500.S" if DEBUG_VT8500_UART0
601 default "debug/tegra.S" if DEBUG_TEGRA_UART
602 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1 650 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
603 default "mach/debug-macro.S" 651 default "mach/debug-macro.S"
604 652
653config DEBUG_UNCOMPRESS
654 bool
655 default y if ARCH_MULTIPLATFORM && DEBUG_LL && \
656 !DEBUG_OMAP2PLUS_UART && \
657 !DEBUG_TEGRA_UART
658
659config UNCOMPRESS_INCLUDE
660 string
661 default "debug/uncompress.h" if ARCH_MULTIPLATFORM
662 default "mach/uncompress.h"
663
605config EARLY_PRINTK 664config EARLY_PRINTK
606 bool "Early printk" 665 bool "Early printk"
607 depends on DEBUG_LL 666 depends on DEBUG_LL
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index ee4605f400b0..47374085befd 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -147,7 +147,6 @@ machine-$(CONFIG_ARCH_DOVE) += dove
147machine-$(CONFIG_ARCH_EBSA110) += ebsa110 147machine-$(CONFIG_ARCH_EBSA110) += ebsa110
148machine-$(CONFIG_ARCH_EP93XX) += ep93xx 148machine-$(CONFIG_ARCH_EP93XX) += ep93xx
149machine-$(CONFIG_ARCH_GEMINI) += gemini 149machine-$(CONFIG_ARCH_GEMINI) += gemini
150machine-$(CONFIG_ARCH_H720X) += h720x
151machine-$(CONFIG_ARCH_HIGHBANK) += highbank 150machine-$(CONFIG_ARCH_HIGHBANK) += highbank
152machine-$(CONFIG_ARCH_INTEGRATOR) += integrator 151machine-$(CONFIG_ARCH_INTEGRATOR) += integrator
153machine-$(CONFIG_ARCH_IOP13XX) += iop13xx 152machine-$(CONFIG_ARCH_IOP13XX) += iop13xx
@@ -191,9 +190,7 @@ machine-$(CONFIG_ARCH_VT8500) += vt8500
191machine-$(CONFIG_ARCH_W90X900) += w90x900 190machine-$(CONFIG_ARCH_W90X900) += w90x900
192machine-$(CONFIG_FOOTBRIDGE) += footbridge 191machine-$(CONFIG_FOOTBRIDGE) += footbridge
193machine-$(CONFIG_ARCH_SOCFPGA) += socfpga 192machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
194machine-$(CONFIG_ARCH_SPEAR13XX) += spear13xx 193machine-$(CONFIG_PLAT_SPEAR) += spear
195machine-$(CONFIG_ARCH_SPEAR3XX) += spear3xx
196machine-$(CONFIG_MACH_SPEAR600) += spear6xx
197machine-$(CONFIG_ARCH_VIRT) += virt 194machine-$(CONFIG_ARCH_VIRT) += virt
198machine-$(CONFIG_ARCH_ZYNQ) += zynq 195machine-$(CONFIG_ARCH_ZYNQ) += zynq
199machine-$(CONFIG_ARCH_SUNXI) += sunxi 196machine-$(CONFIG_ARCH_SUNXI) += sunxi
@@ -207,7 +204,6 @@ plat-$(CONFIG_PLAT_ORION) += orion
207plat-$(CONFIG_PLAT_PXA) += pxa 204plat-$(CONFIG_PLAT_PXA) += pxa
208plat-$(CONFIG_PLAT_S3C24XX) += samsung 205plat-$(CONFIG_PLAT_S3C24XX) += samsung
209plat-$(CONFIG_PLAT_S5P) += samsung 206plat-$(CONFIG_PLAT_S5P) += samsung
210plat-$(CONFIG_PLAT_SPEAR) += spear
211plat-$(CONFIG_PLAT_VERSATILE) += versatile 207plat-$(CONFIG_PLAT_VERSATILE) += versatile
212 208
213ifeq ($(CONFIG_ARCH_EBSA110),y) 209ifeq ($(CONFIG_ARCH_EBSA110),y)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index afed28e37ea5..3580d57ea218 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -24,6 +24,9 @@ endif
24AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) 24AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
25HEAD = head.o 25HEAD = head.o
26OBJS += misc.o decompress.o 26OBJS += misc.o decompress.o
27ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
28OBJS += debug.o
29endif
27FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 30FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
28 31
29# string library code (-Os is enforced to keep it much smaller) 32# string library code (-Os is enforced to keep it much smaller)
diff --git a/arch/arm/boot/compressed/debug.S b/arch/arm/boot/compressed/debug.S
new file mode 100644
index 000000000000..6e8382d5b7a4
--- /dev/null
+++ b/arch/arm/boot/compressed/debug.S
@@ -0,0 +1,12 @@
1#include <linux/linkage.h>
2#include <asm/assembler.h>
3
4#include CONFIG_DEBUG_LL_INCLUDE
5
6ENTRY(putc)
7 addruart r1, r2, r3
8 waituart r3, r1
9 senduart r0, r1
10 busyuart r3, r1
11 mov pc, lr
12ENDPROC(putc)
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index df899834d84e..31bd43b82095 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -25,13 +25,7 @@ unsigned int __machine_arch_type;
25static void putstr(const char *ptr); 25static void putstr(const char *ptr);
26extern void error(char *x); 26extern void error(char *x);
27 27
28#ifdef CONFIG_ARCH_MULTIPLATFORM 28#include CONFIG_UNCOMPRESS_INCLUDE
29static inline void putc(int c) {}
30static inline void flush(void) {}
31static inline void arch_decomp_setup(void) {}
32#else
33#include <mach/uncompress.h>
34#endif
35 29
36#ifdef CONFIG_DEBUG_ICEDCC 30#ifdef CONFIG_DEBUG_ICEDCC
37 31
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 9c6255884cbb..853e199ea89f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -3,6 +3,7 @@ ifeq ($(CONFIG_OF),y)
3# Keep at91 dtb files sorted alphabetically for each SoC 3# Keep at91 dtb files sorted alphabetically for each SoC
4# rm9200 4# rm9200
5dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb 5dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb
6dtb-$(CONFIG_ARCH_AT91) += mpa1600.dtb
6# sam9260 7# sam9260
7dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb 8dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb
8dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb 9dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb
@@ -26,11 +27,17 @@ dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
26# sam9n12 27# sam9n12
27dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb 28dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb
28# sam9x5 29# sam9x5
30dtb-$(CONFIG_ARCH_AT91) += at91-ariag25.dtb
29dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb 31dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb
30dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb 32dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb
31dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb 33dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb
32dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb 34dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb
33dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb 35dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb
36# sama5d3
37dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb
38dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
39dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
40dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
34 41
35dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 42dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
36dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb 43dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb
@@ -42,7 +49,10 @@ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
42dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ 49dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
43 exynos4210-smdkv310.dtb \ 50 exynos4210-smdkv310.dtb \
44 exynos4210-trats.dtb \ 51 exynos4210-trats.dtb \
52 exynos4412-odroidx.dtb \
45 exynos4412-smdk4412.dtb \ 53 exynos4412-smdk4412.dtb \
54 exynos4412-origen.dtb \
55 exynos5250-arndale.dtb \
46 exynos5250-smdk5250.dtb \ 56 exynos5250-smdk5250.dtb \
47 exynos5250-snow.dtb \ 57 exynos5250-snow.dtb \
48 exynos5440-ssdk5440.dtb 58 exynos5440-ssdk5440.dtb
@@ -51,7 +61,8 @@ dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
51dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 61dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
52 integratorcp.dtb 62 integratorcp.dtb
53dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 63dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
54dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ 64dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
65 kirkwood-dns320.dtb \
55 kirkwood-dns325.dtb \ 66 kirkwood-dns325.dtb \
56 kirkwood-dockstar.dtb \ 67 kirkwood-dockstar.dtb \
57 kirkwood-dreamplug.dtb \ 68 kirkwood-dreamplug.dtb \
@@ -65,6 +76,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
65 kirkwood-lschlv2.dtb \ 76 kirkwood-lschlv2.dtb \
66 kirkwood-lsxhl.dtb \ 77 kirkwood-lsxhl.dtb \
67 kirkwood-mplcec4.dtb \ 78 kirkwood-mplcec4.dtb \
79 kirkwood-netgear_readynas_duo_v2.dtb \
68 kirkwood-ns2.dtb \ 80 kirkwood-ns2.dtb \
69 kirkwood-ns2lite.dtb \ 81 kirkwood-ns2lite.dtb \
70 kirkwood-ns2max.dtb \ 82 kirkwood-ns2max.dtb \
@@ -87,19 +99,26 @@ dtb-$(CONFIG_ARCH_MXC) += \
87 imx25-karo-tx25.dtb \ 99 imx25-karo-tx25.dtb \
88 imx25-pdk.dtb \ 100 imx25-pdk.dtb \
89 imx27-apf27.dtb \ 101 imx27-apf27.dtb \
102 imx27-apf27dev.dtb \
90 imx27-pdk.dtb \ 103 imx27-pdk.dtb \
104 imx27-phytec-phycore.dtb \
91 imx31-bug.dtb \ 105 imx31-bug.dtb \
92 imx51-apf51.dtb \ 106 imx51-apf51.dtb \
107 imx51-apf51dev.dtb \
93 imx51-babbage.dtb \ 108 imx51-babbage.dtb \
94 imx53-ard.dtb \ 109 imx53-ard.dtb \
95 imx53-evk.dtb \ 110 imx53-evk.dtb \
96 imx53-mba53.dtb \ 111 imx53-mba53.dtb \
97 imx53-qsb.dtb \ 112 imx53-qsb.dtb \
98 imx53-smd.dtb \ 113 imx53-smd.dtb \
114 imx6dl-sabreauto.dtb \
115 imx6dl-sabresd.dtb \
116 imx6dl-wandboard.dtb \
99 imx6q-arm2.dtb \ 117 imx6q-arm2.dtb \
100 imx6q-sabreauto.dtb \ 118 imx6q-sabreauto.dtb \
101 imx6q-sabrelite.dtb \ 119 imx6q-sabrelite.dtb \
102 imx6q-sabresd.dtb 120 imx6q-sabresd.dtb \
121 imx6q-sbc6x.dtb
103dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \ 122dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
104 imx23-olinuxino.dtb \ 123 imx23-olinuxino.dtb \
105 imx23-stmp378x_devb.dtb \ 124 imx23-stmp378x_devb.dtb \
@@ -136,7 +155,9 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
136 ccu9540.dtb 155 ccu9540.dtb
137dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 156dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
138 r8a7740-armadillo800eva.dtb \ 157 r8a7740-armadillo800eva.dtb \
158 r8a7779-marzen-reference.dtb \
139 sh73a0-kzm9g.dtb \ 159 sh73a0-kzm9g.dtb \
160 sh73a0-kzm9g-reference.dtb \
140 sh7372-mackerel.dtb 161 sh7372-mackerel.dtb
141dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \ 162dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_cyclone5.dtb \
142 socfpga_vt.dtb 163 socfpga_vt.dtb
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index e34b280ce6ec..6403acdbb75f 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -94,5 +94,22 @@
94 spi-max-frequency = <50000000>; 94 spi-max-frequency = <50000000>;
95 }; 95 };
96 }; 96 };
97
98 pcie-controller {
99 status = "okay";
100 /*
101 * The two PCIe units are accessible through
102 * both standard PCIe slots and mini-PCIe
103 * slots on the board.
104 */
105 pcie@1,0 {
106 /* Port 0, Lane 0 */
107 status = "okay";
108 };
109 pcie@2,0 {
110 /* Port 1, Lane 0 */
111 status = "okay";
112 };
113 };
97 }; 114 };
98}; 115};
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
index 3234875824dc..58ee79372206 100644
--- a/arch/arm/boot/dts/armada-370-mirabox.dts
+++ b/arch/arm/boot/dts/armada-370-mirabox.dts
@@ -33,6 +33,43 @@
33 clock-frequency = <600000000>; 33 clock-frequency = <600000000>;
34 status = "okay"; 34 status = "okay";
35 }; 35 };
36
37 pinctrl {
38 pwr_led_pin: pwr-led-pin {
39 marvell,pins = "mpp63";
40 marvell,function = "gpo";
41 };
42
43 stat_led_pins: stat-led-pins {
44 marvell,pins = "mpp64", "mpp65";
45 marvell,function = "gpio";
46 };
47 };
48
49 gpio_leds {
50 compatible = "gpio-leds";
51 pinctrl-names = "default";
52 pinctrl-0 = <&pwr_led_pin &stat_led_pins>;
53
54 green_pwr_led {
55 label = "mirabox:green:pwr";
56 gpios = <&gpio1 31 1>;
57 linux,default-trigger = "heartbeat";
58 };
59
60 blue_stat_led {
61 label = "mirabox:blue:stat";
62 gpios = <&gpio2 0 1>;
63 linux,default-trigger = "cpu0";
64 };
65
66 green_stat_led {
67 label = "mirabox:green:stat";
68 gpios = <&gpio2 1 1>;
69 default-state = "off";
70 };
71 };
72
36 mdio { 73 mdio {
37 phy0: ethernet-phy@0 { 74 phy0: ethernet-phy@0 {
38 reg = <0>; 75 reg = <0>;
@@ -70,5 +107,32 @@
70 usb@d0051000 { 107 usb@d0051000 {
71 status = "okay"; 108 status = "okay";
72 }; 109 };
110
111 i2c@d0011000 {
112 status = "okay";
113 clock-frequency = <100000>;
114 pca9505: pca9505@25 {
115 compatible = "nxp,pca9505";
116 gpio-controller;
117 #gpio-cells = <2>;
118 reg = <0x25>;
119 };
120 };
121
122 pcie-controller {
123 status = "okay";
124
125 /* Internal mini-PCIe connector */
126 pcie@1,0 {
127 /* Port 0, Lane 0 */
128 status = "okay";
129 };
130
131 /* Connected on the PCB to a USB 3.0 XHCI controller */
132 pcie@2,0 {
133 /* Port 1, Lane 0 */
134 status = "okay";
135 };
136 };
73 }; 137 };
74}; 138};
diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index 070bba4f2585..516dec31b469 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -73,4 +73,15 @@
73 status = "okay"; 73 status = "okay";
74 }; 74 };
75 }; 75 };
76
77 gpio-keys {
78 compatible = "gpio-keys";
79 #address-cells = <1>;
80 #size-cells = <0>;
81 button@1 {
82 label = "Software Button";
83 linux,code = <116>;
84 gpios = <&gpio0 6 1>;
85 };
86 };
76}; 87};
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 5b708208b607..758c4ea90344 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -181,6 +181,51 @@
181 clocks = <&coreclk 0>; 181 clocks = <&coreclk 0>;
182 status = "disabled"; 182 status = "disabled";
183 }; 183 };
184
185 devbus-bootcs@d0010400 {
186 compatible = "marvell,mvebu-devbus";
187 reg = <0xd0010400 0x8>;
188 #address-cells = <1>;
189 #size-cells = <1>;
190 clocks = <&coreclk 0>;
191 status = "disabled";
192 };
193
194 devbus-cs0@d0010408 {
195 compatible = "marvell,mvebu-devbus";
196 reg = <0xd0010408 0x8>;
197 #address-cells = <1>;
198 #size-cells = <1>;
199 clocks = <&coreclk 0>;
200 status = "disabled";
201 };
202
203 devbus-cs1@d0010410 {
204 compatible = "marvell,mvebu-devbus";
205 reg = <0xd0010410 0x8>;
206 #address-cells = <1>;
207 #size-cells = <1>;
208 clocks = <&coreclk 0>;
209 status = "disabled";
210 };
211
212 devbus-cs2@d0010418 {
213 compatible = "marvell,mvebu-devbus";
214 reg = <0xd0010418 0x8>;
215 #address-cells = <1>;
216 #size-cells = <1>;
217 clocks = <&coreclk 0>;
218 status = "disabled";
219 };
220
221 devbus-cs3@d0010420 {
222 compatible = "marvell,mvebu-devbus";
223 reg = <0xd0010420 0x8>;
224 #address-cells = <1>;
225 #size-cells = <1>;
226 clocks = <&coreclk 0>;
227 status = "disabled";
228 };
184 }; 229 };
185}; 230};
186 231
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index a195debb67d3..18f6eb47cc50 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -159,5 +159,63 @@
159 clocks = <&coreclk 0>; 159 clocks = <&coreclk 0>;
160 }; 160 };
161 161
162 thermal@d0018300 {
163 compatible = "marvell,armada370-thermal";
164 reg = <0xd0018300 0x4
165 0xd0018304 0x4>;
166 status = "okay";
167 };
168
169 pcie-controller {
170 compatible = "marvell,armada-370-pcie";
171 status = "disabled";
172 device_type = "pci";
173
174 #address-cells = <3>;
175 #size-cells = <2>;
176
177 bus-range = <0x00 0xff>;
178
179 reg = <0xd0040000 0x2000>, <0xd0080000 0x2000>;
180
181 reg-names = "pcie0.0", "pcie1.0";
182
183 ranges = <0x82000000 0 0xd0040000 0xd0040000 0 0x00002000 /* Port 0.0 registers */
184 0x82000000 0 0xd0080000 0xd0080000 0 0x00002000 /* Port 1.0 registers */
185 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
186 0x81000000 0 0 0xe8000000 0 0x00100000>; /* downstream I/O */
187
188 pcie@1,0 {
189 device_type = "pci";
190 assigned-addresses = <0x82000800 0 0xd0040000 0 0x2000>;
191 reg = <0x0800 0 0 0 0>;
192 #address-cells = <3>;
193 #size-cells = <2>;
194 #interrupt-cells = <1>;
195 ranges;
196 interrupt-map-mask = <0 0 0 0>;
197 interrupt-map = <0 0 0 0 &mpic 58>;
198 marvell,pcie-port = <0>;
199 marvell,pcie-lane = <0>;
200 clocks = <&gateclk 5>;
201 status = "disabled";
202 };
203
204 pcie@2,0 {
205 device_type = "pci";
206 assigned-addresses = <0x82002800 0 0xd0080000 0 0x2000>;
207 reg = <0x1000 0 0 0 0>;
208 #address-cells = <3>;
209 #size-cells = <2>;
210 #interrupt-cells = <1>;
211 ranges;
212 interrupt-map-mask = <0 0 0 0>;
213 interrupt-map = <0 0 0 0 &mpic 62>;
214 marvell,pcie-port = <1>;
215 marvell,pcie-lane = <0>;
216 clocks = <&gateclk 9>;
217 status = "disabled";
218 };
219 };
162 }; 220 };
163}; 221};
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
index e83505e4c236..54cc5bb705fb 100644
--- a/arch/arm/boot/dts/armada-xp-db.dts
+++ b/arch/arm/boot/dts/armada-xp-db.dts
@@ -121,5 +121,38 @@
121 spi-max-frequency = <20000000>; 121 spi-max-frequency = <20000000>;
122 }; 122 };
123 }; 123 };
124
125 pcie-controller {
126 status = "okay";
127
128 /*
129 * All 6 slots are physically present as
130 * standard PCIe slots on the board.
131 */
132 pcie@1,0 {
133 /* Port 0, Lane 0 */
134 status = "okay";
135 };
136 pcie@2,0 {
137 /* Port 0, Lane 1 */
138 status = "okay";
139 };
140 pcie@3,0 {
141 /* Port 0, Lane 2 */
142 status = "okay";
143 };
144 pcie@4,0 {
145 /* Port 0, Lane 3 */
146 status = "okay";
147 };
148 pcie@9,0 {
149 /* Port 2, Lane 0 */
150 status = "okay";
151 };
152 pcie@10,0 {
153 /* Port 3, Lane 0 */
154 status = "okay";
155 };
156 };
124 }; 157 };
125}; 158};
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 1c8afe2ffebc..04f28a712b98 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -109,5 +109,55 @@
109 spi-max-frequency = <108000000>; 109 spi-max-frequency = <108000000>;
110 }; 110 };
111 }; 111 };
112
113 devbus-bootcs@d0010400 {
114 status = "okay";
115 ranges = <0 0xf0000000 0x1000000>; /* @addr 0xf000000, size 0x1000000 */
116
117 /* Device Bus parameters are required */
118
119 /* Read parameters */
120 devbus,bus-width = <8>;
121 devbus,turn-off-ps = <60000>;
122 devbus,badr-skew-ps = <0>;
123 devbus,acc-first-ps = <124000>;
124 devbus,acc-next-ps = <248000>;
125 devbus,rd-setup-ps = <0>;
126 devbus,rd-hold-ps = <0>;
127
128 /* Write parameters */
129 devbus,sync-enable = <0>;
130 devbus,wr-high-ps = <60000>;
131 devbus,wr-low-ps = <60000>;
132 devbus,ale-wr-ps = <60000>;
133
134 /* NOR 16 MiB */
135 nor@0 {
136 compatible = "cfi-flash";
137 reg = <0 0x1000000>;
138 bank-width = <2>;
139 };
140 };
141
142 pcie-controller {
143 status = "okay";
144
145 /*
146 * The 3 slots are physically present as
147 * standard PCIe slots on the board.
148 */
149 pcie@1,0 {
150 /* Port 0, Lane 0 */
151 status = "okay";
152 };
153 pcie@9,0 {
154 /* Port 2, Lane 0 */
155 status = "okay";
156 };
157 pcie@10,0 {
158 /* Port 3, Lane 0 */
159 status = "okay";
160 };
161 };
112 }; 162 };
113}; 163};
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
index f56c40599f5b..c2c78459a4d4 100644
--- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
@@ -76,5 +76,109 @@
76 #interrupts-cells = <2>; 76 #interrupts-cells = <2>;
77 interrupts = <87>, <88>, <89>; 77 interrupts = <87>, <88>, <89>;
78 }; 78 };
79
80 /*
81 * MV78230 has 2 PCIe units Gen2.0: One unit can be
82 * configured as x4 or quad x1 lanes. One unit is
83 * x4/x1.
84 */
85 pcie-controller {
86 compatible = "marvell,armada-xp-pcie";
87 status = "disabled";
88 device_type = "pci";
89
90 #address-cells = <3>;
91 #size-cells = <2>;
92
93 bus-range = <0x00 0xff>;
94
95 ranges = <0x82000000 0 0xd0040000 0xd0040000 0 0x00002000 /* Port 0.0 registers */
96 0x82000000 0 0xd0042000 0xd0042000 0 0x00002000 /* Port 2.0 registers */
97 0x82000000 0 0xd0044000 0xd0044000 0 0x00002000 /* Port 0.1 registers */
98 0x82000000 0 0xd0048000 0xd0048000 0 0x00002000 /* Port 0.2 registers */
99 0x82000000 0 0xd004c000 0xd004c000 0 0x00002000 /* Port 0.3 registers */
100 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
101 0x81000000 0 0 0xe8000000 0 0x00100000>; /* downstream I/O */
102
103 pcie@1,0 {
104 device_type = "pci";
105 assigned-addresses = <0x82000800 0 0xd0040000 0 0x2000>;
106 reg = <0x0800 0 0 0 0>;
107 #address-cells = <3>;
108 #size-cells = <2>;
109 #interrupt-cells = <1>;
110 ranges;
111 interrupt-map-mask = <0 0 0 0>;
112 interrupt-map = <0 0 0 0 &mpic 58>;
113 marvell,pcie-port = <0>;
114 marvell,pcie-lane = <0>;
115 clocks = <&gateclk 5>;
116 status = "disabled";
117 };
118
119 pcie@2,0 {
120 device_type = "pci";
121 assigned-addresses = <0x82000800 0 0xd0044000 0 0x2000>;
122 reg = <0x1000 0 0 0 0>;
123 #address-cells = <3>;
124 #size-cells = <2>;
125 #interrupt-cells = <1>;
126 ranges;
127 interrupt-map-mask = <0 0 0 0>;
128 interrupt-map = <0 0 0 0 &mpic 59>;
129 marvell,pcie-port = <0>;
130 marvell,pcie-lane = <1>;
131 clocks = <&gateclk 6>;
132 status = "disabled";
133 };
134
135 pcie@3,0 {
136 device_type = "pci";
137 assigned-addresses = <0x82000800 0 0xd0048000 0 0x2000>;
138 reg = <0x1800 0 0 0 0>;
139 #address-cells = <3>;
140 #size-cells = <2>;
141 #interrupt-cells = <1>;
142 ranges;
143 interrupt-map-mask = <0 0 0 0>;
144 interrupt-map = <0 0 0 0 &mpic 60>;
145 marvell,pcie-port = <0>;
146 marvell,pcie-lane = <2>;
147 clocks = <&gateclk 7>;
148 status = "disabled";
149 };
150
151 pcie@4,0 {
152 device_type = "pci";
153 assigned-addresses = <0x82000800 0 0xd004c000 0 0x2000>;
154 reg = <0x2000 0 0 0 0>;
155 #address-cells = <3>;
156 #size-cells = <2>;
157 #interrupt-cells = <1>;
158 ranges;
159 interrupt-map-mask = <0 0 0 0>;
160 interrupt-map = <0 0 0 0 &mpic 61>;
161 marvell,pcie-port = <0>;
162 marvell,pcie-lane = <3>;
163 clocks = <&gateclk 8>;
164 status = "disabled";
165 };
166
167 pcie@9,0 {
168 device_type = "pci";
169 assigned-addresses = <0x82000800 0 0xd0042000 0 0x2000>;
170 reg = <0x4800 0 0 0 0>;
171 #address-cells = <3>;
172 #size-cells = <2>;
173 #interrupt-cells = <1>;
174 ranges;
175 interrupt-map-mask = <0 0 0 0>;
176 interrupt-map = <0 0 0 0 &mpic 99>;
177 marvell,pcie-port = <2>;
178 marvell,pcie-lane = <0>;
179 clocks = <&gateclk 26>;
180 status = "disabled";
181 };
182 };
79 }; 183 };
80}; 184};
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
index f8f2b787d2b0..885bf229eef7 100644
--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -96,5 +96,127 @@
96 clocks = <&gateclk 1>; 96 clocks = <&gateclk 1>;
97 status = "disabled"; 97 status = "disabled";
98 }; 98 };
99
100 /*
101 * MV78260 has 3 PCIe units Gen2.0: Two units can be
102 * configured as x4 or quad x1 lanes. One unit is
103 * x4/x1.
104 */
105 pcie-controller {
106 compatible = "marvell,armada-xp-pcie";
107 status = "disabled";
108 device_type = "pci";
109
110 #address-cells = <3>;
111 #size-cells = <2>;
112
113 bus-range = <0x00 0xff>;
114
115 ranges = <0x82000000 0 0xd0040000 0xd0040000 0 0x00002000 /* Port 0.0 registers */
116 0x82000000 0 0xd0042000 0xd0042000 0 0x00002000 /* Port 2.0 registers */
117 0x82000000 0 0xd0044000 0xd0044000 0 0x00002000 /* Port 0.1 registers */
118 0x82000000 0 0xd0048000 0xd0048000 0 0x00002000 /* Port 0.2 registers */
119 0x82000000 0 0xd004c000 0xd004c000 0 0x00002000 /* Port 0.3 registers */
120 0x82000000 0 0xd0080000 0xd0080000 0 0x00002000 /* Port 1.0 registers */
121 0x82000000 0 0xd0082000 0xd0082000 0 0x00002000 /* Port 3.0 registers */
122 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
123 0x81000000 0 0 0xe8000000 0 0x00100000>; /* downstream I/O */
124
125 pcie@1,0 {
126 device_type = "pci";
127 assigned-addresses = <0x82000800 0 0xd0040000 0 0x2000>;
128 reg = <0x0800 0 0 0 0>;
129 #address-cells = <3>;
130 #size-cells = <2>;
131 #interrupt-cells = <1>;
132 ranges;
133 interrupt-map-mask = <0 0 0 0>;
134 interrupt-map = <0 0 0 0 &mpic 58>;
135 marvell,pcie-port = <0>;
136 marvell,pcie-lane = <0>;
137 clocks = <&gateclk 5>;
138 status = "disabled";
139 };
140
141 pcie@2,0 {
142 device_type = "pci";
143 assigned-addresses = <0x82000800 0 0xd0044000 0 0x2000>;
144 reg = <0x1000 0 0 0 0>;
145 #address-cells = <3>;
146 #size-cells = <2>;
147 #interrupt-cells = <1>;
148 ranges;
149 interrupt-map-mask = <0 0 0 0>;
150 interrupt-map = <0 0 0 0 &mpic 59>;
151 marvell,pcie-port = <0>;
152 marvell,pcie-lane = <1>;
153 clocks = <&gateclk 6>;
154 status = "disabled";
155 };
156
157 pcie@3,0 {
158 device_type = "pci";
159 assigned-addresses = <0x82000800 0 0xd0048000 0 0x2000>;
160 reg = <0x1800 0 0 0 0>;
161 #address-cells = <3>;
162 #size-cells = <2>;
163 #interrupt-cells = <1>;
164 ranges;
165 interrupt-map-mask = <0 0 0 0>;
166 interrupt-map = <0 0 0 0 &mpic 60>;
167 marvell,pcie-port = <0>;
168 marvell,pcie-lane = <2>;
169 clocks = <&gateclk 7>;
170 status = "disabled";
171 };
172
173 pcie@4,0 {
174 device_type = "pci";
175 assigned-addresses = <0x82000800 0 0xd004c000 0 0x2000>;
176 reg = <0x2000 0 0 0 0>;
177 #address-cells = <3>;
178 #size-cells = <2>;
179 #interrupt-cells = <1>;
180 ranges;
181 interrupt-map-mask = <0 0 0 0>;
182 interrupt-map = <0 0 0 0 &mpic 61>;
183 marvell,pcie-port = <0>;
184 marvell,pcie-lane = <3>;
185 clocks = <&gateclk 8>;
186 status = "disabled";
187 };
188
189 pcie@9,0 {
190 device_type = "pci";
191 assigned-addresses = <0x82000800 0 0xd0042000 0 0x2000>;
192 reg = <0x4800 0 0 0 0>;
193 #address-cells = <3>;
194 #size-cells = <2>;
195 #interrupt-cells = <1>;
196 ranges;
197 interrupt-map-mask = <0 0 0 0>;
198 interrupt-map = <0 0 0 0 &mpic 99>;
199 marvell,pcie-port = <2>;
200 marvell,pcie-lane = <0>;
201 clocks = <&gateclk 26>;
202 status = "disabled";
203 };
204
205 pcie@10,0 {
206 device_type = "pci";
207 assigned-addresses = <0x82000800 0 0xd0082000 0 0x2000>;
208 reg = <0x5000 0 0 0 0>;
209 #address-cells = <3>;
210 #size-cells = <2>;
211 #interrupt-cells = <1>;
212 ranges;
213 interrupt-map-mask = <0 0 0 0>;
214 interrupt-map = <0 0 0 0 &mpic 103>;
215 marvell,pcie-port = <3>;
216 marvell,pcie-lane = <0>;
217 clocks = <&gateclk 27>;
218 status = "disabled";
219 };
220 };
99 }; 221 };
100}; 222};
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
index 936c25dc32b0..23a5ac4490a8 100644
--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -111,5 +111,193 @@
111 clocks = <&gateclk 1>; 111 clocks = <&gateclk 1>;
112 status = "disabled"; 112 status = "disabled";
113 }; 113 };
114
115 /*
116 * MV78460 has 4 PCIe units Gen2.0: Two units can be
117 * configured as x4 or quad x1 lanes. Two units are
118 * x4/x1.
119 */
120 pcie-controller {
121 compatible = "marvell,armada-xp-pcie";
122 status = "disabled";
123 device_type = "pci";
124
125 #address-cells = <3>;
126 #size-cells = <2>;
127
128 bus-range = <0x00 0xff>;
129
130 ranges = <0x82000000 0 0xd0040000 0xd0040000 0 0x00002000 /* Port 0.0 registers */
131 0x82000000 0 0xd0042000 0xd0042000 0 0x00002000 /* Port 2.0 registers */
132 0x82000000 0 0xd0044000 0xd0044000 0 0x00002000 /* Port 0.1 registers */
133 0x82000000 0 0xd0048000 0xd0048000 0 0x00002000 /* Port 0.2 registers */
134 0x82000000 0 0xd004c000 0xd004c000 0 0x00002000 /* Port 0.3 registers */
135 0x82000000 0 0xd0080000 0xd0080000 0 0x00002000 /* Port 1.0 registers */
136 0x82000000 0 0xd0082000 0xd0082000 0 0x00002000 /* Port 3.0 registers */
137 0x82000000 0 0xd0084000 0xd0084000 0 0x00002000 /* Port 1.1 registers */
138 0x82000000 0 0xd0088000 0xd0088000 0 0x00002000 /* Port 1.2 registers */
139 0x82000000 0 0xd008c000 0xd008c000 0 0x00002000 /* Port 1.3 registers */
140 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
141 0x81000000 0 0 0xe8000000 0 0x00100000>; /* downstream I/O */
142
143 pcie@1,0 {
144 device_type = "pci";
145 assigned-addresses = <0x82000800 0 0xd0040000 0 0x2000>;
146 reg = <0x0800 0 0 0 0>;
147 #address-cells = <3>;
148 #size-cells = <2>;
149 #interrupt-cells = <1>;
150 ranges;
151 interrupt-map-mask = <0 0 0 0>;
152 interrupt-map = <0 0 0 0 &mpic 58>;
153 marvell,pcie-port = <0>;
154 marvell,pcie-lane = <0>;
155 clocks = <&gateclk 5>;
156 status = "disabled";
157 };
158
159 pcie@2,0 {
160 device_type = "pci";
161 assigned-addresses = <0x82001000 0 0xd0044000 0 0x2000>;
162 reg = <0x1000 0 0 0 0>;
163 #address-cells = <3>;
164 #size-cells = <2>;
165 #interrupt-cells = <1>;
166 ranges;
167 interrupt-map-mask = <0 0 0 0>;
168 interrupt-map = <0 0 0 0 &mpic 59>;
169 marvell,pcie-port = <0>;
170 marvell,pcie-lane = <1>;
171 clocks = <&gateclk 6>;
172 status = "disabled";
173 };
174
175 pcie@3,0 {
176 device_type = "pci";
177 assigned-addresses = <0x82001800 0 0xd0048000 0 0x2000>;
178 reg = <0x1800 0 0 0 0>;
179 #address-cells = <3>;
180 #size-cells = <2>;
181 #interrupt-cells = <1>;
182 ranges;
183 interrupt-map-mask = <0 0 0 0>;
184 interrupt-map = <0 0 0 0 &mpic 60>;
185 marvell,pcie-port = <0>;
186 marvell,pcie-lane = <2>;
187 clocks = <&gateclk 7>;
188 status = "disabled";
189 };
190
191 pcie@4,0 {
192 device_type = "pci";
193 assigned-addresses = <0x82002000 0 0xd004c000 0 0x2000>;
194 reg = <0x2000 0 0 0 0>;
195 #address-cells = <3>;
196 #size-cells = <2>;
197 #interrupt-cells = <1>;
198 ranges;
199 interrupt-map-mask = <0 0 0 0>;
200 interrupt-map = <0 0 0 0 &mpic 61>;
201 marvell,pcie-port = <0>;
202 marvell,pcie-lane = <3>;
203 clocks = <&gateclk 8>;
204 status = "disabled";
205 };
206
207 pcie@5,0 {
208 device_type = "pci";
209 assigned-addresses = <0x82002800 0 0xd0080000 0 0x2000>;
210 reg = <0x2800 0 0 0 0>;
211 #address-cells = <3>;
212 #size-cells = <2>;
213 #interrupt-cells = <1>;
214 ranges;
215 interrupt-map-mask = <0 0 0 0>;
216 interrupt-map = <0 0 0 0 &mpic 62>;
217 marvell,pcie-port = <1>;
218 marvell,pcie-lane = <0>;
219 clocks = <&gateclk 9>;
220 status = "disabled";
221 };
222
223 pcie@6,0 {
224 device_type = "pci";
225 assigned-addresses = <0x82003000 0 0xd0084000 0 0x2000>;
226 reg = <0x3000 0 0 0 0>;
227 #address-cells = <3>;
228 #size-cells = <2>;
229 #interrupt-cells = <1>;
230 ranges;
231 interrupt-map-mask = <0 0 0 0>;
232 interrupt-map = <0 0 0 0 &mpic 63>;
233 marvell,pcie-port = <1>;
234 marvell,pcie-lane = <1>;
235 clocks = <&gateclk 10>;
236 status = "disabled";
237 };
238
239 pcie@7,0 {
240 device_type = "pci";
241 assigned-addresses = <0x82003800 0 0xd0088000 0 0x2000>;
242 reg = <0x3800 0 0 0 0>;
243 #address-cells = <3>;
244 #size-cells = <2>;
245 #interrupt-cells = <1>;
246 ranges;
247 interrupt-map-mask = <0 0 0 0>;
248 interrupt-map = <0 0 0 0 &mpic 64>;
249 marvell,pcie-port = <1>;
250 marvell,pcie-lane = <2>;
251 clocks = <&gateclk 11>;
252 status = "disabled";
253 };
254
255 pcie@8,0 {
256 device_type = "pci";
257 assigned-addresses = <0x82004000 0 0xd008c000 0 0x2000>;
258 reg = <0x4000 0 0 0 0>;
259 #address-cells = <3>;
260 #size-cells = <2>;
261 #interrupt-cells = <1>;
262 ranges;
263 interrupt-map-mask = <0 0 0 0>;
264 interrupt-map = <0 0 0 0 &mpic 65>;
265 marvell,pcie-port = <1>;
266 marvell,pcie-lane = <3>;
267 clocks = <&gateclk 12>;
268 status = "disabled";
269 };
270 pcie@9,0 {
271 device_type = "pci";
272 assigned-addresses = <0x82004800 0 0xd0042000 0 0x2000>;
273 reg = <0x4800 0 0 0 0>;
274 #address-cells = <3>;
275 #size-cells = <2>;
276 #interrupt-cells = <1>;
277 ranges;
278 interrupt-map-mask = <0 0 0 0>;
279 interrupt-map = <0 0 0 0 &mpic 99>;
280 marvell,pcie-port = <2>;
281 marvell,pcie-lane = <0>;
282 clocks = <&gateclk 26>;
283 status = "disabled";
284 };
285
286 pcie@10,0 {
287 device_type = "pci";
288 assigned-addresses = <0x82005000 0 0xd0082000 0 0x2000>;
289 reg = <0x5000 0 0 0 0>;
290 #address-cells = <3>;
291 #size-cells = <2>;
292 #interrupt-cells = <1>;
293 ranges;
294 interrupt-map-mask = <0 0 0 0>;
295 interrupt-map = <0 0 0 0 &mpic 103>;
296 marvell,pcie-port = <3>;
297 marvell,pcie-lane = <0>;
298 clocks = <&gateclk 27>;
299 status = "disabled";
300 };
301 };
114 }; 302 };
115 }; 303 };
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 3818a82176a2..9d04f04d4e39 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -139,5 +139,43 @@
139 usb@d0051000 { 139 usb@d0051000 {
140 status = "okay"; 140 status = "okay";
141 }; 141 };
142
143 devbus-bootcs@d0010400 {
144 status = "okay";
145 ranges = <0 0xf0000000 0x8000000>; /* @addr 0xf000000, size 0x8000000 */
146
147 /* Device Bus parameters are required */
148
149 /* Read parameters */
150 devbus,bus-width = <8>;
151 devbus,turn-off-ps = <60000>;
152 devbus,badr-skew-ps = <0>;
153 devbus,acc-first-ps = <124000>;
154 devbus,acc-next-ps = <248000>;
155 devbus,rd-setup-ps = <0>;
156 devbus,rd-hold-ps = <0>;
157
158 /* Write parameters */
159 devbus,sync-enable = <0>;
160 devbus,wr-high-ps = <60000>;
161 devbus,wr-low-ps = <60000>;
162 devbus,ale-wr-ps = <60000>;
163
164 /* NOR 128 MiB */
165 nor@0 {
166 compatible = "cfi-flash";
167 reg = <0 0x8000000>;
168 bank-width = <2>;
169 };
170 };
171
172 pcie-controller {
173 status = "okay";
174 /* Internal mini-PCIe connector */
175 pcie@1,0 {
176 /* Port 0, Lane 0 */
177 status = "okay";
178 };
179 };
142 }; 180 };
143}; 181};
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index ca00d8326c87..29dfeb6d4a26 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -151,5 +151,11 @@
151 status = "disabled"; 151 status = "disabled";
152 }; 152 };
153 153
154 thermal@d00182b0 {
155 compatible = "marvell,armadaxp-thermal";
156 reg = <0xd00182b0 0x4
157 0xd00184d0 0x4>;
158 status = "okay";
159 };
154 }; 160 };
155}; 161};
diff --git a/arch/arm/boot/dts/at91-ariag25.dts b/arch/arm/boot/dts/at91-ariag25.dts
new file mode 100644
index 000000000000..c7aebba4e8e7
--- /dev/null
+++ b/arch/arm/boot/dts/at91-ariag25.dts
@@ -0,0 +1,171 @@
1/*
2 * at91-ariag25.dts - Device Tree file for Acme Systems Aria G25 (AT91SAM9G25 based)
3 *
4 * Copyright (C) 2013 Douglas Gilbert <dgilbert@interlog.com>,
5 * Robert Nelson <robertcnelson@gmail.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9g25.dtsi"
11
12/ {
13 model = "Acme Systems Aria G25";
14 compatible = "acme,ariag25", "atmel,at91sam9x5ek",
15 "atmel,at91sam9x5", "atmel,at91sam9";
16
17 aliases {
18 serial0 = &dbgu;
19 serial1 = &usart0;
20 serial2 = &usart1;
21 serial3 = &usart2;
22 serial4 = &usart3;
23 serial5 = &uart0;
24 };
25
26 chosen {
27 bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait";
28 };
29
30 memory {
31 /* 128 MB, change this for 256 MB revision */
32 reg = <0x20000000 0x8000000>;
33 };
34
35 clocks {
36 #address-cells = <1>;
37 #size-cells = <1>;
38 ranges;
39
40 main_clock: clock@0 {
41 compatible = "atmel,osc", "fixed-clock";
42 clock-frequency = <12000000>;
43 };
44 };
45
46 ahb {
47 apb {
48 mmc0: mmc@f0008000 {
49 /* N.B. Aria has no SD card detect (CD), assumed present */
50
51 pinctrl-0 = <
52 &pinctrl_mmc0_slot0_clk_cmd_dat0
53 &pinctrl_mmc0_slot0_dat1_3>;
54 status = "okay";
55 slot@0 {
56 reg = <0>;
57 bus-width = <4>;
58 };
59 };
60
61 i2c0: i2c@f8010000 {
62 status = "okay";
63 };
64
65 i2c1: i2c@f8014000 {
66 status = "okay";
67 };
68
69 /* TWD2+TCLK2 hidden behind ethernet, so no i2c2 */
70
71 usart0: serial@f801c000 {
72 pinctrl-0 = <&pinctrl_usart0
73 &pinctrl_usart0_rts
74 &pinctrl_usart0_cts>;
75 status = "okay";
76 };
77
78 usart1: serial@f8020000 {
79 pinctrl-0 = <&pinctrl_usart1
80 /* &pinctrl_usart1_rts */
81 /* &pinctrl_usart1_cts */
82 >;
83 status = "okay";
84 };
85
86 usart2: serial@f8024000 {
87 /* cannot activate RTS2+CTS2, clash with
88 * ethernet on PB0 and PB1 */
89 pinctrl-0 = <&pinctrl_usart2>;
90 status = "okay";
91 };
92
93 usart3: serial@f8028000 {
94 compatible = "atmel,at91sam9260-usart";
95 reg = <0xf8028000 0x200>;
96 interrupts = <8 4 5>;
97 pinctrl-names = "default";
98 pinctrl-0 = <&pinctrl_usart3
99 /* &pinctrl_usart3_rts */
100 /* &pinctrl_usart3_cts */
101 >;
102 status = "okay";
103 };
104
105 macb0: ethernet@f802c000 {
106 phy-mode = "rmii";
107 /*
108 * following can be overwritten by bootloader:
109 * for example u-boot 'ftd set' command
110 */
111 local-mac-address = [00 00 00 00 00 00];
112 status = "okay";
113 };
114
115 uart0: serial@f8040000 {
116 compatible = "atmel,at91sam9260-usart";
117 reg = <0xf8040000 0x200>;
118 interrupts = <15 4 5>;
119 pinctrl-names = "default";
120 pinctrl-0 = <&pinctrl_uart0>;
121 status = "okay";
122 };
123
124 adc0: adc@f804c000 {
125 status = "okay";
126 atmel,adc-channels-used = <0xf>;
127 atmel,adc-num-channels = <4>;
128 };
129
130 dbgu: serial@fffff200 {
131 status = "okay";
132 };
133
134 pinctrl@fffff400 {
135 w1_0 {
136 pinctrl_w1_0: w1_0-0 {
137 atmel,pins = <0 21 0x0 0x1>; /* PA21 PIO, pull-up */
138 };
139 };
140 };
141 };
142
143 usb0: ohci@00600000 {
144 status = "okay";
145 num-ports = <3>;
146 };
147
148 usb1: ehci@00700000 {
149 status = "okay";
150 };
151 };
152
153 leds {
154 compatible = "gpio-leds";
155
156 /* little green LED in middle of Aria G25 module */
157 aria_led {
158 label = "aria_led";
159 gpios = <&pioB 8 0>; /* PB8 */
160 linux,default-trigger = "heartbeat";
161 };
162
163 };
164
165 onewire@0 {
166 compatible = "w1-gpio";
167 gpios = <&pioA 21 1>;
168 pinctrl-names = "default";
169 pinctrl-0 = <&pinctrl_w1_0>;
170 };
171};
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index b0268a5f4b4e..5d3ed5aafc69 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -29,6 +29,7 @@
29 gpio3 = &pioD; 29 gpio3 = &pioD;
30 tcb0 = &tcb0; 30 tcb0 = &tcb0;
31 tcb1 = &tcb1; 31 tcb1 = &tcb1;
32 i2c0 = &i2c0;
32 ssc0 = &ssc0; 33 ssc0 = &ssc0;
33 ssc1 = &ssc1; 34 ssc1 = &ssc1;
34 ssc2 = &ssc2; 35 ssc2 = &ssc2;
@@ -91,6 +92,17 @@
91 interrupts = <20 4 0 21 4 0 22 4 0>; 92 interrupts = <20 4 0 21 4 0 22 4 0>;
92 }; 93 };
93 94
95 i2c0: i2c@fffb8000 {
96 compatible = "atmel,at91rm9200-i2c";
97 reg = <0xfffb8000 0x4000>;
98 interrupts = <12 4 6>;
99 pinctrl-names = "default";
100 pinctrl-0 = <&pinctrl_twi>;
101 #address-cells = <1>;
102 #size-cells = <0>;
103 status = "disabled";
104 };
105
94 mmc0: mmc@fffb4000 { 106 mmc0: mmc@fffb4000 {
95 compatible = "atmel,hsmci"; 107 compatible = "atmel,hsmci";
96 reg = <0xfffb4000 0x4000>; 108 reg = <0xfffb4000 0x4000>;
@@ -365,6 +377,20 @@
365 }; 377 };
366 }; 378 };
367 379
380 twi {
381 pinctrl_twi: twi-0 {
382 atmel,pins =
383 <0 25 0x1 0x2 /* PA25 periph A with multi drive */
384 0 26 0x1 0x2>; /* PA26 periph A with multi drive */
385 };
386
387 pinctrl_twi_gpio: twi_gpio-0 {
388 atmel,pins =
389 <0 25 0x0 0x2 /* PA25 GPIO with multi drive */
390 0 26 0x0 0x2>; /* PA26 GPIO with multi drive */
391 };
392 };
393
368 pioA: gpio@fffff400 { 394 pioA: gpio@fffff400 {
369 compatible = "atmel,at91rm9200-gpio"; 395 compatible = "atmel,at91rm9200-gpio";
370 reg = <0xfffff400 0x200>; 396 reg = <0xfffff400 0x200>;
@@ -500,6 +526,8 @@
500 i2c-gpio,sda-open-drain; 526 i2c-gpio,sda-open-drain;
501 i2c-gpio,scl-open-drain; 527 i2c-gpio,scl-open-drain;
502 i2c-gpio,delay-us = <2>; /* ~100 kHz */ 528 i2c-gpio,delay-us = <2>; /* ~100 kHz */
529 pinctrl-names = "default";
530 pinctrl-0 = <&pinctrl_twi_gpio>;
503 #address-cells = <1>; 531 #address-cells = <1>;
504 #size-cells = <0>; 532 #size-cells = <0>;
505 status = "disabled"; 533 status = "disabled";
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index cb7bcc51608d..70b5ccbac234 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -158,8 +158,8 @@
158 usart1 { 158 usart1 {
159 pinctrl_usart1: usart1-0 { 159 pinctrl_usart1: usart1-0 {
160 atmel,pins = 160 atmel,pins =
161 <2 6 0x1 0x1 /* PB6 periph A with pullup */ 161 <1 6 0x1 0x1 /* PB6 periph A with pullup */
162 2 7 0x1 0x0>; /* PB7 periph A */ 162 1 7 0x1 0x0>; /* PB7 periph A */
163 }; 163 };
164 164
165 pinctrl_usart1_rts: usart1_rts-0 { 165 pinctrl_usart1_rts: usart1_rts-0 {
@@ -194,18 +194,18 @@
194 usart3 { 194 usart3 {
195 pinctrl_usart3: usart3-0 { 195 pinctrl_usart3: usart3-0 {
196 atmel,pins = 196 atmel,pins =
197 <2 10 0x1 0x1 /* PB10 periph A with pullup */ 197 <1 10 0x1 0x1 /* PB10 periph A with pullup */
198 2 11 0x1 0x0>; /* PB11 periph A */ 198 1 11 0x1 0x0>; /* PB11 periph A */
199 }; 199 };
200 200
201 pinctrl_usart3_rts: usart3_rts-0 { 201 pinctrl_usart3_rts: usart3_rts-0 {
202 atmel,pins = 202 atmel,pins =
203 <3 8 0x2 0x0>; /* PB8 periph B */ 203 <2 8 0x2 0x0>; /* PC8 periph B */
204 }; 204 };
205 205
206 pinctrl_usart3_cts: usart3_cts-0 { 206 pinctrl_usart3_cts: usart3_cts-0 {
207 atmel,pins = 207 atmel,pins =
208 <3 10 0x2 0x0>; /* PB10 periph B */ 208 <2 10 0x2 0x0>; /* PC10 periph B */
209 }; 209 };
210 }; 210 };
211 211
@@ -220,8 +220,8 @@
220 uart1 { 220 uart1 {
221 pinctrl_uart1: uart1-0 { 221 pinctrl_uart1: uart1-0 {
222 atmel,pins = 222 atmel,pins =
223 <2 12 0x1 0x1 /* PB12 periph A with pullup */ 223 <1 12 0x1 0x1 /* PB12 periph A with pullup */
224 2 13 0x1 0x0>; /* PB13 periph A */ 224 1 13 0x1 0x0>; /* PB13 periph A */
225 }; 225 };
226 }; 226 };
227 227
@@ -322,6 +322,24 @@
322 }; 322 };
323 }; 323 };
324 324
325 spi0 {
326 pinctrl_spi0: spi0-0 {
327 atmel,pins =
328 <0 0 0x1 0x0 /* PA0 periph A SPI0_MISO pin */
329 0 1 0x1 0x0 /* PA1 periph A SPI0_MOSI pin */
330 0 2 0x1 0x0>; /* PA2 periph A SPI0_SPCK pin */
331 };
332 };
333
334 spi1 {
335 pinctrl_spi1: spi1-0 {
336 atmel,pins =
337 <1 0 0x1 0x0 /* PB0 periph A SPI1_MISO pin */
338 1 1 0x1 0x0 /* PB1 periph A SPI1_MOSI pin */
339 1 2 0x1 0x0>; /* PB2 periph A SPI1_SPCK pin */
340 };
341 };
342
325 pioA: gpio@fffff400 { 343 pioA: gpio@fffff400 {
326 compatible = "atmel,at91rm9200-gpio"; 344 compatible = "atmel,at91rm9200-gpio";
327 reg = <0xfffff400 0x200>; 345 reg = <0xfffff400 0x200>;
@@ -471,6 +489,28 @@
471 status = "disabled"; 489 status = "disabled";
472 }; 490 };
473 491
492 spi0: spi@fffc8000 {
493 #address-cells = <1>;
494 #size-cells = <0>;
495 compatible = "atmel,at91rm9200-spi";
496 reg = <0xfffc8000 0x200>;
497 interrupts = <12 4 3>;
498 pinctrl-names = "default";
499 pinctrl-0 = <&pinctrl_spi0>;
500 status = "disabled";
501 };
502
503 spi1: spi@fffcc000 {
504 #address-cells = <1>;
505 #size-cells = <0>;
506 compatible = "atmel,at91rm9200-spi";
507 reg = <0xfffcc000 0x200>;
508 interrupts = <13 4 3>;
509 pinctrl-names = "default";
510 pinctrl-0 = <&pinctrl_spi1>;
511 status = "disabled";
512 };
513
474 adc0: adc@fffe0000 { 514 adc0: adc@fffe0000 {
475 compatible = "atmel,at91sam9260-adc"; 515 compatible = "atmel,at91sam9260-adc";
476 reg = <0xfffe0000 0x100>; 516 reg = <0xfffe0000 0x100>;
@@ -484,6 +524,9 @@
484 atmel,adc-drdy-mask = <0x10000>; 524 atmel,adc-drdy-mask = <0x10000>;
485 atmel,adc-status-register = <0x1c>; 525 atmel,adc-status-register = <0x1c>;
486 atmel,adc-trigger-register = <0x04>; 526 atmel,adc-trigger-register = <0x04>;
527 atmel,adc-res = <8 10>;
528 atmel,adc-res-names = "lowres", "highres";
529 atmel,adc-use-res = "highres";
487 530
488 trigger@0 { 531 trigger@0 {
489 trigger-name = "timer-counter-0"; 532 trigger-name = "timer-counter-0";
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 271d4de026e9..94b58ab2cc08 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -303,6 +303,24 @@
303 }; 303 };
304 }; 304 };
305 305
306 spi0 {
307 pinctrl_spi0: spi0-0 {
308 atmel,pins =
309 <0 0 0x2 0x0 /* PA0 periph B SPI0_MISO pin */
310 0 1 0x2 0x0 /* PA1 periph B SPI0_MOSI pin */
311 0 2 0x2 0x0>; /* PA2 periph B SPI0_SPCK pin */
312 };
313 };
314
315 spi1 {
316 pinctrl_spi1: spi1-0 {
317 atmel,pins =
318 <1 12 0x1 0x0 /* PB12 periph A SPI1_MISO pin */
319 1 13 0x1 0x0 /* PB13 periph A SPI1_MOSI pin */
320 1 14 0x1 0x0>; /* PB14 periph A SPI1_SPCK pin */
321 };
322 };
323
306 pioA: gpio@fffff200 { 324 pioA: gpio@fffff200 {
307 compatible = "atmel,at91rm9200-gpio"; 325 compatible = "atmel,at91rm9200-gpio";
308 reg = <0xfffff200 0x200>; 326 reg = <0xfffff200 0x200>;
@@ -462,6 +480,28 @@
462 reg = <0xfffffd40 0x10>; 480 reg = <0xfffffd40 0x10>;
463 status = "disabled"; 481 status = "disabled";
464 }; 482 };
483
484 spi0: spi@fffa4000 {
485 #address-cells = <1>;
486 #size-cells = <0>;
487 compatible = "atmel,at91rm9200-spi";
488 reg = <0xfffa4000 0x200>;
489 interrupts = <14 4 3>;
490 pinctrl-names = "default";
491 pinctrl-0 = <&pinctrl_spi0>;
492 status = "disabled";
493 };
494
495 spi1: spi@fffa8000 {
496 #address-cells = <1>;
497 #size-cells = <0>;
498 compatible = "atmel,at91rm9200-spi";
499 reg = <0xfffa8000 0x200>;
500 interrupts = <15 4 3>;
501 pinctrl-names = "default";
502 pinctrl-0 = <&pinctrl_spi1>;
503 status = "disabled";
504 };
465 }; 505 };
466 506
467 nand0: nand@40000000 { 507 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index 1eb08728f527..3b82d91e7fcc 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -79,6 +79,16 @@
79 }; 79 };
80 }; 80 };
81 }; 81 };
82
83 spi0: spi@fffa4000 {
84 status = "okay";
85 cs-gpios = <&pioA 5 0>, <0>, <0>, <0>;
86 mtd_dataflash@0 {
87 compatible = "atmel,at45", "atmel,dataflash";
88 spi-max-frequency = <50000000>;
89 reg = <0>;
90 };
91 };
82 }; 92 };
83 93
84 nand0: nand@40000000 { 94 nand0: nand@40000000 {
@@ -155,8 +165,6 @@
155 165
156 gpio_keys { 166 gpio_keys {
157 compatible = "gpio-keys"; 167 compatible = "gpio-keys";
158 #address-cells = <1>;
159 #size-cells = <0>;
160 168
161 left_click { 169 left_click {
162 label = "left_click"; 170 label = "left_click";
diff --git a/arch/arm/boot/dts/at91sam9g15.dtsi b/arch/arm/boot/dts/at91sam9g15.dtsi
index fbe7a7089c2a..28467fd6bf96 100644
--- a/arch/arm/boot/dts/at91sam9g15.dtsi
+++ b/arch/arm/boot/dts/at91sam9g15.dtsi
@@ -10,7 +10,7 @@
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G15 SoC"; 12 model = "Atmel AT91SAM9G15 SoC";
13 compatible = "atmel, at91sam9g15, atmel,at91sam9x5"; 13 compatible = "atmel,at91sam9g15", "atmel,at91sam9x5";
14 14
15 ahb { 15 ahb {
16 apb { 16 apb {
diff --git a/arch/arm/boot/dts/at91sam9g15ek.dts b/arch/arm/boot/dts/at91sam9g15ek.dts
index 86dd3f6d938f..5427b2dba87e 100644
--- a/arch/arm/boot/dts/at91sam9g15ek.dts
+++ b/arch/arm/boot/dts/at91sam9g15ek.dts
@@ -11,6 +11,6 @@
11/include/ "at91sam9x5ek.dtsi" 11/include/ "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9G25-EK"; 14 model = "Atmel AT91SAM9G15-EK";
15 compatible = "atmel,at91sam9g15ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9g15ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16}; 16};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index da15e83e7f17..6a92c5baef8c 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -96,6 +96,16 @@
96 status = "okay"; 96 status = "okay";
97 pinctrl-0 = <&pinctrl_ssc0_tx>; 97 pinctrl-0 = <&pinctrl_ssc0_tx>;
98 }; 98 };
99
100 spi0: spi@fffc8000 {
101 status = "okay";
102 cs-gpios = <0>, <&pioC 11 0>, <0>, <0>;
103 mtd_dataflash@0 {
104 compatible = "atmel,at45", "atmel,dataflash";
105 spi-max-frequency = <50000000>;
106 reg = <1>;
107 };
108 };
99 }; 109 };
100 110
101 nand0: nand@40000000 { 111 nand0: nand@40000000 {
@@ -167,8 +177,6 @@
167 177
168 gpio_keys { 178 gpio_keys {
169 compatible = "gpio-keys"; 179 compatible = "gpio-keys";
170 #address-cells = <1>;
171 #size-cells = <0>;
172 180
173 btn3 { 181 btn3 {
174 label = "Button 3"; 182 label = "Button 3";
diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
index 05a718fb83c4..5fd32df03f25 100644
--- a/arch/arm/boot/dts/at91sam9g25.dtsi
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -10,7 +10,7 @@
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G25 SoC"; 12 model = "Atmel AT91SAM9G25 SoC";
13 compatible = "atmel, at91sam9g25, atmel,at91sam9x5"; 13 compatible = "atmel,at91sam9g25", "atmel,at91sam9x5";
14 14
15 ahb { 15 ahb {
16 apb { 16 apb {
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index c5ab16fba059..a1c511fecdc1 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -13,4 +13,13 @@
13/ { 13/ {
14 model = "Atmel AT91SAM9G25-EK"; 14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 ahb {
18 apb {
19 macb0: ethernet@f802c000 {
20 phy-mode = "rmii";
21 status = "okay";
22 };
23 };
24 };
16}; 25};
diff --git a/arch/arm/boot/dts/at91sam9g35.dtsi b/arch/arm/boot/dts/at91sam9g35.dtsi
index f9d14a722794..d6fa8af50724 100644
--- a/arch/arm/boot/dts/at91sam9g35.dtsi
+++ b/arch/arm/boot/dts/at91sam9g35.dtsi
@@ -10,7 +10,7 @@
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G35 SoC"; 12 model = "Atmel AT91SAM9G35 SoC";
13 compatible = "atmel, at91sam9g35, atmel,at91sam9x5"; 13 compatible = "atmel,at91sam9g35", "atmel,at91sam9x5";
14 14
15 ahb { 15 ahb {
16 apb { 16 apb {
diff --git a/arch/arm/boot/dts/at91sam9g35ek.dts b/arch/arm/boot/dts/at91sam9g35ek.dts
index 95944bdd798d..6f58ab8d21f5 100644
--- a/arch/arm/boot/dts/at91sam9g35ek.dts
+++ b/arch/arm/boot/dts/at91sam9g35ek.dts
@@ -13,4 +13,13 @@
13/ { 13/ {
14 model = "Atmel AT91SAM9G35-EK"; 14 model = "Atmel AT91SAM9G35-EK";
15 compatible = "atmel,at91sam9g35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9g35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 ahb {
18 apb {
19 macb0: ethernet@f802c000 {
20 phy-mode = "rmii";
21 status = "okay";
22 };
23 };
24 };
16}; 25};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 6b1d4cab24c2..f8f7370e8669 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -322,6 +322,24 @@
322 }; 322 };
323 }; 323 };
324 324
325 spi0 {
326 pinctrl_spi0: spi0-0 {
327 atmel,pins =
328 <1 0 0x1 0x0 /* PB0 periph A SPI0_MISO pin */
329 1 1 0x1 0x0 /* PB1 periph A SPI0_MOSI pin */
330 1 2 0x1 0x0>; /* PB2 periph A SPI0_SPCK pin */
331 };
332 };
333
334 spi1 {
335 pinctrl_spi1: spi1-0 {
336 atmel,pins =
337 <1 14 0x1 0x0 /* PB14 periph A SPI1_MISO pin */
338 1 15 0x1 0x0 /* PB15 periph A SPI1_MOSI pin */
339 1 16 0x1 0x0>; /* PB16 periph A SPI1_SPCK pin */
340 };
341 };
342
325 pioA: gpio@fffff200 { 343 pioA: gpio@fffff200 {
326 compatible = "atmel,at91rm9200-gpio"; 344 compatible = "atmel,at91rm9200-gpio";
327 reg = <0xfffff200 0x200>; 345 reg = <0xfffff200 0x200>;
@@ -484,6 +502,9 @@
484 atmel,adc-drdy-mask = <0x10000>; 502 atmel,adc-drdy-mask = <0x10000>;
485 atmel,adc-status-register = <0x1c>; 503 atmel,adc-status-register = <0x1c>;
486 atmel,adc-trigger-register = <0x08>; 504 atmel,adc-trigger-register = <0x08>;
505 atmel,adc-res = <8 10>;
506 atmel,adc-res-names = "lowres", "highres";
507 atmel,adc-use-res = "highres";
487 508
488 trigger@0 { 509 trigger@0 {
489 trigger-name = "external-rising"; 510 trigger-name = "external-rising";
@@ -531,6 +552,28 @@
531 reg = <0xfffffd40 0x10>; 552 reg = <0xfffffd40 0x10>;
532 status = "disabled"; 553 status = "disabled";
533 }; 554 };
555
556 spi0: spi@fffa4000 {
557 #address-cells = <1>;
558 #size-cells = <0>;
559 compatible = "atmel,at91rm9200-spi";
560 reg = <0xfffa4000 0x200>;
561 interrupts = <14 4 3>;
562 pinctrl-names = "default";
563 pinctrl-0 = <&pinctrl_spi0>;
564 status = "disabled";
565 };
566
567 spi1: spi@fffa8000 {
568 #address-cells = <1>;
569 #size-cells = <0>;
570 compatible = "atmel,at91rm9200-spi";
571 reg = <0xfffa8000 0x200>;
572 interrupts = <15 4 3>;
573 pinctrl-names = "default";
574 pinctrl-0 = <&pinctrl_spi1>;
575 status = "disabled";
576 };
534 }; 577 };
535 578
536 nand0: nand@40000000 { 579 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 20c31913c270..51d9251b5bbe 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -102,6 +102,16 @@
102 }; 102 };
103 }; 103 };
104 }; 104 };
105
106 spi0: spi@fffa4000{
107 status = "okay";
108 cs-gpios = <&pioB 3 0>, <0>, <0>, <0>;
109 mtd_dataflash@0 {
110 compatible = "atmel,at45", "atmel,dataflash";
111 spi-max-frequency = <13000000>;
112 reg = <0>;
113 };
114 };
105 }; 115 };
106 116
107 nand0: nand@40000000 { 117 nand0: nand@40000000 {
@@ -162,8 +172,6 @@
162 172
163 gpio_keys { 173 gpio_keys {
164 compatible = "gpio-keys"; 174 compatible = "gpio-keys";
165 #address-cells = <1>;
166 #size-cells = <0>;
167 175
168 left_click { 176 left_click {
169 label = "left_click"; 177 label = "left_click";
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 7750f98dd764..b2961f1ea51b 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -261,6 +261,24 @@
261 }; 261 };
262 }; 262 };
263 263
264 spi0 {
265 pinctrl_spi0: spi0-0 {
266 atmel,pins =
267 <0 11 0x1 0x0 /* PA11 periph A SPI0_MISO pin */
268 0 12 0x1 0x0 /* PA12 periph A SPI0_MOSI pin */
269 0 13 0x1 0x0>; /* PA13 periph A SPI0_SPCK pin */
270 };
271 };
272
273 spi1 {
274 pinctrl_spi1: spi1-0 {
275 atmel,pins =
276 <0 21 0x2 0x0 /* PA21 periph B SPI1_MISO pin */
277 0 22 0x2 0x0 /* PA22 periph B SPI1_MOSI pin */
278 0 23 0x2 0x0>; /* PA23 periph B SPI1_SPCK pin */
279 };
280 };
281
264 pioA: gpio@fffff400 { 282 pioA: gpio@fffff400 {
265 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 283 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
266 reg = <0xfffff400 0x200>; 284 reg = <0xfffff400 0x200>;
@@ -373,6 +391,28 @@
373 #size-cells = <0>; 391 #size-cells = <0>;
374 status = "disabled"; 392 status = "disabled";
375 }; 393 };
394
395 spi0: spi@f0000000 {
396 #address-cells = <1>;
397 #size-cells = <0>;
398 compatible = "atmel,at91rm9200-spi";
399 reg = <0xf0000000 0x100>;
400 interrupts = <13 4 3>;
401 pinctrl-names = "default";
402 pinctrl-0 = <&pinctrl_spi0>;
403 status = "disabled";
404 };
405
406 spi1: spi@f0004000 {
407 #address-cells = <1>;
408 #size-cells = <0>;
409 compatible = "atmel,at91rm9200-spi";
410 reg = <0xf0004000 0x100>;
411 interrupts = <14 4 3>;
412 pinctrl-names = "default";
413 pinctrl-0 = <&pinctrl_spi1>;
414 status = "disabled";
415 };
376 }; 416 };
377 417
378 nand0: nand@40000000 { 418 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index d400f8de4387..d30e48bd1e9d 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -67,6 +67,16 @@
67 }; 67 };
68 }; 68 };
69 }; 69 };
70
71 spi0: spi@f0000000 {
72 status = "okay";
73 cs-gpios = <&pioA 14 0>, <0>, <0>, <0>;
74 m25p80@0 {
75 compatible = "atmel,at25df321a";
76 spi-max-frequency = <50000000>;
77 reg = <0>;
78 };
79 };
70 }; 80 };
71 81
72 nand0: nand@40000000 { 82 nand0: nand@40000000 {
@@ -104,8 +114,6 @@
104 114
105 gpio_keys { 115 gpio_keys {
106 compatible = "gpio-keys"; 116 compatible = "gpio-keys";
107 #address-cells = <1>;
108 #size-cells = <0>;
109 117
110 enter { 118 enter {
111 label = "Enter"; 119 label = "Enter";
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
index 54eb33ba6d22..9ac2bc2b4f07 100644
--- a/arch/arm/boot/dts/at91sam9x25.dtsi
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -10,7 +10,7 @@
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9X25 SoC"; 12 model = "Atmel AT91SAM9X25 SoC";
13 compatible = "atmel, at91sam9x25, atmel,at91sam9x5"; 13 compatible = "atmel,at91sam9x25", "atmel,at91sam9x5";
14 14
15 ahb { 15 ahb {
16 apb { 16 apb {
diff --git a/arch/arm/boot/dts/at91sam9x25ek.dts b/arch/arm/boot/dts/at91sam9x25ek.dts
index af907eaa1f25..3b40d11d65e7 100644
--- a/arch/arm/boot/dts/at91sam9x25ek.dts
+++ b/arch/arm/boot/dts/at91sam9x25ek.dts
@@ -13,4 +13,18 @@
13/ { 13/ {
14 model = "Atmel AT91SAM9G25-EK"; 14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9x25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9x25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 ahb {
18 apb {
19 macb0: ethernet@f802c000 {
20 phy-mode = "rmii";
21 status = "okay";
22 };
23
24 macb1: ethernet@f8030000 {
25 phy-mode = "rmii";
26 status = "okay";
27 };
28 };
29 };
16}; 30};
diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
index fb102d6126ce..ba67d83d17ac 100644
--- a/arch/arm/boot/dts/at91sam9x35.dtsi
+++ b/arch/arm/boot/dts/at91sam9x35.dtsi
@@ -10,7 +10,7 @@
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9X35 SoC"; 12 model = "Atmel AT91SAM9X35 SoC";
13 compatible = "atmel, at91sam9x35, atmel,at91sam9x5"; 13 compatible = "atmel,at91sam9x35", "atmel,at91sam9x5";
14 14
15 ahb { 15 ahb {
16 apb { 16 apb {
diff --git a/arch/arm/boot/dts/at91sam9x35ek.dts b/arch/arm/boot/dts/at91sam9x35ek.dts
index 5ccb607b5414..6ad19a0d5424 100644
--- a/arch/arm/boot/dts/at91sam9x35ek.dts
+++ b/arch/arm/boot/dts/at91sam9x35ek.dts
@@ -13,4 +13,13 @@
13/ { 13/ {
14 model = "Atmel AT91SAM9X35-EK"; 14 model = "Atmel AT91SAM9X35-EK";
15 compatible = "atmel,at91sam9x35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9x35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 ahb {
18 apb {
19 macb0: ethernet@f802c000 {
20 phy-mode = "rmii";
21 status = "okay";
22 };
23 };
24 };
16}; 25};
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index a98c0d50fbbe..640b3bbbb706 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -343,6 +343,72 @@
343 }; 343 };
344 }; 344 };
345 345
346 spi0 {
347 pinctrl_spi0: spi0-0 {
348 atmel,pins =
349 <0 11 0x1 0x0 /* PA11 periph A SPI0_MISO pin */
350 0 12 0x1 0x0 /* PA12 periph A SPI0_MOSI pin */
351 0 13 0x1 0x0>; /* PA13 periph A SPI0_SPCK pin */
352 };
353 };
354
355 spi1 {
356 pinctrl_spi1: spi1-0 {
357 atmel,pins =
358 <0 21 0x2 0x0 /* PA21 periph B SPI1_MISO pin */
359 0 22 0x2 0x0 /* PA22 periph B SPI1_MOSI pin */
360 0 23 0x2 0x0>; /* PA23 periph B SPI1_SPCK pin */
361 };
362 };
363
364 i2c0 {
365 pinctrl_i2c0: i2c0-0 {
366 atmel,pins =
367 <0 30 0x1 0x0 /* PA30 periph A I2C0 data */
368 0 31 0x1 0x0>; /* PA31 periph A I2C0 clock */
369 };
370 };
371
372 i2c1 {
373 pinctrl_i2c1: i2c1-0 {
374 atmel,pins =
375 <2 0 0x3 0x0 /* PC0 periph C I2C1 data */
376 2 1 0x3 0x0>; /* PC1 periph C I2C1 clock */
377 };
378 };
379
380 i2c2 {
381 pinctrl_i2c2: i2c2-0 {
382 atmel,pins =
383 <1 4 0x2 0x0 /* PB4 periph B I2C2 data */
384 1 5 0x2 0x0>; /* PB5 periph B I2C2 clock */
385 };
386 };
387
388 i2c_gpio0 {
389 pinctrl_i2c_gpio0: i2c_gpio0-0 {
390 atmel,pins =
391 <0 30 0x0 0x2 /* PA30 gpio multidrive I2C0 data */
392 0 31 0x0 0x2>; /* PA31 gpio multidrive I2C0 clock */
393 };
394 };
395
396 i2c_gpio1 {
397 pinctrl_i2c_gpio1: i2c_gpio1-0 {
398 atmel,pins =
399 <2 0 0x0 0x2 /* PC0 gpio multidrive I2C1 data */
400 2 1 0x0 0x2>; /* PC1 gpio multidrive I2C1 clock */
401 };
402 };
403
404 i2c_gpio2 {
405 pinctrl_i2c_gpio2: i2c_gpio2-0 {
406 atmel,pins =
407 <1 4 0x0 0x2 /* PB4 gpio multidrive I2C2 data */
408 1 5 0x0 0x2>; /* PB5 gpio multidrive I2C2 clock */
409 };
410 };
411
346 pioA: gpio@fffff400 { 412 pioA: gpio@fffff400 {
347 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 413 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
348 reg = <0xfffff400 0x200>; 414 reg = <0xfffff400 0x200>;
@@ -471,6 +537,8 @@
471 interrupts = <9 4 6>; 537 interrupts = <9 4 6>;
472 #address-cells = <1>; 538 #address-cells = <1>;
473 #size-cells = <0>; 539 #size-cells = <0>;
540 pinctrl-names = "default";
541 pinctrl-0 = <&pinctrl_i2c0>;
474 status = "disabled"; 542 status = "disabled";
475 }; 543 };
476 544
@@ -480,6 +548,8 @@
480 interrupts = <10 4 6>; 548 interrupts = <10 4 6>;
481 #address-cells = <1>; 549 #address-cells = <1>;
482 #size-cells = <0>; 550 #size-cells = <0>;
551 pinctrl-names = "default";
552 pinctrl-0 = <&pinctrl_i2c1>;
483 status = "disabled"; 553 status = "disabled";
484 }; 554 };
485 555
@@ -489,6 +559,8 @@
489 interrupts = <11 4 6>; 559 interrupts = <11 4 6>;
490 #address-cells = <1>; 560 #address-cells = <1>;
491 #size-cells = <0>; 561 #size-cells = <0>;
562 pinctrl-names = "default";
563 pinctrl-0 = <&pinctrl_i2c2>;
492 status = "disabled"; 564 status = "disabled";
493 }; 565 };
494 566
@@ -505,6 +577,9 @@
505 atmel,adc-drdy-mask = <0x1000000>; 577 atmel,adc-drdy-mask = <0x1000000>;
506 atmel,adc-status-register = <0x30>; 578 atmel,adc-status-register = <0x30>;
507 atmel,adc-trigger-register = <0xc0>; 579 atmel,adc-trigger-register = <0xc0>;
580 atmel,adc-res = <8 10>;
581 atmel,adc-res-names = "lowres", "highres";
582 atmel,adc-use-res = "highres";
508 583
509 trigger@0 { 584 trigger@0 {
510 trigger-name = "external-rising"; 585 trigger-name = "external-rising";
@@ -529,6 +604,35 @@
529 trigger-value = <0x6>; 604 trigger-value = <0x6>;
530 }; 605 };
531 }; 606 };
607
608 spi0: spi@f0000000 {
609 #address-cells = <1>;
610 #size-cells = <0>;
611 compatible = "atmel,at91rm9200-spi";
612 reg = <0xf0000000 0x100>;
613 interrupts = <13 4 3>;
614 pinctrl-names = "default";
615 pinctrl-0 = <&pinctrl_spi0>;
616 status = "disabled";
617 };
618
619 spi1: spi@f0004000 {
620 #address-cells = <1>;
621 #size-cells = <0>;
622 compatible = "atmel,at91rm9200-spi";
623 reg = <0xf0004000 0x100>;
624 interrupts = <14 4 3>;
625 pinctrl-names = "default";
626 pinctrl-0 = <&pinctrl_spi1>;
627 status = "disabled";
628 };
629
630 rtc@fffffeb0 {
631 compatible = "atmel,at91rm9200-rtc";
632 reg = <0xfffffeb0 0x40>;
633 interrupts = <1 4 7>;
634 status = "disabled";
635 };
532 }; 636 };
533 637
534 nand0: nand@40000000 { 638 nand0: nand@40000000 {
@@ -577,6 +681,8 @@
577 i2c-gpio,delay-us = <2>; /* ~100 kHz */ 681 i2c-gpio,delay-us = <2>; /* ~100 kHz */
578 #address-cells = <1>; 682 #address-cells = <1>;
579 #size-cells = <0>; 683 #size-cells = <0>;
684 pinctrl-names = "default";
685 pinctrl-0 = <&pinctrl_i2c_gpio0>;
580 status = "disabled"; 686 status = "disabled";
581 }; 687 };
582 688
@@ -590,6 +696,8 @@
590 i2c-gpio,delay-us = <2>; /* ~100 kHz */ 696 i2c-gpio,delay-us = <2>; /* ~100 kHz */
591 #address-cells = <1>; 697 #address-cells = <1>;
592 #size-cells = <0>; 698 #size-cells = <0>;
699 pinctrl-names = "default";
700 pinctrl-0 = <&pinctrl_i2c_gpio1>;
593 status = "disabled"; 701 status = "disabled";
594 }; 702 };
595 703
@@ -603,6 +711,8 @@
603 i2c-gpio,delay-us = <2>; /* ~100 kHz */ 711 i2c-gpio,delay-us = <2>; /* ~100 kHz */
604 #address-cells = <1>; 712 #address-cells = <1>;
605 #size-cells = <0>; 713 #size-cells = <0>;
714 pinctrl-names = "default";
715 pinctrl-0 = <&pinctrl_i2c_gpio2>;
606 status = "disabled"; 716 status = "disabled";
607 }; 717 };
608}; 718};
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi
index 4027ac7e4502..347a74a857f6 100644
--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -24,6 +24,16 @@
24 }; 24 };
25 25
26 ahb { 26 ahb {
27 apb {
28 pinctrl@fffff400 {
29 1wire_cm {
30 pinctrl_1wire_cm: 1wire_cm-0 {
31 atmel,pins = <1 18 0x0 0x2>; /* PB18 multidrive, conflicts with led */
32 };
33 };
34 };
35 };
36
27 nand0: nand@40000000 { 37 nand0: nand@40000000 {
28 nand-bus-width = <8>; 38 nand-bus-width = <8>;
29 nand-ecc-mode = "hw"; 39 nand-ecc-mode = "hw";
@@ -74,4 +84,14 @@
74 gpios = <&pioD 21 0>; 84 gpios = <&pioD 21 0>;
75 }; 85 };
76 }; 86 };
87
88 1wire_cm {
89 compatible = "w1-gpio";
90 gpios = <&pioB 18 0>;
91 linux,open-drain;
92 pinctrl-names = "default";
93 pinctrl-0 = <&pinctrl_1wire_cm>;
94 status = "okay";
95 };
96
77}; 97};
diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index 8a7cf1d9cf5d..1fa48d2bfd80 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -13,7 +13,7 @@
13 compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 13 compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
14 14
15 chosen { 15 chosen {
16 bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"; 16 bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
17 }; 17 };
18 18
19 ahb { 19 ahb {
@@ -52,23 +52,10 @@
52 status = "okay"; 52 status = "okay";
53 }; 53 };
54 54
55 macb0: ethernet@f802c000 {
56 phy-mode = "rmii";
57 status = "okay";
58 };
59
60 i2c0: i2c@f8010000 { 55 i2c0: i2c@f8010000 {
61 status = "okay"; 56 status = "okay";
62 }; 57 };
63 58
64 i2c1: i2c@f8014000 {
65 status = "okay";
66 };
67
68 i2c2: i2c@f8018000 {
69 status = "okay";
70 };
71
72 pinctrl@fffff400 { 59 pinctrl@fffff400 {
73 mmc0 { 60 mmc0 {
74 pinctrl_board_mmc0: mmc0-board { 61 pinctrl_board_mmc0: mmc0-board {
@@ -84,6 +71,16 @@
84 }; 71 };
85 }; 72 };
86 }; 73 };
74
75 spi0: spi@f0000000 {
76 status = "okay";
77 cs-gpios = <&pioA 14 0>, <0>, <0>, <0>;
78 m25p80@0 {
79 compatible = "atmel,at25df321a";
80 spi-max-frequency = <50000000>;
81 reg = <0>;
82 };
83 };
87 }; 84 };
88 85
89 usb0: ohci@00600000 { 86 usb0: ohci@00600000 {
diff --git a/arch/arm/boot/dts/atlas6-evb.dts b/arch/arm/boot/dts/atlas6-evb.dts
new file mode 100644
index 000000000000..ab042ca8dea1
--- /dev/null
+++ b/arch/arm/boot/dts/atlas6-evb.dts
@@ -0,0 +1,78 @@
1/*
2 * DTS file for CSR SiRFatlas6 Evaluation Board
3 *
4 * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9/dts-v1/;
10
11/include/ "atlas6.dtsi"
12
13/ {
14 model = "CSR SiRFatlas6 Evaluation Board";
15 compatible = "sirf,atlas6-cb", "sirf,atlas6";
16
17 memory {
18 reg = <0x00000000 0x20000000>;
19 };
20
21 axi {
22 peri-iobg {
23 uart@b0060000 {
24 pinctrl-names = "default";
25 pinctrl-0 = <&uart1_pins_a>;
26 };
27 spi@b00d0000 {
28 status = "okay";
29 pinctrl-names = "default";
30 pinctrl-0 = <&spi0_pins_a>;
31 spi@0 {
32 compatible = "spidev";
33 reg = <0>;
34 spi-max-frequency = <1000000>;
35 };
36 };
37 spi@b0170000 {
38 pinctrl-names = "default";
39 pinctrl-0 = <&spi1_pins_a>;
40 };
41 i2c0: i2c@b00e0000 {
42 status = "okay";
43 pinctrl-names = "default";
44 pinctrl-0 = <&i2c0_pins_a>;
45 lcd@40 {
46 compatible = "sirf,lcd";
47 reg = <0x40>;
48 };
49 };
50
51 };
52 disp-iobg {
53 lcd@90010000 {
54 status = "okay";
55 pinctrl-names = "default";
56 pinctrl-0 = <&lcd_24pins_a>;
57 };
58 };
59 };
60 display: display@0 {
61 panels {
62 panel0: panel@0 {
63 panel-name = "Innolux TFT";
64 hactive = <800>;
65 vactive = <480>;
66 left_margin = <20>;
67 right_margin = <234>;
68 upper_margin = <3>;
69 lower_margin = <41>;
70 hsync_len = <3>;
71 vsync_len = <2>;
72 pixclock = <33264000>;
73 sync = <3>;
74 timing = <0x88>;
75 };
76 };
77 };
78};
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
new file mode 100644
index 000000000000..7d1a27949c13
--- /dev/null
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -0,0 +1,668 @@
1/*
2 * DTS file for CSR SiRFatlas6 SoC
3 *
4 * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9/include/ "skeleton.dtsi"
10/ {
11 compatible = "sirf,atlas6";
12 #address-cells = <1>;
13 #size-cells = <1>;
14 interrupt-parent = <&intc>;
15
16 cpus {
17 #address-cells = <1>;
18 #size-cells = <0>;
19
20 cpu@0 {
21 reg = <0x0>;
22 d-cache-line-size = <32>;
23 i-cache-line-size = <32>;
24 d-cache-size = <32768>;
25 i-cache-size = <32768>;
26 /* from bootloader */
27 timebase-frequency = <0>;
28 bus-frequency = <0>;
29 clock-frequency = <0>;
30 };
31 };
32
33 axi {
34 compatible = "simple-bus";
35 #address-cells = <1>;
36 #size-cells = <1>;
37 ranges = <0x40000000 0x40000000 0x80000000>;
38
39 intc: interrupt-controller@80020000 {
40 #interrupt-cells = <1>;
41 interrupt-controller;
42 compatible = "sirf,prima2-intc";
43 reg = <0x80020000 0x1000>;
44 };
45
46 sys-iobg {
47 compatible = "simple-bus";
48 #address-cells = <1>;
49 #size-cells = <1>;
50 ranges = <0x88000000 0x88000000 0x40000>;
51
52 clks: clock-controller@88000000 {
53 compatible = "sirf,atlas6-clkc";
54 reg = <0x88000000 0x1000>;
55 interrupts = <3>;
56 #clock-cells = <1>;
57 };
58
59 reset-controller@88010000 {
60 compatible = "sirf,prima2-rstc";
61 reg = <0x88010000 0x1000>;
62 };
63
64 rsc-controller@88020000 {
65 compatible = "sirf,prima2-rsc";
66 reg = <0x88020000 0x1000>;
67 };
68 };
69
70 mem-iobg {
71 compatible = "simple-bus";
72 #address-cells = <1>;
73 #size-cells = <1>;
74 ranges = <0x90000000 0x90000000 0x10000>;
75
76 memory-controller@90000000 {
77 compatible = "sirf,prima2-memc";
78 reg = <0x90000000 0x10000>;
79 interrupts = <27>;
80 clocks = <&clks 5>;
81 };
82 };
83
84 disp-iobg {
85 compatible = "simple-bus";
86 #address-cells = <1>;
87 #size-cells = <1>;
88 ranges = <0x90010000 0x90010000 0x30000>;
89
90 lcd@90010000 {
91 compatible = "sirf,prima2-lcd";
92 reg = <0x90010000 0x20000>;
93 interrupts = <30>;
94 clocks = <&clks 34>;
95 display=<&display>;
96 /* later transfer to pwm */
97 bl-gpio = <&gpio 7 0>;
98 default-panel = <&panel0>;
99 };
100
101 vpp@90020000 {
102 compatible = "sirf,prima2-vpp";
103 reg = <0x90020000 0x10000>;
104 interrupts = <31>;
105 clocks = <&clks 35>;
106 };
107 };
108
109 graphics-iobg {
110 compatible = "simple-bus";
111 #address-cells = <1>;
112 #size-cells = <1>;
113 ranges = <0x98000000 0x98000000 0x8000000>;
114
115 graphics@98000000 {
116 compatible = "powervr,sgx510";
117 reg = <0x98000000 0x8000000>;
118 interrupts = <6>;
119 clocks = <&clks 32>;
120 };
121 };
122
123 dsp-iobg {
124 compatible = "simple-bus";
125 #address-cells = <1>;
126 #size-cells = <1>;
127 ranges = <0xa8000000 0xa8000000 0x2000000>;
128
129 dspif@a8000000 {
130 compatible = "sirf,prima2-dspif";
131 reg = <0xa8000000 0x10000>;
132 interrupts = <9>;
133 };
134
135 gps@a8010000 {
136 compatible = "sirf,prima2-gps";
137 reg = <0xa8010000 0x10000>;
138 interrupts = <7>;
139 clocks = <&clks 9>;
140 };
141
142 dsp@a9000000 {
143 compatible = "sirf,prima2-dsp";
144 reg = <0xa9000000 0x1000000>;
145 interrupts = <8>;
146 clocks = <&clks 8>;
147 };
148 };
149
150 peri-iobg {
151 compatible = "simple-bus";
152 #address-cells = <1>;
153 #size-cells = <1>;
154 ranges = <0xb0000000 0xb0000000 0x180000>,
155 <0x56000000 0x56000000 0x1b00000>;
156
157 timer@b0020000 {
158 compatible = "sirf,prima2-tick";
159 reg = <0xb0020000 0x1000>;
160 interrupts = <0>;
161 };
162
163 nand@b0030000 {
164 compatible = "sirf,prima2-nand";
165 reg = <0xb0030000 0x10000>;
166 interrupts = <41>;
167 clocks = <&clks 26>;
168 };
169
170 audio@b0040000 {
171 compatible = "sirf,prima2-audio";
172 reg = <0xb0040000 0x10000>;
173 interrupts = <35>;
174 clocks = <&clks 27>;
175 };
176
177 uart0: uart@b0050000 {
178 cell-index = <0>;
179 compatible = "sirf,prima2-uart";
180 reg = <0xb0050000 0x1000>;
181 interrupts = <17>;
182 fifosize = <128>;
183 clocks = <&clks 13>;
184 };
185
186 uart1: uart@b0060000 {
187 cell-index = <1>;
188 compatible = "sirf,prima2-uart";
189 reg = <0xb0060000 0x1000>;
190 interrupts = <18>;
191 fifosize = <32>;
192 clocks = <&clks 14>;
193 };
194
195 uart2: uart@b0070000 {
196 cell-index = <2>;
197 compatible = "sirf,prima2-uart";
198 reg = <0xb0070000 0x1000>;
199 interrupts = <19>;
200 fifosize = <128>;
201 clocks = <&clks 15>;
202 };
203
204 usp0: usp@b0080000 {
205 cell-index = <0>;
206 compatible = "sirf,prima2-usp";
207 reg = <0xb0080000 0x10000>;
208 interrupts = <20>;
209 clocks = <&clks 28>;
210 };
211
212 usp1: usp@b0090000 {
213 cell-index = <1>;
214 compatible = "sirf,prima2-usp";
215 reg = <0xb0090000 0x10000>;
216 interrupts = <21>;
217 clocks = <&clks 29>;
218 };
219
220 dmac0: dma-controller@b00b0000 {
221 cell-index = <0>;
222 compatible = "sirf,prima2-dmac";
223 reg = <0xb00b0000 0x10000>;
224 interrupts = <12>;
225 clocks = <&clks 24>;
226 };
227
228 dmac1: dma-controller@b0160000 {
229 cell-index = <1>;
230 compatible = "sirf,prima2-dmac";
231 reg = <0xb0160000 0x10000>;
232 interrupts = <13>;
233 clocks = <&clks 25>;
234 };
235
236 vip@b00C0000 {
237 compatible = "sirf,prima2-vip";
238 reg = <0xb00C0000 0x10000>;
239 clocks = <&clks 31>;
240 };
241
242 spi0: spi@b00d0000 {
243 cell-index = <0>;
244 compatible = "sirf,prima2-spi";
245 reg = <0xb00d0000 0x10000>;
246 interrupts = <15>;
247 sirf,spi-num-chipselects = <1>;
248 cs-gpios = <&gpio 0 0>;
249 sirf,spi-dma-rx-channel = <25>;
250 sirf,spi-dma-tx-channel = <20>;
251 #address-cells = <1>;
252 #size-cells = <0>;
253 clocks = <&clks 19>;
254 status = "disabled";
255 };
256
257 spi1: spi@b0170000 {
258 cell-index = <1>;
259 compatible = "sirf,prima2-spi";
260 reg = <0xb0170000 0x10000>;
261 interrupts = <16>;
262 clocks = <&clks 20>;
263 status = "disabled";
264 };
265
266 i2c0: i2c@b00e0000 {
267 cell-index = <0>;
268 compatible = "sirf,prima2-i2c";
269 reg = <0xb00e0000 0x10000>;
270 interrupts = <24>;
271 #address-cells = <1>;
272 #size-cells = <0>;
273 clocks = <&clks 17>;
274 };
275
276 i2c1: i2c@b00f0000 {
277 cell-index = <1>;
278 compatible = "sirf,prima2-i2c";
279 reg = <0xb00f0000 0x10000>;
280 interrupts = <25>;
281 #address-cells = <1>;
282 #size-cells = <0>;
283 clocks = <&clks 18>;
284 };
285
286 tsc@b0110000 {
287 compatible = "sirf,prima2-tsc";
288 reg = <0xb0110000 0x10000>;
289 interrupts = <33>;
290 clocks = <&clks 16>;
291 };
292
293 gpio: pinctrl@b0120000 {
294 #gpio-cells = <2>;
295 #interrupt-cells = <2>;
296 compatible = "sirf,atlas6-pinctrl";
297 reg = <0xb0120000 0x10000>;
298 interrupts = <43 44 45 46 47>;
299 gpio-controller;
300 interrupt-controller;
301
302 lcd_16pins_a: lcd0@0 {
303 lcd {
304 sirf,pins = "lcd_16bitsgrp";
305 sirf,function = "lcd_16bits";
306 };
307 };
308 lcd_18pins_a: lcd0@1 {
309 lcd {
310 sirf,pins = "lcd_18bitsgrp";
311 sirf,function = "lcd_18bits";
312 };
313 };
314 lcd_24pins_a: lcd0@2 {
315 lcd {
316 sirf,pins = "lcd_24bitsgrp";
317 sirf,function = "lcd_24bits";
318 };
319 };
320 lcdrom_pins_a: lcdrom0@0 {
321 lcd {
322 sirf,pins = "lcdromgrp";
323 sirf,function = "lcdrom";
324 };
325 };
326 uart0_pins_a: uart0@0 {
327 uart {
328 sirf,pins = "uart0grp";
329 sirf,function = "uart0";
330 };
331 };
332 uart1_pins_a: uart1@0 {
333 uart {
334 sirf,pins = "uart1grp";
335 sirf,function = "uart1";
336 };
337 };
338 uart2_pins_a: uart2@0 {
339 uart {
340 sirf,pins = "uart2grp";
341 sirf,function = "uart2";
342 };
343 };
344 uart2_noflow_pins_a: uart2@1 {
345 uart {
346 sirf,pins = "uart2_nostreamctrlgrp";
347 sirf,function = "uart2_nostreamctrl";
348 };
349 };
350 spi0_pins_a: spi0@0 {
351 spi {
352 sirf,pins = "spi0grp";
353 sirf,function = "spi0";
354 };
355 };
356 spi1_pins_a: spi1@0 {
357 spi {
358 sirf,pins = "spi1grp";
359 sirf,function = "spi1";
360 };
361 };
362 i2c0_pins_a: i2c0@0 {
363 i2c {
364 sirf,pins = "i2c0grp";
365 sirf,function = "i2c0";
366 };
367 };
368 i2c1_pins_a: i2c1@0 {
369 i2c {
370 sirf,pins = "i2c1grp";
371 sirf,function = "i2c1";
372 };
373 };
374 pwm0_pins_a: pwm0@0 {
375 pwm {
376 sirf,pins = "pwm0grp";
377 sirf,function = "pwm0";
378 };
379 };
380 pwm1_pins_a: pwm1@0 {
381 pwm {
382 sirf,pins = "pwm1grp";
383 sirf,function = "pwm1";
384 };
385 };
386 pwm2_pins_a: pwm2@0 {
387 pwm {
388 sirf,pins = "pwm2grp";
389 sirf,function = "pwm2";
390 };
391 };
392 pwm3_pins_a: pwm3@0 {
393 pwm {
394 sirf,pins = "pwm3grp";
395 sirf,function = "pwm3";
396 };
397 };
398 pwm4_pins_a: pwm4@0 {
399 pwm {
400 sirf,pins = "pwm4grp";
401 sirf,function = "pwm4";
402 };
403 };
404 gps_pins_a: gps@0 {
405 gps {
406 sirf,pins = "gpsgrp";
407 sirf,function = "gps";
408 };
409 };
410 vip_pins_a: vip@0 {
411 vip {
412 sirf,pins = "vipgrp";
413 sirf,function = "vip";
414 };
415 };
416 sdmmc0_pins_a: sdmmc0@0 {
417 sdmmc0 {
418 sirf,pins = "sdmmc0grp";
419 sirf,function = "sdmmc0";
420 };
421 };
422 sdmmc1_pins_a: sdmmc1@0 {
423 sdmmc1 {
424 sirf,pins = "sdmmc1grp";
425 sirf,function = "sdmmc1";
426 };
427 };
428 sdmmc2_pins_a: sdmmc2@0 {
429 sdmmc2 {
430 sirf,pins = "sdmmc2grp";
431 sirf,function = "sdmmc2";
432 };
433 };
434 sdmmc2_nowp_pins_a: sdmmc2_nowp@0 {
435 sdmmc2_nowp {
436 sirf,pins = "sdmmc2_nowpgrp";
437 sirf,function = "sdmmc2_nowp";
438 };
439 };
440 sdmmc3_pins_a: sdmmc3@0 {
441 sdmmc3 {
442 sirf,pins = "sdmmc3grp";
443 sirf,function = "sdmmc3";
444 };
445 };
446 sdmmc5_pins_a: sdmmc5@0 {
447 sdmmc5 {
448 sirf,pins = "sdmmc5grp";
449 sirf,function = "sdmmc5";
450 };
451 };
452 i2s_pins_a: i2s@0 {
453 i2s {
454 sirf,pins = "i2sgrp";
455 sirf,function = "i2s";
456 };
457 };
458 i2s_no_din_pins_a: i2s_no_din@0 {
459 i2s_no_din {
460 sirf,pins = "i2s_no_dingrp";
461 sirf,function = "i2s_no_din";
462 };
463 };
464 i2s_6chn_pins_a: i2s_6chn@0 {
465 i2s_6chn {
466 sirf,pins = "i2s_6chngrp";
467 sirf,function = "i2s_6chn";
468 };
469 };
470 ac97_pins_a: ac97@0 {
471 ac97 {
472 sirf,pins = "ac97grp";
473 sirf,function = "ac97";
474 };
475 };
476 nand_pins_a: nand@0 {
477 nand {
478 sirf,pins = "nandgrp";
479 sirf,function = "nand";
480 };
481 };
482 usp0_pins_a: usp0@0 {
483 usp0 {
484 sirf,pins = "usp0grp";
485 sirf,function = "usp0";
486 };
487 };
488 usp1_pins_a: usp1@0 {
489 usp1 {
490 sirf,pins = "usp1grp";
491 sirf,function = "usp1";
492 };
493 };
494 usb0_upli_drvbus_pins_a: usb0_upli_drvbus@0 {
495 usb0_upli_drvbus {
496 sirf,pins = "usb0_upli_drvbusgrp";
497 sirf,function = "usb0_upli_drvbus";
498 };
499 };
500 usb1_utmi_drvbus_pins_a: usb1_utmi_drvbus@0 {
501 usb1_utmi_drvbus {
502 sirf,pins = "usb1_utmi_drvbusgrp";
503 sirf,function = "usb1_utmi_drvbus";
504 };
505 };
506 warm_rst_pins_a: warm_rst@0 {
507 warm_rst {
508 sirf,pins = "warm_rstgrp";
509 sirf,function = "warm_rst";
510 };
511 };
512 pulse_count_pins_a: pulse_count@0 {
513 pulse_count {
514 sirf,pins = "pulse_countgrp";
515 sirf,function = "pulse_count";
516 };
517 };
518 cko0_rst_pins_a: cko0_rst@0 {
519 cko0_rst {
520 sirf,pins = "cko0_rstgrp";
521 sirf,function = "cko0_rst";
522 };
523 };
524 cko1_rst_pins_a: cko1_rst@0 {
525 cko1_rst {
526 sirf,pins = "cko1_rstgrp";
527 sirf,function = "cko1_rst";
528 };
529 };
530 };
531
532 pwm@b0130000 {
533 compatible = "sirf,prima2-pwm";
534 reg = <0xb0130000 0x10000>;
535 clocks = <&clks 21>;
536 };
537
538 efusesys@b0140000 {
539 compatible = "sirf,prima2-efuse";
540 reg = <0xb0140000 0x10000>;
541 clocks = <&clks 22>;
542 };
543
544 pulsec@b0150000 {
545 compatible = "sirf,prima2-pulsec";
546 reg = <0xb0150000 0x10000>;
547 interrupts = <48>;
548 clocks = <&clks 23>;
549 };
550
551 pci-iobg {
552 compatible = "sirf,prima2-pciiobg", "simple-bus";
553 #address-cells = <1>;
554 #size-cells = <1>;
555 ranges = <0x56000000 0x56000000 0x1b00000>;
556
557 sd0: sdhci@56000000 {
558 cell-index = <0>;
559 compatible = "sirf,prima2-sdhc";
560 reg = <0x56000000 0x100000>;
561 interrupts = <38>;
562 bus-width = <8>;
563 clocks = <&clks 36>;
564 };
565
566 sd1: sdhci@56100000 {
567 cell-index = <1>;
568 compatible = "sirf,prima2-sdhc";
569 reg = <0x56100000 0x100000>;
570 interrupts = <38>;
571 status = "disabled";
572 clocks = <&clks 36>;
573 };
574
575 sd2: sdhci@56200000 {
576 cell-index = <2>;
577 compatible = "sirf,prima2-sdhc";
578 reg = <0x56200000 0x100000>;
579 interrupts = <23>;
580 status = "disabled";
581 clocks = <&clks 37>;
582 };
583
584 sd3: sdhci@56300000 {
585 cell-index = <3>;
586 compatible = "sirf,prima2-sdhc";
587 reg = <0x56300000 0x100000>;
588 interrupts = <23>;
589 status = "disabled";
590 clocks = <&clks 37>;
591 };
592
593 sd5: sdhci@56500000 {
594 cell-index = <5>;
595 compatible = "sirf,prima2-sdhc";
596 reg = <0x56500000 0x100000>;
597 interrupts = <39>;
598 status = "disabled";
599 clocks = <&clks 38>;
600 };
601
602 pci-copy@57900000 {
603 compatible = "sirf,prima2-pcicp";
604 reg = <0x57900000 0x100000>;
605 interrupts = <40>;
606 };
607
608 rom-interface@57a00000 {
609 compatible = "sirf,prima2-romif";
610 reg = <0x57a00000 0x100000>;
611 };
612 };
613 };
614
615 rtc-iobg {
616 compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus";
617 #address-cells = <1>;
618 #size-cells = <1>;
619 reg = <0x80030000 0x10000>;
620
621 gpsrtc@1000 {
622 compatible = "sirf,prima2-gpsrtc";
623 reg = <0x1000 0x1000>;
624 interrupts = <55 56 57>;
625 };
626
627 sysrtc@2000 {
628 compatible = "sirf,prima2-sysrtc";
629 reg = <0x2000 0x1000>;
630 interrupts = <52 53 54>;
631 };
632
633 pwrc@3000 {
634 compatible = "sirf,prima2-pwrc";
635 reg = <0x3000 0x1000>;
636 interrupts = <32>;
637 };
638 };
639
640 uus-iobg {
641 compatible = "simple-bus";
642 #address-cells = <1>;
643 #size-cells = <1>;
644 ranges = <0xb8000000 0xb8000000 0x40000>;
645
646 usb0: usb@b00e0000 {
647 compatible = "chipidea,ci13611a-prima2";
648 reg = <0xb8000000 0x10000>;
649 interrupts = <10>;
650 clocks = <&clks 40>;
651 };
652
653 usb1: usb@b00f0000 {
654 compatible = "chipidea,ci13611a-prima2";
655 reg = <0xb8010000 0x10000>;
656 interrupts = <11>;
657 clocks = <&clks 41>;
658 };
659
660 security@b00f0000 {
661 compatible = "sirf,prima2-security";
662 reg = <0xb8030000 0x10000>;
663 interrupts = <42>;
664 clocks = <&clks 7>;
665 };
666 };
667 };
668};
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index ad135885bd2a..41b2c6c33f09 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -31,6 +31,11 @@
31 <0x3ff00100 0x100>; 31 <0x3ff00100 0x100>;
32 }; 32 };
33 33
34 smc@0x3404c000 {
35 compatible = "bcm,bcm11351-smc", "bcm,kona-smc";
36 reg = <0x3404c000 0x400>; //1 KiB in SRAM
37 };
38
34 uart@3e000000 { 39 uart@3e000000 {
35 compatible = "bcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart"; 40 compatible = "bcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
36 status = "disabled"; 41 status = "disabled";
@@ -47,4 +52,12 @@
47 cache-unified; 52 cache-unified;
48 cache-level = <2>; 53 cache-level = <2>;
49 }; 54 };
55
56 timer@35006000 {
57 compatible = "bcm,kona-timer";
58 reg = <0x35006000 0x1000>;
59 interrupts = <0x0 7 0x4>;
60 clock-frequency = <32768>;
61 };
62
50}; 63};
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 7e0481e2441a..f0052dccf9a8 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -34,6 +34,11 @@
34 reg = <0x7e100000 0x28>; 34 reg = <0x7e100000 0x28>;
35 }; 35 };
36 36
37 rng {
38 compatible = "brcm,bcm2835-rng";
39 reg = <0x7e104000 0x10>;
40 };
41
37 uart@20201000 { 42 uart@20201000 {
38 compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; 43 compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
39 reg = <0x7e201000 0x1000>; 44 reg = <0x7e201000 0x1000>;
@@ -64,6 +69,16 @@
64 #interrupt-cells = <2>; 69 #interrupt-cells = <2>;
65 }; 70 };
66 71
72 spi: spi@20204000 {
73 compatible = "brcm,bcm2835-spi";
74 reg = <0x7e204000 0x1000>;
75 interrupts = <2 22>;
76 clocks = <&clk_spi>;
77 #address-cells = <1>;
78 #size-cells = <0>;
79 status = "disabled";
80 };
81
67 i2c0: i2c@20205000 { 82 i2c0: i2c@20205000 {
68 compatible = "brcm,bcm2835-i2c"; 83 compatible = "brcm,bcm2835-i2c";
69 reg = <0x7e205000 0x1000>; 84 reg = <0x7e205000 0x1000>;
@@ -107,5 +122,12 @@
107 #clock-cells = <0>; 122 #clock-cells = <0>;
108 clock-frequency = <250000000>; 123 clock-frequency = <250000000>;
109 }; 124 };
125
126 clk_spi: spi {
127 compatible = "fixed-clock";
128 reg = <2>;
129 #clock-cells = <0>;
130 clock-frequency = <250000000>;
131 };
110 }; 132 };
111}; 133};
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi
index 46c098017036..62eceb4f0d3f 100644
--- a/arch/arm/boot/dts/cros5250-common.dtsi
+++ b/arch/arm/boot/dts/cros5250-common.dtsi
@@ -24,6 +24,144 @@
24 samsung,i2c-max-bus-freq = <378000>; 24 samsung,i2c-max-bus-freq = <378000>;
25 gpios = <&gpb3 0 2 3 0>, 25 gpios = <&gpb3 0 2 3 0>,
26 <&gpb3 1 2 3 0>; 26 <&gpb3 1 2 3 0>;
27
28 max77686@09 {
29 compatible = "maxim,max77686";
30 reg = <0x09>;
31
32 voltage-regulators {
33 ldo1_reg: LDO1 {
34 regulator-name = "P1.0V_LDO_OUT1";
35 regulator-min-microvolt = <1000000>;
36 regulator-max-microvolt = <1000000>;
37 regulator-always-on;
38 };
39
40 ldo2_reg: LDO2 {
41 regulator-name = "P1.8V_LDO_OUT2";
42 regulator-min-microvolt = <1800000>;
43 regulator-max-microvolt = <1800000>;
44 regulator-always-on;
45 };
46
47 ldo3_reg: LDO3 {
48 regulator-name = "P1.8V_LDO_OUT3";
49 regulator-min-microvolt = <1800000>;
50 regulator-max-microvolt = <1800000>;
51 regulator-always-on;
52 };
53
54 ldo7_reg: LDO7 {
55 regulator-name = "P1.1V_LDO_OUT7";
56 regulator-min-microvolt = <1100000>;
57 regulator-max-microvolt = <1100000>;
58 regulator-always-on;
59 };
60
61 ldo8_reg: LDO8 {
62 regulator-name = "P1.0V_LDO_OUT8";
63 regulator-min-microvolt = <1000000>;
64 regulator-max-microvolt = <1000000>;
65 regulator-always-on;
66 };
67
68 ldo10_reg: LDO10 {
69 regulator-name = "P1.8V_LDO_OUT10";
70 regulator-min-microvolt = <1800000>;
71 regulator-max-microvolt = <1800000>;
72 regulator-always-on;
73 };
74
75 ldo12_reg: LDO12 {
76 regulator-name = "P3.0V_LDO_OUT12";
77 regulator-min-microvolt = <3000000>;
78 regulator-max-microvolt = <3000000>;
79 regulator-always-on;
80 };
81
82 ldo14_reg: LDO14 {
83 regulator-name = "P1.8V_LDO_OUT14";
84 regulator-min-microvolt = <1800000>;
85 regulator-max-microvolt = <1800000>;
86 regulator-always-on;
87 };
88
89 ldo15_reg: LDO15 {
90 regulator-name = "P1.0V_LDO_OUT15";
91 regulator-min-microvolt = <1000000>;
92 regulator-max-microvolt = <1000000>;
93 regulator-always-on;
94 };
95
96 ldo16_reg: LDO16 {
97 regulator-name = "P1.8V_LDO_OUT16";
98 regulator-min-microvolt = <1800000>;
99 regulator-max-microvolt = <1800000>;
100 regulator-always-on;
101 };
102
103 buck1_reg: BUCK1 {
104 regulator-name = "vdd_mif";
105 regulator-min-microvolt = <950000>;
106 regulator-max-microvolt = <1300000>;
107 regulator-always-on;
108 regulator-boot-on;
109 };
110
111 buck2_reg: BUCK2 {
112 regulator-name = "vdd_arm";
113 regulator-min-microvolt = <850000>;
114 regulator-max-microvolt = <1350000>;
115 regulator-always-on;
116 regulator-boot-on;
117 };
118
119 buck3_reg: BUCK3 {
120 regulator-name = "vdd_int";
121 regulator-min-microvolt = <900000>;
122 regulator-max-microvolt = <1200000>;
123 regulator-always-on;
124 regulator-boot-on;
125 };
126
127 buck4_reg: BUCK4 {
128 regulator-name = "vdd_g3d";
129 regulator-min-microvolt = <850000>;
130 regulator-max-microvolt = <1300000>;
131 regulator-always-on;
132 regulator-boot-on;
133 };
134
135 buck5_reg: BUCK5 {
136 regulator-name = "P1.8V_BUCK_OUT5";
137 regulator-min-microvolt = <1800000>;
138 regulator-max-microvolt = <1800000>;
139 regulator-always-on;
140 regulator-boot-on;
141 };
142
143 buck6_reg: BUCK6 {
144 regulator-name = "P1.35V_BUCK_OUT6";
145 regulator-min-microvolt = <1350000>;
146 regulator-max-microvolt = <1350000>;
147 regulator-always-on;
148 };
149
150 buck7_reg: BUCK7 {
151 regulator-name = "P2.0V_BUCK_OUT7";
152 regulator-min-microvolt = <2000000>;
153 regulator-max-microvolt = <2000000>;
154 regulator-always-on;
155 };
156
157 buck8_reg: BUCK8 {
158 regulator-name = "P2.85V_BUCK_OUT8";
159 regulator-min-microvolt = <2850000>;
160 regulator-max-microvolt = <2850000>;
161 regulator-always-on;
162 };
163 };
164 };
27 }; 165 };
28 166
29 i2c@12C70000 { 167 i2c@12C70000 {
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index f712fb607a42..c5834a6c5bf4 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -35,14 +35,84 @@
35 clock-frequency = <100000>; 35 clock-frequency = <100000>;
36 pinctrl-names = "default"; 36 pinctrl-names = "default";
37 pinctrl-0 = <&i2c0_pins>; 37 pinctrl-0 = <&i2c0_pins>;
38
39 tps: tps@48 {
40 reg = <0x48>;
41 };
38 }; 42 };
39 wdt: wdt@1c21000 { 43 wdt: wdt@1c21000 {
40 status = "okay"; 44 status = "okay";
41 }; 45 };
46 mmc0: mmc@1c40000 {
47 max-frequency = <50000000>;
48 bus-width = <4>;
49 status = "okay";
50 pinctrl-names = "default";
51 pinctrl-0 = <&mmc0_pins>;
52 };
42 }; 53 };
43 nand_cs3@62000000 { 54 nand_cs3@62000000 {
44 status = "okay"; 55 status = "okay";
45 pinctrl-names = "default"; 56 pinctrl-names = "default";
46 pinctrl-0 = <&nand_cs3_pins>; 57 pinctrl-0 = <&nand_cs3_pins>;
47 }; 58 };
59 vbat: fixedregulator@0 {
60 compatible = "regulator-fixed";
61 regulator-name = "vbat";
62 regulator-min-microvolt = <5000000>;
63 regulator-max-microvolt = <5000000>;
64 regulator-boot-on;
65 };
66};
67
68/include/ "tps6507x.dtsi"
69
70&tps {
71 vdcdc1_2-supply = <&vbat>;
72 vdcdc3-supply = <&vbat>;
73 vldo1_2-supply = <&vbat>;
74
75 regulators {
76 vdcdc1_reg: regulator@0 {
77 regulator-name = "VDCDC1_3.3V";
78 regulator-min-microvolt = <3150000>;
79 regulator-max-microvolt = <3450000>;
80 regulator-always-on;
81 regulator-boot-on;
82 };
83
84 vdcdc2_reg: regulator@1 {
85 regulator-name = "VDCDC2_3.3V";
86 regulator-min-microvolt = <1710000>;
87 regulator-max-microvolt = <3450000>;
88 regulator-always-on;
89 regulator-boot-on;
90 ti,defdcdc_default = <1>;
91 };
92
93 vdcdc3_reg: regulator@2 {
94 regulator-name = "VDCDC3_1.2V";
95 regulator-min-microvolt = <950000>;
96 regulator-max-microvolt = <1350000>;
97 regulator-always-on;
98 regulator-boot-on;
99 ti,defdcdc_default = <1>;
100 };
101
102 ldo1_reg: regulator@3 {
103 regulator-name = "LDO1_1.8V";
104 regulator-min-microvolt = <1710000>;
105 regulator-max-microvolt = <1890000>;
106 regulator-always-on;
107 regulator-boot-on;
108 };
109
110 ldo2_reg: regulator@4 {
111 regulator-name = "LDO2_1.2V";
112 regulator-min-microvolt = <1140000>;
113 regulator-max-microvolt = <1320000>;
114 regulator-always-on;
115 regulator-boot-on;
116 };
117 };
48}; 118};
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 3ec1bda64356..3ade343f13cc 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -62,6 +62,15 @@
62 0x10 0x00002200 0x0000ff00 62 0x10 0x00002200 0x0000ff00
63 >; 63 >;
64 }; 64 };
65 mmc0_pins: pinmux_mmc_pins {
66 pinctrl-single,bits = <
67 /* MMCSD0_DAT[3] MMCSD0_DAT[2]
68 * MMCSD0_DAT[1] MMCSD0_DAT[0]
69 * MMCSD0_CMD MMCSD0_CLK
70 */
71 0x28 0x00222222 0x00ffffff
72 >;
73 };
65 }; 74 };
66 serial0: serial@1c42000 { 75 serial0: serial@1c42000 {
67 compatible = "ns16550a"; 76 compatible = "ns16550a";
@@ -107,6 +116,12 @@
107 reg = <0x21000 0x1000>; 116 reg = <0x21000 0x1000>;
108 status = "disabled"; 117 status = "disabled";
109 }; 118 };
119 mmc0: mmc@1c40000 {
120 compatible = "ti,da830-mmc";
121 reg = <0x40000 0x1000>;
122 interrupts = <16>;
123 status = "disabled";
124 };
110 }; 125 };
111 nand_cs3@62000000 { 126 nand_cs3@62000000 {
112 compatible = "ti,davinci-nand"; 127 compatible = "ti,davinci-nand";
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index aaa63d0a8096..b6bc4ff17f26 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -191,7 +191,7 @@
191 191
192 prcmu: prcmu@80157000 { 192 prcmu: prcmu@80157000 {
193 compatible = "stericsson,db8500-prcmu"; 193 compatible = "stericsson,db8500-prcmu";
194 reg = <0x80157000 0x1000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>; 194 reg = <0x80157000 0x2000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>;
195 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm"; 195 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
196 interrupts = <0 47 0x4>; 196 interrupts = <0 47 0x4>;
197 #address-cells = <1>; 197 #address-cells = <1>;
@@ -674,10 +674,13 @@
674 compatible = "regulator-gpio"; 674 compatible = "regulator-gpio";
675 675
676 regulator-min-microvolt = <1800000>; 676 regulator-min-microvolt = <1800000>;
677 regulator-max-microvolt = <2600000>; 677 regulator-max-microvolt = <2900000>;
678 regulator-name = "mmci-reg"; 678 regulator-name = "mmci-reg";
679 regulator-type = "voltage"; 679 regulator-type = "voltage";
680 680
681 startup-delay-us = <100>;
682 enable-active-high;
683
681 states = <1800000 0x1 684 states = <1800000 0x1
682 2900000 0x0>; 685 2900000 0x0>;
683 686
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index f7509cafc377..6cab46849cdb 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -50,6 +50,11 @@
50 #clock-cells = <1>; 50 #clock-cells = <1>;
51 }; 51 };
52 52
53 thermal: thermal@d001c {
54 compatible = "marvell,dove-thermal";
55 reg = <0xd001c 0x0c>, <0xd005c 0x08>;
56 };
57
53 uart0: serial@12000 { 58 uart0: serial@12000 {
54 compatible = "ns16550a"; 59 compatible = "ns16550a";
55 reg = <0x12000 0x100>; 60 reg = <0x12000 0x100>;
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 1a62bcf18aa3..9ac47d51c407 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -86,6 +86,8 @@
86 compatible = "samsung,s3c2410-wdt"; 86 compatible = "samsung,s3c2410-wdt";
87 reg = <0x10060000 0x100>; 87 reg = <0x10060000 0x100>;
88 interrupts = <0 43 0>; 88 interrupts = <0 43 0>;
89 clocks = <&clock 345>;
90 clock-names = "watchdog";
89 status = "disabled"; 91 status = "disabled";
90 }; 92 };
91 93
@@ -93,6 +95,8 @@
93 compatible = "samsung,s3c6410-rtc"; 95 compatible = "samsung,s3c6410-rtc";
94 reg = <0x10070000 0x100>; 96 reg = <0x10070000 0x100>;
95 interrupts = <0 44 0>, <0 45 0>; 97 interrupts = <0 44 0>, <0 45 0>;
98 clocks = <&clock 346>;
99 clock-names = "rtc";
96 status = "disabled"; 100 status = "disabled";
97 }; 101 };
98 102
@@ -100,6 +104,8 @@
100 compatible = "samsung,s5pv210-keypad"; 104 compatible = "samsung,s5pv210-keypad";
101 reg = <0x100A0000 0x100>; 105 reg = <0x100A0000 0x100>;
102 interrupts = <0 109 0>; 106 interrupts = <0 109 0>;
107 clocks = <&clock 347>;
108 clock-names = "keypad";
103 status = "disabled"; 109 status = "disabled";
104 }; 110 };
105 111
@@ -107,6 +113,8 @@
107 compatible = "samsung,exynos4210-sdhci"; 113 compatible = "samsung,exynos4210-sdhci";
108 reg = <0x12510000 0x100>; 114 reg = <0x12510000 0x100>;
109 interrupts = <0 73 0>; 115 interrupts = <0 73 0>;
116 clocks = <&clock 297>, <&clock 145>;
117 clock-names = "hsmmc", "mmc_busclk.2";
110 status = "disabled"; 118 status = "disabled";
111 }; 119 };
112 120
@@ -114,6 +122,8 @@
114 compatible = "samsung,exynos4210-sdhci"; 122 compatible = "samsung,exynos4210-sdhci";
115 reg = <0x12520000 0x100>; 123 reg = <0x12520000 0x100>;
116 interrupts = <0 74 0>; 124 interrupts = <0 74 0>;
125 clocks = <&clock 298>, <&clock 146>;
126 clock-names = "hsmmc", "mmc_busclk.2";
117 status = "disabled"; 127 status = "disabled";
118 }; 128 };
119 129
@@ -121,6 +131,8 @@
121 compatible = "samsung,exynos4210-sdhci"; 131 compatible = "samsung,exynos4210-sdhci";
122 reg = <0x12530000 0x100>; 132 reg = <0x12530000 0x100>;
123 interrupts = <0 75 0>; 133 interrupts = <0 75 0>;
134 clocks = <&clock 299>, <&clock 147>;
135 clock-names = "hsmmc", "mmc_busclk.2";
124 status = "disabled"; 136 status = "disabled";
125 }; 137 };
126 138
@@ -128,6 +140,16 @@
128 compatible = "samsung,exynos4210-sdhci"; 140 compatible = "samsung,exynos4210-sdhci";
129 reg = <0x12540000 0x100>; 141 reg = <0x12540000 0x100>;
130 interrupts = <0 76 0>; 142 interrupts = <0 76 0>;
143 clocks = <&clock 300>, <&clock 148>;
144 clock-names = "hsmmc", "mmc_busclk.2";
145 status = "disabled";
146 };
147
148 mfc: codec@13400000 {
149 compatible = "samsung,mfc-v5";
150 reg = <0x13400000 0x10000>;
151 interrupts = <0 94 0>;
152 samsung,power-domain = <&pd_mfc>;
131 status = "disabled"; 153 status = "disabled";
132 }; 154 };
133 155
@@ -135,6 +157,8 @@
135 compatible = "samsung,exynos4210-uart"; 157 compatible = "samsung,exynos4210-uart";
136 reg = <0x13800000 0x100>; 158 reg = <0x13800000 0x100>;
137 interrupts = <0 52 0>; 159 interrupts = <0 52 0>;
160 clocks = <&clock 312>, <&clock 151>;
161 clock-names = "uart", "clk_uart_baud0";
138 status = "disabled"; 162 status = "disabled";
139 }; 163 };
140 164
@@ -142,6 +166,8 @@
142 compatible = "samsung,exynos4210-uart"; 166 compatible = "samsung,exynos4210-uart";
143 reg = <0x13810000 0x100>; 167 reg = <0x13810000 0x100>;
144 interrupts = <0 53 0>; 168 interrupts = <0 53 0>;
169 clocks = <&clock 313>, <&clock 152>;
170 clock-names = "uart", "clk_uart_baud0";
145 status = "disabled"; 171 status = "disabled";
146 }; 172 };
147 173
@@ -149,6 +175,8 @@
149 compatible = "samsung,exynos4210-uart"; 175 compatible = "samsung,exynos4210-uart";
150 reg = <0x13820000 0x100>; 176 reg = <0x13820000 0x100>;
151 interrupts = <0 54 0>; 177 interrupts = <0 54 0>;
178 clocks = <&clock 314>, <&clock 153>;
179 clock-names = "uart", "clk_uart_baud0";
152 status = "disabled"; 180 status = "disabled";
153 }; 181 };
154 182
@@ -156,6 +184,8 @@
156 compatible = "samsung,exynos4210-uart"; 184 compatible = "samsung,exynos4210-uart";
157 reg = <0x13830000 0x100>; 185 reg = <0x13830000 0x100>;
158 interrupts = <0 55 0>; 186 interrupts = <0 55 0>;
187 clocks = <&clock 315>, <&clock 154>;
188 clock-names = "uart", "clk_uart_baud0";
159 status = "disabled"; 189 status = "disabled";
160 }; 190 };
161 191
@@ -165,6 +195,8 @@
165 compatible = "samsung,s3c2440-i2c"; 195 compatible = "samsung,s3c2440-i2c";
166 reg = <0x13860000 0x100>; 196 reg = <0x13860000 0x100>;
167 interrupts = <0 58 0>; 197 interrupts = <0 58 0>;
198 clocks = <&clock 317>;
199 clock-names = "i2c";
168 status = "disabled"; 200 status = "disabled";
169 }; 201 };
170 202
@@ -174,6 +206,8 @@
174 compatible = "samsung,s3c2440-i2c"; 206 compatible = "samsung,s3c2440-i2c";
175 reg = <0x13870000 0x100>; 207 reg = <0x13870000 0x100>;
176 interrupts = <0 59 0>; 208 interrupts = <0 59 0>;
209 clocks = <&clock 318>;
210 clock-names = "i2c";
177 status = "disabled"; 211 status = "disabled";
178 }; 212 };
179 213
@@ -183,6 +217,8 @@
183 compatible = "samsung,s3c2440-i2c"; 217 compatible = "samsung,s3c2440-i2c";
184 reg = <0x13880000 0x100>; 218 reg = <0x13880000 0x100>;
185 interrupts = <0 60 0>; 219 interrupts = <0 60 0>;
220 clocks = <&clock 319>;
221 clock-names = "i2c";
186 status = "disabled"; 222 status = "disabled";
187 }; 223 };
188 224
@@ -192,6 +228,8 @@
192 compatible = "samsung,s3c2440-i2c"; 228 compatible = "samsung,s3c2440-i2c";
193 reg = <0x13890000 0x100>; 229 reg = <0x13890000 0x100>;
194 interrupts = <0 61 0>; 230 interrupts = <0 61 0>;
231 clocks = <&clock 320>;
232 clock-names = "i2c";
195 status = "disabled"; 233 status = "disabled";
196 }; 234 };
197 235
@@ -201,6 +239,8 @@
201 compatible = "samsung,s3c2440-i2c"; 239 compatible = "samsung,s3c2440-i2c";
202 reg = <0x138A0000 0x100>; 240 reg = <0x138A0000 0x100>;
203 interrupts = <0 62 0>; 241 interrupts = <0 62 0>;
242 clocks = <&clock 321>;
243 clock-names = "i2c";
204 status = "disabled"; 244 status = "disabled";
205 }; 245 };
206 246
@@ -210,6 +250,8 @@
210 compatible = "samsung,s3c2440-i2c"; 250 compatible = "samsung,s3c2440-i2c";
211 reg = <0x138B0000 0x100>; 251 reg = <0x138B0000 0x100>;
212 interrupts = <0 63 0>; 252 interrupts = <0 63 0>;
253 clocks = <&clock 322>;
254 clock-names = "i2c";
213 status = "disabled"; 255 status = "disabled";
214 }; 256 };
215 257
@@ -219,6 +261,8 @@
219 compatible = "samsung,s3c2440-i2c"; 261 compatible = "samsung,s3c2440-i2c";
220 reg = <0x138C0000 0x100>; 262 reg = <0x138C0000 0x100>;
221 interrupts = <0 64 0>; 263 interrupts = <0 64 0>;
264 clocks = <&clock 323>;
265 clock-names = "i2c";
222 status = "disabled"; 266 status = "disabled";
223 }; 267 };
224 268
@@ -228,6 +272,8 @@
228 compatible = "samsung,s3c2440-i2c"; 272 compatible = "samsung,s3c2440-i2c";
229 reg = <0x138D0000 0x100>; 273 reg = <0x138D0000 0x100>;
230 interrupts = <0 65 0>; 274 interrupts = <0 65 0>;
275 clocks = <&clock 324>;
276 clock-names = "i2c";
231 status = "disabled"; 277 status = "disabled";
232 }; 278 };
233 279
@@ -239,6 +285,8 @@
239 rx-dma-channel = <&pdma0 6>; /* preliminary */ 285 rx-dma-channel = <&pdma0 6>; /* preliminary */
240 #address-cells = <1>; 286 #address-cells = <1>;
241 #size-cells = <0>; 287 #size-cells = <0>;
288 clocks = <&clock 327>, <&clock 159>;
289 clock-names = "spi", "spi_busclk0";
242 status = "disabled"; 290 status = "disabled";
243 }; 291 };
244 292
@@ -250,6 +298,8 @@
250 rx-dma-channel = <&pdma1 6>; /* preliminary */ 298 rx-dma-channel = <&pdma1 6>; /* preliminary */
251 #address-cells = <1>; 299 #address-cells = <1>;
252 #size-cells = <0>; 300 #size-cells = <0>;
301 clocks = <&clock 328>, <&clock 160>;
302 clock-names = "spi", "spi_busclk0";
253 status = "disabled"; 303 status = "disabled";
254 }; 304 };
255 305
@@ -261,6 +311,8 @@
261 rx-dma-channel = <&pdma0 8>; /* preliminary */ 311 rx-dma-channel = <&pdma0 8>; /* preliminary */
262 #address-cells = <1>; 312 #address-cells = <1>;
263 #size-cells = <0>; 313 #size-cells = <0>;
314 clocks = <&clock 329>, <&clock 161>;
315 clock-names = "spi", "spi_busclk0";
264 status = "disabled"; 316 status = "disabled";
265 }; 317 };
266 318
@@ -275,6 +327,8 @@
275 compatible = "arm,pl330", "arm,primecell"; 327 compatible = "arm,pl330", "arm,primecell";
276 reg = <0x12680000 0x1000>; 328 reg = <0x12680000 0x1000>;
277 interrupts = <0 35 0>; 329 interrupts = <0 35 0>;
330 clocks = <&clock 292>;
331 clock-names = "apb_pclk";
278 #dma-cells = <1>; 332 #dma-cells = <1>;
279 #dma-channels = <8>; 333 #dma-channels = <8>;
280 #dma-requests = <32>; 334 #dma-requests = <32>;
@@ -284,6 +338,8 @@
284 compatible = "arm,pl330", "arm,primecell"; 338 compatible = "arm,pl330", "arm,primecell";
285 reg = <0x12690000 0x1000>; 339 reg = <0x12690000 0x1000>;
286 interrupts = <0 36 0>; 340 interrupts = <0 36 0>;
341 clocks = <&clock 293>;
342 clock-names = "apb_pclk";
287 #dma-cells = <1>; 343 #dma-cells = <1>;
288 #dma-channels = <8>; 344 #dma-channels = <8>;
289 #dma-requests = <32>; 345 #dma-requests = <32>;
@@ -293,6 +349,8 @@
293 compatible = "arm,pl330", "arm,primecell"; 349 compatible = "arm,pl330", "arm,primecell";
294 reg = <0x12850000 0x1000>; 350 reg = <0x12850000 0x1000>;
295 interrupts = <0 34 0>; 351 interrupts = <0 34 0>;
352 clocks = <&clock 279>;
353 clock-names = "apb_pclk";
296 #dma-cells = <1>; 354 #dma-cells = <1>;
297 #dma-channels = <8>; 355 #dma-channels = <8>;
298 #dma-requests = <1>; 356 #dma-requests = <1>;
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts
index f2710018e84e..1b30bc8e2654 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -57,6 +57,12 @@
57 status = "okay"; 57 status = "okay";
58 }; 58 };
59 59
60 codec@13400000 {
61 samsung,mfc-r = <0x43000000 0x800000>;
62 samsung,mfc-l = <0x51000000 0x800000>;
63 status = "okay";
64 };
65
60 serial@13800000 { 66 serial@13800000 {
61 status = "okay"; 67 status = "okay";
62 }; 68 };
@@ -121,4 +127,16 @@
121 linux,default-trigger = "heartbeat"; 127 linux,default-trigger = "heartbeat";
122 }; 128 };
123 }; 129 };
130
131 fixed-rate-clocks {
132 xxti {
133 compatible = "samsung,clock-xxti";
134 clock-frequency = <0>;
135 };
136
137 xusbxti {
138 compatible = "samsung,clock-xusbxti";
139 clock-frequency = <24000000>;
140 };
141 };
124}; 142};
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index f63490707f3a..f52c86e2d424 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -43,6 +43,12 @@
43 status = "okay"; 43 status = "okay";
44 }; 44 };
45 45
46 codec@13400000 {
47 samsung,mfc-r = <0x43000000 0x800000>;
48 samsung,mfc-l = <0x51000000 0x800000>;
49 status = "okay";
50 };
51
46 serial@13800000 { 52 serial@13800000 {
47 status = "okay"; 53 status = "okay";
48 }; 54 };
@@ -189,4 +195,16 @@
189 }; 195 };
190 }; 196 };
191 }; 197 };
198
199 fixed-rate-clocks {
200 xxti {
201 compatible = "samsung,clock-xxti";
202 clock-frequency = <12000000>;
203 };
204
205 xusbxti {
206 compatible = "samsung,clock-xusbxti";
207 clock-frequency = <24000000>;
208 };
209 };
192}; 210};
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts
index c346b64dff55..9a14484c7bb1 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -289,4 +289,16 @@
289 }; 289 };
290 }; 290 };
291 }; 291 };
292
293 fixed-rate-clocks {
294 xxti {
295 compatible = "samsung,clock-xxti";
296 clock-frequency = <0>;
297 };
298
299 xusbxti {
300 compatible = "samsung,clock-xusbxti";
301 clock-frequency = <24000000>;
302 };
303 };
292}; 304};
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 2feffc70814c..15143bdbafb8 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -47,6 +47,42 @@
47 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; 47 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>;
48 }; 48 };
49 49
50 mct@10050000 {
51 compatible = "samsung,exynos4210-mct";
52 reg = <0x10050000 0x800>;
53 interrupt-controller;
54 #interrups-cells = <2>;
55 interrupt-parent = <&mct_map>;
56 interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
57 <4 0>, <5 0>;
58 clocks = <&clock 3>, <&clock 344>;
59 clock-names = "fin_pll", "mct";
60
61 mct_map: mct-map {
62 #interrupt-cells = <2>;
63 #address-cells = <0>;
64 #size-cells = <0>;
65 interrupt-map = <0x0 0 &gic 0 57 0>,
66 <0x1 0 &gic 0 69 0>,
67 <0x2 0 &combiner 12 6>,
68 <0x3 0 &combiner 12 7>,
69 <0x4 0 &gic 0 42 0>,
70 <0x5 0 &gic 0 48 0>;
71 };
72 };
73
74 clock: clock-controller@0x10030000 {
75 compatible = "samsung,exynos4210-clock";
76 reg = <0x10030000 0x20000>;
77 #clock-cells = <1>;
78 };
79
80 pmu {
81 compatible = "arm,cortex-a9-pmu";
82 interrupt-parent = <&combiner>;
83 interrupts = <2 2>, <3 2>;
84 };
85
50 pinctrl_0: pinctrl@11400000 { 86 pinctrl_0: pinctrl@11400000 {
51 compatible = "samsung,exynos4210-pinctrl"; 87 compatible = "samsung,exynos4210-pinctrl";
52 reg = <0x11400000 0x1000>; 88 reg = <0x11400000 0x1000>;
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi
index c6ae2005961f..36d4299789ef 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -25,4 +25,26 @@
25 gic:interrupt-controller@10490000 { 25 gic:interrupt-controller@10490000 {
26 cpu-offset = <0x8000>; 26 cpu-offset = <0x8000>;
27 }; 27 };
28
29 mct@10050000 {
30 compatible = "samsung,exynos4412-mct";
31 reg = <0x10050000 0x800>;
32 interrupt-controller;
33 #interrups-cells = <2>;
34 interrupt-parent = <&mct_map>;
35 interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
36 <4 0>, <5 0>;
37
38 mct_map: mct-map {
39 #interrupt-cells = <2>;
40 #address-cells = <0>;
41 #size-cells = <0>;
42 interrupt-map = <0x0 0 &gic 0 57 0>,
43 <0x1 0 &combiner 12 5>,
44 <0x2 0 &combiner 12 6>,
45 <0x3 0 &combiner 12 7>,
46 <0x4 0 &gic 1 12 0>,
47 <0x5 0 &gic 1 12 0>;
48 };
49 };
28}; 50};
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
new file mode 100644
index 000000000000..53bc8bf77984
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -0,0 +1,111 @@
1/*
2 * Hardkernel's Exynos4412 based ODROID-X board device tree source
3 *
4 * Copyright (c) 2012 Dongjin Kim <tobetter@gmail.com>
5 *
6 * Device tree source file for Hardkernel's ODROID-X board which is based on
7 * Samsung's Exynos4412 SoC.
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/dts-v1/;
15/include/ "exynos4412.dtsi"
16
17/ {
18 model = "Hardkernel ODROID-X board based on Exynos4412";
19 compatible = "hardkernel,odroid-x", "samsung,exynos4412";
20
21 memory {
22 reg = <0x40000000 0x40000000>;
23 };
24
25 leds {
26 compatible = "gpio-leds";
27 led1 {
28 label = "led1:heart";
29 gpios = <&gpc1 0 1>;
30 default-state = "on";
31 linux,default-trigger = "heartbeat";
32 };
33 led2 {
34 label = "led2:mmc0";
35 gpios = <&gpc1 2 1>;
36 default-state = "on";
37 linux,default-trigger = "mmc0";
38 };
39 };
40
41 mshc@12550000 {
42 #address-cells = <1>;
43 #size-cells = <0>;
44 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
45 pinctrl-names = "default";
46 status = "okay";
47
48 num-slots = <1>;
49 supports-highspeed;
50 broken-cd;
51 fifo-depth = <0x80>;
52 card-detect-delay = <200>;
53 samsung,dw-mshc-ciu-div = <3>;
54 samsung,dw-mshc-sdr-timing = <2 3>;
55 samsung,dw-mshc-ddr-timing = <1 2>;
56
57 slot@0 {
58 reg = <0>;
59 bus-width = <8>;
60 };
61 };
62
63 regulator_p3v3 {
64 compatible = "regulator-fixed";
65 regulator-name = "p3v3_en";
66 regulator-min-microvolt = <3300000>;
67 regulator-max-microvolt = <3300000>;
68 gpio = <&gpa1 1 1>;
69 enable-active-high;
70 regulator-boot-on;
71 };
72
73 rtc@10070000 {
74 status = "okay";
75 };
76
77 sdhci@12530000 {
78 bus-width = <4>;
79 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
80 pinctrl-names = "default";
81 status = "okay";
82 };
83
84 serial@13800000 {
85 status = "okay";
86 };
87
88 serial@13810000 {
89 status = "okay";
90 };
91
92 serial@13820000 {
93 status = "okay";
94 };
95
96 serial@13830000 {
97 status = "okay";
98 };
99
100 fixed-rate-clocks {
101 xxti {
102 compatible = "samsung,clock-xxti";
103 clock-frequency = <0>;
104 };
105
106 xusbxti {
107 compatible = "samsung,clock-xusbxti";
108 clock-frequency = <24000000>;
109 };
110 };
111};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
new file mode 100644
index 000000000000..1fecf7666dc0
--- /dev/null
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -0,0 +1,432 @@
1/*
2 * Insignal's Exynos4412 based Origen board device tree source
3 *
4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Device tree source file for Insignal's Origen board which is based on
8 * Samsung's Exynos4412 SoC.
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/dts-v1/;
16/include/ "exynos4412.dtsi"
17
18/ {
19 model = "Insignal Origen evaluation board based on Exynos4412";
20 compatible = "insignal,origen4412", "samsung,exynos4412";
21
22 memory {
23 reg = <0x40000000 0x40000000>;
24 };
25
26 chosen {
27 bootargs ="console=ttySAC2,115200";
28 };
29
30 mmc_reg: voltage-regulator {
31 compatible = "regulator-fixed";
32 regulator-name = "VMEM_VDD_2.8V";
33 regulator-min-microvolt = <2800000>;
34 regulator-max-microvolt = <2800000>;
35 gpio = <&gpx1 1 0>;
36 enable-active-high;
37 };
38
39 sdhci@12530000 {
40 bus-width = <4>;
41 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>;
42 pinctrl-names = "default";
43 vmmc-supply = <&mmc_reg>;
44 status = "okay";
45 };
46
47 mshc@12550000 {
48 #address-cells = <1>;
49 #size-cells = <0>;
50 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
51 pinctrl-names = "default";
52 status = "okay";
53
54 num-slots = <1>;
55 supports-highspeed;
56 broken-cd;
57 fifo-depth = <0x80>;
58 card-detect-delay = <200>;
59 samsung,dw-mshc-ciu-div = <3>;
60 samsung,dw-mshc-sdr-timing = <2 3>;
61 samsung,dw-mshc-ddr-timing = <1 2>;
62
63 slot@0 {
64 reg = <0>;
65 bus-width = <8>;
66 };
67 };
68
69 codec@13400000 {
70 samsung,mfc-r = <0x43000000 0x800000>;
71 samsung,mfc-l = <0x51000000 0x800000>;
72 status = "okay";
73 };
74
75 serial@13800000 {
76 status = "okay";
77 };
78
79 serial@13810000 {
80 status = "okay";
81 };
82
83 serial@13820000 {
84 status = "okay";
85 };
86
87 serial@13830000 {
88 status = "okay";
89 };
90
91 i2c@13860000 {
92 #address-cells = <1>;
93 #size-cells = <0>;
94 samsung,i2c-sda-delay = <100>;
95 samsung,i2c-max-bus-freq = <20000>;
96 pinctrl-0 = <&i2c0_bus>;
97 pinctrl-names = "default";
98 status = "okay";
99
100 s5m8767_pmic@66 {
101 compatible = "samsung,s5m8767-pmic";
102 reg = <0x66>;
103
104 s5m8767,pmic-buck-default-dvs-idx = <3>;
105
106 s5m8767,pmic-buck-dvs-gpios = <&gpx2 3 0>,
107 <&gpx2 4 0>,
108 <&gpx2 5 0>;
109
110 s5m8767,pmic-buck-ds-gpios = <&gpm3 5 0>,
111 <&gpm3 6 0>,
112 <&gpm3 7 0>;
113
114 s5m8767,pmic-buck2-dvs-voltage = <1250000>, <1200000>,
115 <1200000>, <1200000>,
116 <1200000>, <1200000>,
117 <1200000>, <1200000>;
118
119 s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,
120 <1100000>, <1100000>,
121 <1100000>, <1100000>,
122 <1100000>, <1100000>;
123
124 s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,
125 <1200000>, <1200000>,
126 <1200000>, <1200000>,
127 <1200000>, <1200000>;
128
129 regulators {
130 ldo1_reg: LDO1 {
131 regulator-name = "VDD_ALIVE";
132 regulator-min-microvolt = <1100000>;
133 regulator-max-microvolt = <1100000>;
134 regulator-always-on;
135 regulator-boot-on;
136 op_mode = <1>; /* Normal Mode */
137 };
138
139 ldo2_reg: LDO2 {
140 regulator-name = "VDDQ_M12";
141 regulator-min-microvolt = <1200000>;
142 regulator-max-microvolt = <1200000>;
143 regulator-always-on;
144 op_mode = <1>; /* Normal Mode */
145 };
146
147 ldo3_reg: LDO3 {
148 regulator-name = "VDDIOAP_18";
149 regulator-min-microvolt = <1800000>;
150 regulator-max-microvolt = <1800000>;
151 regulator-always-on;
152 op_mode = <1>; /* Normal Mode */
153 };
154
155 ldo4_reg: LDO4 {
156 regulator-name = "VDDQ_PRE";
157 regulator-min-microvolt = <1800000>;
158 regulator-max-microvolt = <1800000>;
159 regulator-always-on;
160 op_mode = <1>; /* Normal Mode */
161 };
162
163 ldo5_reg: LDO5 {
164 regulator-name = "VDD18_2M";
165 regulator-min-microvolt = <1800000>;
166 regulator-max-microvolt = <1800000>;
167 regulator-always-on;
168 op_mode = <1>; /* Normal Mode */
169 };
170
171 ldo6_reg: LDO6 {
172 regulator-name = "VDD10_MPLL";
173 regulator-min-microvolt = <1000000>;
174 regulator-max-microvolt = <1000000>;
175 regulator-always-on;
176 op_mode = <1>; /* Normal Mode */
177 };
178
179 ldo7_reg: LDO7 {
180 regulator-name = "VDD10_XPLL";
181 regulator-min-microvolt = <1000000>;
182 regulator-max-microvolt = <1000000>;
183 regulator-always-on;
184 op_mode = <1>; /* Normal Mode */
185 };
186
187 ldo8_reg: LDO8 {
188 regulator-name = "VDD10_MIPI";
189 regulator-min-microvolt = <1000000>;
190 regulator-max-microvolt = <1000000>;
191 regulator-always-on;
192 op_mode = <1>; /* Normal Mode */
193 };
194
195 ldo9_reg: LDO9 {
196 regulator-name = "VDD33_LCD";
197 regulator-min-microvolt = <3300000>;
198 regulator-max-microvolt = <3300000>;
199 regulator-always-on;
200 op_mode = <1>; /* Normal Mode */
201 };
202
203 ldo10_reg: LDO10 {
204 regulator-name = "VDD18_MIPI";
205 regulator-min-microvolt = <1800000>;
206 regulator-max-microvolt = <1800000>;
207 regulator-always-on;
208 op_mode = <1>; /* Normal Mode */
209 };
210
211 ldo11_reg: LDO11 {
212 regulator-name = "VDD18_ABB1";
213 regulator-min-microvolt = <1800000>;
214 regulator-max-microvolt = <1800000>;
215 regulator-always-on;
216 op_mode = <1>; /* Normal Mode */
217 };
218
219 ldo12_reg: LDO12 {
220 regulator-name = "VDD33_UOTG";
221 regulator-min-microvolt = <3300000>;
222 regulator-max-microvolt = <3300000>;
223 regulator-always-on;
224 op_mode = <1>; /* Normal Mode */
225 };
226
227 ldo13_reg: LDO13 {
228 regulator-name = "VDDIOPERI_18";
229 regulator-min-microvolt = <1800000>;
230 regulator-max-microvolt = <1800000>;
231 regulator-always-on;
232 op_mode = <1>; /* Normal Mode */
233 };
234
235 ldo14_reg: LDO14 {
236 regulator-name = "VDD18_ABB02";
237 regulator-min-microvolt = <1800000>;
238 regulator-max-microvolt = <1800000>;
239 regulator-always-on;
240 op_mode = <1>; /* Normal Mode */
241 };
242
243 ldo15_reg: LDO15 {
244 regulator-name = "VDD10_USH";
245 regulator-min-microvolt = <1000000>;
246 regulator-max-microvolt = <1000000>;
247 regulator-always-on;
248 op_mode = <1>; /* Normal Mode */
249 };
250
251 ldo16_reg: LDO16 {
252 regulator-name = "VDD18_HSIC";
253 regulator-min-microvolt = <1800000>;
254 regulator-max-microvolt = <1800000>;
255 regulator-always-on;
256 op_mode = <1>; /* Normal Mode */
257 };
258
259 ldo17_reg: LDO17 {
260 regulator-name = "VDDIOAP_MMC012_28";
261 regulator-min-microvolt = <2800000>;
262 regulator-max-microvolt = <2800000>;
263 regulator-always-on;
264 op_mode = <1>; /* Normal Mode */
265 };
266
267 ldo18_reg: LDO18 {
268 regulator-name = "VDDIOPERI_28";
269 regulator-min-microvolt = <2800000>;
270 regulator-max-microvolt = <2800000>;
271 regulator-always-on;
272 op_mode = <1>; /* Normal Mode */
273 };
274
275 ldo19_reg: LDO19 {
276 regulator-name = "DVDD25";
277 regulator-min-microvolt = <2500000>;
278 regulator-max-microvolt = <2500000>;
279 regulator-always-on;
280 op_mode = <1>; /* Normal Mode */
281 };
282
283 ldo20_reg: LDO20 {
284 regulator-name = "VDD28_CAM";
285 regulator-min-microvolt = <2800000>;
286 regulator-max-microvolt = <2800000>;
287 regulator-always-on;
288 op_mode = <1>; /* Normal Mode */
289 };
290
291 ldo21_reg: LDO21 {
292 regulator-name = "VDD28_AF";
293 regulator-min-microvolt = <2800000>;
294 regulator-max-microvolt = <2800000>;
295 regulator-always-on;
296 op_mode = <1>; /* Normal Mode */
297 };
298
299 ldo22_reg: LDO22 {
300 regulator-name = "VDDA28_2M";
301 regulator-min-microvolt = <2800000>;
302 regulator-max-microvolt = <2800000>;
303 regulator-always-on;
304 op_mode = <1>; /* Normal Mode */
305 };
306
307 ldo23_reg: LDO23 {
308 regulator-name = "VDD28_TF";
309 regulator-min-microvolt = <2800000>;
310 regulator-max-microvolt = <2800000>;
311 regulator-always-on;
312 op_mode = <1>; /* Normal Mode */
313 };
314
315 ldo24_reg: LDO24 {
316 regulator-name = "VDD33_A31";
317 regulator-min-microvolt = <3300000>;
318 regulator-max-microvolt = <3300000>;
319 regulator-always-on;
320 op_mode = <1>; /* Normal Mode */
321 };
322
323 ldo25_reg: LDO25 {
324 regulator-name = "VDD18_CAM";
325 regulator-min-microvolt = <1800000>;
326 regulator-max-microvolt = <1800000>;
327 regulator-always-on;
328 op_mode = <1>; /* Normal Mode */
329 };
330
331 ldo26_reg: LDO26 {
332 regulator-name = "VDD18_A31";
333 regulator-min-microvolt = <1800000>;
334 regulator-max-microvolt = <1800000>;
335 regulator-always-on;
336 op_mode = <1>; /* Normal Mode */
337 };
338
339 ldo27_reg: LDO27 {
340 regulator-name = "GPS_1V8";
341 regulator-min-microvolt = <1800000>;
342 regulator-max-microvolt = <1800000>;
343 regulator-always-on;
344 op_mode = <1>; /* Normal Mode */
345 };
346
347 ldo28_reg: LDO28 {
348 regulator-name = "DVDD12";
349 regulator-min-microvolt = <1200000>;
350 regulator-max-microvolt = <1200000>;
351 regulator-always-on;
352 op_mode = <1>; /* Normal Mode */
353 };
354
355 buck1_reg: BUCK1 {
356 regulator-name = "vdd_mif";
357 regulator-min-microvolt = <950000>;
358 regulator-max-microvolt = <1100000>;
359 regulator-always-on;
360 regulator-boot-on;
361 op_mode = <1>; /* Normal Mode */
362 };
363
364 buck2_reg: BUCK2 {
365 regulator-name = "vdd_arm";
366 regulator-min-microvolt = <925000>;
367 regulator-max-microvolt = <1300000>;
368 regulator-always-on;
369 regulator-boot-on;
370 op_mode = <1>; /* Normal Mode */
371 };
372
373 buck3_reg: BUCK3 {
374 regulator-name = "vdd_int";
375 regulator-min-microvolt = <900000>;
376 regulator-max-microvolt = <1200000>;
377 regulator-always-on;
378 regulator-boot-on;
379 op_mode = <1>; /* Normal Mode */
380 };
381
382 buck4_reg: BUCK4 {
383 regulator-name = "vdd_g3d";
384 regulator-min-microvolt = <750000>;
385 regulator-max-microvolt = <1500000>;
386 regulator-always-on;
387 regulator-boot-on;
388 op_mode = <1>; /* Normal Mode */
389 };
390
391 buck5_reg: BUCK5 {
392 regulator-name = "vdd_m12";
393 regulator-min-microvolt = <750000>;
394 regulator-max-microvolt = <1500000>;
395 regulator-always-on;
396 regulator-boot-on;
397 op_mode = <1>; /* Normal Mode */
398 };
399
400 buck6_reg: BUCK6 {
401 regulator-name = "vdd12_5m";
402 regulator-min-microvolt = <750000>;
403 regulator-max-microvolt = <1500000>;
404 regulator-always-on;
405 regulator-boot-on;
406 op_mode = <1>; /* Normal Mode */
407 };
408
409 buck9_reg: BUCK9 {
410 regulator-name = "vddf28_emmc";
411 regulator-min-microvolt = <750000>;
412 regulator-max-microvolt = <3000000>;
413 regulator-always-on;
414 regulator-boot-on;
415 op_mode = <1>; /* Normal Mode */
416 };
417 };
418 };
419 };
420
421 fixed-rate-clocks {
422 xxti {
423 compatible = "samsung,clock-xxti";
424 clock-frequency = <0>;
425 };
426
427 xusbxti {
428 compatible = "samsung,clock-xusbxti";
429 clock-frequency = <24000000>;
430 };
431 };
432};
diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts b/arch/arm/boot/dts/exynos4412-smdk4412.dts
index f05bf575cc45..874beeaef99d 100644
--- a/arch/arm/boot/dts/exynos4412-smdk4412.dts
+++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts
@@ -27,6 +27,19 @@
27 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; 27 bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc";
28 }; 28 };
29 29
30 sdhci@12530000 {
31 bus-width = <4>;
32 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>;
33 pinctrl-names = "default";
34 status = "okay";
35 };
36
37 codec@13400000 {
38 samsung,mfc-r = <0x43000000 0x800000>;
39 samsung,mfc-l = <0x51000000 0x800000>;
40 status = "okay";
41 };
42
30 serial@13800000 { 43 serial@13800000 {
31 status = "okay"; 44 status = "okay";
32 }; 45 };
@@ -42,4 +55,16 @@
42 serial@13830000 { 55 serial@13830000 {
43 status = "okay"; 56 status = "okay";
44 }; 57 };
58
59 fixed-rate-clocks {
60 xxti {
61 compatible = "samsung,clock-xxti";
62 clock-frequency = <0>;
63 };
64
65 xusbxti {
66 compatible = "samsung,clock-xusbxti";
67 clock-frequency = <24000000>;
68 };
69 };
45}; 70};
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index d7dfe312772a..d75c047e80a9 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -25,4 +25,30 @@
25 gic:interrupt-controller@10490000 { 25 gic:interrupt-controller@10490000 {
26 cpu-offset = <0x4000>; 26 cpu-offset = <0x4000>;
27 }; 27 };
28
29 mct@10050000 {
30 compatible = "samsung,exynos4412-mct";
31 reg = <0x10050000 0x800>;
32 interrupt-controller;
33 #interrups-cells = <2>;
34 interrupt-parent = <&mct_map>;
35 interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
36 <4 0>, <5 0>, <6 0>, <7 0>;
37 clocks = <&clock 3>, <&clock 344>;
38 clock-names = "fin_pll", "mct";
39
40 mct_map: mct-map {
41 #interrupt-cells = <2>;
42 #address-cells = <0>;
43 #size-cells = <0>;
44 interrupt-map = <0x0 0 &gic 0 57 0>,
45 <0x1 0 &combiner 12 5>,
46 <0x2 0 &combiner 12 6>,
47 <0x3 0 &combiner 12 7>,
48 <0x4 0 &gic 1 12 0>,
49 <0x5 0 &gic 1 12 0>,
50 <0x6 0 &gic 1 12 0>,
51 <0x7 0 &gic 1 12 0>;
52 };
53 };
28}; 54};
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index 9a8780694909..7496b8d633ea 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -36,6 +36,12 @@
36 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>; 36 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>;
37 }; 37 };
38 38
39 clock: clock-controller@0x10030000 {
40 compatible = "samsung,exynos4412-clock";
41 reg = <0x10030000 0x20000>;
42 #clock-cells = <1>;
43 };
44
39 pinctrl_0: pinctrl@11400000 { 45 pinctrl_0: pinctrl@11400000 {
40 compatible = "samsung,exynos4x12-pinctrl"; 46 compatible = "samsung,exynos4x12-pinctrl";
41 reg = <0x11400000 0x1000>; 47 reg = <0x11400000 0x1000>;
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
new file mode 100644
index 000000000000..5de019cb0e58
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -0,0 +1,129 @@
1/*
2 * Samsung's Exynos5250 based Arndale board device tree source
3 *
4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12/dts-v1/;
13/include/ "exynos5250.dtsi"
14
15/ {
16 model = "Insignal Arndale evaluation board based on EXYNOS5250";
17 compatible = "insignal,arndale", "samsung,exynos5250";
18
19 memory {
20 reg = <0x40000000 0x80000000>;
21 };
22
23 chosen {
24 bootargs = "console=ttySAC2,115200";
25 };
26
27 i2c@12C60000 {
28 status = "disabled";
29 };
30
31 i2c@12C70000 {
32 status = "disabled";
33 };
34
35 i2c@12C80000 {
36 status = "disabled";
37 };
38
39 i2c@12C90000 {
40 status = "disabled";
41 };
42
43 i2c@12CA0000 {
44 status = "disabled";
45 };
46
47 i2c@12CB0000 {
48 status = "disabled";
49 };
50
51 i2c@12CC0000 {
52 status = "disabled";
53 };
54
55 i2c@12CD0000 {
56 status = "disabled";
57 };
58
59 i2c@121D0000 {
60 status = "disabled";
61 };
62
63 dwmmc_0: dwmmc0@12200000 {
64 num-slots = <1>;
65 supports-highspeed;
66 broken-cd;
67 fifo-depth = <0x80>;
68 card-detect-delay = <200>;
69 samsung,dw-mshc-ciu-div = <3>;
70 samsung,dw-mshc-sdr-timing = <2 3>;
71 samsung,dw-mshc-ddr-timing = <1 2>;
72
73 slot@0 {
74 reg = <0>;
75 bus-width = <8>;
76 gpios = <&gpc0 0 2 0 3>, <&gpc0 1 2 0 3>,
77 <&gpc0 3 2 3 3>, <&gpc0 4 2 3 3>,
78 <&gpc0 5 2 3 3>, <&gpc0 6 2 3 3>,
79 <&gpc1 0 2 3 3>, <&gpc1 1 2 3 3>,
80 <&gpc1 2 2 3 3>, <&gpc1 3 2 3 3>;
81 };
82 };
83
84 dwmmc_1: dwmmc1@12210000 {
85 status = "disabled";
86 };
87
88 dwmmc_2: dwmmc2@12220000 {
89 num-slots = <1>;
90 supports-highspeed;
91 fifo-depth = <0x80>;
92 card-detect-delay = <200>;
93 samsung,dw-mshc-ciu-div = <3>;
94 samsung,dw-mshc-sdr-timing = <2 3>;
95 samsung,dw-mshc-ddr-timing = <1 2>;
96
97 slot@0 {
98 reg = <0>;
99 bus-width = <4>;
100 samsung,cd-pinmux-gpio = <&gpc3 2 2 3 3>;
101 gpios = <&gpc3 0 2 0 3>, <&gpc3 1 2 0 3>,
102 <&gpc3 3 2 3 3>, <&gpc3 4 2 3 3>,
103 <&gpc3 5 2 3 3>, <&gpc3 6 2 3 3>;
104 };
105 };
106
107 dwmmc_3: dwmmc3@12230000 {
108 status = "disabled";
109 };
110
111 spi_0: spi@12d20000 {
112 status = "disabled";
113 };
114
115 spi_1: spi@12d30000 {
116 status = "disabled";
117 };
118
119 spi_2: spi@12d40000 {
120 status = "disabled";
121 };
122
123 fixed-rate-clocks {
124 xxti {
125 compatible = "samsung,clock-xxti";
126 clock-frequency = <24000000>;
127 };
128 };
129};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 1b8d4106d338..872ae1f93c75 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -231,4 +231,24 @@
231 samsung,i2s-controller = <&i2s0>; 231 samsung,i2s-controller = <&i2s0>;
232 samsung,audio-codec = <&wm8994>; 232 samsung,audio-codec = <&wm8994>;
233 }; 233 };
234
235 usb@12110000 {
236 samsung,vbus-gpio = <&gpx2 6 1 3 3>;
237 };
238
239 dp-controller {
240 samsung,color-space = <0>;
241 samsung,dynamic-range = <0>;
242 samsung,ycbcr-coeff = <0>;
243 samsung,color-depth = <1>;
244 samsung,link-rate = <0x0a>;
245 samsung,lane-count = <4>;
246 };
247
248 fixed-rate-clocks {
249 xxti {
250 compatible = "samsung,clock-xxti";
251 clock-frequency = <24000000>;
252 };
253 };
234}; 254};
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index 17dd951c1cd2..babd9f9b1bf9 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -40,4 +40,15 @@
40 <&gpc4 5 2 3 0>, <&gpc4 6 2 3 0>; 40 <&gpc4 5 2 3 0>, <&gpc4 6 2 3 0>;
41 }; 41 };
42 }; 42 };
43
44 usb@12110000 {
45 samsung,vbus-gpio = <&gpx1 1 1 3 3>;
46 };
47
48 fixed-rate-clocks {
49 xxti {
50 compatible = "samsung,clock-xxti";
51 clock-frequency = <24000000>;
52 };
53 };
43}; 54};
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index b1ac73e21c80..28758e5dd15c 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -46,6 +46,22 @@
46 i2c8 = &i2c_8; 46 i2c8 = &i2c_8;
47 }; 47 };
48 48
49 pd_gsc: gsc-power-domain@0x10044000 {
50 compatible = "samsung,exynos4210-pd";
51 reg = <0x10044000 0x20>;
52 };
53
54 pd_mfc: mfc-power-domain@0x10044040 {
55 compatible = "samsung,exynos4210-pd";
56 reg = <0x10044040 0x20>;
57 };
58
59 clock: clock-controller@0x10010000 {
60 compatible = "samsung,exynos5250-clock";
61 reg = <0x10010000 0x30000>;
62 #clock-cells = <1>;
63 };
64
49 gic:interrupt-controller@10481000 { 65 gic:interrupt-controller@10481000 {
50 compatible = "arm,cortex-a9-gic"; 66 compatible = "arm,cortex-a9-gic";
51 #interrupt-cells = <3>; 67 #interrupt-cells = <3>;
@@ -69,58 +85,106 @@
69 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; 85 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
70 }; 86 };
71 87
88 mct@101C0000 {
89 compatible = "samsung,exynos4210-mct";
90 reg = <0x101C0000 0x800>;
91 interrupt-controller;
92 #interrups-cells = <2>;
93 interrupt-parent = <&mct_map>;
94 interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
95 <4 0>, <5 0>;
96 clocks = <&clock 1>, <&clock 335>;
97 clock-names = "fin_pll", "mct";
98
99 mct_map: mct-map {
100 #interrupt-cells = <2>;
101 #address-cells = <0>;
102 #size-cells = <0>;
103 interrupt-map = <0x0 0 &combiner 23 3>,
104 <0x1 0 &combiner 23 4>,
105 <0x2 0 &combiner 25 2>,
106 <0x3 0 &combiner 25 3>,
107 <0x4 0 &gic 0 120 0>,
108 <0x5 0 &gic 0 121 0>;
109 };
110 };
111
112 pmu {
113 compatible = "arm,cortex-a15-pmu";
114 interrupt-parent = <&combiner>;
115 interrupts = <1 2>, <22 4>;
116 };
117
72 watchdog { 118 watchdog {
73 compatible = "samsung,s3c2410-wdt"; 119 compatible = "samsung,s3c2410-wdt";
74 reg = <0x101D0000 0x100>; 120 reg = <0x101D0000 0x100>;
75 interrupts = <0 42 0>; 121 interrupts = <0 42 0>;
122 clocks = <&clock 336>;
123 clock-names = "watchdog";
76 }; 124 };
77 125
78 codec@11000000 { 126 codec@11000000 {
79 compatible = "samsung,mfc-v6"; 127 compatible = "samsung,mfc-v6";
80 reg = <0x11000000 0x10000>; 128 reg = <0x11000000 0x10000>;
81 interrupts = <0 96 0>; 129 interrupts = <0 96 0>;
130 samsung,power-domain = <&pd_mfc>;
82 }; 131 };
83 132
84 rtc { 133 rtc {
85 compatible = "samsung,s3c6410-rtc"; 134 compatible = "samsung,s3c6410-rtc";
86 reg = <0x101E0000 0x100>; 135 reg = <0x101E0000 0x100>;
87 interrupts = <0 43 0>, <0 44 0>; 136 interrupts = <0 43 0>, <0 44 0>;
137 clocks = <&clock 337>;
138 clock-names = "rtc";
139 status = "disabled";
88 }; 140 };
89 141
90 tmu@10060000 { 142 tmu@10060000 {
91 compatible = "samsung,exynos5250-tmu"; 143 compatible = "samsung,exynos5250-tmu";
92 reg = <0x10060000 0x100>; 144 reg = <0x10060000 0x100>;
93 interrupts = <0 65 0>; 145 interrupts = <0 65 0>;
146 clocks = <&clock 338>;
147 clock-names = "tmu_apbif";
94 }; 148 };
95 149
96 serial@12C00000 { 150 serial@12C00000 {
97 compatible = "samsung,exynos4210-uart"; 151 compatible = "samsung,exynos4210-uart";
98 reg = <0x12C00000 0x100>; 152 reg = <0x12C00000 0x100>;
99 interrupts = <0 51 0>; 153 interrupts = <0 51 0>;
154 clocks = <&clock 289>, <&clock 146>;
155 clock-names = "uart", "clk_uart_baud0";
100 }; 156 };
101 157
102 serial@12C10000 { 158 serial@12C10000 {
103 compatible = "samsung,exynos4210-uart"; 159 compatible = "samsung,exynos4210-uart";
104 reg = <0x12C10000 0x100>; 160 reg = <0x12C10000 0x100>;
105 interrupts = <0 52 0>; 161 interrupts = <0 52 0>;
162 clocks = <&clock 290>, <&clock 147>;
163 clock-names = "uart", "clk_uart_baud0";
106 }; 164 };
107 165
108 serial@12C20000 { 166 serial@12C20000 {
109 compatible = "samsung,exynos4210-uart"; 167 compatible = "samsung,exynos4210-uart";
110 reg = <0x12C20000 0x100>; 168 reg = <0x12C20000 0x100>;
111 interrupts = <0 53 0>; 169 interrupts = <0 53 0>;
170 clocks = <&clock 291>, <&clock 148>;
171 clock-names = "uart", "clk_uart_baud0";
112 }; 172 };
113 173
114 serial@12C30000 { 174 serial@12C30000 {
115 compatible = "samsung,exynos4210-uart"; 175 compatible = "samsung,exynos4210-uart";
116 reg = <0x12C30000 0x100>; 176 reg = <0x12C30000 0x100>;
117 interrupts = <0 54 0>; 177 interrupts = <0 54 0>;
178 clocks = <&clock 292>, <&clock 149>;
179 clock-names = "uart", "clk_uart_baud0";
118 }; 180 };
119 181
120 sata@122F0000 { 182 sata@122F0000 {
121 compatible = "samsung,exynos5-sata-ahci"; 183 compatible = "samsung,exynos5-sata-ahci";
122 reg = <0x122F0000 0x1ff>; 184 reg = <0x122F0000 0x1ff>;
123 interrupts = <0 115 0>; 185 interrupts = <0 115 0>;
186 clocks = <&clock 277>, <&clock 143>;
187 clock-names = "sata", "sclk_sata";
124 }; 188 };
125 189
126 sata-phy@12170000 { 190 sata-phy@12170000 {
@@ -134,6 +198,8 @@
134 interrupts = <0 56 0>; 198 interrupts = <0 56 0>;
135 #address-cells = <1>; 199 #address-cells = <1>;
136 #size-cells = <0>; 200 #size-cells = <0>;
201 clocks = <&clock 294>;
202 clock-names = "i2c";
137 }; 203 };
138 204
139 i2c_1: i2c@12C70000 { 205 i2c_1: i2c@12C70000 {
@@ -142,6 +208,8 @@
142 interrupts = <0 57 0>; 208 interrupts = <0 57 0>;
143 #address-cells = <1>; 209 #address-cells = <1>;
144 #size-cells = <0>; 210 #size-cells = <0>;
211 clocks = <&clock 295>;
212 clock-names = "i2c";
145 }; 213 };
146 214
147 i2c_2: i2c@12C80000 { 215 i2c_2: i2c@12C80000 {
@@ -150,6 +218,8 @@
150 interrupts = <0 58 0>; 218 interrupts = <0 58 0>;
151 #address-cells = <1>; 219 #address-cells = <1>;
152 #size-cells = <0>; 220 #size-cells = <0>;
221 clocks = <&clock 296>;
222 clock-names = "i2c";
153 }; 223 };
154 224
155 i2c_3: i2c@12C90000 { 225 i2c_3: i2c@12C90000 {
@@ -158,6 +228,8 @@
158 interrupts = <0 59 0>; 228 interrupts = <0 59 0>;
159 #address-cells = <1>; 229 #address-cells = <1>;
160 #size-cells = <0>; 230 #size-cells = <0>;
231 clocks = <&clock 297>;
232 clock-names = "i2c";
161 }; 233 };
162 234
163 i2c_4: i2c@12CA0000 { 235 i2c_4: i2c@12CA0000 {
@@ -166,6 +238,8 @@
166 interrupts = <0 60 0>; 238 interrupts = <0 60 0>;
167 #address-cells = <1>; 239 #address-cells = <1>;
168 #size-cells = <0>; 240 #size-cells = <0>;
241 clocks = <&clock 298>;
242 clock-names = "i2c";
169 }; 243 };
170 244
171 i2c_5: i2c@12CB0000 { 245 i2c_5: i2c@12CB0000 {
@@ -174,6 +248,8 @@
174 interrupts = <0 61 0>; 248 interrupts = <0 61 0>;
175 #address-cells = <1>; 249 #address-cells = <1>;
176 #size-cells = <0>; 250 #size-cells = <0>;
251 clocks = <&clock 299>;
252 clock-names = "i2c";
177 }; 253 };
178 254
179 i2c_6: i2c@12CC0000 { 255 i2c_6: i2c@12CC0000 {
@@ -182,6 +258,8 @@
182 interrupts = <0 62 0>; 258 interrupts = <0 62 0>;
183 #address-cells = <1>; 259 #address-cells = <1>;
184 #size-cells = <0>; 260 #size-cells = <0>;
261 clocks = <&clock 300>;
262 clock-names = "i2c";
185 }; 263 };
186 264
187 i2c_7: i2c@12CD0000 { 265 i2c_7: i2c@12CD0000 {
@@ -190,6 +268,8 @@
190 interrupts = <0 63 0>; 268 interrupts = <0 63 0>;
191 #address-cells = <1>; 269 #address-cells = <1>;
192 #size-cells = <0>; 270 #size-cells = <0>;
271 clocks = <&clock 301>;
272 clock-names = "i2c";
193 }; 273 };
194 274
195 i2c_8: i2c@12CE0000 { 275 i2c_8: i2c@12CE0000 {
@@ -198,6 +278,8 @@
198 interrupts = <0 64 0>; 278 interrupts = <0 64 0>;
199 #address-cells = <1>; 279 #address-cells = <1>;
200 #size-cells = <0>; 280 #size-cells = <0>;
281 clocks = <&clock 302>;
282 clock-names = "i2c";
201 }; 283 };
202 284
203 i2c@121D0000 { 285 i2c@121D0000 {
@@ -205,6 +287,8 @@
205 reg = <0x121D0000 0x100>; 287 reg = <0x121D0000 0x100>;
206 #address-cells = <1>; 288 #address-cells = <1>;
207 #size-cells = <0>; 289 #size-cells = <0>;
290 clocks = <&clock 288>;
291 clock-names = "i2c";
208 }; 292 };
209 293
210 spi_0: spi@12d20000 { 294 spi_0: spi@12d20000 {
@@ -216,6 +300,8 @@
216 dma-names = "tx", "rx"; 300 dma-names = "tx", "rx";
217 #address-cells = <1>; 301 #address-cells = <1>;
218 #size-cells = <0>; 302 #size-cells = <0>;
303 clocks = <&clock 304>, <&clock 154>;
304 clock-names = "spi", "spi_busclk0";
219 }; 305 };
220 306
221 spi_1: spi@12d30000 { 307 spi_1: spi@12d30000 {
@@ -227,6 +313,8 @@
227 dma-names = "tx", "rx"; 313 dma-names = "tx", "rx";
228 #address-cells = <1>; 314 #address-cells = <1>;
229 #size-cells = <0>; 315 #size-cells = <0>;
316 clocks = <&clock 305>, <&clock 155>;
317 clock-names = "spi", "spi_busclk0";
230 }; 318 };
231 319
232 spi_2: spi@12d40000 { 320 spi_2: spi@12d40000 {
@@ -238,6 +326,8 @@
238 dma-names = "tx", "rx"; 326 dma-names = "tx", "rx";
239 #address-cells = <1>; 327 #address-cells = <1>;
240 #size-cells = <0>; 328 #size-cells = <0>;
329 clocks = <&clock 306>, <&clock 156>;
330 clock-names = "spi", "spi_busclk0";
241 }; 331 };
242 332
243 dwmmc_0: dwmmc0@12200000 { 333 dwmmc_0: dwmmc0@12200000 {
@@ -246,6 +336,8 @@
246 interrupts = <0 75 0>; 336 interrupts = <0 75 0>;
247 #address-cells = <1>; 337 #address-cells = <1>;
248 #size-cells = <0>; 338 #size-cells = <0>;
339 clocks = <&clock 280>, <&clock 139>;
340 clock-names = "biu", "ciu";
249 }; 341 };
250 342
251 dwmmc_1: dwmmc1@12210000 { 343 dwmmc_1: dwmmc1@12210000 {
@@ -254,6 +346,8 @@
254 interrupts = <0 76 0>; 346 interrupts = <0 76 0>;
255 #address-cells = <1>; 347 #address-cells = <1>;
256 #size-cells = <0>; 348 #size-cells = <0>;
349 clocks = <&clock 281>, <&clock 140>;
350 clock-names = "biu", "ciu";
257 }; 351 };
258 352
259 dwmmc_2: dwmmc2@12220000 { 353 dwmmc_2: dwmmc2@12220000 {
@@ -262,6 +356,8 @@
262 interrupts = <0 77 0>; 356 interrupts = <0 77 0>;
263 #address-cells = <1>; 357 #address-cells = <1>;
264 #size-cells = <0>; 358 #size-cells = <0>;
359 clocks = <&clock 282>, <&clock 141>;
360 clock-names = "biu", "ciu";
265 }; 361 };
266 362
267 dwmmc_3: dwmmc3@12230000 { 363 dwmmc_3: dwmmc3@12230000 {
@@ -270,6 +366,8 @@
270 interrupts = <0 78 0>; 366 interrupts = <0 78 0>;
271 #address-cells = <1>; 367 #address-cells = <1>;
272 #size-cells = <0>; 368 #size-cells = <0>;
369 clocks = <&clock 283>, <&clock 142>;
370 clock-names = "biu", "ciu";
273 }; 371 };
274 372
275 i2s0: i2s@03830000 { 373 i2s0: i2s@03830000 {
@@ -301,6 +399,18 @@
301 dma-names = "tx", "rx"; 399 dma-names = "tx", "rx";
302 }; 400 };
303 401
402 usb@12110000 {
403 compatible = "samsung,exynos4210-ehci";
404 reg = <0x12110000 0x100>;
405 interrupts = <0 71 0>;
406 };
407
408 usb@12120000 {
409 compatible = "samsung,exynos4210-ohci";
410 reg = <0x12120000 0x100>;
411 interrupts = <0 71 0>;
412 };
413
304 amba { 414 amba {
305 #address-cells = <1>; 415 #address-cells = <1>;
306 #size-cells = <1>; 416 #size-cells = <1>;
@@ -312,6 +422,8 @@
312 compatible = "arm,pl330", "arm,primecell"; 422 compatible = "arm,pl330", "arm,primecell";
313 reg = <0x121A0000 0x1000>; 423 reg = <0x121A0000 0x1000>;
314 interrupts = <0 34 0>; 424 interrupts = <0 34 0>;
425 clocks = <&clock 275>;
426 clock-names = "apb_pclk";
315 #dma-cells = <1>; 427 #dma-cells = <1>;
316 #dma-channels = <8>; 428 #dma-channels = <8>;
317 #dma-requests = <32>; 429 #dma-requests = <32>;
@@ -321,6 +433,8 @@
321 compatible = "arm,pl330", "arm,primecell"; 433 compatible = "arm,pl330", "arm,primecell";
322 reg = <0x121B0000 0x1000>; 434 reg = <0x121B0000 0x1000>;
323 interrupts = <0 35 0>; 435 interrupts = <0 35 0>;
436 clocks = <&clock 276>;
437 clock-names = "apb_pclk";
324 #dma-cells = <1>; 438 #dma-cells = <1>;
325 #dma-channels = <8>; 439 #dma-channels = <8>;
326 #dma-requests = <32>; 440 #dma-requests = <32>;
@@ -330,6 +444,8 @@
330 compatible = "arm,pl330", "arm,primecell"; 444 compatible = "arm,pl330", "arm,primecell";
331 reg = <0x10800000 0x1000>; 445 reg = <0x10800000 0x1000>;
332 interrupts = <0 33 0>; 446 interrupts = <0 33 0>;
447 clocks = <&clock 271>;
448 clock-names = "apb_pclk";
333 #dma-cells = <1>; 449 #dma-cells = <1>;
334 #dma-channels = <8>; 450 #dma-channels = <8>;
335 #dma-requests = <1>; 451 #dma-requests = <1>;
@@ -339,6 +455,8 @@
339 compatible = "arm,pl330", "arm,primecell"; 455 compatible = "arm,pl330", "arm,primecell";
340 reg = <0x11C10000 0x1000>; 456 reg = <0x11C10000 0x1000>;
341 interrupts = <0 124 0>; 457 interrupts = <0 124 0>;
458 clocks = <&clock 271>;
459 clock-names = "apb_pclk";
342 #dma-cells = <1>; 460 #dma-cells = <1>;
343 #dma-channels = <8>; 461 #dma-channels = <8>;
344 #dma-requests = <1>; 462 #dma-requests = <1>;
@@ -592,34 +710,51 @@
592 }; 710 };
593 }; 711 };
594 712
713
595 gsc_0: gsc@0x13e00000 { 714 gsc_0: gsc@0x13e00000 {
596 compatible = "samsung,exynos5-gsc"; 715 compatible = "samsung,exynos5-gsc";
597 reg = <0x13e00000 0x1000>; 716 reg = <0x13e00000 0x1000>;
598 interrupts = <0 85 0>; 717 interrupts = <0 85 0>;
718 samsung,power-domain = <&pd_gsc>;
719 clocks = <&clock 256>;
720 clock-names = "gscl";
599 }; 721 };
600 722
601 gsc_1: gsc@0x13e10000 { 723 gsc_1: gsc@0x13e10000 {
602 compatible = "samsung,exynos5-gsc"; 724 compatible = "samsung,exynos5-gsc";
603 reg = <0x13e10000 0x1000>; 725 reg = <0x13e10000 0x1000>;
604 interrupts = <0 86 0>; 726 interrupts = <0 86 0>;
727 samsung,power-domain = <&pd_gsc>;
728 clocks = <&clock 257>;
729 clock-names = "gscl";
605 }; 730 };
606 731
607 gsc_2: gsc@0x13e20000 { 732 gsc_2: gsc@0x13e20000 {
608 compatible = "samsung,exynos5-gsc"; 733 compatible = "samsung,exynos5-gsc";
609 reg = <0x13e20000 0x1000>; 734 reg = <0x13e20000 0x1000>;
610 interrupts = <0 87 0>; 735 interrupts = <0 87 0>;
736 samsung,power-domain = <&pd_gsc>;
737 clocks = <&clock 258>;
738 clock-names = "gscl";
611 }; 739 };
612 740
613 gsc_3: gsc@0x13e30000 { 741 gsc_3: gsc@0x13e30000 {
614 compatible = "samsung,exynos5-gsc"; 742 compatible = "samsung,exynos5-gsc";
615 reg = <0x13e30000 0x1000>; 743 reg = <0x13e30000 0x1000>;
616 interrupts = <0 88 0>; 744 interrupts = <0 88 0>;
745 samsung,power-domain = <&pd_gsc>;
746 clocks = <&clock 259>;
747 clock-names = "gscl";
617 }; 748 };
618 749
619 hdmi { 750 hdmi {
620 compatible = "samsung,exynos5-hdmi"; 751 compatible = "samsung,exynos5-hdmi";
621 reg = <0x14530000 0x70000>; 752 reg = <0x14530000 0x70000>;
622 interrupts = <0 95 0>; 753 interrupts = <0 95 0>;
754 clocks = <&clock 333>, <&clock 136>, <&clock 137>,
755 <&clock 333>, <&clock 333>;
756 clock-names = "hdmi", "sclk_hdmi", "sclk_pixel",
757 "sclk_hdmiphy", "hdmiphy";
623 }; 758 };
624 759
625 mixer { 760 mixer {
@@ -627,4 +762,18 @@
627 reg = <0x14450000 0x10000>; 762 reg = <0x14450000 0x10000>;
628 interrupts = <0 94 0>; 763 interrupts = <0 94 0>;
629 }; 764 };
765
766 dp-controller {
767 compatible = "samsung,exynos5-dp";
768 reg = <0x145b0000 0x1000>;
769 interrupts = <10 3>;
770 interrupt-parent = <&combiner>;
771 #address-cells = <1>;
772 #size-cells = <0>;
773
774 dptx-phy {
775 reg = <0x10040720>;
776 samsung,enable-mask = <1>;
777 };
778 };
630}; 779};
diff --git a/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
index 81e2c964a900..a21eb4cbe893 100644
--- a/arch/arm/boot/dts/exynos5440-ssdk5440.dts
+++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
@@ -28,19 +28,10 @@
28 status = "disabled"; 28 status = "disabled";
29 }; 29 };
30 30
31 i2c@F0000 { 31 fixed-rate-clocks {
32 status = "disabled"; 32 xtal {
33 }; 33 compatible = "samsung,clock-xtal";
34 34 clock-frequency = <50000000>;
35 i2c@100000 { 35 };
36 status = "disabled";
37 };
38
39 watchdog {
40 status = "disabled";
41 };
42
43 rtc {
44 status = "disabled";
45 }; 36 };
46}; 37};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index 9a99755920c0..48cc96aa0b5f 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -16,6 +16,12 @@
16 16
17 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
18 18
19 clock: clock-controller@0x160000 {
20 compatible = "samsung,exynos5440-clock";
21 reg = <0x160000 0x1000>;
22 #clock-cells = <1>;
23 };
24
19 gic:interrupt-controller@2E0000 { 25 gic:interrupt-controller@2E0000 {
20 compatible = "arm,cortex-a15-gic"; 26 compatible = "arm,cortex-a15-gic";
21 #interrupt-cells = <3>; 27 #interrupt-cells = <3>;
@@ -24,55 +30,51 @@
24 }; 30 };
25 31
26 cpus { 32 cpus {
33 #address-cells = <1>;
34 #size-cells = <0>;
35
27 cpu@0 { 36 cpu@0 {
28 compatible = "arm,cortex-a15"; 37 compatible = "arm,cortex-a15";
29 timer { 38 reg = <0>;
30 compatible = "arm,armv7-timer";
31 interrupts = <1 13 0xf08>;
32 clock-frequency = <1000000>;
33 };
34 }; 39 };
35 cpu@1 { 40 cpu@1 {
36 compatible = "arm,cortex-a15"; 41 compatible = "arm,cortex-a15";
37 timer { 42 reg = <1>;
38 compatible = "arm,armv7-timer";
39 interrupts = <1 14 0xf08>;
40 clock-frequency = <1000000>;
41 };
42 }; 43 };
43 cpu@2 { 44 cpu@2 {
44 compatible = "arm,cortex-a15"; 45 compatible = "arm,cortex-a15";
45 timer { 46 reg = <2>;
46 compatible = "arm,armv7-timer";
47 interrupts = <1 14 0xf08>;
48 clock-frequency = <1000000>;
49 };
50 }; 47 };
51 cpu@3 { 48 cpu@3 {
52 compatible = "arm,cortex-a15"; 49 compatible = "arm,cortex-a15";
53 timer { 50 reg = <3>;
54 compatible = "arm,armv7-timer";
55 interrupts = <1 14 0xf08>;
56 clock-frequency = <1000000>;
57 };
58 }; 51 };
59 }; 52 };
60 53
61 common { 54 timer {
62 compatible = "samsung,exynos5440"; 55 compatible = "arm,cortex-a15-timer",
63 56 "arm,armv7-timer";
57 interrupts = <1 13 0xf08>,
58 <1 14 0xf08>,
59 <1 11 0xf08>,
60 <1 10 0xf08>;
61 clock-frequency = <50000000>;
64 }; 62 };
65 63
66 serial@B0000 { 64 serial@B0000 {
67 compatible = "samsung,exynos4210-uart"; 65 compatible = "samsung,exynos4210-uart";
68 reg = <0xB0000 0x1000>; 66 reg = <0xB0000 0x1000>;
69 interrupts = <0 2 0>; 67 interrupts = <0 2 0>;
68 clocks = <&clock 21>, <&clock 21>;
69 clock-names = "uart", "clk_uart_baud0";
70 }; 70 };
71 71
72 serial@C0000 { 72 serial@C0000 {
73 compatible = "samsung,exynos4210-uart"; 73 compatible = "samsung,exynos4210-uart";
74 reg = <0xC0000 0x1000>; 74 reg = <0xC0000 0x1000>;
75 interrupts = <0 3 0>; 75 interrupts = <0 3 0>;
76 clocks = <&clock 21>, <&clock 21>;
77 clock-names = "uart", "clk_uart_baud0";
76 }; 78 };
77 79
78 spi { 80 spi {
@@ -83,6 +85,8 @@
83 rx-dma-channel = <&pdma0 4>; /* preliminary */ 85 rx-dma-channel = <&pdma0 4>; /* preliminary */
84 #address-cells = <1>; 86 #address-cells = <1>;
85 #size-cells = <0>; 87 #size-cells = <0>;
88 clocks = <&clock 21>, <&clock 16>;
89 clock-names = "spi", "spi_busclk0";
86 }; 90 };
87 91
88 pinctrl { 92 pinctrl {
@@ -110,25 +114,31 @@
110 }; 114 };
111 115
112 i2c@F0000 { 116 i2c@F0000 {
113 compatible = "samsung,s3c2440-i2c"; 117 compatible = "samsung,exynos5440-i2c";
114 reg = <0xF0000 0x1000>; 118 reg = <0xF0000 0x1000>;
115 interrupts = <0 5 0>; 119 interrupts = <0 5 0>;
116 #address-cells = <1>; 120 #address-cells = <1>;
117 #size-cells = <0>; 121 #size-cells = <0>;
122 clocks = <&clock 21>;
123 clock-names = "i2c";
118 }; 124 };
119 125
120 i2c@100000 { 126 i2c@100000 {
121 compatible = "samsung,s3c2440-i2c"; 127 compatible = "samsung,exynos5440-i2c";
122 reg = <0x100000 0x1000>; 128 reg = <0x100000 0x1000>;
123 interrupts = <0 6 0>; 129 interrupts = <0 6 0>;
124 #address-cells = <1>; 130 #address-cells = <1>;
125 #size-cells = <0>; 131 #size-cells = <0>;
132 clocks = <&clock 21>;
133 clock-names = "i2c";
126 }; 134 };
127 135
128 watchdog { 136 watchdog {
129 compatible = "samsung,s3c2410-wdt"; 137 compatible = "samsung,s3c2410-wdt";
130 reg = <0x110000 0x1000>; 138 reg = <0x110000 0x1000>;
131 interrupts = <0 1 0>; 139 interrupts = <0 1 0>;
140 clocks = <&clock 21>;
141 clock-names = "watchdog";
132 }; 142 };
133 143
134 amba { 144 amba {
@@ -142,6 +152,8 @@
142 compatible = "arm,pl330", "arm,primecell"; 152 compatible = "arm,pl330", "arm,primecell";
143 reg = <0x120000 0x1000>; 153 reg = <0x120000 0x1000>;
144 interrupts = <0 34 0>; 154 interrupts = <0 34 0>;
155 clocks = <&clock 21>;
156 clock-names = "apb_pclk";
145 #dma-cells = <1>; 157 #dma-cells = <1>;
146 #dma-channels = <8>; 158 #dma-channels = <8>;
147 #dma-requests = <32>; 159 #dma-requests = <32>;
@@ -151,6 +163,8 @@
151 compatible = "arm,pl330", "arm,primecell"; 163 compatible = "arm,pl330", "arm,primecell";
152 reg = <0x121000 0x1000>; 164 reg = <0x121000 0x1000>;
153 interrupts = <0 35 0>; 165 interrupts = <0 35 0>;
166 clocks = <&clock 21>;
167 clock-names = "apb_pclk";
154 #dma-cells = <1>; 168 #dma-cells = <1>;
155 #dma-channels = <8>; 169 #dma-channels = <8>;
156 #dma-requests = <32>; 170 #dma-requests = <32>;
@@ -161,5 +175,8 @@
161 compatible = "samsung,s3c6410-rtc"; 175 compatible = "samsung,s3c6410-rtc";
162 reg = <0x130000 0x1000>; 176 reg = <0x130000 0x1000>;
163 interrupts = <0 17 0>, <0 16 0>; 177 interrupts = <0 17 0>, <0 16 0>;
178 clocks = <&clock 21>;
179 clock-names = "rtc";
180 status = "disabled";
164 }; 181 };
165}; 182};
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi
index 379128eb9d98..c0bc426952ea 100644
--- a/arch/arm/boot/dts/href.dtsi
+++ b/arch/arm/boot/dts/href.dtsi
@@ -87,6 +87,7 @@
87 mmc-cap-sd-highspeed; 87 mmc-cap-sd-highspeed;
88 mmc-cap-mmc-highspeed; 88 mmc-cap-mmc-highspeed;
89 vmmc-supply = <&ab8500_ldo_aux3_reg>; 89 vmmc-supply = <&ab8500_ldo_aux3_reg>;
90 vqmmc-supply = <&vmmci>;
90 91
91 cd-gpios = <&tc3589x_gpio 3 0x4>; 92 cd-gpios = <&tc3589x_gpio 3 0x4>;
92 93
diff --git a/arch/arm/boot/dts/hrefprev60.dts b/arch/arm/boot/dts/hrefprev60.dts
index eec29c4a86dc..c2d274815923 100644
--- a/arch/arm/boot/dts/hrefprev60.dts
+++ b/arch/arm/boot/dts/hrefprev60.dts
@@ -25,6 +25,14 @@
25 }; 25 };
26 26
27 soc-u9500 { 27 soc-u9500 {
28 prcmu@80157000 {
29 ab8500@5 {
30 ab8500-gpio {
31 compatible = "stericsson,ab8500-gpio";
32 };
33 };
34 };
35
28 i2c@80004000 { 36 i2c@80004000 {
29 tps61052@33 { 37 tps61052@33 {
30 compatible = "tps61052"; 38 compatible = "tps61052";
@@ -40,7 +48,7 @@
40 48
41 vmmci: regulator-gpio { 49 vmmci: regulator-gpio {
42 gpios = <&tc3589x_gpio 18 0x4>; 50 gpios = <&tc3589x_gpio 18 0x4>;
43 gpio-enable = <&tc3589x_gpio 17 0x4>; 51 enable-gpio = <&tc3589x_gpio 17 0x4>;
44 52
45 status = "okay"; 53 status = "okay";
46 }; 54 };
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 56afcf41aae0..ad2d79324cd3 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -295,6 +295,7 @@
295 }; 295 };
296 296
297 digctl@8001c000 { 297 digctl@8001c000 {
298 compatible = "fsl,imx23-digctl";
298 reg = <0x8001c000 2000>; 299 reg = <0x8001c000 2000>;
299 status = "disabled"; 300 status = "disabled";
300 }; 301 };
@@ -321,6 +322,7 @@
321 }; 322 };
322 323
323 ocotp@8002c000 { 324 ocotp@8002c000 {
325 compatible = "fsl,ocotp";
324 reg = <0x8002c000 0x2000>; 326 reg = <0x8002c000 0x2000>;
325 status = "disabled"; 327 status = "disabled";
326 }; 328 };
@@ -360,7 +362,7 @@
360 ranges; 362 ranges;
361 363
362 clks: clkctrl@80040000 { 364 clks: clkctrl@80040000 {
363 compatible = "fsl,imx23-clkctrl"; 365 compatible = "fsl,imx23-clkctrl", "fsl,clkctrl";
364 reg = <0x80040000 0x2000>; 366 reg = <0x80040000 0x2000>;
365 #clock-cells = <1>; 367 #clock-cells = <1>;
366 }; 368 };
@@ -426,6 +428,7 @@
426 compatible = "fsl,imx23-timrot", "fsl,timrot"; 428 compatible = "fsl,imx23-timrot", "fsl,timrot";
427 reg = <0x80068000 0x2000>; 429 reg = <0x80068000 0x2000>;
428 interrupts = <28 29 30 31>; 430 interrupts = <28 29 30 31>;
431 clocks = <&clks 28>;
429 }; 432 };
430 433
431 auart0: serial@8006c000 { 434 auart0: serial@8006c000 {
diff --git a/arch/arm/boot/dts/imx25-karo-tx25.dts b/arch/arm/boot/dts/imx25-karo-tx25.dts
index 1a9d0491cdce..f8db366c46ff 100644
--- a/arch/arm/boot/dts/imx25-karo-tx25.dts
+++ b/arch/arm/boot/dts/imx25-karo-tx25.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx25.dtsi" 13#include "imx25.dtsi"
14 14
15/ { 15/ {
16 model = "Ka-Ro TX25"; 16 model = "Ka-Ro TX25";
diff --git a/arch/arm/boot/dts/imx25-pdk.dts b/arch/arm/boot/dts/imx25-pdk.dts
index a02a860afd18..f607ce520eda 100644
--- a/arch/arm/boot/dts/imx25-pdk.dts
+++ b/arch/arm/boot/dts/imx25-pdk.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx25.dtsi" 13#include "imx25.dtsi"
14 14
15/ { 15/ {
16 model = "Freescale i.MX25 Product Development Kit"; 16 model = "Freescale i.MX25 Product Development Kit";
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index 94f33059158a..d2550e0bca24 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -9,7 +9,7 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12/include/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13 13
14/ { 14/ {
15 aliases { 15 aliases {
diff --git a/arch/arm/boot/dts/imx27-apf27.dts b/arch/arm/boot/dts/imx27-apf27.dts
index b464c807d8d9..ba4c6df08ece 100644
--- a/arch/arm/boot/dts/imx27-apf27.dts
+++ b/arch/arm/boot/dts/imx27-apf27.dts
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15/dts-v1/; 15/dts-v1/;
16/include/ "imx27.dtsi" 16#include "imx27.dtsi"
17 17
18/ { 18/ {
19 model = "Armadeus Systems APF27 module"; 19 model = "Armadeus Systems APF27 module";
diff --git a/arch/arm/boot/dts/imx27-apf27dev.dts b/arch/arm/boot/dts/imx27-apf27dev.dts
new file mode 100644
index 000000000000..66b8e1c1b0be
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-apf27dev.dts
@@ -0,0 +1,60 @@
1/*
2 * Copyright 2013 Armadeus Systems - <support@armadeus.com>
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/* APF27Dev is a docking board for the APF27 SOM */
13#include "imx27-apf27.dts"
14
15/ {
16 model = "Armadeus Systems APF27Dev docking/development board";
17 compatible = "armadeus,imx27-apf27dev", "armadeus,imx27-apf27", "fsl,imx27";
18
19 gpio-keys {
20 compatible = "gpio-keys";
21
22 user-key {
23 label = "user";
24 gpios = <&gpio6 13 0>;
25 linux,code = <276>; /* BTN_EXTRA */
26 };
27 };
28
29 leds {
30 compatible = "gpio-leds";
31
32 user {
33 label = "Heartbeat";
34 gpios = <&gpio6 14 0>;
35 linux,default-trigger = "heartbeat";
36 };
37 };
38};
39
40&cspi1 {
41 fsl,spi-num-chipselects = <1>;
42 cs-gpios = <&gpio4 28 1>;
43 status = "okay";
44};
45
46&cspi2 {
47 fsl,spi-num-chipselects = <3>;
48 cs-gpios = <&gpio4 21 1>, <&gpio4 27 1>,
49 <&gpio2 17 1>;
50 status = "okay";
51};
52
53&i2c1 {
54 clock-frequency = <400000>;
55 status = "okay";
56};
57
58&i2c2 {
59 status = "okay";
60};
diff --git a/arch/arm/boot/dts/imx27-pdk.dts b/arch/arm/boot/dts/imx27-pdk.dts
index 41cd1105608e..5ce89aa275df 100644
--- a/arch/arm/boot/dts/imx27-pdk.dts
+++ b/arch/arm/boot/dts/imx27-pdk.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx27.dtsi" 13#include "imx27.dtsi"
14 14
15/ { 15/ {
16 model = "Freescale i.MX27 Product Development Kit"; 16 model = "Freescale i.MX27 Product Development Kit";
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore.dts b/arch/arm/boot/dts/imx27-phytec-phycore.dts
index 53b0ec0c228e..fe64e3a91df0 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycore.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycore.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx27.dtsi" 13#include "imx27.dtsi"
14 14
15/ { 15/ {
16 model = "Phytec pcm038"; 16 model = "Phytec pcm038";
@@ -71,3 +71,9 @@
71 #size-cells = <1>; 71 #size-cells = <1>;
72 }; 72 };
73}; 73};
74
75&nfc {
76 nand-bus-width = <8>;
77 nand-ecc-mode = "hw";
78 status = "okay";
79};
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 5a82cb5707a8..ff4bd4873edf 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -9,7 +9,7 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12/include/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13 13
14/ { 14/ {
15 aliases { 15 aliases {
@@ -60,14 +60,41 @@
60 60
61 wdog: wdog@10002000 { 61 wdog: wdog@10002000 {
62 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt"; 62 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt";
63 reg = <0x10002000 0x4000>; 63 reg = <0x10002000 0x1000>;
64 interrupts = <27>; 64 interrupts = <27>;
65 clocks = <&clks 0>;
66 };
67
68 gpt1: timer@10003000 {
69 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
70 reg = <0x10003000 0x1000>;
71 interrupts = <26>;
72 clocks = <&clks 46>, <&clks 61>;
73 clock-names = "ipg", "per";
74 };
75
76 gpt2: timer@10004000 {
77 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
78 reg = <0x10004000 0x1000>;
79 interrupts = <25>;
80 clocks = <&clks 45>, <&clks 61>;
81 clock-names = "ipg", "per";
82 };
83
84 gpt3: timer@10005000 {
85 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
86 reg = <0x10005000 0x1000>;
87 interrupts = <24>;
88 clocks = <&clks 44>, <&clks 61>;
89 clock-names = "ipg", "per";
65 }; 90 };
66 91
67 uart1: serial@1000a000 { 92 uart1: serial@1000a000 {
68 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 93 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
69 reg = <0x1000a000 0x1000>; 94 reg = <0x1000a000 0x1000>;
70 interrupts = <20>; 95 interrupts = <20>;
96 clocks = <&clks 81>, <&clks 61>;
97 clock-names = "ipg", "per";
71 status = "disabled"; 98 status = "disabled";
72 }; 99 };
73 100
@@ -75,6 +102,8 @@
75 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 102 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
76 reg = <0x1000b000 0x1000>; 103 reg = <0x1000b000 0x1000>;
77 interrupts = <19>; 104 interrupts = <19>;
105 clocks = <&clks 80>, <&clks 61>;
106 clock-names = "ipg", "per";
78 status = "disabled"; 107 status = "disabled";
79 }; 108 };
80 109
@@ -82,6 +111,8 @@
82 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 111 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
83 reg = <0x1000c000 0x1000>; 112 reg = <0x1000c000 0x1000>;
84 interrupts = <18>; 113 interrupts = <18>;
114 clocks = <&clks 79>, <&clks 61>;
115 clock-names = "ipg", "per";
85 status = "disabled"; 116 status = "disabled";
86 }; 117 };
87 118
@@ -89,6 +120,8 @@
89 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 120 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
90 reg = <0x1000d000 0x1000>; 121 reg = <0x1000d000 0x1000>;
91 interrupts = <17>; 122 interrupts = <17>;
123 clocks = <&clks 78>, <&clks 61>;
124 clock-names = "ipg", "per";
92 status = "disabled"; 125 status = "disabled";
93 }; 126 };
94 127
@@ -98,6 +131,8 @@
98 compatible = "fsl,imx27-cspi"; 131 compatible = "fsl,imx27-cspi";
99 reg = <0x1000e000 0x1000>; 132 reg = <0x1000e000 0x1000>;
100 interrupts = <16>; 133 interrupts = <16>;
134 clocks = <&clks 53>, <&clks 0>;
135 clock-names = "ipg", "per";
101 status = "disabled"; 136 status = "disabled";
102 }; 137 };
103 138
@@ -107,6 +142,8 @@
107 compatible = "fsl,imx27-cspi"; 142 compatible = "fsl,imx27-cspi";
108 reg = <0x1000f000 0x1000>; 143 reg = <0x1000f000 0x1000>;
109 interrupts = <15>; 144 interrupts = <15>;
145 clocks = <&clks 52>, <&clks 0>;
146 clock-names = "ipg", "per";
110 status = "disabled"; 147 status = "disabled";
111 }; 148 };
112 149
@@ -116,6 +153,7 @@
116 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; 153 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
117 reg = <0x10012000 0x1000>; 154 reg = <0x10012000 0x1000>;
118 interrupts = <12>; 155 interrupts = <12>;
156 clocks = <&clks 40>;
119 status = "disabled"; 157 status = "disabled";
120 }; 158 };
121 159
@@ -185,13 +223,33 @@
185 compatible = "fsl,imx27-cspi"; 223 compatible = "fsl,imx27-cspi";
186 reg = <0x10017000 0x1000>; 224 reg = <0x10017000 0x1000>;
187 interrupts = <6>; 225 interrupts = <6>;
226 clocks = <&clks 51>, <&clks 0>;
227 clock-names = "ipg", "per";
188 status = "disabled"; 228 status = "disabled";
189 }; 229 };
190 230
231 gpt4: timer@10019000 {
232 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
233 reg = <0x10019000 0x1000>;
234 interrupts = <4>;
235 clocks = <&clks 43>, <&clks 61>;
236 clock-names = "ipg", "per";
237 };
238
239 gpt5: timer@1001a000 {
240 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
241 reg = <0x1001a000 0x1000>;
242 interrupts = <3>;
243 clocks = <&clks 42>, <&clks 61>;
244 clock-names = "ipg", "per";
245 };
246
191 uart5: serial@1001b000 { 247 uart5: serial@1001b000 {
192 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 248 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
193 reg = <0x1001b000 0x1000>; 249 reg = <0x1001b000 0x1000>;
194 interrupts = <49>; 250 interrupts = <49>;
251 clocks = <&clks 77>, <&clks 61>;
252 clock-names = "ipg", "per";
195 status = "disabled"; 253 status = "disabled";
196 }; 254 };
197 255
@@ -199,6 +257,8 @@
199 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 257 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
200 reg = <0x1001c000 0x1000>; 258 reg = <0x1001c000 0x1000>;
201 interrupts = <48>; 259 interrupts = <48>;
260 clocks = <&clks 78>, <&clks 61>;
261 clock-names = "ipg", "per";
202 status = "disabled"; 262 status = "disabled";
203 }; 263 };
204 264
@@ -208,9 +268,17 @@
208 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c"; 268 compatible = "fsl,imx27-i2c", "fsl,imx21-i2c";
209 reg = <0x1001d000 0x1000>; 269 reg = <0x1001d000 0x1000>;
210 interrupts = <1>; 270 interrupts = <1>;
271 clocks = <&clks 39>;
211 status = "disabled"; 272 status = "disabled";
212 }; 273 };
213 274
275 gpt6: timer@1001f000 {
276 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
277 reg = <0x1001f000 0x1000>;
278 interrupts = <2>;
279 clocks = <&clks 41>, <&clks 61>;
280 clock-names = "ipg", "per";
281 };
214 }; 282 };
215 283
216 aipi@10020000 { /* AIPI2 */ 284 aipi@10020000 { /* AIPI2 */
@@ -224,10 +292,19 @@
224 compatible = "fsl,imx27-fec"; 292 compatible = "fsl,imx27-fec";
225 reg = <0x1002b000 0x4000>; 293 reg = <0x1002b000 0x4000>;
226 interrupts = <50>; 294 interrupts = <50>;
295 clocks = <&clks 48>, <&clks 67>, <&clks 0>;
296 clock-names = "ipg", "ahb", "ptp";
227 status = "disabled"; 297 status = "disabled";
228 }; 298 };
299
300 clks: ccm@10027000{
301 compatible = "fsl,imx27-ccm";
302 reg = <0x10027000 0x1000>;
303 #clock-cells = <1>;
304 };
229 }; 305 };
230 306
307
231 nfc: nand@d8000000 { 308 nfc: nand@d8000000 {
232 #address-cells = <1>; 309 #address-cells = <1>;
233 #size-cells = <1>; 310 #size-cells = <1>;
@@ -235,6 +312,7 @@
235 compatible = "fsl,imx27-nand"; 312 compatible = "fsl,imx27-nand";
236 reg = <0xd8000000 0x1000>; 313 reg = <0xd8000000 0x1000>;
237 interrupts = <29>; 314 interrupts = <29>;
315 clocks = <&clks 54>;
238 status = "disabled"; 316 status = "disabled";
239 }; 317 };
240 }; 318 };
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 7ba49662b9bc..64af2381c1b0 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -647,6 +647,7 @@
647 }; 647 };
648 648
649 digctl@8001c000 { 649 digctl@8001c000 {
650 compatible = "fsl,imx28-digctl";
650 reg = <0x8001c000 0x2000>; 651 reg = <0x8001c000 0x2000>;
651 interrupts = <89>; 652 interrupts = <89>;
652 status = "disabled"; 653 status = "disabled";
@@ -676,6 +677,7 @@
676 }; 677 };
677 678
678 ocotp@8002c000 { 679 ocotp@8002c000 {
680 compatible = "fsl,ocotp";
679 reg = <0x8002c000 0x2000>; 681 reg = <0x8002c000 0x2000>;
680 status = "disabled"; 682 status = "disabled";
681 }; 683 };
@@ -755,7 +757,7 @@
755 ranges; 757 ranges;
756 758
757 clks: clkctrl@80040000 { 759 clks: clkctrl@80040000 {
758 compatible = "fsl,imx28-clkctrl"; 760 compatible = "fsl,imx28-clkctrl", "fsl,clkctrl";
759 reg = <0x80040000 0x2000>; 761 reg = <0x80040000 0x2000>;
760 #clock-cells = <1>; 762 #clock-cells = <1>;
761 }; 763 };
@@ -838,6 +840,7 @@
838 compatible = "fsl,imx28-timrot", "fsl,timrot"; 840 compatible = "fsl,imx28-timrot", "fsl,timrot";
839 reg = <0x80068000 0x2000>; 841 reg = <0x80068000 0x2000>;
840 interrupts = <48 49 50 51>; 842 interrupts = <48 49 50 51>;
843 clocks = <&clks 26>;
841 }; 844 };
842 845
843 auart0: serial@8006a000 { 846 auart0: serial@8006a000 {
diff --git a/arch/arm/boot/dts/imx31-bug.dts b/arch/arm/boot/dts/imx31-bug.dts
index 9ac6f6ba1d64..2424abfc9c7b 100644
--- a/arch/arm/boot/dts/imx31-bug.dts
+++ b/arch/arm/boot/dts/imx31-bug.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "imx31.dtsi" 13#include "imx31.dtsi"
14 14
15/ { 15/ {
16 model = "Buglabs i.MX31 Bug 1.x"; 16 model = "Buglabs i.MX31 Bug 1.x";
diff --git a/arch/arm/boot/dts/imx31.dtsi b/arch/arm/boot/dts/imx31.dtsi
index 454c2d175402..c5449257ad9a 100644
--- a/arch/arm/boot/dts/imx31.dtsi
+++ b/arch/arm/boot/dts/imx31.dtsi
@@ -9,7 +9,7 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12/include/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13 13
14/ { 14/ {
15 aliases { 15 aliases {
@@ -101,5 +101,21 @@
101 #clock-cells = <1>; 101 #clock-cells = <1>;
102 }; 102 };
103 }; 103 };
104
105 aips@53f00000 { /* AIPS2 */
106 compatible = "fsl,aips-bus", "simple-bus";
107 #address-cells = <1>;
108 #size-cells = <1>;
109 reg = <0x53f00000 0x100000>;
110 ranges;
111
112 gpt: timer@53f90000 {
113 compatible = "fsl,imx31-gpt";
114 reg = <0x53f90000 0x4000>;
115 interrupts = <29>;
116 clocks = <&clks 10>, <&clks 22>;
117 clock-names = "ipg", "per";
118 };
119 };
104 }; 120 };
105}; 121};
diff --git a/arch/arm/boot/dts/imx35-pinfunc.h b/arch/arm/boot/dts/imx35-pinfunc.h
new file mode 100644
index 000000000000..4911f2c405fa
--- /dev/null
+++ b/arch/arm/boot/dts/imx35-pinfunc.h
@@ -0,0 +1,970 @@
1/*
2 * Copyright 2013 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
10#ifndef __DTS_IMX35_PINFUNC_H
11#define __DTS_IMX35_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX35_PAD_CAPTURE__GPT_CAPIN1 0x004 0x328 0x000 0x0 0x0
18#define MX35_PAD_CAPTURE__GPT_CMPOUT2 0x004 0x328 0x000 0x1 0x0
19#define MX35_PAD_CAPTURE__CSPI2_SS1 0x004 0x328 0x7f4 0x2 0x0
20#define MX35_PAD_CAPTURE__EPIT1_EPITO 0x004 0x328 0x000 0x3 0x0
21#define MX35_PAD_CAPTURE__CCM_CLK32K 0x004 0x328 0x7d0 0x4 0x0
22#define MX35_PAD_CAPTURE__GPIO1_4 0x004 0x328 0x850 0x5 0x0
23#define MX35_PAD_COMPARE__GPT_CMPOUT1 0x008 0x32c 0x000 0x0 0x0
24#define MX35_PAD_COMPARE__GPT_CAPIN2 0x008 0x32c 0x000 0x1 0x0
25#define MX35_PAD_COMPARE__GPT_CMPOUT3 0x008 0x32c 0x000 0x2 0x0
26#define MX35_PAD_COMPARE__EPIT2_EPITO 0x008 0x32c 0x000 0x3 0x0
27#define MX35_PAD_COMPARE__GPIO1_5 0x008 0x32c 0x854 0x5 0x0
28#define MX35_PAD_COMPARE__SDMA_EXTDMA_2 0x008 0x32c 0x000 0x7 0x0
29#define MX35_PAD_WDOG_RST__WDOG_WDOG_B 0x00c 0x330 0x000 0x0 0x0
30#define MX35_PAD_WDOG_RST__IPU_FLASH_STROBE 0x00c 0x330 0x000 0x3 0x0
31#define MX35_PAD_WDOG_RST__GPIO1_6 0x00c 0x330 0x858 0x5 0x0
32#define MX35_PAD_GPIO1_0__GPIO1_0 0x010 0x334 0x82c 0x0 0x0
33#define MX35_PAD_GPIO1_0__CCM_PMIC_RDY 0x010 0x334 0x7d4 0x1 0x0
34#define MX35_PAD_GPIO1_0__OWIRE_LINE 0x010 0x334 0x990 0x2 0x0
35#define MX35_PAD_GPIO1_0__SDMA_EXTDMA_0 0x010 0x334 0x000 0x7 0x0
36#define MX35_PAD_GPIO1_1__GPIO1_1 0x014 0x338 0x838 0x0 0x0
37#define MX35_PAD_GPIO1_1__PWM_PWMO 0x014 0x338 0x000 0x2 0x0
38#define MX35_PAD_GPIO1_1__CSPI1_SS2 0x014 0x338 0x7d8 0x3 0x0
39#define MX35_PAD_GPIO1_1__SCC_TAMPER_DETECT 0x014 0x338 0x000 0x6 0x0
40#define MX35_PAD_GPIO1_1__SDMA_EXTDMA_1 0x014 0x338 0x000 0x7 0x0
41#define MX35_PAD_GPIO2_0__GPIO2_0 0x018 0x33c 0x868 0x0 0x0
42#define MX35_PAD_GPIO2_0__USB_TOP_USBOTG_CLK 0x018 0x33c 0x000 0x1 0x0
43#define MX35_PAD_GPIO3_0__GPIO3_0 0x01c 0x340 0x8e8 0x0 0x0
44#define MX35_PAD_GPIO3_0__USB_TOP_USBH2_CLK 0x01c 0x340 0x000 0x1 0x0
45#define MX35_PAD_RESET_IN_B__CCM_RESET_IN_B 0x000 0x344 0x000 0x0 0x0
46#define MX35_PAD_POR_B__CCM_POR_B 0x000 0x348 0x000 0x0 0x0
47#define MX35_PAD_CLKO__CCM_CLKO 0x020 0x34c 0x000 0x0 0x0
48#define MX35_PAD_CLKO__GPIO1_8 0x020 0x34c 0x860 0x5 0x0
49#define MX35_PAD_BOOT_MODE0__CCM_BOOT_MODE_0 0x000 0x350 0x000 0x0 0x0
50#define MX35_PAD_BOOT_MODE1__CCM_BOOT_MODE_1 0x000 0x354 0x000 0x0 0x0
51#define MX35_PAD_CLK_MODE0__CCM_CLK_MODE_0 0x000 0x358 0x000 0x0 0x0
52#define MX35_PAD_CLK_MODE1__CCM_CLK_MODE_1 0x000 0x35c 0x000 0x0 0x0
53#define MX35_PAD_POWER_FAIL__CCM_DSM_WAKEUP_INT_26 0x000 0x360 0x000 0x0 0x0
54#define MX35_PAD_VSTBY__CCM_VSTBY 0x024 0x364 0x000 0x0 0x0
55#define MX35_PAD_VSTBY__GPIO1_7 0x024 0x364 0x85c 0x5 0x0
56#define MX35_PAD_A0__EMI_EIM_DA_L_0 0x028 0x368 0x000 0x0 0x0
57#define MX35_PAD_A1__EMI_EIM_DA_L_1 0x02c 0x36c 0x000 0x0 0x0
58#define MX35_PAD_A2__EMI_EIM_DA_L_2 0x030 0x370 0x000 0x0 0x0
59#define MX35_PAD_A3__EMI_EIM_DA_L_3 0x034 0x374 0x000 0x0 0x0
60#define MX35_PAD_A4__EMI_EIM_DA_L_4 0x038 0x378 0x000 0x0 0x0
61#define MX35_PAD_A5__EMI_EIM_DA_L_5 0x03c 0x37c 0x000 0x0 0x0
62#define MX35_PAD_A6__EMI_EIM_DA_L_6 0x040 0x380 0x000 0x0 0x0
63#define MX35_PAD_A7__EMI_EIM_DA_L_7 0x044 0x384 0x000 0x0 0x0
64#define MX35_PAD_A8__EMI_EIM_DA_H_8 0x048 0x388 0x000 0x0 0x0
65#define MX35_PAD_A9__EMI_EIM_DA_H_9 0x04c 0x38c 0x000 0x0 0x0
66#define MX35_PAD_A10__EMI_EIM_DA_H_10 0x050 0x390 0x000 0x0 0x0
67#define MX35_PAD_MA10__EMI_MA10 0x054 0x394 0x000 0x0 0x0
68#define MX35_PAD_A11__EMI_EIM_DA_H_11 0x058 0x398 0x000 0x0 0x0
69#define MX35_PAD_A12__EMI_EIM_DA_H_12 0x05c 0x39c 0x000 0x0 0x0
70#define MX35_PAD_A13__EMI_EIM_DA_H_13 0x060 0x3a0 0x000 0x0 0x0
71#define MX35_PAD_A14__EMI_EIM_DA_H2_14 0x064 0x3a4 0x000 0x0 0x0
72#define MX35_PAD_A15__EMI_EIM_DA_H2_15 0x068 0x3a8 0x000 0x0 0x0
73#define MX35_PAD_A16__EMI_EIM_A_16 0x06c 0x3ac 0x000 0x0 0x0
74#define MX35_PAD_A17__EMI_EIM_A_17 0x070 0x3b0 0x000 0x0 0x0
75#define MX35_PAD_A18__EMI_EIM_A_18 0x074 0x3b4 0x000 0x0 0x0
76#define MX35_PAD_A19__EMI_EIM_A_19 0x078 0x3b8 0x000 0x0 0x0
77#define MX35_PAD_A20__EMI_EIM_A_20 0x07c 0x3bc 0x000 0x0 0x0
78#define MX35_PAD_A21__EMI_EIM_A_21 0x080 0x3c0 0x000 0x0 0x0
79#define MX35_PAD_A22__EMI_EIM_A_22 0x084 0x3c4 0x000 0x0 0x0
80#define MX35_PAD_A23__EMI_EIM_A_23 0x088 0x3c8 0x000 0x0 0x0
81#define MX35_PAD_A24__EMI_EIM_A_24 0x08c 0x3cc 0x000 0x0 0x0
82#define MX35_PAD_A25__EMI_EIM_A_25 0x090 0x3d0 0x000 0x0 0x0
83#define MX35_PAD_SDBA1__EMI_EIM_SDBA1 0x000 0x3d4 0x000 0x0 0x0
84#define MX35_PAD_SDBA0__EMI_EIM_SDBA0 0x000 0x3d8 0x000 0x0 0x0
85#define MX35_PAD_SD0__EMI_DRAM_D_0 0x000 0x3dc 0x000 0x0 0x0
86#define MX35_PAD_SD1__EMI_DRAM_D_1 0x000 0x3e0 0x000 0x0 0x0
87#define MX35_PAD_SD2__EMI_DRAM_D_2 0x000 0x3e4 0x000 0x0 0x0
88#define MX35_PAD_SD3__EMI_DRAM_D_3 0x000 0x3e8 0x000 0x0 0x0
89#define MX35_PAD_SD4__EMI_DRAM_D_4 0x000 0x3ec 0x000 0x0 0x0
90#define MX35_PAD_SD5__EMI_DRAM_D_5 0x000 0x3f0 0x000 0x0 0x0
91#define MX35_PAD_SD6__EMI_DRAM_D_6 0x000 0x3f4 0x000 0x0 0x0
92#define MX35_PAD_SD7__EMI_DRAM_D_7 0x000 0x3f8 0x000 0x0 0x0
93#define MX35_PAD_SD8__EMI_DRAM_D_8 0x000 0x3fc 0x000 0x0 0x0
94#define MX35_PAD_SD9__EMI_DRAM_D_9 0x000 0x400 0x000 0x0 0x0
95#define MX35_PAD_SD10__EMI_DRAM_D_10 0x000 0x404 0x000 0x0 0x0
96#define MX35_PAD_SD11__EMI_DRAM_D_11 0x000 0x408 0x000 0x0 0x0
97#define MX35_PAD_SD12__EMI_DRAM_D_12 0x000 0x40c 0x000 0x0 0x0
98#define MX35_PAD_SD13__EMI_DRAM_D_13 0x000 0x410 0x000 0x0 0x0
99#define MX35_PAD_SD14__EMI_DRAM_D_14 0x000 0x414 0x000 0x0 0x0
100#define MX35_PAD_SD15__EMI_DRAM_D_15 0x000 0x418 0x000 0x0 0x0
101#define MX35_PAD_SD16__EMI_DRAM_D_16 0x000 0x41c 0x000 0x0 0x0
102#define MX35_PAD_SD17__EMI_DRAM_D_17 0x000 0x420 0x000 0x0 0x0
103#define MX35_PAD_SD18__EMI_DRAM_D_18 0x000 0x424 0x000 0x0 0x0
104#define MX35_PAD_SD19__EMI_DRAM_D_19 0x000 0x428 0x000 0x0 0x0
105#define MX35_PAD_SD20__EMI_DRAM_D_20 0x000 0x42c 0x000 0x0 0x0
106#define MX35_PAD_SD21__EMI_DRAM_D_21 0x000 0x430 0x000 0x0 0x0
107#define MX35_PAD_SD22__EMI_DRAM_D_22 0x000 0x434 0x000 0x0 0x0
108#define MX35_PAD_SD23__EMI_DRAM_D_23 0x000 0x438 0x000 0x0 0x0
109#define MX35_PAD_SD24__EMI_DRAM_D_24 0x000 0x43c 0x000 0x0 0x0
110#define MX35_PAD_SD25__EMI_DRAM_D_25 0x000 0x440 0x000 0x0 0x0
111#define MX35_PAD_SD26__EMI_DRAM_D_26 0x000 0x444 0x000 0x0 0x0
112#define MX35_PAD_SD27__EMI_DRAM_D_27 0x000 0x448 0x000 0x0 0x0
113#define MX35_PAD_SD28__EMI_DRAM_D_28 0x000 0x44c 0x000 0x0 0x0
114#define MX35_PAD_SD29__EMI_DRAM_D_29 0x000 0x450 0x000 0x0 0x0
115#define MX35_PAD_SD30__EMI_DRAM_D_30 0x000 0x454 0x000 0x0 0x0
116#define MX35_PAD_SD31__EMI_DRAM_D_31 0x000 0x458 0x000 0x0 0x0
117#define MX35_PAD_DQM0__EMI_DRAM_DQM_0 0x000 0x45c 0x000 0x0 0x0
118#define MX35_PAD_DQM1__EMI_DRAM_DQM_1 0x000 0x460 0x000 0x0 0x0
119#define MX35_PAD_DQM2__EMI_DRAM_DQM_2 0x000 0x464 0x000 0x0 0x0
120#define MX35_PAD_DQM3__EMI_DRAM_DQM_3 0x000 0x468 0x000 0x0 0x0
121#define MX35_PAD_EB0__EMI_EIM_EB0_B 0x094 0x46c 0x000 0x0 0x0
122#define MX35_PAD_EB1__EMI_EIM_EB1_B 0x098 0x470 0x000 0x0 0x0
123#define MX35_PAD_OE__EMI_EIM_OE 0x09c 0x474 0x000 0x0 0x0
124#define MX35_PAD_CS0__EMI_EIM_CS0 0x0a0 0x478 0x000 0x0 0x0
125#define MX35_PAD_CS1__EMI_EIM_CS1 0x0a4 0x47c 0x000 0x0 0x0
126#define MX35_PAD_CS1__EMI_NANDF_CE3 0x0a4 0x47c 0x000 0x3 0x0
127#define MX35_PAD_CS2__EMI_EIM_CS2 0x0a8 0x480 0x000 0x0 0x0
128#define MX35_PAD_CS3__EMI_EIM_CS3 0x0ac 0x484 0x000 0x0 0x0
129#define MX35_PAD_CS4__EMI_EIM_CS4 0x0b0 0x488 0x000 0x0 0x0
130#define MX35_PAD_CS4__EMI_DTACK_B 0x0b0 0x488 0x800 0x1 0x0
131#define MX35_PAD_CS4__EMI_NANDF_CE1 0x0b0 0x488 0x000 0x3 0x0
132#define MX35_PAD_CS4__GPIO1_20 0x0b0 0x488 0x83c 0x5 0x0
133#define MX35_PAD_CS5__EMI_EIM_CS5 0x0b4 0x48c 0x000 0x0 0x0
134#define MX35_PAD_CS5__CSPI2_SS2 0x0b4 0x48c 0x7f8 0x1 0x0
135#define MX35_PAD_CS5__CSPI1_SS2 0x0b4 0x48c 0x7d8 0x2 0x1
136#define MX35_PAD_CS5__EMI_NANDF_CE2 0x0b4 0x48c 0x000 0x3 0x0
137#define MX35_PAD_CS5__GPIO1_21 0x0b4 0x48c 0x840 0x5 0x0
138#define MX35_PAD_NF_CE0__EMI_NANDF_CE0 0x0b8 0x490 0x000 0x0 0x0
139#define MX35_PAD_NF_CE0__GPIO1_22 0x0b8 0x490 0x844 0x5 0x0
140#define MX35_PAD_ECB__EMI_EIM_ECB 0x000 0x494 0x000 0x0 0x0
141#define MX35_PAD_LBA__EMI_EIM_LBA 0x0bc 0x498 0x000 0x0 0x0
142#define MX35_PAD_BCLK__EMI_EIM_BCLK 0x0c0 0x49c 0x000 0x0 0x0
143#define MX35_PAD_RW__EMI_EIM_RW 0x0c4 0x4a0 0x000 0x0 0x0
144#define MX35_PAD_RAS__EMI_DRAM_RAS 0x000 0x4a4 0x000 0x0 0x0
145#define MX35_PAD_CAS__EMI_DRAM_CAS 0x000 0x4a8 0x000 0x0 0x0
146#define MX35_PAD_SDWE__EMI_DRAM_SDWE 0x000 0x4ac 0x000 0x0 0x0
147#define MX35_PAD_SDCKE0__EMI_DRAM_SDCKE_0 0x000 0x4b0 0x000 0x0 0x0
148#define MX35_PAD_SDCKE1__EMI_DRAM_SDCKE_1 0x000 0x4b4 0x000 0x0 0x0
149#define MX35_PAD_SDCLK__EMI_DRAM_SDCLK 0x000 0x4b8 0x000 0x0 0x0
150#define MX35_PAD_SDQS0__EMI_DRAM_SDQS_0 0x000 0x4bc 0x000 0x0 0x0
151#define MX35_PAD_SDQS1__EMI_DRAM_SDQS_1 0x000 0x4c0 0x000 0x0 0x0
152#define MX35_PAD_SDQS2__EMI_DRAM_SDQS_2 0x000 0x4c4 0x000 0x0 0x0
153#define MX35_PAD_SDQS3__EMI_DRAM_SDQS_3 0x000 0x4c8 0x000 0x0 0x0
154#define MX35_PAD_NFWE_B__EMI_NANDF_WE_B 0x0c8 0x4cc 0x000 0x0 0x0
155#define MX35_PAD_NFWE_B__USB_TOP_USBH2_DATA_3 0x0c8 0x4cc 0x9d8 0x1 0x0
156#define MX35_PAD_NFWE_B__IPU_DISPB_D0_VSYNC 0x0c8 0x4cc 0x924 0x2 0x0
157#define MX35_PAD_NFWE_B__GPIO2_18 0x0c8 0x4cc 0x88c 0x5 0x0
158#define MX35_PAD_NFWE_B__ARM11P_TOP_TRACE_0 0x0c8 0x4cc 0x000 0x7 0x0
159#define MX35_PAD_NFRE_B__EMI_NANDF_RE_B 0x0cc 0x4d0 0x000 0x0 0x0
160#define MX35_PAD_NFRE_B__USB_TOP_USBH2_DIR 0x0cc 0x4d0 0x9ec 0x1 0x0
161#define MX35_PAD_NFRE_B__IPU_DISPB_BCLK 0x0cc 0x4d0 0x000 0x2 0x0
162#define MX35_PAD_NFRE_B__GPIO2_19 0x0cc 0x4d0 0x890 0x5 0x0
163#define MX35_PAD_NFRE_B__ARM11P_TOP_TRACE_1 0x0cc 0x4d0 0x000 0x7 0x0
164#define MX35_PAD_NFALE__EMI_NANDF_ALE 0x0d0 0x4d4 0x000 0x0 0x0
165#define MX35_PAD_NFALE__USB_TOP_USBH2_STP 0x0d0 0x4d4 0x000 0x1 0x0
166#define MX35_PAD_NFALE__IPU_DISPB_CS0 0x0d0 0x4d4 0x000 0x2 0x0
167#define MX35_PAD_NFALE__GPIO2_20 0x0d0 0x4d4 0x898 0x5 0x0
168#define MX35_PAD_NFALE__ARM11P_TOP_TRACE_2 0x0d0 0x4d4 0x000 0x7 0x0
169#define MX35_PAD_NFCLE__EMI_NANDF_CLE 0x0d4 0x4d8 0x000 0x0 0x0
170#define MX35_PAD_NFCLE__USB_TOP_USBH2_NXT 0x0d4 0x4d8 0x9f0 0x1 0x0
171#define MX35_PAD_NFCLE__IPU_DISPB_PAR_RS 0x0d4 0x4d8 0x000 0x2 0x0
172#define MX35_PAD_NFCLE__GPIO2_21 0x0d4 0x4d8 0x89c 0x5 0x0
173#define MX35_PAD_NFCLE__ARM11P_TOP_TRACE_3 0x0d4 0x4d8 0x000 0x7 0x0
174#define MX35_PAD_NFWP_B__EMI_NANDF_WP_B 0x0d8 0x4dc 0x000 0x0 0x0
175#define MX35_PAD_NFWP_B__USB_TOP_USBH2_DATA_7 0x0d8 0x4dc 0x9e8 0x1 0x0
176#define MX35_PAD_NFWP_B__IPU_DISPB_WR 0x0d8 0x4dc 0x000 0x2 0x0
177#define MX35_PAD_NFWP_B__GPIO2_22 0x0d8 0x4dc 0x8a0 0x5 0x0
178#define MX35_PAD_NFWP_B__ARM11P_TOP_TRCTL 0x0d8 0x4dc 0x000 0x7 0x0
179#define MX35_PAD_NFRB__EMI_NANDF_RB 0x0dc 0x4e0 0x000 0x0 0x0
180#define MX35_PAD_NFRB__IPU_DISPB_RD 0x0dc 0x4e0 0x000 0x2 0x0
181#define MX35_PAD_NFRB__GPIO2_23 0x0dc 0x4e0 0x8a4 0x5 0x0
182#define MX35_PAD_NFRB__ARM11P_TOP_TRCLK 0x0dc 0x4e0 0x000 0x7 0x0
183#define MX35_PAD_D15__EMI_EIM_D_15 0x000 0x4e4 0x000 0x0 0x0
184#define MX35_PAD_D14__EMI_EIM_D_14 0x000 0x4e8 0x000 0x0 0x0
185#define MX35_PAD_D13__EMI_EIM_D_13 0x000 0x4ec 0x000 0x0 0x0
186#define MX35_PAD_D12__EMI_EIM_D_12 0x000 0x4f0 0x000 0x0 0x0
187#define MX35_PAD_D11__EMI_EIM_D_11 0x000 0x4f4 0x000 0x0 0x0
188#define MX35_PAD_D10__EMI_EIM_D_10 0x000 0x4f8 0x000 0x0 0x0
189#define MX35_PAD_D9__EMI_EIM_D_9 0x000 0x4fc 0x000 0x0 0x0
190#define MX35_PAD_D8__EMI_EIM_D_8 0x000 0x500 0x000 0x0 0x0
191#define MX35_PAD_D7__EMI_EIM_D_7 0x000 0x504 0x000 0x0 0x0
192#define MX35_PAD_D6__EMI_EIM_D_6 0x000 0x508 0x000 0x0 0x0
193#define MX35_PAD_D5__EMI_EIM_D_5 0x000 0x50c 0x000 0x0 0x0
194#define MX35_PAD_D4__EMI_EIM_D_4 0x000 0x510 0x000 0x0 0x0
195#define MX35_PAD_D3__EMI_EIM_D_3 0x000 0x514 0x000 0x0 0x0
196#define MX35_PAD_D2__EMI_EIM_D_2 0x000 0x518 0x000 0x0 0x0
197#define MX35_PAD_D1__EMI_EIM_D_1 0x000 0x51c 0x000 0x0 0x0
198#define MX35_PAD_D0__EMI_EIM_D_0 0x000 0x520 0x000 0x0 0x0
199#define MX35_PAD_CSI_D8__IPU_CSI_D_8 0x0e0 0x524 0x000 0x0 0x0
200#define MX35_PAD_CSI_D8__KPP_COL_0 0x0e0 0x524 0x950 0x1 0x0
201#define MX35_PAD_CSI_D8__GPIO1_20 0x0e0 0x524 0x83c 0x5 0x1
202#define MX35_PAD_CSI_D8__ARM11P_TOP_EVNTBUS_13 0x0e0 0x524 0x000 0x7 0x0
203#define MX35_PAD_CSI_D9__IPU_CSI_D_9 0x0e4 0x528 0x000 0x0 0x0
204#define MX35_PAD_CSI_D9__KPP_COL_1 0x0e4 0x528 0x954 0x1 0x0
205#define MX35_PAD_CSI_D9__GPIO1_21 0x0e4 0x528 0x840 0x5 0x1
206#define MX35_PAD_CSI_D9__ARM11P_TOP_EVNTBUS_14 0x0e4 0x528 0x000 0x7 0x0
207#define MX35_PAD_CSI_D10__IPU_CSI_D_10 0x0e8 0x52c 0x000 0x0 0x0
208#define MX35_PAD_CSI_D10__KPP_COL_2 0x0e8 0x52c 0x958 0x1 0x0
209#define MX35_PAD_CSI_D10__GPIO1_22 0x0e8 0x52c 0x844 0x5 0x1
210#define MX35_PAD_CSI_D10__ARM11P_TOP_EVNTBUS_15 0x0e8 0x52c 0x000 0x7 0x0
211#define MX35_PAD_CSI_D11__IPU_CSI_D_11 0x0ec 0x530 0x000 0x0 0x0
212#define MX35_PAD_CSI_D11__KPP_COL_3 0x0ec 0x530 0x95c 0x1 0x0
213#define MX35_PAD_CSI_D11__GPIO1_23 0x0ec 0x530 0x000 0x5 0x0
214#define MX35_PAD_CSI_D12__IPU_CSI_D_12 0x0f0 0x534 0x000 0x0 0x0
215#define MX35_PAD_CSI_D12__KPP_ROW_0 0x0f0 0x534 0x970 0x1 0x0
216#define MX35_PAD_CSI_D12__GPIO1_24 0x0f0 0x534 0x000 0x5 0x0
217#define MX35_PAD_CSI_D13__IPU_CSI_D_13 0x0f4 0x538 0x000 0x0 0x0
218#define MX35_PAD_CSI_D13__KPP_ROW_1 0x0f4 0x538 0x974 0x1 0x0
219#define MX35_PAD_CSI_D13__GPIO1_25 0x0f4 0x538 0x000 0x5 0x0
220#define MX35_PAD_CSI_D14__IPU_CSI_D_14 0x0f8 0x53c 0x000 0x0 0x0
221#define MX35_PAD_CSI_D14__KPP_ROW_2 0x0f8 0x53c 0x978 0x1 0x0
222#define MX35_PAD_CSI_D14__GPIO1_26 0x0f8 0x53c 0x000 0x5 0x0
223#define MX35_PAD_CSI_D15__IPU_CSI_D_15 0x0fc 0x540 0x97c 0x0 0x0
224#define MX35_PAD_CSI_D15__KPP_ROW_3 0x0fc 0x540 0x000 0x1 0x0
225#define MX35_PAD_CSI_D15__GPIO1_27 0x0fc 0x540 0x000 0x5 0x0
226#define MX35_PAD_CSI_MCLK__IPU_CSI_MCLK 0x100 0x544 0x000 0x0 0x0
227#define MX35_PAD_CSI_MCLK__GPIO1_28 0x100 0x544 0x000 0x5 0x0
228#define MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC 0x104 0x548 0x000 0x0 0x0
229#define MX35_PAD_CSI_VSYNC__GPIO1_29 0x104 0x548 0x000 0x5 0x0
230#define MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC 0x108 0x54c 0x000 0x0 0x0
231#define MX35_PAD_CSI_HSYNC__GPIO1_30 0x108 0x54c 0x000 0x5 0x0
232#define MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK 0x10c 0x550 0x000 0x0 0x0
233#define MX35_PAD_CSI_PIXCLK__GPIO1_31 0x10c 0x550 0x000 0x5 0x0
234#define MX35_PAD_I2C1_CLK__I2C1_SCL 0x110 0x554 0x000 0x0 0x0
235#define MX35_PAD_I2C1_CLK__GPIO2_24 0x110 0x554 0x8a8 0x5 0x0
236#define MX35_PAD_I2C1_CLK__CCM_USB_BYP_CLK 0x110 0x554 0x000 0x6 0x0
237#define MX35_PAD_I2C1_DAT__I2C1_SDA 0x114 0x558 0x000 0x0 0x0
238#define MX35_PAD_I2C1_DAT__GPIO2_25 0x114 0x558 0x8ac 0x5 0x0
239#define MX35_PAD_I2C2_CLK__I2C2_SCL 0x118 0x55c 0x000 0x0 0x0
240#define MX35_PAD_I2C2_CLK__CAN1_TXCAN 0x118 0x55c 0x000 0x1 0x0
241#define MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR 0x118 0x55c 0x000 0x2 0x0
242#define MX35_PAD_I2C2_CLK__GPIO2_26 0x118 0x55c 0x8b0 0x5 0x0
243#define MX35_PAD_I2C2_CLK__SDMA_DEBUG_BUS_DEVICE_2 0x118 0x55c 0x000 0x6 0x0
244#define MX35_PAD_I2C2_DAT__I2C2_SDA 0x11c 0x560 0x000 0x0 0x0
245#define MX35_PAD_I2C2_DAT__CAN1_RXCAN 0x11c 0x560 0x7c8 0x1 0x0
246#define MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC 0x11c 0x560 0x9f4 0x2 0x0
247#define MX35_PAD_I2C2_DAT__GPIO2_27 0x11c 0x560 0x8b4 0x5 0x0
248#define MX35_PAD_I2C2_DAT__SDMA_DEBUG_BUS_DEVICE_3 0x11c 0x560 0x000 0x6 0x0
249#define MX35_PAD_STXD4__AUDMUX_AUD4_TXD 0x120 0x564 0x000 0x0 0x0
250#define MX35_PAD_STXD4__GPIO2_28 0x120 0x564 0x8b8 0x5 0x0
251#define MX35_PAD_STXD4__ARM11P_TOP_ARM_COREASID0 0x120 0x564 0x000 0x7 0x0
252#define MX35_PAD_SRXD4__AUDMUX_AUD4_RXD 0x124 0x568 0x000 0x0 0x0
253#define MX35_PAD_SRXD4__GPIO2_29 0x124 0x568 0x8bc 0x5 0x0
254#define MX35_PAD_SRXD4__ARM11P_TOP_ARM_COREASID1 0x124 0x568 0x000 0x7 0x0
255#define MX35_PAD_SCK4__AUDMUX_AUD4_TXC 0x128 0x56c 0x000 0x0 0x0
256#define MX35_PAD_SCK4__GPIO2_30 0x128 0x56c 0x8c4 0x5 0x0
257#define MX35_PAD_SCK4__ARM11P_TOP_ARM_COREASID2 0x128 0x56c 0x000 0x7 0x0
258#define MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS 0x12c 0x570 0x000 0x0 0x0
259#define MX35_PAD_STXFS4__GPIO2_31 0x12c 0x570 0x8c8 0x5 0x0
260#define MX35_PAD_STXFS4__ARM11P_TOP_ARM_COREASID3 0x12c 0x570 0x000 0x7 0x0
261#define MX35_PAD_STXD5__AUDMUX_AUD5_TXD 0x130 0x574 0x000 0x0 0x0
262#define MX35_PAD_STXD5__SPDIF_SPDIF_OUT1 0x130 0x574 0x000 0x1 0x0
263#define MX35_PAD_STXD5__CSPI2_MOSI 0x130 0x574 0x7ec 0x2 0x0
264#define MX35_PAD_STXD5__GPIO1_0 0x130 0x574 0x82c 0x5 0x1
265#define MX35_PAD_STXD5__ARM11P_TOP_ARM_COREASID4 0x130 0x574 0x000 0x7 0x0
266#define MX35_PAD_SRXD5__AUDMUX_AUD5_RXD 0x134 0x578 0x000 0x0 0x0
267#define MX35_PAD_SRXD5__SPDIF_SPDIF_IN1 0x134 0x578 0x998 0x1 0x0
268#define MX35_PAD_SRXD5__CSPI2_MISO 0x134 0x578 0x7e8 0x2 0x0
269#define MX35_PAD_SRXD5__GPIO1_1 0x134 0x578 0x838 0x5 0x1
270#define MX35_PAD_SRXD5__ARM11P_TOP_ARM_COREASID5 0x134 0x578 0x000 0x7 0x0
271#define MX35_PAD_SCK5__AUDMUX_AUD5_TXC 0x138 0x57c 0x000 0x0 0x0
272#define MX35_PAD_SCK5__SPDIF_SPDIF_EXTCLK 0x138 0x57c 0x994 0x1 0x0
273#define MX35_PAD_SCK5__CSPI2_SCLK 0x138 0x57c 0x7e0 0x2 0x0
274#define MX35_PAD_SCK5__GPIO1_2 0x138 0x57c 0x848 0x5 0x0
275#define MX35_PAD_SCK5__ARM11P_TOP_ARM_COREASID6 0x138 0x57c 0x000 0x7 0x0
276#define MX35_PAD_STXFS5__AUDMUX_AUD5_TXFS 0x13c 0x580 0x000 0x0 0x0
277#define MX35_PAD_STXFS5__CSPI2_RDY 0x13c 0x580 0x7e4 0x2 0x0
278#define MX35_PAD_STXFS5__GPIO1_3 0x13c 0x580 0x84c 0x5 0x0
279#define MX35_PAD_STXFS5__ARM11P_TOP_ARM_COREASID7 0x13c 0x580 0x000 0x7 0x0
280#define MX35_PAD_SCKR__ESAI_SCKR 0x140 0x584 0x000 0x0 0x0
281#define MX35_PAD_SCKR__GPIO1_4 0x140 0x584 0x850 0x5 0x1
282#define MX35_PAD_SCKR__ARM11P_TOP_EVNTBUS_10 0x140 0x584 0x000 0x7 0x0
283#define MX35_PAD_FSR__ESAI_FSR 0x144 0x588 0x000 0x0 0x0
284#define MX35_PAD_FSR__GPIO1_5 0x144 0x588 0x854 0x5 0x1
285#define MX35_PAD_FSR__ARM11P_TOP_EVNTBUS_11 0x144 0x588 0x000 0x7 0x0
286#define MX35_PAD_HCKR__ESAI_HCKR 0x148 0x58c 0x000 0x0 0x0
287#define MX35_PAD_HCKR__AUDMUX_AUD5_RXFS 0x148 0x58c 0x000 0x1 0x0
288#define MX35_PAD_HCKR__CSPI2_SS0 0x148 0x58c 0x7f0 0x2 0x0
289#define MX35_PAD_HCKR__IPU_FLASH_STROBE 0x148 0x58c 0x000 0x3 0x0
290#define MX35_PAD_HCKR__GPIO1_6 0x148 0x58c 0x858 0x5 0x1
291#define MX35_PAD_HCKR__ARM11P_TOP_EVNTBUS_12 0x148 0x58c 0x000 0x7 0x0
292#define MX35_PAD_SCKT__ESAI_SCKT 0x14c 0x590 0x000 0x0 0x0
293#define MX35_PAD_SCKT__GPIO1_7 0x14c 0x590 0x85c 0x5 0x1
294#define MX35_PAD_SCKT__IPU_CSI_D_0 0x14c 0x590 0x930 0x6 0x0
295#define MX35_PAD_SCKT__KPP_ROW_2 0x14c 0x590 0x978 0x7 0x1
296#define MX35_PAD_FST__ESAI_FST 0x150 0x594 0x000 0x0 0x0
297#define MX35_PAD_FST__GPIO1_8 0x150 0x594 0x860 0x5 0x1
298#define MX35_PAD_FST__IPU_CSI_D_1 0x150 0x594 0x934 0x6 0x0
299#define MX35_PAD_FST__KPP_ROW_3 0x150 0x594 0x97c 0x7 0x1
300#define MX35_PAD_HCKT__ESAI_HCKT 0x154 0x598 0x000 0x0 0x0
301#define MX35_PAD_HCKT__AUDMUX_AUD5_RXC 0x154 0x598 0x7a8 0x1 0x0
302#define MX35_PAD_HCKT__GPIO1_9 0x154 0x598 0x864 0x5 0x0
303#define MX35_PAD_HCKT__IPU_CSI_D_2 0x154 0x598 0x938 0x6 0x0
304#define MX35_PAD_HCKT__KPP_COL_3 0x154 0x598 0x95c 0x7 0x1
305#define MX35_PAD_TX5_RX0__ESAI_TX5_RX0 0x158 0x59c 0x000 0x0 0x0
306#define MX35_PAD_TX5_RX0__AUDMUX_AUD4_RXC 0x158 0x59c 0x000 0x1 0x0
307#define MX35_PAD_TX5_RX0__CSPI2_SS2 0x158 0x59c 0x7f8 0x2 0x1
308#define MX35_PAD_TX5_RX0__CAN2_TXCAN 0x158 0x59c 0x000 0x3 0x0
309#define MX35_PAD_TX5_RX0__UART2_DTR 0x158 0x59c 0x000 0x4 0x0
310#define MX35_PAD_TX5_RX0__GPIO1_10 0x158 0x59c 0x830 0x5 0x0
311#define MX35_PAD_TX5_RX0__EMI_M3IF_CHOSEN_MASTER_0 0x158 0x59c 0x000 0x7 0x0
312#define MX35_PAD_TX4_RX1__ESAI_TX4_RX1 0x15c 0x5a0 0x000 0x0 0x0
313#define MX35_PAD_TX4_RX1__AUDMUX_AUD4_RXFS 0x15c 0x5a0 0x000 0x1 0x0
314#define MX35_PAD_TX4_RX1__CSPI2_SS3 0x15c 0x5a0 0x7fc 0x2 0x0
315#define MX35_PAD_TX4_RX1__CAN2_RXCAN 0x15c 0x5a0 0x7cc 0x3 0x0
316#define MX35_PAD_TX4_RX1__UART2_DSR 0x15c 0x5a0 0x000 0x4 0x0
317#define MX35_PAD_TX4_RX1__GPIO1_11 0x15c 0x5a0 0x834 0x5 0x0
318#define MX35_PAD_TX4_RX1__IPU_CSI_D_3 0x15c 0x5a0 0x93c 0x6 0x0
319#define MX35_PAD_TX4_RX1__KPP_ROW_0 0x15c 0x5a0 0x970 0x7 0x1
320#define MX35_PAD_TX3_RX2__ESAI_TX3_RX2 0x160 0x5a4 0x000 0x0 0x0
321#define MX35_PAD_TX3_RX2__I2C3_SCL 0x160 0x5a4 0x91c 0x1 0x0
322#define MX35_PAD_TX3_RX2__EMI_NANDF_CE1 0x160 0x5a4 0x000 0x3 0x0
323#define MX35_PAD_TX3_RX2__GPIO1_12 0x160 0x5a4 0x000 0x5 0x0
324#define MX35_PAD_TX3_RX2__IPU_CSI_D_4 0x160 0x5a4 0x940 0x6 0x0
325#define MX35_PAD_TX3_RX2__KPP_ROW_1 0x160 0x5a4 0x974 0x7 0x1
326#define MX35_PAD_TX2_RX3__ESAI_TX2_RX3 0x164 0x5a8 0x000 0x0 0x0
327#define MX35_PAD_TX2_RX3__I2C3_SDA 0x164 0x5a8 0x920 0x1 0x0
328#define MX35_PAD_TX2_RX3__EMI_NANDF_CE2 0x164 0x5a8 0x000 0x3 0x0
329#define MX35_PAD_TX2_RX3__GPIO1_13 0x164 0x5a8 0x000 0x5 0x0
330#define MX35_PAD_TX2_RX3__IPU_CSI_D_5 0x164 0x5a8 0x944 0x6 0x0
331#define MX35_PAD_TX2_RX3__KPP_COL_0 0x164 0x5a8 0x950 0x7 0x1
332#define MX35_PAD_TX1__ESAI_TX1 0x168 0x5ac 0x000 0x0 0x0
333#define MX35_PAD_TX1__CCM_PMIC_RDY 0x168 0x5ac 0x7d4 0x1 0x1
334#define MX35_PAD_TX1__CSPI1_SS2 0x168 0x5ac 0x7d8 0x2 0x2
335#define MX35_PAD_TX1__EMI_NANDF_CE3 0x168 0x5ac 0x000 0x3 0x0
336#define MX35_PAD_TX1__UART2_RI 0x168 0x5ac 0x000 0x4 0x0
337#define MX35_PAD_TX1__GPIO1_14 0x168 0x5ac 0x000 0x5 0x0
338#define MX35_PAD_TX1__IPU_CSI_D_6 0x168 0x5ac 0x948 0x6 0x0
339#define MX35_PAD_TX1__KPP_COL_1 0x168 0x5ac 0x954 0x7 0x1
340#define MX35_PAD_TX0__ESAI_TX0 0x16c 0x5b0 0x000 0x0 0x0
341#define MX35_PAD_TX0__SPDIF_SPDIF_EXTCLK 0x16c 0x5b0 0x994 0x1 0x1
342#define MX35_PAD_TX0__CSPI1_SS3 0x16c 0x5b0 0x7dc 0x2 0x0
343#define MX35_PAD_TX0__EMI_DTACK_B 0x16c 0x5b0 0x800 0x3 0x1
344#define MX35_PAD_TX0__UART2_DCD 0x16c 0x5b0 0x000 0x4 0x0
345#define MX35_PAD_TX0__GPIO1_15 0x16c 0x5b0 0x000 0x5 0x0
346#define MX35_PAD_TX0__IPU_CSI_D_7 0x16c 0x5b0 0x94c 0x6 0x0
347#define MX35_PAD_TX0__KPP_COL_2 0x16c 0x5b0 0x958 0x7 0x1
348#define MX35_PAD_CSPI1_MOSI__CSPI1_MOSI 0x170 0x5b4 0x000 0x0 0x0
349#define MX35_PAD_CSPI1_MOSI__GPIO1_16 0x170 0x5b4 0x000 0x5 0x0
350#define MX35_PAD_CSPI1_MOSI__ECT_CTI_TRIG_OUT1_2 0x170 0x5b4 0x000 0x7 0x0
351#define MX35_PAD_CSPI1_MISO__CSPI1_MISO 0x174 0x5b8 0x000 0x0 0x0
352#define MX35_PAD_CSPI1_MISO__GPIO1_17 0x174 0x5b8 0x000 0x5 0x0
353#define MX35_PAD_CSPI1_MISO__ECT_CTI_TRIG_OUT1_3 0x174 0x5b8 0x000 0x7 0x0
354#define MX35_PAD_CSPI1_SS0__CSPI1_SS0 0x178 0x5bc 0x000 0x0 0x0
355#define MX35_PAD_CSPI1_SS0__OWIRE_LINE 0x178 0x5bc 0x990 0x1 0x1
356#define MX35_PAD_CSPI1_SS0__CSPI2_SS3 0x178 0x5bc 0x7fc 0x2 0x1
357#define MX35_PAD_CSPI1_SS0__GPIO1_18 0x178 0x5bc 0x000 0x5 0x0
358#define MX35_PAD_CSPI1_SS0__ECT_CTI_TRIG_OUT1_4 0x178 0x5bc 0x000 0x7 0x0
359#define MX35_PAD_CSPI1_SS1__CSPI1_SS1 0x17c 0x5c0 0x000 0x0 0x0
360#define MX35_PAD_CSPI1_SS1__PWM_PWMO 0x17c 0x5c0 0x000 0x1 0x0
361#define MX35_PAD_CSPI1_SS1__CCM_CLK32K 0x17c 0x5c0 0x7d0 0x2 0x1
362#define MX35_PAD_CSPI1_SS1__GPIO1_19 0x17c 0x5c0 0x000 0x5 0x0
363#define MX35_PAD_CSPI1_SS1__IPU_DIAGB_29 0x17c 0x5c0 0x000 0x6 0x0
364#define MX35_PAD_CSPI1_SS1__ECT_CTI_TRIG_OUT1_5 0x17c 0x5c0 0x000 0x7 0x0
365#define MX35_PAD_CSPI1_SCLK__CSPI1_SCLK 0x180 0x5c4 0x000 0x0 0x0
366#define MX35_PAD_CSPI1_SCLK__GPIO3_4 0x180 0x5c4 0x904 0x5 0x0
367#define MX35_PAD_CSPI1_SCLK__IPU_DIAGB_30 0x180 0x5c4 0x000 0x6 0x0
368#define MX35_PAD_CSPI1_SCLK__EMI_M3IF_CHOSEN_MASTER_1 0x180 0x5c4 0x000 0x7 0x0
369#define MX35_PAD_CSPI1_SPI_RDY__CSPI1_RDY 0x184 0x5c8 0x000 0x0 0x0
370#define MX35_PAD_CSPI1_SPI_RDY__GPIO3_5 0x184 0x5c8 0x908 0x5 0x0
371#define MX35_PAD_CSPI1_SPI_RDY__IPU_DIAGB_31 0x184 0x5c8 0x000 0x6 0x0
372#define MX35_PAD_CSPI1_SPI_RDY__EMI_M3IF_CHOSEN_MASTER_2 0x184 0x5c8 0x000 0x7 0x0
373#define MX35_PAD_RXD1__UART1_RXD_MUX 0x188 0x5cc 0x000 0x0 0x0
374#define MX35_PAD_RXD1__CSPI2_MOSI 0x188 0x5cc 0x7ec 0x1 0x1
375#define MX35_PAD_RXD1__KPP_COL_4 0x188 0x5cc 0x960 0x4 0x0
376#define MX35_PAD_RXD1__GPIO3_6 0x188 0x5cc 0x90c 0x5 0x0
377#define MX35_PAD_RXD1__ARM11P_TOP_EVNTBUS_16 0x188 0x5cc 0x000 0x7 0x0
378#define MX35_PAD_TXD1__UART1_TXD_MUX 0x18c 0x5d0 0x000 0x0 0x0
379#define MX35_PAD_TXD1__CSPI2_MISO 0x18c 0x5d0 0x7e8 0x1 0x1
380#define MX35_PAD_TXD1__KPP_COL_5 0x18c 0x5d0 0x964 0x4 0x0
381#define MX35_PAD_TXD1__GPIO3_7 0x18c 0x5d0 0x910 0x5 0x0
382#define MX35_PAD_TXD1__ARM11P_TOP_EVNTBUS_17 0x18c 0x5d0 0x000 0x7 0x0
383#define MX35_PAD_RTS1__UART1_RTS 0x190 0x5d4 0x000 0x0 0x0
384#define MX35_PAD_RTS1__CSPI2_SCLK 0x190 0x5d4 0x7e0 0x1 0x1
385#define MX35_PAD_RTS1__I2C3_SCL 0x190 0x5d4 0x91c 0x2 0x1
386#define MX35_PAD_RTS1__IPU_CSI_D_0 0x190 0x5d4 0x930 0x3 0x1
387#define MX35_PAD_RTS1__KPP_COL_6 0x190 0x5d4 0x968 0x4 0x0
388#define MX35_PAD_RTS1__GPIO3_8 0x190 0x5d4 0x914 0x5 0x0
389#define MX35_PAD_RTS1__EMI_NANDF_CE1 0x190 0x5d4 0x000 0x6 0x0
390#define MX35_PAD_RTS1__ARM11P_TOP_EVNTBUS_18 0x190 0x5d4 0x000 0x7 0x0
391#define MX35_PAD_CTS1__UART1_CTS 0x194 0x5d8 0x000 0x0 0x0
392#define MX35_PAD_CTS1__CSPI2_RDY 0x194 0x5d8 0x7e4 0x1 0x1
393#define MX35_PAD_CTS1__I2C3_SDA 0x194 0x5d8 0x920 0x2 0x1
394#define MX35_PAD_CTS1__IPU_CSI_D_1 0x194 0x5d8 0x934 0x3 0x1
395#define MX35_PAD_CTS1__KPP_COL_7 0x194 0x5d8 0x96c 0x4 0x0
396#define MX35_PAD_CTS1__GPIO3_9 0x194 0x5d8 0x918 0x5 0x0
397#define MX35_PAD_CTS1__EMI_NANDF_CE2 0x194 0x5d8 0x000 0x6 0x0
398#define MX35_PAD_CTS1__ARM11P_TOP_EVNTBUS_19 0x194 0x5d8 0x000 0x7 0x0
399#define MX35_PAD_RXD2__UART2_RXD_MUX 0x198 0x5dc 0x000 0x0 0x0
400#define MX35_PAD_RXD2__KPP_ROW_4 0x198 0x5dc 0x980 0x4 0x0
401#define MX35_PAD_RXD2__GPIO3_10 0x198 0x5dc 0x8ec 0x5 0x0
402#define MX35_PAD_TXD2__UART2_TXD_MUX 0x19c 0x5e0 0x000 0x0 0x0
403#define MX35_PAD_TXD2__SPDIF_SPDIF_EXTCLK 0x19c 0x5e0 0x994 0x1 0x2
404#define MX35_PAD_TXD2__KPP_ROW_5 0x19c 0x5e0 0x984 0x4 0x0
405#define MX35_PAD_TXD2__GPIO3_11 0x19c 0x5e0 0x8f0 0x5 0x0
406#define MX35_PAD_RTS2__UART2_RTS 0x1a0 0x5e4 0x000 0x0 0x0
407#define MX35_PAD_RTS2__SPDIF_SPDIF_IN1 0x1a0 0x5e4 0x998 0x1 0x1
408#define MX35_PAD_RTS2__CAN2_RXCAN 0x1a0 0x5e4 0x7cc 0x2 0x1
409#define MX35_PAD_RTS2__IPU_CSI_D_2 0x1a0 0x5e4 0x938 0x3 0x1
410#define MX35_PAD_RTS2__KPP_ROW_6 0x1a0 0x5e4 0x988 0x4 0x0
411#define MX35_PAD_RTS2__GPIO3_12 0x1a0 0x5e4 0x8f4 0x5 0x0
412#define MX35_PAD_RTS2__AUDMUX_AUD5_RXC 0x1a0 0x5e4 0x000 0x6 0x0
413#define MX35_PAD_RTS2__UART3_RXD_MUX 0x1a0 0x5e4 0x9a0 0x7 0x0
414#define MX35_PAD_CTS2__UART2_CTS 0x1a4 0x5e8 0x000 0x0 0x0
415#define MX35_PAD_CTS2__SPDIF_SPDIF_OUT1 0x1a4 0x5e8 0x000 0x1 0x0
416#define MX35_PAD_CTS2__CAN2_TXCAN 0x1a4 0x5e8 0x000 0x2 0x0
417#define MX35_PAD_CTS2__IPU_CSI_D_3 0x1a4 0x5e8 0x93c 0x3 0x1
418#define MX35_PAD_CTS2__KPP_ROW_7 0x1a4 0x5e8 0x98c 0x4 0x0
419#define MX35_PAD_CTS2__GPIO3_13 0x1a4 0x5e8 0x8f8 0x5 0x0
420#define MX35_PAD_CTS2__AUDMUX_AUD5_RXFS 0x1a4 0x5e8 0x000 0x6 0x0
421#define MX35_PAD_CTS2__UART3_TXD_MUX 0x1a4 0x5e8 0x000 0x7 0x0
422#define MX35_PAD_RTCK__ARM11P_TOP_RTCK 0x000 0x5ec 0x000 0x0 0x0
423#define MX35_PAD_TCK__SJC_TCK 0x000 0x5f0 0x000 0x0 0x0
424#define MX35_PAD_TMS__SJC_TMS 0x000 0x5f4 0x000 0x0 0x0
425#define MX35_PAD_TDI__SJC_TDI 0x000 0x5f8 0x000 0x0 0x0
426#define MX35_PAD_TDO__SJC_TDO 0x000 0x5fc 0x000 0x0 0x0
427#define MX35_PAD_TRSTB__SJC_TRSTB 0x000 0x600 0x000 0x0 0x0
428#define MX35_PAD_DE_B__SJC_DE_B 0x000 0x604 0x000 0x0 0x0
429#define MX35_PAD_SJC_MOD__SJC_MOD 0x000 0x608 0x000 0x0 0x0
430#define MX35_PAD_USBOTG_PWR__USB_TOP_USBOTG_PWR 0x1a8 0x60c 0x000 0x0 0x0
431#define MX35_PAD_USBOTG_PWR__USB_TOP_USBH2_PWR 0x1a8 0x60c 0x000 0x1 0x0
432#define MX35_PAD_USBOTG_PWR__GPIO3_14 0x1a8 0x60c 0x8fc 0x5 0x0
433#define MX35_PAD_USBOTG_OC__USB_TOP_USBOTG_OC 0x1ac 0x610 0x000 0x0 0x0
434#define MX35_PAD_USBOTG_OC__USB_TOP_USBH2_OC 0x1ac 0x610 0x9f4 0x1 0x1
435#define MX35_PAD_USBOTG_OC__GPIO3_15 0x1ac 0x610 0x900 0x5 0x0
436#define MX35_PAD_LD0__IPU_DISPB_DAT_0 0x1b0 0x614 0x000 0x0 0x0
437#define MX35_PAD_LD0__GPIO2_0 0x1b0 0x614 0x868 0x5 0x1
438#define MX35_PAD_LD0__SDMA_SDMA_DEBUG_PC_0 0x1b0 0x614 0x000 0x6 0x0
439#define MX35_PAD_LD1__IPU_DISPB_DAT_1 0x1b4 0x618 0x000 0x0 0x0
440#define MX35_PAD_LD1__GPIO2_1 0x1b4 0x618 0x894 0x5 0x0
441#define MX35_PAD_LD1__SDMA_SDMA_DEBUG_PC_1 0x1b4 0x618 0x000 0x6 0x0
442#define MX35_PAD_LD2__IPU_DISPB_DAT_2 0x1b8 0x61c 0x000 0x0 0x0
443#define MX35_PAD_LD2__GPIO2_2 0x1b8 0x61c 0x8c0 0x5 0x0
444#define MX35_PAD_LD2__SDMA_SDMA_DEBUG_PC_2 0x1b8 0x61c 0x000 0x6 0x0
445#define MX35_PAD_LD3__IPU_DISPB_DAT_3 0x1bc 0x620 0x000 0x0 0x0
446#define MX35_PAD_LD3__GPIO2_3 0x1bc 0x620 0x8cc 0x5 0x0
447#define MX35_PAD_LD3__SDMA_SDMA_DEBUG_PC_3 0x1bc 0x620 0x000 0x6 0x0
448#define MX35_PAD_LD4__IPU_DISPB_DAT_4 0x1c0 0x624 0x000 0x0 0x0
449#define MX35_PAD_LD4__GPIO2_4 0x1c0 0x624 0x8d0 0x5 0x0
450#define MX35_PAD_LD4__SDMA_SDMA_DEBUG_PC_4 0x1c0 0x624 0x000 0x6 0x0
451#define MX35_PAD_LD5__IPU_DISPB_DAT_5 0x1c4 0x628 0x000 0x0 0x0
452#define MX35_PAD_LD5__GPIO2_5 0x1c4 0x628 0x8d4 0x5 0x0
453#define MX35_PAD_LD5__SDMA_SDMA_DEBUG_PC_5 0x1c4 0x628 0x000 0x6 0x0
454#define MX35_PAD_LD6__IPU_DISPB_DAT_6 0x1c8 0x62c 0x000 0x0 0x0
455#define MX35_PAD_LD6__GPIO2_6 0x1c8 0x62c 0x8d8 0x5 0x0
456#define MX35_PAD_LD6__SDMA_SDMA_DEBUG_PC_6 0x1c8 0x62c 0x000 0x6 0x0
457#define MX35_PAD_LD7__IPU_DISPB_DAT_7 0x1cc 0x630 0x000 0x0 0x0
458#define MX35_PAD_LD7__GPIO2_7 0x1cc 0x630 0x8dc 0x5 0x0
459#define MX35_PAD_LD7__SDMA_SDMA_DEBUG_PC_7 0x1cc 0x630 0x000 0x6 0x0
460#define MX35_PAD_LD8__IPU_DISPB_DAT_8 0x1d0 0x634 0x000 0x0 0x0
461#define MX35_PAD_LD8__GPIO2_8 0x1d0 0x634 0x8e0 0x5 0x0
462#define MX35_PAD_LD8__SDMA_SDMA_DEBUG_PC_8 0x1d0 0x634 0x000 0x6 0x0
463#define MX35_PAD_LD9__IPU_DISPB_DAT_9 0x1d4 0x638 0x000 0x0 0x0
464#define MX35_PAD_LD9__GPIO2_9 0x1d4 0x638 0x8e4 0x5 0x0
465#define MX35_PAD_LD9__SDMA_SDMA_DEBUG_PC_9 0x1d4 0x638 0x000 0x6 0x0
466#define MX35_PAD_LD10__IPU_DISPB_DAT_10 0x1d8 0x63c 0x000 0x0 0x0
467#define MX35_PAD_LD10__GPIO2_10 0x1d8 0x63c 0x86c 0x5 0x0
468#define MX35_PAD_LD10__SDMA_SDMA_DEBUG_PC_10 0x1d8 0x63c 0x000 0x6 0x0
469#define MX35_PAD_LD11__IPU_DISPB_DAT_11 0x1dc 0x640 0x000 0x0 0x0
470#define MX35_PAD_LD11__GPIO2_11 0x1dc 0x640 0x870 0x5 0x0
471#define MX35_PAD_LD11__SDMA_SDMA_DEBUG_PC_11 0x1dc 0x640 0x000 0x6 0x0
472#define MX35_PAD_LD11__ARM11P_TOP_TRACE_4 0x1dc 0x640 0x000 0x7 0x0
473#define MX35_PAD_LD12__IPU_DISPB_DAT_12 0x1e0 0x644 0x000 0x0 0x0
474#define MX35_PAD_LD12__GPIO2_12 0x1e0 0x644 0x874 0x5 0x0
475#define MX35_PAD_LD12__SDMA_SDMA_DEBUG_PC_12 0x1e0 0x644 0x000 0x6 0x0
476#define MX35_PAD_LD12__ARM11P_TOP_TRACE_5 0x1e0 0x644 0x000 0x7 0x0
477#define MX35_PAD_LD13__IPU_DISPB_DAT_13 0x1e4 0x648 0x000 0x0 0x0
478#define MX35_PAD_LD13__GPIO2_13 0x1e4 0x648 0x878 0x5 0x0
479#define MX35_PAD_LD13__SDMA_SDMA_DEBUG_PC_13 0x1e4 0x648 0x000 0x6 0x0
480#define MX35_PAD_LD13__ARM11P_TOP_TRACE_6 0x1e4 0x648 0x000 0x7 0x0
481#define MX35_PAD_LD14__IPU_DISPB_DAT_14 0x1e8 0x64c 0x000 0x0 0x0
482#define MX35_PAD_LD14__GPIO2_14 0x1e8 0x64c 0x87c 0x5 0x0
483#define MX35_PAD_LD14__SDMA_SDMA_DEBUG_EVENT_CHANNEL_0 0x1e8 0x64c 0x000 0x6 0x0
484#define MX35_PAD_LD14__ARM11P_TOP_TRACE_7 0x1e8 0x64c 0x000 0x7 0x0
485#define MX35_PAD_LD15__IPU_DISPB_DAT_15 0x1ec 0x650 0x000 0x0 0x0
486#define MX35_PAD_LD15__GPIO2_15 0x1ec 0x650 0x880 0x5 0x0
487#define MX35_PAD_LD15__SDMA_SDMA_DEBUG_EVENT_CHANNEL_1 0x1ec 0x650 0x000 0x6 0x0
488#define MX35_PAD_LD15__ARM11P_TOP_TRACE_8 0x1ec 0x650 0x000 0x7 0x0
489#define MX35_PAD_LD16__IPU_DISPB_DAT_16 0x1f0 0x654 0x000 0x0 0x0
490#define MX35_PAD_LD16__IPU_DISPB_D12_VSYNC 0x1f0 0x654 0x928 0x2 0x0
491#define MX35_PAD_LD16__GPIO2_16 0x1f0 0x654 0x884 0x5 0x0
492#define MX35_PAD_LD16__SDMA_SDMA_DEBUG_EVENT_CHANNEL_2 0x1f0 0x654 0x000 0x6 0x0
493#define MX35_PAD_LD16__ARM11P_TOP_TRACE_9 0x1f0 0x654 0x000 0x7 0x0
494#define MX35_PAD_LD17__IPU_DISPB_DAT_17 0x1f4 0x658 0x000 0x0 0x0
495#define MX35_PAD_LD17__IPU_DISPB_CS2 0x1f4 0x658 0x000 0x2 0x0
496#define MX35_PAD_LD17__GPIO2_17 0x1f4 0x658 0x888 0x5 0x0
497#define MX35_PAD_LD17__SDMA_SDMA_DEBUG_EVENT_CHANNEL_3 0x1f4 0x658 0x000 0x6 0x0
498#define MX35_PAD_LD17__ARM11P_TOP_TRACE_10 0x1f4 0x658 0x000 0x7 0x0
499#define MX35_PAD_LD18__IPU_DISPB_DAT_18 0x1f8 0x65c 0x000 0x0 0x0
500#define MX35_PAD_LD18__IPU_DISPB_D0_VSYNC 0x1f8 0x65c 0x924 0x1 0x1
501#define MX35_PAD_LD18__IPU_DISPB_D12_VSYNC 0x1f8 0x65c 0x928 0x2 0x1
502#define MX35_PAD_LD18__ESDHC3_CMD 0x1f8 0x65c 0x818 0x3 0x0
503#define MX35_PAD_LD18__USB_TOP_USBOTG_DATA_3 0x1f8 0x65c 0x9b0 0x4 0x0
504#define MX35_PAD_LD18__GPIO3_24 0x1f8 0x65c 0x000 0x5 0x0
505#define MX35_PAD_LD18__SDMA_SDMA_DEBUG_EVENT_CHANNEL_4 0x1f8 0x65c 0x000 0x6 0x0
506#define MX35_PAD_LD18__ARM11P_TOP_TRACE_11 0x1f8 0x65c 0x000 0x7 0x0
507#define MX35_PAD_LD19__IPU_DISPB_DAT_19 0x1fc 0x660 0x000 0x0 0x0
508#define MX35_PAD_LD19__IPU_DISPB_BCLK 0x1fc 0x660 0x000 0x1 0x0
509#define MX35_PAD_LD19__IPU_DISPB_CS1 0x1fc 0x660 0x000 0x2 0x0
510#define MX35_PAD_LD19__ESDHC3_CLK 0x1fc 0x660 0x814 0x3 0x0
511#define MX35_PAD_LD19__USB_TOP_USBOTG_DIR 0x1fc 0x660 0x9c4 0x4 0x0
512#define MX35_PAD_LD19__GPIO3_25 0x1fc 0x660 0x000 0x5 0x0
513#define MX35_PAD_LD19__SDMA_SDMA_DEBUG_EVENT_CHANNEL_5 0x1fc 0x660 0x000 0x6 0x0
514#define MX35_PAD_LD19__ARM11P_TOP_TRACE_12 0x1fc 0x660 0x000 0x7 0x0
515#define MX35_PAD_LD20__IPU_DISPB_DAT_20 0x200 0x664 0x000 0x0 0x0
516#define MX35_PAD_LD20__IPU_DISPB_CS0 0x200 0x664 0x000 0x1 0x0
517#define MX35_PAD_LD20__IPU_DISPB_SD_CLK 0x200 0x664 0x000 0x2 0x0
518#define MX35_PAD_LD20__ESDHC3_DAT0 0x200 0x664 0x81c 0x3 0x0
519#define MX35_PAD_LD20__GPIO3_26 0x200 0x664 0x000 0x5 0x0
520#define MX35_PAD_LD20__SDMA_SDMA_DEBUG_CORE_STATUS_3 0x200 0x664 0x000 0x6 0x0
521#define MX35_PAD_LD20__ARM11P_TOP_TRACE_13 0x200 0x664 0x000 0x7 0x0
522#define MX35_PAD_LD21__IPU_DISPB_DAT_21 0x204 0x668 0x000 0x0 0x0
523#define MX35_PAD_LD21__IPU_DISPB_PAR_RS 0x204 0x668 0x000 0x1 0x0
524#define MX35_PAD_LD21__IPU_DISPB_SER_RS 0x204 0x668 0x000 0x2 0x0
525#define MX35_PAD_LD21__ESDHC3_DAT1 0x204 0x668 0x820 0x3 0x0
526#define MX35_PAD_LD21__USB_TOP_USBOTG_STP 0x204 0x668 0x000 0x4 0x0
527#define MX35_PAD_LD21__GPIO3_27 0x204 0x668 0x000 0x5 0x0
528#define MX35_PAD_LD21__SDMA_DEBUG_EVENT_CHANNEL_SEL 0x204 0x668 0x000 0x6 0x0
529#define MX35_PAD_LD21__ARM11P_TOP_TRACE_14 0x204 0x668 0x000 0x7 0x0
530#define MX35_PAD_LD22__IPU_DISPB_DAT_22 0x208 0x66c 0x000 0x0 0x0
531#define MX35_PAD_LD22__IPU_DISPB_WR 0x208 0x66c 0x000 0x1 0x0
532#define MX35_PAD_LD22__IPU_DISPB_SD_D_I 0x208 0x66c 0x92c 0x2 0x0
533#define MX35_PAD_LD22__ESDHC3_DAT2 0x208 0x66c 0x824 0x3 0x0
534#define MX35_PAD_LD22__USB_TOP_USBOTG_NXT 0x208 0x66c 0x9c8 0x4 0x0
535#define MX35_PAD_LD22__GPIO3_28 0x208 0x66c 0x000 0x5 0x0
536#define MX35_PAD_LD22__SDMA_DEBUG_BUS_ERROR 0x208 0x66c 0x000 0x6 0x0
537#define MX35_PAD_LD22__ARM11P_TOP_TRCTL 0x208 0x66c 0x000 0x7 0x0
538#define MX35_PAD_LD23__IPU_DISPB_DAT_23 0x20c 0x670 0x000 0x0 0x0
539#define MX35_PAD_LD23__IPU_DISPB_RD 0x20c 0x670 0x000 0x1 0x0
540#define MX35_PAD_LD23__IPU_DISPB_SD_D_IO 0x20c 0x670 0x92c 0x2 0x1
541#define MX35_PAD_LD23__ESDHC3_DAT3 0x20c 0x670 0x828 0x3 0x0
542#define MX35_PAD_LD23__USB_TOP_USBOTG_DATA_7 0x20c 0x670 0x9c0 0x4 0x0
543#define MX35_PAD_LD23__GPIO3_29 0x20c 0x670 0x000 0x5 0x0
544#define MX35_PAD_LD23__SDMA_DEBUG_MATCHED_DMBUS 0x20c 0x670 0x000 0x6 0x0
545#define MX35_PAD_LD23__ARM11P_TOP_TRCLK 0x20c 0x670 0x000 0x7 0x0
546#define MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC 0x210 0x674 0x000 0x0 0x0
547#define MX35_PAD_D3_HSYNC__IPU_DISPB_SD_D_IO 0x210 0x674 0x92c 0x2 0x2
548#define MX35_PAD_D3_HSYNC__GPIO3_30 0x210 0x674 0x000 0x5 0x0
549#define MX35_PAD_D3_HSYNC__SDMA_DEBUG_RTBUFFER_WRITE 0x210 0x674 0x000 0x6 0x0
550#define MX35_PAD_D3_HSYNC__ARM11P_TOP_TRACE_15 0x210 0x674 0x000 0x7 0x0
551#define MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK 0x214 0x678 0x000 0x0 0x0
552#define MX35_PAD_D3_FPSHIFT__IPU_DISPB_SD_CLK 0x214 0x678 0x000 0x2 0x0
553#define MX35_PAD_D3_FPSHIFT__GPIO3_31 0x214 0x678 0x000 0x5 0x0
554#define MX35_PAD_D3_FPSHIFT__SDMA_SDMA_DEBUG_CORE_STATUS_0 0x214 0x678 0x000 0x6 0x0
555#define MX35_PAD_D3_FPSHIFT__ARM11P_TOP_TRACE_16 0x214 0x678 0x000 0x7 0x0
556#define MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY 0x218 0x67c 0x000 0x0 0x0
557#define MX35_PAD_D3_DRDY__IPU_DISPB_SD_D_O 0x218 0x67c 0x000 0x2 0x0
558#define MX35_PAD_D3_DRDY__GPIO1_0 0x218 0x67c 0x82c 0x5 0x2
559#define MX35_PAD_D3_DRDY__SDMA_SDMA_DEBUG_CORE_STATUS_1 0x218 0x67c 0x000 0x6 0x0
560#define MX35_PAD_D3_DRDY__ARM11P_TOP_TRACE_17 0x218 0x67c 0x000 0x7 0x0
561#define MX35_PAD_CONTRAST__IPU_DISPB_CONTR 0x21c 0x680 0x000 0x0 0x0
562#define MX35_PAD_CONTRAST__GPIO1_1 0x21c 0x680 0x838 0x5 0x2
563#define MX35_PAD_CONTRAST__SDMA_SDMA_DEBUG_CORE_STATUS_2 0x21c 0x680 0x000 0x6 0x0
564#define MX35_PAD_CONTRAST__ARM11P_TOP_TRACE_18 0x21c 0x680 0x000 0x7 0x0
565#define MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC 0x220 0x684 0x000 0x0 0x0
566#define MX35_PAD_D3_VSYNC__IPU_DISPB_CS1 0x220 0x684 0x000 0x2 0x0
567#define MX35_PAD_D3_VSYNC__GPIO1_2 0x220 0x684 0x848 0x5 0x1
568#define MX35_PAD_D3_VSYNC__SDMA_DEBUG_YIELD 0x220 0x684 0x000 0x6 0x0
569#define MX35_PAD_D3_VSYNC__ARM11P_TOP_TRACE_19 0x220 0x684 0x000 0x7 0x0
570#define MX35_PAD_D3_REV__IPU_DISPB_D3_REV 0x224 0x688 0x000 0x0 0x0
571#define MX35_PAD_D3_REV__IPU_DISPB_SER_RS 0x224 0x688 0x000 0x2 0x0
572#define MX35_PAD_D3_REV__GPIO1_3 0x224 0x688 0x84c 0x5 0x1
573#define MX35_PAD_D3_REV__SDMA_DEBUG_BUS_RWB 0x224 0x688 0x000 0x6 0x0
574#define MX35_PAD_D3_REV__ARM11P_TOP_TRACE_20 0x224 0x688 0x000 0x7 0x0
575#define MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS 0x228 0x68c 0x000 0x0 0x0
576#define MX35_PAD_D3_CLS__IPU_DISPB_CS2 0x228 0x68c 0x000 0x2 0x0
577#define MX35_PAD_D3_CLS__GPIO1_4 0x228 0x68c 0x850 0x5 0x2
578#define MX35_PAD_D3_CLS__SDMA_DEBUG_BUS_DEVICE_0 0x228 0x68c 0x000 0x6 0x0
579#define MX35_PAD_D3_CLS__ARM11P_TOP_TRACE_21 0x228 0x68c 0x000 0x7 0x0
580#define MX35_PAD_D3_SPL__IPU_DISPB_D3_SPL 0x22c 0x690 0x000 0x0 0x0
581#define MX35_PAD_D3_SPL__IPU_DISPB_D12_VSYNC 0x22c 0x690 0x928 0x2 0x2
582#define MX35_PAD_D3_SPL__GPIO1_5 0x22c 0x690 0x854 0x5 0x2
583#define MX35_PAD_D3_SPL__SDMA_DEBUG_BUS_DEVICE_1 0x22c 0x690 0x000 0x6 0x0
584#define MX35_PAD_D3_SPL__ARM11P_TOP_TRACE_22 0x22c 0x690 0x000 0x7 0x0
585#define MX35_PAD_SD1_CMD__ESDHC1_CMD 0x230 0x694 0x000 0x0 0x0
586#define MX35_PAD_SD1_CMD__MSHC_SCLK 0x230 0x694 0x000 0x1 0x0
587#define MX35_PAD_SD1_CMD__IPU_DISPB_D0_VSYNC 0x230 0x694 0x924 0x3 0x2
588#define MX35_PAD_SD1_CMD__USB_TOP_USBOTG_DATA_4 0x230 0x694 0x9b4 0x4 0x0
589#define MX35_PAD_SD1_CMD__GPIO1_6 0x230 0x694 0x858 0x5 0x2
590#define MX35_PAD_SD1_CMD__ARM11P_TOP_TRCTL 0x230 0x694 0x000 0x7 0x0
591#define MX35_PAD_SD1_CLK__ESDHC1_CLK 0x234 0x698 0x000 0x0 0x0
592#define MX35_PAD_SD1_CLK__MSHC_BS 0x234 0x698 0x000 0x1 0x0
593#define MX35_PAD_SD1_CLK__IPU_DISPB_BCLK 0x234 0x698 0x000 0x3 0x0
594#define MX35_PAD_SD1_CLK__USB_TOP_USBOTG_DATA_5 0x234 0x698 0x9b8 0x4 0x0
595#define MX35_PAD_SD1_CLK__GPIO1_7 0x234 0x698 0x85c 0x5 0x2
596#define MX35_PAD_SD1_CLK__ARM11P_TOP_TRCLK 0x234 0x698 0x000 0x7 0x0
597#define MX35_PAD_SD1_DATA0__ESDHC1_DAT0 0x238 0x69c 0x000 0x0 0x0
598#define MX35_PAD_SD1_DATA0__MSHC_DATA_0 0x238 0x69c 0x000 0x1 0x0
599#define MX35_PAD_SD1_DATA0__IPU_DISPB_CS0 0x238 0x69c 0x000 0x3 0x0
600#define MX35_PAD_SD1_DATA0__USB_TOP_USBOTG_DATA_6 0x238 0x69c 0x9bc 0x4 0x0
601#define MX35_PAD_SD1_DATA0__GPIO1_8 0x238 0x69c 0x860 0x5 0x2
602#define MX35_PAD_SD1_DATA0__ARM11P_TOP_TRACE_23 0x238 0x69c 0x000 0x7 0x0
603#define MX35_PAD_SD1_DATA1__ESDHC1_DAT1 0x23c 0x6a0 0x000 0x0 0x0
604#define MX35_PAD_SD1_DATA1__MSHC_DATA_1 0x23c 0x6a0 0x000 0x1 0x0
605#define MX35_PAD_SD1_DATA1__IPU_DISPB_PAR_RS 0x23c 0x6a0 0x000 0x3 0x0
606#define MX35_PAD_SD1_DATA1__USB_TOP_USBOTG_DATA_0 0x23c 0x6a0 0x9a4 0x4 0x0
607#define MX35_PAD_SD1_DATA1__GPIO1_9 0x23c 0x6a0 0x864 0x5 0x1
608#define MX35_PAD_SD1_DATA1__ARM11P_TOP_TRACE_24 0x23c 0x6a0 0x000 0x7 0x0
609#define MX35_PAD_SD1_DATA2__ESDHC1_DAT2 0x240 0x6a4 0x000 0x0 0x0
610#define MX35_PAD_SD1_DATA2__MSHC_DATA_2 0x240 0x6a4 0x000 0x1 0x0
611#define MX35_PAD_SD1_DATA2__IPU_DISPB_WR 0x240 0x6a4 0x000 0x3 0x0
612#define MX35_PAD_SD1_DATA2__USB_TOP_USBOTG_DATA_1 0x240 0x6a4 0x9a8 0x4 0x0
613#define MX35_PAD_SD1_DATA2__GPIO1_10 0x240 0x6a4 0x830 0x5 0x1
614#define MX35_PAD_SD1_DATA2__ARM11P_TOP_TRACE_25 0x240 0x6a4 0x000 0x7 0x0
615#define MX35_PAD_SD1_DATA3__ESDHC1_DAT3 0x244 0x6a8 0x000 0x0 0x0
616#define MX35_PAD_SD1_DATA3__MSHC_DATA_3 0x244 0x6a8 0x000 0x1 0x0
617#define MX35_PAD_SD1_DATA3__IPU_DISPB_RD 0x244 0x6a8 0x000 0x3 0x0
618#define MX35_PAD_SD1_DATA3__USB_TOP_USBOTG_DATA_2 0x244 0x6a8 0x9ac 0x4 0x0
619#define MX35_PAD_SD1_DATA3__GPIO1_11 0x244 0x6a8 0x834 0x5 0x1
620#define MX35_PAD_SD1_DATA3__ARM11P_TOP_TRACE_26 0x244 0x6a8 0x000 0x7 0x0
621#define MX35_PAD_SD2_CMD__ESDHC2_CMD 0x248 0x6ac 0x000 0x0 0x0
622#define MX35_PAD_SD2_CMD__I2C3_SCL 0x248 0x6ac 0x91c 0x1 0x2
623#define MX35_PAD_SD2_CMD__ESDHC1_DAT4 0x248 0x6ac 0x804 0x2 0x0
624#define MX35_PAD_SD2_CMD__IPU_CSI_D_2 0x248 0x6ac 0x938 0x3 0x2
625#define MX35_PAD_SD2_CMD__USB_TOP_USBH2_DATA_4 0x248 0x6ac 0x9dc 0x4 0x0
626#define MX35_PAD_SD2_CMD__GPIO2_0 0x248 0x6ac 0x868 0x5 0x2
627#define MX35_PAD_SD2_CMD__SPDIF_SPDIF_OUT1 0x248 0x6ac 0x000 0x6 0x0
628#define MX35_PAD_SD2_CMD__IPU_DISPB_D12_VSYNC 0x248 0x6ac 0x928 0x7 0x3
629#define MX35_PAD_SD2_CLK__ESDHC2_CLK 0x24c 0x6b0 0x000 0x0 0x0
630#define MX35_PAD_SD2_CLK__I2C3_SDA 0x24c 0x6b0 0x920 0x1 0x2
631#define MX35_PAD_SD2_CLK__ESDHC1_DAT5 0x24c 0x6b0 0x808 0x2 0x0
632#define MX35_PAD_SD2_CLK__IPU_CSI_D_3 0x24c 0x6b0 0x93c 0x3 0x2
633#define MX35_PAD_SD2_CLK__USB_TOP_USBH2_DATA_5 0x24c 0x6b0 0x9e0 0x4 0x0
634#define MX35_PAD_SD2_CLK__GPIO2_1 0x24c 0x6b0 0x894 0x5 0x1
635#define MX35_PAD_SD2_CLK__SPDIF_SPDIF_IN1 0x24c 0x6b0 0x998 0x6 0x2
636#define MX35_PAD_SD2_CLK__IPU_DISPB_CS2 0x24c 0x6b0 0x000 0x7 0x0
637#define MX35_PAD_SD2_DATA0__ESDHC2_DAT0 0x250 0x6b4 0x000 0x0 0x0
638#define MX35_PAD_SD2_DATA0__UART3_RXD_MUX 0x250 0x6b4 0x9a0 0x1 0x1
639#define MX35_PAD_SD2_DATA0__ESDHC1_DAT6 0x250 0x6b4 0x80c 0x2 0x0
640#define MX35_PAD_SD2_DATA0__IPU_CSI_D_4 0x250 0x6b4 0x940 0x3 0x1
641#define MX35_PAD_SD2_DATA0__USB_TOP_USBH2_DATA_6 0x250 0x6b4 0x9e4 0x4 0x0
642#define MX35_PAD_SD2_DATA0__GPIO2_2 0x250 0x6b4 0x8c0 0x5 0x1
643#define MX35_PAD_SD2_DATA0__SPDIF_SPDIF_EXTCLK 0x250 0x6b4 0x994 0x6 0x3
644#define MX35_PAD_SD2_DATA1__ESDHC2_DAT1 0x254 0x6b8 0x000 0x0 0x0
645#define MX35_PAD_SD2_DATA1__UART3_TXD_MUX 0x254 0x6b8 0x000 0x1 0x0
646#define MX35_PAD_SD2_DATA1__ESDHC1_DAT7 0x254 0x6b8 0x810 0x2 0x0
647#define MX35_PAD_SD2_DATA1__IPU_CSI_D_5 0x254 0x6b8 0x944 0x3 0x1
648#define MX35_PAD_SD2_DATA1__USB_TOP_USBH2_DATA_0 0x254 0x6b8 0x9cc 0x4 0x0
649#define MX35_PAD_SD2_DATA1__GPIO2_3 0x254 0x6b8 0x8cc 0x5 0x1
650#define MX35_PAD_SD2_DATA2__ESDHC2_DAT2 0x258 0x6bc 0x000 0x0 0x0
651#define MX35_PAD_SD2_DATA2__UART3_RTS 0x258 0x6bc 0x99c 0x1 0x0
652#define MX35_PAD_SD2_DATA2__CAN1_RXCAN 0x258 0x6bc 0x7c8 0x2 0x1
653#define MX35_PAD_SD2_DATA2__IPU_CSI_D_6 0x258 0x6bc 0x948 0x3 0x1
654#define MX35_PAD_SD2_DATA2__USB_TOP_USBH2_DATA_1 0x258 0x6bc 0x9d0 0x4 0x0
655#define MX35_PAD_SD2_DATA2__GPIO2_4 0x258 0x6bc 0x8d0 0x5 0x1
656#define MX35_PAD_SD2_DATA3__ESDHC2_DAT3 0x25c 0x6c0 0x000 0x0 0x0
657#define MX35_PAD_SD2_DATA3__UART3_CTS 0x25c 0x6c0 0x000 0x1 0x0
658#define MX35_PAD_SD2_DATA3__CAN1_TXCAN 0x25c 0x6c0 0x000 0x2 0x0
659#define MX35_PAD_SD2_DATA3__IPU_CSI_D_7 0x25c 0x6c0 0x94c 0x3 0x1
660#define MX35_PAD_SD2_DATA3__USB_TOP_USBH2_DATA_2 0x25c 0x6c0 0x9d4 0x4 0x0
661#define MX35_PAD_SD2_DATA3__GPIO2_5 0x25c 0x6c0 0x8d4 0x5 0x1
662#define MX35_PAD_ATA_CS0__ATA_CS0 0x260 0x6c4 0x000 0x0 0x0
663#define MX35_PAD_ATA_CS0__CSPI1_SS3 0x260 0x6c4 0x7dc 0x1 0x1
664#define MX35_PAD_ATA_CS0__IPU_DISPB_CS1 0x260 0x6c4 0x000 0x3 0x0
665#define MX35_PAD_ATA_CS0__GPIO2_6 0x260 0x6c4 0x8d8 0x5 0x1
666#define MX35_PAD_ATA_CS0__IPU_DIAGB_0 0x260 0x6c4 0x000 0x6 0x0
667#define MX35_PAD_ATA_CS0__ARM11P_TOP_MAX1_HMASTER_0 0x260 0x6c4 0x000 0x7 0x0
668#define MX35_PAD_ATA_CS1__ATA_CS1 0x264 0x6c8 0x000 0x0 0x0
669#define MX35_PAD_ATA_CS1__IPU_DISPB_CS2 0x264 0x6c8 0x000 0x3 0x0
670#define MX35_PAD_ATA_CS1__CSPI2_SS0 0x264 0x6c8 0x7f0 0x4 0x1
671#define MX35_PAD_ATA_CS1__GPIO2_7 0x264 0x6c8 0x8dc 0x5 0x1
672#define MX35_PAD_ATA_CS1__IPU_DIAGB_1 0x264 0x6c8 0x000 0x6 0x0
673#define MX35_PAD_ATA_CS1__ARM11P_TOP_MAX1_HMASTER_1 0x264 0x6c8 0x000 0x7 0x0
674#define MX35_PAD_ATA_DIOR__ATA_DIOR 0x268 0x6cc 0x000 0x0 0x0
675#define MX35_PAD_ATA_DIOR__ESDHC3_DAT0 0x268 0x6cc 0x81c 0x1 0x1
676#define MX35_PAD_ATA_DIOR__USB_TOP_USBOTG_DIR 0x268 0x6cc 0x9c4 0x2 0x1
677#define MX35_PAD_ATA_DIOR__IPU_DISPB_BE0 0x268 0x6cc 0x000 0x3 0x0
678#define MX35_PAD_ATA_DIOR__CSPI2_SS1 0x268 0x6cc 0x7f4 0x4 0x1
679#define MX35_PAD_ATA_DIOR__GPIO2_8 0x268 0x6cc 0x8e0 0x5 0x1
680#define MX35_PAD_ATA_DIOR__IPU_DIAGB_2 0x268 0x6cc 0x000 0x6 0x0
681#define MX35_PAD_ATA_DIOR__ARM11P_TOP_MAX1_HMASTER_2 0x268 0x6cc 0x000 0x7 0x0
682#define MX35_PAD_ATA_DIOW__ATA_DIOW 0x26c 0x6d0 0x000 0x0 0x0
683#define MX35_PAD_ATA_DIOW__ESDHC3_DAT1 0x26c 0x6d0 0x820 0x1 0x1
684#define MX35_PAD_ATA_DIOW__USB_TOP_USBOTG_STP 0x26c 0x6d0 0x000 0x2 0x0
685#define MX35_PAD_ATA_DIOW__IPU_DISPB_BE1 0x26c 0x6d0 0x000 0x3 0x0
686#define MX35_PAD_ATA_DIOW__CSPI2_MOSI 0x26c 0x6d0 0x7ec 0x4 0x2
687#define MX35_PAD_ATA_DIOW__GPIO2_9 0x26c 0x6d0 0x8e4 0x5 0x1
688#define MX35_PAD_ATA_DIOW__IPU_DIAGB_3 0x26c 0x6d0 0x000 0x6 0x0
689#define MX35_PAD_ATA_DIOW__ARM11P_TOP_MAX1_HMASTER_3 0x26c 0x6d0 0x000 0x7 0x0
690#define MX35_PAD_ATA_DMACK__ATA_DMACK 0x270 0x6d4 0x000 0x0 0x0
691#define MX35_PAD_ATA_DMACK__ESDHC3_DAT2 0x270 0x6d4 0x824 0x1 0x1
692#define MX35_PAD_ATA_DMACK__USB_TOP_USBOTG_NXT 0x270 0x6d4 0x9c8 0x2 0x1
693#define MX35_PAD_ATA_DMACK__CSPI2_MISO 0x270 0x6d4 0x7e8 0x4 0x2
694#define MX35_PAD_ATA_DMACK__GPIO2_10 0x270 0x6d4 0x86c 0x5 0x1
695#define MX35_PAD_ATA_DMACK__IPU_DIAGB_4 0x270 0x6d4 0x000 0x6 0x0
696#define MX35_PAD_ATA_DMACK__ARM11P_TOP_MAX0_HMASTER_0 0x270 0x6d4 0x000 0x7 0x0
697#define MX35_PAD_ATA_RESET_B__ATA_RESET_B 0x274 0x6d8 0x000 0x0 0x0
698#define MX35_PAD_ATA_RESET_B__ESDHC3_DAT3 0x274 0x6d8 0x828 0x1 0x1
699#define MX35_PAD_ATA_RESET_B__USB_TOP_USBOTG_DATA_0 0x274 0x6d8 0x9a4 0x2 0x1
700#define MX35_PAD_ATA_RESET_B__IPU_DISPB_SD_D_O 0x274 0x6d8 0x000 0x3 0x0
701#define MX35_PAD_ATA_RESET_B__CSPI2_RDY 0x274 0x6d8 0x7e4 0x4 0x2
702#define MX35_PAD_ATA_RESET_B__GPIO2_11 0x274 0x6d8 0x870 0x5 0x1
703#define MX35_PAD_ATA_RESET_B__IPU_DIAGB_5 0x274 0x6d8 0x000 0x6 0x0
704#define MX35_PAD_ATA_RESET_B__ARM11P_TOP_MAX0_HMASTER_1 0x274 0x6d8 0x000 0x7 0x0
705#define MX35_PAD_ATA_IORDY__ATA_IORDY 0x278 0x6dc 0x000 0x0 0x0
706#define MX35_PAD_ATA_IORDY__ESDHC3_DAT4 0x278 0x6dc 0x000 0x1 0x0
707#define MX35_PAD_ATA_IORDY__USB_TOP_USBOTG_DATA_1 0x278 0x6dc 0x9a8 0x2 0x1
708#define MX35_PAD_ATA_IORDY__IPU_DISPB_SD_D_IO 0x278 0x6dc 0x92c 0x3 0x3
709#define MX35_PAD_ATA_IORDY__ESDHC2_DAT4 0x278 0x6dc 0x000 0x4 0x0
710#define MX35_PAD_ATA_IORDY__GPIO2_12 0x278 0x6dc 0x874 0x5 0x1
711#define MX35_PAD_ATA_IORDY__IPU_DIAGB_6 0x278 0x6dc 0x000 0x6 0x0
712#define MX35_PAD_ATA_IORDY__ARM11P_TOP_MAX0_HMASTER_2 0x278 0x6dc 0x000 0x7 0x0
713#define MX35_PAD_ATA_DATA0__ATA_DATA_0 0x27c 0x6e0 0x000 0x0 0x0
714#define MX35_PAD_ATA_DATA0__ESDHC3_DAT5 0x27c 0x6e0 0x000 0x1 0x0
715#define MX35_PAD_ATA_DATA0__USB_TOP_USBOTG_DATA_2 0x27c 0x6e0 0x9ac 0x2 0x1
716#define MX35_PAD_ATA_DATA0__IPU_DISPB_D12_VSYNC 0x27c 0x6e0 0x928 0x3 0x4
717#define MX35_PAD_ATA_DATA0__ESDHC2_DAT5 0x27c 0x6e0 0x000 0x4 0x0
718#define MX35_PAD_ATA_DATA0__GPIO2_13 0x27c 0x6e0 0x878 0x5 0x1
719#define MX35_PAD_ATA_DATA0__IPU_DIAGB_7 0x27c 0x6e0 0x000 0x6 0x0
720#define MX35_PAD_ATA_DATA0__ARM11P_TOP_MAX0_HMASTER_3 0x27c 0x6e0 0x000 0x7 0x0
721#define MX35_PAD_ATA_DATA1__ATA_DATA_1 0x280 0x6e4 0x000 0x0 0x0
722#define MX35_PAD_ATA_DATA1__ESDHC3_DAT6 0x280 0x6e4 0x000 0x1 0x0
723#define MX35_PAD_ATA_DATA1__USB_TOP_USBOTG_DATA_3 0x280 0x6e4 0x9b0 0x2 0x1
724#define MX35_PAD_ATA_DATA1__IPU_DISPB_SD_CLK 0x280 0x6e4 0x000 0x3 0x0
725#define MX35_PAD_ATA_DATA1__ESDHC2_DAT6 0x280 0x6e4 0x000 0x4 0x0
726#define MX35_PAD_ATA_DATA1__GPIO2_14 0x280 0x6e4 0x87c 0x5 0x1
727#define MX35_PAD_ATA_DATA1__IPU_DIAGB_8 0x280 0x6e4 0x000 0x6 0x0
728#define MX35_PAD_ATA_DATA1__ARM11P_TOP_TRACE_27 0x280 0x6e4 0x000 0x7 0x0
729#define MX35_PAD_ATA_DATA2__ATA_DATA_2 0x284 0x6e8 0x000 0x0 0x0
730#define MX35_PAD_ATA_DATA2__ESDHC3_DAT7 0x284 0x6e8 0x000 0x1 0x0
731#define MX35_PAD_ATA_DATA2__USB_TOP_USBOTG_DATA_4 0x284 0x6e8 0x9b4 0x2 0x1
732#define MX35_PAD_ATA_DATA2__IPU_DISPB_SER_RS 0x284 0x6e8 0x000 0x3 0x0
733#define MX35_PAD_ATA_DATA2__ESDHC2_DAT7 0x284 0x6e8 0x000 0x4 0x0
734#define MX35_PAD_ATA_DATA2__GPIO2_15 0x284 0x6e8 0x880 0x5 0x1
735#define MX35_PAD_ATA_DATA2__IPU_DIAGB_9 0x284 0x6e8 0x000 0x6 0x0
736#define MX35_PAD_ATA_DATA2__ARM11P_TOP_TRACE_28 0x284 0x6e8 0x000 0x7 0x0
737#define MX35_PAD_ATA_DATA3__ATA_DATA_3 0x288 0x6ec 0x000 0x0 0x0
738#define MX35_PAD_ATA_DATA3__ESDHC3_CLK 0x288 0x6ec 0x814 0x1 0x1
739#define MX35_PAD_ATA_DATA3__USB_TOP_USBOTG_DATA_5 0x288 0x6ec 0x9b8 0x2 0x1
740#define MX35_PAD_ATA_DATA3__CSPI2_SCLK 0x288 0x6ec 0x7e0 0x4 0x2
741#define MX35_PAD_ATA_DATA3__GPIO2_16 0x288 0x6ec 0x884 0x5 0x1
742#define MX35_PAD_ATA_DATA3__IPU_DIAGB_10 0x288 0x6ec 0x000 0x6 0x0
743#define MX35_PAD_ATA_DATA3__ARM11P_TOP_TRACE_29 0x288 0x6ec 0x000 0x7 0x0
744#define MX35_PAD_ATA_DATA4__ATA_DATA_4 0x28c 0x6f0 0x000 0x0 0x0
745#define MX35_PAD_ATA_DATA4__ESDHC3_CMD 0x28c 0x6f0 0x818 0x1 0x1
746#define MX35_PAD_ATA_DATA4__USB_TOP_USBOTG_DATA_6 0x28c 0x6f0 0x9bc 0x2 0x1
747#define MX35_PAD_ATA_DATA4__GPIO2_17 0x28c 0x6f0 0x888 0x5 0x1
748#define MX35_PAD_ATA_DATA4__IPU_DIAGB_11 0x28c 0x6f0 0x000 0x6 0x0
749#define MX35_PAD_ATA_DATA4__ARM11P_TOP_TRACE_30 0x28c 0x6f0 0x000 0x7 0x0
750#define MX35_PAD_ATA_DATA5__ATA_DATA_5 0x290 0x6f4 0x000 0x0 0x0
751#define MX35_PAD_ATA_DATA5__USB_TOP_USBOTG_DATA_7 0x290 0x6f4 0x9c0 0x2 0x1
752#define MX35_PAD_ATA_DATA5__GPIO2_18 0x290 0x6f4 0x88c 0x5 0x1
753#define MX35_PAD_ATA_DATA5__IPU_DIAGB_12 0x290 0x6f4 0x000 0x6 0x0
754#define MX35_PAD_ATA_DATA5__ARM11P_TOP_TRACE_31 0x290 0x6f4 0x000 0x7 0x0
755#define MX35_PAD_ATA_DATA6__ATA_DATA_6 0x294 0x6f8 0x000 0x0 0x0
756#define MX35_PAD_ATA_DATA6__CAN1_TXCAN 0x294 0x6f8 0x000 0x1 0x0
757#define MX35_PAD_ATA_DATA6__UART1_DTR 0x294 0x6f8 0x000 0x2 0x0
758#define MX35_PAD_ATA_DATA6__AUDMUX_AUD6_TXD 0x294 0x6f8 0x7b4 0x3 0x0
759#define MX35_PAD_ATA_DATA6__GPIO2_19 0x294 0x6f8 0x890 0x5 0x1
760#define MX35_PAD_ATA_DATA6__IPU_DIAGB_13 0x294 0x6f8 0x000 0x6 0x0
761#define MX35_PAD_ATA_DATA7__ATA_DATA_7 0x298 0x6fc 0x000 0x0 0x0
762#define MX35_PAD_ATA_DATA7__CAN1_RXCAN 0x298 0x6fc 0x7c8 0x1 0x2
763#define MX35_PAD_ATA_DATA7__UART1_DSR 0x298 0x6fc 0x000 0x2 0x0
764#define MX35_PAD_ATA_DATA7__AUDMUX_AUD6_RXD 0x298 0x6fc 0x7b0 0x3 0x0
765#define MX35_PAD_ATA_DATA7__GPIO2_20 0x298 0x6fc 0x898 0x5 0x1
766#define MX35_PAD_ATA_DATA7__IPU_DIAGB_14 0x298 0x6fc 0x000 0x6 0x0
767#define MX35_PAD_ATA_DATA8__ATA_DATA_8 0x29c 0x700 0x000 0x0 0x0
768#define MX35_PAD_ATA_DATA8__UART3_RTS 0x29c 0x700 0x99c 0x1 0x1
769#define MX35_PAD_ATA_DATA8__UART1_RI 0x29c 0x700 0x000 0x2 0x0
770#define MX35_PAD_ATA_DATA8__AUDMUX_AUD6_TXC 0x29c 0x700 0x7c0 0x3 0x0
771#define MX35_PAD_ATA_DATA8__GPIO2_21 0x29c 0x700 0x89c 0x5 0x1
772#define MX35_PAD_ATA_DATA8__IPU_DIAGB_15 0x29c 0x700 0x000 0x6 0x0
773#define MX35_PAD_ATA_DATA9__ATA_DATA_9 0x2a0 0x704 0x000 0x0 0x0
774#define MX35_PAD_ATA_DATA9__UART3_CTS 0x2a0 0x704 0x000 0x1 0x0
775#define MX35_PAD_ATA_DATA9__UART1_DCD 0x2a0 0x704 0x000 0x2 0x0
776#define MX35_PAD_ATA_DATA9__AUDMUX_AUD6_TXFS 0x2a0 0x704 0x7c4 0x3 0x0
777#define MX35_PAD_ATA_DATA9__GPIO2_22 0x2a0 0x704 0x8a0 0x5 0x1
778#define MX35_PAD_ATA_DATA9__IPU_DIAGB_16 0x2a0 0x704 0x000 0x6 0x0
779#define MX35_PAD_ATA_DATA10__ATA_DATA_10 0x2a4 0x708 0x000 0x0 0x0
780#define MX35_PAD_ATA_DATA10__UART3_RXD_MUX 0x2a4 0x708 0x9a0 0x1 0x2
781#define MX35_PAD_ATA_DATA10__AUDMUX_AUD6_RXC 0x2a4 0x708 0x7b8 0x3 0x0
782#define MX35_PAD_ATA_DATA10__GPIO2_23 0x2a4 0x708 0x8a4 0x5 0x1
783#define MX35_PAD_ATA_DATA10__IPU_DIAGB_17 0x2a4 0x708 0x000 0x6 0x0
784#define MX35_PAD_ATA_DATA11__ATA_DATA_11 0x2a8 0x70c 0x000 0x0 0x0
785#define MX35_PAD_ATA_DATA11__UART3_TXD_MUX 0x2a8 0x70c 0x000 0x1 0x0
786#define MX35_PAD_ATA_DATA11__AUDMUX_AUD6_RXFS 0x2a8 0x70c 0x7bc 0x3 0x0
787#define MX35_PAD_ATA_DATA11__GPIO2_24 0x2a8 0x70c 0x8a8 0x5 0x1
788#define MX35_PAD_ATA_DATA11__IPU_DIAGB_18 0x2a8 0x70c 0x000 0x6 0x0
789#define MX35_PAD_ATA_DATA12__ATA_DATA_12 0x2ac 0x710 0x000 0x0 0x0
790#define MX35_PAD_ATA_DATA12__I2C3_SCL 0x2ac 0x710 0x91c 0x1 0x3
791#define MX35_PAD_ATA_DATA12__GPIO2_25 0x2ac 0x710 0x8ac 0x5 0x1
792#define MX35_PAD_ATA_DATA12__IPU_DIAGB_19 0x2ac 0x710 0x000 0x6 0x0
793#define MX35_PAD_ATA_DATA13__ATA_DATA_13 0x2b0 0x714 0x000 0x0 0x0
794#define MX35_PAD_ATA_DATA13__I2C3_SDA 0x2b0 0x714 0x920 0x1 0x3
795#define MX35_PAD_ATA_DATA13__GPIO2_26 0x2b0 0x714 0x8b0 0x5 0x1
796#define MX35_PAD_ATA_DATA13__IPU_DIAGB_20 0x2b0 0x714 0x000 0x6 0x0
797#define MX35_PAD_ATA_DATA14__ATA_DATA_14 0x2b4 0x718 0x000 0x0 0x0
798#define MX35_PAD_ATA_DATA14__IPU_CSI_D_0 0x2b4 0x718 0x930 0x1 0x2
799#define MX35_PAD_ATA_DATA14__KPP_ROW_0 0x2b4 0x718 0x970 0x3 0x2
800#define MX35_PAD_ATA_DATA14__GPIO2_27 0x2b4 0x718 0x8b4 0x5 0x1
801#define MX35_PAD_ATA_DATA14__IPU_DIAGB_21 0x2b4 0x718 0x000 0x6 0x0
802#define MX35_PAD_ATA_DATA15__ATA_DATA_15 0x2b8 0x71c 0x000 0x0 0x0
803#define MX35_PAD_ATA_DATA15__IPU_CSI_D_1 0x2b8 0x71c 0x934 0x1 0x2
804#define MX35_PAD_ATA_DATA15__KPP_ROW_1 0x2b8 0x71c 0x974 0x3 0x2
805#define MX35_PAD_ATA_DATA15__GPIO2_28 0x2b8 0x71c 0x8b8 0x5 0x1
806#define MX35_PAD_ATA_DATA15__IPU_DIAGB_22 0x2b8 0x71c 0x000 0x6 0x0
807#define MX35_PAD_ATA_INTRQ__ATA_INTRQ 0x2bc 0x720 0x000 0x0 0x0
808#define MX35_PAD_ATA_INTRQ__IPU_CSI_D_2 0x2bc 0x720 0x938 0x1 0x3
809#define MX35_PAD_ATA_INTRQ__KPP_ROW_2 0x2bc 0x720 0x978 0x3 0x2
810#define MX35_PAD_ATA_INTRQ__GPIO2_29 0x2bc 0x720 0x8bc 0x5 0x1
811#define MX35_PAD_ATA_INTRQ__IPU_DIAGB_23 0x2bc 0x720 0x000 0x6 0x0
812#define MX35_PAD_ATA_BUFF_EN__ATA_BUFFER_EN 0x2c0 0x724 0x000 0x0 0x0
813#define MX35_PAD_ATA_BUFF_EN__IPU_CSI_D_3 0x2c0 0x724 0x93c 0x1 0x3
814#define MX35_PAD_ATA_BUFF_EN__KPP_ROW_3 0x2c0 0x724 0x97c 0x3 0x2
815#define MX35_PAD_ATA_BUFF_EN__GPIO2_30 0x2c0 0x724 0x8c4 0x5 0x1
816#define MX35_PAD_ATA_BUFF_EN__IPU_DIAGB_24 0x2c0 0x724 0x000 0x6 0x0
817#define MX35_PAD_ATA_DMARQ__ATA_DMARQ 0x2c4 0x728 0x000 0x0 0x0
818#define MX35_PAD_ATA_DMARQ__IPU_CSI_D_4 0x2c4 0x728 0x940 0x1 0x2
819#define MX35_PAD_ATA_DMARQ__KPP_COL_0 0x2c4 0x728 0x950 0x3 0x2
820#define MX35_PAD_ATA_DMARQ__GPIO2_31 0x2c4 0x728 0x8c8 0x5 0x1
821#define MX35_PAD_ATA_DMARQ__IPU_DIAGB_25 0x2c4 0x728 0x000 0x6 0x0
822#define MX35_PAD_ATA_DMARQ__ECT_CTI_TRIG_IN1_4 0x2c4 0x728 0x000 0x7 0x0
823#define MX35_PAD_ATA_DA0__ATA_DA_0 0x2c8 0x72c 0x000 0x0 0x0
824#define MX35_PAD_ATA_DA0__IPU_CSI_D_5 0x2c8 0x72c 0x944 0x1 0x2
825#define MX35_PAD_ATA_DA0__KPP_COL_1 0x2c8 0x72c 0x954 0x3 0x2
826#define MX35_PAD_ATA_DA0__GPIO3_0 0x2c8 0x72c 0x8e8 0x5 0x1
827#define MX35_PAD_ATA_DA0__IPU_DIAGB_26 0x2c8 0x72c 0x000 0x6 0x0
828#define MX35_PAD_ATA_DA0__ECT_CTI_TRIG_IN1_5 0x2c8 0x72c 0x000 0x7 0x0
829#define MX35_PAD_ATA_DA1__ATA_DA_1 0x2cc 0x730 0x000 0x0 0x0
830#define MX35_PAD_ATA_DA1__IPU_CSI_D_6 0x2cc 0x730 0x948 0x1 0x2
831#define MX35_PAD_ATA_DA1__KPP_COL_2 0x2cc 0x730 0x958 0x3 0x2
832#define MX35_PAD_ATA_DA1__GPIO3_1 0x2cc 0x730 0x000 0x5 0x0
833#define MX35_PAD_ATA_DA1__IPU_DIAGB_27 0x2cc 0x730 0x000 0x6 0x0
834#define MX35_PAD_ATA_DA1__ECT_CTI_TRIG_IN1_6 0x2cc 0x730 0x000 0x7 0x0
835#define MX35_PAD_ATA_DA2__ATA_DA_2 0x2d0 0x734 0x000 0x0 0x0
836#define MX35_PAD_ATA_DA2__IPU_CSI_D_7 0x2d0 0x734 0x94c 0x1 0x2
837#define MX35_PAD_ATA_DA2__KPP_COL_3 0x2d0 0x734 0x95c 0x3 0x2
838#define MX35_PAD_ATA_DA2__GPIO3_2 0x2d0 0x734 0x000 0x5 0x0
839#define MX35_PAD_ATA_DA2__IPU_DIAGB_28 0x2d0 0x734 0x000 0x6 0x0
840#define MX35_PAD_ATA_DA2__ECT_CTI_TRIG_IN1_7 0x2d0 0x734 0x000 0x7 0x0
841#define MX35_PAD_MLB_CLK__MLB_MLBCLK 0x2d4 0x738 0x000 0x0 0x0
842#define MX35_PAD_MLB_CLK__GPIO3_3 0x2d4 0x738 0x000 0x5 0x0
843#define MX35_PAD_MLB_DAT__MLB_MLBDAT 0x2d8 0x73c 0x000 0x0 0x0
844#define MX35_PAD_MLB_DAT__GPIO3_4 0x2d8 0x73c 0x904 0x5 0x1
845#define MX35_PAD_MLB_SIG__MLB_MLBSIG 0x2dc 0x740 0x000 0x0 0x0
846#define MX35_PAD_MLB_SIG__GPIO3_5 0x2dc 0x740 0x908 0x5 0x1
847#define MX35_PAD_FEC_TX_CLK__FEC_TX_CLK 0x2e0 0x744 0x000 0x0 0x0
848#define MX35_PAD_FEC_TX_CLK__ESDHC1_DAT4 0x2e0 0x744 0x804 0x1 0x1
849#define MX35_PAD_FEC_TX_CLK__UART3_RXD_MUX 0x2e0 0x744 0x9a0 0x2 0x3
850#define MX35_PAD_FEC_TX_CLK__USB_TOP_USBH2_DIR 0x2e0 0x744 0x9ec 0x3 0x1
851#define MX35_PAD_FEC_TX_CLK__CSPI2_MOSI 0x2e0 0x744 0x7ec 0x4 0x3
852#define MX35_PAD_FEC_TX_CLK__GPIO3_6 0x2e0 0x744 0x90c 0x5 0x1
853#define MX35_PAD_FEC_TX_CLK__IPU_DISPB_D12_VSYNC 0x2e0 0x744 0x928 0x6 0x5
854#define MX35_PAD_FEC_TX_CLK__ARM11P_TOP_EVNTBUS_0 0x2e0 0x744 0x000 0x7 0x0
855#define MX35_PAD_FEC_RX_CLK__FEC_RX_CLK 0x2e4 0x748 0x000 0x0 0x0
856#define MX35_PAD_FEC_RX_CLK__ESDHC1_DAT5 0x2e4 0x748 0x808 0x1 0x1
857#define MX35_PAD_FEC_RX_CLK__UART3_TXD_MUX 0x2e4 0x748 0x000 0x2 0x0
858#define MX35_PAD_FEC_RX_CLK__USB_TOP_USBH2_STP 0x2e4 0x748 0x000 0x3 0x0
859#define MX35_PAD_FEC_RX_CLK__CSPI2_MISO 0x2e4 0x748 0x7e8 0x4 0x3
860#define MX35_PAD_FEC_RX_CLK__GPIO3_7 0x2e4 0x748 0x910 0x5 0x1
861#define MX35_PAD_FEC_RX_CLK__IPU_DISPB_SD_D_I 0x2e4 0x748 0x92c 0x6 0x4
862#define MX35_PAD_FEC_RX_CLK__ARM11P_TOP_EVNTBUS_1 0x2e4 0x748 0x000 0x7 0x0
863#define MX35_PAD_FEC_RX_DV__FEC_RX_DV 0x2e8 0x74c 0x000 0x0 0x0
864#define MX35_PAD_FEC_RX_DV__ESDHC1_DAT6 0x2e8 0x74c 0x80c 0x1 0x1
865#define MX35_PAD_FEC_RX_DV__UART3_RTS 0x2e8 0x74c 0x99c 0x2 0x2
866#define MX35_PAD_FEC_RX_DV__USB_TOP_USBH2_NXT 0x2e8 0x74c 0x9f0 0x3 0x1
867#define MX35_PAD_FEC_RX_DV__CSPI2_SCLK 0x2e8 0x74c 0x7e0 0x4 0x3
868#define MX35_PAD_FEC_RX_DV__GPIO3_8 0x2e8 0x74c 0x914 0x5 0x1
869#define MX35_PAD_FEC_RX_DV__IPU_DISPB_SD_CLK 0x2e8 0x74c 0x000 0x6 0x0
870#define MX35_PAD_FEC_RX_DV__ARM11P_TOP_EVNTBUS_2 0x2e8 0x74c 0x000 0x7 0x0
871#define MX35_PAD_FEC_COL__FEC_COL 0x2ec 0x750 0x000 0x0 0x0
872#define MX35_PAD_FEC_COL__ESDHC1_DAT7 0x2ec 0x750 0x810 0x1 0x1
873#define MX35_PAD_FEC_COL__UART3_CTS 0x2ec 0x750 0x000 0x2 0x0
874#define MX35_PAD_FEC_COL__USB_TOP_USBH2_DATA_0 0x2ec 0x750 0x9cc 0x3 0x1
875#define MX35_PAD_FEC_COL__CSPI2_RDY 0x2ec 0x750 0x7e4 0x4 0x3
876#define MX35_PAD_FEC_COL__GPIO3_9 0x2ec 0x750 0x918 0x5 0x1
877#define MX35_PAD_FEC_COL__IPU_DISPB_SER_RS 0x2ec 0x750 0x000 0x6 0x0
878#define MX35_PAD_FEC_COL__ARM11P_TOP_EVNTBUS_3 0x2ec 0x750 0x000 0x7 0x0
879#define MX35_PAD_FEC_RDATA0__FEC_RDATA_0 0x2f0 0x754 0x000 0x0 0x0
880#define MX35_PAD_FEC_RDATA0__PWM_PWMO 0x2f0 0x754 0x000 0x1 0x0
881#define MX35_PAD_FEC_RDATA0__UART3_DTR 0x2f0 0x754 0x000 0x2 0x0
882#define MX35_PAD_FEC_RDATA0__USB_TOP_USBH2_DATA_1 0x2f0 0x754 0x9d0 0x3 0x1
883#define MX35_PAD_FEC_RDATA0__CSPI2_SS0 0x2f0 0x754 0x7f0 0x4 0x2
884#define MX35_PAD_FEC_RDATA0__GPIO3_10 0x2f0 0x754 0x8ec 0x5 0x1
885#define MX35_PAD_FEC_RDATA0__IPU_DISPB_CS1 0x2f0 0x754 0x000 0x6 0x0
886#define MX35_PAD_FEC_RDATA0__ARM11P_TOP_EVNTBUS_4 0x2f0 0x754 0x000 0x7 0x0
887#define MX35_PAD_FEC_TDATA0__FEC_TDATA_0 0x2f4 0x758 0x000 0x0 0x0
888#define MX35_PAD_FEC_TDATA0__SPDIF_SPDIF_OUT1 0x2f4 0x758 0x000 0x1 0x0
889#define MX35_PAD_FEC_TDATA0__UART3_DSR 0x2f4 0x758 0x000 0x2 0x0
890#define MX35_PAD_FEC_TDATA0__USB_TOP_USBH2_DATA_2 0x2f4 0x758 0x9d4 0x3 0x1
891#define MX35_PAD_FEC_TDATA0__CSPI2_SS1 0x2f4 0x758 0x7f4 0x4 0x2
892#define MX35_PAD_FEC_TDATA0__GPIO3_11 0x2f4 0x758 0x8f0 0x5 0x1
893#define MX35_PAD_FEC_TDATA0__IPU_DISPB_CS0 0x2f4 0x758 0x000 0x6 0x0
894#define MX35_PAD_FEC_TDATA0__ARM11P_TOP_EVNTBUS_5 0x2f4 0x758 0x000 0x7 0x0
895#define MX35_PAD_FEC_TX_EN__FEC_TX_EN 0x2f8 0x75c 0x000 0x0 0x0
896#define MX35_PAD_FEC_TX_EN__SPDIF_SPDIF_IN1 0x2f8 0x75c 0x998 0x1 0x3
897#define MX35_PAD_FEC_TX_EN__UART3_RI 0x2f8 0x75c 0x000 0x2 0x0
898#define MX35_PAD_FEC_TX_EN__USB_TOP_USBH2_DATA_3 0x2f8 0x75c 0x9d8 0x3 0x1
899#define MX35_PAD_FEC_TX_EN__GPIO3_12 0x2f8 0x75c 0x8f4 0x5 0x1
900#define MX35_PAD_FEC_TX_EN__IPU_DISPB_PAR_RS 0x2f8 0x75c 0x000 0x6 0x0
901#define MX35_PAD_FEC_TX_EN__ARM11P_TOP_EVNTBUS_6 0x2f8 0x75c 0x000 0x7 0x0
902#define MX35_PAD_FEC_MDC__FEC_MDC 0x2fc 0x760 0x000 0x0 0x0
903#define MX35_PAD_FEC_MDC__CAN2_TXCAN 0x2fc 0x760 0x000 0x1 0x0
904#define MX35_PAD_FEC_MDC__UART3_DCD 0x2fc 0x760 0x000 0x2 0x0
905#define MX35_PAD_FEC_MDC__USB_TOP_USBH2_DATA_4 0x2fc 0x760 0x9dc 0x3 0x1
906#define MX35_PAD_FEC_MDC__GPIO3_13 0x2fc 0x760 0x8f8 0x5 0x1
907#define MX35_PAD_FEC_MDC__IPU_DISPB_WR 0x2fc 0x760 0x000 0x6 0x0
908#define MX35_PAD_FEC_MDC__ARM11P_TOP_EVNTBUS_7 0x2fc 0x760 0x000 0x7 0x0
909#define MX35_PAD_FEC_MDIO__FEC_MDIO 0x300 0x764 0x000 0x0 0x0
910#define MX35_PAD_FEC_MDIO__CAN2_RXCAN 0x300 0x764 0x7cc 0x1 0x2
911#define MX35_PAD_FEC_MDIO__USB_TOP_USBH2_DATA_5 0x300 0x764 0x9e0 0x3 0x1
912#define MX35_PAD_FEC_MDIO__GPIO3_14 0x300 0x764 0x8fc 0x5 0x1
913#define MX35_PAD_FEC_MDIO__IPU_DISPB_RD 0x300 0x764 0x000 0x6 0x0
914#define MX35_PAD_FEC_MDIO__ARM11P_TOP_EVNTBUS_8 0x300 0x764 0x000 0x7 0x0
915#define MX35_PAD_FEC_TX_ERR__FEC_TX_ERR 0x304 0x768 0x000 0x0 0x0
916#define MX35_PAD_FEC_TX_ERR__OWIRE_LINE 0x304 0x768 0x990 0x1 0x2
917#define MX35_PAD_FEC_TX_ERR__SPDIF_SPDIF_EXTCLK 0x304 0x768 0x994 0x2 0x4
918#define MX35_PAD_FEC_TX_ERR__USB_TOP_USBH2_DATA_6 0x304 0x768 0x9e4 0x3 0x1
919#define MX35_PAD_FEC_TX_ERR__GPIO3_15 0x304 0x768 0x900 0x5 0x1
920#define MX35_PAD_FEC_TX_ERR__IPU_DISPB_D0_VSYNC 0x304 0x768 0x924 0x6 0x3
921#define MX35_PAD_FEC_TX_ERR__ARM11P_TOP_EVNTBUS_9 0x304 0x768 0x000 0x7 0x0
922#define MX35_PAD_FEC_RX_ERR__FEC_RX_ERR 0x308 0x76c 0x000 0x0 0x0
923#define MX35_PAD_FEC_RX_ERR__IPU_CSI_D_0 0x308 0x76c 0x930 0x1 0x3
924#define MX35_PAD_FEC_RX_ERR__USB_TOP_USBH2_DATA_7 0x308 0x76c 0x9e8 0x3 0x1
925#define MX35_PAD_FEC_RX_ERR__KPP_COL_4 0x308 0x76c 0x960 0x4 0x1
926#define MX35_PAD_FEC_RX_ERR__GPIO3_16 0x308 0x76c 0x000 0x5 0x0
927#define MX35_PAD_FEC_RX_ERR__IPU_DISPB_SD_D_IO 0x308 0x76c 0x92c 0x6 0x5
928#define MX35_PAD_FEC_CRS__FEC_CRS 0x30c 0x770 0x000 0x0 0x0
929#define MX35_PAD_FEC_CRS__IPU_CSI_D_1 0x30c 0x770 0x934 0x1 0x3
930#define MX35_PAD_FEC_CRS__USB_TOP_USBH2_PWR 0x30c 0x770 0x000 0x3 0x0
931#define MX35_PAD_FEC_CRS__KPP_COL_5 0x30c 0x770 0x964 0x4 0x1
932#define MX35_PAD_FEC_CRS__GPIO3_17 0x30c 0x770 0x000 0x5 0x0
933#define MX35_PAD_FEC_CRS__IPU_FLASH_STROBE 0x30c 0x770 0x000 0x6 0x0
934#define MX35_PAD_FEC_RDATA1__FEC_RDATA_1 0x310 0x774 0x000 0x0 0x0
935#define MX35_PAD_FEC_RDATA1__IPU_CSI_D_2 0x310 0x774 0x938 0x1 0x4
936#define MX35_PAD_FEC_RDATA1__AUDMUX_AUD6_RXC 0x310 0x774 0x000 0x2 0x0
937#define MX35_PAD_FEC_RDATA1__USB_TOP_USBH2_OC 0x310 0x774 0x9f4 0x3 0x2
938#define MX35_PAD_FEC_RDATA1__KPP_COL_6 0x310 0x774 0x968 0x4 0x1
939#define MX35_PAD_FEC_RDATA1__GPIO3_18 0x310 0x774 0x000 0x5 0x0
940#define MX35_PAD_FEC_RDATA1__IPU_DISPB_BE0 0x310 0x774 0x000 0x6 0x0
941#define MX35_PAD_FEC_TDATA1__FEC_TDATA_1 0x314 0x778 0x000 0x0 0x0
942#define MX35_PAD_FEC_TDATA1__IPU_CSI_D_3 0x314 0x778 0x93c 0x1 0x4
943#define MX35_PAD_FEC_TDATA1__AUDMUX_AUD6_RXFS 0x314 0x778 0x7bc 0x2 0x1
944#define MX35_PAD_FEC_TDATA1__KPP_COL_7 0x314 0x778 0x96c 0x4 0x1
945#define MX35_PAD_FEC_TDATA1__GPIO3_19 0x314 0x778 0x000 0x5 0x0
946#define MX35_PAD_FEC_TDATA1__IPU_DISPB_BE1 0x314 0x778 0x000 0x6 0x0
947#define MX35_PAD_FEC_RDATA2__FEC_RDATA_2 0x318 0x77c 0x000 0x0 0x0
948#define MX35_PAD_FEC_RDATA2__IPU_CSI_D_4 0x318 0x77c 0x940 0x1 0x3
949#define MX35_PAD_FEC_RDATA2__AUDMUX_AUD6_TXD 0x318 0x77c 0x7b4 0x2 0x1
950#define MX35_PAD_FEC_RDATA2__KPP_ROW_4 0x318 0x77c 0x980 0x4 0x1
951#define MX35_PAD_FEC_RDATA2__GPIO3_20 0x318 0x77c 0x000 0x5 0x0
952#define MX35_PAD_FEC_TDATA2__FEC_TDATA_2 0x31c 0x780 0x000 0x0 0x0
953#define MX35_PAD_FEC_TDATA2__IPU_CSI_D_5 0x31c 0x780 0x944 0x1 0x3
954#define MX35_PAD_FEC_TDATA2__AUDMUX_AUD6_RXD 0x31c 0x780 0x7b0 0x2 0x1
955#define MX35_PAD_FEC_TDATA2__KPP_ROW_5 0x31c 0x780 0x984 0x4 0x1
956#define MX35_PAD_FEC_TDATA2__GPIO3_21 0x31c 0x780 0x000 0x5 0x0
957#define MX35_PAD_FEC_RDATA3__FEC_RDATA_3 0x320 0x784 0x000 0x0 0x0
958#define MX35_PAD_FEC_RDATA3__IPU_CSI_D_6 0x320 0x784 0x948 0x1 0x3
959#define MX35_PAD_FEC_RDATA3__AUDMUX_AUD6_TXC 0x320 0x784 0x7c0 0x2 0x1
960#define MX35_PAD_FEC_RDATA3__KPP_ROW_6 0x320 0x784 0x988 0x4 0x1
961#define MX35_PAD_FEC_RDATA3__GPIO3_22 0x320 0x784 0x000 0x6 0x0
962#define MX35_PAD_FEC_TDATA3__FEC_TDATA_3 0x324 0x788 0x000 0x0 0x0
963#define MX35_PAD_FEC_TDATA3__IPU_CSI_D_7 0x324 0x788 0x94c 0x1 0x3
964#define MX35_PAD_FEC_TDATA3__AUDMUX_AUD6_TXFS 0x324 0x788 0x7c4 0x2 0x1
965#define MX35_PAD_FEC_TDATA3__KPP_ROW_7 0x324 0x788 0x98c 0x4 0x1
966#define MX35_PAD_FEC_TDATA3__GPIO3_23 0x324 0x788 0x000 0x5 0x0
967#define MX35_PAD_EXT_ARMCLK__CCM_EXT_ARMCLK 0x000 0x78c 0x000 0x0 0x0
968#define MX35_PAD_TEST_MODE__TCU_TEST_MODE 0x000 0x790 0x000 0x0 0x0
969
970#endif /* __DTS_IMX35_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx51-apf51.dts b/arch/arm/boot/dts/imx51-apf51.dts
index 92d3a66a69e2..2bcf6981d490 100644
--- a/arch/arm/boot/dts/imx51-apf51.dts
+++ b/arch/arm/boot/dts/imx51-apf51.dts
@@ -15,7 +15,7 @@
15 */ 15 */
16 16
17/dts-v1/; 17/dts-v1/;
18/include/ "imx51.dtsi" 18#include "imx51.dtsi"
19 19
20/ { 20/ {
21 model = "Armadeus Systems APF51 module"; 21 model = "Armadeus Systems APF51 module";
diff --git a/arch/arm/boot/dts/imx51-apf51dev.dts b/arch/arm/boot/dts/imx51-apf51dev.dts
new file mode 100644
index 000000000000..123fe84e0e8c
--- /dev/null
+++ b/arch/arm/boot/dts/imx51-apf51dev.dts
@@ -0,0 +1,97 @@
1/*
2 * Copyright 2013 Armadeus Systems - <support@armadeus.com>
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/* APF51Dev is a docking board for the APF51 SOM */
13#include "imx51-apf51.dts"
14
15/ {
16 model = "Armadeus Systems APF51Dev docking/development board";
17 compatible = "armadeus,imx51-apf51dev", "armadeus,imx51-apf51", "fsl,imx51";
18
19 gpio-keys {
20 compatible = "gpio-keys";
21
22 user-key {
23 label = "user";
24 gpios = <&gpio1 3 0>;
25 linux,code = <256>; /* BTN_0 */
26 };
27 };
28
29 leds {
30 compatible = "gpio-leds";
31
32 user {
33 label = "Heartbeat";
34 gpios = <&gpio1 2 0>;
35 linux,default-trigger = "heartbeat";
36 };
37 };
38};
39
40&ecspi1 {
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_ecspi1_1>;
43 fsl,spi-num-chipselects = <2>;
44 cs-gpios = <&gpio4 24 0>, <&gpio4 25 0>;
45 status = "okay";
46};
47
48&ecspi2 {
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_ecspi2_1>;
51 fsl,spi-num-chipselects = <2>;
52 cs-gpios = <&gpio3 28 1>, <&gpio3 27 1>;
53 status = "okay";
54};
55
56&esdhc1 {
57 pinctrl-names = "default";
58 pinctrl-0 = <&pinctrl_esdhc1_1>;
59 cd-gpios = <&gpio2 29 0>;
60 bus-width = <4>;
61 status = "okay";
62};
63
64&esdhc2 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&pinctrl_esdhc2_1>;
67 bus-width = <4>;
68 non-removable;
69 status = "okay";
70};
71
72&i2c2 {
73 pinctrl-names = "default";
74 pinctrl-0 = <&pinctrl_i2c2_2>;
75 status = "okay";
76};
77
78&iomuxc {
79 pinctrl-names = "default";
80 pinctrl-0 = <&pinctrl_hog>;
81
82 hog {
83 pinctrl_hog: hoggrp {
84 fsl,pins = <
85 MX51_PAD_EIM_EB2__GPIO2_22 0x0C5
86 MX51_PAD_EIM_EB3__GPIO2_23 0x0C5
87 MX51_PAD_EIM_CS4__GPIO2_29 0x100
88 MX51_PAD_NANDF_D13__GPIO3_27 0x0C5
89 MX51_PAD_NANDF_D12__GPIO3_28 0x0C5
90 MX51_PAD_CSPI1_SS0__GPIO4_24 0x0C5
91 MX51_PAD_CSPI1_SS1__GPIO4_25 0x0C5
92 MX51_PAD_GPIO1_2__GPIO1_2 0x0C5
93 MX51_PAD_GPIO1_3__GPIO1_3 0x0C5
94 >;
95 };
96 };
97};
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index aab6e43219af..6dd9486c755b 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx51.dtsi" 14#include "imx51.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX51 Babbage Board"; 17 model = "Freescale i.MX51 Babbage Board";
@@ -222,13 +222,13 @@
222 hog { 222 hog {
223 pinctrl_hog: hoggrp { 223 pinctrl_hog: hoggrp {
224 fsl,pins = < 224 fsl,pins = <
225 694 0x20d5 /* MX51_PAD_GPIO1_0__SD1_CD */ 225 MX51_PAD_GPIO1_0__SD1_CD 0x20d5
226 697 0x20d5 /* MX51_PAD_GPIO1_1__SD1_WP */ 226 MX51_PAD_GPIO1_1__SD1_WP 0x20d5
227 737 0x100 /* MX51_PAD_GPIO1_5__GPIO1_5 */ 227 MX51_PAD_GPIO1_5__GPIO1_5 0x100
228 740 0x100 /* MX51_PAD_GPIO1_6__GPIO1_6 */ 228 MX51_PAD_GPIO1_6__GPIO1_6 0x100
229 121 0x5 /* MX51_PAD_EIM_A27__GPIO2_21 */ 229 MX51_PAD_EIM_A27__GPIO2_21 0x5
230 402 0x85 /* MX51_PAD_CSPI1_SS0__GPIO4_24 */ 230 MX51_PAD_CSPI1_SS0__GPIO4_24 0x85
231 405 0x85 /* MX51_PAD_CSPI1_SS1__GPIO4_25 */ 231 MX51_PAD_CSPI1_SS1__GPIO4_25 0x85
232 >; 232 >;
233 }; 233 };
234 }; 234 };
diff --git a/arch/arm/boot/dts/imx51-pinfunc.h b/arch/arm/boot/dts/imx51-pinfunc.h
new file mode 100644
index 000000000000..9eb92abaeb6d
--- /dev/null
+++ b/arch/arm/boot/dts/imx51-pinfunc.h
@@ -0,0 +1,773 @@
1/*
2 * Copyright 2013 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
10#ifndef __DTS_IMX51_PINFUNC_H
11#define __DTS_IMX51_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX51_PAD_EIM_D16__AUD4_RXFS 0x05c 0x3f0 0x000 0x5 0x0
18#define MX51_PAD_EIM_D16__AUD5_TXD 0x05c 0x3f0 0x8d8 0x7 0x0
19#define MX51_PAD_EIM_D16__EIM_D16 0x05c 0x3f0 0x000 0x0 0x0
20#define MX51_PAD_EIM_D16__GPIO2_0 0x05c 0x3f0 0x000 0x1 0x0
21#define MX51_PAD_EIM_D16__I2C1_SDA 0x05c 0x3f0 0x9b4 0x4 0x0
22#define MX51_PAD_EIM_D16__UART2_CTS 0x05c 0x3f0 0x000 0x3 0x0
23#define MX51_PAD_EIM_D16__USBH2_DATA0 0x05c 0x3f0 0x000 0x2 0x0
24#define MX51_PAD_EIM_D17__AUD5_RXD 0x060 0x3f4 0x8d4 0x7 0x0
25#define MX51_PAD_EIM_D17__EIM_D17 0x060 0x3f4 0x000 0x0 0x0
26#define MX51_PAD_EIM_D17__GPIO2_1 0x060 0x3f4 0x000 0x1 0x0
27#define MX51_PAD_EIM_D17__UART2_RXD 0x060 0x3f4 0x9ec 0x3 0x0
28#define MX51_PAD_EIM_D17__UART3_CTS 0x060 0x3f4 0x000 0x4 0x0
29#define MX51_PAD_EIM_D17__USBH2_DATA1 0x060 0x3f4 0x000 0x2 0x0
30#define MX51_PAD_EIM_D18__AUD5_TXC 0x064 0x3f8 0x8e4 0x7 0x0
31#define MX51_PAD_EIM_D18__EIM_D18 0x064 0x3f8 0x000 0x0 0x0
32#define MX51_PAD_EIM_D18__GPIO2_2 0x064 0x3f8 0x000 0x1 0x0
33#define MX51_PAD_EIM_D18__UART2_TXD 0x064 0x3f8 0x000 0x3 0x0
34#define MX51_PAD_EIM_D18__UART3_RTS 0x064 0x3f8 0x9f0 0x4 0x1
35#define MX51_PAD_EIM_D18__USBH2_DATA2 0x064 0x3f8 0x000 0x2 0x0
36#define MX51_PAD_EIM_D19__AUD4_RXC 0x068 0x3fc 0x000 0x5 0x0
37#define MX51_PAD_EIM_D19__AUD5_TXFS 0x068 0x3fc 0x8e8 0x7 0x0
38#define MX51_PAD_EIM_D19__EIM_D19 0x068 0x3fc 0x000 0x0 0x0
39#define MX51_PAD_EIM_D19__GPIO2_3 0x068 0x3fc 0x000 0x1 0x0
40#define MX51_PAD_EIM_D19__I2C1_SCL 0x068 0x3fc 0x9b0 0x4 0x0
41#define MX51_PAD_EIM_D19__UART2_RTS 0x068 0x3fc 0x9e8 0x3 0x1
42#define MX51_PAD_EIM_D19__USBH2_DATA3 0x068 0x3fc 0x000 0x2 0x0
43#define MX51_PAD_EIM_D20__AUD4_TXD 0x06c 0x400 0x8c8 0x5 0x0
44#define MX51_PAD_EIM_D20__EIM_D20 0x06c 0x400 0x000 0x0 0x0
45#define MX51_PAD_EIM_D20__GPIO2_4 0x06c 0x400 0x000 0x1 0x0
46#define MX51_PAD_EIM_D20__SRTC_ALARM_DEB 0x06c 0x400 0x000 0x4 0x0
47#define MX51_PAD_EIM_D20__USBH2_DATA4 0x06c 0x400 0x000 0x2 0x0
48#define MX51_PAD_EIM_D21__AUD4_RXD 0x070 0x404 0x8c4 0x5 0x0
49#define MX51_PAD_EIM_D21__EIM_D21 0x070 0x404 0x000 0x0 0x0
50#define MX51_PAD_EIM_D21__GPIO2_5 0x070 0x404 0x000 0x1 0x0
51#define MX51_PAD_EIM_D21__SRTC_ALARM_DEB 0x070 0x404 0x000 0x3 0x0
52#define MX51_PAD_EIM_D21__USBH2_DATA5 0x070 0x404 0x000 0x2 0x0
53#define MX51_PAD_EIM_D22__AUD4_TXC 0x074 0x408 0x8cc 0x5 0x0
54#define MX51_PAD_EIM_D22__EIM_D22 0x074 0x408 0x000 0x0 0x0
55#define MX51_PAD_EIM_D22__GPIO2_6 0x074 0x408 0x000 0x1 0x0
56#define MX51_PAD_EIM_D22__USBH2_DATA6 0x074 0x408 0x000 0x2 0x0
57#define MX51_PAD_EIM_D23__AUD4_TXFS 0x078 0x40c 0x8d0 0x5 0x0
58#define MX51_PAD_EIM_D23__EIM_D23 0x078 0x40c 0x000 0x0 0x0
59#define MX51_PAD_EIM_D23__GPIO2_7 0x078 0x40c 0x000 0x1 0x0
60#define MX51_PAD_EIM_D23__SPDIF_OUT1 0x078 0x40c 0x000 0x4 0x0
61#define MX51_PAD_EIM_D23__USBH2_DATA7 0x078 0x40c 0x000 0x2 0x0
62#define MX51_PAD_EIM_D24__AUD6_RXFS 0x07c 0x410 0x8f8 0x5 0x0
63#define MX51_PAD_EIM_D24__EIM_D24 0x07c 0x410 0x000 0x0 0x0
64#define MX51_PAD_EIM_D24__GPIO2_8 0x07c 0x410 0x000 0x1 0x0
65#define MX51_PAD_EIM_D24__I2C2_SDA 0x07c 0x410 0x9bc 0x4 0x0
66#define MX51_PAD_EIM_D24__UART3_CTS 0x07c 0x410 0x000 0x3 0x0
67#define MX51_PAD_EIM_D24__USBOTG_DATA0 0x07c 0x410 0x000 0x2 0x0
68#define MX51_PAD_EIM_D25__EIM_D25 0x080 0x414 0x000 0x0 0x0
69#define MX51_PAD_EIM_D25__KEY_COL6 0x080 0x414 0x9c8 0x1 0x0
70#define MX51_PAD_EIM_D25__UART2_CTS 0x080 0x414 0x000 0x4 0x0
71#define MX51_PAD_EIM_D25__UART3_RXD 0x080 0x414 0x9f4 0x3 0x0
72#define MX51_PAD_EIM_D25__USBOTG_DATA1 0x080 0x414 0x000 0x2 0x0
73#define MX51_PAD_EIM_D26__EIM_D26 0x084 0x418 0x000 0x0 0x0
74#define MX51_PAD_EIM_D26__KEY_COL7 0x084 0x418 0x9cc 0x1 0x0
75#define MX51_PAD_EIM_D26__UART2_RTS 0x084 0x418 0x9e8 0x4 0x3
76#define MX51_PAD_EIM_D26__UART3_TXD 0x084 0x418 0x000 0x3 0x0
77#define MX51_PAD_EIM_D26__USBOTG_DATA2 0x084 0x418 0x000 0x2 0x0
78#define MX51_PAD_EIM_D27__AUD6_RXC 0x088 0x41c 0x8f4 0x5 0x0
79#define MX51_PAD_EIM_D27__EIM_D27 0x088 0x41c 0x000 0x0 0x0
80#define MX51_PAD_EIM_D27__GPIO2_9 0x088 0x41c 0x000 0x1 0x0
81#define MX51_PAD_EIM_D27__I2C2_SCL 0x088 0x41c 0x9b8 0x4 0x0
82#define MX51_PAD_EIM_D27__UART3_RTS 0x088 0x41c 0x9f0 0x3 0x3
83#define MX51_PAD_EIM_D27__USBOTG_DATA3 0x088 0x41c 0x000 0x2 0x0
84#define MX51_PAD_EIM_D28__AUD6_TXD 0x08c 0x420 0x8f0 0x5 0x0
85#define MX51_PAD_EIM_D28__EIM_D28 0x08c 0x420 0x000 0x0 0x0
86#define MX51_PAD_EIM_D28__KEY_ROW4 0x08c 0x420 0x9d0 0x1 0x0
87#define MX51_PAD_EIM_D28__USBOTG_DATA4 0x08c 0x420 0x000 0x2 0x0
88#define MX51_PAD_EIM_D29__AUD6_RXD 0x090 0x424 0x8ec 0x5 0x0
89#define MX51_PAD_EIM_D29__EIM_D29 0x090 0x424 0x000 0x0 0x0
90#define MX51_PAD_EIM_D29__KEY_ROW5 0x090 0x424 0x9d4 0x1 0x0
91#define MX51_PAD_EIM_D29__USBOTG_DATA5 0x090 0x424 0x000 0x2 0x0
92#define MX51_PAD_EIM_D30__AUD6_TXC 0x094 0x428 0x8fc 0x5 0x0
93#define MX51_PAD_EIM_D30__EIM_D30 0x094 0x428 0x000 0x0 0x0
94#define MX51_PAD_EIM_D30__KEY_ROW6 0x094 0x428 0x9d8 0x1 0x0
95#define MX51_PAD_EIM_D30__USBOTG_DATA6 0x094 0x428 0x000 0x2 0x0
96#define MX51_PAD_EIM_D31__AUD6_TXFS 0x098 0x42c 0x900 0x5 0x0
97#define MX51_PAD_EIM_D31__EIM_D31 0x098 0x42c 0x000 0x0 0x0
98#define MX51_PAD_EIM_D31__KEY_ROW7 0x098 0x42c 0x9dc 0x1 0x0
99#define MX51_PAD_EIM_D31__USBOTG_DATA7 0x098 0x42c 0x000 0x2 0x0
100#define MX51_PAD_EIM_A16__EIM_A16 0x09c 0x430 0x000 0x0 0x0
101#define MX51_PAD_EIM_A16__GPIO2_10 0x09c 0x430 0x000 0x1 0x0
102#define MX51_PAD_EIM_A16__OSC_FREQ_SEL0 0x09c 0x430 0x000 0x7 0x0
103#define MX51_PAD_EIM_A17__EIM_A17 0x0a0 0x434 0x000 0x0 0x0
104#define MX51_PAD_EIM_A17__GPIO2_11 0x0a0 0x434 0x000 0x1 0x0
105#define MX51_PAD_EIM_A17__OSC_FREQ_SEL1 0x0a0 0x434 0x000 0x7 0x0
106#define MX51_PAD_EIM_A18__BOOT_LPB0 0x0a4 0x438 0x000 0x7 0x0
107#define MX51_PAD_EIM_A18__EIM_A18 0x0a4 0x438 0x000 0x0 0x0
108#define MX51_PAD_EIM_A18__GPIO2_12 0x0a4 0x438 0x000 0x1 0x0
109#define MX51_PAD_EIM_A19__BOOT_LPB1 0x0a8 0x43c 0x000 0x7 0x0
110#define MX51_PAD_EIM_A19__EIM_A19 0x0a8 0x43c 0x000 0x0 0x0
111#define MX51_PAD_EIM_A19__GPIO2_13 0x0a8 0x43c 0x000 0x1 0x0
112#define MX51_PAD_EIM_A20__BOOT_UART_SRC0 0x0ac 0x440 0x000 0x7 0x0
113#define MX51_PAD_EIM_A20__EIM_A20 0x0ac 0x440 0x000 0x0 0x0
114#define MX51_PAD_EIM_A20__GPIO2_14 0x0ac 0x440 0x000 0x1 0x0
115#define MX51_PAD_EIM_A21__BOOT_UART_SRC1 0x0b0 0x444 0x000 0x7 0x0
116#define MX51_PAD_EIM_A21__EIM_A21 0x0b0 0x444 0x000 0x0 0x0
117#define MX51_PAD_EIM_A21__GPIO2_15 0x0b0 0x444 0x000 0x1 0x0
118#define MX51_PAD_EIM_A22__EIM_A22 0x0b4 0x448 0x000 0x0 0x0
119#define MX51_PAD_EIM_A22__GPIO2_16 0x0b4 0x448 0x000 0x1 0x0
120#define MX51_PAD_EIM_A23__BOOT_HPN_EN 0x0b8 0x44c 0x000 0x7 0x0
121#define MX51_PAD_EIM_A23__EIM_A23 0x0b8 0x44c 0x000 0x0 0x0
122#define MX51_PAD_EIM_A23__GPIO2_17 0x0b8 0x44c 0x000 0x1 0x0
123#define MX51_PAD_EIM_A24__EIM_A24 0x0bc 0x450 0x000 0x0 0x0
124#define MX51_PAD_EIM_A24__GPIO2_18 0x0bc 0x450 0x000 0x1 0x0
125#define MX51_PAD_EIM_A24__USBH2_CLK 0x0bc 0x450 0x000 0x2 0x0
126#define MX51_PAD_EIM_A25__DISP1_PIN4 0x0c0 0x454 0x000 0x6 0x0
127#define MX51_PAD_EIM_A25__EIM_A25 0x0c0 0x454 0x000 0x0 0x0
128#define MX51_PAD_EIM_A25__GPIO2_19 0x0c0 0x454 0x000 0x1 0x0
129#define MX51_PAD_EIM_A25__USBH2_DIR 0x0c0 0x454 0x000 0x2 0x0
130#define MX51_PAD_EIM_A26__CSI1_DATA_EN 0x0c4 0x458 0x9a0 0x5 0x0
131#define MX51_PAD_EIM_A26__DISP2_EXT_CLK 0x0c4 0x458 0x908 0x6 0x0
132#define MX51_PAD_EIM_A26__EIM_A26 0x0c4 0x458 0x000 0x0 0x0
133#define MX51_PAD_EIM_A26__GPIO2_20 0x0c4 0x458 0x000 0x1 0x0
134#define MX51_PAD_EIM_A26__USBH2_STP 0x0c4 0x458 0x000 0x2 0x0
135#define MX51_PAD_EIM_A27__CSI2_DATA_EN 0x0c8 0x45c 0x99c 0x5 0x0
136#define MX51_PAD_EIM_A27__DISP1_PIN1 0x0c8 0x45c 0x9a4 0x6 0x0
137#define MX51_PAD_EIM_A27__EIM_A27 0x0c8 0x45c 0x000 0x0 0x0
138#define MX51_PAD_EIM_A27__GPIO2_21 0x0c8 0x45c 0x000 0x1 0x0
139#define MX51_PAD_EIM_A27__USBH2_NXT 0x0c8 0x45c 0x000 0x2 0x0
140#define MX51_PAD_EIM_EB0__EIM_EB0 0x0cc 0x460 0x000 0x0 0x0
141#define MX51_PAD_EIM_EB1__EIM_EB1 0x0d0 0x464 0x000 0x0 0x0
142#define MX51_PAD_EIM_EB2__AUD5_RXFS 0x0d4 0x468 0x8e0 0x6 0x0
143#define MX51_PAD_EIM_EB2__CSI1_D2 0x0d4 0x468 0x000 0x5 0x0
144#define MX51_PAD_EIM_EB2__EIM_EB2 0x0d4 0x468 0x000 0x0 0x0
145#define MX51_PAD_EIM_EB2__FEC_MDIO 0x0d4 0x468 0x954 0x3 0x0
146#define MX51_PAD_EIM_EB2__GPIO2_22 0x0d4 0x468 0x000 0x1 0x0
147#define MX51_PAD_EIM_EB2__GPT_CMPOUT1 0x0d4 0x468 0x000 0x7 0x0
148#define MX51_PAD_EIM_EB3__AUD5_RXC 0x0d8 0x46c 0x8dc 0x6 0x0
149#define MX51_PAD_EIM_EB3__CSI1_D3 0x0d8 0x46c 0x000 0x5 0x0
150#define MX51_PAD_EIM_EB3__EIM_EB3 0x0d8 0x46c 0x000 0x0 0x0
151#define MX51_PAD_EIM_EB3__FEC_RDATA1 0x0d8 0x46c 0x95c 0x3 0x0
152#define MX51_PAD_EIM_EB3__GPIO2_23 0x0d8 0x46c 0x000 0x1 0x0
153#define MX51_PAD_EIM_EB3__GPT_CMPOUT2 0x0d8 0x46c 0x000 0x7 0x0
154#define MX51_PAD_EIM_OE__EIM_OE 0x0dc 0x470 0x000 0x0 0x0
155#define MX51_PAD_EIM_OE__GPIO2_24 0x0dc 0x470 0x000 0x1 0x0
156#define MX51_PAD_EIM_CS0__EIM_CS0 0x0e0 0x474 0x000 0x0 0x0
157#define MX51_PAD_EIM_CS0__GPIO2_25 0x0e0 0x474 0x000 0x1 0x0
158#define MX51_PAD_EIM_CS1__EIM_CS1 0x0e4 0x478 0x000 0x0 0x0
159#define MX51_PAD_EIM_CS1__GPIO2_26 0x0e4 0x478 0x000 0x1 0x0
160#define MX51_PAD_EIM_CS2__AUD5_TXD 0x0e8 0x47c 0x8d8 0x6 0x1
161#define MX51_PAD_EIM_CS2__CSI1_D4 0x0e8 0x47c 0x000 0x5 0x0
162#define MX51_PAD_EIM_CS2__EIM_CS2 0x0e8 0x47c 0x000 0x0 0x0
163#define MX51_PAD_EIM_CS2__FEC_RDATA2 0x0e8 0x47c 0x960 0x3 0x0
164#define MX51_PAD_EIM_CS2__GPIO2_27 0x0e8 0x47c 0x000 0x1 0x0
165#define MX51_PAD_EIM_CS2__USBOTG_STP 0x0e8 0x47c 0x000 0x2 0x0
166#define MX51_PAD_EIM_CS3__AUD5_RXD 0x0ec 0x480 0x8d4 0x6 0x1
167#define MX51_PAD_EIM_CS3__CSI1_D5 0x0ec 0x480 0x000 0x5 0x0
168#define MX51_PAD_EIM_CS3__EIM_CS3 0x0ec 0x480 0x000 0x0 0x0
169#define MX51_PAD_EIM_CS3__FEC_RDATA3 0x0ec 0x480 0x964 0x3 0x0
170#define MX51_PAD_EIM_CS3__GPIO2_28 0x0ec 0x480 0x000 0x1 0x0
171#define MX51_PAD_EIM_CS3__USBOTG_NXT 0x0ec 0x480 0x000 0x2 0x0
172#define MX51_PAD_EIM_CS4__AUD5_TXC 0x0f0 0x484 0x8e4 0x6 0x1
173#define MX51_PAD_EIM_CS4__CSI1_D6 0x0f0 0x484 0x000 0x5 0x0
174#define MX51_PAD_EIM_CS4__EIM_CS4 0x0f0 0x484 0x000 0x0 0x0
175#define MX51_PAD_EIM_CS4__FEC_RX_ER 0x0f0 0x484 0x970 0x3 0x0
176#define MX51_PAD_EIM_CS4__GPIO2_29 0x0f0 0x484 0x000 0x1 0x0
177#define MX51_PAD_EIM_CS4__USBOTG_CLK 0x0f0 0x484 0x000 0x2 0x0
178#define MX51_PAD_EIM_CS5__AUD5_TXFS 0x0f4 0x488 0x8e8 0x6 0x1
179#define MX51_PAD_EIM_CS5__CSI1_D7 0x0f4 0x488 0x000 0x5 0x0
180#define MX51_PAD_EIM_CS5__DISP1_EXT_CLK 0x0f4 0x488 0x904 0x4 0x0
181#define MX51_PAD_EIM_CS5__EIM_CS5 0x0f4 0x488 0x000 0x0 0x0
182#define MX51_PAD_EIM_CS5__FEC_CRS 0x0f4 0x488 0x950 0x3 0x0
183#define MX51_PAD_EIM_CS5__GPIO2_30 0x0f4 0x488 0x000 0x1 0x0
184#define MX51_PAD_EIM_CS5__USBOTG_DIR 0x0f4 0x488 0x000 0x2 0x0
185#define MX51_PAD_EIM_DTACK__EIM_DTACK 0x0f8 0x48c 0x000 0x0 0x0
186#define MX51_PAD_EIM_DTACK__GPIO2_31 0x0f8 0x48c 0x000 0x1 0x0
187#define MX51_PAD_EIM_LBA__EIM_LBA 0x0fc 0x494 0x000 0x0 0x0
188#define MX51_PAD_EIM_LBA__GPIO3_1 0x0fc 0x494 0x978 0x1 0x0
189#define MX51_PAD_EIM_CRE__EIM_CRE 0x100 0x4a0 0x000 0x0 0x0
190#define MX51_PAD_EIM_CRE__GPIO3_2 0x100 0x4a0 0x97c 0x1 0x0
191#define MX51_PAD_DRAM_CS1__DRAM_CS1 0x104 0x4d0 0x000 0x0 0x0
192#define MX51_PAD_NANDF_WE_B__GPIO3_3 0x108 0x4e4 0x980 0x3 0x0
193#define MX51_PAD_NANDF_WE_B__NANDF_WE_B 0x108 0x4e4 0x000 0x0 0x0
194#define MX51_PAD_NANDF_WE_B__PATA_DIOW 0x108 0x4e4 0x000 0x1 0x0
195#define MX51_PAD_NANDF_WE_B__SD3_DATA0 0x108 0x4e4 0x93c 0x2 0x0
196#define MX51_PAD_NANDF_RE_B__GPIO3_4 0x10c 0x4e8 0x984 0x3 0x0
197#define MX51_PAD_NANDF_RE_B__NANDF_RE_B 0x10c 0x4e8 0x000 0x0 0x0
198#define MX51_PAD_NANDF_RE_B__PATA_DIOR 0x10c 0x4e8 0x000 0x1 0x0
199#define MX51_PAD_NANDF_RE_B__SD3_DATA1 0x10c 0x4e8 0x940 0x2 0x0
200#define MX51_PAD_NANDF_ALE__GPIO3_5 0x110 0x4ec 0x988 0x3 0x0
201#define MX51_PAD_NANDF_ALE__NANDF_ALE 0x110 0x4ec 0x000 0x0 0x0
202#define MX51_PAD_NANDF_ALE__PATA_BUFFER_EN 0x110 0x4ec 0x000 0x1 0x0
203#define MX51_PAD_NANDF_CLE__GPIO3_6 0x114 0x4f0 0x98c 0x3 0x0
204#define MX51_PAD_NANDF_CLE__NANDF_CLE 0x114 0x4f0 0x000 0x0 0x0
205#define MX51_PAD_NANDF_CLE__PATA_RESET_B 0x114 0x4f0 0x000 0x1 0x0
206#define MX51_PAD_NANDF_WP_B__GPIO3_7 0x118 0x4f4 0x990 0x3 0x0
207#define MX51_PAD_NANDF_WP_B__NANDF_WP_B 0x118 0x4f4 0x000 0x0 0x0
208#define MX51_PAD_NANDF_WP_B__PATA_DMACK 0x118 0x4f4 0x000 0x1 0x0
209#define MX51_PAD_NANDF_WP_B__SD3_DATA2 0x118 0x4f4 0x944 0x2 0x0
210#define MX51_PAD_NANDF_RB0__ECSPI2_SS1 0x11c 0x4f8 0x930 0x5 0x0
211#define MX51_PAD_NANDF_RB0__GPIO3_8 0x11c 0x4f8 0x994 0x3 0x0
212#define MX51_PAD_NANDF_RB0__NANDF_RB0 0x11c 0x4f8 0x000 0x0 0x0
213#define MX51_PAD_NANDF_RB0__PATA_DMARQ 0x11c 0x4f8 0x000 0x1 0x0
214#define MX51_PAD_NANDF_RB0__SD3_DATA3 0x11c 0x4f8 0x948 0x2 0x0
215#define MX51_PAD_NANDF_RB1__CSPI_MOSI 0x120 0x4fc 0x91c 0x6 0x0
216#define MX51_PAD_NANDF_RB1__ECSPI2_RDY 0x120 0x4fc 0x000 0x2 0x0
217#define MX51_PAD_NANDF_RB1__GPIO3_9 0x120 0x4fc 0x000 0x3 0x0
218#define MX51_PAD_NANDF_RB1__NANDF_RB1 0x120 0x4fc 0x000 0x0 0x0
219#define MX51_PAD_NANDF_RB1__PATA_IORDY 0x120 0x4fc 0x000 0x1 0x0
220#define MX51_PAD_NANDF_RB1__SD4_CMD 0x120 0x4fc 0x000 0x5 0x0
221#define MX51_PAD_NANDF_RB2__DISP2_WAIT 0x124 0x500 0x9a8 0x5 0x0
222#define MX51_PAD_NANDF_RB2__ECSPI2_SCLK 0x124 0x500 0x000 0x2 0x0
223#define MX51_PAD_NANDF_RB2__FEC_COL 0x124 0x500 0x94c 0x1 0x0
224#define MX51_PAD_NANDF_RB2__GPIO3_10 0x124 0x500 0x000 0x3 0x0
225#define MX51_PAD_NANDF_RB2__NANDF_RB2 0x124 0x500 0x000 0x0 0x0
226#define MX51_PAD_NANDF_RB2__USBH3_H3_DP 0x124 0x500 0x000 0x7 0x0
227#define MX51_PAD_NANDF_RB2__USBH3_NXT 0x124 0x500 0xa20 0x6 0x0
228#define MX51_PAD_NANDF_RB3__DISP1_WAIT 0x128 0x504 0x000 0x5 0x0
229#define MX51_PAD_NANDF_RB3__ECSPI2_MISO 0x128 0x504 0x000 0x2 0x0
230#define MX51_PAD_NANDF_RB3__FEC_RX_CLK 0x128 0x504 0x968 0x1 0x0
231#define MX51_PAD_NANDF_RB3__GPIO3_11 0x128 0x504 0x000 0x3 0x0
232#define MX51_PAD_NANDF_RB3__NANDF_RB3 0x128 0x504 0x000 0x0 0x0
233#define MX51_PAD_NANDF_RB3__USBH3_CLK 0x128 0x504 0x9f8 0x6 0x0
234#define MX51_PAD_NANDF_RB3__USBH3_H3_DM 0x128 0x504 0x000 0x7 0x0
235#define MX51_PAD_GPIO_NAND__GPIO_NAND 0x12c 0x514 0x998 0x0 0x0
236#define MX51_PAD_GPIO_NAND__PATA_INTRQ 0x12c 0x514 0x000 0x1 0x0
237#define MX51_PAD_NANDF_CS0__GPIO3_16 0x130 0x518 0x000 0x3 0x0
238#define MX51_PAD_NANDF_CS0__NANDF_CS0 0x130 0x518 0x000 0x0 0x0
239#define MX51_PAD_NANDF_CS1__GPIO3_17 0x134 0x51c 0x000 0x3 0x0
240#define MX51_PAD_NANDF_CS1__NANDF_CS1 0x134 0x51c 0x000 0x0 0x0
241#define MX51_PAD_NANDF_CS2__CSPI_SCLK 0x138 0x520 0x914 0x6 0x0
242#define MX51_PAD_NANDF_CS2__FEC_TX_ER 0x138 0x520 0x000 0x2 0x0
243#define MX51_PAD_NANDF_CS2__GPIO3_18 0x138 0x520 0x000 0x3 0x0
244#define MX51_PAD_NANDF_CS2__NANDF_CS2 0x138 0x520 0x000 0x0 0x0
245#define MX51_PAD_NANDF_CS2__PATA_CS_0 0x138 0x520 0x000 0x1 0x0
246#define MX51_PAD_NANDF_CS2__SD4_CLK 0x138 0x520 0x000 0x5 0x0
247#define MX51_PAD_NANDF_CS2__USBH3_H1_DP 0x138 0x520 0x000 0x7 0x0
248#define MX51_PAD_NANDF_CS3__FEC_MDC 0x13c 0x524 0x000 0x2 0x0
249#define MX51_PAD_NANDF_CS3__GPIO3_19 0x13c 0x524 0x000 0x3 0x0
250#define MX51_PAD_NANDF_CS3__NANDF_CS3 0x13c 0x524 0x000 0x0 0x0
251#define MX51_PAD_NANDF_CS3__PATA_CS_1 0x13c 0x524 0x000 0x1 0x0
252#define MX51_PAD_NANDF_CS3__SD4_DAT0 0x13c 0x524 0x000 0x5 0x0
253#define MX51_PAD_NANDF_CS3__USBH3_H1_DM 0x13c 0x524 0x000 0x7 0x0
254#define MX51_PAD_NANDF_CS4__FEC_TDATA1 0x140 0x528 0x000 0x2 0x0
255#define MX51_PAD_NANDF_CS4__GPIO3_20 0x140 0x528 0x000 0x3 0x0
256#define MX51_PAD_NANDF_CS4__NANDF_CS4 0x140 0x528 0x000 0x0 0x0
257#define MX51_PAD_NANDF_CS4__PATA_DA_0 0x140 0x528 0x000 0x1 0x0
258#define MX51_PAD_NANDF_CS4__SD4_DAT1 0x140 0x528 0x000 0x5 0x0
259#define MX51_PAD_NANDF_CS4__USBH3_STP 0x140 0x528 0xa24 0x7 0x0
260#define MX51_PAD_NANDF_CS5__FEC_TDATA2 0x144 0x52c 0x000 0x2 0x0
261#define MX51_PAD_NANDF_CS5__GPIO3_21 0x144 0x52c 0x000 0x3 0x0
262#define MX51_PAD_NANDF_CS5__NANDF_CS5 0x144 0x52c 0x000 0x0 0x0
263#define MX51_PAD_NANDF_CS5__PATA_DA_1 0x144 0x52c 0x000 0x1 0x0
264#define MX51_PAD_NANDF_CS5__SD4_DAT2 0x144 0x52c 0x000 0x5 0x0
265#define MX51_PAD_NANDF_CS5__USBH3_DIR 0x144 0x52c 0xa1c 0x7 0x0
266#define MX51_PAD_NANDF_CS6__CSPI_SS3 0x148 0x530 0x928 0x7 0x0
267#define MX51_PAD_NANDF_CS6__FEC_TDATA3 0x148 0x530 0x000 0x2 0x0
268#define MX51_PAD_NANDF_CS6__GPIO3_22 0x148 0x530 0x000 0x3 0x0
269#define MX51_PAD_NANDF_CS6__NANDF_CS6 0x148 0x530 0x000 0x0 0x0
270#define MX51_PAD_NANDF_CS6__PATA_DA_2 0x148 0x530 0x000 0x1 0x0
271#define MX51_PAD_NANDF_CS6__SD4_DAT3 0x148 0x530 0x000 0x5 0x0
272#define MX51_PAD_NANDF_CS7__FEC_TX_EN 0x14c 0x534 0x000 0x1 0x0
273#define MX51_PAD_NANDF_CS7__GPIO3_23 0x14c 0x534 0x000 0x3 0x0
274#define MX51_PAD_NANDF_CS7__NANDF_CS7 0x14c 0x534 0x000 0x0 0x0
275#define MX51_PAD_NANDF_CS7__SD3_CLK 0x14c 0x534 0x000 0x5 0x0
276#define MX51_PAD_NANDF_RDY_INT__ECSPI2_SS0 0x150 0x538 0x000 0x2 0x0
277#define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK 0x150 0x538 0x974 0x1 0x0
278#define MX51_PAD_NANDF_RDY_INT__GPIO3_24 0x150 0x538 0x000 0x3 0x0
279#define MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT 0x150 0x538 0x938 0x0 0x0
280#define MX51_PAD_NANDF_RDY_INT__SD3_CMD 0x150 0x538 0x000 0x5 0x0
281#define MX51_PAD_NANDF_D15__ECSPI2_MOSI 0x154 0x53c 0x000 0x2 0x0
282#define MX51_PAD_NANDF_D15__GPIO3_25 0x154 0x53c 0x000 0x3 0x0
283#define MX51_PAD_NANDF_D15__NANDF_D15 0x154 0x53c 0x000 0x0 0x0
284#define MX51_PAD_NANDF_D15__PATA_DATA15 0x154 0x53c 0x000 0x1 0x0
285#define MX51_PAD_NANDF_D15__SD3_DAT7 0x154 0x53c 0x000 0x5 0x0
286#define MX51_PAD_NANDF_D14__ECSPI2_SS3 0x158 0x540 0x934 0x2 0x0
287#define MX51_PAD_NANDF_D14__GPIO3_26 0x158 0x540 0x000 0x3 0x0
288#define MX51_PAD_NANDF_D14__NANDF_D14 0x158 0x540 0x000 0x0 0x0
289#define MX51_PAD_NANDF_D14__PATA_DATA14 0x158 0x540 0x000 0x1 0x0
290#define MX51_PAD_NANDF_D14__SD3_DAT6 0x158 0x540 0x000 0x5 0x0
291#define MX51_PAD_NANDF_D13__ECSPI2_SS2 0x15c 0x544 0x000 0x2 0x0
292#define MX51_PAD_NANDF_D13__GPIO3_27 0x15c 0x544 0x000 0x3 0x0
293#define MX51_PAD_NANDF_D13__NANDF_D13 0x15c 0x544 0x000 0x0 0x0
294#define MX51_PAD_NANDF_D13__PATA_DATA13 0x15c 0x544 0x000 0x1 0x0
295#define MX51_PAD_NANDF_D13__SD3_DAT5 0x15c 0x544 0x000 0x5 0x0
296#define MX51_PAD_NANDF_D12__ECSPI2_SS1 0x160 0x548 0x930 0x2 0x1
297#define MX51_PAD_NANDF_D12__GPIO3_28 0x160 0x548 0x000 0x3 0x0
298#define MX51_PAD_NANDF_D12__NANDF_D12 0x160 0x548 0x000 0x0 0x0
299#define MX51_PAD_NANDF_D12__PATA_DATA12 0x160 0x548 0x000 0x1 0x0
300#define MX51_PAD_NANDF_D12__SD3_DAT4 0x160 0x548 0x000 0x5 0x0
301#define MX51_PAD_NANDF_D11__FEC_RX_DV 0x164 0x54c 0x96c 0x2 0x0
302#define MX51_PAD_NANDF_D11__GPIO3_29 0x164 0x54c 0x000 0x3 0x0
303#define MX51_PAD_NANDF_D11__NANDF_D11 0x164 0x54c 0x000 0x0 0x0
304#define MX51_PAD_NANDF_D11__PATA_DATA11 0x164 0x54c 0x000 0x1 0x0
305#define MX51_PAD_NANDF_D11__SD3_DATA3 0x164 0x54c 0x948 0x5 0x1
306#define MX51_PAD_NANDF_D10__GPIO3_30 0x168 0x550 0x000 0x3 0x0
307#define MX51_PAD_NANDF_D10__NANDF_D10 0x168 0x550 0x000 0x0 0x0
308#define MX51_PAD_NANDF_D10__PATA_DATA10 0x168 0x550 0x000 0x1 0x0
309#define MX51_PAD_NANDF_D10__SD3_DATA2 0x168 0x550 0x944 0x5 0x1
310#define MX51_PAD_NANDF_D9__FEC_RDATA0 0x16c 0x554 0x958 0x2 0x0
311#define MX51_PAD_NANDF_D9__GPIO3_31 0x16c 0x554 0x000 0x3 0x0
312#define MX51_PAD_NANDF_D9__NANDF_D9 0x16c 0x554 0x000 0x0 0x0
313#define MX51_PAD_NANDF_D9__PATA_DATA9 0x16c 0x554 0x000 0x1 0x0
314#define MX51_PAD_NANDF_D9__SD3_DATA1 0x16c 0x554 0x940 0x5 0x1
315#define MX51_PAD_NANDF_D8__FEC_TDATA0 0x170 0x558 0x000 0x2 0x0
316#define MX51_PAD_NANDF_D8__GPIO4_0 0x170 0x558 0x000 0x3 0x0
317#define MX51_PAD_NANDF_D8__NANDF_D8 0x170 0x558 0x000 0x0 0x0
318#define MX51_PAD_NANDF_D8__PATA_DATA8 0x170 0x558 0x000 0x1 0x0
319#define MX51_PAD_NANDF_D8__SD3_DATA0 0x170 0x558 0x93c 0x5 0x1
320#define MX51_PAD_NANDF_D7__GPIO4_1 0x174 0x55c 0x000 0x3 0x0
321#define MX51_PAD_NANDF_D7__NANDF_D7 0x174 0x55c 0x000 0x0 0x0
322#define MX51_PAD_NANDF_D7__PATA_DATA7 0x174 0x55c 0x000 0x1 0x0
323#define MX51_PAD_NANDF_D7__USBH3_DATA0 0x174 0x55c 0x9fc 0x5 0x0
324#define MX51_PAD_NANDF_D6__GPIO4_2 0x178 0x560 0x000 0x3 0x0
325#define MX51_PAD_NANDF_D6__NANDF_D6 0x178 0x560 0x000 0x0 0x0
326#define MX51_PAD_NANDF_D6__PATA_DATA6 0x178 0x560 0x000 0x1 0x0
327#define MX51_PAD_NANDF_D6__SD4_LCTL 0x178 0x560 0x000 0x2 0x0
328#define MX51_PAD_NANDF_D6__USBH3_DATA1 0x178 0x560 0xa00 0x5 0x0
329#define MX51_PAD_NANDF_D5__GPIO4_3 0x17c 0x564 0x000 0x3 0x0
330#define MX51_PAD_NANDF_D5__NANDF_D5 0x17c 0x564 0x000 0x0 0x0
331#define MX51_PAD_NANDF_D5__PATA_DATA5 0x17c 0x564 0x000 0x1 0x0
332#define MX51_PAD_NANDF_D5__SD4_WP 0x17c 0x564 0x000 0x2 0x0
333#define MX51_PAD_NANDF_D5__USBH3_DATA2 0x17c 0x564 0xa04 0x5 0x0
334#define MX51_PAD_NANDF_D4__GPIO4_4 0x180 0x568 0x000 0x3 0x0
335#define MX51_PAD_NANDF_D4__NANDF_D4 0x180 0x568 0x000 0x0 0x0
336#define MX51_PAD_NANDF_D4__PATA_DATA4 0x180 0x568 0x000 0x1 0x0
337#define MX51_PAD_NANDF_D4__SD4_CD 0x180 0x568 0x000 0x2 0x0
338#define MX51_PAD_NANDF_D4__USBH3_DATA3 0x180 0x568 0xa08 0x5 0x0
339#define MX51_PAD_NANDF_D3__GPIO4_5 0x184 0x56c 0x000 0x3 0x0
340#define MX51_PAD_NANDF_D3__NANDF_D3 0x184 0x56c 0x000 0x0 0x0
341#define MX51_PAD_NANDF_D3__PATA_DATA3 0x184 0x56c 0x000 0x1 0x0
342#define MX51_PAD_NANDF_D3__SD4_DAT4 0x184 0x56c 0x000 0x2 0x0
343#define MX51_PAD_NANDF_D3__USBH3_DATA4 0x184 0x56c 0xa0c 0x5 0x0
344#define MX51_PAD_NANDF_D2__GPIO4_6 0x188 0x570 0x000 0x3 0x0
345#define MX51_PAD_NANDF_D2__NANDF_D2 0x188 0x570 0x000 0x0 0x0
346#define MX51_PAD_NANDF_D2__PATA_DATA2 0x188 0x570 0x000 0x1 0x0
347#define MX51_PAD_NANDF_D2__SD4_DAT5 0x188 0x570 0x000 0x2 0x0
348#define MX51_PAD_NANDF_D2__USBH3_DATA5 0x188 0x570 0xa10 0x5 0x0
349#define MX51_PAD_NANDF_D1__GPIO4_7 0x18c 0x574 0x000 0x3 0x0
350#define MX51_PAD_NANDF_D1__NANDF_D1 0x18c 0x574 0x000 0x0 0x0
351#define MX51_PAD_NANDF_D1__PATA_DATA1 0x18c 0x574 0x000 0x1 0x0
352#define MX51_PAD_NANDF_D1__SD4_DAT6 0x18c 0x574 0x000 0x2 0x0
353#define MX51_PAD_NANDF_D1__USBH3_DATA6 0x18c 0x574 0xa14 0x5 0x0
354#define MX51_PAD_NANDF_D0__GPIO4_8 0x190 0x578 0x000 0x3 0x0
355#define MX51_PAD_NANDF_D0__NANDF_D0 0x190 0x578 0x000 0x0 0x0
356#define MX51_PAD_NANDF_D0__PATA_DATA0 0x190 0x578 0x000 0x1 0x0
357#define MX51_PAD_NANDF_D0__SD4_DAT7 0x190 0x578 0x000 0x2 0x0
358#define MX51_PAD_NANDF_D0__USBH3_DATA7 0x190 0x578 0xa18 0x5 0x0
359#define MX51_PAD_CSI1_D8__CSI1_D8 0x194 0x57c 0x000 0x0 0x0
360#define MX51_PAD_CSI1_D8__GPIO3_12 0x194 0x57c 0x998 0x3 0x1
361#define MX51_PAD_CSI1_D9__CSI1_D9 0x198 0x580 0x000 0x0 0x0
362#define MX51_PAD_CSI1_D9__GPIO3_13 0x198 0x580 0x000 0x3 0x0
363#define MX51_PAD_CSI1_D10__CSI1_D10 0x19c 0x584 0x000 0x0 0x0
364#define MX51_PAD_CSI1_D11__CSI1_D11 0x1a0 0x588 0x000 0x0 0x0
365#define MX51_PAD_CSI1_D12__CSI1_D12 0x1a4 0x58c 0x000 0x0 0x0
366#define MX51_PAD_CSI1_D13__CSI1_D13 0x1a8 0x590 0x000 0x0 0x0
367#define MX51_PAD_CSI1_D14__CSI1_D14 0x1ac 0x594 0x000 0x0 0x0
368#define MX51_PAD_CSI1_D15__CSI1_D15 0x1b0 0x598 0x000 0x0 0x0
369#define MX51_PAD_CSI1_D16__CSI1_D16 0x1b4 0x59c 0x000 0x0 0x0
370#define MX51_PAD_CSI1_D17__CSI1_D17 0x1b8 0x5a0 0x000 0x0 0x0
371#define MX51_PAD_CSI1_D18__CSI1_D18 0x1bc 0x5a4 0x000 0x0 0x0
372#define MX51_PAD_CSI1_D19__CSI1_D19 0x1c0 0x5a8 0x000 0x0 0x0
373#define MX51_PAD_CSI1_VSYNC__CSI1_VSYNC 0x1c4 0x5ac 0x000 0x0 0x0
374#define MX51_PAD_CSI1_VSYNC__GPIO3_14 0x1c4 0x5ac 0x000 0x3 0x0
375#define MX51_PAD_CSI1_HSYNC__CSI1_HSYNC 0x1c8 0x5b0 0x000 0x0 0x0
376#define MX51_PAD_CSI1_HSYNC__GPIO3_15 0x1c8 0x5b0 0x000 0x3 0x0
377#define MX51_PAD_CSI1_PIXCLK__CSI1_PIXCLK 0x000 0x5b4 0x000 0x0 0x0
378#define MX51_PAD_CSI1_MCLK__CSI1_MCLK 0x000 0x5b8 0x000 0x0 0x0
379#define MX51_PAD_CSI2_D12__CSI2_D12 0x1cc 0x5bc 0x000 0x0 0x0
380#define MX51_PAD_CSI2_D12__GPIO4_9 0x1cc 0x5bc 0x000 0x3 0x0
381#define MX51_PAD_CSI2_D13__CSI2_D13 0x1d0 0x5c0 0x000 0x0 0x0
382#define MX51_PAD_CSI2_D13__GPIO4_10 0x1d0 0x5c0 0x000 0x3 0x0
383#define MX51_PAD_CSI2_D14__CSI2_D14 0x1d4 0x5c4 0x000 0x0 0x0
384#define MX51_PAD_CSI2_D15__CSI2_D15 0x1d8 0x5c8 0x000 0x0 0x0
385#define MX51_PAD_CSI2_D16__CSI2_D16 0x1dc 0x5cc 0x000 0x0 0x0
386#define MX51_PAD_CSI2_D17__CSI2_D17 0x1e0 0x5d0 0x000 0x0 0x0
387#define MX51_PAD_CSI2_D18__CSI2_D18 0x1e4 0x5d4 0x000 0x0 0x0
388#define MX51_PAD_CSI2_D18__GPIO4_11 0x1e4 0x5d4 0x000 0x3 0x0
389#define MX51_PAD_CSI2_D19__CSI2_D19 0x1e8 0x5d8 0x000 0x0 0x0
390#define MX51_PAD_CSI2_D19__GPIO4_12 0x1e8 0x5d8 0x000 0x3 0x0
391#define MX51_PAD_CSI2_VSYNC__CSI2_VSYNC 0x1ec 0x5dc 0x000 0x0 0x0
392#define MX51_PAD_CSI2_VSYNC__GPIO4_13 0x1ec 0x5dc 0x000 0x3 0x0
393#define MX51_PAD_CSI2_HSYNC__CSI2_HSYNC 0x1f0 0x5e0 0x000 0x0 0x0
394#define MX51_PAD_CSI2_HSYNC__GPIO4_14 0x1f0 0x5e0 0x000 0x3 0x0
395#define MX51_PAD_CSI2_PIXCLK__CSI2_PIXCLK 0x1f4 0x5e4 0x000 0x0 0x0
396#define MX51_PAD_CSI2_PIXCLK__GPIO4_15 0x1f4 0x5e4 0x000 0x3 0x0
397#define MX51_PAD_I2C1_CLK__GPIO4_16 0x1f8 0x5e8 0x000 0x3 0x0
398#define MX51_PAD_I2C1_CLK__I2C1_CLK 0x1f8 0x5e8 0x000 0x0 0x0
399#define MX51_PAD_I2C1_DAT__GPIO4_17 0x1fc 0x5ec 0x000 0x3 0x0
400#define MX51_PAD_I2C1_DAT__I2C1_DAT 0x1fc 0x5ec 0x000 0x0 0x0
401#define MX51_PAD_AUD3_BB_TXD__AUD3_TXD 0x200 0x5f0 0x000 0x0 0x0
402#define MX51_PAD_AUD3_BB_TXD__GPIO4_18 0x200 0x5f0 0x000 0x3 0x0
403#define MX51_PAD_AUD3_BB_RXD__AUD3_RXD 0x204 0x5f4 0x000 0x0 0x0
404#define MX51_PAD_AUD3_BB_RXD__GPIO4_19 0x204 0x5f4 0x000 0x3 0x0
405#define MX51_PAD_AUD3_BB_RXD__UART3_RXD 0x204 0x5f4 0x9f4 0x1 0x2
406#define MX51_PAD_AUD3_BB_CK__AUD3_TXC 0x208 0x5f8 0x000 0x0 0x0
407#define MX51_PAD_AUD3_BB_CK__GPIO4_20 0x208 0x5f8 0x000 0x3 0x0
408#define MX51_PAD_AUD3_BB_FS__AUD3_TXFS 0x20c 0x5fc 0x000 0x0 0x0
409#define MX51_PAD_AUD3_BB_FS__GPIO4_21 0x20c 0x5fc 0x000 0x3 0x0
410#define MX51_PAD_AUD3_BB_FS__UART3_TXD 0x20c 0x5fc 0x000 0x1 0x0
411#define MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI 0x210 0x600 0x000 0x0 0x0
412#define MX51_PAD_CSPI1_MOSI__GPIO4_22 0x210 0x600 0x000 0x3 0x0
413#define MX51_PAD_CSPI1_MOSI__I2C1_SDA 0x210 0x600 0x9b4 0x1 0x1
414#define MX51_PAD_CSPI1_MISO__AUD4_RXD 0x214 0x604 0x8c4 0x1 0x1
415#define MX51_PAD_CSPI1_MISO__ECSPI1_MISO 0x214 0x604 0x000 0x0 0x0
416#define MX51_PAD_CSPI1_MISO__GPIO4_23 0x214 0x604 0x000 0x3 0x0
417#define MX51_PAD_CSPI1_SS0__AUD4_TXC 0x218 0x608 0x8cc 0x1 0x1
418#define MX51_PAD_CSPI1_SS0__ECSPI1_SS0 0x218 0x608 0x000 0x0 0x0
419#define MX51_PAD_CSPI1_SS0__GPIO4_24 0x218 0x608 0x000 0x3 0x0
420#define MX51_PAD_CSPI1_SS1__AUD4_TXD 0x21c 0x60c 0x8c8 0x1 0x1
421#define MX51_PAD_CSPI1_SS1__ECSPI1_SS1 0x21c 0x60c 0x000 0x0 0x0
422#define MX51_PAD_CSPI1_SS1__GPIO4_25 0x21c 0x60c 0x000 0x3 0x0
423#define MX51_PAD_CSPI1_RDY__AUD4_TXFS 0x220 0x610 0x8d0 0x1 0x1
424#define MX51_PAD_CSPI1_RDY__ECSPI1_RDY 0x220 0x610 0x000 0x0 0x0
425#define MX51_PAD_CSPI1_RDY__GPIO4_26 0x220 0x610 0x000 0x3 0x0
426#define MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK 0x224 0x614 0x000 0x0 0x0
427#define MX51_PAD_CSPI1_SCLK__GPIO4_27 0x224 0x614 0x000 0x3 0x0
428#define MX51_PAD_CSPI1_SCLK__I2C1_SCL 0x224 0x614 0x9b0 0x1 0x1
429#define MX51_PAD_UART1_RXD__GPIO4_28 0x228 0x618 0x000 0x3 0x0
430#define MX51_PAD_UART1_RXD__UART1_RXD 0x228 0x618 0x9e4 0x0 0x0
431#define MX51_PAD_UART1_TXD__GPIO4_29 0x22c 0x61c 0x000 0x3 0x0
432#define MX51_PAD_UART1_TXD__PWM2_PWMO 0x22c 0x61c 0x000 0x1 0x0
433#define MX51_PAD_UART1_TXD__UART1_TXD 0x22c 0x61c 0x000 0x0 0x0
434#define MX51_PAD_UART1_RTS__GPIO4_30 0x230 0x620 0x000 0x3 0x0
435#define MX51_PAD_UART1_RTS__UART1_RTS 0x230 0x620 0x9e0 0x0 0x0
436#define MX51_PAD_UART1_CTS__GPIO4_31 0x234 0x624 0x000 0x3 0x0
437#define MX51_PAD_UART1_CTS__UART1_CTS 0x234 0x624 0x000 0x0 0x0
438#define MX51_PAD_UART2_RXD__FIRI_TXD 0x238 0x628 0x000 0x1 0x0
439#define MX51_PAD_UART2_RXD__GPIO1_20 0x238 0x628 0x000 0x3 0x0
440#define MX51_PAD_UART2_RXD__UART2_RXD 0x238 0x628 0x9ec 0x0 0x2
441#define MX51_PAD_UART2_TXD__FIRI_RXD 0x23c 0x62c 0x000 0x1 0x0
442#define MX51_PAD_UART2_TXD__GPIO1_21 0x23c 0x62c 0x000 0x3 0x0
443#define MX51_PAD_UART2_TXD__UART2_TXD 0x23c 0x62c 0x000 0x0 0x0
444#define MX51_PAD_UART3_RXD__CSI1_D0 0x240 0x630 0x000 0x2 0x0
445#define MX51_PAD_UART3_RXD__GPIO1_22 0x240 0x630 0x000 0x3 0x0
446#define MX51_PAD_UART3_RXD__UART1_DTR 0x240 0x630 0x000 0x0 0x0
447#define MX51_PAD_UART3_RXD__UART3_RXD 0x240 0x630 0x9f4 0x1 0x4
448#define MX51_PAD_UART3_TXD__CSI1_D1 0x244 0x634 0x000 0x2 0x0
449#define MX51_PAD_UART3_TXD__GPIO1_23 0x244 0x634 0x000 0x3 0x0
450#define MX51_PAD_UART3_TXD__UART1_DSR 0x244 0x634 0x000 0x0 0x0
451#define MX51_PAD_UART3_TXD__UART3_TXD 0x244 0x634 0x000 0x1 0x0
452#define MX51_PAD_OWIRE_LINE__GPIO1_24 0x248 0x638 0x000 0x3 0x0
453#define MX51_PAD_OWIRE_LINE__OWIRE_LINE 0x248 0x638 0x000 0x0 0x0
454#define MX51_PAD_OWIRE_LINE__SPDIF_OUT 0x248 0x638 0x000 0x6 0x0
455#define MX51_PAD_KEY_ROW0__KEY_ROW0 0x24c 0x63c 0x000 0x0 0x0
456#define MX51_PAD_KEY_ROW1__KEY_ROW1 0x250 0x640 0x000 0x0 0x0
457#define MX51_PAD_KEY_ROW2__KEY_ROW2 0x254 0x644 0x000 0x0 0x0
458#define MX51_PAD_KEY_ROW3__KEY_ROW3 0x258 0x648 0x000 0x0 0x0
459#define MX51_PAD_KEY_COL0__KEY_COL0 0x25c 0x64c 0x000 0x0 0x0
460#define MX51_PAD_KEY_COL0__PLL1_BYP 0x25c 0x64c 0x90c 0x7 0x0
461#define MX51_PAD_KEY_COL1__KEY_COL1 0x260 0x650 0x000 0x0 0x0
462#define MX51_PAD_KEY_COL1__PLL2_BYP 0x260 0x650 0x910 0x7 0x0
463#define MX51_PAD_KEY_COL2__KEY_COL2 0x264 0x654 0x000 0x0 0x0
464#define MX51_PAD_KEY_COL2__PLL3_BYP 0x264 0x654 0x000 0x7 0x0
465#define MX51_PAD_KEY_COL3__KEY_COL3 0x268 0x658 0x000 0x0 0x0
466#define MX51_PAD_KEY_COL4__I2C2_SCL 0x26c 0x65c 0x9b8 0x3 0x1
467#define MX51_PAD_KEY_COL4__KEY_COL4 0x26c 0x65c 0x000 0x0 0x0
468#define MX51_PAD_KEY_COL4__SPDIF_OUT1 0x26c 0x65c 0x000 0x6 0x0
469#define MX51_PAD_KEY_COL4__UART1_RI 0x26c 0x65c 0x000 0x1 0x0
470#define MX51_PAD_KEY_COL4__UART3_RTS 0x26c 0x65c 0x9f0 0x2 0x4
471#define MX51_PAD_KEY_COL5__I2C2_SDA 0x270 0x660 0x9bc 0x3 0x1
472#define MX51_PAD_KEY_COL5__KEY_COL5 0x270 0x660 0x000 0x0 0x0
473#define MX51_PAD_KEY_COL5__UART1_DCD 0x270 0x660 0x000 0x1 0x0
474#define MX51_PAD_KEY_COL5__UART3_CTS 0x270 0x660 0x000 0x2 0x0
475#define MX51_PAD_USBH1_CLK__CSPI_SCLK 0x278 0x678 0x914 0x1 0x1
476#define MX51_PAD_USBH1_CLK__GPIO1_25 0x278 0x678 0x000 0x2 0x0
477#define MX51_PAD_USBH1_CLK__I2C2_SCL 0x278 0x678 0x9b8 0x5 0x2
478#define MX51_PAD_USBH1_CLK__USBH1_CLK 0x278 0x678 0x000 0x0 0x0
479#define MX51_PAD_USBH1_DIR__CSPI_MOSI 0x27c 0x67c 0x91c 0x1 0x1
480#define MX51_PAD_USBH1_DIR__GPIO1_26 0x27c 0x67c 0x000 0x2 0x0
481#define MX51_PAD_USBH1_DIR__I2C2_SDA 0x27c 0x67c 0x9bc 0x5 0x2
482#define MX51_PAD_USBH1_DIR__USBH1_DIR 0x27c 0x67c 0x000 0x0 0x0
483#define MX51_PAD_USBH1_STP__CSPI_RDY 0x280 0x680 0x000 0x1 0x0
484#define MX51_PAD_USBH1_STP__GPIO1_27 0x280 0x680 0x000 0x2 0x0
485#define MX51_PAD_USBH1_STP__UART3_RXD 0x280 0x680 0x9f4 0x5 0x6
486#define MX51_PAD_USBH1_STP__USBH1_STP 0x280 0x680 0x000 0x0 0x0
487#define MX51_PAD_USBH1_NXT__CSPI_MISO 0x284 0x684 0x918 0x1 0x0
488#define MX51_PAD_USBH1_NXT__GPIO1_28 0x284 0x684 0x000 0x2 0x0
489#define MX51_PAD_USBH1_NXT__UART3_TXD 0x284 0x684 0x000 0x5 0x0
490#define MX51_PAD_USBH1_NXT__USBH1_NXT 0x284 0x684 0x000 0x0 0x0
491#define MX51_PAD_USBH1_DATA0__GPIO1_11 0x288 0x688 0x000 0x2 0x0
492#define MX51_PAD_USBH1_DATA0__UART2_CTS 0x288 0x688 0x000 0x1 0x0
493#define MX51_PAD_USBH1_DATA0__USBH1_DATA0 0x288 0x688 0x000 0x0 0x0
494#define MX51_PAD_USBH1_DATA1__GPIO1_12 0x28c 0x68c 0x000 0x2 0x0
495#define MX51_PAD_USBH1_DATA1__UART2_RXD 0x28c 0x68c 0x9ec 0x1 0x4
496#define MX51_PAD_USBH1_DATA1__USBH1_DATA1 0x28c 0x68c 0x000 0x0 0x0
497#define MX51_PAD_USBH1_DATA2__GPIO1_13 0x290 0x690 0x000 0x2 0x0
498#define MX51_PAD_USBH1_DATA2__UART2_TXD 0x290 0x690 0x000 0x1 0x0
499#define MX51_PAD_USBH1_DATA2__USBH1_DATA2 0x290 0x690 0x000 0x0 0x0
500#define MX51_PAD_USBH1_DATA3__GPIO1_14 0x294 0x694 0x000 0x2 0x0
501#define MX51_PAD_USBH1_DATA3__UART2_RTS 0x294 0x694 0x9e8 0x1 0x5
502#define MX51_PAD_USBH1_DATA3__USBH1_DATA3 0x294 0x694 0x000 0x0 0x0
503#define MX51_PAD_USBH1_DATA4__CSPI_SS0 0x298 0x698 0x000 0x1 0x0
504#define MX51_PAD_USBH1_DATA4__GPIO1_15 0x298 0x698 0x000 0x2 0x0
505#define MX51_PAD_USBH1_DATA4__USBH1_DATA4 0x298 0x698 0x000 0x0 0x0
506#define MX51_PAD_USBH1_DATA5__CSPI_SS1 0x29c 0x69c 0x920 0x1 0x0
507#define MX51_PAD_USBH1_DATA5__GPIO1_16 0x29c 0x69c 0x000 0x2 0x0
508#define MX51_PAD_USBH1_DATA5__USBH1_DATA5 0x29c 0x69c 0x000 0x0 0x0
509#define MX51_PAD_USBH1_DATA6__CSPI_SS3 0x2a0 0x6a0 0x928 0x1 0x1
510#define MX51_PAD_USBH1_DATA6__GPIO1_17 0x2a0 0x6a0 0x000 0x2 0x0
511#define MX51_PAD_USBH1_DATA6__USBH1_DATA6 0x2a0 0x6a0 0x000 0x0 0x0
512#define MX51_PAD_USBH1_DATA7__ECSPI1_SS3 0x2a4 0x6a4 0x000 0x1 0x0
513#define MX51_PAD_USBH1_DATA7__ECSPI2_SS3 0x2a4 0x6a4 0x934 0x5 0x1
514#define MX51_PAD_USBH1_DATA7__GPIO1_18 0x2a4 0x6a4 0x000 0x2 0x0
515#define MX51_PAD_USBH1_DATA7__USBH1_DATA7 0x2a4 0x6a4 0x000 0x0 0x0
516#define MX51_PAD_DI1_PIN11__DI1_PIN11 0x2a8 0x6a8 0x000 0x0 0x0
517#define MX51_PAD_DI1_PIN11__ECSPI1_SS2 0x2a8 0x6a8 0x000 0x7 0x0
518#define MX51_PAD_DI1_PIN11__GPIO3_0 0x2a8 0x6a8 0x000 0x4 0x0
519#define MX51_PAD_DI1_PIN12__DI1_PIN12 0x2ac 0x6ac 0x000 0x0 0x0
520#define MX51_PAD_DI1_PIN12__GPIO3_1 0x2ac 0x6ac 0x978 0x4 0x1
521#define MX51_PAD_DI1_PIN13__DI1_PIN13 0x2b0 0x6b0 0x000 0x0 0x0
522#define MX51_PAD_DI1_PIN13__GPIO3_2 0x2b0 0x6b0 0x97c 0x4 0x1
523#define MX51_PAD_DI1_D0_CS__DI1_D0_CS 0x2b4 0x6b4 0x000 0x0 0x0
524#define MX51_PAD_DI1_D0_CS__GPIO3_3 0x2b4 0x6b4 0x980 0x4 0x1
525#define MX51_PAD_DI1_D1_CS__DI1_D1_CS 0x2b8 0x6b8 0x000 0x0 0x0
526#define MX51_PAD_DI1_D1_CS__DISP1_PIN14 0x2b8 0x6b8 0x000 0x2 0x0
527#define MX51_PAD_DI1_D1_CS__DISP1_PIN5 0x2b8 0x6b8 0x000 0x3 0x0
528#define MX51_PAD_DI1_D1_CS__GPIO3_4 0x2b8 0x6b8 0x984 0x4 0x1
529#define MX51_PAD_DISPB2_SER_DIN__DISP1_PIN1 0x2bc 0x6bc 0x9a4 0x2 0x1
530#define MX51_PAD_DISPB2_SER_DIN__DISPB2_SER_DIN 0x2bc 0x6bc 0x9c4 0x0 0x0
531#define MX51_PAD_DISPB2_SER_DIN__GPIO3_5 0x2bc 0x6bc 0x988 0x4 0x1
532#define MX51_PAD_DISPB2_SER_DIO__DISP1_PIN6 0x2c0 0x6c0 0x000 0x3 0x0
533#define MX51_PAD_DISPB2_SER_DIO__DISPB2_SER_DIO 0x2c0 0x6c0 0x9c4 0x0 0x1
534#define MX51_PAD_DISPB2_SER_DIO__GPIO3_6 0x2c0 0x6c0 0x98c 0x4 0x1
535#define MX51_PAD_DISPB2_SER_CLK__DISP1_PIN17 0x2c4 0x6c4 0x000 0x2 0x0
536#define MX51_PAD_DISPB2_SER_CLK__DISP1_PIN7 0x2c4 0x6c4 0x000 0x3 0x0
537#define MX51_PAD_DISPB2_SER_CLK__DISPB2_SER_CLK 0x2c4 0x6c4 0x000 0x0 0x0
538#define MX51_PAD_DISPB2_SER_CLK__GPIO3_7 0x2c4 0x6c4 0x990 0x4 0x1
539#define MX51_PAD_DISPB2_SER_RS__DISP1_EXT_CLK 0x2c8 0x6c8 0x000 0x2 0x0
540#define MX51_PAD_DISPB2_SER_RS__DISP1_PIN16 0x2c8 0x6c8 0x000 0x2 0x0
541#define MX51_PAD_DISPB2_SER_RS__DISP1_PIN8 0x2c8 0x6c8 0x000 0x3 0x0
542#define MX51_PAD_DISPB2_SER_RS__DISPB2_SER_RS 0x2c8 0x6c8 0x000 0x0 0x0
543#define MX51_PAD_DISPB2_SER_RS__GPIO3_8 0x2c8 0x6c8 0x994 0x4 0x1
544#define MX51_PAD_DISP1_DAT0__DISP1_DAT0 0x2cc 0x6cc 0x000 0x0 0x0
545#define MX51_PAD_DISP1_DAT1__DISP1_DAT1 0x2d0 0x6d0 0x000 0x0 0x0
546#define MX51_PAD_DISP1_DAT2__DISP1_DAT2 0x2d4 0x6d4 0x000 0x0 0x0
547#define MX51_PAD_DISP1_DAT3__DISP1_DAT3 0x2d8 0x6d8 0x000 0x0 0x0
548#define MX51_PAD_DISP1_DAT4__DISP1_DAT4 0x2dc 0x6dc 0x000 0x0 0x0
549#define MX51_PAD_DISP1_DAT5__DISP1_DAT5 0x2e0 0x6e0 0x000 0x0 0x0
550#define MX51_PAD_DISP1_DAT6__BOOT_USB_SRC 0x2e4 0x6e4 0x000 0x7 0x0
551#define MX51_PAD_DISP1_DAT6__DISP1_DAT6 0x2e4 0x6e4 0x000 0x0 0x0
552#define MX51_PAD_DISP1_DAT7__BOOT_EEPROM_CFG 0x2e8 0x6e8 0x000 0x7 0x0
553#define MX51_PAD_DISP1_DAT7__DISP1_DAT7 0x2e8 0x6e8 0x000 0x0 0x0
554#define MX51_PAD_DISP1_DAT8__BOOT_SRC0 0x2ec 0x6ec 0x000 0x7 0x0
555#define MX51_PAD_DISP1_DAT8__DISP1_DAT8 0x2ec 0x6ec 0x000 0x0 0x0
556#define MX51_PAD_DISP1_DAT9__BOOT_SRC1 0x2f0 0x6f0 0x000 0x7 0x0
557#define MX51_PAD_DISP1_DAT9__DISP1_DAT9 0x2f0 0x6f0 0x000 0x0 0x0
558#define MX51_PAD_DISP1_DAT10__BOOT_SPARE_SIZE 0x2f4 0x6f4 0x000 0x7 0x0
559#define MX51_PAD_DISP1_DAT10__DISP1_DAT10 0x2f4 0x6f4 0x000 0x0 0x0
560#define MX51_PAD_DISP1_DAT11__BOOT_LPB_FREQ2 0x2f8 0x6f8 0x000 0x7 0x0
561#define MX51_PAD_DISP1_DAT11__DISP1_DAT11 0x2f8 0x6f8 0x000 0x0 0x0
562#define MX51_PAD_DISP1_DAT12__BOOT_MLC_SEL 0x2fc 0x6fc 0x000 0x7 0x0
563#define MX51_PAD_DISP1_DAT12__DISP1_DAT12 0x2fc 0x6fc 0x000 0x0 0x0
564#define MX51_PAD_DISP1_DAT13__BOOT_MEM_CTL0 0x300 0x700 0x000 0x7 0x0
565#define MX51_PAD_DISP1_DAT13__DISP1_DAT13 0x300 0x700 0x000 0x0 0x0
566#define MX51_PAD_DISP1_DAT14__BOOT_MEM_CTL1 0x304 0x704 0x000 0x7 0x0
567#define MX51_PAD_DISP1_DAT14__DISP1_DAT14 0x304 0x704 0x000 0x0 0x0
568#define MX51_PAD_DISP1_DAT15__BOOT_BUS_WIDTH 0x308 0x708 0x000 0x7 0x0
569#define MX51_PAD_DISP1_DAT15__DISP1_DAT15 0x308 0x708 0x000 0x0 0x0
570#define MX51_PAD_DISP1_DAT16__BOOT_PAGE_SIZE0 0x30c 0x70c 0x000 0x7 0x0
571#define MX51_PAD_DISP1_DAT16__DISP1_DAT16 0x30c 0x70c 0x000 0x0 0x0
572#define MX51_PAD_DISP1_DAT17__BOOT_PAGE_SIZE1 0x310 0x710 0x000 0x7 0x0
573#define MX51_PAD_DISP1_DAT17__DISP1_DAT17 0x310 0x710 0x000 0x0 0x0
574#define MX51_PAD_DISP1_DAT18__BOOT_WEIM_MUXED0 0x314 0x714 0x000 0x7 0x0
575#define MX51_PAD_DISP1_DAT18__DISP1_DAT18 0x314 0x714 0x000 0x0 0x0
576#define MX51_PAD_DISP1_DAT18__DISP2_PIN11 0x314 0x714 0x000 0x5 0x0
577#define MX51_PAD_DISP1_DAT18__DISP2_PIN5 0x314 0x714 0x000 0x4 0x0
578#define MX51_PAD_DISP1_DAT19__BOOT_WEIM_MUXED1 0x318 0x718 0x000 0x7 0x0
579#define MX51_PAD_DISP1_DAT19__DISP1_DAT19 0x318 0x718 0x000 0x0 0x0
580#define MX51_PAD_DISP1_DAT19__DISP2_PIN12 0x318 0x718 0x000 0x5 0x0
581#define MX51_PAD_DISP1_DAT19__DISP2_PIN6 0x318 0x718 0x000 0x4 0x0
582#define MX51_PAD_DISP1_DAT20__BOOT_MEM_TYPE0 0x31c 0x71c 0x000 0x7 0x0
583#define MX51_PAD_DISP1_DAT20__DISP1_DAT20 0x31c 0x71c 0x000 0x0 0x0
584#define MX51_PAD_DISP1_DAT20__DISP2_PIN13 0x31c 0x71c 0x000 0x5 0x0
585#define MX51_PAD_DISP1_DAT20__DISP2_PIN7 0x31c 0x71c 0x000 0x4 0x0
586#define MX51_PAD_DISP1_DAT21__BOOT_MEM_TYPE1 0x320 0x720 0x000 0x7 0x0
587#define MX51_PAD_DISP1_DAT21__DISP1_DAT21 0x320 0x720 0x000 0x0 0x0
588#define MX51_PAD_DISP1_DAT21__DISP2_PIN14 0x320 0x720 0x000 0x5 0x0
589#define MX51_PAD_DISP1_DAT21__DISP2_PIN8 0x320 0x720 0x000 0x4 0x0
590#define MX51_PAD_DISP1_DAT22__BOOT_LPB_FREQ0 0x324 0x724 0x000 0x7 0x0
591#define MX51_PAD_DISP1_DAT22__DISP1_DAT22 0x324 0x724 0x000 0x0 0x0
592#define MX51_PAD_DISP1_DAT22__DISP2_D0_CS 0x324 0x724 0x000 0x6 0x0
593#define MX51_PAD_DISP1_DAT22__DISP2_DAT16 0x324 0x724 0x000 0x5 0x0
594#define MX51_PAD_DISP1_DAT23__BOOT_LPB_FREQ1 0x328 0x728 0x000 0x7 0x0
595#define MX51_PAD_DISP1_DAT23__DISP1_DAT23 0x328 0x728 0x000 0x0 0x0
596#define MX51_PAD_DISP1_DAT23__DISP2_D1_CS 0x328 0x728 0x000 0x6 0x0
597#define MX51_PAD_DISP1_DAT23__DISP2_DAT17 0x328 0x728 0x000 0x5 0x0
598#define MX51_PAD_DISP1_DAT23__DISP2_SER_CS 0x328 0x728 0x000 0x4 0x0
599#define MX51_PAD_DI1_PIN3__DI1_PIN3 0x32c 0x72c 0x000 0x0 0x0
600#define MX51_PAD_DI1_PIN2__DI1_PIN2 0x330 0x734 0x000 0x0 0x0
601#define MX51_PAD_DI_GP2__DISP1_SER_CLK 0x338 0x740 0x000 0x0 0x0
602#define MX51_PAD_DI_GP2__DISP2_WAIT 0x338 0x740 0x9a8 0x2 0x1
603#define MX51_PAD_DI_GP3__CSI1_DATA_EN 0x33c 0x744 0x9a0 0x3 0x1
604#define MX51_PAD_DI_GP3__DISP1_SER_DIO 0x33c 0x744 0x9c0 0x0 0x0
605#define MX51_PAD_DI_GP3__FEC_TX_ER 0x33c 0x744 0x000 0x2 0x0
606#define MX51_PAD_DI2_PIN4__CSI2_DATA_EN 0x340 0x748 0x99c 0x3 0x1
607#define MX51_PAD_DI2_PIN4__DI2_PIN4 0x340 0x748 0x000 0x0 0x0
608#define MX51_PAD_DI2_PIN4__FEC_CRS 0x340 0x748 0x950 0x2 0x1
609#define MX51_PAD_DI2_PIN2__DI2_PIN2 0x344 0x74c 0x000 0x0 0x0
610#define MX51_PAD_DI2_PIN2__FEC_MDC 0x344 0x74c 0x000 0x2 0x0
611#define MX51_PAD_DI2_PIN3__DI2_PIN3 0x348 0x750 0x000 0x0 0x0
612#define MX51_PAD_DI2_PIN3__FEC_MDIO 0x348 0x750 0x954 0x2 0x1
613#define MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK 0x34c 0x754 0x000 0x0 0x0
614#define MX51_PAD_DI2_DISP_CLK__FEC_RDATA1 0x34c 0x754 0x95c 0x2 0x1
615#define MX51_PAD_DI_GP4__DI2_PIN15 0x350 0x758 0x000 0x4 0x0
616#define MX51_PAD_DI_GP4__DISP1_SER_DIN 0x350 0x758 0x9c0 0x0 0x1
617#define MX51_PAD_DI_GP4__DISP2_PIN1 0x350 0x758 0x000 0x3 0x0
618#define MX51_PAD_DI_GP4__FEC_RDATA2 0x350 0x758 0x960 0x2 0x1
619#define MX51_PAD_DISP2_DAT0__DISP2_DAT0 0x354 0x75c 0x000 0x0 0x0
620#define MX51_PAD_DISP2_DAT0__FEC_RDATA3 0x354 0x75c 0x964 0x2 0x1
621#define MX51_PAD_DISP2_DAT0__KEY_COL6 0x354 0x75c 0x9c8 0x4 0x1
622#define MX51_PAD_DISP2_DAT0__UART3_RXD 0x354 0x75c 0x9f4 0x5 0x8
623#define MX51_PAD_DISP2_DAT0__USBH3_CLK 0x354 0x75c 0x9f8 0x3 0x1
624#define MX51_PAD_DISP2_DAT1__DISP2_DAT1 0x358 0x760 0x000 0x0 0x0
625#define MX51_PAD_DISP2_DAT1__FEC_RX_ER 0x358 0x760 0x970 0x2 0x1
626#define MX51_PAD_DISP2_DAT1__KEY_COL7 0x358 0x760 0x9cc 0x4 0x1
627#define MX51_PAD_DISP2_DAT1__UART3_TXD 0x358 0x760 0x000 0x5 0x0
628#define MX51_PAD_DISP2_DAT1__USBH3_DIR 0x358 0x760 0xa1c 0x3 0x1
629#define MX51_PAD_DISP2_DAT2__DISP2_DAT2 0x35c 0x764 0x000 0x0 0x0
630#define MX51_PAD_DISP2_DAT3__DISP2_DAT3 0x360 0x768 0x000 0x0 0x0
631#define MX51_PAD_DISP2_DAT4__DISP2_DAT4 0x364 0x76c 0x000 0x0 0x0
632#define MX51_PAD_DISP2_DAT5__DISP2_DAT5 0x368 0x770 0x000 0x0 0x0
633#define MX51_PAD_DISP2_DAT6__DISP2_DAT6 0x36c 0x774 0x000 0x0 0x0
634#define MX51_PAD_DISP2_DAT6__FEC_TDATA1 0x36c 0x774 0x000 0x2 0x0
635#define MX51_PAD_DISP2_DAT6__GPIO1_19 0x36c 0x774 0x000 0x5 0x0
636#define MX51_PAD_DISP2_DAT6__KEY_ROW4 0x36c 0x774 0x9d0 0x4 0x1
637#define MX51_PAD_DISP2_DAT6__USBH3_STP 0x36c 0x774 0xa24 0x3 0x1
638#define MX51_PAD_DISP2_DAT7__DISP2_DAT7 0x370 0x778 0x000 0x0 0x0
639#define MX51_PAD_DISP2_DAT7__FEC_TDATA2 0x370 0x778 0x000 0x2 0x0
640#define MX51_PAD_DISP2_DAT7__GPIO1_29 0x370 0x778 0x000 0x5 0x0
641#define MX51_PAD_DISP2_DAT7__KEY_ROW5 0x370 0x778 0x9d4 0x4 0x1
642#define MX51_PAD_DISP2_DAT7__USBH3_NXT 0x370 0x778 0xa20 0x3 0x1
643#define MX51_PAD_DISP2_DAT8__DISP2_DAT8 0x374 0x77c 0x000 0x0 0x0
644#define MX51_PAD_DISP2_DAT8__FEC_TDATA3 0x374 0x77c 0x000 0x2 0x0
645#define MX51_PAD_DISP2_DAT8__GPIO1_30 0x374 0x77c 0x000 0x5 0x0
646#define MX51_PAD_DISP2_DAT8__KEY_ROW6 0x374 0x77c 0x9d8 0x4 0x1
647#define MX51_PAD_DISP2_DAT8__USBH3_DATA0 0x374 0x77c 0x9fc 0x3 0x1
648#define MX51_PAD_DISP2_DAT9__AUD6_RXC 0x378 0x780 0x8f4 0x4 0x1
649#define MX51_PAD_DISP2_DAT9__DISP2_DAT9 0x378 0x780 0x000 0x0 0x0
650#define MX51_PAD_DISP2_DAT9__FEC_TX_EN 0x378 0x780 0x000 0x2 0x0
651#define MX51_PAD_DISP2_DAT9__GPIO1_31 0x378 0x780 0x000 0x5 0x0
652#define MX51_PAD_DISP2_DAT9__USBH3_DATA1 0x378 0x780 0xa00 0x3 0x1
653#define MX51_PAD_DISP2_DAT10__DISP2_DAT10 0x37c 0x784 0x000 0x0 0x0
654#define MX51_PAD_DISP2_DAT10__DISP2_SER_CS 0x37c 0x784 0x000 0x5 0x0
655#define MX51_PAD_DISP2_DAT10__FEC_COL 0x37c 0x784 0x94c 0x2 0x1
656#define MX51_PAD_DISP2_DAT10__KEY_ROW7 0x37c 0x784 0x9dc 0x4 0x1
657#define MX51_PAD_DISP2_DAT10__USBH3_DATA2 0x37c 0x784 0xa04 0x3 0x1
658#define MX51_PAD_DISP2_DAT11__AUD6_TXD 0x380 0x788 0x8f0 0x4 0x1
659#define MX51_PAD_DISP2_DAT11__DISP2_DAT11 0x380 0x788 0x000 0x0 0x0
660#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK 0x380 0x788 0x968 0x2 0x1
661#define MX51_PAD_DISP2_DAT11__GPIO1_10 0x380 0x788 0x000 0x7 0x0
662#define MX51_PAD_DISP2_DAT11__USBH3_DATA3 0x380 0x788 0xa08 0x3 0x1
663#define MX51_PAD_DISP2_DAT12__AUD6_RXD 0x384 0x78c 0x8ec 0x4 0x1
664#define MX51_PAD_DISP2_DAT12__DISP2_DAT12 0x384 0x78c 0x000 0x0 0x0
665#define MX51_PAD_DISP2_DAT12__FEC_RX_DV 0x384 0x78c 0x96c 0x2 0x1
666#define MX51_PAD_DISP2_DAT12__USBH3_DATA4 0x384 0x78c 0xa0c 0x3 0x1
667#define MX51_PAD_DISP2_DAT13__AUD6_TXC 0x388 0x790 0x8fc 0x4 0x1
668#define MX51_PAD_DISP2_DAT13__DISP2_DAT13 0x388 0x790 0x000 0x0 0x0
669#define MX51_PAD_DISP2_DAT13__FEC_TX_CLK 0x388 0x790 0x974 0x2 0x1
670#define MX51_PAD_DISP2_DAT13__USBH3_DATA5 0x388 0x790 0xa10 0x3 0x1
671#define MX51_PAD_DISP2_DAT14__AUD6_TXFS 0x38c 0x794 0x900 0x4 0x1
672#define MX51_PAD_DISP2_DAT14__DISP2_DAT14 0x38c 0x794 0x000 0x0 0x0
673#define MX51_PAD_DISP2_DAT14__FEC_RDATA0 0x38c 0x794 0x958 0x2 0x1
674#define MX51_PAD_DISP2_DAT14__USBH3_DATA6 0x38c 0x794 0xa14 0x3 0x1
675#define MX51_PAD_DISP2_DAT15__AUD6_RXFS 0x390 0x798 0x8f8 0x4 0x1
676#define MX51_PAD_DISP2_DAT15__DISP1_SER_CS 0x390 0x798 0x000 0x5 0x0
677#define MX51_PAD_DISP2_DAT15__DISP2_DAT15 0x390 0x798 0x000 0x0 0x0
678#define MX51_PAD_DISP2_DAT15__FEC_TDATA0 0x390 0x798 0x000 0x2 0x0
679#define MX51_PAD_DISP2_DAT15__USBH3_DATA7 0x390 0x798 0xa18 0x3 0x1
680#define MX51_PAD_SD1_CMD__AUD5_RXFS 0x394 0x79c 0x8e0 0x1 0x1
681#define MX51_PAD_SD1_CMD__CSPI_MOSI 0x394 0x79c 0x91c 0x2 0x2
682#define MX51_PAD_SD1_CMD__SD1_CMD 0x394 0x79c 0x000 0x0 0x0
683#define MX51_PAD_SD1_CLK__AUD5_RXC 0x398 0x7a0 0x8dc 0x1 0x1
684#define MX51_PAD_SD1_CLK__CSPI_SCLK 0x398 0x7a0 0x914 0x2 0x2
685#define MX51_PAD_SD1_CLK__SD1_CLK 0x398 0x7a0 0x000 0x0 0x0
686#define MX51_PAD_SD1_DATA0__AUD5_TXD 0x39c 0x7a4 0x8d8 0x1 0x2
687#define MX51_PAD_SD1_DATA0__CSPI_MISO 0x39c 0x7a4 0x918 0x2 0x1
688#define MX51_PAD_SD1_DATA0__SD1_DATA0 0x39c 0x7a4 0x000 0x0 0x0
689#define MX51_PAD_EIM_DA0__EIM_DA0 0x01c 0x000 0x000 0x0 0x0
690#define MX51_PAD_EIM_DA1__EIM_DA1 0x020 0x000 0x000 0x0 0x0
691#define MX51_PAD_EIM_DA2__EIM_DA2 0x024 0x000 0x000 0x0 0x0
692#define MX51_PAD_EIM_DA3__EIM_DA3 0x028 0x000 0x000 0x0 0x0
693#define MX51_PAD_SD1_DATA1__AUD5_RXD 0x3a0 0x7a8 0x8d4 0x1 0x2
694#define MX51_PAD_SD1_DATA1__SD1_DATA1 0x3a0 0x7a8 0x000 0x0 0x0
695#define MX51_PAD_EIM_DA4__EIM_DA4 0x02c 0x000 0x000 0x0 0x0
696#define MX51_PAD_EIM_DA5__EIM_DA5 0x030 0x000 0x000 0x0 0x0
697#define MX51_PAD_EIM_DA6__EIM_DA6 0x034 0x000 0x000 0x0 0x0
698#define MX51_PAD_EIM_DA7__EIM_DA7 0x038 0x000 0x000 0x0 0x0
699#define MX51_PAD_SD1_DATA2__AUD5_TXC 0x3a4 0x7ac 0x8e4 0x1 0x2
700#define MX51_PAD_SD1_DATA2__SD1_DATA2 0x3a4 0x7ac 0x000 0x0 0x0
701#define MX51_PAD_EIM_DA10__EIM_DA10 0x044 0x000 0x000 0x0 0x0
702#define MX51_PAD_EIM_DA11__EIM_DA11 0x048 0x000 0x000 0x0 0x0
703#define MX51_PAD_EIM_DA8__EIM_DA8 0x03c 0x000 0x000 0x0 0x0
704#define MX51_PAD_EIM_DA9__EIM_DA9 0x040 0x000 0x000 0x0 0x0
705#define MX51_PAD_SD1_DATA3__AUD5_TXFS 0x3a8 0x7b0 0x8e8 0x1 0x2
706#define MX51_PAD_SD1_DATA3__CSPI_SS1 0x3a8 0x7b0 0x920 0x2 0x1
707#define MX51_PAD_SD1_DATA3__SD1_DATA3 0x3a8 0x7b0 0x000 0x0 0x0
708#define MX51_PAD_GPIO1_0__CSPI_SS2 0x3ac 0x7b4 0x924 0x2 0x0
709#define MX51_PAD_GPIO1_0__GPIO1_0 0x3ac 0x7b4 0x000 0x1 0x0
710#define MX51_PAD_GPIO1_0__SD1_CD 0x3ac 0x7b4 0x000 0x0 0x0
711#define MX51_PAD_GPIO1_1__CSPI_MISO 0x3b0 0x7b8 0x918 0x2 0x2
712#define MX51_PAD_GPIO1_1__GPIO1_1 0x3b0 0x7b8 0x000 0x1 0x0
713#define MX51_PAD_GPIO1_1__SD1_WP 0x3b0 0x7b8 0x000 0x0 0x0
714#define MX51_PAD_EIM_DA12__EIM_DA12 0x04c 0x000 0x000 0x0 0x0
715#define MX51_PAD_EIM_DA13__EIM_DA13 0x050 0x000 0x000 0x0 0x0
716#define MX51_PAD_EIM_DA14__EIM_DA14 0x054 0x000 0x000 0x0 0x0
717#define MX51_PAD_EIM_DA15__EIM_DA15 0x058 0x000 0x000 0x0 0x0
718#define MX51_PAD_SD2_CMD__CSPI_MOSI 0x3b4 0x7bc 0x91c 0x2 0x3
719#define MX51_PAD_SD2_CMD__I2C1_SCL 0x3b4 0x7bc 0x9b0 0x1 0x2
720#define MX51_PAD_SD2_CMD__SD2_CMD 0x3b4 0x7bc 0x000 0x0 0x0
721#define MX51_PAD_SD2_CLK__CSPI_SCLK 0x3b8 0x7c0 0x914 0x2 0x3
722#define MX51_PAD_SD2_CLK__I2C1_SDA 0x3b8 0x7c0 0x9b4 0x1 0x2
723#define MX51_PAD_SD2_CLK__SD2_CLK 0x3b8 0x7c0 0x000 0x0 0x0
724#define MX51_PAD_SD2_DATA0__CSPI_MISO 0x3bc 0x7c4 0x918 0x2 0x3
725#define MX51_PAD_SD2_DATA0__SD1_DAT4 0x3bc 0x7c4 0x000 0x1 0x0
726#define MX51_PAD_SD2_DATA0__SD2_DATA0 0x3bc 0x7c4 0x000 0x0 0x0
727#define MX51_PAD_SD2_DATA1__SD1_DAT5 0x3c0 0x7c8 0x000 0x1 0x0
728#define MX51_PAD_SD2_DATA1__SD2_DATA1 0x3c0 0x7c8 0x000 0x0 0x0
729#define MX51_PAD_SD2_DATA1__USBH3_H2_DP 0x3c0 0x7c8 0x000 0x2 0x0
730#define MX51_PAD_SD2_DATA2__SD1_DAT6 0x3c4 0x7cc 0x000 0x1 0x0
731#define MX51_PAD_SD2_DATA2__SD2_DATA2 0x3c4 0x7cc 0x000 0x0 0x0
732#define MX51_PAD_SD2_DATA2__USBH3_H2_DM 0x3c4 0x7cc 0x000 0x2 0x0
733#define MX51_PAD_SD2_DATA3__CSPI_SS2 0x3c8 0x7d0 0x924 0x2 0x1
734#define MX51_PAD_SD2_DATA3__SD1_DAT7 0x3c8 0x7d0 0x000 0x1 0x0
735#define MX51_PAD_SD2_DATA3__SD2_DATA3 0x3c8 0x7d0 0x000 0x0 0x0
736#define MX51_PAD_GPIO1_2__CCM_OUT_2 0x3cc 0x7d4 0x000 0x5 0x0
737#define MX51_PAD_GPIO1_2__GPIO1_2 0x3cc 0x7d4 0x000 0x0 0x0
738#define MX51_PAD_GPIO1_2__I2C2_SCL 0x3cc 0x7d4 0x9b8 0x2 0x3
739#define MX51_PAD_GPIO1_2__PLL1_BYP 0x3cc 0x7d4 0x90c 0x7 0x1
740#define MX51_PAD_GPIO1_2__PWM1_PWMO 0x3cc 0x7d4 0x000 0x1 0x0
741#define MX51_PAD_GPIO1_3__GPIO1_3 0x3d0 0x7d8 0x000 0x0 0x0
742#define MX51_PAD_GPIO1_3__I2C2_SDA 0x3d0 0x7d8 0x9bc 0x2 0x3
743#define MX51_PAD_GPIO1_3__PLL2_BYP 0x3d0 0x7d8 0x910 0x7 0x1
744#define MX51_PAD_GPIO1_3__PWM2_PWMO 0x3d0 0x7d8 0x000 0x1 0x0
745#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ 0x3d4 0x7fc 0x000 0x0 0x0
746#define MX51_PAD_PMIC_INT_REQ__PMIC_PMU_IRQ_B 0x3d4 0x7fc 0x000 0x1 0x0
747#define MX51_PAD_GPIO1_4__DISP2_EXT_CLK 0x3d8 0x804 0x908 0x4 0x1
748#define MX51_PAD_GPIO1_4__EIM_RDY 0x3d8 0x804 0x938 0x3 0x1
749#define MX51_PAD_GPIO1_4__GPIO1_4 0x3d8 0x804 0x000 0x0 0x0
750#define MX51_PAD_GPIO1_4__WDOG1_WDOG_B 0x3d8 0x804 0x000 0x2 0x0
751#define MX51_PAD_GPIO1_5__CSI2_MCLK 0x3dc 0x808 0x000 0x6 0x0
752#define MX51_PAD_GPIO1_5__DISP2_PIN16 0x3dc 0x808 0x000 0x3 0x0
753#define MX51_PAD_GPIO1_5__GPIO1_5 0x3dc 0x808 0x000 0x0 0x0
754#define MX51_PAD_GPIO1_5__WDOG2_WDOG_B 0x3dc 0x808 0x000 0x2 0x0
755#define MX51_PAD_GPIO1_6__DISP2_PIN17 0x3e0 0x80c 0x000 0x4 0x0
756#define MX51_PAD_GPIO1_6__GPIO1_6 0x3e0 0x80c 0x000 0x0 0x0
757#define MX51_PAD_GPIO1_6__REF_EN_B 0x3e0 0x80c 0x000 0x3 0x0
758#define MX51_PAD_GPIO1_7__CCM_OUT_0 0x3e4 0x810 0x000 0x3 0x0
759#define MX51_PAD_GPIO1_7__GPIO1_7 0x3e4 0x810 0x000 0x0 0x0
760#define MX51_PAD_GPIO1_7__SD2_WP 0x3e4 0x810 0x000 0x6 0x0
761#define MX51_PAD_GPIO1_7__SPDIF_OUT1 0x3e4 0x810 0x000 0x2 0x0
762#define MX51_PAD_GPIO1_8__CSI2_DATA_EN 0x3e8 0x814 0x99c 0x2 0x2
763#define MX51_PAD_GPIO1_8__GPIO1_8 0x3e8 0x814 0x000 0x0 0x0
764#define MX51_PAD_GPIO1_8__SD2_CD 0x3e8 0x814 0x000 0x6 0x0
765#define MX51_PAD_GPIO1_8__USBH3_PWR 0x3e8 0x814 0x000 0x1 0x0
766#define MX51_PAD_GPIO1_9__CCM_OUT_1 0x3ec 0x818 0x000 0x3 0x0
767#define MX51_PAD_GPIO1_9__DISP2_D1_CS 0x3ec 0x818 0x000 0x2 0x0
768#define MX51_PAD_GPIO1_9__DISP2_SER_CS 0x3ec 0x818 0x000 0x7 0x0
769#define MX51_PAD_GPIO1_9__GPIO1_9 0x3ec 0x818 0x000 0x0 0x0
770#define MX51_PAD_GPIO1_9__SD2_LCTL 0x3ec 0x818 0x000 0x6 0x0
771#define MX51_PAD_GPIO1_9__USBH3_OC 0x3ec 0x818 0x000 0x1 0x0
772
773#endif /* __DTS_IMX51_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index fcf035bf7c5a..21bb786c5b31 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -10,7 +10,8 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13/include/ "skeleton.dtsi" 13#include "skeleton.dtsi"
14#include "imx51-pinfunc.h"
14 15
15/ { 16/ {
16 aliases { 17 aliases {
@@ -55,6 +56,24 @@
55 }; 56 };
56 }; 57 };
57 58
59 cpus {
60 #address-cells = <1>;
61 #size-cells = <0>;
62 cpu@0 {
63 device_type = "cpu";
64 compatible = "arm,cortex-a8";
65 reg = <0>;
66 clock-latency = <61036>; /* two CLK32 periods */
67 clocks = <&clks 24>;
68 clock-names = "cpu";
69 operating-points = <
70 /* kHz uV (No regulator support) */
71 160000 0
72 800000 0
73 >;
74 };
75 };
76
58 soc { 77 soc {
59 #address-cells = <1>; 78 #address-cells = <1>;
60 #size-cells = <1>; 79 #size-cells = <1>;
@@ -67,6 +86,9 @@
67 compatible = "fsl,imx51-ipu"; 86 compatible = "fsl,imx51-ipu";
68 reg = <0x40000000 0x20000000>; 87 reg = <0x40000000 0x20000000>;
69 interrupts = <11 10>; 88 interrupts = <11 10>;
89 clocks = <&clks 59>, <&clks 110>, <&clks 61>;
90 clock-names = "bus", "di0", "di1";
91 resets = <&src 2>;
70 }; 92 };
71 93
72 aips@70000000 { /* AIPS1 */ 94 aips@70000000 { /* AIPS1 */
@@ -244,6 +266,14 @@
244 status = "disabled"; 266 status = "disabled";
245 }; 267 };
246 268
269 gpt: timer@73fa0000 {
270 compatible = "fsl,imx51-gpt", "fsl,imx31-gpt";
271 reg = <0x73fa0000 0x4000>;
272 interrupts = <39>;
273 clocks = <&clks 36>, <&clks 41>;
274 clock-names = "ipg", "per";
275 };
276
247 iomuxc: iomuxc@73fa8000 { 277 iomuxc: iomuxc@73fa8000 {
248 compatible = "fsl,imx51-iomuxc"; 278 compatible = "fsl,imx51-iomuxc";
249 reg = <0x73fa8000 0x4000>; 279 reg = <0x73fa8000 0x4000>;
@@ -251,10 +281,10 @@
251 audmux { 281 audmux {
252 pinctrl_audmux_1: audmuxgrp-1 { 282 pinctrl_audmux_1: audmuxgrp-1 {
253 fsl,pins = < 283 fsl,pins = <
254 384 0x80000000 /* MX51_PAD_AUD3_BB_TXD__AUD3_TXD */ 284 MX51_PAD_AUD3_BB_TXD__AUD3_TXD 0x80000000
255 386 0x80000000 /* MX51_PAD_AUD3_BB_RXD__AUD3_RXD */ 285 MX51_PAD_AUD3_BB_RXD__AUD3_RXD 0x80000000
256 389 0x80000000 /* MX51_PAD_AUD3_BB_CK__AUD3_TXC */ 286 MX51_PAD_AUD3_BB_CK__AUD3_TXC 0x80000000
257 391 0x80000000 /* MX51_PAD_AUD3_BB_FS__AUD3_TXFS */ 287 MX51_PAD_AUD3_BB_FS__AUD3_TXFS 0x80000000
258 >; 288 >;
259 }; 289 };
260 }; 290 };
@@ -262,46 +292,46 @@
262 fec { 292 fec {
263 pinctrl_fec_1: fecgrp-1 { 293 pinctrl_fec_1: fecgrp-1 {
264 fsl,pins = < 294 fsl,pins = <
265 128 0x80000000 /* MX51_PAD_EIM_EB2__FEC_MDIO */ 295 MX51_PAD_EIM_EB2__FEC_MDIO 0x80000000
266 134 0x80000000 /* MX51_PAD_EIM_EB3__FEC_RDATA1 */ 296 MX51_PAD_EIM_EB3__FEC_RDATA1 0x80000000
267 146 0x80000000 /* MX51_PAD_EIM_CS2__FEC_RDATA2 */ 297 MX51_PAD_EIM_CS2__FEC_RDATA2 0x80000000
268 152 0x80000000 /* MX51_PAD_EIM_CS3__FEC_RDATA3 */ 298 MX51_PAD_EIM_CS3__FEC_RDATA3 0x80000000
269 158 0x80000000 /* MX51_PAD_EIM_CS4__FEC_RX_ER */ 299 MX51_PAD_EIM_CS4__FEC_RX_ER 0x80000000
270 165 0x80000000 /* MX51_PAD_EIM_CS5__FEC_CRS */ 300 MX51_PAD_EIM_CS5__FEC_CRS 0x80000000
271 206 0x80000000 /* MX51_PAD_NANDF_RB2__FEC_COL */ 301 MX51_PAD_NANDF_RB2__FEC_COL 0x80000000
272 213 0x80000000 /* MX51_PAD_NANDF_RB3__FEC_RX_CLK */ 302 MX51_PAD_NANDF_RB3__FEC_RX_CLK 0x80000000
273 293 0x80000000 /* MX51_PAD_NANDF_D9__FEC_RDATA0 */ 303 MX51_PAD_NANDF_D9__FEC_RDATA0 0x80000000
274 298 0x80000000 /* MX51_PAD_NANDF_D8__FEC_TDATA0 */ 304 MX51_PAD_NANDF_D8__FEC_TDATA0 0x80000000
275 225 0x80000000 /* MX51_PAD_NANDF_CS2__FEC_TX_ER */ 305 MX51_PAD_NANDF_CS2__FEC_TX_ER 0x80000000
276 231 0x80000000 /* MX51_PAD_NANDF_CS3__FEC_MDC */ 306 MX51_PAD_NANDF_CS3__FEC_MDC 0x80000000
277 237 0x80000000 /* MX51_PAD_NANDF_CS4__FEC_TDATA1 */ 307 MX51_PAD_NANDF_CS4__FEC_TDATA1 0x80000000
278 243 0x80000000 /* MX51_PAD_NANDF_CS5__FEC_TDATA2 */ 308 MX51_PAD_NANDF_CS5__FEC_TDATA2 0x80000000
279 250 0x80000000 /* MX51_PAD_NANDF_CS6__FEC_TDATA3 */ 309 MX51_PAD_NANDF_CS6__FEC_TDATA3 0x80000000
280 255 0x80000000 /* MX51_PAD_NANDF_CS7__FEC_TX_EN */ 310 MX51_PAD_NANDF_CS7__FEC_TX_EN 0x80000000
281 260 0x80000000 /* MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK */ 311 MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK 0x80000000
282 >; 312 >;
283 }; 313 };
284 314
285 pinctrl_fec_2: fecgrp-2 { 315 pinctrl_fec_2: fecgrp-2 {
286 fsl,pins = < 316 fsl,pins = <
287 589 0x80000000 /* MX51_PAD_DI_GP3__FEC_TX_ER */ 317 MX51_PAD_DI_GP3__FEC_TX_ER 0x80000000
288 592 0x80000000 /* MX51_PAD_DI2_PIN4__FEC_CRS */ 318 MX51_PAD_DI2_PIN4__FEC_CRS 0x80000000
289 594 0x80000000 /* MX51_PAD_DI2_PIN2__FEC_MDC */ 319 MX51_PAD_DI2_PIN2__FEC_MDC 0x80000000
290 596 0x80000000 /* MX51_PAD_DI2_PIN3__FEC_MDIO */ 320 MX51_PAD_DI2_PIN3__FEC_MDIO 0x80000000
291 598 0x80000000 /* MX51_PAD_DI2_DISP_CLK__FEC_RDATA1 */ 321 MX51_PAD_DI2_DISP_CLK__FEC_RDATA1 0x80000000
292 602 0x80000000 /* MX51_PAD_DI_GP4__FEC_RDATA2 */ 322 MX51_PAD_DI_GP4__FEC_RDATA2 0x80000000
293 604 0x80000000 /* MX51_PAD_DISP2_DAT0__FEC_RDATA3 */ 323 MX51_PAD_DISP2_DAT0__FEC_RDATA3 0x80000000
294 609 0x80000000 /* MX51_PAD_DISP2_DAT1__FEC_RX_ER */ 324 MX51_PAD_DISP2_DAT1__FEC_RX_ER 0x80000000
295 618 0x80000000 /* MX51_PAD_DISP2_DAT6__FEC_TDATA1 */ 325 MX51_PAD_DISP2_DAT6__FEC_TDATA1 0x80000000
296 623 0x80000000 /* MX51_PAD_DISP2_DAT7__FEC_TDATA2 */ 326 MX51_PAD_DISP2_DAT7__FEC_TDATA2 0x80000000
297 628 0x80000000 /* MX51_PAD_DISP2_DAT8__FEC_TDATA3 */ 327 MX51_PAD_DISP2_DAT8__FEC_TDATA3 0x80000000
298 634 0x80000000 /* MX51_PAD_DISP2_DAT9__FEC_TX_EN */ 328 MX51_PAD_DISP2_DAT9__FEC_TX_EN 0x80000000
299 639 0x80000000 /* MX51_PAD_DISP2_DAT10__FEC_COL */ 329 MX51_PAD_DISP2_DAT10__FEC_COL 0x80000000
300 644 0x80000000 /* MX51_PAD_DISP2_DAT11__FEC_RX_CLK */ 330 MX51_PAD_DISP2_DAT11__FEC_RX_CLK 0x80000000
301 649 0x80000000 /* MX51_PAD_DISP2_DAT12__FEC_RX_DV */ 331 MX51_PAD_DISP2_DAT12__FEC_RX_DV 0x80000000
302 653 0x80000000 /* MX51_PAD_DISP2_DAT13__FEC_TX_CLK */ 332 MX51_PAD_DISP2_DAT13__FEC_TX_CLK 0x80000000
303 657 0x80000000 /* MX51_PAD_DISP2_DAT14__FEC_RDATA0 */ 333 MX51_PAD_DISP2_DAT14__FEC_RDATA0 0x80000000
304 662 0x80000000 /* MX51_PAD_DISP2_DAT15__FEC_TDATA0 */ 334 MX51_PAD_DISP2_DAT15__FEC_TDATA0 0x80000000
305 >; 335 >;
306 }; 336 };
307 }; 337 };
@@ -309,9 +339,19 @@
309 ecspi1 { 339 ecspi1 {
310 pinctrl_ecspi1_1: ecspi1grp-1 { 340 pinctrl_ecspi1_1: ecspi1grp-1 {
311 fsl,pins = < 341 fsl,pins = <
312 398 0x185 /* MX51_PAD_CSPI1_MISO__ECSPI1_MISO */ 342 MX51_PAD_CSPI1_MISO__ECSPI1_MISO 0x185
313 394 0x185 /* MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI */ 343 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI 0x185
314 409 0x185 /* MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK */ 344 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK 0x185
345 >;
346 };
347 };
348
349 ecspi2 {
350 pinctrl_ecspi2_1: ecspi2grp-1 {
351 fsl,pins = <
352 MX51_PAD_NANDF_RB3__ECSPI2_MISO 0x185
353 MX51_PAD_NANDF_D15__ECSPI2_MOSI 0x185
354 MX51_PAD_NANDF_RB2__ECSPI2_SCLK 0x185
315 >; 355 >;
316 }; 356 };
317 }; 357 };
@@ -319,12 +359,12 @@
319 esdhc1 { 359 esdhc1 {
320 pinctrl_esdhc1_1: esdhc1grp-1 { 360 pinctrl_esdhc1_1: esdhc1grp-1 {
321 fsl,pins = < 361 fsl,pins = <
322 666 0x400020d5 /* MX51_PAD_SD1_CMD__SD1_CMD */ 362 MX51_PAD_SD1_CMD__SD1_CMD 0x400020d5
323 669 0x20d5 /* MX51_PAD_SD1_CLK__SD1_CLK */ 363 MX51_PAD_SD1_CLK__SD1_CLK 0x20d5
324 672 0x20d5 /* MX51_PAD_SD1_DATA0__SD1_DATA0 */ 364 MX51_PAD_SD1_DATA0__SD1_DATA0 0x20d5
325 678 0x20d5 /* MX51_PAD_SD1_DATA1__SD1_DATA1 */ 365 MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5
326 684 0x20d5 /* MX51_PAD_SD1_DATA2__SD1_DATA2 */ 366 MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5
327 691 0x20d5 /* MX51_PAD_SD1_DATA3__SD1_DATA3 */ 367 MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5
328 >; 368 >;
329 }; 369 };
330 }; 370 };
@@ -332,12 +372,12 @@
332 esdhc2 { 372 esdhc2 {
333 pinctrl_esdhc2_1: esdhc2grp-1 { 373 pinctrl_esdhc2_1: esdhc2grp-1 {
334 fsl,pins = < 374 fsl,pins = <
335 704 0x400020d5 /* MX51_PAD_SD2_CMD__SD2_CMD */ 375 MX51_PAD_SD2_CMD__SD2_CMD 0x400020d5
336 707 0x20d5 /* MX51_PAD_SD2_CLK__SD2_CLK */ 376 MX51_PAD_SD2_CLK__SD2_CLK 0x20d5
337 710 0x20d5 /* MX51_PAD_SD2_DATA0__SD2_DATA0 */ 377 MX51_PAD_SD2_DATA0__SD2_DATA0 0x20d5
338 712 0x20d5 /* MX51_PAD_SD2_DATA1__SD2_DATA1 */ 378 MX51_PAD_SD2_DATA1__SD2_DATA1 0x20d5
339 715 0x20d5 /* MX51_PAD_SD2_DATA2__SD2_DATA2 */ 379 MX51_PAD_SD2_DATA2__SD2_DATA2 0x20d5
340 719 0x20d5 /* MX51_PAD_SD2_DATA3__SD2_DATA3 */ 380 MX51_PAD_SD2_DATA3__SD2_DATA3 0x20d5
341 >; 381 >;
342 }; 382 };
343 }; 383 };
@@ -345,8 +385,15 @@
345 i2c2 { 385 i2c2 {
346 pinctrl_i2c2_1: i2c2grp-1 { 386 pinctrl_i2c2_1: i2c2grp-1 {
347 fsl,pins = < 387 fsl,pins = <
348 449 0x400001ed /* MX51_PAD_KEY_COL4__I2C2_SCL */ 388 MX51_PAD_KEY_COL4__I2C2_SCL 0x400001ed
349 454 0x400001ed /* MX51_PAD_KEY_COL5__I2C2_SDA */ 389 MX51_PAD_KEY_COL5__I2C2_SDA 0x400001ed
390 >;
391 };
392
393 pinctrl_i2c2_2: i2c2grp-2 {
394 fsl,pins = <
395 MX51_PAD_EIM_D27__I2C2_SCL 0x400001ed
396 MX51_PAD_EIM_D24__I2C2_SDA 0x400001ed
350 >; 397 >;
351 }; 398 };
352 }; 399 };
@@ -354,32 +401,32 @@
354 ipu_disp1 { 401 ipu_disp1 {
355 pinctrl_ipu_disp1_1: ipudisp1grp-1 { 402 pinctrl_ipu_disp1_1: ipudisp1grp-1 {
356 fsl,pins = < 403 fsl,pins = <
357 528 0x5 /* MX51_PAD_DISP1_DAT0__DISP1_DAT0 */ 404 MX51_PAD_DISP1_DAT0__DISP1_DAT0 0x5
358 529 0x5 /* MX51_PAD_DISP1_DAT1__DISP1_DAT1 */ 405 MX51_PAD_DISP1_DAT1__DISP1_DAT1 0x5
359 530 0x5 /* MX51_PAD_DISP1_DAT2__DISP1_DAT2 */ 406 MX51_PAD_DISP1_DAT2__DISP1_DAT2 0x5
360 531 0x5 /* MX51_PAD_DISP1_DAT3__DISP1_DAT3 */ 407 MX51_PAD_DISP1_DAT3__DISP1_DAT3 0x5
361 532 0x5 /* MX51_PAD_DISP1_DAT4__DISP1_DAT4 */ 408 MX51_PAD_DISP1_DAT4__DISP1_DAT4 0x5
362 533 0x5 /* MX51_PAD_DISP1_DAT5__DISP1_DAT5 */ 409 MX51_PAD_DISP1_DAT5__DISP1_DAT5 0x5
363 535 0x5 /* MX51_PAD_DISP1_DAT6__DISP1_DAT6 */ 410 MX51_PAD_DISP1_DAT6__DISP1_DAT6 0x5
364 537 0x5 /* MX51_PAD_DISP1_DAT7__DISP1_DAT7 */ 411 MX51_PAD_DISP1_DAT7__DISP1_DAT7 0x5
365 539 0x5 /* MX51_PAD_DISP1_DAT8__DISP1_DAT8 */ 412 MX51_PAD_DISP1_DAT8__DISP1_DAT8 0x5
366 541 0x5 /* MX51_PAD_DISP1_DAT9__DISP1_DAT9 */ 413 MX51_PAD_DISP1_DAT9__DISP1_DAT9 0x5
367 543 0x5 /* MX51_PAD_DISP1_DAT10__DISP1_DAT10 */ 414 MX51_PAD_DISP1_DAT10__DISP1_DAT10 0x5
368 545 0x5 /* MX51_PAD_DISP1_DAT11__DISP1_DAT11 */ 415 MX51_PAD_DISP1_DAT11__DISP1_DAT11 0x5
369 547 0x5 /* MX51_PAD_DISP1_DAT12__DISP1_DAT12 */ 416 MX51_PAD_DISP1_DAT12__DISP1_DAT12 0x5
370 549 0x5 /* MX51_PAD_DISP1_DAT13__DISP1_DAT13 */ 417 MX51_PAD_DISP1_DAT13__DISP1_DAT13 0x5
371 551 0x5 /* MX51_PAD_DISP1_DAT14__DISP1_DAT14 */ 418 MX51_PAD_DISP1_DAT14__DISP1_DAT14 0x5
372 553 0x5 /* MX51_PAD_DISP1_DAT15__DISP1_DAT15 */ 419 MX51_PAD_DISP1_DAT15__DISP1_DAT15 0x5
373 555 0x5 /* MX51_PAD_DISP1_DAT16__DISP1_DAT16 */ 420 MX51_PAD_DISP1_DAT16__DISP1_DAT16 0x5
374 557 0x5 /* MX51_PAD_DISP1_DAT17__DISP1_DAT17 */ 421 MX51_PAD_DISP1_DAT17__DISP1_DAT17 0x5
375 559 0x5 /* MX51_PAD_DISP1_DAT18__DISP1_DAT18 */ 422 MX51_PAD_DISP1_DAT18__DISP1_DAT18 0x5
376 563 0x5 /* MX51_PAD_DISP1_DAT19__DISP1_DAT19 */ 423 MX51_PAD_DISP1_DAT19__DISP1_DAT19 0x5
377 567 0x5 /* MX51_PAD_DISP1_DAT20__DISP1_DAT20 */ 424 MX51_PAD_DISP1_DAT20__DISP1_DAT20 0x5
378 571 0x5 /* MX51_PAD_DISP1_DAT21__DISP1_DAT21 */ 425 MX51_PAD_DISP1_DAT21__DISP1_DAT21 0x5
379 575 0x5 /* MX51_PAD_DISP1_DAT22__DISP1_DAT22 */ 426 MX51_PAD_DISP1_DAT22__DISP1_DAT22 0x5
380 579 0x5 /* MX51_PAD_DISP1_DAT23__DISP1_DAT23 */ 427 MX51_PAD_DISP1_DAT23__DISP1_DAT23 0x5
381 584 0x5 /* MX51_PAD_DI1_PIN2__DI1_PIN2 (hsync) */ 428 MX51_PAD_DI1_PIN2__DI1_PIN2 0x5 /* hsync */
382 583 0x5 /* MX51_PAD_DI1_PIN3__DI1_PIN3 (vsync) */ 429 MX51_PAD_DI1_PIN3__DI1_PIN3 0x5 /* vsync */
383 >; 430 >;
384 }; 431 };
385 }; 432 };
@@ -387,26 +434,62 @@
387 ipu_disp2 { 434 ipu_disp2 {
388 pinctrl_ipu_disp2_1: ipudisp2grp-1 { 435 pinctrl_ipu_disp2_1: ipudisp2grp-1 {
389 fsl,pins = < 436 fsl,pins = <
390 603 0x5 /* MX51_PAD_DISP2_DAT0__DISP2_DAT0 */ 437 MX51_PAD_DISP2_DAT0__DISP2_DAT0 0x5
391 608 0x5 /* MX51_PAD_DISP2_DAT1__DISP2_DAT1 */ 438 MX51_PAD_DISP2_DAT1__DISP2_DAT1 0x5
392 613 0x5 /* MX51_PAD_DISP2_DAT2__DISP2_DAT2 */ 439 MX51_PAD_DISP2_DAT2__DISP2_DAT2 0x5
393 614 0x5 /* MX51_PAD_DISP2_DAT3__DISP2_DAT3 */ 440 MX51_PAD_DISP2_DAT3__DISP2_DAT3 0x5
394 615 0x5 /* MX51_PAD_DISP2_DAT4__DISP2_DAT4 */ 441 MX51_PAD_DISP2_DAT4__DISP2_DAT4 0x5
395 616 0x5 /* MX51_PAD_DISP2_DAT5__DISP2_DAT5 */ 442 MX51_PAD_DISP2_DAT5__DISP2_DAT5 0x5
396 617 0x5 /* MX51_PAD_DISP2_DAT6__DISP2_DAT6 */ 443 MX51_PAD_DISP2_DAT6__DISP2_DAT6 0x5
397 622 0x5 /* MX51_PAD_DISP2_DAT7__DISP2_DAT7 */ 444 MX51_PAD_DISP2_DAT7__DISP2_DAT7 0x5
398 627 0x5 /* MX51_PAD_DISP2_DAT8__DISP2_DAT8 */ 445 MX51_PAD_DISP2_DAT8__DISP2_DAT8 0x5
399 633 0x5 /* MX51_PAD_DISP2_DAT9__DISP2_DAT9 */ 446 MX51_PAD_DISP2_DAT9__DISP2_DAT9 0x5
400 637 0x5 /* MX51_PAD_DISP2_DAT10__DISP2_DAT10 */ 447 MX51_PAD_DISP2_DAT10__DISP2_DAT10 0x5
401 643 0x5 /* MX51_PAD_DISP2_DAT11__DISP2_DAT11 */ 448 MX51_PAD_DISP2_DAT11__DISP2_DAT11 0x5
402 648 0x5 /* MX51_PAD_DISP2_DAT12__DISP2_DAT12 */ 449 MX51_PAD_DISP2_DAT12__DISP2_DAT12 0x5
403 652 0x5 /* MX51_PAD_DISP2_DAT13__DISP2_DAT13 */ 450 MX51_PAD_DISP2_DAT13__DISP2_DAT13 0x5
404 656 0x5 /* MX51_PAD_DISP2_DAT14__DISP2_DAT14 */ 451 MX51_PAD_DISP2_DAT14__DISP2_DAT14 0x5
405 661 0x5 /* MX51_PAD_DISP2_DAT15__DISP2_DAT15 */ 452 MX51_PAD_DISP2_DAT15__DISP2_DAT15 0x5
406 593 0x5 /* MX51_PAD_DI2_PIN2__DI2_PIN2 (hsync) */ 453 MX51_PAD_DI2_PIN2__DI2_PIN2 0x5 /* hsync */
407 595 0x5 /* MX51_PAD_DI2_PIN3__DI2_PIN3 (vsync) */ 454 MX51_PAD_DI2_PIN3__DI2_PIN3 0x5 /* vsync */
408 597 0x5 /* MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK */ 455 MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK 0x5
409 599 0x5 /* MX51_PAD_DI_GP4__DI2_PIN15 */ 456 MX51_PAD_DI_GP4__DI2_PIN15 0x5
457 >;
458 };
459 };
460
461 pata {
462 pinctrl_pata_1: patagrp-1 {
463 fsl,pins = <
464 MX51_PAD_NANDF_WE_B__PATA_DIOW 0x2004
465 MX51_PAD_NANDF_RE_B__PATA_DIOR 0x2004
466 MX51_PAD_NANDF_ALE__PATA_BUFFER_EN 0x2004
467 MX51_PAD_NANDF_CLE__PATA_RESET_B 0x2004
468 MX51_PAD_NANDF_WP_B__PATA_DMACK 0x2004
469 MX51_PAD_NANDF_RB0__PATA_DMARQ 0x2004
470 MX51_PAD_NANDF_RB1__PATA_IORDY 0x2004
471 MX51_PAD_GPIO_NAND__PATA_INTRQ 0x2004
472 MX51_PAD_NANDF_CS2__PATA_CS_0 0x2004
473 MX51_PAD_NANDF_CS3__PATA_CS_1 0x2004
474 MX51_PAD_NANDF_CS4__PATA_DA_0 0x2004
475 MX51_PAD_NANDF_CS5__PATA_DA_1 0x2004
476 MX51_PAD_NANDF_CS6__PATA_DA_2 0x2004
477 MX51_PAD_NANDF_D15__PATA_DATA15 0x2004
478 MX51_PAD_NANDF_D14__PATA_DATA14 0x2004
479 MX51_PAD_NANDF_D13__PATA_DATA13 0x2004
480 MX51_PAD_NANDF_D12__PATA_DATA12 0x2004
481 MX51_PAD_NANDF_D11__PATA_DATA11 0x2004
482 MX51_PAD_NANDF_D10__PATA_DATA10 0x2004
483 MX51_PAD_NANDF_D9__PATA_DATA9 0x2004
484 MX51_PAD_NANDF_D8__PATA_DATA8 0x2004
485 MX51_PAD_NANDF_D7__PATA_DATA7 0x2004
486 MX51_PAD_NANDF_D6__PATA_DATA6 0x2004
487 MX51_PAD_NANDF_D5__PATA_DATA5 0x2004
488 MX51_PAD_NANDF_D4__PATA_DATA4 0x2004
489 MX51_PAD_NANDF_D3__PATA_DATA3 0x2004
490 MX51_PAD_NANDF_D2__PATA_DATA2 0x2004
491 MX51_PAD_NANDF_D1__PATA_DATA1 0x2004
492 MX51_PAD_NANDF_D0__PATA_DATA0 0x2004
410 >; 493 >;
411 }; 494 };
412 }; 495 };
@@ -414,10 +497,10 @@
414 uart1 { 497 uart1 {
415 pinctrl_uart1_1: uart1grp-1 { 498 pinctrl_uart1_1: uart1grp-1 {
416 fsl,pins = < 499 fsl,pins = <
417 413 0x1c5 /* MX51_PAD_UART1_RXD__UART1_RXD */ 500 MX51_PAD_UART1_RXD__UART1_RXD 0x1c5
418 416 0x1c5 /* MX51_PAD_UART1_TXD__UART1_TXD */ 501 MX51_PAD_UART1_TXD__UART1_TXD 0x1c5
419 418 0x1c5 /* MX51_PAD_UART1_RTS__UART1_RTS */ 502 MX51_PAD_UART1_RTS__UART1_RTS 0x1c5
420 420 0x1c5 /* MX51_PAD_UART1_CTS__UART1_CTS */ 503 MX51_PAD_UART1_CTS__UART1_CTS 0x1c5
421 >; 504 >;
422 }; 505 };
423 }; 506 };
@@ -425,8 +508,8 @@
425 uart2 { 508 uart2 {
426 pinctrl_uart2_1: uart2grp-1 { 509 pinctrl_uart2_1: uart2grp-1 {
427 fsl,pins = < 510 fsl,pins = <
428 423 0x1c5 /* MX51_PAD_UART2_RXD__UART2_RXD */ 511 MX51_PAD_UART2_RXD__UART2_RXD 0x1c5
429 426 0x1c5 /* MX51_PAD_UART2_TXD__UART2_TXD */ 512 MX51_PAD_UART2_TXD__UART2_TXD 0x1c5
430 >; 513 >;
431 }; 514 };
432 }; 515 };
@@ -434,17 +517,17 @@
434 uart3 { 517 uart3 {
435 pinctrl_uart3_1: uart3grp-1 { 518 pinctrl_uart3_1: uart3grp-1 {
436 fsl,pins = < 519 fsl,pins = <
437 54 0x1c5 /* MX51_PAD_EIM_D25__UART3_RXD */ 520 MX51_PAD_EIM_D25__UART3_RXD 0x1c5
438 59 0x1c5 /* MX51_PAD_EIM_D26__UART3_TXD */ 521 MX51_PAD_EIM_D26__UART3_TXD 0x1c5
439 65 0x1c5 /* MX51_PAD_EIM_D27__UART3_RTS */ 522 MX51_PAD_EIM_D27__UART3_RTS 0x1c5
440 49 0x1c5 /* MX51_PAD_EIM_D24__UART3_CTS */ 523 MX51_PAD_EIM_D24__UART3_CTS 0x1c5
441 >; 524 >;
442 }; 525 };
443 526
444 pinctrl_uart3_2: uart3grp-2 { 527 pinctrl_uart3_2: uart3grp-2 {
445 fsl,pins = < 528 fsl,pins = <
446 434 0x1c5 /* MX51_PAD_UART3_RXD__UART3_RXD */ 529 MX51_PAD_UART3_RXD__UART3_RXD 0x1c5
447 430 0x1c5 /* MX51_PAD_UART3_TXD__UART3_TXD */ 530 MX51_PAD_UART3_TXD__UART3_TXD 0x1c5
448 >; 531 >;
449 }; 532 };
450 }; 533 };
@@ -452,14 +535,14 @@
452 kpp { 535 kpp {
453 pinctrl_kpp_1: kppgrp-1 { 536 pinctrl_kpp_1: kppgrp-1 {
454 fsl,pins = < 537 fsl,pins = <
455 438 0xe0 /* MX51_PAD_KEY_ROW0__KEY_ROW0 */ 538 MX51_PAD_KEY_ROW0__KEY_ROW0 0xe0
456 439 0xe0 /* MX51_PAD_KEY_ROW1__KEY_ROW1 */ 539 MX51_PAD_KEY_ROW1__KEY_ROW1 0xe0
457 440 0xe0 /* MX51_PAD_KEY_ROW2__KEY_ROW2 */ 540 MX51_PAD_KEY_ROW2__KEY_ROW2 0xe0
458 441 0xe0 /* MX51_PAD_KEY_ROW3__KEY_ROW3 */ 541 MX51_PAD_KEY_ROW3__KEY_ROW3 0xe0
459 442 0xe8 /* MX51_PAD_KEY_COL0__KEY_COL0 */ 542 MX51_PAD_KEY_COL0__KEY_COL0 0xe8
460 444 0xe8 /* MX51_PAD_KEY_COL1__KEY_COL1 */ 543 MX51_PAD_KEY_COL1__KEY_COL1 0xe8
461 446 0xe8 /* MX51_PAD_KEY_COL2__KEY_COL2 */ 544 MX51_PAD_KEY_COL2__KEY_COL2 0xe8
462 448 0xe8 /* MX51_PAD_KEY_COL3__KEY_COL3 */ 545 MX51_PAD_KEY_COL3__KEY_COL3 0xe8
463 >; 546 >;
464 }; 547 };
465 }; 548 };
@@ -501,6 +584,12 @@
501 status = "disabled"; 584 status = "disabled";
502 }; 585 };
503 586
587 src: src@73fd0000 {
588 compatible = "fsl,imx51-src";
589 reg = <0x73fd0000 0x4000>;
590 #reset-cells = <1>;
591 };
592
504 clks: ccm@73fd4000{ 593 clks: ccm@73fd4000{
505 compatible = "fsl,imx51-ccm"; 594 compatible = "fsl,imx51-ccm";
506 reg = <0x73fd4000 0x4000>; 595 reg = <0x73fd4000 0x4000>;
@@ -591,6 +680,14 @@
591 status = "disabled"; 680 status = "disabled";
592 }; 681 };
593 682
683 pata: pata@83fe0000 {
684 compatible = "fsl,imx51-pata", "fsl,imx27-pata";
685 reg = <0x83fe0000 0x4000>;
686 interrupts = <70>;
687 clocks = <&clks 161>;
688 status = "disabled";
689 };
690
594 ssi3: ssi@83fe8000 { 691 ssi3: ssi@83fe8000 {
595 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi"; 692 compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
596 reg = <0x83fe8000 0x4000>; 693 reg = <0x83fe8000 0x4000>;
diff --git a/arch/arm/boot/dts/imx53-ard.dts b/arch/arm/boot/dts/imx53-ard.dts
index e049fd0319e8..174f86938c89 100644
--- a/arch/arm/boot/dts/imx53-ard.dts
+++ b/arch/arm/boot/dts/imx53-ard.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx53.dtsi" 14#include "imx53.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX53 Automotive Reference Design Board"; 17 model = "Freescale i.MX53 Automotive Reference Design Board";
@@ -112,40 +112,40 @@
112 hog { 112 hog {
113 pinctrl_hog: hoggrp { 113 pinctrl_hog: hoggrp {
114 fsl,pins = < 114 fsl,pins = <
115 1077 0x80000000 /* MX53_PAD_GPIO_1__GPIO1_1 */ 115 MX53_PAD_GPIO_1__GPIO1_1 0x80000000
116 1085 0x80000000 /* MX53_PAD_GPIO_9__GPIO1_9 */ 116 MX53_PAD_GPIO_9__GPIO1_9 0x80000000
117 486 0x80000000 /* MX53_PAD_EIM_EB3__GPIO2_31 */ 117 MX53_PAD_EIM_EB3__GPIO2_31 0x80000000
118 739 0x80000000 /* MX53_PAD_GPIO_10__GPIO4_0 */ 118 MX53_PAD_GPIO_10__GPIO4_0 0x80000000
119 218 0x80000000 /* MX53_PAD_DISP0_DAT16__GPIO5_10 */ 119 MX53_PAD_DISP0_DAT16__GPIO5_10 0x80000000
120 226 0x80000000 /* MX53_PAD_DISP0_DAT17__GPIO5_11 */ 120 MX53_PAD_DISP0_DAT17__GPIO5_11 0x80000000
121 233 0x80000000 /* MX53_PAD_DISP0_DAT18__GPIO5_12 */ 121 MX53_PAD_DISP0_DAT18__GPIO5_12 0x80000000
122 241 0x80000000 /* MX53_PAD_DISP0_DAT19__GPIO5_13 */ 122 MX53_PAD_DISP0_DAT19__GPIO5_13 0x80000000
123 429 0x80000000 /* MX53_PAD_EIM_D16__EMI_WEIM_D_16 */ 123 MX53_PAD_EIM_D16__EMI_WEIM_D_16 0x80000000
124 435 0x80000000 /* MX53_PAD_EIM_D17__EMI_WEIM_D_17 */ 124 MX53_PAD_EIM_D17__EMI_WEIM_D_17 0x80000000
125 441 0x80000000 /* MX53_PAD_EIM_D18__EMI_WEIM_D_18 */ 125 MX53_PAD_EIM_D18__EMI_WEIM_D_18 0x80000000
126 448 0x80000000 /* MX53_PAD_EIM_D19__EMI_WEIM_D_19 */ 126 MX53_PAD_EIM_D19__EMI_WEIM_D_19 0x80000000
127 456 0x80000000 /* MX53_PAD_EIM_D20__EMI_WEIM_D_20 */ 127 MX53_PAD_EIM_D20__EMI_WEIM_D_20 0x80000000
128 464 0x80000000 /* MX53_PAD_EIM_D21__EMI_WEIM_D_21 */ 128 MX53_PAD_EIM_D21__EMI_WEIM_D_21 0x80000000
129 471 0x80000000 /* MX53_PAD_EIM_D22__EMI_WEIM_D_22 */ 129 MX53_PAD_EIM_D22__EMI_WEIM_D_22 0x80000000
130 477 0x80000000 /* MX53_PAD_EIM_D23__EMI_WEIM_D_23 */ 130 MX53_PAD_EIM_D23__EMI_WEIM_D_23 0x80000000
131 492 0x80000000 /* MX53_PAD_EIM_D24__EMI_WEIM_D_24 */ 131 MX53_PAD_EIM_D24__EMI_WEIM_D_24 0x80000000
132 500 0x80000000 /* MX53_PAD_EIM_D25__EMI_WEIM_D_25 */ 132 MX53_PAD_EIM_D25__EMI_WEIM_D_25 0x80000000
133 508 0x80000000 /* MX53_PAD_EIM_D26__EMI_WEIM_D_26 */ 133 MX53_PAD_EIM_D26__EMI_WEIM_D_26 0x80000000
134 516 0x80000000 /* MX53_PAD_EIM_D27__EMI_WEIM_D_27 */ 134 MX53_PAD_EIM_D27__EMI_WEIM_D_27 0x80000000
135 524 0x80000000 /* MX53_PAD_EIM_D28__EMI_WEIM_D_28 */ 135 MX53_PAD_EIM_D28__EMI_WEIM_D_28 0x80000000
136 532 0x80000000 /* MX53_PAD_EIM_D29__EMI_WEIM_D_29 */ 136 MX53_PAD_EIM_D29__EMI_WEIM_D_29 0x80000000
137 540 0x80000000 /* MX53_PAD_EIM_D30__EMI_WEIM_D_30 */ 137 MX53_PAD_EIM_D30__EMI_WEIM_D_30 0x80000000
138 548 0x80000000 /* MX53_PAD_EIM_D31__EMI_WEIM_D_31 */ 138 MX53_PAD_EIM_D31__EMI_WEIM_D_31 0x80000000
139 637 0x80000000 /* MX53_PAD_EIM_DA0__EMI_NAND_WEIM_DA_0 */ 139 MX53_PAD_EIM_DA0__EMI_NAND_WEIM_DA_0 0x80000000
140 642 0x80000000 /* MX53_PAD_EIM_DA1__EMI_NAND_WEIM_DA_1 */ 140 MX53_PAD_EIM_DA1__EMI_NAND_WEIM_DA_1 0x80000000
141 647 0x80000000 /* MX53_PAD_EIM_DA2__EMI_NAND_WEIM_DA_2 */ 141 MX53_PAD_EIM_DA2__EMI_NAND_WEIM_DA_2 0x80000000
142 652 0x80000000 /* MX53_PAD_EIM_DA3__EMI_NAND_WEIM_DA_3 */ 142 MX53_PAD_EIM_DA3__EMI_NAND_WEIM_DA_3 0x80000000
143 657 0x80000000 /* MX53_PAD_EIM_DA4__EMI_NAND_WEIM_DA_4 */ 143 MX53_PAD_EIM_DA4__EMI_NAND_WEIM_DA_4 0x80000000
144 662 0x80000000 /* MX53_PAD_EIM_DA5__EMI_NAND_WEIM_DA_5 */ 144 MX53_PAD_EIM_DA5__EMI_NAND_WEIM_DA_5 0x80000000
145 667 0x80000000 /* MX53_PAD_EIM_DA6__EMI_NAND_WEIM_DA_6 */ 145 MX53_PAD_EIM_DA6__EMI_NAND_WEIM_DA_6 0x80000000
146 611 0x80000000 /* MX53_PAD_EIM_OE__EMI_WEIM_OE */ 146 MX53_PAD_EIM_OE__EMI_WEIM_OE 0x80000000
147 616 0x80000000 /* MX53_PAD_EIM_RW__EMI_WEIM_RW */ 147 MX53_PAD_EIM_RW__EMI_WEIM_RW 0x80000000
148 607 0x80000000 /* MX53_PAD_EIM_CS1__EMI_WEIM_CS_1 */ 148 MX53_PAD_EIM_CS1__EMI_WEIM_CS_1 0x80000000
149 >; 149 >;
150 }; 150 };
151 }; 151 };
diff --git a/arch/arm/boot/dts/imx53-evk.dts b/arch/arm/boot/dts/imx53-evk.dts
index 85a89b52f9b8..801fda728ed6 100644
--- a/arch/arm/boot/dts/imx53-evk.dts
+++ b/arch/arm/boot/dts/imx53-evk.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx53.dtsi" 14#include "imx53.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX53 Evaluation Kit"; 17 model = "Freescale i.MX53 Evaluation Kit";
@@ -82,14 +82,14 @@
82 hog { 82 hog {
83 pinctrl_hog: hoggrp { 83 pinctrl_hog: hoggrp {
84 fsl,pins = < 84 fsl,pins = <
85 424 0x80000000 /* MX53_PAD_EIM_EB2__GPIO2_30 */ 85 MX53_PAD_EIM_EB2__GPIO2_30 0x80000000
86 449 0x80000000 /* MX53_PAD_EIM_D19__GPIO3_19 */ 86 MX53_PAD_EIM_D19__GPIO3_19 0x80000000
87 693 0x80000000 /* MX53_PAD_EIM_DA11__GPIO3_11 */ 87 MX53_PAD_EIM_DA11__GPIO3_11 0x80000000
88 697 0x80000000 /* MX53_PAD_EIM_DA12__GPIO3_12 */ 88 MX53_PAD_EIM_DA12__GPIO3_12 0x80000000
89 701 0x80000000 /* MX53_PAD_EIM_DA13__GPIO3_13 */ 89 MX53_PAD_EIM_DA13__GPIO3_13 0x80000000
90 705 0x80000000 /* MX53_PAD_EIM_DA14__GPIO3_14 */ 90 MX53_PAD_EIM_DA14__GPIO3_14 0x80000000
91 868 0x80000000 /* MX53_PAD_PATA_DA_0__GPIO7_6 */ 91 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
92 873 0x80000000 /* MX53_PAD_PATA_DA_1__GPIO7_7 */ 92 MX53_PAD_PATA_DA_1__GPIO7_7 0x80000000
93 >; 93 >;
94 }; 94 };
95 }; 95 };
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts
index 468c0a1d48d9..445a01119cc5 100644
--- a/arch/arm/boot/dts/imx53-mba53.dts
+++ b/arch/arm/boot/dts/imx53-mba53.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx53-tqma53.dtsi" 14#include "imx53-tqma53.dtsi"
15 15
16/ { 16/ {
17 model = "TQ MBa53 starter kit"; 17 model = "TQ MBa53 starter kit";
@@ -21,51 +21,57 @@
21&iomuxc { 21&iomuxc {
22 lvds1 { 22 lvds1 {
23 pinctrl_lvds1_1: lvds1-grp1 { 23 pinctrl_lvds1_1: lvds1-grp1 {
24 fsl,pins = <730 0x10000 /* LVDS0_TX3 */ 24 fsl,pins = <
25 732 0x10000 /* LVDS0_CLK */ 25 MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x10000
26 734 0x10000 /* LVDS0_TX2 */ 26 MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK 0x10000
27 736 0x10000 /* LVDS0_TX1 */ 27 MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2 0x10000
28 738 0x10000>; /* LVDS0_TX0 */ 28 MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1 0x10000
29 MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0 0x10000
30 >;
29 }; 31 };
30 32
31 pinctrl_lvds1_2: lvds1-grp2 { 33 pinctrl_lvds1_2: lvds1-grp2 {
32 fsl,pins = <720 0x10000 /* LVDS1_TX3 */ 34 fsl,pins = <
33 722 0x10000 /* LVDS1_TX2 */ 35 MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3 0x10000
34 724 0x10000 /* LVDS1_CLK */ 36 MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2 0x10000
35 726 0x10000 /* LVDS1_TX1 */ 37 MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK 0x10000
36 728 0x10000>; /* LVDS1_TX0 */ 38 MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1 0x10000
39 MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0 0x10000
40 >;
37 }; 41 };
38 }; 42 };
39 43
40 disp1 { 44 disp1 {
41 pinctrl_disp1_1: disp1-grp1 { 45 pinctrl_disp1_1: disp1-grp1 {
42 fsl,pins = <689 0x10000 /* DISP1_DRDY */ 46 fsl,pins = <
43 482 0x10000 /* DISP1_HSYNC */ 47 MX53_PAD_EIM_DA10__IPU_DI1_PIN15 0x10000 /* DISP1_DRDY */
44 489 0x10000 /* DISP1_VSYNC */ 48 MX53_PAD_EIM_D23__IPU_DI1_PIN2 0x10000 /* DISP1_HSYNC */
45 515 0x10000 /* DISP1_DAT_22 */ 49 MX53_PAD_EIM_EB3__IPU_DI1_PIN3 0x10000 /* DISP1_VSYNC */
46 523 0x10000 /* DISP1_DAT_23 */ 50 MX53_PAD_EIM_D26__IPU_DISP1_DAT_22 0x10000
47 545 0x10000 /* DISP1_DAT_21 */ 51 MX53_PAD_EIM_D27__IPU_DISP1_DAT_23 0x10000
48 553 0x10000 /* DISP1_DAT_20 */ 52 MX53_PAD_EIM_D30__IPU_DISP1_DAT_21 0x10000
49 558 0x10000 /* DISP1_DAT_19 */ 53 MX53_PAD_EIM_D31__IPU_DISP1_DAT_20 0x10000
50 564 0x10000 /* DISP1_DAT_18 */ 54 MX53_PAD_EIM_A24__IPU_DISP1_DAT_19 0x10000
51 570 0x10000 /* DISP1_DAT_17 */ 55 MX53_PAD_EIM_A23__IPU_DISP1_DAT_18 0x10000
52 575 0x10000 /* DISP1_DAT_16 */ 56 MX53_PAD_EIM_A22__IPU_DISP1_DAT_17 0x10000
53 580 0x10000 /* DISP1_DAT_15 */ 57 MX53_PAD_EIM_A21__IPU_DISP1_DAT_16 0x10000
54 585 0x10000 /* DISP1_DAT_14 */ 58 MX53_PAD_EIM_A20__IPU_DISP1_DAT_15 0x10000
55 590 0x10000 /* DISP1_DAT_13 */ 59 MX53_PAD_EIM_A19__IPU_DISP1_DAT_14 0x10000
56 595 0x10000 /* DISP1_DAT_12 */ 60 MX53_PAD_EIM_A18__IPU_DISP1_DAT_13 0x10000
57 628 0x10000 /* DISP1_DAT_11 */ 61 MX53_PAD_EIM_A17__IPU_DISP1_DAT_12 0x10000
58 634 0x10000 /* DISP1_DAT_10 */ 62 MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11 0x10000
59 639 0x10000 /* DISP1_DAT_9 */ 63 MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10 0x10000
60 644 0x10000 /* DISP1_DAT_8 */ 64 MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9 0x10000
61 649 0x10000 /* DISP1_DAT_7 */ 65 MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8 0x10000
62 654 0x10000 /* DISP1_DAT_6 */ 66 MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7 0x10000
63 659 0x10000 /* DISP1_DAT_5 */ 67 MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6 0x10000
64 664 0x10000 /* DISP1_DAT_4 */ 68 MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5 0x10000
65 669 0x10000 /* DISP1_DAT_3 */ 69 MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4 0x10000
66 674 0x10000 /* DISP1_DAT_2 */ 70 MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3 0x10000
67 679 0x10000 /* DISP1_DAT_1 */ 71 MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2 0x10000
68 684 0x10000>; /* DISP1_DAT_0 */ 72 MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1 0x10000
73 MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0 0x10000
74 >;
69 }; 75 };
70 }; 76 };
71}; 77};
diff --git a/arch/arm/boot/dts/imx53-pinfunc.h b/arch/arm/boot/dts/imx53-pinfunc.h
new file mode 100644
index 000000000000..aec406bc65eb
--- /dev/null
+++ b/arch/arm/boot/dts/imx53-pinfunc.h
@@ -0,0 +1,1189 @@
1/*
2 * Copyright 2013 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
10#ifndef __DTS_IMX53_PINFUNC_H
11#define __DTS_IMX53_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX53_PAD_GPIO_19__KPP_COL_5 0x020 0x348 0x840 0x0 0x0
18#define MX53_PAD_GPIO_19__GPIO4_5 0x020 0x348 0x000 0x1 0x0
19#define MX53_PAD_GPIO_19__CCM_CLKO 0x020 0x348 0x000 0x2 0x0
20#define MX53_PAD_GPIO_19__SPDIF_OUT1 0x020 0x348 0x000 0x3 0x0
21#define MX53_PAD_GPIO_19__RTC_CE_RTC_EXT_TRIG2 0x020 0x348 0x000 0x4 0x0
22#define MX53_PAD_GPIO_19__ECSPI1_RDY 0x020 0x348 0x000 0x5 0x0
23#define MX53_PAD_GPIO_19__FEC_TDATA_3 0x020 0x348 0x000 0x6 0x0
24#define MX53_PAD_GPIO_19__SRC_INT_BOOT 0x020 0x348 0x000 0x7 0x0
25#define MX53_PAD_KEY_COL0__KPP_COL_0 0x024 0x34c 0x000 0x0 0x0
26#define MX53_PAD_KEY_COL0__GPIO4_6 0x024 0x34c 0x000 0x1 0x0
27#define MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC 0x024 0x34c 0x758 0x2 0x0
28#define MX53_PAD_KEY_COL0__UART4_TXD_MUX 0x024 0x34c 0x000 0x4 0x0
29#define MX53_PAD_KEY_COL0__ECSPI1_SCLK 0x024 0x34c 0x79c 0x5 0x0
30#define MX53_PAD_KEY_COL0__FEC_RDATA_3 0x024 0x34c 0x000 0x6 0x0
31#define MX53_PAD_KEY_COL0__SRC_ANY_PU_RST 0x024 0x34c 0x000 0x7 0x0
32#define MX53_PAD_KEY_ROW0__KPP_ROW_0 0x028 0x350 0x000 0x0 0x0
33#define MX53_PAD_KEY_ROW0__GPIO4_7 0x028 0x350 0x000 0x1 0x0
34#define MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x028 0x350 0x74c 0x2 0x0
35#define MX53_PAD_KEY_ROW0__UART4_RXD_MUX 0x028 0x350 0x890 0x4 0x1
36#define MX53_PAD_KEY_ROW0__ECSPI1_MOSI 0x028 0x350 0x7a4 0x5 0x0
37#define MX53_PAD_KEY_ROW0__FEC_TX_ER 0x028 0x350 0x000 0x6 0x0
38#define MX53_PAD_KEY_COL1__KPP_COL_1 0x02c 0x354 0x000 0x0 0x0
39#define MX53_PAD_KEY_COL1__GPIO4_8 0x02c 0x354 0x000 0x1 0x0
40#define MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x02c 0x354 0x75c 0x2 0x0
41#define MX53_PAD_KEY_COL1__UART5_TXD_MUX 0x02c 0x354 0x000 0x4 0x0
42#define MX53_PAD_KEY_COL1__ECSPI1_MISO 0x02c 0x354 0x7a0 0x5 0x0
43#define MX53_PAD_KEY_COL1__FEC_RX_CLK 0x02c 0x354 0x808 0x6 0x0
44#define MX53_PAD_KEY_COL1__USBPHY1_TXREADY 0x02c 0x354 0x000 0x7 0x0
45#define MX53_PAD_KEY_ROW1__KPP_ROW_1 0x030 0x358 0x000 0x0 0x0
46#define MX53_PAD_KEY_ROW1__GPIO4_9 0x030 0x358 0x000 0x1 0x0
47#define MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x030 0x358 0x748 0x2 0x0
48#define MX53_PAD_KEY_ROW1__UART5_RXD_MUX 0x030 0x358 0x898 0x4 0x1
49#define MX53_PAD_KEY_ROW1__ECSPI1_SS0 0x030 0x358 0x7a8 0x5 0x0
50#define MX53_PAD_KEY_ROW1__FEC_COL 0x030 0x358 0x800 0x6 0x0
51#define MX53_PAD_KEY_ROW1__USBPHY1_RXVALID 0x030 0x358 0x000 0x7 0x0
52#define MX53_PAD_KEY_COL2__KPP_COL_2 0x034 0x35c 0x000 0x0 0x0
53#define MX53_PAD_KEY_COL2__GPIO4_10 0x034 0x35c 0x000 0x1 0x0
54#define MX53_PAD_KEY_COL2__CAN1_TXCAN 0x034 0x35c 0x000 0x2 0x0
55#define MX53_PAD_KEY_COL2__FEC_MDIO 0x034 0x35c 0x804 0x4 0x0
56#define MX53_PAD_KEY_COL2__ECSPI1_SS1 0x034 0x35c 0x7ac 0x5 0x0
57#define MX53_PAD_KEY_COL2__FEC_RDATA_2 0x034 0x35c 0x000 0x6 0x0
58#define MX53_PAD_KEY_COL2__USBPHY1_RXACTIVE 0x034 0x35c 0x000 0x7 0x0
59#define MX53_PAD_KEY_ROW2__KPP_ROW_2 0x038 0x360 0x000 0x0 0x0
60#define MX53_PAD_KEY_ROW2__GPIO4_11 0x038 0x360 0x000 0x1 0x0
61#define MX53_PAD_KEY_ROW2__CAN1_RXCAN 0x038 0x360 0x760 0x2 0x0
62#define MX53_PAD_KEY_ROW2__FEC_MDC 0x038 0x360 0x000 0x4 0x0
63#define MX53_PAD_KEY_ROW2__ECSPI1_SS2 0x038 0x360 0x7b0 0x5 0x0
64#define MX53_PAD_KEY_ROW2__FEC_TDATA_2 0x038 0x360 0x000 0x6 0x0
65#define MX53_PAD_KEY_ROW2__USBPHY1_RXERROR 0x038 0x360 0x000 0x7 0x0
66#define MX53_PAD_KEY_COL3__KPP_COL_3 0x03c 0x364 0x000 0x0 0x0
67#define MX53_PAD_KEY_COL3__GPIO4_12 0x03c 0x364 0x000 0x1 0x0
68#define MX53_PAD_KEY_COL3__USBOH3_H2_DP 0x03c 0x364 0x000 0x2 0x0
69#define MX53_PAD_KEY_COL3__SPDIF_IN1 0x03c 0x364 0x870 0x3 0x0
70#define MX53_PAD_KEY_COL3__I2C2_SCL 0x03c 0x364 0x81c 0x4 0x0
71#define MX53_PAD_KEY_COL3__ECSPI1_SS3 0x03c 0x364 0x7b4 0x5 0x0
72#define MX53_PAD_KEY_COL3__FEC_CRS 0x03c 0x364 0x000 0x6 0x0
73#define MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK 0x03c 0x364 0x000 0x7 0x0
74#define MX53_PAD_KEY_ROW3__KPP_ROW_3 0x040 0x368 0x000 0x0 0x0
75#define MX53_PAD_KEY_ROW3__GPIO4_13 0x040 0x368 0x000 0x1 0x0
76#define MX53_PAD_KEY_ROW3__USBOH3_H2_DM 0x040 0x368 0x000 0x2 0x0
77#define MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK 0x040 0x368 0x768 0x3 0x0
78#define MX53_PAD_KEY_ROW3__I2C2_SDA 0x040 0x368 0x820 0x4 0x0
79#define MX53_PAD_KEY_ROW3__OSC32K_32K_OUT 0x040 0x368 0x000 0x5 0x0
80#define MX53_PAD_KEY_ROW3__CCM_PLL4_BYP 0x040 0x368 0x77c 0x6 0x0
81#define MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 0x040 0x368 0x000 0x7 0x0
82#define MX53_PAD_KEY_COL4__KPP_COL_4 0x044 0x36c 0x000 0x0 0x0
83#define MX53_PAD_KEY_COL4__GPIO4_14 0x044 0x36c 0x000 0x1 0x0
84#define MX53_PAD_KEY_COL4__CAN2_TXCAN 0x044 0x36c 0x000 0x2 0x0
85#define MX53_PAD_KEY_COL4__IPU_SISG_4 0x044 0x36c 0x000 0x3 0x0
86#define MX53_PAD_KEY_COL4__UART5_RTS 0x044 0x36c 0x894 0x4 0x0
87#define MX53_PAD_KEY_COL4__USBOH3_USBOTG_OC 0x044 0x36c 0x89c 0x5 0x0
88#define MX53_PAD_KEY_COL4__USBPHY1_LINESTATE_1 0x044 0x36c 0x000 0x7 0x0
89#define MX53_PAD_KEY_ROW4__KPP_ROW_4 0x048 0x370 0x000 0x0 0x0
90#define MX53_PAD_KEY_ROW4__GPIO4_15 0x048 0x370 0x000 0x1 0x0
91#define MX53_PAD_KEY_ROW4__CAN2_RXCAN 0x048 0x370 0x764 0x2 0x0
92#define MX53_PAD_KEY_ROW4__IPU_SISG_5 0x048 0x370 0x000 0x3 0x0
93#define MX53_PAD_KEY_ROW4__UART5_CTS 0x048 0x370 0x000 0x4 0x0
94#define MX53_PAD_KEY_ROW4__USBOH3_USBOTG_PWR 0x048 0x370 0x000 0x5 0x0
95#define MX53_PAD_KEY_ROW4__USBPHY1_VBUSVALID 0x048 0x370 0x000 0x7 0x0
96#define MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK 0x04c 0x378 0x000 0x0 0x0
97#define MX53_PAD_DI0_DISP_CLK__GPIO4_16 0x04c 0x378 0x000 0x1 0x0
98#define MX53_PAD_DI0_DISP_CLK__USBOH3_USBH2_DIR 0x04c 0x378 0x000 0x2 0x0
99#define MX53_PAD_DI0_DISP_CLK__SDMA_DEBUG_CORE_STATE_0 0x04c 0x378 0x000 0x5 0x0
100#define MX53_PAD_DI0_DISP_CLK__EMI_EMI_DEBUG_0 0x04c 0x378 0x000 0x6 0x0
101#define MX53_PAD_DI0_DISP_CLK__USBPHY1_AVALID 0x04c 0x378 0x000 0x7 0x0
102#define MX53_PAD_DI0_PIN15__IPU_DI0_PIN15 0x050 0x37c 0x000 0x0 0x0
103#define MX53_PAD_DI0_PIN15__GPIO4_17 0x050 0x37c 0x000 0x1 0x0
104#define MX53_PAD_DI0_PIN15__AUDMUX_AUD6_TXC 0x050 0x37c 0x000 0x2 0x0
105#define MX53_PAD_DI0_PIN15__SDMA_DEBUG_CORE_STATE_1 0x050 0x37c 0x000 0x5 0x0
106#define MX53_PAD_DI0_PIN15__EMI_EMI_DEBUG_1 0x050 0x37c 0x000 0x6 0x0
107#define MX53_PAD_DI0_PIN15__USBPHY1_BVALID 0x050 0x37c 0x000 0x7 0x0
108#define MX53_PAD_DI0_PIN2__IPU_DI0_PIN2 0x054 0x380 0x000 0x0 0x0
109#define MX53_PAD_DI0_PIN2__GPIO4_18 0x054 0x380 0x000 0x1 0x0
110#define MX53_PAD_DI0_PIN2__AUDMUX_AUD6_TXD 0x054 0x380 0x000 0x2 0x0
111#define MX53_PAD_DI0_PIN2__SDMA_DEBUG_CORE_STATE_2 0x054 0x380 0x000 0x5 0x0
112#define MX53_PAD_DI0_PIN2__EMI_EMI_DEBUG_2 0x054 0x380 0x000 0x6 0x0
113#define MX53_PAD_DI0_PIN2__USBPHY1_ENDSESSION 0x054 0x380 0x000 0x7 0x0
114#define MX53_PAD_DI0_PIN3__IPU_DI0_PIN3 0x058 0x384 0x000 0x0 0x0
115#define MX53_PAD_DI0_PIN3__GPIO4_19 0x058 0x384 0x000 0x1 0x0
116#define MX53_PAD_DI0_PIN3__AUDMUX_AUD6_TXFS 0x058 0x384 0x000 0x2 0x0
117#define MX53_PAD_DI0_PIN3__SDMA_DEBUG_CORE_STATE_3 0x058 0x384 0x000 0x5 0x0
118#define MX53_PAD_DI0_PIN3__EMI_EMI_DEBUG_3 0x058 0x384 0x000 0x6 0x0
119#define MX53_PAD_DI0_PIN3__USBPHY1_IDDIG 0x058 0x384 0x000 0x7 0x0
120#define MX53_PAD_DI0_PIN4__IPU_DI0_PIN4 0x05c 0x388 0x000 0x0 0x0
121#define MX53_PAD_DI0_PIN4__GPIO4_20 0x05c 0x388 0x000 0x1 0x0
122#define MX53_PAD_DI0_PIN4__AUDMUX_AUD6_RXD 0x05c 0x388 0x000 0x2 0x0
123#define MX53_PAD_DI0_PIN4__ESDHC1_WP 0x05c 0x388 0x7fc 0x3 0x0
124#define MX53_PAD_DI0_PIN4__SDMA_DEBUG_YIELD 0x05c 0x388 0x000 0x5 0x0
125#define MX53_PAD_DI0_PIN4__EMI_EMI_DEBUG_4 0x05c 0x388 0x000 0x6 0x0
126#define MX53_PAD_DI0_PIN4__USBPHY1_HOSTDISCONNECT 0x05c 0x388 0x000 0x7 0x0
127#define MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0 0x060 0x38c 0x000 0x0 0x0
128#define MX53_PAD_DISP0_DAT0__GPIO4_21 0x060 0x38c 0x000 0x1 0x0
129#define MX53_PAD_DISP0_DAT0__CSPI_SCLK 0x060 0x38c 0x780 0x2 0x0
130#define MX53_PAD_DISP0_DAT0__USBOH3_USBH2_DATA_0 0x060 0x38c 0x000 0x3 0x0
131#define MX53_PAD_DISP0_DAT0__SDMA_DEBUG_CORE_RUN 0x060 0x38c 0x000 0x5 0x0
132#define MX53_PAD_DISP0_DAT0__EMI_EMI_DEBUG_5 0x060 0x38c 0x000 0x6 0x0
133#define MX53_PAD_DISP0_DAT0__USBPHY2_TXREADY 0x060 0x38c 0x000 0x7 0x0
134#define MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1 0x064 0x390 0x000 0x0 0x0
135#define MX53_PAD_DISP0_DAT1__GPIO4_22 0x064 0x390 0x000 0x1 0x0
136#define MX53_PAD_DISP0_DAT1__CSPI_MOSI 0x064 0x390 0x788 0x2 0x0
137#define MX53_PAD_DISP0_DAT1__USBOH3_USBH2_DATA_1 0x064 0x390 0x000 0x3 0x0
138#define MX53_PAD_DISP0_DAT1__SDMA_DEBUG_EVENT_CHANNEL_SEL 0x064 0x390 0x000 0x5 0x0
139#define MX53_PAD_DISP0_DAT1__EMI_EMI_DEBUG_6 0x064 0x390 0x000 0x6 0x0
140#define MX53_PAD_DISP0_DAT1__USBPHY2_RXVALID 0x064 0x390 0x000 0x7 0x0
141#define MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2 0x068 0x394 0x000 0x0 0x0
142#define MX53_PAD_DISP0_DAT2__GPIO4_23 0x068 0x394 0x000 0x1 0x0
143#define MX53_PAD_DISP0_DAT2__CSPI_MISO 0x068 0x394 0x784 0x2 0x0
144#define MX53_PAD_DISP0_DAT2__USBOH3_USBH2_DATA_2 0x068 0x394 0x000 0x3 0x0
145#define MX53_PAD_DISP0_DAT2__SDMA_DEBUG_MODE 0x068 0x394 0x000 0x5 0x0
146#define MX53_PAD_DISP0_DAT2__EMI_EMI_DEBUG_7 0x068 0x394 0x000 0x6 0x0
147#define MX53_PAD_DISP0_DAT2__USBPHY2_RXACTIVE 0x068 0x394 0x000 0x7 0x0
148#define MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3 0x06c 0x398 0x000 0x0 0x0
149#define MX53_PAD_DISP0_DAT3__GPIO4_24 0x06c 0x398 0x000 0x1 0x0
150#define MX53_PAD_DISP0_DAT3__CSPI_SS0 0x06c 0x398 0x78c 0x2 0x0
151#define MX53_PAD_DISP0_DAT3__USBOH3_USBH2_DATA_3 0x06c 0x398 0x000 0x3 0x0
152#define MX53_PAD_DISP0_DAT3__SDMA_DEBUG_BUS_ERROR 0x06c 0x398 0x000 0x5 0x0
153#define MX53_PAD_DISP0_DAT3__EMI_EMI_DEBUG_8 0x06c 0x398 0x000 0x6 0x0
154#define MX53_PAD_DISP0_DAT3__USBPHY2_RXERROR 0x06c 0x398 0x000 0x7 0x0
155#define MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4 0x070 0x39c 0x000 0x0 0x0
156#define MX53_PAD_DISP0_DAT4__GPIO4_25 0x070 0x39c 0x000 0x1 0x0
157#define MX53_PAD_DISP0_DAT4__CSPI_SS1 0x070 0x39c 0x790 0x2 0x0
158#define MX53_PAD_DISP0_DAT4__USBOH3_USBH2_DATA_4 0x070 0x39c 0x000 0x3 0x0
159#define MX53_PAD_DISP0_DAT4__SDMA_DEBUG_BUS_RWB 0x070 0x39c 0x000 0x5 0x0
160#define MX53_PAD_DISP0_DAT4__EMI_EMI_DEBUG_9 0x070 0x39c 0x000 0x6 0x0
161#define MX53_PAD_DISP0_DAT4__USBPHY2_SIECLOCK 0x070 0x39c 0x000 0x7 0x0
162#define MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5 0x074 0x3a0 0x000 0x0 0x0
163#define MX53_PAD_DISP0_DAT5__GPIO4_26 0x074 0x3a0 0x000 0x1 0x0
164#define MX53_PAD_DISP0_DAT5__CSPI_SS2 0x074 0x3a0 0x794 0x2 0x0
165#define MX53_PAD_DISP0_DAT5__USBOH3_USBH2_DATA_5 0x074 0x3a0 0x000 0x3 0x0
166#define MX53_PAD_DISP0_DAT5__SDMA_DEBUG_MATCHED_DMBUS 0x074 0x3a0 0x000 0x5 0x0
167#define MX53_PAD_DISP0_DAT5__EMI_EMI_DEBUG_10 0x074 0x3a0 0x000 0x6 0x0
168#define MX53_PAD_DISP0_DAT5__USBPHY2_LINESTATE_0 0x074 0x3a0 0x000 0x7 0x0
169#define MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6 0x078 0x3a4 0x000 0x0 0x0
170#define MX53_PAD_DISP0_DAT6__GPIO4_27 0x078 0x3a4 0x000 0x1 0x0
171#define MX53_PAD_DISP0_DAT6__CSPI_SS3 0x078 0x3a4 0x798 0x2 0x0
172#define MX53_PAD_DISP0_DAT6__USBOH3_USBH2_DATA_6 0x078 0x3a4 0x000 0x3 0x0
173#define MX53_PAD_DISP0_DAT6__SDMA_DEBUG_RTBUFFER_WRITE 0x078 0x3a4 0x000 0x5 0x0
174#define MX53_PAD_DISP0_DAT6__EMI_EMI_DEBUG_11 0x078 0x3a4 0x000 0x6 0x0
175#define MX53_PAD_DISP0_DAT6__USBPHY2_LINESTATE_1 0x078 0x3a4 0x000 0x7 0x0
176#define MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7 0x07c 0x3a8 0x000 0x0 0x0
177#define MX53_PAD_DISP0_DAT7__GPIO4_28 0x07c 0x3a8 0x000 0x1 0x0
178#define MX53_PAD_DISP0_DAT7__CSPI_RDY 0x07c 0x3a8 0x000 0x2 0x0
179#define MX53_PAD_DISP0_DAT7__USBOH3_USBH2_DATA_7 0x07c 0x3a8 0x000 0x3 0x0
180#define MX53_PAD_DISP0_DAT7__SDMA_DEBUG_EVENT_CHANNEL_0 0x07c 0x3a8 0x000 0x5 0x0
181#define MX53_PAD_DISP0_DAT7__EMI_EMI_DEBUG_12 0x07c 0x3a8 0x000 0x6 0x0
182#define MX53_PAD_DISP0_DAT7__USBPHY2_VBUSVALID 0x07c 0x3a8 0x000 0x7 0x0
183#define MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8 0x080 0x3ac 0x000 0x0 0x0
184#define MX53_PAD_DISP0_DAT8__GPIO4_29 0x080 0x3ac 0x000 0x1 0x0
185#define MX53_PAD_DISP0_DAT8__PWM1_PWMO 0x080 0x3ac 0x000 0x2 0x0
186#define MX53_PAD_DISP0_DAT8__WDOG1_WDOG_B 0x080 0x3ac 0x000 0x3 0x0
187#define MX53_PAD_DISP0_DAT8__SDMA_DEBUG_EVENT_CHANNEL_1 0x080 0x3ac 0x000 0x5 0x0
188#define MX53_PAD_DISP0_DAT8__EMI_EMI_DEBUG_13 0x080 0x3ac 0x000 0x6 0x0
189#define MX53_PAD_DISP0_DAT8__USBPHY2_AVALID 0x080 0x3ac 0x000 0x7 0x0
190#define MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9 0x084 0x3b0 0x000 0x0 0x0
191#define MX53_PAD_DISP0_DAT9__GPIO4_30 0x084 0x3b0 0x000 0x1 0x0
192#define MX53_PAD_DISP0_DAT9__PWM2_PWMO 0x084 0x3b0 0x000 0x2 0x0
193#define MX53_PAD_DISP0_DAT9__WDOG2_WDOG_B 0x084 0x3b0 0x000 0x3 0x0
194#define MX53_PAD_DISP0_DAT9__SDMA_DEBUG_EVENT_CHANNEL_2 0x084 0x3b0 0x000 0x5 0x0
195#define MX53_PAD_DISP0_DAT9__EMI_EMI_DEBUG_14 0x084 0x3b0 0x000 0x6 0x0
196#define MX53_PAD_DISP0_DAT9__USBPHY2_VSTATUS_0 0x084 0x3b0 0x000 0x7 0x0
197#define MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10 0x088 0x3b4 0x000 0x0 0x0
198#define MX53_PAD_DISP0_DAT10__GPIO4_31 0x088 0x3b4 0x000 0x1 0x0
199#define MX53_PAD_DISP0_DAT10__USBOH3_USBH2_STP 0x088 0x3b4 0x000 0x2 0x0
200#define MX53_PAD_DISP0_DAT10__SDMA_DEBUG_EVENT_CHANNEL_3 0x088 0x3b4 0x000 0x5 0x0
201#define MX53_PAD_DISP0_DAT10__EMI_EMI_DEBUG_15 0x088 0x3b4 0x000 0x6 0x0
202#define MX53_PAD_DISP0_DAT10__USBPHY2_VSTATUS_1 0x088 0x3b4 0x000 0x7 0x0
203#define MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11 0x08c 0x3b8 0x000 0x0 0x0
204#define MX53_PAD_DISP0_DAT11__GPIO5_5 0x08c 0x3b8 0x000 0x1 0x0
205#define MX53_PAD_DISP0_DAT11__USBOH3_USBH2_NXT 0x08c 0x3b8 0x000 0x2 0x0
206#define MX53_PAD_DISP0_DAT11__SDMA_DEBUG_EVENT_CHANNEL_4 0x08c 0x3b8 0x000 0x5 0x0
207#define MX53_PAD_DISP0_DAT11__EMI_EMI_DEBUG_16 0x08c 0x3b8 0x000 0x6 0x0
208#define MX53_PAD_DISP0_DAT11__USBPHY2_VSTATUS_2 0x08c 0x3b8 0x000 0x7 0x0
209#define MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12 0x090 0x3bc 0x000 0x0 0x0
210#define MX53_PAD_DISP0_DAT12__GPIO5_6 0x090 0x3bc 0x000 0x1 0x0
211#define MX53_PAD_DISP0_DAT12__USBOH3_USBH2_CLK 0x090 0x3bc 0x000 0x2 0x0
212#define MX53_PAD_DISP0_DAT12__SDMA_DEBUG_EVENT_CHANNEL_5 0x090 0x3bc 0x000 0x5 0x0
213#define MX53_PAD_DISP0_DAT12__EMI_EMI_DEBUG_17 0x090 0x3bc 0x000 0x6 0x0
214#define MX53_PAD_DISP0_DAT12__USBPHY2_VSTATUS_3 0x090 0x3bc 0x000 0x7 0x0
215#define MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13 0x094 0x3c0 0x000 0x0 0x0
216#define MX53_PAD_DISP0_DAT13__GPIO5_7 0x094 0x3c0 0x000 0x1 0x0
217#define MX53_PAD_DISP0_DAT13__AUDMUX_AUD5_RXFS 0x094 0x3c0 0x754 0x3 0x0
218#define MX53_PAD_DISP0_DAT13__SDMA_DEBUG_EVT_CHN_LINES_0 0x094 0x3c0 0x000 0x5 0x0
219#define MX53_PAD_DISP0_DAT13__EMI_EMI_DEBUG_18 0x094 0x3c0 0x000 0x6 0x0
220#define MX53_PAD_DISP0_DAT13__USBPHY2_VSTATUS_4 0x094 0x3c0 0x000 0x7 0x0
221#define MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14 0x098 0x3c4 0x000 0x0 0x0
222#define MX53_PAD_DISP0_DAT14__GPIO5_8 0x098 0x3c4 0x000 0x1 0x0
223#define MX53_PAD_DISP0_DAT14__AUDMUX_AUD5_RXC 0x098 0x3c4 0x750 0x3 0x0
224#define MX53_PAD_DISP0_DAT14__SDMA_DEBUG_EVT_CHN_LINES_1 0x098 0x3c4 0x000 0x5 0x0
225#define MX53_PAD_DISP0_DAT14__EMI_EMI_DEBUG_19 0x098 0x3c4 0x000 0x6 0x0
226#define MX53_PAD_DISP0_DAT14__USBPHY2_VSTATUS_5 0x098 0x3c4 0x000 0x7 0x0
227#define MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15 0x09c 0x3c8 0x000 0x0 0x0
228#define MX53_PAD_DISP0_DAT15__GPIO5_9 0x09c 0x3c8 0x000 0x1 0x0
229#define MX53_PAD_DISP0_DAT15__ECSPI1_SS1 0x09c 0x3c8 0x7ac 0x2 0x1
230#define MX53_PAD_DISP0_DAT15__ECSPI2_SS1 0x09c 0x3c8 0x7c8 0x3 0x0
231#define MX53_PAD_DISP0_DAT15__SDMA_DEBUG_EVT_CHN_LINES_2 0x09c 0x3c8 0x000 0x5 0x0
232#define MX53_PAD_DISP0_DAT15__EMI_EMI_DEBUG_20 0x09c 0x3c8 0x000 0x6 0x0
233#define MX53_PAD_DISP0_DAT15__USBPHY2_VSTATUS_6 0x09c 0x3c8 0x000 0x7 0x0
234#define MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16 0x0a0 0x3cc 0x000 0x0 0x0
235#define MX53_PAD_DISP0_DAT16__GPIO5_10 0x0a0 0x3cc 0x000 0x1 0x0
236#define MX53_PAD_DISP0_DAT16__ECSPI2_MOSI 0x0a0 0x3cc 0x7c0 0x2 0x0
237#define MX53_PAD_DISP0_DAT16__AUDMUX_AUD5_TXC 0x0a0 0x3cc 0x758 0x3 0x1
238#define MX53_PAD_DISP0_DAT16__SDMA_EXT_EVENT_0 0x0a0 0x3cc 0x868 0x4 0x0
239#define MX53_PAD_DISP0_DAT16__SDMA_DEBUG_EVT_CHN_LINES_3 0x0a0 0x3cc 0x000 0x5 0x0
240#define MX53_PAD_DISP0_DAT16__EMI_EMI_DEBUG_21 0x0a0 0x3cc 0x000 0x6 0x0
241#define MX53_PAD_DISP0_DAT16__USBPHY2_VSTATUS_7 0x0a0 0x3cc 0x000 0x7 0x0
242#define MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17 0x0a4 0x3d0 0x000 0x0 0x0
243#define MX53_PAD_DISP0_DAT17__GPIO5_11 0x0a4 0x3d0 0x000 0x1 0x0
244#define MX53_PAD_DISP0_DAT17__ECSPI2_MISO 0x0a4 0x3d0 0x7bc 0x2 0x0
245#define MX53_PAD_DISP0_DAT17__AUDMUX_AUD5_TXD 0x0a4 0x3d0 0x74c 0x3 0x1
246#define MX53_PAD_DISP0_DAT17__SDMA_EXT_EVENT_1 0x0a4 0x3d0 0x86c 0x4 0x0
247#define MX53_PAD_DISP0_DAT17__SDMA_DEBUG_EVT_CHN_LINES_4 0x0a4 0x3d0 0x000 0x5 0x0
248#define MX53_PAD_DISP0_DAT17__EMI_EMI_DEBUG_22 0x0a4 0x3d0 0x000 0x6 0x0
249#define MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18 0x0a8 0x3d4 0x000 0x0 0x0
250#define MX53_PAD_DISP0_DAT18__GPIO5_12 0x0a8 0x3d4 0x000 0x1 0x0
251#define MX53_PAD_DISP0_DAT18__ECSPI2_SS0 0x0a8 0x3d4 0x7c4 0x2 0x0
252#define MX53_PAD_DISP0_DAT18__AUDMUX_AUD5_TXFS 0x0a8 0x3d4 0x75c 0x3 0x1
253#define MX53_PAD_DISP0_DAT18__AUDMUX_AUD4_RXFS 0x0a8 0x3d4 0x73c 0x4 0x0
254#define MX53_PAD_DISP0_DAT18__SDMA_DEBUG_EVT_CHN_LINES_5 0x0a8 0x3d4 0x000 0x5 0x0
255#define MX53_PAD_DISP0_DAT18__EMI_EMI_DEBUG_23 0x0a8 0x3d4 0x000 0x6 0x0
256#define MX53_PAD_DISP0_DAT18__EMI_WEIM_CS_2 0x0a8 0x3d4 0x000 0x7 0x0
257#define MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19 0x0ac 0x3d8 0x000 0x0 0x0
258#define MX53_PAD_DISP0_DAT19__GPIO5_13 0x0ac 0x3d8 0x000 0x1 0x0
259#define MX53_PAD_DISP0_DAT19__ECSPI2_SCLK 0x0ac 0x3d8 0x7b8 0x2 0x0
260#define MX53_PAD_DISP0_DAT19__AUDMUX_AUD5_RXD 0x0ac 0x3d8 0x748 0x3 0x1
261#define MX53_PAD_DISP0_DAT19__AUDMUX_AUD4_RXC 0x0ac 0x3d8 0x738 0x4 0x0
262#define MX53_PAD_DISP0_DAT19__SDMA_DEBUG_EVT_CHN_LINES_6 0x0ac 0x3d8 0x000 0x5 0x0
263#define MX53_PAD_DISP0_DAT19__EMI_EMI_DEBUG_24 0x0ac 0x3d8 0x000 0x6 0x0
264#define MX53_PAD_DISP0_DAT19__EMI_WEIM_CS_3 0x0ac 0x3d8 0x000 0x7 0x0
265#define MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20 0x0b0 0x3dc 0x000 0x0 0x0
266#define MX53_PAD_DISP0_DAT20__GPIO5_14 0x0b0 0x3dc 0x000 0x1 0x0
267#define MX53_PAD_DISP0_DAT20__ECSPI1_SCLK 0x0b0 0x3dc 0x79c 0x2 0x1
268#define MX53_PAD_DISP0_DAT20__AUDMUX_AUD4_TXC 0x0b0 0x3dc 0x740 0x3 0x0
269#define MX53_PAD_DISP0_DAT20__SDMA_DEBUG_EVT_CHN_LINES_7 0x0b0 0x3dc 0x000 0x5 0x0
270#define MX53_PAD_DISP0_DAT20__EMI_EMI_DEBUG_25 0x0b0 0x3dc 0x000 0x6 0x0
271#define MX53_PAD_DISP0_DAT20__SATA_PHY_TDI 0x0b0 0x3dc 0x000 0x7 0x0
272#define MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21 0x0b4 0x3e0 0x000 0x0 0x0
273#define MX53_PAD_DISP0_DAT21__GPIO5_15 0x0b4 0x3e0 0x000 0x1 0x0
274#define MX53_PAD_DISP0_DAT21__ECSPI1_MOSI 0x0b4 0x3e0 0x7a4 0x2 0x1
275#define MX53_PAD_DISP0_DAT21__AUDMUX_AUD4_TXD 0x0b4 0x3e0 0x734 0x3 0x0
276#define MX53_PAD_DISP0_DAT21__SDMA_DEBUG_BUS_DEVICE_0 0x0b4 0x3e0 0x000 0x5 0x0
277#define MX53_PAD_DISP0_DAT21__EMI_EMI_DEBUG_26 0x0b4 0x3e0 0x000 0x6 0x0
278#define MX53_PAD_DISP0_DAT21__SATA_PHY_TDO 0x0b4 0x3e0 0x000 0x7 0x0
279#define MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22 0x0b8 0x3e4 0x000 0x0 0x0
280#define MX53_PAD_DISP0_DAT22__GPIO5_16 0x0b8 0x3e4 0x000 0x1 0x0
281#define MX53_PAD_DISP0_DAT22__ECSPI1_MISO 0x0b8 0x3e4 0x7a0 0x2 0x1
282#define MX53_PAD_DISP0_DAT22__AUDMUX_AUD4_TXFS 0x0b8 0x3e4 0x744 0x3 0x0
283#define MX53_PAD_DISP0_DAT22__SDMA_DEBUG_BUS_DEVICE_1 0x0b8 0x3e4 0x000 0x5 0x0
284#define MX53_PAD_DISP0_DAT22__EMI_EMI_DEBUG_27 0x0b8 0x3e4 0x000 0x6 0x0
285#define MX53_PAD_DISP0_DAT22__SATA_PHY_TCK 0x0b8 0x3e4 0x000 0x7 0x0
286#define MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23 0x0bc 0x3e8 0x000 0x0 0x0
287#define MX53_PAD_DISP0_DAT23__GPIO5_17 0x0bc 0x3e8 0x000 0x1 0x0
288#define MX53_PAD_DISP0_DAT23__ECSPI1_SS0 0x0bc 0x3e8 0x7a8 0x2 0x1
289#define MX53_PAD_DISP0_DAT23__AUDMUX_AUD4_RXD 0x0bc 0x3e8 0x730 0x3 0x0
290#define MX53_PAD_DISP0_DAT23__SDMA_DEBUG_BUS_DEVICE_2 0x0bc 0x3e8 0x000 0x5 0x0
291#define MX53_PAD_DISP0_DAT23__EMI_EMI_DEBUG_28 0x0bc 0x3e8 0x000 0x6 0x0
292#define MX53_PAD_DISP0_DAT23__SATA_PHY_TMS 0x0bc 0x3e8 0x000 0x7 0x0
293#define MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK 0x0c0 0x3ec 0x000 0x0 0x0
294#define MX53_PAD_CSI0_PIXCLK__GPIO5_18 0x0c0 0x3ec 0x000 0x1 0x0
295#define MX53_PAD_CSI0_PIXCLK__SDMA_DEBUG_PC_0 0x0c0 0x3ec 0x000 0x5 0x0
296#define MX53_PAD_CSI0_PIXCLK__EMI_EMI_DEBUG_29 0x0c0 0x3ec 0x000 0x6 0x0
297#define MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC 0x0c4 0x3f0 0x000 0x0 0x0
298#define MX53_PAD_CSI0_MCLK__GPIO5_19 0x0c4 0x3f0 0x000 0x1 0x0
299#define MX53_PAD_CSI0_MCLK__CCM_CSI0_MCLK 0x0c4 0x3f0 0x000 0x2 0x0
300#define MX53_PAD_CSI0_MCLK__SDMA_DEBUG_PC_1 0x0c4 0x3f0 0x000 0x5 0x0
301#define MX53_PAD_CSI0_MCLK__EMI_EMI_DEBUG_30 0x0c4 0x3f0 0x000 0x6 0x0
302#define MX53_PAD_CSI0_MCLK__TPIU_TRCTL 0x0c4 0x3f0 0x000 0x7 0x0
303#define MX53_PAD_CSI0_DATA_EN__IPU_CSI0_DATA_EN 0x0c8 0x3f4 0x000 0x0 0x0
304#define MX53_PAD_CSI0_DATA_EN__GPIO5_20 0x0c8 0x3f4 0x000 0x1 0x0
305#define MX53_PAD_CSI0_DATA_EN__SDMA_DEBUG_PC_2 0x0c8 0x3f4 0x000 0x5 0x0
306#define MX53_PAD_CSI0_DATA_EN__EMI_EMI_DEBUG_31 0x0c8 0x3f4 0x000 0x6 0x0
307#define MX53_PAD_CSI0_DATA_EN__TPIU_TRCLK 0x0c8 0x3f4 0x000 0x7 0x0
308#define MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC 0x0cc 0x3f8 0x000 0x0 0x0
309#define MX53_PAD_CSI0_VSYNC__GPIO5_21 0x0cc 0x3f8 0x000 0x1 0x0
310#define MX53_PAD_CSI0_VSYNC__SDMA_DEBUG_PC_3 0x0cc 0x3f8 0x000 0x5 0x0
311#define MX53_PAD_CSI0_VSYNC__EMI_EMI_DEBUG_32 0x0cc 0x3f8 0x000 0x6 0x0
312#define MX53_PAD_CSI0_VSYNC__TPIU_TRACE_0 0x0cc 0x3f8 0x000 0x7 0x0
313#define MX53_PAD_CSI0_DAT4__IPU_CSI0_D_4 0x0d0 0x3fc 0x000 0x0 0x0
314#define MX53_PAD_CSI0_DAT4__GPIO5_22 0x0d0 0x3fc 0x000 0x1 0x0
315#define MX53_PAD_CSI0_DAT4__KPP_COL_5 0x0d0 0x3fc 0x840 0x2 0x1
316#define MX53_PAD_CSI0_DAT4__ECSPI1_SCLK 0x0d0 0x3fc 0x79c 0x3 0x2
317#define MX53_PAD_CSI0_DAT4__USBOH3_USBH3_STP 0x0d0 0x3fc 0x000 0x4 0x0
318#define MX53_PAD_CSI0_DAT4__AUDMUX_AUD3_TXC 0x0d0 0x3fc 0x000 0x5 0x0
319#define MX53_PAD_CSI0_DAT4__EMI_EMI_DEBUG_33 0x0d0 0x3fc 0x000 0x6 0x0
320#define MX53_PAD_CSI0_DAT4__TPIU_TRACE_1 0x0d0 0x3fc 0x000 0x7 0x0
321#define MX53_PAD_CSI0_DAT5__IPU_CSI0_D_5 0x0d4 0x400 0x000 0x0 0x0
322#define MX53_PAD_CSI0_DAT5__GPIO5_23 0x0d4 0x400 0x000 0x1 0x0
323#define MX53_PAD_CSI0_DAT5__KPP_ROW_5 0x0d4 0x400 0x84c 0x2 0x0
324#define MX53_PAD_CSI0_DAT5__ECSPI1_MOSI 0x0d4 0x400 0x7a4 0x3 0x2
325#define MX53_PAD_CSI0_DAT5__USBOH3_USBH3_NXT 0x0d4 0x400 0x000 0x4 0x0
326#define MX53_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD 0x0d4 0x400 0x000 0x5 0x0
327#define MX53_PAD_CSI0_DAT5__EMI_EMI_DEBUG_34 0x0d4 0x400 0x000 0x6 0x0
328#define MX53_PAD_CSI0_DAT5__TPIU_TRACE_2 0x0d4 0x400 0x000 0x7 0x0
329#define MX53_PAD_CSI0_DAT6__IPU_CSI0_D_6 0x0d8 0x404 0x000 0x0 0x0
330#define MX53_PAD_CSI0_DAT6__GPIO5_24 0x0d8 0x404 0x000 0x1 0x0
331#define MX53_PAD_CSI0_DAT6__KPP_COL_6 0x0d8 0x404 0x844 0x2 0x0
332#define MX53_PAD_CSI0_DAT6__ECSPI1_MISO 0x0d8 0x404 0x7a0 0x3 0x2
333#define MX53_PAD_CSI0_DAT6__USBOH3_USBH3_CLK 0x0d8 0x404 0x000 0x4 0x0
334#define MX53_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS 0x0d8 0x404 0x000 0x5 0x0
335#define MX53_PAD_CSI0_DAT6__EMI_EMI_DEBUG_35 0x0d8 0x404 0x000 0x6 0x0
336#define MX53_PAD_CSI0_DAT6__TPIU_TRACE_3 0x0d8 0x404 0x000 0x7 0x0
337#define MX53_PAD_CSI0_DAT7__IPU_CSI0_D_7 0x0dc 0x408 0x000 0x0 0x0
338#define MX53_PAD_CSI0_DAT7__GPIO5_25 0x0dc 0x408 0x000 0x1 0x0
339#define MX53_PAD_CSI0_DAT7__KPP_ROW_6 0x0dc 0x408 0x850 0x2 0x0
340#define MX53_PAD_CSI0_DAT7__ECSPI1_SS0 0x0dc 0x408 0x7a8 0x3 0x2
341#define MX53_PAD_CSI0_DAT7__USBOH3_USBH3_DIR 0x0dc 0x408 0x000 0x4 0x0
342#define MX53_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD 0x0dc 0x408 0x000 0x5 0x0
343#define MX53_PAD_CSI0_DAT7__EMI_EMI_DEBUG_36 0x0dc 0x408 0x000 0x6 0x0
344#define MX53_PAD_CSI0_DAT7__TPIU_TRACE_4 0x0dc 0x408 0x000 0x7 0x0
345#define MX53_PAD_CSI0_DAT8__IPU_CSI0_D_8 0x0e0 0x40c 0x000 0x0 0x0
346#define MX53_PAD_CSI0_DAT8__GPIO5_26 0x0e0 0x40c 0x000 0x1 0x0
347#define MX53_PAD_CSI0_DAT8__KPP_COL_7 0x0e0 0x40c 0x848 0x2 0x0
348#define MX53_PAD_CSI0_DAT8__ECSPI2_SCLK 0x0e0 0x40c 0x7b8 0x3 0x1
349#define MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC 0x0e0 0x40c 0x000 0x4 0x0
350#define MX53_PAD_CSI0_DAT8__I2C1_SDA 0x0e0 0x40c 0x818 0x5 0x0
351#define MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 0x0e0 0x40c 0x000 0x6 0x0
352#define MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 0x0e0 0x40c 0x000 0x7 0x0
353#define MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 0x0e4 0x410 0x000 0x0 0x0
354#define MX53_PAD_CSI0_DAT9__GPIO5_27 0x0e4 0x410 0x000 0x1 0x0
355#define MX53_PAD_CSI0_DAT9__KPP_ROW_7 0x0e4 0x410 0x854 0x2 0x0
356#define MX53_PAD_CSI0_DAT9__ECSPI2_MOSI 0x0e4 0x410 0x7c0 0x3 0x1
357#define MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR 0x0e4 0x410 0x000 0x4 0x0
358#define MX53_PAD_CSI0_DAT9__I2C1_SCL 0x0e4 0x410 0x814 0x5 0x0
359#define MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 0x0e4 0x410 0x000 0x6 0x0
360#define MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 0x0e4 0x410 0x000 0x7 0x0
361#define MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 0x0e8 0x414 0x000 0x0 0x0
362#define MX53_PAD_CSI0_DAT10__GPIO5_28 0x0e8 0x414 0x000 0x1 0x0
363#define MX53_PAD_CSI0_DAT10__UART1_TXD_MUX 0x0e8 0x414 0x000 0x2 0x0
364#define MX53_PAD_CSI0_DAT10__ECSPI2_MISO 0x0e8 0x414 0x7bc 0x3 0x1
365#define MX53_PAD_CSI0_DAT10__AUDMUX_AUD3_RXC 0x0e8 0x414 0x000 0x4 0x0
366#define MX53_PAD_CSI0_DAT10__SDMA_DEBUG_PC_4 0x0e8 0x414 0x000 0x5 0x0
367#define MX53_PAD_CSI0_DAT10__EMI_EMI_DEBUG_39 0x0e8 0x414 0x000 0x6 0x0
368#define MX53_PAD_CSI0_DAT10__TPIU_TRACE_7 0x0e8 0x414 0x000 0x7 0x0
369#define MX53_PAD_CSI0_DAT11__IPU_CSI0_D_11 0x0ec 0x418 0x000 0x0 0x0
370#define MX53_PAD_CSI0_DAT11__GPIO5_29 0x0ec 0x418 0x000 0x1 0x0
371#define MX53_PAD_CSI0_DAT11__UART1_RXD_MUX 0x0ec 0x418 0x878 0x2 0x1
372#define MX53_PAD_CSI0_DAT11__ECSPI2_SS0 0x0ec 0x418 0x7c4 0x3 0x1
373#define MX53_PAD_CSI0_DAT11__AUDMUX_AUD3_RXFS 0x0ec 0x418 0x000 0x4 0x0
374#define MX53_PAD_CSI0_DAT11__SDMA_DEBUG_PC_5 0x0ec 0x418 0x000 0x5 0x0
375#define MX53_PAD_CSI0_DAT11__EMI_EMI_DEBUG_40 0x0ec 0x418 0x000 0x6 0x0
376#define MX53_PAD_CSI0_DAT11__TPIU_TRACE_8 0x0ec 0x418 0x000 0x7 0x0
377#define MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12 0x0f0 0x41c 0x000 0x0 0x0
378#define MX53_PAD_CSI0_DAT12__GPIO5_30 0x0f0 0x41c 0x000 0x1 0x0
379#define MX53_PAD_CSI0_DAT12__UART4_TXD_MUX 0x0f0 0x41c 0x000 0x2 0x0
380#define MX53_PAD_CSI0_DAT12__USBOH3_USBH3_DATA_0 0x0f0 0x41c 0x000 0x4 0x0
381#define MX53_PAD_CSI0_DAT12__SDMA_DEBUG_PC_6 0x0f0 0x41c 0x000 0x5 0x0
382#define MX53_PAD_CSI0_DAT12__EMI_EMI_DEBUG_41 0x0f0 0x41c 0x000 0x6 0x0
383#define MX53_PAD_CSI0_DAT12__TPIU_TRACE_9 0x0f0 0x41c 0x000 0x7 0x0
384#define MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13 0x0f4 0x420 0x000 0x0 0x0
385#define MX53_PAD_CSI0_DAT13__GPIO5_31 0x0f4 0x420 0x000 0x1 0x0
386#define MX53_PAD_CSI0_DAT13__UART4_RXD_MUX 0x0f4 0x420 0x890 0x2 0x3
387#define MX53_PAD_CSI0_DAT13__USBOH3_USBH3_DATA_1 0x0f4 0x420 0x000 0x4 0x0
388#define MX53_PAD_CSI0_DAT13__SDMA_DEBUG_PC_7 0x0f4 0x420 0x000 0x5 0x0
389#define MX53_PAD_CSI0_DAT13__EMI_EMI_DEBUG_42 0x0f4 0x420 0x000 0x6 0x0
390#define MX53_PAD_CSI0_DAT13__TPIU_TRACE_10 0x0f4 0x420 0x000 0x7 0x0
391#define MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14 0x0f8 0x424 0x000 0x0 0x0
392#define MX53_PAD_CSI0_DAT14__GPIO6_0 0x0f8 0x424 0x000 0x1 0x0
393#define MX53_PAD_CSI0_DAT14__UART5_TXD_MUX 0x0f8 0x424 0x000 0x2 0x0
394#define MX53_PAD_CSI0_DAT14__USBOH3_USBH3_DATA_2 0x0f8 0x424 0x000 0x4 0x0
395#define MX53_PAD_CSI0_DAT14__SDMA_DEBUG_PC_8 0x0f8 0x424 0x000 0x5 0x0
396#define MX53_PAD_CSI0_DAT14__EMI_EMI_DEBUG_43 0x0f8 0x424 0x000 0x6 0x0
397#define MX53_PAD_CSI0_DAT14__TPIU_TRACE_11 0x0f8 0x424 0x000 0x7 0x0
398#define MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15 0x0fc 0x428 0x000 0x0 0x0
399#define MX53_PAD_CSI0_DAT15__GPIO6_1 0x0fc 0x428 0x000 0x1 0x0
400#define MX53_PAD_CSI0_DAT15__UART5_RXD_MUX 0x0fc 0x428 0x898 0x2 0x3
401#define MX53_PAD_CSI0_DAT15__USBOH3_USBH3_DATA_3 0x0fc 0x428 0x000 0x4 0x0
402#define MX53_PAD_CSI0_DAT15__SDMA_DEBUG_PC_9 0x0fc 0x428 0x000 0x5 0x0
403#define MX53_PAD_CSI0_DAT15__EMI_EMI_DEBUG_44 0x0fc 0x428 0x000 0x6 0x0
404#define MX53_PAD_CSI0_DAT15__TPIU_TRACE_12 0x0fc 0x428 0x000 0x7 0x0
405#define MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16 0x100 0x42c 0x000 0x0 0x0
406#define MX53_PAD_CSI0_DAT16__GPIO6_2 0x100 0x42c 0x000 0x1 0x0
407#define MX53_PAD_CSI0_DAT16__UART4_RTS 0x100 0x42c 0x88c 0x2 0x0
408#define MX53_PAD_CSI0_DAT16__USBOH3_USBH3_DATA_4 0x100 0x42c 0x000 0x4 0x0
409#define MX53_PAD_CSI0_DAT16__SDMA_DEBUG_PC_10 0x100 0x42c 0x000 0x5 0x0
410#define MX53_PAD_CSI0_DAT16__EMI_EMI_DEBUG_45 0x100 0x42c 0x000 0x6 0x0
411#define MX53_PAD_CSI0_DAT16__TPIU_TRACE_13 0x100 0x42c 0x000 0x7 0x0
412#define MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17 0x104 0x430 0x000 0x0 0x0
413#define MX53_PAD_CSI0_DAT17__GPIO6_3 0x104 0x430 0x000 0x1 0x0
414#define MX53_PAD_CSI0_DAT17__UART4_CTS 0x104 0x430 0x000 0x2 0x0
415#define MX53_PAD_CSI0_DAT17__USBOH3_USBH3_DATA_5 0x104 0x430 0x000 0x4 0x0
416#define MX53_PAD_CSI0_DAT17__SDMA_DEBUG_PC_11 0x104 0x430 0x000 0x5 0x0
417#define MX53_PAD_CSI0_DAT17__EMI_EMI_DEBUG_46 0x104 0x430 0x000 0x6 0x0
418#define MX53_PAD_CSI0_DAT17__TPIU_TRACE_14 0x104 0x430 0x000 0x7 0x0
419#define MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18 0x108 0x434 0x000 0x0 0x0
420#define MX53_PAD_CSI0_DAT18__GPIO6_4 0x108 0x434 0x000 0x1 0x0
421#define MX53_PAD_CSI0_DAT18__UART5_RTS 0x108 0x434 0x894 0x2 0x2
422#define MX53_PAD_CSI0_DAT18__USBOH3_USBH3_DATA_6 0x108 0x434 0x000 0x4 0x0
423#define MX53_PAD_CSI0_DAT18__SDMA_DEBUG_PC_12 0x108 0x434 0x000 0x5 0x0
424#define MX53_PAD_CSI0_DAT18__EMI_EMI_DEBUG_47 0x108 0x434 0x000 0x6 0x0
425#define MX53_PAD_CSI0_DAT18__TPIU_TRACE_15 0x108 0x434 0x000 0x7 0x0
426#define MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19 0x10c 0x438 0x000 0x0 0x0
427#define MX53_PAD_CSI0_DAT19__GPIO6_5 0x10c 0x438 0x000 0x1 0x0
428#define MX53_PAD_CSI0_DAT19__UART5_CTS 0x10c 0x438 0x000 0x2 0x0
429#define MX53_PAD_CSI0_DAT19__USBOH3_USBH3_DATA_7 0x10c 0x438 0x000 0x4 0x0
430#define MX53_PAD_CSI0_DAT19__SDMA_DEBUG_PC_13 0x10c 0x438 0x000 0x5 0x0
431#define MX53_PAD_CSI0_DAT19__EMI_EMI_DEBUG_48 0x10c 0x438 0x000 0x6 0x0
432#define MX53_PAD_CSI0_DAT19__USBPHY2_BISTOK 0x10c 0x438 0x000 0x7 0x0
433#define MX53_PAD_EIM_A25__EMI_WEIM_A_25 0x110 0x458 0x000 0x0 0x0
434#define MX53_PAD_EIM_A25__GPIO5_2 0x110 0x458 0x000 0x1 0x0
435#define MX53_PAD_EIM_A25__ECSPI2_RDY 0x110 0x458 0x000 0x2 0x0
436#define MX53_PAD_EIM_A25__IPU_DI1_PIN12 0x110 0x458 0x000 0x3 0x0
437#define MX53_PAD_EIM_A25__CSPI_SS1 0x110 0x458 0x790 0x4 0x1
438#define MX53_PAD_EIM_A25__IPU_DI0_D1_CS 0x110 0x458 0x000 0x6 0x0
439#define MX53_PAD_EIM_A25__USBPHY1_BISTOK 0x110 0x458 0x000 0x7 0x0
440#define MX53_PAD_EIM_EB2__EMI_WEIM_EB_2 0x114 0x45c 0x000 0x0 0x0
441#define MX53_PAD_EIM_EB2__GPIO2_30 0x114 0x45c 0x000 0x1 0x0
442#define MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK 0x114 0x45c 0x76c 0x2 0x0
443#define MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS 0x114 0x45c 0x000 0x3 0x0
444#define MX53_PAD_EIM_EB2__ECSPI1_SS0 0x114 0x45c 0x7a8 0x4 0x3
445#define MX53_PAD_EIM_EB2__I2C2_SCL 0x114 0x45c 0x81c 0x5 0x1
446#define MX53_PAD_EIM_D16__EMI_WEIM_D_16 0x118 0x460 0x000 0x0 0x0
447#define MX53_PAD_EIM_D16__GPIO3_16 0x118 0x460 0x000 0x1 0x0
448#define MX53_PAD_EIM_D16__IPU_DI0_PIN5 0x118 0x460 0x000 0x2 0x0
449#define MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK 0x118 0x460 0x000 0x3 0x0
450#define MX53_PAD_EIM_D16__ECSPI1_SCLK 0x118 0x460 0x79c 0x4 0x3
451#define MX53_PAD_EIM_D16__I2C2_SDA 0x118 0x460 0x820 0x5 0x1
452#define MX53_PAD_EIM_D17__EMI_WEIM_D_17 0x11c 0x464 0x000 0x0 0x0
453#define MX53_PAD_EIM_D17__GPIO3_17 0x11c 0x464 0x000 0x1 0x0
454#define MX53_PAD_EIM_D17__IPU_DI0_PIN6 0x11c 0x464 0x000 0x2 0x0
455#define MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN 0x11c 0x464 0x830 0x3 0x0
456#define MX53_PAD_EIM_D17__ECSPI1_MISO 0x11c 0x464 0x7a0 0x4 0x3
457#define MX53_PAD_EIM_D17__I2C3_SCL 0x11c 0x464 0x824 0x5 0x0
458#define MX53_PAD_EIM_D18__EMI_WEIM_D_18 0x120 0x468 0x000 0x0 0x0
459#define MX53_PAD_EIM_D18__GPIO3_18 0x120 0x468 0x000 0x1 0x0
460#define MX53_PAD_EIM_D18__IPU_DI0_PIN7 0x120 0x468 0x000 0x2 0x0
461#define MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO 0x120 0x468 0x830 0x3 0x1
462#define MX53_PAD_EIM_D18__ECSPI1_MOSI 0x120 0x468 0x7a4 0x4 0x3
463#define MX53_PAD_EIM_D18__I2C3_SDA 0x120 0x468 0x828 0x5 0x0
464#define MX53_PAD_EIM_D18__IPU_DI1_D0_CS 0x120 0x468 0x000 0x6 0x0
465#define MX53_PAD_EIM_D19__EMI_WEIM_D_19 0x124 0x46c 0x000 0x0 0x0
466#define MX53_PAD_EIM_D19__GPIO3_19 0x124 0x46c 0x000 0x1 0x0
467#define MX53_PAD_EIM_D19__IPU_DI0_PIN8 0x124 0x46c 0x000 0x2 0x0
468#define MX53_PAD_EIM_D19__IPU_DISPB1_SER_RS 0x124 0x46c 0x000 0x3 0x0
469#define MX53_PAD_EIM_D19__ECSPI1_SS1 0x124 0x46c 0x7ac 0x4 0x2
470#define MX53_PAD_EIM_D19__EPIT1_EPITO 0x124 0x46c 0x000 0x5 0x0
471#define MX53_PAD_EIM_D19__UART1_CTS 0x124 0x46c 0x000 0x6 0x0
472#define MX53_PAD_EIM_D19__USBOH3_USBH2_OC 0x124 0x46c 0x8a4 0x7 0x0
473#define MX53_PAD_EIM_D20__EMI_WEIM_D_20 0x128 0x470 0x000 0x0 0x0
474#define MX53_PAD_EIM_D20__GPIO3_20 0x128 0x470 0x000 0x1 0x0
475#define MX53_PAD_EIM_D20__IPU_DI0_PIN16 0x128 0x470 0x000 0x2 0x0
476#define MX53_PAD_EIM_D20__IPU_SER_DISP0_CS 0x128 0x470 0x000 0x3 0x0
477#define MX53_PAD_EIM_D20__CSPI_SS0 0x128 0x470 0x78c 0x4 0x1
478#define MX53_PAD_EIM_D20__EPIT2_EPITO 0x128 0x470 0x000 0x5 0x0
479#define MX53_PAD_EIM_D20__UART1_RTS 0x128 0x470 0x874 0x6 0x1
480#define MX53_PAD_EIM_D20__USBOH3_USBH2_PWR 0x128 0x470 0x000 0x7 0x0
481#define MX53_PAD_EIM_D21__EMI_WEIM_D_21 0x12c 0x474 0x000 0x0 0x0
482#define MX53_PAD_EIM_D21__GPIO3_21 0x12c 0x474 0x000 0x1 0x0
483#define MX53_PAD_EIM_D21__IPU_DI0_PIN17 0x12c 0x474 0x000 0x2 0x0
484#define MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK 0x12c 0x474 0x000 0x3 0x0
485#define MX53_PAD_EIM_D21__CSPI_SCLK 0x12c 0x474 0x780 0x4 0x1
486#define MX53_PAD_EIM_D21__I2C1_SCL 0x12c 0x474 0x814 0x5 0x1
487#define MX53_PAD_EIM_D21__USBOH3_USBOTG_OC 0x12c 0x474 0x89c 0x6 0x1
488#define MX53_PAD_EIM_D22__EMI_WEIM_D_22 0x130 0x478 0x000 0x0 0x0
489#define MX53_PAD_EIM_D22__GPIO3_22 0x130 0x478 0x000 0x1 0x0
490#define MX53_PAD_EIM_D22__IPU_DI0_PIN1 0x130 0x478 0x000 0x2 0x0
491#define MX53_PAD_EIM_D22__IPU_DISPB0_SER_DIN 0x130 0x478 0x82c 0x3 0x0
492#define MX53_PAD_EIM_D22__CSPI_MISO 0x130 0x478 0x784 0x4 0x1
493#define MX53_PAD_EIM_D22__USBOH3_USBOTG_PWR 0x130 0x478 0x000 0x6 0x0
494#define MX53_PAD_EIM_D23__EMI_WEIM_D_23 0x134 0x47c 0x000 0x0 0x0
495#define MX53_PAD_EIM_D23__GPIO3_23 0x134 0x47c 0x000 0x1 0x0
496#define MX53_PAD_EIM_D23__UART3_CTS 0x134 0x47c 0x000 0x2 0x0
497#define MX53_PAD_EIM_D23__UART1_DCD 0x134 0x47c 0x000 0x3 0x0
498#define MX53_PAD_EIM_D23__IPU_DI0_D0_CS 0x134 0x47c 0x000 0x4 0x0
499#define MX53_PAD_EIM_D23__IPU_DI1_PIN2 0x134 0x47c 0x000 0x5 0x0
500#define MX53_PAD_EIM_D23__IPU_CSI1_DATA_EN 0x134 0x47c 0x834 0x6 0x0
501#define MX53_PAD_EIM_D23__IPU_DI1_PIN14 0x134 0x47c 0x000 0x7 0x0
502#define MX53_PAD_EIM_EB3__EMI_WEIM_EB_3 0x138 0x480 0x000 0x0 0x0
503#define MX53_PAD_EIM_EB3__GPIO2_31 0x138 0x480 0x000 0x1 0x0
504#define MX53_PAD_EIM_EB3__UART3_RTS 0x138 0x480 0x884 0x2 0x1
505#define MX53_PAD_EIM_EB3__UART1_RI 0x138 0x480 0x000 0x3 0x0
506#define MX53_PAD_EIM_EB3__IPU_DI1_PIN3 0x138 0x480 0x000 0x5 0x0
507#define MX53_PAD_EIM_EB3__IPU_CSI1_HSYNC 0x138 0x480 0x838 0x6 0x0
508#define MX53_PAD_EIM_EB3__IPU_DI1_PIN16 0x138 0x480 0x000 0x7 0x0
509#define MX53_PAD_EIM_D24__EMI_WEIM_D_24 0x13c 0x484 0x000 0x0 0x0
510#define MX53_PAD_EIM_D24__GPIO3_24 0x13c 0x484 0x000 0x1 0x0
511#define MX53_PAD_EIM_D24__UART3_TXD_MUX 0x13c 0x484 0x000 0x2 0x0
512#define MX53_PAD_EIM_D24__ECSPI1_SS2 0x13c 0x484 0x7b0 0x3 0x1
513#define MX53_PAD_EIM_D24__CSPI_SS2 0x13c 0x484 0x794 0x4 0x1
514#define MX53_PAD_EIM_D24__AUDMUX_AUD5_RXFS 0x13c 0x484 0x754 0x5 0x1
515#define MX53_PAD_EIM_D24__ECSPI2_SS2 0x13c 0x484 0x000 0x6 0x0
516#define MX53_PAD_EIM_D24__UART1_DTR 0x13c 0x484 0x000 0x7 0x0
517#define MX53_PAD_EIM_D25__EMI_WEIM_D_25 0x140 0x488 0x000 0x0 0x0
518#define MX53_PAD_EIM_D25__GPIO3_25 0x140 0x488 0x000 0x1 0x0
519#define MX53_PAD_EIM_D25__UART3_RXD_MUX 0x140 0x488 0x888 0x2 0x1
520#define MX53_PAD_EIM_D25__ECSPI1_SS3 0x140 0x488 0x7b4 0x3 0x1
521#define MX53_PAD_EIM_D25__CSPI_SS3 0x140 0x488 0x798 0x4 0x1
522#define MX53_PAD_EIM_D25__AUDMUX_AUD5_RXC 0x140 0x488 0x750 0x5 0x1
523#define MX53_PAD_EIM_D25__ECSPI2_SS3 0x140 0x488 0x000 0x6 0x0
524#define MX53_PAD_EIM_D25__UART1_DSR 0x140 0x488 0x000 0x7 0x0
525#define MX53_PAD_EIM_D26__EMI_WEIM_D_26 0x144 0x48c 0x000 0x0 0x0
526#define MX53_PAD_EIM_D26__GPIO3_26 0x144 0x48c 0x000 0x1 0x0
527#define MX53_PAD_EIM_D26__UART2_TXD_MUX 0x144 0x48c 0x000 0x2 0x0
528#define MX53_PAD_EIM_D26__FIRI_RXD 0x144 0x48c 0x80c 0x3 0x0
529#define MX53_PAD_EIM_D26__IPU_CSI0_D_1 0x144 0x48c 0x000 0x4 0x0
530#define MX53_PAD_EIM_D26__IPU_DI1_PIN11 0x144 0x48c 0x000 0x5 0x0
531#define MX53_PAD_EIM_D26__IPU_SISG_2 0x144 0x48c 0x000 0x6 0x0
532#define MX53_PAD_EIM_D26__IPU_DISP1_DAT_22 0x144 0x48c 0x000 0x7 0x0
533#define MX53_PAD_EIM_D27__EMI_WEIM_D_27 0x148 0x490 0x000 0x0 0x0
534#define MX53_PAD_EIM_D27__GPIO3_27 0x148 0x490 0x000 0x1 0x0
535#define MX53_PAD_EIM_D27__UART2_RXD_MUX 0x148 0x490 0x880 0x2 0x1
536#define MX53_PAD_EIM_D27__FIRI_TXD 0x148 0x490 0x000 0x3 0x0
537#define MX53_PAD_EIM_D27__IPU_CSI0_D_0 0x148 0x490 0x000 0x4 0x0
538#define MX53_PAD_EIM_D27__IPU_DI1_PIN13 0x148 0x490 0x000 0x5 0x0
539#define MX53_PAD_EIM_D27__IPU_SISG_3 0x148 0x490 0x000 0x6 0x0
540#define MX53_PAD_EIM_D27__IPU_DISP1_DAT_23 0x148 0x490 0x000 0x7 0x0
541#define MX53_PAD_EIM_D28__EMI_WEIM_D_28 0x14c 0x494 0x000 0x0 0x0
542#define MX53_PAD_EIM_D28__GPIO3_28 0x14c 0x494 0x000 0x1 0x0
543#define MX53_PAD_EIM_D28__UART2_CTS 0x14c 0x494 0x000 0x2 0x0
544#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO 0x14c 0x494 0x82c 0x3 0x1
545#define MX53_PAD_EIM_D28__CSPI_MOSI 0x14c 0x494 0x788 0x4 0x1
546#define MX53_PAD_EIM_D28__I2C1_SDA 0x14c 0x494 0x818 0x5 0x1
547#define MX53_PAD_EIM_D28__IPU_EXT_TRIG 0x14c 0x494 0x000 0x6 0x0
548#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 0x14c 0x494 0x000 0x7 0x0
549#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 0x150 0x498 0x000 0x0 0x0
550#define MX53_PAD_EIM_D29__GPIO3_29 0x150 0x498 0x000 0x1 0x0
551#define MX53_PAD_EIM_D29__UART2_RTS 0x150 0x498 0x87c 0x2 0x1
552#define MX53_PAD_EIM_D29__IPU_DISPB0_SER_RS 0x150 0x498 0x000 0x3 0x0
553#define MX53_PAD_EIM_D29__CSPI_SS0 0x150 0x498 0x78c 0x4 0x2
554#define MX53_PAD_EIM_D29__IPU_DI1_PIN15 0x150 0x498 0x000 0x5 0x0
555#define MX53_PAD_EIM_D29__IPU_CSI1_VSYNC 0x150 0x498 0x83c 0x6 0x0
556#define MX53_PAD_EIM_D29__IPU_DI0_PIN14 0x150 0x498 0x000 0x7 0x0
557#define MX53_PAD_EIM_D30__EMI_WEIM_D_30 0x154 0x49c 0x000 0x0 0x0
558#define MX53_PAD_EIM_D30__GPIO3_30 0x154 0x49c 0x000 0x1 0x0
559#define MX53_PAD_EIM_D30__UART3_CTS 0x154 0x49c 0x000 0x2 0x0
560#define MX53_PAD_EIM_D30__IPU_CSI0_D_3 0x154 0x49c 0x000 0x3 0x0
561#define MX53_PAD_EIM_D30__IPU_DI0_PIN11 0x154 0x49c 0x000 0x4 0x0
562#define MX53_PAD_EIM_D30__IPU_DISP1_DAT_21 0x154 0x49c 0x000 0x5 0x0
563#define MX53_PAD_EIM_D30__USBOH3_USBH1_OC 0x154 0x49c 0x8a0 0x6 0x0
564#define MX53_PAD_EIM_D30__USBOH3_USBH2_OC 0x154 0x49c 0x8a4 0x7 0x1
565#define MX53_PAD_EIM_D31__EMI_WEIM_D_31 0x158 0x4a0 0x000 0x0 0x0
566#define MX53_PAD_EIM_D31__GPIO3_31 0x158 0x4a0 0x000 0x1 0x0
567#define MX53_PAD_EIM_D31__UART3_RTS 0x158 0x4a0 0x884 0x2 0x3
568#define MX53_PAD_EIM_D31__IPU_CSI0_D_2 0x158 0x4a0 0x000 0x3 0x0
569#define MX53_PAD_EIM_D31__IPU_DI0_PIN12 0x158 0x4a0 0x000 0x4 0x0
570#define MX53_PAD_EIM_D31__IPU_DISP1_DAT_20 0x158 0x4a0 0x000 0x5 0x0
571#define MX53_PAD_EIM_D31__USBOH3_USBH1_PWR 0x158 0x4a0 0x000 0x6 0x0
572#define MX53_PAD_EIM_D31__USBOH3_USBH2_PWR 0x158 0x4a0 0x000 0x7 0x0
573#define MX53_PAD_EIM_A24__EMI_WEIM_A_24 0x15c 0x4a8 0x000 0x0 0x0
574#define MX53_PAD_EIM_A24__GPIO5_4 0x15c 0x4a8 0x000 0x1 0x0
575#define MX53_PAD_EIM_A24__IPU_DISP1_DAT_19 0x15c 0x4a8 0x000 0x2 0x0
576#define MX53_PAD_EIM_A24__IPU_CSI1_D_19 0x15c 0x4a8 0x000 0x3 0x0
577#define MX53_PAD_EIM_A24__IPU_SISG_2 0x15c 0x4a8 0x000 0x6 0x0
578#define MX53_PAD_EIM_A24__USBPHY2_BVALID 0x15c 0x4a8 0x000 0x7 0x0
579#define MX53_PAD_EIM_A23__EMI_WEIM_A_23 0x160 0x4ac 0x000 0x0 0x0
580#define MX53_PAD_EIM_A23__GPIO6_6 0x160 0x4ac 0x000 0x1 0x0
581#define MX53_PAD_EIM_A23__IPU_DISP1_DAT_18 0x160 0x4ac 0x000 0x2 0x0
582#define MX53_PAD_EIM_A23__IPU_CSI1_D_18 0x160 0x4ac 0x000 0x3 0x0
583#define MX53_PAD_EIM_A23__IPU_SISG_3 0x160 0x4ac 0x000 0x6 0x0
584#define MX53_PAD_EIM_A23__USBPHY2_ENDSESSION 0x160 0x4ac 0x000 0x7 0x0
585#define MX53_PAD_EIM_A22__EMI_WEIM_A_22 0x164 0x4b0 0x000 0x0 0x0
586#define MX53_PAD_EIM_A22__GPIO2_16 0x164 0x4b0 0x000 0x1 0x0
587#define MX53_PAD_EIM_A22__IPU_DISP1_DAT_17 0x164 0x4b0 0x000 0x2 0x0
588#define MX53_PAD_EIM_A22__IPU_CSI1_D_17 0x164 0x4b0 0x000 0x3 0x0
589#define MX53_PAD_EIM_A22__SRC_BT_CFG1_7 0x164 0x4b0 0x000 0x7 0x0
590#define MX53_PAD_EIM_A21__EMI_WEIM_A_21 0x168 0x4b4 0x000 0x0 0x0
591#define MX53_PAD_EIM_A21__GPIO2_17 0x168 0x4b4 0x000 0x1 0x0
592#define MX53_PAD_EIM_A21__IPU_DISP1_DAT_16 0x168 0x4b4 0x000 0x2 0x0
593#define MX53_PAD_EIM_A21__IPU_CSI1_D_16 0x168 0x4b4 0x000 0x3 0x0
594#define MX53_PAD_EIM_A21__SRC_BT_CFG1_6 0x168 0x4b4 0x000 0x7 0x0
595#define MX53_PAD_EIM_A20__EMI_WEIM_A_20 0x16c 0x4b8 0x000 0x0 0x0
596#define MX53_PAD_EIM_A20__GPIO2_18 0x16c 0x4b8 0x000 0x1 0x0
597#define MX53_PAD_EIM_A20__IPU_DISP1_DAT_15 0x16c 0x4b8 0x000 0x2 0x0
598#define MX53_PAD_EIM_A20__IPU_CSI1_D_15 0x16c 0x4b8 0x000 0x3 0x0
599#define MX53_PAD_EIM_A20__SRC_BT_CFG1_5 0x16c 0x4b8 0x000 0x7 0x0
600#define MX53_PAD_EIM_A19__EMI_WEIM_A_19 0x170 0x4bc 0x000 0x0 0x0
601#define MX53_PAD_EIM_A19__GPIO2_19 0x170 0x4bc 0x000 0x1 0x0
602#define MX53_PAD_EIM_A19__IPU_DISP1_DAT_14 0x170 0x4bc 0x000 0x2 0x0
603#define MX53_PAD_EIM_A19__IPU_CSI1_D_14 0x170 0x4bc 0x000 0x3 0x0
604#define MX53_PAD_EIM_A19__SRC_BT_CFG1_4 0x170 0x4bc 0x000 0x7 0x0
605#define MX53_PAD_EIM_A18__EMI_WEIM_A_18 0x174 0x4c0 0x000 0x0 0x0
606#define MX53_PAD_EIM_A18__GPIO2_20 0x174 0x4c0 0x000 0x1 0x0
607#define MX53_PAD_EIM_A18__IPU_DISP1_DAT_13 0x174 0x4c0 0x000 0x2 0x0
608#define MX53_PAD_EIM_A18__IPU_CSI1_D_13 0x174 0x4c0 0x000 0x3 0x0
609#define MX53_PAD_EIM_A18__SRC_BT_CFG1_3 0x174 0x4c0 0x000 0x7 0x0
610#define MX53_PAD_EIM_A17__EMI_WEIM_A_17 0x178 0x4c4 0x000 0x0 0x0
611#define MX53_PAD_EIM_A17__GPIO2_21 0x178 0x4c4 0x000 0x1 0x0
612#define MX53_PAD_EIM_A17__IPU_DISP1_DAT_12 0x178 0x4c4 0x000 0x2 0x0
613#define MX53_PAD_EIM_A17__IPU_CSI1_D_12 0x178 0x4c4 0x000 0x3 0x0
614#define MX53_PAD_EIM_A17__SRC_BT_CFG1_2 0x178 0x4c4 0x000 0x7 0x0
615#define MX53_PAD_EIM_A16__EMI_WEIM_A_16 0x17c 0x4c8 0x000 0x0 0x0
616#define MX53_PAD_EIM_A16__GPIO2_22 0x17c 0x4c8 0x000 0x1 0x0
617#define MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK 0x17c 0x4c8 0x000 0x2 0x0
618#define MX53_PAD_EIM_A16__IPU_CSI1_PIXCLK 0x17c 0x4c8 0x000 0x3 0x0
619#define MX53_PAD_EIM_A16__SRC_BT_CFG1_1 0x17c 0x4c8 0x000 0x7 0x0
620#define MX53_PAD_EIM_CS0__EMI_WEIM_CS_0 0x180 0x4cc 0x000 0x0 0x0
621#define MX53_PAD_EIM_CS0__GPIO2_23 0x180 0x4cc 0x000 0x1 0x0
622#define MX53_PAD_EIM_CS0__ECSPI2_SCLK 0x180 0x4cc 0x7b8 0x2 0x2
623#define MX53_PAD_EIM_CS0__IPU_DI1_PIN5 0x180 0x4cc 0x000 0x3 0x0
624#define MX53_PAD_EIM_CS1__EMI_WEIM_CS_1 0x184 0x4d0 0x000 0x0 0x0
625#define MX53_PAD_EIM_CS1__GPIO2_24 0x184 0x4d0 0x000 0x1 0x0
626#define MX53_PAD_EIM_CS1__ECSPI2_MOSI 0x184 0x4d0 0x7c0 0x2 0x2
627#define MX53_PAD_EIM_CS1__IPU_DI1_PIN6 0x184 0x4d0 0x000 0x3 0x0
628#define MX53_PAD_EIM_OE__EMI_WEIM_OE 0x188 0x4d4 0x000 0x0 0x0
629#define MX53_PAD_EIM_OE__GPIO2_25 0x188 0x4d4 0x000 0x1 0x0
630#define MX53_PAD_EIM_OE__ECSPI2_MISO 0x188 0x4d4 0x7bc 0x2 0x2
631#define MX53_PAD_EIM_OE__IPU_DI1_PIN7 0x188 0x4d4 0x000 0x3 0x0
632#define MX53_PAD_EIM_OE__USBPHY2_IDDIG 0x188 0x4d4 0x000 0x7 0x0
633#define MX53_PAD_EIM_RW__EMI_WEIM_RW 0x18c 0x4d8 0x000 0x0 0x0
634#define MX53_PAD_EIM_RW__GPIO2_26 0x18c 0x4d8 0x000 0x1 0x0
635#define MX53_PAD_EIM_RW__ECSPI2_SS0 0x18c 0x4d8 0x7c4 0x2 0x2
636#define MX53_PAD_EIM_RW__IPU_DI1_PIN8 0x18c 0x4d8 0x000 0x3 0x0
637#define MX53_PAD_EIM_RW__USBPHY2_HOSTDISCONNECT 0x18c 0x4d8 0x000 0x7 0x0
638#define MX53_PAD_EIM_LBA__EMI_WEIM_LBA 0x190 0x4dc 0x000 0x0 0x0
639#define MX53_PAD_EIM_LBA__GPIO2_27 0x190 0x4dc 0x000 0x1 0x0
640#define MX53_PAD_EIM_LBA__ECSPI2_SS1 0x190 0x4dc 0x7c8 0x2 0x1
641#define MX53_PAD_EIM_LBA__IPU_DI1_PIN17 0x190 0x4dc 0x000 0x3 0x0
642#define MX53_PAD_EIM_LBA__SRC_BT_CFG1_0 0x190 0x4dc 0x000 0x7 0x0
643#define MX53_PAD_EIM_EB0__EMI_WEIM_EB_0 0x194 0x4e4 0x000 0x0 0x0
644#define MX53_PAD_EIM_EB0__GPIO2_28 0x194 0x4e4 0x000 0x1 0x0
645#define MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11 0x194 0x4e4 0x000 0x3 0x0
646#define MX53_PAD_EIM_EB0__IPU_CSI1_D_11 0x194 0x4e4 0x000 0x4 0x0
647#define MX53_PAD_EIM_EB0__GPC_PMIC_RDY 0x194 0x4e4 0x810 0x5 0x0
648#define MX53_PAD_EIM_EB0__SRC_BT_CFG2_7 0x194 0x4e4 0x000 0x7 0x0
649#define MX53_PAD_EIM_EB1__EMI_WEIM_EB_1 0x198 0x4e8 0x000 0x0 0x0
650#define MX53_PAD_EIM_EB1__GPIO2_29 0x198 0x4e8 0x000 0x1 0x0
651#define MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10 0x198 0x4e8 0x000 0x3 0x0
652#define MX53_PAD_EIM_EB1__IPU_CSI1_D_10 0x198 0x4e8 0x000 0x4 0x0
653#define MX53_PAD_EIM_EB1__SRC_BT_CFG2_6 0x198 0x4e8 0x000 0x7 0x0
654#define MX53_PAD_EIM_DA0__EMI_NAND_WEIM_DA_0 0x19c 0x4ec 0x000 0x0 0x0
655#define MX53_PAD_EIM_DA0__GPIO3_0 0x19c 0x4ec 0x000 0x1 0x0
656#define MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9 0x19c 0x4ec 0x000 0x3 0x0
657#define MX53_PAD_EIM_DA0__IPU_CSI1_D_9 0x19c 0x4ec 0x000 0x4 0x0
658#define MX53_PAD_EIM_DA0__SRC_BT_CFG2_5 0x19c 0x4ec 0x000 0x7 0x0
659#define MX53_PAD_EIM_DA1__EMI_NAND_WEIM_DA_1 0x1a0 0x4f0 0x000 0x0 0x0
660#define MX53_PAD_EIM_DA1__GPIO3_1 0x1a0 0x4f0 0x000 0x1 0x0
661#define MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8 0x1a0 0x4f0 0x000 0x3 0x0
662#define MX53_PAD_EIM_DA1__IPU_CSI1_D_8 0x1a0 0x4f0 0x000 0x4 0x0
663#define MX53_PAD_EIM_DA1__SRC_BT_CFG2_4 0x1a0 0x4f0 0x000 0x7 0x0
664#define MX53_PAD_EIM_DA2__EMI_NAND_WEIM_DA_2 0x1a4 0x4f4 0x000 0x0 0x0
665#define MX53_PAD_EIM_DA2__GPIO3_2 0x1a4 0x4f4 0x000 0x1 0x0
666#define MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7 0x1a4 0x4f4 0x000 0x3 0x0
667#define MX53_PAD_EIM_DA2__IPU_CSI1_D_7 0x1a4 0x4f4 0x000 0x4 0x0
668#define MX53_PAD_EIM_DA2__SRC_BT_CFG2_3 0x1a4 0x4f4 0x000 0x7 0x0
669#define MX53_PAD_EIM_DA3__EMI_NAND_WEIM_DA_3 0x1a8 0x4f8 0x000 0x0 0x0
670#define MX53_PAD_EIM_DA3__GPIO3_3 0x1a8 0x4f8 0x000 0x1 0x0
671#define MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6 0x1a8 0x4f8 0x000 0x3 0x0
672#define MX53_PAD_EIM_DA3__IPU_CSI1_D_6 0x1a8 0x4f8 0x000 0x4 0x0
673#define MX53_PAD_EIM_DA3__SRC_BT_CFG2_2 0x1a8 0x4f8 0x000 0x7 0x0
674#define MX53_PAD_EIM_DA4__EMI_NAND_WEIM_DA_4 0x1ac 0x4fc 0x000 0x0 0x0
675#define MX53_PAD_EIM_DA4__GPIO3_4 0x1ac 0x4fc 0x000 0x1 0x0
676#define MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5 0x1ac 0x4fc 0x000 0x3 0x0
677#define MX53_PAD_EIM_DA4__IPU_CSI1_D_5 0x1ac 0x4fc 0x000 0x4 0x0
678#define MX53_PAD_EIM_DA4__SRC_BT_CFG3_7 0x1ac 0x4fc 0x000 0x7 0x0
679#define MX53_PAD_EIM_DA5__EMI_NAND_WEIM_DA_5 0x1b0 0x500 0x000 0x0 0x0
680#define MX53_PAD_EIM_DA5__GPIO3_5 0x1b0 0x500 0x000 0x1 0x0
681#define MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4 0x1b0 0x500 0x000 0x3 0x0
682#define MX53_PAD_EIM_DA5__IPU_CSI1_D_4 0x1b0 0x500 0x000 0x4 0x0
683#define MX53_PAD_EIM_DA5__SRC_BT_CFG3_6 0x1b0 0x500 0x000 0x7 0x0
684#define MX53_PAD_EIM_DA6__EMI_NAND_WEIM_DA_6 0x1b4 0x504 0x000 0x0 0x0
685#define MX53_PAD_EIM_DA6__GPIO3_6 0x1b4 0x504 0x000 0x1 0x0
686#define MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3 0x1b4 0x504 0x000 0x3 0x0
687#define MX53_PAD_EIM_DA6__IPU_CSI1_D_3 0x1b4 0x504 0x000 0x4 0x0
688#define MX53_PAD_EIM_DA6__SRC_BT_CFG3_5 0x1b4 0x504 0x000 0x7 0x0
689#define MX53_PAD_EIM_DA7__EMI_NAND_WEIM_DA_7 0x1b8 0x508 0x000 0x0 0x0
690#define MX53_PAD_EIM_DA7__GPIO3_7 0x1b8 0x508 0x000 0x1 0x0
691#define MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2 0x1b8 0x508 0x000 0x3 0x0
692#define MX53_PAD_EIM_DA7__IPU_CSI1_D_2 0x1b8 0x508 0x000 0x4 0x0
693#define MX53_PAD_EIM_DA7__SRC_BT_CFG3_4 0x1b8 0x508 0x000 0x7 0x0
694#define MX53_PAD_EIM_DA8__EMI_NAND_WEIM_DA_8 0x1bc 0x50c 0x000 0x0 0x0
695#define MX53_PAD_EIM_DA8__GPIO3_8 0x1bc 0x50c 0x000 0x1 0x0
696#define MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1 0x1bc 0x50c 0x000 0x3 0x0
697#define MX53_PAD_EIM_DA8__IPU_CSI1_D_1 0x1bc 0x50c 0x000 0x4 0x0
698#define MX53_PAD_EIM_DA8__SRC_BT_CFG3_3 0x1bc 0x50c 0x000 0x7 0x0
699#define MX53_PAD_EIM_DA9__EMI_NAND_WEIM_DA_9 0x1c0 0x510 0x000 0x0 0x0
700#define MX53_PAD_EIM_DA9__GPIO3_9 0x1c0 0x510 0x000 0x1 0x0
701#define MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0 0x1c0 0x510 0x000 0x3 0x0
702#define MX53_PAD_EIM_DA9__IPU_CSI1_D_0 0x1c0 0x510 0x000 0x4 0x0
703#define MX53_PAD_EIM_DA9__SRC_BT_CFG3_2 0x1c0 0x510 0x000 0x7 0x0
704#define MX53_PAD_EIM_DA10__EMI_NAND_WEIM_DA_10 0x1c4 0x514 0x000 0x0 0x0
705#define MX53_PAD_EIM_DA10__GPIO3_10 0x1c4 0x514 0x000 0x1 0x0
706#define MX53_PAD_EIM_DA10__IPU_DI1_PIN15 0x1c4 0x514 0x000 0x3 0x0
707#define MX53_PAD_EIM_DA10__IPU_CSI1_DATA_EN 0x1c4 0x514 0x834 0x4 0x1
708#define MX53_PAD_EIM_DA10__SRC_BT_CFG3_1 0x1c4 0x514 0x000 0x7 0x0
709#define MX53_PAD_EIM_DA11__EMI_NAND_WEIM_DA_11 0x1c8 0x518 0x000 0x0 0x0
710#define MX53_PAD_EIM_DA11__GPIO3_11 0x1c8 0x518 0x000 0x1 0x0
711#define MX53_PAD_EIM_DA11__IPU_DI1_PIN2 0x1c8 0x518 0x000 0x3 0x0
712#define MX53_PAD_EIM_DA11__IPU_CSI1_HSYNC 0x1c8 0x518 0x838 0x4 0x1
713#define MX53_PAD_EIM_DA12__EMI_NAND_WEIM_DA_12 0x1cc 0x51c 0x000 0x0 0x0
714#define MX53_PAD_EIM_DA12__GPIO3_12 0x1cc 0x51c 0x000 0x1 0x0
715#define MX53_PAD_EIM_DA12__IPU_DI1_PIN3 0x1cc 0x51c 0x000 0x3 0x0
716#define MX53_PAD_EIM_DA12__IPU_CSI1_VSYNC 0x1cc 0x51c 0x83c 0x4 0x1
717#define MX53_PAD_EIM_DA13__EMI_NAND_WEIM_DA_13 0x1d0 0x520 0x000 0x0 0x0
718#define MX53_PAD_EIM_DA13__GPIO3_13 0x1d0 0x520 0x000 0x1 0x0
719#define MX53_PAD_EIM_DA13__IPU_DI1_D0_CS 0x1d0 0x520 0x000 0x3 0x0
720#define MX53_PAD_EIM_DA13__CCM_DI1_EXT_CLK 0x1d0 0x520 0x76c 0x4 0x1
721#define MX53_PAD_EIM_DA14__EMI_NAND_WEIM_DA_14 0x1d4 0x524 0x000 0x0 0x0
722#define MX53_PAD_EIM_DA14__GPIO3_14 0x1d4 0x524 0x000 0x1 0x0
723#define MX53_PAD_EIM_DA14__IPU_DI1_D1_CS 0x1d4 0x524 0x000 0x3 0x0
724#define MX53_PAD_EIM_DA14__CCM_DI0_EXT_CLK 0x1d4 0x524 0x000 0x4 0x0
725#define MX53_PAD_EIM_DA15__EMI_NAND_WEIM_DA_15 0x1d8 0x528 0x000 0x0 0x0
726#define MX53_PAD_EIM_DA15__GPIO3_15 0x1d8 0x528 0x000 0x1 0x0
727#define MX53_PAD_EIM_DA15__IPU_DI1_PIN1 0x1d8 0x528 0x000 0x3 0x0
728#define MX53_PAD_EIM_DA15__IPU_DI1_PIN4 0x1d8 0x528 0x000 0x4 0x0
729#define MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B 0x1dc 0x52c 0x000 0x0 0x0
730#define MX53_PAD_NANDF_WE_B__GPIO6_12 0x1dc 0x52c 0x000 0x1 0x0
731#define MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B 0x1e0 0x530 0x000 0x0 0x0
732#define MX53_PAD_NANDF_RE_B__GPIO6_13 0x1e0 0x530 0x000 0x1 0x0
733#define MX53_PAD_EIM_WAIT__EMI_WEIM_WAIT 0x1e4 0x534 0x000 0x0 0x0
734#define MX53_PAD_EIM_WAIT__GPIO5_0 0x1e4 0x534 0x000 0x1 0x0
735#define MX53_PAD_EIM_WAIT__EMI_WEIM_DTACK_B 0x1e4 0x534 0x000 0x2 0x0
736#define MX53_PAD_LVDS1_TX3_P__GPIO6_22 0x1ec 0x000 0x000 0x0 0x0
737#define MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3 0x1ec 0x000 0x000 0x1 0x0
738#define MX53_PAD_LVDS1_TX2_P__GPIO6_24 0x1f0 0x000 0x000 0x0 0x0
739#define MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2 0x1f0 0x000 0x000 0x1 0x0
740#define MX53_PAD_LVDS1_CLK_P__GPIO6_26 0x1f4 0x000 0x000 0x0 0x0
741#define MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK 0x1f4 0x000 0x000 0x1 0x0
742#define MX53_PAD_LVDS1_TX1_P__GPIO6_28 0x1f8 0x000 0x000 0x0 0x0
743#define MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1 0x1f8 0x000 0x000 0x1 0x0
744#define MX53_PAD_LVDS1_TX0_P__GPIO6_30 0x1fc 0x000 0x000 0x0 0x0
745#define MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0 0x1fc 0x000 0x000 0x1 0x0
746#define MX53_PAD_LVDS0_TX3_P__GPIO7_22 0x200 0x000 0x000 0x0 0x0
747#define MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x200 0x000 0x000 0x1 0x0
748#define MX53_PAD_LVDS0_CLK_P__GPIO7_24 0x204 0x000 0x000 0x0 0x0
749#define MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK 0x204 0x000 0x000 0x1 0x0
750#define MX53_PAD_LVDS0_TX2_P__GPIO7_26 0x208 0x000 0x000 0x0 0x0
751#define MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2 0x208 0x000 0x000 0x1 0x0
752#define MX53_PAD_LVDS0_TX1_P__GPIO7_28 0x20c 0x000 0x000 0x0 0x0
753#define MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1 0x20c 0x000 0x000 0x1 0x0
754#define MX53_PAD_LVDS0_TX0_P__GPIO7_30 0x210 0x000 0x000 0x0 0x0
755#define MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0 0x210 0x000 0x000 0x1 0x0
756#define MX53_PAD_GPIO_10__GPIO4_0 0x214 0x540 0x000 0x0 0x0
757#define MX53_PAD_GPIO_10__OSC32k_32K_OUT 0x214 0x540 0x000 0x1 0x0
758#define MX53_PAD_GPIO_11__GPIO4_1 0x218 0x544 0x000 0x0 0x0
759#define MX53_PAD_GPIO_12__GPIO4_2 0x21c 0x548 0x000 0x0 0x0
760#define MX53_PAD_GPIO_13__GPIO4_3 0x220 0x54c 0x000 0x0 0x0
761#define MX53_PAD_GPIO_14__GPIO4_4 0x224 0x550 0x000 0x0 0x0
762#define MX53_PAD_NANDF_CLE__EMI_NANDF_CLE 0x228 0x5a0 0x000 0x0 0x0
763#define MX53_PAD_NANDF_CLE__GPIO6_7 0x228 0x5a0 0x000 0x1 0x0
764#define MX53_PAD_NANDF_CLE__USBPHY1_VSTATUS_0 0x228 0x5a0 0x000 0x7 0x0
765#define MX53_PAD_NANDF_ALE__EMI_NANDF_ALE 0x22c 0x5a4 0x000 0x0 0x0
766#define MX53_PAD_NANDF_ALE__GPIO6_8 0x22c 0x5a4 0x000 0x1 0x0
767#define MX53_PAD_NANDF_ALE__USBPHY1_VSTATUS_1 0x22c 0x5a4 0x000 0x7 0x0
768#define MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B 0x230 0x5a8 0x000 0x0 0x0
769#define MX53_PAD_NANDF_WP_B__GPIO6_9 0x230 0x5a8 0x000 0x1 0x0
770#define MX53_PAD_NANDF_WP_B__USBPHY1_VSTATUS_2 0x230 0x5a8 0x000 0x7 0x0
771#define MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0 0x234 0x5ac 0x000 0x0 0x0
772#define MX53_PAD_NANDF_RB0__GPIO6_10 0x234 0x5ac 0x000 0x1 0x0
773#define MX53_PAD_NANDF_RB0__USBPHY1_VSTATUS_3 0x234 0x5ac 0x000 0x7 0x0
774#define MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0 0x238 0x5b0 0x000 0x0 0x0
775#define MX53_PAD_NANDF_CS0__GPIO6_11 0x238 0x5b0 0x000 0x1 0x0
776#define MX53_PAD_NANDF_CS0__USBPHY1_VSTATUS_4 0x238 0x5b0 0x000 0x7 0x0
777#define MX53_PAD_NANDF_CS1__EMI_NANDF_CS_1 0x23c 0x5b4 0x000 0x0 0x0
778#define MX53_PAD_NANDF_CS1__GPIO6_14 0x23c 0x5b4 0x000 0x1 0x0
779#define MX53_PAD_NANDF_CS1__MLB_MLBCLK 0x23c 0x5b4 0x858 0x6 0x0
780#define MX53_PAD_NANDF_CS1__USBPHY1_VSTATUS_5 0x23c 0x5b4 0x000 0x7 0x0
781#define MX53_PAD_NANDF_CS2__EMI_NANDF_CS_2 0x240 0x5b8 0x000 0x0 0x0
782#define MX53_PAD_NANDF_CS2__GPIO6_15 0x240 0x5b8 0x000 0x1 0x0
783#define MX53_PAD_NANDF_CS2__IPU_SISG_0 0x240 0x5b8 0x000 0x2 0x0
784#define MX53_PAD_NANDF_CS2__ESAI1_TX0 0x240 0x5b8 0x7e4 0x3 0x0
785#define MX53_PAD_NANDF_CS2__EMI_WEIM_CRE 0x240 0x5b8 0x000 0x4 0x0
786#define MX53_PAD_NANDF_CS2__CCM_CSI0_MCLK 0x240 0x5b8 0x000 0x5 0x0
787#define MX53_PAD_NANDF_CS2__MLB_MLBSIG 0x240 0x5b8 0x860 0x6 0x0
788#define MX53_PAD_NANDF_CS2__USBPHY1_VSTATUS_6 0x240 0x5b8 0x000 0x7 0x0
789#define MX53_PAD_NANDF_CS3__EMI_NANDF_CS_3 0x244 0x5bc 0x000 0x0 0x0
790#define MX53_PAD_NANDF_CS3__GPIO6_16 0x244 0x5bc 0x000 0x1 0x0
791#define MX53_PAD_NANDF_CS3__IPU_SISG_1 0x244 0x5bc 0x000 0x2 0x0
792#define MX53_PAD_NANDF_CS3__ESAI1_TX1 0x244 0x5bc 0x7e8 0x3 0x0
793#define MX53_PAD_NANDF_CS3__EMI_WEIM_A_26 0x244 0x5bc 0x000 0x4 0x0
794#define MX53_PAD_NANDF_CS3__MLB_MLBDAT 0x244 0x5bc 0x85c 0x6 0x0
795#define MX53_PAD_NANDF_CS3__USBPHY1_VSTATUS_7 0x244 0x5bc 0x000 0x7 0x0
796#define MX53_PAD_FEC_MDIO__FEC_MDIO 0x248 0x5c4 0x804 0x0 0x1
797#define MX53_PAD_FEC_MDIO__GPIO1_22 0x248 0x5c4 0x000 0x1 0x0
798#define MX53_PAD_FEC_MDIO__ESAI1_SCKR 0x248 0x5c4 0x7dc 0x2 0x0
799#define MX53_PAD_FEC_MDIO__FEC_COL 0x248 0x5c4 0x800 0x3 0x1
800#define MX53_PAD_FEC_MDIO__RTC_CE_RTC_PS2 0x248 0x5c4 0x000 0x4 0x0
801#define MX53_PAD_FEC_MDIO__SDMA_DEBUG_BUS_DEVICE_3 0x248 0x5c4 0x000 0x5 0x0
802#define MX53_PAD_FEC_MDIO__EMI_EMI_DEBUG_49 0x248 0x5c4 0x000 0x6 0x0
803#define MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x24c 0x5c8 0x000 0x0 0x0
804#define MX53_PAD_FEC_REF_CLK__GPIO1_23 0x24c 0x5c8 0x000 0x1 0x0
805#define MX53_PAD_FEC_REF_CLK__ESAI1_FSR 0x24c 0x5c8 0x7cc 0x2 0x0
806#define MX53_PAD_FEC_REF_CLK__SDMA_DEBUG_BUS_DEVICE_4 0x24c 0x5c8 0x000 0x5 0x0
807#define MX53_PAD_FEC_REF_CLK__EMI_EMI_DEBUG_50 0x24c 0x5c8 0x000 0x6 0x0
808#define MX53_PAD_FEC_RX_ER__FEC_RX_ER 0x250 0x5cc 0x000 0x0 0x0
809#define MX53_PAD_FEC_RX_ER__GPIO1_24 0x250 0x5cc 0x000 0x1 0x0
810#define MX53_PAD_FEC_RX_ER__ESAI1_HCKR 0x250 0x5cc 0x7d4 0x2 0x0
811#define MX53_PAD_FEC_RX_ER__FEC_RX_CLK 0x250 0x5cc 0x808 0x3 0x1
812#define MX53_PAD_FEC_RX_ER__RTC_CE_RTC_PS3 0x250 0x5cc 0x000 0x4 0x0
813#define MX53_PAD_FEC_CRS_DV__FEC_RX_DV 0x254 0x5d0 0x000 0x0 0x0
814#define MX53_PAD_FEC_CRS_DV__GPIO1_25 0x254 0x5d0 0x000 0x1 0x0
815#define MX53_PAD_FEC_CRS_DV__ESAI1_SCKT 0x254 0x5d0 0x7e0 0x2 0x0
816#define MX53_PAD_FEC_RXD1__FEC_RDATA_1 0x258 0x5d4 0x000 0x0 0x0
817#define MX53_PAD_FEC_RXD1__GPIO1_26 0x258 0x5d4 0x000 0x1 0x0
818#define MX53_PAD_FEC_RXD1__ESAI1_FST 0x258 0x5d4 0x7d0 0x2 0x0
819#define MX53_PAD_FEC_RXD1__MLB_MLBSIG 0x258 0x5d4 0x860 0x3 0x1
820#define MX53_PAD_FEC_RXD1__RTC_CE_RTC_PS1 0x258 0x5d4 0x000 0x4 0x0
821#define MX53_PAD_FEC_RXD0__FEC_RDATA_0 0x25c 0x5d8 0x000 0x0 0x0
822#define MX53_PAD_FEC_RXD0__GPIO1_27 0x25c 0x5d8 0x000 0x1 0x0
823#define MX53_PAD_FEC_RXD0__ESAI1_HCKT 0x25c 0x5d8 0x7d8 0x2 0x0
824#define MX53_PAD_FEC_RXD0__OSC32k_32K_OUT 0x25c 0x5d8 0x000 0x3 0x0
825#define MX53_PAD_FEC_TX_EN__FEC_TX_EN 0x260 0x5dc 0x000 0x0 0x0
826#define MX53_PAD_FEC_TX_EN__GPIO1_28 0x260 0x5dc 0x000 0x1 0x0
827#define MX53_PAD_FEC_TX_EN__ESAI1_TX3_RX2 0x260 0x5dc 0x7f0 0x2 0x0
828#define MX53_PAD_FEC_TXD1__FEC_TDATA_1 0x264 0x5e0 0x000 0x0 0x0
829#define MX53_PAD_FEC_TXD1__GPIO1_29 0x264 0x5e0 0x000 0x1 0x0
830#define MX53_PAD_FEC_TXD1__ESAI1_TX2_RX3 0x264 0x5e0 0x7ec 0x2 0x0
831#define MX53_PAD_FEC_TXD1__MLB_MLBCLK 0x264 0x5e0 0x858 0x3 0x1
832#define MX53_PAD_FEC_TXD1__RTC_CE_RTC_PRSC_CLK 0x264 0x5e0 0x000 0x4 0x0
833#define MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x268 0x5e4 0x000 0x0 0x0
834#define MX53_PAD_FEC_TXD0__GPIO1_30 0x268 0x5e4 0x000 0x1 0x0
835#define MX53_PAD_FEC_TXD0__ESAI1_TX4_RX1 0x268 0x5e4 0x7f4 0x2 0x0
836#define MX53_PAD_FEC_TXD0__USBPHY2_DATAOUT_0 0x268 0x5e4 0x000 0x7 0x0
837#define MX53_PAD_FEC_MDC__FEC_MDC 0x26c 0x5e8 0x000 0x0 0x0
838#define MX53_PAD_FEC_MDC__GPIO1_31 0x26c 0x5e8 0x000 0x1 0x0
839#define MX53_PAD_FEC_MDC__ESAI1_TX5_RX0 0x26c 0x5e8 0x7f8 0x2 0x0
840#define MX53_PAD_FEC_MDC__MLB_MLBDAT 0x26c 0x5e8 0x85c 0x3 0x1
841#define MX53_PAD_FEC_MDC__RTC_CE_RTC_ALARM1_TRIG 0x26c 0x5e8 0x000 0x4 0x0
842#define MX53_PAD_FEC_MDC__USBPHY2_DATAOUT_1 0x26c 0x5e8 0x000 0x7 0x0
843#define MX53_PAD_PATA_DIOW__PATA_DIOW 0x270 0x5f0 0x000 0x0 0x0
844#define MX53_PAD_PATA_DIOW__GPIO6_17 0x270 0x5f0 0x000 0x1 0x0
845#define MX53_PAD_PATA_DIOW__UART1_TXD_MUX 0x270 0x5f0 0x000 0x3 0x0
846#define MX53_PAD_PATA_DIOW__USBPHY2_DATAOUT_2 0x270 0x5f0 0x000 0x7 0x0
847#define MX53_PAD_PATA_DMACK__PATA_DMACK 0x274 0x5f4 0x000 0x0 0x0
848#define MX53_PAD_PATA_DMACK__GPIO6_18 0x274 0x5f4 0x000 0x1 0x0
849#define MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x274 0x5f4 0x878 0x3 0x3
850#define MX53_PAD_PATA_DMACK__USBPHY2_DATAOUT_3 0x274 0x5f4 0x000 0x7 0x0
851#define MX53_PAD_PATA_DMARQ__PATA_DMARQ 0x278 0x5f8 0x000 0x0 0x0
852#define MX53_PAD_PATA_DMARQ__GPIO7_0 0x278 0x5f8 0x000 0x1 0x0
853#define MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x278 0x5f8 0x000 0x3 0x0
854#define MX53_PAD_PATA_DMARQ__CCM_CCM_OUT_0 0x278 0x5f8 0x000 0x5 0x0
855#define MX53_PAD_PATA_DMARQ__USBPHY2_DATAOUT_4 0x278 0x5f8 0x000 0x7 0x0
856#define MX53_PAD_PATA_BUFFER_EN__PATA_BUFFER_EN 0x27c 0x5fc 0x000 0x0 0x0
857#define MX53_PAD_PATA_BUFFER_EN__GPIO7_1 0x27c 0x5fc 0x000 0x1 0x0
858#define MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX 0x27c 0x5fc 0x880 0x3 0x3
859#define MX53_PAD_PATA_BUFFER_EN__CCM_CCM_OUT_1 0x27c 0x5fc 0x000 0x5 0x0
860#define MX53_PAD_PATA_BUFFER_EN__USBPHY2_DATAOUT_5 0x27c 0x5fc 0x000 0x7 0x0
861#define MX53_PAD_PATA_INTRQ__PATA_INTRQ 0x280 0x600 0x000 0x0 0x0
862#define MX53_PAD_PATA_INTRQ__GPIO7_2 0x280 0x600 0x000 0x1 0x0
863#define MX53_PAD_PATA_INTRQ__UART2_CTS 0x280 0x600 0x000 0x3 0x0
864#define MX53_PAD_PATA_INTRQ__CAN1_TXCAN 0x280 0x600 0x000 0x4 0x0
865#define MX53_PAD_PATA_INTRQ__CCM_CCM_OUT_2 0x280 0x600 0x000 0x5 0x0
866#define MX53_PAD_PATA_INTRQ__USBPHY2_DATAOUT_6 0x280 0x600 0x000 0x7 0x0
867#define MX53_PAD_PATA_DIOR__PATA_DIOR 0x284 0x604 0x000 0x0 0x0
868#define MX53_PAD_PATA_DIOR__GPIO7_3 0x284 0x604 0x000 0x1 0x0
869#define MX53_PAD_PATA_DIOR__UART2_RTS 0x284 0x604 0x87c 0x3 0x3
870#define MX53_PAD_PATA_DIOR__CAN1_RXCAN 0x284 0x604 0x760 0x4 0x1
871#define MX53_PAD_PATA_DIOR__USBPHY2_DATAOUT_7 0x284 0x604 0x000 0x7 0x0
872#define MX53_PAD_PATA_RESET_B__PATA_PATA_RESET_B 0x288 0x608 0x000 0x0 0x0
873#define MX53_PAD_PATA_RESET_B__GPIO7_4 0x288 0x608 0x000 0x1 0x0
874#define MX53_PAD_PATA_RESET_B__ESDHC3_CMD 0x288 0x608 0x000 0x2 0x0
875#define MX53_PAD_PATA_RESET_B__UART1_CTS 0x288 0x608 0x000 0x3 0x0
876#define MX53_PAD_PATA_RESET_B__CAN2_TXCAN 0x288 0x608 0x000 0x4 0x0
877#define MX53_PAD_PATA_RESET_B__USBPHY1_DATAOUT_0 0x288 0x608 0x000 0x7 0x0
878#define MX53_PAD_PATA_IORDY__PATA_IORDY 0x28c 0x60c 0x000 0x0 0x0
879#define MX53_PAD_PATA_IORDY__GPIO7_5 0x28c 0x60c 0x000 0x1 0x0
880#define MX53_PAD_PATA_IORDY__ESDHC3_CLK 0x28c 0x60c 0x000 0x2 0x0
881#define MX53_PAD_PATA_IORDY__UART1_RTS 0x28c 0x60c 0x874 0x3 0x3
882#define MX53_PAD_PATA_IORDY__CAN2_RXCAN 0x28c 0x60c 0x764 0x4 0x1
883#define MX53_PAD_PATA_IORDY__USBPHY1_DATAOUT_1 0x28c 0x60c 0x000 0x7 0x0
884#define MX53_PAD_PATA_DA_0__PATA_DA_0 0x290 0x610 0x000 0x0 0x0
885#define MX53_PAD_PATA_DA_0__GPIO7_6 0x290 0x610 0x000 0x1 0x0
886#define MX53_PAD_PATA_DA_0__ESDHC3_RST 0x290 0x610 0x000 0x2 0x0
887#define MX53_PAD_PATA_DA_0__OWIRE_LINE 0x290 0x610 0x864 0x4 0x0
888#define MX53_PAD_PATA_DA_0__USBPHY1_DATAOUT_2 0x290 0x610 0x000 0x7 0x0
889#define MX53_PAD_PATA_DA_1__PATA_DA_1 0x294 0x614 0x000 0x0 0x0
890#define MX53_PAD_PATA_DA_1__GPIO7_7 0x294 0x614 0x000 0x1 0x0
891#define MX53_PAD_PATA_DA_1__ESDHC4_CMD 0x294 0x614 0x000 0x2 0x0
892#define MX53_PAD_PATA_DA_1__UART3_CTS 0x294 0x614 0x000 0x4 0x0
893#define MX53_PAD_PATA_DA_1__USBPHY1_DATAOUT_3 0x294 0x614 0x000 0x7 0x0
894#define MX53_PAD_PATA_DA_2__PATA_DA_2 0x298 0x618 0x000 0x0 0x0
895#define MX53_PAD_PATA_DA_2__GPIO7_8 0x298 0x618 0x000 0x1 0x0
896#define MX53_PAD_PATA_DA_2__ESDHC4_CLK 0x298 0x618 0x000 0x2 0x0
897#define MX53_PAD_PATA_DA_2__UART3_RTS 0x298 0x618 0x884 0x4 0x5
898#define MX53_PAD_PATA_DA_2__USBPHY1_DATAOUT_4 0x298 0x618 0x000 0x7 0x0
899#define MX53_PAD_PATA_CS_0__PATA_CS_0 0x29c 0x61c 0x000 0x0 0x0
900#define MX53_PAD_PATA_CS_0__GPIO7_9 0x29c 0x61c 0x000 0x1 0x0
901#define MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x29c 0x61c 0x000 0x4 0x0
902#define MX53_PAD_PATA_CS_0__USBPHY1_DATAOUT_5 0x29c 0x61c 0x000 0x7 0x0
903#define MX53_PAD_PATA_CS_1__PATA_CS_1 0x2a0 0x620 0x000 0x0 0x0
904#define MX53_PAD_PATA_CS_1__GPIO7_10 0x2a0 0x620 0x000 0x1 0x0
905#define MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x2a0 0x620 0x888 0x4 0x3
906#define MX53_PAD_PATA_CS_1__USBPHY1_DATAOUT_6 0x2a0 0x620 0x000 0x7 0x0
907#define MX53_PAD_PATA_DATA0__PATA_DATA_0 0x2a4 0x628 0x000 0x0 0x0
908#define MX53_PAD_PATA_DATA0__GPIO2_0 0x2a4 0x628 0x000 0x1 0x0
909#define MX53_PAD_PATA_DATA0__EMI_NANDF_D_0 0x2a4 0x628 0x000 0x3 0x0
910#define MX53_PAD_PATA_DATA0__ESDHC3_DAT4 0x2a4 0x628 0x000 0x4 0x0
911#define MX53_PAD_PATA_DATA0__GPU3d_GPU_DEBUG_OUT_0 0x2a4 0x628 0x000 0x5 0x0
912#define MX53_PAD_PATA_DATA0__IPU_DIAG_BUS_0 0x2a4 0x628 0x000 0x6 0x0
913#define MX53_PAD_PATA_DATA0__USBPHY1_DATAOUT_7 0x2a4 0x628 0x000 0x7 0x0
914#define MX53_PAD_PATA_DATA1__PATA_DATA_1 0x2a8 0x62c 0x000 0x0 0x0
915#define MX53_PAD_PATA_DATA1__GPIO2_1 0x2a8 0x62c 0x000 0x1 0x0
916#define MX53_PAD_PATA_DATA1__EMI_NANDF_D_1 0x2a8 0x62c 0x000 0x3 0x0
917#define MX53_PAD_PATA_DATA1__ESDHC3_DAT5 0x2a8 0x62c 0x000 0x4 0x0
918#define MX53_PAD_PATA_DATA1__GPU3d_GPU_DEBUG_OUT_1 0x2a8 0x62c 0x000 0x5 0x0
919#define MX53_PAD_PATA_DATA1__IPU_DIAG_BUS_1 0x2a8 0x62c 0x000 0x6 0x0
920#define MX53_PAD_PATA_DATA2__PATA_DATA_2 0x2ac 0x630 0x000 0x0 0x0
921#define MX53_PAD_PATA_DATA2__GPIO2_2 0x2ac 0x630 0x000 0x1 0x0
922#define MX53_PAD_PATA_DATA2__EMI_NANDF_D_2 0x2ac 0x630 0x000 0x3 0x0
923#define MX53_PAD_PATA_DATA2__ESDHC3_DAT6 0x2ac 0x630 0x000 0x4 0x0
924#define MX53_PAD_PATA_DATA2__GPU3d_GPU_DEBUG_OUT_2 0x2ac 0x630 0x000 0x5 0x0
925#define MX53_PAD_PATA_DATA2__IPU_DIAG_BUS_2 0x2ac 0x630 0x000 0x6 0x0
926#define MX53_PAD_PATA_DATA3__PATA_DATA_3 0x2b0 0x634 0x000 0x0 0x0
927#define MX53_PAD_PATA_DATA3__GPIO2_3 0x2b0 0x634 0x000 0x1 0x0
928#define MX53_PAD_PATA_DATA3__EMI_NANDF_D_3 0x2b0 0x634 0x000 0x3 0x0
929#define MX53_PAD_PATA_DATA3__ESDHC3_DAT7 0x2b0 0x634 0x000 0x4 0x0
930#define MX53_PAD_PATA_DATA3__GPU3d_GPU_DEBUG_OUT_3 0x2b0 0x634 0x000 0x5 0x0
931#define MX53_PAD_PATA_DATA3__IPU_DIAG_BUS_3 0x2b0 0x634 0x000 0x6 0x0
932#define MX53_PAD_PATA_DATA4__PATA_DATA_4 0x2b4 0x638 0x000 0x0 0x0
933#define MX53_PAD_PATA_DATA4__GPIO2_4 0x2b4 0x638 0x000 0x1 0x0
934#define MX53_PAD_PATA_DATA4__EMI_NANDF_D_4 0x2b4 0x638 0x000 0x3 0x0
935#define MX53_PAD_PATA_DATA4__ESDHC4_DAT4 0x2b4 0x638 0x000 0x4 0x0
936#define MX53_PAD_PATA_DATA4__GPU3d_GPU_DEBUG_OUT_4 0x2b4 0x638 0x000 0x5 0x0
937#define MX53_PAD_PATA_DATA4__IPU_DIAG_BUS_4 0x2b4 0x638 0x000 0x6 0x0
938#define MX53_PAD_PATA_DATA5__PATA_DATA_5 0x2b8 0x63c 0x000 0x0 0x0
939#define MX53_PAD_PATA_DATA5__GPIO2_5 0x2b8 0x63c 0x000 0x1 0x0
940#define MX53_PAD_PATA_DATA5__EMI_NANDF_D_5 0x2b8 0x63c 0x000 0x3 0x0
941#define MX53_PAD_PATA_DATA5__ESDHC4_DAT5 0x2b8 0x63c 0x000 0x4 0x0
942#define MX53_PAD_PATA_DATA5__GPU3d_GPU_DEBUG_OUT_5 0x2b8 0x63c 0x000 0x5 0x0
943#define MX53_PAD_PATA_DATA5__IPU_DIAG_BUS_5 0x2b8 0x63c 0x000 0x6 0x0
944#define MX53_PAD_PATA_DATA6__PATA_DATA_6 0x2bc 0x640 0x000 0x0 0x0
945#define MX53_PAD_PATA_DATA6__GPIO2_6 0x2bc 0x640 0x000 0x1 0x0
946#define MX53_PAD_PATA_DATA6__EMI_NANDF_D_6 0x2bc 0x640 0x000 0x3 0x0
947#define MX53_PAD_PATA_DATA6__ESDHC4_DAT6 0x2bc 0x640 0x000 0x4 0x0
948#define MX53_PAD_PATA_DATA6__GPU3d_GPU_DEBUG_OUT_6 0x2bc 0x640 0x000 0x5 0x0
949#define MX53_PAD_PATA_DATA6__IPU_DIAG_BUS_6 0x2bc 0x640 0x000 0x6 0x0
950#define MX53_PAD_PATA_DATA7__PATA_DATA_7 0x2c0 0x644 0x000 0x0 0x0
951#define MX53_PAD_PATA_DATA7__GPIO2_7 0x2c0 0x644 0x000 0x1 0x0
952#define MX53_PAD_PATA_DATA7__EMI_NANDF_D_7 0x2c0 0x644 0x000 0x3 0x0
953#define MX53_PAD_PATA_DATA7__ESDHC4_DAT7 0x2c0 0x644 0x000 0x4 0x0
954#define MX53_PAD_PATA_DATA7__GPU3d_GPU_DEBUG_OUT_7 0x2c0 0x644 0x000 0x5 0x0
955#define MX53_PAD_PATA_DATA7__IPU_DIAG_BUS_7 0x2c0 0x644 0x000 0x6 0x0
956#define MX53_PAD_PATA_DATA8__PATA_DATA_8 0x2c4 0x648 0x000 0x0 0x0
957#define MX53_PAD_PATA_DATA8__GPIO2_8 0x2c4 0x648 0x000 0x1 0x0
958#define MX53_PAD_PATA_DATA8__ESDHC1_DAT4 0x2c4 0x648 0x000 0x2 0x0
959#define MX53_PAD_PATA_DATA8__EMI_NANDF_D_8 0x2c4 0x648 0x000 0x3 0x0
960#define MX53_PAD_PATA_DATA8__ESDHC3_DAT0 0x2c4 0x648 0x000 0x4 0x0
961#define MX53_PAD_PATA_DATA8__GPU3d_GPU_DEBUG_OUT_8 0x2c4 0x648 0x000 0x5 0x0
962#define MX53_PAD_PATA_DATA8__IPU_DIAG_BUS_8 0x2c4 0x648 0x000 0x6 0x0
963#define MX53_PAD_PATA_DATA9__PATA_DATA_9 0x2c8 0x64c 0x000 0x0 0x0
964#define MX53_PAD_PATA_DATA9__GPIO2_9 0x2c8 0x64c 0x000 0x1 0x0
965#define MX53_PAD_PATA_DATA9__ESDHC1_DAT5 0x2c8 0x64c 0x000 0x2 0x0
966#define MX53_PAD_PATA_DATA9__EMI_NANDF_D_9 0x2c8 0x64c 0x000 0x3 0x0
967#define MX53_PAD_PATA_DATA9__ESDHC3_DAT1 0x2c8 0x64c 0x000 0x4 0x0
968#define MX53_PAD_PATA_DATA9__GPU3d_GPU_DEBUG_OUT_9 0x2c8 0x64c 0x000 0x5 0x0
969#define MX53_PAD_PATA_DATA9__IPU_DIAG_BUS_9 0x2c8 0x64c 0x000 0x6 0x0
970#define MX53_PAD_PATA_DATA10__PATA_DATA_10 0x2cc 0x650 0x000 0x0 0x0
971#define MX53_PAD_PATA_DATA10__GPIO2_10 0x2cc 0x650 0x000 0x1 0x0
972#define MX53_PAD_PATA_DATA10__ESDHC1_DAT6 0x2cc 0x650 0x000 0x2 0x0
973#define MX53_PAD_PATA_DATA10__EMI_NANDF_D_10 0x2cc 0x650 0x000 0x3 0x0
974#define MX53_PAD_PATA_DATA10__ESDHC3_DAT2 0x2cc 0x650 0x000 0x4 0x0
975#define MX53_PAD_PATA_DATA10__GPU3d_GPU_DEBUG_OUT_10 0x2cc 0x650 0x000 0x5 0x0
976#define MX53_PAD_PATA_DATA10__IPU_DIAG_BUS_10 0x2cc 0x650 0x000 0x6 0x0
977#define MX53_PAD_PATA_DATA11__PATA_DATA_11 0x2d0 0x654 0x000 0x0 0x0
978#define MX53_PAD_PATA_DATA11__GPIO2_11 0x2d0 0x654 0x000 0x1 0x0
979#define MX53_PAD_PATA_DATA11__ESDHC1_DAT7 0x2d0 0x654 0x000 0x2 0x0
980#define MX53_PAD_PATA_DATA11__EMI_NANDF_D_11 0x2d0 0x654 0x000 0x3 0x0
981#define MX53_PAD_PATA_DATA11__ESDHC3_DAT3 0x2d0 0x654 0x000 0x4 0x0
982#define MX53_PAD_PATA_DATA11__GPU3d_GPU_DEBUG_OUT_11 0x2d0 0x654 0x000 0x5 0x0
983#define MX53_PAD_PATA_DATA11__IPU_DIAG_BUS_11 0x2d0 0x654 0x000 0x6 0x0
984#define MX53_PAD_PATA_DATA12__PATA_DATA_12 0x2d4 0x658 0x000 0x0 0x0
985#define MX53_PAD_PATA_DATA12__GPIO2_12 0x2d4 0x658 0x000 0x1 0x0
986#define MX53_PAD_PATA_DATA12__ESDHC2_DAT4 0x2d4 0x658 0x000 0x2 0x0
987#define MX53_PAD_PATA_DATA12__EMI_NANDF_D_12 0x2d4 0x658 0x000 0x3 0x0
988#define MX53_PAD_PATA_DATA12__ESDHC4_DAT0 0x2d4 0x658 0x000 0x4 0x0
989#define MX53_PAD_PATA_DATA12__GPU3d_GPU_DEBUG_OUT_12 0x2d4 0x658 0x000 0x5 0x0
990#define MX53_PAD_PATA_DATA12__IPU_DIAG_BUS_12 0x2d4 0x658 0x000 0x6 0x0
991#define MX53_PAD_PATA_DATA13__PATA_DATA_13 0x2d8 0x65c 0x000 0x0 0x0
992#define MX53_PAD_PATA_DATA13__GPIO2_13 0x2d8 0x65c 0x000 0x1 0x0
993#define MX53_PAD_PATA_DATA13__ESDHC2_DAT5 0x2d8 0x65c 0x000 0x2 0x0
994#define MX53_PAD_PATA_DATA13__EMI_NANDF_D_13 0x2d8 0x65c 0x000 0x3 0x0
995#define MX53_PAD_PATA_DATA13__ESDHC4_DAT1 0x2d8 0x65c 0x000 0x4 0x0
996#define MX53_PAD_PATA_DATA13__GPU3d_GPU_DEBUG_OUT_13 0x2d8 0x65c 0x000 0x5 0x0
997#define MX53_PAD_PATA_DATA13__IPU_DIAG_BUS_13 0x2d8 0x65c 0x000 0x6 0x0
998#define MX53_PAD_PATA_DATA14__PATA_DATA_14 0x2dc 0x660 0x000 0x0 0x0
999#define MX53_PAD_PATA_DATA14__GPIO2_14 0x2dc 0x660 0x000 0x1 0x0
1000#define MX53_PAD_PATA_DATA14__ESDHC2_DAT6 0x2dc 0x660 0x000 0x2 0x0
1001#define MX53_PAD_PATA_DATA14__EMI_NANDF_D_14 0x2dc 0x660 0x000 0x3 0x0
1002#define MX53_PAD_PATA_DATA14__ESDHC4_DAT2 0x2dc 0x660 0x000 0x4 0x0
1003#define MX53_PAD_PATA_DATA14__GPU3d_GPU_DEBUG_OUT_14 0x2dc 0x660 0x000 0x5 0x0
1004#define MX53_PAD_PATA_DATA14__IPU_DIAG_BUS_14 0x2dc 0x660 0x000 0x6 0x0
1005#define MX53_PAD_PATA_DATA15__PATA_DATA_15 0x2e0 0x664 0x000 0x0 0x0
1006#define MX53_PAD_PATA_DATA15__GPIO2_15 0x2e0 0x664 0x000 0x1 0x0
1007#define MX53_PAD_PATA_DATA15__ESDHC2_DAT7 0x2e0 0x664 0x000 0x2 0x0
1008#define MX53_PAD_PATA_DATA15__EMI_NANDF_D_15 0x2e0 0x664 0x000 0x3 0x0
1009#define MX53_PAD_PATA_DATA15__ESDHC4_DAT3 0x2e0 0x664 0x000 0x4 0x0
1010#define MX53_PAD_PATA_DATA15__GPU3d_GPU_DEBUG_OUT_15 0x2e0 0x664 0x000 0x5 0x0
1011#define MX53_PAD_PATA_DATA15__IPU_DIAG_BUS_15 0x2e0 0x664 0x000 0x6 0x0
1012#define MX53_PAD_SD1_DATA0__ESDHC1_DAT0 0x2e4 0x66c 0x000 0x0 0x0
1013#define MX53_PAD_SD1_DATA0__GPIO1_16 0x2e4 0x66c 0x000 0x1 0x0
1014#define MX53_PAD_SD1_DATA0__GPT_CAPIN1 0x2e4 0x66c 0x000 0x3 0x0
1015#define MX53_PAD_SD1_DATA0__CSPI_MISO 0x2e4 0x66c 0x784 0x5 0x2
1016#define MX53_PAD_SD1_DATA0__CCM_PLL3_BYP 0x2e4 0x66c 0x778 0x7 0x0
1017#define MX53_PAD_SD1_DATA1__ESDHC1_DAT1 0x2e8 0x670 0x000 0x0 0x0
1018#define MX53_PAD_SD1_DATA1__GPIO1_17 0x2e8 0x670 0x000 0x1 0x0
1019#define MX53_PAD_SD1_DATA1__GPT_CAPIN2 0x2e8 0x670 0x000 0x3 0x0
1020#define MX53_PAD_SD1_DATA1__CSPI_SS0 0x2e8 0x670 0x78c 0x5 0x3
1021#define MX53_PAD_SD1_DATA1__CCM_PLL4_BYP 0x2e8 0x670 0x77c 0x7 0x1
1022#define MX53_PAD_SD1_CMD__ESDHC1_CMD 0x2ec 0x674 0x000 0x0 0x0
1023#define MX53_PAD_SD1_CMD__GPIO1_18 0x2ec 0x674 0x000 0x1 0x0
1024#define MX53_PAD_SD1_CMD__GPT_CMPOUT1 0x2ec 0x674 0x000 0x3 0x0
1025#define MX53_PAD_SD1_CMD__CSPI_MOSI 0x2ec 0x674 0x788 0x5 0x2
1026#define MX53_PAD_SD1_CMD__CCM_PLL1_BYP 0x2ec 0x674 0x770 0x7 0x0
1027#define MX53_PAD_SD1_DATA2__ESDHC1_DAT2 0x2f0 0x678 0x000 0x0 0x0
1028#define MX53_PAD_SD1_DATA2__GPIO1_19 0x2f0 0x678 0x000 0x1 0x0
1029#define MX53_PAD_SD1_DATA2__GPT_CMPOUT2 0x2f0 0x678 0x000 0x2 0x0
1030#define MX53_PAD_SD1_DATA2__PWM2_PWMO 0x2f0 0x678 0x000 0x3 0x0
1031#define MX53_PAD_SD1_DATA2__WDOG1_WDOG_B 0x2f0 0x678 0x000 0x4 0x0
1032#define MX53_PAD_SD1_DATA2__CSPI_SS1 0x2f0 0x678 0x790 0x5 0x2
1033#define MX53_PAD_SD1_DATA2__WDOG1_WDOG_RST_B_DEB 0x2f0 0x678 0x000 0x6 0x0
1034#define MX53_PAD_SD1_DATA2__CCM_PLL2_BYP 0x2f0 0x678 0x774 0x7 0x0
1035#define MX53_PAD_SD1_CLK__ESDHC1_CLK 0x2f4 0x67c 0x000 0x0 0x0
1036#define MX53_PAD_SD1_CLK__GPIO1_20 0x2f4 0x67c 0x000 0x1 0x0
1037#define MX53_PAD_SD1_CLK__OSC32k_32K_OUT 0x2f4 0x67c 0x000 0x2 0x0
1038#define MX53_PAD_SD1_CLK__GPT_CLKIN 0x2f4 0x67c 0x000 0x3 0x0
1039#define MX53_PAD_SD1_CLK__CSPI_SCLK 0x2f4 0x67c 0x780 0x5 0x2
1040#define MX53_PAD_SD1_CLK__SATA_PHY_DTB_0 0x2f4 0x67c 0x000 0x7 0x0
1041#define MX53_PAD_SD1_DATA3__ESDHC1_DAT3 0x2f8 0x680 0x000 0x0 0x0
1042#define MX53_PAD_SD1_DATA3__GPIO1_21 0x2f8 0x680 0x000 0x1 0x0
1043#define MX53_PAD_SD1_DATA3__GPT_CMPOUT3 0x2f8 0x680 0x000 0x2 0x0
1044#define MX53_PAD_SD1_DATA3__PWM1_PWMO 0x2f8 0x680 0x000 0x3 0x0
1045#define MX53_PAD_SD1_DATA3__WDOG2_WDOG_B 0x2f8 0x680 0x000 0x4 0x0
1046#define MX53_PAD_SD1_DATA3__CSPI_SS2 0x2f8 0x680 0x794 0x5 0x2
1047#define MX53_PAD_SD1_DATA3__WDOG2_WDOG_RST_B_DEB 0x2f8 0x680 0x000 0x6 0x0
1048#define MX53_PAD_SD1_DATA3__SATA_PHY_DTB_1 0x2f8 0x680 0x000 0x7 0x0
1049#define MX53_PAD_SD2_CLK__ESDHC2_CLK 0x2fc 0x688 0x000 0x0 0x0
1050#define MX53_PAD_SD2_CLK__GPIO1_10 0x2fc 0x688 0x000 0x1 0x0
1051#define MX53_PAD_SD2_CLK__KPP_COL_5 0x2fc 0x688 0x840 0x2 0x2
1052#define MX53_PAD_SD2_CLK__AUDMUX_AUD4_RXFS 0x2fc 0x688 0x73c 0x3 0x1
1053#define MX53_PAD_SD2_CLK__CSPI_SCLK 0x2fc 0x688 0x780 0x5 0x3
1054#define MX53_PAD_SD2_CLK__SCC_RANDOM_V 0x2fc 0x688 0x000 0x7 0x0
1055#define MX53_PAD_SD2_CMD__ESDHC2_CMD 0x300 0x68c 0x000 0x0 0x0
1056#define MX53_PAD_SD2_CMD__GPIO1_11 0x300 0x68c 0x000 0x1 0x0
1057#define MX53_PAD_SD2_CMD__KPP_ROW_5 0x300 0x68c 0x84c 0x2 0x1
1058#define MX53_PAD_SD2_CMD__AUDMUX_AUD4_RXC 0x300 0x68c 0x738 0x3 0x1
1059#define MX53_PAD_SD2_CMD__CSPI_MOSI 0x300 0x68c 0x788 0x5 0x3
1060#define MX53_PAD_SD2_CMD__SCC_RANDOM 0x300 0x68c 0x000 0x7 0x0
1061#define MX53_PAD_SD2_DATA3__ESDHC2_DAT3 0x304 0x690 0x000 0x0 0x0
1062#define MX53_PAD_SD2_DATA3__GPIO1_12 0x304 0x690 0x000 0x1 0x0
1063#define MX53_PAD_SD2_DATA3__KPP_COL_6 0x304 0x690 0x844 0x2 0x1
1064#define MX53_PAD_SD2_DATA3__AUDMUX_AUD4_TXC 0x304 0x690 0x740 0x3 0x1
1065#define MX53_PAD_SD2_DATA3__CSPI_SS2 0x304 0x690 0x794 0x5 0x3
1066#define MX53_PAD_SD2_DATA3__SJC_DONE 0x304 0x690 0x000 0x7 0x0
1067#define MX53_PAD_SD2_DATA2__ESDHC2_DAT2 0x308 0x694 0x000 0x0 0x0
1068#define MX53_PAD_SD2_DATA2__GPIO1_13 0x308 0x694 0x000 0x1 0x0
1069#define MX53_PAD_SD2_DATA2__KPP_ROW_6 0x308 0x694 0x850 0x2 0x1
1070#define MX53_PAD_SD2_DATA2__AUDMUX_AUD4_TXD 0x308 0x694 0x734 0x3 0x1
1071#define MX53_PAD_SD2_DATA2__CSPI_SS1 0x308 0x694 0x790 0x5 0x3
1072#define MX53_PAD_SD2_DATA2__SJC_FAIL 0x308 0x694 0x000 0x7 0x0
1073#define MX53_PAD_SD2_DATA1__ESDHC2_DAT1 0x30c 0x698 0x000 0x0 0x0
1074#define MX53_PAD_SD2_DATA1__GPIO1_14 0x30c 0x698 0x000 0x1 0x0
1075#define MX53_PAD_SD2_DATA1__KPP_COL_7 0x30c 0x698 0x848 0x2 0x1
1076#define MX53_PAD_SD2_DATA1__AUDMUX_AUD4_TXFS 0x30c 0x698 0x744 0x3 0x1
1077#define MX53_PAD_SD2_DATA1__CSPI_SS0 0x30c 0x698 0x78c 0x5 0x4
1078#define MX53_PAD_SD2_DATA1__RTIC_SEC_VIO 0x30c 0x698 0x000 0x7 0x0
1079#define MX53_PAD_SD2_DATA0__ESDHC2_DAT0 0x310 0x69c 0x000 0x0 0x0
1080#define MX53_PAD_SD2_DATA0__GPIO1_15 0x310 0x69c 0x000 0x1 0x0
1081#define MX53_PAD_SD2_DATA0__KPP_ROW_7 0x310 0x69c 0x854 0x2 0x1
1082#define MX53_PAD_SD2_DATA0__AUDMUX_AUD4_RXD 0x310 0x69c 0x730 0x3 0x1
1083#define MX53_PAD_SD2_DATA0__CSPI_MISO 0x310 0x69c 0x784 0x5 0x3
1084#define MX53_PAD_SD2_DATA0__RTIC_DONE_INT 0x310 0x69c 0x000 0x7 0x0
1085#define MX53_PAD_GPIO_0__CCM_CLKO 0x314 0x6a4 0x000 0x0 0x0
1086#define MX53_PAD_GPIO_0__GPIO1_0 0x314 0x6a4 0x000 0x1 0x0
1087#define MX53_PAD_GPIO_0__KPP_COL_5 0x314 0x6a4 0x840 0x2 0x3
1088#define MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x314 0x6a4 0x000 0x3 0x0
1089#define MX53_PAD_GPIO_0__EPIT1_EPITO 0x314 0x6a4 0x000 0x4 0x0
1090#define MX53_PAD_GPIO_0__SRTC_ALARM_DEB 0x314 0x6a4 0x000 0x5 0x0
1091#define MX53_PAD_GPIO_0__USBOH3_USBH1_PWR 0x314 0x6a4 0x000 0x6 0x0
1092#define MX53_PAD_GPIO_0__CSU_TD 0x314 0x6a4 0x000 0x7 0x0
1093#define MX53_PAD_GPIO_1__ESAI1_SCKR 0x318 0x6a8 0x7dc 0x0 0x1
1094#define MX53_PAD_GPIO_1__GPIO1_1 0x318 0x6a8 0x000 0x1 0x0
1095#define MX53_PAD_GPIO_1__KPP_ROW_5 0x318 0x6a8 0x84c 0x2 0x2
1096#define MX53_PAD_GPIO_1__CCM_SSI_EXT2_CLK 0x318 0x6a8 0x000 0x3 0x0
1097#define MX53_PAD_GPIO_1__PWM2_PWMO 0x318 0x6a8 0x000 0x4 0x0
1098#define MX53_PAD_GPIO_1__WDOG2_WDOG_B 0x318 0x6a8 0x000 0x5 0x0
1099#define MX53_PAD_GPIO_1__ESDHC1_CD 0x318 0x6a8 0x000 0x6 0x0
1100#define MX53_PAD_GPIO_1__SRC_TESTER_ACK 0x318 0x6a8 0x000 0x7 0x0
1101#define MX53_PAD_GPIO_9__ESAI1_FSR 0x31c 0x6ac 0x7cc 0x0 0x1
1102#define MX53_PAD_GPIO_9__GPIO1_9 0x31c 0x6ac 0x000 0x1 0x0
1103#define MX53_PAD_GPIO_9__KPP_COL_6 0x31c 0x6ac 0x844 0x2 0x2
1104#define MX53_PAD_GPIO_9__CCM_REF_EN_B 0x31c 0x6ac 0x000 0x3 0x0
1105#define MX53_PAD_GPIO_9__PWM1_PWMO 0x31c 0x6ac 0x000 0x4 0x0
1106#define MX53_PAD_GPIO_9__WDOG1_WDOG_B 0x31c 0x6ac 0x000 0x5 0x0
1107#define MX53_PAD_GPIO_9__ESDHC1_WP 0x31c 0x6ac 0x7fc 0x6 0x1
1108#define MX53_PAD_GPIO_9__SCC_FAIL_STATE 0x31c 0x6ac 0x000 0x7 0x0
1109#define MX53_PAD_GPIO_3__ESAI1_HCKR 0x320 0x6b0 0x7d4 0x0 0x1
1110#define MX53_PAD_GPIO_3__GPIO1_3 0x320 0x6b0 0x000 0x1 0x0
1111#define MX53_PAD_GPIO_3__I2C3_SCL 0x320 0x6b0 0x824 0x2 0x1
1112#define MX53_PAD_GPIO_3__DPLLIP1_TOG_EN 0x320 0x6b0 0x000 0x3 0x0
1113#define MX53_PAD_GPIO_3__CCM_CLKO2 0x320 0x6b0 0x000 0x4 0x0
1114#define MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 0x320 0x6b0 0x000 0x5 0x0
1115#define MX53_PAD_GPIO_3__USBOH3_USBH1_OC 0x320 0x6b0 0x8a0 0x6 0x1
1116#define MX53_PAD_GPIO_3__MLB_MLBCLK 0x320 0x6b0 0x858 0x7 0x2
1117#define MX53_PAD_GPIO_6__ESAI1_SCKT 0x324 0x6b4 0x7e0 0x0 0x1
1118#define MX53_PAD_GPIO_6__GPIO1_6 0x324 0x6b4 0x000 0x1 0x0
1119#define MX53_PAD_GPIO_6__I2C3_SDA 0x324 0x6b4 0x828 0x2 0x1
1120#define MX53_PAD_GPIO_6__CCM_CCM_OUT_0 0x324 0x6b4 0x000 0x3 0x0
1121#define MX53_PAD_GPIO_6__CSU_CSU_INT_DEB 0x324 0x6b4 0x000 0x4 0x0
1122#define MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 0x324 0x6b4 0x000 0x5 0x0
1123#define MX53_PAD_GPIO_6__ESDHC2_LCTL 0x324 0x6b4 0x000 0x6 0x0
1124#define MX53_PAD_GPIO_6__MLB_MLBSIG 0x324 0x6b4 0x860 0x7 0x2
1125#define MX53_PAD_GPIO_2__ESAI1_FST 0x328 0x6b8 0x7d0 0x0 0x1
1126#define MX53_PAD_GPIO_2__GPIO1_2 0x328 0x6b8 0x000 0x1 0x0
1127#define MX53_PAD_GPIO_2__KPP_ROW_6 0x328 0x6b8 0x850 0x2 0x2
1128#define MX53_PAD_GPIO_2__CCM_CCM_OUT_1 0x328 0x6b8 0x000 0x3 0x0
1129#define MX53_PAD_GPIO_2__CSU_CSU_ALARM_AUT_0 0x328 0x6b8 0x000 0x4 0x0
1130#define MX53_PAD_GPIO_2__OBSERVE_MUX_OBSRV_INT_OUT2 0x328 0x6b8 0x000 0x5 0x0
1131#define MX53_PAD_GPIO_2__ESDHC2_WP 0x328 0x6b8 0x000 0x6 0x0
1132#define MX53_PAD_GPIO_2__MLB_MLBDAT 0x328 0x6b8 0x85c 0x7 0x2
1133#define MX53_PAD_GPIO_4__ESAI1_HCKT 0x32c 0x6bc 0x7d8 0x0 0x1
1134#define MX53_PAD_GPIO_4__GPIO1_4 0x32c 0x6bc 0x000 0x1 0x0
1135#define MX53_PAD_GPIO_4__KPP_COL_7 0x32c 0x6bc 0x848 0x2 0x2
1136#define MX53_PAD_GPIO_4__CCM_CCM_OUT_2 0x32c 0x6bc 0x000 0x3 0x0
1137#define MX53_PAD_GPIO_4__CSU_CSU_ALARM_AUT_1 0x32c 0x6bc 0x000 0x4 0x0
1138#define MX53_PAD_GPIO_4__OBSERVE_MUX_OBSRV_INT_OUT3 0x32c 0x6bc 0x000 0x5 0x0
1139#define MX53_PAD_GPIO_4__ESDHC2_CD 0x32c 0x6bc 0x000 0x6 0x0
1140#define MX53_PAD_GPIO_4__SCC_SEC_STATE 0x32c 0x6bc 0x000 0x7 0x0
1141#define MX53_PAD_GPIO_5__ESAI1_TX2_RX3 0x330 0x6c0 0x7ec 0x0 0x1
1142#define MX53_PAD_GPIO_5__GPIO1_5 0x330 0x6c0 0x000 0x1 0x0
1143#define MX53_PAD_GPIO_5__KPP_ROW_7 0x330 0x6c0 0x854 0x2 0x2
1144#define MX53_PAD_GPIO_5__CCM_CLKO 0x330 0x6c0 0x000 0x3 0x0
1145#define MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 0x330 0x6c0 0x000 0x4 0x0
1146#define MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 0x330 0x6c0 0x000 0x5 0x0
1147#define MX53_PAD_GPIO_5__I2C3_SCL 0x330 0x6c0 0x824 0x6 0x2
1148#define MX53_PAD_GPIO_5__CCM_PLL1_BYP 0x330 0x6c0 0x770 0x7 0x1
1149#define MX53_PAD_GPIO_7__ESAI1_TX4_RX1 0x334 0x6c4 0x7f4 0x0 0x1
1150#define MX53_PAD_GPIO_7__GPIO1_7 0x334 0x6c4 0x000 0x1 0x0
1151#define MX53_PAD_GPIO_7__EPIT1_EPITO 0x334 0x6c4 0x000 0x2 0x0
1152#define MX53_PAD_GPIO_7__CAN1_TXCAN 0x334 0x6c4 0x000 0x3 0x0
1153#define MX53_PAD_GPIO_7__UART2_TXD_MUX 0x334 0x6c4 0x000 0x4 0x0
1154#define MX53_PAD_GPIO_7__FIRI_RXD 0x334 0x6c4 0x80c 0x5 0x1
1155#define MX53_PAD_GPIO_7__SPDIF_PLOCK 0x334 0x6c4 0x000 0x6 0x0
1156#define MX53_PAD_GPIO_7__CCM_PLL2_BYP 0x334 0x6c4 0x774 0x7 0x1
1157#define MX53_PAD_GPIO_8__ESAI1_TX5_RX0 0x338 0x6c8 0x7f8 0x0 0x1
1158#define MX53_PAD_GPIO_8__GPIO1_8 0x338 0x6c8 0x000 0x1 0x0
1159#define MX53_PAD_GPIO_8__EPIT2_EPITO 0x338 0x6c8 0x000 0x2 0x0
1160#define MX53_PAD_GPIO_8__CAN1_RXCAN 0x338 0x6c8 0x760 0x3 0x2
1161#define MX53_PAD_GPIO_8__UART2_RXD_MUX 0x338 0x6c8 0x880 0x4 0x5
1162#define MX53_PAD_GPIO_8__FIRI_TXD 0x338 0x6c8 0x000 0x5 0x0
1163#define MX53_PAD_GPIO_8__SPDIF_SRCLK 0x338 0x6c8 0x000 0x6 0x0
1164#define MX53_PAD_GPIO_8__CCM_PLL3_BYP 0x338 0x6c8 0x778 0x7 0x1
1165#define MX53_PAD_GPIO_16__ESAI1_TX3_RX2 0x33c 0x6cc 0x7f0 0x0 0x1
1166#define MX53_PAD_GPIO_16__GPIO7_11 0x33c 0x6cc 0x000 0x1 0x0
1167#define MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT 0x33c 0x6cc 0x000 0x2 0x0
1168#define MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 0x33c 0x6cc 0x000 0x4 0x0
1169#define MX53_PAD_GPIO_16__SPDIF_IN1 0x33c 0x6cc 0x870 0x5 0x1
1170#define MX53_PAD_GPIO_16__I2C3_SDA 0x33c 0x6cc 0x828 0x6 0x2
1171#define MX53_PAD_GPIO_16__SJC_DE_B 0x33c 0x6cc 0x000 0x7 0x0
1172#define MX53_PAD_GPIO_17__ESAI1_TX0 0x340 0x6d0 0x7e4 0x0 0x1
1173#define MX53_PAD_GPIO_17__GPIO7_12 0x340 0x6d0 0x000 0x1 0x0
1174#define MX53_PAD_GPIO_17__SDMA_EXT_EVENT_0 0x340 0x6d0 0x868 0x2 0x1
1175#define MX53_PAD_GPIO_17__GPC_PMIC_RDY 0x340 0x6d0 0x810 0x3 0x1
1176#define MX53_PAD_GPIO_17__RTC_CE_RTC_FSV_TRIG 0x340 0x6d0 0x000 0x4 0x0
1177#define MX53_PAD_GPIO_17__SPDIF_OUT1 0x340 0x6d0 0x000 0x5 0x0
1178#define MX53_PAD_GPIO_17__IPU_SNOOP2 0x340 0x6d0 0x000 0x6 0x0
1179#define MX53_PAD_GPIO_17__SJC_JTAG_ACT 0x340 0x6d0 0x000 0x7 0x0
1180#define MX53_PAD_GPIO_18__ESAI1_TX1 0x344 0x6d4 0x7e8 0x0 0x1
1181#define MX53_PAD_GPIO_18__GPIO7_13 0x344 0x6d4 0x000 0x1 0x0
1182#define MX53_PAD_GPIO_18__SDMA_EXT_EVENT_1 0x344 0x6d4 0x86c 0x2 0x1
1183#define MX53_PAD_GPIO_18__OWIRE_LINE 0x344 0x6d4 0x864 0x3 0x1
1184#define MX53_PAD_GPIO_18__RTC_CE_RTC_ALARM2_TRIG 0x344 0x6d4 0x000 0x4 0x0
1185#define MX53_PAD_GPIO_18__CCM_ASRC_EXT_CLK 0x344 0x6d4 0x768 0x5 0x1
1186#define MX53_PAD_GPIO_18__ESDHC1_LCTL 0x344 0x6d4 0x000 0x6 0x0
1187#define MX53_PAD_GPIO_18__SRC_SYSTEM_RST 0x344 0x6d4 0x000 0x7 0x0
1188
1189#endif /* __DTS_IMX53_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dts
index 05cc5620436b..8f0e9ae0e3e6 100644
--- a/arch/arm/boot/dts/imx53-qsb.dts
+++ b/arch/arm/boot/dts/imx53-qsb.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx53.dtsi" 14#include "imx53.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX53 Quick Start Board"; 17 model = "Freescale i.MX53 Quick Start Board";
@@ -110,21 +110,21 @@
110 hog { 110 hog {
111 pinctrl_hog: hoggrp { 111 pinctrl_hog: hoggrp {
112 fsl,pins = < 112 fsl,pins = <
113 1071 0x80000000 /* MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK */ 113 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000
114 1141 0x80000000 /* MX53_PAD_GPIO_8__GPIO1_8 */ 114 MX53_PAD_GPIO_8__GPIO1_8 0x80000000
115 982 0x80000000 /* MX53_PAD_PATA_DATA14__GPIO2_14 */ 115 MX53_PAD_PATA_DATA14__GPIO2_14 0x80000000
116 989 0x80000000 /* MX53_PAD_PATA_DATA15__GPIO2_15 */ 116 MX53_PAD_PATA_DATA15__GPIO2_15 0x80000000
117 693 0x80000000 /* MX53_PAD_EIM_DA11__GPIO3_11 */ 117 MX53_PAD_EIM_DA11__GPIO3_11 0x80000000
118 697 0x80000000 /* MX53_PAD_EIM_DA12__GPIO3_12 */ 118 MX53_PAD_EIM_DA12__GPIO3_12 0x80000000
119 701 0x80000000 /* MX53_PAD_EIM_DA13__GPIO3_13 */ 119 MX53_PAD_EIM_DA13__GPIO3_13 0x80000000
120 868 0x80000000 /* MX53_PAD_PATA_DA_0__GPIO7_6 */ 120 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
121 1149 0x80000000 /* MX53_PAD_GPIO_16__GPIO7_11 */ 121 MX53_PAD_GPIO_16__GPIO7_11 0x80000000
122 >; 122 >;
123 }; 123 };
124 124
125 led_pin_gpio7_7: led_gpio7_7@0 { 125 led_pin_gpio7_7: led_gpio7_7@0 {
126 fsl,pins = < 126 fsl,pins = <
127 873 0x80000000 /* MX53_PAD_PATA_DA_1__GPIO7_7 */ 127 MX53_PAD_PATA_DA_1__GPIO7_7 0x80000000
128 >; 128 >;
129 }; 129 };
130 }; 130 };
diff --git a/arch/arm/boot/dts/imx53-smd.dts b/arch/arm/boot/dts/imx53-smd.dts
index 995554c324b8..a9b6e10de0a5 100644
--- a/arch/arm/boot/dts/imx53-smd.dts
+++ b/arch/arm/boot/dts/imx53-smd.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx53.dtsi" 14#include "imx53.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX53 Smart Mobile Reference Design Board"; 17 model = "Freescale i.MX53 Smart Mobile Reference Design Board";
@@ -107,13 +107,13 @@
107 hog { 107 hog {
108 pinctrl_hog: hoggrp { 108 pinctrl_hog: hoggrp {
109 fsl,pins = < 109 fsl,pins = <
110 982 0x80000000 /* MX53_PAD_PATA_DATA14__GPIO2_14 */ 110 MX53_PAD_PATA_DATA14__GPIO2_14 0x80000000
111 989 0x80000000 /* MX53_PAD_PATA_DATA15__GPIO2_15 */ 111 MX53_PAD_PATA_DATA15__GPIO2_15 0x80000000
112 424 0x80000000 /* MX53_PAD_EIM_EB2__GPIO2_30 */ 112 MX53_PAD_EIM_EB2__GPIO2_30 0x80000000
113 701 0x80000000 /* MX53_PAD_EIM_DA13__GPIO3_13 */ 113 MX53_PAD_EIM_DA13__GPIO3_13 0x80000000
114 449 0x80000000 /* MX53_PAD_EIM_D19__GPIO3_19 */ 114 MX53_PAD_EIM_D19__GPIO3_19 0x80000000
115 43 0x80000000 /* MX53_PAD_KEY_ROW2__GPIO4_11 */ 115 MX53_PAD_KEY_ROW2__GPIO4_11 0x80000000
116 868 0x80000000 /* MX53_PAD_PATA_DA_0__GPIO7_6 */ 116 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
117 >; 117 >;
118 }; 118 };
119 }; 119 };
diff --git a/arch/arm/boot/dts/imx53-tqma53.dtsi b/arch/arm/boot/dts/imx53-tqma53.dtsi
index 8278ec5ec222..38bed3ed7c1a 100644
--- a/arch/arm/boot/dts/imx53-tqma53.dtsi
+++ b/arch/arm/boot/dts/imx53-tqma53.dtsi
@@ -10,7 +10,7 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13/include/ "imx53.dtsi" 13#include "imx53.dtsi"
14 14
15/ { 15/ {
16 model = "TQ TQMa53"; 16 model = "TQ TQMa53";
@@ -72,11 +72,11 @@
72 i2s { 72 i2s {
73 pinctrl_i2s_1: i2s-grp1 { 73 pinctrl_i2s_1: i2s-grp1 {
74 fsl,pins = < 74 fsl,pins = <
75 1 0x10000 /* I2S_MCLK */ 75 MX53_PAD_GPIO_19__GPIO4_5 0x10000 /* I2S_MCLK */
76 10 0x10000 /* I2S_SCLK */ 76 MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC 0x10000 /* I2S_SCLK */
77 17 0x10000 /* I2S_DOUT */ 77 MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x10000 /* I2S_DOUT */
78 23 0x10000 /* I2S_LRCLK*/ 78 MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x10000 /* I2S_LRCLK */
79 30 0x10000 /* I2S_DIN */ 79 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x10000 /* I2S_DIN */
80 >; 80 >;
81 }; 81 };
82 }; 82 };
@@ -84,16 +84,16 @@
84 hog { 84 hog {
85 pinctrl_hog: hoggrp { 85 pinctrl_hog: hoggrp {
86 fsl,pins = < 86 fsl,pins = <
87 610 0x10000 /* MX53_PAD_EIM_CS1__IPU_DI1_PIN6 (VSYNC)*/ 87 MX53_PAD_EIM_CS1__IPU_DI1_PIN6 0x10000 /* VSYNC */
88 711 0x10000 /* MX53_PAD_EIM_DA15__IPU_DI1_PIN4 (HSYNC)*/ 88 MX53_PAD_EIM_DA15__IPU_DI1_PIN4 0x10000 /* HSYNC */
89 873 0x10000 /* MX53_PAD_PATA_DA_1__GPIO7_7 (LCD_BLT_EN)*/ 89 MX53_PAD_PATA_DA_1__GPIO7_7 0x10000 /* LCD_BLT_EN */
90 878 0x10000 /* MX53_PAD_PATA_DA_2__GPIO7_8 (LCD_RESET)*/ 90 MX53_PAD_PATA_DA_2__GPIO7_8 0x10000 /* LCD_RESET */
91 922 0x10000 /* MX53_PAD_PATA_DATA5__GPIO2_5 (LCD_POWER)*/ 91 MX53_PAD_PATA_DATA5__GPIO2_5 0x10000 /* LCD_POWER */
92 928 0x10000 /* MX53_PAD_PATA_DATA6__GPIO2_6 (PMIC_INT)*/ 92 MX53_PAD_PATA_DATA6__GPIO2_6 0x10000 /* PMIC_INT */
93 982 0x10000 /* MX53_PAD_PATA_DATA14__GPIO2_14 (CSI_RST)*/ 93 MX53_PAD_PATA_DATA14__GPIO2_14 0x10000 /* CSI_RST */
94 989 0x10000 /* MX53_PAD_PATA_DATA15__GPIO2_15 (CSI_PWDN)*/ 94 MX53_PAD_PATA_DATA15__GPIO2_15 0x10000 /* CSI_PWDN */
95 1069 0x10000 /* MX53_PAD_GPIO_0__GPIO1_0 (SYSTEM_DOWN)*/ 95 MX53_PAD_GPIO_0__GPIO1_0 0x10000 /* SYSTEM_DOWN */
96 1093 0x10000 /* MX53_PAD_GPIO_3__GPIO1_3 */ 96 MX53_PAD_GPIO_3__GPIO1_3 0x10000
97 >; 97 >;
98 }; 98 };
99 }; 99 };
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index d05aa215c7f9..845982eaac22 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -10,7 +10,8 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13/include/ "skeleton.dtsi" 13#include "skeleton.dtsi"
14#include "imx53-pinfunc.h"
14 15
15/ { 16/ {
16 aliases { 17 aliases {
@@ -72,6 +73,9 @@
72 compatible = "fsl,imx53-ipu"; 73 compatible = "fsl,imx53-ipu";
73 reg = <0x18000000 0x080000000>; 74 reg = <0x18000000 0x080000000>;
74 interrupts = <11 10>; 75 interrupts = <11 10>;
76 clocks = <&clks 59>, <&clks 110>, <&clks 61>;
77 clock-names = "bus", "di0", "di1";
78 resets = <&src 2>;
75 }; 79 };
76 80
77 aips@50000000 { /* AIPS1 */ 81 aips@50000000 { /* AIPS1 */
@@ -242,6 +246,14 @@
242 status = "disabled"; 246 status = "disabled";
243 }; 247 };
244 248
249 gpt: timer@53fa0000 {
250 compatible = "fsl,imx53-gpt", "fsl,imx31-gpt";
251 reg = <0x53fa0000 0x4000>;
252 interrupts = <39>;
253 clocks = <&clks 36>, <&clks 41>;
254 clock-names = "ipg", "per";
255 };
256
245 iomuxc: iomuxc@53fa8000 { 257 iomuxc: iomuxc@53fa8000 {
246 compatible = "fsl,imx53-iomuxc"; 258 compatible = "fsl,imx53-iomuxc";
247 reg = <0x53fa8000 0x4000>; 259 reg = <0x53fa8000 0x4000>;
@@ -249,10 +261,10 @@
249 audmux { 261 audmux {
250 pinctrl_audmux_1: audmuxgrp-1 { 262 pinctrl_audmux_1: audmuxgrp-1 {
251 fsl,pins = < 263 fsl,pins = <
252 10 0x80000000 /* MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC */ 264 MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC 0x80000000
253 17 0x80000000 /* MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD */ 265 MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x80000000
254 23 0x80000000 /* MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS */ 266 MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x80000000
255 30 0x80000000 /* MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD */ 267 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x80000000
256 >; 268 >;
257 }; 269 };
258 }; 270 };
@@ -260,16 +272,16 @@
260 fec { 272 fec {
261 pinctrl_fec_1: fecgrp-1 { 273 pinctrl_fec_1: fecgrp-1 {
262 fsl,pins = < 274 fsl,pins = <
263 820 0x80000000 /* MX53_PAD_FEC_MDC__FEC_MDC */ 275 MX53_PAD_FEC_MDC__FEC_MDC 0x80000000
264 779 0x80000000 /* MX53_PAD_FEC_MDIO__FEC_MDIO */ 276 MX53_PAD_FEC_MDIO__FEC_MDIO 0x80000000
265 786 0x80000000 /* MX53_PAD_FEC_REF_CLK__FEC_TX_CLK */ 277 MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x80000000
266 791 0x80000000 /* MX53_PAD_FEC_RX_ER__FEC_RX_ER */ 278 MX53_PAD_FEC_RX_ER__FEC_RX_ER 0x80000000
267 796 0x80000000 /* MX53_PAD_FEC_CRS_DV__FEC_RX_DV */ 279 MX53_PAD_FEC_CRS_DV__FEC_RX_DV 0x80000000
268 799 0x80000000 /* MX53_PAD_FEC_RXD1__FEC_RDATA_1 */ 280 MX53_PAD_FEC_RXD1__FEC_RDATA_1 0x80000000
269 804 0x80000000 /* MX53_PAD_FEC_RXD0__FEC_RDATA_0 */ 281 MX53_PAD_FEC_RXD0__FEC_RDATA_0 0x80000000
270 808 0x80000000 /* MX53_PAD_FEC_TX_EN__FEC_TX_EN */ 282 MX53_PAD_FEC_TX_EN__FEC_TX_EN 0x80000000
271 811 0x80000000 /* MX53_PAD_FEC_TXD1__FEC_TDATA_1 */ 283 MX53_PAD_FEC_TXD1__FEC_TDATA_1 0x80000000
272 816 0x80000000 /* MX53_PAD_FEC_TXD0__FEC_TDATA_0 */ 284 MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x80000000
273 >; 285 >;
274 }; 286 };
275 }; 287 };
@@ -277,27 +289,27 @@
277 csi { 289 csi {
278 pinctrl_csi_1: csigrp-1 { 290 pinctrl_csi_1: csigrp-1 {
279 fsl,pins = < 291 fsl,pins = <
280 286 0x1d5 /* MX53_PAD_CSI0_DATA_EN__IPU_CSI0_DATA_EN */ 292 MX53_PAD_CSI0_DATA_EN__IPU_CSI0_DATA_EN 0x1d5
281 291 0x1d5 /* MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC */ 293 MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC 0x1d5
282 280 0x1d5 /* MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC */ 294 MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC 0x1d5
283 276 0x1d5 /* MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK */ 295 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK 0x1d5
284 409 0x1d5 /* MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19 */ 296 MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19 0x1d5
285 402 0x1d5 /* MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18 */ 297 MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18 0x1d5
286 395 0x1d5 /* MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17 */ 298 MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17 0x1d5
287 388 0x1d5 /* MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16 */ 299 MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16 0x1d5
288 381 0x1d5 /* MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15 */ 300 MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15 0x1d5
289 374 0x1d5 /* MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14 */ 301 MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14 0x1d5
290 367 0x1d5 /* MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13 */ 302 MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13 0x1d5
291 360 0x1d5 /* MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12 */ 303 MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12 0x1d5
292 352 0x1d5 /* MX53_PAD_CSI0_DAT11__IPU_CSI0_D_11 */ 304 MX53_PAD_CSI0_DAT11__IPU_CSI0_D_11 0x1d5
293 344 0x1d5 /* MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 */ 305 MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 0x1d5
294 336 0x1d5 /* MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 */ 306 MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 0x1d5
295 328 0x1d5 /* MX53_PAD_CSI0_DAT8__IPU_CSI0_D_8 */ 307 MX53_PAD_CSI0_DAT8__IPU_CSI0_D_8 0x1d5
296 320 0x1d5 /* MX53_PAD_CSI0_DAT7__IPU_CSI0_D_7 */ 308 MX53_PAD_CSI0_DAT7__IPU_CSI0_D_7 0x1d5
297 312 0x1d5 /* MX53_PAD_CSI0_DAT6__IPU_CSI0_D_6 */ 309 MX53_PAD_CSI0_DAT6__IPU_CSI0_D_6 0x1d5
298 304 0x1d5 /* MX53_PAD_CSI0_DAT5__IPU_CSI0_D_5 */ 310 MX53_PAD_CSI0_DAT5__IPU_CSI0_D_5 0x1d5
299 296 0x1d5 /* MX53_PAD_CSI0_DAT4__IPU_CSI0_D_4 */ 311 MX53_PAD_CSI0_DAT4__IPU_CSI0_D_4 0x1d5
300 276 0x1d5 /* MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK */ 312 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK 0x1d5
301 >; 313 >;
302 }; 314 };
303 }; 315 };
@@ -305,9 +317,9 @@
305 cspi { 317 cspi {
306 pinctrl_cspi_1: cspigrp-1 { 318 pinctrl_cspi_1: cspigrp-1 {
307 fsl,pins = < 319 fsl,pins = <
308 998 0x1d5 /* MX53_PAD_SD1_DATA0__CSPI_MISO */ 320 MX53_PAD_SD1_DATA0__CSPI_MISO 0x1d5
309 1008 0x1d5 /* MX53_PAD_SD1_CMD__CSPI_MOSI */ 321 MX53_PAD_SD1_CMD__CSPI_MOSI 0x1d5
310 1022 0x1d5 /* MX53_PAD_SD1_CLK__CSPI_SCLK */ 322 MX53_PAD_SD1_CLK__CSPI_SCLK 0x1d5
311 >; 323 >;
312 }; 324 };
313 }; 325 };
@@ -315,9 +327,9 @@
315 ecspi1 { 327 ecspi1 {
316 pinctrl_ecspi1_1: ecspi1grp-1 { 328 pinctrl_ecspi1_1: ecspi1grp-1 {
317 fsl,pins = < 329 fsl,pins = <
318 433 0x80000000 /* MX53_PAD_EIM_D16__ECSPI1_SCLK */ 330 MX53_PAD_EIM_D16__ECSPI1_SCLK 0x80000000
319 439 0x80000000 /* MX53_PAD_EIM_D17__ECSPI1_MISO */ 331 MX53_PAD_EIM_D17__ECSPI1_MISO 0x80000000
320 445 0x80000000 /* MX53_PAD_EIM_D18__ECSPI1_MOSI */ 332 MX53_PAD_EIM_D18__ECSPI1_MOSI 0x80000000
321 >; 333 >;
322 }; 334 };
323 }; 335 };
@@ -325,27 +337,27 @@
325 esdhc1 { 337 esdhc1 {
326 pinctrl_esdhc1_1: esdhc1grp-1 { 338 pinctrl_esdhc1_1: esdhc1grp-1 {
327 fsl,pins = < 339 fsl,pins = <
328 995 0x1d5 /* MX53_PAD_SD1_DATA0__ESDHC1_DAT0 */ 340 MX53_PAD_SD1_DATA0__ESDHC1_DAT0 0x1d5
329 1000 0x1d5 /* MX53_PAD_SD1_DATA1__ESDHC1_DAT1 */ 341 MX53_PAD_SD1_DATA1__ESDHC1_DAT1 0x1d5
330 1010 0x1d5 /* MX53_PAD_SD1_DATA2__ESDHC1_DAT2 */ 342 MX53_PAD_SD1_DATA2__ESDHC1_DAT2 0x1d5
331 1024 0x1d5 /* MX53_PAD_SD1_DATA3__ESDHC1_DAT3 */ 343 MX53_PAD_SD1_DATA3__ESDHC1_DAT3 0x1d5
332 1005 0x1d5 /* MX53_PAD_SD1_CMD__ESDHC1_CMD */ 344 MX53_PAD_SD1_CMD__ESDHC1_CMD 0x1d5
333 1018 0x1d5 /* MX53_PAD_SD1_CLK__ESDHC1_CLK */ 345 MX53_PAD_SD1_CLK__ESDHC1_CLK 0x1d5
334 >; 346 >;
335 }; 347 };
336 348
337 pinctrl_esdhc1_2: esdhc1grp-2 { 349 pinctrl_esdhc1_2: esdhc1grp-2 {
338 fsl,pins = < 350 fsl,pins = <
339 995 0x1d5 /* MX53_PAD_SD1_DATA0__ESDHC1_DAT0 */ 351 MX53_PAD_SD1_DATA0__ESDHC1_DAT0 0x1d5
340 1000 0x1d5 /* MX53_PAD_SD1_DATA1__ESDHC1_DAT1 */ 352 MX53_PAD_SD1_DATA1__ESDHC1_DAT1 0x1d5
341 1010 0x1d5 /* MX53_PAD_SD1_DATA2__ESDHC1_DAT2 */ 353 MX53_PAD_SD1_DATA2__ESDHC1_DAT2 0x1d5
342 1024 0x1d5 /* MX53_PAD_SD1_DATA3__ESDHC1_DAT3 */ 354 MX53_PAD_SD1_DATA3__ESDHC1_DAT3 0x1d5
343 941 0x1d5 /* MX53_PAD_PATA_DATA8__ESDHC1_DAT4 */ 355 MX53_PAD_PATA_DATA8__ESDHC1_DAT4 0x1d5
344 948 0x1d5 /* MX53_PAD_PATA_DATA9__ESDHC1_DAT5 */ 356 MX53_PAD_PATA_DATA9__ESDHC1_DAT5 0x1d5
345 955 0x1d5 /* MX53_PAD_PATA_DATA10__ESDHC1_DAT6 */ 357 MX53_PAD_PATA_DATA10__ESDHC1_DAT6 0x1d5
346 962 0x1d5 /* MX53_PAD_PATA_DATA11__ESDHC1_DAT7 */ 358 MX53_PAD_PATA_DATA11__ESDHC1_DAT7 0x1d5
347 1005 0x1d5 /* MX53_PAD_SD1_CMD__ESDHC1_CMD */ 359 MX53_PAD_SD1_CMD__ESDHC1_CMD 0x1d5
348 1018 0x1d5 /* MX53_PAD_SD1_CLK__ESDHC1_CLK */ 360 MX53_PAD_SD1_CLK__ESDHC1_CLK 0x1d5
349 >; 361 >;
350 }; 362 };
351 }; 363 };
@@ -353,12 +365,12 @@
353 esdhc2 { 365 esdhc2 {
354 pinctrl_esdhc2_1: esdhc2grp-1 { 366 pinctrl_esdhc2_1: esdhc2grp-1 {
355 fsl,pins = < 367 fsl,pins = <
356 1038 0x1d5 /* MX53_PAD_SD2_CMD__ESDHC2_CMD */ 368 MX53_PAD_SD2_CMD__ESDHC2_CMD 0x1d5
357 1032 0x1d5 /* MX53_PAD_SD2_CLK__ESDHC2_CLK */ 369 MX53_PAD_SD2_CLK__ESDHC2_CLK 0x1d5
358 1062 0x1d5 /* MX53_PAD_SD2_DATA0__ESDHC2_DAT0 */ 370 MX53_PAD_SD2_DATA0__ESDHC2_DAT0 0x1d5
359 1056 0x1d5 /* MX53_PAD_SD2_DATA1__ESDHC2_DAT1 */ 371 MX53_PAD_SD2_DATA1__ESDHC2_DAT1 0x1d5
360 1050 0x1d5 /* MX53_PAD_SD2_DATA2__ESDHC2_DAT2 */ 372 MX53_PAD_SD2_DATA2__ESDHC2_DAT2 0x1d5
361 1044 0x1d5 /* MX53_PAD_SD2_DATA3__ESDHC2_DAT3 */ 373 MX53_PAD_SD2_DATA3__ESDHC2_DAT3 0x1d5
362 >; 374 >;
363 }; 375 };
364 }; 376 };
@@ -366,16 +378,16 @@
366 esdhc3 { 378 esdhc3 {
367 pinctrl_esdhc3_1: esdhc3grp-1 { 379 pinctrl_esdhc3_1: esdhc3grp-1 {
368 fsl,pins = < 380 fsl,pins = <
369 943 0x1d5 /* MX53_PAD_PATA_DATA8__ESDHC3_DAT0 */ 381 MX53_PAD_PATA_DATA8__ESDHC3_DAT0 0x1d5
370 950 0x1d5 /* MX53_PAD_PATA_DATA9__ESDHC3_DAT1 */ 382 MX53_PAD_PATA_DATA9__ESDHC3_DAT1 0x1d5
371 957 0x1d5 /* MX53_PAD_PATA_DATA10__ESDHC3_DAT2 */ 383 MX53_PAD_PATA_DATA10__ESDHC3_DAT2 0x1d5
372 964 0x1d5 /* MX53_PAD_PATA_DATA11__ESDHC3_DAT3 */ 384 MX53_PAD_PATA_DATA11__ESDHC3_DAT3 0x1d5
373 893 0x1d5 /* MX53_PAD_PATA_DATA0__ESDHC3_DAT4 */ 385 MX53_PAD_PATA_DATA0__ESDHC3_DAT4 0x1d5
374 900 0x1d5 /* MX53_PAD_PATA_DATA1__ESDHC3_DAT5 */ 386 MX53_PAD_PATA_DATA1__ESDHC3_DAT5 0x1d5
375 906 0x1d5 /* MX53_PAD_PATA_DATA2__ESDHC3_DAT6 */ 387 MX53_PAD_PATA_DATA2__ESDHC3_DAT6 0x1d5
376 912 0x1d5 /* MX53_PAD_PATA_DATA3__ESDHC3_DAT7 */ 388 MX53_PAD_PATA_DATA3__ESDHC3_DAT7 0x1d5
377 857 0x1d5 /* MX53_PAD_PATA_RESET_B__ESDHC3_CMD */ 389 MX53_PAD_PATA_RESET_B__ESDHC3_CMD 0x1d5
378 863 0x1d5 /* MX53_PAD_PATA_IORDY__ESDHC3_CLK */ 390 MX53_PAD_PATA_IORDY__ESDHC3_CLK 0x1d5
379 >; 391 >;
380 }; 392 };
381 }; 393 };
@@ -383,15 +395,15 @@
383 can1 { 395 can1 {
384 pinctrl_can1_1: can1grp-1 { 396 pinctrl_can1_1: can1grp-1 {
385 fsl,pins = < 397 fsl,pins = <
386 847 0x80000000 /* MX53_PAD_PATA_INTRQ__CAN1_TXCAN */ 398 MX53_PAD_PATA_INTRQ__CAN1_TXCAN 0x80000000
387 853 0x80000000 /* MX53_PAD_PATA_DIOR__CAN1_RXCAN */ 399 MX53_PAD_PATA_DIOR__CAN1_RXCAN 0x80000000
388 >; 400 >;
389 }; 401 };
390 402
391 pinctrl_can1_2: can1grp-2 { 403 pinctrl_can1_2: can1grp-2 {
392 fsl,pins = < 404 fsl,pins = <
393 37 0x80000000 /* MX53_PAD_KEY_COL2__CAN1_TXCAN */ 405 MX53_PAD_KEY_COL2__CAN1_TXCAN 0x80000000
394 44 0x80000000 /* MX53_PAD_KEY_ROW2__CAN1_RXCAN */ 406 MX53_PAD_KEY_ROW2__CAN1_RXCAN 0x80000000
395 >; 407 >;
396 }; 408 };
397 }; 409 };
@@ -399,8 +411,8 @@
399 can2 { 411 can2 {
400 pinctrl_can2_1: can2grp-1 { 412 pinctrl_can2_1: can2grp-1 {
401 fsl,pins = < 413 fsl,pins = <
402 67 0x80000000 /* MX53_PAD_KEY_COL4__CAN2_TXCAN */ 414 MX53_PAD_KEY_COL4__CAN2_TXCAN 0x80000000
403 74 0x80000000 /* MX53_PAD_KEY_ROW4__CAN2_RXCAN */ 415 MX53_PAD_KEY_ROW4__CAN2_RXCAN 0x80000000
404 >; 416 >;
405 }; 417 };
406 }; 418 };
@@ -408,8 +420,8 @@
408 i2c1 { 420 i2c1 {
409 pinctrl_i2c1_1: i2c1grp-1 { 421 pinctrl_i2c1_1: i2c1grp-1 {
410 fsl,pins = < 422 fsl,pins = <
411 333 0xc0000000 /* MX53_PAD_CSI0_DAT8__I2C1_SDA */ 423 MX53_PAD_CSI0_DAT8__I2C1_SDA 0xc0000000
412 341 0xc0000000 /* MX53_PAD_CSI0_DAT9__I2C1_SCL */ 424 MX53_PAD_CSI0_DAT9__I2C1_SCL 0xc0000000
413 >; 425 >;
414 }; 426 };
415 }; 427 };
@@ -417,8 +429,8 @@
417 i2c2 { 429 i2c2 {
418 pinctrl_i2c2_1: i2c2grp-1 { 430 pinctrl_i2c2_1: i2c2grp-1 {
419 fsl,pins = < 431 fsl,pins = <
420 61 0xc0000000 /* MX53_PAD_KEY_ROW3__I2C2_SDA */ 432 MX53_PAD_KEY_ROW3__I2C2_SDA 0xc0000000
421 53 0xc0000000 /* MX53_PAD_KEY_COL3__I2C2_SCL */ 433 MX53_PAD_KEY_COL3__I2C2_SCL 0xc0000000
422 >; 434 >;
423 }; 435 };
424 }; 436 };
@@ -426,8 +438,8 @@
426 i2c3 { 438 i2c3 {
427 pinctrl_i2c3_1: i2c3grp-1 { 439 pinctrl_i2c3_1: i2c3grp-1 {
428 fsl,pins = < 440 fsl,pins = <
429 1102 0xc0000000 /* MX53_PAD_GPIO_6__I2C3_SDA */ 441 MX53_PAD_GPIO_6__I2C3_SDA 0xc0000000
430 1130 0xc0000000 /* MX53_PAD_GPIO_5__I2C3_SCL */ 442 MX53_PAD_GPIO_5__I2C3_SCL 0xc0000000
431 >; 443 >;
432 }; 444 };
433 }; 445 };
@@ -435,7 +447,7 @@
435 owire { 447 owire {
436 pinctrl_owire_1: owiregrp-1 { 448 pinctrl_owire_1: owiregrp-1 {
437 fsl,pins = < 449 fsl,pins = <
438 1166 0x80000000 /* MX53_PAD_GPIO_18__OWIRE_LINE */ 450 MX53_PAD_GPIO_18__OWIRE_LINE 0x80000000
439 >; 451 >;
440 }; 452 };
441 }; 453 };
@@ -443,15 +455,15 @@
443 uart1 { 455 uart1 {
444 pinctrl_uart1_1: uart1grp-1 { 456 pinctrl_uart1_1: uart1grp-1 {
445 fsl,pins = < 457 fsl,pins = <
446 346 0x1c5 /* MX53_PAD_CSI0_DAT10__UART1_TXD_MUX */ 458 MX53_PAD_CSI0_DAT10__UART1_TXD_MUX 0x1c5
447 354 0x1c5 /* MX53_PAD_CSI0_DAT11__UART1_RXD_MUX */ 459 MX53_PAD_CSI0_DAT11__UART1_RXD_MUX 0x1c5
448 >; 460 >;
449 }; 461 };
450 462
451 pinctrl_uart1_2: uart1grp-2 { 463 pinctrl_uart1_2: uart1grp-2 {
452 fsl,pins = < 464 fsl,pins = <
453 828 0x1c5 /* MX53_PAD_PATA_DIOW__UART1_TXD_MUX */ 465 MX53_PAD_PATA_DIOW__UART1_TXD_MUX 0x1c5
454 832 0x1c5 /* MX53_PAD_PATA_DMACK__UART1_RXD_MUX */ 466 MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x1c5
455 >; 467 >;
456 }; 468 };
457 }; 469 };
@@ -459,8 +471,8 @@
459 uart2 { 471 uart2 {
460 pinctrl_uart2_1: uart2grp-1 { 472 pinctrl_uart2_1: uart2grp-1 {
461 fsl,pins = < 473 fsl,pins = <
462 841 0x1c5 /* MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX */ 474 MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX 0x1c5
463 836 0x1c5 /* MX53_PAD_PATA_DMARQ__UART2_TXD_MUX */ 475 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1c5
464 >; 476 >;
465 }; 477 };
466 }; 478 };
@@ -468,17 +480,17 @@
468 uart3 { 480 uart3 {
469 pinctrl_uart3_1: uart3grp-1 { 481 pinctrl_uart3_1: uart3grp-1 {
470 fsl,pins = < 482 fsl,pins = <
471 884 0x1c5 /* MX53_PAD_PATA_CS_0__UART3_TXD_MUX */ 483 MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1c5
472 888 0x1c5 /* MX53_PAD_PATA_CS_1__UART3_RXD_MUX */ 484 MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1c5
473 875 0x1c5 /* MX53_PAD_PATA_DA_1__UART3_CTS */ 485 MX53_PAD_PATA_DA_1__UART3_CTS 0x1c5
474 880 0x1c5 /* MX53_PAD_PATA_DA_2__UART3_RTS */ 486 MX53_PAD_PATA_DA_2__UART3_RTS 0x1c5
475 >; 487 >;
476 }; 488 };
477 489
478 pinctrl_uart3_2: uart3grp-2 { 490 pinctrl_uart3_2: uart3grp-2 {
479 fsl,pins = < 491 fsl,pins = <
480 884 0x1c5 /* MX53_PAD_PATA_CS_0__UART3_TXD_MUX */ 492 MX53_PAD_PATA_CS_0__UART3_TXD_MUX 0x1c5
481 888 0x1c5 /* MX53_PAD_PATA_CS_1__UART3_RXD_MUX */ 493 MX53_PAD_PATA_CS_1__UART3_RXD_MUX 0x1c5
482 >; 494 >;
483 }; 495 };
484 496
@@ -487,8 +499,8 @@
487 uart4 { 499 uart4 {
488 pinctrl_uart4_1: uart4grp-1 { 500 pinctrl_uart4_1: uart4grp-1 {
489 fsl,pins = < 501 fsl,pins = <
490 11 0x1c5 /* MX53_PAD_KEY_COL0__UART4_TXD_MUX */ 502 MX53_PAD_KEY_COL0__UART4_TXD_MUX 0x1c5
491 18 0x1c5 /* MX53_PAD_KEY_ROW0__UART4_RXD_MUX */ 503 MX53_PAD_KEY_ROW0__UART4_RXD_MUX 0x1c5
492 >; 504 >;
493 }; 505 };
494 }; 506 };
@@ -496,14 +508,46 @@
496 uart5 { 508 uart5 {
497 pinctrl_uart5_1: uart5grp-1 { 509 pinctrl_uart5_1: uart5grp-1 {
498 fsl,pins = < 510 fsl,pins = <
499 24 0x1c5 /* MX53_PAD_KEY_COL1__UART5_TXD_MUX */ 511 MX53_PAD_KEY_COL1__UART5_TXD_MUX 0x1c5
500 31 0x1c5 /* MX53_PAD_KEY_ROW1__UART5_RXD_MUX */ 512 MX53_PAD_KEY_ROW1__UART5_RXD_MUX 0x1c5
501 >; 513 >;
502 }; 514 };
503 }; 515 };
504 516
505 }; 517 };
506 518
519 gpr: iomuxc-gpr@53fa8000 {
520 compatible = "fsl,imx53-iomuxc-gpr", "syscon";
521 reg = <0x53fa8000 0xc>;
522 };
523
524 ldb: ldb@53fa8008 {
525 #address-cells = <1>;
526 #size-cells = <0>;
527 compatible = "fsl,imx53-ldb";
528 reg = <0x53fa8008 0x4>;
529 gpr = <&gpr>;
530 clocks = <&clks 122>, <&clks 120>,
531 <&clks 115>, <&clks 116>,
532 <&clks 123>, <&clks 85>;
533 clock-names = "di0_pll", "di1_pll",
534 "di0_sel", "di1_sel",
535 "di0", "di1";
536 status = "disabled";
537
538 lvds-channel@0 {
539 reg = <0>;
540 crtcs = <&ipu 0>;
541 status = "disabled";
542 };
543
544 lvds-channel@1 {
545 reg = <1>;
546 crtcs = <&ipu 1>;
547 status = "disabled";
548 };
549 };
550
507 pwm1: pwm@53fb4000 { 551 pwm1: pwm@53fb4000 {
508 #pwm-cells = <2>; 552 #pwm-cells = <2>;
509 compatible = "fsl,imx53-pwm", "fsl,imx27-pwm"; 553 compatible = "fsl,imx53-pwm", "fsl,imx27-pwm";
@@ -558,6 +602,12 @@
558 status = "disabled"; 602 status = "disabled";
559 }; 603 };
560 604
605 src: src@53fd0000 {
606 compatible = "fsl,imx53-src", "fsl,imx51-src";
607 reg = <0x53fd0000 0x4000>;
608 #reset-cells = <1>;
609 };
610
561 clks: ccm@53fd4000{ 611 clks: ccm@53fd4000{
562 compatible = "fsl,imx53-ccm"; 612 compatible = "fsl,imx53-ccm";
563 reg = <0x53fd4000 0x4000>; 613 reg = <0x53fd4000 0x4000>;
diff --git a/arch/arm/boot/dts/imx6dl-pinfunc.h b/arch/arm/boot/dts/imx6dl-pinfunc.h
new file mode 100644
index 000000000000..9aab950ec269
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-pinfunc.h
@@ -0,0 +1,1085 @@
1/*
2 * Copyright 2013 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
10#ifndef __DTS_IMX6DL_PINFUNC_H
11#define __DTS_IMX6DL_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX6DL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10 0x04c 0x360 0x000 0x0 0x0
18#define MX6DL_PAD_CSI0_DAT10__AUD3_RXC 0x04c 0x360 0x000 0x1 0x0
19#define MX6DL_PAD_CSI0_DAT10__ECSPI2_MISO 0x04c 0x360 0x7f8 0x2 0x0
20#define MX6DL_PAD_CSI0_DAT10__UART1_TX_DATA 0x04c 0x360 0x000 0x3 0x0
21#define MX6DL_PAD_CSI0_DAT10__UART1_RX_DATA 0x04c 0x360 0x8fc 0x3 0x0
22#define MX6DL_PAD_CSI0_DAT10__GPIO5_IO28 0x04c 0x360 0x000 0x5 0x0
23#define MX6DL_PAD_CSI0_DAT10__ARM_TRACE07 0x04c 0x360 0x000 0x7 0x0
24#define MX6DL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11 0x050 0x364 0x000 0x0 0x0
25#define MX6DL_PAD_CSI0_DAT11__AUD3_RXFS 0x050 0x364 0x000 0x1 0x0
26#define MX6DL_PAD_CSI0_DAT11__ECSPI2_SS0 0x050 0x364 0x800 0x2 0x0
27#define MX6DL_PAD_CSI0_DAT11__UART1_RX_DATA 0x050 0x364 0x8fc 0x3 0x1
28#define MX6DL_PAD_CSI0_DAT11__UART1_TX_DATA 0x050 0x364 0x000 0x3 0x0
29#define MX6DL_PAD_CSI0_DAT11__GPIO5_IO29 0x050 0x364 0x000 0x5 0x0
30#define MX6DL_PAD_CSI0_DAT11__ARM_TRACE08 0x050 0x364 0x000 0x7 0x0
31#define MX6DL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x054 0x368 0x000 0x0 0x0
32#define MX6DL_PAD_CSI0_DAT12__EIM_DATA08 0x054 0x368 0x000 0x1 0x0
33#define MX6DL_PAD_CSI0_DAT12__UART4_TX_DATA 0x054 0x368 0x000 0x3 0x0
34#define MX6DL_PAD_CSI0_DAT12__UART4_RX_DATA 0x054 0x368 0x914 0x3 0x0
35#define MX6DL_PAD_CSI0_DAT12__GPIO5_IO30 0x054 0x368 0x000 0x5 0x0
36#define MX6DL_PAD_CSI0_DAT12__ARM_TRACE09 0x054 0x368 0x000 0x7 0x0
37#define MX6DL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x058 0x36c 0x000 0x0 0x0
38#define MX6DL_PAD_CSI0_DAT13__EIM_DATA09 0x058 0x36c 0x000 0x1 0x0
39#define MX6DL_PAD_CSI0_DAT13__UART4_RX_DATA 0x058 0x36c 0x914 0x3 0x1
40#define MX6DL_PAD_CSI0_DAT13__UART4_TX_DATA 0x058 0x36c 0x000 0x3 0x0
41#define MX6DL_PAD_CSI0_DAT13__GPIO5_IO31 0x058 0x36c 0x000 0x5 0x0
42#define MX6DL_PAD_CSI0_DAT13__ARM_TRACE10 0x058 0x36c 0x000 0x7 0x0
43#define MX6DL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x05c 0x370 0x000 0x0 0x0
44#define MX6DL_PAD_CSI0_DAT14__EIM_DATA10 0x05c 0x370 0x000 0x1 0x0
45#define MX6DL_PAD_CSI0_DAT14__UART5_TX_DATA 0x05c 0x370 0x000 0x3 0x0
46#define MX6DL_PAD_CSI0_DAT14__UART5_RX_DATA 0x05c 0x370 0x91c 0x3 0x0
47#define MX6DL_PAD_CSI0_DAT14__GPIO6_IO00 0x05c 0x370 0x000 0x5 0x0
48#define MX6DL_PAD_CSI0_DAT14__ARM_TRACE11 0x05c 0x370 0x000 0x7 0x0
49#define MX6DL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x060 0x374 0x000 0x0 0x0
50#define MX6DL_PAD_CSI0_DAT15__EIM_DATA11 0x060 0x374 0x000 0x1 0x0
51#define MX6DL_PAD_CSI0_DAT15__UART5_RX_DATA 0x060 0x374 0x91c 0x3 0x1
52#define MX6DL_PAD_CSI0_DAT15__UART5_TX_DATA 0x060 0x374 0x000 0x3 0x0
53#define MX6DL_PAD_CSI0_DAT15__GPIO6_IO01 0x060 0x374 0x000 0x5 0x0
54#define MX6DL_PAD_CSI0_DAT15__ARM_TRACE12 0x060 0x374 0x000 0x7 0x0
55#define MX6DL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x064 0x378 0x000 0x0 0x0
56#define MX6DL_PAD_CSI0_DAT16__EIM_DATA12 0x064 0x378 0x000 0x1 0x0
57#define MX6DL_PAD_CSI0_DAT16__UART4_RTS_B 0x064 0x378 0x910 0x3 0x0
58#define MX6DL_PAD_CSI0_DAT16__UART4_CTS_B 0x064 0x378 0x000 0x3 0x0
59#define MX6DL_PAD_CSI0_DAT16__GPIO6_IO02 0x064 0x378 0x000 0x5 0x0
60#define MX6DL_PAD_CSI0_DAT16__ARM_TRACE13 0x064 0x378 0x000 0x7 0x0
61#define MX6DL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x068 0x37c 0x000 0x0 0x0
62#define MX6DL_PAD_CSI0_DAT17__EIM_DATA13 0x068 0x37c 0x000 0x1 0x0
63#define MX6DL_PAD_CSI0_DAT17__UART4_CTS_B 0x068 0x37c 0x000 0x3 0x0
64#define MX6DL_PAD_CSI0_DAT17__UART4_RTS_B 0x068 0x37c 0x910 0x3 0x1
65#define MX6DL_PAD_CSI0_DAT17__GPIO6_IO03 0x068 0x37c 0x000 0x5 0x0
66#define MX6DL_PAD_CSI0_DAT17__ARM_TRACE14 0x068 0x37c 0x000 0x7 0x0
67#define MX6DL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x06c 0x380 0x000 0x0 0x0
68#define MX6DL_PAD_CSI0_DAT18__EIM_DATA14 0x06c 0x380 0x000 0x1 0x0
69#define MX6DL_PAD_CSI0_DAT18__UART5_RTS_B 0x06c 0x380 0x918 0x3 0x0
70#define MX6DL_PAD_CSI0_DAT18__UART5_CTS_B 0x06c 0x380 0x000 0x3 0x0
71#define MX6DL_PAD_CSI0_DAT18__GPIO6_IO04 0x06c 0x380 0x000 0x5 0x0
72#define MX6DL_PAD_CSI0_DAT18__ARM_TRACE15 0x06c 0x380 0x000 0x7 0x0
73#define MX6DL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x070 0x384 0x000 0x0 0x0
74#define MX6DL_PAD_CSI0_DAT19__EIM_DATA15 0x070 0x384 0x000 0x1 0x0
75#define MX6DL_PAD_CSI0_DAT19__UART5_CTS_B 0x070 0x384 0x000 0x3 0x0
76#define MX6DL_PAD_CSI0_DAT19__UART5_RTS_B 0x070 0x384 0x918 0x3 0x1
77#define MX6DL_PAD_CSI0_DAT19__GPIO6_IO05 0x070 0x384 0x000 0x5 0x0
78#define MX6DL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x074 0x388 0x000 0x0 0x0
79#define MX6DL_PAD_CSI0_DAT4__EIM_DATA02 0x074 0x388 0x000 0x1 0x0
80#define MX6DL_PAD_CSI0_DAT4__ECSPI1_SCLK 0x074 0x388 0x7d8 0x2 0x0
81#define MX6DL_PAD_CSI0_DAT4__KEY_COL5 0x074 0x388 0x8c0 0x3 0x0
82#define MX6DL_PAD_CSI0_DAT4__AUD3_TXC 0x074 0x388 0x000 0x4 0x0
83#define MX6DL_PAD_CSI0_DAT4__GPIO5_IO22 0x074 0x388 0x000 0x5 0x0
84#define MX6DL_PAD_CSI0_DAT4__ARM_TRACE01 0x074 0x388 0x000 0x7 0x0
85#define MX6DL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x078 0x38c 0x000 0x0 0x0
86#define MX6DL_PAD_CSI0_DAT5__EIM_DATA03 0x078 0x38c 0x000 0x1 0x0
87#define MX6DL_PAD_CSI0_DAT5__ECSPI1_MOSI 0x078 0x38c 0x7e0 0x2 0x0
88#define MX6DL_PAD_CSI0_DAT5__KEY_ROW5 0x078 0x38c 0x8cc 0x3 0x0
89#define MX6DL_PAD_CSI0_DAT5__AUD3_TXD 0x078 0x38c 0x000 0x4 0x0
90#define MX6DL_PAD_CSI0_DAT5__GPIO5_IO23 0x078 0x38c 0x000 0x5 0x0
91#define MX6DL_PAD_CSI0_DAT5__ARM_TRACE02 0x078 0x38c 0x000 0x7 0x0
92#define MX6DL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x07c 0x390 0x000 0x0 0x0
93#define MX6DL_PAD_CSI0_DAT6__EIM_DATA04 0x07c 0x390 0x000 0x1 0x0
94#define MX6DL_PAD_CSI0_DAT6__ECSPI1_MISO 0x07c 0x390 0x7dc 0x2 0x0
95#define MX6DL_PAD_CSI0_DAT6__KEY_COL6 0x07c 0x390 0x8c4 0x3 0x0
96#define MX6DL_PAD_CSI0_DAT6__AUD3_TXFS 0x07c 0x390 0x000 0x4 0x0
97#define MX6DL_PAD_CSI0_DAT6__GPIO5_IO24 0x07c 0x390 0x000 0x5 0x0
98#define MX6DL_PAD_CSI0_DAT6__ARM_TRACE03 0x07c 0x390 0x000 0x7 0x0
99#define MX6DL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x080 0x394 0x000 0x0 0x0
100#define MX6DL_PAD_CSI0_DAT7__EIM_DATA05 0x080 0x394 0x000 0x1 0x0
101#define MX6DL_PAD_CSI0_DAT7__ECSPI1_SS0 0x080 0x394 0x7e4 0x2 0x0
102#define MX6DL_PAD_CSI0_DAT7__KEY_ROW6 0x080 0x394 0x8d0 0x3 0x0
103#define MX6DL_PAD_CSI0_DAT7__AUD3_RXD 0x080 0x394 0x000 0x4 0x0
104#define MX6DL_PAD_CSI0_DAT7__GPIO5_IO25 0x080 0x394 0x000 0x5 0x0
105#define MX6DL_PAD_CSI0_DAT7__ARM_TRACE04 0x080 0x394 0x000 0x7 0x0
106#define MX6DL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08 0x084 0x398 0x000 0x0 0x0
107#define MX6DL_PAD_CSI0_DAT8__EIM_DATA06 0x084 0x398 0x000 0x1 0x0
108#define MX6DL_PAD_CSI0_DAT8__ECSPI2_SCLK 0x084 0x398 0x7f4 0x2 0x0
109#define MX6DL_PAD_CSI0_DAT8__KEY_COL7 0x084 0x398 0x8c8 0x3 0x0
110#define MX6DL_PAD_CSI0_DAT8__I2C1_SDA 0x084 0x398 0x86c 0x4 0x0
111#define MX6DL_PAD_CSI0_DAT8__GPIO5_IO26 0x084 0x398 0x000 0x5 0x0
112#define MX6DL_PAD_CSI0_DAT8__ARM_TRACE05 0x084 0x398 0x000 0x7 0x0
113#define MX6DL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09 0x088 0x39c 0x000 0x0 0x0
114#define MX6DL_PAD_CSI0_DAT9__EIM_DATA07 0x088 0x39c 0x000 0x1 0x0
115#define MX6DL_PAD_CSI0_DAT9__ECSPI2_MOSI 0x088 0x39c 0x7fc 0x2 0x0
116#define MX6DL_PAD_CSI0_DAT9__KEY_ROW7 0x088 0x39c 0x8d4 0x3 0x0
117#define MX6DL_PAD_CSI0_DAT9__I2C1_SCL 0x088 0x39c 0x868 0x4 0x0
118#define MX6DL_PAD_CSI0_DAT9__GPIO5_IO27 0x088 0x39c 0x000 0x5 0x0
119#define MX6DL_PAD_CSI0_DAT9__ARM_TRACE06 0x088 0x39c 0x000 0x7 0x0
120#define MX6DL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x08c 0x3a0 0x000 0x0 0x0
121#define MX6DL_PAD_CSI0_DATA_EN__EIM_DATA00 0x08c 0x3a0 0x000 0x1 0x0
122#define MX6DL_PAD_CSI0_DATA_EN__GPIO5_IO20 0x08c 0x3a0 0x000 0x5 0x0
123#define MX6DL_PAD_CSI0_DATA_EN__ARM_TRACE_CLK 0x08c 0x3a0 0x000 0x7 0x0
124#define MX6DL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x090 0x3a4 0x000 0x0 0x0
125#define MX6DL_PAD_CSI0_MCLK__CCM_CLKO1 0x090 0x3a4 0x000 0x3 0x0
126#define MX6DL_PAD_CSI0_MCLK__GPIO5_IO19 0x090 0x3a4 0x000 0x5 0x0
127#define MX6DL_PAD_CSI0_MCLK__ARM_TRACE_CTL 0x090 0x3a4 0x000 0x7 0x0
128#define MX6DL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x094 0x3a8 0x000 0x0 0x0
129#define MX6DL_PAD_CSI0_PIXCLK__GPIO5_IO18 0x094 0x3a8 0x000 0x5 0x0
130#define MX6DL_PAD_CSI0_PIXCLK__ARM_EVENTO 0x094 0x3a8 0x000 0x7 0x0
131#define MX6DL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x098 0x3ac 0x000 0x0 0x0
132#define MX6DL_PAD_CSI0_VSYNC__EIM_DATA01 0x098 0x3ac 0x000 0x1 0x0
133#define MX6DL_PAD_CSI0_VSYNC__GPIO5_IO21 0x098 0x3ac 0x000 0x5 0x0
134#define MX6DL_PAD_CSI0_VSYNC__ARM_TRACE00 0x098 0x3ac 0x000 0x7 0x0
135#define MX6DL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x09c 0x3b0 0x000 0x0 0x0
136#define MX6DL_PAD_DI0_DISP_CLK__LCD_CLK 0x09c 0x3b0 0x000 0x1 0x0
137#define MX6DL_PAD_DI0_DISP_CLK__GPIO4_IO16 0x09c 0x3b0 0x000 0x5 0x0
138#define MX6DL_PAD_DI0_DISP_CLK__LCD_WR_RWN 0x09c 0x3b0 0x000 0x8 0x0
139#define MX6DL_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x0a0 0x3b4 0x000 0x0 0x0
140#define MX6DL_PAD_DI0_PIN15__LCD_ENABLE 0x0a0 0x3b4 0x000 0x1 0x0
141#define MX6DL_PAD_DI0_PIN15__AUD6_TXC 0x0a0 0x3b4 0x000 0x2 0x0
142#define MX6DL_PAD_DI0_PIN15__GPIO4_IO17 0x0a0 0x3b4 0x000 0x5 0x0
143#define MX6DL_PAD_DI0_PIN15__LCD_RD_E 0x0a0 0x3b4 0x000 0x8 0x0
144#define MX6DL_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x0a4 0x3b8 0x000 0x0 0x0
145#define MX6DL_PAD_DI0_PIN2__LCD_HSYNC 0x0a4 0x3b8 0x8d8 0x1 0x0
146#define MX6DL_PAD_DI0_PIN2__AUD6_TXD 0x0a4 0x3b8 0x000 0x2 0x0
147#define MX6DL_PAD_DI0_PIN2__GPIO4_IO18 0x0a4 0x3b8 0x000 0x5 0x0
148#define MX6DL_PAD_DI0_PIN2__LCD_RS 0x0a4 0x3b8 0x000 0x8 0x0
149#define MX6DL_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x0a8 0x3bc 0x000 0x0 0x0
150#define MX6DL_PAD_DI0_PIN3__LCD_VSYNC 0x0a8 0x3bc 0x000 0x1 0x0
151#define MX6DL_PAD_DI0_PIN3__AUD6_TXFS 0x0a8 0x3bc 0x000 0x2 0x0
152#define MX6DL_PAD_DI0_PIN3__GPIO4_IO19 0x0a8 0x3bc 0x000 0x5 0x0
153#define MX6DL_PAD_DI0_PIN3__LCD_CS 0x0a8 0x3bc 0x000 0x8 0x0
154#define MX6DL_PAD_DI0_PIN4__IPU1_DI0_PIN04 0x0ac 0x3c0 0x000 0x0 0x0
155#define MX6DL_PAD_DI0_PIN4__LCD_BUSY 0x0ac 0x3c0 0x8d8 0x1 0x1
156#define MX6DL_PAD_DI0_PIN4__AUD6_RXD 0x0ac 0x3c0 0x000 0x2 0x0
157#define MX6DL_PAD_DI0_PIN4__SD1_WP 0x0ac 0x3c0 0x92c 0x3 0x0
158#define MX6DL_PAD_DI0_PIN4__GPIO4_IO20 0x0ac 0x3c0 0x000 0x5 0x0
159#define MX6DL_PAD_DI0_PIN4__LCD_RESET 0x0ac 0x3c0 0x000 0x8 0x0
160#define MX6DL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00 0x0b0 0x3c4 0x000 0x0 0x0
161#define MX6DL_PAD_DISP0_DAT0__LCD_DATA00 0x0b0 0x3c4 0x000 0x1 0x0
162#define MX6DL_PAD_DISP0_DAT0__ECSPI3_SCLK 0x0b0 0x3c4 0x000 0x2 0x0
163#define MX6DL_PAD_DISP0_DAT0__GPIO4_IO21 0x0b0 0x3c4 0x000 0x5 0x0
164#define MX6DL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x0b4 0x3c8 0x000 0x0 0x0
165#define MX6DL_PAD_DISP0_DAT1__LCD_DATA01 0x0b4 0x3c8 0x000 0x1 0x0
166#define MX6DL_PAD_DISP0_DAT1__ECSPI3_MOSI 0x0b4 0x3c8 0x000 0x2 0x0
167#define MX6DL_PAD_DISP0_DAT1__GPIO4_IO22 0x0b4 0x3c8 0x000 0x5 0x0
168#define MX6DL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x0b8 0x3cc 0x000 0x0 0x0
169#define MX6DL_PAD_DISP0_DAT10__LCD_DATA10 0x0b8 0x3cc 0x000 0x1 0x0
170#define MX6DL_PAD_DISP0_DAT10__GPIO4_IO31 0x0b8 0x3cc 0x000 0x5 0x0
171#define MX6DL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x0bc 0x3d0 0x000 0x0 0x0
172#define MX6DL_PAD_DISP0_DAT11__LCD_DATA11 0x0bc 0x3d0 0x000 0x1 0x0
173#define MX6DL_PAD_DISP0_DAT11__GPIO5_IO05 0x0bc 0x3d0 0x000 0x5 0x0
174#define MX6DL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x0c0 0x3d4 0x000 0x0 0x0
175#define MX6DL_PAD_DISP0_DAT12__LCD_DATA12 0x0c0 0x3d4 0x000 0x1 0x0
176#define MX6DL_PAD_DISP0_DAT12__GPIO5_IO06 0x0c0 0x3d4 0x000 0x5 0x0
177#define MX6DL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x0c4 0x3d8 0x000 0x0 0x0
178#define MX6DL_PAD_DISP0_DAT13__LCD_DATA13 0x0c4 0x3d8 0x000 0x1 0x0
179#define MX6DL_PAD_DISP0_DAT13__AUD5_RXFS 0x0c4 0x3d8 0x7bc 0x3 0x0
180#define MX6DL_PAD_DISP0_DAT13__GPIO5_IO07 0x0c4 0x3d8 0x000 0x5 0x0
181#define MX6DL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x0c8 0x3dc 0x000 0x0 0x0
182#define MX6DL_PAD_DISP0_DAT14__LCD_DATA14 0x0c8 0x3dc 0x000 0x1 0x0
183#define MX6DL_PAD_DISP0_DAT14__AUD5_RXC 0x0c8 0x3dc 0x7b8 0x3 0x0
184#define MX6DL_PAD_DISP0_DAT14__GPIO5_IO08 0x0c8 0x3dc 0x000 0x5 0x0
185#define MX6DL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x0cc 0x3e0 0x000 0x0 0x0
186#define MX6DL_PAD_DISP0_DAT15__LCD_DATA15 0x0cc 0x3e0 0x000 0x1 0x0
187#define MX6DL_PAD_DISP0_DAT15__ECSPI1_SS1 0x0cc 0x3e0 0x7e8 0x2 0x0
188#define MX6DL_PAD_DISP0_DAT15__ECSPI2_SS1 0x0cc 0x3e0 0x804 0x3 0x0
189#define MX6DL_PAD_DISP0_DAT15__GPIO5_IO09 0x0cc 0x3e0 0x000 0x5 0x0
190#define MX6DL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x0d0 0x3e4 0x000 0x0 0x0
191#define MX6DL_PAD_DISP0_DAT16__LCD_DATA16 0x0d0 0x3e4 0x000 0x1 0x0
192#define MX6DL_PAD_DISP0_DAT16__ECSPI2_MOSI 0x0d0 0x3e4 0x7fc 0x2 0x1
193#define MX6DL_PAD_DISP0_DAT16__AUD5_TXC 0x0d0 0x3e4 0x7c0 0x3 0x0
194#define MX6DL_PAD_DISP0_DAT16__SDMA_EXT_EVENT0 0x0d0 0x3e4 0x8e8 0x4 0x0
195#define MX6DL_PAD_DISP0_DAT16__GPIO5_IO10 0x0d0 0x3e4 0x000 0x5 0x0
196#define MX6DL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x0d4 0x3e8 0x000 0x0 0x0
197#define MX6DL_PAD_DISP0_DAT17__LCD_DATA17 0x0d4 0x3e8 0x000 0x1 0x0
198#define MX6DL_PAD_DISP0_DAT17__ECSPI2_MISO 0x0d4 0x3e8 0x7f8 0x2 0x1
199#define MX6DL_PAD_DISP0_DAT17__AUD5_TXD 0x0d4 0x3e8 0x7b4 0x3 0x0
200#define MX6DL_PAD_DISP0_DAT17__SDMA_EXT_EVENT1 0x0d4 0x3e8 0x8ec 0x4 0x0
201#define MX6DL_PAD_DISP0_DAT17__GPIO5_IO11 0x0d4 0x3e8 0x000 0x5 0x0
202#define MX6DL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x0d8 0x3ec 0x000 0x0 0x0
203#define MX6DL_PAD_DISP0_DAT18__LCD_DATA18 0x0d8 0x3ec 0x000 0x1 0x0
204#define MX6DL_PAD_DISP0_DAT18__ECSPI2_SS0 0x0d8 0x3ec 0x800 0x2 0x1
205#define MX6DL_PAD_DISP0_DAT18__AUD5_TXFS 0x0d8 0x3ec 0x7c4 0x3 0x0
206#define MX6DL_PAD_DISP0_DAT18__AUD4_RXFS 0x0d8 0x3ec 0x7a4 0x4 0x0
207#define MX6DL_PAD_DISP0_DAT18__GPIO5_IO12 0x0d8 0x3ec 0x000 0x5 0x0
208#define MX6DL_PAD_DISP0_DAT18__EIM_CS2_B 0x0d8 0x3ec 0x000 0x7 0x0
209#define MX6DL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x0dc 0x3f0 0x000 0x0 0x0
210#define MX6DL_PAD_DISP0_DAT19__LCD_DATA19 0x0dc 0x3f0 0x000 0x1 0x0
211#define MX6DL_PAD_DISP0_DAT19__ECSPI2_SCLK 0x0dc 0x3f0 0x7f4 0x2 0x1
212#define MX6DL_PAD_DISP0_DAT19__AUD5_RXD 0x0dc 0x3f0 0x7b0 0x3 0x0
213#define MX6DL_PAD_DISP0_DAT19__AUD4_RXC 0x0dc 0x3f0 0x7a0 0x4 0x0
214#define MX6DL_PAD_DISP0_DAT19__GPIO5_IO13 0x0dc 0x3f0 0x000 0x5 0x0
215#define MX6DL_PAD_DISP0_DAT19__EIM_CS3_B 0x0dc 0x3f0 0x000 0x7 0x0
216#define MX6DL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x0e0 0x3f4 0x000 0x0 0x0
217#define MX6DL_PAD_DISP0_DAT2__LCD_DATA02 0x0e0 0x3f4 0x000 0x1 0x0
218#define MX6DL_PAD_DISP0_DAT2__ECSPI3_MISO 0x0e0 0x3f4 0x000 0x2 0x0
219#define MX6DL_PAD_DISP0_DAT2__GPIO4_IO23 0x0e0 0x3f4 0x000 0x5 0x0
220#define MX6DL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x0e4 0x3f8 0x000 0x0 0x0
221#define MX6DL_PAD_DISP0_DAT20__LCD_DATA20 0x0e4 0x3f8 0x000 0x1 0x0
222#define MX6DL_PAD_DISP0_DAT20__ECSPI1_SCLK 0x0e4 0x3f8 0x7d8 0x2 0x1
223#define MX6DL_PAD_DISP0_DAT20__AUD4_TXC 0x0e4 0x3f8 0x7a8 0x3 0x0
224#define MX6DL_PAD_DISP0_DAT20__GPIO5_IO14 0x0e4 0x3f8 0x000 0x5 0x0
225#define MX6DL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x0e8 0x3fc 0x000 0x0 0x0
226#define MX6DL_PAD_DISP0_DAT21__LCD_DATA21 0x0e8 0x3fc 0x000 0x1 0x0
227#define MX6DL_PAD_DISP0_DAT21__ECSPI1_MOSI 0x0e8 0x3fc 0x7e0 0x2 0x1
228#define MX6DL_PAD_DISP0_DAT21__AUD4_TXD 0x0e8 0x3fc 0x79c 0x3 0x0
229#define MX6DL_PAD_DISP0_DAT21__GPIO5_IO15 0x0e8 0x3fc 0x000 0x5 0x0
230#define MX6DL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x0ec 0x400 0x000 0x0 0x0
231#define MX6DL_PAD_DISP0_DAT22__LCD_DATA22 0x0ec 0x400 0x000 0x1 0x0
232#define MX6DL_PAD_DISP0_DAT22__ECSPI1_MISO 0x0ec 0x400 0x7dc 0x2 0x1
233#define MX6DL_PAD_DISP0_DAT22__AUD4_TXFS 0x0ec 0x400 0x7ac 0x3 0x0
234#define MX6DL_PAD_DISP0_DAT22__GPIO5_IO16 0x0ec 0x400 0x000 0x5 0x0
235#define MX6DL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x0f0 0x404 0x000 0x0 0x0
236#define MX6DL_PAD_DISP0_DAT23__LCD_DATA23 0x0f0 0x404 0x000 0x1 0x0
237#define MX6DL_PAD_DISP0_DAT23__ECSPI1_SS0 0x0f0 0x404 0x7e4 0x2 0x1
238#define MX6DL_PAD_DISP0_DAT23__AUD4_RXD 0x0f0 0x404 0x798 0x3 0x0
239#define MX6DL_PAD_DISP0_DAT23__GPIO5_IO17 0x0f0 0x404 0x000 0x5 0x0
240#define MX6DL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x0f4 0x408 0x000 0x0 0x0
241#define MX6DL_PAD_DISP0_DAT3__LCD_DATA03 0x0f4 0x408 0x000 0x1 0x0
242#define MX6DL_PAD_DISP0_DAT3__ECSPI3_SS0 0x0f4 0x408 0x000 0x2 0x0
243#define MX6DL_PAD_DISP0_DAT3__GPIO4_IO24 0x0f4 0x408 0x000 0x5 0x0
244#define MX6DL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x0f8 0x40c 0x000 0x0 0x0
245#define MX6DL_PAD_DISP0_DAT4__LCD_DATA04 0x0f8 0x40c 0x000 0x1 0x0
246#define MX6DL_PAD_DISP0_DAT4__ECSPI3_SS1 0x0f8 0x40c 0x000 0x2 0x0
247#define MX6DL_PAD_DISP0_DAT4__GPIO4_IO25 0x0f8 0x40c 0x000 0x5 0x0
248#define MX6DL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x0fc 0x410 0x000 0x0 0x0
249#define MX6DL_PAD_DISP0_DAT5__LCD_DATA05 0x0fc 0x410 0x000 0x1 0x0
250#define MX6DL_PAD_DISP0_DAT5__ECSPI3_SS2 0x0fc 0x410 0x000 0x2 0x0
251#define MX6DL_PAD_DISP0_DAT5__AUD6_RXFS 0x0fc 0x410 0x000 0x3 0x0
252#define MX6DL_PAD_DISP0_DAT5__GPIO4_IO26 0x0fc 0x410 0x000 0x5 0x0
253#define MX6DL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x100 0x414 0x000 0x0 0x0
254#define MX6DL_PAD_DISP0_DAT6__LCD_DATA06 0x100 0x414 0x000 0x1 0x0
255#define MX6DL_PAD_DISP0_DAT6__ECSPI3_SS3 0x100 0x414 0x000 0x2 0x0
256#define MX6DL_PAD_DISP0_DAT6__AUD6_RXC 0x100 0x414 0x000 0x3 0x0
257#define MX6DL_PAD_DISP0_DAT6__GPIO4_IO27 0x100 0x414 0x000 0x5 0x0
258#define MX6DL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x104 0x418 0x000 0x0 0x0
259#define MX6DL_PAD_DISP0_DAT7__LCD_DATA07 0x104 0x418 0x000 0x1 0x0
260#define MX6DL_PAD_DISP0_DAT7__ECSPI3_RDY 0x104 0x418 0x000 0x2 0x0
261#define MX6DL_PAD_DISP0_DAT7__GPIO4_IO28 0x104 0x418 0x000 0x5 0x0
262#define MX6DL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x108 0x41c 0x000 0x0 0x0
263#define MX6DL_PAD_DISP0_DAT8__LCD_DATA08 0x108 0x41c 0x000 0x1 0x0
264#define MX6DL_PAD_DISP0_DAT8__PWM1_OUT 0x108 0x41c 0x000 0x2 0x0
265#define MX6DL_PAD_DISP0_DAT8__WDOG1_B 0x108 0x41c 0x000 0x3 0x0
266#define MX6DL_PAD_DISP0_DAT8__GPIO4_IO29 0x108 0x41c 0x000 0x5 0x0
267#define MX6DL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x10c 0x420 0x000 0x0 0x0
268#define MX6DL_PAD_DISP0_DAT9__LCD_DATA09 0x10c 0x420 0x000 0x1 0x0
269#define MX6DL_PAD_DISP0_DAT9__PWM2_OUT 0x10c 0x420 0x000 0x2 0x0
270#define MX6DL_PAD_DISP0_DAT9__WDOG2_B 0x10c 0x420 0x000 0x3 0x0
271#define MX6DL_PAD_DISP0_DAT9__GPIO4_IO30 0x10c 0x420 0x000 0x5 0x0
272#define MX6DL_PAD_EIM_A16__EIM_ADDR16 0x110 0x4e0 0x000 0x0 0x0
273#define MX6DL_PAD_EIM_A16__IPU1_DI1_DISP_CLK 0x110 0x4e0 0x000 0x1 0x0
274#define MX6DL_PAD_EIM_A16__IPU1_CSI1_PIXCLK 0x110 0x4e0 0x8b8 0x2 0x0
275#define MX6DL_PAD_EIM_A16__GPIO2_IO22 0x110 0x4e0 0x000 0x5 0x0
276#define MX6DL_PAD_EIM_A16__SRC_BOOT_CFG16 0x110 0x4e0 0x000 0x7 0x0
277#define MX6DL_PAD_EIM_A16__EPDC_DATA00 0x110 0x4e0 0x000 0x8 0x0
278#define MX6DL_PAD_EIM_A17__EIM_ADDR17 0x114 0x4e4 0x000 0x0 0x0
279#define MX6DL_PAD_EIM_A17__IPU1_DISP1_DATA12 0x114 0x4e4 0x000 0x1 0x0
280#define MX6DL_PAD_EIM_A17__IPU1_CSI1_DATA12 0x114 0x4e4 0x890 0x2 0x0
281#define MX6DL_PAD_EIM_A17__GPIO2_IO21 0x114 0x4e4 0x000 0x5 0x0
282#define MX6DL_PAD_EIM_A17__SRC_BOOT_CFG17 0x114 0x4e4 0x000 0x7 0x0
283#define MX6DL_PAD_EIM_A17__EPDC_PWR_STAT 0x114 0x4e4 0x000 0x8 0x0
284#define MX6DL_PAD_EIM_A18__EIM_ADDR18 0x118 0x4e8 0x000 0x0 0x0
285#define MX6DL_PAD_EIM_A18__IPU1_DISP1_DATA13 0x118 0x4e8 0x000 0x1 0x0
286#define MX6DL_PAD_EIM_A18__IPU1_CSI1_DATA13 0x118 0x4e8 0x894 0x2 0x0
287#define MX6DL_PAD_EIM_A18__GPIO2_IO20 0x118 0x4e8 0x000 0x5 0x0
288#define MX6DL_PAD_EIM_A18__SRC_BOOT_CFG18 0x118 0x4e8 0x000 0x7 0x0
289#define MX6DL_PAD_EIM_A18__EPDC_PWR_CTRL0 0x118 0x4e8 0x000 0x8 0x0
290#define MX6DL_PAD_EIM_A19__EIM_ADDR19 0x11c 0x4ec 0x000 0x0 0x0
291#define MX6DL_PAD_EIM_A19__IPU1_DISP1_DATA14 0x11c 0x4ec 0x000 0x1 0x0
292#define MX6DL_PAD_EIM_A19__IPU1_CSI1_DATA14 0x11c 0x4ec 0x898 0x2 0x0
293#define MX6DL_PAD_EIM_A19__GPIO2_IO19 0x11c 0x4ec 0x000 0x5 0x0
294#define MX6DL_PAD_EIM_A19__SRC_BOOT_CFG19 0x11c 0x4ec 0x000 0x7 0x0
295#define MX6DL_PAD_EIM_A19__EPDC_PWR_CTRL1 0x11c 0x4ec 0x000 0x8 0x0
296#define MX6DL_PAD_EIM_A20__EIM_ADDR20 0x120 0x4f0 0x000 0x0 0x0
297#define MX6DL_PAD_EIM_A20__IPU1_DISP1_DATA15 0x120 0x4f0 0x000 0x1 0x0
298#define MX6DL_PAD_EIM_A20__IPU1_CSI1_DATA15 0x120 0x4f0 0x89c 0x2 0x0
299#define MX6DL_PAD_EIM_A20__GPIO2_IO18 0x120 0x4f0 0x000 0x5 0x0
300#define MX6DL_PAD_EIM_A20__SRC_BOOT_CFG20 0x120 0x4f0 0x000 0x7 0x0
301#define MX6DL_PAD_EIM_A20__EPDC_PWR_CTRL2 0x120 0x4f0 0x000 0x8 0x0
302#define MX6DL_PAD_EIM_A21__EIM_ADDR21 0x124 0x4f4 0x000 0x0 0x0
303#define MX6DL_PAD_EIM_A21__IPU1_DISP1_DATA16 0x124 0x4f4 0x000 0x1 0x0
304#define MX6DL_PAD_EIM_A21__IPU1_CSI1_DATA16 0x124 0x4f4 0x8a0 0x2 0x0
305#define MX6DL_PAD_EIM_A21__GPIO2_IO17 0x124 0x4f4 0x000 0x5 0x0
306#define MX6DL_PAD_EIM_A21__SRC_BOOT_CFG21 0x124 0x4f4 0x000 0x7 0x0
307#define MX6DL_PAD_EIM_A21__EPDC_GDCLK 0x124 0x4f4 0x000 0x8 0x0
308#define MX6DL_PAD_EIM_A22__EIM_ADDR22 0x128 0x4f8 0x000 0x0 0x0
309#define MX6DL_PAD_EIM_A22__IPU1_DISP1_DATA17 0x128 0x4f8 0x000 0x1 0x0
310#define MX6DL_PAD_EIM_A22__IPU1_CSI1_DATA17 0x128 0x4f8 0x8a4 0x2 0x0
311#define MX6DL_PAD_EIM_A22__GPIO2_IO16 0x128 0x4f8 0x000 0x5 0x0
312#define MX6DL_PAD_EIM_A22__SRC_BOOT_CFG22 0x128 0x4f8 0x000 0x7 0x0
313#define MX6DL_PAD_EIM_A22__EPDC_GDSP 0x128 0x4f8 0x000 0x8 0x0
314#define MX6DL_PAD_EIM_A23__EIM_ADDR23 0x12c 0x4fc 0x000 0x0 0x0
315#define MX6DL_PAD_EIM_A23__IPU1_DISP1_DATA18 0x12c 0x4fc 0x000 0x1 0x0
316#define MX6DL_PAD_EIM_A23__IPU1_CSI1_DATA18 0x12c 0x4fc 0x8a8 0x2 0x0
317#define MX6DL_PAD_EIM_A23__IPU1_SISG3 0x12c 0x4fc 0x000 0x4 0x0
318#define MX6DL_PAD_EIM_A23__GPIO6_IO06 0x12c 0x4fc 0x000 0x5 0x0
319#define MX6DL_PAD_EIM_A23__SRC_BOOT_CFG23 0x12c 0x4fc 0x000 0x7 0x0
320#define MX6DL_PAD_EIM_A23__EPDC_GDOE 0x12c 0x4fc 0x000 0x8 0x0
321#define MX6DL_PAD_EIM_A24__EIM_ADDR24 0x130 0x500 0x000 0x0 0x0
322#define MX6DL_PAD_EIM_A24__IPU1_DISP1_DATA19 0x130 0x500 0x000 0x1 0x0
323#define MX6DL_PAD_EIM_A24__IPU1_CSI1_DATA19 0x130 0x500 0x8ac 0x2 0x0
324#define MX6DL_PAD_EIM_A24__IPU1_SISG2 0x130 0x500 0x000 0x4 0x0
325#define MX6DL_PAD_EIM_A24__GPIO5_IO04 0x130 0x500 0x000 0x5 0x0
326#define MX6DL_PAD_EIM_A24__SRC_BOOT_CFG24 0x130 0x500 0x000 0x7 0x0
327#define MX6DL_PAD_EIM_A24__EPDC_GDRL 0x130 0x500 0x000 0x8 0x0
328#define MX6DL_PAD_EIM_A25__EIM_ADDR25 0x134 0x504 0x000 0x0 0x0
329#define MX6DL_PAD_EIM_A25__ECSPI4_SS1 0x134 0x504 0x000 0x1 0x0
330#define MX6DL_PAD_EIM_A25__ECSPI2_RDY 0x134 0x504 0x000 0x2 0x0
331#define MX6DL_PAD_EIM_A25__IPU1_DI1_PIN12 0x134 0x504 0x000 0x3 0x0
332#define MX6DL_PAD_EIM_A25__IPU1_DI0_D1_CS 0x134 0x504 0x000 0x4 0x0
333#define MX6DL_PAD_EIM_A25__GPIO5_IO02 0x134 0x504 0x000 0x5 0x0
334#define MX6DL_PAD_EIM_A25__HDMI_TX_CEC_LINE 0x134 0x504 0x85c 0x6 0x0
335#define MX6DL_PAD_EIM_A25__EPDC_DATA15 0x134 0x504 0x000 0x8 0x0
336#define MX6DL_PAD_EIM_A25__EIM_ACLK_FREERUN 0x134 0x504 0x000 0x9 0x0
337#define MX6DL_PAD_EIM_BCLK__EIM_BCLK 0x138 0x508 0x000 0x0 0x0
338#define MX6DL_PAD_EIM_BCLK__IPU1_DI1_PIN16 0x138 0x508 0x000 0x1 0x0
339#define MX6DL_PAD_EIM_BCLK__GPIO6_IO31 0x138 0x508 0x000 0x5 0x0
340#define MX6DL_PAD_EIM_BCLK__EPDC_SDCE9 0x138 0x508 0x000 0x8 0x0
341#define MX6DL_PAD_EIM_CS0__EIM_CS0_B 0x13c 0x50c 0x000 0x0 0x0
342#define MX6DL_PAD_EIM_CS0__IPU1_DI1_PIN05 0x13c 0x50c 0x000 0x1 0x0
343#define MX6DL_PAD_EIM_CS0__ECSPI2_SCLK 0x13c 0x50c 0x7f4 0x2 0x2
344#define MX6DL_PAD_EIM_CS0__GPIO2_IO23 0x13c 0x50c 0x000 0x5 0x0
345#define MX6DL_PAD_EIM_CS0__EPDC_DATA06 0x13c 0x50c 0x000 0x8 0x0
346#define MX6DL_PAD_EIM_CS1__EIM_CS1_B 0x140 0x510 0x000 0x0 0x0
347#define MX6DL_PAD_EIM_CS1__IPU1_DI1_PIN06 0x140 0x510 0x000 0x1 0x0
348#define MX6DL_PAD_EIM_CS1__ECSPI2_MOSI 0x140 0x510 0x7fc 0x2 0x2
349#define MX6DL_PAD_EIM_CS1__GPIO2_IO24 0x140 0x510 0x000 0x5 0x0
350#define MX6DL_PAD_EIM_CS1__EPDC_DATA08 0x140 0x510 0x000 0x8 0x0
351#define MX6DL_PAD_EIM_D16__EIM_DATA16 0x144 0x514 0x000 0x0 0x0
352#define MX6DL_PAD_EIM_D16__ECSPI1_SCLK 0x144 0x514 0x7d8 0x1 0x2
353#define MX6DL_PAD_EIM_D16__IPU1_DI0_PIN05 0x144 0x514 0x000 0x2 0x0
354#define MX6DL_PAD_EIM_D16__IPU1_CSI1_DATA18 0x144 0x514 0x8a8 0x3 0x1
355#define MX6DL_PAD_EIM_D16__HDMI_TX_DDC_SDA 0x144 0x514 0x864 0x4 0x0
356#define MX6DL_PAD_EIM_D16__GPIO3_IO16 0x144 0x514 0x000 0x5 0x0
357#define MX6DL_PAD_EIM_D16__I2C2_SDA 0x144 0x514 0x874 0x6 0x0
358#define MX6DL_PAD_EIM_D16__EPDC_DATA10 0x144 0x514 0x000 0x8 0x0
359#define MX6DL_PAD_EIM_D17__EIM_DATA17 0x148 0x518 0x000 0x0 0x0
360#define MX6DL_PAD_EIM_D17__ECSPI1_MISO 0x148 0x518 0x7dc 0x1 0x2
361#define MX6DL_PAD_EIM_D17__IPU1_DI0_PIN06 0x148 0x518 0x000 0x2 0x0
362#define MX6DL_PAD_EIM_D17__IPU1_CSI1_PIXCLK 0x148 0x518 0x8b8 0x3 0x1
363#define MX6DL_PAD_EIM_D17__DCIC1_OUT 0x148 0x518 0x000 0x4 0x0
364#define MX6DL_PAD_EIM_D17__GPIO3_IO17 0x148 0x518 0x000 0x5 0x0
365#define MX6DL_PAD_EIM_D17__I2C3_SCL 0x148 0x518 0x878 0x6 0x0
366#define MX6DL_PAD_EIM_D17__EPDC_VCOM0 0x148 0x518 0x000 0x8 0x0
367#define MX6DL_PAD_EIM_D18__EIM_DATA18 0x14c 0x51c 0x000 0x0 0x0
368#define MX6DL_PAD_EIM_D18__ECSPI1_MOSI 0x14c 0x51c 0x7e0 0x1 0x2
369#define MX6DL_PAD_EIM_D18__IPU1_DI0_PIN07 0x14c 0x51c 0x000 0x2 0x0
370#define MX6DL_PAD_EIM_D18__IPU1_CSI1_DATA17 0x14c 0x51c 0x8a4 0x3 0x1
371#define MX6DL_PAD_EIM_D18__IPU1_DI1_D0_CS 0x14c 0x51c 0x000 0x4 0x0
372#define MX6DL_PAD_EIM_D18__GPIO3_IO18 0x14c 0x51c 0x000 0x5 0x0
373#define MX6DL_PAD_EIM_D18__I2C3_SDA 0x14c 0x51c 0x87c 0x6 0x0
374#define MX6DL_PAD_EIM_D18__EPDC_VCOM1 0x14c 0x51c 0x000 0x8 0x0
375#define MX6DL_PAD_EIM_D19__EIM_DATA19 0x150 0x520 0x000 0x0 0x0
376#define MX6DL_PAD_EIM_D19__ECSPI1_SS1 0x150 0x520 0x7e8 0x1 0x1
377#define MX6DL_PAD_EIM_D19__IPU1_DI0_PIN08 0x150 0x520 0x000 0x2 0x0
378#define MX6DL_PAD_EIM_D19__IPU1_CSI1_DATA16 0x150 0x520 0x8a0 0x3 0x1
379#define MX6DL_PAD_EIM_D19__UART1_CTS_B 0x150 0x520 0x000 0x4 0x0
380#define MX6DL_PAD_EIM_D19__UART1_RTS_B 0x150 0x520 0x8f8 0x4 0x0
381#define MX6DL_PAD_EIM_D19__GPIO3_IO19 0x150 0x520 0x000 0x5 0x0
382#define MX6DL_PAD_EIM_D19__EPIT1_OUT 0x150 0x520 0x000 0x6 0x0
383#define MX6DL_PAD_EIM_D19__EPDC_DATA12 0x150 0x520 0x000 0x8 0x0
384#define MX6DL_PAD_EIM_D20__EIM_DATA20 0x154 0x524 0x000 0x0 0x0
385#define MX6DL_PAD_EIM_D20__ECSPI4_SS0 0x154 0x524 0x808 0x1 0x0
386#define MX6DL_PAD_EIM_D20__IPU1_DI0_PIN16 0x154 0x524 0x000 0x2 0x0
387#define MX6DL_PAD_EIM_D20__IPU1_CSI1_DATA15 0x154 0x524 0x89c 0x3 0x1
388#define MX6DL_PAD_EIM_D20__UART1_RTS_B 0x154 0x524 0x8f8 0x4 0x1
389#define MX6DL_PAD_EIM_D20__UART1_CTS_B 0x154 0x524 0x000 0x4 0x0
390#define MX6DL_PAD_EIM_D20__GPIO3_IO20 0x154 0x524 0x000 0x5 0x0
391#define MX6DL_PAD_EIM_D20__EPIT2_OUT 0x154 0x524 0x000 0x6 0x0
392#define MX6DL_PAD_EIM_D21__EIM_DATA21 0x158 0x528 0x000 0x0 0x0
393#define MX6DL_PAD_EIM_D21__ECSPI4_SCLK 0x158 0x528 0x000 0x1 0x0
394#define MX6DL_PAD_EIM_D21__IPU1_DI0_PIN17 0x158 0x528 0x000 0x2 0x0
395#define MX6DL_PAD_EIM_D21__IPU1_CSI1_DATA11 0x158 0x528 0x88c 0x3 0x0
396#define MX6DL_PAD_EIM_D21__USB_OTG_OC 0x158 0x528 0x920 0x4 0x0
397#define MX6DL_PAD_EIM_D21__GPIO3_IO21 0x158 0x528 0x000 0x5 0x0
398#define MX6DL_PAD_EIM_D21__I2C1_SCL 0x158 0x528 0x868 0x6 0x1
399#define MX6DL_PAD_EIM_D21__SPDIF_IN 0x158 0x528 0x8f0 0x7 0x0
400#define MX6DL_PAD_EIM_D22__EIM_DATA22 0x15c 0x52c 0x000 0x0 0x0
401#define MX6DL_PAD_EIM_D22__ECSPI4_MISO 0x15c 0x52c 0x000 0x1 0x0
402#define MX6DL_PAD_EIM_D22__IPU1_DI0_PIN01 0x15c 0x52c 0x000 0x2 0x0
403#define MX6DL_PAD_EIM_D22__IPU1_CSI1_DATA10 0x15c 0x52c 0x888 0x3 0x0
404#define MX6DL_PAD_EIM_D22__USB_OTG_PWR 0x15c 0x52c 0x000 0x4 0x0
405#define MX6DL_PAD_EIM_D22__GPIO3_IO22 0x15c 0x52c 0x000 0x5 0x0
406#define MX6DL_PAD_EIM_D22__SPDIF_OUT 0x15c 0x52c 0x000 0x6 0x0
407#define MX6DL_PAD_EIM_D22__EPDC_SDCE6 0x15c 0x52c 0x000 0x8 0x0
408#define MX6DL_PAD_EIM_D23__EIM_DATA23 0x160 0x530 0x000 0x0 0x0
409#define MX6DL_PAD_EIM_D23__IPU1_DI0_D0_CS 0x160 0x530 0x000 0x1 0x0
410#define MX6DL_PAD_EIM_D23__UART3_CTS_B 0x160 0x530 0x000 0x2 0x0
411#define MX6DL_PAD_EIM_D23__UART3_RTS_B 0x160 0x530 0x908 0x2 0x0
412#define MX6DL_PAD_EIM_D23__UART1_DCD_B 0x160 0x530 0x000 0x3 0x0
413#define MX6DL_PAD_EIM_D23__IPU1_CSI1_DATA_EN 0x160 0x530 0x8b0 0x4 0x0
414#define MX6DL_PAD_EIM_D23__GPIO3_IO23 0x160 0x530 0x000 0x5 0x0
415#define MX6DL_PAD_EIM_D23__IPU1_DI1_PIN02 0x160 0x530 0x000 0x6 0x0
416#define MX6DL_PAD_EIM_D23__IPU1_DI1_PIN14 0x160 0x530 0x000 0x7 0x0
417#define MX6DL_PAD_EIM_D23__EPDC_DATA11 0x160 0x530 0x000 0x8 0x0
418#define MX6DL_PAD_EIM_D24__EIM_DATA24 0x164 0x534 0x000 0x0 0x0
419#define MX6DL_PAD_EIM_D24__ECSPI4_SS2 0x164 0x534 0x000 0x1 0x0
420#define MX6DL_PAD_EIM_D24__UART3_TX_DATA 0x164 0x534 0x000 0x2 0x0
421#define MX6DL_PAD_EIM_D24__UART3_RX_DATA 0x164 0x534 0x90c 0x2 0x0
422#define MX6DL_PAD_EIM_D24__ECSPI1_SS2 0x164 0x534 0x7ec 0x3 0x0
423#define MX6DL_PAD_EIM_D24__ECSPI2_SS2 0x164 0x534 0x000 0x4 0x0
424#define MX6DL_PAD_EIM_D24__GPIO3_IO24 0x164 0x534 0x000 0x5 0x0
425#define MX6DL_PAD_EIM_D24__AUD5_RXFS 0x164 0x534 0x7bc 0x6 0x1
426#define MX6DL_PAD_EIM_D24__UART1_DTR_B 0x164 0x534 0x000 0x7 0x0
427#define MX6DL_PAD_EIM_D24__EPDC_SDCE7 0x164 0x534 0x000 0x8 0x0
428#define MX6DL_PAD_EIM_D25__EIM_DATA25 0x168 0x538 0x000 0x0 0x0
429#define MX6DL_PAD_EIM_D25__ECSPI4_SS3 0x168 0x538 0x000 0x1 0x0
430#define MX6DL_PAD_EIM_D25__UART3_RX_DATA 0x168 0x538 0x90c 0x2 0x1
431#define MX6DL_PAD_EIM_D25__UART3_TX_DATA 0x168 0x538 0x000 0x2 0x0
432#define MX6DL_PAD_EIM_D25__ECSPI1_SS3 0x168 0x538 0x7f0 0x3 0x0
433#define MX6DL_PAD_EIM_D25__ECSPI2_SS3 0x168 0x538 0x000 0x4 0x0
434#define MX6DL_PAD_EIM_D25__GPIO3_IO25 0x168 0x538 0x000 0x5 0x0
435#define MX6DL_PAD_EIM_D25__AUD5_RXC 0x168 0x538 0x7b8 0x6 0x1
436#define MX6DL_PAD_EIM_D25__UART1_DSR_B 0x168 0x538 0x000 0x7 0x0
437#define MX6DL_PAD_EIM_D25__EPDC_SDCE8 0x168 0x538 0x000 0x8 0x0
438#define MX6DL_PAD_EIM_D26__EIM_DATA26 0x16c 0x53c 0x000 0x0 0x0
439#define MX6DL_PAD_EIM_D26__IPU1_DI1_PIN11 0x16c 0x53c 0x000 0x1 0x0
440#define MX6DL_PAD_EIM_D26__IPU1_CSI0_DATA01 0x16c 0x53c 0x000 0x2 0x0
441#define MX6DL_PAD_EIM_D26__IPU1_CSI1_DATA14 0x16c 0x53c 0x898 0x3 0x1
442#define MX6DL_PAD_EIM_D26__UART2_TX_DATA 0x16c 0x53c 0x000 0x4 0x0
443#define MX6DL_PAD_EIM_D26__UART2_RX_DATA 0x16c 0x53c 0x904 0x4 0x0
444#define MX6DL_PAD_EIM_D26__GPIO3_IO26 0x16c 0x53c 0x000 0x5 0x0
445#define MX6DL_PAD_EIM_D26__IPU1_SISG2 0x16c 0x53c 0x000 0x6 0x0
446#define MX6DL_PAD_EIM_D26__IPU1_DISP1_DATA22 0x16c 0x53c 0x000 0x7 0x0
447#define MX6DL_PAD_EIM_D26__EPDC_SDOED 0x16c 0x53c 0x000 0x8 0x0
448#define MX6DL_PAD_EIM_D27__EIM_DATA27 0x170 0x540 0x000 0x0 0x0
449#define MX6DL_PAD_EIM_D27__IPU1_DI1_PIN13 0x170 0x540 0x000 0x1 0x0
450#define MX6DL_PAD_EIM_D27__IPU1_CSI0_DATA00 0x170 0x540 0x000 0x2 0x0
451#define MX6DL_PAD_EIM_D27__IPU1_CSI1_DATA13 0x170 0x540 0x894 0x3 0x1
452#define MX6DL_PAD_EIM_D27__UART2_RX_DATA 0x170 0x540 0x904 0x4 0x1
453#define MX6DL_PAD_EIM_D27__UART2_TX_DATA 0x170 0x540 0x000 0x4 0x0
454#define MX6DL_PAD_EIM_D27__GPIO3_IO27 0x170 0x540 0x000 0x5 0x0
455#define MX6DL_PAD_EIM_D27__IPU1_SISG3 0x170 0x540 0x000 0x6 0x0
456#define MX6DL_PAD_EIM_D27__IPU1_DISP1_DATA23 0x170 0x540 0x000 0x7 0x0
457#define MX6DL_PAD_EIM_D27__EPDC_SDOE 0x170 0x540 0x000 0x8 0x0
458#define MX6DL_PAD_EIM_D28__EIM_DATA28 0x174 0x544 0x000 0x0 0x0
459#define MX6DL_PAD_EIM_D28__I2C1_SDA 0x174 0x544 0x86c 0x1 0x1
460#define MX6DL_PAD_EIM_D28__ECSPI4_MOSI 0x174 0x544 0x000 0x2 0x0
461#define MX6DL_PAD_EIM_D28__IPU1_CSI1_DATA12 0x174 0x544 0x890 0x3 0x1
462#define MX6DL_PAD_EIM_D28__UART2_CTS_B 0x174 0x544 0x000 0x4 0x0
463#define MX6DL_PAD_EIM_D28__UART2_RTS_B 0x174 0x544 0x900 0x4 0x0
464#define MX6DL_PAD_EIM_D28__GPIO3_IO28 0x174 0x544 0x000 0x5 0x0
465#define MX6DL_PAD_EIM_D28__IPU1_EXT_TRIG 0x174 0x544 0x000 0x6 0x0
466#define MX6DL_PAD_EIM_D28__IPU1_DI0_PIN13 0x174 0x544 0x000 0x7 0x0
467#define MX6DL_PAD_EIM_D28__EPDC_PWR_CTRL3 0x174 0x544 0x000 0x8 0x0
468#define MX6DL_PAD_EIM_D29__EIM_DATA29 0x178 0x548 0x000 0x0 0x0
469#define MX6DL_PAD_EIM_D29__IPU1_DI1_PIN15 0x178 0x548 0x000 0x1 0x0
470#define MX6DL_PAD_EIM_D29__ECSPI4_SS0 0x178 0x548 0x808 0x2 0x1
471#define MX6DL_PAD_EIM_D29__UART2_RTS_B 0x178 0x548 0x900 0x4 0x1
472#define MX6DL_PAD_EIM_D29__UART2_CTS_B 0x178 0x548 0x000 0x4 0x0
473#define MX6DL_PAD_EIM_D29__GPIO3_IO29 0x178 0x548 0x000 0x5 0x0
474#define MX6DL_PAD_EIM_D29__IPU1_CSI1_VSYNC 0x178 0x548 0x8bc 0x6 0x0
475#define MX6DL_PAD_EIM_D29__IPU1_DI0_PIN14 0x178 0x548 0x000 0x7 0x0
476#define MX6DL_PAD_EIM_D29__EPDC_PWR_WAKE 0x178 0x548 0x000 0x8 0x0
477#define MX6DL_PAD_EIM_D30__EIM_DATA30 0x17c 0x54c 0x000 0x0 0x0
478#define MX6DL_PAD_EIM_D30__IPU1_DISP1_DATA21 0x17c 0x54c 0x000 0x1 0x0
479#define MX6DL_PAD_EIM_D30__IPU1_DI0_PIN11 0x17c 0x54c 0x000 0x2 0x0
480#define MX6DL_PAD_EIM_D30__IPU1_CSI0_DATA03 0x17c 0x54c 0x000 0x3 0x0
481#define MX6DL_PAD_EIM_D30__UART3_CTS_B 0x17c 0x54c 0x000 0x4 0x0
482#define MX6DL_PAD_EIM_D30__UART3_RTS_B 0x17c 0x54c 0x908 0x4 0x1
483#define MX6DL_PAD_EIM_D30__GPIO3_IO30 0x17c 0x54c 0x000 0x5 0x0
484#define MX6DL_PAD_EIM_D30__USB_H1_OC 0x17c 0x54c 0x924 0x6 0x0
485#define MX6DL_PAD_EIM_D30__EPDC_SDOEZ 0x17c 0x54c 0x000 0x8 0x0
486#define MX6DL_PAD_EIM_D31__EIM_DATA31 0x180 0x550 0x000 0x0 0x0
487#define MX6DL_PAD_EIM_D31__IPU1_DISP1_DATA20 0x180 0x550 0x000 0x1 0x0
488#define MX6DL_PAD_EIM_D31__IPU1_DI0_PIN12 0x180 0x550 0x000 0x2 0x0
489#define MX6DL_PAD_EIM_D31__IPU1_CSI0_DATA02 0x180 0x550 0x000 0x3 0x0
490#define MX6DL_PAD_EIM_D31__UART3_RTS_B 0x180 0x550 0x908 0x4 0x2
491#define MX6DL_PAD_EIM_D31__UART3_CTS_B 0x180 0x550 0x000 0x4 0x0
492#define MX6DL_PAD_EIM_D31__GPIO3_IO31 0x180 0x550 0x000 0x5 0x0
493#define MX6DL_PAD_EIM_D31__USB_H1_PWR 0x180 0x550 0x000 0x6 0x0
494#define MX6DL_PAD_EIM_D31__EPDC_SDCLK_P 0x180 0x550 0x000 0x8 0x0
495#define MX6DL_PAD_EIM_D31__EIM_ACLK_FREERUN 0x180 0x550 0x000 0x9 0x0
496#define MX6DL_PAD_EIM_DA0__EIM_AD00 0x184 0x554 0x000 0x0 0x0
497#define MX6DL_PAD_EIM_DA0__IPU1_DISP1_DATA09 0x184 0x554 0x000 0x1 0x0
498#define MX6DL_PAD_EIM_DA0__IPU1_CSI1_DATA09 0x184 0x554 0x000 0x2 0x0
499#define MX6DL_PAD_EIM_DA0__GPIO3_IO00 0x184 0x554 0x000 0x5 0x0
500#define MX6DL_PAD_EIM_DA0__SRC_BOOT_CFG00 0x184 0x554 0x000 0x7 0x0
501#define MX6DL_PAD_EIM_DA0__EPDC_SDCLK_N 0x184 0x554 0x000 0x8 0x0
502#define MX6DL_PAD_EIM_DA1__EIM_AD01 0x188 0x558 0x000 0x0 0x0
503#define MX6DL_PAD_EIM_DA1__IPU1_DISP1_DATA08 0x188 0x558 0x000 0x1 0x0
504#define MX6DL_PAD_EIM_DA1__IPU1_CSI1_DATA08 0x188 0x558 0x000 0x2 0x0
505#define MX6DL_PAD_EIM_DA1__GPIO3_IO01 0x188 0x558 0x000 0x5 0x0
506#define MX6DL_PAD_EIM_DA1__SRC_BOOT_CFG01 0x188 0x558 0x000 0x7 0x0
507#define MX6DL_PAD_EIM_DA1__EPDC_SDLE 0x188 0x558 0x000 0x8 0x0
508#define MX6DL_PAD_EIM_DA10__EIM_AD10 0x18c 0x55c 0x000 0x0 0x0
509#define MX6DL_PAD_EIM_DA10__IPU1_DI1_PIN15 0x18c 0x55c 0x000 0x1 0x0
510#define MX6DL_PAD_EIM_DA10__IPU1_CSI1_DATA_EN 0x18c 0x55c 0x8b0 0x2 0x1
511#define MX6DL_PAD_EIM_DA10__GPIO3_IO10 0x18c 0x55c 0x000 0x5 0x0
512#define MX6DL_PAD_EIM_DA10__SRC_BOOT_CFG10 0x18c 0x55c 0x000 0x7 0x0
513#define MX6DL_PAD_EIM_DA10__EPDC_DATA01 0x18c 0x55c 0x000 0x8 0x0
514#define MX6DL_PAD_EIM_DA11__EIM_AD11 0x190 0x560 0x000 0x0 0x0
515#define MX6DL_PAD_EIM_DA11__IPU1_DI1_PIN02 0x190 0x560 0x000 0x1 0x0
516#define MX6DL_PAD_EIM_DA11__IPU1_CSI1_HSYNC 0x190 0x560 0x8b4 0x2 0x0
517#define MX6DL_PAD_EIM_DA11__GPIO3_IO11 0x190 0x560 0x000 0x5 0x0
518#define MX6DL_PAD_EIM_DA11__SRC_BOOT_CFG11 0x190 0x560 0x000 0x7 0x0
519#define MX6DL_PAD_EIM_DA11__EPDC_DATA03 0x190 0x560 0x000 0x8 0x0
520#define MX6DL_PAD_EIM_DA12__EIM_AD12 0x194 0x564 0x000 0x0 0x0
521#define MX6DL_PAD_EIM_DA12__IPU1_DI1_PIN03 0x194 0x564 0x000 0x1 0x0
522#define MX6DL_PAD_EIM_DA12__IPU1_CSI1_VSYNC 0x194 0x564 0x8bc 0x2 0x1
523#define MX6DL_PAD_EIM_DA12__GPIO3_IO12 0x194 0x564 0x000 0x5 0x0
524#define MX6DL_PAD_EIM_DA12__SRC_BOOT_CFG12 0x194 0x564 0x000 0x7 0x0
525#define MX6DL_PAD_EIM_DA12__EPDC_DATA02 0x194 0x564 0x000 0x8 0x0
526#define MX6DL_PAD_EIM_DA13__EIM_AD13 0x198 0x568 0x000 0x0 0x0
527#define MX6DL_PAD_EIM_DA13__IPU1_DI1_D0_CS 0x198 0x568 0x000 0x1 0x0
528#define MX6DL_PAD_EIM_DA13__GPIO3_IO13 0x198 0x568 0x000 0x5 0x0
529#define MX6DL_PAD_EIM_DA13__SRC_BOOT_CFG13 0x198 0x568 0x000 0x7 0x0
530#define MX6DL_PAD_EIM_DA13__EPDC_DATA13 0x198 0x568 0x000 0x8 0x0
531#define MX6DL_PAD_EIM_DA14__EIM_AD14 0x19c 0x56c 0x000 0x0 0x0
532#define MX6DL_PAD_EIM_DA14__IPU1_DI1_D1_CS 0x19c 0x56c 0x000 0x1 0x0
533#define MX6DL_PAD_EIM_DA14__GPIO3_IO14 0x19c 0x56c 0x000 0x5 0x0
534#define MX6DL_PAD_EIM_DA14__SRC_BOOT_CFG14 0x19c 0x56c 0x000 0x7 0x0
535#define MX6DL_PAD_EIM_DA14__EPDC_DATA14 0x19c 0x56c 0x000 0x8 0x0
536#define MX6DL_PAD_EIM_DA15__EIM_AD15 0x1a0 0x570 0x000 0x0 0x0
537#define MX6DL_PAD_EIM_DA15__IPU1_DI1_PIN01 0x1a0 0x570 0x000 0x1 0x0
538#define MX6DL_PAD_EIM_DA15__IPU1_DI1_PIN04 0x1a0 0x570 0x000 0x2 0x0
539#define MX6DL_PAD_EIM_DA15__GPIO3_IO15 0x1a0 0x570 0x000 0x5 0x0
540#define MX6DL_PAD_EIM_DA15__SRC_BOOT_CFG15 0x1a0 0x570 0x000 0x7 0x0
541#define MX6DL_PAD_EIM_DA15__EPDC_DATA09 0x1a0 0x570 0x000 0x8 0x0
542#define MX6DL_PAD_EIM_DA2__EIM_AD02 0x1a4 0x574 0x000 0x0 0x0
543#define MX6DL_PAD_EIM_DA2__IPU1_DISP1_DATA07 0x1a4 0x574 0x000 0x1 0x0
544#define MX6DL_PAD_EIM_DA2__IPU1_CSI1_DATA07 0x1a4 0x574 0x000 0x2 0x0
545#define MX6DL_PAD_EIM_DA2__GPIO3_IO02 0x1a4 0x574 0x000 0x5 0x0
546#define MX6DL_PAD_EIM_DA2__SRC_BOOT_CFG02 0x1a4 0x574 0x000 0x7 0x0
547#define MX6DL_PAD_EIM_DA2__EPDC_BDR0 0x1a4 0x574 0x000 0x8 0x0
548#define MX6DL_PAD_EIM_DA3__EIM_AD03 0x1a8 0x578 0x000 0x0 0x0
549#define MX6DL_PAD_EIM_DA3__IPU1_DISP1_DATA06 0x1a8 0x578 0x000 0x1 0x0
550#define MX6DL_PAD_EIM_DA3__IPU1_CSI1_DATA06 0x1a8 0x578 0x000 0x2 0x0
551#define MX6DL_PAD_EIM_DA3__GPIO3_IO03 0x1a8 0x578 0x000 0x5 0x0
552#define MX6DL_PAD_EIM_DA3__SRC_BOOT_CFG03 0x1a8 0x578 0x000 0x7 0x0
553#define MX6DL_PAD_EIM_DA3__EPDC_BDR1 0x1a8 0x578 0x000 0x8 0x0
554#define MX6DL_PAD_EIM_DA4__EIM_AD04 0x1ac 0x57c 0x000 0x0 0x0
555#define MX6DL_PAD_EIM_DA4__IPU1_DISP1_DATA05 0x1ac 0x57c 0x000 0x1 0x0
556#define MX6DL_PAD_EIM_DA4__IPU1_CSI1_DATA05 0x1ac 0x57c 0x000 0x2 0x0
557#define MX6DL_PAD_EIM_DA4__GPIO3_IO04 0x1ac 0x57c 0x000 0x5 0x0
558#define MX6DL_PAD_EIM_DA4__SRC_BOOT_CFG04 0x1ac 0x57c 0x000 0x7 0x0
559#define MX6DL_PAD_EIM_DA4__EPDC_SDCE0 0x1ac 0x57c 0x000 0x8 0x0
560#define MX6DL_PAD_EIM_DA5__EIM_AD05 0x1b0 0x580 0x000 0x0 0x0
561#define MX6DL_PAD_EIM_DA5__IPU1_DISP1_DATA04 0x1b0 0x580 0x000 0x1 0x0
562#define MX6DL_PAD_EIM_DA5__IPU1_CSI1_DATA04 0x1b0 0x580 0x000 0x2 0x0
563#define MX6DL_PAD_EIM_DA5__GPIO3_IO05 0x1b0 0x580 0x000 0x5 0x0
564#define MX6DL_PAD_EIM_DA5__SRC_BOOT_CFG05 0x1b0 0x580 0x000 0x7 0x0
565#define MX6DL_PAD_EIM_DA5__EPDC_SDCE1 0x1b0 0x580 0x000 0x8 0x0
566#define MX6DL_PAD_EIM_DA6__EIM_AD06 0x1b4 0x584 0x000 0x0 0x0
567#define MX6DL_PAD_EIM_DA6__IPU1_DISP1_DATA03 0x1b4 0x584 0x000 0x1 0x0
568#define MX6DL_PAD_EIM_DA6__IPU1_CSI1_DATA03 0x1b4 0x584 0x000 0x2 0x0
569#define MX6DL_PAD_EIM_DA6__GPIO3_IO06 0x1b4 0x584 0x000 0x5 0x0
570#define MX6DL_PAD_EIM_DA6__SRC_BOOT_CFG06 0x1b4 0x584 0x000 0x7 0x0
571#define MX6DL_PAD_EIM_DA6__EPDC_SDCE2 0x1b4 0x584 0x000 0x8 0x0
572#define MX6DL_PAD_EIM_DA7__EIM_AD07 0x1b8 0x588 0x000 0x0 0x0
573#define MX6DL_PAD_EIM_DA7__IPU1_DISP1_DATA02 0x1b8 0x588 0x000 0x1 0x0
574#define MX6DL_PAD_EIM_DA7__IPU1_CSI1_DATA02 0x1b8 0x588 0x000 0x2 0x0
575#define MX6DL_PAD_EIM_DA7__GPIO3_IO07 0x1b8 0x588 0x000 0x5 0x0
576#define MX6DL_PAD_EIM_DA7__SRC_BOOT_CFG07 0x1b8 0x588 0x000 0x7 0x0
577#define MX6DL_PAD_EIM_DA7__EPDC_SDCE3 0x1b8 0x588 0x000 0x8 0x0
578#define MX6DL_PAD_EIM_DA8__EIM_AD08 0x1bc 0x58c 0x000 0x0 0x0
579#define MX6DL_PAD_EIM_DA8__IPU1_DISP1_DATA01 0x1bc 0x58c 0x000 0x1 0x0
580#define MX6DL_PAD_EIM_DA8__IPU1_CSI1_DATA01 0x1bc 0x58c 0x000 0x2 0x0
581#define MX6DL_PAD_EIM_DA8__GPIO3_IO08 0x1bc 0x58c 0x000 0x5 0x0
582#define MX6DL_PAD_EIM_DA8__SRC_BOOT_CFG08 0x1bc 0x58c 0x000 0x7 0x0
583#define MX6DL_PAD_EIM_DA8__EPDC_SDCE4 0x1bc 0x58c 0x000 0x8 0x0
584#define MX6DL_PAD_EIM_DA9__EIM_AD09 0x1c0 0x590 0x000 0x0 0x0
585#define MX6DL_PAD_EIM_DA9__IPU1_DISP1_DATA00 0x1c0 0x590 0x000 0x1 0x0
586#define MX6DL_PAD_EIM_DA9__IPU1_CSI1_DATA00 0x1c0 0x590 0x000 0x2 0x0
587#define MX6DL_PAD_EIM_DA9__GPIO3_IO09 0x1c0 0x590 0x000 0x5 0x0
588#define MX6DL_PAD_EIM_DA9__SRC_BOOT_CFG09 0x1c0 0x590 0x000 0x7 0x0
589#define MX6DL_PAD_EIM_DA9__EPDC_SDCE5 0x1c0 0x590 0x000 0x8 0x0
590#define MX6DL_PAD_EIM_EB0__EIM_EB0_B 0x1c4 0x594 0x000 0x0 0x0
591#define MX6DL_PAD_EIM_EB0__IPU1_DISP1_DATA11 0x1c4 0x594 0x000 0x1 0x0
592#define MX6DL_PAD_EIM_EB0__IPU1_CSI1_DATA11 0x1c4 0x594 0x88c 0x2 0x1
593#define MX6DL_PAD_EIM_EB0__CCM_PMIC_READY 0x1c4 0x594 0x7d4 0x4 0x0
594#define MX6DL_PAD_EIM_EB0__GPIO2_IO28 0x1c4 0x594 0x000 0x5 0x0
595#define MX6DL_PAD_EIM_EB0__SRC_BOOT_CFG27 0x1c4 0x594 0x000 0x7 0x0
596#define MX6DL_PAD_EIM_EB0__EPDC_PWR_COM 0x1c4 0x594 0x000 0x8 0x0
597#define MX6DL_PAD_EIM_EB1__EIM_EB1_B 0x1c8 0x598 0x000 0x0 0x0
598#define MX6DL_PAD_EIM_EB1__IPU1_DISP1_DATA10 0x1c8 0x598 0x000 0x1 0x0
599#define MX6DL_PAD_EIM_EB1__IPU1_CSI1_DATA10 0x1c8 0x598 0x888 0x2 0x1
600#define MX6DL_PAD_EIM_EB1__GPIO2_IO29 0x1c8 0x598 0x000 0x5 0x0
601#define MX6DL_PAD_EIM_EB1__SRC_BOOT_CFG28 0x1c8 0x598 0x000 0x7 0x0
602#define MX6DL_PAD_EIM_EB1__EPDC_SDSHR 0x1c8 0x598 0x000 0x8 0x0
603#define MX6DL_PAD_EIM_EB2__EIM_EB2_B 0x1cc 0x59c 0x000 0x0 0x0
604#define MX6DL_PAD_EIM_EB2__ECSPI1_SS0 0x1cc 0x59c 0x7e4 0x1 0x2
605#define MX6DL_PAD_EIM_EB2__IPU1_CSI1_DATA19 0x1cc 0x59c 0x8ac 0x3 0x1
606#define MX6DL_PAD_EIM_EB2__HDMI_TX_DDC_SCL 0x1cc 0x59c 0x860 0x4 0x0
607#define MX6DL_PAD_EIM_EB2__GPIO2_IO30 0x1cc 0x59c 0x000 0x5 0x0
608#define MX6DL_PAD_EIM_EB2__I2C2_SCL 0x1cc 0x59c 0x870 0x6 0x0
609#define MX6DL_PAD_EIM_EB2__SRC_BOOT_CFG30 0x1cc 0x59c 0x000 0x7 0x0
610#define MX6DL_PAD_EIM_EB2__EPDC_DATA05 0x1cc 0x59c 0x000 0x8 0x0
611#define MX6DL_PAD_EIM_EB3__EIM_EB3_B 0x1d0 0x5a0 0x000 0x0 0x0
612#define MX6DL_PAD_EIM_EB3__ECSPI4_RDY 0x1d0 0x5a0 0x000 0x1 0x0
613#define MX6DL_PAD_EIM_EB3__UART3_RTS_B 0x1d0 0x5a0 0x908 0x2 0x3
614#define MX6DL_PAD_EIM_EB3__UART3_CTS_B 0x1d0 0x5a0 0x000 0x2 0x0
615#define MX6DL_PAD_EIM_EB3__UART1_RI_B 0x1d0 0x5a0 0x000 0x3 0x0
616#define MX6DL_PAD_EIM_EB3__IPU1_CSI1_HSYNC 0x1d0 0x5a0 0x8b4 0x4 0x1
617#define MX6DL_PAD_EIM_EB3__GPIO2_IO31 0x1d0 0x5a0 0x000 0x5 0x0
618#define MX6DL_PAD_EIM_EB3__IPU1_DI1_PIN03 0x1d0 0x5a0 0x000 0x6 0x0
619#define MX6DL_PAD_EIM_EB3__SRC_BOOT_CFG31 0x1d0 0x5a0 0x000 0x7 0x0
620#define MX6DL_PAD_EIM_EB3__EPDC_SDCE0 0x1d0 0x5a0 0x000 0x8 0x0
621#define MX6DL_PAD_EIM_EB3__EIM_ACLK_FREERUN 0x1d0 0x5a0 0x000 0x9 0x0
622#define MX6DL_PAD_EIM_LBA__EIM_LBA_B 0x1d4 0x5a4 0x000 0x0 0x0
623#define MX6DL_PAD_EIM_LBA__IPU1_DI1_PIN17 0x1d4 0x5a4 0x000 0x1 0x0
624#define MX6DL_PAD_EIM_LBA__ECSPI2_SS1 0x1d4 0x5a4 0x804 0x2 0x1
625#define MX6DL_PAD_EIM_LBA__GPIO2_IO27 0x1d4 0x5a4 0x000 0x5 0x0
626#define MX6DL_PAD_EIM_LBA__SRC_BOOT_CFG26 0x1d4 0x5a4 0x000 0x7 0x0
627#define MX6DL_PAD_EIM_LBA__EPDC_DATA04 0x1d4 0x5a4 0x000 0x8 0x0
628#define MX6DL_PAD_EIM_OE__EIM_OE_B 0x1d8 0x5a8 0x000 0x0 0x0
629#define MX6DL_PAD_EIM_OE__IPU1_DI1_PIN07 0x1d8 0x5a8 0x000 0x1 0x0
630#define MX6DL_PAD_EIM_OE__ECSPI2_MISO 0x1d8 0x5a8 0x7f8 0x2 0x2
631#define MX6DL_PAD_EIM_OE__GPIO2_IO25 0x1d8 0x5a8 0x000 0x5 0x0
632#define MX6DL_PAD_EIM_OE__EPDC_PWR_IRQ 0x1d8 0x5a8 0x000 0x8 0x0
633#define MX6DL_PAD_EIM_RW__EIM_RW 0x1dc 0x5ac 0x000 0x0 0x0
634#define MX6DL_PAD_EIM_RW__IPU1_DI1_PIN08 0x1dc 0x5ac 0x000 0x1 0x0
635#define MX6DL_PAD_EIM_RW__ECSPI2_SS0 0x1dc 0x5ac 0x800 0x2 0x2
636#define MX6DL_PAD_EIM_RW__GPIO2_IO26 0x1dc 0x5ac 0x000 0x5 0x0
637#define MX6DL_PAD_EIM_RW__SRC_BOOT_CFG29 0x1dc 0x5ac 0x000 0x7 0x0
638#define MX6DL_PAD_EIM_RW__EPDC_DATA07 0x1dc 0x5ac 0x000 0x8 0x0
639#define MX6DL_PAD_EIM_WAIT__EIM_WAIT_B 0x1e0 0x5b0 0x000 0x0 0x0
640#define MX6DL_PAD_EIM_WAIT__EIM_DTACK_B 0x1e0 0x5b0 0x000 0x1 0x0
641#define MX6DL_PAD_EIM_WAIT__GPIO5_IO00 0x1e0 0x5b0 0x000 0x5 0x0
642#define MX6DL_PAD_EIM_WAIT__SRC_BOOT_CFG25 0x1e0 0x5b0 0x000 0x7 0x0
643#define MX6DL_PAD_ENET_CRS_DV__ENET_RX_EN 0x1e4 0x5b4 0x828 0x1 0x0
644#define MX6DL_PAD_ENET_CRS_DV__ESAI_TX_CLK 0x1e4 0x5b4 0x840 0x2 0x0
645#define MX6DL_PAD_ENET_CRS_DV__SPDIF_EXT_CLK 0x1e4 0x5b4 0x8f4 0x3 0x0
646#define MX6DL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1e4 0x5b4 0x000 0x5 0x0
647#define MX6DL_PAD_ENET_MDC__MLB_DATA 0x1e8 0x5b8 0x8e0 0x0 0x0
648#define MX6DL_PAD_ENET_MDC__ENET_MDC 0x1e8 0x5b8 0x000 0x1 0x0
649#define MX6DL_PAD_ENET_MDC__ESAI_TX5_RX0 0x1e8 0x5b8 0x858 0x2 0x0
650#define MX6DL_PAD_ENET_MDC__ENET_1588_EVENT1_IN 0x1e8 0x5b8 0x000 0x4 0x0
651#define MX6DL_PAD_ENET_MDC__GPIO1_IO31 0x1e8 0x5b8 0x000 0x5 0x0
652#define MX6DL_PAD_ENET_MDIO__ENET_MDIO 0x1ec 0x5bc 0x810 0x1 0x0
653#define MX6DL_PAD_ENET_MDIO__ESAI_RX_CLK 0x1ec 0x5bc 0x83c 0x2 0x0
654#define MX6DL_PAD_ENET_MDIO__ENET_1588_EVENT1_OUT 0x1ec 0x5bc 0x000 0x4 0x0
655#define MX6DL_PAD_ENET_MDIO__GPIO1_IO22 0x1ec 0x5bc 0x000 0x5 0x0
656#define MX6DL_PAD_ENET_MDIO__SPDIF_LOCK 0x1ec 0x5bc 0x000 0x6 0x0
657#define MX6DL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1f0 0x5c0 0x000 0x1 0x0
658#define MX6DL_PAD_ENET_REF_CLK__ESAI_RX_FS 0x1f0 0x5c0 0x82c 0x2 0x0
659#define MX6DL_PAD_ENET_REF_CLK__GPIO1_IO23 0x1f0 0x5c0 0x000 0x5 0x0
660#define MX6DL_PAD_ENET_REF_CLK__SPDIF_SR_CLK 0x1f0 0x5c0 0x000 0x6 0x0
661#define MX6DL_PAD_ENET_RX_ER__USB_OTG_ID 0x1f4 0x5c4 0x790 0x0 0x0
662#define MX6DL_PAD_ENET_RX_ER__ENET_RX_ER 0x1f4 0x5c4 0x000 0x1 0x0
663#define MX6DL_PAD_ENET_RX_ER__ESAI_RX_HF_CLK 0x1f4 0x5c4 0x834 0x2 0x0
664#define MX6DL_PAD_ENET_RX_ER__SPDIF_IN 0x1f4 0x5c4 0x8f0 0x3 0x1
665#define MX6DL_PAD_ENET_RX_ER__ENET_1588_EVENT2_OUT 0x1f4 0x5c4 0x000 0x4 0x0
666#define MX6DL_PAD_ENET_RX_ER__GPIO1_IO24 0x1f4 0x5c4 0x000 0x5 0x0
667#define MX6DL_PAD_ENET_RXD0__ENET_RX_DATA0 0x1f8 0x5c8 0x818 0x1 0x0
668#define MX6DL_PAD_ENET_RXD0__ESAI_TX_HF_CLK 0x1f8 0x5c8 0x838 0x2 0x0
669#define MX6DL_PAD_ENET_RXD0__SPDIF_OUT 0x1f8 0x5c8 0x000 0x3 0x0
670#define MX6DL_PAD_ENET_RXD0__GPIO1_IO27 0x1f8 0x5c8 0x000 0x5 0x0
671#define MX6DL_PAD_ENET_RXD1__MLB_SIG 0x1fc 0x5cc 0x8e4 0x0 0x0
672#define MX6DL_PAD_ENET_RXD1__ENET_RX_DATA1 0x1fc 0x5cc 0x81c 0x1 0x0
673#define MX6DL_PAD_ENET_RXD1__ESAI_TX_FS 0x1fc 0x5cc 0x830 0x2 0x0
674#define MX6DL_PAD_ENET_RXD1__ENET_1588_EVENT3_OUT 0x1fc 0x5cc 0x000 0x4 0x0
675#define MX6DL_PAD_ENET_RXD1__GPIO1_IO26 0x1fc 0x5cc 0x000 0x5 0x0
676#define MX6DL_PAD_ENET_TX_EN__ENET_TX_EN 0x200 0x5d0 0x000 0x1 0x0
677#define MX6DL_PAD_ENET_TX_EN__ESAI_TX3_RX2 0x200 0x5d0 0x850 0x2 0x0
678#define MX6DL_PAD_ENET_TX_EN__GPIO1_IO28 0x200 0x5d0 0x000 0x5 0x0
679#define MX6DL_PAD_ENET_TX_EN__I2C4_SCL 0x200 0x5d0 0x880 0x9 0x0
680#define MX6DL_PAD_ENET_TXD0__ENET_TX_DATA0 0x204 0x5d4 0x000 0x1 0x0
681#define MX6DL_PAD_ENET_TXD0__ESAI_TX4_RX1 0x204 0x5d4 0x854 0x2 0x0
682#define MX6DL_PAD_ENET_TXD0__GPIO1_IO30 0x204 0x5d4 0x000 0x5 0x0
683#define MX6DL_PAD_ENET_TXD1__MLB_CLK 0x208 0x5d8 0x8dc 0x0 0x0
684#define MX6DL_PAD_ENET_TXD1__ENET_TX_DATA1 0x208 0x5d8 0x000 0x1 0x0
685#define MX6DL_PAD_ENET_TXD1__ESAI_TX2_RX3 0x208 0x5d8 0x84c 0x2 0x0
686#define MX6DL_PAD_ENET_TXD1__ENET_1588_EVENT0_IN 0x208 0x5d8 0x000 0x4 0x0
687#define MX6DL_PAD_ENET_TXD1__GPIO1_IO29 0x208 0x5d8 0x000 0x5 0x0
688#define MX6DL_PAD_ENET_TXD1__I2C4_SDA 0x208 0x5d8 0x884 0x9 0x0
689#define MX6DL_PAD_GPIO_0__CCM_CLKO1 0x20c 0x5dc 0x000 0x0 0x0
690#define MX6DL_PAD_GPIO_0__KEY_COL5 0x20c 0x5dc 0x8c0 0x2 0x1
691#define MX6DL_PAD_GPIO_0__ASRC_EXT_CLK 0x20c 0x5dc 0x794 0x3 0x0
692#define MX6DL_PAD_GPIO_0__EPIT1_OUT 0x20c 0x5dc 0x000 0x4 0x0
693#define MX6DL_PAD_GPIO_0__GPIO1_IO00 0x20c 0x5dc 0x000 0x5 0x0
694#define MX6DL_PAD_GPIO_0__USB_H1_PWR 0x20c 0x5dc 0x000 0x6 0x0
695#define MX6DL_PAD_GPIO_0__SNVS_VIO_5 0x20c 0x5dc 0x000 0x7 0x0
696#define MX6DL_PAD_GPIO_1__ESAI_RX_CLK 0x210 0x5e0 0x83c 0x0 0x1
697#define MX6DL_PAD_GPIO_1__WDOG2_B 0x210 0x5e0 0x000 0x1 0x0
698#define MX6DL_PAD_GPIO_1__KEY_ROW5 0x210 0x5e0 0x8cc 0x2 0x1
699#define MX6DL_PAD_GPIO_1__USB_OTG_ID 0x210 0x5e0 0x790 0x3 0x1
700#define MX6DL_PAD_GPIO_1__PWM2_OUT 0x210 0x5e0 0x000 0x4 0x0
701#define MX6DL_PAD_GPIO_1__GPIO1_IO01 0x210 0x5e0 0x000 0x5 0x0
702#define MX6DL_PAD_GPIO_1__SD1_CD_B 0x210 0x5e0 0x000 0x6 0x0
703#define MX6DL_PAD_GPIO_16__ESAI_TX3_RX2 0x214 0x5e4 0x850 0x0 0x1
704#define MX6DL_PAD_GPIO_16__ENET_1588_EVENT2_IN 0x214 0x5e4 0x000 0x1 0x0
705#define MX6DL_PAD_GPIO_16__ENET_REF_CLK 0x214 0x5e4 0x80c 0x2 0x0
706#define MX6DL_PAD_GPIO_16__SD1_LCTL 0x214 0x5e4 0x000 0x3 0x0
707#define MX6DL_PAD_GPIO_16__SPDIF_IN 0x214 0x5e4 0x8f0 0x4 0x2
708#define MX6DL_PAD_GPIO_16__GPIO7_IO11 0x214 0x5e4 0x000 0x5 0x0
709#define MX6DL_PAD_GPIO_16__I2C3_SDA 0x214 0x5e4 0x87c 0x6 0x1
710#define MX6DL_PAD_GPIO_16__JTAG_DE_B 0x214 0x5e4 0x000 0x7 0x0
711#define MX6DL_PAD_GPIO_17__ESAI_TX0 0x218 0x5e8 0x844 0x0 0x0
712#define MX6DL_PAD_GPIO_17__ENET_1588_EVENT3_IN 0x218 0x5e8 0x000 0x1 0x0
713#define MX6DL_PAD_GPIO_17__CCM_PMIC_READY 0x218 0x5e8 0x7d4 0x2 0x1
714#define MX6DL_PAD_GPIO_17__SDMA_EXT_EVENT0 0x218 0x5e8 0x8e8 0x3 0x1
715#define MX6DL_PAD_GPIO_17__SPDIF_OUT 0x218 0x5e8 0x000 0x4 0x0
716#define MX6DL_PAD_GPIO_17__GPIO7_IO12 0x218 0x5e8 0x000 0x5 0x0
717#define MX6DL_PAD_GPIO_18__ESAI_TX1 0x21c 0x5ec 0x848 0x0 0x0
718#define MX6DL_PAD_GPIO_18__ENET_RX_CLK 0x21c 0x5ec 0x814 0x1 0x0
719#define MX6DL_PAD_GPIO_18__SD3_VSELECT 0x21c 0x5ec 0x000 0x2 0x0
720#define MX6DL_PAD_GPIO_18__SDMA_EXT_EVENT1 0x21c 0x5ec 0x8ec 0x3 0x1
721#define MX6DL_PAD_GPIO_18__ASRC_EXT_CLK 0x21c 0x5ec 0x794 0x4 0x1
722#define MX6DL_PAD_GPIO_18__GPIO7_IO13 0x21c 0x5ec 0x000 0x5 0x0
723#define MX6DL_PAD_GPIO_18__SNVS_VIO_5_CTL 0x21c 0x5ec 0x000 0x6 0x0
724#define MX6DL_PAD_GPIO_19__KEY_COL5 0x220 0x5f0 0x8c0 0x0 0x2
725#define MX6DL_PAD_GPIO_19__ENET_1588_EVENT0_OUT 0x220 0x5f0 0x000 0x1 0x0
726#define MX6DL_PAD_GPIO_19__SPDIF_OUT 0x220 0x5f0 0x000 0x2 0x0
727#define MX6DL_PAD_GPIO_19__CCM_CLKO1 0x220 0x5f0 0x000 0x3 0x0
728#define MX6DL_PAD_GPIO_19__ECSPI1_RDY 0x220 0x5f0 0x000 0x4 0x0
729#define MX6DL_PAD_GPIO_19__GPIO4_IO05 0x220 0x5f0 0x000 0x5 0x0
730#define MX6DL_PAD_GPIO_19__ENET_TX_ER 0x220 0x5f0 0x000 0x6 0x0
731#define MX6DL_PAD_GPIO_2__ESAI_TX_FS 0x224 0x5f4 0x830 0x0 0x1
732#define MX6DL_PAD_GPIO_2__KEY_ROW6 0x224 0x5f4 0x8d0 0x2 0x1
733#define MX6DL_PAD_GPIO_2__GPIO1_IO02 0x224 0x5f4 0x000 0x5 0x0
734#define MX6DL_PAD_GPIO_2__SD2_WP 0x224 0x5f4 0x000 0x6 0x0
735#define MX6DL_PAD_GPIO_2__MLB_DATA 0x224 0x5f4 0x8e0 0x7 0x1
736#define MX6DL_PAD_GPIO_3__ESAI_RX_HF_CLK 0x228 0x5f8 0x834 0x0 0x1
737#define MX6DL_PAD_GPIO_3__I2C3_SCL 0x228 0x5f8 0x878 0x2 0x1
738#define MX6DL_PAD_GPIO_3__XTALOSC_REF_CLK_24M 0x228 0x5f8 0x000 0x3 0x0
739#define MX6DL_PAD_GPIO_3__CCM_CLKO2 0x228 0x5f8 0x000 0x4 0x0
740#define MX6DL_PAD_GPIO_3__GPIO1_IO03 0x228 0x5f8 0x000 0x5 0x0
741#define MX6DL_PAD_GPIO_3__USB_H1_OC 0x228 0x5f8 0x924 0x6 0x1
742#define MX6DL_PAD_GPIO_3__MLB_CLK 0x228 0x5f8 0x8dc 0x7 0x1
743#define MX6DL_PAD_GPIO_4__ESAI_TX_HF_CLK 0x22c 0x5fc 0x838 0x0 0x1
744#define MX6DL_PAD_GPIO_4__KEY_COL7 0x22c 0x5fc 0x8c8 0x2 0x1
745#define MX6DL_PAD_GPIO_4__GPIO1_IO04 0x22c 0x5fc 0x000 0x5 0x0
746#define MX6DL_PAD_GPIO_4__SD2_CD_B 0x22c 0x5fc 0x000 0x6 0x0
747#define MX6DL_PAD_GPIO_5__ESAI_TX2_RX3 0x230 0x600 0x84c 0x0 0x1
748#define MX6DL_PAD_GPIO_5__KEY_ROW7 0x230 0x600 0x8d4 0x2 0x1
749#define MX6DL_PAD_GPIO_5__CCM_CLKO1 0x230 0x600 0x000 0x3 0x0
750#define MX6DL_PAD_GPIO_5__GPIO1_IO05 0x230 0x600 0x000 0x5 0x0
751#define MX6DL_PAD_GPIO_5__I2C3_SCL 0x230 0x600 0x878 0x6 0x2
752#define MX6DL_PAD_GPIO_5__ARM_EVENTI 0x230 0x600 0x000 0x7 0x0
753#define MX6DL_PAD_GPIO_6__ESAI_TX_CLK 0x234 0x604 0x840 0x0 0x1
754#define MX6DL_PAD_GPIO_6__I2C3_SDA 0x234 0x604 0x87c 0x2 0x2
755#define MX6DL_PAD_GPIO_6__GPIO1_IO06 0x234 0x604 0x000 0x5 0x0
756#define MX6DL_PAD_GPIO_6__SD2_LCTL 0x234 0x604 0x000 0x6 0x0
757#define MX6DL_PAD_GPIO_6__MLB_SIG 0x234 0x604 0x8e4 0x7 0x1
758#define MX6DL_PAD_GPIO_7__ESAI_TX4_RX1 0x238 0x608 0x854 0x0 0x1
759#define MX6DL_PAD_GPIO_7__EPIT1_OUT 0x238 0x608 0x000 0x2 0x0
760#define MX6DL_PAD_GPIO_7__FLEXCAN1_TX 0x238 0x608 0x000 0x3 0x0
761#define MX6DL_PAD_GPIO_7__UART2_TX_DATA 0x238 0x608 0x000 0x4 0x0
762#define MX6DL_PAD_GPIO_7__UART2_RX_DATA 0x238 0x608 0x904 0x4 0x2
763#define MX6DL_PAD_GPIO_7__GPIO1_IO07 0x238 0x608 0x000 0x5 0x0
764#define MX6DL_PAD_GPIO_7__SPDIF_LOCK 0x238 0x608 0x000 0x6 0x0
765#define MX6DL_PAD_GPIO_7__USB_OTG_HOST_MODE 0x238 0x608 0x000 0x7 0x0
766#define MX6DL_PAD_GPIO_7__I2C4_SCL 0x238 0x608 0x880 0x8 0x1
767#define MX6DL_PAD_GPIO_8__ESAI_TX5_RX0 0x23c 0x60c 0x858 0x0 0x1
768#define MX6DL_PAD_GPIO_8__XTALOSC_REF_CLK_32K 0x23c 0x60c 0x000 0x1 0x0
769#define MX6DL_PAD_GPIO_8__EPIT2_OUT 0x23c 0x60c 0x000 0x2 0x0
770#define MX6DL_PAD_GPIO_8__FLEXCAN1_RX 0x23c 0x60c 0x7c8 0x3 0x0
771#define MX6DL_PAD_GPIO_8__UART2_RX_DATA 0x23c 0x60c 0x904 0x4 0x3
772#define MX6DL_PAD_GPIO_8__UART2_TX_DATA 0x23c 0x60c 0x000 0x4 0x0
773#define MX6DL_PAD_GPIO_8__GPIO1_IO08 0x23c 0x60c 0x000 0x5 0x0
774#define MX6DL_PAD_GPIO_8__SPDIF_SR_CLK 0x23c 0x60c 0x000 0x6 0x0
775#define MX6DL_PAD_GPIO_8__USB_OTG_PWR_CTL_WAKE 0x23c 0x60c 0x000 0x7 0x0
776#define MX6DL_PAD_GPIO_8__I2C4_SDA 0x23c 0x60c 0x884 0x8 0x1
777#define MX6DL_PAD_GPIO_9__ESAI_RX_FS 0x240 0x610 0x82c 0x0 0x1
778#define MX6DL_PAD_GPIO_9__WDOG1_B 0x240 0x610 0x000 0x1 0x0
779#define MX6DL_PAD_GPIO_9__KEY_COL6 0x240 0x610 0x8c4 0x2 0x1
780#define MX6DL_PAD_GPIO_9__CCM_REF_EN_B 0x240 0x610 0x000 0x3 0x0
781#define MX6DL_PAD_GPIO_9__PWM1_OUT 0x240 0x610 0x000 0x4 0x0
782#define MX6DL_PAD_GPIO_9__GPIO1_IO09 0x240 0x610 0x000 0x5 0x0
783#define MX6DL_PAD_GPIO_9__SD1_WP 0x240 0x610 0x92c 0x6 0x1
784#define MX6DL_PAD_KEY_COL0__ECSPI1_SCLK 0x244 0x62c 0x7d8 0x0 0x3
785#define MX6DL_PAD_KEY_COL0__ENET_RX_DATA3 0x244 0x62c 0x824 0x1 0x0
786#define MX6DL_PAD_KEY_COL0__AUD5_TXC 0x244 0x62c 0x7c0 0x2 0x1
787#define MX6DL_PAD_KEY_COL0__KEY_COL0 0x244 0x62c 0x000 0x3 0x0
788#define MX6DL_PAD_KEY_COL0__UART4_TX_DATA 0x244 0x62c 0x000 0x4 0x0
789#define MX6DL_PAD_KEY_COL0__UART4_RX_DATA 0x244 0x62c 0x914 0x4 0x2
790#define MX6DL_PAD_KEY_COL0__GPIO4_IO06 0x244 0x62c 0x000 0x5 0x0
791#define MX6DL_PAD_KEY_COL0__DCIC1_OUT 0x244 0x62c 0x000 0x6 0x0
792#define MX6DL_PAD_KEY_COL1__ECSPI1_MISO 0x248 0x630 0x7dc 0x0 0x3
793#define MX6DL_PAD_KEY_COL1__ENET_MDIO 0x248 0x630 0x810 0x1 0x1
794#define MX6DL_PAD_KEY_COL1__AUD5_TXFS 0x248 0x630 0x7c4 0x2 0x1
795#define MX6DL_PAD_KEY_COL1__KEY_COL1 0x248 0x630 0x000 0x3 0x0
796#define MX6DL_PAD_KEY_COL1__UART5_TX_DATA 0x248 0x630 0x000 0x4 0x0
797#define MX6DL_PAD_KEY_COL1__UART5_RX_DATA 0x248 0x630 0x91c 0x4 0x2
798#define MX6DL_PAD_KEY_COL1__GPIO4_IO08 0x248 0x630 0x000 0x5 0x0
799#define MX6DL_PAD_KEY_COL1__SD1_VSELECT 0x248 0x630 0x000 0x6 0x0
800#define MX6DL_PAD_KEY_COL2__ECSPI1_SS1 0x24c 0x634 0x7e8 0x0 0x2
801#define MX6DL_PAD_KEY_COL2__ENET_RX_DATA2 0x24c 0x634 0x820 0x1 0x0
802#define MX6DL_PAD_KEY_COL2__FLEXCAN1_TX 0x24c 0x634 0x000 0x2 0x0
803#define MX6DL_PAD_KEY_COL2__KEY_COL2 0x24c 0x634 0x000 0x3 0x0
804#define MX6DL_PAD_KEY_COL2__ENET_MDC 0x24c 0x634 0x000 0x4 0x0
805#define MX6DL_PAD_KEY_COL2__GPIO4_IO10 0x24c 0x634 0x000 0x5 0x0
806#define MX6DL_PAD_KEY_COL2__USB_H1_PWR_CTL_WAKE 0x24c 0x634 0x000 0x6 0x0
807#define MX6DL_PAD_KEY_COL3__ECSPI1_SS3 0x250 0x638 0x7f0 0x0 0x1
808#define MX6DL_PAD_KEY_COL3__ENET_CRS 0x250 0x638 0x000 0x1 0x0
809#define MX6DL_PAD_KEY_COL3__HDMI_TX_DDC_SCL 0x250 0x638 0x860 0x2 0x1
810#define MX6DL_PAD_KEY_COL3__KEY_COL3 0x250 0x638 0x000 0x3 0x0
811#define MX6DL_PAD_KEY_COL3__I2C2_SCL 0x250 0x638 0x870 0x4 0x1
812#define MX6DL_PAD_KEY_COL3__GPIO4_IO12 0x250 0x638 0x000 0x5 0x0
813#define MX6DL_PAD_KEY_COL3__SPDIF_IN 0x250 0x638 0x8f0 0x6 0x3
814#define MX6DL_PAD_KEY_COL4__FLEXCAN2_TX 0x254 0x63c 0x000 0x0 0x0
815#define MX6DL_PAD_KEY_COL4__IPU1_SISG4 0x254 0x63c 0x000 0x1 0x0
816#define MX6DL_PAD_KEY_COL4__USB_OTG_OC 0x254 0x63c 0x920 0x2 0x1
817#define MX6DL_PAD_KEY_COL4__KEY_COL4 0x254 0x63c 0x000 0x3 0x0
818#define MX6DL_PAD_KEY_COL4__UART5_RTS_B 0x254 0x63c 0x918 0x4 0x2
819#define MX6DL_PAD_KEY_COL4__UART5_CTS_B 0x254 0x63c 0x000 0x4 0x0
820#define MX6DL_PAD_KEY_COL4__GPIO4_IO14 0x254 0x63c 0x000 0x5 0x0
821#define MX6DL_PAD_KEY_ROW0__ECSPI1_MOSI 0x258 0x640 0x7e0 0x0 0x3
822#define MX6DL_PAD_KEY_ROW0__ENET_TX_DATA3 0x258 0x640 0x000 0x1 0x0
823#define MX6DL_PAD_KEY_ROW0__AUD5_TXD 0x258 0x640 0x7b4 0x2 0x1
824#define MX6DL_PAD_KEY_ROW0__KEY_ROW0 0x258 0x640 0x000 0x3 0x0
825#define MX6DL_PAD_KEY_ROW0__UART4_RX_DATA 0x258 0x640 0x914 0x4 0x3
826#define MX6DL_PAD_KEY_ROW0__UART4_TX_DATA 0x258 0x640 0x000 0x4 0x0
827#define MX6DL_PAD_KEY_ROW0__GPIO4_IO07 0x258 0x640 0x000 0x5 0x0
828#define MX6DL_PAD_KEY_ROW0__DCIC2_OUT 0x258 0x640 0x000 0x6 0x0
829#define MX6DL_PAD_KEY_ROW1__ECSPI1_SS0 0x25c 0x644 0x7e4 0x0 0x3
830#define MX6DL_PAD_KEY_ROW1__ENET_COL 0x25c 0x644 0x000 0x1 0x0
831#define MX6DL_PAD_KEY_ROW1__AUD5_RXD 0x25c 0x644 0x7b0 0x2 0x1
832#define MX6DL_PAD_KEY_ROW1__KEY_ROW1 0x25c 0x644 0x000 0x3 0x0
833#define MX6DL_PAD_KEY_ROW1__UART5_RX_DATA 0x25c 0x644 0x91c 0x4 0x3
834#define MX6DL_PAD_KEY_ROW1__UART5_TX_DATA 0x25c 0x644 0x000 0x4 0x0
835#define MX6DL_PAD_KEY_ROW1__GPIO4_IO09 0x25c 0x644 0x000 0x5 0x0
836#define MX6DL_PAD_KEY_ROW1__SD2_VSELECT 0x25c 0x644 0x000 0x6 0x0
837#define MX6DL_PAD_KEY_ROW2__ECSPI1_SS2 0x260 0x648 0x7ec 0x0 0x1
838#define MX6DL_PAD_KEY_ROW2__ENET_TX_DATA2 0x260 0x648 0x000 0x1 0x0
839#define MX6DL_PAD_KEY_ROW2__FLEXCAN1_RX 0x260 0x648 0x7c8 0x2 0x1
840#define MX6DL_PAD_KEY_ROW2__KEY_ROW2 0x260 0x648 0x000 0x3 0x0
841#define MX6DL_PAD_KEY_ROW2__SD2_VSELECT 0x260 0x648 0x000 0x4 0x0
842#define MX6DL_PAD_KEY_ROW2__GPIO4_IO11 0x260 0x648 0x000 0x5 0x0
843#define MX6DL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x260 0x648 0x85c 0x6 0x1
844#define MX6DL_PAD_KEY_ROW3__ASRC_EXT_CLK 0x264 0x64c 0x794 0x1 0x2
845#define MX6DL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA 0x264 0x64c 0x864 0x2 0x1
846#define MX6DL_PAD_KEY_ROW3__KEY_ROW3 0x264 0x64c 0x000 0x3 0x0
847#define MX6DL_PAD_KEY_ROW3__I2C2_SDA 0x264 0x64c 0x874 0x4 0x1
848#define MX6DL_PAD_KEY_ROW3__GPIO4_IO13 0x264 0x64c 0x000 0x5 0x0
849#define MX6DL_PAD_KEY_ROW3__SD1_VSELECT 0x264 0x64c 0x000 0x6 0x0
850#define MX6DL_PAD_KEY_ROW4__FLEXCAN2_RX 0x268 0x650 0x7cc 0x0 0x0
851#define MX6DL_PAD_KEY_ROW4__IPU1_SISG5 0x268 0x650 0x000 0x1 0x0
852#define MX6DL_PAD_KEY_ROW4__USB_OTG_PWR 0x268 0x650 0x000 0x2 0x0
853#define MX6DL_PAD_KEY_ROW4__KEY_ROW4 0x268 0x650 0x000 0x3 0x0
854#define MX6DL_PAD_KEY_ROW4__UART5_CTS_B 0x268 0x650 0x000 0x4 0x0
855#define MX6DL_PAD_KEY_ROW4__UART5_RTS_B 0x268 0x650 0x918 0x4 0x3
856#define MX6DL_PAD_KEY_ROW4__GPIO4_IO15 0x268 0x650 0x000 0x5 0x0
857#define MX6DL_PAD_NANDF_ALE__NAND_ALE 0x26c 0x654 0x000 0x0 0x0
858#define MX6DL_PAD_NANDF_ALE__SD4_RESET 0x26c 0x654 0x000 0x1 0x0
859#define MX6DL_PAD_NANDF_ALE__GPIO6_IO08 0x26c 0x654 0x000 0x5 0x0
860#define MX6DL_PAD_NANDF_CLE__NAND_CLE 0x270 0x658 0x000 0x0 0x0
861#define MX6DL_PAD_NANDF_CLE__GPIO6_IO07 0x270 0x658 0x000 0x5 0x0
862#define MX6DL_PAD_NANDF_CS0__NAND_CE0_B 0x274 0x65c 0x000 0x0 0x0
863#define MX6DL_PAD_NANDF_CS0__GPIO6_IO11 0x274 0x65c 0x000 0x5 0x0
864#define MX6DL_PAD_NANDF_CS1__NAND_CE1_B 0x278 0x660 0x000 0x0 0x0
865#define MX6DL_PAD_NANDF_CS1__SD4_VSELECT 0x278 0x660 0x000 0x1 0x0
866#define MX6DL_PAD_NANDF_CS1__SD3_VSELECT 0x278 0x660 0x000 0x2 0x0
867#define MX6DL_PAD_NANDF_CS1__GPIO6_IO14 0x278 0x660 0x000 0x5 0x0
868#define MX6DL_PAD_NANDF_CS2__NAND_CE2_B 0x27c 0x664 0x000 0x0 0x0
869#define MX6DL_PAD_NANDF_CS2__IPU1_SISG0 0x27c 0x664 0x000 0x1 0x0
870#define MX6DL_PAD_NANDF_CS2__ESAI_TX0 0x27c 0x664 0x844 0x2 0x1
871#define MX6DL_PAD_NANDF_CS2__EIM_CRE 0x27c 0x664 0x000 0x3 0x0
872#define MX6DL_PAD_NANDF_CS2__CCM_CLKO2 0x27c 0x664 0x000 0x4 0x0
873#define MX6DL_PAD_NANDF_CS2__GPIO6_IO15 0x27c 0x664 0x000 0x5 0x0
874#define MX6DL_PAD_NANDF_CS3__NAND_CE3_B 0x280 0x668 0x000 0x0 0x0
875#define MX6DL_PAD_NANDF_CS3__IPU1_SISG1 0x280 0x668 0x000 0x1 0x0
876#define MX6DL_PAD_NANDF_CS3__ESAI_TX1 0x280 0x668 0x848 0x2 0x1
877#define MX6DL_PAD_NANDF_CS3__EIM_ADDR26 0x280 0x668 0x000 0x3 0x0
878#define MX6DL_PAD_NANDF_CS3__GPIO6_IO16 0x280 0x668 0x000 0x5 0x0
879#define MX6DL_PAD_NANDF_CS3__I2C4_SDA 0x280 0x668 0x884 0x9 0x2
880#define MX6DL_PAD_NANDF_D0__NAND_DATA00 0x284 0x66c 0x000 0x0 0x0
881#define MX6DL_PAD_NANDF_D0__SD1_DATA4 0x284 0x66c 0x000 0x1 0x0
882#define MX6DL_PAD_NANDF_D0__GPIO2_IO00 0x284 0x66c 0x000 0x5 0x0
883#define MX6DL_PAD_NANDF_D1__NAND_DATA01 0x288 0x670 0x000 0x0 0x0
884#define MX6DL_PAD_NANDF_D1__SD1_DATA5 0x288 0x670 0x000 0x1 0x0
885#define MX6DL_PAD_NANDF_D1__GPIO2_IO01 0x288 0x670 0x000 0x5 0x0
886#define MX6DL_PAD_NANDF_D2__NAND_DATA02 0x28c 0x674 0x000 0x0 0x0
887#define MX6DL_PAD_NANDF_D2__SD1_DATA6 0x28c 0x674 0x000 0x1 0x0
888#define MX6DL_PAD_NANDF_D2__GPIO2_IO02 0x28c 0x674 0x000 0x5 0x0
889#define MX6DL_PAD_NANDF_D3__NAND_DATA03 0x290 0x678 0x000 0x0 0x0
890#define MX6DL_PAD_NANDF_D3__SD1_DATA7 0x290 0x678 0x000 0x1 0x0
891#define MX6DL_PAD_NANDF_D3__GPIO2_IO03 0x290 0x678 0x000 0x5 0x0
892#define MX6DL_PAD_NANDF_D4__NAND_DATA04 0x294 0x67c 0x000 0x0 0x0
893#define MX6DL_PAD_NANDF_D4__SD2_DATA4 0x294 0x67c 0x000 0x1 0x0
894#define MX6DL_PAD_NANDF_D4__GPIO2_IO04 0x294 0x67c 0x000 0x5 0x0
895#define MX6DL_PAD_NANDF_D5__NAND_DATA05 0x298 0x680 0x000 0x0 0x0
896#define MX6DL_PAD_NANDF_D5__SD2_DATA5 0x298 0x680 0x000 0x1 0x0
897#define MX6DL_PAD_NANDF_D5__GPIO2_IO05 0x298 0x680 0x000 0x5 0x0
898#define MX6DL_PAD_NANDF_D6__NAND_DATA06 0x29c 0x684 0x000 0x0 0x0
899#define MX6DL_PAD_NANDF_D6__SD2_DATA6 0x29c 0x684 0x000 0x1 0x0
900#define MX6DL_PAD_NANDF_D6__GPIO2_IO06 0x29c 0x684 0x000 0x5 0x0
901#define MX6DL_PAD_NANDF_D7__NAND_DATA07 0x2a0 0x688 0x000 0x0 0x0
902#define MX6DL_PAD_NANDF_D7__SD2_DATA7 0x2a0 0x688 0x000 0x1 0x0
903#define MX6DL_PAD_NANDF_D7__GPIO2_IO07 0x2a0 0x688 0x000 0x5 0x0
904#define MX6DL_PAD_NANDF_RB0__NAND_READY_B 0x2a4 0x68c 0x000 0x0 0x0
905#define MX6DL_PAD_NANDF_RB0__GPIO6_IO10 0x2a4 0x68c 0x000 0x5 0x0
906#define MX6DL_PAD_NANDF_WP_B__NAND_WP_B 0x2a8 0x690 0x000 0x0 0x0
907#define MX6DL_PAD_NANDF_WP_B__GPIO6_IO09 0x2a8 0x690 0x000 0x5 0x0
908#define MX6DL_PAD_NANDF_WP_B__I2C4_SCL 0x2a8 0x690 0x880 0x9 0x2
909#define MX6DL_PAD_RGMII_RD0__HSI_RX_READY 0x2ac 0x694 0x000 0x0 0x0
910#define MX6DL_PAD_RGMII_RD0__RGMII_RD0 0x2ac 0x694 0x818 0x1 0x1
911#define MX6DL_PAD_RGMII_RD0__GPIO6_IO25 0x2ac 0x694 0x000 0x5 0x0
912#define MX6DL_PAD_RGMII_RD1__HSI_TX_FLAG 0x2b0 0x698 0x000 0x0 0x0
913#define MX6DL_PAD_RGMII_RD1__RGMII_RD1 0x2b0 0x698 0x81c 0x1 0x1
914#define MX6DL_PAD_RGMII_RD1__GPIO6_IO27 0x2b0 0x698 0x000 0x5 0x0
915#define MX6DL_PAD_RGMII_RD2__HSI_TX_DATA 0x2b4 0x69c 0x000 0x0 0x0
916#define MX6DL_PAD_RGMII_RD2__RGMII_RD2 0x2b4 0x69c 0x820 0x1 0x1
917#define MX6DL_PAD_RGMII_RD2__GPIO6_IO28 0x2b4 0x69c 0x000 0x5 0x0
918#define MX6DL_PAD_RGMII_RD3__HSI_TX_WAKE 0x2b8 0x6a0 0x000 0x0 0x0
919#define MX6DL_PAD_RGMII_RD3__RGMII_RD3 0x2b8 0x6a0 0x824 0x1 0x1
920#define MX6DL_PAD_RGMII_RD3__GPIO6_IO29 0x2b8 0x6a0 0x000 0x5 0x0
921#define MX6DL_PAD_RGMII_RX_CTL__USB_H3_DATA 0x2bc 0x6a4 0x000 0x0 0x0
922#define MX6DL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x2bc 0x6a4 0x828 0x1 0x1
923#define MX6DL_PAD_RGMII_RX_CTL__GPIO6_IO24 0x2bc 0x6a4 0x000 0x5 0x0
924#define MX6DL_PAD_RGMII_RXC__USB_H3_STROBE 0x2c0 0x6a8 0x000 0x0 0x0
925#define MX6DL_PAD_RGMII_RXC__RGMII_RXC 0x2c0 0x6a8 0x814 0x1 0x1
926#define MX6DL_PAD_RGMII_RXC__GPIO6_IO30 0x2c0 0x6a8 0x000 0x5 0x0
927#define MX6DL_PAD_RGMII_TD0__HSI_TX_READY 0x2c4 0x6ac 0x000 0x0 0x0
928#define MX6DL_PAD_RGMII_TD0__RGMII_TD0 0x2c4 0x6ac 0x000 0x1 0x0
929#define MX6DL_PAD_RGMII_TD0__GPIO6_IO20 0x2c4 0x6ac 0x000 0x5 0x0
930#define MX6DL_PAD_RGMII_TD1__HSI_RX_FLAG 0x2c8 0x6b0 0x000 0x0 0x0
931#define MX6DL_PAD_RGMII_TD1__RGMII_TD1 0x2c8 0x6b0 0x000 0x1 0x0
932#define MX6DL_PAD_RGMII_TD1__GPIO6_IO21 0x2c8 0x6b0 0x000 0x5 0x0
933#define MX6DL_PAD_RGMII_TD2__HSI_RX_DATA 0x2cc 0x6b4 0x000 0x0 0x0
934#define MX6DL_PAD_RGMII_TD2__RGMII_TD2 0x2cc 0x6b4 0x000 0x1 0x0
935#define MX6DL_PAD_RGMII_TD2__GPIO6_IO22 0x2cc 0x6b4 0x000 0x5 0x0
936#define MX6DL_PAD_RGMII_TD3__HSI_RX_WAKE 0x2d0 0x6b8 0x000 0x0 0x0
937#define MX6DL_PAD_RGMII_TD3__RGMII_TD3 0x2d0 0x6b8 0x000 0x1 0x0
938#define MX6DL_PAD_RGMII_TD3__GPIO6_IO23 0x2d0 0x6b8 0x000 0x5 0x0
939#define MX6DL_PAD_RGMII_TX_CTL__USB_H2_STROBE 0x2d4 0x6bc 0x000 0x0 0x0
940#define MX6DL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x2d4 0x6bc 0x000 0x1 0x0
941#define MX6DL_PAD_RGMII_TX_CTL__GPIO6_IO26 0x2d4 0x6bc 0x000 0x5 0x0
942#define MX6DL_PAD_RGMII_TX_CTL__ENET_REF_CLK 0x2d4 0x6bc 0x80c 0x7 0x1
943#define MX6DL_PAD_RGMII_TXC__USB_H2_DATA 0x2d8 0x6c0 0x000 0x0 0x0
944#define MX6DL_PAD_RGMII_TXC__RGMII_TXC 0x2d8 0x6c0 0x000 0x1 0x0
945#define MX6DL_PAD_RGMII_TXC__SPDIF_EXT_CLK 0x2d8 0x6c0 0x8f4 0x2 0x1
946#define MX6DL_PAD_RGMII_TXC__GPIO6_IO19 0x2d8 0x6c0 0x000 0x5 0x0
947#define MX6DL_PAD_RGMII_TXC__XTALOSC_REF_CLK_24M 0x2d8 0x6c0 0x000 0x7 0x0
948#define MX6DL_PAD_SD1_CLK__SD1_CLK 0x2dc 0x6c4 0x928 0x0 0x1
949#define MX6DL_PAD_SD1_CLK__GPT_CLKIN 0x2dc 0x6c4 0x000 0x3 0x0
950#define MX6DL_PAD_SD1_CLK__GPIO1_IO20 0x2dc 0x6c4 0x000 0x5 0x0
951#define MX6DL_PAD_SD1_CMD__SD1_CMD 0x2e0 0x6c8 0x000 0x0 0x0
952#define MX6DL_PAD_SD1_CMD__PWM4_OUT 0x2e0 0x6c8 0x000 0x2 0x0
953#define MX6DL_PAD_SD1_CMD__GPT_COMPARE1 0x2e0 0x6c8 0x000 0x3 0x0
954#define MX6DL_PAD_SD1_CMD__GPIO1_IO18 0x2e0 0x6c8 0x000 0x5 0x0
955#define MX6DL_PAD_SD1_DAT0__SD1_DATA0 0x2e4 0x6cc 0x000 0x0 0x0
956#define MX6DL_PAD_SD1_DAT0__GPT_CAPTURE1 0x2e4 0x6cc 0x000 0x3 0x0
957#define MX6DL_PAD_SD1_DAT0__GPIO1_IO16 0x2e4 0x6cc 0x000 0x5 0x0
958#define MX6DL_PAD_SD1_DAT1__SD1_DATA1 0x2e8 0x6d0 0x000 0x0 0x0
959#define MX6DL_PAD_SD1_DAT1__PWM3_OUT 0x2e8 0x6d0 0x000 0x2 0x0
960#define MX6DL_PAD_SD1_DAT1__GPT_CAPTURE2 0x2e8 0x6d0 0x000 0x3 0x0
961#define MX6DL_PAD_SD1_DAT1__GPIO1_IO17 0x2e8 0x6d0 0x000 0x5 0x0
962#define MX6DL_PAD_SD1_DAT2__SD1_DATA2 0x2ec 0x6d4 0x000 0x0 0x0
963#define MX6DL_PAD_SD1_DAT2__GPT_COMPARE2 0x2ec 0x6d4 0x000 0x2 0x0
964#define MX6DL_PAD_SD1_DAT2__PWM2_OUT 0x2ec 0x6d4 0x000 0x3 0x0
965#define MX6DL_PAD_SD1_DAT2__WDOG1_B 0x2ec 0x6d4 0x000 0x4 0x0
966#define MX6DL_PAD_SD1_DAT2__GPIO1_IO19 0x2ec 0x6d4 0x000 0x5 0x0
967#define MX6DL_PAD_SD1_DAT2__WDOG1_RESET_B_DEB 0x2ec 0x6d4 0x000 0x6 0x0
968#define MX6DL_PAD_SD1_DAT3__SD1_DATA3 0x2f0 0x6d8 0x000 0x0 0x0
969#define MX6DL_PAD_SD1_DAT3__GPT_COMPARE3 0x2f0 0x6d8 0x000 0x2 0x0
970#define MX6DL_PAD_SD1_DAT3__PWM1_OUT 0x2f0 0x6d8 0x000 0x3 0x0
971#define MX6DL_PAD_SD1_DAT3__WDOG2_B 0x2f0 0x6d8 0x000 0x4 0x0
972#define MX6DL_PAD_SD1_DAT3__GPIO1_IO21 0x2f0 0x6d8 0x000 0x5 0x0
973#define MX6DL_PAD_SD1_DAT3__WDOG2_RESET_B_DEB 0x2f0 0x6d8 0x000 0x6 0x0
974#define MX6DL_PAD_SD2_CLK__SD2_CLK 0x2f4 0x6dc 0x930 0x0 0x1
975#define MX6DL_PAD_SD2_CLK__KEY_COL5 0x2f4 0x6dc 0x8c0 0x2 0x3
976#define MX6DL_PAD_SD2_CLK__AUD4_RXFS 0x2f4 0x6dc 0x7a4 0x3 0x1
977#define MX6DL_PAD_SD2_CLK__GPIO1_IO10 0x2f4 0x6dc 0x000 0x5 0x0
978#define MX6DL_PAD_SD2_CMD__SD2_CMD 0x2f8 0x6e0 0x000 0x0 0x0
979#define MX6DL_PAD_SD2_CMD__KEY_ROW5 0x2f8 0x6e0 0x8cc 0x2 0x2
980#define MX6DL_PAD_SD2_CMD__AUD4_RXC 0x2f8 0x6e0 0x7a0 0x3 0x1
981#define MX6DL_PAD_SD2_CMD__GPIO1_IO11 0x2f8 0x6e0 0x000 0x5 0x0
982#define MX6DL_PAD_SD2_DAT0__SD2_DATA0 0x2fc 0x6e4 0x000 0x0 0x0
983#define MX6DL_PAD_SD2_DAT0__AUD4_RXD 0x2fc 0x6e4 0x798 0x3 0x1
984#define MX6DL_PAD_SD2_DAT0__KEY_ROW7 0x2fc 0x6e4 0x8d4 0x4 0x2
985#define MX6DL_PAD_SD2_DAT0__GPIO1_IO15 0x2fc 0x6e4 0x000 0x5 0x0
986#define MX6DL_PAD_SD2_DAT0__DCIC2_OUT 0x2fc 0x6e4 0x000 0x6 0x0
987#define MX6DL_PAD_SD2_DAT1__SD2_DATA1 0x300 0x6e8 0x000 0x0 0x0
988#define MX6DL_PAD_SD2_DAT1__EIM_CS2_B 0x300 0x6e8 0x000 0x2 0x0
989#define MX6DL_PAD_SD2_DAT1__AUD4_TXFS 0x300 0x6e8 0x7ac 0x3 0x1
990#define MX6DL_PAD_SD2_DAT1__KEY_COL7 0x300 0x6e8 0x8c8 0x4 0x2
991#define MX6DL_PAD_SD2_DAT1__GPIO1_IO14 0x300 0x6e8 0x000 0x5 0x0
992#define MX6DL_PAD_SD2_DAT2__SD2_DATA2 0x304 0x6ec 0x000 0x0 0x0
993#define MX6DL_PAD_SD2_DAT2__EIM_CS3_B 0x304 0x6ec 0x000 0x2 0x0
994#define MX6DL_PAD_SD2_DAT2__AUD4_TXD 0x304 0x6ec 0x79c 0x3 0x1
995#define MX6DL_PAD_SD2_DAT2__KEY_ROW6 0x304 0x6ec 0x8d0 0x4 0x2
996#define MX6DL_PAD_SD2_DAT2__GPIO1_IO13 0x304 0x6ec 0x000 0x5 0x0
997#define MX6DL_PAD_SD2_DAT3__SD2_DATA3 0x308 0x6f0 0x000 0x0 0x0
998#define MX6DL_PAD_SD2_DAT3__KEY_COL6 0x308 0x6f0 0x8c4 0x2 0x2
999#define MX6DL_PAD_SD2_DAT3__AUD4_TXC 0x308 0x6f0 0x7a8 0x3 0x1
1000#define MX6DL_PAD_SD2_DAT3__GPIO1_IO12 0x308 0x6f0 0x000 0x5 0x0
1001#define MX6DL_PAD_SD3_CLK__SD3_CLK 0x30c 0x6f4 0x934 0x0 0x1
1002#define MX6DL_PAD_SD3_CLK__UART2_RTS_B 0x30c 0x6f4 0x900 0x1 0x2
1003#define MX6DL_PAD_SD3_CLK__UART2_CTS_B 0x30c 0x6f4 0x000 0x1 0x0
1004#define MX6DL_PAD_SD3_CLK__FLEXCAN1_RX 0x30c 0x6f4 0x7c8 0x2 0x2
1005#define MX6DL_PAD_SD3_CLK__GPIO7_IO03 0x30c 0x6f4 0x000 0x5 0x0
1006#define MX6DL_PAD_SD3_CMD__SD3_CMD 0x310 0x6f8 0x000 0x0 0x0
1007#define MX6DL_PAD_SD3_CMD__UART2_CTS_B 0x310 0x6f8 0x000 0x1 0x0
1008#define MX6DL_PAD_SD3_CMD__UART2_RTS_B 0x310 0x6f8 0x900 0x1 0x3
1009#define MX6DL_PAD_SD3_CMD__FLEXCAN1_TX 0x310 0x6f8 0x000 0x2 0x0
1010#define MX6DL_PAD_SD3_CMD__GPIO7_IO02 0x310 0x6f8 0x000 0x5 0x0
1011#define MX6DL_PAD_SD3_DAT0__SD3_DATA0 0x314 0x6fc 0x000 0x0 0x0
1012#define MX6DL_PAD_SD3_DAT0__UART1_CTS_B 0x314 0x6fc 0x000 0x1 0x0
1013#define MX6DL_PAD_SD3_DAT0__UART1_RTS_B 0x314 0x6fc 0x8f8 0x1 0x2
1014#define MX6DL_PAD_SD3_DAT0__FLEXCAN2_TX 0x314 0x6fc 0x000 0x2 0x0
1015#define MX6DL_PAD_SD3_DAT0__GPIO7_IO04 0x314 0x6fc 0x000 0x5 0x0
1016#define MX6DL_PAD_SD3_DAT1__SD3_DATA1 0x318 0x700 0x000 0x0 0x0
1017#define MX6DL_PAD_SD3_DAT1__UART1_RTS_B 0x318 0x700 0x8f8 0x1 0x3
1018#define MX6DL_PAD_SD3_DAT1__UART1_CTS_B 0x318 0x700 0x000 0x1 0x0
1019#define MX6DL_PAD_SD3_DAT1__FLEXCAN2_RX 0x318 0x700 0x7cc 0x2 0x1
1020#define MX6DL_PAD_SD3_DAT1__GPIO7_IO05 0x318 0x700 0x000 0x5 0x0
1021#define MX6DL_PAD_SD3_DAT2__SD3_DATA2 0x31c 0x704 0x000 0x0 0x0
1022#define MX6DL_PAD_SD3_DAT2__GPIO7_IO06 0x31c 0x704 0x000 0x5 0x0
1023#define MX6DL_PAD_SD3_DAT3__SD3_DATA3 0x320 0x708 0x000 0x0 0x0
1024#define MX6DL_PAD_SD3_DAT3__UART3_CTS_B 0x320 0x708 0x000 0x1 0x0
1025#define MX6DL_PAD_SD3_DAT3__UART3_RTS_B 0x320 0x708 0x908 0x1 0x4
1026#define MX6DL_PAD_SD3_DAT3__GPIO7_IO07 0x320 0x708 0x000 0x5 0x0
1027#define MX6DL_PAD_SD3_DAT4__SD3_DATA4 0x324 0x70c 0x000 0x0 0x0
1028#define MX6DL_PAD_SD3_DAT4__UART2_RX_DATA 0x324 0x70c 0x904 0x1 0x4
1029#define MX6DL_PAD_SD3_DAT4__UART2_TX_DATA 0x324 0x70c 0x000 0x1 0x0
1030#define MX6DL_PAD_SD3_DAT4__GPIO7_IO01 0x324 0x70c 0x000 0x5 0x0
1031#define MX6DL_PAD_SD3_DAT5__SD3_DATA5 0x328 0x710 0x000 0x0 0x0
1032#define MX6DL_PAD_SD3_DAT5__UART2_TX_DATA 0x328 0x710 0x000 0x1 0x0
1033#define MX6DL_PAD_SD3_DAT5__UART2_RX_DATA 0x328 0x710 0x904 0x1 0x5
1034#define MX6DL_PAD_SD3_DAT5__GPIO7_IO00 0x328 0x710 0x000 0x5 0x0
1035#define MX6DL_PAD_SD3_DAT6__SD3_DATA6 0x32c 0x714 0x000 0x0 0x0
1036#define MX6DL_PAD_SD3_DAT6__UART1_RX_DATA 0x32c 0x714 0x8fc 0x1 0x2
1037#define MX6DL_PAD_SD3_DAT6__UART1_TX_DATA 0x32c 0x714 0x000 0x1 0x0
1038#define MX6DL_PAD_SD3_DAT6__GPIO6_IO18 0x32c 0x714 0x000 0x5 0x0
1039#define MX6DL_PAD_SD3_DAT7__SD3_DATA7 0x330 0x718 0x000 0x0 0x0
1040#define MX6DL_PAD_SD3_DAT7__UART1_TX_DATA 0x330 0x718 0x000 0x1 0x0
1041#define MX6DL_PAD_SD3_DAT7__UART1_RX_DATA 0x330 0x718 0x8fc 0x1 0x3
1042#define MX6DL_PAD_SD3_DAT7__GPIO6_IO17 0x330 0x718 0x000 0x5 0x0
1043#define MX6DL_PAD_SD3_RST__SD3_RESET 0x334 0x71c 0x000 0x0 0x0
1044#define MX6DL_PAD_SD3_RST__UART3_RTS_B 0x334 0x71c 0x908 0x1 0x5
1045#define MX6DL_PAD_SD3_RST__UART3_CTS_B 0x334 0x71c 0x000 0x1 0x0
1046#define MX6DL_PAD_SD3_RST__GPIO7_IO08 0x334 0x71c 0x000 0x5 0x0
1047#define MX6DL_PAD_SD4_CLK__SD4_CLK 0x338 0x720 0x938 0x0 0x1
1048#define MX6DL_PAD_SD4_CLK__NAND_WE_B 0x338 0x720 0x000 0x1 0x0
1049#define MX6DL_PAD_SD4_CLK__UART3_RX_DATA 0x338 0x720 0x90c 0x2 0x2
1050#define MX6DL_PAD_SD4_CLK__UART3_TX_DATA 0x338 0x720 0x000 0x2 0x0
1051#define MX6DL_PAD_SD4_CLK__GPIO7_IO10 0x338 0x720 0x000 0x5 0x0
1052#define MX6DL_PAD_SD4_CMD__SD4_CMD 0x33c 0x724 0x000 0x0 0x0
1053#define MX6DL_PAD_SD4_CMD__NAND_RE_B 0x33c 0x724 0x000 0x1 0x0
1054#define MX6DL_PAD_SD4_CMD__UART3_TX_DATA 0x33c 0x724 0x000 0x2 0x0
1055#define MX6DL_PAD_SD4_CMD__UART3_RX_DATA 0x33c 0x724 0x90c 0x2 0x3
1056#define MX6DL_PAD_SD4_CMD__GPIO7_IO09 0x33c 0x724 0x000 0x5 0x0
1057#define MX6DL_PAD_SD4_DAT0__SD4_DATA0 0x340 0x728 0x000 0x1 0x0
1058#define MX6DL_PAD_SD4_DAT0__NAND_DQS 0x340 0x728 0x000 0x2 0x0
1059#define MX6DL_PAD_SD4_DAT0__GPIO2_IO08 0x340 0x728 0x000 0x5 0x0
1060#define MX6DL_PAD_SD4_DAT1__SD4_DATA1 0x344 0x72c 0x000 0x1 0x0
1061#define MX6DL_PAD_SD4_DAT1__PWM3_OUT 0x344 0x72c 0x000 0x2 0x0
1062#define MX6DL_PAD_SD4_DAT1__GPIO2_IO09 0x344 0x72c 0x000 0x5 0x0
1063#define MX6DL_PAD_SD4_DAT2__SD4_DATA2 0x348 0x730 0x000 0x1 0x0
1064#define MX6DL_PAD_SD4_DAT2__PWM4_OUT 0x348 0x730 0x000 0x2 0x0
1065#define MX6DL_PAD_SD4_DAT2__GPIO2_IO10 0x348 0x730 0x000 0x5 0x0
1066#define MX6DL_PAD_SD4_DAT3__SD4_DATA3 0x34c 0x734 0x000 0x1 0x0
1067#define MX6DL_PAD_SD4_DAT3__GPIO2_IO11 0x34c 0x734 0x000 0x5 0x0
1068#define MX6DL_PAD_SD4_DAT4__SD4_DATA4 0x350 0x738 0x000 0x1 0x0
1069#define MX6DL_PAD_SD4_DAT4__UART2_RX_DATA 0x350 0x738 0x904 0x2 0x6
1070#define MX6DL_PAD_SD4_DAT4__UART2_TX_DATA 0x350 0x738 0x000 0x2 0x0
1071#define MX6DL_PAD_SD4_DAT4__GPIO2_IO12 0x350 0x738 0x000 0x5 0x0
1072#define MX6DL_PAD_SD4_DAT5__SD4_DATA5 0x354 0x73c 0x000 0x1 0x0
1073#define MX6DL_PAD_SD4_DAT5__UART2_RTS_B 0x354 0x73c 0x900 0x2 0x4
1074#define MX6DL_PAD_SD4_DAT5__UART2_CTS_B 0x354 0x73c 0x000 0x2 0x0
1075#define MX6DL_PAD_SD4_DAT5__GPIO2_IO13 0x354 0x73c 0x000 0x5 0x0
1076#define MX6DL_PAD_SD4_DAT6__SD4_DATA6 0x358 0x740 0x000 0x1 0x0
1077#define MX6DL_PAD_SD4_DAT6__UART2_CTS_B 0x358 0x740 0x000 0x2 0x0
1078#define MX6DL_PAD_SD4_DAT6__UART2_RTS_B 0x358 0x740 0x900 0x2 0x5
1079#define MX6DL_PAD_SD4_DAT6__GPIO2_IO14 0x358 0x740 0x000 0x5 0x0
1080#define MX6DL_PAD_SD4_DAT7__SD4_DATA7 0x35c 0x744 0x000 0x1 0x0
1081#define MX6DL_PAD_SD4_DAT7__UART2_TX_DATA 0x35c 0x744 0x000 0x2 0x0
1082#define MX6DL_PAD_SD4_DAT7__UART2_RX_DATA 0x35c 0x744 0x904 0x2 0x7
1083#define MX6DL_PAD_SD4_DAT7__GPIO2_IO15 0x35c 0x744 0x000 0x5 0x0
1084
1085#endif /* __DTS_IMX6DL_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx6dl-sabreauto.dts b/arch/arm/boot/dts/imx6dl-sabreauto.dts
new file mode 100644
index 000000000000..7adcec360213
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-sabreauto.dts
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2013 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/dts-v1/;
10
11#include "imx6dl.dtsi"
12#include "imx6qdl-sabreauto.dtsi"
13
14/ {
15 model = "Freescale i.MX6 DualLite/Solo SABRE Automotive Board";
16 compatible = "fsl,imx6dl-sabreauto", "fsl,imx6dl";
17};
18
19&iomuxc {
20 pinctrl-names = "default";
21 pinctrl-0 = <&pinctrl_hog>;
22
23 hog {
24 pinctrl_hog: hoggrp {
25 fsl,pins = <
26 MX6DL_PAD_NANDF_CS2__GPIO6_IO15 0x80000000
27 MX6DL_PAD_SD2_DAT2__GPIO1_IO13 0x80000000
28 >;
29 };
30 };
31};
diff --git a/arch/arm/boot/dts/imx6dl-sabresd.dts b/arch/arm/boot/dts/imx6dl-sabresd.dts
new file mode 100644
index 000000000000..7efb05db4783
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-sabresd.dts
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2013 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/dts-v1/;
10
11#include "imx6dl.dtsi"
12#include "imx6qdl-sabresd.dtsi"
13
14/ {
15 model = "Freescale i.MX6 DualLite SABRE Smart Device Board";
16 compatible = "fsl,imx6dl-sabresd", "fsl,imx6dl";
17};
18
19&iomuxc {
20 pinctrl-names = "default";
21 pinctrl-0 = <&pinctrl_hog>;
22
23 hog {
24 pinctrl_hog: hoggrp {
25 fsl,pins = <
26 MX6DL_PAD_GPIO_4__GPIO1_IO04 0x80000000
27 MX6DL_PAD_GPIO_5__GPIO1_IO05 0x80000000
28 MX6DL_PAD_NANDF_D0__GPIO2_IO00 0x80000000
29 MX6DL_PAD_NANDF_D1__GPIO2_IO01 0x80000000
30 MX6DL_PAD_NANDF_D2__GPIO2_IO02 0x80000000
31 MX6DL_PAD_NANDF_D3__GPIO2_IO03 0x80000000
32 >;
33 };
34 };
35};
diff --git a/arch/arm/boot/dts/imx6dl-wandboard.dts b/arch/arm/boot/dts/imx6dl-wandboard.dts
new file mode 100644
index 000000000000..bfc59c3566a4
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-wandboard.dts
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * Author: Fabio Estevam <fabio.estevam@freescale.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11/dts-v1/;
12#include "imx6dl.dtsi"
13
14/ {
15 model = "Wandboard i.MX6 Dual Lite Board";
16 compatible = "wand,imx6dl-wandboard", "fsl,imx6dl";
17
18 memory {
19 reg = <0x10000000 0x40000000>;
20 };
21};
22
23&fec {
24 pinctrl-names = "default";
25 pinctrl-0 = <&pinctrl_enet_1>;
26 phy-mode = "rgmii";
27 status = "okay";
28};
29
30&uart1 {
31 pinctrl-names = "default";
32 pinctrl-0 = <&pinctrl_uart1_1>;
33 status = "okay";
34};
35
36&usbh1 {
37 status = "okay";
38};
39
40&usdhc3 {
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_usdhc3_2>;
43 status = "okay";
44};
diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi
index 63fafe2a606c..5bcdf3a90bb3 100644
--- a/arch/arm/boot/dts/imx6dl.dtsi
+++ b/arch/arm/boot/dts/imx6dl.dtsi
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * Copyright 2013 Freescale Semiconductor, Inc. 3 * Copyright 2013 Freescale Semiconductor, Inc.
3 * 4 *
@@ -7,7 +8,8 @@
7 * 8 *
8 */ 9 */
9 10
10/include/ "imx6qdl.dtsi" 11#include "imx6qdl.dtsi"
12#include "imx6dl-pinfunc.h"
11 13
12/ { 14/ {
13 cpus { 15 cpus {
@@ -29,6 +31,127 @@
29 31
30 soc { 32 soc {
31 aips1: aips-bus@02000000 { 33 aips1: aips-bus@02000000 {
34 iomuxc: iomuxc@020e0000 {
35 compatible = "fsl,imx6dl-iomuxc";
36 reg = <0x020e0000 0x4000>;
37
38 enet {
39 pinctrl_enet_1: enetgrp-1 {
40 fsl,pins = <
41 MX6DL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
42 MX6DL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
43 MX6DL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
44 MX6DL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
45 MX6DL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
46 MX6DL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
47 MX6DL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
48 MX6DL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
49 MX6DL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
50 MX6DL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
51 MX6DL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
52 MX6DL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
53 MX6DL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
54 MX6DL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
55 MX6DL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
56 MX6DL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
57 >;
58 };
59
60 pinctrl_enet_2: enetgrp-2 {
61 fsl,pins = <
62 MX6DL_PAD_KEY_COL1__ENET_MDIO 0x1b0b0
63 MX6DL_PAD_KEY_COL2__ENET_MDC 0x1b0b0
64 MX6DL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
65 MX6DL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
66 MX6DL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
67 MX6DL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
68 MX6DL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
69 MX6DL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
70 MX6DL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
71 MX6DL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
72 MX6DL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
73 MX6DL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
74 MX6DL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
75 MX6DL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
76 MX6DL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
77 >;
78 };
79 };
80
81 uart1 {
82 pinctrl_uart1_1: uart1grp-1 {
83 fsl,pins = <
84 MX6DL_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
85 MX6DL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
86 >;
87 };
88 };
89
90 uart4 {
91 pinctrl_uart4_1: uart4grp-1 {
92 fsl,pins = <
93 MX6DL_PAD_KEY_COL0__UART4_TX_DATA 0x1b0b1
94 MX6DL_PAD_KEY_ROW0__UART4_RX_DATA 0x1b0b1
95 >;
96 };
97 };
98
99 usbotg {
100 pinctrl_usbotg_2: usbotggrp-2 {
101 fsl,pins = <
102 MX6DL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059
103 >;
104 };
105 };
106
107 usdhc2 {
108 pinctrl_usdhc2_1: usdhc2grp-1 {
109 fsl,pins = <
110 MX6DL_PAD_SD2_CMD__SD2_CMD 0x17059
111 MX6DL_PAD_SD2_CLK__SD2_CLK 0x10059
112 MX6DL_PAD_SD2_DAT0__SD2_DATA0 0x17059
113 MX6DL_PAD_SD2_DAT1__SD2_DATA1 0x17059
114 MX6DL_PAD_SD2_DAT2__SD2_DATA2 0x17059
115 MX6DL_PAD_SD2_DAT3__SD2_DATA3 0x17059
116 MX6DL_PAD_NANDF_D4__SD2_DATA4 0x17059
117 MX6DL_PAD_NANDF_D5__SD2_DATA5 0x17059
118 MX6DL_PAD_NANDF_D6__SD2_DATA6 0x17059
119 MX6DL_PAD_NANDF_D7__SD2_DATA7 0x17059
120 >;
121 };
122 };
123
124 usdhc3 {
125 pinctrl_usdhc3_1: usdhc3grp-1 {
126 fsl,pins = <
127 MX6DL_PAD_SD3_CMD__SD3_CMD 0x17059
128 MX6DL_PAD_SD3_CLK__SD3_CLK 0x10059
129 MX6DL_PAD_SD3_DAT0__SD3_DATA0 0x17059
130 MX6DL_PAD_SD3_DAT1__SD3_DATA1 0x17059
131 MX6DL_PAD_SD3_DAT2__SD3_DATA2 0x17059
132 MX6DL_PAD_SD3_DAT3__SD3_DATA3 0x17059
133 MX6DL_PAD_SD3_DAT4__SD3_DATA4 0x17059
134 MX6DL_PAD_SD3_DAT5__SD3_DATA5 0x17059
135 MX6DL_PAD_SD3_DAT6__SD3_DATA6 0x17059
136 MX6DL_PAD_SD3_DAT7__SD3_DATA7 0x17059
137 >;
138 };
139
140 pinctrl_usdhc3_2: usdhc3grp_2 {
141 fsl,pins = <
142 MX6DL_PAD_SD3_CMD__SD3_CMD 0x17059
143 MX6DL_PAD_SD3_CLK__SD3_CLK 0x10059
144 MX6DL_PAD_SD3_DAT0__SD3_DATA0 0x17059
145 MX6DL_PAD_SD3_DAT1__SD3_DATA1 0x17059
146 MX6DL_PAD_SD3_DAT2__SD3_DATA2 0x17059
147 MX6DL_PAD_SD3_DAT3__SD3_DATA3 0x17059
148 >;
149 };
150 };
151
152
153 };
154
32 pxp: pxp@020f0000 { 155 pxp: pxp@020f0000 {
33 reg = <0x020f0000 0x4000>; 156 reg = <0x020f0000 0x4000>;
34 interrupts = <0 98 0x04>; 157 interrupts = <0 98 0x04>;
diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts
index 53eb241fa5ad..4e54fde591bd 100644
--- a/arch/arm/boot/dts/imx6q-arm2.dts
+++ b/arch/arm/boot/dts/imx6q-arm2.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx6q.dtsi" 14#include "imx6q.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX6 Quad Armadillo2 Board"; 17 model = "Freescale i.MX6 Quad Armadillo2 Board";
@@ -57,7 +57,7 @@
57 hog { 57 hog {
58 pinctrl_hog: hoggrp { 58 pinctrl_hog: hoggrp {
59 fsl,pins = < 59 fsl,pins = <
60 176 0x80000000 /* MX6Q_PAD_EIM_D25__GPIO_3_25 */ 60 MX6Q_PAD_EIM_D25__GPIO3_IO25 0x80000000
61 >; 61 >;
62 }; 62 };
63 }; 63 };
@@ -65,8 +65,8 @@
65 arm2 { 65 arm2 {
66 pinctrl_usdhc3_arm2: usdhc3grp-arm2 { 66 pinctrl_usdhc3_arm2: usdhc3grp-arm2 {
67 fsl,pins = < 67 fsl,pins = <
68 1363 0x80000000 /* MX6Q_PAD_NANDF_CS0__GPIO_6_11 */ 68 MX6Q_PAD_NANDF_CS0__GPIO6_IO11 0x80000000
69 1369 0x80000000 /* MX6Q_PAD_NANDF_CS1__GPIO_6_14 */ 69 MX6Q_PAD_NANDF_CS1__GPIO6_IO14 0x80000000
70 >; 70 >;
71 }; 71 };
72 }; 72 };
diff --git a/arch/arm/boot/dts/imx6q-pinfunc.h b/arch/arm/boot/dts/imx6q-pinfunc.h
new file mode 100644
index 000000000000..faea6e1ada00
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-pinfunc.h
@@ -0,0 +1,1041 @@
1/*
2 * Copyright 2013 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
10#ifndef __DTS_IMX6Q_PINFUNC_H
11#define __DTS_IMX6Q_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX6Q_PAD_SD2_DAT1__SD2_DATA1 0x04c 0x360 0x000 0x0 0x0
18#define MX6Q_PAD_SD2_DAT1__ECSPI5_SS0 0x04c 0x360 0x834 0x1 0x0
19#define MX6Q_PAD_SD2_DAT1__EIM_CS2_B 0x04c 0x360 0x000 0x2 0x0
20#define MX6Q_PAD_SD2_DAT1__AUD4_TXFS 0x04c 0x360 0x7c8 0x3 0x0
21#define MX6Q_PAD_SD2_DAT1__KEY_COL7 0x04c 0x360 0x8f0 0x4 0x0
22#define MX6Q_PAD_SD2_DAT1__GPIO1_IO14 0x04c 0x360 0x000 0x5 0x0
23#define MX6Q_PAD_SD2_DAT2__SD2_DATA2 0x050 0x364 0x000 0x0 0x0
24#define MX6Q_PAD_SD2_DAT2__ECSPI5_SS1 0x050 0x364 0x838 0x1 0x0
25#define MX6Q_PAD_SD2_DAT2__EIM_CS3_B 0x050 0x364 0x000 0x2 0x0
26#define MX6Q_PAD_SD2_DAT2__AUD4_TXD 0x050 0x364 0x7b8 0x3 0x0
27#define MX6Q_PAD_SD2_DAT2__KEY_ROW6 0x050 0x364 0x8f8 0x4 0x0
28#define MX6Q_PAD_SD2_DAT2__GPIO1_IO13 0x050 0x364 0x000 0x5 0x0
29#define MX6Q_PAD_SD2_DAT0__SD2_DATA0 0x054 0x368 0x000 0x0 0x0
30#define MX6Q_PAD_SD2_DAT0__ECSPI5_MISO 0x054 0x368 0x82c 0x1 0x0
31#define MX6Q_PAD_SD2_DAT0__AUD4_RXD 0x054 0x368 0x7b4 0x3 0x0
32#define MX6Q_PAD_SD2_DAT0__KEY_ROW7 0x054 0x368 0x8fc 0x4 0x0
33#define MX6Q_PAD_SD2_DAT0__GPIO1_IO15 0x054 0x368 0x000 0x5 0x0
34#define MX6Q_PAD_SD2_DAT0__DCIC2_OUT 0x054 0x368 0x000 0x6 0x0
35#define MX6Q_PAD_RGMII_TXC__USB_H2_DATA 0x058 0x36c 0x000 0x0 0x0
36#define MX6Q_PAD_RGMII_TXC__RGMII_TXC 0x058 0x36c 0x000 0x1 0x0
37#define MX6Q_PAD_RGMII_TXC__SPDIF_EXT_CLK 0x058 0x36c 0x918 0x2 0x0
38#define MX6Q_PAD_RGMII_TXC__GPIO6_IO19 0x058 0x36c 0x000 0x5 0x0
39#define MX6Q_PAD_RGMII_TXC__XTALOSC_REF_CLK_24M 0x058 0x36c 0x000 0x7 0x0
40#define MX6Q_PAD_RGMII_TD0__HSI_TX_READY 0x05c 0x370 0x000 0x0 0x0
41#define MX6Q_PAD_RGMII_TD0__RGMII_TD0 0x05c 0x370 0x000 0x1 0x0
42#define MX6Q_PAD_RGMII_TD0__GPIO6_IO20 0x05c 0x370 0x000 0x5 0x0
43#define MX6Q_PAD_RGMII_TD1__HSI_RX_FLAG 0x060 0x374 0x000 0x0 0x0
44#define MX6Q_PAD_RGMII_TD1__RGMII_TD1 0x060 0x374 0x000 0x1 0x0
45#define MX6Q_PAD_RGMII_TD1__GPIO6_IO21 0x060 0x374 0x000 0x5 0x0
46#define MX6Q_PAD_RGMII_TD2__HSI_RX_DATA 0x064 0x378 0x000 0x0 0x0
47#define MX6Q_PAD_RGMII_TD2__RGMII_TD2 0x064 0x378 0x000 0x1 0x0
48#define MX6Q_PAD_RGMII_TD2__GPIO6_IO22 0x064 0x378 0x000 0x5 0x0
49#define MX6Q_PAD_RGMII_TD3__HSI_RX_WAKE 0x068 0x37c 0x000 0x0 0x0
50#define MX6Q_PAD_RGMII_TD3__RGMII_TD3 0x068 0x37c 0x000 0x1 0x0
51#define MX6Q_PAD_RGMII_TD3__GPIO6_IO23 0x068 0x37c 0x000 0x5 0x0
52#define MX6Q_PAD_RGMII_RX_CTL__USB_H3_DATA 0x06c 0x380 0x000 0x0 0x0
53#define MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x06c 0x380 0x858 0x1 0x0
54#define MX6Q_PAD_RGMII_RX_CTL__GPIO6_IO24 0x06c 0x380 0x000 0x5 0x0
55#define MX6Q_PAD_RGMII_RD0__HSI_RX_READY 0x070 0x384 0x000 0x0 0x0
56#define MX6Q_PAD_RGMII_RD0__RGMII_RD0 0x070 0x384 0x848 0x1 0x0
57#define MX6Q_PAD_RGMII_RD0__GPIO6_IO25 0x070 0x384 0x000 0x5 0x0
58#define MX6Q_PAD_RGMII_TX_CTL__USB_H2_STROBE 0x074 0x388 0x000 0x0 0x0
59#define MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x074 0x388 0x000 0x1 0x0
60#define MX6Q_PAD_RGMII_TX_CTL__GPIO6_IO26 0x074 0x388 0x000 0x5 0x0
61#define MX6Q_PAD_RGMII_TX_CTL__ENET_REF_CLK 0x074 0x388 0x83c 0x7 0x0
62#define MX6Q_PAD_RGMII_RD1__HSI_TX_FLAG 0x078 0x38c 0x000 0x0 0x0
63#define MX6Q_PAD_RGMII_RD1__RGMII_RD1 0x078 0x38c 0x84c 0x1 0x0
64#define MX6Q_PAD_RGMII_RD1__GPIO6_IO27 0x078 0x38c 0x000 0x5 0x0
65#define MX6Q_PAD_RGMII_RD2__HSI_TX_DATA 0x07c 0x390 0x000 0x0 0x0
66#define MX6Q_PAD_RGMII_RD2__RGMII_RD2 0x07c 0x390 0x850 0x1 0x0
67#define MX6Q_PAD_RGMII_RD2__GPIO6_IO28 0x07c 0x390 0x000 0x5 0x0
68#define MX6Q_PAD_RGMII_RD3__HSI_TX_WAKE 0x080 0x394 0x000 0x0 0x0
69#define MX6Q_PAD_RGMII_RD3__RGMII_RD3 0x080 0x394 0x854 0x1 0x0
70#define MX6Q_PAD_RGMII_RD3__GPIO6_IO29 0x080 0x394 0x000 0x5 0x0
71#define MX6Q_PAD_RGMII_RXC__USB_H3_STROBE 0x084 0x398 0x000 0x0 0x0
72#define MX6Q_PAD_RGMII_RXC__RGMII_RXC 0x084 0x398 0x844 0x1 0x0
73#define MX6Q_PAD_RGMII_RXC__GPIO6_IO30 0x084 0x398 0x000 0x5 0x0
74#define MX6Q_PAD_EIM_A25__EIM_ADDR25 0x088 0x39c 0x000 0x0 0x0
75#define MX6Q_PAD_EIM_A25__ECSPI4_SS1 0x088 0x39c 0x000 0x1 0x0
76#define MX6Q_PAD_EIM_A25__ECSPI2_RDY 0x088 0x39c 0x000 0x2 0x0
77#define MX6Q_PAD_EIM_A25__IPU1_DI1_PIN12 0x088 0x39c 0x000 0x3 0x0
78#define MX6Q_PAD_EIM_A25__IPU1_DI0_D1_CS 0x088 0x39c 0x000 0x4 0x0
79#define MX6Q_PAD_EIM_A25__GPIO5_IO02 0x088 0x39c 0x000 0x5 0x0
80#define MX6Q_PAD_EIM_A25__HDMI_TX_CEC_LINE 0x088 0x39c 0x88c 0x6 0x0
81#define MX6Q_PAD_EIM_EB2__EIM_EB2_B 0x08c 0x3a0 0x000 0x0 0x0
82#define MX6Q_PAD_EIM_EB2__ECSPI1_SS0 0x08c 0x3a0 0x800 0x1 0x0
83#define MX6Q_PAD_EIM_EB2__IPU2_CSI1_DATA19 0x08c 0x3a0 0x8d4 0x3 0x0
84#define MX6Q_PAD_EIM_EB2__HDMI_TX_DDC_SCL 0x08c 0x3a0 0x890 0x4 0x0
85#define MX6Q_PAD_EIM_EB2__GPIO2_IO30 0x08c 0x3a0 0x000 0x5 0x0
86#define MX6Q_PAD_EIM_EB2__I2C2_SCL 0x08c 0x3a0 0x8a0 0x6 0x0
87#define MX6Q_PAD_EIM_EB2__SRC_BOOT_CFG30 0x08c 0x3a0 0x000 0x7 0x0
88#define MX6Q_PAD_EIM_D16__EIM_DATA16 0x090 0x3a4 0x000 0x0 0x0
89#define MX6Q_PAD_EIM_D16__ECSPI1_SCLK 0x090 0x3a4 0x7f4 0x1 0x0
90#define MX6Q_PAD_EIM_D16__IPU1_DI0_PIN05 0x090 0x3a4 0x000 0x2 0x0
91#define MX6Q_PAD_EIM_D16__IPU2_CSI1_DATA18 0x090 0x3a4 0x8d0 0x3 0x0
92#define MX6Q_PAD_EIM_D16__HDMI_TX_DDC_SDA 0x090 0x3a4 0x894 0x4 0x0
93#define MX6Q_PAD_EIM_D16__GPIO3_IO16 0x090 0x3a4 0x000 0x5 0x0
94#define MX6Q_PAD_EIM_D16__I2C2_SDA 0x090 0x3a4 0x8a4 0x6 0x0
95#define MX6Q_PAD_EIM_D17__EIM_DATA17 0x094 0x3a8 0x000 0x0 0x0
96#define MX6Q_PAD_EIM_D17__ECSPI1_MISO 0x094 0x3a8 0x7f8 0x1 0x0
97#define MX6Q_PAD_EIM_D17__IPU1_DI0_PIN06 0x094 0x3a8 0x000 0x2 0x0
98#define MX6Q_PAD_EIM_D17__IPU2_CSI1_PIXCLK 0x094 0x3a8 0x8e0 0x3 0x0
99#define MX6Q_PAD_EIM_D17__DCIC1_OUT 0x094 0x3a8 0x000 0x4 0x0
100#define MX6Q_PAD_EIM_D17__GPIO3_IO17 0x094 0x3a8 0x000 0x5 0x0
101#define MX6Q_PAD_EIM_D17__I2C3_SCL 0x094 0x3a8 0x8a8 0x6 0x0
102#define MX6Q_PAD_EIM_D18__EIM_DATA18 0x098 0x3ac 0x000 0x0 0x0
103#define MX6Q_PAD_EIM_D18__ECSPI1_MOSI 0x098 0x3ac 0x7fc 0x1 0x0
104#define MX6Q_PAD_EIM_D18__IPU1_DI0_PIN07 0x098 0x3ac 0x000 0x2 0x0
105#define MX6Q_PAD_EIM_D18__IPU2_CSI1_DATA17 0x098 0x3ac 0x8cc 0x3 0x0
106#define MX6Q_PAD_EIM_D18__IPU1_DI1_D0_CS 0x098 0x3ac 0x000 0x4 0x0
107#define MX6Q_PAD_EIM_D18__GPIO3_IO18 0x098 0x3ac 0x000 0x5 0x0
108#define MX6Q_PAD_EIM_D18__I2C3_SDA 0x098 0x3ac 0x8ac 0x6 0x0
109#define MX6Q_PAD_EIM_D19__EIM_DATA19 0x09c 0x3b0 0x000 0x0 0x0
110#define MX6Q_PAD_EIM_D19__ECSPI1_SS1 0x09c 0x3b0 0x804 0x1 0x0
111#define MX6Q_PAD_EIM_D19__IPU1_DI0_PIN08 0x09c 0x3b0 0x000 0x2 0x0
112#define MX6Q_PAD_EIM_D19__IPU2_CSI1_DATA16 0x09c 0x3b0 0x8c8 0x3 0x0
113#define MX6Q_PAD_EIM_D19__UART1_CTS_B 0x09c 0x3b0 0x000 0x4 0x0
114#define MX6Q_PAD_EIM_D19__UART1_RTS_B 0x09c 0x3b0 0x91c 0x4 0x0
115#define MX6Q_PAD_EIM_D19__GPIO3_IO19 0x09c 0x3b0 0x000 0x5 0x0
116#define MX6Q_PAD_EIM_D19__EPIT1_OUT 0x09c 0x3b0 0x000 0x6 0x0
117#define MX6Q_PAD_EIM_D20__EIM_DATA20 0x0a0 0x3b4 0x000 0x0 0x0
118#define MX6Q_PAD_EIM_D20__ECSPI4_SS0 0x0a0 0x3b4 0x824 0x1 0x0
119#define MX6Q_PAD_EIM_D20__IPU1_DI0_PIN16 0x0a0 0x3b4 0x000 0x2 0x0
120#define MX6Q_PAD_EIM_D20__IPU2_CSI1_DATA15 0x0a0 0x3b4 0x8c4 0x3 0x0
121#define MX6Q_PAD_EIM_D20__UART1_RTS_B 0x0a0 0x3b4 0x91c 0x4 0x1
122#define MX6Q_PAD_EIM_D20__UART1_CTS_B 0x0a0 0x3b4 0x000 0x4 0x0
123#define MX6Q_PAD_EIM_D20__GPIO3_IO20 0x0a0 0x3b4 0x000 0x5 0x0
124#define MX6Q_PAD_EIM_D20__EPIT2_OUT 0x0a0 0x3b4 0x000 0x6 0x0
125#define MX6Q_PAD_EIM_D21__EIM_DATA21 0x0a4 0x3b8 0x000 0x0 0x0
126#define MX6Q_PAD_EIM_D21__ECSPI4_SCLK 0x0a4 0x3b8 0x000 0x1 0x0
127#define MX6Q_PAD_EIM_D21__IPU1_DI0_PIN17 0x0a4 0x3b8 0x000 0x2 0x0
128#define MX6Q_PAD_EIM_D21__IPU2_CSI1_DATA11 0x0a4 0x3b8 0x8b4 0x3 0x0
129#define MX6Q_PAD_EIM_D21__USB_OTG_OC 0x0a4 0x3b8 0x944 0x4 0x0
130#define MX6Q_PAD_EIM_D21__GPIO3_IO21 0x0a4 0x3b8 0x000 0x5 0x0
131#define MX6Q_PAD_EIM_D21__I2C1_SCL 0x0a4 0x3b8 0x898 0x6 0x0
132#define MX6Q_PAD_EIM_D21__SPDIF_IN 0x0a4 0x3b8 0x914 0x7 0x0
133#define MX6Q_PAD_EIM_D22__EIM_DATA22 0x0a8 0x3bc 0x000 0x0 0x0
134#define MX6Q_PAD_EIM_D22__ECSPI4_MISO 0x0a8 0x3bc 0x000 0x1 0x0
135#define MX6Q_PAD_EIM_D22__IPU1_DI0_PIN01 0x0a8 0x3bc 0x000 0x2 0x0
136#define MX6Q_PAD_EIM_D22__IPU2_CSI1_DATA10 0x0a8 0x3bc 0x8b0 0x3 0x0
137#define MX6Q_PAD_EIM_D22__USB_OTG_PWR 0x0a8 0x3bc 0x000 0x4 0x0
138#define MX6Q_PAD_EIM_D22__GPIO3_IO22 0x0a8 0x3bc 0x000 0x5 0x0
139#define MX6Q_PAD_EIM_D22__SPDIF_OUT 0x0a8 0x3bc 0x000 0x6 0x0
140#define MX6Q_PAD_EIM_D23__EIM_DATA23 0x0ac 0x3c0 0x000 0x0 0x0
141#define MX6Q_PAD_EIM_D23__IPU1_DI0_D0_CS 0x0ac 0x3c0 0x000 0x1 0x0
142#define MX6Q_PAD_EIM_D23__UART3_CTS_B 0x0ac 0x3c0 0x000 0x2 0x0
143#define MX6Q_PAD_EIM_D23__UART3_RTS_B 0x0ac 0x3c0 0x92c 0x2 0x0
144#define MX6Q_PAD_EIM_D23__UART1_DCD_B 0x0ac 0x3c0 0x000 0x3 0x0
145#define MX6Q_PAD_EIM_D23__IPU2_CSI1_DATA_EN 0x0ac 0x3c0 0x8d8 0x4 0x0
146#define MX6Q_PAD_EIM_D23__GPIO3_IO23 0x0ac 0x3c0 0x000 0x5 0x0
147#define MX6Q_PAD_EIM_D23__IPU1_DI1_PIN02 0x0ac 0x3c0 0x000 0x6 0x0
148#define MX6Q_PAD_EIM_D23__IPU1_DI1_PIN14 0x0ac 0x3c0 0x000 0x7 0x0
149#define MX6Q_PAD_EIM_EB3__EIM_EB3_B 0x0b0 0x3c4 0x000 0x0 0x0
150#define MX6Q_PAD_EIM_EB3__ECSPI4_RDY 0x0b0 0x3c4 0x000 0x1 0x0
151#define MX6Q_PAD_EIM_EB3__UART3_RTS_B 0x0b0 0x3c4 0x92c 0x2 0x1
152#define MX6Q_PAD_EIM_EB3__UART3_CTS_B 0x0b0 0x3c4 0x000 0x2 0x0
153#define MX6Q_PAD_EIM_EB3__UART1_RI_B 0x0b0 0x3c4 0x000 0x3 0x0
154#define MX6Q_PAD_EIM_EB3__IPU2_CSI1_HSYNC 0x0b0 0x3c4 0x8dc 0x4 0x0
155#define MX6Q_PAD_EIM_EB3__GPIO2_IO31 0x0b0 0x3c4 0x000 0x5 0x0
156#define MX6Q_PAD_EIM_EB3__IPU1_DI1_PIN03 0x0b0 0x3c4 0x000 0x6 0x0
157#define MX6Q_PAD_EIM_EB3__SRC_BOOT_CFG31 0x0b0 0x3c4 0x000 0x7 0x0
158#define MX6Q_PAD_EIM_D24__EIM_DATA24 0x0b4 0x3c8 0x000 0x0 0x0
159#define MX6Q_PAD_EIM_D24__ECSPI4_SS2 0x0b4 0x3c8 0x000 0x1 0x0
160#define MX6Q_PAD_EIM_D24__UART3_TX_DATA 0x0b4 0x3c8 0x000 0x2 0x0
161#define MX6Q_PAD_EIM_D24__UART3_RX_DATA 0x0b4 0x3c8 0x930 0x2 0x0
162#define MX6Q_PAD_EIM_D24__ECSPI1_SS2 0x0b4 0x3c8 0x808 0x3 0x0
163#define MX6Q_PAD_EIM_D24__ECSPI2_SS2 0x0b4 0x3c8 0x000 0x4 0x0
164#define MX6Q_PAD_EIM_D24__GPIO3_IO24 0x0b4 0x3c8 0x000 0x5 0x0
165#define MX6Q_PAD_EIM_D24__AUD5_RXFS 0x0b4 0x3c8 0x7d8 0x6 0x0
166#define MX6Q_PAD_EIM_D24__UART1_DTR_B 0x0b4 0x3c8 0x000 0x7 0x0
167#define MX6Q_PAD_EIM_D25__EIM_DATA25 0x0b8 0x3cc 0x000 0x0 0x0
168#define MX6Q_PAD_EIM_D25__ECSPI4_SS3 0x0b8 0x3cc 0x000 0x1 0x0
169#define MX6Q_PAD_EIM_D25__UART3_RX_DATA 0x0b8 0x3cc 0x930 0x2 0x1
170#define MX6Q_PAD_EIM_D25__UART3_TX_DATA 0x0b8 0x3cc 0x000 0x2 0x0
171#define MX6Q_PAD_EIM_D25__ECSPI1_SS3 0x0b8 0x3cc 0x80c 0x3 0x0
172#define MX6Q_PAD_EIM_D25__ECSPI2_SS3 0x0b8 0x3cc 0x000 0x4 0x0
173#define MX6Q_PAD_EIM_D25__GPIO3_IO25 0x0b8 0x3cc 0x000 0x5 0x0
174#define MX6Q_PAD_EIM_D25__AUD5_RXC 0x0b8 0x3cc 0x7d4 0x6 0x0
175#define MX6Q_PAD_EIM_D25__UART1_DSR_B 0x0b8 0x3cc 0x000 0x7 0x0
176#define MX6Q_PAD_EIM_D26__EIM_DATA26 0x0bc 0x3d0 0x000 0x0 0x0
177#define MX6Q_PAD_EIM_D26__IPU1_DI1_PIN11 0x0bc 0x3d0 0x000 0x1 0x0
178#define MX6Q_PAD_EIM_D26__IPU1_CSI0_DATA01 0x0bc 0x3d0 0x000 0x2 0x0
179#define MX6Q_PAD_EIM_D26__IPU2_CSI1_DATA14 0x0bc 0x3d0 0x8c0 0x3 0x0
180#define MX6Q_PAD_EIM_D26__UART2_TX_DATA 0x0bc 0x3d0 0x000 0x4 0x0
181#define MX6Q_PAD_EIM_D26__UART2_RX_DATA 0x0bc 0x3d0 0x928 0x4 0x0
182#define MX6Q_PAD_EIM_D26__GPIO3_IO26 0x0bc 0x3d0 0x000 0x5 0x0
183#define MX6Q_PAD_EIM_D26__IPU1_SISG2 0x0bc 0x3d0 0x000 0x6 0x0
184#define MX6Q_PAD_EIM_D26__IPU1_DISP1_DATA22 0x0bc 0x3d0 0x000 0x7 0x0
185#define MX6Q_PAD_EIM_D27__EIM_DATA27 0x0c0 0x3d4 0x000 0x0 0x0
186#define MX6Q_PAD_EIM_D27__IPU1_DI1_PIN13 0x0c0 0x3d4 0x000 0x1 0x0
187#define MX6Q_PAD_EIM_D27__IPU1_CSI0_DATA00 0x0c0 0x3d4 0x000 0x2 0x0
188#define MX6Q_PAD_EIM_D27__IPU2_CSI1_DATA13 0x0c0 0x3d4 0x8bc 0x3 0x0
189#define MX6Q_PAD_EIM_D27__UART2_RX_DATA 0x0c0 0x3d4 0x928 0x4 0x1
190#define MX6Q_PAD_EIM_D27__UART2_TX_DATA 0x0c0 0x3d4 0x000 0x4 0x0
191#define MX6Q_PAD_EIM_D27__GPIO3_IO27 0x0c0 0x3d4 0x000 0x5 0x0
192#define MX6Q_PAD_EIM_D27__IPU1_SISG3 0x0c0 0x3d4 0x000 0x6 0x0
193#define MX6Q_PAD_EIM_D27__IPU1_DISP1_DATA23 0x0c0 0x3d4 0x000 0x7 0x0
194#define MX6Q_PAD_EIM_D28__EIM_DATA28 0x0c4 0x3d8 0x000 0x0 0x0
195#define MX6Q_PAD_EIM_D28__I2C1_SDA 0x0c4 0x3d8 0x89c 0x1 0x0
196#define MX6Q_PAD_EIM_D28__ECSPI4_MOSI 0x0c4 0x3d8 0x000 0x2 0x0
197#define MX6Q_PAD_EIM_D28__IPU2_CSI1_DATA12 0x0c4 0x3d8 0x8b8 0x3 0x0
198#define MX6Q_PAD_EIM_D28__UART2_CTS_B 0x0c4 0x3d8 0x000 0x4 0x0
199#define MX6Q_PAD_EIM_D28__UART2_RTS_B 0x0c4 0x3d8 0x924 0x4 0x0
200#define MX6Q_PAD_EIM_D28__GPIO3_IO28 0x0c4 0x3d8 0x000 0x5 0x0
201#define MX6Q_PAD_EIM_D28__IPU1_EXT_TRIG 0x0c4 0x3d8 0x000 0x6 0x0
202#define MX6Q_PAD_EIM_D28__IPU1_DI0_PIN13 0x0c4 0x3d8 0x000 0x7 0x0
203#define MX6Q_PAD_EIM_D29__EIM_DATA29 0x0c8 0x3dc 0x000 0x0 0x0
204#define MX6Q_PAD_EIM_D29__IPU1_DI1_PIN15 0x0c8 0x3dc 0x000 0x1 0x0
205#define MX6Q_PAD_EIM_D29__ECSPI4_SS0 0x0c8 0x3dc 0x824 0x2 0x1
206#define MX6Q_PAD_EIM_D29__UART2_RTS_B 0x0c8 0x3dc 0x924 0x4 0x1
207#define MX6Q_PAD_EIM_D29__UART2_CTS_B 0x0c8 0x3dc 0x000 0x4 0x0
208#define MX6Q_PAD_EIM_D29__GPIO3_IO29 0x0c8 0x3dc 0x000 0x5 0x0
209#define MX6Q_PAD_EIM_D29__IPU2_CSI1_VSYNC 0x0c8 0x3dc 0x8e4 0x6 0x0
210#define MX6Q_PAD_EIM_D29__IPU1_DI0_PIN14 0x0c8 0x3dc 0x000 0x7 0x0
211#define MX6Q_PAD_EIM_D30__EIM_DATA30 0x0cc 0x3e0 0x000 0x0 0x0
212#define MX6Q_PAD_EIM_D30__IPU1_DISP1_DATA21 0x0cc 0x3e0 0x000 0x1 0x0
213#define MX6Q_PAD_EIM_D30__IPU1_DI0_PIN11 0x0cc 0x3e0 0x000 0x2 0x0
214#define MX6Q_PAD_EIM_D30__IPU1_CSI0_DATA03 0x0cc 0x3e0 0x000 0x3 0x0
215#define MX6Q_PAD_EIM_D30__UART3_CTS_B 0x0cc 0x3e0 0x000 0x4 0x0
216#define MX6Q_PAD_EIM_D30__UART3_RTS_B 0x0cc 0x3e0 0x92c 0x4 0x2
217#define MX6Q_PAD_EIM_D30__GPIO3_IO30 0x0cc 0x3e0 0x000 0x5 0x0
218#define MX6Q_PAD_EIM_D30__USB_H1_OC 0x0cc 0x3e0 0x948 0x6 0x0
219#define MX6Q_PAD_EIM_D31__EIM_DATA31 0x0d0 0x3e4 0x000 0x0 0x0
220#define MX6Q_PAD_EIM_D31__IPU1_DISP1_DATA20 0x0d0 0x3e4 0x000 0x1 0x0
221#define MX6Q_PAD_EIM_D31__IPU1_DI0_PIN12 0x0d0 0x3e4 0x000 0x2 0x0
222#define MX6Q_PAD_EIM_D31__IPU1_CSI0_DATA02 0x0d0 0x3e4 0x000 0x3 0x0
223#define MX6Q_PAD_EIM_D31__UART3_RTS_B 0x0d0 0x3e4 0x92c 0x4 0x3
224#define MX6Q_PAD_EIM_D31__UART3_CTS_B 0x0d0 0x3e4 0x000 0x4 0x0
225#define MX6Q_PAD_EIM_D31__GPIO3_IO31 0x0d0 0x3e4 0x000 0x5 0x0
226#define MX6Q_PAD_EIM_D31__USB_H1_PWR 0x0d0 0x3e4 0x000 0x6 0x0
227#define MX6Q_PAD_EIM_A24__EIM_ADDR24 0x0d4 0x3e8 0x000 0x0 0x0
228#define MX6Q_PAD_EIM_A24__IPU1_DISP1_DATA19 0x0d4 0x3e8 0x000 0x1 0x0
229#define MX6Q_PAD_EIM_A24__IPU2_CSI1_DATA19 0x0d4 0x3e8 0x8d4 0x2 0x1
230#define MX6Q_PAD_EIM_A24__IPU2_SISG2 0x0d4 0x3e8 0x000 0x3 0x0
231#define MX6Q_PAD_EIM_A24__IPU1_SISG2 0x0d4 0x3e8 0x000 0x4 0x0
232#define MX6Q_PAD_EIM_A24__GPIO5_IO04 0x0d4 0x3e8 0x000 0x5 0x0
233#define MX6Q_PAD_EIM_A24__SRC_BOOT_CFG24 0x0d4 0x3e8 0x000 0x7 0x0
234#define MX6Q_PAD_EIM_A23__EIM_ADDR23 0x0d8 0x3ec 0x000 0x0 0x0
235#define MX6Q_PAD_EIM_A23__IPU1_DISP1_DATA18 0x0d8 0x3ec 0x000 0x1 0x0
236#define MX6Q_PAD_EIM_A23__IPU2_CSI1_DATA18 0x0d8 0x3ec 0x8d0 0x2 0x1
237#define MX6Q_PAD_EIM_A23__IPU2_SISG3 0x0d8 0x3ec 0x000 0x3 0x0
238#define MX6Q_PAD_EIM_A23__IPU1_SISG3 0x0d8 0x3ec 0x000 0x4 0x0
239#define MX6Q_PAD_EIM_A23__GPIO6_IO06 0x0d8 0x3ec 0x000 0x5 0x0
240#define MX6Q_PAD_EIM_A23__SRC_BOOT_CFG23 0x0d8 0x3ec 0x000 0x7 0x0
241#define MX6Q_PAD_EIM_A22__EIM_ADDR22 0x0dc 0x3f0 0x000 0x0 0x0
242#define MX6Q_PAD_EIM_A22__IPU1_DISP1_DATA17 0x0dc 0x3f0 0x000 0x1 0x0
243#define MX6Q_PAD_EIM_A22__IPU2_CSI1_DATA17 0x0dc 0x3f0 0x8cc 0x2 0x1
244#define MX6Q_PAD_EIM_A22__GPIO2_IO16 0x0dc 0x3f0 0x000 0x5 0x0
245#define MX6Q_PAD_EIM_A22__SRC_BOOT_CFG22 0x0dc 0x3f0 0x000 0x7 0x0
246#define MX6Q_PAD_EIM_A21__EIM_ADDR21 0x0e0 0x3f4 0x000 0x0 0x0
247#define MX6Q_PAD_EIM_A21__IPU1_DISP1_DATA16 0x0e0 0x3f4 0x000 0x1 0x0
248#define MX6Q_PAD_EIM_A21__IPU2_CSI1_DATA16 0x0e0 0x3f4 0x8c8 0x2 0x1
249#define MX6Q_PAD_EIM_A21__GPIO2_IO17 0x0e0 0x3f4 0x000 0x5 0x0
250#define MX6Q_PAD_EIM_A21__SRC_BOOT_CFG21 0x0e0 0x3f4 0x000 0x7 0x0
251#define MX6Q_PAD_EIM_A20__EIM_ADDR20 0x0e4 0x3f8 0x000 0x0 0x0
252#define MX6Q_PAD_EIM_A20__IPU1_DISP1_DATA15 0x0e4 0x3f8 0x000 0x1 0x0
253#define MX6Q_PAD_EIM_A20__IPU2_CSI1_DATA15 0x0e4 0x3f8 0x8c4 0x2 0x1
254#define MX6Q_PAD_EIM_A20__GPIO2_IO18 0x0e4 0x3f8 0x000 0x5 0x0
255#define MX6Q_PAD_EIM_A20__SRC_BOOT_CFG20 0x0e4 0x3f8 0x000 0x7 0x0
256#define MX6Q_PAD_EIM_A19__EIM_ADDR19 0x0e8 0x3fc 0x000 0x0 0x0
257#define MX6Q_PAD_EIM_A19__IPU1_DISP1_DATA14 0x0e8 0x3fc 0x000 0x1 0x0
258#define MX6Q_PAD_EIM_A19__IPU2_CSI1_DATA14 0x0e8 0x3fc 0x8c0 0x2 0x1
259#define MX6Q_PAD_EIM_A19__GPIO2_IO19 0x0e8 0x3fc 0x000 0x5 0x0
260#define MX6Q_PAD_EIM_A19__SRC_BOOT_CFG19 0x0e8 0x3fc 0x000 0x7 0x0
261#define MX6Q_PAD_EIM_A18__EIM_ADDR18 0x0ec 0x400 0x000 0x0 0x0
262#define MX6Q_PAD_EIM_A18__IPU1_DISP1_DATA13 0x0ec 0x400 0x000 0x1 0x0
263#define MX6Q_PAD_EIM_A18__IPU2_CSI1_DATA13 0x0ec 0x400 0x8bc 0x2 0x1
264#define MX6Q_PAD_EIM_A18__GPIO2_IO20 0x0ec 0x400 0x000 0x5 0x0
265#define MX6Q_PAD_EIM_A18__SRC_BOOT_CFG18 0x0ec 0x400 0x000 0x7 0x0
266#define MX6Q_PAD_EIM_A17__EIM_ADDR17 0x0f0 0x404 0x000 0x0 0x0
267#define MX6Q_PAD_EIM_A17__IPU1_DISP1_DATA12 0x0f0 0x404 0x000 0x1 0x0
268#define MX6Q_PAD_EIM_A17__IPU2_CSI1_DATA12 0x0f0 0x404 0x8b8 0x2 0x1
269#define MX6Q_PAD_EIM_A17__GPIO2_IO21 0x0f0 0x404 0x000 0x5 0x0
270#define MX6Q_PAD_EIM_A17__SRC_BOOT_CFG17 0x0f0 0x404 0x000 0x7 0x0
271#define MX6Q_PAD_EIM_A16__EIM_ADDR16 0x0f4 0x408 0x000 0x0 0x0
272#define MX6Q_PAD_EIM_A16__IPU1_DI1_DISP_CLK 0x0f4 0x408 0x000 0x1 0x0
273#define MX6Q_PAD_EIM_A16__IPU2_CSI1_PIXCLK 0x0f4 0x408 0x8e0 0x2 0x1
274#define MX6Q_PAD_EIM_A16__GPIO2_IO22 0x0f4 0x408 0x000 0x5 0x0
275#define MX6Q_PAD_EIM_A16__SRC_BOOT_CFG16 0x0f4 0x408 0x000 0x7 0x0
276#define MX6Q_PAD_EIM_CS0__EIM_CS0_B 0x0f8 0x40c 0x000 0x0 0x0
277#define MX6Q_PAD_EIM_CS0__IPU1_DI1_PIN05 0x0f8 0x40c 0x000 0x1 0x0
278#define MX6Q_PAD_EIM_CS0__ECSPI2_SCLK 0x0f8 0x40c 0x810 0x2 0x0
279#define MX6Q_PAD_EIM_CS0__GPIO2_IO23 0x0f8 0x40c 0x000 0x5 0x0
280#define MX6Q_PAD_EIM_CS1__EIM_CS1_B 0x0fc 0x410 0x000 0x0 0x0
281#define MX6Q_PAD_EIM_CS1__IPU1_DI1_PIN06 0x0fc 0x410 0x000 0x1 0x0
282#define MX6Q_PAD_EIM_CS1__ECSPI2_MOSI 0x0fc 0x410 0x818 0x2 0x0
283#define MX6Q_PAD_EIM_CS1__GPIO2_IO24 0x0fc 0x410 0x000 0x5 0x0
284#define MX6Q_PAD_EIM_OE__EIM_OE_B 0x100 0x414 0x000 0x0 0x0
285#define MX6Q_PAD_EIM_OE__IPU1_DI1_PIN07 0x100 0x414 0x000 0x1 0x0
286#define MX6Q_PAD_EIM_OE__ECSPI2_MISO 0x100 0x414 0x814 0x2 0x0
287#define MX6Q_PAD_EIM_OE__GPIO2_IO25 0x100 0x414 0x000 0x5 0x0
288#define MX6Q_PAD_EIM_RW__EIM_RW 0x104 0x418 0x000 0x0 0x0
289#define MX6Q_PAD_EIM_RW__IPU1_DI1_PIN08 0x104 0x418 0x000 0x1 0x0
290#define MX6Q_PAD_EIM_RW__ECSPI2_SS0 0x104 0x418 0x81c 0x2 0x0
291#define MX6Q_PAD_EIM_RW__GPIO2_IO26 0x104 0x418 0x000 0x5 0x0
292#define MX6Q_PAD_EIM_RW__SRC_BOOT_CFG29 0x104 0x418 0x000 0x7 0x0
293#define MX6Q_PAD_EIM_LBA__EIM_LBA_B 0x108 0x41c 0x000 0x0 0x0
294#define MX6Q_PAD_EIM_LBA__IPU1_DI1_PIN17 0x108 0x41c 0x000 0x1 0x0
295#define MX6Q_PAD_EIM_LBA__ECSPI2_SS1 0x108 0x41c 0x820 0x2 0x0
296#define MX6Q_PAD_EIM_LBA__GPIO2_IO27 0x108 0x41c 0x000 0x5 0x0
297#define MX6Q_PAD_EIM_LBA__SRC_BOOT_CFG26 0x108 0x41c 0x000 0x7 0x0
298#define MX6Q_PAD_EIM_EB0__EIM_EB0_B 0x10c 0x420 0x000 0x0 0x0
299#define MX6Q_PAD_EIM_EB0__IPU1_DISP1_DATA11 0x10c 0x420 0x000 0x1 0x0
300#define MX6Q_PAD_EIM_EB0__IPU2_CSI1_DATA11 0x10c 0x420 0x8b4 0x2 0x1
301#define MX6Q_PAD_EIM_EB0__CCM_PMIC_READY 0x10c 0x420 0x7f0 0x4 0x0
302#define MX6Q_PAD_EIM_EB0__GPIO2_IO28 0x10c 0x420 0x000 0x5 0x0
303#define MX6Q_PAD_EIM_EB0__SRC_BOOT_CFG27 0x10c 0x420 0x000 0x7 0x0
304#define MX6Q_PAD_EIM_EB1__EIM_EB1_B 0x110 0x424 0x000 0x0 0x0
305#define MX6Q_PAD_EIM_EB1__IPU1_DISP1_DATA10 0x110 0x424 0x000 0x1 0x0
306#define MX6Q_PAD_EIM_EB1__IPU2_CSI1_DATA10 0x110 0x424 0x8b0 0x2 0x1
307#define MX6Q_PAD_EIM_EB1__GPIO2_IO29 0x110 0x424 0x000 0x5 0x0
308#define MX6Q_PAD_EIM_EB1__SRC_BOOT_CFG28 0x110 0x424 0x000 0x7 0x0
309#define MX6Q_PAD_EIM_DA0__EIM_AD00 0x114 0x428 0x000 0x0 0x0
310#define MX6Q_PAD_EIM_DA0__IPU1_DISP1_DATA09 0x114 0x428 0x000 0x1 0x0
311#define MX6Q_PAD_EIM_DA0__IPU2_CSI1_DATA09 0x114 0x428 0x000 0x2 0x0
312#define MX6Q_PAD_EIM_DA0__GPIO3_IO00 0x114 0x428 0x000 0x5 0x0
313#define MX6Q_PAD_EIM_DA0__SRC_BOOT_CFG00 0x114 0x428 0x000 0x7 0x0
314#define MX6Q_PAD_EIM_DA1__EIM_AD01 0x118 0x42c 0x000 0x0 0x0
315#define MX6Q_PAD_EIM_DA1__IPU1_DISP1_DATA08 0x118 0x42c 0x000 0x1 0x0
316#define MX6Q_PAD_EIM_DA1__IPU2_CSI1_DATA08 0x118 0x42c 0x000 0x2 0x0
317#define MX6Q_PAD_EIM_DA1__GPIO3_IO01 0x118 0x42c 0x000 0x5 0x0
318#define MX6Q_PAD_EIM_DA1__SRC_BOOT_CFG01 0x118 0x42c 0x000 0x7 0x0
319#define MX6Q_PAD_EIM_DA2__EIM_AD02 0x11c 0x430 0x000 0x0 0x0
320#define MX6Q_PAD_EIM_DA2__IPU1_DISP1_DATA07 0x11c 0x430 0x000 0x1 0x0
321#define MX6Q_PAD_EIM_DA2__IPU2_CSI1_DATA07 0x11c 0x430 0x000 0x2 0x0
322#define MX6Q_PAD_EIM_DA2__GPIO3_IO02 0x11c 0x430 0x000 0x5 0x0
323#define MX6Q_PAD_EIM_DA2__SRC_BOOT_CFG02 0x11c 0x430 0x000 0x7 0x0
324#define MX6Q_PAD_EIM_DA3__EIM_AD03 0x120 0x434 0x000 0x0 0x0
325#define MX6Q_PAD_EIM_DA3__IPU1_DISP1_DATA06 0x120 0x434 0x000 0x1 0x0
326#define MX6Q_PAD_EIM_DA3__IPU2_CSI1_DATA06 0x120 0x434 0x000 0x2 0x0
327#define MX6Q_PAD_EIM_DA3__GPIO3_IO03 0x120 0x434 0x000 0x5 0x0
328#define MX6Q_PAD_EIM_DA3__SRC_BOOT_CFG03 0x120 0x434 0x000 0x7 0x0
329#define MX6Q_PAD_EIM_DA4__EIM_AD04 0x124 0x438 0x000 0x0 0x0
330#define MX6Q_PAD_EIM_DA4__IPU1_DISP1_DATA05 0x124 0x438 0x000 0x1 0x0
331#define MX6Q_PAD_EIM_DA4__IPU2_CSI1_DATA05 0x124 0x438 0x000 0x2 0x0
332#define MX6Q_PAD_EIM_DA4__GPIO3_IO04 0x124 0x438 0x000 0x5 0x0
333#define MX6Q_PAD_EIM_DA4__SRC_BOOT_CFG04 0x124 0x438 0x000 0x7 0x0
334#define MX6Q_PAD_EIM_DA5__EIM_AD05 0x128 0x43c 0x000 0x0 0x0
335#define MX6Q_PAD_EIM_DA5__IPU1_DISP1_DATA04 0x128 0x43c 0x000 0x1 0x0
336#define MX6Q_PAD_EIM_DA5__IPU2_CSI1_DATA04 0x128 0x43c 0x000 0x2 0x0
337#define MX6Q_PAD_EIM_DA5__GPIO3_IO05 0x128 0x43c 0x000 0x5 0x0
338#define MX6Q_PAD_EIM_DA5__SRC_BOOT_CFG05 0x128 0x43c 0x000 0x7 0x0
339#define MX6Q_PAD_EIM_DA6__EIM_AD06 0x12c 0x440 0x000 0x0 0x0
340#define MX6Q_PAD_EIM_DA6__IPU1_DISP1_DATA03 0x12c 0x440 0x000 0x1 0x0
341#define MX6Q_PAD_EIM_DA6__IPU2_CSI1_DATA03 0x12c 0x440 0x000 0x2 0x0
342#define MX6Q_PAD_EIM_DA6__GPIO3_IO06 0x12c 0x440 0x000 0x5 0x0
343#define MX6Q_PAD_EIM_DA6__SRC_BOOT_CFG06 0x12c 0x440 0x000 0x7 0x0
344#define MX6Q_PAD_EIM_DA7__EIM_AD07 0x130 0x444 0x000 0x0 0x0
345#define MX6Q_PAD_EIM_DA7__IPU1_DISP1_DATA02 0x130 0x444 0x000 0x1 0x0
346#define MX6Q_PAD_EIM_DA7__IPU2_CSI1_DATA02 0x130 0x444 0x000 0x2 0x0
347#define MX6Q_PAD_EIM_DA7__GPIO3_IO07 0x130 0x444 0x000 0x5 0x0
348#define MX6Q_PAD_EIM_DA7__SRC_BOOT_CFG07 0x130 0x444 0x000 0x7 0x0
349#define MX6Q_PAD_EIM_DA8__EIM_AD08 0x134 0x448 0x000 0x0 0x0
350#define MX6Q_PAD_EIM_DA8__IPU1_DISP1_DATA01 0x134 0x448 0x000 0x1 0x0
351#define MX6Q_PAD_EIM_DA8__IPU2_CSI1_DATA01 0x134 0x448 0x000 0x2 0x0
352#define MX6Q_PAD_EIM_DA8__GPIO3_IO08 0x134 0x448 0x000 0x5 0x0
353#define MX6Q_PAD_EIM_DA8__SRC_BOOT_CFG08 0x134 0x448 0x000 0x7 0x0
354#define MX6Q_PAD_EIM_DA9__EIM_AD09 0x138 0x44c 0x000 0x0 0x0
355#define MX6Q_PAD_EIM_DA9__IPU1_DISP1_DATA00 0x138 0x44c 0x000 0x1 0x0
356#define MX6Q_PAD_EIM_DA9__IPU2_CSI1_DATA00 0x138 0x44c 0x000 0x2 0x0
357#define MX6Q_PAD_EIM_DA9__GPIO3_IO09 0x138 0x44c 0x000 0x5 0x0
358#define MX6Q_PAD_EIM_DA9__SRC_BOOT_CFG09 0x138 0x44c 0x000 0x7 0x0
359#define MX6Q_PAD_EIM_DA10__EIM_AD10 0x13c 0x450 0x000 0x0 0x0
360#define MX6Q_PAD_EIM_DA10__IPU1_DI1_PIN15 0x13c 0x450 0x000 0x1 0x0
361#define MX6Q_PAD_EIM_DA10__IPU2_CSI1_DATA_EN 0x13c 0x450 0x8d8 0x2 0x1
362#define MX6Q_PAD_EIM_DA10__GPIO3_IO10 0x13c 0x450 0x000 0x5 0x0
363#define MX6Q_PAD_EIM_DA10__SRC_BOOT_CFG10 0x13c 0x450 0x000 0x7 0x0
364#define MX6Q_PAD_EIM_DA11__EIM_AD11 0x140 0x454 0x000 0x0 0x0
365#define MX6Q_PAD_EIM_DA11__IPU1_DI1_PIN02 0x140 0x454 0x000 0x1 0x0
366#define MX6Q_PAD_EIM_DA11__IPU2_CSI1_HSYNC 0x140 0x454 0x8dc 0x2 0x1
367#define MX6Q_PAD_EIM_DA11__GPIO3_IO11 0x140 0x454 0x000 0x5 0x0
368#define MX6Q_PAD_EIM_DA11__SRC_BOOT_CFG11 0x140 0x454 0x000 0x7 0x0
369#define MX6Q_PAD_EIM_DA12__EIM_AD12 0x144 0x458 0x000 0x0 0x0
370#define MX6Q_PAD_EIM_DA12__IPU1_DI1_PIN03 0x144 0x458 0x000 0x1 0x0
371#define MX6Q_PAD_EIM_DA12__IPU2_CSI1_VSYNC 0x144 0x458 0x8e4 0x2 0x1
372#define MX6Q_PAD_EIM_DA12__GPIO3_IO12 0x144 0x458 0x000 0x5 0x0
373#define MX6Q_PAD_EIM_DA12__SRC_BOOT_CFG12 0x144 0x458 0x000 0x7 0x0
374#define MX6Q_PAD_EIM_DA13__EIM_AD13 0x148 0x45c 0x000 0x0 0x0
375#define MX6Q_PAD_EIM_DA13__IPU1_DI1_D0_CS 0x148 0x45c 0x000 0x1 0x0
376#define MX6Q_PAD_EIM_DA13__GPIO3_IO13 0x148 0x45c 0x000 0x5 0x0
377#define MX6Q_PAD_EIM_DA13__SRC_BOOT_CFG13 0x148 0x45c 0x000 0x7 0x0
378#define MX6Q_PAD_EIM_DA14__EIM_AD14 0x14c 0x460 0x000 0x0 0x0
379#define MX6Q_PAD_EIM_DA14__IPU1_DI1_D1_CS 0x14c 0x460 0x000 0x1 0x0
380#define MX6Q_PAD_EIM_DA14__GPIO3_IO14 0x14c 0x460 0x000 0x5 0x0
381#define MX6Q_PAD_EIM_DA14__SRC_BOOT_CFG14 0x14c 0x460 0x000 0x7 0x0
382#define MX6Q_PAD_EIM_DA15__EIM_AD15 0x150 0x464 0x000 0x0 0x0
383#define MX6Q_PAD_EIM_DA15__IPU1_DI1_PIN01 0x150 0x464 0x000 0x1 0x0
384#define MX6Q_PAD_EIM_DA15__IPU1_DI1_PIN04 0x150 0x464 0x000 0x2 0x0
385#define MX6Q_PAD_EIM_DA15__GPIO3_IO15 0x150 0x464 0x000 0x5 0x0
386#define MX6Q_PAD_EIM_DA15__SRC_BOOT_CFG15 0x150 0x464 0x000 0x7 0x0
387#define MX6Q_PAD_EIM_WAIT__EIM_WAIT_B 0x154 0x468 0x000 0x0 0x0
388#define MX6Q_PAD_EIM_WAIT__EIM_DTACK_B 0x154 0x468 0x000 0x1 0x0
389#define MX6Q_PAD_EIM_WAIT__GPIO5_IO00 0x154 0x468 0x000 0x5 0x0
390#define MX6Q_PAD_EIM_WAIT__SRC_BOOT_CFG25 0x154 0x468 0x000 0x7 0x0
391#define MX6Q_PAD_EIM_BCLK__EIM_BCLK 0x158 0x46c 0x000 0x0 0x0
392#define MX6Q_PAD_EIM_BCLK__IPU1_DI1_PIN16 0x158 0x46c 0x000 0x1 0x0
393#define MX6Q_PAD_EIM_BCLK__GPIO6_IO31 0x158 0x46c 0x000 0x5 0x0
394#define MX6Q_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x15c 0x470 0x000 0x0 0x0
395#define MX6Q_PAD_DI0_DISP_CLK__IPU2_DI0_DISP_CLK 0x15c 0x470 0x000 0x1 0x0
396#define MX6Q_PAD_DI0_DISP_CLK__GPIO4_IO16 0x15c 0x470 0x000 0x5 0x0
397#define MX6Q_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x160 0x474 0x000 0x0 0x0
398#define MX6Q_PAD_DI0_PIN15__IPU2_DI0_PIN15 0x160 0x474 0x000 0x1 0x0
399#define MX6Q_PAD_DI0_PIN15__AUD6_TXC 0x160 0x474 0x000 0x2 0x0
400#define MX6Q_PAD_DI0_PIN15__GPIO4_IO17 0x160 0x474 0x000 0x5 0x0
401#define MX6Q_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x164 0x478 0x000 0x0 0x0
402#define MX6Q_PAD_DI0_PIN2__IPU2_DI0_PIN02 0x164 0x478 0x000 0x1 0x0
403#define MX6Q_PAD_DI0_PIN2__AUD6_TXD 0x164 0x478 0x000 0x2 0x0
404#define MX6Q_PAD_DI0_PIN2__GPIO4_IO18 0x164 0x478 0x000 0x5 0x0
405#define MX6Q_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x168 0x47c 0x000 0x0 0x0
406#define MX6Q_PAD_DI0_PIN3__IPU2_DI0_PIN03 0x168 0x47c 0x000 0x1 0x0
407#define MX6Q_PAD_DI0_PIN3__AUD6_TXFS 0x168 0x47c 0x000 0x2 0x0
408#define MX6Q_PAD_DI0_PIN3__GPIO4_IO19 0x168 0x47c 0x000 0x5 0x0
409#define MX6Q_PAD_DI0_PIN4__IPU1_DI0_PIN04 0x16c 0x480 0x000 0x0 0x0
410#define MX6Q_PAD_DI0_PIN4__IPU2_DI0_PIN04 0x16c 0x480 0x000 0x1 0x0
411#define MX6Q_PAD_DI0_PIN4__AUD6_RXD 0x16c 0x480 0x000 0x2 0x0
412#define MX6Q_PAD_DI0_PIN4__SD1_WP 0x16c 0x480 0x94c 0x3 0x0
413#define MX6Q_PAD_DI0_PIN4__GPIO4_IO20 0x16c 0x480 0x000 0x5 0x0
414#define MX6Q_PAD_DISP0_DAT0__IPU1_DISP0_DATA00 0x170 0x484 0x000 0x0 0x0
415#define MX6Q_PAD_DISP0_DAT0__IPU2_DISP0_DATA00 0x170 0x484 0x000 0x1 0x0
416#define MX6Q_PAD_DISP0_DAT0__ECSPI3_SCLK 0x170 0x484 0x000 0x2 0x0
417#define MX6Q_PAD_DISP0_DAT0__GPIO4_IO21 0x170 0x484 0x000 0x5 0x0
418#define MX6Q_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x174 0x488 0x000 0x0 0x0
419#define MX6Q_PAD_DISP0_DAT1__IPU2_DISP0_DATA01 0x174 0x488 0x000 0x1 0x0
420#define MX6Q_PAD_DISP0_DAT1__ECSPI3_MOSI 0x174 0x488 0x000 0x2 0x0
421#define MX6Q_PAD_DISP0_DAT1__GPIO4_IO22 0x174 0x488 0x000 0x5 0x0
422#define MX6Q_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x178 0x48c 0x000 0x0 0x0
423#define MX6Q_PAD_DISP0_DAT2__IPU2_DISP0_DATA02 0x178 0x48c 0x000 0x1 0x0
424#define MX6Q_PAD_DISP0_DAT2__ECSPI3_MISO 0x178 0x48c 0x000 0x2 0x0
425#define MX6Q_PAD_DISP0_DAT2__GPIO4_IO23 0x178 0x48c 0x000 0x5 0x0
426#define MX6Q_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x17c 0x490 0x000 0x0 0x0
427#define MX6Q_PAD_DISP0_DAT3__IPU2_DISP0_DATA03 0x17c 0x490 0x000 0x1 0x0
428#define MX6Q_PAD_DISP0_DAT3__ECSPI3_SS0 0x17c 0x490 0x000 0x2 0x0
429#define MX6Q_PAD_DISP0_DAT3__GPIO4_IO24 0x17c 0x490 0x000 0x5 0x0
430#define MX6Q_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x180 0x494 0x000 0x0 0x0
431#define MX6Q_PAD_DISP0_DAT4__IPU2_DISP0_DATA04 0x180 0x494 0x000 0x1 0x0
432#define MX6Q_PAD_DISP0_DAT4__ECSPI3_SS1 0x180 0x494 0x000 0x2 0x0
433#define MX6Q_PAD_DISP0_DAT4__GPIO4_IO25 0x180 0x494 0x000 0x5 0x0
434#define MX6Q_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x184 0x498 0x000 0x0 0x0
435#define MX6Q_PAD_DISP0_DAT5__IPU2_DISP0_DATA05 0x184 0x498 0x000 0x1 0x0
436#define MX6Q_PAD_DISP0_DAT5__ECSPI3_SS2 0x184 0x498 0x000 0x2 0x0
437#define MX6Q_PAD_DISP0_DAT5__AUD6_RXFS 0x184 0x498 0x000 0x3 0x0
438#define MX6Q_PAD_DISP0_DAT5__GPIO4_IO26 0x184 0x498 0x000 0x5 0x0
439#define MX6Q_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x188 0x49c 0x000 0x0 0x0
440#define MX6Q_PAD_DISP0_DAT6__IPU2_DISP0_DATA06 0x188 0x49c 0x000 0x1 0x0
441#define MX6Q_PAD_DISP0_DAT6__ECSPI3_SS3 0x188 0x49c 0x000 0x2 0x0
442#define MX6Q_PAD_DISP0_DAT6__AUD6_RXC 0x188 0x49c 0x000 0x3 0x0
443#define MX6Q_PAD_DISP0_DAT6__GPIO4_IO27 0x188 0x49c 0x000 0x5 0x0
444#define MX6Q_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x18c 0x4a0 0x000 0x0 0x0
445#define MX6Q_PAD_DISP0_DAT7__IPU2_DISP0_DATA07 0x18c 0x4a0 0x000 0x1 0x0
446#define MX6Q_PAD_DISP0_DAT7__ECSPI3_RDY 0x18c 0x4a0 0x000 0x2 0x0
447#define MX6Q_PAD_DISP0_DAT7__GPIO4_IO28 0x18c 0x4a0 0x000 0x5 0x0
448#define MX6Q_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x190 0x4a4 0x000 0x0 0x0
449#define MX6Q_PAD_DISP0_DAT8__IPU2_DISP0_DATA08 0x190 0x4a4 0x000 0x1 0x0
450#define MX6Q_PAD_DISP0_DAT8__PWM1_OUT 0x190 0x4a4 0x000 0x2 0x0
451#define MX6Q_PAD_DISP0_DAT8__WDOG1_B 0x190 0x4a4 0x000 0x3 0x0
452#define MX6Q_PAD_DISP0_DAT8__GPIO4_IO29 0x190 0x4a4 0x000 0x5 0x0
453#define MX6Q_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x194 0x4a8 0x000 0x0 0x0
454#define MX6Q_PAD_DISP0_DAT9__IPU2_DISP0_DATA09 0x194 0x4a8 0x000 0x1 0x0
455#define MX6Q_PAD_DISP0_DAT9__PWM2_OUT 0x194 0x4a8 0x000 0x2 0x0
456#define MX6Q_PAD_DISP0_DAT9__WDOG2_B 0x194 0x4a8 0x000 0x3 0x0
457#define MX6Q_PAD_DISP0_DAT9__GPIO4_IO30 0x194 0x4a8 0x000 0x5 0x0
458#define MX6Q_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x198 0x4ac 0x000 0x0 0x0
459#define MX6Q_PAD_DISP0_DAT10__IPU2_DISP0_DATA10 0x198 0x4ac 0x000 0x1 0x0
460#define MX6Q_PAD_DISP0_DAT10__GPIO4_IO31 0x198 0x4ac 0x000 0x5 0x0
461#define MX6Q_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x19c 0x4b0 0x000 0x0 0x0
462#define MX6Q_PAD_DISP0_DAT11__IPU2_DISP0_DATA11 0x19c 0x4b0 0x000 0x1 0x0
463#define MX6Q_PAD_DISP0_DAT11__GPIO5_IO05 0x19c 0x4b0 0x000 0x5 0x0
464#define MX6Q_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x1a0 0x4b4 0x000 0x0 0x0
465#define MX6Q_PAD_DISP0_DAT12__IPU2_DISP0_DATA12 0x1a0 0x4b4 0x000 0x1 0x0
466#define MX6Q_PAD_DISP0_DAT12__GPIO5_IO06 0x1a0 0x4b4 0x000 0x5 0x0
467#define MX6Q_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x1a4 0x4b8 0x000 0x0 0x0
468#define MX6Q_PAD_DISP0_DAT13__IPU2_DISP0_DATA13 0x1a4 0x4b8 0x000 0x1 0x0
469#define MX6Q_PAD_DISP0_DAT13__AUD5_RXFS 0x1a4 0x4b8 0x7d8 0x3 0x1
470#define MX6Q_PAD_DISP0_DAT13__GPIO5_IO07 0x1a4 0x4b8 0x000 0x5 0x0
471#define MX6Q_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x1a8 0x4bc 0x000 0x0 0x0
472#define MX6Q_PAD_DISP0_DAT14__IPU2_DISP0_DATA14 0x1a8 0x4bc 0x000 0x1 0x0
473#define MX6Q_PAD_DISP0_DAT14__AUD5_RXC 0x1a8 0x4bc 0x7d4 0x3 0x1
474#define MX6Q_PAD_DISP0_DAT14__GPIO5_IO08 0x1a8 0x4bc 0x000 0x5 0x0
475#define MX6Q_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x1ac 0x4c0 0x000 0x0 0x0
476#define MX6Q_PAD_DISP0_DAT15__IPU2_DISP0_DATA15 0x1ac 0x4c0 0x000 0x1 0x0
477#define MX6Q_PAD_DISP0_DAT15__ECSPI1_SS1 0x1ac 0x4c0 0x804 0x2 0x1
478#define MX6Q_PAD_DISP0_DAT15__ECSPI2_SS1 0x1ac 0x4c0 0x820 0x3 0x1
479#define MX6Q_PAD_DISP0_DAT15__GPIO5_IO09 0x1ac 0x4c0 0x000 0x5 0x0
480#define MX6Q_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x1b0 0x4c4 0x000 0x0 0x0
481#define MX6Q_PAD_DISP0_DAT16__IPU2_DISP0_DATA16 0x1b0 0x4c4 0x000 0x1 0x0
482#define MX6Q_PAD_DISP0_DAT16__ECSPI2_MOSI 0x1b0 0x4c4 0x818 0x2 0x1
483#define MX6Q_PAD_DISP0_DAT16__AUD5_TXC 0x1b0 0x4c4 0x7dc 0x3 0x0
484#define MX6Q_PAD_DISP0_DAT16__SDMA_EXT_EVENT0 0x1b0 0x4c4 0x90c 0x4 0x0
485#define MX6Q_PAD_DISP0_DAT16__GPIO5_IO10 0x1b0 0x4c4 0x000 0x5 0x0
486#define MX6Q_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x1b4 0x4c8 0x000 0x0 0x0
487#define MX6Q_PAD_DISP0_DAT17__IPU2_DISP0_DATA17 0x1b4 0x4c8 0x000 0x1 0x0
488#define MX6Q_PAD_DISP0_DAT17__ECSPI2_MISO 0x1b4 0x4c8 0x814 0x2 0x1
489#define MX6Q_PAD_DISP0_DAT17__AUD5_TXD 0x1b4 0x4c8 0x7d0 0x3 0x0
490#define MX6Q_PAD_DISP0_DAT17__SDMA_EXT_EVENT1 0x1b4 0x4c8 0x910 0x4 0x0
491#define MX6Q_PAD_DISP0_DAT17__GPIO5_IO11 0x1b4 0x4c8 0x000 0x5 0x0
492#define MX6Q_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x1b8 0x4cc 0x000 0x0 0x0
493#define MX6Q_PAD_DISP0_DAT18__IPU2_DISP0_DATA18 0x1b8 0x4cc 0x000 0x1 0x0
494#define MX6Q_PAD_DISP0_DAT18__ECSPI2_SS0 0x1b8 0x4cc 0x81c 0x2 0x1
495#define MX6Q_PAD_DISP0_DAT18__AUD5_TXFS 0x1b8 0x4cc 0x7e0 0x3 0x0
496#define MX6Q_PAD_DISP0_DAT18__AUD4_RXFS 0x1b8 0x4cc 0x7c0 0x4 0x0
497#define MX6Q_PAD_DISP0_DAT18__GPIO5_IO12 0x1b8 0x4cc 0x000 0x5 0x0
498#define MX6Q_PAD_DISP0_DAT18__EIM_CS2_B 0x1b8 0x4cc 0x000 0x7 0x0
499#define MX6Q_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x1bc 0x4d0 0x000 0x0 0x0
500#define MX6Q_PAD_DISP0_DAT19__IPU2_DISP0_DATA19 0x1bc 0x4d0 0x000 0x1 0x0
501#define MX6Q_PAD_DISP0_DAT19__ECSPI2_SCLK 0x1bc 0x4d0 0x810 0x2 0x1
502#define MX6Q_PAD_DISP0_DAT19__AUD5_RXD 0x1bc 0x4d0 0x7cc 0x3 0x0
503#define MX6Q_PAD_DISP0_DAT19__AUD4_RXC 0x1bc 0x4d0 0x7bc 0x4 0x0
504#define MX6Q_PAD_DISP0_DAT19__GPIO5_IO13 0x1bc 0x4d0 0x000 0x5 0x0
505#define MX6Q_PAD_DISP0_DAT19__EIM_CS3_B 0x1bc 0x4d0 0x000 0x7 0x0
506#define MX6Q_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x1c0 0x4d4 0x000 0x0 0x0
507#define MX6Q_PAD_DISP0_DAT20__IPU2_DISP0_DATA20 0x1c0 0x4d4 0x000 0x1 0x0
508#define MX6Q_PAD_DISP0_DAT20__ECSPI1_SCLK 0x1c0 0x4d4 0x7f4 0x2 0x1
509#define MX6Q_PAD_DISP0_DAT20__AUD4_TXC 0x1c0 0x4d4 0x7c4 0x3 0x0
510#define MX6Q_PAD_DISP0_DAT20__GPIO5_IO14 0x1c0 0x4d4 0x000 0x5 0x0
511#define MX6Q_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x1c4 0x4d8 0x000 0x0 0x0
512#define MX6Q_PAD_DISP0_DAT21__IPU2_DISP0_DATA21 0x1c4 0x4d8 0x000 0x1 0x0
513#define MX6Q_PAD_DISP0_DAT21__ECSPI1_MOSI 0x1c4 0x4d8 0x7fc 0x2 0x1
514#define MX6Q_PAD_DISP0_DAT21__AUD4_TXD 0x1c4 0x4d8 0x7b8 0x3 0x1
515#define MX6Q_PAD_DISP0_DAT21__GPIO5_IO15 0x1c4 0x4d8 0x000 0x5 0x0
516#define MX6Q_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x1c8 0x4dc 0x000 0x0 0x0
517#define MX6Q_PAD_DISP0_DAT22__IPU2_DISP0_DATA22 0x1c8 0x4dc 0x000 0x1 0x0
518#define MX6Q_PAD_DISP0_DAT22__ECSPI1_MISO 0x1c8 0x4dc 0x7f8 0x2 0x1
519#define MX6Q_PAD_DISP0_DAT22__AUD4_TXFS 0x1c8 0x4dc 0x7c8 0x3 0x1
520#define MX6Q_PAD_DISP0_DAT22__GPIO5_IO16 0x1c8 0x4dc 0x000 0x5 0x0
521#define MX6Q_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x1cc 0x4e0 0x000 0x0 0x0
522#define MX6Q_PAD_DISP0_DAT23__IPU2_DISP0_DATA23 0x1cc 0x4e0 0x000 0x1 0x0
523#define MX6Q_PAD_DISP0_DAT23__ECSPI1_SS0 0x1cc 0x4e0 0x800 0x2 0x1
524#define MX6Q_PAD_DISP0_DAT23__AUD4_RXD 0x1cc 0x4e0 0x7b4 0x3 0x1
525#define MX6Q_PAD_DISP0_DAT23__GPIO5_IO17 0x1cc 0x4e0 0x000 0x5 0x0
526#define MX6Q_PAD_ENET_MDIO__ENET_MDIO 0x1d0 0x4e4 0x840 0x1 0x0
527#define MX6Q_PAD_ENET_MDIO__ESAI_RX_CLK 0x1d0 0x4e4 0x86c 0x2 0x0
528#define MX6Q_PAD_ENET_MDIO__ENET_1588_EVENT1_OUT 0x1d0 0x4e4 0x000 0x4 0x0
529#define MX6Q_PAD_ENET_MDIO__GPIO1_IO22 0x1d0 0x4e4 0x000 0x5 0x0
530#define MX6Q_PAD_ENET_MDIO__SPDIF_LOCK 0x1d0 0x4e4 0x000 0x6 0x0
531#define MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1d4 0x4e8 0x000 0x1 0x0
532#define MX6Q_PAD_ENET_REF_CLK__ESAI_RX_FS 0x1d4 0x4e8 0x85c 0x2 0x0
533#define MX6Q_PAD_ENET_REF_CLK__GPIO1_IO23 0x1d4 0x4e8 0x000 0x5 0x0
534#define MX6Q_PAD_ENET_REF_CLK__SPDIF_SR_CLK 0x1d4 0x4e8 0x000 0x6 0x0
535#define MX6Q_PAD_ENET_RX_ER__USB_OTG_ID 0x1d8 0x4ec 0x000 0x0 0x0
536#define MX6Q_PAD_ENET_RX_ER__ENET_RX_ER 0x1d8 0x4ec 0x000 0x1 0x0
537#define MX6Q_PAD_ENET_RX_ER__ESAI_RX_HF_CLK 0x1d8 0x4ec 0x864 0x2 0x0
538#define MX6Q_PAD_ENET_RX_ER__SPDIF_IN 0x1d8 0x4ec 0x914 0x3 0x1
539#define MX6Q_PAD_ENET_RX_ER__ENET_1588_EVENT2_OUT 0x1d8 0x4ec 0x000 0x4 0x0
540#define MX6Q_PAD_ENET_RX_ER__GPIO1_IO24 0x1d8 0x4ec 0x000 0x5 0x0
541#define MX6Q_PAD_ENET_CRS_DV__ENET_RX_EN 0x1dc 0x4f0 0x858 0x1 0x1
542#define MX6Q_PAD_ENET_CRS_DV__ESAI_TX_CLK 0x1dc 0x4f0 0x870 0x2 0x0
543#define MX6Q_PAD_ENET_CRS_DV__SPDIF_EXT_CLK 0x1dc 0x4f0 0x918 0x3 0x1
544#define MX6Q_PAD_ENET_CRS_DV__GPIO1_IO25 0x1dc 0x4f0 0x000 0x5 0x0
545#define MX6Q_PAD_ENET_RXD1__MLB_SIG 0x1e0 0x4f4 0x908 0x0 0x0
546#define MX6Q_PAD_ENET_RXD1__ENET_RX_DATA1 0x1e0 0x4f4 0x84c 0x1 0x1
547#define MX6Q_PAD_ENET_RXD1__ESAI_TX_FS 0x1e0 0x4f4 0x860 0x2 0x0
548#define MX6Q_PAD_ENET_RXD1__ENET_1588_EVENT3_OUT 0x1e0 0x4f4 0x000 0x4 0x0
549#define MX6Q_PAD_ENET_RXD1__GPIO1_IO26 0x1e0 0x4f4 0x000 0x5 0x0
550#define MX6Q_PAD_ENET_RXD0__ENET_RX_DATA0 0x1e4 0x4f8 0x848 0x1 0x1
551#define MX6Q_PAD_ENET_RXD0__ESAI_TX_HF_CLK 0x1e4 0x4f8 0x868 0x2 0x0
552#define MX6Q_PAD_ENET_RXD0__SPDIF_OUT 0x1e4 0x4f8 0x000 0x3 0x0
553#define MX6Q_PAD_ENET_RXD0__GPIO1_IO27 0x1e4 0x4f8 0x000 0x5 0x0
554#define MX6Q_PAD_ENET_TX_EN__ENET_TX_EN 0x1e8 0x4fc 0x000 0x1 0x0
555#define MX6Q_PAD_ENET_TX_EN__ESAI_TX3_RX2 0x1e8 0x4fc 0x880 0x2 0x0
556#define MX6Q_PAD_ENET_TX_EN__GPIO1_IO28 0x1e8 0x4fc 0x000 0x5 0x0
557#define MX6Q_PAD_ENET_TXD1__MLB_CLK 0x1ec 0x500 0x900 0x0 0x0
558#define MX6Q_PAD_ENET_TXD1__ENET_TX_DATA1 0x1ec 0x500 0x000 0x1 0x0
559#define MX6Q_PAD_ENET_TXD1__ESAI_TX2_RX3 0x1ec 0x500 0x87c 0x2 0x0
560#define MX6Q_PAD_ENET_TXD1__ENET_1588_EVENT0_IN 0x1ec 0x500 0x000 0x4 0x0
561#define MX6Q_PAD_ENET_TXD1__GPIO1_IO29 0x1ec 0x500 0x000 0x5 0x0
562#define MX6Q_PAD_ENET_TXD0__ENET_TX_DATA0 0x1f0 0x504 0x000 0x1 0x0
563#define MX6Q_PAD_ENET_TXD0__ESAI_TX4_RX1 0x1f0 0x504 0x884 0x2 0x0
564#define MX6Q_PAD_ENET_TXD0__GPIO1_IO30 0x1f0 0x504 0x000 0x5 0x0
565#define MX6Q_PAD_ENET_MDC__MLB_DATA 0x1f4 0x508 0x904 0x0 0x0
566#define MX6Q_PAD_ENET_MDC__ENET_MDC 0x1f4 0x508 0x000 0x1 0x0
567#define MX6Q_PAD_ENET_MDC__ESAI_TX5_RX0 0x1f4 0x508 0x888 0x2 0x0
568#define MX6Q_PAD_ENET_MDC__ENET_1588_EVENT1_IN 0x1f4 0x508 0x000 0x4 0x0
569#define MX6Q_PAD_ENET_MDC__GPIO1_IO31 0x1f4 0x508 0x000 0x5 0x0
570#define MX6Q_PAD_KEY_COL0__ECSPI1_SCLK 0x1f8 0x5c8 0x7f4 0x0 0x2
571#define MX6Q_PAD_KEY_COL0__ENET_RX_DATA3 0x1f8 0x5c8 0x854 0x1 0x1
572#define MX6Q_PAD_KEY_COL0__AUD5_TXC 0x1f8 0x5c8 0x7dc 0x2 0x1
573#define MX6Q_PAD_KEY_COL0__KEY_COL0 0x1f8 0x5c8 0x000 0x3 0x0
574#define MX6Q_PAD_KEY_COL0__UART4_TX_DATA 0x1f8 0x5c8 0x000 0x4 0x0
575#define MX6Q_PAD_KEY_COL0__UART4_RX_DATA 0x1f8 0x5c8 0x938 0x4 0x0
576#define MX6Q_PAD_KEY_COL0__GPIO4_IO06 0x1f8 0x5c8 0x000 0x5 0x0
577#define MX6Q_PAD_KEY_COL0__DCIC1_OUT 0x1f8 0x5c8 0x000 0x6 0x0
578#define MX6Q_PAD_KEY_ROW0__ECSPI1_MOSI 0x1fc 0x5cc 0x7fc 0x0 0x2
579#define MX6Q_PAD_KEY_ROW0__ENET_TX_DATA3 0x1fc 0x5cc 0x000 0x1 0x0
580#define MX6Q_PAD_KEY_ROW0__AUD5_TXD 0x1fc 0x5cc 0x7d0 0x2 0x1
581#define MX6Q_PAD_KEY_ROW0__KEY_ROW0 0x1fc 0x5cc 0x000 0x3 0x0
582#define MX6Q_PAD_KEY_ROW0__UART4_RX_DATA 0x1fc 0x5cc 0x938 0x4 0x1
583#define MX6Q_PAD_KEY_ROW0__UART4_TX_DATA 0x1fc 0x5cc 0x000 0x4 0x0
584#define MX6Q_PAD_KEY_ROW0__GPIO4_IO07 0x1fc 0x5cc 0x000 0x5 0x0
585#define MX6Q_PAD_KEY_ROW0__DCIC2_OUT 0x1fc 0x5cc 0x000 0x6 0x0
586#define MX6Q_PAD_KEY_COL1__ECSPI1_MISO 0x200 0x5d0 0x7f8 0x0 0x2
587#define MX6Q_PAD_KEY_COL1__ENET_MDIO 0x200 0x5d0 0x840 0x1 0x1
588#define MX6Q_PAD_KEY_COL1__AUD5_TXFS 0x200 0x5d0 0x7e0 0x2 0x1
589#define MX6Q_PAD_KEY_COL1__KEY_COL1 0x200 0x5d0 0x000 0x3 0x0
590#define MX6Q_PAD_KEY_COL1__UART5_TX_DATA 0x200 0x5d0 0x000 0x4 0x0
591#define MX6Q_PAD_KEY_COL1__UART5_RX_DATA 0x200 0x5d0 0x940 0x4 0x0
592#define MX6Q_PAD_KEY_COL1__GPIO4_IO08 0x200 0x5d0 0x000 0x5 0x0
593#define MX6Q_PAD_KEY_COL1__SD1_VSELECT 0x200 0x5d0 0x000 0x6 0x0
594#define MX6Q_PAD_KEY_ROW1__ECSPI1_SS0 0x204 0x5d4 0x800 0x0 0x2
595#define MX6Q_PAD_KEY_ROW1__ENET_COL 0x204 0x5d4 0x000 0x1 0x0
596#define MX6Q_PAD_KEY_ROW1__AUD5_RXD 0x204 0x5d4 0x7cc 0x2 0x1
597#define MX6Q_PAD_KEY_ROW1__KEY_ROW1 0x204 0x5d4 0x000 0x3 0x0
598#define MX6Q_PAD_KEY_ROW1__UART5_RX_DATA 0x204 0x5d4 0x940 0x4 0x1
599#define MX6Q_PAD_KEY_ROW1__UART5_TX_DATA 0x204 0x5d4 0x000 0x4 0x0
600#define MX6Q_PAD_KEY_ROW1__GPIO4_IO09 0x204 0x5d4 0x000 0x5 0x0
601#define MX6Q_PAD_KEY_ROW1__SD2_VSELECT 0x204 0x5d4 0x000 0x6 0x0
602#define MX6Q_PAD_KEY_COL2__ECSPI1_SS1 0x208 0x5d8 0x804 0x0 0x2
603#define MX6Q_PAD_KEY_COL2__ENET_RX_DATA2 0x208 0x5d8 0x850 0x1 0x1
604#define MX6Q_PAD_KEY_COL2__FLEXCAN1_TX 0x208 0x5d8 0x000 0x2 0x0
605#define MX6Q_PAD_KEY_COL2__KEY_COL2 0x208 0x5d8 0x000 0x3 0x0
606#define MX6Q_PAD_KEY_COL2__ENET_MDC 0x208 0x5d8 0x000 0x4 0x0
607#define MX6Q_PAD_KEY_COL2__GPIO4_IO10 0x208 0x5d8 0x000 0x5 0x0
608#define MX6Q_PAD_KEY_COL2__USB_H1_PWR_CTL_WAKE 0x208 0x5d8 0x000 0x6 0x0
609#define MX6Q_PAD_KEY_ROW2__ECSPI1_SS2 0x20c 0x5dc 0x808 0x0 0x1
610#define MX6Q_PAD_KEY_ROW2__ENET_TX_DATA2 0x20c 0x5dc 0x000 0x1 0x0
611#define MX6Q_PAD_KEY_ROW2__FLEXCAN1_RX 0x20c 0x5dc 0x7e4 0x2 0x0
612#define MX6Q_PAD_KEY_ROW2__KEY_ROW2 0x20c 0x5dc 0x000 0x3 0x0
613#define MX6Q_PAD_KEY_ROW2__SD2_VSELECT 0x20c 0x5dc 0x000 0x4 0x0
614#define MX6Q_PAD_KEY_ROW2__GPIO4_IO11 0x20c 0x5dc 0x000 0x5 0x0
615#define MX6Q_PAD_KEY_ROW2__HDMI_TX_CEC_LINE 0x20c 0x5dc 0x88c 0x6 0x1
616#define MX6Q_PAD_KEY_COL3__ECSPI1_SS3 0x210 0x5e0 0x80c 0x0 0x1
617#define MX6Q_PAD_KEY_COL3__ENET_CRS 0x210 0x5e0 0x000 0x1 0x0
618#define MX6Q_PAD_KEY_COL3__HDMI_TX_DDC_SCL 0x210 0x5e0 0x890 0x2 0x1
619#define MX6Q_PAD_KEY_COL3__KEY_COL3 0x210 0x5e0 0x000 0x3 0x0
620#define MX6Q_PAD_KEY_COL3__I2C2_SCL 0x210 0x5e0 0x8a0 0x4 0x1
621#define MX6Q_PAD_KEY_COL3__GPIO4_IO12 0x210 0x5e0 0x000 0x5 0x0
622#define MX6Q_PAD_KEY_COL3__SPDIF_IN 0x210 0x5e0 0x914 0x6 0x2
623#define MX6Q_PAD_KEY_ROW3__ASRC_EXT_CLK 0x214 0x5e4 0x7b0 0x1 0x0
624#define MX6Q_PAD_KEY_ROW3__HDMI_TX_DDC_SDA 0x214 0x5e4 0x894 0x2 0x1
625#define MX6Q_PAD_KEY_ROW3__KEY_ROW3 0x214 0x5e4 0x000 0x3 0x0
626#define MX6Q_PAD_KEY_ROW3__I2C2_SDA 0x214 0x5e4 0x8a4 0x4 0x1
627#define MX6Q_PAD_KEY_ROW3__GPIO4_IO13 0x214 0x5e4 0x000 0x5 0x0
628#define MX6Q_PAD_KEY_ROW3__SD1_VSELECT 0x214 0x5e4 0x000 0x6 0x0
629#define MX6Q_PAD_KEY_COL4__FLEXCAN2_TX 0x218 0x5e8 0x000 0x0 0x0
630#define MX6Q_PAD_KEY_COL4__IPU1_SISG4 0x218 0x5e8 0x000 0x1 0x0
631#define MX6Q_PAD_KEY_COL4__USB_OTG_OC 0x218 0x5e8 0x944 0x2 0x1
632#define MX6Q_PAD_KEY_COL4__KEY_COL4 0x218 0x5e8 0x000 0x3 0x0
633#define MX6Q_PAD_KEY_COL4__UART5_RTS_B 0x218 0x5e8 0x93c 0x4 0x0
634#define MX6Q_PAD_KEY_COL4__UART5_CTS_B 0x218 0x5e8 0x000 0x4 0x0
635#define MX6Q_PAD_KEY_COL4__GPIO4_IO14 0x218 0x5e8 0x000 0x5 0x0
636#define MX6Q_PAD_KEY_ROW4__FLEXCAN2_RX 0x21c 0x5ec 0x7e8 0x0 0x0
637#define MX6Q_PAD_KEY_ROW4__IPU1_SISG5 0x21c 0x5ec 0x000 0x1 0x0
638#define MX6Q_PAD_KEY_ROW4__USB_OTG_PWR 0x21c 0x5ec 0x000 0x2 0x0
639#define MX6Q_PAD_KEY_ROW4__KEY_ROW4 0x21c 0x5ec 0x000 0x3 0x0
640#define MX6Q_PAD_KEY_ROW4__UART5_CTS_B 0x21c 0x5ec 0x000 0x4 0x0
641#define MX6Q_PAD_KEY_ROW4__UART5_RTS_B 0x21c 0x5ec 0x93c 0x4 0x1
642#define MX6Q_PAD_KEY_ROW4__GPIO4_IO15 0x21c 0x5ec 0x000 0x5 0x0
643#define MX6Q_PAD_GPIO_0__CCM_CLKO1 0x220 0x5f0 0x000 0x0 0x0
644#define MX6Q_PAD_GPIO_0__KEY_COL5 0x220 0x5f0 0x8e8 0x2 0x0
645#define MX6Q_PAD_GPIO_0__ASRC_EXT_CLK 0x220 0x5f0 0x7b0 0x3 0x1
646#define MX6Q_PAD_GPIO_0__EPIT1_OUT 0x220 0x5f0 0x000 0x4 0x0
647#define MX6Q_PAD_GPIO_0__GPIO1_IO00 0x220 0x5f0 0x000 0x5 0x0
648#define MX6Q_PAD_GPIO_0__USB_H1_PWR 0x220 0x5f0 0x000 0x6 0x0
649#define MX6Q_PAD_GPIO_0__SNVS_VIO_5 0x220 0x5f0 0x000 0x7 0x0
650#define MX6Q_PAD_GPIO_1__ESAI_RX_CLK 0x224 0x5f4 0x86c 0x0 0x1
651#define MX6Q_PAD_GPIO_1__WDOG2_B 0x224 0x5f4 0x000 0x1 0x0
652#define MX6Q_PAD_GPIO_1__KEY_ROW5 0x224 0x5f4 0x8f4 0x2 0x0
653#define MX6Q_PAD_GPIO_1__USB_OTG_ID 0x224 0x5f4 0x000 0x3 0x0
654#define MX6Q_PAD_GPIO_1__PWM2_OUT 0x224 0x5f4 0x000 0x4 0x0
655#define MX6Q_PAD_GPIO_1__GPIO1_IO01 0x224 0x5f4 0x000 0x5 0x0
656#define MX6Q_PAD_GPIO_1__SD1_CD_B 0x224 0x5f4 0x000 0x6 0x0
657#define MX6Q_PAD_GPIO_9__ESAI_RX_FS 0x228 0x5f8 0x85c 0x0 0x1
658#define MX6Q_PAD_GPIO_9__WDOG1_B 0x228 0x5f8 0x000 0x1 0x0
659#define MX6Q_PAD_GPIO_9__KEY_COL6 0x228 0x5f8 0x8ec 0x2 0x0
660#define MX6Q_PAD_GPIO_9__CCM_REF_EN_B 0x228 0x5f8 0x000 0x3 0x0
661#define MX6Q_PAD_GPIO_9__PWM1_OUT 0x228 0x5f8 0x000 0x4 0x0
662#define MX6Q_PAD_GPIO_9__GPIO1_IO09 0x228 0x5f8 0x000 0x5 0x0
663#define MX6Q_PAD_GPIO_9__SD1_WP 0x228 0x5f8 0x94c 0x6 0x1
664#define MX6Q_PAD_GPIO_3__ESAI_RX_HF_CLK 0x22c 0x5fc 0x864 0x0 0x1
665#define MX6Q_PAD_GPIO_3__I2C3_SCL 0x22c 0x5fc 0x8a8 0x2 0x1
666#define MX6Q_PAD_GPIO_3__XTALOSC_REF_CLK_24M 0x22c 0x5fc 0x000 0x3 0x0
667#define MX6Q_PAD_GPIO_3__CCM_CLKO2 0x22c 0x5fc 0x000 0x4 0x0
668#define MX6Q_PAD_GPIO_3__GPIO1_IO03 0x22c 0x5fc 0x000 0x5 0x0
669#define MX6Q_PAD_GPIO_3__USB_H1_OC 0x22c 0x5fc 0x948 0x6 0x1
670#define MX6Q_PAD_GPIO_3__MLB_CLK 0x22c 0x5fc 0x900 0x7 0x1
671#define MX6Q_PAD_GPIO_6__ESAI_TX_CLK 0x230 0x600 0x870 0x0 0x1
672#define MX6Q_PAD_GPIO_6__I2C3_SDA 0x230 0x600 0x8ac 0x2 0x1
673#define MX6Q_PAD_GPIO_6__GPIO1_IO06 0x230 0x600 0x000 0x5 0x0
674#define MX6Q_PAD_GPIO_6__SD2_LCTL 0x230 0x600 0x000 0x6 0x0
675#define MX6Q_PAD_GPIO_6__MLB_SIG 0x230 0x600 0x908 0x7 0x1
676#define MX6Q_PAD_GPIO_2__ESAI_TX_FS 0x234 0x604 0x860 0x0 0x1
677#define MX6Q_PAD_GPIO_2__KEY_ROW6 0x234 0x604 0x8f8 0x2 0x1
678#define MX6Q_PAD_GPIO_2__GPIO1_IO02 0x234 0x604 0x000 0x5 0x0
679#define MX6Q_PAD_GPIO_2__SD2_WP 0x234 0x604 0x000 0x6 0x0
680#define MX6Q_PAD_GPIO_2__MLB_DATA 0x234 0x604 0x904 0x7 0x1
681#define MX6Q_PAD_GPIO_4__ESAI_TX_HF_CLK 0x238 0x608 0x868 0x0 0x1
682#define MX6Q_PAD_GPIO_4__KEY_COL7 0x238 0x608 0x8f0 0x2 0x1
683#define MX6Q_PAD_GPIO_4__GPIO1_IO04 0x238 0x608 0x000 0x5 0x0
684#define MX6Q_PAD_GPIO_4__SD2_CD_B 0x238 0x608 0x000 0x6 0x0
685#define MX6Q_PAD_GPIO_5__ESAI_TX2_RX3 0x23c 0x60c 0x87c 0x0 0x1
686#define MX6Q_PAD_GPIO_5__KEY_ROW7 0x23c 0x60c 0x8fc 0x2 0x1
687#define MX6Q_PAD_GPIO_5__CCM_CLKO1 0x23c 0x60c 0x000 0x3 0x0
688#define MX6Q_PAD_GPIO_5__GPIO1_IO05 0x23c 0x60c 0x000 0x5 0x0
689#define MX6Q_PAD_GPIO_5__I2C3_SCL 0x23c 0x60c 0x8a8 0x6 0x2
690#define MX6Q_PAD_GPIO_5__ARM_EVENTI 0x23c 0x60c 0x000 0x7 0x0
691#define MX6Q_PAD_GPIO_7__ESAI_TX4_RX1 0x240 0x610 0x884 0x0 0x1
692#define MX6Q_PAD_GPIO_7__ECSPI5_RDY 0x240 0x610 0x000 0x1 0x0
693#define MX6Q_PAD_GPIO_7__EPIT1_OUT 0x240 0x610 0x000 0x2 0x0
694#define MX6Q_PAD_GPIO_7__FLEXCAN1_TX 0x240 0x610 0x000 0x3 0x0
695#define MX6Q_PAD_GPIO_7__UART2_TX_DATA 0x240 0x610 0x000 0x4 0x0
696#define MX6Q_PAD_GPIO_7__UART2_RX_DATA 0x240 0x610 0x928 0x4 0x2
697#define MX6Q_PAD_GPIO_7__GPIO1_IO07 0x240 0x610 0x000 0x5 0x0
698#define MX6Q_PAD_GPIO_7__SPDIF_LOCK 0x240 0x610 0x000 0x6 0x0
699#define MX6Q_PAD_GPIO_7__USB_OTG_HOST_MODE 0x240 0x610 0x000 0x7 0x0
700#define MX6Q_PAD_GPIO_8__ESAI_TX5_RX0 0x244 0x614 0x888 0x0 0x1
701#define MX6Q_PAD_GPIO_8__XTALOSC_REF_CLK_32K 0x244 0x614 0x000 0x1 0x0
702#define MX6Q_PAD_GPIO_8__EPIT2_OUT 0x244 0x614 0x000 0x2 0x0
703#define MX6Q_PAD_GPIO_8__FLEXCAN1_RX 0x244 0x614 0x7e4 0x3 0x1
704#define MX6Q_PAD_GPIO_8__UART2_RX_DATA 0x244 0x614 0x928 0x4 0x3
705#define MX6Q_PAD_GPIO_8__UART2_TX_DATA 0x244 0x614 0x000 0x4 0x0
706#define MX6Q_PAD_GPIO_8__GPIO1_IO08 0x244 0x614 0x000 0x5 0x0
707#define MX6Q_PAD_GPIO_8__SPDIF_SR_CLK 0x244 0x614 0x000 0x6 0x0
708#define MX6Q_PAD_GPIO_8__USB_OTG_PWR_CTL_WAKE 0x244 0x614 0x000 0x7 0x0
709#define MX6Q_PAD_GPIO_16__ESAI_TX3_RX2 0x248 0x618 0x880 0x0 0x1
710#define MX6Q_PAD_GPIO_16__ENET_1588_EVENT2_IN 0x248 0x618 0x000 0x1 0x0
711#define MX6Q_PAD_GPIO_16__ENET_REF_CLK 0x248 0x618 0x83c 0x2 0x1
712#define MX6Q_PAD_GPIO_16__SD1_LCTL 0x248 0x618 0x000 0x3 0x0
713#define MX6Q_PAD_GPIO_16__SPDIF_IN 0x248 0x618 0x914 0x4 0x3
714#define MX6Q_PAD_GPIO_16__GPIO7_IO11 0x248 0x618 0x000 0x5 0x0
715#define MX6Q_PAD_GPIO_16__I2C3_SDA 0x248 0x618 0x8ac 0x6 0x2
716#define MX6Q_PAD_GPIO_16__JTAG_DE_B 0x248 0x618 0x000 0x7 0x0
717#define MX6Q_PAD_GPIO_17__ESAI_TX0 0x24c 0x61c 0x874 0x0 0x0
718#define MX6Q_PAD_GPIO_17__ENET_1588_EVENT3_IN 0x24c 0x61c 0x000 0x1 0x0
719#define MX6Q_PAD_GPIO_17__CCM_PMIC_READY 0x24c 0x61c 0x7f0 0x2 0x1
720#define MX6Q_PAD_GPIO_17__SDMA_EXT_EVENT0 0x24c 0x61c 0x90c 0x3 0x1
721#define MX6Q_PAD_GPIO_17__SPDIF_OUT 0x24c 0x61c 0x000 0x4 0x0
722#define MX6Q_PAD_GPIO_17__GPIO7_IO12 0x24c 0x61c 0x000 0x5 0x0
723#define MX6Q_PAD_GPIO_18__ESAI_TX1 0x250 0x620 0x878 0x0 0x0
724#define MX6Q_PAD_GPIO_18__ENET_RX_CLK 0x250 0x620 0x844 0x1 0x1
725#define MX6Q_PAD_GPIO_18__SD3_VSELECT 0x250 0x620 0x000 0x2 0x0
726#define MX6Q_PAD_GPIO_18__SDMA_EXT_EVENT1 0x250 0x620 0x910 0x3 0x1
727#define MX6Q_PAD_GPIO_18__ASRC_EXT_CLK 0x250 0x620 0x7b0 0x4 0x2
728#define MX6Q_PAD_GPIO_18__GPIO7_IO13 0x250 0x620 0x000 0x5 0x0
729#define MX6Q_PAD_GPIO_18__SNVS_VIO_5_CTL 0x250 0x620 0x000 0x6 0x0
730#define MX6Q_PAD_GPIO_19__KEY_COL5 0x254 0x624 0x8e8 0x0 0x1
731#define MX6Q_PAD_GPIO_19__ENET_1588_EVENT0_OUT 0x254 0x624 0x000 0x1 0x0
732#define MX6Q_PAD_GPIO_19__SPDIF_OUT 0x254 0x624 0x000 0x2 0x0
733#define MX6Q_PAD_GPIO_19__CCM_CLKO1 0x254 0x624 0x000 0x3 0x0
734#define MX6Q_PAD_GPIO_19__ECSPI1_RDY 0x254 0x624 0x000 0x4 0x0
735#define MX6Q_PAD_GPIO_19__GPIO4_IO05 0x254 0x624 0x000 0x5 0x0
736#define MX6Q_PAD_GPIO_19__ENET_TX_ER 0x254 0x624 0x000 0x6 0x0
737#define MX6Q_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x258 0x628 0x000 0x0 0x0
738#define MX6Q_PAD_CSI0_PIXCLK__GPIO5_IO18 0x258 0x628 0x000 0x5 0x0
739#define MX6Q_PAD_CSI0_PIXCLK__ARM_EVENTO 0x258 0x628 0x000 0x7 0x0
740#define MX6Q_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x25c 0x62c 0x000 0x0 0x0
741#define MX6Q_PAD_CSI0_MCLK__CCM_CLKO1 0x25c 0x62c 0x000 0x3 0x0
742#define MX6Q_PAD_CSI0_MCLK__GPIO5_IO19 0x25c 0x62c 0x000 0x5 0x0
743#define MX6Q_PAD_CSI0_MCLK__ARM_TRACE_CTL 0x25c 0x62c 0x000 0x7 0x0
744#define MX6Q_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x260 0x630 0x000 0x0 0x0
745#define MX6Q_PAD_CSI0_DATA_EN__EIM_DATA00 0x260 0x630 0x000 0x1 0x0
746#define MX6Q_PAD_CSI0_DATA_EN__GPIO5_IO20 0x260 0x630 0x000 0x5 0x0
747#define MX6Q_PAD_CSI0_DATA_EN__ARM_TRACE_CLK 0x260 0x630 0x000 0x7 0x0
748#define MX6Q_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x264 0x634 0x000 0x0 0x0
749#define MX6Q_PAD_CSI0_VSYNC__EIM_DATA01 0x264 0x634 0x000 0x1 0x0
750#define MX6Q_PAD_CSI0_VSYNC__GPIO5_IO21 0x264 0x634 0x000 0x5 0x0
751#define MX6Q_PAD_CSI0_VSYNC__ARM_TRACE00 0x264 0x634 0x000 0x7 0x0
752#define MX6Q_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x268 0x638 0x000 0x0 0x0
753#define MX6Q_PAD_CSI0_DAT4__EIM_DATA02 0x268 0x638 0x000 0x1 0x0
754#define MX6Q_PAD_CSI0_DAT4__ECSPI1_SCLK 0x268 0x638 0x7f4 0x2 0x3
755#define MX6Q_PAD_CSI0_DAT4__KEY_COL5 0x268 0x638 0x8e8 0x3 0x2
756#define MX6Q_PAD_CSI0_DAT4__AUD3_TXC 0x268 0x638 0x000 0x4 0x0
757#define MX6Q_PAD_CSI0_DAT4__GPIO5_IO22 0x268 0x638 0x000 0x5 0x0
758#define MX6Q_PAD_CSI0_DAT4__ARM_TRACE01 0x268 0x638 0x000 0x7 0x0
759#define MX6Q_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x26c 0x63c 0x000 0x0 0x0
760#define MX6Q_PAD_CSI0_DAT5__EIM_DATA03 0x26c 0x63c 0x000 0x1 0x0
761#define MX6Q_PAD_CSI0_DAT5__ECSPI1_MOSI 0x26c 0x63c 0x7fc 0x2 0x3
762#define MX6Q_PAD_CSI0_DAT5__KEY_ROW5 0x26c 0x63c 0x8f4 0x3 0x1
763#define MX6Q_PAD_CSI0_DAT5__AUD3_TXD 0x26c 0x63c 0x000 0x4 0x0
764#define MX6Q_PAD_CSI0_DAT5__GPIO5_IO23 0x26c 0x63c 0x000 0x5 0x0
765#define MX6Q_PAD_CSI0_DAT5__ARM_TRACE02 0x26c 0x63c 0x000 0x7 0x0
766#define MX6Q_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x270 0x640 0x000 0x0 0x0
767#define MX6Q_PAD_CSI0_DAT6__EIM_DATA04 0x270 0x640 0x000 0x1 0x0
768#define MX6Q_PAD_CSI0_DAT6__ECSPI1_MISO 0x270 0x640 0x7f8 0x2 0x3
769#define MX6Q_PAD_CSI0_DAT6__KEY_COL6 0x270 0x640 0x8ec 0x3 0x1
770#define MX6Q_PAD_CSI0_DAT6__AUD3_TXFS 0x270 0x640 0x000 0x4 0x0
771#define MX6Q_PAD_CSI0_DAT6__GPIO5_IO24 0x270 0x640 0x000 0x5 0x0
772#define MX6Q_PAD_CSI0_DAT6__ARM_TRACE03 0x270 0x640 0x000 0x7 0x0
773#define MX6Q_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x274 0x644 0x000 0x0 0x0
774#define MX6Q_PAD_CSI0_DAT7__EIM_DATA05 0x274 0x644 0x000 0x1 0x0
775#define MX6Q_PAD_CSI0_DAT7__ECSPI1_SS0 0x274 0x644 0x800 0x2 0x3
776#define MX6Q_PAD_CSI0_DAT7__KEY_ROW6 0x274 0x644 0x8f8 0x3 0x2
777#define MX6Q_PAD_CSI0_DAT7__AUD3_RXD 0x274 0x644 0x000 0x4 0x0
778#define MX6Q_PAD_CSI0_DAT7__GPIO5_IO25 0x274 0x644 0x000 0x5 0x0
779#define MX6Q_PAD_CSI0_DAT7__ARM_TRACE04 0x274 0x644 0x000 0x7 0x0
780#define MX6Q_PAD_CSI0_DAT8__IPU1_CSI0_DATA08 0x278 0x648 0x000 0x0 0x0
781#define MX6Q_PAD_CSI0_DAT8__EIM_DATA06 0x278 0x648 0x000 0x1 0x0
782#define MX6Q_PAD_CSI0_DAT8__ECSPI2_SCLK 0x278 0x648 0x810 0x2 0x2
783#define MX6Q_PAD_CSI0_DAT8__KEY_COL7 0x278 0x648 0x8f0 0x3 0x2
784#define MX6Q_PAD_CSI0_DAT8__I2C1_SDA 0x278 0x648 0x89c 0x4 0x1
785#define MX6Q_PAD_CSI0_DAT8__GPIO5_IO26 0x278 0x648 0x000 0x5 0x0
786#define MX6Q_PAD_CSI0_DAT8__ARM_TRACE05 0x278 0x648 0x000 0x7 0x0
787#define MX6Q_PAD_CSI0_DAT9__IPU1_CSI0_DATA09 0x27c 0x64c 0x000 0x0 0x0
788#define MX6Q_PAD_CSI0_DAT9__EIM_DATA07 0x27c 0x64c 0x000 0x1 0x0
789#define MX6Q_PAD_CSI0_DAT9__ECSPI2_MOSI 0x27c 0x64c 0x818 0x2 0x2
790#define MX6Q_PAD_CSI0_DAT9__KEY_ROW7 0x27c 0x64c 0x8fc 0x3 0x2
791#define MX6Q_PAD_CSI0_DAT9__I2C1_SCL 0x27c 0x64c 0x898 0x4 0x1
792#define MX6Q_PAD_CSI0_DAT9__GPIO5_IO27 0x27c 0x64c 0x000 0x5 0x0
793#define MX6Q_PAD_CSI0_DAT9__ARM_TRACE06 0x27c 0x64c 0x000 0x7 0x0
794#define MX6Q_PAD_CSI0_DAT10__IPU1_CSI0_DATA10 0x280 0x650 0x000 0x0 0x0
795#define MX6Q_PAD_CSI0_DAT10__AUD3_RXC 0x280 0x650 0x000 0x1 0x0
796#define MX6Q_PAD_CSI0_DAT10__ECSPI2_MISO 0x280 0x650 0x814 0x2 0x2
797#define MX6Q_PAD_CSI0_DAT10__UART1_TX_DATA 0x280 0x650 0x000 0x3 0x0
798#define MX6Q_PAD_CSI0_DAT10__UART1_RX_DATA 0x280 0x650 0x920 0x3 0x0
799#define MX6Q_PAD_CSI0_DAT10__GPIO5_IO28 0x280 0x650 0x000 0x5 0x0
800#define MX6Q_PAD_CSI0_DAT10__ARM_TRACE07 0x280 0x650 0x000 0x7 0x0
801#define MX6Q_PAD_CSI0_DAT11__IPU1_CSI0_DATA11 0x284 0x654 0x000 0x0 0x0
802#define MX6Q_PAD_CSI0_DAT11__AUD3_RXFS 0x284 0x654 0x000 0x1 0x0
803#define MX6Q_PAD_CSI0_DAT11__ECSPI2_SS0 0x284 0x654 0x81c 0x2 0x2
804#define MX6Q_PAD_CSI0_DAT11__UART1_RX_DATA 0x284 0x654 0x920 0x3 0x1
805#define MX6Q_PAD_CSI0_DAT11__UART1_TX_DATA 0x284 0x654 0x000 0x3 0x0
806#define MX6Q_PAD_CSI0_DAT11__GPIO5_IO29 0x284 0x654 0x000 0x5 0x0
807#define MX6Q_PAD_CSI0_DAT11__ARM_TRACE08 0x284 0x654 0x000 0x7 0x0
808#define MX6Q_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x288 0x658 0x000 0x0 0x0
809#define MX6Q_PAD_CSI0_DAT12__EIM_DATA08 0x288 0x658 0x000 0x1 0x0
810#define MX6Q_PAD_CSI0_DAT12__UART4_TX_DATA 0x288 0x658 0x000 0x3 0x0
811#define MX6Q_PAD_CSI0_DAT12__UART4_RX_DATA 0x288 0x658 0x938 0x3 0x2
812#define MX6Q_PAD_CSI0_DAT12__GPIO5_IO30 0x288 0x658 0x000 0x5 0x0
813#define MX6Q_PAD_CSI0_DAT12__ARM_TRACE09 0x288 0x658 0x000 0x7 0x0
814#define MX6Q_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x28c 0x65c 0x000 0x0 0x0
815#define MX6Q_PAD_CSI0_DAT13__EIM_DATA09 0x28c 0x65c 0x000 0x1 0x0
816#define MX6Q_PAD_CSI0_DAT13__UART4_RX_DATA 0x28c 0x65c 0x938 0x3 0x3
817#define MX6Q_PAD_CSI0_DAT13__UART4_TX_DATA 0x28c 0x65c 0x000 0x3 0x0
818#define MX6Q_PAD_CSI0_DAT13__GPIO5_IO31 0x28c 0x65c 0x000 0x5 0x0
819#define MX6Q_PAD_CSI0_DAT13__ARM_TRACE10 0x28c 0x65c 0x000 0x7 0x0
820#define MX6Q_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x290 0x660 0x000 0x0 0x0
821#define MX6Q_PAD_CSI0_DAT14__EIM_DATA10 0x290 0x660 0x000 0x1 0x0
822#define MX6Q_PAD_CSI0_DAT14__UART5_TX_DATA 0x290 0x660 0x000 0x3 0x0
823#define MX6Q_PAD_CSI0_DAT14__UART5_RX_DATA 0x290 0x660 0x940 0x3 0x2
824#define MX6Q_PAD_CSI0_DAT14__GPIO6_IO00 0x290 0x660 0x000 0x5 0x0
825#define MX6Q_PAD_CSI0_DAT14__ARM_TRACE11 0x290 0x660 0x000 0x7 0x0
826#define MX6Q_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x294 0x664 0x000 0x0 0x0
827#define MX6Q_PAD_CSI0_DAT15__EIM_DATA11 0x294 0x664 0x000 0x1 0x0
828#define MX6Q_PAD_CSI0_DAT15__UART5_RX_DATA 0x294 0x664 0x940 0x3 0x3
829#define MX6Q_PAD_CSI0_DAT15__UART5_TX_DATA 0x294 0x664 0x000 0x3 0x0
830#define MX6Q_PAD_CSI0_DAT15__GPIO6_IO01 0x294 0x664 0x000 0x5 0x0
831#define MX6Q_PAD_CSI0_DAT15__ARM_TRACE12 0x294 0x664 0x000 0x7 0x0
832#define MX6Q_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x298 0x668 0x000 0x0 0x0
833#define MX6Q_PAD_CSI0_DAT16__EIM_DATA12 0x298 0x668 0x000 0x1 0x0
834#define MX6Q_PAD_CSI0_DAT16__UART4_RTS_B 0x298 0x668 0x934 0x3 0x0
835#define MX6Q_PAD_CSI0_DAT16__UART4_CTS_B 0x298 0x668 0x000 0x3 0x0
836#define MX6Q_PAD_CSI0_DAT16__GPIO6_IO02 0x298 0x668 0x000 0x5 0x0
837#define MX6Q_PAD_CSI0_DAT16__ARM_TRACE13 0x298 0x668 0x000 0x7 0x0
838#define MX6Q_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x29c 0x66c 0x000 0x0 0x0
839#define MX6Q_PAD_CSI0_DAT17__EIM_DATA13 0x29c 0x66c 0x000 0x1 0x0
840#define MX6Q_PAD_CSI0_DAT17__UART4_CTS_B 0x29c 0x66c 0x000 0x3 0x0
841#define MX6Q_PAD_CSI0_DAT17__UART4_RTS_B 0x29c 0x66c 0x934 0x3 0x1
842#define MX6Q_PAD_CSI0_DAT17__GPIO6_IO03 0x29c 0x66c 0x000 0x5 0x0
843#define MX6Q_PAD_CSI0_DAT17__ARM_TRACE14 0x29c 0x66c 0x000 0x7 0x0
844#define MX6Q_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x2a0 0x670 0x000 0x0 0x0
845#define MX6Q_PAD_CSI0_DAT18__EIM_DATA14 0x2a0 0x670 0x000 0x1 0x0
846#define MX6Q_PAD_CSI0_DAT18__UART5_RTS_B 0x2a0 0x670 0x93c 0x3 0x2
847#define MX6Q_PAD_CSI0_DAT18__UART5_CTS_B 0x2a0 0x670 0x000 0x3 0x0
848#define MX6Q_PAD_CSI0_DAT18__GPIO6_IO04 0x2a0 0x670 0x000 0x5 0x0
849#define MX6Q_PAD_CSI0_DAT18__ARM_TRACE15 0x2a0 0x670 0x000 0x7 0x0
850#define MX6Q_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x2a4 0x674 0x000 0x0 0x0
851#define MX6Q_PAD_CSI0_DAT19__EIM_DATA15 0x2a4 0x674 0x000 0x1 0x0
852#define MX6Q_PAD_CSI0_DAT19__UART5_CTS_B 0x2a4 0x674 0x000 0x3 0x0
853#define MX6Q_PAD_CSI0_DAT19__UART5_RTS_B 0x2a4 0x674 0x93c 0x3 0x3
854#define MX6Q_PAD_CSI0_DAT19__GPIO6_IO05 0x2a4 0x674 0x000 0x5 0x0
855#define MX6Q_PAD_SD3_DAT7__SD3_DATA7 0x2a8 0x690 0x000 0x0 0x0
856#define MX6Q_PAD_SD3_DAT7__UART1_TX_DATA 0x2a8 0x690 0x000 0x1 0x0
857#define MX6Q_PAD_SD3_DAT7__UART1_RX_DATA 0x2a8 0x690 0x920 0x1 0x2
858#define MX6Q_PAD_SD3_DAT7__GPIO6_IO17 0x2a8 0x690 0x000 0x5 0x0
859#define MX6Q_PAD_SD3_DAT6__SD3_DATA6 0x2ac 0x694 0x000 0x0 0x0
860#define MX6Q_PAD_SD3_DAT6__UART1_RX_DATA 0x2ac 0x694 0x920 0x1 0x3
861#define MX6Q_PAD_SD3_DAT6__UART1_TX_DATA 0x2ac 0x694 0x000 0x1 0x0
862#define MX6Q_PAD_SD3_DAT6__GPIO6_IO18 0x2ac 0x694 0x000 0x5 0x0
863#define MX6Q_PAD_SD3_DAT5__SD3_DATA5 0x2b0 0x698 0x000 0x0 0x0
864#define MX6Q_PAD_SD3_DAT5__UART2_TX_DATA 0x2b0 0x698 0x000 0x1 0x0
865#define MX6Q_PAD_SD3_DAT5__UART2_RX_DATA 0x2b0 0x698 0x928 0x1 0x4
866#define MX6Q_PAD_SD3_DAT5__GPIO7_IO00 0x2b0 0x698 0x000 0x5 0x0
867#define MX6Q_PAD_SD3_DAT4__SD3_DATA4 0x2b4 0x69c 0x000 0x0 0x0
868#define MX6Q_PAD_SD3_DAT4__UART2_RX_DATA 0x2b4 0x69c 0x928 0x1 0x5
869#define MX6Q_PAD_SD3_DAT4__UART2_TX_DATA 0x2b4 0x69c 0x000 0x1 0x0
870#define MX6Q_PAD_SD3_DAT4__GPIO7_IO01 0x2b4 0x69c 0x000 0x5 0x0
871#define MX6Q_PAD_SD3_CMD__SD3_CMD 0x2b8 0x6a0 0x000 0x0 0x0
872#define MX6Q_PAD_SD3_CMD__UART2_CTS_B 0x2b8 0x6a0 0x000 0x1 0x0
873#define MX6Q_PAD_SD3_CMD__UART2_RTS_B 0x2b8 0x6a0 0x924 0x1 0x2
874#define MX6Q_PAD_SD3_CMD__FLEXCAN1_TX 0x2b8 0x6a0 0x000 0x2 0x0
875#define MX6Q_PAD_SD3_CMD__GPIO7_IO02 0x2b8 0x6a0 0x000 0x5 0x0
876#define MX6Q_PAD_SD3_CLK__SD3_CLK 0x2bc 0x6a4 0x000 0x0 0x0
877#define MX6Q_PAD_SD3_CLK__UART2_RTS_B 0x2bc 0x6a4 0x924 0x1 0x3
878#define MX6Q_PAD_SD3_CLK__UART2_CTS_B 0x2bc 0x6a4 0x000 0x1 0x0
879#define MX6Q_PAD_SD3_CLK__FLEXCAN1_RX 0x2bc 0x6a4 0x7e4 0x2 0x2
880#define MX6Q_PAD_SD3_CLK__GPIO7_IO03 0x2bc 0x6a4 0x000 0x5 0x0
881#define MX6Q_PAD_SD3_DAT0__SD3_DATA0 0x2c0 0x6a8 0x000 0x0 0x0
882#define MX6Q_PAD_SD3_DAT0__UART1_CTS_B 0x2c0 0x6a8 0x000 0x1 0x0
883#define MX6Q_PAD_SD3_DAT0__UART1_RTS_B 0x2c0 0x6a8 0x91c 0x1 0x2
884#define MX6Q_PAD_SD3_DAT0__FLEXCAN2_TX 0x2c0 0x6a8 0x000 0x2 0x0
885#define MX6Q_PAD_SD3_DAT0__GPIO7_IO04 0x2c0 0x6a8 0x000 0x5 0x0
886#define MX6Q_PAD_SD3_DAT1__SD3_DATA1 0x2c4 0x6ac 0x000 0x0 0x0
887#define MX6Q_PAD_SD3_DAT1__UART1_RTS_B 0x2c4 0x6ac 0x91c 0x1 0x3
888#define MX6Q_PAD_SD3_DAT1__UART1_CTS_B 0x2c4 0x6ac 0x000 0x1 0x0
889#define MX6Q_PAD_SD3_DAT1__FLEXCAN2_RX 0x2c4 0x6ac 0x7e8 0x2 0x1
890#define MX6Q_PAD_SD3_DAT1__GPIO7_IO05 0x2c4 0x6ac 0x000 0x5 0x0
891#define MX6Q_PAD_SD3_DAT2__SD3_DATA2 0x2c8 0x6b0 0x000 0x0 0x0
892#define MX6Q_PAD_SD3_DAT2__GPIO7_IO06 0x2c8 0x6b0 0x000 0x5 0x0
893#define MX6Q_PAD_SD3_DAT3__SD3_DATA3 0x2cc 0x6b4 0x000 0x0 0x0
894#define MX6Q_PAD_SD3_DAT3__UART3_CTS_B 0x2cc 0x6b4 0x000 0x1 0x0
895#define MX6Q_PAD_SD3_DAT3__UART3_RTS_B 0x2cc 0x6b4 0x92c 0x1 0x4
896#define MX6Q_PAD_SD3_DAT3__GPIO7_IO07 0x2cc 0x6b4 0x000 0x5 0x0
897#define MX6Q_PAD_SD3_RST__SD3_RESET 0x2d0 0x6b8 0x000 0x0 0x0
898#define MX6Q_PAD_SD3_RST__UART3_RTS_B 0x2d0 0x6b8 0x92c 0x1 0x5
899#define MX6Q_PAD_SD3_RST__UART3_CTS_B 0x2d0 0x6b8 0x000 0x1 0x0
900#define MX6Q_PAD_SD3_RST__GPIO7_IO08 0x2d0 0x6b8 0x000 0x5 0x0
901#define MX6Q_PAD_NANDF_CLE__NAND_CLE 0x2d4 0x6bc 0x000 0x0 0x0
902#define MX6Q_PAD_NANDF_CLE__IPU2_SISG4 0x2d4 0x6bc 0x000 0x1 0x0
903#define MX6Q_PAD_NANDF_CLE__GPIO6_IO07 0x2d4 0x6bc 0x000 0x5 0x0
904#define MX6Q_PAD_NANDF_ALE__NAND_ALE 0x2d8 0x6c0 0x000 0x0 0x0
905#define MX6Q_PAD_NANDF_ALE__SD4_RESET 0x2d8 0x6c0 0x000 0x1 0x0
906#define MX6Q_PAD_NANDF_ALE__GPIO6_IO08 0x2d8 0x6c0 0x000 0x5 0x0
907#define MX6Q_PAD_NANDF_WP_B__NAND_WP_B 0x2dc 0x6c4 0x000 0x0 0x0
908#define MX6Q_PAD_NANDF_WP_B__IPU2_SISG5 0x2dc 0x6c4 0x000 0x1 0x0
909#define MX6Q_PAD_NANDF_WP_B__GPIO6_IO09 0x2dc 0x6c4 0x000 0x5 0x0
910#define MX6Q_PAD_NANDF_RB0__NAND_READY_B 0x2e0 0x6c8 0x000 0x0 0x0
911#define MX6Q_PAD_NANDF_RB0__IPU2_DI0_PIN01 0x2e0 0x6c8 0x000 0x1 0x0
912#define MX6Q_PAD_NANDF_RB0__GPIO6_IO10 0x2e0 0x6c8 0x000 0x5 0x0
913#define MX6Q_PAD_NANDF_CS0__NAND_CE0_B 0x2e4 0x6cc 0x000 0x0 0x0
914#define MX6Q_PAD_NANDF_CS0__GPIO6_IO11 0x2e4 0x6cc 0x000 0x5 0x0
915#define MX6Q_PAD_NANDF_CS1__NAND_CE1_B 0x2e8 0x6d0 0x000 0x0 0x0
916#define MX6Q_PAD_NANDF_CS1__SD4_VSELECT 0x2e8 0x6d0 0x000 0x1 0x0
917#define MX6Q_PAD_NANDF_CS1__SD3_VSELECT 0x2e8 0x6d0 0x000 0x2 0x0
918#define MX6Q_PAD_NANDF_CS1__GPIO6_IO14 0x2e8 0x6d0 0x000 0x5 0x0
919#define MX6Q_PAD_NANDF_CS2__NAND_CE2_B 0x2ec 0x6d4 0x000 0x0 0x0
920#define MX6Q_PAD_NANDF_CS2__IPU1_SISG0 0x2ec 0x6d4 0x000 0x1 0x0
921#define MX6Q_PAD_NANDF_CS2__ESAI_TX0 0x2ec 0x6d4 0x874 0x2 0x1
922#define MX6Q_PAD_NANDF_CS2__EIM_CRE 0x2ec 0x6d4 0x000 0x3 0x0
923#define MX6Q_PAD_NANDF_CS2__CCM_CLKO2 0x2ec 0x6d4 0x000 0x4 0x0
924#define MX6Q_PAD_NANDF_CS2__GPIO6_IO15 0x2ec 0x6d4 0x000 0x5 0x0
925#define MX6Q_PAD_NANDF_CS2__IPU2_SISG0 0x2ec 0x6d4 0x000 0x6 0x0
926#define MX6Q_PAD_NANDF_CS3__NAND_CE3_B 0x2f0 0x6d8 0x000 0x0 0x0
927#define MX6Q_PAD_NANDF_CS3__IPU1_SISG1 0x2f0 0x6d8 0x000 0x1 0x0
928#define MX6Q_PAD_NANDF_CS3__ESAI_TX1 0x2f0 0x6d8 0x878 0x2 0x1
929#define MX6Q_PAD_NANDF_CS3__EIM_ADDR26 0x2f0 0x6d8 0x000 0x3 0x0
930#define MX6Q_PAD_NANDF_CS3__GPIO6_IO16 0x2f0 0x6d8 0x000 0x5 0x0
931#define MX6Q_PAD_NANDF_CS3__IPU2_SISG1 0x2f0 0x6d8 0x000 0x6 0x0
932#define MX6Q_PAD_SD4_CMD__SD4_CMD 0x2f4 0x6dc 0x000 0x0 0x0
933#define MX6Q_PAD_SD4_CMD__NAND_RE_B 0x2f4 0x6dc 0x000 0x1 0x0
934#define MX6Q_PAD_SD4_CMD__UART3_TX_DATA 0x2f4 0x6dc 0x000 0x2 0x0
935#define MX6Q_PAD_SD4_CMD__UART3_RX_DATA 0x2f4 0x6dc 0x930 0x2 0x2
936#define MX6Q_PAD_SD4_CMD__GPIO7_IO09 0x2f4 0x6dc 0x000 0x5 0x0
937#define MX6Q_PAD_SD4_CLK__SD4_CLK 0x2f8 0x6e0 0x000 0x0 0x0
938#define MX6Q_PAD_SD4_CLK__NAND_WE_B 0x2f8 0x6e0 0x000 0x1 0x0
939#define MX6Q_PAD_SD4_CLK__UART3_RX_DATA 0x2f8 0x6e0 0x930 0x2 0x3
940#define MX6Q_PAD_SD4_CLK__UART3_TX_DATA 0x2f8 0x6e0 0x000 0x2 0x0
941#define MX6Q_PAD_SD4_CLK__GPIO7_IO10 0x2f8 0x6e0 0x000 0x5 0x0
942#define MX6Q_PAD_NANDF_D0__NAND_DATA00 0x2fc 0x6e4 0x000 0x0 0x0
943#define MX6Q_PAD_NANDF_D0__SD1_DATA4 0x2fc 0x6e4 0x000 0x1 0x0
944#define MX6Q_PAD_NANDF_D0__GPIO2_IO00 0x2fc 0x6e4 0x000 0x5 0x0
945#define MX6Q_PAD_NANDF_D1__NAND_DATA01 0x300 0x6e8 0x000 0x0 0x0
946#define MX6Q_PAD_NANDF_D1__SD1_DATA5 0x300 0x6e8 0x000 0x1 0x0
947#define MX6Q_PAD_NANDF_D1__GPIO2_IO01 0x300 0x6e8 0x000 0x5 0x0
948#define MX6Q_PAD_NANDF_D2__NAND_DATA02 0x304 0x6ec 0x000 0x0 0x0
949#define MX6Q_PAD_NANDF_D2__SD1_DATA6 0x304 0x6ec 0x000 0x1 0x0
950#define MX6Q_PAD_NANDF_D2__GPIO2_IO02 0x304 0x6ec 0x000 0x5 0x0
951#define MX6Q_PAD_NANDF_D3__NAND_DATA03 0x308 0x6f0 0x000 0x0 0x0
952#define MX6Q_PAD_NANDF_D3__SD1_DATA7 0x308 0x6f0 0x000 0x1 0x0
953#define MX6Q_PAD_NANDF_D3__GPIO2_IO03 0x308 0x6f0 0x000 0x5 0x0
954#define MX6Q_PAD_NANDF_D4__NAND_DATA04 0x30c 0x6f4 0x000 0x0 0x0
955#define MX6Q_PAD_NANDF_D4__SD2_DATA4 0x30c 0x6f4 0x000 0x1 0x0
956#define MX6Q_PAD_NANDF_D4__GPIO2_IO04 0x30c 0x6f4 0x000 0x5 0x0
957#define MX6Q_PAD_NANDF_D5__NAND_DATA05 0x310 0x6f8 0x000 0x0 0x0
958#define MX6Q_PAD_NANDF_D5__SD2_DATA5 0x310 0x6f8 0x000 0x1 0x0
959#define MX6Q_PAD_NANDF_D5__GPIO2_IO05 0x310 0x6f8 0x000 0x5 0x0
960#define MX6Q_PAD_NANDF_D6__NAND_DATA06 0x314 0x6fc 0x000 0x0 0x0
961#define MX6Q_PAD_NANDF_D6__SD2_DATA6 0x314 0x6fc 0x000 0x1 0x0
962#define MX6Q_PAD_NANDF_D6__GPIO2_IO06 0x314 0x6fc 0x000 0x5 0x0
963#define MX6Q_PAD_NANDF_D7__NAND_DATA07 0x318 0x700 0x000 0x0 0x0
964#define MX6Q_PAD_NANDF_D7__SD2_DATA7 0x318 0x700 0x000 0x1 0x0
965#define MX6Q_PAD_NANDF_D7__GPIO2_IO07 0x318 0x700 0x000 0x5 0x0
966#define MX6Q_PAD_SD4_DAT0__SD4_DATA0 0x31c 0x704 0x000 0x1 0x0
967#define MX6Q_PAD_SD4_DAT0__NAND_DQS 0x31c 0x704 0x000 0x2 0x0
968#define MX6Q_PAD_SD4_DAT0__GPIO2_IO08 0x31c 0x704 0x000 0x5 0x0
969#define MX6Q_PAD_SD4_DAT1__SD4_DATA1 0x320 0x708 0x000 0x1 0x0
970#define MX6Q_PAD_SD4_DAT1__PWM3_OUT 0x320 0x708 0x000 0x2 0x0
971#define MX6Q_PAD_SD4_DAT1__GPIO2_IO09 0x320 0x708 0x000 0x5 0x0
972#define MX6Q_PAD_SD4_DAT2__SD4_DATA2 0x324 0x70c 0x000 0x1 0x0
973#define MX6Q_PAD_SD4_DAT2__PWM4_OUT 0x324 0x70c 0x000 0x2 0x0
974#define MX6Q_PAD_SD4_DAT2__GPIO2_IO10 0x324 0x70c 0x000 0x5 0x0
975#define MX6Q_PAD_SD4_DAT3__SD4_DATA3 0x328 0x710 0x000 0x1 0x0
976#define MX6Q_PAD_SD4_DAT3__GPIO2_IO11 0x328 0x710 0x000 0x5 0x0
977#define MX6Q_PAD_SD4_DAT4__SD4_DATA4 0x32c 0x714 0x000 0x1 0x0
978#define MX6Q_PAD_SD4_DAT4__UART2_RX_DATA 0x32c 0x714 0x928 0x2 0x6
979#define MX6Q_PAD_SD4_DAT4__UART2_TX_DATA 0x32c 0x714 0x000 0x2 0x0
980#define MX6Q_PAD_SD4_DAT4__GPIO2_IO12 0x32c 0x714 0x000 0x5 0x0
981#define MX6Q_PAD_SD4_DAT5__SD4_DATA5 0x330 0x718 0x000 0x1 0x0
982#define MX6Q_PAD_SD4_DAT5__UART2_RTS_B 0x330 0x718 0x924 0x2 0x4
983#define MX6Q_PAD_SD4_DAT5__UART2_CTS_B 0x330 0x718 0x000 0x2 0x0
984#define MX6Q_PAD_SD4_DAT5__GPIO2_IO13 0x330 0x718 0x000 0x5 0x0
985#define MX6Q_PAD_SD4_DAT6__SD4_DATA6 0x334 0x71c 0x000 0x1 0x0
986#define MX6Q_PAD_SD4_DAT6__UART2_CTS_B 0x334 0x71c 0x000 0x2 0x0
987#define MX6Q_PAD_SD4_DAT6__UART2_RTS_B 0x334 0x71c 0x924 0x2 0x5
988#define MX6Q_PAD_SD4_DAT6__GPIO2_IO14 0x334 0x71c 0x000 0x5 0x0
989#define MX6Q_PAD_SD4_DAT7__SD4_DATA7 0x338 0x720 0x000 0x1 0x0
990#define MX6Q_PAD_SD4_DAT7__UART2_TX_DATA 0x338 0x720 0x000 0x2 0x0
991#define MX6Q_PAD_SD4_DAT7__UART2_RX_DATA 0x338 0x720 0x928 0x2 0x7
992#define MX6Q_PAD_SD4_DAT7__GPIO2_IO15 0x338 0x720 0x000 0x5 0x0
993#define MX6Q_PAD_SD1_DAT1__SD1_DATA1 0x33c 0x724 0x000 0x0 0x0
994#define MX6Q_PAD_SD1_DAT1__ECSPI5_SS0 0x33c 0x724 0x834 0x1 0x1
995#define MX6Q_PAD_SD1_DAT1__PWM3_OUT 0x33c 0x724 0x000 0x2 0x0
996#define MX6Q_PAD_SD1_DAT1__GPT_CAPTURE2 0x33c 0x724 0x000 0x3 0x0
997#define MX6Q_PAD_SD1_DAT1__GPIO1_IO17 0x33c 0x724 0x000 0x5 0x0
998#define MX6Q_PAD_SD1_DAT0__SD1_DATA0 0x340 0x728 0x000 0x0 0x0
999#define MX6Q_PAD_SD1_DAT0__ECSPI5_MISO 0x340 0x728 0x82c 0x1 0x1
1000#define MX6Q_PAD_SD1_DAT0__GPT_CAPTURE1 0x340 0x728 0x000 0x3 0x0
1001#define MX6Q_PAD_SD1_DAT0__GPIO1_IO16 0x340 0x728 0x000 0x5 0x0
1002#define MX6Q_PAD_SD1_DAT3__SD1_DATA3 0x344 0x72c 0x000 0x0 0x0
1003#define MX6Q_PAD_SD1_DAT3__ECSPI5_SS2 0x344 0x72c 0x000 0x1 0x0
1004#define MX6Q_PAD_SD1_DAT3__GPT_COMPARE3 0x344 0x72c 0x000 0x2 0x0
1005#define MX6Q_PAD_SD1_DAT3__PWM1_OUT 0x344 0x72c 0x000 0x3 0x0
1006#define MX6Q_PAD_SD1_DAT3__WDOG2_B 0x344 0x72c 0x000 0x4 0x0
1007#define MX6Q_PAD_SD1_DAT3__GPIO1_IO21 0x344 0x72c 0x000 0x5 0x0
1008#define MX6Q_PAD_SD1_DAT3__WDOG2_RESET_B_DEB 0x344 0x72c 0x000 0x6 0x0
1009#define MX6Q_PAD_SD1_CMD__SD1_CMD 0x348 0x730 0x000 0x0 0x0
1010#define MX6Q_PAD_SD1_CMD__ECSPI5_MOSI 0x348 0x730 0x830 0x1 0x0
1011#define MX6Q_PAD_SD1_CMD__PWM4_OUT 0x348 0x730 0x000 0x2 0x0
1012#define MX6Q_PAD_SD1_CMD__GPT_COMPARE1 0x348 0x730 0x000 0x3 0x0
1013#define MX6Q_PAD_SD1_CMD__GPIO1_IO18 0x348 0x730 0x000 0x5 0x0
1014#define MX6Q_PAD_SD1_DAT2__SD1_DATA2 0x34c 0x734 0x000 0x0 0x0
1015#define MX6Q_PAD_SD1_DAT2__ECSPI5_SS1 0x34c 0x734 0x838 0x1 0x1
1016#define MX6Q_PAD_SD1_DAT2__GPT_COMPARE2 0x34c 0x734 0x000 0x2 0x0
1017#define MX6Q_PAD_SD1_DAT2__PWM2_OUT 0x34c 0x734 0x000 0x3 0x0
1018#define MX6Q_PAD_SD1_DAT2__WDOG1_B 0x34c 0x734 0x000 0x4 0x0
1019#define MX6Q_PAD_SD1_DAT2__GPIO1_IO19 0x34c 0x734 0x000 0x5 0x0
1020#define MX6Q_PAD_SD1_DAT2__WDOG1_RESET_B_DEB 0x34c 0x734 0x000 0x6 0x0
1021#define MX6Q_PAD_SD1_CLK__SD1_CLK 0x350 0x738 0x000 0x0 0x0
1022#define MX6Q_PAD_SD1_CLK__ECSPI5_SCLK 0x350 0x738 0x828 0x1 0x0
1023#define MX6Q_PAD_SD1_CLK__GPT_CLKIN 0x350 0x738 0x000 0x3 0x0
1024#define MX6Q_PAD_SD1_CLK__GPIO1_IO20 0x350 0x738 0x000 0x5 0x0
1025#define MX6Q_PAD_SD2_CLK__SD2_CLK 0x354 0x73c 0x000 0x0 0x0
1026#define MX6Q_PAD_SD2_CLK__ECSPI5_SCLK 0x354 0x73c 0x828 0x1 0x1
1027#define MX6Q_PAD_SD2_CLK__KEY_COL5 0x354 0x73c 0x8e8 0x2 0x3
1028#define MX6Q_PAD_SD2_CLK__AUD4_RXFS 0x354 0x73c 0x7c0 0x3 0x1
1029#define MX6Q_PAD_SD2_CLK__GPIO1_IO10 0x354 0x73c 0x000 0x5 0x0
1030#define MX6Q_PAD_SD2_CMD__SD2_CMD 0x358 0x740 0x000 0x0 0x0
1031#define MX6Q_PAD_SD2_CMD__ECSPI5_MOSI 0x358 0x740 0x830 0x1 0x1
1032#define MX6Q_PAD_SD2_CMD__KEY_ROW5 0x358 0x740 0x8f4 0x2 0x2
1033#define MX6Q_PAD_SD2_CMD__AUD4_RXC 0x358 0x740 0x7bc 0x3 0x1
1034#define MX6Q_PAD_SD2_CMD__GPIO1_IO11 0x358 0x740 0x000 0x5 0x0
1035#define MX6Q_PAD_SD2_DAT3__SD2_DATA3 0x35c 0x744 0x000 0x0 0x0
1036#define MX6Q_PAD_SD2_DAT3__ECSPI5_SS3 0x35c 0x744 0x000 0x1 0x0
1037#define MX6Q_PAD_SD2_DAT3__KEY_COL6 0x35c 0x744 0x8ec 0x2 0x2
1038#define MX6Q_PAD_SD2_DAT3__AUD4_TXC 0x35c 0x744 0x7c4 0x3 0x1
1039#define MX6Q_PAD_SD2_DAT3__GPIO1_IO12 0x35c 0x744 0x000 0x5 0x0
1040
1041#endif /* __DTS_IMX6Q_PINFUNC_H */
diff --git a/arch/arm/boot/dts/imx6q-sabreauto.dts b/arch/arm/boot/dts/imx6q-sabreauto.dts
index 656d489122fe..49d6f2831ec9 100644
--- a/arch/arm/boot/dts/imx6q-sabreauto.dts
+++ b/arch/arm/boot/dts/imx6q-sabreauto.dts
@@ -11,15 +11,13 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx6q.dtsi" 14
15#include "imx6q.dtsi"
16#include "imx6qdl-sabreauto.dtsi"
15 17
16/ { 18/ {
17 model = "Freescale i.MX6 Quad SABRE Automotive Board"; 19 model = "Freescale i.MX6 Quad SABRE Automotive Board";
18 compatible = "fsl,imx6q-sabreauto", "fsl,imx6q"; 20 compatible = "fsl,imx6q-sabreauto", "fsl,imx6q";
19
20 memory {
21 reg = <0x10000000 0x80000000>;
22 };
23}; 21};
24 22
25&iomuxc { 23&iomuxc {
@@ -29,30 +27,9 @@
29 hog { 27 hog {
30 pinctrl_hog: hoggrp { 28 pinctrl_hog: hoggrp {
31 fsl,pins = < 29 fsl,pins = <
32 1376 0x80000000 /* MX6Q_PAD_NANDF_CS2__GPIO_6_15 */ 30 MX6Q_PAD_NANDF_CS2__GPIO6_IO15 0x80000000
33 13 0x80000000 /* MX6Q_PAD_SD2_DAT2__GPIO_1_13 */ 31 MX6Q_PAD_SD2_DAT2__GPIO1_IO13 0x80000000
34 >; 32 >;
35 }; 33 };
36 }; 34 };
37}; 35};
38
39&uart4 {
40 pinctrl-names = "default";
41 pinctrl-0 = <&pinctrl_uart4_1>;
42 status = "okay";
43};
44
45&fec {
46 pinctrl-names = "default";
47 pinctrl-0 = <&pinctrl_enet_2>;
48 phy-mode = "rgmii";
49 status = "okay";
50};
51
52&usdhc3 {
53 pinctrl-names = "default";
54 pinctrl-0 = <&pinctrl_usdhc3_1>;
55 cd-gpios = <&gpio6 15 0>;
56 wp-gpios = <&gpio1 13 0>;
57 status = "okay";
58};
diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts
index 2ce355cd05e5..6a000666c147 100644
--- a/arch/arm/boot/dts/imx6q-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6q-sabrelite.dts
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx6q.dtsi" 14#include "imx6q.dtsi"
15 15
16/ { 16/ {
17 model = "Freescale i.MX6 Quad SABRE Lite Board"; 17 model = "Freescale i.MX6 Quad SABRE Lite Board";
@@ -91,14 +91,14 @@
91 hog { 91 hog {
92 pinctrl_hog: hoggrp { 92 pinctrl_hog: hoggrp {
93 fsl,pins = < 93 fsl,pins = <
94 1450 0x80000000 /* MX6Q_PAD_NANDF_D6__GPIO_2_6 */ 94 MX6Q_PAD_NANDF_D6__GPIO2_IO06 0x80000000
95 1458 0x80000000 /* MX6Q_PAD_NANDF_D7__GPIO_2_7 */ 95 MX6Q_PAD_NANDF_D7__GPIO2_IO07 0x80000000
96 121 0x80000000 /* MX6Q_PAD_EIM_D19__GPIO_3_19 */ 96 MX6Q_PAD_EIM_D19__GPIO3_IO19 0x80000000
97 144 0x80000000 /* MX6Q_PAD_EIM_D22__GPIO_3_22 */ 97 MX6Q_PAD_EIM_D22__GPIO3_IO22 0x80000000
98 152 0x80000000 /* MX6Q_PAD_EIM_D23__GPIO_3_23 */ 98 MX6Q_PAD_EIM_D23__GPIO3_IO23 0x80000000
99 1262 0x80000000 /* MX6Q_PAD_SD3_DAT5__GPIO_7_0 */ 99 MX6Q_PAD_SD3_DAT5__GPIO7_IO00 0x80000000
100 1270 0x1f0b0 /* MX6Q_PAD_SD3_DAT4__GPIO_7_1 */ 100 MX6Q_PAD_SD3_DAT4__GPIO7_IO01 0x1f0b0
101 953 0x80000000 /* MX6Q_PAD_GPIO_0__CCM_CLKO */ 101 MX6Q_PAD_GPIO_0__CCM_CLKO1 0x80000000
102 >; 102 >;
103 }; 103 };
104 }; 104 };
diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dts
index 2dea304a7980..442051350225 100644
--- a/arch/arm/boot/dts/imx6q-sabresd.dts
+++ b/arch/arm/boot/dts/imx6q-sabresd.dts
@@ -11,37 +11,13 @@
11 */ 11 */
12 12
13/dts-v1/; 13/dts-v1/;
14/include/ "imx6q.dtsi" 14
15#include "imx6q.dtsi"
16#include "imx6qdl-sabresd.dtsi"
15 17
16/ { 18/ {
17 model = "Freescale i.MX6Q SABRE Smart Device Board"; 19 model = "Freescale i.MX6 Quad SABRE Smart Device Board";
18 compatible = "fsl,imx6q-sabresd", "fsl,imx6q"; 20 compatible = "fsl,imx6q-sabresd", "fsl,imx6q";
19
20 memory {
21 reg = <0x10000000 0x40000000>;
22 };
23
24 gpio-keys {
25 compatible = "gpio-keys";
26
27 volume-up {
28 label = "Volume Up";
29 gpios = <&gpio1 4 0>;
30 linux,code = <115>; /* KEY_VOLUMEUP */
31 };
32
33 volume-down {
34 label = "Volume Down";
35 gpios = <&gpio1 5 0>;
36 linux,code = <114>; /* KEY_VOLUMEDOWN */
37 };
38 };
39};
40
41&uart1 {
42 pinctrl-names = "default";
43 pinctrl-0 = <&pinctrl_uart1_1>;
44 status = "okay";
45}; 21};
46 22
47&iomuxc { 23&iomuxc {
@@ -51,36 +27,13 @@
51 hog { 27 hog {
52 pinctrl_hog: hoggrp { 28 pinctrl_hog: hoggrp {
53 fsl,pins = < 29 fsl,pins = <
54 1004 0x80000000 /* MX6Q_PAD_GPIO_4__GPIO_1_4 */ 30 MX6Q_PAD_GPIO_4__GPIO1_IO04 0x80000000
55 1012 0x80000000 /* MX6Q_PAD_GPIO_5__GPIO_1_5 */ 31 MX6Q_PAD_GPIO_5__GPIO1_IO05 0x80000000
56 1402 0x80000000 /* MX6Q_PAD_NANDF_D0__GPIO_2_0 */ 32 MX6Q_PAD_NANDF_D0__GPIO2_IO00 0x80000000
57 1410 0x80000000 /* MX6Q_PAD_NANDF_D1__GPIO_2_1 */ 33 MX6Q_PAD_NANDF_D1__GPIO2_IO01 0x80000000
58 1418 0x80000000 /* MX6Q_PAD_NANDF_D2__GPIO_2_2 */ 34 MX6Q_PAD_NANDF_D2__GPIO2_IO02 0x80000000
59 1426 0x80000000 /* MX6Q_PAD_NANDF_D3__GPIO_2_3 */ 35 MX6Q_PAD_NANDF_D3__GPIO2_IO03 0x80000000
60 >; 36 >;
61 }; 37 };
62 }; 38 };
63}; 39};
64
65&fec {
66 pinctrl-names = "default";
67 pinctrl-0 = <&pinctrl_enet_1>;
68 phy-mode = "rgmii";
69 status = "okay";
70};
71
72&usdhc2 {
73 pinctrl-names = "default";
74 pinctrl-0 = <&pinctrl_usdhc2_1>;
75 cd-gpios = <&gpio2 2 0>;
76 wp-gpios = <&gpio2 3 0>;
77 status = "okay";
78};
79
80&usdhc3 {
81 pinctrl-names = "default";
82 pinctrl-0 = <&pinctrl_usdhc3_1>;
83 cd-gpios = <&gpio2 0 0>;
84 wp-gpios = <&gpio2 1 0>;
85 status = "okay";
86};
diff --git a/arch/arm/boot/dts/imx6q-sbc6x.dts b/arch/arm/boot/dts/imx6q-sbc6x.dts
new file mode 100644
index 000000000000..ee6addf149af
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-sbc6x.dts
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2013 Pavel Machek <pavel@denx.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License V2.
6 */
7
8/dts-v1/;
9#include "imx6q.dtsi"
10
11/ {
12 model = "MicroSys sbc6x board";
13 compatible = "microsys,sbc6x", "fsl,imx6q";
14
15 memory {
16 reg = <0x10000000 0x80000000>;
17 };
18};
19
20&fec {
21 pinctrl-names = "default";
22 pinctrl-0 = <&pinctrl_enet_1>;
23 phy-mode = "rgmii";
24 status = "okay";
25};
26
27&uart1 {
28 pinctrl-names = "default";
29 pinctrl-0 = <&pinctrl_uart1_1>;
30 status = "okay";
31};
32
33&usbotg {
34 pinctrl-names = "default";
35 pinctrl-0 = <&pinctrl_usbotg_1>;
36 disable-over-current;
37 status = "okay";
38};
39
40&usdhc3 {
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_usdhc3_2>;
43 status = "okay";
44};
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index cba021eb035e..21e675848bd1 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -8,7 +8,8 @@
8 * 8 *
9 */ 9 */
10 10
11/include/ "imx6qdl.dtsi" 11#include "imx6qdl.dtsi"
12#include "imx6q-pinfunc.h"
12 13
13/ { 14/ {
14 cpus { 15 cpus {
@@ -78,10 +79,19 @@
78 audmux { 79 audmux {
79 pinctrl_audmux_1: audmux-1 { 80 pinctrl_audmux_1: audmux-1 {
80 fsl,pins = < 81 fsl,pins = <
81 18 0x80000000 /* MX6Q_PAD_SD2_DAT0__AUDMUX_AUD4_RXD */ 82 MX6Q_PAD_SD2_DAT0__AUD4_RXD 0x80000000
82 1586 0x80000000 /* MX6Q_PAD_SD2_DAT3__AUDMUX_AUD4_TXC */ 83 MX6Q_PAD_SD2_DAT3__AUD4_TXC 0x80000000
83 11 0x80000000 /* MX6Q_PAD_SD2_DAT2__AUDMUX_AUD4_TXD */ 84 MX6Q_PAD_SD2_DAT2__AUD4_TXD 0x80000000
84 3 0x80000000 /* MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS */ 85 MX6Q_PAD_SD2_DAT1__AUD4_TXFS 0x80000000
86 >;
87 };
88
89 pinctrl_audmux_2: audmux-2 {
90 fsl,pins = <
91 MX6Q_PAD_CSI0_DAT7__AUD3_RXD 0x80000000
92 MX6Q_PAD_CSI0_DAT4__AUD3_TXC 0x80000000
93 MX6Q_PAD_CSI0_DAT5__AUD3_TXD 0x80000000
94 MX6Q_PAD_CSI0_DAT6__AUD3_TXFS 0x80000000
85 >; 95 >;
86 }; 96 };
87 }; 97 };
@@ -89,9 +99,19 @@
89 ecspi1 { 99 ecspi1 {
90 pinctrl_ecspi1_1: ecspi1grp-1 { 100 pinctrl_ecspi1_1: ecspi1grp-1 {
91 fsl,pins = < 101 fsl,pins = <
92 101 0x100b1 /* MX6Q_PAD_EIM_D17__ECSPI1_MISO */ 102 MX6Q_PAD_EIM_D17__ECSPI1_MISO 0x100b1
93 109 0x100b1 /* MX6Q_PAD_EIM_D18__ECSPI1_MOSI */ 103 MX6Q_PAD_EIM_D18__ECSPI1_MOSI 0x100b1
94 94 0x100b1 /* MX6Q_PAD_EIM_D16__ECSPI1_SCLK */ 104 MX6Q_PAD_EIM_D16__ECSPI1_SCLK 0x100b1
105 >;
106 };
107 };
108
109 ecspi3 {
110 pinctrl_ecspi3_1: ecspi3grp-1 {
111 fsl,pins = <
112 MX6Q_PAD_DISP0_DAT2__ECSPI3_MISO 0x100b1
113 MX6Q_PAD_DISP0_DAT1__ECSPI3_MOSI 0x100b1
114 MX6Q_PAD_DISP0_DAT0__ECSPI3_SCLK 0x100b1
95 >; 115 >;
96 }; 116 };
97 }; 117 };
@@ -99,42 +119,42 @@
99 enet { 119 enet {
100 pinctrl_enet_1: enetgrp-1 { 120 pinctrl_enet_1: enetgrp-1 {
101 fsl,pins = < 121 fsl,pins = <
102 695 0x1b0b0 /* MX6Q_PAD_ENET_MDIO__ENET_MDIO */ 122 MX6Q_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
103 756 0x1b0b0 /* MX6Q_PAD_ENET_MDC__ENET_MDC */ 123 MX6Q_PAD_ENET_MDC__ENET_MDC 0x1b0b0
104 24 0x1b0b0 /* MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC */ 124 MX6Q_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
105 30 0x1b0b0 /* MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0 */ 125 MX6Q_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
106 34 0x1b0b0 /* MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1 */ 126 MX6Q_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
107 39 0x1b0b0 /* MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2 */ 127 MX6Q_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
108 44 0x1b0b0 /* MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3 */ 128 MX6Q_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
109 56 0x1b0b0 /* MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL */ 129 MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
110 702 0x1b0b0 /* MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK */ 130 MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
111 74 0x1b0b0 /* MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC */ 131 MX6Q_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
112 52 0x1b0b0 /* MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0 */ 132 MX6Q_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
113 61 0x1b0b0 /* MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1 */ 133 MX6Q_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
114 66 0x1b0b0 /* MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2 */ 134 MX6Q_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
115 70 0x1b0b0 /* MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3 */ 135 MX6Q_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
116 48 0x1b0b0 /* MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL */ 136 MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
117 1033 0x4001b0a8 /* MX6Q_PAD_GPIO_16__ENET_ANATOP_ETHERNET_REF_OUT*/ 137 MX6Q_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8
118 >; 138 >;
119 }; 139 };
120 140
121 pinctrl_enet_2: enetgrp-2 { 141 pinctrl_enet_2: enetgrp-2 {
122 fsl,pins = < 142 fsl,pins = <
123 890 0x1b0b0 /* MX6Q_PAD_KEY_COL1__ENET_MDIO */ 143 MX6Q_PAD_KEY_COL1__ENET_MDIO 0x1b0b0
124 909 0x1b0b0 /* MX6Q_PAD_KEY_COL2__ENET_MDC */ 144 MX6Q_PAD_KEY_COL2__ENET_MDC 0x1b0b0
125 24 0x1b0b0 /* MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC */ 145 MX6Q_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
126 30 0x1b0b0 /* MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0 */ 146 MX6Q_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
127 34 0x1b0b0 /* MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1 */ 147 MX6Q_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
128 39 0x1b0b0 /* MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2 */ 148 MX6Q_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
129 44 0x1b0b0 /* MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3 */ 149 MX6Q_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
130 56 0x1b0b0 /* MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL */ 150 MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
131 702 0x1b0b0 /* MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK */ 151 MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
132 74 0x1b0b0 /* MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC */ 152 MX6Q_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
133 52 0x1b0b0 /* MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0 */ 153 MX6Q_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
134 61 0x1b0b0 /* MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1 */ 154 MX6Q_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
135 66 0x1b0b0 /* MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2 */ 155 MX6Q_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
136 70 0x1b0b0 /* MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3 */ 156 MX6Q_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
137 48 0x1b0b0 /* MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL */ 157 MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
138 >; 158 >;
139 }; 159 };
140 }; 160 };
@@ -142,25 +162,25 @@
142 gpmi-nand { 162 gpmi-nand {
143 pinctrl_gpmi_nand_1: gpmi-nand-1 { 163 pinctrl_gpmi_nand_1: gpmi-nand-1 {
144 fsl,pins = < 164 fsl,pins = <
145 1328 0xb0b1 /* MX6Q_PAD_NANDF_CLE__RAWNAND_CLE */ 165 MX6Q_PAD_NANDF_CLE__NAND_CLE 0xb0b1
146 1336 0xb0b1 /* MX6Q_PAD_NANDF_ALE__RAWNAND_ALE */ 166 MX6Q_PAD_NANDF_ALE__NAND_ALE 0xb0b1
147 1344 0xb0b1 /* MX6Q_PAD_NANDF_WP_B__RAWNAND_RESETN */ 167 MX6Q_PAD_NANDF_WP_B__NAND_WP_B 0xb0b1
148 1352 0xb000 /* MX6Q_PAD_NANDF_RB0__RAWNAND_READY0 */ 168 MX6Q_PAD_NANDF_RB0__NAND_READY_B 0xb000
149 1360 0xb0b1 /* MX6Q_PAD_NANDF_CS0__RAWNAND_CE0N */ 169 MX6Q_PAD_NANDF_CS0__NAND_CE0_B 0xb0b1
150 1365 0xb0b1 /* MX6Q_PAD_NANDF_CS1__RAWNAND_CE1N */ 170 MX6Q_PAD_NANDF_CS1__NAND_CE1_B 0xb0b1
151 1371 0xb0b1 /* MX6Q_PAD_NANDF_CS2__RAWNAND_CE2N */ 171 MX6Q_PAD_NANDF_CS2__NAND_CE2_B 0xb0b1
152 1378 0xb0b1 /* MX6Q_PAD_NANDF_CS3__RAWNAND_CE3N */ 172 MX6Q_PAD_NANDF_CS3__NAND_CE3_B 0xb0b1
153 1387 0xb0b1 /* MX6Q_PAD_SD4_CMD__RAWNAND_RDN */ 173 MX6Q_PAD_SD4_CMD__NAND_RE_B 0xb0b1
154 1393 0xb0b1 /* MX6Q_PAD_SD4_CLK__RAWNAND_WRN */ 174 MX6Q_PAD_SD4_CLK__NAND_WE_B 0xb0b1
155 1397 0xb0b1 /* MX6Q_PAD_NANDF_D0__RAWNAND_D0 */ 175 MX6Q_PAD_NANDF_D0__NAND_DATA00 0xb0b1
156 1405 0xb0b1 /* MX6Q_PAD_NANDF_D1__RAWNAND_D1 */ 176 MX6Q_PAD_NANDF_D1__NAND_DATA01 0xb0b1
157 1413 0xb0b1 /* MX6Q_PAD_NANDF_D2__RAWNAND_D2 */ 177 MX6Q_PAD_NANDF_D2__NAND_DATA02 0xb0b1
158 1421 0xb0b1 /* MX6Q_PAD_NANDF_D3__RAWNAND_D3 */ 178 MX6Q_PAD_NANDF_D3__NAND_DATA03 0xb0b1
159 1429 0xb0b1 /* MX6Q_PAD_NANDF_D4__RAWNAND_D4 */ 179 MX6Q_PAD_NANDF_D4__NAND_DATA04 0xb0b1
160 1437 0xb0b1 /* MX6Q_PAD_NANDF_D5__RAWNAND_D5 */ 180 MX6Q_PAD_NANDF_D5__NAND_DATA05 0xb0b1
161 1445 0xb0b1 /* MX6Q_PAD_NANDF_D6__RAWNAND_D6 */ 181 MX6Q_PAD_NANDF_D6__NAND_DATA06 0xb0b1
162 1453 0xb0b1 /* MX6Q_PAD_NANDF_D7__RAWNAND_D7 */ 182 MX6Q_PAD_NANDF_D7__NAND_DATA07 0xb0b1
163 1463 0x00b1 /* MX6Q_PAD_SD4_DAT0__RAWNAND_DQS */ 183 MX6Q_PAD_SD4_DAT0__NAND_DQS 0x00b1
164 >; 184 >;
165 }; 185 };
166 }; 186 };
@@ -168,8 +188,26 @@
168 i2c1 { 188 i2c1 {
169 pinctrl_i2c1_1: i2c1grp-1 { 189 pinctrl_i2c1_1: i2c1grp-1 {
170 fsl,pins = < 190 fsl,pins = <
171 137 0x4001b8b1 /* MX6Q_PAD_EIM_D21__I2C1_SCL */ 191 MX6Q_PAD_EIM_D21__I2C1_SCL 0x4001b8b1
172 196 0x4001b8b1 /* MX6Q_PAD_EIM_D28__I2C1_SDA */ 192 MX6Q_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
193 >;
194 };
195 };
196
197 i2c2 {
198 pinctrl_i2c2_1: i2c2grp-1 {
199 fsl,pins = <
200 MX6Q_PAD_EIM_EB2__I2C2_SCL 0x4001b8b1
201 MX6Q_PAD_EIM_D16__I2C2_SDA 0x4001b8b1
202 >;
203 };
204 };
205
206 i2c3 {
207 pinctrl_i2c3_1: i2c3grp-1 {
208 fsl,pins = <
209 MX6Q_PAD_EIM_D17__I2C3_SCL 0x4001b8b1
210 MX6Q_PAD_EIM_D18__I2C3_SDA 0x4001b8b1
173 >; 211 >;
174 }; 212 };
175 }; 213 };
@@ -177,8 +215,8 @@
177 uart1 { 215 uart1 {
178 pinctrl_uart1_1: uart1grp-1 { 216 pinctrl_uart1_1: uart1grp-1 {
179 fsl,pins = < 217 fsl,pins = <
180 1140 0x1b0b1 /* MX6Q_PAD_CSI0_DAT10__UART1_TXD */ 218 MX6Q_PAD_CSI0_DAT10__UART1_TX_DATA 0x1b0b1
181 1148 0x1b0b1 /* MX6Q_PAD_CSI0_DAT11__UART1_RXD */ 219 MX6Q_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1
182 >; 220 >;
183 }; 221 };
184 }; 222 };
@@ -186,8 +224,8 @@
186 uart2 { 224 uart2 {
187 pinctrl_uart2_1: uart2grp-1 { 225 pinctrl_uart2_1: uart2grp-1 {
188 fsl,pins = < 226 fsl,pins = <
189 183 0x1b0b1 /* MX6Q_PAD_EIM_D26__UART2_TXD */ 227 MX6Q_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1
190 191 0x1b0b1 /* MX6Q_PAD_EIM_D27__UART2_RXD */ 228 MX6Q_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1
191 >; 229 >;
192 }; 230 };
193 }; 231 };
@@ -195,8 +233,8 @@
195 uart4 { 233 uart4 {
196 pinctrl_uart4_1: uart4grp-1 { 234 pinctrl_uart4_1: uart4grp-1 {
197 fsl,pins = < 235 fsl,pins = <
198 877 0x1b0b1 /* MX6Q_PAD_KEY_COL0__UART4_TXD */ 236 MX6Q_PAD_KEY_COL0__UART4_TX_DATA 0x1b0b1
199 885 0x1b0b1 /* MX6Q_PAD_KEY_ROW0__UART4_RXD */ 237 MX6Q_PAD_KEY_ROW0__UART4_RX_DATA 0x1b0b1
200 >; 238 >;
201 }; 239 };
202 }; 240 };
@@ -204,7 +242,13 @@
204 usbotg { 242 usbotg {
205 pinctrl_usbotg_1: usbotggrp-1 { 243 pinctrl_usbotg_1: usbotggrp-1 {
206 fsl,pins = < 244 fsl,pins = <
207 1592 0x17059 /* MX6Q_PAD_GPIO_1__ANATOP_USBOTG_ID */ 245 MX6Q_PAD_GPIO_1__USB_OTG_ID 0x17059
246 >;
247 };
248
249 pinctrl_usbotg_2: usbotggrp-2 {
250 fsl,pins = <
251 MX6Q_PAD_ENET_RX_ER__USB_OTG_ID 0x17059
208 >; 252 >;
209 }; 253 };
210 }; 254 };
@@ -212,16 +256,16 @@
212 usdhc2 { 256 usdhc2 {
213 pinctrl_usdhc2_1: usdhc2grp-1 { 257 pinctrl_usdhc2_1: usdhc2grp-1 {
214 fsl,pins = < 258 fsl,pins = <
215 1577 0x17059 /* MX6Q_PAD_SD2_CMD__USDHC2_CMD */ 259 MX6Q_PAD_SD2_CMD__SD2_CMD 0x17059
216 1569 0x10059 /* MX6Q_PAD_SD2_CLK__USDHC2_CLK */ 260 MX6Q_PAD_SD2_CLK__SD2_CLK 0x10059
217 16 0x17059 /* MX6Q_PAD_SD2_DAT0__USDHC2_DAT0 */ 261 MX6Q_PAD_SD2_DAT0__SD2_DATA0 0x17059
218 0 0x17059 /* MX6Q_PAD_SD2_DAT1__USDHC2_DAT1 */ 262 MX6Q_PAD_SD2_DAT1__SD2_DATA1 0x17059
219 8 0x17059 /* MX6Q_PAD_SD2_DAT2__USDHC2_DAT2 */ 263 MX6Q_PAD_SD2_DAT2__SD2_DATA2 0x17059
220 1583 0x17059 /* MX6Q_PAD_SD2_DAT3__USDHC2_DAT3 */ 264 MX6Q_PAD_SD2_DAT3__SD2_DATA3 0x17059
221 1430 0x17059 /* MX6Q_PAD_NANDF_D4__USDHC2_DAT4 */ 265 MX6Q_PAD_NANDF_D4__SD2_DATA4 0x17059
222 1438 0x17059 /* MX6Q_PAD_NANDF_D5__USDHC2_DAT5 */ 266 MX6Q_PAD_NANDF_D5__SD2_DATA5 0x17059
223 1446 0x17059 /* MX6Q_PAD_NANDF_D6__USDHC2_DAT6 */ 267 MX6Q_PAD_NANDF_D6__SD2_DATA6 0x17059
224 1454 0x17059 /* MX6Q_PAD_NANDF_D7__USDHC2_DAT7 */ 268 MX6Q_PAD_NANDF_D7__SD2_DATA7 0x17059
225 >; 269 >;
226 }; 270 };
227 }; 271 };
@@ -229,27 +273,27 @@
229 usdhc3 { 273 usdhc3 {
230 pinctrl_usdhc3_1: usdhc3grp-1 { 274 pinctrl_usdhc3_1: usdhc3grp-1 {
231 fsl,pins = < 275 fsl,pins = <
232 1273 0x17059 /* MX6Q_PAD_SD3_CMD__USDHC3_CMD */ 276 MX6Q_PAD_SD3_CMD__SD3_CMD 0x17059
233 1281 0x10059 /* MX6Q_PAD_SD3_CLK__USDHC3_CLK */ 277 MX6Q_PAD_SD3_CLK__SD3_CLK 0x10059
234 1289 0x17059 /* MX6Q_PAD_SD3_DAT0__USDHC3_DAT0 */ 278 MX6Q_PAD_SD3_DAT0__SD3_DATA0 0x17059
235 1297 0x17059 /* MX6Q_PAD_SD3_DAT1__USDHC3_DAT1 */ 279 MX6Q_PAD_SD3_DAT1__SD3_DATA1 0x17059
236 1305 0x17059 /* MX6Q_PAD_SD3_DAT2__USDHC3_DAT2 */ 280 MX6Q_PAD_SD3_DAT2__SD3_DATA2 0x17059
237 1312 0x17059 /* MX6Q_PAD_SD3_DAT3__USDHC3_DAT3 */ 281 MX6Q_PAD_SD3_DAT3__SD3_DATA3 0x17059
238 1265 0x17059 /* MX6Q_PAD_SD3_DAT4__USDHC3_DAT4 */ 282 MX6Q_PAD_SD3_DAT4__SD3_DATA4 0x17059
239 1257 0x17059 /* MX6Q_PAD_SD3_DAT5__USDHC3_DAT5 */ 283 MX6Q_PAD_SD3_DAT5__SD3_DATA5 0x17059
240 1249 0x17059 /* MX6Q_PAD_SD3_DAT6__USDHC3_DAT6 */ 284 MX6Q_PAD_SD3_DAT6__SD3_DATA6 0x17059
241 1241 0x17059 /* MX6Q_PAD_SD3_DAT7__USDHC3_DAT7 */ 285 MX6Q_PAD_SD3_DAT7__SD3_DATA7 0x17059
242 >; 286 >;
243 }; 287 };
244 288
245 pinctrl_usdhc3_2: usdhc3grp-2 { 289 pinctrl_usdhc3_2: usdhc3grp-2 {
246 fsl,pins = < 290 fsl,pins = <
247 1273 0x17059 /* MX6Q_PAD_SD3_CMD__USDHC3_CMD */ 291 MX6Q_PAD_SD3_CMD__SD3_CMD 0x17059
248 1281 0x10059 /* MX6Q_PAD_SD3_CLK__USDHC3_CLK */ 292 MX6Q_PAD_SD3_CLK__SD3_CLK 0x10059
249 1289 0x17059 /* MX6Q_PAD_SD3_DAT0__USDHC3_DAT0 */ 293 MX6Q_PAD_SD3_DAT0__SD3_DATA0 0x17059
250 1297 0x17059 /* MX6Q_PAD_SD3_DAT1__USDHC3_DAT1 */ 294 MX6Q_PAD_SD3_DAT1__SD3_DATA1 0x17059
251 1305 0x17059 /* MX6Q_PAD_SD3_DAT2__USDHC3_DAT2 */ 295 MX6Q_PAD_SD3_DAT2__SD3_DATA2 0x17059
252 1312 0x17059 /* MX6Q_PAD_SD3_DAT3__USDHC3_DAT3 */ 296 MX6Q_PAD_SD3_DAT3__SD3_DATA3 0x17059
253 >; 297 >;
254 }; 298 };
255 }; 299 };
@@ -257,27 +301,27 @@
257 usdhc4 { 301 usdhc4 {
258 pinctrl_usdhc4_1: usdhc4grp-1 { 302 pinctrl_usdhc4_1: usdhc4grp-1 {
259 fsl,pins = < 303 fsl,pins = <
260 1386 0x17059 /* MX6Q_PAD_SD4_CMD__USDHC4_CMD */ 304 MX6Q_PAD_SD4_CMD__SD4_CMD 0x17059
261 1392 0x10059 /* MX6Q_PAD_SD4_CLK__USDHC4_CLK */ 305 MX6Q_PAD_SD4_CLK__SD4_CLK 0x10059
262 1462 0x17059 /* MX6Q_PAD_SD4_DAT0__USDHC4_DAT0 */ 306 MX6Q_PAD_SD4_DAT0__SD4_DATA0 0x17059
263 1470 0x17059 /* MX6Q_PAD_SD4_DAT1__USDHC4_DAT1 */ 307 MX6Q_PAD_SD4_DAT1__SD4_DATA1 0x17059
264 1478 0x17059 /* MX6Q_PAD_SD4_DAT2__USDHC4_DAT2 */ 308 MX6Q_PAD_SD4_DAT2__SD4_DATA2 0x17059
265 1486 0x17059 /* MX6Q_PAD_SD4_DAT3__USDHC4_DAT3 */ 309 MX6Q_PAD_SD4_DAT3__SD4_DATA3 0x17059
266 1493 0x17059 /* MX6Q_PAD_SD4_DAT4__USDHC4_DAT4 */ 310 MX6Q_PAD_SD4_DAT4__SD4_DATA4 0x17059
267 1501 0x17059 /* MX6Q_PAD_SD4_DAT5__USDHC4_DAT5 */ 311 MX6Q_PAD_SD4_DAT5__SD4_DATA5 0x17059
268 1509 0x17059 /* MX6Q_PAD_SD4_DAT6__USDHC4_DAT6 */ 312 MX6Q_PAD_SD4_DAT6__SD4_DATA6 0x17059
269 1517 0x17059 /* MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 */ 313 MX6Q_PAD_SD4_DAT7__SD4_DATA7 0x17059
270 >; 314 >;
271 }; 315 };
272 316
273 pinctrl_usdhc4_2: usdhc4grp-2 { 317 pinctrl_usdhc4_2: usdhc4grp-2 {
274 fsl,pins = < 318 fsl,pins = <
275 1386 0x17059 /* MX6Q_PAD_SD4_CMD__USDHC4_CMD */ 319 MX6Q_PAD_SD4_CMD__SD4_CMD 0x17059
276 1392 0x10059 /* MX6Q_PAD_SD4_CLK__USDHC4_CLK */ 320 MX6Q_PAD_SD4_CLK__SD4_CLK 0x10059
277 1462 0x17059 /* MX6Q_PAD_SD4_DAT0__USDHC4_DAT0 */ 321 MX6Q_PAD_SD4_DAT0__SD4_DATA0 0x17059
278 1470 0x17059 /* MX6Q_PAD_SD4_DAT1__USDHC4_DAT1 */ 322 MX6Q_PAD_SD4_DAT1__SD4_DATA1 0x17059
279 1478 0x17059 /* MX6Q_PAD_SD4_DAT2__USDHC4_DAT2 */ 323 MX6Q_PAD_SD4_DAT2__SD4_DATA2 0x17059
280 1486 0x17059 /* MX6Q_PAD_SD4_DAT3__USDHC4_DAT3 */ 324 MX6Q_PAD_SD4_DAT3__SD4_DATA3 0x17059
281 >; 325 >;
282 }; 326 };
283 }; 327 };
@@ -291,6 +335,24 @@
291 interrupts = <0 8 0x4 0 7 0x4>; 335 interrupts = <0 8 0x4 0 7 0x4>;
292 clocks = <&clks 133>, <&clks 134>, <&clks 137>; 336 clocks = <&clks 133>, <&clks 134>, <&clks 137>;
293 clock-names = "bus", "di0", "di1"; 337 clock-names = "bus", "di0", "di1";
338 resets = <&src 4>;
294 }; 339 };
295 }; 340 };
296}; 341};
342
343&ldb {
344 clocks = <&clks 33>, <&clks 34>,
345 <&clks 39>, <&clks 40>, <&clks 41>, <&clks 42>,
346 <&clks 135>, <&clks 136>;
347 clock-names = "di0_pll", "di1_pll",
348 "di0_sel", "di1_sel", "di2_sel", "di3_sel",
349 "di0", "di1";
350
351 lvds-channel@0 {
352 crtcs = <&ipu1 0>, <&ipu1 1>, <&ipu2 0>, <&ipu2 1>;
353 };
354
355 lvds-channel@1 {
356 crtcs = <&ipu1 0>, <&ipu1 1>, <&ipu2 0>, <&ipu2 1>;
357 };
358};
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
new file mode 100644
index 000000000000..4d237cffcc41
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -0,0 +1,38 @@
1/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
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/ {
14 memory {
15 reg = <0x10000000 0x80000000>;
16 };
17};
18
19&fec {
20 pinctrl-names = "default";
21 pinctrl-0 = <&pinctrl_enet_2>;
22 phy-mode = "rgmii";
23 status = "okay";
24};
25
26&uart4 {
27 pinctrl-names = "default";
28 pinctrl-0 = <&pinctrl_uart4_1>;
29 status = "okay";
30};
31
32&usdhc3 {
33 pinctrl-names = "default";
34 pinctrl-0 = <&pinctrl_usdhc3_1>;
35 cd-gpios = <&gpio6 15 0>;
36 wp-gpios = <&gpio1 13 0>;
37 status = "okay";
38};
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
new file mode 100644
index 000000000000..e21f6a89cf0f
--- /dev/null
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -0,0 +1,87 @@
1/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
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/ {
14 memory {
15 reg = <0x10000000 0x40000000>;
16 };
17
18 regulators {
19 compatible = "simple-bus";
20
21 reg_usb_otg_vbus: usb_otg_vbus {
22 compatible = "regulator-fixed";
23 regulator-name = "usb_otg_vbus";
24 regulator-min-microvolt = <5000000>;
25 regulator-max-microvolt = <5000000>;
26 gpio = <&gpio3 22 0>;
27 enable-active-high;
28 };
29 };
30
31 gpio-keys {
32 compatible = "gpio-keys";
33
34 volume-up {
35 label = "Volume Up";
36 gpios = <&gpio1 4 0>;
37 linux,code = <115>; /* KEY_VOLUMEUP */
38 };
39
40 volume-down {
41 label = "Volume Down";
42 gpios = <&gpio1 5 0>;
43 linux,code = <114>; /* KEY_VOLUMEDOWN */
44 };
45 };
46};
47
48&fec {
49 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_enet_1>;
51 phy-mode = "rgmii";
52 status = "okay";
53};
54
55&uart1 {
56 pinctrl-names = "default";
57 pinctrl-0 = <&pinctrl_uart1_1>;
58 status = "okay";
59};
60
61&usbh1 {
62 status = "okay";
63};
64
65&usbotg {
66 vbus-supply = <&reg_usb_otg_vbus>;
67 pinctrl-names = "default";
68 pinctrl-0 = <&pinctrl_usbotg_2>;
69 disable-over-current;
70 status = "okay";
71};
72
73&usdhc2 {
74 pinctrl-names = "default";
75 pinctrl-0 = <&pinctrl_usdhc2_1>;
76 cd-gpios = <&gpio2 2 0>;
77 wp-gpios = <&gpio2 3 0>;
78 status = "okay";
79};
80
81&usdhc3 {
82 pinctrl-names = "default";
83 pinctrl-0 = <&pinctrl_usdhc3_1>;
84 cd-gpios = <&gpio2 0 0>;
85 wp-gpios = <&gpio2 1 0>;
86 status = "okay";
87};
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 281a223591ff..3cca7d39529d 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -10,7 +10,7 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13/include/ "skeleton.dtsi" 13#include "skeleton.dtsi"
14 14
15/ { 15/ {
16 aliases { 16 aliases {
@@ -102,6 +102,11 @@
102 cache-level = <2>; 102 cache-level = <2>;
103 }; 103 };
104 104
105 pmu {
106 compatible = "arm,cortex-a9-pmu";
107 interrupts = <0 94 0x04>;
108 };
109
105 aips-bus@02000000 { /* AIPS1 */ 110 aips-bus@02000000 { /* AIPS1 */
106 compatible = "fsl,aips-bus", "simple-bus"; 111 compatible = "fsl,aips-bus", "simple-bus";
107 #address-cells = <1>; 112 #address-cells = <1>;
@@ -278,6 +283,8 @@
278 compatible = "fsl,imx6q-gpt"; 283 compatible = "fsl,imx6q-gpt";
279 reg = <0x02098000 0x4000>; 284 reg = <0x02098000 0x4000>;
280 interrupts = <0 55 0x04>; 285 interrupts = <0 55 0x04>;
286 clocks = <&clks 119>, <&clks 120>;
287 clock-names = "ipg", "per";
281 }; 288 };
282 289
283 gpio1: gpio@0209c000 { 290 gpio1: gpio@0209c000 {
@@ -514,9 +521,10 @@
514 }; 521 };
515 522
516 src: src@020d8000 { 523 src: src@020d8000 {
517 compatible = "fsl,imx6q-src"; 524 compatible = "fsl,imx6q-src", "fsl,imx51-src";
518 reg = <0x020d8000 0x4000>; 525 reg = <0x020d8000 0x4000>;
519 interrupts = <0 91 0x04 0 96 0x04>; 526 interrupts = <0 91 0x04 0 96 0x04>;
527 #reset-cells = <1>;
520 }; 528 };
521 529
522 gpc: gpc@020dc000 { 530 gpc: gpc@020dc000 {
@@ -530,6 +538,26 @@
530 reg = <0x020e0000 0x38>; 538 reg = <0x020e0000 0x38>;
531 }; 539 };
532 540
541 ldb: ldb@020e0008 {
542 #address-cells = <1>;
543 #size-cells = <0>;
544 compatible = "fsl,imx6q-ldb", "fsl,imx53-ldb";
545 gpr = <&gpr>;
546 status = "disabled";
547
548 lvds-channel@0 {
549 reg = <0>;
550 crtcs = <&ipu1 0>;
551 status = "disabled";
552 };
553
554 lvds-channel@1 {
555 reg = <1>;
556 crtcs = <&ipu1 1>;
557 status = "disabled";
558 };
559 };
560
533 dcic1: dcic@020e4000 { 561 dcic1: dcic@020e4000 {
534 reg = <0x020e4000 0x4000>; 562 reg = <0x020e4000 0x4000>;
535 interrupts = <0 124 0x04>; 563 interrupts = <0 124 0x04>;
@@ -796,6 +824,7 @@
796 interrupts = <0 6 0x4 0 5 0x4>; 824 interrupts = <0 6 0x4 0 5 0x4>;
797 clocks = <&clks 130>, <&clks 131>, <&clks 132>; 825 clocks = <&clks 130>, <&clks 131>, <&clks 132>;
798 clock-names = "bus", "di0", "di1"; 826 clock-names = "bus", "di0", "di1";
827 resets = <&src 2>;
799 }; 828 };
800 }; 829 };
801}; 830};
diff --git a/arch/arm/boot/dts/imx6sl-pinfunc.h b/arch/arm/boot/dts/imx6sl-pinfunc.h
new file mode 100644
index 000000000000..77b17bcc7b70
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sl-pinfunc.h
@@ -0,0 +1,1077 @@
1/*
2 * Copyright 2013 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
10#ifndef __DTS_IMX6SL_PINFUNC_H
11#define __DTS_IMX6SL_PINFUNC_H
12
13/*
14 * The pin function ID is a tuple of
15 * <mux_reg conf_reg input_reg mux_mode input_val>
16 */
17#define MX6SL_PAD_AUD_MCLK__AUDIO_CLK_OUT 0x04c 0x2a4 0x000 0x0 0x0
18#define MX6SL_PAD_AUD_MCLK__PWM4_OUT 0x04c 0x2a4 0x000 0x1 0x0
19#define MX6SL_PAD_AUD_MCLK__ECSPI3_RDY 0x04c 0x2a4 0x6b4 0x2 0x0
20#define MX6SL_PAD_AUD_MCLK__FEC_MDC 0x04c 0x2a4 0x000 0x3 0x0
21#define MX6SL_PAD_AUD_MCLK__WDOG2_RESET_B_DEB 0x04c 0x2a4 0x000 0x4 0x0
22#define MX6SL_PAD_AUD_MCLK__GPIO1_IO06 0x04c 0x2a4 0x000 0x5 0x0
23#define MX6SL_PAD_AUD_MCLK__SPDIF_EXT_CLK 0x04c 0x2a4 0x7f4 0x6 0x0
24#define MX6SL_PAD_AUD_RXC__AUD3_RXC 0x050 0x2a8 0x000 0x0 0x0
25#define MX6SL_PAD_AUD_RXC__I2C1_SDA 0x050 0x2a8 0x720 0x1 0x0
26#define MX6SL_PAD_AUD_RXC__UART3_TX_DATA 0x050 0x2a8 0x000 0x2 0x0
27#define MX6SL_PAD_AUD_RXC__UART3_RX_DATA 0x050 0x2a8 0x80c 0x2 0x0
28#define MX6SL_PAD_AUD_RXC__FEC_TX_CLK 0x050 0x2a8 0x70c 0x3 0x0
29#define MX6SL_PAD_AUD_RXC__I2C3_SDA 0x050 0x2a8 0x730 0x4 0x0
30#define MX6SL_PAD_AUD_RXC__GPIO1_IO01 0x050 0x2a8 0x000 0x5 0x0
31#define MX6SL_PAD_AUD_RXC__ECSPI3_SS1 0x050 0x2a8 0x6c4 0x6 0x0
32#define MX6SL_PAD_AUD_RXD__AUD3_RXD 0x054 0x2ac 0x000 0x0 0x0
33#define MX6SL_PAD_AUD_RXD__ECSPI3_MOSI 0x054 0x2ac 0x6bc 0x1 0x0
34#define MX6SL_PAD_AUD_RXD__UART4_RX_DATA 0x054 0x2ac 0x814 0x2 0x0
35#define MX6SL_PAD_AUD_RXD__UART4_TX_DATA 0x054 0x2ac 0x000 0x2 0x0
36#define MX6SL_PAD_AUD_RXD__FEC_RX_ER 0x054 0x2ac 0x708 0x3 0x0
37#define MX6SL_PAD_AUD_RXD__SD1_LCTL 0x054 0x2ac 0x000 0x4 0x0
38#define MX6SL_PAD_AUD_RXD__GPIO1_IO02 0x054 0x2ac 0x000 0x5 0x0
39#define MX6SL_PAD_AUD_RXFS__AUD3_RXFS 0x058 0x2b0 0x000 0x0 0x0
40#define MX6SL_PAD_AUD_RXFS__I2C1_SCL 0x058 0x2b0 0x71c 0x1 0x0
41#define MX6SL_PAD_AUD_RXFS__UART3_RX_DATA 0x058 0x2b0 0x80c 0x2 0x1
42#define MX6SL_PAD_AUD_RXFS__UART3_TX_DATA 0x058 0x2b0 0x000 0x2 0x0
43#define MX6SL_PAD_AUD_RXFS__FEC_MDIO 0x058 0x2b0 0x6f4 0x3 0x0
44#define MX6SL_PAD_AUD_RXFS__I2C3_SCL 0x058 0x2b0 0x72c 0x4 0x0
45#define MX6SL_PAD_AUD_RXFS__GPIO1_IO00 0x058 0x2b0 0x000 0x5 0x0
46#define MX6SL_PAD_AUD_RXFS__ECSPI3_SS0 0x058 0x2b0 0x6c0 0x6 0x0
47#define MX6SL_PAD_AUD_TXC__AUD3_TXC 0x05c 0x2b4 0x000 0x0 0x0
48#define MX6SL_PAD_AUD_TXC__ECSPI3_MISO 0x05c 0x2b4 0x6b8 0x1 0x0
49#define MX6SL_PAD_AUD_TXC__UART4_TX_DATA 0x05c 0x2b4 0x000 0x2 0x0
50#define MX6SL_PAD_AUD_TXC__UART4_RX_DATA 0x05c 0x2b4 0x814 0x2 0x1
51#define MX6SL_PAD_AUD_TXC__FEC_RX_DV 0x05c 0x2b4 0x704 0x3 0x0
52#define MX6SL_PAD_AUD_TXC__SD2_LCTL 0x05c 0x2b4 0x000 0x4 0x0
53#define MX6SL_PAD_AUD_TXC__GPIO1_IO03 0x05c 0x2b4 0x000 0x5 0x0
54#define MX6SL_PAD_AUD_TXD__AUD3_TXD 0x060 0x2b8 0x000 0x0 0x0
55#define MX6SL_PAD_AUD_TXD__ECSPI3_SCLK 0x060 0x2b8 0x6b0 0x1 0x0
56#define MX6SL_PAD_AUD_TXD__UART4_CTS_B 0x060 0x2b8 0x000 0x2 0x0
57#define MX6SL_PAD_AUD_TXD__UART4_RTS_B 0x060 0x2b8 0x810 0x2 0x0
58#define MX6SL_PAD_AUD_TXD__FEC_TX_DATA0 0x060 0x2b8 0x000 0x3 0x0
59#define MX6SL_PAD_AUD_TXD__SD4_LCTL 0x060 0x2b8 0x000 0x4 0x0
60#define MX6SL_PAD_AUD_TXD__GPIO1_IO05 0x060 0x2b8 0x000 0x5 0x0
61#define MX6SL_PAD_AUD_TXFS__AUD3_TXFS 0x064 0x2bc 0x000 0x0 0x0
62#define MX6SL_PAD_AUD_TXFS__PWM3_OUT 0x064 0x2bc 0x000 0x1 0x0
63#define MX6SL_PAD_AUD_TXFS__UART4_RTS_B 0x064 0x2bc 0x810 0x2 0x1
64#define MX6SL_PAD_AUD_TXFS__UART4_CTS_B 0x064 0x2bc 0x000 0x2 0x0
65#define MX6SL_PAD_AUD_TXFS__FEC_RX_DATA1 0x064 0x2bc 0x6fc 0x3 0x0
66#define MX6SL_PAD_AUD_TXFS__SD3_LCTL 0x064 0x2bc 0x000 0x4 0x0
67#define MX6SL_PAD_AUD_TXFS__GPIO1_IO04 0x064 0x2bc 0x000 0x5 0x0
68#define MX6SL_PAD_ECSPI1_MISO__ECSPI1_MISO 0x068 0x358 0x684 0x0 0x0
69#define MX6SL_PAD_ECSPI1_MISO__AUD4_TXFS 0x068 0x358 0x5f8 0x1 0x0
70#define MX6SL_PAD_ECSPI1_MISO__UART5_RTS_B 0x068 0x358 0x818 0x2 0x0
71#define MX6SL_PAD_ECSPI1_MISO__UART5_CTS_B 0x068 0x358 0x000 0x2 0x0
72#define MX6SL_PAD_ECSPI1_MISO__EPDC_BDR0 0x068 0x358 0x000 0x3 0x0
73#define MX6SL_PAD_ECSPI1_MISO__SD2_WP 0x068 0x358 0x834 0x4 0x0
74#define MX6SL_PAD_ECSPI1_MISO__GPIO4_IO10 0x068 0x358 0x000 0x5 0x0
75#define MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI 0x06c 0x35c 0x688 0x0 0x0
76#define MX6SL_PAD_ECSPI1_MOSI__AUD4_TXC 0x06c 0x35c 0x5f4 0x1 0x0
77#define MX6SL_PAD_ECSPI1_MOSI__UART5_TX_DATA 0x06c 0x35c 0x000 0x2 0x0
78#define MX6SL_PAD_ECSPI1_MOSI__UART5_RX_DATA 0x06c 0x35c 0x81c 0x2 0x0
79#define MX6SL_PAD_ECSPI1_MOSI__EPDC_VCOM1 0x06c 0x35c 0x000 0x3 0x0
80#define MX6SL_PAD_ECSPI1_MOSI__SD2_VSELECT 0x06c 0x35c 0x000 0x4 0x0
81#define MX6SL_PAD_ECSPI1_MOSI__GPIO4_IO09 0x06c 0x35c 0x000 0x5 0x0
82#define MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK 0x070 0x360 0x67c 0x0 0x0
83#define MX6SL_PAD_ECSPI1_SCLK__AUD4_TXD 0x070 0x360 0x5e8 0x1 0x0
84#define MX6SL_PAD_ECSPI1_SCLK__UART5_RX_DATA 0x070 0x360 0x81c 0x2 0x1
85#define MX6SL_PAD_ECSPI1_SCLK__UART5_TX_DATA 0x070 0x360 0x000 0x2 0x0
86#define MX6SL_PAD_ECSPI1_SCLK__EPDC_VCOM0 0x070 0x360 0x000 0x3 0x0
87#define MX6SL_PAD_ECSPI1_SCLK__SD2_RESET 0x070 0x360 0x000 0x4 0x0
88#define MX6SL_PAD_ECSPI1_SCLK__GPIO4_IO08 0x070 0x360 0x000 0x5 0x0
89#define MX6SL_PAD_ECSPI1_SCLK__USB_OTG2_OC 0x070 0x360 0x820 0x6 0x0
90#define MX6SL_PAD_ECSPI1_SS0__ECSPI1_SS0 0x074 0x364 0x68c 0x0 0x0
91#define MX6SL_PAD_ECSPI1_SS0__AUD4_RXD 0x074 0x364 0x5e4 0x1 0x0
92#define MX6SL_PAD_ECSPI1_SS0__UART5_CTS_B 0x074 0x364 0x000 0x2 0x0
93#define MX6SL_PAD_ECSPI1_SS0__UART5_RTS_B 0x074 0x364 0x818 0x2 0x1
94#define MX6SL_PAD_ECSPI1_SS0__EPDC_BDR1 0x074 0x364 0x000 0x3 0x0
95#define MX6SL_PAD_ECSPI1_SS0__SD2_CD_B 0x074 0x364 0x830 0x4 0x0
96#define MX6SL_PAD_ECSPI1_SS0__GPIO4_IO11 0x074 0x364 0x000 0x5 0x0
97#define MX6SL_PAD_ECSPI1_SS0__USB_OTG2_PWR 0x074 0x364 0x000 0x6 0x0
98#define MX6SL_PAD_ECSPI2_MISO__ECSPI2_MISO 0x078 0x368 0x6a0 0x0 0x0
99#define MX6SL_PAD_ECSPI2_MISO__SDMA_EXT_EVENT0 0x078 0x368 0x000 0x1 0x0
100#define MX6SL_PAD_ECSPI2_MISO__UART3_RTS_B 0x078 0x368 0x808 0x2 0x0
101#define MX6SL_PAD_ECSPI2_MISO__UART3_CTS_B 0x078 0x368 0x000 0x2 0x0
102#define MX6SL_PAD_ECSPI2_MISO__CSI_MCLK 0x078 0x368 0x000 0x3 0x0
103#define MX6SL_PAD_ECSPI2_MISO__SD1_WP 0x078 0x368 0x82c 0x4 0x0
104#define MX6SL_PAD_ECSPI2_MISO__GPIO4_IO14 0x078 0x368 0x000 0x5 0x0
105#define MX6SL_PAD_ECSPI2_MISO__USB_OTG1_OC 0x078 0x368 0x824 0x6 0x0
106#define MX6SL_PAD_ECSPI2_MOSI__ECSPI2_MOSI 0x07c 0x36c 0x6a4 0x0 0x0
107#define MX6SL_PAD_ECSPI2_MOSI__SDMA_EXT_EVENT1 0x07c 0x36c 0x000 0x1 0x0
108#define MX6SL_PAD_ECSPI2_MOSI__UART3_TX_DATA 0x07c 0x36c 0x000 0x2 0x0
109#define MX6SL_PAD_ECSPI2_MOSI__UART3_RX_DATA 0x07c 0x36c 0x80c 0x2 0x2
110#define MX6SL_PAD_ECSPI2_MOSI__CSI_HSYNC 0x07c 0x36c 0x670 0x3 0x0
111#define MX6SL_PAD_ECSPI2_MOSI__SD1_VSELECT 0x07c 0x36c 0x000 0x4 0x0
112#define MX6SL_PAD_ECSPI2_MOSI__GPIO4_IO13 0x07c 0x36c 0x000 0x5 0x0
113#define MX6SL_PAD_ECSPI2_SCLK__ECSPI2_SCLK 0x080 0x370 0x69c 0x0 0x0
114#define MX6SL_PAD_ECSPI2_SCLK__SPDIF_EXT_CLK 0x080 0x370 0x7f4 0x1 0x1
115#define MX6SL_PAD_ECSPI2_SCLK__UART3_RX_DATA 0x080 0x370 0x80c 0x2 0x3
116#define MX6SL_PAD_ECSPI2_SCLK__UART3_TX_DATA 0x080 0x370 0x000 0x2 0x0
117#define MX6SL_PAD_ECSPI2_SCLK__CSI_PIXCLK 0x080 0x370 0x674 0x3 0x0
118#define MX6SL_PAD_ECSPI2_SCLK__SD1_RESET 0x080 0x370 0x000 0x4 0x0
119#define MX6SL_PAD_ECSPI2_SCLK__GPIO4_IO12 0x080 0x370 0x000 0x5 0x0
120#define MX6SL_PAD_ECSPI2_SCLK__USB_OTG2_OC 0x080 0x370 0x820 0x6 0x1
121#define MX6SL_PAD_ECSPI2_SS0__ECSPI2_SS0 0x084 0x374 0x6a8 0x0 0x0
122#define MX6SL_PAD_ECSPI2_SS0__ECSPI1_SS3 0x084 0x374 0x698 0x1 0x0
123#define MX6SL_PAD_ECSPI2_SS0__UART3_CTS_B 0x084 0x374 0x000 0x2 0x0
124#define MX6SL_PAD_ECSPI2_SS0__UART3_RTS_B 0x084 0x374 0x808 0x2 0x1
125#define MX6SL_PAD_ECSPI2_SS0__CSI_VSYNC 0x084 0x374 0x678 0x3 0x0
126#define MX6SL_PAD_ECSPI2_SS0__SD1_CD_B 0x084 0x374 0x828 0x4 0x0
127#define MX6SL_PAD_ECSPI2_SS0__GPIO4_IO15 0x084 0x374 0x000 0x5 0x0
128#define MX6SL_PAD_ECSPI2_SS0__USB_OTG1_PWR 0x084 0x374 0x000 0x6 0x0
129#define MX6SL_PAD_EPDC_BDR0__EPDC_BDR0 0x088 0x378 0x000 0x0 0x0
130#define MX6SL_PAD_EPDC_BDR0__SD4_CLK 0x088 0x378 0x850 0x1 0x0
131#define MX6SL_PAD_EPDC_BDR0__UART3_RTS_B 0x088 0x378 0x808 0x2 0x2
132#define MX6SL_PAD_EPDC_BDR0__UART3_CTS_B 0x088 0x378 0x000 0x2 0x0
133#define MX6SL_PAD_EPDC_BDR0__EIM_ADDR26 0x088 0x378 0x000 0x3 0x0
134#define MX6SL_PAD_EPDC_BDR0__SPDC_RL 0x088 0x378 0x000 0x4 0x0
135#define MX6SL_PAD_EPDC_BDR0__GPIO2_IO05 0x088 0x378 0x000 0x5 0x0
136#define MX6SL_PAD_EPDC_BDR0__EPDC_SDCE7 0x088 0x378 0x000 0x6 0x0
137#define MX6SL_PAD_EPDC_BDR1__EPDC_BDR1 0x08c 0x37c 0x000 0x0 0x0
138#define MX6SL_PAD_EPDC_BDR1__SD4_CMD 0x08c 0x37c 0x858 0x1 0x0
139#define MX6SL_PAD_EPDC_BDR1__UART3_CTS_B 0x08c 0x37c 0x000 0x2 0x0
140#define MX6SL_PAD_EPDC_BDR1__UART3_RTS_B 0x08c 0x37c 0x808 0x2 0x3
141#define MX6SL_PAD_EPDC_BDR1__EIM_CRE 0x08c 0x37c 0x000 0x3 0x0
142#define MX6SL_PAD_EPDC_BDR1__SPDC_UD 0x08c 0x37c 0x000 0x4 0x0
143#define MX6SL_PAD_EPDC_BDR1__GPIO2_IO06 0x08c 0x37c 0x000 0x5 0x0
144#define MX6SL_PAD_EPDC_BDR1__EPDC_SDCE8 0x08c 0x37c 0x000 0x6 0x0
145#define MX6SL_PAD_EPDC_D0__EPDC_DATA00 0x090 0x380 0x000 0x0 0x0
146#define MX6SL_PAD_EPDC_D0__ECSPI4_MOSI 0x090 0x380 0x6d8 0x1 0x0
147#define MX6SL_PAD_EPDC_D0__LCD_DATA24 0x090 0x380 0x000 0x2 0x0
148#define MX6SL_PAD_EPDC_D0__CSI_DATA00 0x090 0x380 0x630 0x3 0x0
149#define MX6SL_PAD_EPDC_D0__SPDC_DATA00 0x090 0x380 0x000 0x4 0x0
150#define MX6SL_PAD_EPDC_D0__GPIO1_IO07 0x090 0x380 0x000 0x5 0x0
151#define MX6SL_PAD_EPDC_D1__EPDC_DATA01 0x094 0x384 0x000 0x0 0x0
152#define MX6SL_PAD_EPDC_D1__ECSPI4_MISO 0x094 0x384 0x6d4 0x1 0x0
153#define MX6SL_PAD_EPDC_D1__LCD_DATA25 0x094 0x384 0x000 0x2 0x0
154#define MX6SL_PAD_EPDC_D1__CSI_DATA01 0x094 0x384 0x634 0x3 0x0
155#define MX6SL_PAD_EPDC_D1__SPDC_DATA01 0x094 0x384 0x000 0x4 0x0
156#define MX6SL_PAD_EPDC_D1__GPIO1_IO08 0x094 0x384 0x000 0x5 0x0
157#define MX6SL_PAD_EPDC_D10__EPDC_DATA10 0x098 0x388 0x000 0x0 0x0
158#define MX6SL_PAD_EPDC_D10__ECSPI3_SS0 0x098 0x388 0x6c0 0x1 0x1
159#define MX6SL_PAD_EPDC_D10__EPDC_PWR_CTRL2 0x098 0x388 0x000 0x2 0x0
160#define MX6SL_PAD_EPDC_D10__EIM_ADDR18 0x098 0x388 0x000 0x3 0x0
161#define MX6SL_PAD_EPDC_D10__SPDC_DATA10 0x098 0x388 0x000 0x4 0x0
162#define MX6SL_PAD_EPDC_D10__GPIO1_IO17 0x098 0x388 0x000 0x5 0x0
163#define MX6SL_PAD_EPDC_D10__SD4_WP 0x098 0x388 0x87c 0x6 0x0
164#define MX6SL_PAD_EPDC_D11__EPDC_DATA11 0x09c 0x38c 0x000 0x0 0x0
165#define MX6SL_PAD_EPDC_D11__ECSPI3_SCLK 0x09c 0x38c 0x6b0 0x1 0x1
166#define MX6SL_PAD_EPDC_D11__EPDC_PWR_CTRL3 0x09c 0x38c 0x000 0x2 0x0
167#define MX6SL_PAD_EPDC_D11__EIM_ADDR19 0x09c 0x38c 0x000 0x3 0x0
168#define MX6SL_PAD_EPDC_D11__SPDC_DATA11 0x09c 0x38c 0x000 0x4 0x0
169#define MX6SL_PAD_EPDC_D11__GPIO1_IO18 0x09c 0x38c 0x000 0x5 0x0
170#define MX6SL_PAD_EPDC_D11__SD4_CD_B 0x09c 0x38c 0x854 0x6 0x0
171#define MX6SL_PAD_EPDC_D12__EPDC_DATA12 0x0a0 0x390 0x000 0x0 0x0
172#define MX6SL_PAD_EPDC_D12__UART2_RX_DATA 0x0a0 0x390 0x804 0x1 0x0
173#define MX6SL_PAD_EPDC_D12__UART2_TX_DATA 0x0a0 0x390 0x000 0x1 0x0
174#define MX6SL_PAD_EPDC_D12__EPDC_PWR_COM 0x0a0 0x390 0x000 0x2 0x0
175#define MX6SL_PAD_EPDC_D12__EIM_ADDR20 0x0a0 0x390 0x000 0x3 0x0
176#define MX6SL_PAD_EPDC_D12__SPDC_DATA12 0x0a0 0x390 0x000 0x4 0x0
177#define MX6SL_PAD_EPDC_D12__GPIO1_IO19 0x0a0 0x390 0x000 0x5 0x0
178#define MX6SL_PAD_EPDC_D12__ECSPI3_SS1 0x0a0 0x390 0x6c4 0x6 0x1
179#define MX6SL_PAD_EPDC_D13__EPDC_DATA13 0x0a4 0x394 0x000 0x0 0x0
180#define MX6SL_PAD_EPDC_D13__UART2_TX_DATA 0x0a4 0x394 0x000 0x1 0x0
181#define MX6SL_PAD_EPDC_D13__UART2_RX_DATA 0x0a4 0x394 0x804 0x1 0x1
182#define MX6SL_PAD_EPDC_D13__EPDC_PWR_IRQ 0x0a4 0x394 0x6e8 0x2 0x0
183#define MX6SL_PAD_EPDC_D13__EIM_ADDR21 0x0a4 0x394 0x000 0x3 0x0
184#define MX6SL_PAD_EPDC_D13__SPDC_DATA13 0x0a4 0x394 0x000 0x4 0x0
185#define MX6SL_PAD_EPDC_D13__GPIO1_IO20 0x0a4 0x394 0x000 0x5 0x0
186#define MX6SL_PAD_EPDC_D13__ECSPI3_SS2 0x0a4 0x394 0x6c8 0x6 0x0
187#define MX6SL_PAD_EPDC_D14__EPDC_DATA14 0x0a8 0x398 0x000 0x0 0x0
188#define MX6SL_PAD_EPDC_D14__UART2_RTS_B 0x0a8 0x398 0x800 0x1 0x0
189#define MX6SL_PAD_EPDC_D14__UART2_CTS_B 0x0a8 0x398 0x000 0x1 0x0
190#define MX6SL_PAD_EPDC_D14__EPDC_PWR_STAT 0x0a8 0x398 0x6ec 0x2 0x0
191#define MX6SL_PAD_EPDC_D14__EIM_ADDR22 0x0a8 0x398 0x000 0x3 0x0
192#define MX6SL_PAD_EPDC_D14__SPDC_DATA14 0x0a8 0x398 0x000 0x4 0x0
193#define MX6SL_PAD_EPDC_D14__GPIO1_IO21 0x0a8 0x398 0x000 0x5 0x0
194#define MX6SL_PAD_EPDC_D14__ECSPI3_SS3 0x0a8 0x398 0x6cc 0x6 0x0
195#define MX6SL_PAD_EPDC_D15__EPDC_DATA15 0x0ac 0x39c 0x000 0x0 0x0
196#define MX6SL_PAD_EPDC_D15__UART2_CTS_B 0x0ac 0x39c 0x000 0x1 0x0
197#define MX6SL_PAD_EPDC_D15__UART2_RTS_B 0x0ac 0x39c 0x800 0x1 0x1
198#define MX6SL_PAD_EPDC_D15__EPDC_PWR_WAKE 0x0ac 0x39c 0x000 0x2 0x0
199#define MX6SL_PAD_EPDC_D15__EIM_ADDR23 0x0ac 0x39c 0x000 0x3 0x0
200#define MX6SL_PAD_EPDC_D15__SPDC_DATA15 0x0ac 0x39c 0x000 0x4 0x0
201#define MX6SL_PAD_EPDC_D15__GPIO1_IO22 0x0ac 0x39c 0x000 0x5 0x0
202#define MX6SL_PAD_EPDC_D15__ECSPI3_RDY 0x0ac 0x39c 0x6b4 0x6 0x1
203#define MX6SL_PAD_EPDC_D2__EPDC_DATA02 0x0b0 0x3a0 0x000 0x0 0x0
204#define MX6SL_PAD_EPDC_D2__ECSPI4_SS0 0x0b0 0x3a0 0x6dc 0x1 0x0
205#define MX6SL_PAD_EPDC_D2__LCD_DATA26 0x0b0 0x3a0 0x000 0x2 0x0
206#define MX6SL_PAD_EPDC_D2__CSI_DATA02 0x0b0 0x3a0 0x638 0x3 0x0
207#define MX6SL_PAD_EPDC_D2__SPDC_DATA02 0x0b0 0x3a0 0x000 0x4 0x0
208#define MX6SL_PAD_EPDC_D2__GPIO1_IO09 0x0b0 0x3a0 0x000 0x5 0x0
209#define MX6SL_PAD_EPDC_D3__EPDC_DATA03 0x0b4 0x3a4 0x000 0x0 0x0
210#define MX6SL_PAD_EPDC_D3__ECSPI4_SCLK 0x0b4 0x3a4 0x6d0 0x1 0x0
211#define MX6SL_PAD_EPDC_D3__LCD_DATA27 0x0b4 0x3a4 0x000 0x2 0x0
212#define MX6SL_PAD_EPDC_D3__CSI_DATA03 0x0b4 0x3a4 0x63c 0x3 0x0
213#define MX6SL_PAD_EPDC_D3__SPDC_DATA03 0x0b4 0x3a4 0x000 0x4 0x0
214#define MX6SL_PAD_EPDC_D3__GPIO1_IO10 0x0b4 0x3a4 0x000 0x5 0x0
215#define MX6SL_PAD_EPDC_D4__EPDC_DATA04 0x0b8 0x3a8 0x000 0x0 0x0
216#define MX6SL_PAD_EPDC_D4__ECSPI4_SS1 0x0b8 0x3a8 0x6e0 0x1 0x0
217#define MX6SL_PAD_EPDC_D4__LCD_DATA28 0x0b8 0x3a8 0x000 0x2 0x0
218#define MX6SL_PAD_EPDC_D4__CSI_DATA04 0x0b8 0x3a8 0x640 0x3 0x0
219#define MX6SL_PAD_EPDC_D4__SPDC_DATA04 0x0b8 0x3a8 0x000 0x4 0x0
220#define MX6SL_PAD_EPDC_D4__GPIO1_IO11 0x0b8 0x3a8 0x000 0x5 0x0
221#define MX6SL_PAD_EPDC_D5__EPDC_DATA05 0x0bc 0x3ac 0x000 0x0 0x0
222#define MX6SL_PAD_EPDC_D5__ECSPI4_SS2 0x0bc 0x3ac 0x6e4 0x1 0x0
223#define MX6SL_PAD_EPDC_D5__LCD_DATA29 0x0bc 0x3ac 0x000 0x2 0x0
224#define MX6SL_PAD_EPDC_D5__CSI_DATA05 0x0bc 0x3ac 0x644 0x3 0x0
225#define MX6SL_PAD_EPDC_D5__SPDC_DATA05 0x0bc 0x3ac 0x000 0x4 0x0
226#define MX6SL_PAD_EPDC_D5__GPIO1_IO12 0x0bc 0x3ac 0x000 0x5 0x0
227#define MX6SL_PAD_EPDC_D6__EPDC_DATA06 0x0c0 0x3b0 0x000 0x0 0x0
228#define MX6SL_PAD_EPDC_D6__ECSPI4_SS3 0x0c0 0x3b0 0x000 0x1 0x0
229#define MX6SL_PAD_EPDC_D6__LCD_DATA30 0x0c0 0x3b0 0x000 0x2 0x0
230#define MX6SL_PAD_EPDC_D6__CSI_DATA06 0x0c0 0x3b0 0x648 0x3 0x0
231#define MX6SL_PAD_EPDC_D6__SPDC_DATA06 0x0c0 0x3b0 0x000 0x4 0x0
232#define MX6SL_PAD_EPDC_D6__GPIO1_IO13 0x0c0 0x3b0 0x000 0x5 0x0
233#define MX6SL_PAD_EPDC_D7__EPDC_DATA07 0x0c4 0x3b4 0x000 0x0 0x0
234#define MX6SL_PAD_EPDC_D7__ECSPI4_RDY 0x0c4 0x3b4 0x000 0x1 0x0
235#define MX6SL_PAD_EPDC_D7__LCD_DATA31 0x0c4 0x3b4 0x000 0x2 0x0
236#define MX6SL_PAD_EPDC_D7__CSI_DATA07 0x0c4 0x3b4 0x64c 0x3 0x0
237#define MX6SL_PAD_EPDC_D7__SPDC_DATA07 0x0c4 0x3b4 0x000 0x4 0x0
238#define MX6SL_PAD_EPDC_D7__GPIO1_IO14 0x0c4 0x3b4 0x000 0x5 0x0
239#define MX6SL_PAD_EPDC_D8__EPDC_DATA08 0x0c8 0x3b8 0x000 0x0 0x0
240#define MX6SL_PAD_EPDC_D8__ECSPI3_MOSI 0x0c8 0x3b8 0x6bc 0x1 0x1
241#define MX6SL_PAD_EPDC_D8__EPDC_PWR_CTRL0 0x0c8 0x3b8 0x000 0x2 0x0
242#define MX6SL_PAD_EPDC_D8__EIM_ADDR16 0x0c8 0x3b8 0x000 0x3 0x0
243#define MX6SL_PAD_EPDC_D8__SPDC_DATA08 0x0c8 0x3b8 0x000 0x4 0x0
244#define MX6SL_PAD_EPDC_D8__GPIO1_IO15 0x0c8 0x3b8 0x000 0x5 0x0
245#define MX6SL_PAD_EPDC_D8__SD4_RESET 0x0c8 0x3b8 0x000 0x6 0x0
246#define MX6SL_PAD_EPDC_D9__EPDC_DATA09 0x0cc 0x3bc 0x000 0x0 0x0
247#define MX6SL_PAD_EPDC_D9__ECSPI3_MISO 0x0cc 0x3bc 0x6b8 0x1 0x1
248#define MX6SL_PAD_EPDC_D9__EPDC_PWR_CTRL1 0x0cc 0x3bc 0x000 0x2 0x0
249#define MX6SL_PAD_EPDC_D9__EIM_ADDR17 0x0cc 0x3bc 0x000 0x3 0x0
250#define MX6SL_PAD_EPDC_D9__SPDC_DATA09 0x0cc 0x3bc 0x000 0x4 0x0
251#define MX6SL_PAD_EPDC_D9__GPIO1_IO16 0x0cc 0x3bc 0x000 0x5 0x0
252#define MX6SL_PAD_EPDC_D9__SD4_VSELECT 0x0cc 0x3bc 0x000 0x6 0x0
253#define MX6SL_PAD_EPDC_GDCLK__EPDC_GDCLK 0x0d0 0x3c0 0x000 0x0 0x0
254#define MX6SL_PAD_EPDC_GDCLK__ECSPI2_SS2 0x0d0 0x3c0 0x000 0x1 0x0
255#define MX6SL_PAD_EPDC_GDCLK__SPDC_YCKR 0x0d0 0x3c0 0x000 0x2 0x0
256#define MX6SL_PAD_EPDC_GDCLK__CSI_PIXCLK 0x0d0 0x3c0 0x674 0x3 0x1
257#define MX6SL_PAD_EPDC_GDCLK__SPDC_YCKL 0x0d0 0x3c0 0x000 0x4 0x0
258#define MX6SL_PAD_EPDC_GDCLK__GPIO1_IO31 0x0d0 0x3c0 0x000 0x5 0x0
259#define MX6SL_PAD_EPDC_GDCLK__SD2_RESET 0x0d0 0x3c0 0x000 0x6 0x0
260#define MX6SL_PAD_EPDC_GDOE__EPDC_GDOE 0x0d4 0x3c4 0x000 0x0 0x0
261#define MX6SL_PAD_EPDC_GDOE__ECSPI2_SS3 0x0d4 0x3c4 0x000 0x1 0x0
262#define MX6SL_PAD_EPDC_GDOE__SPDC_YOER 0x0d4 0x3c4 0x000 0x2 0x0
263#define MX6SL_PAD_EPDC_GDOE__CSI_HSYNC 0x0d4 0x3c4 0x670 0x3 0x1
264#define MX6SL_PAD_EPDC_GDOE__SPDC_YOEL 0x0d4 0x3c4 0x000 0x4 0x0
265#define MX6SL_PAD_EPDC_GDOE__GPIO2_IO00 0x0d4 0x3c4 0x000 0x5 0x0
266#define MX6SL_PAD_EPDC_GDOE__SD2_VSELECT 0x0d4 0x3c4 0x000 0x6 0x0
267#define MX6SL_PAD_EPDC_GDRL__EPDC_GDRL 0x0d8 0x3c8 0x000 0x0 0x0
268#define MX6SL_PAD_EPDC_GDRL__ECSPI2_RDY 0x0d8 0x3c8 0x000 0x1 0x0
269#define MX6SL_PAD_EPDC_GDRL__SPDC_YDIOUR 0x0d8 0x3c8 0x000 0x2 0x0
270#define MX6SL_PAD_EPDC_GDRL__CSI_MCLK 0x0d8 0x3c8 0x000 0x3 0x0
271#define MX6SL_PAD_EPDC_GDRL__SPDC_YDIOUL 0x0d8 0x3c8 0x000 0x4 0x0
272#define MX6SL_PAD_EPDC_GDRL__GPIO2_IO01 0x0d8 0x3c8 0x000 0x5 0x0
273#define MX6SL_PAD_EPDC_GDRL__SD2_WP 0x0d8 0x3c8 0x834 0x6 0x1
274#define MX6SL_PAD_EPDC_GDSP__EPDC_GDSP 0x0dc 0x3cc 0x000 0x0 0x0
275#define MX6SL_PAD_EPDC_GDSP__PWM4_OUT 0x0dc 0x3cc 0x000 0x1 0x0
276#define MX6SL_PAD_EPDC_GDSP__SPDC_YDIODR 0x0dc 0x3cc 0x000 0x2 0x0
277#define MX6SL_PAD_EPDC_GDSP__CSI_VSYNC 0x0dc 0x3cc 0x678 0x3 0x1
278#define MX6SL_PAD_EPDC_GDSP__SPDC_YDIODL 0x0dc 0x3cc 0x000 0x4 0x0
279#define MX6SL_PAD_EPDC_GDSP__GPIO2_IO02 0x0dc 0x3cc 0x000 0x5 0x0
280#define MX6SL_PAD_EPDC_GDSP__SD2_CD_B 0x0dc 0x3cc 0x830 0x6 0x1
281#define MX6SL_PAD_EPDC_PWRCOM__EPDC_PWR_COM 0x0e0 0x3d0 0x000 0x0 0x0
282#define MX6SL_PAD_EPDC_PWRCOM__SD4_DATA0 0x0e0 0x3d0 0x85c 0x1 0x0
283#define MX6SL_PAD_EPDC_PWRCOM__LCD_DATA20 0x0e0 0x3d0 0x7c8 0x2 0x0
284#define MX6SL_PAD_EPDC_PWRCOM__EIM_BCLK 0x0e0 0x3d0 0x000 0x3 0x0
285#define MX6SL_PAD_EPDC_PWRCOM__USB_OTG1_ID 0x0e0 0x3d0 0x5dc 0x4 0x0
286#define MX6SL_PAD_EPDC_PWRCOM__GPIO2_IO11 0x0e0 0x3d0 0x000 0x5 0x0
287#define MX6SL_PAD_EPDC_PWRCOM__SD3_RESET 0x0e0 0x3d0 0x000 0x6 0x0
288#define MX6SL_PAD_EPDC_PWRCTRL0__EPDC_PWR_CTRL0 0x0e4 0x3d4 0x000 0x0 0x0
289#define MX6SL_PAD_EPDC_PWRCTRL0__AUD5_RXC 0x0e4 0x3d4 0x604 0x1 0x0
290#define MX6SL_PAD_EPDC_PWRCTRL0__LCD_DATA16 0x0e4 0x3d4 0x7b8 0x2 0x0
291#define MX6SL_PAD_EPDC_PWRCTRL0__EIM_RW 0x0e4 0x3d4 0x000 0x3 0x0
292#define MX6SL_PAD_EPDC_PWRCTRL0__SPDC_YCKL 0x0e4 0x3d4 0x000 0x4 0x0
293#define MX6SL_PAD_EPDC_PWRCTRL0__GPIO2_IO07 0x0e4 0x3d4 0x000 0x5 0x0
294#define MX6SL_PAD_EPDC_PWRCTRL0__SD4_RESET 0x0e4 0x3d4 0x000 0x6 0x0
295#define MX6SL_PAD_EPDC_PWRCTRL1__EPDC_PWR_CTRL1 0x0e8 0x3d8 0x000 0x0 0x0
296#define MX6SL_PAD_EPDC_PWRCTRL1__AUD5_TXFS 0x0e8 0x3d8 0x610 0x1 0x0
297#define MX6SL_PAD_EPDC_PWRCTRL1__LCD_DATA17 0x0e8 0x3d8 0x7bc 0x2 0x0
298#define MX6SL_PAD_EPDC_PWRCTRL1__EIM_OE_B 0x0e8 0x3d8 0x000 0x3 0x0
299#define MX6SL_PAD_EPDC_PWRCTRL1__SPDC_YOEL 0x0e8 0x3d8 0x000 0x4 0x0
300#define MX6SL_PAD_EPDC_PWRCTRL1__GPIO2_IO08 0x0e8 0x3d8 0x000 0x5 0x0
301#define MX6SL_PAD_EPDC_PWRCTRL1__SD4_VSELECT 0x0e8 0x3d8 0x000 0x6 0x0
302#define MX6SL_PAD_EPDC_PWRCTRL2__EPDC_PWR_CTRL2 0x0ec 0x3dc 0x000 0x0 0x0
303#define MX6SL_PAD_EPDC_PWRCTRL2__AUD5_TXD 0x0ec 0x3dc 0x600 0x1 0x0
304#define MX6SL_PAD_EPDC_PWRCTRL2__LCD_DATA18 0x0ec 0x3dc 0x7c0 0x2 0x0
305#define MX6SL_PAD_EPDC_PWRCTRL2__EIM_CS0_B 0x0ec 0x3dc 0x000 0x3 0x0
306#define MX6SL_PAD_EPDC_PWRCTRL2__SPDC_YDIOUL 0x0ec 0x3dc 0x000 0x4 0x0
307#define MX6SL_PAD_EPDC_PWRCTRL2__GPIO2_IO09 0x0ec 0x3dc 0x000 0x5 0x0
308#define MX6SL_PAD_EPDC_PWRCTRL2__SD4_WP 0x0ec 0x3dc 0x87c 0x6 0x1
309#define MX6SL_PAD_EPDC_PWRCTRL3__EPDC_PWR_CTRL3 0x0f0 0x3e0 0x000 0x0 0x0
310#define MX6SL_PAD_EPDC_PWRCTRL3__AUD5_TXC 0x0f0 0x3e0 0x60c 0x1 0x0
311#define MX6SL_PAD_EPDC_PWRCTRL3__LCD_DATA19 0x0f0 0x3e0 0x7c4 0x2 0x0
312#define MX6SL_PAD_EPDC_PWRCTRL3__EIM_CS1_B 0x0f0 0x3e0 0x000 0x3 0x0
313#define MX6SL_PAD_EPDC_PWRCTRL3__SPDC_YDIODL 0x0f0 0x3e0 0x000 0x4 0x0
314#define MX6SL_PAD_EPDC_PWRCTRL3__GPIO2_IO10 0x0f0 0x3e0 0x000 0x5 0x0
315#define MX6SL_PAD_EPDC_PWRCTRL3__SD4_CD_B 0x0f0 0x3e0 0x854 0x6 0x1
316#define MX6SL_PAD_EPDC_PWRINT__EPDC_PWR_IRQ 0x0f4 0x3e4 0x6e8 0x0 0x1
317#define MX6SL_PAD_EPDC_PWRINT__SD4_DATA1 0x0f4 0x3e4 0x860 0x1 0x0
318#define MX6SL_PAD_EPDC_PWRINT__LCD_DATA21 0x0f4 0x3e4 0x7cc 0x2 0x0
319#define MX6SL_PAD_EPDC_PWRINT__EIM_ACLK_FREERUN 0x0f4 0x3e4 0x000 0x3 0x0
320#define MX6SL_PAD_EPDC_PWRINT__USB_OTG2_ID 0x0f4 0x3e4 0x5e0 0x4 0x0
321#define MX6SL_PAD_EPDC_PWRINT__GPIO2_IO12 0x0f4 0x3e4 0x000 0x5 0x0
322#define MX6SL_PAD_EPDC_PWRINT__SD3_VSELECT 0x0f4 0x3e4 0x000 0x6 0x0
323#define MX6SL_PAD_EPDC_PWRSTAT__EPDC_PWR_STAT 0x0f8 0x3e8 0x6ec 0x0 0x1
324#define MX6SL_PAD_EPDC_PWRSTAT__SD4_DATA2 0x0f8 0x3e8 0x864 0x1 0x0
325#define MX6SL_PAD_EPDC_PWRSTAT__LCD_DATA22 0x0f8 0x3e8 0x7d0 0x2 0x0
326#define MX6SL_PAD_EPDC_PWRSTAT__EIM_WAIT_B 0x0f8 0x3e8 0x884 0x3 0x0
327#define MX6SL_PAD_EPDC_PWRSTAT__ARM_EVENTI 0x0f8 0x3e8 0x000 0x4 0x0
328#define MX6SL_PAD_EPDC_PWRSTAT__GPIO2_IO13 0x0f8 0x3e8 0x000 0x5 0x0
329#define MX6SL_PAD_EPDC_PWRSTAT__SD3_WP 0x0f8 0x3e8 0x84c 0x6 0x0
330#define MX6SL_PAD_EPDC_PWRWAKEUP__EPDC_PWR_WAKE 0x0fc 0x3ec 0x000 0x0 0x0
331#define MX6SL_PAD_EPDC_PWRWAKEUP__SD4_DATA3 0x0fc 0x3ec 0x868 0x1 0x0
332#define MX6SL_PAD_EPDC_PWRWAKEUP__LCD_DATA23 0x0fc 0x3ec 0x7d4 0x2 0x0
333#define MX6SL_PAD_EPDC_PWRWAKEUP__EIM_DTACK_B 0x0fc 0x3ec 0x880 0x3 0x0
334#define MX6SL_PAD_EPDC_PWRWAKEUP__ARM_EVENTO 0x0fc 0x3ec 0x000 0x4 0x0
335#define MX6SL_PAD_EPDC_PWRWAKEUP__GPIO2_IO14 0x0fc 0x3ec 0x000 0x5 0x0
336#define MX6SL_PAD_EPDC_PWRWAKEUP__SD3_CD_B 0x0fc 0x3ec 0x838 0x6 0x0
337#define MX6SL_PAD_EPDC_SDCE0__EPDC_SDCE0 0x100 0x3f0 0x000 0x0 0x0
338#define MX6SL_PAD_EPDC_SDCE0__ECSPI2_SS1 0x100 0x3f0 0x6ac 0x1 0x0
339#define MX6SL_PAD_EPDC_SDCE0__PWM3_OUT 0x100 0x3f0 0x000 0x2 0x0
340#define MX6SL_PAD_EPDC_SDCE0__EIM_CS2_B 0x100 0x3f0 0x000 0x3 0x0
341#define MX6SL_PAD_EPDC_SDCE0__SPDC_YCKR 0x100 0x3f0 0x000 0x4 0x0
342#define MX6SL_PAD_EPDC_SDCE0__GPIO1_IO27 0x100 0x3f0 0x000 0x5 0x0
343#define MX6SL_PAD_EPDC_SDCE1__EPDC_SDCE1 0x104 0x3f4 0x000 0x0 0x0
344#define MX6SL_PAD_EPDC_SDCE1__WDOG2_B 0x104 0x3f4 0x000 0x1 0x0
345#define MX6SL_PAD_EPDC_SDCE1__PWM4_OUT 0x104 0x3f4 0x000 0x2 0x0
346#define MX6SL_PAD_EPDC_SDCE1__EIM_LBA_B 0x104 0x3f4 0x000 0x3 0x0
347#define MX6SL_PAD_EPDC_SDCE1__SPDC_YOER 0x104 0x3f4 0x000 0x4 0x0
348#define MX6SL_PAD_EPDC_SDCE1__GPIO1_IO28 0x104 0x3f4 0x000 0x5 0x0
349#define MX6SL_PAD_EPDC_SDCE2__EPDC_SDCE2 0x108 0x3f8 0x000 0x0 0x0
350#define MX6SL_PAD_EPDC_SDCE2__I2C3_SCL 0x108 0x3f8 0x72c 0x1 0x1
351#define MX6SL_PAD_EPDC_SDCE2__PWM1_OUT 0x108 0x3f8 0x000 0x2 0x0
352#define MX6SL_PAD_EPDC_SDCE2__EIM_EB0_B 0x108 0x3f8 0x000 0x3 0x0
353#define MX6SL_PAD_EPDC_SDCE2__SPDC_YDIOUR 0x108 0x3f8 0x000 0x4 0x0
354#define MX6SL_PAD_EPDC_SDCE2__GPIO1_IO29 0x108 0x3f8 0x000 0x5 0x0
355#define MX6SL_PAD_EPDC_SDCE3__EPDC_SDCE3 0x10c 0x3fc 0x000 0x0 0x0
356#define MX6SL_PAD_EPDC_SDCE3__I2C3_SDA 0x10c 0x3fc 0x730 0x1 0x1
357#define MX6SL_PAD_EPDC_SDCE3__PWM2_OUT 0x10c 0x3fc 0x000 0x2 0x0
358#define MX6SL_PAD_EPDC_SDCE3__EIM_EB1_B 0x10c 0x3fc 0x000 0x3 0x0
359#define MX6SL_PAD_EPDC_SDCE3__SPDC_YDIODR 0x10c 0x3fc 0x000 0x4 0x0
360#define MX6SL_PAD_EPDC_SDCE3__GPIO1_IO30 0x10c 0x3fc 0x000 0x5 0x0
361#define MX6SL_PAD_EPDC_SDCLK__EPDC_SDCLK_P 0x110 0x400 0x000 0x0 0x0
362#define MX6SL_PAD_EPDC_SDCLK__ECSPI2_MOSI 0x110 0x400 0x6a4 0x1 0x1
363#define MX6SL_PAD_EPDC_SDCLK__I2C2_SCL 0x110 0x400 0x724 0x2 0x0
364#define MX6SL_PAD_EPDC_SDCLK__CSI_DATA08 0x110 0x400 0x650 0x3 0x0
365#define MX6SL_PAD_EPDC_SDCLK__SPDC_CL 0x110 0x400 0x000 0x4 0x0
366#define MX6SL_PAD_EPDC_SDCLK__GPIO1_IO23 0x110 0x400 0x000 0x5 0x0
367#define MX6SL_PAD_EPDC_SDLE__EPDC_SDLE 0x114 0x404 0x000 0x0 0x0
368#define MX6SL_PAD_EPDC_SDLE__ECSPI2_MISO 0x114 0x404 0x6a0 0x1 0x1
369#define MX6SL_PAD_EPDC_SDLE__I2C2_SDA 0x114 0x404 0x728 0x2 0x0
370#define MX6SL_PAD_EPDC_SDLE__CSI_DATA09 0x114 0x404 0x654 0x3 0x0
371#define MX6SL_PAD_EPDC_SDLE__SPDC_LD 0x114 0x404 0x000 0x4 0x0
372#define MX6SL_PAD_EPDC_SDLE__GPIO1_IO24 0x114 0x404 0x000 0x5 0x0
373#define MX6SL_PAD_EPDC_SDOE__EPDC_SDOE 0x118 0x408 0x000 0x0 0x0
374#define MX6SL_PAD_EPDC_SDOE__ECSPI2_SS0 0x118 0x408 0x6a8 0x1 0x1
375#define MX6SL_PAD_EPDC_SDOE__SPDC_XDIOR 0x118 0x408 0x000 0x2 0x0
376#define MX6SL_PAD_EPDC_SDOE__CSI_DATA10 0x118 0x408 0x658 0x3 0x0
377#define MX6SL_PAD_EPDC_SDOE__SPDC_XDIOL 0x118 0x408 0x000 0x4 0x0
378#define MX6SL_PAD_EPDC_SDOE__GPIO1_IO25 0x118 0x408 0x000 0x5 0x0
379#define MX6SL_PAD_EPDC_SDSHR__EPDC_SDSHR 0x11c 0x40c 0x000 0x0 0x0
380#define MX6SL_PAD_EPDC_SDSHR__ECSPI2_SCLK 0x11c 0x40c 0x69c 0x1 0x1
381#define MX6SL_PAD_EPDC_SDSHR__EPDC_SDCE4 0x11c 0x40c 0x000 0x2 0x0
382#define MX6SL_PAD_EPDC_SDSHR__CSI_DATA11 0x11c 0x40c 0x65c 0x3 0x0
383#define MX6SL_PAD_EPDC_SDSHR__SPDC_XDIOR 0x11c 0x40c 0x000 0x4 0x0
384#define MX6SL_PAD_EPDC_SDSHR__GPIO1_IO26 0x11c 0x40c 0x000 0x5 0x0
385#define MX6SL_PAD_EPDC_VCOM0__EPDC_VCOM0 0x120 0x410 0x000 0x0 0x0
386#define MX6SL_PAD_EPDC_VCOM0__AUD5_RXFS 0x120 0x410 0x608 0x1 0x0
387#define MX6SL_PAD_EPDC_VCOM0__UART3_RX_DATA 0x120 0x410 0x80c 0x2 0x4
388#define MX6SL_PAD_EPDC_VCOM0__UART3_TX_DATA 0x120 0x410 0x000 0x2 0x0
389#define MX6SL_PAD_EPDC_VCOM0__EIM_ADDR24 0x120 0x410 0x000 0x3 0x0
390#define MX6SL_PAD_EPDC_VCOM0__SPDC_VCOM0 0x120 0x410 0x000 0x4 0x0
391#define MX6SL_PAD_EPDC_VCOM0__GPIO2_IO03 0x120 0x410 0x000 0x5 0x0
392#define MX6SL_PAD_EPDC_VCOM0__EPDC_SDCE5 0x120 0x410 0x000 0x6 0x0
393#define MX6SL_PAD_EPDC_VCOM1__EPDC_VCOM1 0x124 0x414 0x000 0x0 0x0
394#define MX6SL_PAD_EPDC_VCOM1__AUD5_RXD 0x124 0x414 0x5fc 0x1 0x0
395#define MX6SL_PAD_EPDC_VCOM1__UART3_TX_DATA 0x124 0x414 0x000 0x2 0x0
396#define MX6SL_PAD_EPDC_VCOM1__UART3_RX_DATA 0x124 0x414 0x80c 0x2 0x5
397#define MX6SL_PAD_EPDC_VCOM1__EIM_ADDR25 0x124 0x414 0x000 0x3 0x0
398#define MX6SL_PAD_EPDC_VCOM1__SPDC_VCOM1 0x124 0x414 0x000 0x4 0x0
399#define MX6SL_PAD_EPDC_VCOM1__GPIO2_IO04 0x124 0x414 0x000 0x5 0x0
400#define MX6SL_PAD_EPDC_VCOM1__EPDC_SDCE6 0x124 0x414 0x000 0x6 0x0
401#define MX6SL_PAD_FEC_CRS_DV__FEC_RX_DV 0x128 0x418 0x704 0x0 0x1
402#define MX6SL_PAD_FEC_CRS_DV__SD4_DATA1 0x128 0x418 0x860 0x1 0x1
403#define MX6SL_PAD_FEC_CRS_DV__AUD6_TXC 0x128 0x418 0x624 0x2 0x0
404#define MX6SL_PAD_FEC_CRS_DV__ECSPI4_MISO 0x128 0x418 0x6d4 0x3 0x1
405#define MX6SL_PAD_FEC_CRS_DV__GPT_COMPARE2 0x128 0x418 0x000 0x4 0x0
406#define MX6SL_PAD_FEC_CRS_DV__GPIO4_IO25 0x128 0x418 0x000 0x5 0x0
407#define MX6SL_PAD_FEC_CRS_DV__ARM_TRACE31 0x128 0x418 0x000 0x6 0x0
408#define MX6SL_PAD_FEC_MDC__FEC_MDC 0x12c 0x41c 0x000 0x0 0x0
409#define MX6SL_PAD_FEC_MDC__SD4_DATA4 0x12c 0x41c 0x86c 0x1 0x0
410#define MX6SL_PAD_FEC_MDC__AUDIO_CLK_OUT 0x12c 0x41c 0x000 0x2 0x0
411#define MX6SL_PAD_FEC_MDC__SD1_RESET 0x12c 0x41c 0x000 0x3 0x0
412#define MX6SL_PAD_FEC_MDC__SD3_RESET 0x12c 0x41c 0x000 0x4 0x0
413#define MX6SL_PAD_FEC_MDC__GPIO4_IO23 0x12c 0x41c 0x000 0x5 0x0
414#define MX6SL_PAD_FEC_MDC__ARM_TRACE29 0x12c 0x41c 0x000 0x6 0x0
415#define MX6SL_PAD_FEC_MDIO__FEC_MDIO 0x130 0x420 0x6f4 0x0 0x1
416#define MX6SL_PAD_FEC_MDIO__SD4_CLK 0x130 0x420 0x850 0x1 0x1
417#define MX6SL_PAD_FEC_MDIO__AUD6_RXFS 0x130 0x420 0x620 0x2 0x0
418#define MX6SL_PAD_FEC_MDIO__ECSPI4_SS0 0x130 0x420 0x6dc 0x3 0x1
419#define MX6SL_PAD_FEC_MDIO__GPT_CAPTURE1 0x130 0x420 0x710 0x4 0x0
420#define MX6SL_PAD_FEC_MDIO__GPIO4_IO20 0x130 0x420 0x000 0x5 0x0
421#define MX6SL_PAD_FEC_MDIO__ARM_TRACE26 0x130 0x420 0x000 0x6 0x0
422#define MX6SL_PAD_FEC_REF_CLK__FEC_REF_OUT 0x134 0x424 0x000 0x0 0x0
423#define MX6SL_PAD_FEC_REF_CLK__SD4_RESET 0x134 0x424 0x000 0x1 0x0
424#define MX6SL_PAD_FEC_REF_CLK__WDOG1_B 0x134 0x424 0x000 0x2 0x0
425#define MX6SL_PAD_FEC_REF_CLK__PWM4_OUT 0x134 0x424 0x000 0x3 0x0
426#define MX6SL_PAD_FEC_REF_CLK__CCM_PMIC_READY 0x134 0x424 0x62c 0x4 0x0
427#define MX6SL_PAD_FEC_REF_CLK__GPIO4_IO26 0x134 0x424 0x000 0x5 0x0
428#define MX6SL_PAD_FEC_REF_CLK__SPDIF_EXT_CLK 0x134 0x424 0x7f4 0x6 0x2
429#define MX6SL_PAD_FEC_RX_ER__FEC_RX_ER 0x138 0x428 0x708 0x0 0x1
430#define MX6SL_PAD_FEC_RX_ER__SD4_DATA0 0x138 0x428 0x85c 0x1 0x1
431#define MX6SL_PAD_FEC_RX_ER__AUD6_RXD 0x138 0x428 0x614 0x2 0x0
432#define MX6SL_PAD_FEC_RX_ER__ECSPI4_MOSI 0x138 0x428 0x6d8 0x3 0x1
433#define MX6SL_PAD_FEC_RX_ER__GPT_COMPARE1 0x138 0x428 0x000 0x4 0x0
434#define MX6SL_PAD_FEC_RX_ER__GPIO4_IO19 0x138 0x428 0x000 0x5 0x0
435#define MX6SL_PAD_FEC_RX_ER__ARM_TRACE25 0x138 0x428 0x000 0x6 0x0
436#define MX6SL_PAD_FEC_RXD0__FEC_RX_DATA0 0x13c 0x42c 0x6f8 0x0 0x0
437#define MX6SL_PAD_FEC_RXD0__SD4_DATA5 0x13c 0x42c 0x870 0x1 0x0
438#define MX6SL_PAD_FEC_RXD0__USB_OTG1_ID 0x13c 0x42c 0x5dc 0x2 0x1
439#define MX6SL_PAD_FEC_RXD0__SD1_VSELECT 0x13c 0x42c 0x000 0x3 0x0
440#define MX6SL_PAD_FEC_RXD0__SD3_VSELECT 0x13c 0x42c 0x000 0x4 0x0
441#define MX6SL_PAD_FEC_RXD0__GPIO4_IO17 0x13c 0x42c 0x000 0x5 0x0
442#define MX6SL_PAD_FEC_RXD0__ARM_TRACE24 0x13c 0x42c 0x000 0x6 0x0
443#define MX6SL_PAD_FEC_RXD1__FEC_RX_DATA1 0x140 0x430 0x6fc 0x0 0x1
444#define MX6SL_PAD_FEC_RXD1__SD4_DATA2 0x140 0x430 0x864 0x1 0x1
445#define MX6SL_PAD_FEC_RXD1__AUD6_TXFS 0x140 0x430 0x628 0x2 0x0
446#define MX6SL_PAD_FEC_RXD1__ECSPI4_SS1 0x140 0x430 0x6e0 0x3 0x1
447#define MX6SL_PAD_FEC_RXD1__GPT_COMPARE3 0x140 0x430 0x000 0x4 0x0
448#define MX6SL_PAD_FEC_RXD1__GPIO4_IO18 0x140 0x430 0x000 0x5 0x0
449#define MX6SL_PAD_FEC_RXD1__FEC_COL 0x140 0x430 0x6f0 0x6 0x0
450#define MX6SL_PAD_FEC_TX_CLK__FEC_TX_CLK 0x144 0x434 0x70c 0x0 0x1
451#define MX6SL_PAD_FEC_TX_CLK__SD4_CMD 0x144 0x434 0x858 0x1 0x1
452#define MX6SL_PAD_FEC_TX_CLK__AUD6_RXC 0x144 0x434 0x61c 0x2 0x0
453#define MX6SL_PAD_FEC_TX_CLK__ECSPI4_SCLK 0x144 0x434 0x6d0 0x3 0x1
454#define MX6SL_PAD_FEC_TX_CLK__GPT_CAPTURE2 0x144 0x434 0x714 0x4 0x0
455#define MX6SL_PAD_FEC_TX_CLK__GPIO4_IO21 0x144 0x434 0x000 0x5 0x0
456#define MX6SL_PAD_FEC_TX_CLK__ARM_TRACE27 0x144 0x434 0x000 0x6 0x0
457#define MX6SL_PAD_FEC_TX_EN__FEC_TX_EN 0x148 0x438 0x000 0x0 0x0
458#define MX6SL_PAD_FEC_TX_EN__SD4_DATA6 0x148 0x438 0x874 0x1 0x0
459#define MX6SL_PAD_FEC_TX_EN__SPDIF_IN 0x148 0x438 0x7f0 0x2 0x0
460#define MX6SL_PAD_FEC_TX_EN__SD1_WP 0x148 0x438 0x82c 0x3 0x1
461#define MX6SL_PAD_FEC_TX_EN__SD3_WP 0x148 0x438 0x84c 0x4 0x1
462#define MX6SL_PAD_FEC_TX_EN__GPIO4_IO22 0x148 0x438 0x000 0x5 0x0
463#define MX6SL_PAD_FEC_TX_EN__ARM_TRACE28 0x148 0x438 0x000 0x6 0x0
464#define MX6SL_PAD_FEC_TXD0__FEC_TX_DATA0 0x14c 0x43c 0x000 0x0 0x0
465#define MX6SL_PAD_FEC_TXD0__SD4_DATA3 0x14c 0x43c 0x868 0x1 0x1
466#define MX6SL_PAD_FEC_TXD0__AUD6_TXD 0x14c 0x43c 0x618 0x2 0x0
467#define MX6SL_PAD_FEC_TXD0__ECSPI4_SS2 0x14c 0x43c 0x6e4 0x3 0x1
468#define MX6SL_PAD_FEC_TXD0__GPT_CLKIN 0x14c 0x43c 0x718 0x4 0x0
469#define MX6SL_PAD_FEC_TXD0__GPIO4_IO24 0x14c 0x43c 0x000 0x5 0x0
470#define MX6SL_PAD_FEC_TXD0__ARM_TRACE30 0x14c 0x43c 0x000 0x6 0x0
471#define MX6SL_PAD_FEC_TXD1__FEC_TX_DATA1 0x150 0x440 0x000 0x0 0x0
472#define MX6SL_PAD_FEC_TXD1__SD4_DATA7 0x150 0x440 0x878 0x1 0x0
473#define MX6SL_PAD_FEC_TXD1__SPDIF_OUT 0x150 0x440 0x000 0x2 0x0
474#define MX6SL_PAD_FEC_TXD1__SD1_CD_B 0x150 0x440 0x828 0x3 0x1
475#define MX6SL_PAD_FEC_TXD1__SD3_CD_B 0x150 0x440 0x838 0x4 0x1
476#define MX6SL_PAD_FEC_TXD1__GPIO4_IO16 0x150 0x440 0x000 0x5 0x0
477#define MX6SL_PAD_FEC_TXD1__FEC_RX_CLK 0x150 0x440 0x700 0x6 0x0
478#define MX6SL_PAD_HSIC_DAT__USB_H_DATA 0x154 0x444 0x000 0x0 0x0
479#define MX6SL_PAD_HSIC_DAT__I2C1_SCL 0x154 0x444 0x71c 0x1 0x1
480#define MX6SL_PAD_HSIC_DAT__PWM1_OUT 0x154 0x444 0x000 0x2 0x0
481#define MX6SL_PAD_HSIC_DAT__XTALOSC_REF_CLK_24M 0x154 0x444 0x000 0x3 0x0
482#define MX6SL_PAD_HSIC_DAT__GPIO3_IO19 0x154 0x444 0x000 0x5 0x0
483#define MX6SL_PAD_HSIC_STROBE__USB_H_STROBE 0x158 0x448 0x000 0x0 0x0
484#define MX6SL_PAD_HSIC_STROBE__I2C1_SDA 0x158 0x448 0x720 0x1 0x1
485#define MX6SL_PAD_HSIC_STROBE__PWM2_OUT 0x158 0x448 0x000 0x2 0x0
486#define MX6SL_PAD_HSIC_STROBE__XTALOSC_REF_CLK_32K 0x158 0x448 0x000 0x3 0x0
487#define MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x158 0x448 0x000 0x5 0x0
488#define MX6SL_PAD_I2C1_SCL__I2C1_SCL 0x15c 0x44c 0x71c 0x0 0x2
489#define MX6SL_PAD_I2C1_SCL__UART1_RTS_B 0x15c 0x44c 0x7f8 0x1 0x0
490#define MX6SL_PAD_I2C1_SCL__UART1_CTS_B 0x15c 0x44c 0x000 0x1 0x0
491#define MX6SL_PAD_I2C1_SCL__ECSPI3_SS2 0x15c 0x44c 0x6c8 0x2 0x1
492#define MX6SL_PAD_I2C1_SCL__FEC_RX_DATA0 0x15c 0x44c 0x6f8 0x3 0x1
493#define MX6SL_PAD_I2C1_SCL__SD3_RESET 0x15c 0x44c 0x000 0x4 0x0
494#define MX6SL_PAD_I2C1_SCL__GPIO3_IO12 0x15c 0x44c 0x000 0x5 0x0
495#define MX6SL_PAD_I2C1_SCL__ECSPI1_SS1 0x15c 0x44c 0x690 0x6 0x0
496#define MX6SL_PAD_I2C1_SDA__I2C1_SDA 0x160 0x450 0x720 0x0 0x2
497#define MX6SL_PAD_I2C1_SDA__UART1_CTS_B 0x160 0x450 0x000 0x1 0x0
498#define MX6SL_PAD_I2C1_SDA__UART1_RTS_B 0x160 0x450 0x7f8 0x1 0x1
499#define MX6SL_PAD_I2C1_SDA__ECSPI3_SS3 0x160 0x450 0x6cc 0x2 0x1
500#define MX6SL_PAD_I2C1_SDA__FEC_TX_EN 0x160 0x450 0x000 0x3 0x0
501#define MX6SL_PAD_I2C1_SDA__SD3_VSELECT 0x160 0x450 0x000 0x4 0x0
502#define MX6SL_PAD_I2C1_SDA__GPIO3_IO13 0x160 0x450 0x000 0x5 0x0
503#define MX6SL_PAD_I2C1_SDA__ECSPI1_SS2 0x160 0x450 0x694 0x6 0x0
504#define MX6SL_PAD_I2C2_SCL__I2C2_SCL 0x164 0x454 0x724 0x0 0x1
505#define MX6SL_PAD_I2C2_SCL__AUD4_RXFS 0x164 0x454 0x5f0 0x1 0x0
506#define MX6SL_PAD_I2C2_SCL__SPDIF_IN 0x164 0x454 0x7f0 0x2 0x1
507#define MX6SL_PAD_I2C2_SCL__FEC_TX_DATA1 0x164 0x454 0x000 0x3 0x0
508#define MX6SL_PAD_I2C2_SCL__SD3_WP 0x164 0x454 0x84c 0x4 0x2
509#define MX6SL_PAD_I2C2_SCL__GPIO3_IO14 0x164 0x454 0x000 0x5 0x0
510#define MX6SL_PAD_I2C2_SCL__ECSPI1_RDY 0x164 0x454 0x680 0x6 0x0
511#define MX6SL_PAD_I2C2_SDA__I2C2_SDA 0x168 0x458 0x728 0x0 0x1
512#define MX6SL_PAD_I2C2_SDA__AUD4_RXC 0x168 0x458 0x5ec 0x1 0x0
513#define MX6SL_PAD_I2C2_SDA__SPDIF_OUT 0x168 0x458 0x000 0x2 0x0
514#define MX6SL_PAD_I2C2_SDA__FEC_REF_OUT 0x168 0x458 0x000 0x3 0x0
515#define MX6SL_PAD_I2C2_SDA__SD3_CD_B 0x168 0x458 0x838 0x4 0x2
516#define MX6SL_PAD_I2C2_SDA__GPIO3_IO15 0x168 0x458 0x000 0x5 0x0
517#define MX6SL_PAD_KEY_COL0__KEY_COL0 0x16c 0x474 0x734 0x0 0x0
518#define MX6SL_PAD_KEY_COL0__I2C2_SCL 0x16c 0x474 0x724 0x1 0x2
519#define MX6SL_PAD_KEY_COL0__LCD_DATA00 0x16c 0x474 0x778 0x2 0x0
520#define MX6SL_PAD_KEY_COL0__EIM_AD00 0x16c 0x474 0x000 0x3 0x0
521#define MX6SL_PAD_KEY_COL0__SD1_CD_B 0x16c 0x474 0x828 0x4 0x2
522#define MX6SL_PAD_KEY_COL0__GPIO3_IO24 0x16c 0x474 0x000 0x5 0x0
523#define MX6SL_PAD_KEY_COL1__KEY_COL1 0x170 0x478 0x738 0x0 0x0
524#define MX6SL_PAD_KEY_COL1__ECSPI4_MOSI 0x170 0x478 0x6d8 0x1 0x2
525#define MX6SL_PAD_KEY_COL1__LCD_DATA02 0x170 0x478 0x780 0x2 0x0
526#define MX6SL_PAD_KEY_COL1__EIM_AD02 0x170 0x478 0x000 0x3 0x0
527#define MX6SL_PAD_KEY_COL1__SD3_DATA4 0x170 0x478 0x83c 0x4 0x0
528#define MX6SL_PAD_KEY_COL1__GPIO3_IO26 0x170 0x478 0x000 0x5 0x0
529#define MX6SL_PAD_KEY_COL2__KEY_COL2 0x174 0x47c 0x73c 0x0 0x0
530#define MX6SL_PAD_KEY_COL2__ECSPI4_SS0 0x174 0x47c 0x6dc 0x1 0x2
531#define MX6SL_PAD_KEY_COL2__LCD_DATA04 0x174 0x47c 0x788 0x2 0x0
532#define MX6SL_PAD_KEY_COL2__EIM_AD04 0x174 0x47c 0x000 0x3 0x0
533#define MX6SL_PAD_KEY_COL2__SD3_DATA6 0x174 0x47c 0x844 0x4 0x0
534#define MX6SL_PAD_KEY_COL2__GPIO3_IO28 0x174 0x47c 0x000 0x5 0x0
535#define MX6SL_PAD_KEY_COL3__KEY_COL3 0x178 0x480 0x740 0x0 0x0
536#define MX6SL_PAD_KEY_COL3__AUD6_RXFS 0x178 0x480 0x620 0x1 0x1
537#define MX6SL_PAD_KEY_COL3__LCD_DATA06 0x178 0x480 0x790 0x2 0x0
538#define MX6SL_PAD_KEY_COL3__EIM_AD06 0x178 0x480 0x000 0x3 0x0
539#define MX6SL_PAD_KEY_COL3__SD4_DATA6 0x178 0x480 0x874 0x4 0x1
540#define MX6SL_PAD_KEY_COL3__GPIO3_IO30 0x178 0x480 0x000 0x5 0x0
541#define MX6SL_PAD_KEY_COL3__SD1_RESET 0x178 0x480 0x000 0x6 0x0
542#define MX6SL_PAD_KEY_COL4__KEY_COL4 0x17c 0x484 0x744 0x0 0x0
543#define MX6SL_PAD_KEY_COL4__AUD6_RXD 0x17c 0x484 0x614 0x1 0x1
544#define MX6SL_PAD_KEY_COL4__LCD_DATA08 0x17c 0x484 0x798 0x2 0x0
545#define MX6SL_PAD_KEY_COL4__EIM_AD08 0x17c 0x484 0x000 0x3 0x0
546#define MX6SL_PAD_KEY_COL4__SD4_CLK 0x17c 0x484 0x850 0x4 0x2
547#define MX6SL_PAD_KEY_COL4__GPIO4_IO00 0x17c 0x484 0x000 0x5 0x0
548#define MX6SL_PAD_KEY_COL4__USB_OTG1_PWR 0x17c 0x484 0x000 0x6 0x0
549#define MX6SL_PAD_KEY_COL5__KEY_COL5 0x180 0x488 0x748 0x0 0x0
550#define MX6SL_PAD_KEY_COL5__AUD6_TXFS 0x180 0x488 0x628 0x1 0x1
551#define MX6SL_PAD_KEY_COL5__LCD_DATA10 0x180 0x488 0x7a0 0x2 0x0
552#define MX6SL_PAD_KEY_COL5__EIM_AD10 0x180 0x488 0x000 0x3 0x0
553#define MX6SL_PAD_KEY_COL5__SD4_DATA0 0x180 0x488 0x85c 0x4 0x2
554#define MX6SL_PAD_KEY_COL5__GPIO4_IO02 0x180 0x488 0x000 0x5 0x0
555#define MX6SL_PAD_KEY_COL5__USB_OTG2_PWR 0x180 0x488 0x000 0x6 0x0
556#define MX6SL_PAD_KEY_COL6__KEY_COL6 0x184 0x48c 0x74c 0x0 0x0
557#define MX6SL_PAD_KEY_COL6__UART4_RX_DATA 0x184 0x48c 0x814 0x1 0x2
558#define MX6SL_PAD_KEY_COL6__UART4_TX_DATA 0x184 0x48c 0x000 0x1 0x0
559#define MX6SL_PAD_KEY_COL6__LCD_DATA12 0x184 0x48c 0x7a8 0x2 0x0
560#define MX6SL_PAD_KEY_COL6__EIM_AD12 0x184 0x48c 0x000 0x3 0x0
561#define MX6SL_PAD_KEY_COL6__SD4_DATA2 0x184 0x48c 0x864 0x4 0x2
562#define MX6SL_PAD_KEY_COL6__GPIO4_IO04 0x184 0x48c 0x000 0x5 0x0
563#define MX6SL_PAD_KEY_COL6__SD3_RESET 0x184 0x48c 0x000 0x6 0x0
564#define MX6SL_PAD_KEY_COL7__KEY_COL7 0x188 0x490 0x750 0x0 0x0
565#define MX6SL_PAD_KEY_COL7__UART4_RTS_B 0x188 0x490 0x810 0x1 0x2
566#define MX6SL_PAD_KEY_COL7__UART4_CTS_B 0x188 0x490 0x000 0x1 0x0
567#define MX6SL_PAD_KEY_COL7__LCD_DATA14 0x188 0x490 0x7b0 0x2 0x0
568#define MX6SL_PAD_KEY_COL7__EIM_AD14 0x188 0x490 0x000 0x3 0x0
569#define MX6SL_PAD_KEY_COL7__SD4_DATA4 0x188 0x490 0x86c 0x4 0x1
570#define MX6SL_PAD_KEY_COL7__GPIO4_IO06 0x188 0x490 0x000 0x5 0x0
571#define MX6SL_PAD_KEY_COL7__SD1_WP 0x188 0x490 0x82c 0x6 0x2
572#define MX6SL_PAD_KEY_ROW0__KEY_ROW0 0x18c 0x494 0x754 0x0 0x0
573#define MX6SL_PAD_KEY_ROW0__I2C2_SDA 0x18c 0x494 0x728 0x1 0x2
574#define MX6SL_PAD_KEY_ROW0__LCD_DATA01 0x18c 0x494 0x77c 0x2 0x0
575#define MX6SL_PAD_KEY_ROW0__EIM_AD01 0x18c 0x494 0x000 0x3 0x0
576#define MX6SL_PAD_KEY_ROW0__SD1_WP 0x18c 0x494 0x82c 0x4 0x3
577#define MX6SL_PAD_KEY_ROW0__GPIO3_IO25 0x18c 0x494 0x000 0x5 0x0
578#define MX6SL_PAD_KEY_ROW1__KEY_ROW1 0x190 0x498 0x758 0x0 0x0
579#define MX6SL_PAD_KEY_ROW1__ECSPI4_MISO 0x190 0x498 0x6d4 0x1 0x2
580#define MX6SL_PAD_KEY_ROW1__LCD_DATA03 0x190 0x498 0x784 0x2 0x0
581#define MX6SL_PAD_KEY_ROW1__EIM_AD03 0x190 0x498 0x000 0x3 0x0
582#define MX6SL_PAD_KEY_ROW1__SD3_DATA5 0x190 0x498 0x840 0x4 0x0
583#define MX6SL_PAD_KEY_ROW1__GPIO3_IO27 0x190 0x498 0x000 0x5 0x0
584#define MX6SL_PAD_KEY_ROW2__KEY_ROW2 0x194 0x49c 0x75c 0x0 0x0
585#define MX6SL_PAD_KEY_ROW2__ECSPI4_SCLK 0x194 0x49c 0x6d0 0x1 0x2
586#define MX6SL_PAD_KEY_ROW2__LCD_DATA05 0x194 0x49c 0x78c 0x2 0x0
587#define MX6SL_PAD_KEY_ROW2__EIM_AD05 0x194 0x49c 0x000 0x3 0x0
588#define MX6SL_PAD_KEY_ROW2__SD3_DATA7 0x194 0x49c 0x848 0x4 0x0
589#define MX6SL_PAD_KEY_ROW2__GPIO3_IO29 0x194 0x49c 0x000 0x5 0x0
590#define MX6SL_PAD_KEY_ROW3__KEY_ROW3 0x198 0x4a0 0x760 0x0 0x0
591#define MX6SL_PAD_KEY_ROW3__AUD6_RXC 0x198 0x4a0 0x61c 0x1 0x1
592#define MX6SL_PAD_KEY_ROW3__LCD_DATA07 0x198 0x4a0 0x794 0x2 0x0
593#define MX6SL_PAD_KEY_ROW3__EIM_AD07 0x198 0x4a0 0x000 0x3 0x0
594#define MX6SL_PAD_KEY_ROW3__SD4_DATA7 0x198 0x4a0 0x878 0x4 0x1
595#define MX6SL_PAD_KEY_ROW3__GPIO3_IO31 0x198 0x4a0 0x000 0x5 0x0
596#define MX6SL_PAD_KEY_ROW3__SD1_VSELECT 0x198 0x4a0 0x000 0x6 0x0
597#define MX6SL_PAD_KEY_ROW4__KEY_ROW4 0x19c 0x4a4 0x764 0x0 0x0
598#define MX6SL_PAD_KEY_ROW4__AUD6_TXC 0x19c 0x4a4 0x624 0x1 0x1
599#define MX6SL_PAD_KEY_ROW4__LCD_DATA09 0x19c 0x4a4 0x79c 0x2 0x0
600#define MX6SL_PAD_KEY_ROW4__EIM_AD09 0x19c 0x4a4 0x000 0x3 0x0
601#define MX6SL_PAD_KEY_ROW4__SD4_CMD 0x19c 0x4a4 0x858 0x4 0x2
602#define MX6SL_PAD_KEY_ROW4__GPIO4_IO01 0x19c 0x4a4 0x000 0x5 0x0
603#define MX6SL_PAD_KEY_ROW4__USB_OTG1_OC 0x19c 0x4a4 0x824 0x6 0x1
604#define MX6SL_PAD_KEY_ROW5__KEY_ROW5 0x1a0 0x4a8 0x768 0x0 0x0
605#define MX6SL_PAD_KEY_ROW5__AUD6_TXD 0x1a0 0x4a8 0x618 0x1 0x1
606#define MX6SL_PAD_KEY_ROW5__LCD_DATA11 0x1a0 0x4a8 0x7a4 0x2 0x0
607#define MX6SL_PAD_KEY_ROW5__EIM_AD11 0x1a0 0x4a8 0x000 0x3 0x0
608#define MX6SL_PAD_KEY_ROW5__SD4_DATA1 0x1a0 0x4a8 0x860 0x4 0x2
609#define MX6SL_PAD_KEY_ROW5__GPIO4_IO03 0x1a0 0x4a8 0x000 0x5 0x0
610#define MX6SL_PAD_KEY_ROW5__USB_OTG2_OC 0x1a0 0x4a8 0x820 0x6 0x2
611#define MX6SL_PAD_KEY_ROW6__KEY_ROW6 0x1a4 0x4ac 0x76c 0x0 0x0
612#define MX6SL_PAD_KEY_ROW6__UART4_TX_DATA 0x1a4 0x4ac 0x000 0x1 0x0
613#define MX6SL_PAD_KEY_ROW6__UART4_RX_DATA 0x1a4 0x4ac 0x814 0x1 0x3
614#define MX6SL_PAD_KEY_ROW6__LCD_DATA13 0x1a4 0x4ac 0x7ac 0x2 0x0
615#define MX6SL_PAD_KEY_ROW6__EIM_AD13 0x1a4 0x4ac 0x000 0x3 0x0
616#define MX6SL_PAD_KEY_ROW6__SD4_DATA3 0x1a4 0x4ac 0x868 0x4 0x2
617#define MX6SL_PAD_KEY_ROW6__GPIO4_IO05 0x1a4 0x4ac 0x000 0x5 0x0
618#define MX6SL_PAD_KEY_ROW6__SD3_VSELECT 0x1a4 0x4ac 0x000 0x6 0x0
619#define MX6SL_PAD_KEY_ROW7__KEY_ROW7 0x1a8 0x4b0 0x770 0x0 0x0
620#define MX6SL_PAD_KEY_ROW7__UART4_CTS_B 0x1a8 0x4b0 0x000 0x1 0x0
621#define MX6SL_PAD_KEY_ROW7__UART4_RTS_B 0x1a8 0x4b0 0x810 0x1 0x3
622#define MX6SL_PAD_KEY_ROW7__LCD_DATA15 0x1a8 0x4b0 0x7b4 0x2 0x0
623#define MX6SL_PAD_KEY_ROW7__EIM_AD15 0x1a8 0x4b0 0x000 0x3 0x0
624#define MX6SL_PAD_KEY_ROW7__SD4_DATA5 0x1a8 0x4b0 0x870 0x4 0x1
625#define MX6SL_PAD_KEY_ROW7__GPIO4_IO07 0x1a8 0x4b0 0x000 0x5 0x0
626#define MX6SL_PAD_KEY_ROW7__SD1_CD_B 0x1a8 0x4b0 0x828 0x6 0x3
627#define MX6SL_PAD_LCD_CLK__LCD_CLK 0x1ac 0x4b4 0x000 0x0 0x0
628#define MX6SL_PAD_LCD_CLK__SD4_DATA4 0x1ac 0x4b4 0x86c 0x1 0x2
629#define MX6SL_PAD_LCD_CLK__LCD_WR_RWN 0x1ac 0x4b4 0x000 0x2 0x0
630#define MX6SL_PAD_LCD_CLK__EIM_RW 0x1ac 0x4b4 0x000 0x3 0x0
631#define MX6SL_PAD_LCD_CLK__PWM4_OUT 0x1ac 0x4b4 0x000 0x4 0x0
632#define MX6SL_PAD_LCD_CLK__GPIO2_IO15 0x1ac 0x4b4 0x000 0x5 0x0
633#define MX6SL_PAD_LCD_DAT0__LCD_DATA00 0x1b0 0x4b8 0x778 0x0 0x1
634#define MX6SL_PAD_LCD_DAT0__ECSPI1_MOSI 0x1b0 0x4b8 0x688 0x1 0x1
635#define MX6SL_PAD_LCD_DAT0__USB_OTG2_ID 0x1b0 0x4b8 0x5e0 0x2 0x1
636#define MX6SL_PAD_LCD_DAT0__PWM1_OUT 0x1b0 0x4b8 0x000 0x3 0x0
637#define MX6SL_PAD_LCD_DAT0__UART5_DTR_B 0x1b0 0x4b8 0x000 0x4 0x0
638#define MX6SL_PAD_LCD_DAT0__GPIO2_IO20 0x1b0 0x4b8 0x000 0x5 0x0
639#define MX6SL_PAD_LCD_DAT0__ARM_TRACE00 0x1b0 0x4b8 0x000 0x6 0x0
640#define MX6SL_PAD_LCD_DAT0__SRC_BOOT_CFG00 0x1b0 0x4b8 0x000 0x7 0x0
641#define MX6SL_PAD_LCD_DAT1__LCD_DATA01 0x1b4 0x4bc 0x77c 0x0 0x1
642#define MX6SL_PAD_LCD_DAT1__ECSPI1_MISO 0x1b4 0x4bc 0x684 0x1 0x1
643#define MX6SL_PAD_LCD_DAT1__USB_OTG1_ID 0x1b4 0x4bc 0x5dc 0x2 0x2
644#define MX6SL_PAD_LCD_DAT1__PWM2_OUT 0x1b4 0x4bc 0x000 0x3 0x0
645#define MX6SL_PAD_LCD_DAT1__AUD4_RXFS 0x1b4 0x4bc 0x5f0 0x4 0x1
646#define MX6SL_PAD_LCD_DAT1__GPIO2_IO21 0x1b4 0x4bc 0x000 0x5 0x0
647#define MX6SL_PAD_LCD_DAT1__ARM_TRACE01 0x1b4 0x4bc 0x000 0x6 0x0
648#define MX6SL_PAD_LCD_DAT1__SRC_BOOT_CFG01 0x1b4 0x4bc 0x000 0x7 0x0
649#define MX6SL_PAD_LCD_DAT10__LCD_DATA10 0x1b8 0x4c0 0x7a0 0x0 0x1
650#define MX6SL_PAD_LCD_DAT10__KEY_COL1 0x1b8 0x4c0 0x738 0x1 0x1
651#define MX6SL_PAD_LCD_DAT10__CSI_DATA07 0x1b8 0x4c0 0x64c 0x2 0x1
652#define MX6SL_PAD_LCD_DAT10__EIM_DATA04 0x1b8 0x4c0 0x000 0x3 0x0
653#define MX6SL_PAD_LCD_DAT10__ECSPI2_MISO 0x1b8 0x4c0 0x6a0 0x4 0x2
654#define MX6SL_PAD_LCD_DAT10__GPIO2_IO30 0x1b8 0x4c0 0x000 0x5 0x0
655#define MX6SL_PAD_LCD_DAT10__ARM_TRACE10 0x1b8 0x4c0 0x000 0x6 0x0
656#define MX6SL_PAD_LCD_DAT10__SRC_BOOT_CFG10 0x1b8 0x4c0 0x000 0x7 0x0
657#define MX6SL_PAD_LCD_DAT11__LCD_DATA11 0x1bc 0x4c4 0x7a4 0x0 0x1
658#define MX6SL_PAD_LCD_DAT11__KEY_ROW1 0x1bc 0x4c4 0x758 0x1 0x1
659#define MX6SL_PAD_LCD_DAT11__CSI_DATA06 0x1bc 0x4c4 0x648 0x2 0x1
660#define MX6SL_PAD_LCD_DAT11__EIM_DATA05 0x1bc 0x4c4 0x000 0x3 0x0
661#define MX6SL_PAD_LCD_DAT11__ECSPI2_SS1 0x1bc 0x4c4 0x6ac 0x4 0x1
662#define MX6SL_PAD_LCD_DAT11__GPIO2_IO31 0x1bc 0x4c4 0x000 0x5 0x0
663#define MX6SL_PAD_LCD_DAT11__ARM_TRACE11 0x1bc 0x4c4 0x000 0x6 0x0
664#define MX6SL_PAD_LCD_DAT11__SRC_BOOT_CFG11 0x1bc 0x4c4 0x000 0x7 0x0
665#define MX6SL_PAD_LCD_DAT12__LCD_DATA12 0x1c0 0x4c8 0x7a8 0x0 0x1
666#define MX6SL_PAD_LCD_DAT12__KEY_COL2 0x1c0 0x4c8 0x73c 0x1 0x1
667#define MX6SL_PAD_LCD_DAT12__CSI_DATA05 0x1c0 0x4c8 0x644 0x2 0x1
668#define MX6SL_PAD_LCD_DAT12__EIM_DATA06 0x1c0 0x4c8 0x000 0x3 0x0
669#define MX6SL_PAD_LCD_DAT12__UART5_RTS_B 0x1c0 0x4c8 0x818 0x4 0x2
670#define MX6SL_PAD_LCD_DAT12__UART5_CTS_B 0x1c0 0x4c8 0x000 0x4 0x0
671#define MX6SL_PAD_LCD_DAT12__GPIO3_IO00 0x1c0 0x4c8 0x000 0x5 0x0
672#define MX6SL_PAD_LCD_DAT12__ARM_TRACE12 0x1c0 0x4c8 0x000 0x6 0x0
673#define MX6SL_PAD_LCD_DAT12__SRC_BOOT_CFG12 0x1c0 0x4c8 0x000 0x7 0x0
674#define MX6SL_PAD_LCD_DAT13__LCD_DATA13 0x1c4 0x4cc 0x7ac 0x0 0x1
675#define MX6SL_PAD_LCD_DAT13__KEY_ROW2 0x1c4 0x4cc 0x75c 0x1 0x1
676#define MX6SL_PAD_LCD_DAT13__CSI_DATA04 0x1c4 0x4cc 0x640 0x2 0x1
677#define MX6SL_PAD_LCD_DAT13__EIM_DATA07 0x1c4 0x4cc 0x000 0x3 0x0
678#define MX6SL_PAD_LCD_DAT13__UART5_CTS_B 0x1c4 0x4cc 0x000 0x4 0x0
679#define MX6SL_PAD_LCD_DAT13__UART5_RTS_B 0x1c4 0x4cc 0x818 0x4 0x3
680#define MX6SL_PAD_LCD_DAT13__GPIO3_IO01 0x1c4 0x4cc 0x000 0x5 0x0
681#define MX6SL_PAD_LCD_DAT13__ARM_TRACE13 0x1c4 0x4cc 0x000 0x6 0x0
682#define MX6SL_PAD_LCD_DAT13__SRC_BOOT_CFG13 0x1c4 0x4cc 0x000 0x7 0x0
683#define MX6SL_PAD_LCD_DAT14__LCD_DATA14 0x1c8 0x4d0 0x7b0 0x0 0x1
684#define MX6SL_PAD_LCD_DAT14__KEY_COL3 0x1c8 0x4d0 0x740 0x1 0x1
685#define MX6SL_PAD_LCD_DAT14__CSI_DATA03 0x1c8 0x4d0 0x63c 0x2 0x1
686#define MX6SL_PAD_LCD_DAT14__EIM_DATA08 0x1c8 0x4d0 0x000 0x3 0x0
687#define MX6SL_PAD_LCD_DAT14__UART5_RX_DATA 0x1c8 0x4d0 0x81c 0x4 0x2
688#define MX6SL_PAD_LCD_DAT14__UART5_TX_DATA 0x1c8 0x4d0 0x000 0x4 0x0
689#define MX6SL_PAD_LCD_DAT14__GPIO3_IO02 0x1c8 0x4d0 0x000 0x5 0x0
690#define MX6SL_PAD_LCD_DAT14__ARM_TRACE14 0x1c8 0x4d0 0x000 0x6 0x0
691#define MX6SL_PAD_LCD_DAT14__SRC_BOOT_CFG14 0x1c8 0x4d0 0x000 0x7 0x0
692#define MX6SL_PAD_LCD_DAT15__LCD_DATA15 0x1cc 0x4d4 0x7b4 0x0 0x1
693#define MX6SL_PAD_LCD_DAT15__KEY_ROW3 0x1cc 0x4d4 0x760 0x1 0x1
694#define MX6SL_PAD_LCD_DAT15__CSI_DATA02 0x1cc 0x4d4 0x638 0x2 0x1
695#define MX6SL_PAD_LCD_DAT15__EIM_DATA09 0x1cc 0x4d4 0x000 0x3 0x0
696#define MX6SL_PAD_LCD_DAT15__UART5_TX_DATA 0x1cc 0x4d4 0x000 0x4 0x0
697#define MX6SL_PAD_LCD_DAT15__UART5_RX_DATA 0x1cc 0x4d4 0x81c 0x4 0x3
698#define MX6SL_PAD_LCD_DAT15__GPIO3_IO03 0x1cc 0x4d4 0x000 0x5 0x0
699#define MX6SL_PAD_LCD_DAT15__ARM_TRACE15 0x1cc 0x4d4 0x000 0x6 0x0
700#define MX6SL_PAD_LCD_DAT15__SRC_BOOT_CFG15 0x1cc 0x4d4 0x000 0x7 0x0
701#define MX6SL_PAD_LCD_DAT16__LCD_DATA16 0x1d0 0x4d8 0x7b8 0x0 0x1
702#define MX6SL_PAD_LCD_DAT16__KEY_COL4 0x1d0 0x4d8 0x744 0x1 0x1
703#define MX6SL_PAD_LCD_DAT16__CSI_DATA01 0x1d0 0x4d8 0x634 0x2 0x1
704#define MX6SL_PAD_LCD_DAT16__EIM_DATA10 0x1d0 0x4d8 0x000 0x3 0x0
705#define MX6SL_PAD_LCD_DAT16__I2C2_SCL 0x1d0 0x4d8 0x724 0x4 0x3
706#define MX6SL_PAD_LCD_DAT16__GPIO3_IO04 0x1d0 0x4d8 0x000 0x5 0x0
707#define MX6SL_PAD_LCD_DAT16__ARM_TRACE16 0x1d0 0x4d8 0x000 0x6 0x0
708#define MX6SL_PAD_LCD_DAT16__SRC_BOOT_CFG24 0x1d0 0x4d8 0x000 0x7 0x0
709#define MX6SL_PAD_LCD_DAT17__LCD_DATA17 0x1d4 0x4dc 0x7bc 0x0 0x1
710#define MX6SL_PAD_LCD_DAT17__KEY_ROW4 0x1d4 0x4dc 0x764 0x1 0x1
711#define MX6SL_PAD_LCD_DAT17__CSI_DATA00 0x1d4 0x4dc 0x630 0x2 0x1
712#define MX6SL_PAD_LCD_DAT17__EIM_DATA11 0x1d4 0x4dc 0x000 0x3 0x0
713#define MX6SL_PAD_LCD_DAT17__I2C2_SDA 0x1d4 0x4dc 0x728 0x4 0x3
714#define MX6SL_PAD_LCD_DAT17__GPIO3_IO05 0x1d4 0x4dc 0x000 0x5 0x0
715#define MX6SL_PAD_LCD_DAT17__ARM_TRACE17 0x1d4 0x4dc 0x000 0x6 0x0
716#define MX6SL_PAD_LCD_DAT17__SRC_BOOT_CFG25 0x1d4 0x4dc 0x000 0x7 0x0
717#define MX6SL_PAD_LCD_DAT18__LCD_DATA18 0x1d8 0x4e0 0x7c0 0x0 0x1
718#define MX6SL_PAD_LCD_DAT18__KEY_COL5 0x1d8 0x4e0 0x748 0x1 0x1
719#define MX6SL_PAD_LCD_DAT18__CSI_DATA15 0x1d8 0x4e0 0x66c 0x2 0x0
720#define MX6SL_PAD_LCD_DAT18__EIM_DATA12 0x1d8 0x4e0 0x000 0x3 0x0
721#define MX6SL_PAD_LCD_DAT18__GPT_CAPTURE1 0x1d8 0x4e0 0x710 0x4 0x1
722#define MX6SL_PAD_LCD_DAT18__GPIO3_IO06 0x1d8 0x4e0 0x000 0x5 0x0
723#define MX6SL_PAD_LCD_DAT18__ARM_TRACE18 0x1d8 0x4e0 0x000 0x6 0x0
724#define MX6SL_PAD_LCD_DAT18__SRC_BOOT_CFG26 0x1d8 0x4e0 0x000 0x7 0x0
725#define MX6SL_PAD_LCD_DAT19__LCD_DATA19 0x1dc 0x4e4 0x7c4 0x0 0x1
726#define MX6SL_PAD_LCD_DAT19__KEY_ROW5 0x1dc 0x4e4 0x768 0x1 0x1
727#define MX6SL_PAD_LCD_DAT19__CSI_DATA14 0x1dc 0x4e4 0x668 0x2 0x0
728#define MX6SL_PAD_LCD_DAT19__EIM_DATA13 0x1dc 0x4e4 0x000 0x3 0x0
729#define MX6SL_PAD_LCD_DAT19__GPT_CAPTURE2 0x1dc 0x4e4 0x714 0x4 0x1
730#define MX6SL_PAD_LCD_DAT19__GPIO3_IO07 0x1dc 0x4e4 0x000 0x5 0x0
731#define MX6SL_PAD_LCD_DAT19__ARM_TRACE19 0x1dc 0x4e4 0x000 0x6 0x0
732#define MX6SL_PAD_LCD_DAT19__SRC_BOOT_CFG27 0x1dc 0x4e4 0x000 0x7 0x0
733#define MX6SL_PAD_LCD_DAT2__LCD_DATA02 0x1e0 0x4e8 0x780 0x0 0x1
734#define MX6SL_PAD_LCD_DAT2__ECSPI1_SS0 0x1e0 0x4e8 0x68c 0x1 0x1
735#define MX6SL_PAD_LCD_DAT2__EPIT2_OUT 0x1e0 0x4e8 0x000 0x2 0x0
736#define MX6SL_PAD_LCD_DAT2__PWM3_OUT 0x1e0 0x4e8 0x000 0x3 0x0
737#define MX6SL_PAD_LCD_DAT2__AUD4_RXC 0x1e0 0x4e8 0x5ec 0x4 0x1
738#define MX6SL_PAD_LCD_DAT2__GPIO2_IO22 0x1e0 0x4e8 0x000 0x5 0x0
739#define MX6SL_PAD_LCD_DAT2__ARM_TRACE02 0x1e0 0x4e8 0x000 0x6 0x0
740#define MX6SL_PAD_LCD_DAT2__SRC_BOOT_CFG02 0x1e0 0x4e8 0x000 0x7 0x0
741#define MX6SL_PAD_LCD_DAT20__LCD_DATA20 0x1e4 0x4ec 0x7c8 0x0 0x1
742#define MX6SL_PAD_LCD_DAT20__KEY_COL6 0x1e4 0x4ec 0x74c 0x1 0x1
743#define MX6SL_PAD_LCD_DAT20__CSI_DATA13 0x1e4 0x4ec 0x664 0x2 0x0
744#define MX6SL_PAD_LCD_DAT20__EIM_DATA14 0x1e4 0x4ec 0x000 0x3 0x0
745#define MX6SL_PAD_LCD_DAT20__GPT_COMPARE1 0x1e4 0x4ec 0x000 0x4 0x0
746#define MX6SL_PAD_LCD_DAT20__GPIO3_IO08 0x1e4 0x4ec 0x000 0x5 0x0
747#define MX6SL_PAD_LCD_DAT20__ARM_TRACE20 0x1e4 0x4ec 0x000 0x6 0x0
748#define MX6SL_PAD_LCD_DAT20__SRC_BOOT_CFG28 0x1e4 0x4ec 0x000 0x7 0x0
749#define MX6SL_PAD_LCD_DAT21__LCD_DATA21 0x1e8 0x4f0 0x7cc 0x0 0x1
750#define MX6SL_PAD_LCD_DAT21__KEY_ROW6 0x1e8 0x4f0 0x76c 0x1 0x1
751#define MX6SL_PAD_LCD_DAT21__CSI_DATA12 0x1e8 0x4f0 0x660 0x2 0x0
752#define MX6SL_PAD_LCD_DAT21__EIM_DATA15 0x1e8 0x4f0 0x000 0x3 0x0
753#define MX6SL_PAD_LCD_DAT21__GPT_COMPARE2 0x1e8 0x4f0 0x000 0x4 0x0
754#define MX6SL_PAD_LCD_DAT21__GPIO3_IO09 0x1e8 0x4f0 0x000 0x5 0x0
755#define MX6SL_PAD_LCD_DAT21__ARM_TRACE21 0x1e8 0x4f0 0x000 0x6 0x0
756#define MX6SL_PAD_LCD_DAT21__SRC_BOOT_CFG29 0x1e8 0x4f0 0x000 0x7 0x0
757#define MX6SL_PAD_LCD_DAT22__LCD_DATA22 0x1ec 0x4f4 0x7d0 0x0 0x1
758#define MX6SL_PAD_LCD_DAT22__KEY_COL7 0x1ec 0x4f4 0x750 0x1 0x1
759#define MX6SL_PAD_LCD_DAT22__CSI_DATA11 0x1ec 0x4f4 0x65c 0x2 0x1
760#define MX6SL_PAD_LCD_DAT22__EIM_EB3_B 0x1ec 0x4f4 0x000 0x3 0x0
761#define MX6SL_PAD_LCD_DAT22__GPT_COMPARE3 0x1ec 0x4f4 0x000 0x4 0x0
762#define MX6SL_PAD_LCD_DAT22__GPIO3_IO10 0x1ec 0x4f4 0x000 0x5 0x0
763#define MX6SL_PAD_LCD_DAT22__ARM_TRACE22 0x1ec 0x4f4 0x000 0x6 0x0
764#define MX6SL_PAD_LCD_DAT22__SRC_BOOT_CFG30 0x1ec 0x4f4 0x000 0x7 0x0
765#define MX6SL_PAD_LCD_DAT23__LCD_DATA23 0x1f0 0x4f8 0x7d4 0x0 0x1
766#define MX6SL_PAD_LCD_DAT23__KEY_ROW7 0x1f0 0x4f8 0x770 0x1 0x1
767#define MX6SL_PAD_LCD_DAT23__CSI_DATA10 0x1f0 0x4f8 0x658 0x2 0x1
768#define MX6SL_PAD_LCD_DAT23__EIM_EB2_B 0x1f0 0x4f8 0x000 0x3 0x0
769#define MX6SL_PAD_LCD_DAT23__GPT_CLKIN 0x1f0 0x4f8 0x718 0x4 0x1
770#define MX6SL_PAD_LCD_DAT23__GPIO3_IO11 0x1f0 0x4f8 0x000 0x5 0x0
771#define MX6SL_PAD_LCD_DAT23__ARM_TRACE23 0x1f0 0x4f8 0x000 0x6 0x0
772#define MX6SL_PAD_LCD_DAT23__SRC_BOOT_CFG31 0x1f0 0x4f8 0x000 0x7 0x0
773#define MX6SL_PAD_LCD_DAT3__LCD_DATA03 0x1f4 0x4fc 0x784 0x0 0x1
774#define MX6SL_PAD_LCD_DAT3__ECSPI1_SCLK 0x1f4 0x4fc 0x67c 0x1 0x1
775#define MX6SL_PAD_LCD_DAT3__UART5_DSR_B 0x1f4 0x4fc 0x000 0x2 0x0
776#define MX6SL_PAD_LCD_DAT3__PWM4_OUT 0x1f4 0x4fc 0x000 0x3 0x0
777#define MX6SL_PAD_LCD_DAT3__AUD4_RXD 0x1f4 0x4fc 0x5e4 0x4 0x1
778#define MX6SL_PAD_LCD_DAT3__GPIO2_IO23 0x1f4 0x4fc 0x000 0x5 0x0
779#define MX6SL_PAD_LCD_DAT3__ARM_TRACE03 0x1f4 0x4fc 0x000 0x6 0x0
780#define MX6SL_PAD_LCD_DAT3__SRC_BOOT_CFG03 0x1f4 0x4fc 0x000 0x7 0x0
781#define MX6SL_PAD_LCD_DAT4__LCD_DATA04 0x1f8 0x500 0x788 0x0 0x1
782#define MX6SL_PAD_LCD_DAT4__ECSPI1_SS1 0x1f8 0x500 0x690 0x1 0x1
783#define MX6SL_PAD_LCD_DAT4__CSI_VSYNC 0x1f8 0x500 0x678 0x2 0x2
784#define MX6SL_PAD_LCD_DAT4__WDOG2_RESET_B_DEB 0x1f8 0x500 0x000 0x3 0x0
785#define MX6SL_PAD_LCD_DAT4__AUD4_TXC 0x1f8 0x500 0x5f4 0x4 0x1
786#define MX6SL_PAD_LCD_DAT4__GPIO2_IO24 0x1f8 0x500 0x000 0x5 0x0
787#define MX6SL_PAD_LCD_DAT4__ARM_TRACE04 0x1f8 0x500 0x000 0x6 0x0
788#define MX6SL_PAD_LCD_DAT4__SRC_BOOT_CFG04 0x1f8 0x500 0x000 0x7 0x0
789#define MX6SL_PAD_LCD_DAT5__LCD_DATA05 0x1fc 0x504 0x78c 0x0 0x1
790#define MX6SL_PAD_LCD_DAT5__ECSPI1_SS2 0x1fc 0x504 0x694 0x1 0x1
791#define MX6SL_PAD_LCD_DAT5__CSI_HSYNC 0x1fc 0x504 0x670 0x2 0x2
792#define MX6SL_PAD_LCD_DAT5__EIM_CS3_B 0x1fc 0x504 0x000 0x3 0x0
793#define MX6SL_PAD_LCD_DAT5__AUD4_TXFS 0x1fc 0x504 0x5f8 0x4 0x1
794#define MX6SL_PAD_LCD_DAT5__GPIO2_IO25 0x1fc 0x504 0x000 0x5 0x0
795#define MX6SL_PAD_LCD_DAT5__ARM_TRACE05 0x1fc 0x504 0x000 0x6 0x0
796#define MX6SL_PAD_LCD_DAT5__SRC_BOOT_CFG05 0x1fc 0x504 0x000 0x7 0x0
797#define MX6SL_PAD_LCD_DAT6__LCD_DATA06 0x200 0x508 0x790 0x0 0x1
798#define MX6SL_PAD_LCD_DAT6__ECSPI1_SS3 0x200 0x508 0x698 0x1 0x1
799#define MX6SL_PAD_LCD_DAT6__CSI_PIXCLK 0x200 0x508 0x674 0x2 0x2
800#define MX6SL_PAD_LCD_DAT6__EIM_DATA00 0x200 0x508 0x000 0x3 0x0
801#define MX6SL_PAD_LCD_DAT6__AUD4_TXD 0x200 0x508 0x5e8 0x4 0x1
802#define MX6SL_PAD_LCD_DAT6__GPIO2_IO26 0x200 0x508 0x000 0x5 0x0
803#define MX6SL_PAD_LCD_DAT6__ARM_TRACE06 0x200 0x508 0x000 0x6 0x0
804#define MX6SL_PAD_LCD_DAT6__SRC_BOOT_CFG06 0x200 0x508 0x000 0x7 0x0
805#define MX6SL_PAD_LCD_DAT7__LCD_DATA07 0x204 0x50c 0x794 0x0 0x1
806#define MX6SL_PAD_LCD_DAT7__ECSPI1_RDY 0x204 0x50c 0x680 0x1 0x1
807#define MX6SL_PAD_LCD_DAT7__CSI_MCLK 0x204 0x50c 0x000 0x2 0x0
808#define MX6SL_PAD_LCD_DAT7__EIM_DATA01 0x204 0x50c 0x000 0x3 0x0
809#define MX6SL_PAD_LCD_DAT7__AUDIO_CLK_OUT 0x204 0x50c 0x000 0x4 0x0
810#define MX6SL_PAD_LCD_DAT7__GPIO2_IO27 0x204 0x50c 0x000 0x5 0x0
811#define MX6SL_PAD_LCD_DAT7__ARM_TRACE07 0x204 0x50c 0x000 0x6 0x0
812#define MX6SL_PAD_LCD_DAT7__SRC_BOOT_CFG07 0x204 0x50c 0x000 0x7 0x0
813#define MX6SL_PAD_LCD_DAT8__LCD_DATA08 0x208 0x510 0x798 0x0 0x1
814#define MX6SL_PAD_LCD_DAT8__KEY_COL0 0x208 0x510 0x734 0x1 0x1
815#define MX6SL_PAD_LCD_DAT8__CSI_DATA09 0x208 0x510 0x654 0x2 0x1
816#define MX6SL_PAD_LCD_DAT8__EIM_DATA02 0x208 0x510 0x000 0x3 0x0
817#define MX6SL_PAD_LCD_DAT8__ECSPI2_SCLK 0x208 0x510 0x69c 0x4 0x2
818#define MX6SL_PAD_LCD_DAT8__GPIO2_IO28 0x208 0x510 0x000 0x5 0x0
819#define MX6SL_PAD_LCD_DAT8__ARM_TRACE08 0x208 0x510 0x000 0x6 0x0
820#define MX6SL_PAD_LCD_DAT8__SRC_BOOT_CFG08 0x208 0x510 0x000 0x7 0x0
821#define MX6SL_PAD_LCD_DAT9__LCD_DATA09 0x20c 0x514 0x79c 0x0 0x1
822#define MX6SL_PAD_LCD_DAT9__KEY_ROW0 0x20c 0x514 0x754 0x1 0x1
823#define MX6SL_PAD_LCD_DAT9__CSI_DATA08 0x20c 0x514 0x650 0x2 0x1
824#define MX6SL_PAD_LCD_DAT9__EIM_DATA03 0x20c 0x514 0x000 0x3 0x0
825#define MX6SL_PAD_LCD_DAT9__ECSPI2_MOSI 0x20c 0x514 0x6a4 0x4 0x2
826#define MX6SL_PAD_LCD_DAT9__GPIO2_IO29 0x20c 0x514 0x000 0x5 0x0
827#define MX6SL_PAD_LCD_DAT9__ARM_TRACE09 0x20c 0x514 0x000 0x6 0x0
828#define MX6SL_PAD_LCD_DAT9__SRC_BOOT_CFG09 0x20c 0x514 0x000 0x7 0x0
829#define MX6SL_PAD_LCD_ENABLE__LCD_ENABLE 0x210 0x518 0x000 0x0 0x0
830#define MX6SL_PAD_LCD_ENABLE__SD4_DATA5 0x210 0x518 0x870 0x1 0x2
831#define MX6SL_PAD_LCD_ENABLE__LCD_RD_E 0x210 0x518 0x000 0x2 0x0
832#define MX6SL_PAD_LCD_ENABLE__EIM_OE_B 0x210 0x518 0x000 0x3 0x0
833#define MX6SL_PAD_LCD_ENABLE__UART2_RX_DATA 0x210 0x518 0x804 0x4 0x2
834#define MX6SL_PAD_LCD_ENABLE__UART2_TX_DATA 0x210 0x518 0x000 0x4 0x0
835#define MX6SL_PAD_LCD_ENABLE__GPIO2_IO16 0x210 0x518 0x000 0x5 0x0
836#define MX6SL_PAD_LCD_HSYNC__LCD_HSYNC 0x214 0x51c 0x774 0x0 0x0
837#define MX6SL_PAD_LCD_HSYNC__SD4_DATA6 0x214 0x51c 0x874 0x1 0x2
838#define MX6SL_PAD_LCD_HSYNC__LCD_CS 0x214 0x51c 0x000 0x2 0x0
839#define MX6SL_PAD_LCD_HSYNC__EIM_CS0_B 0x214 0x51c 0x000 0x3 0x0
840#define MX6SL_PAD_LCD_HSYNC__UART2_TX_DATA 0x214 0x51c 0x000 0x4 0x0
841#define MX6SL_PAD_LCD_HSYNC__UART2_RX_DATA 0x214 0x51c 0x804 0x4 0x3
842#define MX6SL_PAD_LCD_HSYNC__GPIO2_IO17 0x214 0x51c 0x000 0x5 0x0
843#define MX6SL_PAD_LCD_HSYNC__ARM_TRACE_CLK 0x214 0x51c 0x000 0x6 0x0
844#define MX6SL_PAD_LCD_RESET__LCD_RESET 0x218 0x520 0x000 0x0 0x0
845#define MX6SL_PAD_LCD_RESET__EIM_DTACK_B 0x218 0x520 0x880 0x1 0x1
846#define MX6SL_PAD_LCD_RESET__LCD_BUSY 0x218 0x520 0x774 0x2 0x1
847#define MX6SL_PAD_LCD_RESET__EIM_WAIT_B 0x218 0x520 0x884 0x3 0x1
848#define MX6SL_PAD_LCD_RESET__UART2_CTS_B 0x218 0x520 0x000 0x4 0x0
849#define MX6SL_PAD_LCD_RESET__UART2_RTS_B 0x218 0x520 0x800 0x4 0x2
850#define MX6SL_PAD_LCD_RESET__GPIO2_IO19 0x218 0x520 0x000 0x5 0x0
851#define MX6SL_PAD_LCD_RESET__CCM_PMIC_READY 0x218 0x520 0x62c 0x6 0x1
852#define MX6SL_PAD_LCD_VSYNC__LCD_VSYNC 0x21c 0x524 0x000 0x0 0x0
853#define MX6SL_PAD_LCD_VSYNC__SD4_DATA7 0x21c 0x524 0x878 0x1 0x2
854#define MX6SL_PAD_LCD_VSYNC__LCD_RS 0x21c 0x524 0x000 0x2 0x0
855#define MX6SL_PAD_LCD_VSYNC__EIM_CS1_B 0x21c 0x524 0x000 0x3 0x0
856#define MX6SL_PAD_LCD_VSYNC__UART2_RTS_B 0x21c 0x524 0x800 0x4 0x3
857#define MX6SL_PAD_LCD_VSYNC__UART2_CTS_B 0x21c 0x524 0x000 0x4 0x0
858#define MX6SL_PAD_LCD_VSYNC__GPIO2_IO18 0x21c 0x524 0x000 0x5 0x0
859#define MX6SL_PAD_LCD_VSYNC__ARM_TRACE_CTL 0x21c 0x524 0x000 0x6 0x0
860#define MX6SL_PAD_PWM1__PWM1_OUT 0x220 0x528 0x000 0x0 0x0
861#define MX6SL_PAD_PWM1__CCM_CLKO 0x220 0x528 0x000 0x1 0x0
862#define MX6SL_PAD_PWM1__AUDIO_CLK_OUT 0x220 0x528 0x000 0x2 0x0
863#define MX6SL_PAD_PWM1__FEC_REF_OUT 0x220 0x528 0x000 0x3 0x0
864#define MX6SL_PAD_PWM1__CSI_MCLK 0x220 0x528 0x000 0x4 0x0
865#define MX6SL_PAD_PWM1__GPIO3_IO23 0x220 0x528 0x000 0x5 0x0
866#define MX6SL_PAD_PWM1__EPIT1_OUT 0x220 0x528 0x000 0x6 0x0
867#define MX6SL_PAD_REF_CLK_24M__XTALOSC_REF_CLK_24M 0x224 0x52c 0x000 0x0 0x0
868#define MX6SL_PAD_REF_CLK_24M__I2C3_SCL 0x224 0x52c 0x72c 0x1 0x2
869#define MX6SL_PAD_REF_CLK_24M__PWM3_OUT 0x224 0x52c 0x000 0x2 0x0
870#define MX6SL_PAD_REF_CLK_24M__USB_OTG2_ID 0x224 0x52c 0x5e0 0x3 0x2
871#define MX6SL_PAD_REF_CLK_24M__CCM_PMIC_READY 0x224 0x52c 0x62c 0x4 0x2
872#define MX6SL_PAD_REF_CLK_24M__GPIO3_IO21 0x224 0x52c 0x000 0x5 0x0
873#define MX6SL_PAD_REF_CLK_24M__SD3_WP 0x224 0x52c 0x84c 0x6 0x3
874#define MX6SL_PAD_REF_CLK_32K__XTALOSC_REF_CLK_32K 0x228 0x530 0x000 0x0 0x0
875#define MX6SL_PAD_REF_CLK_32K__I2C3_SDA 0x228 0x530 0x730 0x1 0x2
876#define MX6SL_PAD_REF_CLK_32K__PWM4_OUT 0x228 0x530 0x000 0x2 0x0
877#define MX6SL_PAD_REF_CLK_32K__USB_OTG1_ID 0x228 0x530 0x5dc 0x3 0x3
878#define MX6SL_PAD_REF_CLK_32K__SD1_LCTL 0x228 0x530 0x000 0x4 0x0
879#define MX6SL_PAD_REF_CLK_32K__GPIO3_IO22 0x228 0x530 0x000 0x5 0x0
880#define MX6SL_PAD_REF_CLK_32K__SD3_CD_B 0x228 0x530 0x838 0x6 0x3
881#define MX6SL_PAD_SD1_CLK__SD1_CLK 0x22c 0x534 0x000 0x0 0x0
882#define MX6SL_PAD_SD1_CLK__FEC_MDIO 0x22c 0x534 0x6f4 0x1 0x2
883#define MX6SL_PAD_SD1_CLK__KEY_COL0 0x22c 0x534 0x734 0x2 0x2
884#define MX6SL_PAD_SD1_CLK__EPDC_SDCE4 0x22c 0x534 0x000 0x3 0x0
885#define MX6SL_PAD_SD1_CLK__GPIO5_IO15 0x22c 0x534 0x000 0x5 0x0
886#define MX6SL_PAD_SD1_CMD__SD1_CMD 0x230 0x538 0x000 0x0 0x0
887#define MX6SL_PAD_SD1_CMD__FEC_TX_CLK 0x230 0x538 0x70c 0x1 0x2
888#define MX6SL_PAD_SD1_CMD__KEY_ROW0 0x230 0x538 0x754 0x2 0x2
889#define MX6SL_PAD_SD1_CMD__EPDC_SDCE5 0x230 0x538 0x000 0x3 0x0
890#define MX6SL_PAD_SD1_CMD__GPIO5_IO14 0x230 0x538 0x000 0x5 0x0
891#define MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x234 0x53c 0x000 0x0 0x0
892#define MX6SL_PAD_SD1_DAT0__FEC_RX_ER 0x234 0x53c 0x708 0x1 0x2
893#define MX6SL_PAD_SD1_DAT0__KEY_COL1 0x234 0x53c 0x738 0x2 0x2
894#define MX6SL_PAD_SD1_DAT0__EPDC_SDCE6 0x234 0x53c 0x000 0x3 0x0
895#define MX6SL_PAD_SD1_DAT0__GPIO5_IO11 0x234 0x53c 0x000 0x5 0x0
896#define MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x238 0x540 0x000 0x0 0x0
897#define MX6SL_PAD_SD1_DAT1__FEC_RX_DV 0x238 0x540 0x704 0x1 0x2
898#define MX6SL_PAD_SD1_DAT1__KEY_ROW1 0x238 0x540 0x758 0x2 0x2
899#define MX6SL_PAD_SD1_DAT1__EPDC_SDCE7 0x238 0x540 0x000 0x3 0x0
900#define MX6SL_PAD_SD1_DAT1__GPIO5_IO08 0x238 0x540 0x000 0x5 0x0
901#define MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x23c 0x544 0x000 0x0 0x0
902#define MX6SL_PAD_SD1_DAT2__FEC_RX_DATA1 0x23c 0x544 0x6fc 0x1 0x2
903#define MX6SL_PAD_SD1_DAT2__KEY_COL2 0x23c 0x544 0x73c 0x2 0x2
904#define MX6SL_PAD_SD1_DAT2__EPDC_SDCE8 0x23c 0x544 0x000 0x3 0x0
905#define MX6SL_PAD_SD1_DAT2__GPIO5_IO13 0x23c 0x544 0x000 0x5 0x0
906#define MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x240 0x548 0x000 0x0 0x0
907#define MX6SL_PAD_SD1_DAT3__FEC_TX_DATA0 0x240 0x548 0x000 0x1 0x0
908#define MX6SL_PAD_SD1_DAT3__KEY_ROW2 0x240 0x548 0x75c 0x2 0x2
909#define MX6SL_PAD_SD1_DAT3__EPDC_SDCE9 0x240 0x548 0x000 0x3 0x0
910#define MX6SL_PAD_SD1_DAT3__GPIO5_IO06 0x240 0x548 0x000 0x5 0x0
911#define MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x244 0x54c 0x000 0x0 0x0
912#define MX6SL_PAD_SD1_DAT4__FEC_MDC 0x244 0x54c 0x000 0x1 0x0
913#define MX6SL_PAD_SD1_DAT4__KEY_COL3 0x244 0x54c 0x740 0x2 0x2
914#define MX6SL_PAD_SD1_DAT4__EPDC_SDCLK_N 0x244 0x54c 0x000 0x3 0x0
915#define MX6SL_PAD_SD1_DAT4__UART4_RX_DATA 0x244 0x54c 0x814 0x4 0x4
916#define MX6SL_PAD_SD1_DAT4__UART4_TX_DATA 0x244 0x54c 0x000 0x4 0x0
917#define MX6SL_PAD_SD1_DAT4__GPIO5_IO12 0x244 0x54c 0x000 0x5 0x0
918#define MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x248 0x550 0x000 0x0 0x0
919#define MX6SL_PAD_SD1_DAT5__FEC_RX_DATA0 0x248 0x550 0x6f8 0x1 0x2
920#define MX6SL_PAD_SD1_DAT5__KEY_ROW3 0x248 0x550 0x760 0x2 0x2
921#define MX6SL_PAD_SD1_DAT5__EPDC_SDOED 0x248 0x550 0x000 0x3 0x0
922#define MX6SL_PAD_SD1_DAT5__UART4_TX_DATA 0x248 0x550 0x000 0x4 0x0
923#define MX6SL_PAD_SD1_DAT5__UART4_RX_DATA 0x248 0x550 0x814 0x4 0x5
924#define MX6SL_PAD_SD1_DAT5__GPIO5_IO09 0x248 0x550 0x000 0x5 0x0
925#define MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x24c 0x554 0x000 0x0 0x0
926#define MX6SL_PAD_SD1_DAT6__FEC_TX_EN 0x24c 0x554 0x000 0x1 0x0
927#define MX6SL_PAD_SD1_DAT6__KEY_COL4 0x24c 0x554 0x744 0x2 0x2
928#define MX6SL_PAD_SD1_DAT6__EPDC_SDOEZ 0x24c 0x554 0x000 0x3 0x0
929#define MX6SL_PAD_SD1_DAT6__UART4_RTS_B 0x24c 0x554 0x810 0x4 0x4
930#define MX6SL_PAD_SD1_DAT6__UART4_CTS_B 0x24c 0x554 0x000 0x4 0x0
931#define MX6SL_PAD_SD1_DAT6__GPIO5_IO07 0x24c 0x554 0x000 0x5 0x0
932#define MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x250 0x558 0x000 0x0 0x0
933#define MX6SL_PAD_SD1_DAT7__FEC_TX_DATA1 0x250 0x558 0x000 0x1 0x0
934#define MX6SL_PAD_SD1_DAT7__KEY_ROW4 0x250 0x558 0x764 0x2 0x2
935#define MX6SL_PAD_SD1_DAT7__CCM_PMIC_READY 0x250 0x558 0x62c 0x3 0x3
936#define MX6SL_PAD_SD1_DAT7__UART4_CTS_B 0x250 0x558 0x000 0x4 0x0
937#define MX6SL_PAD_SD1_DAT7__UART4_RTS_B 0x250 0x558 0x810 0x4 0x5
938#define MX6SL_PAD_SD1_DAT7__GPIO5_IO10 0x250 0x558 0x000 0x5 0x0
939#define MX6SL_PAD_SD2_CLK__SD2_CLK 0x254 0x55c 0x000 0x0 0x0
940#define MX6SL_PAD_SD2_CLK__AUD4_RXFS 0x254 0x55c 0x5f0 0x1 0x2
941#define MX6SL_PAD_SD2_CLK__ECSPI3_SCLK 0x254 0x55c 0x6b0 0x2 0x2
942#define MX6SL_PAD_SD2_CLK__CSI_DATA00 0x254 0x55c 0x630 0x3 0x2
943#define MX6SL_PAD_SD2_CLK__GPIO5_IO05 0x254 0x55c 0x000 0x5 0x0
944#define MX6SL_PAD_SD2_CMD__SD2_CMD 0x258 0x560 0x000 0x0 0x0
945#define MX6SL_PAD_SD2_CMD__AUD4_RXC 0x258 0x560 0x5ec 0x1 0x2
946#define MX6SL_PAD_SD2_CMD__ECSPI3_SS0 0x258 0x560 0x6c0 0x2 0x2
947#define MX6SL_PAD_SD2_CMD__CSI_DATA01 0x258 0x560 0x634 0x3 0x2
948#define MX6SL_PAD_SD2_CMD__EPIT1_OUT 0x258 0x560 0x000 0x4 0x0
949#define MX6SL_PAD_SD2_CMD__GPIO5_IO04 0x258 0x560 0x000 0x5 0x0
950#define MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x25c 0x564 0x000 0x0 0x0
951#define MX6SL_PAD_SD2_DAT0__AUD4_RXD 0x25c 0x564 0x5e4 0x1 0x2
952#define MX6SL_PAD_SD2_DAT0__ECSPI3_MOSI 0x25c 0x564 0x6bc 0x2 0x2
953#define MX6SL_PAD_SD2_DAT0__CSI_DATA02 0x25c 0x564 0x638 0x3 0x2
954#define MX6SL_PAD_SD2_DAT0__UART5_RTS_B 0x25c 0x564 0x818 0x4 0x4
955#define MX6SL_PAD_SD2_DAT0__UART5_CTS_B 0x25c 0x564 0x000 0x4 0x0
956#define MX6SL_PAD_SD2_DAT0__GPIO5_IO01 0x25c 0x564 0x000 0x5 0x0
957#define MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x260 0x568 0x000 0x0 0x0
958#define MX6SL_PAD_SD2_DAT1__AUD4_TXC 0x260 0x568 0x5f4 0x1 0x2
959#define MX6SL_PAD_SD2_DAT1__ECSPI3_MISO 0x260 0x568 0x6b8 0x2 0x2
960#define MX6SL_PAD_SD2_DAT1__CSI_DATA03 0x260 0x568 0x63c 0x3 0x2
961#define MX6SL_PAD_SD2_DAT1__UART5_CTS_B 0x260 0x568 0x000 0x4 0x0
962#define MX6SL_PAD_SD2_DAT1__UART5_RTS_B 0x260 0x568 0x818 0x4 0x5
963#define MX6SL_PAD_SD2_DAT1__GPIO4_IO30 0x260 0x568 0x000 0x5 0x0
964#define MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x264 0x56c 0x000 0x0 0x0
965#define MX6SL_PAD_SD2_DAT2__AUD4_TXFS 0x264 0x56c 0x5f8 0x1 0x2
966#define MX6SL_PAD_SD2_DAT2__FEC_COL 0x264 0x56c 0x6f0 0x2 0x1
967#define MX6SL_PAD_SD2_DAT2__CSI_DATA04 0x264 0x56c 0x640 0x3 0x2
968#define MX6SL_PAD_SD2_DAT2__UART5_RX_DATA 0x264 0x56c 0x81c 0x4 0x4
969#define MX6SL_PAD_SD2_DAT2__UART5_TX_DATA 0x264 0x56c 0x000 0x4 0x0
970#define MX6SL_PAD_SD2_DAT2__GPIO5_IO03 0x264 0x56c 0x000 0x5 0x0
971#define MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x268 0x570 0x000 0x0 0x0
972#define MX6SL_PAD_SD2_DAT3__AUD4_TXD 0x268 0x570 0x5e8 0x1 0x2
973#define MX6SL_PAD_SD2_DAT3__FEC_RX_CLK 0x268 0x570 0x700 0x2 0x1
974#define MX6SL_PAD_SD2_DAT3__CSI_DATA05 0x268 0x570 0x644 0x3 0x2
975#define MX6SL_PAD_SD2_DAT3__UART5_TX_DATA 0x268 0x570 0x000 0x4 0x0
976#define MX6SL_PAD_SD2_DAT3__UART5_RX_DATA 0x268 0x570 0x81c 0x4 0x5
977#define MX6SL_PAD_SD2_DAT3__GPIO4_IO28 0x268 0x570 0x000 0x5 0x0
978#define MX6SL_PAD_SD2_DAT4__SD2_DATA4 0x26c 0x574 0x000 0x0 0x0
979#define MX6SL_PAD_SD2_DAT4__SD3_DATA4 0x26c 0x574 0x83c 0x1 0x1
980#define MX6SL_PAD_SD2_DAT4__UART2_RX_DATA 0x26c 0x574 0x804 0x2 0x4
981#define MX6SL_PAD_SD2_DAT4__UART2_TX_DATA 0x26c 0x574 0x000 0x2 0x0
982#define MX6SL_PAD_SD2_DAT4__CSI_DATA06 0x26c 0x574 0x648 0x3 0x2
983#define MX6SL_PAD_SD2_DAT4__SPDIF_OUT 0x26c 0x574 0x000 0x4 0x0
984#define MX6SL_PAD_SD2_DAT4__GPIO5_IO02 0x26c 0x574 0x000 0x5 0x0
985#define MX6SL_PAD_SD2_DAT5__SD2_DATA5 0x270 0x578 0x000 0x0 0x0
986#define MX6SL_PAD_SD2_DAT5__SD3_DATA5 0x270 0x578 0x840 0x1 0x1
987#define MX6SL_PAD_SD2_DAT5__UART2_TX_DATA 0x270 0x578 0x000 0x2 0x0
988#define MX6SL_PAD_SD2_DAT5__UART2_RX_DATA 0x270 0x578 0x804 0x2 0x5
989#define MX6SL_PAD_SD2_DAT5__CSI_DATA07 0x270 0x578 0x64c 0x3 0x2
990#define MX6SL_PAD_SD2_DAT5__SPDIF_IN 0x270 0x578 0x7f0 0x4 0x2
991#define MX6SL_PAD_SD2_DAT5__GPIO4_IO31 0x270 0x578 0x000 0x5 0x0
992#define MX6SL_PAD_SD2_DAT6__SD2_DATA6 0x274 0x57c 0x000 0x0 0x0
993#define MX6SL_PAD_SD2_DAT6__SD3_DATA6 0x274 0x57c 0x844 0x1 0x1
994#define MX6SL_PAD_SD2_DAT6__UART2_RTS_B 0x274 0x57c 0x800 0x2 0x4
995#define MX6SL_PAD_SD2_DAT6__UART2_CTS_B 0x274 0x57c 0x000 0x2 0x0
996#define MX6SL_PAD_SD2_DAT6__CSI_DATA08 0x274 0x57c 0x650 0x3 0x2
997#define MX6SL_PAD_SD2_DAT6__SD2_WP 0x274 0x57c 0x834 0x4 0x2
998#define MX6SL_PAD_SD2_DAT6__GPIO4_IO29 0x274 0x57c 0x000 0x5 0x0
999#define MX6SL_PAD_SD2_DAT7__SD2_DATA7 0x278 0x580 0x000 0x0 0x0
1000#define MX6SL_PAD_SD2_DAT7__SD3_DATA7 0x278 0x580 0x848 0x1 0x1
1001#define MX6SL_PAD_SD2_DAT7__UART2_CTS_B 0x278 0x580 0x000 0x2 0x0
1002#define MX6SL_PAD_SD2_DAT7__UART2_RTS_B 0x278 0x580 0x800 0x2 0x5
1003#define MX6SL_PAD_SD2_DAT7__CSI_DATA09 0x278 0x580 0x654 0x3 0x2
1004#define MX6SL_PAD_SD2_DAT7__SD2_CD_B 0x278 0x580 0x830 0x4 0x2
1005#define MX6SL_PAD_SD2_DAT7__GPIO5_IO00 0x278 0x580 0x000 0x5 0x0
1006#define MX6SL_PAD_SD2_RST__SD2_RESET 0x27c 0x584 0x000 0x0 0x0
1007#define MX6SL_PAD_SD2_RST__FEC_REF_OUT 0x27c 0x584 0x000 0x1 0x0
1008#define MX6SL_PAD_SD2_RST__WDOG2_B 0x27c 0x584 0x000 0x2 0x0
1009#define MX6SL_PAD_SD2_RST__SPDIF_OUT 0x27c 0x584 0x000 0x3 0x0
1010#define MX6SL_PAD_SD2_RST__CSI_MCLK 0x27c 0x584 0x000 0x4 0x0
1011#define MX6SL_PAD_SD2_RST__GPIO4_IO27 0x27c 0x584 0x000 0x5 0x0
1012#define MX6SL_PAD_SD3_CLK__SD3_CLK 0x280 0x588 0x000 0x0 0x0
1013#define MX6SL_PAD_SD3_CLK__AUD5_RXFS 0x280 0x588 0x608 0x1 0x1
1014#define MX6SL_PAD_SD3_CLK__KEY_COL5 0x280 0x588 0x748 0x2 0x2
1015#define MX6SL_PAD_SD3_CLK__CSI_DATA10 0x280 0x588 0x658 0x3 0x2
1016#define MX6SL_PAD_SD3_CLK__WDOG1_RESET_B_DEB 0x280 0x588 0x000 0x4 0x0
1017#define MX6SL_PAD_SD3_CLK__GPIO5_IO18 0x280 0x588 0x000 0x5 0x0
1018#define MX6SL_PAD_SD3_CLK__USB_OTG1_PWR 0x280 0x588 0x000 0x6 0x0
1019#define MX6SL_PAD_SD3_CMD__SD3_CMD 0x284 0x58c 0x000 0x0 0x0
1020#define MX6SL_PAD_SD3_CMD__AUD5_RXC 0x284 0x58c 0x604 0x1 0x1
1021#define MX6SL_PAD_SD3_CMD__KEY_ROW5 0x284 0x58c 0x768 0x2 0x2
1022#define MX6SL_PAD_SD3_CMD__CSI_DATA11 0x284 0x58c 0x65c 0x3 0x2
1023#define MX6SL_PAD_SD3_CMD__USB_OTG2_ID 0x284 0x58c 0x5e0 0x4 0x3
1024#define MX6SL_PAD_SD3_CMD__GPIO5_IO21 0x284 0x58c 0x000 0x5 0x0
1025#define MX6SL_PAD_SD3_CMD__USB_OTG2_PWR 0x284 0x58c 0x000 0x6 0x0
1026#define MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x288 0x590 0x000 0x0 0x0
1027#define MX6SL_PAD_SD3_DAT0__AUD5_RXD 0x288 0x590 0x5fc 0x1 0x1
1028#define MX6SL_PAD_SD3_DAT0__KEY_COL6 0x288 0x590 0x74c 0x2 0x2
1029#define MX6SL_PAD_SD3_DAT0__CSI_DATA12 0x288 0x590 0x660 0x3 0x1
1030#define MX6SL_PAD_SD3_DAT0__USB_OTG1_ID 0x288 0x590 0x5dc 0x4 0x4
1031#define MX6SL_PAD_SD3_DAT0__GPIO5_IO19 0x288 0x590 0x000 0x5 0x0
1032#define MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x28c 0x594 0x000 0x0 0x0
1033#define MX6SL_PAD_SD3_DAT1__AUD5_TXC 0x28c 0x594 0x60c 0x1 0x1
1034#define MX6SL_PAD_SD3_DAT1__KEY_ROW6 0x28c 0x594 0x76c 0x2 0x2
1035#define MX6SL_PAD_SD3_DAT1__CSI_DATA13 0x28c 0x594 0x664 0x3 0x1
1036#define MX6SL_PAD_SD3_DAT1__SD1_VSELECT 0x28c 0x594 0x000 0x4 0x0
1037#define MX6SL_PAD_SD3_DAT1__GPIO5_IO20 0x28c 0x594 0x000 0x5 0x0
1038#define MX6SL_PAD_SD3_DAT1__JTAG_DE_B 0x28c 0x594 0x000 0x6 0x0
1039#define MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x290 0x598 0x000 0x0 0x0
1040#define MX6SL_PAD_SD3_DAT2__AUD5_TXFS 0x290 0x598 0x610 0x1 0x1
1041#define MX6SL_PAD_SD3_DAT2__KEY_COL7 0x290 0x598 0x750 0x2 0x2
1042#define MX6SL_PAD_SD3_DAT2__CSI_DATA14 0x290 0x598 0x668 0x3 0x1
1043#define MX6SL_PAD_SD3_DAT2__EPIT1_OUT 0x290 0x598 0x000 0x4 0x0
1044#define MX6SL_PAD_SD3_DAT2__GPIO5_IO16 0x290 0x598 0x000 0x5 0x0
1045#define MX6SL_PAD_SD3_DAT2__USB_OTG2_OC 0x290 0x598 0x820 0x6 0x3
1046#define MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x294 0x59c 0x000 0x0 0x0
1047#define MX6SL_PAD_SD3_DAT3__AUD5_TXD 0x294 0x59c 0x600 0x1 0x1
1048#define MX6SL_PAD_SD3_DAT3__KEY_ROW7 0x294 0x59c 0x770 0x2 0x2
1049#define MX6SL_PAD_SD3_DAT3__CSI_DATA15 0x294 0x59c 0x66c 0x3 0x1
1050#define MX6SL_PAD_SD3_DAT3__EPIT2_OUT 0x294 0x59c 0x000 0x4 0x0
1051#define MX6SL_PAD_SD3_DAT3__GPIO5_IO17 0x294 0x59c 0x000 0x5 0x0
1052#define MX6SL_PAD_SD3_DAT3__USB_OTG1_OC 0x294 0x59c 0x824 0x6 0x2
1053#define MX6SL_PAD_UART1_RXD__UART1_RX_DATA 0x298 0x5a0 0x7fc 0x0 0x0
1054#define MX6SL_PAD_UART1_RXD__UART1_TX_DATA 0x298 0x5a0 0x000 0x0 0x0
1055#define MX6SL_PAD_UART1_RXD__PWM1_OUT 0x298 0x5a0 0x000 0x1 0x0
1056#define MX6SL_PAD_UART1_RXD__UART4_RX_DATA 0x298 0x5a0 0x814 0x2 0x6
1057#define MX6SL_PAD_UART1_RXD__UART4_TX_DATA 0x298 0x5a0 0x000 0x2 0x0
1058#define MX6SL_PAD_UART1_RXD__FEC_COL 0x298 0x5a0 0x6f0 0x3 0x2
1059#define MX6SL_PAD_UART1_RXD__UART5_RX_DATA 0x298 0x5a0 0x81c 0x4 0x6
1060#define MX6SL_PAD_UART1_RXD__UART5_TX_DATA 0x298 0x5a0 0x000 0x4 0x0
1061#define MX6SL_PAD_UART1_RXD__GPIO3_IO16 0x298 0x5a0 0x000 0x5 0x0
1062#define MX6SL_PAD_UART1_TXD__UART1_TX_DATA 0x29c 0x5a4 0x000 0x0 0x0
1063#define MX6SL_PAD_UART1_TXD__UART1_RX_DATA 0x29c 0x5a4 0x7fc 0x0 0x1
1064#define MX6SL_PAD_UART1_TXD__PWM2_OUT 0x29c 0x5a4 0x000 0x1 0x0
1065#define MX6SL_PAD_UART1_TXD__UART4_TX_DATA 0x29c 0x5a4 0x000 0x2 0x0
1066#define MX6SL_PAD_UART1_TXD__UART4_RX_DATA 0x29c 0x5a4 0x814 0x2 0x7
1067#define MX6SL_PAD_UART1_TXD__FEC_RX_CLK 0x29c 0x5a4 0x700 0x3 0x2
1068#define MX6SL_PAD_UART1_TXD__UART5_TX_DATA 0x29c 0x5a4 0x000 0x4 0x0
1069#define MX6SL_PAD_UART1_TXD__UART5_RX_DATA 0x29c 0x5a4 0x81c 0x4 0x7
1070#define MX6SL_PAD_UART1_TXD__GPIO3_IO17 0x29c 0x5a4 0x000 0x5 0x0
1071#define MX6SL_PAD_UART1_TXD__UART5_DCD_B 0x29c 0x5a4 0x000 0x7 0x0
1072#define MX6SL_PAD_WDOG_B__WDOG1_B 0x2a0 0x5a8 0x000 0x0 0x0
1073#define MX6SL_PAD_WDOG_B__WDOG1_RESET_B_DEB 0x2a0 0x5a8 0x000 0x1 0x0
1074#define MX6SL_PAD_WDOG_B__UART5_RI_B 0x2a0 0x5a8 0x000 0x2 0x0
1075#define MX6SL_PAD_WDOG_B__GPIO3_IO18 0x2a0 0x5a8 0x000 0x5 0x0
1076
1077#endif /* __DTS_IMX6SL_PINFUNC_H */
diff --git a/arch/arm/boot/dts/include/dt-bindings b/arch/arm/boot/dts/include/dt-bindings
new file mode 120000
index 000000000000..08c00e4972fa
--- /dev/null
+++ b/arch/arm/boot/dts/include/dt-bindings
@@ -0,0 +1 @@
../../../../../include/dt-bindings \ No newline at end of file
diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi
index 192cf76fbf93..23991e45bc55 100644
--- a/arch/arm/boot/dts/kirkwood-6282.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6282.dtsi
@@ -49,6 +49,12 @@
49 }; 49 };
50 }; 50 };
51 51
52 thermal@10078 {
53 compatible = "marvell,kirkwood-thermal";
54 reg = <0x10078 0x4>;
55 status = "okay";
56 };
57
52 i2c@11100 { 58 i2c@11100 {
53 compatible = "marvell,mv64xxx-i2c"; 59 compatible = "marvell,mv64xxx-i2c";
54 reg = <0x11100 0x20>; 60 reg = <0x11100 0x20>;
diff --git a/arch/arm/boot/dts/kirkwood-cloudbox.dts b/arch/arm/boot/dts/kirkwood-cloudbox.dts
new file mode 100644
index 000000000000..5f21d4e427b0
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
@@ -0,0 +1,89 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
5
6/ {
7 model = "LaCie CloudBox";
8 compatible = "lacie,cloudbox", "marvell,kirkwood-88f6702", "marvell,kirkwood";
9
10 memory {
11 device_type = "memory";
12 reg = <0x00000000 0x10000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyS0,115200n8";
17 };
18
19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21 pinctrl-0 = < &pmx_spi &pmx_uart0
22 &pmx_cloudbox_sata0 >;
23 pinctrl-names = "default";
24
25 pmx_cloudbox_sata0: pmx-cloudbox-sata0 {
26 marvell,pins = "mpp15";
27 marvell,function = "sata0";
28 };
29 };
30
31 serial@12000 {
32 clock-frequency = <166666667>;
33 status = "okay";
34 };
35
36 sata@80000 {
37 status = "okay";
38 nr-ports = <1>;
39 };
40
41 spi@10600 {
42 status = "okay";
43
44 flash@0 {
45 #address-cells = <1>;
46 #size-cells = <1>;
47 compatible = "mx25l4005a";
48 reg = <0>;
49 spi-max-frequency = <20000000>;
50 mode = <0>;
51
52 partition@0 {
53 reg = <0x0 0x80000>;
54 label = "u-boot";
55 };
56 };
57 };
58 };
59
60 gpio_keys {
61 compatible = "gpio-keys";
62 #address-cells = <1>;
63 #size-cells = <0>;
64
65 button@1 {
66 label = "Power push button";
67 linux,code = <116>;
68 gpios = <&gpio0 16 1>;
69 };
70 };
71
72 gpio-leds {
73 compatible = "gpio-leds";
74
75 red-fail {
76 label = "cloudbox:red:fail";
77 gpios = <&gpio0 14 0>;
78 };
79 blue-sata {
80 label = "cloudbox:blue:sata";
81 gpios = <&gpio0 15 0>;
82 };
83 };
84
85 gpio_poweroff {
86 compatible = "gpio-poweroff";
87 gpios = <&gpio0 17 0>;
88 };
89};
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
index 9555a86297c2..44fd97dfc1f3 100644
--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
@@ -69,6 +69,10 @@
69 status = "okay"; 69 status = "okay";
70 nr-ports = <1>; 70 nr-ports = <1>;
71 }; 71 };
72
73 mvsdio@90000 {
74 status = "okay";
75 };
72 }; 76 };
73 77
74 gpio-leds { 78 gpio-leds {
diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
new file mode 100644
index 000000000000..1ca66ab83ad6
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
@@ -0,0 +1,180 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6282.dtsi"
5
6/ {
7 model = "NETGEAR ReadyNAS Duo v2";
8 compatible = "netgear,readynas-duo-v2", "netgear,readynas", "marvell,kirkwood-88f6282", "marvell,kirkwood";
9
10 memory { /* 256 MB */
11 device_type = "memory";
12 reg = <0x00000000 0x10000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyS0,115200n8 earlyprintk";
17 };
18
19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_uart0
23 &pmx_button_power
24 &pmx_button_backup
25 &pmx_button_reset
26 &pmx_led_blue_power
27 &pmx_led_blue_activity
28 &pmx_led_blue_disk1
29 &pmx_led_blue_disk2
30 &pmx_led_blue_backup >;
31 pinctrl-names = "default";
32
33 pmx_button_power: pmx-button-power {
34 marvell,pins = "mpp47";
35 marvell,function = "gpio";
36 };
37 pmx_button_backup: pmx-button-backup {
38 marvell,pins = "mpp45";
39 marvell,function = "gpio";
40 };
41 pmx_button_reset: pmx-button-reset {
42 marvell,pins = "mpp13";
43 marvell,function = "gpio";
44 };
45 pmx_led_blue_power: pmx-led-blue-power {
46 marvell,pins = "mpp31";
47 marvell,function = "gpio";
48 };
49 pmx_led_blue_activity: pmx-led-blue-activity {
50 marvell,pins = "mpp38";
51 marvell,function = "gpio";
52 };
53 pmx_led_blue_disk1: pmx-led-blue-disk1 {
54 marvell,pins = "mpp23";
55 marvell,function = "gpio";
56 };
57 pmx_led_blue_disk2: pmx-led-blue-disk2 {
58 marvell,pins = "mpp22";
59 marvell,function = "gpio";
60 };
61 pmx_led_blue_backup: pmx-led-blue-backup {
62 marvell,pins = "mpp29";
63 marvell,function = "gpio";
64 };
65 };
66
67 i2c@11000 {
68 status = "okay";
69
70 rs5c372a: rs5c372a@32 {
71 compatible = "ricoh,rs5c372a";
72 reg = <0x32>;
73 };
74 };
75
76 serial@12000 {
77 status = "okay";
78 };
79
80 nand@3000000 {
81 status = "okay";
82
83 partition@0 {
84 label = "u-boot";
85 reg = <0x0000000 0x180000>;
86 read-only;
87 };
88
89 partition@180000 {
90 label = "u-boot-env";
91 reg = <0x180000 0x20000>;
92 };
93
94 partition@200000 {
95 label = "uImage";
96 reg = <0x0200000 0x600000>;
97 };
98
99 partition@800000 {
100 label = "minirootfs";
101 reg = <0x0800000 0x1000000>;
102 };
103
104 partition@1800000 {
105 label = "jffs2";
106 reg = <0x1800000 0x6800000>;
107 };
108 };
109
110 sata@80000 {
111 status = "okay";
112 nr-ports = <2>;
113 };
114 };
115
116 gpio-leds {
117 compatible = "gpio-leds";
118
119 power_led {
120 label = "status:blue:power_led";
121 gpios = <&gpio0 31 1>; /* GPIO 31 Active Low */
122 linux,default-trigger = "default-on";
123 };
124 activity_led {
125 label = "status:blue:activity_led";
126 gpios = <&gpio1 6 1>; /* GPIO 38 Active Low */
127 };
128 disk1_led {
129 label = "status:blue:disk1_led";
130 gpios = <&gpio0 23 1>; /* GPIO 23 Active Low */
131 };
132 disk2_led {
133 label = "status:blue:disk2_led";
134 gpios = <&gpio0 22 1>; /* GPIO 22 Active Low */
135 };
136 backup_led {
137 label = "status:blue:backup_led";
138 gpios = <&gpio0 29 1>; /* GPIO 29 Active Low*/
139 };
140 };
141
142 gpio_keys {
143 compatible = "gpio-keys";
144 #address-cells = <1>;
145 #size-cells = <0>;
146 button@1 {
147 label = "Power Button";
148 linux,code = <116>; /* KEY_POWER */
149 gpios = <&gpio1 15 1>;
150 };
151 button@2 {
152 label = "Reset Button";
153 linux,code = <0x198>; /* KEY_RESTART */
154 gpios = <&gpio0 13 1>;
155 };
156 button@3 {
157 label = "Backup Button";
158 linux,code = <133>; /* KEY_COPY */
159 gpios = <&gpio1 13 1>;
160 };
161 };
162
163 regulators {
164 compatible = "simple-bus";
165 #address-cells = <1>;
166 #size-cells = <0>;
167
168 usb_power: regulator@1 {
169 compatible = "regulator-fixed";
170 reg = <1>;
171 regulator-name = "USB 3.0 Power";
172 regulator-min-microvolt = <5000000>;
173 regulator-max-microvolt = <5000000>;
174 enable-active-high;
175 regulator-always-on;
176 regulator-boot-on;
177 gpio = <&gpio1 14 0>;
178 };
179 };
180};
diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
index b79f5eb25589..adab1ab25733 100644
--- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
@@ -3,6 +3,7 @@
3/include/ "kirkwood-ns2-common.dtsi" 3/include/ "kirkwood-ns2-common.dtsi"
4 4
5/ { 5/ {
6 /* This machine is embedded in the first LaCie CloudBox product. */
6 model = "LaCie Network Space Mini v2"; 7 model = "LaCie Network Space Mini v2";
7 compatible = "lacie,netspace_mini_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood"; 8 compatible = "lacie,netspace_mini_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
8 9
diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi
index 1429ac05b36d..4e8b08c628c7 100644
--- a/arch/arm/boot/dts/mmp2.dtsi
+++ b/arch/arm/boot/dts/mmp2.dtsi
@@ -160,7 +160,7 @@
160 }; 160 };
161 161
162 gpio@d4019000 { 162 gpio@d4019000 {
163 compatible = "mrvl,mmp-gpio"; 163 compatible = "marvell,mmp2-gpio";
164 #address-cells = <1>; 164 #address-cells = <1>;
165 #size-cells = <1>; 165 #size-cells = <1>;
166 reg = <0xd4019000 0x1000>; 166 reg = <0xd4019000 0x1000>;
diff --git a/arch/arm/boot/dts/mpa1600.dts b/arch/arm/boot/dts/mpa1600.dts
new file mode 100644
index 000000000000..317300875f34
--- /dev/null
+++ b/arch/arm/boot/dts/mpa1600.dts
@@ -0,0 +1,69 @@
1/*
2 * mpa1600.dts - Device Tree file for Phontech MPA 1600
3 *
4 * Copyright (C) 2013 Joachim Eastwood <manabian@gmail.com>
5 *
6 * Licensed under GPLv2 only
7 */
8/dts-v1/;
9/include/ "at91rm9200.dtsi"
10
11/ {
12 model = "Phontech MPA 1600";
13 compatible = "phontech,mpa1600", "atmel,at91rm9200";
14
15 memory {
16 reg = <0x20000000 0x4000000>;
17 };
18
19 clocks {
20 #address-cells = <1>;
21 #size-cells = <1>;
22 ranges;
23
24 main_clock: clock@0 {
25 compatible = "atmel,osc", "fixed-clock";
26 clock-frequency = <18432000>;
27 };
28 };
29
30 ahb {
31 apb {
32 dbgu: serial@fffff200 {
33 status = "okay";
34 };
35
36 macb0: ethernet@fffbc000 {
37 phy-mode = "rmii";
38 status = "okay";
39 };
40
41 ssc0: ssc@fffd0000 {
42 status = "okay";
43 };
44
45 ssc1: ssc@fffd4000 {
46 status = "okay";
47 };
48 };
49
50 usb0: ohci@00300000 {
51 num-ports = <1>;
52 status = "okay";
53 };
54 };
55
56 i2c@0 {
57 status = "okay";
58 };
59
60 gpio_keys {
61 compatible = "gpio-keys";
62
63 monitor_mute {
64 label = "Monitor mute";
65 gpios = <&pioC 1 1>;
66 linux,code = <113>;
67 };
68 };
69};
diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/msm8660-surf.dts
index 31f2157cd7d7..9bf49b3826ea 100644
--- a/arch/arm/boot/dts/msm8660-surf.dts
+++ b/arch/arm/boot/dts/msm8660-surf.dts
@@ -16,19 +16,13 @@
16 }; 16 };
17 17
18 timer@2000004 { 18 timer@2000004 {
19 compatible = "qcom,msm-gpt", "qcom,msm-timer"; 19 compatible = "qcom,scss-timer", "qcom,msm-timer";
20 interrupts = <1 1 0x301>; 20 interrupts = <1 0 0x301>,
21 reg = <0x02000004 0x10>; 21 <1 1 0x301>,
22 clock-frequency = <32768>; 22 <1 2 0x301>;
23 cpu-offset = <0x40000>; 23 reg = <0x02000000 0x100>;
24 }; 24 clock-frequency = <27000000>,
25 25 <32768>;
26 timer@2000024 {
27 compatible = "qcom,msm-dgt", "qcom,msm-timer";
28 interrupts = <1 0 0x301>;
29 reg = <0x02000024 0x10>,
30 <0x02000034 0x4>;
31 clock-frequency = <6750000>;
32 cpu-offset = <0x40000>; 26 cpu-offset = <0x40000>;
33 }; 27 };
34 28
@@ -38,4 +32,10 @@
38 <0x19c00000 0x1000>; 32 <0x19c00000 0x1000>;
39 interrupts = <0 195 0x0>; 33 interrupts = <0 195 0x0>;
40 }; 34 };
35
36 qcom,ssbi@500000 {
37 compatible = "qcom,ssbi";
38 reg = <0x500000 0x1000>;
39 qcom,controller-type = "pmic-arbiter";
40 };
41}; 41};
diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/msm8960-cdp.dts
index 9e621b5ad3dd..2e4d87a125d6 100644
--- a/arch/arm/boot/dts/msm8960-cdp.dts
+++ b/arch/arm/boot/dts/msm8960-cdp.dts
@@ -15,20 +15,14 @@
15 < 0x02002000 0x1000 >; 15 < 0x02002000 0x1000 >;
16 }; 16 };
17 17
18 timer@200a004 { 18 timer@200a000 {
19 compatible = "qcom,msm-gpt", "qcom,msm-timer"; 19 compatible = "qcom,kpss-timer", "qcom,msm-timer";
20 interrupts = <1 2 0x301>; 20 interrupts = <1 1 0x301>,
21 reg = <0x0200a004 0x10>; 21 <1 2 0x301>,
22 clock-frequency = <32768>; 22 <1 3 0x301>;
23 cpu-offset = <0x80000>; 23 reg = <0x0200a000 0x100>;
24 }; 24 clock-frequency = <27000000>,
25 25 <32768>;
26 timer@200a024 {
27 compatible = "qcom,msm-dgt", "qcom,msm-timer";
28 interrupts = <1 1 0x301>;
29 reg = <0x0200a024 0x10>,
30 <0x0200a034 0x4>;
31 clock-frequency = <6750000>;
32 cpu-offset = <0x80000>; 26 cpu-offset = <0x80000>;
33 }; 27 };
34 28
@@ -38,4 +32,10 @@
38 <0x16400000 0x1000>; 32 <0x16400000 0x1000>;
39 interrupts = <0 154 0x0>; 33 interrupts = <0 154 0x0>;
40 }; 34 };
35
36 qcom,ssbi@500000 {
37 compatible = "qcom,ssbi";
38 reg = <0x500000 0x1000>;
39 qcom,controller-type = "pmic-arbiter";
40 };
41}; 41};
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index f624dc85d441..02d23f15fd86 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -38,6 +38,57 @@
38 }; 38 };
39 }; 39 };
40 40
41 /* HS USB Port 2 RESET */
42 hsusb2_reset: hsusb2_reset_reg {
43 compatible = "regulator-fixed";
44 regulator-name = "hsusb2_reset";
45 regulator-min-microvolt = <3300000>;
46 regulator-max-microvolt = <3300000>;
47 gpio = <&gpio5 19 0>; /* gpio_147 */
48 startup-delay-us = <70000>;
49 enable-active-high;
50 };
51
52 /* HS USB Port 2 Power */
53 hsusb2_power: hsusb2_power_reg {
54 compatible = "regulator-fixed";
55 regulator-name = "hsusb2_vbus";
56 regulator-min-microvolt = <3300000>;
57 regulator-max-microvolt = <3300000>;
58 gpio = <&twl_gpio 18 0>; /* GPIO LEDA */
59 startup-delay-us = <70000>;
60 };
61
62 /* HS USB Host PHY on PORT 2 */
63 hsusb2_phy: hsusb2_phy {
64 compatible = "usb-nop-xceiv";
65 reset-supply = <&hsusb2_reset>;
66 vcc-supply = <&hsusb2_power>;
67 };
68};
69
70&omap3_pmx_core {
71 pinctrl-names = "default";
72 pinctrl-0 = <
73 &hsusbb2_pins
74 >;
75
76 hsusbb2_pins: pinmux_hsusbb2_pins {
77 pinctrl-single,pins = <
78 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */
79 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */
80 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */
81 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */
82 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */
83 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */
84 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */
85 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */
86 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */
87 0x1aa 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */
88 0x1ac 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */
89 0x1ae 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */
90 >;
91 };
41}; 92};
42 93
43&i2c1 { 94&i2c1 {
@@ -65,3 +116,23 @@
65&mmc3 { 116&mmc3 {
66 status = "disabled"; 117 status = "disabled";
67}; 118};
119
120&usbhshost {
121 port2-mode = "ehci-phy";
122};
123
124&usbhsehci {
125 phys = <0 &hsusb2_phy>;
126};
127
128&twl_gpio {
129 ti,use-leds;
130 /* pullups: BIT(1) */
131 ti,pullups = <0x000002>;
132 /*
133 * pulldowns:
134 * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
135 * BIT(15), BIT(16), BIT(17)
136 */
137 ti,pulldowns = <0x03a1c4>;
138};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 1acc26148ffc..a14f74bbce7c 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -397,5 +397,36 @@
397 ti,timer-alwon; 397 ti,timer-alwon;
398 ti,timer-secure; 398 ti,timer-secure;
399 }; 399 };
400
401 usbhstll: usbhstll@48062000 {
402 compatible = "ti,usbhs-tll";
403 reg = <0x48062000 0x1000>;
404 interrupts = <78>;
405 ti,hwmods = "usb_tll_hs";
406 };
407
408 usbhshost: usbhshost@48064000 {
409 compatible = "ti,usbhs-host";
410 reg = <0x48064000 0x400>;
411 ti,hwmods = "usb_host_hs";
412 #address-cells = <1>;
413 #size-cells = <1>;
414 ranges;
415
416 usbhsohci: ohci@48064400 {
417 compatible = "ti,ohci-omap3", "usb-ohci";
418 reg = <0x48064400 0x400>;
419 interrupt-parent = <&intc>;
420 interrupts = <76>;
421 };
422
423 usbhsehci: ehci@48064800 {
424 compatible = "ti,ehci-omap", "usb-ehci";
425 reg = <0x48064800 0x400>;
426 interrupt-parent = <&intc>;
427 interrupts = <77>;
428 };
429 };
430
400 }; 431 };
401}; 432};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 739bb79e410e..b7db1a2b6ca7 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -529,5 +529,35 @@
529 ti,hwmods = "timer11"; 529 ti,hwmods = "timer11";
530 ti,timer-pwm; 530 ti,timer-pwm;
531 }; 531 };
532
533 usbhstll: usbhstll@4a062000 {
534 compatible = "ti,usbhs-tll";
535 reg = <0x4a062000 0x1000>;
536 interrupts = <0 78 0x4>;
537 ti,hwmods = "usb_tll_hs";
538 };
539
540 usbhshost: usbhshost@4a064000 {
541 compatible = "ti,usbhs-host";
542 reg = <0x4a064000 0x800>;
543 ti,hwmods = "usb_host_hs";
544 #address-cells = <1>;
545 #size-cells = <1>;
546 ranges;
547
548 usbhsohci: ohci@4a064800 {
549 compatible = "ti,ohci-omap3", "usb-ohci";
550 reg = <0x4a064800 0x400>;
551 interrupt-parent = <&gic>;
552 interrupts = <0 76 0x4>;
553 };
554
555 usbhsehci: ehci@4a064c00 {
556 compatible = "ti,ehci-omap", "usb-ehci";
557 reg = <0x4a064c00 0x400>;
558 interrupt-parent = <&gic>;
559 interrupts = <0 77 0x4>;
560 };
561 };
532 }; 562 };
533}; 563};
diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi
index f7bec3b1ba32..892c64e3f1e1 100644
--- a/arch/arm/boot/dts/orion5x.dtsi
+++ b/arch/arm/boot/dts/orion5x.dtsi
@@ -74,6 +74,20 @@
74 status = "okay"; 74 status = "okay";
75 }; 75 };
76 76
77 ehci@50000 {
78 compatible = "marvell,orion-ehci";
79 reg = <0x50000 0x1000>;
80 interrupts = <17>;
81 status = "disabled";
82 };
83
84 ehci@a0000 {
85 compatible = "marvell,orion-ehci";
86 reg = <0xa0000 0x1000>;
87 interrupts = <12>;
88 status = "disabled";
89 };
90
77 sata@80000 { 91 sata@80000 {
78 compatible = "marvell,orion-sata"; 92 compatible = "marvell,orion-sata";
79 reg = <0x80000 0x5000>; 93 reg = <0x80000 0x5000>;
@@ -91,6 +105,25 @@
91 status = "disabled"; 105 status = "disabled";
92 }; 106 };
93 107
108 xor@60900 {
109 compatible = "marvell,orion-xor";
110 reg = <0x60900 0x100
111 0x60b00 0x100>;
112 status = "okay";
113
114 xor00 {
115 interrupts = <30>;
116 dmacap,memcpy;
117 dmacap,xor;
118 };
119 xor01 {
120 interrupts = <31>;
121 dmacap,memcpy;
122 dmacap,xor;
123 dmacap,memset;
124 };
125 };
126
94 crypto@90000 { 127 crypto@90000 {
95 compatible = "marvell,orion-crypto"; 128 compatible = "marvell,orion-crypto";
96 reg = <0x90000 0x10000>, 129 reg = <0x90000 0x10000>,
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
index 31a718696080..975dad21ac38 100644
--- a/arch/arm/boot/dts/pxa168.dtsi
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -77,7 +77,7 @@
77 }; 77 };
78 78
79 gpio@d4019000 { 79 gpio@d4019000 {
80 compatible = "mrvl,mmp-gpio"; 80 compatible = "marvell,mmp-gpio";
81 #address-cells = <1>; 81 #address-cells = <1>;
82 #size-cells = <1>; 82 #size-cells = <1>;
83 reg = <0xd4019000 0x1000>; 83 reg = <0xd4019000 0x1000>;
diff --git a/arch/arm/boot/dts/pxa910.dtsi b/arch/arm/boot/dts/pxa910.dtsi
index 825aaca33034..0247c622f580 100644
--- a/arch/arm/boot/dts/pxa910.dtsi
+++ b/arch/arm/boot/dts/pxa910.dtsi
@@ -89,7 +89,7 @@
89 }; 89 };
90 90
91 gpio@d4019000 { 91 gpio@d4019000 {
92 compatible = "mrvl,mmp-gpio"; 92 compatible = "marvell,mmp-gpio";
93 #address-cells = <1>; 93 #address-cells = <1>;
94 #size-cells = <1>; 94 #size-cells = <1>;
95 reg = <0xd4019000 0x1000>; 95 reg = <0xd4019000 0x1000>;
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
new file mode 100644
index 000000000000..72be4c87cfb5
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -0,0 +1,47 @@
1/*
2 * Reference Device Tree Source for the Marzen board
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/dts-v1/;
13/include/ "r8a7779.dtsi"
14
15/ {
16 model = "marzen";
17 compatible = "renesas,marzen-reference", "renesas,r8a7779";
18
19 chosen {
20 bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on";
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0x60000000 0x40000000>;
26 };
27
28 fixedregulator3v3: fixedregulator@0 {
29 compatible = "regulator-fixed";
30 regulator-name = "fixed-3.3V";
31 regulator-min-microvolt = <3300000>;
32 regulator-max-microvolt = <3300000>;
33 regulator-boot-on;
34 regulator-always-on;
35 };
36
37 lan0@18000000 {
38 compatible = "smsc,lan9220", "smsc,lan9115";
39 reg = <0x18000000 0x100>;
40 phy-mode = "mii";
41 interrupt-parent = <&gic>;
42 interrupts = <0 28 0x4>;
43 reg-io-width = <4>;
44 vddvario-supply = <&fixedregulator3v3>;
45 vdd33a-supply = <&fixedregulator3v3>;
46 };
47};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
new file mode 100644
index 000000000000..fe5c6f213271
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -0,0 +1,98 @@
1/*
2 * Device Tree Source for Renesas r8a7779
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12/include/ "skeleton.dtsi"
13
14/ {
15 compatible = "renesas,r8a7779";
16
17 cpus {
18 #address-cells = <1>;
19 #size-cells = <0>;
20
21 cpu@0 {
22 device_type = "cpu";
23 compatible = "arm,cortex-a9";
24 reg = <0>;
25 };
26 cpu@1 {
27 device_type = "cpu";
28 compatible = "arm,cortex-a9";
29 reg = <1>;
30 };
31 cpu@2 {
32 device_type = "cpu";
33 compatible = "arm,cortex-a9";
34 reg = <2>;
35 };
36 cpu@3 {
37 device_type = "cpu";
38 compatible = "arm,cortex-a9";
39 reg = <3>;
40 };
41 };
42
43 gic: interrupt-controller@f0001000 {
44 compatible = "arm,cortex-a9-gic";
45 #interrupt-cells = <3>;
46 interrupt-controller;
47 reg = <0xf0001000 0x1000>,
48 <0xf0000100 0x100>;
49 };
50
51 i2c0: i2c@0xffc70000 {
52 #address-cells = <1>;
53 #size-cells = <0>;
54 compatible = "renesas,rmobile-iic";
55 reg = <0xffc70000 0x1000>;
56 interrupt-parent = <&gic>;
57 interrupts = <0 79 0x4>;
58 };
59
60 i2c1: i2c@0xffc71000 {
61 #address-cells = <1>;
62 #size-cells = <0>;
63 compatible = "renesas,rmobile-iic";
64 reg = <0xffc71000 0x1000>;
65 interrupt-parent = <&gic>;
66 interrupts = <0 82 0x4>;
67 };
68
69 i2c2: i2c@0xffc72000 {
70 #address-cells = <1>;
71 #size-cells = <0>;
72 compatible = "renesas,rmobile-iic";
73 reg = <0xffc72000 0x1000>;
74 interrupt-parent = <&gic>;
75 interrupts = <0 80 0x4>;
76 };
77
78 i2c3: i2c@0xffc73000 {
79 #address-cells = <1>;
80 #size-cells = <0>;
81 compatible = "renesas,rmobile-iic";
82 reg = <0xffc73000 0x1000>;
83 interrupt-parent = <&gic>;
84 interrupts = <0 81 0x4>;
85 };
86
87 thermal@ffc48000 {
88 compatible = "renesas,rcar-thermal";
89 reg = <0xffc48000 0x38>;
90 };
91
92 sata: sata@fc600000 {
93 compatible = "renesas,rcar-sata";
94 reg = <0xfc600000 0x2000>;
95 interrupt-parent = <&gic>;
96 interrupts = <0 100 0x4>;
97 };
98};
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
new file mode 100644
index 000000000000..39b0458d365a
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -0,0 +1,1031 @@
1/*
2 * sama5d3.dtsi - Device Tree Include file for SAMA5D3 family SoC
3 * applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35 SoC
4 *
5 * Copyright (C) 2013 Atmel,
6 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11/include/ "skeleton.dtsi"
12
13/ {
14 model = "Atmel SAMA5D3 family SoC";
15 compatible = "atmel,sama5d3", "atmel,sama5";
16 interrupt-parent = <&aic>;
17
18 aliases {
19 serial0 = &dbgu;
20 serial1 = &usart0;
21 serial2 = &usart1;
22 serial3 = &usart2;
23 serial4 = &usart3;
24 gpio0 = &pioA;
25 gpio1 = &pioB;
26 gpio2 = &pioC;
27 gpio3 = &pioD;
28 gpio4 = &pioE;
29 tcb0 = &tcb0;
30 tcb1 = &tcb1;
31 i2c0 = &i2c0;
32 i2c1 = &i2c1;
33 i2c2 = &i2c2;
34 ssc0 = &ssc0;
35 ssc1 = &ssc1;
36 };
37 cpus {
38 cpu@0 {
39 compatible = "arm,cortex-a5";
40 };
41 };
42
43 memory {
44 reg = <0x20000000 0x8000000>;
45 };
46
47 ahb {
48 compatible = "simple-bus";
49 #address-cells = <1>;
50 #size-cells = <1>;
51 ranges;
52
53 apb {
54 compatible = "simple-bus";
55 #address-cells = <1>;
56 #size-cells = <1>;
57 ranges;
58
59 mmc0: mmc@f0000000 {
60 compatible = "atmel,hsmci";
61 reg = <0xf0000000 0x600>;
62 interrupts = <21 4 0>;
63 pinctrl-names = "default";
64 pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7>;
65 status = "disabled";
66 #address-cells = <1>;
67 #size-cells = <0>;
68 };
69
70 spi0: spi@f0004000 {
71 #address-cells = <1>;
72 #size-cells = <0>;
73 compatible = "atmel,at91sam9x5-spi";
74 reg = <0xf0004000 0x100>;
75 interrupts = <24 4 3>;
76 cs-gpios = <&pioD 13 0
77 &pioD 14 0 /* conflicts with SCK0 and CANRX0 */
78 &pioD 15 0 /* conflicts with CTS0 and CANTX0 */
79 &pioD 16 0 /* conflicts with RTS0 and PWMFI3 */
80 >;
81 pinctrl-names = "default";
82 pinctrl-0 = <&pinctrl_spi0>;
83 status = "disabled";
84 };
85
86 ssc0: ssc@f0008000 {
87 compatible = "atmel,at91sam9g45-ssc";
88 reg = <0xf0008000 0x4000>;
89 interrupts = <38 4 4>;
90 pinctrl-names = "default";
91 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
92 status = "disabled";
93 };
94
95 can0: can@f000c000 {
96 compatible = "atmel,at91sam9x5-can";
97 reg = <0xf000c000 0x300>;
98 interrupts = <40 4 3>;
99 pinctrl-names = "default";
100 pinctrl-0 = <&pinctrl_can0_rx_tx>;
101 status = "disabled";
102 };
103
104 tcb0: timer@f0010000 {
105 compatible = "atmel,at91sam9x5-tcb";
106 reg = <0xf0010000 0x100>;
107 interrupts = <26 4 0>;
108 };
109
110 i2c0: i2c@f0014000 {
111 compatible = "atmel,at91sam9x5-i2c";
112 reg = <0xf0014000 0x4000>;
113 interrupts = <18 4 6>;
114 pinctrl-names = "default";
115 pinctrl-0 = <&pinctrl_i2c0>;
116 #address-cells = <1>;
117 #size-cells = <0>;
118 status = "disabled";
119 };
120
121 i2c1: i2c@f0018000 {
122 compatible = "atmel,at91sam9x5-i2c";
123 reg = <0xf0018000 0x4000>;
124 interrupts = <19 4 6>;
125 pinctrl-names = "default";
126 pinctrl-0 = <&pinctrl_i2c1>;
127 #address-cells = <1>;
128 #size-cells = <0>;
129 status = "disabled";
130 };
131
132 usart0: serial@f001c000 {
133 compatible = "atmel,at91sam9260-usart";
134 reg = <0xf001c000 0x100>;
135 interrupts = <12 4 5>;
136 pinctrl-names = "default";
137 pinctrl-0 = <&pinctrl_usart0>;
138 status = "disabled";
139 };
140
141 usart1: serial@f0020000 {
142 compatible = "atmel,at91sam9260-usart";
143 reg = <0xf0020000 0x100>;
144 interrupts = <13 4 5>;
145 pinctrl-names = "default";
146 pinctrl-0 = <&pinctrl_usart1>;
147 status = "disabled";
148 };
149
150 macb0: ethernet@f0028000 {
151 compatible = "cnds,pc302-gem", "cdns,gem";
152 reg = <0xf0028000 0x100>;
153 interrupts = <34 4 3>;
154 pinctrl-names = "default";
155 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>;
156 status = "disabled";
157 };
158
159 isi: isi@f0034000 {
160 compatible = "atmel,at91sam9g45-isi";
161 reg = <0xf0034000 0x4000>;
162 interrupts = <37 4 5>;
163 status = "disabled";
164 };
165
166 mmc1: mmc@f8000000 {
167 compatible = "atmel,hsmci";
168 reg = <0xf8000000 0x600>;
169 interrupts = <22 4 0>;
170 pinctrl-names = "default";
171 pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>;
172 status = "disabled";
173 #address-cells = <1>;
174 #size-cells = <0>;
175 };
176
177 mmc2: mmc@f8004000 {
178 compatible = "atmel,hsmci";
179 reg = <0xf8004000 0x600>;
180 interrupts = <23 4 0>;
181 pinctrl-names = "default";
182 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>;
183 status = "disabled";
184 #address-cells = <1>;
185 #size-cells = <0>;
186 };
187
188 spi1: spi@f8008000 {
189 #address-cells = <1>;
190 #size-cells = <0>;
191 compatible = "atmel,at91sam9x5-spi";
192 reg = <0xf8008000 0x100>;
193 interrupts = <25 4 3>;
194 cs-gpios = <&pioC 25 0
195 &pioC 26 0 /* conflitcs with TWD1 and ISI_D11 */
196 &pioC 27 0 /* conflitcs with TWCK1 and ISI_D10 */
197 &pioC 28 0 /* conflitcs with PWMFI0 and ISI_D9 */
198 >;
199 pinctrl-names = "default";
200 pinctrl-0 = <&pinctrl_spi1>;
201 status = "disabled";
202 };
203
204 ssc1: ssc@f800c000 {
205 compatible = "atmel,at91sam9g45-ssc";
206 reg = <0xf800c000 0x4000>;
207 interrupts = <39 4 4>;
208 pinctrl-names = "default";
209 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
210 status = "disabled";
211 };
212
213 can1: can@f8010000 {
214 compatible = "atmel,at91sam9x5-can";
215 reg = <0xf8010000 0x300>;
216 interrupts = <41 4 3>;
217 pinctrl-names = "default";
218 pinctrl-0 = <&pinctrl_can1_rx_tx>;
219 };
220
221 tcb1: timer@f8014000 {
222 compatible = "atmel,at91sam9x5-tcb";
223 reg = <0xf8014000 0x100>;
224 interrupts = <27 4 0>;
225 };
226
227 adc0: adc@f8018000 {
228 compatible = "atmel,at91sam9260-adc";
229 reg = <0xf8018000 0x100>;
230 interrupts = <29 4 5>;
231 pinctrl-names = "default";
232 pinctrl-0 = <
233 &pinctrl_adc0_adtrg
234 &pinctrl_adc0_ad0
235 &pinctrl_adc0_ad1
236 &pinctrl_adc0_ad2
237 &pinctrl_adc0_ad3
238 &pinctrl_adc0_ad4
239 &pinctrl_adc0_ad5
240 &pinctrl_adc0_ad6
241 &pinctrl_adc0_ad7
242 &pinctrl_adc0_ad8
243 &pinctrl_adc0_ad9
244 &pinctrl_adc0_ad10
245 &pinctrl_adc0_ad11
246 >;
247 atmel,adc-channel-base = <0x50>;
248 atmel,adc-channels-used = <0xfff>;
249 atmel,adc-drdy-mask = <0x1000000>;
250 atmel,adc-num-channels = <12>;
251 atmel,adc-startup-time = <40>;
252 atmel,adc-status-register = <0x30>;
253 atmel,adc-trigger-register = <0xc0>;
254 atmel,adc-use-external;
255 atmel,adc-vref = <3000>;
256 atmel,adc-res = <10 12>;
257 atmel,adc-res-names = "lowres", "highres";
258 status = "disabled";
259
260 trigger@0 {
261 trigger-name = "external-rising";
262 trigger-value = <0x1>;
263 trigger-external;
264 };
265 trigger@1 {
266 trigger-name = "external-falling";
267 trigger-value = <0x2>;
268 trigger-external;
269 };
270 trigger@2 {
271 trigger-name = "external-any";
272 trigger-value = <0x3>;
273 trigger-external;
274 };
275 trigger@3 {
276 trigger-name = "continuous";
277 trigger-value = <0x6>;
278 };
279 };
280
281 tsadcc: tsadcc@f8018000 {
282 compatible = "atmel,at91sam9x5-tsadcc";
283 reg = <0xf8018000 0x4000>;
284 interrupts = <29 4 5>;
285 atmel,tsadcc_clock = <300000>;
286 atmel,filtering_average = <0x03>;
287 atmel,pendet_debounce = <0x08>;
288 atmel,pendet_sensitivity = <0x02>;
289 atmel,ts_sample_hold_time = <0x0a>;
290 status = "disabled";
291 };
292
293 i2c2: i2c@f801c000 {
294 compatible = "atmel,at91sam9x5-i2c";
295 reg = <0xf801c000 0x4000>;
296 interrupts = <20 4 6>;
297 #address-cells = <1>;
298 #size-cells = <0>;
299 status = "disabled";
300 };
301
302 usart2: serial@f8020000 {
303 compatible = "atmel,at91sam9260-usart";
304 reg = <0xf8020000 0x100>;
305 interrupts = <14 4 5>;
306 pinctrl-names = "default";
307 pinctrl-0 = <&pinctrl_usart2>;
308 status = "disabled";
309 };
310
311 usart3: serial@f8024000 {
312 compatible = "atmel,at91sam9260-usart";
313 reg = <0xf8024000 0x100>;
314 interrupts = <15 4 5>;
315 pinctrl-names = "default";
316 pinctrl-0 = <&pinctrl_usart3>;
317 status = "disabled";
318 };
319
320 macb1: ethernet@f802c000 {
321 compatible = "cdns,at32ap7000-macb", "cdns,macb";
322 reg = <0xf802c000 0x100>;
323 interrupts = <35 4 3>;
324 pinctrl-names = "default";
325 pinctrl-0 = <&pinctrl_macb1_rmii>;
326 status = "disabled";
327 };
328
329 sha@f8034000 {
330 compatible = "atmel,sam9g46-sha";
331 reg = <0xf8034000 0x100>;
332 interrupts = <42 4 0>;
333 };
334
335 aes@f8038000 {
336 compatible = "atmel,sam9g46-aes";
337 reg = <0xf8038000 0x100>;
338 interrupts = <43 4 0>;
339 };
340
341 tdes@f803c000 {
342 compatible = "atmel,sam9g46-tdes";
343 reg = <0xf803c000 0x100>;
344 interrupts = <44 4 0>;
345 };
346
347 dma0: dma-controller@ffffe600 {
348 compatible = "atmel,at91sam9g45-dma";
349 reg = <0xffffe600 0x200>;
350 interrupts = <30 4 0>;
351 #dma-cells = <1>;
352 };
353
354 dma1: dma-controller@ffffe800 {
355 compatible = "atmel,at91sam9g45-dma";
356 reg = <0xffffe800 0x200>;
357 interrupts = <31 4 0>;
358 #dma-cells = <1>;
359 };
360
361 ramc0: ramc@ffffea00 {
362 compatible = "atmel,at91sam9g45-ddramc";
363 reg = <0xffffea00 0x200>;
364 };
365
366 dbgu: serial@ffffee00 {
367 compatible = "atmel,at91sam9260-usart";
368 reg = <0xffffee00 0x200>;
369 interrupts = <2 4 7>;
370 pinctrl-names = "default";
371 pinctrl-0 = <&pinctrl_dbgu>;
372 status = "disabled";
373 };
374
375 aic: interrupt-controller@fffff000 {
376 #interrupt-cells = <3>;
377 compatible = "atmel,sama5d3-aic";
378 interrupt-controller;
379 reg = <0xfffff000 0x200>;
380 atmel,external-irqs = <47>;
381 };
382
383 pinctrl@fffff200 {
384 #address-cells = <1>;
385 #size-cells = <1>;
386 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
387 ranges = <0xfffff200 0xfffff200 0xa00>;
388 atmel,mux-mask = <
389 /* A B C */
390 0xffffffff 0xc0fc0000 0xc0ff0000 /* pioA */
391 0xffffffff 0x0ff8ffff 0x00000000 /* pioB */
392 0xffffffff 0xbc00f1ff 0x7c00fc00 /* pioC */
393 0xffffffff 0xc001c0e0 0x0001c1e0 /* pioD */
394 0xffffffff 0xbf9f8000 0x18000000 /* pioE */
395 >;
396
397 /* shared pinctrl settings */
398 adc0 {
399 pinctrl_adc0_adtrg: adc0_adtrg {
400 atmel,pins =
401 <3 19 0x1 0x0>; /* PD19 periph A ADTRG */
402 };
403 pinctrl_adc0_ad0: adc0_ad0 {
404 atmel,pins =
405 <3 20 0x1 0x0>; /* PD20 periph A AD0 */
406 };
407 pinctrl_adc0_ad1: adc0_ad1 {
408 atmel,pins =
409 <3 21 0x1 0x0>; /* PD21 periph A AD1 */
410 };
411 pinctrl_adc0_ad2: adc0_ad2 {
412 atmel,pins =
413 <3 22 0x1 0x0>; /* PD22 periph A AD2 */
414 };
415 pinctrl_adc0_ad3: adc0_ad3 {
416 atmel,pins =
417 <3 23 0x1 0x0>; /* PD23 periph A AD3 */
418 };
419 pinctrl_adc0_ad4: adc0_ad4 {
420 atmel,pins =
421 <3 24 0x1 0x0>; /* PD24 periph A AD4 */
422 };
423 pinctrl_adc0_ad5: adc0_ad5 {
424 atmel,pins =
425 <3 25 0x1 0x0>; /* PD25 periph A AD5 */
426 };
427 pinctrl_adc0_ad6: adc0_ad6 {
428 atmel,pins =
429 <3 26 0x1 0x0>; /* PD26 periph A AD6 */
430 };
431 pinctrl_adc0_ad7: adc0_ad7 {
432 atmel,pins =
433 <3 27 0x1 0x0>; /* PD27 periph A AD7 */
434 };
435 pinctrl_adc0_ad8: adc0_ad8 {
436 atmel,pins =
437 <3 28 0x1 0x0>; /* PD28 periph A AD8 */
438 };
439 pinctrl_adc0_ad9: adc0_ad9 {
440 atmel,pins =
441 <3 29 0x1 0x0>; /* PD29 periph A AD9 */
442 };
443 pinctrl_adc0_ad10: adc0_ad10 {
444 atmel,pins =
445 <3 30 0x1 0x0>; /* PD30 periph A AD10, conflicts with PCK0 */
446 };
447 pinctrl_adc0_ad11: adc0_ad11 {
448 atmel,pins =
449 <3 31 0x1 0x0>; /* PD31 periph A AD11, conflicts with PCK1 */
450 };
451 };
452
453 can0 {
454 pinctrl_can0_rx_tx: can0_rx_tx {
455 atmel,pins =
456 <3 14 0x3 0x0 /* PD14 periph C RX, conflicts with SCK0, SPI0_NPCS1 */
457 3 15 0x3 0x0>; /* PD15 periph C TX, conflicts with CTS0, SPI0_NPCS2 */
458 };
459 };
460
461 can1 {
462 pinctrl_can1_rx_tx: can1_rx_tx {
463 atmel,pins =
464 <1 14 0x2 0x0 /* PB14 periph B RX, conflicts with GCRS */
465 1 15 0x2 0x0>; /* PB15 periph B TX, conflicts with GCOL */
466 };
467 };
468
469 dbgu {
470 pinctrl_dbgu: dbgu-0 {
471 atmel,pins =
472 <1 30 0x1 0x0 /* PB30 periph A */
473 1 31 0x1 0x1>; /* PB31 periph A with pullup */
474 };
475 };
476
477 i2c0 {
478 pinctrl_i2c0: i2c0-0 {
479 atmel,pins =
480 <0 30 0x1 0x0 /* PA30 periph A TWD0 pin, conflicts with URXD1, ISI_VSYNC */
481 0 31 0x1 0x0>; /* PA31 periph A TWCK0 pin, conflicts with UTXD1, ISI_HSYNC */
482 };
483 };
484
485 i2c1 {
486 pinctrl_i2c1: i2c1-0 {
487 atmel,pins =
488 <2 26 0x2 0x0 /* PC26 periph B TWD1 pin, conflicts with SPI1_NPCS1, ISI_D11 */
489 2 27 0x2 0x0>; /* PC27 periph B TWCK1 pin, conflicts with SPI1_NPCS2, ISI_D10 */
490 };
491 };
492
493 isi {
494 pinctrl_isi: isi-0 {
495 atmel,pins =
496 <0 16 0x3 0x0 /* PA16 periph C ISI_D0, conflicts with LCDDAT16 */
497 0 17 0x3 0x0 /* PA17 periph C ISI_D1, conflicts with LCDDAT17 */
498 0 18 0x3 0x0 /* PA18 periph C ISI_D2, conflicts with LCDDAT18, TWD2 */
499 0 19 0x3 0x0 /* PA19 periph C ISI_D3, conflicts with LCDDAT19, TWCK2 */
500 0 20 0x3 0x0 /* PA20 periph C ISI_D4, conflicts with LCDDAT20, PWMH0 */
501 0 21 0x3 0x0 /* PA21 periph C ISI_D5, conflicts with LCDDAT21, PWML0 */
502 0 22 0x3 0x0 /* PA22 periph C ISI_D6, conflicts with LCDDAT22, PWMH1 */
503 0 23 0x3 0x0 /* PA23 periph C ISI_D7, conflicts with LCDDAT23, PWML1 */
504 2 30 0x3 0x0 /* PC30 periph C ISI_PCK, conflicts with UTXD0 */
505 0 31 0x3 0x0 /* PA31 periph C ISI_HSYNC, conflicts with TWCK0, UTXD1 */
506 0 30 0x3 0x0 /* PA30 periph C ISI_VSYNC, conflicts with TWD0, URXD1 */
507 2 29 0x3 0x0 /* PC29 periph C ISI_PD8, conflicts with URXD0, PWMFI2 */
508 2 28 0x3 0x0>; /* PC28 periph C ISI_PD9, conflicts with SPI1_NPCS3, PWMFI0 */
509 };
510 pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 {
511 atmel,pins =
512 <3 31 0x2 0x0>; /* PD31 periph B ISI_MCK */
513 };
514 };
515
516 lcd {
517 pinctrl_lcd: lcd-0 {
518 atmel,pins =
519 <0 24 0x1 0x0 /* PA24 periph A LCDPWM */
520 0 26 0x1 0x0 /* PA26 periph A LCDVSYNC */
521 0 27 0x1 0x0 /* PA27 periph A LCDHSYNC */
522 0 25 0x1 0x0 /* PA25 periph A LCDDISP */
523 0 29 0x1 0x0 /* PA29 periph A LCDDEN */
524 0 28 0x1 0x0 /* PA28 periph A LCDPCK */
525 0 0 0x1 0x0 /* PA0 periph A LCDD0 pin */
526 0 1 0x1 0x0 /* PA1 periph A LCDD1 pin */
527 0 2 0x1 0x0 /* PA2 periph A LCDD2 pin */
528 0 3 0x1 0x0 /* PA3 periph A LCDD3 pin */
529 0 4 0x1 0x0 /* PA4 periph A LCDD4 pin */
530 0 5 0x1 0x0 /* PA5 periph A LCDD5 pin */
531 0 6 0x1 0x0 /* PA6 periph A LCDD6 pin */
532 0 7 0x1 0x0 /* PA7 periph A LCDD7 pin */
533 0 8 0x1 0x0 /* PA8 periph A LCDD8 pin */
534 0 9 0x1 0x0 /* PA9 periph A LCDD9 pin */
535 0 10 0x1 0x0 /* PA10 periph A LCDD10 pin */
536 0 11 0x1 0x0 /* PA11 periph A LCDD11 pin */
537 0 12 0x1 0x0 /* PA12 periph A LCDD12 pin */
538 0 13 0x1 0x0 /* PA13 periph A LCDD13 pin */
539 0 14 0x1 0x0 /* PA14 periph A LCDD14 pin */
540 0 15 0x1 0x0 /* PA15 periph A LCDD15 pin */
541 2 14 0x3 0x0 /* PC14 periph C LCDD16 pin */
542 2 13 0x3 0x0 /* PC13 periph C LCDD17 pin */
543 2 12 0x3 0x0 /* PC12 periph C LCDD18 pin */
544 2 11 0x3 0x0 /* PC11 periph C LCDD19 pin */
545 2 10 0x3 0x0 /* PC10 periph C LCDD20 pin */
546 2 15 0x3 0x0 /* PC15 periph C LCDD21 pin */
547 4 27 0x3 0x0 /* PE27 periph C LCDD22 pin */
548 4 28 0x3 0x0>; /* PE28 periph C LCDD23 pin */
549 };
550 };
551
552 macb0 {
553 pinctrl_macb0_data_rgmii: macb0_data_rgmii {
554 atmel,pins =
555 <1 0 0x1 0x0 /* PB0 periph A GTX0, conflicts with PWMH0 */
556 1 1 0x1 0x0 /* PB1 periph A GTX1, conflicts with PWML0 */
557 1 2 0x1 0x0 /* PB2 periph A GTX2, conflicts with TK1 */
558 1 3 0x1 0x0 /* PB3 periph A GTX3, conflicts with TF1 */
559 1 4 0x1 0x0 /* PB4 periph A GRX0, conflicts with PWMH1 */
560 1 5 0x1 0x0 /* PB5 periph A GRX1, conflicts with PWML1 */
561 1 6 0x1 0x0 /* PB6 periph A GRX2, conflicts with TD1 */
562 1 7 0x1 0x0>; /* PB7 periph A GRX3, conflicts with RK1 */
563 };
564 pinctrl_macb0_data_gmii: macb0_data_gmii {
565 atmel,pins =
566 <1 19 0x2 0x0 /* PB19 periph B GTX4, conflicts with MCI1_CDA */
567 1 20 0x2 0x0 /* PB20 periph B GTX5, conflicts with MCI1_DA0 */
568 1 21 0x2 0x0 /* PB21 periph B GTX6, conflicts with MCI1_DA1 */
569 1 22 0x2 0x0 /* PB22 periph B GTX7, conflicts with MCI1_DA2 */
570 1 23 0x2 0x0 /* PB23 periph B GRX4, conflicts with MCI1_DA3 */
571 1 24 0x2 0x0 /* PB24 periph B GRX5, conflicts with MCI1_CK */
572 1 25 0x2 0x0 /* PB25 periph B GRX6, conflicts with SCK1 */
573 1 26 0x2 0x0>; /* PB26 periph B GRX7, conflicts with CTS1 */
574 };
575 pinctrl_macb0_signal_rgmii: macb0_signal_rgmii {
576 atmel,pins =
577 <1 8 0x1 0x0 /* PB8 periph A GTXCK, conflicts with PWMH2 */
578 1 9 0x1 0x0 /* PB9 periph A GTXEN, conflicts with PWML2 */
579 1 11 0x1 0x0 /* PB11 periph A GRXCK, conflicts with RD1 */
580 1 13 0x1 0x0 /* PB13 periph A GRXER, conflicts with PWML3 */
581 1 16 0x1 0x0 /* PB16 periph A GMDC */
582 1 17 0x1 0x0 /* PB17 periph A GMDIO */
583 1 18 0x1 0x0>; /* PB18 periph A G125CK */
584 };
585 pinctrl_macb0_signal_gmii: macb0_signal_gmii {
586 atmel,pins =
587 <1 9 0x1 0x0 /* PB9 periph A GTXEN, conflicts with PWML2 */
588 1 10 0x1 0x0 /* PB10 periph A GTXER, conflicts with RF1 */
589 1 11 0x1 0x0 /* PB11 periph A GRXCK, conflicts with RD1 */
590 1 12 0x1 0x0 /* PB12 periph A GRXDV, conflicts with PWMH3 */
591 1 13 0x1 0x0 /* PB13 periph A GRXER, conflicts with PWML3 */
592 1 14 0x1 0x0 /* PB14 periph A GCRS, conflicts with CANRX1 */
593 1 15 0x1 0x0 /* PB15 periph A GCOL, conflicts with CANTX1 */
594 1 16 0x1 0x0 /* PB16 periph A GMDC */
595 1 17 0x1 0x0 /* PB17 periph A GMDIO */
596 1 27 0x2 0x0>; /* PB27 periph B G125CKO */
597 };
598
599 };
600
601 macb1 {
602 pinctrl_macb1_rmii: macb1_rmii-0 {
603 atmel,pins =
604 <2 0 0x1 0x0 /* PC0 periph A ETX0, conflicts with TIOA3 */
605 2 1 0x1 0x0 /* PC1 periph A ETX1, conflicts with TIOB3 */
606 2 2 0x1 0x0 /* PC2 periph A ERX0, conflicts with TCLK3 */
607 2 3 0x1 0x0 /* PC3 periph A ERX1, conflicts with TIOA4 */
608 2 4 0x1 0x0 /* PC4 periph A ETXEN, conflicts with TIOB4 */
609 2 5 0x1 0x0 /* PC5 periph A ECRSDV,conflicts with TCLK4 */
610 2 6 0x1 0x0 /* PC6 periph A ERXER, conflicts with TIOA5 */
611 2 7 0x1 0x0 /* PC7 periph A EREFCK, conflicts with TIOB5 */
612 2 8 0x1 0x0 /* PC8 periph A EMDC, conflicts with TCLK5 */
613 2 9 0x1 0x0>; /* PC9 periph A EMDIO */
614 };
615 };
616
617 mmc0 {
618 pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 {
619 atmel,pins =
620 <3 9 0x1 0x0 /* PD9 periph A MCI0_CK */
621 3 0 0x1 0x1 /* PD0 periph A MCI0_CDA with pullup */
622 3 1 0x1 0x1>; /* PD1 periph A MCI0_DA0 with pullup */
623 };
624 pinctrl_mmc0_dat1_3: mmc0_dat1_3 {
625 atmel,pins =
626 <3 2 0x1 0x1 /* PD2 periph A MCI0_DA1 with pullup */
627 3 3 0x1 0x1 /* PD3 periph A MCI0_DA2 with pullup */
628 3 4 0x1 0x1>; /* PD4 periph A MCI0_DA3 with pullup */
629 };
630 pinctrl_mmc0_dat4_7: mmc0_dat4_7 {
631 atmel,pins =
632 <3 5 0x1 0x1 /* PD5 periph A MCI0_DA4 with pullup, conflicts with TIOA0, PWMH2 */
633 3 6 0x1 0x1 /* PD6 periph A MCI0_DA5 with pullup, conflicts with TIOB0, PWML2 */
634 3 7 0x1 0x1 /* PD7 periph A MCI0_DA6 with pullup, conlicts with TCLK0, PWMH3 */
635 3 8 0x1 0x1>; /* PD8 periph A MCI0_DA7 with pullup, conflicts with PWML3 */
636 };
637 };
638
639 mmc1 {
640 pinctrl_mmc1_clk_cmd_dat0: mmc1_clk_cmd_dat0 {
641 atmel,pins =
642 <1 24 0x1 0x0 /* PB24 periph A MCI1_CK, conflicts with GRX5 */
643 1 19 0x1 0x1 /* PB19 periph A MCI1_CDA with pullup, conflicts with GTX4 */
644 1 20 0x1 0x1>; /* PB20 periph A MCI1_DA0 with pullup, conflicts with GTX5 */
645 };
646 pinctrl_mmc1_dat1_3: mmc1_dat1_3 {
647 atmel,pins =
648 <1 21 0x1 0x1 /* PB21 periph A MCI1_DA1 with pullup, conflicts with GTX6 */
649 1 22 0x1 0x1 /* PB22 periph A MCI1_DA2 with pullup, conflicts with GTX7 */
650 1 23 0x1 0x1>; /* PB23 periph A MCI1_DA3 with pullup, conflicts with GRX4 */
651 };
652 };
653
654 mmc2 {
655 pinctrl_mmc2_clk_cmd_dat0: mmc2_clk_cmd_dat0 {
656 atmel,pins =
657 <2 15 0x1 0x0 /* PC15 periph A MCI2_CK, conflicts with PCK2 */
658 2 10 0x1 0x1 /* PC10 periph A MCI2_CDA with pullup */
659 2 11 0x1 0x1>; /* PC11 periph A MCI2_DA0 with pullup */
660 };
661 pinctrl_mmc2_dat1_3: mmc2_dat1_3 {
662 atmel,pins =
663 <2 12 0x1 0x0 /* PC12 periph A MCI2_DA1 with pullup, conflicts with TIOA1 */
664 2 13 0x1 0x0 /* PC13 periph A MCI2_DA2 with pullup, conflicts with TIOB1 */
665 2 14 0x1 0x0>; /* PC14 periph A MCI2_DA3 with pullup, conflicts with TCLK1 */
666 };
667 };
668
669 nand0 {
670 pinctrl_nand0_ale_cle: nand0_ale_cle-0 {
671 atmel,pins =
672 <4 21 0x1 0x1 /* PE21 periph A with pullup */
673 4 22 0x1 0x1>; /* PE22 periph A with pullup */
674 };
675 };
676
677 pioA: gpio@fffff200 {
678 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
679 reg = <0xfffff200 0x100>;
680 interrupts = <6 4 1>;
681 #gpio-cells = <2>;
682 gpio-controller;
683 interrupt-controller;
684 #interrupt-cells = <2>;
685 };
686
687 pioB: gpio@fffff400 {
688 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
689 reg = <0xfffff400 0x100>;
690 interrupts = <7 4 1>;
691 #gpio-cells = <2>;
692 gpio-controller;
693 interrupt-controller;
694 #interrupt-cells = <2>;
695 };
696
697 pioC: gpio@fffff600 {
698 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
699 reg = <0xfffff600 0x100>;
700 interrupts = <8 4 1>;
701 #gpio-cells = <2>;
702 gpio-controller;
703 interrupt-controller;
704 #interrupt-cells = <2>;
705 };
706
707 pioD: gpio@fffff800 {
708 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
709 reg = <0xfffff800 0x100>;
710 interrupts = <9 4 1>;
711 #gpio-cells = <2>;
712 gpio-controller;
713 interrupt-controller;
714 #interrupt-cells = <2>;
715 };
716
717 pioE: gpio@fffffa00 {
718 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
719 reg = <0xfffffa00 0x100>;
720 interrupts = <10 4 1>;
721 #gpio-cells = <2>;
722 gpio-controller;
723 interrupt-controller;
724 #interrupt-cells = <2>;
725 };
726
727 spi0 {
728 pinctrl_spi0: spi0-0 {
729 atmel,pins =
730 <3 10 0x1 0x0 /* PD10 periph A SPI0_MISO pin */
731 3 11 0x1 0x0 /* PD11 periph A SPI0_MOSI pin */
732 3 12 0x1 0x0 /* PD12 periph A SPI0_SPCK pin */
733 3 13 0x0 0x0>; /* PD13 GPIO SPI0_NPCS0 pin */
734 };
735 };
736
737 spi1 {
738 pinctrl_spi1: spi1-0 {
739 atmel,pins =
740 <2 22 0x1 0x0 /* PC22 periph A SPI1_MISO pin */
741 2 23 0x1 0x0 /* PC23 periph A SPI1_MOSI pin */
742 2 24 0x1 0x0 /* PC24 periph A SPI1_SPCK pin */
743 2 25 0x0 0x0>; /* PC25 GPIO SPI1_NPCS0 pin */
744 };
745 };
746
747 ssc0 {
748 pinctrl_ssc0_tx: ssc0_tx {
749 atmel,pins =
750 <2 16 0x1 0x0 /* PC16 periph A TK0 */
751 2 17 0x1 0x0 /* PC17 periph A TF0 */
752 2 18 0x1 0x0>; /* PC18 periph A TD0 */
753 };
754
755 pinctrl_ssc0_rx: ssc0_rx {
756 atmel,pins =
757 <2 19 0x1 0x0 /* PC19 periph A RK0 */
758 2 20 0x1 0x0 /* PC20 periph A RF0 */
759 2 21 0x1 0x0>; /* PC21 periph A RD0 */
760 };
761 };
762
763 ssc1 {
764 pinctrl_ssc1_tx: ssc1_tx {
765 atmel,pins =
766 <1 2 0x2 0x0 /* PB2 periph B TK1, conflicts with GTX2 */
767 1 3 0x2 0x0 /* PB3 periph B TF1, conflicts with GTX3 */
768 1 6 0x2 0x0>; /* PB6 periph B TD1, conflicts with TD1 */
769 };
770
771 pinctrl_ssc1_rx: ssc1_rx {
772 atmel,pins =
773 <1 7 0x2 0x0 /* PB7 periph B RK1, conflicts with EREFCK */
774 1 10 0x2 0x0 /* PB10 periph B RF1, conflicts with GTXER */
775 1 11 0x2 0x0>; /* PB11 periph B RD1, conflicts with GRXCK */
776 };
777 };
778
779 uart0 {
780 pinctrl_uart0: uart0-0 {
781 atmel,pins =
782 <2 29 0x1 0x0 /* PC29 periph A, conflicts with PWMFI2, ISI_D8 */
783 2 30 0x1 0x1>; /* PC30 periph A with pullup, conflicts with ISI_PCK */
784 };
785 };
786
787 uart1 {
788 pinctrl_uart1: uart1-0 {
789 atmel,pins =
790 <0 30 0x2 0x0 /* PA30 periph B, conflicts with TWD0, ISI_VSYNC */
791 0 31 0x2 0x1>; /* PA31 periph B with pullup, conflicts with TWCK0, ISI_HSYNC */
792 };
793 };
794
795 usart0 {
796 pinctrl_usart0: usart0-0 {
797 atmel,pins =
798 <3 17 0x1 0x0 /* PD17 periph A */
799 3 18 0x1 0x1>; /* PD18 periph A with pullup */
800 };
801
802 pinctrl_usart0_rts_cts: usart0_rts_cts-0 {
803 atmel,pins =
804 <3 15 0x1 0x0 /* PD15 periph A, conflicts with SPI0_NPCS2, CANTX0 */
805 3 16 0x1 0x0>; /* PD16 periph A, conflicts with SPI0_NPCS3, PWMFI3 */
806 };
807 };
808
809 usart1 {
810 pinctrl_usart1: usart1-0 {
811 atmel,pins =
812 <1 28 0x1 0x0 /* PB28 periph A */
813 1 29 0x1 0x1>; /* PB29 periph A with pullup */
814 };
815
816 pinctrl_usart1_rts_cts: usart1_rts_cts-0 {
817 atmel,pins =
818 <1 26 0x1 0x0 /* PB26 periph A, conflicts with GRX7 */
819 1 27 0x1 0x0>; /* PB27 periph A, conflicts with G125CKO */
820 };
821 };
822
823 usart2 {
824 pinctrl_usart2: usart2-0 {
825 atmel,pins =
826 <4 25 0x2 0x0 /* PE25 periph B, conflicts with A25 */
827 4 26 0x2 0x1>; /* PE26 periph B with pullup, conflicts NCS0 */
828 };
829
830 pinctrl_usart2_rts_cts: usart2_rts_cts-0 {
831 atmel,pins =
832 <4 23 0x2 0x0 /* PE23 periph B, conflicts with A23 */
833 4 24 0x2 0x0>; /* PE24 periph B, conflicts with A24 */
834 };
835 };
836
837 usart3 {
838 pinctrl_usart3: usart3-0 {
839 atmel,pins =
840 <4 18 0x2 0x0 /* PE18 periph B, conflicts with A18 */
841 4 19 0x2 0x1>; /* PE19 periph B with pullup, conflicts with A19 */
842 };
843
844 pinctrl_usart3_rts_cts: usart3_rts_cts-0 {
845 atmel,pins =
846 <4 16 0x2 0x0 /* PE16 periph B, conflicts with A16 */
847 4 17 0x2 0x0>; /* PE17 periph B, conflicts with A17 */
848 };
849 };
850 };
851
852 pmc: pmc@fffffc00 {
853 compatible = "atmel,at91rm9200-pmc";
854 reg = <0xfffffc00 0x120>;
855 };
856
857 rstc@fffffe00 {
858 compatible = "atmel,at91sam9g45-rstc";
859 reg = <0xfffffe00 0x10>;
860 };
861
862 pit: timer@fffffe30 {
863 compatible = "atmel,at91sam9260-pit";
864 reg = <0xfffffe30 0xf>;
865 interrupts = <3 4 5>;
866 };
867
868 watchdog@fffffe40 {
869 compatible = "atmel,at91sam9260-wdt";
870 reg = <0xfffffe40 0x10>;
871 status = "disabled";
872 };
873
874 rtc@fffffeb0 {
875 compatible = "atmel,at91rm9200-rtc";
876 reg = <0xfffffeb0 0x30>;
877 interrupts = <1 4 7>;
878 };
879 };
880
881 usb0: gadget@00500000 {
882 #address-cells = <1>;
883 #size-cells = <0>;
884 compatible = "atmel,at91sam9rl-udc";
885 reg = <0x00500000 0x100000
886 0xf8030000 0x4000>;
887 interrupts = <33 4 2>;
888 status = "disabled";
889
890 ep0 {
891 reg = <0>;
892 atmel,fifo-size = <64>;
893 atmel,nb-banks = <1>;
894 };
895
896 ep1 {
897 reg = <1>;
898 atmel,fifo-size = <1024>;
899 atmel,nb-banks = <3>;
900 atmel,can-dma;
901 atmel,can-isoc;
902 };
903
904 ep2 {
905 reg = <2>;
906 atmel,fifo-size = <1024>;
907 atmel,nb-banks = <3>;
908 atmel,can-dma;
909 atmel,can-isoc;
910 };
911
912 ep3 {
913 reg = <3>;
914 atmel,fifo-size = <1024>;
915 atmel,nb-banks = <2>;
916 atmel,can-dma;
917 };
918
919 ep4 {
920 reg = <4>;
921 atmel,fifo-size = <1024>;
922 atmel,nb-banks = <2>;
923 atmel,can-dma;
924 };
925
926 ep5 {
927 reg = <5>;
928 atmel,fifo-size = <1024>;
929 atmel,nb-banks = <2>;
930 atmel,can-dma;
931 };
932
933 ep6 {
934 reg = <6>;
935 atmel,fifo-size = <1024>;
936 atmel,nb-banks = <2>;
937 atmel,can-dma;
938 };
939
940 ep7 {
941 reg = <7>;
942 atmel,fifo-size = <1024>;
943 atmel,nb-banks = <2>;
944 atmel,can-dma;
945 };
946
947 ep8 {
948 reg = <8>;
949 atmel,fifo-size = <1024>;
950 atmel,nb-banks = <2>;
951 };
952
953 ep9 {
954 reg = <9>;
955 atmel,fifo-size = <1024>;
956 atmel,nb-banks = <2>;
957 };
958
959 ep10 {
960 reg = <10>;
961 atmel,fifo-size = <1024>;
962 atmel,nb-banks = <2>;
963 };
964
965 ep11 {
966 reg = <11>;
967 atmel,fifo-size = <1024>;
968 atmel,nb-banks = <2>;
969 };
970
971 ep12 {
972 reg = <12>;
973 atmel,fifo-size = <1024>;
974 atmel,nb-banks = <2>;
975 };
976
977 ep13 {
978 reg = <13>;
979 atmel,fifo-size = <1024>;
980 atmel,nb-banks = <2>;
981 };
982
983 ep14 {
984 reg = <14>;
985 atmel,fifo-size = <1024>;
986 atmel,nb-banks = <2>;
987 };
988
989 ep15 {
990 reg = <15>;
991 atmel,fifo-size = <1024>;
992 atmel,nb-banks = <2>;
993 };
994 };
995
996 usb1: ohci@00600000 {
997 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
998 reg = <0x00600000 0x100000>;
999 interrupts = <32 4 2>;
1000 status = "disabled";
1001 };
1002
1003 usb2: ehci@00700000 {
1004 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
1005 reg = <0x00700000 0x100000>;
1006 interrupts = <32 4 2>;
1007 status = "disabled";
1008 };
1009
1010 nand0: nand@60000000 {
1011 compatible = "atmel,at91rm9200-nand";
1012 #address-cells = <1>;
1013 #size-cells = <1>;
1014 reg = < 0x60000000 0x01000000 /* EBI CS3 */
1015 0xffffc070 0x00000490 /* SMC PMECC regs */
1016 0xffffc500 0x00000100 /* SMC PMECC Error Location regs */
1017 0x00100000 0x00100000 /* ROM code */
1018 0x70000000 0x10000000 /* NFC Command Registers */
1019 0xffffc000 0x00000070 /* NFC HSMC regs */
1020 0x00200000 0x00100000 /* NFC SRAM banks */
1021 >;
1022 interrupts = <5 4 6>;
1023 atmel,nand-addr-offset = <21>;
1024 atmel,nand-cmd-offset = <22>;
1025 pinctrl-names = "default";
1026 pinctrl-0 = <&pinctrl_nand0_ale_cle>;
1027 atmel,pmecc-lookup-table-offset = <0x10000 0x18000>;
1028 status = "disabled";
1029 };
1030 };
1031};
diff --git a/arch/arm/boot/dts/sama5d31ek.dts b/arch/arm/boot/dts/sama5d31ek.dts
new file mode 100644
index 000000000000..fa5d216f1db7
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d31ek.dts
@@ -0,0 +1,51 @@
1/*
2 * sama5d31ek.dts - Device Tree file for SAMA5D31-EK board
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "sama5d3xmb.dtsi"
11/include/ "sama5d3xdm.dtsi"
12
13/ {
14 model = "Atmel SAMA5D31-EK";
15 compatible = "atmel,sama5d31ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5";
16
17 ahb {
18 apb {
19 spi0: spi@f0004000 {
20 status = "okay";
21 };
22
23 ssc0: ssc@f0008000 {
24 status = "okay";
25 };
26
27 i2c0: i2c@f0014000 {
28 status = "okay";
29 };
30
31 i2c1: i2c@f0018000 {
32 status = "okay";
33 };
34
35 macb1: ethernet@f802c000 {
36 status = "okay";
37 };
38 };
39 };
40
41 leds {
42 d3 {
43 label = "d3";
44 gpios = <&pioE 24 0>;
45 };
46 };
47
48 sound {
49 status = "okay";
50 };
51};
diff --git a/arch/arm/boot/dts/sama5d33ek.dts b/arch/arm/boot/dts/sama5d33ek.dts
new file mode 100644
index 000000000000..c38c9433d7a5
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d33ek.dts
@@ -0,0 +1,44 @@
1/*
2 * sama5d33ek.dts - Device Tree file for SAMA5D33-EK board
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "sama5d3xmb.dtsi"
11/include/ "sama5d3xdm.dtsi"
12
13/ {
14 model = "Atmel SAMA5D33-EK";
15 compatible = "atmel,sama5d33ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5";
16
17 ahb {
18 apb {
19 spi0: spi@f0004000 {
20 status = "okay";
21 };
22
23 ssc0: ssc@f0008000 {
24 status = "okay";
25 };
26
27 i2c0: i2c@f0014000 {
28 status = "okay";
29 };
30
31 i2c1: i2c@f0018000 {
32 status = "okay";
33 };
34
35 macb0: ethernet@f0028000 {
36 status = "okay";
37 };
38 };
39 };
40
41 sound {
42 status = "okay";
43 };
44};
diff --git a/arch/arm/boot/dts/sama5d34ek.dts b/arch/arm/boot/dts/sama5d34ek.dts
new file mode 100644
index 000000000000..d2739f8d7ae9
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d34ek.dts
@@ -0,0 +1,61 @@
1/*
2 * sama5d34ek.dts - Device Tree file for SAMA5D34-EK board
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "sama5d3xmb.dtsi"
11/include/ "sama5d3xdm.dtsi"
12
13/ {
14 model = "Atmel SAMA5D34-EK";
15 compatible = "atmel,sama5d34ek", "atmel,sama5ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5";
16
17 ahb {
18 apb {
19 spi0: spi@f0004000 {
20 status = "okay";
21 };
22
23 ssc0: ssc@f0008000 {
24 status = "okay";
25 };
26
27 can0: can@f000c000 {
28 status = "okay";
29 };
30
31 i2c0: i2c@f0014000 {
32 status = "okay";
33 };
34
35 i2c1: i2c@f0018000 {
36 status = "okay";
37
38 24c256@50 {
39 compatible = "24c256";
40 reg = <0x50>;
41 pagesize = <64>;
42 };
43 };
44
45 macb0: ethernet@f0028000 {
46 status = "okay";
47 };
48 };
49 };
50
51 leds {
52 d3 {
53 label = "d3";
54 gpios = <&pioE 24 0>;
55 };
56 };
57
58 sound {
59 status = "okay";
60 };
61};
diff --git a/arch/arm/boot/dts/sama5d35ek.dts b/arch/arm/boot/dts/sama5d35ek.dts
new file mode 100644
index 000000000000..a488fc4e9777
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d35ek.dts
@@ -0,0 +1,56 @@
1/*
2 * sama5d35ek.dts - Device Tree file for SAMA5D35-EK board
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "sama5d3xmb.dtsi"
11
12/ {
13 model = "Atmel SAMA5D35-EK";
14 compatible = "atmel,sama5d35ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5";
15
16 ahb {
17 apb {
18 spi0: spi@f0004000 {
19 status = "okay";
20 };
21
22 can0: can@f000c000 {
23 status = "okay";
24 };
25
26 i2c1: i2c@f0018000 {
27 status = "okay";
28 };
29
30 macb0: ethernet@f0028000 {
31 status = "okay";
32 };
33
34 isi: isi@f0034000 {
35 status = "okay";
36 };
37
38 macb1: ethernet@f802c000 {
39 status = "okay";
40 };
41 };
42 };
43
44 gpio_keys {
45 compatible = "gpio-keys";
46 #address-cells = <1>;
47 #size-cells = <0>;
48
49 pb_user1 {
50 label = "pb_user1";
51 gpios = <&pioE 27 0>;
52 linux,code = <0x100>;
53 gpio-key,wakeup;
54 };
55 };
56};
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi
new file mode 100644
index 000000000000..1f8ed404626c
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -0,0 +1,91 @@
1/*
2 * sama5d3xcm.dtsi - Device Tree Include file for SAMA5D3x CPU Module
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/include/ "sama5d3.dtsi"
10
11/ {
12 compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5";
13
14 chosen {
15 bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs";
16 };
17
18 memory {
19 reg = <0x20000000 0x20000000>;
20 };
21
22 clocks {
23 #address-cells = <1>;
24 #size-cells = <1>;
25 ranges;
26
27 main_clock: clock@0 {
28 compatible = "atmel,osc", "fixed-clock";
29 clock-frequency = <12000000>;
30 };
31 };
32
33 ahb {
34 apb {
35 macb0: ethernet@f0028000 {
36 phy-mode = "rgmii";
37 };
38 };
39
40 nand0: nand@60000000 {
41 nand-bus-width = <8>;
42 nand-ecc-mode = "hw";
43 atmel,has-pmecc;
44 atmel,pmecc-cap = <4>;
45 atmel,pmecc-sector-size = <512>;
46 atmel,has-nfc;
47 atmel,use-nfc-sram;
48 nand-on-flash-bbt;
49 status = "okay";
50
51 at91bootstrap@0 {
52 label = "at91bootstrap";
53 reg = <0x0 0x40000>;
54 };
55
56 bootloader@40000 {
57 label = "bootloader";
58 reg = <0x40000 0x80000>;
59 };
60
61 bootloaderenv@c0000 {
62 label = "bootloader env";
63 reg = <0xc0000 0xc0000>;
64 };
65
66 dtb@180000 {
67 label = "device tree";
68 reg = <0x180000 0x80000>;
69 };
70
71 kernel@200000 {
72 label = "kernel";
73 reg = <0x200000 0x600000>;
74 };
75
76 rootfs@800000 {
77 label = "rootfs";
78 reg = <0x800000 0x0f800000>;
79 };
80 };
81 };
82
83 leds {
84 compatible = "gpio-leds";
85
86 d2 {
87 label = "d2";
88 gpios = <&pioE 25 1>; /* PE25, conflicts with A25, RXD2 */
89 };
90 };
91};
diff --git a/arch/arm/boot/dts/sama5d3xdm.dtsi b/arch/arm/boot/dts/sama5d3xdm.dtsi
new file mode 100644
index 000000000000..4b8830eb2060
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3xdm.dtsi
@@ -0,0 +1,42 @@
1/*
2 * sama5d3dm.dtsi - Device Tree file for SAMA5 display module
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10/ {
11 ahb {
12 apb {
13 i2c1: i2c@f0018000 {
14 qt1070: keyboard@1b {
15 compatible = "qt1070";
16 reg = <0x1b>;
17 interrupt-parent = <&pioE>;
18 interrupts = <31 0x0>;
19 pinctrl-names = "default";
20 pinctrl-0 = <&pinctrl_qt1070_irq>;
21 };
22 };
23
24 adc0: adc@f8018000 {
25 status = "disabled";
26 };
27
28 tsadcc: tsadcc@f8018000 {
29 status = "okay";
30 };
31
32 pinctrl@fffff200 {
33 board {
34 pinctrl_qt1070_irq: qt1070_irq {
35 atmel,pins =
36 <4 31 0x0 0x5>; /* PE31 GPIO with pull up deglith */
37 };
38 };
39 };
40 };
41 };
42};
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
new file mode 100644
index 000000000000..661d7ca9c309
--- /dev/null
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -0,0 +1,166 @@
1/*
2 * sama5d3xmb.dts - Device Tree file for SAMA5D3x mother board
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/include/ "sama5d3xcm.dtsi"
10
11/ {
12 compatible = "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5";
13
14 ahb {
15 apb {
16 mmc0: mmc@f0000000 {
17 pinctrl-names = "default";
18 pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>;
19 status = "okay";
20 slot@0 {
21 reg = <0>;
22 bus-width = <4>;
23 cd-gpios = <&pioD 17 0>;
24 };
25 };
26
27 spi0: spi@f0004000 {
28 m25p80@0 {
29 compatible = "atmel,at25df321a";
30 spi-max-frequency = <50000000>;
31 reg = <0>;
32 };
33 };
34
35 /*
36 * i2c0 conflicts with ISI:
37 * disable it to allow the use of ISI
38 * can not enable audio when i2c0 disabled
39 */
40 i2c0: i2c@f0014000 {
41 wm8904: wm8904@1a {
42 compatible = "wm8904";
43 reg = <0x1a>;
44 };
45 };
46
47 usart1: serial@f0020000 {
48 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>;
50 status = "okay";
51 };
52
53 isi: isi@f0034000 {
54 pinctrl-names = "default";
55 pinctrl-0 = <&pinctrl_isi &pinctrl_isi_pck_as_mck &pinctrl_isi_power &pinctrl_isi_reset>;
56 };
57
58 mmc1: mmc@f8000000 {
59 pinctrl-names = "default";
60 pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>;
61 status = "okay";
62 slot@0 {
63 reg = <0>;
64 bus-width = <4>;
65 cd-gpios = <&pioD 18 0>;
66 };
67 };
68
69 adc0: adc@f8018000 {
70 pinctrl-names = "default";
71 pinctrl-0 = <
72 &pinctrl_adc0_adtrg
73 &pinctrl_adc0_ad0
74 &pinctrl_adc0_ad1
75 &pinctrl_adc0_ad2
76 &pinctrl_adc0_ad3
77 &pinctrl_adc0_ad4
78 >;
79 status = "okay";
80 };
81
82 macb1: ethernet@f802c000 {
83 phy-mode = "rmii";
84 };
85
86 pinctrl@fffff200 {
87 board {
88 pinctrl_mmc0_cd: mmc0_cd {
89 atmel,pins =
90 <3 17 0x0 0x5>; /* PD17 GPIO with pullup deglitch */
91 };
92
93 pinctrl_mmc1_cd: mmc1_cd {
94 atmel,pins =
95 <3 18 0x0 0x5>; /* PD18 GPIO with pullup deglitch */
96 };
97
98 pinctrl_pck0_as_audio_mck: pck0_as_audio_mck {
99 atmel,pins =
100 <3 30 0x2 0x0>; /* PD30 periph B */
101 };
102
103 pinctrl_isi_reset: isi_reset-0 {
104 atmel,pins =
105 <4 24 0x0 0x0>; /* PE24 gpio */
106 };
107
108 pinctrl_isi_power: isi_power-0 {
109 atmel,pins =
110 <4 29 0x0 0x0>; /* PE29 gpio */
111 };
112
113 pinctrl_usba_vbus: usba_vbus {
114 atmel,pins =
115 <3 29 0x0 0x4>; /* PD29 GPIO with deglitch */
116 };
117 };
118 };
119
120 dbgu: serial@ffffee00 {
121 status = "okay";
122 };
123
124 watchdog@fffffe40 {
125 status = "okay";
126 };
127 };
128
129 usb0: gadget@00500000 {
130 atmel,vbus-gpio = <&pioD 29 0>;
131 pinctrl-names = "default";
132 pinctrl-0 = <&pinctrl_usba_vbus>;
133 status = "okay";
134 };
135
136 usb1: ohci@00600000 {
137 num-ports = <3>;
138 atmel,vbus-gpio = <&pioD 25 0
139 &pioD 26 1
140 &pioD 27 1
141 >;
142 status = "okay";
143 };
144
145 usb2: ehci@00700000 {
146 status = "okay";
147 };
148 };
149
150 sound {
151 compatible = "atmel,sama5d3ek-wm8904";
152 pinctrl-names = "default";
153 pinctrl-0 = <&pinctrl_pck0_as_audio_mck>;
154
155 atmel,model = "wm8904 @ SAMA5D3EK";
156 atmel,audio-routing =
157 "Headphone Jack", "HPOUTL",
158 "Headphone Jack", "HPOUTR",
159 "IN2L", "Line In Jack",
160 "IN2R", "Line In Jack",
161 "IN1L", "Mic";
162
163 atmel,ssc-controller = <&ssc0>;
164 atmel,audio-codec = <&wm8904>;
165 };
166};
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
new file mode 100644
index 000000000000..f33b5ccb7446
--- /dev/null
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -0,0 +1,66 @@
1/*
2 * Device Tree Source for the KZM-A9-GT board
3 *
4 * Copyright (C) 2012 Horms Solutions Ltd.
5 *
6 * Based on sh73a0-kzm9g.dts
7 * Copyright (C) 2012 Renesas Solutions Corp.
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13
14/dts-v1/;
15/include/ "sh73a0.dtsi"
16
17/ {
18 model = "KZM-A9-GT";
19 compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
20
21 chosen {
22 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0x41000000 0x1e800000>;
28 };
29
30 reg_1p8v: regulator@0 {
31 compatible = "regulator-fixed";
32 regulator-name = "fixed-1.8V";
33 regulator-min-microvolt = <1800000>;
34 regulator-max-microvolt = <1800000>;
35 regulator-always-on;
36 regulator-boot-on;
37 };
38
39 reg_3p3v: regulator@1 {
40 compatible = "regulator-fixed";
41 regulator-name = "fixed-3.3V";
42 regulator-min-microvolt = <3300000>;
43 regulator-max-microvolt = <3300000>;
44 regulator-always-on;
45 regulator-boot-on;
46 };
47};
48
49&mmcif {
50 bus-width = <8>;
51 vmmc-supply = <&reg_1p8v>;
52 status = "okay";
53};
54
55&sdhi0 {
56 vmmc-supply = <&reg_3p3v>;
57 bus-width = <4>;
58 status = "okay";
59};
60
61&sdhi2 {
62 vmmc-supply = <&reg_3p3v>;
63 bus-width = <4>;
64 broken-cd;
65 status = "okay";
66};
diff --git a/arch/arm/boot/dts/sh73a0-reference.dtsi b/arch/arm/boot/dts/sh73a0-reference.dtsi
deleted file mode 100644
index d4bb0125b2b2..000000000000
--- a/arch/arm/boot/dts/sh73a0-reference.dtsi
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Device Tree Source for the SH73A0 SoC
3 *
4 * Copyright (C) 2012 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/include/ "sh73a0.dtsi"
12
13/ {
14 compatible = "renesas,sh73a0";
15
16 mmcif: mmcif@0x10010000 {
17 compatible = "renesas,sh-mmcif";
18 reg = <0xe6bd0000 0x100>;
19 interrupt-parent = <&gic>;
20 interrupts = <0 140 0x4
21 0 141 0x4>;
22 reg-io-width = <4>;
23 };
24};
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index 8a59465d0231..3e4d383ac6d9 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -97,4 +97,48 @@
97 0 189 0x4 97 0 189 0x4
98 0 190 0x4>; 98 0 190 0x4>;
99 }; 99 };
100
101 mmcif: mmcif@0x10010000 {
102 compatible = "renesas,sh-mmcif";
103 reg = <0xe6bd0000 0x100>;
104 interrupt-parent = <&gic>;
105 interrupts = <0 140 0x4
106 0 141 0x4>;
107 reg-io-width = <4>;
108 status = "disabled";
109 };
110
111 sdhi0: sdhi@0xee100000 {
112 compatible = "renesas,r8a7740-sdhi";
113 reg = <0xee100000 0x100>;
114 interrupt-parent = <&gic>;
115 interrupts = <0 83 4
116 0 84 4
117 0 85 4>;
118 cap-sd-highspeed;
119 status = "disabled";
120 };
121
122 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
123 sdhi1: sdhi@0xee120000 {
124 compatible = "renesas,r8a7740-sdhi";
125 reg = <0xee120000 0x100>;
126 interrupt-parent = <&gic>;
127 interrupts = <0 88 4
128 0 89 4>;
129 toshiba,mmc-wrprotect-disable;
130 cap-sd-highspeed;
131 status = "disabled";
132 };
133
134 sdhi2: sdhi@0xee140000 {
135 compatible = "renesas,r8a7740-sdhi";
136 reg = <0xee140000 0x100>;
137 interrupt-parent = <&gic>;
138 interrupts = <0 104 4
139 0 105 4>;
140 toshiba,mmc-wrprotect-disable;
141 cap-sd-highspeed;
142 status = "disabled";
143 };
100}; 144};
diff --git a/arch/arm/boot/dts/skeleton64.dtsi b/arch/arm/boot/dts/skeleton64.dtsi
new file mode 100644
index 000000000000..15994158a998
--- /dev/null
+++ b/arch/arm/boot/dts/skeleton64.dtsi
@@ -0,0 +1,13 @@
1/*
2 * Skeleton device tree in the 64 bits version; the bare minimum
3 * needed to boot; just include and add a compatible value. The
4 * bootloader will typically populate the memory node.
5 */
6
7/ {
8 #address-cells = <2>;
9 #size-cells = <2>;
10 chosen { };
11 aliases { };
12 memory { device_type = "memory"; reg = <0 0>; };
13};
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index d3ec32f6b790..db5db24fd544 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -299,6 +299,10 @@
299 }; 299 };
300 300
301 ab8500 { 301 ab8500 {
302 ab8500-gpio {
303 compatible = "stericsson,ab8500-gpio";
304 };
305
302 ab8500-regulators { 306 ab8500-regulators {
303 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 307 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
304 regulator-name = "V-DISPLAY"; 308 regulator-name = "V-DISPLAY";
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 7e8769bd5977..16a6e13e08b4 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -81,6 +81,163 @@
81 }; 81 };
82 }; 82 };
83 83
84 clkmgr@ffd04000 {
85 compatible = "altr,clk-mgr";
86 reg = <0xffd04000 0x1000>;
87
88 clocks {
89 #address-cells = <1>;
90 #size-cells = <0>;
91
92 osc: osc1 {
93 #clock-cells = <0>;
94 compatible = "fixed-clock";
95 };
96
97 main_pll: main_pll {
98 #address-cells = <1>;
99 #size-cells = <0>;
100 #clock-cells = <0>;
101 compatible = "altr,socfpga-pll-clock";
102 clocks = <&osc>;
103 reg = <0x40>;
104
105 mpuclk: mpuclk {
106 #clock-cells = <0>;
107 compatible = "altr,socfpga-perip-clk";
108 clocks = <&main_pll>;
109 fixed-divider = <2>;
110 reg = <0x48>;
111 };
112
113 mainclk: mainclk {
114 #clock-cells = <0>;
115 compatible = "altr,socfpga-perip-clk";
116 clocks = <&main_pll>;
117 fixed-divider = <4>;
118 reg = <0x4C>;
119 };
120
121 dbg_base_clk: dbg_base_clk {
122 #clock-cells = <0>;
123 compatible = "altr,socfpga-perip-clk";
124 clocks = <&main_pll>;
125 fixed-divider = <4>;
126 reg = <0x50>;
127 };
128
129 main_qspi_clk: main_qspi_clk {
130 #clock-cells = <0>;
131 compatible = "altr,socfpga-perip-clk";
132 clocks = <&main_pll>;
133 reg = <0x54>;
134 };
135
136 main_nand_sdmmc_clk: main_nand_sdmmc_clk {
137 #clock-cells = <0>;
138 compatible = "altr,socfpga-perip-clk";
139 clocks = <&main_pll>;
140 reg = <0x58>;
141 };
142
143 cfg_s2f_usr0_clk: cfg_s2f_usr0_clk {
144 #clock-cells = <0>;
145 compatible = "altr,socfpga-perip-clk";
146 clocks = <&main_pll>;
147 reg = <0x5C>;
148 };
149 };
150
151 periph_pll: periph_pll {
152 #address-cells = <1>;
153 #size-cells = <0>;
154 #clock-cells = <0>;
155 compatible = "altr,socfpga-pll-clock";
156 clocks = <&osc>;
157 reg = <0x80>;
158
159 emac0_clk: emac0_clk {
160 #clock-cells = <0>;
161 compatible = "altr,socfpga-perip-clk";
162 clocks = <&periph_pll>;
163 reg = <0x88>;
164 };
165
166 emac1_clk: emac1_clk {
167 #clock-cells = <0>;
168 compatible = "altr,socfpga-perip-clk";
169 clocks = <&periph_pll>;
170 reg = <0x8C>;
171 };
172
173 per_qspi_clk: per_qsi_clk {
174 #clock-cells = <0>;
175 compatible = "altr,socfpga-perip-clk";
176 clocks = <&periph_pll>;
177 reg = <0x90>;
178 };
179
180 per_nand_mmc_clk: per_nand_mmc_clk {
181 #clock-cells = <0>;
182 compatible = "altr,socfpga-perip-clk";
183 clocks = <&periph_pll>;
184 reg = <0x94>;
185 };
186
187 per_base_clk: per_base_clk {
188 #clock-cells = <0>;
189 compatible = "altr,socfpga-perip-clk";
190 clocks = <&periph_pll>;
191 reg = <0x98>;
192 };
193
194 s2f_usr1_clk: s2f_usr1_clk {
195 #clock-cells = <0>;
196 compatible = "altr,socfpga-perip-clk";
197 clocks = <&periph_pll>;
198 reg = <0x9C>;
199 };
200 };
201
202 sdram_pll: sdram_pll {
203 #address-cells = <1>;
204 #size-cells = <0>;
205 #clock-cells = <0>;
206 compatible = "altr,socfpga-pll-clock";
207 clocks = <&osc>;
208 reg = <0xC0>;
209
210 ddr_dqs_clk: ddr_dqs_clk {
211 #clock-cells = <0>;
212 compatible = "altr,socfpga-perip-clk";
213 clocks = <&sdram_pll>;
214 reg = <0xC8>;
215 };
216
217 ddr_2x_dqs_clk: ddr_2x_dqs_clk {
218 #clock-cells = <0>;
219 compatible = "altr,socfpga-perip-clk";
220 clocks = <&sdram_pll>;
221 reg = <0xCC>;
222 };
223
224 ddr_dq_clk: ddr_dq_clk {
225 #clock-cells = <0>;
226 compatible = "altr,socfpga-perip-clk";
227 clocks = <&sdram_pll>;
228 reg = <0xD0>;
229 };
230
231 s2f_usr2_clk: s2f_usr2_clk {
232 #clock-cells = <0>;
233 compatible = "altr,socfpga-perip-clk";
234 clocks = <&sdram_pll>;
235 reg = <0xD4>;
236 };
237 };
238 };
239 };
240
84 gmac0: stmmac@ff700000 { 241 gmac0: stmmac@ff700000 {
85 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac"; 242 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
86 reg = <0xff700000 0x2000>; 243 reg = <0xff700000 0x2000>;
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dts b/arch/arm/boot/dts/socfpga_cyclone5.dts
index 3ae8a83a0875..2495958f1016 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dts
@@ -33,6 +33,14 @@
33 }; 33 };
34 34
35 soc { 35 soc {
36 clkmgr@ffd04000 {
37 clocks {
38 osc1 {
39 clock-frequency = <25000000>;
40 };
41 };
42 };
43
36 timer0@ffc08000 { 44 timer0@ffc08000 {
37 clock-frequency = <100000000>; 45 clock-frequency = <100000000>;
38 }; 46 };
diff --git a/arch/arm/boot/dts/socfpga_vt.dts b/arch/arm/boot/dts/socfpga_vt.dts
index 1036eba40bbf..0bf035d607f0 100644
--- a/arch/arm/boot/dts/socfpga_vt.dts
+++ b/arch/arm/boot/dts/socfpga_vt.dts
@@ -33,6 +33,14 @@
33 }; 33 };
34 34
35 soc { 35 soc {
36 clkmgr@ffd04000 {
37 clocks {
38 osc1 {
39 clock-frequency = <10000000>;
40 };
41 };
42 };
43
36 timer0@ffc08000 { 44 timer0@ffc08000 {
37 clock-frequency = <7000000>; 45 clock-frequency = <7000000>;
38 }; 46 };
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 1513c1927cc8..122ae94076c8 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -89,7 +89,7 @@
89 pinmux: pinmux@e0700000 { 89 pinmux: pinmux@e0700000 {
90 compatible = "st,spear1310-pinmux"; 90 compatible = "st,spear1310-pinmux";
91 reg = <0xe0700000 0x1000>; 91 reg = <0xe0700000 0x1000>;
92 #gpio-range-cells = <2>; 92 #gpio-range-cells = <3>;
93 }; 93 };
94 94
95 apb { 95 apb {
@@ -212,7 +212,7 @@
212 interrupt-controller; 212 interrupt-controller;
213 gpio-controller; 213 gpio-controller;
214 #gpio-cells = <2>; 214 #gpio-cells = <2>;
215 gpio-ranges = <&pinmux 0 246>; 215 gpio-ranges = <&pinmux 0 0 246>;
216 status = "disabled"; 216 status = "disabled";
217 217
218 st-plgpio,ngpio = <246>; 218 st-plgpio,ngpio = <246>;
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 34da11aa6795..c511c4772efd 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -63,7 +63,7 @@
63 pinmux: pinmux@e0700000 { 63 pinmux: pinmux@e0700000 {
64 compatible = "st,spear1340-pinmux"; 64 compatible = "st,spear1340-pinmux";
65 reg = <0xe0700000 0x1000>; 65 reg = <0xe0700000 0x1000>;
66 #gpio-range-cells = <2>; 66 #gpio-range-cells = <3>;
67 }; 67 };
68 68
69 pwm: pwm@e0180000 { 69 pwm: pwm@e0180000 {
@@ -127,7 +127,7 @@
127 interrupt-controller; 127 interrupt-controller;
128 gpio-controller; 128 gpio-controller;
129 #gpio-cells = <2>; 129 #gpio-cells = <2>;
130 gpio-ranges = <&pinmux 0 252>; 130 gpio-ranges = <&pinmux 0 0 252>;
131 status = "disabled"; 131 status = "disabled";
132 132
133 st-plgpio,ngpio = <250>; 133 st-plgpio,ngpio = <250>;
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index ab45b8c81982..95372080eea6 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -25,7 +25,7 @@
25 pinmux: pinmux@b4000000 { 25 pinmux: pinmux@b4000000 {
26 compatible = "st,spear310-pinmux"; 26 compatible = "st,spear310-pinmux";
27 reg = <0xb4000000 0x1000>; 27 reg = <0xb4000000 0x1000>;
28 #gpio-range-cells = <2>; 28 #gpio-range-cells = <3>;
29 }; 29 };
30 30
31 fsmc: flash@44000000 { 31 fsmc: flash@44000000 {
@@ -102,7 +102,7 @@
102 interrupt-controller; 102 interrupt-controller;
103 gpio-controller; 103 gpio-controller;
104 #gpio-cells = <2>; 104 #gpio-cells = <2>;
105 gpio-ranges = <&pinmux 0 102>; 105 gpio-ranges = <&pinmux 0 0 102>;
106 status = "disabled"; 106 status = "disabled";
107 107
108 st-plgpio,ngpio = <102>; 108 st-plgpio,ngpio = <102>;
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index caa5520b1fd4..ffea342aeec9 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -24,7 +24,7 @@
24 pinmux: pinmux@b3000000 { 24 pinmux: pinmux@b3000000 {
25 compatible = "st,spear320-pinmux"; 25 compatible = "st,spear320-pinmux";
26 reg = <0xb3000000 0x1000>; 26 reg = <0xb3000000 0x1000>;
27 #gpio-range-cells = <2>; 27 #gpio-range-cells = <3>;
28 }; 28 };
29 29
30 clcd@90000000 { 30 clcd@90000000 {
@@ -130,7 +130,7 @@
130 interrupt-controller; 130 interrupt-controller;
131 gpio-controller; 131 gpio-controller;
132 #gpio-cells = <2>; 132 #gpio-cells = <2>;
133 gpio-ranges = <&pinmux 0 102>; 133 gpio-ranges = <&pinmux 0 0 102>;
134 status = "disabled"; 134 status = "disabled";
135 135
136 st-plgpio,ngpio = <102>; 136 st-plgpio,ngpio = <102>;
diff --git a/arch/arm/boot/dts/stuib.dtsi b/arch/arm/boot/dts/stuib.dtsi
index 39446a247e79..615392a75676 100644
--- a/arch/arm/boot/dts/stuib.dtsi
+++ b/arch/arm/boot/dts/stuib.dtsi
@@ -15,7 +15,7 @@
15 stmpe1601: stmpe1601@40 { 15 stmpe1601: stmpe1601@40 {
16 compatible = "st,stmpe1601"; 16 compatible = "st,stmpe1601";
17 reg = <0x40>; 17 reg = <0x40>;
18 interrupts = <26 0x1>; 18 interrupts = <26 0x2>;
19 interrupt-parent = <&gpio6>; 19 interrupt-parent = <&gpio6>;
20 interrupt-controller; 20 interrupt-controller;
21 21
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 5cab82540437..b70fe0db6bb7 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -26,13 +26,37 @@
26 bootargs = "earlyprintk console=ttyS0,115200"; 26 bootargs = "earlyprintk console=ttyS0,115200";
27 }; 27 };
28 28
29 soc { 29 soc@01c20000 {
30 uart0: uart@01c28000 { 30 pinctrl@01c20800 {
31 status = "okay"; 31 led_pins_cubieboard: led_pins@0 {
32 allwinner,pins = "PH20", "PH21";
33 allwinner,function = "gpio_out";
34 allwinner,drive = <1>;
35 allwinner,pull = <0>;
36 };
32 }; 37 };
33 38
34 uart1: uart@01c28400 { 39 uart0: serial@01c28000 {
40 pinctrl-names = "default";
41 pinctrl-0 = <&uart0_pins_a>;
35 status = "okay"; 42 status = "okay";
36 }; 43 };
37 }; 44 };
45
46 leds {
47 compatible = "gpio-leds";
48 pinctrl-names = "default";
49 pinctrl-0 = <&led_pins_cubieboard>;
50
51 blue {
52 label = "cubieboard::blue";
53 gpios = <&pio 7 21 0>; /* LED1 */
54 };
55
56 green {
57 label = "cubieboard::green";
58 gpios = <&pio 7 20 0>; /* LED2 */
59 linux,default-trigger = "heartbeat";
60 };
61 };
38}; 62};
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index f84549ad791e..b9efac100c85 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -22,8 +22,10 @@
22 bootargs = "earlyprintk console=ttyS0,115200"; 22 bootargs = "earlyprintk console=ttyS0,115200";
23 }; 23 };
24 24
25 soc { 25 soc@01c20000 {
26 uart0: uart@01c28000 { 26 uart0: serial@01c28000 {
27 pinctrl-names = "default";
28 pinctrl-0 = <&uart0_pins_a>;
27 status = "okay"; 29 status = "okay";
28 }; 30 };
29 }; 31 };
diff --git a/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
new file mode 100644
index 000000000000..4a7c35d6726a
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-mini-xplus.dts
@@ -0,0 +1,32 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "sun4i-a10.dtsi"
16
17/ {
18 model = "PineRiver Mini X-Plus";
19 compatible = "pineriver,mini-xplus", "allwinner,sun4i-a10";
20
21 chosen {
22 bootargs = "earlyprintk console=ttyS0,115200";
23 };
24
25 soc {
26 uart0: uart@01c28000 {
27 pinctrl-names = "default";
28 pinctrl-0 = <&uart0_pins_a>;
29 status = "okay";
30 };
31 };
32};
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index f99f60dadf5d..e7ef619a70a2 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -10,19 +10,174 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13/include/ "sunxi.dtsi" 13/include/ "skeleton.dtsi"
14 14
15/ { 15/ {
16 interrupt-parent = <&intc>;
17
18 cpus {
19 cpu@0 {
20 compatible = "arm,cortex-a8";
21 };
22 };
23
16 memory { 24 memory {
17 reg = <0x40000000 0x80000000>; 25 reg = <0x40000000 0x80000000>;
18 }; 26 };
19 27
20 soc { 28 clocks {
21 pinctrl@01c20800 { 29 #address-cells = <1>;
30 #size-cells = <1>;
31 ranges;
32
33 /*
34 * This is a dummy clock, to be used as placeholder on
35 * other mux clocks when a specific parent clock is not
36 * yet implemented. It should be dropped when the driver
37 * is complete.
38 */
39 dummy: dummy {
40 #clock-cells = <0>;
41 compatible = "fixed-clock";
42 clock-frequency = <0>;
43 };
44
45 osc24M: osc24M@01c20050 {
46 #clock-cells = <0>;
47 compatible = "allwinner,sun4i-osc-clk";
48 reg = <0x01c20050 0x4>;
49 clock-frequency = <24000000>;
50 };
51
52 osc32k: osc32k {
53 #clock-cells = <0>;
54 compatible = "fixed-clock";
55 clock-frequency = <32768>;
56 };
57
58 pll1: pll1@01c20000 {
59 #clock-cells = <0>;
60 compatible = "allwinner,sun4i-pll1-clk";
61 reg = <0x01c20000 0x4>;
62 clocks = <&osc24M>;
63 };
64
65 /* dummy is 200M */
66 cpu: cpu@01c20054 {
67 #clock-cells = <0>;
68 compatible = "allwinner,sun4i-cpu-clk";
69 reg = <0x01c20054 0x4>;
70 clocks = <&osc32k>, <&osc24M>, <&pll1>, <&dummy>;
71 };
72
73 axi: axi@01c20054 {
74 #clock-cells = <0>;
75 compatible = "allwinner,sun4i-axi-clk";
76 reg = <0x01c20054 0x4>;
77 clocks = <&cpu>;
78 };
79
80 axi_gates: axi_gates@01c2005c {
81 #clock-cells = <1>;
82 compatible = "allwinner,sun4i-axi-gates-clk";
83 reg = <0x01c2005c 0x4>;
84 clocks = <&axi>;
85 clock-output-names = "axi_dram";
86 };
87
88 ahb: ahb@01c20054 {
89 #clock-cells = <0>;
90 compatible = "allwinner,sun4i-ahb-clk";
91 reg = <0x01c20054 0x4>;
92 clocks = <&axi>;
93 };
94
95 ahb_gates: ahb_gates@01c20060 {
96 #clock-cells = <1>;
97 compatible = "allwinner,sun4i-ahb-gates-clk";
98 reg = <0x01c20060 0x8>;
99 clocks = <&ahb>;
100 clock-output-names = "ahb_usb0", "ahb_ehci0",
101 "ahb_ohci0", "ahb_ehci1", "ahb_ohci1", "ahb_ss",
102 "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1",
103 "ahb_mmc2", "ahb_mmc3", "ahb_ms", "ahb_nand",
104 "ahb_sdram", "ahb_ace", "ahb_emac", "ahb_ts",
105 "ahb_spi0", "ahb_spi1", "ahb_spi2", "ahb_spi3",
106 "ahb_pata", "ahb_sata", "ahb_gps", "ahb_ve",
107 "ahb_tvd", "ahb_tve0", "ahb_tve1", "ahb_lcd0",
108 "ahb_lcd1", "ahb_csi0", "ahb_csi1", "ahb_hdmi",
109 "ahb_de_be0", "ahb_de_be1", "ahb_de_fe0",
110 "ahb_de_fe1", "ahb_mp", "ahb_mali400";
111 };
112
113 apb0: apb0@01c20054 {
114 #clock-cells = <0>;
115 compatible = "allwinner,sun4i-apb0-clk";
116 reg = <0x01c20054 0x4>;
117 clocks = <&ahb>;
118 };
119
120 apb0_gates: apb0_gates@01c20068 {
121 #clock-cells = <1>;
122 compatible = "allwinner,sun4i-apb0-gates-clk";
123 reg = <0x01c20068 0x4>;
124 clocks = <&apb0>;
125 clock-output-names = "apb0_codec", "apb0_spdif",
126 "apb0_ac97", "apb0_iis", "apb0_pio", "apb0_ir0",
127 "apb0_ir1", "apb0_keypad";
128 };
129
130 /* dummy is pll62 */
131 apb1_mux: apb1_mux@01c20058 {
132 #clock-cells = <0>;
133 compatible = "allwinner,sun4i-apb1-mux-clk";
134 reg = <0x01c20058 0x4>;
135 clocks = <&osc24M>, <&dummy>, <&osc32k>;
136 };
137
138 apb1: apb1@01c20058 {
139 #clock-cells = <0>;
140 compatible = "allwinner,sun4i-apb1-clk";
141 reg = <0x01c20058 0x4>;
142 clocks = <&apb1_mux>;
143 };
144
145 apb1_gates: apb1_gates@01c2006c {
146 #clock-cells = <1>;
147 compatible = "allwinner,sun4i-apb1-gates-clk";
148 reg = <0x01c2006c 0x4>;
149 clocks = <&apb1>;
150 clock-output-names = "apb1_i2c0", "apb1_i2c1",
151 "apb1_i2c2", "apb1_can", "apb1_scr",
152 "apb1_ps20", "apb1_ps21", "apb1_uart0",
153 "apb1_uart1", "apb1_uart2", "apb1_uart3",
154 "apb1_uart4", "apb1_uart5", "apb1_uart6",
155 "apb1_uart7";
156 };
157 };
158
159 soc@01c20000 {
160 compatible = "simple-bus";
161 #address-cells = <1>;
162 #size-cells = <1>;
163 reg = <0x01c20000 0x300000>;
164 ranges;
165
166 intc: interrupt-controller@01c20400 {
167 compatible = "allwinner,sun4i-ic";
168 reg = <0x01c20400 0x400>;
169 interrupt-controller;
170 #interrupt-cells = <1>;
171 };
172
173 pio: pinctrl@01c20800 {
22 compatible = "allwinner,sun4i-a10-pinctrl"; 174 compatible = "allwinner,sun4i-a10-pinctrl";
23 reg = <0x01c20800 0x400>; 175 reg = <0x01c20800 0x400>;
176 clocks = <&apb0_gates 5>;
177 gpio-controller;
24 #address-cells = <1>; 178 #address-cells = <1>;
25 #size-cells = <0>; 179 #size-cells = <0>;
180 #gpio-cells = <3>;
26 181
27 uart0_pins_a: uart0@0 { 182 uart0_pins_a: uart0@0 {
28 allwinner,pins = "PB22", "PB23"; 183 allwinner,pins = "PB22", "PB23";
@@ -45,5 +200,97 @@
45 allwinner,pull = <0>; 200 allwinner,pull = <0>;
46 }; 201 };
47 }; 202 };
203
204 timer@01c20c00 {
205 compatible = "allwinner,sun4i-timer";
206 reg = <0x01c20c00 0x90>;
207 interrupts = <22>;
208 clocks = <&osc24M>;
209 };
210
211 wdt: watchdog@01c20c90 {
212 compatible = "allwinner,sun4i-wdt";
213 reg = <0x01c20c90 0x10>;
214 };
215
216 uart0: serial@01c28000 {
217 compatible = "snps,dw-apb-uart";
218 reg = <0x01c28000 0x400>;
219 interrupts = <1>;
220 reg-shift = <2>;
221 reg-io-width = <4>;
222 clocks = <&apb1_gates 16>;
223 status = "disabled";
224 };
225
226 uart1: serial@01c28400 {
227 compatible = "snps,dw-apb-uart";
228 reg = <0x01c28400 0x400>;
229 interrupts = <2>;
230 reg-shift = <2>;
231 reg-io-width = <4>;
232 clocks = <&apb1_gates 17>;
233 status = "disabled";
234 };
235
236 uart2: serial@01c28800 {
237 compatible = "snps,dw-apb-uart";
238 reg = <0x01c28800 0x400>;
239 interrupts = <3>;
240 reg-shift = <2>;
241 reg-io-width = <4>;
242 clocks = <&apb1_gates 18>;
243 status = "disabled";
244 };
245
246 uart3: serial@01c28c00 {
247 compatible = "snps,dw-apb-uart";
248 reg = <0x01c28c00 0x400>;
249 interrupts = <4>;
250 reg-shift = <2>;
251 reg-io-width = <4>;
252 clocks = <&apb1_gates 19>;
253 status = "disabled";
254 };
255
256 uart4: serial@01c29000 {
257 compatible = "snps,dw-apb-uart";
258 reg = <0x01c29000 0x400>;
259 interrupts = <17>;
260 reg-shift = <2>;
261 reg-io-width = <4>;
262 clocks = <&apb1_gates 20>;
263 status = "disabled";
264 };
265
266 uart5: serial@01c29400 {
267 compatible = "snps,dw-apb-uart";
268 reg = <0x01c29400 0x400>;
269 interrupts = <18>;
270 reg-shift = <2>;
271 reg-io-width = <4>;
272 clocks = <&apb1_gates 21>;
273 status = "disabled";
274 };
275
276 uart6: serial@01c29800 {
277 compatible = "snps,dw-apb-uart";
278 reg = <0x01c29800 0x400>;
279 interrupts = <19>;
280 reg-shift = <2>;
281 reg-io-width = <4>;
282 clocks = <&apb1_gates 22>;
283 status = "disabled";
284 };
285
286 uart7: serial@01c29c00 {
287 compatible = "snps,dw-apb-uart";
288 reg = <0x01c29c00 0x400>;
289 interrupts = <20>;
290 reg-shift = <2>;
291 reg-io-width = <4>;
292 clocks = <&apb1_gates 23>;
293 status = "disabled";
294 };
48 }; 295 };
49}; 296};
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 4a1e45d4aace..3ca55067f868 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -22,11 +22,31 @@
22 bootargs = "earlyprintk console=ttyS0,115200"; 22 bootargs = "earlyprintk console=ttyS0,115200";
23 }; 23 };
24 24
25 soc { 25 soc@01c20000 {
26 uart1: uart@01c28400 { 26 pinctrl@01c20800 {
27 led_pins_olinuxino: led_pins@0 {
28 allwinner,pins = "PG9";
29 allwinner,function = "gpio_out";
30 allwinner,drive = <1>;
31 allwinner,pull = <0>;
32 };
33 };
34
35 uart1: serial@01c28400 {
27 pinctrl-names = "default"; 36 pinctrl-names = "default";
28 pinctrl-0 = <&uart1_pins_b>; 37 pinctrl-0 = <&uart1_pins_b>;
29 status = "okay"; 38 status = "okay";
30 }; 39 };
31 }; 40 };
41
42 leds {
43 compatible = "gpio-leds";
44 pinctrl-names = "default";
45 pinctrl-0 = <&led_pins_olinuxino>;
46
47 power {
48 gpios = <&pio 6 9 0>;
49 default-state = "on";
50 };
51 };
32}; 52};
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index e1121890fb29..31fa38f8cc98 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -11,19 +11,174 @@
11 * http://www.gnu.org/copyleft/gpl.html 11 * http://www.gnu.org/copyleft/gpl.html
12 */ 12 */
13 13
14/include/ "sunxi.dtsi" 14/include/ "skeleton.dtsi"
15 15
16/ { 16/ {
17 interrupt-parent = <&intc>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,cortex-a8";
22 };
23 };
24
17 memory { 25 memory {
18 reg = <0x40000000 0x20000000>; 26 reg = <0x40000000 0x20000000>;
19 }; 27 };
20 28
21 soc { 29 clocks {
22 pinctrl@01c20800 { 30 #address-cells = <1>;
31 #size-cells = <1>;
32 ranges;
33
34 /*
35 * This is a dummy clock, to be used as placeholder on
36 * other mux clocks when a specific parent clock is not
37 * yet implemented. It should be dropped when the driver
38 * is complete.
39 */
40 dummy: dummy {
41 #clock-cells = <0>;
42 compatible = "fixed-clock";
43 clock-frequency = <0>;
44 };
45
46 osc24M: osc24M@01c20050 {
47 #clock-cells = <0>;
48 compatible = "allwinner,sun4i-osc-clk";
49 reg = <0x01c20050 0x4>;
50 clock-frequency = <24000000>;
51 };
52
53 osc32k: osc32k {
54 #clock-cells = <0>;
55 compatible = "fixed-clock";
56 clock-frequency = <32768>;
57 };
58
59 pll1: pll1@01c20000 {
60 #clock-cells = <0>;
61 compatible = "allwinner,sun4i-pll1-clk";
62 reg = <0x01c20000 0x4>;
63 clocks = <&osc24M>;
64 };
65
66 /* dummy is 200M */
67 cpu: cpu@01c20054 {
68 #clock-cells = <0>;
69 compatible = "allwinner,sun4i-cpu-clk";
70 reg = <0x01c20054 0x4>;
71 clocks = <&osc32k>, <&osc24M>, <&pll1>, <&dummy>;
72 };
73
74 axi: axi@01c20054 {
75 #clock-cells = <0>;
76 compatible = "allwinner,sun4i-axi-clk";
77 reg = <0x01c20054 0x4>;
78 clocks = <&cpu>;
79 };
80
81 axi_gates: axi_gates@01c2005c {
82 #clock-cells = <1>;
83 compatible = "allwinner,sun4i-axi-gates-clk";
84 reg = <0x01c2005c 0x4>;
85 clocks = <&axi>;
86 clock-output-names = "axi_dram";
87 };
88
89 ahb: ahb@01c20054 {
90 #clock-cells = <0>;
91 compatible = "allwinner,sun4i-ahb-clk";
92 reg = <0x01c20054 0x4>;
93 clocks = <&axi>;
94 };
95
96 ahb_gates: ahb_gates@01c20060 {
97 #clock-cells = <1>;
98 compatible = "allwinner,sun4i-ahb-gates-clk";
99 reg = <0x01c20060 0x8>;
100 clocks = <&ahb>;
101 clock-output-names = "ahb_usb0", "ahb_ehci0",
102 "ahb_ohci0", "ahb_ehci1", "ahb_ohci1", "ahb_ss",
103 "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1",
104 "ahb_mmc2", "ahb_mmc3", "ahb_ms", "ahb_nand",
105 "ahb_sdram", "ahb_ace", "ahb_emac", "ahb_ts",
106 "ahb_spi0", "ahb_spi1", "ahb_spi2", "ahb_spi3",
107 "ahb_pata", "ahb_sata", "ahb_gps", "ahb_ve",
108 "ahb_tvd", "ahb_tve0", "ahb_tve1", "ahb_lcd0",
109 "ahb_lcd1", "ahb_csi0", "ahb_csi1", "ahb_hdmi",
110 "ahb_de_be0", "ahb_de_be1", "ahb_de_fe0",
111 "ahb_de_fe1", "ahb_mp", "ahb_mali400";
112 };
113
114 apb0: apb0@01c20054 {
115 #clock-cells = <0>;
116 compatible = "allwinner,sun4i-apb0-clk";
117 reg = <0x01c20054 0x4>;
118 clocks = <&ahb>;
119 };
120
121 apb0_gates: apb0_gates@01c20068 {
122 #clock-cells = <1>;
123 compatible = "allwinner,sun4i-apb0-gates-clk";
124 reg = <0x01c20068 0x4>;
125 clocks = <&apb0>;
126 clock-output-names = "apb0_codec", "apb0_spdif",
127 "apb0_ac97", "apb0_iis", "apb0_pio", "apb0_ir0",
128 "apb0_ir1", "apb0_keypad";
129 };
130
131 /* dummy is pll62 */
132 apb1_mux: apb1_mux@01c20058 {
133 #clock-cells = <0>;
134 compatible = "allwinner,sun4i-apb1-mux-clk";
135 reg = <0x01c20058 0x4>;
136 clocks = <&osc24M>, <&dummy>, <&osc32k>;
137 };
138
139 apb1: apb1@01c20058 {
140 #clock-cells = <0>;
141 compatible = "allwinner,sun4i-apb1-clk";
142 reg = <0x01c20058 0x4>;
143 clocks = <&apb1_mux>;
144 };
145
146 apb1_gates: apb1_gates@01c2006c {
147 #clock-cells = <1>;
148 compatible = "allwinner,sun4i-apb1-gates-clk";
149 reg = <0x01c2006c 0x4>;
150 clocks = <&apb1>;
151 clock-output-names = "apb1_i2c0", "apb1_i2c1",
152 "apb1_i2c2", "apb1_can", "apb1_scr",
153 "apb1_ps20", "apb1_ps21", "apb1_uart0",
154 "apb1_uart1", "apb1_uart2", "apb1_uart3",
155 "apb1_uart4", "apb1_uart5", "apb1_uart6",
156 "apb1_uart7";
157 };
158 };
159
160 soc@01c20000 {
161 compatible = "simple-bus";
162 #address-cells = <1>;
163 #size-cells = <1>;
164 reg = <0x01c20000 0x300000>;
165 ranges;
166
167 intc: interrupt-controller@01c20400 {
168 compatible = "allwinner,sun4i-ic";
169 reg = <0x01c20400 0x400>;
170 interrupt-controller;
171 #interrupt-cells = <1>;
172 };
173
174 pio: pinctrl@01c20800 {
23 compatible = "allwinner,sun5i-a13-pinctrl"; 175 compatible = "allwinner,sun5i-a13-pinctrl";
24 reg = <0x01c20800 0x400>; 176 reg = <0x01c20800 0x400>;
177 clocks = <&apb0_gates 5>;
178 gpio-controller;
25 #address-cells = <1>; 179 #address-cells = <1>;
26 #size-cells = <0>; 180 #size-cells = <0>;
181 #gpio-cells = <3>;
27 182
28 uart1_pins_a: uart1@0 { 183 uart1_pins_a: uart1@0 {
29 allwinner,pins = "PE10", "PE11"; 184 allwinner,pins = "PE10", "PE11";
@@ -39,5 +194,37 @@
39 allwinner,pull = <0>; 194 allwinner,pull = <0>;
40 }; 195 };
41 }; 196 };
197
198 timer@01c20c00 {
199 compatible = "allwinner,sun4i-timer";
200 reg = <0x01c20c00 0x90>;
201 interrupts = <22>;
202 clocks = <&osc24M>;
203 };
204
205 wdt: watchdog@01c20c90 {
206 compatible = "allwinner,sun4i-wdt";
207 reg = <0x01c20c90 0x10>;
208 };
209
210 uart1: serial@01c28400 {
211 compatible = "snps,dw-apb-uart";
212 reg = <0x01c28400 0x400>;
213 interrupts = <2>;
214 reg-shift = <2>;
215 reg-io-width = <4>;
216 clocks = <&apb1_gates 17>;
217 status = "disabled";
218 };
219
220 uart3: serial@01c28c00 {
221 compatible = "snps,dw-apb-uart";
222 reg = <0x01c28c00 0x400>;
223 interrupts = <4>;
224 reg-shift = <2>;
225 reg-io-width = <4>;
226 clocks = <&apb1_gates 19>;
227 status = "disabled";
228 };
42 }; 229 };
43}; 230};
diff --git a/arch/arm/boot/dts/sunxi.dtsi b/arch/arm/boot/dts/sunxi.dtsi
deleted file mode 100644
index 8b36abea9f2e..000000000000
--- a/arch/arm/boot/dts/sunxi.dtsi
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&intc>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,cortex-a8";
22 };
23 };
24
25 clocks {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 osc: oscillator {
30 #clock-cells = <0>;
31 compatible = "fixed-clock";
32 clock-frequency = <24000000>;
33 };
34 };
35
36 soc {
37 compatible = "simple-bus";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 reg = <0x01c20000 0x300000>;
41 ranges;
42
43 timer@01c20c00 {
44 compatible = "allwinner,sunxi-timer";
45 reg = <0x01c20c00 0x90>;
46 interrupts = <22>;
47 clocks = <&osc>;
48 };
49
50 wdt: watchdog@01c20c90 {
51 compatible = "allwinner,sunxi-wdt";
52 reg = <0x01c20c90 0x10>;
53 };
54
55 intc: interrupt-controller@01c20400 {
56 compatible = "allwinner,sunxi-ic";
57 reg = <0x01c20400 0x400>;
58 interrupt-controller;
59 #interrupt-cells = <1>;
60 };
61
62 uart0: uart@01c28000 {
63 compatible = "snps,dw-apb-uart";
64 reg = <0x01c28000 0x400>;
65 interrupts = <1>;
66 reg-shift = <2>;
67 reg-io-width = <4>;
68 clock-frequency = <24000000>;
69 status = "disabled";
70 };
71
72 uart1: uart@01c28400 {
73 compatible = "snps,dw-apb-uart";
74 reg = <0x01c28400 0x400>;
75 interrupts = <2>;
76 reg-shift = <2>;
77 reg-io-width = <4>;
78 clock-frequency = <24000000>;
79 status = "disabled";
80 };
81 };
82};
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index a30aca62658a..616990dc92db 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -12,10 +12,22 @@
12 12
13 serial@70006300 { 13 serial@70006300 {
14 status = "okay"; 14 status = "okay";
15 clock-frequency = <408000000>;
16 }; 15 };
17 16
18 pmc { 17 pmc {
19 nvidia,invert-interrupt; 18 nvidia,invert-interrupt;
20 }; 19 };
20
21 clocks {
22 compatible = "simple-bus";
23 #address-cells = <1>;
24 #size-cells = <0>;
25
26 clk32k_in: clock {
27 compatible = "fixed-clock";
28 reg=<0>;
29 #clock-cells = <0>;
30 clock-frequency = <32768>;
31 };
32 };
21}; 33};
diff --git a/arch/arm/boot/dts/tegra114-pluto.dts b/arch/arm/boot/dts/tegra114-pluto.dts
index 9bea8f57aa47..6bbc8efae9c0 100644
--- a/arch/arm/boot/dts/tegra114-pluto.dts
+++ b/arch/arm/boot/dts/tegra114-pluto.dts
@@ -12,10 +12,22 @@
12 12
13 serial@70006300 { 13 serial@70006300 {
14 status = "okay"; 14 status = "okay";
15 clock-frequency = <408000000>;
16 }; 15 };
17 16
18 pmc { 17 pmc {
19 nvidia,invert-interrupt; 18 nvidia,invert-interrupt;
20 }; 19 };
20
21 clocks {
22 compatible = "simple-bus";
23 #address-cells = <1>;
24 #size-cells = <0>;
25
26 clk32k_in: clock {
27 compatible = "fixed-clock";
28 reg=<0>;
29 #clock-cells = <0>;
30 clock-frequency = <32768>;
31 };
32 };
21}; 33};
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 1dfaf2874c57..c1110a9b2a91 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -24,10 +24,11 @@
24 0 42 0x04 24 0 42 0x04
25 0 121 0x04 25 0 121 0x04
26 0 122 0x04>; 26 0 122 0x04>;
27 clocks = <&tegra_car 5>;
27 }; 28 };
28 29
29 tegra_car: clock { 30 tegra_car: clock {
30 compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; 31 compatible = "nvidia,tegra114-car";
31 reg = <0x60006000 0x1000>; 32 reg = <0x60006000 0x1000>;
32 #clock-cells = <1>; 33 #clock-cells = <1>;
33 }; 34 };
@@ -66,6 +67,7 @@
66 reg-shift = <2>; 67 reg-shift = <2>;
67 interrupts = <0 36 0x04>; 68 interrupts = <0 36 0x04>;
68 status = "disabled"; 69 status = "disabled";
70 clocks = <&tegra_car 6>;
69 }; 71 };
70 72
71 serial@70006040 { 73 serial@70006040 {
@@ -74,6 +76,7 @@
74 reg-shift = <2>; 76 reg-shift = <2>;
75 interrupts = <0 37 0x04>; 77 interrupts = <0 37 0x04>;
76 status = "disabled"; 78 status = "disabled";
79 clocks = <&tegra_car 192>;
77 }; 80 };
78 81
79 serial@70006200 { 82 serial@70006200 {
@@ -82,6 +85,7 @@
82 reg-shift = <2>; 85 reg-shift = <2>;
83 interrupts = <0 46 0x04>; 86 interrupts = <0 46 0x04>;
84 status = "disabled"; 87 status = "disabled";
88 clocks = <&tegra_car 55>;
85 }; 89 };
86 90
87 serial@70006300 { 91 serial@70006300 {
@@ -90,17 +94,21 @@
90 reg-shift = <2>; 94 reg-shift = <2>;
91 interrupts = <0 90 0x04>; 95 interrupts = <0 90 0x04>;
92 status = "disabled"; 96 status = "disabled";
97 clocks = <&tegra_car 65>;
93 }; 98 };
94 99
95 rtc { 100 rtc {
96 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; 101 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc";
97 reg = <0x7000e000 0x100>; 102 reg = <0x7000e000 0x100>;
98 interrupts = <0 2 0x04>; 103 interrupts = <0 2 0x04>;
104 clocks = <&tegra_car 4>;
99 }; 105 };
100 106
101 pmc { 107 pmc {
102 compatible = "nvidia,tegra114-pmc", "nvidia,tegra30-pmc"; 108 compatible = "nvidia,tegra114-pmc";
103 reg = <0x7000e400 0x400>; 109 reg = <0x7000e400 0x400>;
110 clocks = <&tegra_car 261>, <&clk32k_in>;
111 clock-names = "pclk", "clk32k_in";
104 }; 112 };
105 113
106 iommu { 114 iommu {
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
index 444162090042..4e3afdef28a8 100644
--- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi
+++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
@@ -444,7 +444,20 @@
444 }; 444 };
445 445
446 sdhci@c8000600 { 446 sdhci@c8000600 {
447 cd-gpios = <&gpio 23 0>; /* gpio PC7 */ 447 cd-gpios = <&gpio 23 1>; /* gpio PC7 */
448 };
449
450 clocks {
451 compatible = "simple-bus";
452 #address-cells = <1>;
453 #size-cells = <0>;
454
455 clk32k_in: clock {
456 compatible = "fixed-clock";
457 reg=<0>;
458 #clock-cells = <0>;
459 clock-frequency = <32768>;
460 };
448 }; 461 };
449 462
450 sound { 463 sound {
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index 61d027f03617..ae9d5a20834e 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -437,7 +437,7 @@
437 437
438 sdhci@c8000200 { 438 sdhci@c8000200 {
439 status = "okay"; 439 status = "okay";
440 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 440 cd-gpios = <&gpio 69 1>; /* gpio PI5 */
441 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 441 wp-gpios = <&gpio 57 0>; /* gpio PH1 */
442 power-gpios = <&gpio 155 0>; /* gpio PT3 */ 442 power-gpios = <&gpio 155 0>; /* gpio PT3 */
443 bus-width = <4>; 443 bus-width = <4>;
@@ -445,12 +445,25 @@
445 445
446 sdhci@c8000600 { 446 sdhci@c8000600 {
447 status = "okay"; 447 status = "okay";
448 cd-gpios = <&gpio 58 0>; /* gpio PH2 */ 448 cd-gpios = <&gpio 58 1>; /* gpio PH2 */
449 wp-gpios = <&gpio 59 0>; /* gpio PH3 */ 449 wp-gpios = <&gpio 59 0>; /* gpio PH3 */
450 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 450 power-gpios = <&gpio 70 0>; /* gpio PI6 */
451 bus-width = <8>; 451 bus-width = <8>;
452 }; 452 };
453 453
454 clocks {
455 compatible = "simple-bus";
456 #address-cells = <1>;
457 #size-cells = <0>;
458
459 clk32k_in: clock {
460 compatible = "fixed-clock";
461 reg=<0>;
462 #clock-cells = <0>;
463 clock-frequency = <32768>;
464 };
465 };
466
454 kbc { 467 kbc {
455 status = "okay"; 468 status = "okay";
456 nvidia,debounce-delay-ms = <2>; 469 nvidia,debounce-delay-ms = <2>;
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index 54d6fce00a59..fd60940e4063 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -436,7 +436,7 @@
436 436
437 sdhci@c8000000 { 437 sdhci@c8000000 {
438 status = "okay"; 438 status = "okay";
439 cd-gpios = <&gpio 173 0>; /* gpio PV5 */ 439 cd-gpios = <&gpio 173 1>; /* gpio PV5 */
440 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 440 wp-gpios = <&gpio 57 0>; /* gpio PH1 */
441 power-gpios = <&gpio 169 0>; /* gpio PV1 */ 441 power-gpios = <&gpio 169 0>; /* gpio PV1 */
442 bus-width = <4>; 442 bus-width = <4>;
@@ -447,6 +447,19 @@
447 bus-width = <8>; 447 bus-width = <8>;
448 }; 448 };
449 449
450 clocks {
451 compatible = "simple-bus";
452 #address-cells = <1>;
453 #size-cells = <0>;
454
455 clk32k_in: clock {
456 compatible = "fixed-clock";
457 reg=<0>;
458 #clock-cells = <0>;
459 clock-frequency = <32768>;
460 };
461 };
462
450 gpio-keys { 463 gpio-keys {
451 compatible = "gpio-keys"; 464 compatible = "gpio-keys";
452 465
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index 37b3a57ec0f1..4ee700a33ca5 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -584,7 +584,7 @@
584 584
585 sdhci@c8000400 { 585 sdhci@c8000400 {
586 status = "okay"; 586 status = "okay";
587 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 587 cd-gpios = <&gpio 69 1>; /* gpio PI5 */
588 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 588 wp-gpios = <&gpio 57 0>; /* gpio PH1 */
589 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 589 power-gpios = <&gpio 70 0>; /* gpio PI6 */
590 bus-width = <4>; 590 bus-width = <4>;
@@ -595,6 +595,19 @@
595 bus-width = <8>; 595 bus-width = <8>;
596 }; 596 };
597 597
598 clocks {
599 compatible = "simple-bus";
600 #address-cells = <1>;
601 #size-cells = <0>;
602
603 clk32k_in: clock {
604 compatible = "fixed-clock";
605 reg=<0>;
606 #clock-cells = <0>;
607 clock-frequency = <32768>;
608 };
609 };
610
598 gpio-keys { 611 gpio-keys {
599 compatible = "gpio-keys"; 612 compatible = "gpio-keys";
600 613
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index 4766abae7a72..c19025725918 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -465,12 +465,25 @@
465 }; 465 };
466 466
467 sdhci@c8000600 { 467 sdhci@c8000600 {
468 cd-gpios = <&gpio 58 0>; /* gpio PH2 */ 468 cd-gpios = <&gpio 58 1>; /* gpio PH2 */
469 wp-gpios = <&gpio 59 0>; /* gpio PH3 */ 469 wp-gpios = <&gpio 59 0>; /* gpio PH3 */
470 bus-width = <4>; 470 bus-width = <4>;
471 status = "okay"; 471 status = "okay";
472 }; 472 };
473 473
474 clocks {
475 compatible = "simple-bus";
476 #address-cells = <1>;
477 #size-cells = <0>;
478
479 clk32k_in: clock {
480 compatible = "fixed-clock";
481 reg=<0>;
482 #clock-cells = <0>;
483 clock-frequency = <32768>;
484 };
485 };
486
474 regulators { 487 regulators {
475 compatible = "simple-bus"; 488 compatible = "simple-bus";
476 489
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 5d79e4fc49a6..a9f3f06580f5 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -325,11 +325,24 @@
325 325
326 sdhci@c8000600 { 326 sdhci@c8000600 {
327 status = "okay"; 327 status = "okay";
328 cd-gpios = <&gpio 121 0>; /* gpio PP1 */ 328 cd-gpios = <&gpio 121 1>; /* gpio PP1 */
329 wp-gpios = <&gpio 122 0>; /* gpio PP2 */ 329 wp-gpios = <&gpio 122 0>; /* gpio PP2 */
330 bus-width = <4>; 330 bus-width = <4>;
331 }; 331 };
332 332
333 clocks {
334 compatible = "simple-bus";
335 #address-cells = <1>;
336 #size-cells = <0>;
337
338 clk32k_in: clock {
339 compatible = "fixed-clock";
340 reg=<0>;
341 #clock-cells = <0>;
342 clock-frequency = <32768>;
343 };
344 };
345
333 poweroff { 346 poweroff {
334 compatible = "gpio-poweroff"; 347 compatible = "gpio-poweroff";
335 gpios = <&gpio 191 1>; /* gpio PX7, active low */ 348 gpios = <&gpio 191 1>; /* gpio PX7, active low */
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts
index 425c89000c20..f544806e9618 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -520,7 +520,7 @@
520 520
521 sdhci@c8000400 { 521 sdhci@c8000400 {
522 status = "okay"; 522 status = "okay";
523 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 523 cd-gpios = <&gpio 69 1>; /* gpio PI5 */
524 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 524 wp-gpios = <&gpio 57 0>; /* gpio PH1 */
525 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 525 power-gpios = <&gpio 70 0>; /* gpio PI6 */
526 bus-width = <4>; 526 bus-width = <4>;
@@ -531,6 +531,19 @@
531 bus-width = <8>; 531 bus-width = <8>;
532 }; 532 };
533 533
534 clocks {
535 compatible = "simple-bus";
536 #address-cells = <1>;
537 #size-cells = <0>;
538
539 clk32k_in: clock {
540 compatible = "fixed-clock";
541 reg=<0>;
542 #clock-cells = <0>;
543 clock-frequency = <32768>;
544 };
545 };
546
534 regulators { 547 regulators {
535 compatible = "simple-bus"; 548 compatible = "simple-bus";
536 #address-cells = <1>; 549 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index ea57c0f6dcce..258cf945f515 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -510,6 +510,7 @@
510 510
511 sdhci@c8000400 { 511 sdhci@c8000400 {
512 status = "okay"; 512 status = "okay";
513 cd-gpios = <&gpio 69 1>; /* gpio PI5 */
513 wp-gpios = <&gpio 173 0>; /* gpio PV5 */ 514 wp-gpios = <&gpio 173 0>; /* gpio PV5 */
514 bus-width = <8>; 515 bus-width = <8>;
515 }; 516 };
@@ -519,6 +520,19 @@
519 bus-width = <8>; 520 bus-width = <8>;
520 }; 521 };
521 522
523 clocks {
524 compatible = "simple-bus";
525 #address-cells = <1>;
526 #size-cells = <0>;
527
528 clk32k_in: clock {
529 compatible = "fixed-clock";
530 reg=<0>;
531 #clock-cells = <0>;
532 clock-frequency = <32768>;
533 };
534 };
535
522 kbc { 536 kbc {
523 status = "okay"; 537 status = "okay";
524 nvidia,debounce-delay-ms = <20>; 538 nvidia,debounce-delay-ms = <20>;
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 3d3f64d2111a..fc7febc2b386 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -145,6 +145,7 @@
145 0 1 0x04 145 0 1 0x04
146 0 41 0x04 146 0 41 0x04
147 0 42 0x04>; 147 0 42 0x04>;
148 clocks = <&tegra_car 5>;
148 }; 149 };
149 150
150 tegra_car: clock { 151 tegra_car: clock {
@@ -304,6 +305,7 @@
304 compatible = "nvidia,tegra20-rtc"; 305 compatible = "nvidia,tegra20-rtc";
305 reg = <0x7000e000 0x100>; 306 reg = <0x7000e000 0x100>;
306 interrupts = <0 2 0x04>; 307 interrupts = <0 2 0x04>;
308 clocks = <&tegra_car 4>;
307 }; 309 };
308 310
309 i2c@7000c000 { 311 i2c@7000c000 {
@@ -416,6 +418,8 @@
416 pmc { 418 pmc {
417 compatible = "nvidia,tegra20-pmc"; 419 compatible = "nvidia,tegra20-pmc";
418 reg = <0x7000e400 0x400>; 420 reg = <0x7000e400 0x400>;
421 clocks = <&tegra_car 110>, <&clk32k_in>;
422 clock-names = "pclk", "clk32k_in";
419 }; 423 };
420 424
421 memory-controller@7000f000 { 425 memory-controller@7000f000 {
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index 8ff2ff20e4a3..6248b2445b32 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -257,7 +257,7 @@
257 257
258 sdhci@78000000 { 258 sdhci@78000000 {
259 status = "okay"; 259 status = "okay";
260 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 260 cd-gpios = <&gpio 69 1>; /* gpio PI5 */
261 wp-gpios = <&gpio 155 0>; /* gpio PT3 */ 261 wp-gpios = <&gpio 155 0>; /* gpio PT3 */
262 power-gpios = <&gpio 31 0>; /* gpio PD7 */ 262 power-gpios = <&gpio 31 0>; /* gpio PD7 */
263 bus-width = <4>; 263 bus-width = <4>;
@@ -268,6 +268,19 @@
268 bus-width = <8>; 268 bus-width = <8>;
269 }; 269 };
270 270
271 clocks {
272 compatible = "simple-bus";
273 #address-cells = <1>;
274 #size-cells = <0>;
275
276 clk32k_in: clock {
277 compatible = "fixed-clock";
278 reg=<0>;
279 #clock-cells = <0>;
280 clock-frequency = <32768>;
281 };
282 };
283
271 regulators { 284 regulators {
272 compatible = "simple-bus"; 285 compatible = "simple-bus";
273 #address-cells = <1>; 286 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index 17499272a4ef..65bf2b63174e 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -311,7 +311,7 @@
311 311
312 sdhci@78000000 { 312 sdhci@78000000 {
313 status = "okay"; 313 status = "okay";
314 cd-gpios = <&gpio 69 0>; /* gpio PI5 */ 314 cd-gpios = <&gpio 69 1>; /* gpio PI5 */
315 wp-gpios = <&gpio 155 0>; /* gpio PT3 */ 315 wp-gpios = <&gpio 155 0>; /* gpio PT3 */
316 power-gpios = <&gpio 31 0>; /* gpio PD7 */ 316 power-gpios = <&gpio 31 0>; /* gpio PD7 */
317 bus-width = <4>; 317 bus-width = <4>;
@@ -322,6 +322,19 @@
322 bus-width = <8>; 322 bus-width = <8>;
323 }; 323 };
324 324
325 clocks {
326 compatible = "simple-bus";
327 #address-cells = <1>;
328 #size-cells = <0>;
329
330 clk32k_in: clock {
331 compatible = "fixed-clock";
332 reg=<0>;
333 #clock-cells = <0>;
334 clock-frequency = <32768>;
335 };
336 };
337
325 regulators { 338 regulators {
326 compatible = "simple-bus"; 339 compatible = "simple-bus";
327 #address-cells = <1>; 340 #address-cells = <1>;
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index dbf46c272562..9fe7a92b4c85 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -148,6 +148,7 @@
148 0 42 0x04 148 0 42 0x04
149 0 121 0x04 149 0 121 0x04
150 0 122 0x04>; 150 0 122 0x04>;
151 clocks = <&tegra_car 5>;
151 }; 152 };
152 153
153 tegra_car: clock { 154 tegra_car: clock {
@@ -291,6 +292,7 @@
291 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc"; 292 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc";
292 reg = <0x7000e000 0x100>; 293 reg = <0x7000e000 0x100>;
293 interrupts = <0 2 0x04>; 294 interrupts = <0 2 0x04>;
295 clocks = <&tegra_car 4>;
294 }; 296 };
295 297
296 i2c@7000c000 { 298 i2c@7000c000 {
@@ -423,8 +425,10 @@
423 }; 425 };
424 426
425 pmc { 427 pmc {
426 compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc"; 428 compatible = "nvidia,tegra30-pmc";
427 reg = <0x7000e400 0x400>; 429 reg = <0x7000e400 0x400>;
430 clocks = <&tegra_car 218>, <&clk32k_in>;
431 clock-names = "pclk", "clk32k_in";
428 }; 432 };
429 433
430 memory-controller { 434 memory-controller {
diff --git a/arch/arm/boot/dts/tps6507x.dtsi b/arch/arm/boot/dts/tps6507x.dtsi
new file mode 100644
index 000000000000..4c326e591e5a
--- /dev/null
+++ b/arch/arm/boot/dts/tps6507x.dtsi
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
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/*
10 * Integrated Power Management Chip
11 * http://www.ti.com/lit/ds/symlink/tps65070.pdf
12 */
13
14&tps {
15 compatible = "ti,tps6507x";
16
17 regulators {
18 #address-cells = <1>;
19 #size-cells = <0>;
20
21 vdcdc1_reg: regulator@0 {
22 reg = <0>;
23 regulator-compatible = "VDCDC1";
24 };
25
26 vdcdc2_reg: regulator@1 {
27 reg = <1>;
28 regulator-compatible = "VDCDC2";
29 };
30
31 vdcdc3_reg: regulator@2 {
32 reg = <2>;
33 regulator-compatible = "VDCDC3";
34 };
35
36 ldo1_reg: regulator@3 {
37 reg = <3>;
38 regulator-compatible = "LDO1";
39 };
40
41 ldo2_reg: regulator@4 {
42 reg = <4>;
43 regulator-compatible = "LDO2";
44 };
45
46 };
47};
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
index 73187173117c..9420053acc14 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
@@ -117,7 +117,7 @@
117 }; 117 };
118 118
119 pmu { 119 pmu {
120 compatible = "arm,cortex-a15-pmu", "arm,cortex-a9-pmu"; 120 compatible = "arm,cortex-a15-pmu";
121 interrupts = <0 68 4>, 121 interrupts = <0 68 4>,
122 <0 69 4>; 122 <0 69 4>;
123 }; 123 };
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index dfe371ec2749..d2803be4e1a8 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -134,7 +134,7 @@
134 }; 134 };
135 135
136 pmu { 136 pmu {
137 compatible = "arm,cortex-a15-pmu", "arm,cortex-a9-pmu"; 137 compatible = "arm,cortex-a15-pmu";
138 interrupts = <0 68 4>, 138 interrupts = <0 68 4>,
139 <0 69 4>; 139 <0 69 4>;
140 }; 140 };
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca5s.dts b/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
index 6328cbc71d30..c544a5504591 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
@@ -111,7 +111,7 @@
111 }; 111 };
112 112
113 pmu { 113 pmu {
114 compatible = "arm,cortex-a5-pmu", "arm,cortex-a9-pmu"; 114 compatible = "arm,cortex-a5-pmu";
115 interrupts = <0 68 4>, 115 interrupts = <0 68 4>,
116 <0 69 4>; 116 <0 69 4>;
117 }; 117 };
diff --git a/arch/arm/boot/dts/vt8500-bv07.dts b/arch/arm/boot/dts/vt8500-bv07.dts
index 567cf4e8ab84..877b33afa7ed 100644
--- a/arch/arm/boot/dts/vt8500-bv07.dts
+++ b/arch/arm/boot/dts/vt8500-bv07.dts
@@ -11,26 +11,22 @@
11 11
12/ { 12/ {
13 model = "Benign BV07 Netbook"; 13 model = "Benign BV07 Netbook";
14};
14 15
15 /* 16&fb {
16 * Display node is based on Sascha Hauer's patch on dri-devel. 17 bits-per-pixel = <16>;
17 * Added a bpp property to calculate the size of the framebuffer 18 display-timings {
18 * until the binding is formalized. 19 native-mode = <&timing0>;
19 */ 20 timing0: 800x480 {
20 display: display@0 { 21 clock-frequency = <0>; /* unused but required */
21 modes { 22 hactive = <800>;
22 mode0: mode@0 { 23 vactive = <480>;
23 hactive = <800>; 24 hfront-porch = <40>;
24 vactive = <480>; 25 hback-porch = <88>;
25 hback-porch = <88>; 26 hsync-len = <0>;
26 hfront-porch = <40>; 27 vback-porch = <32>;
27 hsync-len = <0>; 28 vfront-porch = <11>;
28 vback-porch = <32>; 29 vsync-len = <1>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 clock = <0>; /* unused but required */
32 bpp = <16>; /* non-standard but required */
33 };
34 }; 30 };
35 }; 31 };
36}; 32};
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi
index cf31ced46602..4a4b96f6827e 100644
--- a/arch/arm/boot/dts/vt8500.dtsi
+++ b/arch/arm/boot/dts/vt8500.dtsi
@@ -25,11 +25,13 @@
25 #interrupt-cells = <1>; 25 #interrupt-cells = <1>;
26 }; 26 };
27 27
28 gpio: gpio-controller@d8110000 { 28 pinctrl: pinctrl@d8110000 {
29 compatible = "via,vt8500-gpio"; 29 compatible = "via,vt8500-pinctrl";
30 gpio-controller;
31 reg = <0xd8110000 0x10000>; 30 reg = <0xd8110000 0x10000>;
32 #gpio-cells = <3>; 31 interrupt-controller;
32 #interrupt-cells = <2>;
33 gpio-controller;
34 #gpio-cells = <2>;
33 }; 35 };
34 36
35 pmc@d8130000 { 37 pmc@d8130000 {
@@ -98,12 +100,10 @@
98 interrupts = <43>; 100 interrupts = <43>;
99 }; 101 };
100 102
101 fb@d800e400 { 103 fb: fb@d8050800 {
102 compatible = "via,vt8500-fb"; 104 compatible = "via,vt8500-fb";
103 reg = <0xd800e400 0x400>; 105 reg = <0xd800e400 0x400>;
104 interrupts = <12>; 106 interrupts = <12>;
105 display = <&display>;
106 default-mode = <&mode0>;
107 }; 107 };
108 108
109 ge_rops@d8050400 { 109 ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8505-ref.dts b/arch/arm/boot/dts/wm8505-ref.dts
index fd4e248074c6..edd2cec3d37f 100644
--- a/arch/arm/boot/dts/wm8505-ref.dts
+++ b/arch/arm/boot/dts/wm8505-ref.dts
@@ -11,26 +11,22 @@
11 11
12/ { 12/ {
13 model = "Wondermedia WM8505 Netbook"; 13 model = "Wondermedia WM8505 Netbook";
14};
14 15
15 /* 16&fb {
16 * Display node is based on Sascha Hauer's patch on dri-devel. 17 bits-per-pixel = <32>;
17 * Added a bpp property to calculate the size of the framebuffer 18 display-timings {
18 * until the binding is formalized. 19 native-mode = <&timing0>;
19 */ 20 timing0: 800x480 {
20 display: display@0 { 21 clock-frequency = <0>; /* unused but required */
21 modes { 22 hactive = <800>;
22 mode0: mode@0 { 23 vactive = <480>;
23 hactive = <800>; 24 hfront-porch = <40>;
24 vactive = <480>; 25 hback-porch = <88>;
25 hback-porch = <88>; 26 hsync-len = <0>;
26 hfront-porch = <40>; 27 vback-porch = <32>;
27 hsync-len = <0>; 28 vfront-porch = <11>;
28 vback-porch = <32>; 29 vsync-len = <1>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 clock = <0>; /* unused but required */
32 bpp = <32>; /* non-standard but required */
33 };
34 }; 30 };
35 }; 31 };
36}; 32};
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index e74a1c0fb9a2..b2bf359e852f 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -40,11 +40,13 @@
40 interrupts = <56 57 58 59 60 61 62 63>; 40 interrupts = <56 57 58 59 60 61 62 63>;
41 }; 41 };
42 42
43 gpio: gpio-controller@d8110000 { 43 pinctrl: pinctrl@d8110000 {
44 compatible = "wm,wm8505-gpio"; 44 compatible = "wm,wm8505-pinctrl";
45 gpio-controller;
46 reg = <0xd8110000 0x10000>; 45 reg = <0xd8110000 0x10000>;
47 #gpio-cells = <3>; 46 interrupt-controller;
47 #interrupt-cells = <2>;
48 gpio-controller;
49 #gpio-cells = <2>;
48 }; 50 };
49 51
50 pmc@d8130000 { 52 pmc@d8130000 {
@@ -60,6 +62,19 @@
60 clock-frequency = <24000000>; 62 clock-frequency = <24000000>;
61 }; 63 };
62 64
65 ref25: ref25M {
66 #clock-cells = <0>;
67 compatible = "fixed-clock";
68 clock-frequency = <25000000>;
69 };
70
71 pllb: pllb {
72 #clock-cells = <0>;
73 compatible = "via,vt8500-pll-clock";
74 clocks = <&ref25>;
75 reg = <0x204>;
76 };
77
63 clkuart0: uart0 { 78 clkuart0: uart0 {
64 #clock-cells = <0>; 79 #clock-cells = <0>;
65 compatible = "via,vt8500-device-clock"; 80 compatible = "via,vt8500-device-clock";
@@ -107,6 +122,16 @@
107 enable-reg = <0x250>; 122 enable-reg = <0x250>;
108 enable-bit = <23>; 123 enable-bit = <23>;
109 }; 124 };
125
126 clksdhc: sdhc {
127 #clock-cells = <0>;
128 compatible = "via,vt8500-device-clock";
129 clocks = <&pllb>;
130 divisor-reg = <0x328>;
131 divisor-mask = <0x3f>;
132 enable-reg = <0x254>;
133 enable-bit = <18>;
134 };
110 }; 135 };
111 }; 136 };
112 137
@@ -128,11 +153,9 @@
128 interrupts = <0>; 153 interrupts = <0>;
129 }; 154 };
130 155
131 fb@d8050800 { 156 fb: fb@d8050800 {
132 compatible = "wm,wm8505-fb"; 157 compatible = "wm,wm8505-fb";
133 reg = <0xd8050800 0x200>; 158 reg = <0xd8050800 0x200>;
134 display = <&display>;
135 default-mode = <&mode0>;
136 }; 159 };
137 160
138 ge_rops@d8050400 { 161 ge_rops@d8050400 {
@@ -187,5 +210,13 @@
187 reg = <0xd8100000 0x10000>; 210 reg = <0xd8100000 0x10000>;
188 interrupts = <48>; 211 interrupts = <48>;
189 }; 212 };
213
214 sdhc@d800a000 {
215 compatible = "wm,wm8505-sdhc";
216 reg = <0xd800a000 0x1000>;
217 interrupts = <20 21>;
218 clocks = <&clksdhc>;
219 bus-width = <4>;
220 };
190 }; 221 };
191}; 222};
diff --git a/arch/arm/boot/dts/wm8650-mid.dts b/arch/arm/boot/dts/wm8650-mid.dts
index cefd938f842f..61671a0d9ede 100644
--- a/arch/arm/boot/dts/wm8650-mid.dts
+++ b/arch/arm/boot/dts/wm8650-mid.dts
@@ -11,26 +11,24 @@
11 11
12/ { 12/ {
13 model = "Wondermedia WM8650-MID Tablet"; 13 model = "Wondermedia WM8650-MID Tablet";
14};
15
16&fb {
17 bits-per-pixel = <16>;
14 18
15 /* 19 display-timings {
16 * Display node is based on Sascha Hauer's patch on dri-devel. 20 native-mode = <&timing0>;
17 * Added a bpp property to calculate the size of the framebuffer 21 timing0: 800x480 {
18 * until the binding is formalized. 22 clock-frequency = <0>; /* unused but required */
19 */ 23 hactive = <800>;
20 display: display@0 { 24 vactive = <480>;
21 modes { 25 hfront-porch = <40>;
22 mode0: mode@0 { 26 hback-porch = <88>;
23 hactive = <800>; 27 hsync-len = <0>;
24 vactive = <480>; 28 vback-porch = <32>;
25 hback-porch = <88>; 29 vfront-porch = <11>;
26 hfront-porch = <40>; 30 vsync-len = <1>;
27 hsync-len = <0>;
28 vback-porch = <32>;
29 vfront-porch = <11>;
30 vsync-len = <1>;
31 clock = <0>; /* unused but required */
32 bpp = <16>; /* non-standard but required */
33 };
34 }; 31 };
35 }; 32 };
36}; 33};
34
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index db3c0a12e052..dd8464eeb40d 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -34,11 +34,13 @@
34 interrupts = <56 57 58 59 60 61 62 63>; 34 interrupts = <56 57 58 59 60 61 62 63>;
35 }; 35 };
36 36
37 gpio: gpio-controller@d8110000 { 37 pinctrl: pinctrl@d8110000 {
38 compatible = "wm,wm8650-gpio"; 38 compatible = "wm,wm8650-pinctrl";
39 gpio-controller;
40 reg = <0xd8110000 0x10000>; 39 reg = <0xd8110000 0x10000>;
41 #gpio-cells = <3>; 40 interrupt-controller;
41 #interrupt-cells = <2>;
42 gpio-controller;
43 #gpio-cells = <2>;
42 }; 44 };
43 45
44 pmc@d8130000 { 46 pmc@d8130000 {
@@ -128,11 +130,9 @@
128 interrupts = <43>; 130 interrupts = <43>;
129 }; 131 };
130 132
131 fb@d8050800 { 133 fb: fb@d8050800 {
132 compatible = "wm,wm8505-fb"; 134 compatible = "wm,wm8505-fb";
133 reg = <0xd8050800 0x200>; 135 reg = <0xd8050800 0x200>;
134 display = <&display>;
135 default-mode = <&mode0>;
136 }; 136 };
137 137
138 ge_rops@d8050400 { 138 ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8850-w70v2.dts b/arch/arm/boot/dts/wm8850-w70v2.dts
index fcc660c89540..32d22532cd6c 100644
--- a/arch/arm/boot/dts/wm8850-w70v2.dts
+++ b/arch/arm/boot/dts/wm8850-w70v2.dts
@@ -15,28 +15,6 @@
15/ { 15/ {
16 model = "Wondermedia WM8850-W70v2 Tablet"; 16 model = "Wondermedia WM8850-W70v2 Tablet";
17 17
18 /*
19 * Display node is based on Sascha Hauer's patch on dri-devel.
20 * Added a bpp property to calculate the size of the framebuffer
21 * until the binding is formalized.
22 */
23 display: display@0 {
24 modes {
25 mode0: mode@0 {
26 hactive = <800>;
27 vactive = <480>;
28 hback-porch = <88>;
29 hfront-porch = <40>;
30 hsync-len = <0>;
31 vback-porch = <32>;
32 vfront-porch = <11>;
33 vsync-len = <1>;
34 clock = <0>; /* unused but required */
35 bpp = <16>; /* non-standard but required */
36 };
37 };
38 };
39
40 backlight { 18 backlight {
41 compatible = "pwm-backlight"; 19 compatible = "pwm-backlight";
42 pwms = <&pwm 0 50000 1>; /* duty inverted */ 20 pwms = <&pwm 0 50000 1>; /* duty inverted */
@@ -45,3 +23,21 @@
45 default-brightness-level = <5>; 23 default-brightness-level = <5>;
46 }; 24 };
47}; 25};
26
27&fb {
28 bits-per-pixel = <16>;
29 display-timings {
30 native-mode = <&timing0>;
31 timing0: 800x480 {
32 clock-frequency = <0>; /* unused but required */
33 hactive = <800>;
34 vactive = <480>;
35 hfront-porch = <40>;
36 hback-porch = <88>;
37 hsync-len = <0>;
38 vback-porch = <32>;
39 vfront-porch = <11>;
40 vsync-len = <1>;
41 };
42 };
43};
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi
index e8cbfdc87bba..fc790d0aee66 100644
--- a/arch/arm/boot/dts/wm8850.dtsi
+++ b/arch/arm/boot/dts/wm8850.dtsi
@@ -41,11 +41,13 @@
41 interrupts = <56 57 58 59 60 61 62 63>; 41 interrupts = <56 57 58 59 60 61 62 63>;
42 }; 42 };
43 43
44 gpio: gpio-controller@d8110000 { 44 pinctrl: pinctrl@d8110000 {
45 compatible = "wm,wm8650-gpio"; 45 compatible = "wm,wm8850-pinctrl";
46 gpio-controller;
47 reg = <0xd8110000 0x10000>; 46 reg = <0xd8110000 0x10000>;
48 #gpio-cells = <3>; 47 interrupt-controller;
48 #interrupt-cells = <2>;
49 gpio-controller;
50 #gpio-cells = <2>;
49 }; 51 };
50 52
51 pmc@d8130000 { 53 pmc@d8130000 {
@@ -135,11 +137,9 @@
135 }; 137 };
136 }; 138 };
137 139
138 fb@d8051700 { 140 fb: fb@d8051700 {
139 compatible = "wm,wm8505-fb"; 141 compatible = "wm,wm8505-fb";
140 reg = <0xd8051700 0x200>; 142 reg = <0xd8051700 0x200>;
141 display = <&display>;
142 default-mode = <&mode0>;
143 }; 143 };
144 144
145 ge_rops@d8050400 { 145 ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 5914b5654591..748fc347ed18 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -15,6 +15,13 @@
15/ { 15/ {
16 compatible = "xlnx,zynq-7000"; 16 compatible = "xlnx,zynq-7000";
17 17
18 pmu {
19 compatible = "arm,cortex-a9-pmu";
20 interrupts = <0 5 4>, <0 6 4>;
21 interrupt-parent = <&intc>;
22 reg = < 0xf8891000 0x1000 0xf8893000 0x1000 >;
23 };
24
18 amba { 25 amba {
19 compatible = "simple-bus"; 26 compatible = "simple-bus";
20 #address-cells = <1>; 27 #address-cells = <1>;
@@ -111,56 +118,23 @@
111 }; 118 };
112 119
113 ttc0: ttc0@f8001000 { 120 ttc0: ttc0@f8001000 {
114 #address-cells = <1>; 121 interrupt-parent = <&intc>;
115 #size-cells = <0>; 122 interrupts = < 0 10 4 0 11 4 0 12 4 >;
116 compatible = "xlnx,ttc"; 123 compatible = "cdns,ttc";
117 reg = <0xF8001000 0x1000>; 124 reg = <0xF8001000 0x1000>;
118 clocks = <&cpu_clk 3>; 125 clocks = <&cpu_clk 3>;
119 clock-names = "cpu_1x"; 126 clock-names = "cpu_1x";
120 clock-ranges; 127 clock-ranges;
121
122 ttc0_0: ttc0.0 {
123 status = "disabled";
124 reg = <0>;
125 interrupts = <0 10 4>;
126 };
127 ttc0_1: ttc0.1 {
128 status = "disabled";
129 reg = <1>;
130 interrupts = <0 11 4>;
131 };
132 ttc0_2: ttc0.2 {
133 status = "disabled";
134 reg = <2>;
135 interrupts = <0 12 4>;
136 };
137 }; 128 };
138 129
139 ttc1: ttc1@f8002000 { 130 ttc1: ttc1@f8002000 {
140 #interrupt-parent = <&intc>; 131 interrupt-parent = <&intc>;
141 #address-cells = <1>; 132 interrupts = < 0 37 4 0 38 4 0 39 4 >;
142 #size-cells = <0>; 133 compatible = "cdns,ttc";
143 compatible = "xlnx,ttc";
144 reg = <0xF8002000 0x1000>; 134 reg = <0xF8002000 0x1000>;
145 clocks = <&cpu_clk 3>; 135 clocks = <&cpu_clk 3>;
146 clock-names = "cpu_1x"; 136 clock-names = "cpu_1x";
147 clock-ranges; 137 clock-ranges;
148
149 ttc1_0: ttc1.0 {
150 status = "disabled";
151 reg = <0>;
152 interrupts = <0 37 4>;
153 };
154 ttc1_1: ttc1.1 {
155 status = "disabled";
156 reg = <1>;
157 interrupts = <0 38 4>;
158 };
159 ttc1_2: ttc1.2 {
160 status = "disabled";
161 reg = <2>;
162 interrupts = <0 39 4>;
163 };
164 }; 138 };
165 }; 139 };
166}; 140};
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index c772942a399a..86f44d5b0265 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -32,13 +32,3 @@
32&ps_clk { 32&ps_clk {
33 clock-frequency = <33333330>; 33 clock-frequency = <33333330>;
34}; 34};
35
36&ttc0_0 {
37 status = "ok";
38 compatible = "xlnx,ttc-counter-clocksource";
39};
40
41&ttc0_1 {
42 status = "ok";
43 compatible = "xlnx,ttc-counter-clockevent";
44};
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index dc8dd0de5c0f..48434cbe3e89 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -2,6 +2,8 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y += firmware.o
6
5obj-$(CONFIG_ICST) += icst.o 7obj-$(CONFIG_ICST) += icst.o
6obj-$(CONFIG_SA1111) += sa1111.o 8obj-$(CONFIG_SA1111) += sa1111.o
7obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o 9obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o
@@ -11,3 +13,6 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
11obj-$(CONFIG_SHARP_SCOOP) += scoop.o 13obj-$(CONFIG_SHARP_SCOOP) += scoop.o
12obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o 14obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
13obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o 15obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
16obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
17AFLAGS_mcpm_head.o := -march=armv7-a
18AFLAGS_vlock.o := -march=armv7-a
diff --git a/arch/arm/common/firmware.c b/arch/arm/common/firmware.c
new file mode 100644
index 000000000000..27ddccb1131f
--- /dev/null
+++ b/arch/arm/common/firmware.c
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics.
3 * Kyungmin Park <kyungmin.park@samsung.com>
4 * Tomasz Figa <t.figa@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/suspend.h>
13
14#include <asm/firmware.h>
15
16static const struct firmware_ops default_firmware_ops;
17
18const struct firmware_ops *firmware_ops = &default_firmware_ops;
diff --git a/arch/arm/common/mcpm_entry.c b/arch/arm/common/mcpm_entry.c
new file mode 100644
index 000000000000..370236dd1a03
--- /dev/null
+++ b/arch/arm/common/mcpm_entry.c
@@ -0,0 +1,263 @@
1/*
2 * arch/arm/common/mcpm_entry.c -- entry point for multi-cluster PM
3 *
4 * Created by: Nicolas Pitre, March 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/irqflags.h>
15
16#include <asm/mcpm.h>
17#include <asm/cacheflush.h>
18#include <asm/idmap.h>
19#include <asm/cputype.h>
20
21extern unsigned long mcpm_entry_vectors[MAX_NR_CLUSTERS][MAX_CPUS_PER_CLUSTER];
22
23void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr)
24{
25 unsigned long val = ptr ? virt_to_phys(ptr) : 0;
26 mcpm_entry_vectors[cluster][cpu] = val;
27 sync_cache_w(&mcpm_entry_vectors[cluster][cpu]);
28}
29
30static const struct mcpm_platform_ops *platform_ops;
31
32int __init mcpm_platform_register(const struct mcpm_platform_ops *ops)
33{
34 if (platform_ops)
35 return -EBUSY;
36 platform_ops = ops;
37 return 0;
38}
39
40int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster)
41{
42 if (!platform_ops)
43 return -EUNATCH; /* try not to shadow power_up errors */
44 might_sleep();
45 return platform_ops->power_up(cpu, cluster);
46}
47
48typedef void (*phys_reset_t)(unsigned long);
49
50void mcpm_cpu_power_down(void)
51{
52 phys_reset_t phys_reset;
53
54 BUG_ON(!platform_ops);
55 BUG_ON(!irqs_disabled());
56
57 /*
58 * Do this before calling into the power_down method,
59 * as it might not always be safe to do afterwards.
60 */
61 setup_mm_for_reboot();
62
63 platform_ops->power_down();
64
65 /*
66 * It is possible for a power_up request to happen concurrently
67 * with a power_down request for the same CPU. In this case the
68 * power_down method might not be able to actually enter a
69 * powered down state with the WFI instruction if the power_up
70 * method has removed the required reset condition. The
71 * power_down method is then allowed to return. We must perform
72 * a re-entry in the kernel as if the power_up method just had
73 * deasserted reset on the CPU.
74 *
75 * To simplify race issues, the platform specific implementation
76 * must accommodate for the possibility of unordered calls to
77 * power_down and power_up with a usage count. Therefore, if a
78 * call to power_up is issued for a CPU that is not down, then
79 * the next call to power_down must not attempt a full shutdown
80 * but only do the minimum (normally disabling L1 cache and CPU
81 * coherency) and return just as if a concurrent power_up request
82 * had happened as described above.
83 */
84
85 phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
86 phys_reset(virt_to_phys(mcpm_entry_point));
87
88 /* should never get here */
89 BUG();
90}
91
92void mcpm_cpu_suspend(u64 expected_residency)
93{
94 phys_reset_t phys_reset;
95
96 BUG_ON(!platform_ops);
97 BUG_ON(!irqs_disabled());
98
99 /* Very similar to mcpm_cpu_power_down() */
100 setup_mm_for_reboot();
101 platform_ops->suspend(expected_residency);
102 phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
103 phys_reset(virt_to_phys(mcpm_entry_point));
104 BUG();
105}
106
107int mcpm_cpu_powered_up(void)
108{
109 if (!platform_ops)
110 return -EUNATCH;
111 if (platform_ops->powered_up)
112 platform_ops->powered_up();
113 return 0;
114}
115
116struct sync_struct mcpm_sync;
117
118/*
119 * __mcpm_cpu_going_down: Indicates that the cpu is being torn down.
120 * This must be called at the point of committing to teardown of a CPU.
121 * The CPU cache (SCTRL.C bit) is expected to still be active.
122 */
123void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster)
124{
125 mcpm_sync.clusters[cluster].cpus[cpu].cpu = CPU_GOING_DOWN;
126 sync_cache_w(&mcpm_sync.clusters[cluster].cpus[cpu].cpu);
127}
128
129/*
130 * __mcpm_cpu_down: Indicates that cpu teardown is complete and that the
131 * cluster can be torn down without disrupting this CPU.
132 * To avoid deadlocks, this must be called before a CPU is powered down.
133 * The CPU cache (SCTRL.C bit) is expected to be off.
134 * However L2 cache might or might not be active.
135 */
136void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster)
137{
138 dmb();
139 mcpm_sync.clusters[cluster].cpus[cpu].cpu = CPU_DOWN;
140 sync_cache_w(&mcpm_sync.clusters[cluster].cpus[cpu].cpu);
141 dsb_sev();
142}
143
144/*
145 * __mcpm_outbound_leave_critical: Leave the cluster teardown critical section.
146 * @state: the final state of the cluster:
147 * CLUSTER_UP: no destructive teardown was done and the cluster has been
148 * restored to the previous state (CPU cache still active); or
149 * CLUSTER_DOWN: the cluster has been torn-down, ready for power-off
150 * (CPU cache disabled, L2 cache either enabled or disabled).
151 */
152void __mcpm_outbound_leave_critical(unsigned int cluster, int state)
153{
154 dmb();
155 mcpm_sync.clusters[cluster].cluster = state;
156 sync_cache_w(&mcpm_sync.clusters[cluster].cluster);
157 dsb_sev();
158}
159
160/*
161 * __mcpm_outbound_enter_critical: Enter the cluster teardown critical section.
162 * This function should be called by the last man, after local CPU teardown
163 * is complete. CPU cache expected to be active.
164 *
165 * Returns:
166 * false: the critical section was not entered because an inbound CPU was
167 * observed, or the cluster is already being set up;
168 * true: the critical section was entered: it is now safe to tear down the
169 * cluster.
170 */
171bool __mcpm_outbound_enter_critical(unsigned int cpu, unsigned int cluster)
172{
173 unsigned int i;
174 struct mcpm_sync_struct *c = &mcpm_sync.clusters[cluster];
175
176 /* Warn inbound CPUs that the cluster is being torn down: */
177 c->cluster = CLUSTER_GOING_DOWN;
178 sync_cache_w(&c->cluster);
179
180 /* Back out if the inbound cluster is already in the critical region: */
181 sync_cache_r(&c->inbound);
182 if (c->inbound == INBOUND_COMING_UP)
183 goto abort;
184
185 /*
186 * Wait for all CPUs to get out of the GOING_DOWN state, so that local
187 * teardown is complete on each CPU before tearing down the cluster.
188 *
189 * If any CPU has been woken up again from the DOWN state, then we
190 * shouldn't be taking the cluster down at all: abort in that case.
191 */
192 sync_cache_r(&c->cpus);
193 for (i = 0; i < MAX_CPUS_PER_CLUSTER; i++) {
194 int cpustate;
195
196 if (i == cpu)
197 continue;
198
199 while (1) {
200 cpustate = c->cpus[i].cpu;
201 if (cpustate != CPU_GOING_DOWN)
202 break;
203
204 wfe();
205 sync_cache_r(&c->cpus[i].cpu);
206 }
207
208 switch (cpustate) {
209 case CPU_DOWN:
210 continue;
211
212 default:
213 goto abort;
214 }
215 }
216
217 return true;
218
219abort:
220 __mcpm_outbound_leave_critical(cluster, CLUSTER_UP);
221 return false;
222}
223
224int __mcpm_cluster_state(unsigned int cluster)
225{
226 sync_cache_r(&mcpm_sync.clusters[cluster].cluster);
227 return mcpm_sync.clusters[cluster].cluster;
228}
229
230extern unsigned long mcpm_power_up_setup_phys;
231
232int __init mcpm_sync_init(
233 void (*power_up_setup)(unsigned int affinity_level))
234{
235 unsigned int i, j, mpidr, this_cluster;
236
237 BUILD_BUG_ON(MCPM_SYNC_CLUSTER_SIZE * MAX_NR_CLUSTERS != sizeof mcpm_sync);
238 BUG_ON((unsigned long)&mcpm_sync & (__CACHE_WRITEBACK_GRANULE - 1));
239
240 /*
241 * Set initial CPU and cluster states.
242 * Only one cluster is assumed to be active at this point.
243 */
244 for (i = 0; i < MAX_NR_CLUSTERS; i++) {
245 mcpm_sync.clusters[i].cluster = CLUSTER_DOWN;
246 mcpm_sync.clusters[i].inbound = INBOUND_NOT_COMING_UP;
247 for (j = 0; j < MAX_CPUS_PER_CLUSTER; j++)
248 mcpm_sync.clusters[i].cpus[j].cpu = CPU_DOWN;
249 }
250 mpidr = read_cpuid_mpidr();
251 this_cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
252 for_each_online_cpu(i)
253 mcpm_sync.clusters[this_cluster].cpus[i].cpu = CPU_UP;
254 mcpm_sync.clusters[this_cluster].cluster = CLUSTER_UP;
255 sync_cache_w(&mcpm_sync);
256
257 if (power_up_setup) {
258 mcpm_power_up_setup_phys = virt_to_phys(power_up_setup);
259 sync_cache_w(&mcpm_power_up_setup_phys);
260 }
261
262 return 0;
263}
diff --git a/arch/arm/common/mcpm_head.S b/arch/arm/common/mcpm_head.S
new file mode 100644
index 000000000000..8178705c4b24
--- /dev/null
+++ b/arch/arm/common/mcpm_head.S
@@ -0,0 +1,219 @@
1/*
2 * arch/arm/common/mcpm_head.S -- kernel entry point for multi-cluster PM
3 *
4 * Created by: Nicolas Pitre, March 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 *
12 * Refer to Documentation/arm/cluster-pm-race-avoidance.txt
13 * for details of the synchronisation algorithms used here.
14 */
15
16#include <linux/linkage.h>
17#include <asm/mcpm.h>
18
19#include "vlock.h"
20
21.if MCPM_SYNC_CLUSTER_CPUS
22.error "cpus must be the first member of struct mcpm_sync_struct"
23.endif
24
25 .macro pr_dbg string
26#if defined(CONFIG_DEBUG_LL) && defined(DEBUG)
27 b 1901f
281902: .asciz "CPU"
291903: .asciz " cluster"
301904: .asciz ": \string"
31 .align
321901: adr r0, 1902b
33 bl printascii
34 mov r0, r9
35 bl printhex8
36 adr r0, 1903b
37 bl printascii
38 mov r0, r10
39 bl printhex8
40 adr r0, 1904b
41 bl printascii
42#endif
43 .endm
44
45 .arm
46 .align
47
48ENTRY(mcpm_entry_point)
49
50 THUMB( adr r12, BSYM(1f) )
51 THUMB( bx r12 )
52 THUMB( .thumb )
531:
54 mrc p15, 0, r0, c0, c0, 5 @ MPIDR
55 ubfx r9, r0, #0, #8 @ r9 = cpu
56 ubfx r10, r0, #8, #8 @ r10 = cluster
57 mov r3, #MAX_CPUS_PER_CLUSTER
58 mla r4, r3, r10, r9 @ r4 = canonical CPU index
59 cmp r4, #(MAX_CPUS_PER_CLUSTER * MAX_NR_CLUSTERS)
60 blo 2f
61
62 /* We didn't expect this CPU. Try to cheaply make it quiet. */
631: wfi
64 wfe
65 b 1b
66
672: pr_dbg "kernel mcpm_entry_point\n"
68
69 /*
70 * MMU is off so we need to get to various variables in a
71 * position independent way.
72 */
73 adr r5, 3f
74 ldmia r5, {r6, r7, r8, r11}
75 add r6, r5, r6 @ r6 = mcpm_entry_vectors
76 ldr r7, [r5, r7] @ r7 = mcpm_power_up_setup_phys
77 add r8, r5, r8 @ r8 = mcpm_sync
78 add r11, r5, r11 @ r11 = first_man_locks
79
80 mov r0, #MCPM_SYNC_CLUSTER_SIZE
81 mla r8, r0, r10, r8 @ r8 = sync cluster base
82
83 @ Signal that this CPU is coming UP:
84 mov r0, #CPU_COMING_UP
85 mov r5, #MCPM_SYNC_CPU_SIZE
86 mla r5, r9, r5, r8 @ r5 = sync cpu address
87 strb r0, [r5]
88
89 @ At this point, the cluster cannot unexpectedly enter the GOING_DOWN
90 @ state, because there is at least one active CPU (this CPU).
91
92 mov r0, #VLOCK_SIZE
93 mla r11, r0, r10, r11 @ r11 = cluster first man lock
94 mov r0, r11
95 mov r1, r9 @ cpu
96 bl vlock_trylock @ implies DMB
97
98 cmp r0, #0 @ failed to get the lock?
99 bne mcpm_setup_wait @ wait for cluster setup if so
100
101 ldrb r0, [r8, #MCPM_SYNC_CLUSTER_CLUSTER]
102 cmp r0, #CLUSTER_UP @ cluster already up?
103 bne mcpm_setup @ if not, set up the cluster
104
105 @ Otherwise, release the first man lock and skip setup:
106 mov r0, r11
107 bl vlock_unlock
108 b mcpm_setup_complete
109
110mcpm_setup:
111 @ Control dependency implies strb not observable before previous ldrb.
112
113 @ Signal that the cluster is being brought up:
114 mov r0, #INBOUND_COMING_UP
115 strb r0, [r8, #MCPM_SYNC_CLUSTER_INBOUND]
116 dmb
117
118 @ Any CPU trying to take the cluster into CLUSTER_GOING_DOWN from this
119 @ point onwards will observe INBOUND_COMING_UP and abort.
120
121 @ Wait for any previously-pending cluster teardown operations to abort
122 @ or complete:
123mcpm_teardown_wait:
124 ldrb r0, [r8, #MCPM_SYNC_CLUSTER_CLUSTER]
125 cmp r0, #CLUSTER_GOING_DOWN
126 bne first_man_setup
127 wfe
128 b mcpm_teardown_wait
129
130first_man_setup:
131 dmb
132
133 @ If the outbound gave up before teardown started, skip cluster setup:
134
135 cmp r0, #CLUSTER_UP
136 beq mcpm_setup_leave
137
138 @ power_up_setup is now responsible for setting up the cluster:
139
140 cmp r7, #0
141 mov r0, #1 @ second (cluster) affinity level
142 blxne r7 @ Call power_up_setup if defined
143 dmb
144
145 mov r0, #CLUSTER_UP
146 strb r0, [r8, #MCPM_SYNC_CLUSTER_CLUSTER]
147 dmb
148
149mcpm_setup_leave:
150 @ Leave the cluster setup critical section:
151
152 mov r0, #INBOUND_NOT_COMING_UP
153 strb r0, [r8, #MCPM_SYNC_CLUSTER_INBOUND]
154 dsb
155 sev
156
157 mov r0, r11
158 bl vlock_unlock @ implies DMB
159 b mcpm_setup_complete
160
161 @ In the contended case, non-first men wait here for cluster setup
162 @ to complete:
163mcpm_setup_wait:
164 ldrb r0, [r8, #MCPM_SYNC_CLUSTER_CLUSTER]
165 cmp r0, #CLUSTER_UP
166 wfene
167 bne mcpm_setup_wait
168 dmb
169
170mcpm_setup_complete:
171 @ If a platform-specific CPU setup hook is needed, it is
172 @ called from here.
173
174 cmp r7, #0
175 mov r0, #0 @ first (CPU) affinity level
176 blxne r7 @ Call power_up_setup if defined
177 dmb
178
179 @ Mark the CPU as up:
180
181 mov r0, #CPU_UP
182 strb r0, [r5]
183
184 @ Observability order of CPU_UP and opening of the gate does not matter.
185
186mcpm_entry_gated:
187 ldr r5, [r6, r4, lsl #2] @ r5 = CPU entry vector
188 cmp r5, #0
189 wfeeq
190 beq mcpm_entry_gated
191 dmb
192
193 pr_dbg "released\n"
194 bx r5
195
196 .align 2
197
1983: .word mcpm_entry_vectors - .
199 .word mcpm_power_up_setup_phys - 3b
200 .word mcpm_sync - 3b
201 .word first_man_locks - 3b
202
203ENDPROC(mcpm_entry_point)
204
205 .bss
206
207 .align CACHE_WRITEBACK_ORDER
208 .type first_man_locks, #object
209first_man_locks:
210 .space VLOCK_SIZE * MAX_NR_CLUSTERS
211 .align CACHE_WRITEBACK_ORDER
212
213 .type mcpm_entry_vectors, #object
214ENTRY(mcpm_entry_vectors)
215 .space 4 * MAX_NR_CLUSTERS * MAX_CPUS_PER_CLUSTER
216
217 .type mcpm_power_up_setup_phys, #object
218ENTRY(mcpm_power_up_setup_phys)
219 .space 4 @ set by mcpm_sync_init()
diff --git a/arch/arm/common/mcpm_platsmp.c b/arch/arm/common/mcpm_platsmp.c
new file mode 100644
index 000000000000..52b88d81b7bb
--- /dev/null
+++ b/arch/arm/common/mcpm_platsmp.c
@@ -0,0 +1,92 @@
1/*
2 * linux/arch/arm/mach-vexpress/mcpm_platsmp.c
3 *
4 * Created by: Nicolas Pitre, November 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Code to handle secondary CPU bringup and hotplug for the cluster power API.
12 */
13
14#include <linux/init.h>
15#include <linux/smp.h>
16#include <linux/spinlock.h>
17
18#include <linux/irqchip/arm-gic.h>
19
20#include <asm/mcpm.h>
21#include <asm/smp.h>
22#include <asm/smp_plat.h>
23
24static void __init simple_smp_init_cpus(void)
25{
26}
27
28static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle)
29{
30 unsigned int mpidr, pcpu, pcluster, ret;
31 extern void secondary_startup(void);
32
33 mpidr = cpu_logical_map(cpu);
34 pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
35 pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
36 pr_debug("%s: logical CPU %d is physical CPU %d cluster %d\n",
37 __func__, cpu, pcpu, pcluster);
38
39 mcpm_set_entry_vector(pcpu, pcluster, NULL);
40 ret = mcpm_cpu_power_up(pcpu, pcluster);
41 if (ret)
42 return ret;
43 mcpm_set_entry_vector(pcpu, pcluster, secondary_startup);
44 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
45 dsb_sev();
46 return 0;
47}
48
49static void __cpuinit mcpm_secondary_init(unsigned int cpu)
50{
51 mcpm_cpu_powered_up();
52 gic_secondary_init(0);
53}
54
55#ifdef CONFIG_HOTPLUG_CPU
56
57static int mcpm_cpu_disable(unsigned int cpu)
58{
59 /*
60 * We assume all CPUs may be shut down.
61 * This would be the hook to use for eventual Secure
62 * OS migration requests as described in the PSCI spec.
63 */
64 return 0;
65}
66
67static void mcpm_cpu_die(unsigned int cpu)
68{
69 unsigned int mpidr, pcpu, pcluster;
70 mpidr = read_cpuid_mpidr();
71 pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
72 pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
73 mcpm_set_entry_vector(pcpu, pcluster, NULL);
74 mcpm_cpu_power_down();
75}
76
77#endif
78
79static struct smp_operations __initdata mcpm_smp_ops = {
80 .smp_init_cpus = simple_smp_init_cpus,
81 .smp_boot_secondary = mcpm_boot_secondary,
82 .smp_secondary_init = mcpm_secondary_init,
83#ifdef CONFIG_HOTPLUG_CPU
84 .cpu_disable = mcpm_cpu_disable,
85 .cpu_die = mcpm_cpu_die,
86#endif
87};
88
89void __init mcpm_smp_set_ops(void)
90{
91 smp_set_ops(&mcpm_smp_ops);
92}
diff --git a/arch/arm/common/vlock.S b/arch/arm/common/vlock.S
new file mode 100644
index 000000000000..ff198583f683
--- /dev/null
+++ b/arch/arm/common/vlock.S
@@ -0,0 +1,108 @@
1/*
2 * vlock.S - simple voting lock implementation for ARM
3 *
4 * Created by: Dave Martin, 2012-08-16
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 *
17 * This algorithm is described in more detail in
18 * Documentation/arm/vlocks.txt.
19 */
20
21#include <linux/linkage.h>
22#include "vlock.h"
23
24/* Select different code if voting flags can fit in a single word. */
25#if VLOCK_VOTING_SIZE > 4
26#define FEW(x...)
27#define MANY(x...) x
28#else
29#define FEW(x...) x
30#define MANY(x...)
31#endif
32
33@ voting lock for first-man coordination
34
35.macro voting_begin rbase:req, rcpu:req, rscratch:req
36 mov \rscratch, #1
37 strb \rscratch, [\rbase, \rcpu]
38 dmb
39.endm
40
41.macro voting_end rbase:req, rcpu:req, rscratch:req
42 dmb
43 mov \rscratch, #0
44 strb \rscratch, [\rbase, \rcpu]
45 dsb
46 sev
47.endm
48
49/*
50 * The vlock structure must reside in Strongly-Ordered or Device memory.
51 * This implementation deliberately eliminates most of the barriers which
52 * would be required for other memory types, and assumes that independent
53 * writes to neighbouring locations within a cacheline do not interfere
54 * with one another.
55 */
56
57@ r0: lock structure base
58@ r1: CPU ID (0-based index within cluster)
59ENTRY(vlock_trylock)
60 add r1, r1, #VLOCK_VOTING_OFFSET
61
62 voting_begin r0, r1, r2
63
64 ldrb r2, [r0, #VLOCK_OWNER_OFFSET] @ check whether lock is held
65 cmp r2, #VLOCK_OWNER_NONE
66 bne trylock_fail @ fail if so
67
68 @ Control dependency implies strb not observable before previous ldrb.
69
70 strb r1, [r0, #VLOCK_OWNER_OFFSET] @ submit my vote
71
72 voting_end r0, r1, r2 @ implies DMB
73
74 @ Wait for the current round of voting to finish:
75
76 MANY( mov r3, #VLOCK_VOTING_OFFSET )
770:
78 MANY( ldr r2, [r0, r3] )
79 FEW( ldr r2, [r0, #VLOCK_VOTING_OFFSET] )
80 cmp r2, #0
81 wfene
82 bne 0b
83 MANY( add r3, r3, #4 )
84 MANY( cmp r3, #VLOCK_VOTING_OFFSET + VLOCK_VOTING_SIZE )
85 MANY( bne 0b )
86
87 @ Check who won:
88
89 dmb
90 ldrb r2, [r0, #VLOCK_OWNER_OFFSET]
91 eor r0, r1, r2 @ zero if I won, else nonzero
92 bx lr
93
94trylock_fail:
95 voting_end r0, r1, r2
96 mov r0, #1 @ nonzero indicates that I lost
97 bx lr
98ENDPROC(vlock_trylock)
99
100@ r0: lock structure base
101ENTRY(vlock_unlock)
102 dmb
103 mov r1, #VLOCK_OWNER_NONE
104 strb r1, [r0, #VLOCK_OWNER_OFFSET]
105 dsb
106 sev
107 bx lr
108ENDPROC(vlock_unlock)
diff --git a/arch/arm/common/vlock.h b/arch/arm/common/vlock.h
new file mode 100644
index 000000000000..3b441475a59b
--- /dev/null
+++ b/arch/arm/common/vlock.h
@@ -0,0 +1,29 @@
1/*
2 * vlock.h - simple voting lock implementation
3 *
4 * Created by: Dave Martin, 2012-08-16
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __VLOCK_H
18#define __VLOCK_H
19
20#include <asm/mcpm.h>
21
22/* Offsets and sizes are rounded to a word (4 bytes) */
23#define VLOCK_OWNER_OFFSET 0
24#define VLOCK_VOTING_OFFSET 4
25#define VLOCK_VOTING_SIZE ((MAX_CPUS_PER_CLUSTER + 3) / 4 * 4)
26#define VLOCK_SIZE (VLOCK_VOTING_OFFSET + VLOCK_VOTING_SIZE)
27#define VLOCK_OWNER_NONE 0
28
29#endif /* ! __VLOCK_H */
diff --git a/arch/arm/configs/ape6evm_defconfig b/arch/arm/configs/ape6evm_defconfig
new file mode 100644
index 000000000000..dab5a7dfadc6
--- /dev/null
+++ b/arch/arm/configs/ape6evm_defconfig
@@ -0,0 +1,95 @@
1CONFIG_SYSVIPC=y
2CONFIG_POSIX_MQUEUE=y
3CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y
5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=16
9CONFIG_CGROUPS=y
10CONFIG_CGROUP_SCHED=y
11CONFIG_KALLSYMS_ALL=y
12CONFIG_EMBEDDED=y
13CONFIG_PERF_EVENTS=y
14CONFIG_SLAB=y
15# CONFIG_BLOCK is not set
16CONFIG_ARCH_SHMOBILE=y
17CONFIG_ARCH_R8A73A4=y
18CONFIG_MACH_APE6EVM=y
19# CONFIG_ARM_THUMB is not set
20CONFIG_CPU_BPREDICT_DISABLE=y
21CONFIG_PL310_ERRATA_588369=y
22CONFIG_ARM_ERRATA_754322=y
23CONFIG_SMP=y
24CONFIG_SCHED_MC=y
25CONFIG_HAVE_ARM_ARCH_TIMER=y
26CONFIG_NR_CPUS=8
27CONFIG_AEABI=y
28CONFIG_HIGHMEM=y
29CONFIG_HIGHPTE=y
30# CONFIG_HW_PERF_EVENTS is not set
31# CONFIG_COMPACTION is not set
32# CONFIG_CROSS_MEMORY_ATTACH is not set
33CONFIG_ARM_APPENDED_DTB=y
34CONFIG_VFP=y
35CONFIG_NEON=y
36CONFIG_BINFMT_MISC=y
37CONFIG_NET=y
38CONFIG_PACKET=y
39CONFIG_UNIX=y
40CONFIG_XFRM_USER=y
41CONFIG_NET_KEY=y
42CONFIG_NET_KEY_MIGRATE=y
43CONFIG_INET=y
44CONFIG_IP_MULTICAST=y
45CONFIG_IP_PNP=y
46CONFIG_IP_PNP_DHCP=y
47# CONFIG_INET_LRO is not set
48# CONFIG_IPV6_SIT is not set
49CONFIG_NETFILTER=y
50CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
51# CONFIG_FW_LOADER_USER_HELPER is not set
52CONFIG_NETDEVICES=y
53# CONFIG_NET_CADENCE is not set
54CONFIG_SMC91X=y
55CONFIG_SMSC911X=y
56# CONFIG_INPUT_MOUSEDEV is not set
57# CONFIG_INPUT_KEYBOARD is not set
58# CONFIG_INPUT_MOUSE is not set
59# CONFIG_SERIO is not set
60CONFIG_SERIAL_NONSTANDARD=y
61CONFIG_SERIAL_SH_SCI=y
62CONFIG_SERIAL_SH_SCI_NR_UARTS=12
63CONFIG_SERIAL_SH_SCI_CONSOLE=y
64CONFIG_GPIO_SH_PFC=y
65CONFIG_GPIOLIB=y
66# CONFIG_HWMON is not set
67CONFIG_THERMAL=y
68CONFIG_RCAR_THERMAL=y
69CONFIG_REGULATOR=y
70CONFIG_REGULATOR_FIXED_VOLTAGE=y
71CONFIG_REGULATOR_GPIO=y
72# CONFIG_HID is not set
73# CONFIG_USB_SUPPORT is not set
74# CONFIG_IOMMU_SUPPORT is not set
75# CONFIG_DNOTIFY is not set
76CONFIG_TMPFS=y
77# CONFIG_MISC_FILESYSTEMS is not set
78CONFIG_NFS_FS=y
79CONFIG_NFS_V3_ACL=y
80CONFIG_NFS_V4=y
81CONFIG_NFS_V4_1=y
82CONFIG_ROOT_NFS=y
83CONFIG_MAGIC_SYSRQ=y
84CONFIG_ENABLE_DEFAULT_TRACERS=y
85CONFIG_CRYPTO_CBC=y
86CONFIG_CRYPTO_ECB=y
87CONFIG_CRYPTO_MD5=y
88CONFIG_CRYPTO_MICHAEL_MIC=y
89CONFIG_CRYPTO_TWOFISH=y
90CONFIG_CRC_CCITT=y
91CONFIG_CRC16=y
92CONFIG_CRC_T10DIF=y
93CONFIG_CRC_ITU_T=y
94CONFIG_CRC7=y
95CONFIG_LIBCRC32C=y
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
index 0b98100d2ae7..0f2d80da7378 100644
--- a/arch/arm/configs/armadillo800eva_defconfig
+++ b/arch/arm/configs/armadillo800eva_defconfig
@@ -20,15 +20,19 @@ CONFIG_ARCH_R8A7740=y
20CONFIG_MACH_ARMADILLO800EVA=y 20CONFIG_MACH_ARMADILLO800EVA=y
21# CONFIG_SH_TIMER_TMU is not set 21# CONFIG_SH_TIMER_TMU is not set
22CONFIG_ARM_THUMB=y 22CONFIG_ARM_THUMB=y
23CONFIG_CPU_BPREDICT_DISABLE=y
24CONFIG_CACHE_L2X0=y 23CONFIG_CACHE_L2X0=y
25CONFIG_ARM_ERRATA_430973=y 24CONFIG_ARM_ERRATA_430973=y
26CONFIG_ARM_ERRATA_458693=y 25CONFIG_ARM_ERRATA_458693=y
27CONFIG_ARM_ERRATA_460075=y 26CONFIG_ARM_ERRATA_460075=y
27CONFIG_PL310_ERRATA_588369=y
28CONFIG_ARM_ERRATA_720789=y 28CONFIG_ARM_ERRATA_720789=y
29CONFIG_PL310_ERRATA_727915=y
29CONFIG_ARM_ERRATA_743622=y 30CONFIG_ARM_ERRATA_743622=y
30CONFIG_ARM_ERRATA_751472=y 31CONFIG_ARM_ERRATA_751472=y
32CONFIG_PL310_ERRATA_753970=y
31CONFIG_ARM_ERRATA_754322=y 33CONFIG_ARM_ERRATA_754322=y
34CONFIG_PL310_ERRATA_769419=y
35CONFIG_ARM_ERRATA_775420=y
32CONFIG_AEABI=y 36CONFIG_AEABI=y
33# CONFIG_OABI_COMPAT is not set 37# CONFIG_OABI_COMPAT is not set
34CONFIG_FORCE_MAX_ZONEORDER=13 38CONFIG_FORCE_MAX_ZONEORDER=13
@@ -37,6 +41,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
37CONFIG_ARM_APPENDED_DTB=y 41CONFIG_ARM_APPENDED_DTB=y
38CONFIG_KEXEC=y 42CONFIG_KEXEC=y
39CONFIG_VFP=y 43CONFIG_VFP=y
44CONFIG_NEON=y
40# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 45# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
41CONFIG_PM_RUNTIME=y 46CONFIG_PM_RUNTIME=y
42CONFIG_NET=y 47CONFIG_NET=y
@@ -88,6 +93,7 @@ CONFIG_I2C=y
88CONFIG_I2C_GPIO=y 93CONFIG_I2C_GPIO=y
89CONFIG_I2C_SH_MOBILE=y 94CONFIG_I2C_SH_MOBILE=y
90# CONFIG_HWMON is not set 95# CONFIG_HWMON is not set
96CONFIG_REGULATOR=y
91CONFIG_MEDIA_SUPPORT=y 97CONFIG_MEDIA_SUPPORT=y
92CONFIG_VIDEO_DEV=y 98CONFIG_VIDEO_DEV=y
93CONFIG_MEDIA_CAMERA_SUPPORT=y 99CONFIG_MEDIA_CAMERA_SUPPORT=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 1ea959019fcd..047f2a415309 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -20,7 +20,7 @@ CONFIG_SOC_AT91SAM9263=y
20CONFIG_SOC_AT91SAM9G45=y 20CONFIG_SOC_AT91SAM9G45=y
21CONFIG_SOC_AT91SAM9X5=y 21CONFIG_SOC_AT91SAM9X5=y
22CONFIG_SOC_AT91SAM9N12=y 22CONFIG_SOC_AT91SAM9N12=y
23CONFIG_MACH_AT91SAM_DT=y 23CONFIG_MACH_AT91SAM9_DT=y
24CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 24CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
25CONFIG_AT91_TIMER_HZ=128 25CONFIG_AT91_TIMER_HZ=128
26CONFIG_AEABI=y 26CONFIG_AEABI=y
diff --git a/arch/arm/configs/at91sam9260_defconfig b/arch/arm/configs/at91sam9260_defconfig
index 0ea5d2c97fc4..05618eb694f8 100644
--- a/arch/arm/configs/at91sam9260_defconfig
+++ b/arch/arm/configs/at91sam9260_defconfig
@@ -22,7 +22,7 @@ CONFIG_MACH_QIL_A9260=y
22CONFIG_MACH_CPU9260=y 22CONFIG_MACH_CPU9260=y
23CONFIG_MACH_FLEXIBITY=y 23CONFIG_MACH_FLEXIBITY=y
24CONFIG_MACH_SNAPPER_9260=y 24CONFIG_MACH_SNAPPER_9260=y
25CONFIG_MACH_AT91SAM_DT=y 25CONFIG_MACH_AT91SAM9_DT=y
26CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 26CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
27# CONFIG_ARM_THUMB is not set 27# CONFIG_ARM_THUMB is not set
28CONFIG_ZBOOT_ROM_TEXT=0x0 28CONFIG_ZBOOT_ROM_TEXT=0x0
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig
index 3b1881033ad8..892e8287ed73 100644
--- a/arch/arm/configs/at91sam9g20_defconfig
+++ b/arch/arm/configs/at91sam9g20_defconfig
@@ -22,7 +22,7 @@ CONFIG_MACH_PCONTROL_G20=y
22CONFIG_MACH_GSIA18S=y 22CONFIG_MACH_GSIA18S=y
23CONFIG_MACH_USB_A9G20=y 23CONFIG_MACH_USB_A9G20=y
24CONFIG_MACH_SNAPPER_9260=y 24CONFIG_MACH_SNAPPER_9260=y
25CONFIG_MACH_AT91SAM_DT=y 25CONFIG_MACH_AT91SAM9_DT=y
26CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 26CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
27# CONFIG_ARM_THUMB is not set 27# CONFIG_ARM_THUMB is not set
28CONFIG_AEABI=y 28CONFIG_AEABI=y
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index 606d48f3b8f8..18964cdacd68 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -18,7 +18,7 @@ CONFIG_MODULE_UNLOAD=y
18CONFIG_ARCH_AT91=y 18CONFIG_ARCH_AT91=y
19CONFIG_ARCH_AT91SAM9G45=y 19CONFIG_ARCH_AT91SAM9G45=y
20CONFIG_MACH_AT91SAM9M10G45EK=y 20CONFIG_MACH_AT91SAM9M10G45EK=y
21CONFIG_MACH_AT91SAM_DT=y 21CONFIG_MACH_AT91SAM9_DT=y
22CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 22CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
23CONFIG_AT91_SLOW_CLOCK=y 23CONFIG_AT91_SLOW_CLOCK=y
24CONFIG_AEABI=y 24CONFIG_AEABI=y
@@ -173,7 +173,6 @@ CONFIG_MMC=y
173# CONFIG_MMC_BLOCK_BOUNCE is not set 173# CONFIG_MMC_BLOCK_BOUNCE is not set
174CONFIG_SDIO_UART=m 174CONFIG_SDIO_UART=m
175CONFIG_MMC_ATMELMCI=y 175CONFIG_MMC_ATMELMCI=y
176CONFIG_MMC_ATMELMCI_DMA=y
177CONFIG_LEDS_ATMEL_PWM=y 176CONFIG_LEDS_ATMEL_PWM=y
178CONFIG_LEDS_GPIO=y 177CONFIG_LEDS_GPIO=y
179CONFIG_LEDS_TRIGGER_TIMER=y 178CONFIG_LEDS_TRIGGER_TIMER=y
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
index af472e4ed451..ce987211a609 100644
--- a/arch/arm/configs/bcm2835_defconfig
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -29,6 +29,8 @@ CONFIG_EMBEDDED=y
29CONFIG_PROFILING=y 29CONFIG_PROFILING=y
30CONFIG_OPROFILE=y 30CONFIG_OPROFILE=y
31CONFIG_JUMP_LABEL=y 31CONFIG_JUMP_LABEL=y
32CONFIG_ARCH_MULTI_V6=y
33# CONFIG_ARCH_MULTI_V7 is not set
32CONFIG_ARCH_BCM2835=y 34CONFIG_ARCH_BCM2835=y
33CONFIG_PREEMPT_VOLUNTARY=y 35CONFIG_PREEMPT_VOLUNTARY=y
34CONFIG_AEABI=y 36CONFIG_AEABI=y
@@ -59,10 +61,13 @@ CONFIG_DEVTMPFS_MOUNT=y
59CONFIG_SERIAL_AMBA_PL011=y 61CONFIG_SERIAL_AMBA_PL011=y
60CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 62CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
61CONFIG_TTY_PRINTK=y 63CONFIG_TTY_PRINTK=y
62# CONFIG_HW_RANDOM is not set 64CONFIG_HW_RANDOM=y
65CONFIG_HW_RANDOM_BCM2835=y
63CONFIG_I2C=y 66CONFIG_I2C=y
64CONFIG_I2C_CHARDEV=y 67CONFIG_I2C_CHARDEV=y
65CONFIG_I2C_BCM2835=y 68CONFIG_I2C_BCM2835=y
69CONFIG_SPI=y
70CONFIG_SPI_BCM2835=y
66CONFIG_GPIO_SYSFS=y 71CONFIG_GPIO_SYSFS=y
67# CONFIG_HWMON is not set 72# CONFIG_HWMON is not set
68# CONFIG_USB_SUPPORT is not set 73# CONFIG_USB_SUPPORT is not set
@@ -108,9 +113,5 @@ CONFIG_TEST_KSTRTOX=y
108CONFIG_STRICT_DEVMEM=y 113CONFIG_STRICT_DEVMEM=y
109CONFIG_DEBUG_LL=y 114CONFIG_DEBUG_LL=y
110CONFIG_EARLY_PRINTK=y 115CONFIG_EARLY_PRINTK=y
111# CONFIG_XZ_DEC_X86 is not set
112# CONFIG_XZ_DEC_POWERPC is not set
113# CONFIG_XZ_DEC_IA64 is not set
114# CONFIG_XZ_DEC_ARM is not set 116# CONFIG_XZ_DEC_ARM is not set
115# CONFIG_XZ_DEC_ARMTHUMB is not set 117# CONFIG_XZ_DEC_ARMTHUMB is not set
116# CONFIG_XZ_DEC_SPARC is not set
diff --git a/arch/arm/configs/cns3420vb_defconfig b/arch/arm/configs/cns3420vb_defconfig
index 313627adf46c..b1ff5cdba9a1 100644
--- a/arch/arm/configs/cns3420vb_defconfig
+++ b/arch/arm/configs/cns3420vb_defconfig
@@ -19,8 +19,11 @@ CONFIG_MODULE_FORCE_UNLOAD=y
19CONFIG_MODVERSIONS=y 19CONFIG_MODVERSIONS=y
20# CONFIG_BLK_DEV_BSG is not set 20# CONFIG_BLK_DEV_BSG is not set
21CONFIG_IOSCHED_CFQ=m 21CONFIG_IOSCHED_CFQ=m
22CONFIG_ARCH_MULTI_V6=y
23#CONFIG_ARCH_MULTI_V7 is not set
22CONFIG_ARCH_CNS3XXX=y 24CONFIG_ARCH_CNS3XXX=y
23CONFIG_MACH_CNS3420VB=y 25CONFIG_MACH_CNS3420VB=y
26CONFIG_DEBUG_CNS3XXX=y
24CONFIG_AEABI=y 27CONFIG_AEABI=y
25CONFIG_ZBOOT_ROM_TEXT=0x0 28CONFIG_ZBOOT_ROM_TEXT=0x0
26CONFIG_ZBOOT_ROM_BSS=0x0 29CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig
index 9aaad36a1728..7c868139bdb0 100644
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ b/arch/arm/configs/da8xx_omapl_defconfig
@@ -5,6 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_CGROUPS=y
8CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
9CONFIG_EXPERT=y 10CONFIG_EXPERT=y
10CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 3edc78a40b66..c86fd75e181a 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -5,6 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_CGROUPS=y
8CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
9CONFIG_EXPERT=y 10CONFIG_EXPERT=y
10CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index 3fe8dae8d32d..4364eff5b01e 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -75,6 +75,8 @@ CONFIG_I2C_MV64XXX=y
75CONFIG_SPI=y 75CONFIG_SPI=y
76CONFIG_SPI_ORION=y 76CONFIG_SPI_ORION=y
77# CONFIG_HWMON is not set 77# CONFIG_HWMON is not set
78CONFIG_THERMAL=y
79CONFIG_DOVE_THERMAL=y
78CONFIG_USB=y 80CONFIG_USB=y
79CONFIG_USB_EHCI_HCD=y 81CONFIG_USB_EHCI_HCD=y
80CONFIG_USB_EHCI_ROOT_HUB_TT=y 82CONFIG_USB_EHCI_ROOT_HUB_TT=y
diff --git a/arch/arm/configs/h7201_defconfig b/arch/arm/configs/h7201_defconfig
deleted file mode 100644
index bee94d29655e..000000000000
--- a/arch/arm/configs/h7201_defconfig
+++ /dev/null
@@ -1,27 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y
5CONFIG_MODULES=y
6CONFIG_ARCH_H720X=y
7CONFIG_ARCH_H7201=y
8CONFIG_ZBOOT_ROM_TEXT=0x0
9CONFIG_ZBOOT_ROM_BSS=0x0
10CONFIG_FPE_NWFPE=y
11CONFIG_MTD=y
12CONFIG_MTD_DEBUG=y
13CONFIG_MTD_PARTITIONS=y
14CONFIG_MTD_CHAR=y
15CONFIG_MTD_BLOCK=y
16CONFIG_MTD_CFI=y
17CONFIG_MTD_CFI_ADV_OPTIONS=y
18CONFIG_MTD_CFI_INTELEXT=y
19CONFIG_BLK_DEV_RAM=y
20CONFIG_BLK_DEV_RAM_SIZE=8192
21# CONFIG_INPUT_KEYBOARD is not set
22# CONFIG_INPUT_MOUSE is not set
23# CONFIG_VGA_CONSOLE is not set
24CONFIG_SOUND=m
25CONFIG_EXT2_FS=y
26CONFIG_JFFS2_FS=y
27CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/h7202_defconfig b/arch/arm/configs/h7202_defconfig
deleted file mode 100644
index e16d3f372e2a..000000000000
--- a/arch/arm/configs/h7202_defconfig
+++ /dev/null
@@ -1,47 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_MODULES=y
5CONFIG_ARCH_H720X=y
6CONFIG_ARCH_H7202=y
7# CONFIG_ARM_THUMB is not set
8CONFIG_ZBOOT_ROM_TEXT=0x0
9CONFIG_ZBOOT_ROM_BSS=0x0
10CONFIG_CMDLINE="console=ttyS0,19200"
11CONFIG_FPE_NWFPE=y
12CONFIG_FPE_NWFPE_XP=y
13CONFIG_NET=y
14CONFIG_UNIX=y
15CONFIG_INET=y
16CONFIG_IP_PNP=y
17CONFIG_IP_PNP_BOOTP=y
18# CONFIG_IPV6 is not set
19CONFIG_MTD=y
20CONFIG_MTD_PARTITIONS=y
21CONFIG_MTD_CMDLINE_PARTS=y
22CONFIG_MTD_CHAR=y
23CONFIG_MTD_BLOCK=y
24CONFIG_MTD_CFI=y
25CONFIG_MTD_CFI_INTELEXT=y
26CONFIG_MTD_H720X=y
27CONFIG_NETDEVICES=y
28CONFIG_NET_ETHERNET=y
29CONFIG_SERIAL_8250=y
30CONFIG_SERIAL_8250_CONSOLE=y
31CONFIG_FB=y
32CONFIG_FB_MODE_HELPERS=y
33# CONFIG_VGA_CONSOLE is not set
34CONFIG_USB_GADGET=m
35CONFIG_USB_ZERO=m
36CONFIG_USB_GADGETFS=m
37CONFIG_USB_MASS_STORAGE=m
38CONFIG_USB_G_SERIAL=m
39CONFIG_EXT2_FS=y
40CONFIG_TMPFS=y
41CONFIG_JFFS2_FS=y
42CONFIG_NFS_FS=y
43CONFIG_NFS_V3=y
44CONFIG_MAGIC_SYSRQ=y
45CONFIG_DEBUG_KERNEL=y
46CONFIG_DEBUG_INFO=y
47CONFIG_DEBUG_USER=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index e36b01025321..088d6c11a0fa 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -188,6 +188,7 @@ CONFIG_USB_EHCI_HCD=y
188CONFIG_USB_EHCI_MXC=y 188CONFIG_USB_EHCI_MXC=y
189CONFIG_USB_CHIPIDEA=y 189CONFIG_USB_CHIPIDEA=y
190CONFIG_USB_CHIPIDEA_HOST=y 190CONFIG_USB_CHIPIDEA_HOST=y
191CONFIG_USB_PHY=y
191CONFIG_USB_MXS_PHY=y 192CONFIG_USB_MXS_PHY=y
192CONFIG_USB_STORAGE=y 193CONFIG_USB_STORAGE=y
193CONFIG_MMC=y 194CONFIG_MMC=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 13482ea58b09..a1d8252e9ec7 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -10,45 +10,48 @@ CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
12CONFIG_ARCH_KIRKWOOD=y 12CONFIG_ARCH_KIRKWOOD=y
13CONFIG_MACH_D2NET_V2=y
13CONFIG_MACH_DB88F6281_BP=y 14CONFIG_MACH_DB88F6281_BP=y
15CONFIG_MACH_DOCKSTAR=y
16CONFIG_MACH_ESATA_SHEEVAPLUG=y
17CONFIG_MACH_GURUPLUG=y
18CONFIG_MACH_INETSPACE_V2=y
19CONFIG_MACH_MV88F6281GTW_GE=y
20CONFIG_MACH_NET2BIG_V2=y
21CONFIG_MACH_NET5BIG_V2=y
22CONFIG_MACH_NETSPACE_MAX_V2=y
23CONFIG_MACH_NETSPACE_V2=y
24CONFIG_MACH_OPENRD_BASE=y
25CONFIG_MACH_OPENRD_CLIENT=y
26CONFIG_MACH_OPENRD_ULTIMATE=y
14CONFIG_MACH_RD88F6192_NAS=y 27CONFIG_MACH_RD88F6192_NAS=y
15CONFIG_MACH_RD88F6281=y 28CONFIG_MACH_RD88F6281=y
16CONFIG_MACH_MV88F6281GTW_GE=y
17CONFIG_MACH_SHEEVAPLUG=y 29CONFIG_MACH_SHEEVAPLUG=y
18CONFIG_MACH_ESATA_SHEEVAPLUG=y 30CONFIG_MACH_T5325=y
19CONFIG_MACH_GURUPLUG=y 31CONFIG_MACH_TS219=y
20CONFIG_MACH_DREAMPLUG_DT=y 32CONFIG_MACH_TS41X=y
21CONFIG_MACH_ICONNECT_DT=y 33CONFIG_MACH_CLOUDBOX_DT=y
22CONFIG_MACH_DLINK_KIRKWOOD_DT=y 34CONFIG_MACH_DLINK_KIRKWOOD_DT=y
23CONFIG_MACH_IB62X0_DT=y
24CONFIG_MACH_TS219_DT=y
25CONFIG_MACH_DOCKSTAR_DT=y 35CONFIG_MACH_DOCKSTAR_DT=y
36CONFIG_MACH_DREAMPLUG_DT=y
26CONFIG_MACH_GOFLEXNET_DT=y 37CONFIG_MACH_GOFLEXNET_DT=y
27CONFIG_MACH_LSXL_DT=y 38CONFIG_MACH_GURUPLUG_DT=y
39CONFIG_MACH_IB62X0_DT=y
40CONFIG_MACH_ICONNECT_DT=y
41CONFIG_MACH_INETSPACE_V2_DT=y
28CONFIG_MACH_IOMEGA_IX2_200_DT=y 42CONFIG_MACH_IOMEGA_IX2_200_DT=y
29CONFIG_MACH_KM_KIRKWOOD_DT=y 43CONFIG_MACH_KM_KIRKWOOD_DT=y
30CONFIG_MACH_INETSPACE_V2_DT=y 44CONFIG_MACH_LSXL_DT=y
31CONFIG_MACH_MPLCEC4_DT=y 45CONFIG_MACH_MPLCEC4_DT=y
32CONFIG_MACH_NETSPACE_V2_DT=y
33CONFIG_MACH_NETSPACE_MAX_V2_DT=y
34CONFIG_MACH_NETSPACE_LITE_V2_DT=y 46CONFIG_MACH_NETSPACE_LITE_V2_DT=y
47CONFIG_MACH_NETSPACE_MAX_V2_DT=y
35CONFIG_MACH_NETSPACE_MINI_V2_DT=y 48CONFIG_MACH_NETSPACE_MINI_V2_DT=y
49CONFIG_MACH_NETSPACE_V2_DT=y
50CONFIG_MACH_NSA310_DT=y
36CONFIG_MACH_OPENBLOCKS_A6_DT=y 51CONFIG_MACH_OPENBLOCKS_A6_DT=y
52CONFIG_MACH_READYNAS_DT=y
37CONFIG_MACH_TOPKICK_DT=y 53CONFIG_MACH_TOPKICK_DT=y
38CONFIG_MACH_TS219=y 54CONFIG_MACH_TS219_DT=y
39CONFIG_MACH_TS41X=y
40CONFIG_MACH_DOCKSTAR=y
41CONFIG_MACH_OPENRD_BASE=y
42CONFIG_MACH_OPENRD_CLIENT=y
43CONFIG_MACH_OPENRD_ULTIMATE=y
44CONFIG_MACH_NETSPACE_V2=y
45CONFIG_MACH_INETSPACE_V2=y
46CONFIG_MACH_NETSPACE_MAX_V2=y
47CONFIG_MACH_D2NET_V2=y
48CONFIG_MACH_NET2BIG_V2=y
49CONFIG_MACH_NET5BIG_V2=y
50CONFIG_MACH_T5325=y
51CONFIG_MACH_NSA310_DT=y
52# CONFIG_CPU_FEROCEON_OLD_ID is not set 55# CONFIG_CPU_FEROCEON_OLD_ID is not set
53CONFIG_PREEMPT=y 56CONFIG_PREEMPT=y
54CONFIG_AEABI=y 57CONFIG_AEABI=y
@@ -56,7 +59,6 @@ CONFIG_AEABI=y
56CONFIG_ZBOOT_ROM_TEXT=0x0 59CONFIG_ZBOOT_ROM_TEXT=0x0
57CONFIG_ZBOOT_ROM_BSS=0x0 60CONFIG_ZBOOT_ROM_BSS=0x0
58CONFIG_CPU_IDLE=y 61CONFIG_CPU_IDLE=y
59CONFIG_CPU_IDLE_KIRKWOOD=y
60CONFIG_NET=y 62CONFIG_NET=y
61CONFIG_PACKET=y 63CONFIG_PACKET=y
62CONFIG_UNIX=y 64CONFIG_UNIX=y
@@ -119,6 +121,8 @@ CONFIG_SPI=y
119CONFIG_SPI_ORION=y 121CONFIG_SPI_ORION=y
120CONFIG_GPIO_SYSFS=y 122CONFIG_GPIO_SYSFS=y
121# CONFIG_HWMON is not set 123# CONFIG_HWMON is not set
124CONFIG_THERMAL=y
125CONFIG_KIRKWOOD_THERMAL=y
122CONFIG_WATCHDOG=y 126CONFIG_WATCHDOG=y
123CONFIG_ORION_WATCHDOG=y 127CONFIG_ORION_WATCHDOG=y
124CONFIG_HID_DRAGONRISE=y 128CONFIG_HID_DRAGONRISE=y
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
index 670c3b60f936..f6e585b353a4 100644
--- a/arch/arm/configs/kzm9g_defconfig
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -33,7 +33,6 @@ CONFIG_NO_HZ=y
33CONFIG_HIGH_RES_TIMERS=y 33CONFIG_HIGH_RES_TIMERS=y
34CONFIG_SMP=y 34CONFIG_SMP=y
35CONFIG_SCHED_MC=y 35CONFIG_SCHED_MC=y
36CONFIG_PREEMPT=y
37CONFIG_AEABI=y 36CONFIG_AEABI=y
38# CONFIG_OABI_COMPAT is not set 37# CONFIG_OABI_COMPAT is not set
39CONFIG_HIGHMEM=y 38CONFIG_HIGHMEM=y
@@ -86,7 +85,6 @@ CONFIG_I2C_SH_MOBILE=y
86CONFIG_GPIO_PCF857X=y 85CONFIG_GPIO_PCF857X=y
87# CONFIG_HWMON is not set 86# CONFIG_HWMON is not set
88CONFIG_REGULATOR=y 87CONFIG_REGULATOR=y
89CONFIG_REGULATOR_DUMMY=y
90CONFIG_FB=y 88CONFIG_FB=y
91CONFIG_FB_SH_MOBILE_LCDC=y 89CONFIG_FB_SH_MOBILE_LCDC=y
92CONFIG_FRAMEBUFFER_CONSOLE=y 90CONFIG_FRAMEBUFFER_CONSOLE=y
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig
index 92386b20bd09..398a367ffce8 100644
--- a/arch/arm/configs/lpc32xx_defconfig
+++ b/arch/arm/configs/lpc32xx_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_NO_HZ=y 2CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
@@ -18,6 +17,7 @@ CONFIG_MODULE_UNLOAD=y
18# CONFIG_BLK_DEV_BSG is not set 17# CONFIG_BLK_DEV_BSG is not set
19CONFIG_PARTITION_ADVANCED=y 18CONFIG_PARTITION_ADVANCED=y
20CONFIG_ARCH_LPC32XX=y 19CONFIG_ARCH_LPC32XX=y
20CONFIG_GPIO_PCA953X=y
21CONFIG_KEYBOARD_GPIO_POLLED=y 21CONFIG_KEYBOARD_GPIO_POLLED=y
22CONFIG_PREEMPT=y 22CONFIG_PREEMPT=y
23CONFIG_AEABI=y 23CONFIG_AEABI=y
@@ -48,6 +48,8 @@ CONFIG_IPV6=y
48CONFIG_IPV6_PRIVACY=y 48CONFIG_IPV6_PRIVACY=y
49# CONFIG_WIRELESS is not set 49# CONFIG_WIRELESS is not set
50CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 50CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
51CONFIG_DEVTMPFS=y
52CONFIG_DEVTMPFS_MOUNT=y
51# CONFIG_FW_LOADER is not set 53# CONFIG_FW_LOADER is not set
52CONFIG_MTD=y 54CONFIG_MTD=y
53CONFIG_MTD_CMDLINE_PARTS=y 55CONFIG_MTD_CMDLINE_PARTS=y
@@ -55,7 +57,6 @@ CONFIG_MTD_CHAR=y
55CONFIG_MTD_BLOCK=y 57CONFIG_MTD_BLOCK=y
56CONFIG_MTD_M25P80=y 58CONFIG_MTD_M25P80=y
57CONFIG_MTD_NAND=y 59CONFIG_MTD_NAND=y
58CONFIG_MTD_NAND_MUSEUM_IDS=y
59CONFIG_MTD_NAND_SLC_LPC32XX=y 60CONFIG_MTD_NAND_SLC_LPC32XX=y
60CONFIG_MTD_NAND_MLC_LPC32XX=y 61CONFIG_MTD_NAND_MLC_LPC32XX=y
61CONFIG_BLK_DEV_LOOP=y 62CONFIG_BLK_DEV_LOOP=y
@@ -70,7 +71,6 @@ CONFIG_BLK_DEV_SD=y
70CONFIG_NETDEVICES=y 71CONFIG_NETDEVICES=y
71CONFIG_MII=y 72CONFIG_MII=y
72# CONFIG_NET_VENDOR_BROADCOM is not set 73# CONFIG_NET_VENDOR_BROADCOM is not set
73# CONFIG_NET_VENDOR_CHELSIO is not set
74# CONFIG_NET_VENDOR_CIRRUS is not set 74# CONFIG_NET_VENDOR_CIRRUS is not set
75# CONFIG_NET_VENDOR_FARADAY is not set 75# CONFIG_NET_VENDOR_FARADAY is not set
76# CONFIG_NET_VENDOR_INTEL is not set 76# CONFIG_NET_VENDOR_INTEL is not set
@@ -84,7 +84,6 @@ CONFIG_LPC_ENET=y
84# CONFIG_NET_VENDOR_STMICRO is not set 84# CONFIG_NET_VENDOR_STMICRO is not set
85CONFIG_SMSC_PHY=y 85CONFIG_SMSC_PHY=y
86# CONFIG_WLAN is not set 86# CONFIG_WLAN is not set
87CONFIG_INPUT_MATRIXKMAP=y
88# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 87# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
89CONFIG_INPUT_MOUSEDEV_SCREEN_X=240 88CONFIG_INPUT_MOUSEDEV_SCREEN_X=240
90CONFIG_INPUT_MOUSEDEV_SCREEN_Y=320 89CONFIG_INPUT_MOUSEDEV_SCREEN_Y=320
@@ -108,6 +107,19 @@ CONFIG_I2C_PNX=y
108CONFIG_SPI=y 107CONFIG_SPI=y
109CONFIG_SPI_PL022=y 108CONFIG_SPI_PL022=y
110CONFIG_GPIO_SYSFS=y 109CONFIG_GPIO_SYSFS=y
110CONFIG_GPIO_GENERIC_PLATFORM=y
111CONFIG_GPIO_EM=y
112CONFIG_GPIO_PL061=y
113CONFIG_GPIO_MAX7300=y
114CONFIG_GPIO_MAX732X=y
115CONFIG_GPIO_PCF857X=y
116CONFIG_GPIO_SX150X=y
117CONFIG_GPIO_ADP5588=y
118CONFIG_GPIO_ADNP=y
119CONFIG_GPIO_MAX7301=y
120CONFIG_GPIO_MCP23S08=y
121CONFIG_GPIO_MC33880=y
122CONFIG_GPIO_74X164=y
111CONFIG_SENSORS_DS620=y 123CONFIG_SENSORS_DS620=y
112CONFIG_SENSORS_MAX6639=y 124CONFIG_SENSORS_MAX6639=y
113CONFIG_WATCHDOG=y 125CONFIG_WATCHDOG=y
@@ -134,6 +146,7 @@ CONFIG_SND_DEBUG_VERBOSE=y
134# CONFIG_SND_SPI is not set 146# CONFIG_SND_SPI is not set
135CONFIG_SND_SOC=y 147CONFIG_SND_SOC=y
136CONFIG_USB=y 148CONFIG_USB=y
149CONFIG_USB_PHY=y
137CONFIG_USB_OHCI_HCD=y 150CONFIG_USB_OHCI_HCD=y
138CONFIG_USB_STORAGE=y 151CONFIG_USB_STORAGE=y
139CONFIG_USB_GADGET=y 152CONFIG_USB_GADGET=y
@@ -143,6 +156,7 @@ CONFIG_USB_G_SERIAL=m
143CONFIG_MMC=y 156CONFIG_MMC=y
144# CONFIG_MMC_BLOCK_BOUNCE is not set 157# CONFIG_MMC_BLOCK_BOUNCE is not set
145CONFIG_MMC_ARMMMCI=y 158CONFIG_MMC_ARMMMCI=y
159CONFIG_MMC_SPI=y
146CONFIG_NEW_LEDS=y 160CONFIG_NEW_LEDS=y
147CONFIG_LEDS_CLASS=y 161CONFIG_LEDS_CLASS=y
148CONFIG_LEDS_PCA9532=y 162CONFIG_LEDS_PCA9532=y
diff --git a/arch/arm/configs/mackerel_defconfig b/arch/arm/configs/mackerel_defconfig
index 7594b3aff259..9fb11895b2e2 100644
--- a/arch/arm/configs/mackerel_defconfig
+++ b/arch/arm/configs/mackerel_defconfig
@@ -75,6 +75,7 @@ CONFIG_I2C=y
75CONFIG_I2C_SH_MOBILE=y 75CONFIG_I2C_SH_MOBILE=y
76# CONFIG_HWMON is not set 76# CONFIG_HWMON is not set
77# CONFIG_MFD_SUPPORT is not set 77# CONFIG_MFD_SUPPORT is not set
78CONFIG_REGULATOR=y
78CONFIG_FB=y 79CONFIG_FB=y
79CONFIG_FB_MODE_HELPERS=y 80CONFIG_FB_MODE_HELPERS=y
80CONFIG_FB_SH_MOBILE_LCDC=y 81CONFIG_FB_SH_MOBILE_LCDC=y
@@ -94,6 +95,9 @@ CONFIG_USB_RENESAS_USBHS=y
94CONFIG_USB_STORAGE=y 95CONFIG_USB_STORAGE=y
95CONFIG_USB_GADGET=y 96CONFIG_USB_GADGET=y
96CONFIG_USB_RENESAS_USBHS_UDC=y 97CONFIG_USB_RENESAS_USBHS_UDC=y
98CONFIG_MMC=y
99CONFIG_MMC_SDHI=y
100CONFIG_MMC_SH_MMCIF=y
97CONFIG_DMADEVICES=y 101CONFIG_DMADEVICES=y
98CONFIG_SH_DMAE=y 102CONFIG_SH_DMAE=y
99CONFIG_EXT2_FS=y 103CONFIG_EXT2_FS=y
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index afb17d630d44..494e70aeb9e1 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -49,6 +49,10 @@ CONFIG_DEVTMPFS_MOUNT=y
49# CONFIG_FW_LOADER is not set 49# CONFIG_FW_LOADER is not set
50CONFIG_SCSI=y 50CONFIG_SCSI=y
51CONFIG_BLK_DEV_SD=y 51CONFIG_BLK_DEV_SD=y
52CONFIG_ATA=y
53CONFIG_ATA_SFF=y
54CONFIG_ATA_BMDMA=y
55CONFIG_SATA_RCAR=y
52CONFIG_NETDEVICES=y 56CONFIG_NETDEVICES=y
53# CONFIG_NET_VENDOR_BROADCOM is not set 57# CONFIG_NET_VENDOR_BROADCOM is not set
54# CONFIG_NET_VENDOR_FARADAY is not set 58# CONFIG_NET_VENDOR_FARADAY is not set
@@ -75,6 +79,7 @@ CONFIG_I2C_RCAR=y
75CONFIG_SPI=y 79CONFIG_SPI=y
76CONFIG_SPI_SH_HSPI=y 80CONFIG_SPI_SH_HSPI=y
77CONFIG_GPIO_SYSFS=y 81CONFIG_GPIO_SYSFS=y
82CONFIG_GPIO_RCAR=y
78# CONFIG_HWMON is not set 83# CONFIG_HWMON is not set
79CONFIG_THERMAL=y 84CONFIG_THERMAL=y
80CONFIG_RCAR_THERMAL=y 85CONFIG_RCAR_THERMAL=y
@@ -88,6 +93,9 @@ CONFIG_USB_OHCI_HCD=y
88CONFIG_USB_OHCI_HCD_PLATFORM=y 93CONFIG_USB_OHCI_HCD_PLATFORM=y
89CONFIG_USB_EHCI_HCD_PLATFORM=y 94CONFIG_USB_EHCI_HCD_PLATFORM=y
90CONFIG_USB_STORAGE=y 95CONFIG_USB_STORAGE=y
96CONFIG_NEW_LEDS=y
97CONFIG_LEDS_CLASS=y
98CONFIG_LEDS_GPIO=y
91CONFIG_UIO=y 99CONFIG_UIO=y
92CONFIG_UIO_PDRV_GENIRQ=y 100CONFIG_UIO_PDRV_GENIRQ=y
93# CONFIG_IOMMU_SUPPORT is not set 101# CONFIG_IOMMU_SUPPORT is not set
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
index 2b8f7affc1eb..690b5f9c7462 100644
--- a/arch/arm/configs/msm_defconfig
+++ b/arch/arm/configs/msm_defconfig
@@ -1,72 +1,137 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y
2CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
3CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
4CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
5CONFIG_SLAB=y 7CONFIG_SYSCTL_SYSCALL=y
6# CONFIG_BLK_DEV_BSG is not set 8CONFIG_KALLSYMS_ALL=y
7# CONFIG_IOSCHED_DEADLINE is not set 9CONFIG_EMBEDDED=y
8# CONFIG_IOSCHED_CFQ is not set 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
9CONFIG_ARCH_MSM=y 20CONFIG_ARCH_MSM=y
10CONFIG_MACH_HALIBUT=y 21CONFIG_ARCH_MSM8X60=y
11CONFIG_NO_HZ=y 22CONFIG_ARCH_MSM8960=y
12CONFIG_HIGH_RES_TIMERS=y 23CONFIG_SMP=y
13CONFIG_PREEMPT=y 24CONFIG_PREEMPT=y
14CONFIG_AEABI=y 25CONFIG_AEABI=y
15# CONFIG_OABI_COMPAT is not set 26CONFIG_HIGHMEM=y
16CONFIG_ZBOOT_ROM_TEXT=0x0 27CONFIG_HIGHPTE=y
17CONFIG_ZBOOT_ROM_BSS=0x0 28CONFIG_CLEANCACHE=y
18CONFIG_CMDLINE="mem=64M console=ttyMSM,115200n8" 29CONFIG_CC_STACKPROTECTOR=y
19CONFIG_PM=y 30CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_AUTO_ZRELADDR=y
33CONFIG_VFP=y
34CONFIG_NEON=y
35# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
20CONFIG_NET=y 36CONFIG_NET=y
37CONFIG_PACKET=y
21CONFIG_UNIX=y 38CONFIG_UNIX=y
22CONFIG_INET=y 39CONFIG_INET=y
40CONFIG_IP_ADVANCED_ROUTER=y
41CONFIG_IP_MULTIPLE_TABLES=y
42CONFIG_IP_ROUTE_VERBOSE=y
43CONFIG_IP_PNP=y
44CONFIG_IP_PNP_DHCP=y
23# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
24# CONFIG_INET_XFRM_MODE_TUNNEL is not set 46# CONFIG_INET_XFRM_MODE_TUNNEL is not set
25# CONFIG_INET_XFRM_MODE_BEET is not set 47# CONFIG_INET_XFRM_MODE_BEET is not set
26# CONFIG_INET_DIAG is not set 48# CONFIG_INET_LRO is not set
27# CONFIG_IPV6 is not set 49# CONFIG_IPV6 is not set
28CONFIG_MTD=y 50CONFIG_CFG80211=y
29CONFIG_MTD_PARTITIONS=y 51CONFIG_RFKILL=y
30CONFIG_MTD_CMDLINE_PARTS=y 52CONFIG_BLK_DEV_LOOP=y
31CONFIG_MTD_CHAR=y 53CONFIG_BLK_DEV_RAM=y
32CONFIG_MTD_BLOCK=y 54CONFIG_SCSI=y
55CONFIG_SCSI_TGT=y
56CONFIG_BLK_DEV_SD=y
57CONFIG_CHR_DEV_SG=y
58CONFIG_CHR_DEV_SCH=y
59CONFIG_SCSI_MULTI_LUN=y
60CONFIG_SCSI_CONSTANTS=y
61CONFIG_SCSI_LOGGING=y
62CONFIG_SCSI_SCAN_ASYNC=y
33CONFIG_NETDEVICES=y 63CONFIG_NETDEVICES=y
34CONFIG_DUMMY=y 64CONFIG_DUMMY=y
35CONFIG_NET_ETHERNET=y 65CONFIG_PHYLIB=y
36CONFIG_SMC91X=y 66CONFIG_SLIP=y
37CONFIG_PPP=y 67CONFIG_SLIP_COMPRESSED=y
38CONFIG_PPP_ASYNC=y 68CONFIG_SLIP_MODE_SLIP6=y
39CONFIG_PPP_DEFLATE=y 69CONFIG_USB_USBNET=y
40CONFIG_PPP_BSDCOMP=y 70# CONFIG_USB_NET_AX8817X is not set
41# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 71# CONFIG_USB_NET_ZAURUS is not set
42CONFIG_INPUT_EVDEV=y 72CONFIG_INPUT_EVDEV=y
43# CONFIG_KEYBOARD_ATKBD is not set 73# CONFIG_KEYBOARD_ATKBD is not set
44# CONFIG_INPUT_MOUSE is not set 74# CONFIG_MOUSE_PS2 is not set
75CONFIG_INPUT_JOYSTICK=y
45CONFIG_INPUT_TOUCHSCREEN=y 76CONFIG_INPUT_TOUCHSCREEN=y
46CONFIG_INPUT_MISC=y 77CONFIG_INPUT_MISC=y
47# CONFIG_SERIO is not set 78CONFIG_INPUT_UINPUT=y
48CONFIG_VT_HW_CONSOLE_BINDING=y 79CONFIG_SERIO_LIBPS2=y
80# CONFIG_LEGACY_PTYS is not set
49CONFIG_SERIAL_MSM=y 81CONFIG_SERIAL_MSM=y
50CONFIG_SERIAL_MSM_CONSOLE=y 82CONFIG_SERIAL_MSM_CONSOLE=y
51# CONFIG_LEGACY_PTYS is not set 83CONFIG_HW_RANDOM=y
52# CONFIG_HW_RANDOM is not set
53CONFIG_I2C=y 84CONFIG_I2C=y
54# CONFIG_HWMON is not set 85CONFIG_I2C_CHARDEV=y
55CONFIG_VIDEO_OUTPUT_CONTROL=y 86CONFIG_SPI=y
87CONFIG_SSBI=y
88CONFIG_DEBUG_GPIO=y
89CONFIG_GPIO_SYSFS=y
90CONFIG_POWER_SUPPLY=y
91CONFIG_THERMAL=y
92CONFIG_REGULATOR=y
93CONFIG_MEDIA_SUPPORT=y
56CONFIG_FB=y 94CONFIG_FB=y
57CONFIG_FB_MODE_HELPERS=y 95CONFIG_SOUND=y
58CONFIG_FB_TILEBLITTING=y 96CONFIG_SND=y
59CONFIG_FB_MSM=y 97CONFIG_SND_DYNAMIC_MINORS=y
60# CONFIG_VGA_CONSOLE is not set 98# CONFIG_SND_ARM is not set
61CONFIG_FRAMEBUFFER_CONSOLE=y 99# CONFIG_SND_SPI is not set
100# CONFIG_SND_USB is not set
101CONFIG_SND_SOC=y
102CONFIG_HID_BATTERY_STRENGTH=y
103CONFIG_USB=y
104CONFIG_USB_PHY=y
105CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
106CONFIG_USB_MON=y
107CONFIG_USB_EHCI_HCD=y
108CONFIG_USB_EHCI_MSM=y
109CONFIG_USB_ACM=y
110CONFIG_USB_SERIAL=y
111CONFIG_USB_GADGET=y
112CONFIG_USB_GADGET_DEBUG_FILES=y
113CONFIG_USB_GADGET_VBUS_DRAW=500
62CONFIG_NEW_LEDS=y 114CONFIG_NEW_LEDS=y
63CONFIG_LEDS_CLASS=y 115CONFIG_RTC_CLASS=y
64CONFIG_INOTIFY=y 116CONFIG_STAGING=y
117CONFIG_MSM_IOMMU=y
118CONFIG_EXT2_FS=y
119CONFIG_EXT2_FS_XATTR=y
120CONFIG_EXT3_FS=y
121# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
122CONFIG_EXT4_FS=y
123CONFIG_FUSE_FS=y
124CONFIG_VFAT_FS=y
65CONFIG_TMPFS=y 125CONFIG_TMPFS=y
126CONFIG_NFS_FS=y
127CONFIG_NFS_V3_ACL=y
128CONFIG_NFS_V4=y
129CONFIG_CIFS=y
130CONFIG_PRINTK_TIME=y
66CONFIG_MAGIC_SYSRQ=y 131CONFIG_MAGIC_SYSRQ=y
67CONFIG_DEBUG_KERNEL=y 132CONFIG_LOCKUP_DETECTOR=y
68CONFIG_SCHEDSTATS=y 133# CONFIG_DETECT_HUNG_TASK is not set
69CONFIG_DEBUG_MUTEXES=y 134# CONFIG_SCHED_DEBUG is not set
70CONFIG_DEBUG_SPINLOCK_SLEEP=y 135CONFIG_TIMER_STATS=y
71CONFIG_DEBUG_INFO=y 136CONFIG_DEBUG_INFO=y
72CONFIG_DEBUG_LL=y 137CONFIG_DYNAMIC_DEBUG=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e31d442343c8..2e67a272df70 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -3,13 +3,19 @@ CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_ARCH_MVEBU=y 4CONFIG_ARCH_MVEBU=y
5CONFIG_MACH_ARMADA_370=y 5CONFIG_MACH_ARMADA_370=y
6CONFIG_ARCH_SIRF=y
6CONFIG_MACH_ARMADA_XP=y 7CONFIG_MACH_ARMADA_XP=y
7CONFIG_ARCH_HIGHBANK=y 8CONFIG_ARCH_HIGHBANK=y
8CONFIG_ARCH_SOCFPGA=y 9CONFIG_ARCH_SOCFPGA=y
9CONFIG_ARCH_SUNXI=y 10CONFIG_ARCH_SUNXI=y
11CONFIG_ARCH_WM8850=y
10# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set 12# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set
11CONFIG_ARCH_ZYNQ=y 13CONFIG_ARCH_ZYNQ=y
12CONFIG_ARM_ERRATA_754322=y 14CONFIG_ARM_ERRATA_754322=y
15CONFIG_PLAT_SPEAR=y
16CONFIG_ARCH_SPEAR13XX=y
17CONFIG_MACH_SPEAR1310=y
18CONFIG_MACH_SPEAR1340=y
13CONFIG_SMP=y 19CONFIG_SMP=y
14CONFIG_ARM_ARCH_TIMER=y 20CONFIG_ARM_ARCH_TIMER=y
15CONFIG_AEABI=y 21CONFIG_AEABI=y
@@ -23,6 +29,7 @@ CONFIG_BLK_DEV_SD=y
23CONFIG_ATA=y 29CONFIG_ATA=y
24CONFIG_SATA_HIGHBANK=y 30CONFIG_SATA_HIGHBANK=y
25CONFIG_SATA_MV=y 31CONFIG_SATA_MV=y
32CONFIG_SATA_AHCI_PLATFORM=y
26CONFIG_NETDEVICES=y 33CONFIG_NETDEVICES=y
27CONFIG_NET_CALXEDA_XGMAC=y 34CONFIG_NET_CALXEDA_XGMAC=y
28CONFIG_SMSC911X=y 35CONFIG_SMSC911X=y
@@ -31,17 +38,26 @@ CONFIG_SERIO_AMBAKMI=y
31CONFIG_SERIAL_8250=y 38CONFIG_SERIAL_8250=y
32CONFIG_SERIAL_8250_CONSOLE=y 39CONFIG_SERIAL_8250_CONSOLE=y
33CONFIG_SERIAL_8250_DW=y 40CONFIG_SERIAL_8250_DW=y
41CONFIG_KEYBOARD_SPEAR=y
34CONFIG_SERIAL_AMBA_PL011=y 42CONFIG_SERIAL_AMBA_PL011=y
35CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 43CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
36CONFIG_SERIAL_OF_PLATFORM=y 44CONFIG_SERIAL_OF_PLATFORM=y
45CONFIG_SERIAL_SIRFSOC=y
46CONFIG_SERIAL_SIRFSOC_CONSOLE=y
47CONFIG_SERIAL_VT8500=y
48CONFIG_SERIAL_VT8500_CONSOLE=y
37CONFIG_IPMI_HANDLER=y 49CONFIG_IPMI_HANDLER=y
38CONFIG_IPMI_SI=y 50CONFIG_IPMI_SI=y
39CONFIG_I2C=y 51CONFIG_I2C=y
40CONFIG_I2C_DESIGNWARE_PLATFORM=y 52CONFIG_I2C_DESIGNWARE_PLATFORM=y
53CONFIG_I2C_SIRF=y
41CONFIG_SPI=y 54CONFIG_SPI=y
42CONFIG_SPI_PL022=y 55CONFIG_SPI_PL022=y
56CONFIG_SPI_SIRF=y
57CONFIG_GPIO_PL061=y
43CONFIG_FB=y 58CONFIG_FB=y
44CONFIG_FB_ARMCLCD=y 59CONFIG_FB_ARMCLCD=y
60CONFIG_FB_WM8505=y
45CONFIG_FRAMEBUFFER_CONSOLE=y 61CONFIG_FRAMEBUFFER_CONSOLE=y
46CONFIG_USB=y 62CONFIG_USB=y
47CONFIG_USB_ISP1760_HCD=y 63CONFIG_USB_ISP1760_HCD=y
@@ -50,11 +66,18 @@ CONFIG_MMC=y
50CONFIG_MMC_ARMMMCI=y 66CONFIG_MMC_ARMMMCI=y
51CONFIG_MMC_SDHCI=y 67CONFIG_MMC_SDHCI=y
52CONFIG_MMC_SDHCI_PLTFM=y 68CONFIG_MMC_SDHCI_PLTFM=y
69CONFIG_MMC_SDHCI_SPEAR=y
70CONFIG_MMC_WMT=y
53CONFIG_EDAC=y 71CONFIG_EDAC=y
54CONFIG_EDAC_MM_EDAC=y 72CONFIG_EDAC_MM_EDAC=y
55CONFIG_EDAC_HIGHBANK_MC=y 73CONFIG_EDAC_HIGHBANK_MC=y
56CONFIG_EDAC_HIGHBANK_L2=y 74CONFIG_EDAC_HIGHBANK_L2=y
57CONFIG_RTC_CLASS=y 75CONFIG_RTC_CLASS=y
58CONFIG_RTC_DRV_PL031=y 76CONFIG_RTC_DRV_PL031=y
77CONFIG_RTC_DRV_VT8500=y
78CONFIG_PWM=y
79CONFIG_PWM_VT8500=y
59CONFIG_DMADEVICES=y 80CONFIG_DMADEVICES=y
60CONFIG_PL330_DMA=y 81CONFIG_PL330_DMA=y
82CONFIG_SIRF_DMA=y
83CONFIG_DW_DMAC=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 2ec8119cff73..f3e8ae001ff1 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -46,9 +46,16 @@ CONFIG_I2C_MV64XXX=y
46CONFIG_MTD=y 46CONFIG_MTD=y
47CONFIG_MTD_CHAR=y 47CONFIG_MTD_CHAR=y
48CONFIG_MTD_M25P80=y 48CONFIG_MTD_M25P80=y
49CONFIG_MTD_CFI=y
50CONFIG_MTD_CFI_INTELEXT=y
51CONFIG_MTD_CFI_AMDSTD=y
52CONFIG_MTD_CFI_STAA=y
53CONFIG_MTD_PHYSMAP_OF=y
49CONFIG_SERIAL_8250_DW=y 54CONFIG_SERIAL_8250_DW=y
50CONFIG_GPIOLIB=y 55CONFIG_GPIOLIB=y
51CONFIG_GPIO_SYSFS=y 56CONFIG_GPIO_SYSFS=y
57CONFIG_THERMAL=y
58CONFIG_ARMADA_THERMAL=y
52CONFIG_USB_SUPPORT=y 59CONFIG_USB_SUPPORT=y
53CONFIG_USB=y 60CONFIG_USB=y
54CONFIG_USB_EHCI_HCD=y 61CONFIG_USB_EHCI_HCD=y
@@ -65,6 +72,8 @@ CONFIG_RTC_DRV_S35390A=y
65CONFIG_RTC_DRV_MV=y 72CONFIG_RTC_DRV_MV=y
66CONFIG_DMADEVICES=y 73CONFIG_DMADEVICES=y
67CONFIG_MV_XOR=y 74CONFIG_MV_XOR=y
75CONFIG_MEMORY=y
76CONFIG_MVEBU_DEVBUS=y
68# CONFIG_IOMMU_SUPPORT is not set 77# CONFIG_IOMMU_SUPPORT is not set
69CONFIG_EXT2_FS=y 78CONFIG_EXT2_FS=y
70CONFIG_EXT3_FS=y 79CONFIG_EXT3_FS=y
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 6a99e30f81d2..1d6d8fb7f4a1 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -22,8 +22,8 @@ CONFIG_MODVERSIONS=y
22CONFIG_BLK_DEV_INTEGRITY=y 22CONFIG_BLK_DEV_INTEGRITY=y
23# CONFIG_IOSCHED_DEADLINE is not set 23# CONFIG_IOSCHED_DEADLINE is not set
24# CONFIG_IOSCHED_CFQ is not set 24# CONFIG_IOSCHED_CFQ is not set
25# CONFIG_ARCH_MULTI_V7 is not set
25CONFIG_ARCH_MXS=y 26CONFIG_ARCH_MXS=y
26CONFIG_MACH_MXS_DT=y
27# CONFIG_ARM_THUMB is not set 27# CONFIG_ARM_THUMB is not set
28CONFIG_PREEMPT_VOLUNTARY=y 28CONFIG_PREEMPT_VOLUNTARY=y
29CONFIG_AEABI=y 29CONFIG_AEABI=y
@@ -75,7 +75,7 @@ CONFIG_REALTEK_PHY=y
75CONFIG_MICREL_PHY=y 75CONFIG_MICREL_PHY=y
76# CONFIG_WLAN is not set 76# CONFIG_WLAN is not set
77# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 77# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
78CONFIG_INPUT_EVDEV=m 78CONFIG_INPUT_EVDEV=y
79# CONFIG_INPUT_KEYBOARD is not set 79# CONFIG_INPUT_KEYBOARD is not set
80# CONFIG_INPUT_MOUSE is not set 80# CONFIG_INPUT_MOUSE is not set
81CONFIG_INPUT_TOUCHSCREEN=y 81CONFIG_INPUT_TOUCHSCREEN=y
@@ -99,6 +99,8 @@ CONFIG_SPI_MXS=y
99CONFIG_DEBUG_GPIO=y 99CONFIG_DEBUG_GPIO=y
100CONFIG_GPIO_SYSFS=y 100CONFIG_GPIO_SYSFS=y
101# CONFIG_HWMON is not set 101# CONFIG_HWMON is not set
102CONFIG_WATCHDOG=y
103CONFIG_STMP3XXX_RTC_WATCHDOG=y
102CONFIG_REGULATOR=y 104CONFIG_REGULATOR=y
103CONFIG_REGULATOR_FIXED_VOLTAGE=y 105CONFIG_REGULATOR_FIXED_VOLTAGE=y
104CONFIG_FB=y 106CONFIG_FB=y
@@ -120,8 +122,10 @@ CONFIG_USB_EHCI_HCD=y
120CONFIG_USB_CHIPIDEA=y 122CONFIG_USB_CHIPIDEA=y
121CONFIG_USB_CHIPIDEA_HOST=y 123CONFIG_USB_CHIPIDEA_HOST=y
122CONFIG_USB_STORAGE=y 124CONFIG_USB_STORAGE=y
125CONFIG_USB_PHY=y
123CONFIG_USB_MXS_PHY=y 126CONFIG_USB_MXS_PHY=y
124CONFIG_MMC=y 127CONFIG_MMC=y
128CONFIG_MMC_UNSAFE_RESUME=y
125CONFIG_MMC_MXS=y 129CONFIG_MMC_MXS=y
126CONFIG_NEW_LEDS=y 130CONFIG_NEW_LEDS=y
127CONFIG_LEDS_CLASS=y 131CONFIG_LEDS_CLASS=y
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 86cfd2959c47..b01e7632ed2e 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -1,11 +1,9 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
10CONFIG_EXPERT=y 8CONFIG_EXPERT=y
11CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
@@ -13,6 +11,7 @@ CONFIG_SLAB=y
13CONFIG_MODULES=y 11CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y 12CONFIG_MODULE_UNLOAD=y
15# CONFIG_BLK_DEV_BSG is not set 13# CONFIG_BLK_DEV_BSG is not set
14# CONFIG_ARCH_MULTI_V7 is not set
16CONFIG_ARCH_NOMADIK=y 15CONFIG_ARCH_NOMADIK=y
17CONFIG_MACH_NOMADIK_8815NHK=y 16CONFIG_MACH_NOMADIK_8815NHK=y
18CONFIG_PREEMPT=y 17CONFIG_PREEMPT=y
@@ -20,7 +19,6 @@ CONFIG_AEABI=y
20CONFIG_ZBOOT_ROM_TEXT=0x0 19CONFIG_ZBOOT_ROM_TEXT=0x0
21CONFIG_ZBOOT_ROM_BSS=0x0 20CONFIG_ZBOOT_ROM_BSS=0x0
22CONFIG_FPE_NWFPE=y 21CONFIG_FPE_NWFPE=y
23CONFIG_PM=y
24CONFIG_NET=y 22CONFIG_NET=y
25CONFIG_PACKET=y 23CONFIG_PACKET=y
26CONFIG_UNIX=y 24CONFIG_UNIX=y
@@ -32,14 +30,10 @@ CONFIG_IP_PNP=y
32CONFIG_IP_PNP_DHCP=y 30CONFIG_IP_PNP_DHCP=y
33CONFIG_IP_PNP_BOOTP=y 31CONFIG_IP_PNP_BOOTP=y
34CONFIG_NET_IPIP=y 32CONFIG_NET_IPIP=y
35CONFIG_NET_IPGRE=y
36CONFIG_NET_IPGRE_BROADCAST=y
37CONFIG_IP_MROUTE=y 33CONFIG_IP_MROUTE=y
38# CONFIG_INET_LRO is not set 34# CONFIG_INET_LRO is not set
39# CONFIG_IPV6 is not set 35# CONFIG_IPV6 is not set
40CONFIG_BT=m 36CONFIG_BT=m
41CONFIG_BT_L2CAP=m
42CONFIG_BT_SCO=m
43CONFIG_BT_RFCOMM=m 37CONFIG_BT_RFCOMM=m
44CONFIG_BT_RFCOMM_TTY=y 38CONFIG_BT_RFCOMM_TTY=y
45CONFIG_BT_BNEP=m 39CONFIG_BT_BNEP=m
@@ -53,14 +47,16 @@ CONFIG_BT_HCIVHCI=m
53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 47CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
54CONFIG_MTD=y 48CONFIG_MTD=y
55CONFIG_MTD_TESTS=m 49CONFIG_MTD_TESTS=m
50CONFIG_MTD_CMDLINE_PARTS=y
56CONFIG_MTD_CHAR=y 51CONFIG_MTD_CHAR=y
57CONFIG_MTD_BLOCK=y 52CONFIG_MTD_BLOCK=y
58CONFIG_MTD_NAND=y
59CONFIG_MTD_NAND_ECC_SMC=y 53CONFIG_MTD_NAND_ECC_SMC=y
54CONFIG_MTD_NAND=y
60CONFIG_MTD_NAND_FSMC=y 55CONFIG_MTD_NAND_FSMC=y
61CONFIG_MTD_ONENAND=y 56CONFIG_MTD_ONENAND=y
62CONFIG_MTD_ONENAND_VERIFY_WRITE=y 57CONFIG_MTD_ONENAND_VERIFY_WRITE=y
63CONFIG_MTD_ONENAND_GENERIC=y 58CONFIG_MTD_ONENAND_GENERIC=y
59CONFIG_PROC_DEVICETREE=y
64CONFIG_BLK_DEV_LOOP=y 60CONFIG_BLK_DEV_LOOP=y
65CONFIG_BLK_DEV_CRYPTOLOOP=y 61CONFIG_BLK_DEV_CRYPTOLOOP=y
66CONFIG_BLK_DEV_RAM=y 62CONFIG_BLK_DEV_RAM=y
@@ -72,47 +68,48 @@ CONFIG_SCSI_CONSTANTS=y
72CONFIG_SCSI_LOGGING=y 68CONFIG_SCSI_LOGGING=y
73CONFIG_SCSI_SCAN_ASYNC=y 69CONFIG_SCSI_SCAN_ASYNC=y
74CONFIG_NETDEVICES=y 70CONFIG_NETDEVICES=y
71CONFIG_NETCONSOLE=m
75CONFIG_TUN=y 72CONFIG_TUN=y
76CONFIG_NET_ETHERNET=y
77CONFIG_SMC91X=y 73CONFIG_SMC91X=y
78CONFIG_PPP=m 74CONFIG_PPP=m
79CONFIG_PPP_ASYNC=m
80CONFIG_PPP_SYNC_TTY=m
81CONFIG_PPP_DEFLATE=m
82CONFIG_PPP_BSDCOMP=m 75CONFIG_PPP_BSDCOMP=m
76CONFIG_PPP_DEFLATE=m
83CONFIG_PPP_MPPE=m 77CONFIG_PPP_MPPE=m
84CONFIG_PPPOE=m 78CONFIG_PPPOE=m
85CONFIG_NETCONSOLE=m 79CONFIG_PPP_ASYNC=m
80CONFIG_PPP_SYNC_TTY=m
86# CONFIG_INPUT_MOUSEDEV is not set 81# CONFIG_INPUT_MOUSEDEV is not set
87CONFIG_INPUT_EVDEV=y 82CONFIG_INPUT_EVDEV=y
88# CONFIG_KEYBOARD_ATKBD is not set 83# CONFIG_KEYBOARD_ATKBD is not set
89# CONFIG_MOUSE_PS2 is not set 84# CONFIG_MOUSE_PS2 is not set
90# CONFIG_SERIO is not set 85# CONFIG_SERIO is not set
86# CONFIG_LEGACY_PTYS is not set
91CONFIG_SERIAL_AMBA_PL011=y 87CONFIG_SERIAL_AMBA_PL011=y
92CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 88CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
93# CONFIG_LEGACY_PTYS is not set 89CONFIG_HW_RANDOM=y
94# CONFIG_HW_RANDOM is not set 90CONFIG_HW_RANDOM_NOMADIK=y
95CONFIG_I2C=y
96CONFIG_I2C_CHARDEV=y 91CONFIG_I2C_CHARDEV=y
97CONFIG_I2C_GPIO=y 92CONFIG_I2C_GPIO=y
93CONFIG_I2C_NOMADIK=y
98CONFIG_DEBUG_GPIO=y 94CONFIG_DEBUG_GPIO=y
99CONFIG_PINCTRL_NOMADIK=y
100# CONFIG_HWMON is not set 95# CONFIG_HWMON is not set
101# CONFIG_VGA_CONSOLE is not set 96CONFIG_MMC=y
97CONFIG_MMC_CLKGATE=y
98CONFIG_MMC_ARMMMCI=y
102CONFIG_RTC_CLASS=y 99CONFIG_RTC_CLASS=y
100CONFIG_RTC_DRV_PL031=y
101CONFIG_DMADEVICES=y
102CONFIG_AMBA_PL08X=y
103CONFIG_EXT2_FS=y 103CONFIG_EXT2_FS=y
104CONFIG_EXT3_FS=y 104CONFIG_EXT3_FS=y
105CONFIG_INOTIFY=y
106CONFIG_FUSE_FS=y 105CONFIG_FUSE_FS=y
107CONFIG_MSDOS_FS=y 106CONFIG_MSDOS_FS=y
108CONFIG_VFAT_FS=y 107CONFIG_VFAT_FS=y
109CONFIG_TMPFS=y 108CONFIG_TMPFS=y
110CONFIG_JFFS2_FS=y 109CONFIG_JFFS2_FS=y
111CONFIG_NFS_FS=y 110CONFIG_NFS_FS=y
112CONFIG_NFS_V3=y
113CONFIG_NFS_V3_ACL=y 111CONFIG_NFS_V3_ACL=y
114CONFIG_ROOT_NFS=y 112CONFIG_ROOT_NFS=y
115CONFIG_SMB_FS=m
116CONFIG_CIFS=m 113CONFIG_CIFS=m
117CONFIG_CIFS_WEAK_PW_HASH=y 114CONFIG_CIFS_WEAK_PW_HASH=y
118CONFIG_NLS_CODEPAGE_437=y 115CONFIG_NLS_CODEPAGE_437=y
@@ -120,12 +117,11 @@ CONFIG_NLS_ASCII=y
120CONFIG_NLS_ISO8859_1=y 117CONFIG_NLS_ISO8859_1=y
121CONFIG_NLS_ISO8859_15=y 118CONFIG_NLS_ISO8859_15=y
122# CONFIG_ENABLE_MUST_CHECK is not set 119# CONFIG_ENABLE_MUST_CHECK is not set
123CONFIG_DEBUG_KERNEL=y 120CONFIG_DEBUG_FS=y
124# CONFIG_SCHED_DEBUG is not set 121# CONFIG_SCHED_DEBUG is not set
125# CONFIG_DEBUG_PREEMPT is not set 122# CONFIG_DEBUG_PREEMPT is not set
126# CONFIG_DEBUG_BUGVERBOSE is not set 123# CONFIG_DEBUG_BUGVERBOSE is not set
127CONFIG_DEBUG_INFO=y 124CONFIG_DEBUG_INFO=y
128# CONFIG_RCU_CPU_STALL_DETECTOR is not set
129CONFIG_CRYPTO_MD5=y 125CONFIG_CRYPTO_MD5=y
130CONFIG_CRYPTO_SHA1=y 126CONFIG_CRYPTO_SHA1=y
131CONFIG_CRYPTO_DES=y 127CONFIG_CRYPTO_DES=y
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index 42eab9a2a0fd..7e0ebb64a7f9 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -195,6 +195,7 @@ CONFIG_SND_SOC=y
195CONFIG_SND_OMAP_SOC=y 195CONFIG_SND_OMAP_SOC=y
196# CONFIG_USB_HID is not set 196# CONFIG_USB_HID is not set
197CONFIG_USB=y 197CONFIG_USB=y
198CONFIG_USB_PHY=y
198CONFIG_USB_DEBUG=y 199CONFIG_USB_DEBUG=y
199CONFIG_USB_DEVICEFS=y 200CONFIG_USB_DEVICEFS=y
200# CONFIG_USB_DEVICE_CLASS is not set 201# CONFIG_USB_DEVICE_CLASS is not set
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index bd07864f14a0..33903ca0d879 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -93,6 +93,7 @@ CONFIG_BLK_DEV_RAM_SIZE=16384
93CONFIG_SENSORS_LIS3LV02D=m 93CONFIG_SENSORS_LIS3LV02D=m
94CONFIG_SENSORS_TSL2550=m 94CONFIG_SENSORS_TSL2550=m
95CONFIG_SENSORS_LIS3_I2C=m 95CONFIG_SENSORS_LIS3_I2C=m
96CONFIG_BMP085_I2C=m
96CONFIG_SCSI=y 97CONFIG_SCSI=y
97CONFIG_BLK_DEV_SD=y 98CONFIG_BLK_DEV_SD=y
98CONFIG_SCSI_MULTI_LUN=y 99CONFIG_SCSI_MULTI_LUN=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
new file mode 100644
index 000000000000..4d0dc3c16063
--- /dev/null
+++ b/arch/arm/configs/sama5_defconfig
@@ -0,0 +1,181 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_IRQ_DOMAIN_DEBUG=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED=y
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y
10CONFIG_SLAB=y
11CONFIG_MODULES=y
12CONFIG_MODULE_FORCE_LOAD=y
13CONFIG_MODULE_UNLOAD=y
14CONFIG_MODULE_FORCE_UNLOAD=y
15# CONFIG_LBDAF is not set
16# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set
19CONFIG_ARCH_AT91=y
20CONFIG_SOC_SAM_V7=y
21CONFIG_SOC_SAMA5D3=y
22CONFIG_MACH_SAMA5_DT=y
23CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
24CONFIG_AEABI=y
25# CONFIG_OABI_COMPAT is not set
26CONFIG_UACCESS_WITH_MEMCPY=y
27CONFIG_ZBOOT_ROM_TEXT=0x0
28CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"
30CONFIG_AUTO_ZRELADDR=y
31CONFIG_VFP=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33CONFIG_PM_RUNTIME=y
34CONFIG_PM_DEBUG=y
35CONFIG_PM_ADVANCED_DEBUG=y
36CONFIG_NET=y
37CONFIG_PACKET=y
38CONFIG_UNIX=y
39CONFIG_INET=y
40CONFIG_IP_MULTICAST=y
41CONFIG_IP_PNP=y
42# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
43# CONFIG_INET_XFRM_MODE_TUNNEL is not set
44# CONFIG_INET_XFRM_MODE_BEET is not set
45# CONFIG_INET_LRO is not set
46# CONFIG_INET_DIAG is not set
47CONFIG_IPV6=y
48# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
49# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
50# CONFIG_INET6_XFRM_MODE_BEET is not set
51CONFIG_IPV6_SIT_6RD=y
52CONFIG_CAN=y
53CONFIG_CAN_AT91=y
54CONFIG_CFG80211=y
55CONFIG_MAC80211=y
56CONFIG_MAC80211_LEDS=y
57CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
58CONFIG_DEVTMPFS=y
59CONFIG_DEVTMPFS_MOUNT=y
60# CONFIG_STANDALONE is not set
61# CONFIG_PREVENT_FIRMWARE_BUILD is not set
62CONFIG_MTD=y
63CONFIG_MTD_CMDLINE_PARTS=y
64CONFIG_MTD_CHAR=y
65CONFIG_MTD_BLOCK=y
66CONFIG_MTD_CFI=y
67CONFIG_MTD_M25P80=y
68CONFIG_MTD_NAND=y
69CONFIG_MTD_NAND_ATMEL=y
70CONFIG_MTD_UBI=y
71CONFIG_BLK_DEV_LOOP=y
72CONFIG_BLK_DEV_RAM=y
73CONFIG_BLK_DEV_RAM_COUNT=4
74CONFIG_BLK_DEV_RAM_SIZE=8192
75CONFIG_ATMEL_TCLIB=y
76CONFIG_ATMEL_SSC=y
77CONFIG_EEPROM_AT24=y
78CONFIG_SCSI=y
79CONFIG_BLK_DEV_SD=y
80CONFIG_SCSI_MULTI_LUN=y
81# CONFIG_SCSI_LOWLEVEL is not set
82CONFIG_NETDEVICES=y
83CONFIG_MII=y
84CONFIG_MACB=y
85# CONFIG_NET_VENDOR_BROADCOM is not set
86# CONFIG_NET_VENDOR_CIRRUS is not set
87# CONFIG_NET_VENDOR_FARADAY is not set
88# CONFIG_NET_VENDOR_INTEL is not set
89# CONFIG_NET_VENDOR_MARVELL is not set
90# CONFIG_NET_VENDOR_MICREL is not set
91# CONFIG_NET_VENDOR_MICROCHIP is not set
92# CONFIG_NET_VENDOR_NATSEMI is not set
93# CONFIG_NET_VENDOR_SEEQ is not set
94# CONFIG_NET_VENDOR_SMSC is not set
95# CONFIG_NET_VENDOR_STMICRO is not set
96# CONFIG_NET_VENDOR_WIZNET is not set
97CONFIG_MICREL_PHY=y
98# CONFIG_WLAN is not set
99# CONFIG_INPUT_MOUSEDEV is not set
100CONFIG_INPUT_EVDEV=y
101# CONFIG_KEYBOARD_ATKBD is not set
102CONFIG_KEYBOARD_QT1070=y
103CONFIG_KEYBOARD_GPIO=y
104# CONFIG_INPUT_MOUSE is not set
105CONFIG_INPUT_TOUCHSCREEN=y
106CONFIG_TOUCHSCREEN_ATMEL_MXT=y
107CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
108# CONFIG_SERIO is not set
109CONFIG_LEGACY_PTY_COUNT=4
110CONFIG_SERIAL_ATMEL=y
111CONFIG_SERIAL_ATMEL_CONSOLE=y
112CONFIG_HW_RANDOM=y
113CONFIG_I2C=y
114CONFIG_I2C_CHARDEV=y
115CONFIG_I2C_AT91=y
116CONFIG_I2C_GPIO=y
117CONFIG_SPI=y
118CONFIG_SPI_ATMEL=y
119CONFIG_SPI_GPIO=y
120CONFIG_GPIO_SYSFS=y
121# CONFIG_HWMON is not set
122CONFIG_SSB=m
123CONFIG_FB=y
124CONFIG_BACKLIGHT_LCD_SUPPORT=y
125# CONFIG_LCD_CLASS_DEVICE is not set
126CONFIG_BACKLIGHT_CLASS_DEVICE=y
127# CONFIG_BACKLIGHT_GENERIC is not set
128CONFIG_FRAMEBUFFER_CONSOLE=y
129# CONFIG_HID_GENERIC is not set
130CONFIG_USB=y
131CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
132CONFIG_USB_EHCI_HCD=y
133CONFIG_USB_OHCI_HCD=y
134CONFIG_USB_ACM=y
135CONFIG_USB_STORAGE=y
136CONFIG_USB_GADGET=y
137CONFIG_USB_AT91=y
138CONFIG_USB_MASS_STORAGE=m
139CONFIG_MMC=y
140# CONFIG_MMC_BLOCK_BOUNCE is not set
141CONFIG_MMC_ATMELMCI=y
142CONFIG_NEW_LEDS=y
143CONFIG_LEDS_CLASS=y
144CONFIG_LEDS_GPIO=y
145CONFIG_LEDS_TRIGGER_TIMER=y
146CONFIG_LEDS_TRIGGER_HEARTBEAT=y
147CONFIG_LEDS_TRIGGER_GPIO=y
148CONFIG_RTC_CLASS=y
149CONFIG_RTC_DRV_AT91RM9200=y
150CONFIG_DMADEVICES=y
151# CONFIG_IOMMU_SUPPORT is not set
152CONFIG_IIO=y
153CONFIG_AT91_ADC=y
154CONFIG_EXT2_FS=y
155CONFIG_FANOTIFY=y
156CONFIG_VFAT_FS=y
157CONFIG_TMPFS=y
158CONFIG_JFFS2_FS=y
159CONFIG_JFFS2_SUMMARY=y
160CONFIG_UBIFS_FS=y
161CONFIG_NFS_FS=y
162CONFIG_ROOT_NFS=y
163CONFIG_NLS_CODEPAGE_437=y
164CONFIG_NLS_CODEPAGE_850=y
165CONFIG_NLS_ISO8859_1=y
166CONFIG_STRIP_ASM_SYMS=y
167CONFIG_DEBUG_FS=y
168# CONFIG_SCHED_DEBUG is not set
169CONFIG_DEBUG_MEMORY_INIT=y
170# CONFIG_FTRACE is not set
171CONFIG_DEBUG_USER=y
172CONFIG_DEBUG_LL=y
173CONFIG_EARLY_PRINTK=y
174# CONFIG_CRYPTO_ANSI_CPRNG is not set
175CONFIG_CRYPTO_USER_API_HASH=m
176CONFIG_CRYPTO_USER_API_SKCIPHER=m
177CONFIG_CRYPTO_DEV_ATMEL_AES=y
178CONFIG_CRYPTO_DEV_ATMEL_TDES=y
179CONFIG_CRYPTO_DEV_ATMEL_SHA=y
180CONFIG_CRC_CCITT=m
181CONFIG_CRC_ITU_T=m
diff --git a/arch/arm/configs/spear3xx_defconfig b/arch/arm/configs/spear3xx_defconfig
index 865980c5f212..7ff23a077f5d 100644
--- a/arch/arm/configs/spear3xx_defconfig
+++ b/arch/arm/configs/spear3xx_defconfig
@@ -6,7 +6,9 @@ CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
7CONFIG_MODVERSIONS=y 7CONFIG_MODVERSIONS=y
8CONFIG_PARTITION_ADVANCED=y 8CONFIG_PARTITION_ADVANCED=y
9# CONFIG_ARCH_MULTI_V7 is not set
9CONFIG_PLAT_SPEAR=y 10CONFIG_PLAT_SPEAR=y
11CONFIG_ARCH_SPEAR3XX=y
10CONFIG_MACH_SPEAR300=y 12CONFIG_MACH_SPEAR300=y
11CONFIG_MACH_SPEAR310=y 13CONFIG_MACH_SPEAR310=y
12CONFIG_MACH_SPEAR320=y 14CONFIG_MACH_SPEAR320=y
diff --git a/arch/arm/configs/spear6xx_defconfig b/arch/arm/configs/spear6xx_defconfig
index a2a1265f86b6..7822980d7d55 100644
--- a/arch/arm/configs/spear6xx_defconfig
+++ b/arch/arm/configs/spear6xx_defconfig
@@ -6,6 +6,7 @@ CONFIG_MODULES=y
6CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
7CONFIG_MODVERSIONS=y 7CONFIG_MODVERSIONS=y
8CONFIG_PARTITION_ADVANCED=y 8CONFIG_PARTITION_ADVANCED=y
9# CONFIG_ARCH_MULTI_V7 is not set
9CONFIG_PLAT_SPEAR=y 10CONFIG_PLAT_SPEAR=y
10CONFIG_ARCH_SPEAR6XX=y 11CONFIG_ARCH_SPEAR6XX=y
11CONFIG_BINFMT_MISC=y 12CONFIG_BINFMT_MISC=y
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index aba4881d20e5..a5f0485133cf 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_NO_HZ=y 1CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 2CONFIG_HIGH_RES_TIMERS=y
4CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
@@ -20,15 +19,14 @@ CONFIG_MODULE_UNLOAD=y
20CONFIG_MODULE_FORCE_UNLOAD=y 19CONFIG_MODULE_FORCE_UNLOAD=y
21# CONFIG_BLK_DEV_BSG is not set 20# CONFIG_BLK_DEV_BSG is not set
22CONFIG_PARTITION_ADVANCED=y 21CONFIG_PARTITION_ADVANCED=y
23CONFIG_EFI_PARTITION=y
24# CONFIG_IOSCHED_DEADLINE is not set 22# CONFIG_IOSCHED_DEADLINE is not set
25# CONFIG_IOSCHED_CFQ is not set 23# CONFIG_IOSCHED_CFQ is not set
26CONFIG_ARCH_TEGRA=y 24CONFIG_ARCH_TEGRA=y
27CONFIG_GPIO_PCA953X=y 25CONFIG_GPIO_PCA953X=y
28CONFIG_ARCH_TEGRA_2x_SOC=y 26CONFIG_ARCH_TEGRA_2x_SOC=y
29CONFIG_ARCH_TEGRA_3x_SOC=y 27CONFIG_ARCH_TEGRA_3x_SOC=y
28CONFIG_ARCH_TEGRA_114_SOC=y
30CONFIG_TEGRA_PCI=y 29CONFIG_TEGRA_PCI=y
31CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA=y
32CONFIG_TEGRA_EMC_SCALING_ENABLE=y 30CONFIG_TEGRA_EMC_SCALING_ENABLE=y
33CONFIG_SMP=y 31CONFIG_SMP=y
34CONFIG_PREEMPT=y 32CONFIG_PREEMPT=y
@@ -37,8 +35,8 @@ CONFIG_AEABI=y
37CONFIG_HIGHMEM=y 35CONFIG_HIGHMEM=y
38CONFIG_ZBOOT_ROM_TEXT=0x0 36CONFIG_ZBOOT_ROM_TEXT=0x0
39CONFIG_ZBOOT_ROM_BSS=0x0 37CONFIG_ZBOOT_ROM_BSS=0x0
40CONFIG_AUTO_ZRELADDR=y
41CONFIG_KEXEC=y 38CONFIG_KEXEC=y
39CONFIG_AUTO_ZRELADDR=y
42CONFIG_CPU_FREQ=y 40CONFIG_CPU_FREQ=y
43CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 41CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
44CONFIG_CPU_IDLE=y 42CONFIG_CPU_IDLE=y
@@ -108,6 +106,7 @@ CONFIG_RT2X00=y
108CONFIG_RT2800USB=m 106CONFIG_RT2800USB=m
109CONFIG_INPUT_EVDEV=y 107CONFIG_INPUT_EVDEV=y
110CONFIG_KEYBOARD_TEGRA=y 108CONFIG_KEYBOARD_TEGRA=y
109CONFIG_KEYBOARD_GPIO=y
111CONFIG_INPUT_MISC=y 110CONFIG_INPUT_MISC=y
112CONFIG_INPUT_MPU3050=y 111CONFIG_INPUT_MPU3050=y
113# CONFIG_LEGACY_PTYS is not set 112# CONFIG_LEGACY_PTYS is not set
@@ -117,7 +116,6 @@ CONFIG_SERIAL_8250_CONSOLE=y
117CONFIG_SERIAL_TEGRA=y 116CONFIG_SERIAL_TEGRA=y
118CONFIG_SERIAL_OF_PLATFORM=y 117CONFIG_SERIAL_OF_PLATFORM=y
119# CONFIG_HW_RANDOM is not set 118# CONFIG_HW_RANDOM is not set
120CONFIG_I2C=y
121# CONFIG_I2C_COMPAT is not set 119# CONFIG_I2C_COMPAT is not set
122CONFIG_I2C_MUX=y 120CONFIG_I2C_MUX=y
123CONFIG_I2C_MUX_PINCTRL=y 121CONFIG_I2C_MUX_PINCTRL=y
@@ -126,6 +124,7 @@ CONFIG_SPI=y
126CONFIG_SPI_TEGRA20_SFLASH=y 124CONFIG_SPI_TEGRA20_SFLASH=y
127CONFIG_SPI_TEGRA20_SLINK=y 125CONFIG_SPI_TEGRA20_SLINK=y
128CONFIG_GPIO_PCA953X_IRQ=y 126CONFIG_GPIO_PCA953X_IRQ=y
127CONFIG_GPIO_PALMAS=y
129CONFIG_GPIO_TPS6586X=y 128CONFIG_GPIO_TPS6586X=y
130CONFIG_GPIO_TPS65910=y 129CONFIG_GPIO_TPS65910=y
131CONFIG_POWER_SUPPLY=y 130CONFIG_POWER_SUPPLY=y
@@ -136,12 +135,17 @@ CONFIG_SENSORS_LM90=y
136CONFIG_MFD_TPS6586X=y 135CONFIG_MFD_TPS6586X=y
137CONFIG_MFD_TPS65910=y 136CONFIG_MFD_TPS65910=y
138CONFIG_MFD_MAX8907=y 137CONFIG_MFD_MAX8907=y
138CONFIG_MFD_TPS65090=y
139CONFIG_MFD_PALMAS=y
139CONFIG_REGULATOR=y 140CONFIG_REGULATOR=y
140CONFIG_REGULATOR_FIXED_VOLTAGE=y 141CONFIG_REGULATOR_FIXED_VOLTAGE=y
141CONFIG_REGULATOR_VIRTUAL_CONSUMER=y 142CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
142CONFIG_REGULATOR_GPIO=y 143CONFIG_REGULATOR_GPIO=y
143CONFIG_REGULATOR_MAX8907=y 144CONFIG_REGULATOR_MAX8907=y
145CONFIG_REGULATOR_PALMAS=y
146CONFIG_REGULATOR_TPS51632=y
144CONFIG_REGULATOR_TPS62360=y 147CONFIG_REGULATOR_TPS62360=y
148CONFIG_REGULATOR_TPS65090=y
145CONFIG_REGULATOR_TPS6586X=y 149CONFIG_REGULATOR_TPS6586X=y
146CONFIG_REGULATOR_TPS65910=y 150CONFIG_REGULATOR_TPS65910=y
147CONFIG_MEDIA_SUPPORT=y 151CONFIG_MEDIA_SUPPORT=y
@@ -187,10 +191,8 @@ CONFIG_LEDS_GPIO=y
187CONFIG_LEDS_TRIGGERS=y 191CONFIG_LEDS_TRIGGERS=y
188CONFIG_LEDS_TRIGGER_GPIO=y 192CONFIG_LEDS_TRIGGER_GPIO=y
189CONFIG_RTC_CLASS=y 193CONFIG_RTC_CLASS=y
190CONFIG_RTC_INTF_SYSFS=y
191CONFIG_RTC_INTF_PROC=y
192CONFIG_RTC_INTF_DEV=y
193CONFIG_RTC_DRV_MAX8907=y 194CONFIG_RTC_DRV_MAX8907=y
195CONFIG_RTC_DRV_PALMAS=y
194CONFIG_RTC_DRV_TPS6586X=y 196CONFIG_RTC_DRV_TPS6586X=y
195CONFIG_RTC_DRV_TPS65910=y 197CONFIG_RTC_DRV_TPS65910=y
196CONFIG_RTC_DRV_EM3027=y 198CONFIG_RTC_DRV_EM3027=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 426270fe080d..c037aa1065b7 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -5,7 +5,6 @@ CONFIG_BLK_DEV_INITRD=y
5CONFIG_KALLSYMS_ALL=y 5CONFIG_KALLSYMS_ALL=y
6CONFIG_MODULES=y 6CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
8# CONFIG_LBDAF is not set
9# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
10CONFIG_ARCH_U8500=y 9CONFIG_ARCH_U8500=y
11CONFIG_MACH_HREFV60=y 10CONFIG_MACH_HREFV60=y
@@ -90,6 +89,8 @@ CONFIG_LEDS_CLASS=y
90CONFIG_LEDS_LM3530=y 89CONFIG_LEDS_LM3530=y
91CONFIG_LEDS_LP5521=y 90CONFIG_LEDS_LP5521=y
92CONFIG_LEDS_GPIO=y 91CONFIG_LEDS_GPIO=y
92CONFIG_LEDS_TRIGGERS=y
93CONFIG_LEDS_TRIGGER_HEARTBEAT=y
93CONFIG_RTC_CLASS=y 94CONFIG_RTC_CLASS=y
94CONFIG_RTC_DRV_AB8500=y 95CONFIG_RTC_DRV_AB8500=y
95CONFIG_RTC_DRV_PL031=y 96CONFIG_RTC_DRV_PL031=y
@@ -103,6 +104,7 @@ CONFIG_EXT2_FS_XATTR=y
103CONFIG_EXT2_FS_POSIX_ACL=y 104CONFIG_EXT2_FS_POSIX_ACL=y
104CONFIG_EXT2_FS_SECURITY=y 105CONFIG_EXT2_FS_SECURITY=y
105CONFIG_EXT3_FS=y 106CONFIG_EXT3_FS=y
107CONFIG_EXT4_FS=y
106CONFIG_VFAT_FS=y 108CONFIG_VFAT_FS=y
107CONFIG_TMPFS=y 109CONFIG_TMPFS=y
108CONFIG_TMPFS_POSIX_ACL=y 110CONFIG_TMPFS_POSIX_ACL=y
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index c79f61faa3a5..da1c77d39327 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -243,6 +243,29 @@ typedef struct {
243 243
244#define ATOMIC64_INIT(i) { (i) } 244#define ATOMIC64_INIT(i) { (i) }
245 245
246#ifdef CONFIG_ARM_LPAE
247static inline u64 atomic64_read(const atomic64_t *v)
248{
249 u64 result;
250
251 __asm__ __volatile__("@ atomic64_read\n"
252" ldrd %0, %H0, [%1]"
253 : "=&r" (result)
254 : "r" (&v->counter), "Qo" (v->counter)
255 );
256
257 return result;
258}
259
260static inline void atomic64_set(atomic64_t *v, u64 i)
261{
262 __asm__ __volatile__("@ atomic64_set\n"
263" strd %2, %H2, [%1]"
264 : "=Qo" (v->counter)
265 : "r" (&v->counter), "r" (i)
266 );
267}
268#else
246static inline u64 atomic64_read(const atomic64_t *v) 269static inline u64 atomic64_read(const atomic64_t *v)
247{ 270{
248 u64 result; 271 u64 result;
@@ -269,6 +292,7 @@ static inline void atomic64_set(atomic64_t *v, u64 i)
269 : "r" (&v->counter), "r" (i) 292 : "r" (&v->counter), "r" (i)
270 : "cc"); 293 : "cc");
271} 294}
295#endif
272 296
273static inline void atomic64_add(u64 i, atomic64_t *v) 297static inline void atomic64_add(u64 i, atomic64_t *v)
274{ 298{
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index e1489c54cd12..bff71388e72a 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -363,4 +363,79 @@ static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
363 flush_cache_all(); 363 flush_cache_all();
364} 364}
365 365
366/*
367 * Memory synchronization helpers for mixed cached vs non cached accesses.
368 *
369 * Some synchronization algorithms have to set states in memory with the
370 * cache enabled or disabled depending on the code path. It is crucial
371 * to always ensure proper cache maintenance to update main memory right
372 * away in that case.
373 *
374 * Any cached write must be followed by a cache clean operation.
375 * Any cached read must be preceded by a cache invalidate operation.
376 * Yet, in the read case, a cache flush i.e. atomic clean+invalidate
377 * operation is needed to avoid discarding possible concurrent writes to the
378 * accessed memory.
379 *
380 * Also, in order to prevent a cached writer from interfering with an
381 * adjacent non-cached writer, each state variable must be located to
382 * a separate cache line.
383 */
384
385/*
386 * This needs to be >= the max cache writeback size of all
387 * supported platforms included in the current kernel configuration.
388 * This is used to align state variables to their own cache lines.
389 */
390#define __CACHE_WRITEBACK_ORDER 6 /* guessed from existing platforms */
391#define __CACHE_WRITEBACK_GRANULE (1 << __CACHE_WRITEBACK_ORDER)
392
393/*
394 * There is no __cpuc_clean_dcache_area but we use it anyway for
395 * code intent clarity, and alias it to __cpuc_flush_dcache_area.
396 */
397#define __cpuc_clean_dcache_area __cpuc_flush_dcache_area
398
399/*
400 * Ensure preceding writes to *p by this CPU are visible to
401 * subsequent reads by other CPUs:
402 */
403static inline void __sync_cache_range_w(volatile void *p, size_t size)
404{
405 char *_p = (char *)p;
406
407 __cpuc_clean_dcache_area(_p, size);
408 outer_clean_range(__pa(_p), __pa(_p + size));
409}
410
411/*
412 * Ensure preceding writes to *p by other CPUs are visible to
413 * subsequent reads by this CPU. We must be careful not to
414 * discard data simultaneously written by another CPU, hence the
415 * usage of flush rather than invalidate operations.
416 */
417static inline void __sync_cache_range_r(volatile void *p, size_t size)
418{
419 char *_p = (char *)p;
420
421#ifdef CONFIG_OUTER_CACHE
422 if (outer_cache.flush_range) {
423 /*
424 * Ensure dirty data migrated from other CPUs into our cache
425 * are cleaned out safely before the outer cache is cleaned:
426 */
427 __cpuc_clean_dcache_area(_p, size);
428
429 /* Clean and invalidate stale data for *p from outer ... */
430 outer_flush_range(__pa(_p), __pa(_p + size));
431 }
432#endif
433
434 /* ... and inner cache: */
435 __cpuc_flush_dcache_area(_p, size);
436}
437
438#define sync_cache_w(ptr) __sync_cache_range_w(ptr, sizeof *(ptr))
439#define sync_cache_r(ptr) __sync_cache_range_r(ptr, sizeof *(ptr))
440
366#endif 441#endif
diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h
index 5ef4d8015a60..1f3262e99d81 100644
--- a/arch/arm/include/asm/cp15.h
+++ b/arch/arm/include/asm/cp15.h
@@ -42,6 +42,8 @@
42#define vectors_high() (0) 42#define vectors_high() (0)
43#endif 43#endif
44 44
45#ifdef CONFIG_CPU_CP15
46
45extern unsigned long cr_no_alignment; /* defined in entry-armv.S */ 47extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
46extern unsigned long cr_alignment; /* defined in entry-armv.S */ 48extern unsigned long cr_alignment; /* defined in entry-armv.S */
47 49
@@ -82,6 +84,18 @@ static inline void set_copro_access(unsigned int val)
82 isb(); 84 isb();
83} 85}
84 86
85#endif 87#else /* ifdef CONFIG_CPU_CP15 */
88
89/*
90 * cr_alignment and cr_no_alignment are tightly coupled to cp15 (at least in the
91 * minds of the developers). Yielding 0 for machines without a cp15 (and making
92 * it read-only) is fine for most cases and saves quite some #ifdeffery.
93 */
94#define cr_no_alignment UL(0)
95#define cr_alignment UL(0)
96
97#endif /* ifdef CONFIG_CPU_CP15 / else */
98
99#endif /* ifndef __ASSEMBLY__ */
86 100
87#endif 101#endif
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index ad41ec2471e8..7652712d1d14 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -38,6 +38,24 @@
38#define MPIDR_AFFINITY_LEVEL(mpidr, level) \ 38#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
39 ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK) 39 ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK)
40 40
41#define ARM_CPU_IMP_ARM 0x41
42#define ARM_CPU_IMP_INTEL 0x69
43
44#define ARM_CPU_PART_ARM1136 0xB360
45#define ARM_CPU_PART_ARM1156 0xB560
46#define ARM_CPU_PART_ARM1176 0xB760
47#define ARM_CPU_PART_ARM11MPCORE 0xB020
48#define ARM_CPU_PART_CORTEX_A8 0xC080
49#define ARM_CPU_PART_CORTEX_A9 0xC090
50#define ARM_CPU_PART_CORTEX_A5 0xC050
51#define ARM_CPU_PART_CORTEX_A15 0xC0F0
52#define ARM_CPU_PART_CORTEX_A7 0xC070
53
54#define ARM_CPU_XSCALE_ARCH_MASK 0xe000
55#define ARM_CPU_XSCALE_ARCH_V1 0x2000
56#define ARM_CPU_XSCALE_ARCH_V2 0x4000
57#define ARM_CPU_XSCALE_ARCH_V3 0x6000
58
41extern unsigned int processor_id; 59extern unsigned int processor_id;
42 60
43#ifdef CONFIG_CPU_CP15 61#ifdef CONFIG_CPU_CP15
@@ -50,6 +68,7 @@ extern unsigned int processor_id;
50 : "cc"); \ 68 : "cc"); \
51 __val; \ 69 __val; \
52 }) 70 })
71
53#define read_cpuid_ext(ext_reg) \ 72#define read_cpuid_ext(ext_reg) \
54 ({ \ 73 ({ \
55 unsigned int __val; \ 74 unsigned int __val; \
@@ -59,29 +78,24 @@ extern unsigned int processor_id;
59 : "cc"); \ 78 : "cc"); \
60 __val; \ 79 __val; \
61 }) 80 })
62#else
63#define read_cpuid(reg) (processor_id)
64#define read_cpuid_ext(reg) 0
65#endif
66 81
67#define ARM_CPU_IMP_ARM 0x41 82#else /* ifdef CONFIG_CPU_CP15 */
68#define ARM_CPU_IMP_INTEL 0x69
69 83
70#define ARM_CPU_PART_ARM1136 0xB360 84/*
71#define ARM_CPU_PART_ARM1156 0xB560 85 * read_cpuid and read_cpuid_ext should only ever be called on machines that
72#define ARM_CPU_PART_ARM1176 0xB760 86 * have cp15 so warn on other usages.
73#define ARM_CPU_PART_ARM11MPCORE 0xB020 87 */
74#define ARM_CPU_PART_CORTEX_A8 0xC080 88#define read_cpuid(reg) \
75#define ARM_CPU_PART_CORTEX_A9 0xC090 89 ({ \
76#define ARM_CPU_PART_CORTEX_A5 0xC050 90 WARN_ON_ONCE(1); \
77#define ARM_CPU_PART_CORTEX_A15 0xC0F0 91 0; \
78#define ARM_CPU_PART_CORTEX_A7 0xC070 92 })
79 93
80#define ARM_CPU_XSCALE_ARCH_MASK 0xe000 94#define read_cpuid_ext(reg) read_cpuid(reg)
81#define ARM_CPU_XSCALE_ARCH_V1 0x2000 95
82#define ARM_CPU_XSCALE_ARCH_V2 0x4000 96#endif /* ifdef CONFIG_CPU_CP15 / else */
83#define ARM_CPU_XSCALE_ARCH_V3 0x6000
84 97
98#ifdef CONFIG_CPU_CP15
85/* 99/*
86 * The CPU ID never changes at run time, so we might as well tell the 100 * The CPU ID never changes at run time, so we might as well tell the
87 * compiler that it's constant. Use this function to read the CPU ID 101 * compiler that it's constant. Use this function to read the CPU ID
@@ -92,6 +106,15 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)
92 return read_cpuid(CPUID_ID); 106 return read_cpuid(CPUID_ID);
93} 107}
94 108
109#else /* ifdef CONFIG_CPU_CP15 */
110
111static inline unsigned int __attribute_const__ read_cpuid_id(void)
112{
113 return processor_id;
114}
115
116#endif /* ifdef CONFIG_CPU_CP15 / else */
117
95static inline unsigned int __attribute_const__ read_cpuid_implementor(void) 118static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
96{ 119{
97 return (read_cpuid_id() & 0xFF000000) >> 24; 120 return (read_cpuid_id() & 0xFF000000) >> 24;
diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h
new file mode 100644
index 000000000000..15631300c238
--- /dev/null
+++ b/arch/arm/include/asm/firmware.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics.
3 * Kyungmin Park <kyungmin.park@samsung.com>
4 * Tomasz Figa <t.figa@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARM_FIRMWARE_H
12#define __ASM_ARM_FIRMWARE_H
13
14#include <linux/bug.h>
15
16/*
17 * struct firmware_ops
18 *
19 * A structure to specify available firmware operations.
20 *
21 * A filled up structure can be registered with register_firmware_ops().
22 */
23struct firmware_ops {
24 /*
25 * Enters CPU idle mode
26 */
27 int (*do_idle)(void);
28 /*
29 * Sets boot address of specified physical CPU
30 */
31 int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr);
32 /*
33 * Boots specified physical CPU
34 */
35 int (*cpu_boot)(int cpu);
36 /*
37 * Initializes L2 cache
38 */
39 int (*l2x0_init)(void);
40};
41
42/* Global pointer for current firmware_ops structure, can't be NULL. */
43extern const struct firmware_ops *firmware_ops;
44
45/*
46 * call_firmware_op(op, ...)
47 *
48 * Checks if firmware operation is present and calls it,
49 * otherwise returns -ENOSYS
50 */
51#define call_firmware_op(op, ...) \
52 ((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : (-ENOSYS))
53
54/*
55 * register_firmware_ops(ops)
56 *
57 * A function to register platform firmware_ops struct.
58 */
59static inline void register_firmware_ops(const struct firmware_ops *ops)
60{
61 BUG_ON(!ops);
62
63 firmware_ops = ops;
64}
65
66#endif
diff --git a/arch/arm/include/asm/glue-df.h b/arch/arm/include/asm/glue-df.h
index 8cacbcda76da..b6e9f2c108b5 100644
--- a/arch/arm/include/asm/glue-df.h
+++ b/arch/arm/include/asm/glue-df.h
@@ -18,12 +18,12 @@
18 * ================ 18 * ================
19 * 19 *
20 * We have the following to choose from: 20 * We have the following to choose from:
21 * arm6 - ARM6 style
22 * arm7 - ARM7 style 21 * arm7 - ARM7 style
23 * v4_early - ARMv4 without Thumb early abort handler 22 * v4_early - ARMv4 without Thumb early abort handler
24 * v4t_late - ARMv4 with Thumb late abort handler 23 * v4t_late - ARMv4 with Thumb late abort handler
25 * v4t_early - ARMv4 with Thumb early abort handler 24 * v4t_early - ARMv4 with Thumb early abort handler
26 * v5tej_early - ARMv5 with Thumb and Java early abort handler 25 * v5t_early - ARMv5 with Thumb early abort handler
26 * v5tj_early - ARMv5 with Thumb and Java early abort handler
27 * xscale - ARMv5 with Thumb with Xscale extensions 27 * xscale - ARMv5 with Thumb with Xscale extensions
28 * v6_early - ARMv6 generic early abort handler 28 * v6_early - ARMv6 generic early abort handler
29 * v7_early - ARMv7 generic early abort handler 29 * v7_early - ARMv7 generic early abort handler
@@ -39,19 +39,19 @@
39# endif 39# endif
40#endif 40#endif
41 41
42#ifdef CONFIG_CPU_ABRT_LV4T 42#ifdef CONFIG_CPU_ABRT_EV4
43# ifdef CPU_DABORT_HANDLER 43# ifdef CPU_DABORT_HANDLER
44# define MULTI_DABORT 1 44# define MULTI_DABORT 1
45# else 45# else
46# define CPU_DABORT_HANDLER v4t_late_abort 46# define CPU_DABORT_HANDLER v4_early_abort
47# endif 47# endif
48#endif 48#endif
49 49
50#ifdef CONFIG_CPU_ABRT_EV4 50#ifdef CONFIG_CPU_ABRT_LV4T
51# ifdef CPU_DABORT_HANDLER 51# ifdef CPU_DABORT_HANDLER
52# define MULTI_DABORT 1 52# define MULTI_DABORT 1
53# else 53# else
54# define CPU_DABORT_HANDLER v4_early_abort 54# define CPU_DABORT_HANDLER v4t_late_abort
55# endif 55# endif
56#endif 56#endif
57 57
@@ -63,19 +63,19 @@
63# endif 63# endif
64#endif 64#endif
65 65
66#ifdef CONFIG_CPU_ABRT_EV5TJ 66#ifdef CONFIG_CPU_ABRT_EV5T
67# ifdef CPU_DABORT_HANDLER 67# ifdef CPU_DABORT_HANDLER
68# define MULTI_DABORT 1 68# define MULTI_DABORT 1
69# else 69# else
70# define CPU_DABORT_HANDLER v5tj_early_abort 70# define CPU_DABORT_HANDLER v5t_early_abort
71# endif 71# endif
72#endif 72#endif
73 73
74#ifdef CONFIG_CPU_ABRT_EV5T 74#ifdef CONFIG_CPU_ABRT_EV5TJ
75# ifdef CPU_DABORT_HANDLER 75# ifdef CPU_DABORT_HANDLER
76# define MULTI_DABORT 1 76# define MULTI_DABORT 1
77# else 77# else
78# define CPU_DABORT_HANDLER v5t_early_abort 78# define CPU_DABORT_HANDLER v5tj_early_abort
79# endif 79# endif
80#endif 80#endif
81 81
diff --git a/arch/arm/include/asm/idmap.h b/arch/arm/include/asm/idmap.h
index 1a66f907e5cc..bf863edb517d 100644
--- a/arch/arm/include/asm/idmap.h
+++ b/arch/arm/include/asm/idmap.h
@@ -8,7 +8,6 @@
8#define __idmap __section(.idmap.text) noinline notrace 8#define __idmap __section(.idmap.text) noinline notrace
9 9
10extern pgd_t *idmap_pgd; 10extern pgd_t *idmap_pgd;
11extern pgd_t *hyp_pgd;
12 11
13void setup_mm_for_reboot(void); 12void setup_mm_for_reboot(void);
14 13
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 35c21c375d81..53c15dec7af6 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -30,6 +30,11 @@ extern void asm_do_IRQ(unsigned int, struct pt_regs *);
30void handle_IRQ(unsigned int, struct pt_regs *); 30void handle_IRQ(unsigned int, struct pt_regs *);
31void init_IRQ(void); 31void init_IRQ(void);
32 32
33#ifdef CONFIG_MULTI_IRQ_HANDLER
34extern void (*handle_arch_irq)(struct pt_regs *);
35extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
36#endif
37
33#endif 38#endif
34 39
35#endif 40#endif
diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
index 7c3d813e15df..124623e5ef14 100644
--- a/arch/arm/include/asm/kvm_arm.h
+++ b/arch/arm/include/asm/kvm_arm.h
@@ -211,4 +211,8 @@
211 211
212#define HSR_HVC_IMM_MASK ((1UL << 16) - 1) 212#define HSR_HVC_IMM_MASK ((1UL << 16) - 1)
213 213
214#define HSR_DABT_S1PTW (1U << 7)
215#define HSR_DABT_CM (1U << 8)
216#define HSR_DABT_EA (1U << 9)
217
214#endif /* __ARM_KVM_ARM_H__ */ 218#endif /* __ARM_KVM_ARM_H__ */
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
index e4956f4e23e1..18d50322a9e2 100644
--- a/arch/arm/include/asm/kvm_asm.h
+++ b/arch/arm/include/asm/kvm_asm.h
@@ -75,7 +75,7 @@ extern char __kvm_hyp_code_end[];
75extern void __kvm_tlb_flush_vmid(struct kvm *kvm); 75extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
76 76
77extern void __kvm_flush_vm_context(void); 77extern void __kvm_flush_vm_context(void);
78extern void __kvm_tlb_flush_vmid(struct kvm *kvm); 78extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
79 79
80extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); 80extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
81#endif 81#endif
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index fd611996bfb5..82b4babead2c 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -22,11 +22,12 @@
22#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
23#include <asm/kvm_asm.h> 23#include <asm/kvm_asm.h>
24#include <asm/kvm_mmio.h> 24#include <asm/kvm_mmio.h>
25#include <asm/kvm_arm.h>
25 26
26u32 *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num); 27unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
27u32 *vcpu_spsr(struct kvm_vcpu *vcpu); 28unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);
28 29
29int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run); 30bool kvm_condition_valid(struct kvm_vcpu *vcpu);
30void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr); 31void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);
31void kvm_inject_undefined(struct kvm_vcpu *vcpu); 32void kvm_inject_undefined(struct kvm_vcpu *vcpu);
32void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr); 33void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
@@ -37,14 +38,14 @@ static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
37 return 1; 38 return 1;
38} 39}
39 40
40static inline u32 *vcpu_pc(struct kvm_vcpu *vcpu) 41static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
41{ 42{
42 return (u32 *)&vcpu->arch.regs.usr_regs.ARM_pc; 43 return &vcpu->arch.regs.usr_regs.ARM_pc;
43} 44}
44 45
45static inline u32 *vcpu_cpsr(struct kvm_vcpu *vcpu) 46static inline unsigned long *vcpu_cpsr(struct kvm_vcpu *vcpu)
46{ 47{
47 return (u32 *)&vcpu->arch.regs.usr_regs.ARM_cpsr; 48 return &vcpu->arch.regs.usr_regs.ARM_cpsr;
48} 49}
49 50
50static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu) 51static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu)
@@ -69,4 +70,96 @@ static inline bool kvm_vcpu_reg_is_pc(struct kvm_vcpu *vcpu, int reg)
69 return reg == 15; 70 return reg == 15;
70} 71}
71 72
73static inline u32 kvm_vcpu_get_hsr(struct kvm_vcpu *vcpu)
74{
75 return vcpu->arch.fault.hsr;
76}
77
78static inline unsigned long kvm_vcpu_get_hfar(struct kvm_vcpu *vcpu)
79{
80 return vcpu->arch.fault.hxfar;
81}
82
83static inline phys_addr_t kvm_vcpu_get_fault_ipa(struct kvm_vcpu *vcpu)
84{
85 return ((phys_addr_t)vcpu->arch.fault.hpfar & HPFAR_MASK) << 8;
86}
87
88static inline unsigned long kvm_vcpu_get_hyp_pc(struct kvm_vcpu *vcpu)
89{
90 return vcpu->arch.fault.hyp_pc;
91}
92
93static inline bool kvm_vcpu_dabt_isvalid(struct kvm_vcpu *vcpu)
94{
95 return kvm_vcpu_get_hsr(vcpu) & HSR_ISV;
96}
97
98static inline bool kvm_vcpu_dabt_iswrite(struct kvm_vcpu *vcpu)
99{
100 return kvm_vcpu_get_hsr(vcpu) & HSR_WNR;
101}
102
103static inline bool kvm_vcpu_dabt_issext(struct kvm_vcpu *vcpu)
104{
105 return kvm_vcpu_get_hsr(vcpu) & HSR_SSE;
106}
107
108static inline int kvm_vcpu_dabt_get_rd(struct kvm_vcpu *vcpu)
109{
110 return (kvm_vcpu_get_hsr(vcpu) & HSR_SRT_MASK) >> HSR_SRT_SHIFT;
111}
112
113static inline bool kvm_vcpu_dabt_isextabt(struct kvm_vcpu *vcpu)
114{
115 return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_EA;
116}
117
118static inline bool kvm_vcpu_dabt_iss1tw(struct kvm_vcpu *vcpu)
119{
120 return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_S1PTW;
121}
122
123/* Get Access Size from a data abort */
124static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu)
125{
126 switch ((kvm_vcpu_get_hsr(vcpu) >> 22) & 0x3) {
127 case 0:
128 return 1;
129 case 1:
130 return 2;
131 case 2:
132 return 4;
133 default:
134 kvm_err("Hardware is weird: SAS 0b11 is reserved\n");
135 return -EFAULT;
136 }
137}
138
139/* This one is not specific to Data Abort */
140static inline bool kvm_vcpu_trap_il_is32bit(struct kvm_vcpu *vcpu)
141{
142 return kvm_vcpu_get_hsr(vcpu) & HSR_IL;
143}
144
145static inline u8 kvm_vcpu_trap_get_class(struct kvm_vcpu *vcpu)
146{
147 return kvm_vcpu_get_hsr(vcpu) >> HSR_EC_SHIFT;
148}
149
150static inline bool kvm_vcpu_trap_is_iabt(struct kvm_vcpu *vcpu)
151{
152 return kvm_vcpu_trap_get_class(vcpu) == HSR_EC_IABT;
153}
154
155static inline u8 kvm_vcpu_trap_get_fault(struct kvm_vcpu *vcpu)
156{
157 return kvm_vcpu_get_hsr(vcpu) & HSR_FSC_TYPE;
158}
159
160static inline u32 kvm_vcpu_hvc_get_imm(struct kvm_vcpu *vcpu)
161{
162 return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK;
163}
164
72#endif /* __ARM_KVM_EMULATE_H__ */ 165#endif /* __ARM_KVM_EMULATE_H__ */
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index d1736a53b12d..57cb786a6203 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -80,6 +80,15 @@ struct kvm_mmu_memory_cache {
80 void *objects[KVM_NR_MEM_OBJS]; 80 void *objects[KVM_NR_MEM_OBJS];
81}; 81};
82 82
83struct kvm_vcpu_fault_info {
84 u32 hsr; /* Hyp Syndrome Register */
85 u32 hxfar; /* Hyp Data/Inst. Fault Address Register */
86 u32 hpfar; /* Hyp IPA Fault Address Register */
87 u32 hyp_pc; /* PC when exception was taken from Hyp mode */
88};
89
90typedef struct vfp_hard_struct kvm_cpu_context_t;
91
83struct kvm_vcpu_arch { 92struct kvm_vcpu_arch {
84 struct kvm_regs regs; 93 struct kvm_regs regs;
85 94
@@ -93,13 +102,13 @@ struct kvm_vcpu_arch {
93 u32 midr; 102 u32 midr;
94 103
95 /* Exception Information */ 104 /* Exception Information */
96 u32 hsr; /* Hyp Syndrome Register */ 105 struct kvm_vcpu_fault_info fault;
97 u32 hxfar; /* Hyp Data/Inst Fault Address Register */
98 u32 hpfar; /* Hyp IPA Fault Address Register */
99 106
100 /* Floating point registers (VFP and Advanced SIMD/NEON) */ 107 /* Floating point registers (VFP and Advanced SIMD/NEON) */
101 struct vfp_hard_struct vfp_guest; 108 struct vfp_hard_struct vfp_guest;
102 struct vfp_hard_struct *vfp_host; 109
110 /* Host FP context */
111 kvm_cpu_context_t *host_cpu_context;
103 112
104 /* VGIC state */ 113 /* VGIC state */
105 struct vgic_cpu vgic_cpu; 114 struct vgic_cpu vgic_cpu;
@@ -122,9 +131,6 @@ struct kvm_vcpu_arch {
122 /* Interrupt related fields */ 131 /* Interrupt related fields */
123 u32 irq_lines; /* IRQ and FIQ levels */ 132 u32 irq_lines; /* IRQ and FIQ levels */
124 133
125 /* Hyp exception information */
126 u32 hyp_pc; /* PC when exception was taken from Hyp mode */
127
128 /* Cache some mmu pages needed inside spinlock regions */ 134 /* Cache some mmu pages needed inside spinlock regions */
129 struct kvm_mmu_memory_cache mmu_page_cache; 135 struct kvm_mmu_memory_cache mmu_page_cache;
130 136
@@ -181,4 +187,41 @@ struct kvm_one_reg;
181int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *); 187int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
182int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *); 188int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
183 189
190int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
191 int exception_index);
192
193static inline void __cpu_init_hyp_mode(unsigned long long boot_pgd_ptr,
194 unsigned long long pgd_ptr,
195 unsigned long hyp_stack_ptr,
196 unsigned long vector_ptr)
197{
198 /*
199 * Call initialization code, and switch to the full blown HYP
200 * code. The init code doesn't need to preserve these
201 * registers as r0-r3 are already callee saved according to
202 * the AAPCS.
203 * Note that we slightly misuse the prototype by casing the
204 * stack pointer to a void *.
205 *
206 * We don't have enough registers to perform the full init in
207 * one go. Install the boot PGD first, and then install the
208 * runtime PGD, stack pointer and vectors. The PGDs are always
209 * passed as the third argument, in order to be passed into
210 * r2-r3 to the init code (yes, this is compliant with the
211 * PCS!).
212 */
213
214 kvm_call_hyp(NULL, 0, boot_pgd_ptr);
215
216 kvm_call_hyp((void*)hyp_stack_ptr, vector_ptr, pgd_ptr);
217}
218
219static inline int kvm_arch_dev_ioctl_check_extension(long ext)
220{
221 return 0;
222}
223
224int kvm_perf_init(void);
225int kvm_perf_teardown(void);
226
184#endif /* __ARM_KVM_HOST_H__ */ 227#endif /* __ARM_KVM_HOST_H__ */
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index 421a20b34874..472ac7091003 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -19,9 +19,33 @@
19#ifndef __ARM_KVM_MMU_H__ 19#ifndef __ARM_KVM_MMU_H__
20#define __ARM_KVM_MMU_H__ 20#define __ARM_KVM_MMU_H__
21 21
22#include <asm/memory.h>
23#include <asm/page.h>
24
25/*
26 * We directly use the kernel VA for the HYP, as we can directly share
27 * the mapping (HTTBR "covers" TTBR1).
28 */
29#define HYP_PAGE_OFFSET_MASK UL(~0)
30#define HYP_PAGE_OFFSET PAGE_OFFSET
31#define KERN_TO_HYP(kva) (kva)
32
33/*
34 * Our virtual mapping for the boot-time MMU-enable code. Must be
35 * shared across all the page-tables. Conveniently, we use the vectors
36 * page, where no kernel data will ever be shared with HYP.
37 */
38#define TRAMPOLINE_VA UL(CONFIG_VECTORS_BASE)
39
40#ifndef __ASSEMBLY__
41
42#include <asm/cacheflush.h>
43#include <asm/pgalloc.h>
44
22int create_hyp_mappings(void *from, void *to); 45int create_hyp_mappings(void *from, void *to);
23int create_hyp_io_mappings(void *from, void *to, phys_addr_t); 46int create_hyp_io_mappings(void *from, void *to, phys_addr_t);
24void free_hyp_pmds(void); 47void free_boot_hyp_pgd(void);
48void free_hyp_pgds(void);
25 49
26int kvm_alloc_stage2_pgd(struct kvm *kvm); 50int kvm_alloc_stage2_pgd(struct kvm *kvm);
27void kvm_free_stage2_pgd(struct kvm *kvm); 51void kvm_free_stage2_pgd(struct kvm *kvm);
@@ -33,9 +57,21 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run);
33void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu); 57void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);
34 58
35phys_addr_t kvm_mmu_get_httbr(void); 59phys_addr_t kvm_mmu_get_httbr(void);
60phys_addr_t kvm_mmu_get_boot_httbr(void);
61phys_addr_t kvm_get_idmap_vector(void);
36int kvm_mmu_init(void); 62int kvm_mmu_init(void);
37void kvm_clear_hyp_idmap(void); 63void kvm_clear_hyp_idmap(void);
38 64
65static inline void kvm_set_pte(pte_t *pte, pte_t new_pte)
66{
67 pte_val(*pte) = new_pte;
68 /*
69 * flush_pmd_entry just takes a void pointer and cleans the necessary
70 * cache entries, so we can reuse the function for ptes.
71 */
72 flush_pmd_entry(pte);
73}
74
39static inline bool kvm_is_write_fault(unsigned long hsr) 75static inline bool kvm_is_write_fault(unsigned long hsr)
40{ 76{
41 unsigned long hsr_ec = hsr >> HSR_EC_SHIFT; 77 unsigned long hsr_ec = hsr >> HSR_EC_SHIFT;
@@ -47,4 +83,53 @@ static inline bool kvm_is_write_fault(unsigned long hsr)
47 return true; 83 return true;
48} 84}
49 85
86static inline void kvm_clean_pgd(pgd_t *pgd)
87{
88 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t));
89}
90
91static inline void kvm_clean_pmd_entry(pmd_t *pmd)
92{
93 clean_pmd_entry(pmd);
94}
95
96static inline void kvm_clean_pte(pte_t *pte)
97{
98 clean_pte_table(pte);
99}
100
101static inline void kvm_set_s2pte_writable(pte_t *pte)
102{
103 pte_val(*pte) |= L_PTE_S2_RDWR;
104}
105
106struct kvm;
107
108static inline void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn)
109{
110 /*
111 * If we are going to insert an instruction page and the icache is
112 * either VIPT or PIPT, there is a potential problem where the host
113 * (or another VM) may have used the same page as this guest, and we
114 * read incorrect data from the icache. If we're using a PIPT cache,
115 * we can invalidate just that page, but if we are using a VIPT cache
116 * we need to invalidate the entire icache - damn shame - as written
117 * in the ARM ARM (DDI 0406C.b - Page B3-1393).
118 *
119 * VIVT caches are tagged using both the ASID and the VMID and doesn't
120 * need any kind of flushing (DDI 0406C.b - Page B3-1392).
121 */
122 if (icache_is_pipt()) {
123 unsigned long hva = gfn_to_hva(kvm, gfn);
124 __cpuc_coherent_user_range(hva, hva + PAGE_SIZE);
125 } else if (!icache_is_vivt_asid_tagged()) {
126 /* any kind of VIPT cache */
127 __flush_icache_all();
128 }
129}
130
131#define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l))
132
133#endif /* !__ASSEMBLY__ */
134
50#endif /* __ARM_KVM_MMU_H__ */ 135#endif /* __ARM_KVM_MMU_H__ */
diff --git a/arch/arm/include/asm/kvm_vgic.h b/arch/arm/include/asm/kvm_vgic.h
index ab97207d9cd3..343744e4809c 100644
--- a/arch/arm/include/asm/kvm_vgic.h
+++ b/arch/arm/include/asm/kvm_vgic.h
@@ -21,7 +21,6 @@
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/kvm.h> 23#include <linux/kvm.h>
24#include <linux/kvm_host.h>
25#include <linux/irqreturn.h> 24#include <linux/irqreturn.h>
26#include <linux/spinlock.h> 25#include <linux/spinlock.h>
27#include <linux/types.h> 26#include <linux/types.h>
diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h
index 18c883023339..2092ee1e1300 100644
--- a/arch/arm/include/asm/mach/irq.h
+++ b/arch/arm/include/asm/mach/irq.h
@@ -20,11 +20,6 @@ struct seq_file;
20extern void init_FIQ(int); 20extern void init_FIQ(int);
21extern int show_fiq_list(struct seq_file *, int); 21extern int show_fiq_list(struct seq_file *, int);
22 22
23#ifdef CONFIG_MULTI_IRQ_HANDLER
24extern void (*handle_arch_irq)(struct pt_regs *);
25extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
26#endif
27
28/* 23/*
29 * This is for easy migration, but should be changed in the source 24 * This is for easy migration, but should be changed in the source
30 */ 25 */
@@ -35,35 +30,4 @@ do { \
35 raw_spin_unlock(&desc->lock); \ 30 raw_spin_unlock(&desc->lock); \
36} while(0) 31} while(0)
37 32
38#ifndef __ASSEMBLY__
39/*
40 * Entry/exit functions for chained handlers where the primary IRQ chip
41 * may implement either fasteoi or level-trigger flow control.
42 */
43static inline void chained_irq_enter(struct irq_chip *chip,
44 struct irq_desc *desc)
45{
46 /* FastEOI controllers require no action on entry. */
47 if (chip->irq_eoi)
48 return;
49
50 if (chip->irq_mask_ack) {
51 chip->irq_mask_ack(&desc->irq_data);
52 } else {
53 chip->irq_mask(&desc->irq_data);
54 if (chip->irq_ack)
55 chip->irq_ack(&desc->irq_data);
56 }
57}
58
59static inline void chained_irq_exit(struct irq_chip *chip,
60 struct irq_desc *desc)
61{
62 if (chip->irq_eoi)
63 chip->irq_eoi(&desc->irq_data);
64 else
65 chip->irq_unmask(&desc->irq_data);
66}
67#endif
68
69#endif 33#endif
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 5cf2e979b4be..7d2c3c843801 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -30,6 +30,11 @@ struct hw_pci {
30 void (*postinit)(void); 30 void (*postinit)(void);
31 u8 (*swizzle)(struct pci_dev *dev, u8 *pin); 31 u8 (*swizzle)(struct pci_dev *dev, u8 *pin);
32 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); 32 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
33 resource_size_t (*align_resource)(struct pci_dev *dev,
34 const struct resource *res,
35 resource_size_t start,
36 resource_size_t size,
37 resource_size_t align);
33}; 38};
34 39
35/* 40/*
@@ -51,6 +56,12 @@ struct pci_sys_data {
51 u8 (*swizzle)(struct pci_dev *, u8 *); 56 u8 (*swizzle)(struct pci_dev *, u8 *);
52 /* IRQ mapping */ 57 /* IRQ mapping */
53 int (*map_irq)(const struct pci_dev *, u8, u8); 58 int (*map_irq)(const struct pci_dev *, u8, u8);
59 /* Resource alignement requirements */
60 resource_size_t (*align_resource)(struct pci_dev *dev,
61 const struct resource *res,
62 resource_size_t start,
63 resource_size_t size,
64 resource_size_t align);
54 void *private_data; /* platform controller private data */ 65 void *private_data; /* platform controller private data */
55}; 66};
56 67
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h
new file mode 100644
index 000000000000..0f7b7620e9a5
--- /dev/null
+++ b/arch/arm/include/asm/mcpm.h
@@ -0,0 +1,209 @@
1/*
2 * arch/arm/include/asm/mcpm.h
3 *
4 * Created by: Nicolas Pitre, April 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef MCPM_H
13#define MCPM_H
14
15/*
16 * Maximum number of possible clusters / CPUs per cluster.
17 *
18 * This should be sufficient for quite a while, while keeping the
19 * (assembly) code simpler. When this starts to grow then we'll have
20 * to consider dynamic allocation.
21 */
22#define MAX_CPUS_PER_CLUSTER 4
23#define MAX_NR_CLUSTERS 2
24
25#ifndef __ASSEMBLY__
26
27#include <linux/types.h>
28#include <asm/cacheflush.h>
29
30/*
31 * Platform specific code should use this symbol to set up secondary
32 * entry location for processors to use when released from reset.
33 */
34extern void mcpm_entry_point(void);
35
36/*
37 * This is used to indicate where the given CPU from given cluster should
38 * branch once it is ready to re-enter the kernel using ptr, or NULL if it
39 * should be gated. A gated CPU is held in a WFE loop until its vector
40 * becomes non NULL.
41 */
42void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr);
43
44/*
45 * CPU/cluster power operations API for higher subsystems to use.
46 */
47
48/**
49 * mcpm_cpu_power_up - make given CPU in given cluster runable
50 *
51 * @cpu: CPU number within given cluster
52 * @cluster: cluster number for the CPU
53 *
54 * The identified CPU is brought out of reset. If the cluster was powered
55 * down then it is brought up as well, taking care not to let the other CPUs
56 * in the cluster run, and ensuring appropriate cluster setup.
57 *
58 * Caller must ensure the appropriate entry vector is initialized with
59 * mcpm_set_entry_vector() prior to calling this.
60 *
61 * This must be called in a sleepable context. However, the implementation
62 * is strongly encouraged to return early and let the operation happen
63 * asynchronously, especially when significant delays are expected.
64 *
65 * If the operation cannot be performed then an error code is returned.
66 */
67int mcpm_cpu_power_up(unsigned int cpu, unsigned int cluster);
68
69/**
70 * mcpm_cpu_power_down - power the calling CPU down
71 *
72 * The calling CPU is powered down.
73 *
74 * If this CPU is found to be the "last man standing" in the cluster
75 * then the cluster is prepared for power-down too.
76 *
77 * This must be called with interrupts disabled.
78 *
79 * This does not return. Re-entry in the kernel is expected via
80 * mcpm_entry_point.
81 */
82void mcpm_cpu_power_down(void);
83
84/**
85 * mcpm_cpu_suspend - bring the calling CPU in a suspended state
86 *
87 * @expected_residency: duration in microseconds the CPU is expected
88 * to remain suspended, or 0 if unknown/infinity.
89 *
90 * The calling CPU is suspended. The expected residency argument is used
91 * as a hint by the platform specific backend to implement the appropriate
92 * sleep state level according to the knowledge it has on wake-up latency
93 * for the given hardware.
94 *
95 * If this CPU is found to be the "last man standing" in the cluster
96 * then the cluster may be prepared for power-down too, if the expected
97 * residency makes it worthwhile.
98 *
99 * This must be called with interrupts disabled.
100 *
101 * This does not return. Re-entry in the kernel is expected via
102 * mcpm_entry_point.
103 */
104void mcpm_cpu_suspend(u64 expected_residency);
105
106/**
107 * mcpm_cpu_powered_up - housekeeping workafter a CPU has been powered up
108 *
109 * This lets the platform specific backend code perform needed housekeeping
110 * work. This must be called by the newly activated CPU as soon as it is
111 * fully operational in kernel space, before it enables interrupts.
112 *
113 * If the operation cannot be performed then an error code is returned.
114 */
115int mcpm_cpu_powered_up(void);
116
117/*
118 * Platform specific methods used in the implementation of the above API.
119 */
120struct mcpm_platform_ops {
121 int (*power_up)(unsigned int cpu, unsigned int cluster);
122 void (*power_down)(void);
123 void (*suspend)(u64);
124 void (*powered_up)(void);
125};
126
127/**
128 * mcpm_platform_register - register platform specific power methods
129 *
130 * @ops: mcpm_platform_ops structure to register
131 *
132 * An error is returned if the registration has been done previously.
133 */
134int __init mcpm_platform_register(const struct mcpm_platform_ops *ops);
135
136/* Synchronisation structures for coordinating safe cluster setup/teardown: */
137
138/*
139 * When modifying this structure, make sure you update the MCPM_SYNC_ defines
140 * to match.
141 */
142struct mcpm_sync_struct {
143 /* individual CPU states */
144 struct {
145 s8 cpu __aligned(__CACHE_WRITEBACK_GRANULE);
146 } cpus[MAX_CPUS_PER_CLUSTER];
147
148 /* cluster state */
149 s8 cluster __aligned(__CACHE_WRITEBACK_GRANULE);
150
151 /* inbound-side state */
152 s8 inbound __aligned(__CACHE_WRITEBACK_GRANULE);
153};
154
155struct sync_struct {
156 struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS];
157};
158
159extern unsigned long sync_phys; /* physical address of *mcpm_sync */
160
161void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster);
162void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster);
163void __mcpm_outbound_leave_critical(unsigned int cluster, int state);
164bool __mcpm_outbound_enter_critical(unsigned int this_cpu, unsigned int cluster);
165int __mcpm_cluster_state(unsigned int cluster);
166
167int __init mcpm_sync_init(
168 void (*power_up_setup)(unsigned int affinity_level));
169
170void __init mcpm_smp_set_ops(void);
171
172#else
173
174/*
175 * asm-offsets.h causes trouble when included in .c files, and cacheflush.h
176 * cannot be included in asm files. Let's work around the conflict like this.
177 */
178#include <asm/asm-offsets.h>
179#define __CACHE_WRITEBACK_GRANULE CACHE_WRITEBACK_GRANULE
180
181#endif /* ! __ASSEMBLY__ */
182
183/* Definitions for mcpm_sync_struct */
184#define CPU_DOWN 0x11
185#define CPU_COMING_UP 0x12
186#define CPU_UP 0x13
187#define CPU_GOING_DOWN 0x14
188
189#define CLUSTER_DOWN 0x21
190#define CLUSTER_UP 0x22
191#define CLUSTER_GOING_DOWN 0x23
192
193#define INBOUND_NOT_COMING_UP 0x31
194#define INBOUND_COMING_UP 0x32
195
196/*
197 * Offsets for the mcpm_sync_struct members, for use in asm.
198 * We don't want to make them global to the kernel via asm-offsets.c.
199 */
200#define MCPM_SYNC_CLUSTER_CPUS 0
201#define MCPM_SYNC_CPU_SIZE __CACHE_WRITEBACK_GRANULE
202#define MCPM_SYNC_CLUSTER_CLUSTER \
203 (MCPM_SYNC_CLUSTER_CPUS + MCPM_SYNC_CPU_SIZE * MAX_CPUS_PER_CLUSTER)
204#define MCPM_SYNC_CLUSTER_INBOUND \
205 (MCPM_SYNC_CLUSTER_CLUSTER + __CACHE_WRITEBACK_GRANULE)
206#define MCPM_SYNC_CLUSTER_SIZE \
207 (MCPM_SYNC_CLUSTER_INBOUND + __CACHE_WRITEBACK_GRANULE)
208
209#endif
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 80d6fc4dbe4a..9bcd262a9008 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -61,6 +61,15 @@ extern void __pgd_error(const char *file, int line, pgd_t);
61#define FIRST_USER_ADDRESS PAGE_SIZE 61#define FIRST_USER_ADDRESS PAGE_SIZE
62 62
63/* 63/*
64 * Use TASK_SIZE as the ceiling argument for free_pgtables() and
65 * free_pgd_range() to avoid freeing the modules pmd when LPAE is enabled (pmd
66 * page shared between user and kernel).
67 */
68#ifdef CONFIG_ARM_LPAE
69#define USER_PGTABLES_CEILING TASK_SIZE
70#endif
71
72/*
64 * The pgprot_* and protection_map entries will be fixed up in runtime 73 * The pgprot_* and protection_map entries will be fixed up in runtime
65 * to include the cachable and bufferable bits based on memory policy, 74 * to include the cachable and bufferable bits based on memory policy,
66 * as well as any architecture dependent bits like global/ASID and SMP 75 * as well as any architecture dependent bits like global/ASID and SMP
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index 0f01f4677bd2..7b2899c2f7fc 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -34,12 +34,4 @@ struct twd_local_timer name __initdata = { \
34 34
35int twd_local_timer_register(struct twd_local_timer *); 35int twd_local_timer_register(struct twd_local_timer *);
36 36
37#ifdef CONFIG_HAVE_ARM_TWD
38void twd_local_timer_of_register(void);
39#else
40static inline void twd_local_timer_of_register(void)
41{
42}
43#endif
44
45#endif 37#endif
diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
index 5a85f148b607..21a23e378bbe 100644
--- a/arch/arm/include/asm/system_misc.h
+++ b/arch/arm/include/asm/system_misc.h
@@ -21,9 +21,6 @@ extern void (*arm_pm_idle)(void);
21 21
22extern unsigned int user_debug; 22extern unsigned int user_debug;
23 23
24extern void disable_hlt(void);
25extern void enable_hlt(void);
26
27#endif /* !__ASSEMBLY__ */ 24#endif /* !__ASSEMBLY__ */
28 25
29#endif /* __ASM_ARM_SYSTEM_MISC_H */ 26#endif /* __ASM_ARM_SYSTEM_MISC_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index cddda1f41f0f..1995d1a84060 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -152,6 +152,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
152#define TIF_SYSCALL_AUDIT 9 152#define TIF_SYSCALL_AUDIT 9
153#define TIF_SYSCALL_TRACEPOINT 10 153#define TIF_SYSCALL_TRACEPOINT 10
154#define TIF_SECCOMP 11 /* seccomp syscall filtering active */ 154#define TIF_SECCOMP 11 /* seccomp syscall filtering active */
155#define TIF_NOHZ 12 /* in adaptive nohz mode */
155#define TIF_USING_IWMMXT 17 156#define TIF_USING_IWMMXT 17
156#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 157#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
157#define TIF_RESTORE_SIGMASK 20 158#define TIF_RESTORE_SIGMASK 20
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index ab865e65a84c..a3625d141c1d 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -166,7 +166,7 @@
166# define v6wbi_always_flags (-1UL) 166# define v6wbi_always_flags (-1UL)
167#endif 167#endif
168 168
169#define v7wbi_tlb_flags_smp (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \ 169#define v7wbi_tlb_flags_smp (TLB_WB | TLB_BARRIER | \
170 TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | \ 170 TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | \
171 TLB_V7_UIS_ASID | TLB_V7_UIS_BP) 171 TLB_V7_UIS_ASID | TLB_V7_UIS_BP)
172#define v7wbi_tlb_flags_up (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \ 172#define v7wbi_tlb_flags_up (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index e4ddfb39ca34..141baa3f9a72 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -44,14 +44,6 @@
44#define __ARCH_WANT_SYS_CLONE 44#define __ARCH_WANT_SYS_CLONE
45 45
46/* 46/*
47 * "Conditional" syscalls
48 *
49 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
50 * but it doesn't work on all toolchains, so we just do it by hand
51 */
52#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
53
54/*
55 * Unimplemented (or alternatively implemented) syscalls 47 * Unimplemented (or alternatively implemented) syscalls
56 */ 48 */
57#define __IGNORE_fadvise64_64 49#define __IGNORE_fadvise64_64
diff --git a/arch/arm/mach-bcm2835/include/mach/debug-macro.S b/arch/arm/include/debug/bcm2835.S
index 8a161e44ae28..aed9199bd847 100644
--- a/arch/arm/mach-bcm2835/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/bcm2835.S
@@ -11,7 +11,8 @@
11 * 11 *
12 */ 12 */
13 13
14#include <mach/bcm2835_soc.h> 14#define BCM2835_DEBUG_PHYS 0x20201000
15#define BCM2835_DEBUG_VIRT 0xf0201000
15 16
16 .macro addruart, rp, rv, tmp 17 .macro addruart, rp, rv, tmp
17 ldr \rp, =BCM2835_DEBUG_PHYS 18 ldr \rp, =BCM2835_DEBUG_PHYS
diff --git a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S b/arch/arm/include/debug/cns3xxx.S
index d04c150baa1c..d04c150baa1c 100644
--- a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/cns3xxx.S
diff --git a/arch/arm/mach-exynos/include/mach/debug-macro.S b/arch/arm/include/debug/exynos.S
index e0c86ea475e7..b17fdb7fbd34 100644
--- a/arch/arm/mach-exynos/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/exynos.S
@@ -1,10 +1,7 @@
1/* linux/arch/arm/mach-exynos4/include/mach/debug-macro.S 1/*
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S
7 *
8 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
@@ -12,7 +9,10 @@
12 9
13/* pull in the relevant register and map files. */ 10/* pull in the relevant register and map files. */
14 11
15#include <mach/map.h> 12#define S3C_ADDR_BASE 0xF6000000
13#define S3C_VA_UART S3C_ADDR_BASE + 0x01000000
14#define EXYNOS4_PA_UART 0x13800000
15#define EXYNOS5_PA_UART 0x12C00000
16 16
17 /* note, for the boot process to work we have to keep the UART 17 /* note, for the boot process to work we have to keep the UART
18 * virtual address aligned to an 1MiB boundary for the L1 18 * virtual address aligned to an 1MiB boundary for the L1
@@ -36,4 +36,4 @@
36#define fifo_full fifo_full_s5pv210 36#define fifo_full fifo_full_s5pv210
37#define fifo_level fifo_level_s5pv210 37#define fifo_level fifo_level_s5pv210
38 38
39#include <plat/debug-macro.S> 39#include <debug/samsung.S>
diff --git a/arch/arm/mach-mxs/include/mach/debug-macro.S b/arch/arm/include/debug/mxs.S
index 90c6b7836ad3..d86951551ca1 100644
--- a/arch/arm/mach-mxs/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/mxs.S
@@ -11,16 +11,13 @@
11 * 11 *
12 */ 12 */
13 13
14#include <mach/mx23.h>
15#include <mach/mx28.h>
16
17#ifdef CONFIG_DEBUG_IMX23_UART 14#ifdef CONFIG_DEBUG_IMX23_UART
18#define UART_PADDR MX23_DUART_BASE_ADDR 15#define UART_PADDR 0x80070000
19#elif defined (CONFIG_DEBUG_IMX28_UART) 16#elif defined (CONFIG_DEBUG_IMX28_UART)
20#define UART_PADDR MX28_DUART_BASE_ADDR 17#define UART_PADDR 0x80074000
21#endif 18#endif
22 19
23#define UART_VADDR MXS_IO_ADDRESS(UART_PADDR) 20#define UART_VADDR 0xfe100000
24 21
25 .macro addruart, rp, rv, tmp 22 .macro addruart, rp, rv, tmp
26 ldr \rp, =UART_PADDR @ physical 23 ldr \rp, =UART_PADDR @ physical
diff --git a/arch/arm/mach-nomadik/include/mach/debug-macro.S b/arch/arm/include/debug/nomadik.S
index 735417922ce2..735417922ce2 100644
--- a/arch/arm/mach-nomadik/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/nomadik.S
diff --git a/arch/arm/include/debug/pxa.S b/arch/arm/include/debug/pxa.S
new file mode 100644
index 000000000000..e1e795aa3d7f
--- /dev/null
+++ b/arch/arm/include/debug/pxa.S
@@ -0,0 +1,33 @@
1/*
2 * Early serial output macro for Marvell PXA/MMP SoC
3 *
4 * Copyright (C) 1994-1999 Russell King
5 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
6 *
7 * Copyright (C) 2013 Haojian Zhuang
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#if defined(CONFIG_DEBUG_PXA_UART1)
15#define PXA_UART_REG_PHYS_BASE 0x40100000
16#define PXA_UART_REG_VIRT_BASE 0xf2100000
17#elif defined(CONFIG_DEBUG_MMP_UART2)
18#define PXA_UART_REG_PHYS_BASE 0xd4017000
19#define PXA_UART_REG_VIRT_BASE 0xfe017000
20#elif defined(CONFIG_DEBUG_MMP_UART3)
21#define PXA_UART_REG_PHYS_BASE 0xd4018000
22#define PXA_UART_REG_VIRT_BASE 0xfe018000
23#else
24#error "Select uart for DEBUG_LL"
25#endif
26
27 .macro addruart, rp, rv, tmp
28 ldr \rp, =PXA_UART_REG_PHYS_BASE
29 ldr \rv, =PXA_UART_REG_VIRT_BASE
30 .endm
31
32#define UART_SHIFT 2
33#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/plat-samsung/include/plat/debug-macro.S b/arch/arm/include/debug/samsung.S
index f3a9cff6d5d4..f3a9cff6d5d4 100644
--- a/arch/arm/plat-samsung/include/plat/debug-macro.S
+++ b/arch/arm/include/debug/samsung.S
diff --git a/arch/arm/mach-prima2/include/mach/uart.h b/arch/arm/include/debug/sirf.S
index c10510d01a44..dbf250cf18e6 100644
--- a/arch/arm/mach-prima2/include/mach/uart.h
+++ b/arch/arm/include/debug/sirf.S
@@ -1,15 +1,11 @@
1/* 1/*
2 * arch/arm/mach-prima2/include/mach/uart.h 2 * arch/arm/mach-prima2/include/mach/debug-macro.S
3 * 3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. 4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 * 5 *
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8 8
9#ifndef __MACH_PRIMA2_SIRFSOC_UART_H
10#define __MACH_PRIMA2_SIRFSOC_UART_H
11
12/* UART-1: used as serial debug port */
13#if defined(CONFIG_DEBUG_SIRFPRIMA2_UART1) 9#if defined(CONFIG_DEBUG_SIRFPRIMA2_UART1)
14#define SIRFSOC_UART1_PA_BASE 0xb0060000 10#define SIRFSOC_UART1_PA_BASE 0xb0060000
15#elif defined(CONFIG_DEBUG_SIRFMARCO_UART1) 11#elif defined(CONFIG_DEBUG_SIRFMARCO_UART1)
@@ -17,8 +13,8 @@
17#else 13#else
18#define SIRFSOC_UART1_PA_BASE 0 14#define SIRFSOC_UART1_PA_BASE 0
19#endif 15#endif
20#define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000) 16
21#define SIRFSOC_UART1_SIZE SZ_4K 17#define SIRFSOC_UART1_VA_BASE 0xFEC60000
22 18
23#define SIRFSOC_UART_TXFIFO_STATUS 0x0114 19#define SIRFSOC_UART_TXFIFO_STATUS 0x0114
24#define SIRFSOC_UART_TXFIFO_DATA 0x0118 20#define SIRFSOC_UART_TXFIFO_DATA 0x0118
@@ -26,4 +22,21 @@
26#define SIRFSOC_UART1_TXFIFO_FULL (1 << 5) 22#define SIRFSOC_UART1_TXFIFO_FULL (1 << 5)
27#define SIRFSOC_UART1_TXFIFO_EMPTY (1 << 6) 23#define SIRFSOC_UART1_TXFIFO_EMPTY (1 << 6)
28 24
29#endif 25 .macro addruart, rp, rv, tmp
26 ldr \rp, =SIRFSOC_UART1_PA_BASE @ physical
27 ldr \rv, =SIRFSOC_UART1_VA_BASE @ virtual
28 .endm
29
30 .macro senduart,rd,rx
31 str \rd, [\rx, #SIRFSOC_UART_TXFIFO_DATA]
32 .endm
33
34 .macro busyuart,rd,rx
35 .endm
36
37 .macro waituart,rd,rx
381001: ldr \rd, [\rx, #SIRFSOC_UART_TXFIFO_STATUS]
39 tst \rd, #SIRFSOC_UART1_TXFIFO_EMPTY
40 beq 1001b
41 .endm
42
diff --git a/arch/arm/include/debug/uncompress.h b/arch/arm/include/debug/uncompress.h
new file mode 100644
index 000000000000..0e2949b0fae9
--- /dev/null
+++ b/arch/arm/include/debug/uncompress.h
@@ -0,0 +1,7 @@
1#ifdef CONFIG_DEBUG_UNCOMPRESS
2extern void putc(int c);
3#else
4static inline void putc(int c) {}
5#endif
6static inline void flush(void) {}
7static inline void arch_decomp_setup(void) {}
diff --git a/arch/arm/include/debug/ux500.S b/arch/arm/include/debug/ux500.S
new file mode 100644
index 000000000000..2848857f5b62
--- /dev/null
+++ b/arch/arm/include/debug/ux500.S
@@ -0,0 +1,48 @@
1/*
2 * Debugging macro include header
3 *
4 * Copyright (C) 2009 ST-Ericsson
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12
13#if CONFIG_UX500_DEBUG_UART > 2
14#error Invalid Ux500 debug UART
15#endif
16
17/*
18 * DEBUG_LL only works if only one SOC is built in. We don't use #else below
19 * in order to get "__UX500_UART redefined" warnings if more than one SOC is
20 * built, so that there's some hint during the build that something is wrong.
21 */
22
23#ifdef CONFIG_UX500_SOC_DB8500
24#define U8500_UART0_PHYS_BASE (0x80120000)
25#define U8500_UART1_PHYS_BASE (0x80121000)
26#define U8500_UART2_PHYS_BASE (0x80007000)
27#define U8500_UART0_VIRT_BASE (0xa8120000)
28#define U8500_UART1_VIRT_BASE (0xa8121000)
29#define U8500_UART2_VIRT_BASE (0xa8007000)
30#define __UX500_PHYS_UART(n) U8500_UART##n##_PHYS_BASE
31#define __UX500_VIRT_UART(n) U8500_UART##n##_VIRT_BASE
32#endif
33
34#if !defined(__UX500_PHYS_UART) || !defined(__UX500_VIRT_UART)
35#error Unknown SOC
36#endif
37
38#define UX500_PHYS_UART(n) __UX500_PHYS_UART(n)
39#define UX500_VIRT_UART(n) __UX500_VIRT_UART(n)
40#define UART_PHYS_BASE UX500_PHYS_UART(CONFIG_UX500_DEBUG_UART)
41#define UART_VIRT_BASE UX500_VIRT_UART(CONFIG_UX500_DEBUG_UART)
42
43 .macro addruart, rp, rv, tmp
44 ldr \rp, =UART_PHYS_BASE @ no, physical address
45 ldr \rv, =UART_VIRT_BASE @ yes, virtual address
46 .endm
47
48#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/include/uapi/asm/kvm.h b/arch/arm/include/uapi/asm/kvm.h
index 023bfeb367bf..c1ee007523d7 100644
--- a/arch/arm/include/uapi/asm/kvm.h
+++ b/arch/arm/include/uapi/asm/kvm.h
@@ -53,12 +53,12 @@
53#define KVM_ARM_FIQ_spsr fiq_regs[7] 53#define KVM_ARM_FIQ_spsr fiq_regs[7]
54 54
55struct kvm_regs { 55struct kvm_regs {
56 struct pt_regs usr_regs;/* R0_usr - R14_usr, PC, CPSR */ 56 struct pt_regs usr_regs; /* R0_usr - R14_usr, PC, CPSR */
57 __u32 svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */ 57 unsigned long svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */
58 __u32 abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */ 58 unsigned long abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */
59 __u32 und_regs[3]; /* SP_und, LR_und, SPSR_und */ 59 unsigned long und_regs[3]; /* SP_und, LR_und, SPSR_und */
60 __u32 irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */ 60 unsigned long irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */
61 __u32 fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */ 61 unsigned long fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */
62}; 62};
63 63
64/* Supported Processor Types */ 64/* Supported Processor Types */
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 923eec7105cf..ee68cce6b48e 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -149,12 +149,16 @@ int main(void)
149 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); 149 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
150 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); 150 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE);
151 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE); 151 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVICE);
152 BLANK();
153 DEFINE(CACHE_WRITEBACK_ORDER, __CACHE_WRITEBACK_ORDER);
154 DEFINE(CACHE_WRITEBACK_GRANULE, __CACHE_WRITEBACK_GRANULE);
155 BLANK();
152#ifdef CONFIG_KVM_ARM_HOST 156#ifdef CONFIG_KVM_ARM_HOST
153 DEFINE(VCPU_KVM, offsetof(struct kvm_vcpu, kvm)); 157 DEFINE(VCPU_KVM, offsetof(struct kvm_vcpu, kvm));
154 DEFINE(VCPU_MIDR, offsetof(struct kvm_vcpu, arch.midr)); 158 DEFINE(VCPU_MIDR, offsetof(struct kvm_vcpu, arch.midr));
155 DEFINE(VCPU_CP15, offsetof(struct kvm_vcpu, arch.cp15)); 159 DEFINE(VCPU_CP15, offsetof(struct kvm_vcpu, arch.cp15));
156 DEFINE(VCPU_VFP_GUEST, offsetof(struct kvm_vcpu, arch.vfp_guest)); 160 DEFINE(VCPU_VFP_GUEST, offsetof(struct kvm_vcpu, arch.vfp_guest));
157 DEFINE(VCPU_VFP_HOST, offsetof(struct kvm_vcpu, arch.vfp_host)); 161 DEFINE(VCPU_VFP_HOST, offsetof(struct kvm_vcpu, arch.host_cpu_context));
158 DEFINE(VCPU_REGS, offsetof(struct kvm_vcpu, arch.regs)); 162 DEFINE(VCPU_REGS, offsetof(struct kvm_vcpu, arch.regs));
159 DEFINE(VCPU_USR_REGS, offsetof(struct kvm_vcpu, arch.regs.usr_regs)); 163 DEFINE(VCPU_USR_REGS, offsetof(struct kvm_vcpu, arch.regs.usr_regs));
160 DEFINE(VCPU_SVC_REGS, offsetof(struct kvm_vcpu, arch.regs.svc_regs)); 164 DEFINE(VCPU_SVC_REGS, offsetof(struct kvm_vcpu, arch.regs.svc_regs));
@@ -165,10 +169,10 @@ int main(void)
165 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.regs.usr_regs.ARM_pc)); 169 DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.regs.usr_regs.ARM_pc));
166 DEFINE(VCPU_CPSR, offsetof(struct kvm_vcpu, arch.regs.usr_regs.ARM_cpsr)); 170 DEFINE(VCPU_CPSR, offsetof(struct kvm_vcpu, arch.regs.usr_regs.ARM_cpsr));
167 DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines)); 171 DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines));
168 DEFINE(VCPU_HSR, offsetof(struct kvm_vcpu, arch.hsr)); 172 DEFINE(VCPU_HSR, offsetof(struct kvm_vcpu, arch.fault.hsr));
169 DEFINE(VCPU_HxFAR, offsetof(struct kvm_vcpu, arch.hxfar)); 173 DEFINE(VCPU_HxFAR, offsetof(struct kvm_vcpu, arch.fault.hxfar));
170 DEFINE(VCPU_HPFAR, offsetof(struct kvm_vcpu, arch.hpfar)); 174 DEFINE(VCPU_HPFAR, offsetof(struct kvm_vcpu, arch.fault.hpfar));
171 DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.hyp_pc)); 175 DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.fault.hyp_pc));
172#ifdef CONFIG_KVM_ARM_VGIC 176#ifdef CONFIG_KVM_ARM_VGIC
173 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu)); 177 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu));
174 DEFINE(VGIC_CPU_HCR, offsetof(struct vgic_cpu, vgic_hcr)); 178 DEFINE(VGIC_CPU_HCR, offsetof(struct vgic_cpu, vgic_hcr));
diff --git a/arch/arm/kernel/atags_proc.c b/arch/arm/kernel/atags_proc.c
index 42a1a1415fa6..c7ff8073416f 100644
--- a/arch/arm/kernel/atags_proc.c
+++ b/arch/arm/kernel/atags_proc.c
@@ -9,24 +9,18 @@ struct buffer {
9 char data[]; 9 char data[];
10}; 10};
11 11
12static int 12static ssize_t atags_read(struct file *file, char __user *buf,
13read_buffer(char* page, char** start, off_t off, int count, 13 size_t count, loff_t *ppos)
14 int* eof, void* data)
15{ 14{
16 struct buffer *buffer = (struct buffer *)data; 15 struct buffer *b = PDE_DATA(file_inode(file));
17 16 return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
18 if (off >= buffer->size) {
19 *eof = 1;
20 return 0;
21 }
22
23 count = min((int) (buffer->size - off), count);
24
25 memcpy(page, &buffer->data[off], count);
26
27 return count;
28} 17}
29 18
19static const struct file_operations atags_fops = {
20 .read = atags_read,
21 .llseek = default_llseek,
22};
23
30#define BOOT_PARAMS_SIZE 1536 24#define BOOT_PARAMS_SIZE 1536
31static char __initdata atags_copy[BOOT_PARAMS_SIZE]; 25static char __initdata atags_copy[BOOT_PARAMS_SIZE];
32 26
@@ -66,9 +60,7 @@ static int __init init_atags_procfs(void)
66 b->size = size; 60 b->size = size;
67 memcpy(b->data, atags_copy, size); 61 memcpy(b->data, atags_copy, size);
68 62
69 tags_entry = create_proc_read_entry("atags", 0400, 63 tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b);
70 NULL, read_buffer, b);
71
72 if (!tags_entry) 64 if (!tags_entry)
73 goto nomem; 65 goto nomem;
74 66
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index a1f73b502ef0..b2ed73c45489 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -462,6 +462,7 @@ static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
462 sys->busnr = busnr; 462 sys->busnr = busnr;
463 sys->swizzle = hw->swizzle; 463 sys->swizzle = hw->swizzle;
464 sys->map_irq = hw->map_irq; 464 sys->map_irq = hw->map_irq;
465 sys->align_resource = hw->align_resource;
465 INIT_LIST_HEAD(&sys->resources); 466 INIT_LIST_HEAD(&sys->resources);
466 467
467 if (hw->private_data) 468 if (hw->private_data)
@@ -574,6 +575,8 @@ char * __init pcibios_setup(char *str)
574resource_size_t pcibios_align_resource(void *data, const struct resource *res, 575resource_size_t pcibios_align_resource(void *data, const struct resource *res,
575 resource_size_t size, resource_size_t align) 576 resource_size_t size, resource_size_t align)
576{ 577{
578 struct pci_dev *dev = data;
579 struct pci_sys_data *sys = dev->sysdata;
577 resource_size_t start = res->start; 580 resource_size_t start = res->start;
578 581
579 if (res->flags & IORESOURCE_IO && start & 0x300) 582 if (res->flags & IORESOURCE_IO && start & 0x300)
@@ -581,6 +584,9 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
581 584
582 start = (start + align - 1) & ~(align - 1); 585 start = (start + align - 1) & ~(align - 1);
583 586
587 if (sys->align_resource)
588 return sys->align_resource(dev, res, start, size, align);
589
584 return start; 590 return start;
585} 591}
586 592
diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
index 85aa2b292692..43076536965c 100644
--- a/arch/arm/kernel/early_printk.c
+++ b/arch/arm/kernel/early_printk.c
@@ -29,28 +29,17 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
29 early_write(s, n); 29 early_write(s, n);
30} 30}
31 31
32static struct console early_console = { 32static struct console early_console_dev = {
33 .name = "earlycon", 33 .name = "earlycon",
34 .write = early_console_write, 34 .write = early_console_write,
35 .flags = CON_PRINTBUFFER | CON_BOOT, 35 .flags = CON_PRINTBUFFER | CON_BOOT,
36 .index = -1, 36 .index = -1,
37}; 37};
38 38
39asmlinkage void early_printk(const char *fmt, ...)
40{
41 char buf[512];
42 int n;
43 va_list ap;
44
45 va_start(ap, fmt);
46 n = vscnprintf(buf, sizeof(buf), fmt, ap);
47 early_write(buf, n);
48 va_end(ap);
49}
50
51static int __init setup_early_printk(char *buf) 39static int __init setup_early_printk(char *buf)
52{ 40{
53 register_console(&early_console); 41 early_console = &early_console_dev;
42 register_console(&early_console_dev);
54 return 0; 43 return 0;
55} 44}
56 45
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098c9bfe..582b405befc5 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -192,18 +192,6 @@ __dabt_svc:
192 svc_entry 192 svc_entry
193 mov r2, sp 193 mov r2, sp
194 dabt_helper 194 dabt_helper
195
196 @
197 @ IRQs off again before pulling preserved data off the stack
198 @
199 disable_irq_notrace
200
201#ifdef CONFIG_TRACE_IRQFLAGS
202 tst r5, #PSR_I_BIT
203 bleq trace_hardirqs_on
204 tst r5, #PSR_I_BIT
205 blne trace_hardirqs_off
206#endif
207 svc_exit r5 @ return from exception 195 svc_exit r5 @ return from exception
208 UNWIND(.fnend ) 196 UNWIND(.fnend )
209ENDPROC(__dabt_svc) 197ENDPROC(__dabt_svc)
@@ -223,12 +211,7 @@ __irq_svc:
223 blne svc_preempt 211 blne svc_preempt
224#endif 212#endif
225 213
226#ifdef CONFIG_TRACE_IRQFLAGS 214 svc_exit r5, irq = 1 @ return from exception
227 @ The parent context IRQs must have been enabled to get here in
228 @ the first place, so there's no point checking the PSR I bit.
229 bl trace_hardirqs_on
230#endif
231 svc_exit r5 @ return from exception
232 UNWIND(.fnend ) 215 UNWIND(.fnend )
233ENDPROC(__irq_svc) 216ENDPROC(__irq_svc)
234 217
@@ -295,22 +278,8 @@ __und_svc_fault:
295 mov r0, sp @ struct pt_regs *regs 278 mov r0, sp @ struct pt_regs *regs
296 bl __und_fault 279 bl __und_fault
297 280
298 @
299 @ IRQs off again before pulling preserved data off the stack
300 @
301__und_svc_finish: 281__und_svc_finish:
302 disable_irq_notrace
303
304 @
305 @ restore SPSR and restart the instruction
306 @
307 ldr r5, [sp, #S_PSR] @ Get SVC cpsr 282 ldr r5, [sp, #S_PSR] @ Get SVC cpsr
308#ifdef CONFIG_TRACE_IRQFLAGS
309 tst r5, #PSR_I_BIT
310 bleq trace_hardirqs_on
311 tst r5, #PSR_I_BIT
312 blne trace_hardirqs_off
313#endif
314 svc_exit r5 @ return from exception 283 svc_exit r5 @ return from exception
315 UNWIND(.fnend ) 284 UNWIND(.fnend )
316ENDPROC(__und_svc) 285ENDPROC(__und_svc)
@@ -320,18 +289,6 @@ __pabt_svc:
320 svc_entry 289 svc_entry
321 mov r2, sp @ regs 290 mov r2, sp @ regs
322 pabt_helper 291 pabt_helper
323
324 @
325 @ IRQs off again before pulling preserved data off the stack
326 @
327 disable_irq_notrace
328
329#ifdef CONFIG_TRACE_IRQFLAGS
330 tst r5, #PSR_I_BIT
331 bleq trace_hardirqs_on
332 tst r5, #PSR_I_BIT
333 blne trace_hardirqs_off
334#endif
335 svc_exit r5 @ return from exception 292 svc_exit r5 @ return from exception
336 UNWIND(.fnend ) 293 UNWIND(.fnend )
337ENDPROC(__pabt_svc) 294ENDPROC(__pabt_svc)
@@ -396,6 +353,7 @@ ENDPROC(__pabt_svc)
396#ifdef CONFIG_IRQSOFF_TRACER 353#ifdef CONFIG_IRQSOFF_TRACER
397 bl trace_hardirqs_off 354 bl trace_hardirqs_off
398#endif 355#endif
356 ct_user_exit save = 0
399 .endm 357 .endm
400 358
401 .macro kuser_cmpxchg_check 359 .macro kuser_cmpxchg_check
@@ -562,21 +520,21 @@ ENDPROC(__und_usr)
562 @ Fall-through from Thumb-2 __und_usr 520 @ Fall-through from Thumb-2 __und_usr
563 @ 521 @
564#ifdef CONFIG_NEON 522#ifdef CONFIG_NEON
523 get_thread_info r10 @ get current thread
565 adr r6, .LCneon_thumb_opcodes 524 adr r6, .LCneon_thumb_opcodes
566 b 2f 525 b 2f
567#endif 526#endif
568call_fpe: 527call_fpe:
528 get_thread_info r10 @ get current thread
569#ifdef CONFIG_NEON 529#ifdef CONFIG_NEON
570 adr r6, .LCneon_arm_opcodes 530 adr r6, .LCneon_arm_opcodes
5712: 5312: ldr r5, [r6], #4 @ mask value
572 ldr r7, [r6], #4 @ mask value
573 cmp r7, #0 @ end mask?
574 beq 1f
575 and r8, r0, r7
576 ldr r7, [r6], #4 @ opcode bits matching in mask 532 ldr r7, [r6], #4 @ opcode bits matching in mask
533 cmp r5, #0 @ end mask?
534 beq 1f
535 and r8, r0, r5
577 cmp r8, r7 @ NEON instruction? 536 cmp r8, r7 @ NEON instruction?
578 bne 2b 537 bne 2b
579 get_thread_info r10
580 mov r7, #1 538 mov r7, #1
581 strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used 539 strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used
582 strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used 540 strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used
@@ -586,7 +544,6 @@ call_fpe:
586 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 544 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
587 tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 545 tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2
588 moveq pc, lr 546 moveq pc, lr
589 get_thread_info r10 @ get current thread
590 and r8, r0, #0x00000f00 @ mask out CP number 547 and r8, r0, #0x00000f00 @ mask out CP number
591 THUMB( lsr r8, r8, #8 ) 548 THUMB( lsr r8, r8, #8 )
592 mov r7, #1 549 mov r7, #1
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index fefd7f971437..bc5bc0a97131 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -35,12 +35,11 @@ ret_fast_syscall:
35 ldr r1, [tsk, #TI_FLAGS] 35 ldr r1, [tsk, #TI_FLAGS]
36 tst r1, #_TIF_WORK_MASK 36 tst r1, #_TIF_WORK_MASK
37 bne fast_work_pending 37 bne fast_work_pending
38#if defined(CONFIG_IRQSOFF_TRACER)
39 asm_trace_hardirqs_on 38 asm_trace_hardirqs_on
40#endif
41 39
42 /* perform architecture specific actions before user return */ 40 /* perform architecture specific actions before user return */
43 arch_ret_to_user r1, lr 41 arch_ret_to_user r1, lr
42 ct_user_enter
44 43
45 restore_user_regs fast = 1, offset = S_OFF 44 restore_user_regs fast = 1, offset = S_OFF
46 UNWIND(.fnend ) 45 UNWIND(.fnend )
@@ -71,11 +70,11 @@ ENTRY(ret_to_user_from_irq)
71 tst r1, #_TIF_WORK_MASK 70 tst r1, #_TIF_WORK_MASK
72 bne work_pending 71 bne work_pending
73no_work_pending: 72no_work_pending:
74#if defined(CONFIG_IRQSOFF_TRACER)
75 asm_trace_hardirqs_on 73 asm_trace_hardirqs_on
76#endif 74
77 /* perform architecture specific actions before user return */ 75 /* perform architecture specific actions before user return */
78 arch_ret_to_user r1, lr 76 arch_ret_to_user r1, lr
77 ct_user_enter save = 0
79 78
80 restore_user_regs fast = 0, offset = 0 79 restore_user_regs fast = 0, offset = 0
81ENDPROC(ret_to_user_from_irq) 80ENDPROC(ret_to_user_from_irq)
@@ -406,6 +405,7 @@ ENTRY(vector_swi)
406 mcr p15, 0, ip, c1, c0 @ update control register 405 mcr p15, 0, ip, c1, c0 @ update control register
407#endif 406#endif
408 enable_irq 407 enable_irq
408 ct_user_exit
409 409
410 get_thread_info tsk 410 get_thread_info tsk
411 adr tbl, sys_call_table @ load syscall table pointer 411 adr tbl, sys_call_table @ load syscall table pointer
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 9a8531eadd3d..160f3376ba6d 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -74,7 +74,24 @@
74 .endm 74 .endm
75 75
76#ifndef CONFIG_THUMB2_KERNEL 76#ifndef CONFIG_THUMB2_KERNEL
77 .macro svc_exit, rpsr 77 .macro svc_exit, rpsr, irq = 0
78 .if \irq != 0
79 @ IRQs already off
80#ifdef CONFIG_TRACE_IRQFLAGS
81 @ The parent context IRQs must have been enabled to get here in
82 @ the first place, so there's no point checking the PSR I bit.
83 bl trace_hardirqs_on
84#endif
85 .else
86 @ IRQs off again before pulling preserved data off the stack
87 disable_irq_notrace
88#ifdef CONFIG_TRACE_IRQFLAGS
89 tst \rpsr, #PSR_I_BIT
90 bleq trace_hardirqs_on
91 tst \rpsr, #PSR_I_BIT
92 blne trace_hardirqs_off
93#endif
94 .endif
78 msr spsr_cxsf, \rpsr 95 msr spsr_cxsf, \rpsr
79#if defined(CONFIG_CPU_V6) 96#if defined(CONFIG_CPU_V6)
80 ldr r0, [sp] 97 ldr r0, [sp]
@@ -120,7 +137,24 @@
120 mov pc, \reg 137 mov pc, \reg
121 .endm 138 .endm
122#else /* CONFIG_THUMB2_KERNEL */ 139#else /* CONFIG_THUMB2_KERNEL */
123 .macro svc_exit, rpsr 140 .macro svc_exit, rpsr, irq = 0
141 .if \irq != 0
142 @ IRQs already off
143#ifdef CONFIG_TRACE_IRQFLAGS
144 @ The parent context IRQs must have been enabled to get here in
145 @ the first place, so there's no point checking the PSR I bit.
146 bl trace_hardirqs_on
147#endif
148 .else
149 @ IRQs off again before pulling preserved data off the stack
150 disable_irq_notrace
151#ifdef CONFIG_TRACE_IRQFLAGS
152 tst \rpsr, #PSR_I_BIT
153 bleq trace_hardirqs_on
154 tst \rpsr, #PSR_I_BIT
155 blne trace_hardirqs_off
156#endif
157 .endif
124 ldr lr, [sp, #S_SP] @ top of the stack 158 ldr lr, [sp, #S_SP] @ top of the stack
125 ldrd r0, r1, [sp, #S_LR] @ calling lr and pc 159 ldrd r0, r1, [sp, #S_LR] @ calling lr and pc
126 clrex @ clear the exclusive monitor 160 clrex @ clear the exclusive monitor
@@ -164,6 +198,34 @@
164#endif /* !CONFIG_THUMB2_KERNEL */ 198#endif /* !CONFIG_THUMB2_KERNEL */
165 199
166/* 200/*
201 * Context tracking subsystem. Used to instrument transitions
202 * between user and kernel mode.
203 */
204 .macro ct_user_exit, save = 1
205#ifdef CONFIG_CONTEXT_TRACKING
206 .if \save
207 stmdb sp!, {r0-r3, ip, lr}
208 bl user_exit
209 ldmia sp!, {r0-r3, ip, lr}
210 .else
211 bl user_exit
212 .endif
213#endif
214 .endm
215
216 .macro ct_user_enter, save = 1
217#ifdef CONFIG_CONTEXT_TRACKING
218 .if \save
219 stmdb sp!, {r0-r3, ip, lr}
220 bl user_enter
221 ldmia sp!, {r0-r3, ip, lr}
222 .else
223 bl user_enter
224 .endif
225#endif
226 .endm
227
228/*
167 * These are the registers used in the syscall handler, and allow us to 229 * These are the registers used in the syscall handler, and allow us to
168 * have in theory up to 7 arguments to a function - r0 to r6. 230 * have in theory up to 7 arguments to a function - r0 to r6.
169 * 231 *
diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 9b6de8c988f3..8ff0ecdc637f 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -254,7 +254,7 @@ static void sysrq_etm_dump(int key)
254 254
255static struct sysrq_key_op sysrq_etm_op = { 255static struct sysrq_key_op sysrq_etm_op = {
256 .handler = sysrq_etm_dump, 256 .handler = sysrq_etm_dump,
257 .help_msg = "ETM buffer dump", 257 .help_msg = "etm-buffer-dump(v)",
258 .action_msg = "etm", 258 .action_msg = "etm",
259}; 259};
260 260
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 854bd22380d3..5b391a689b47 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -98,8 +98,9 @@ __mmap_switched:
98 str r9, [r4] @ Save processor ID 98 str r9, [r4] @ Save processor ID
99 str r1, [r5] @ Save machine type 99 str r1, [r5] @ Save machine type
100 str r2, [r6] @ Save atags pointer 100 str r2, [r6] @ Save atags pointer
101 bic r4, r0, #CR_A @ Clear 'A' bit 101 cmp r7, #0
102 stmia r7, {r0, r4} @ Save control register values 102 bicne r4, r0, #CR_A @ Clear 'A' bit
103 stmneia r7, {r0, r4} @ Save control register values
103 b start_kernel 104 b start_kernel
104ENDPROC(__mmap_switched) 105ENDPROC(__mmap_switched)
105 106
@@ -113,7 +114,11 @@ __mmap_switched_data:
113 .long processor_id @ r4 114 .long processor_id @ r4
114 .long __machine_arch_type @ r5 115 .long __machine_arch_type @ r5
115 .long __atags_pointer @ r6 116 .long __atags_pointer @ r6
117#ifdef CONFIG_CPU_CP15
116 .long cr_alignment @ r7 118 .long cr_alignment @ r7
119#else
120 .long 0 @ r7
121#endif
117 .long init_thread_union + THREAD_START_SP @ sp 122 .long init_thread_union + THREAD_START_SP @ sp
118 .size __mmap_switched_data, . - __mmap_switched_data 123 .size __mmap_switched_data, . - __mmap_switched_data
119 124
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 2c228a07e58c..6a2e09c952c7 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -32,15 +32,21 @@
32 * numbers for r1. 32 * numbers for r1.
33 * 33 *
34 */ 34 */
35 .arm
36 35
37 __HEAD 36 __HEAD
37
38#ifdef CONFIG_CPU_THUMBONLY
39 .thumb
40ENTRY(stext)
41#else
42 .arm
38ENTRY(stext) 43ENTRY(stext)
39 44
40 THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM. 45 THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM.
41 THUMB( bx r9 ) @ If this is a Thumb-2 kernel, 46 THUMB( bx r9 ) @ If this is a Thumb-2 kernel,
42 THUMB( .thumb ) @ switch to Thumb now. 47 THUMB( .thumb ) @ switch to Thumb now.
43 THUMB(1: ) 48 THUMB(1: )
49#endif
44 50
45 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode 51 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
46 @ and irqs disabled 52 @ and irqs disabled
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 8e4ef4c83a74..9723d17b8f38 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -26,6 +26,7 @@
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/irq.h> 28#include <linux/irq.h>
29#include <linux/irqchip.h>
29#include <linux/random.h> 30#include <linux/random.h>
30#include <linux/smp.h> 31#include <linux/smp.h>
31#include <linux/init.h> 32#include <linux/init.h>
@@ -114,7 +115,10 @@ EXPORT_SYMBOL_GPL(set_irq_flags);
114 115
115void __init init_IRQ(void) 116void __init init_IRQ(void)
116{ 117{
117 machine_desc->init_irq(); 118 if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq)
119 irqchip_init();
120 else
121 machine_desc->init_irq();
118} 122}
119 123
120#ifdef CONFIG_MULTI_IRQ_HANDLER 124#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 047d3e40e470..f21970316836 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -57,38 +57,6 @@ static const char *isa_modes[] = {
57 "ARM" , "Thumb" , "Jazelle", "ThumbEE" 57 "ARM" , "Thumb" , "Jazelle", "ThumbEE"
58}; 58};
59 59
60static volatile int hlt_counter;
61
62void disable_hlt(void)
63{
64 hlt_counter++;
65}
66
67EXPORT_SYMBOL(disable_hlt);
68
69void enable_hlt(void)
70{
71 hlt_counter--;
72 BUG_ON(hlt_counter < 0);
73}
74
75EXPORT_SYMBOL(enable_hlt);
76
77static int __init nohlt_setup(char *__unused)
78{
79 hlt_counter = 1;
80 return 1;
81}
82
83static int __init hlt_setup(char *__unused)
84{
85 hlt_counter = 0;
86 return 1;
87}
88
89__setup("nohlt", nohlt_setup);
90__setup("hlt", hlt_setup);
91
92extern void call_with_stack(void (*fn)(void *), void *arg, void *sp); 60extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
93typedef void (*phys_reset_t)(unsigned long); 61typedef void (*phys_reset_t)(unsigned long);
94 62
@@ -172,54 +140,38 @@ static void default_idle(void)
172 local_irq_enable(); 140 local_irq_enable();
173} 141}
174 142
175/* 143void arch_cpu_idle_prepare(void)
176 * The idle thread.
177 * We always respect 'hlt_counter' to prevent low power idle.
178 */
179void cpu_idle(void)
180{ 144{
181 local_fiq_enable(); 145 local_fiq_enable();
146}
182 147
183 /* endless idle loop with no priority at all */ 148void arch_cpu_idle_enter(void)
184 while (1) { 149{
185 tick_nohz_idle_enter(); 150 ledtrig_cpu(CPU_LED_IDLE_START);
186 rcu_idle_enter(); 151#ifdef CONFIG_PL310_ERRATA_769419
187 ledtrig_cpu(CPU_LED_IDLE_START); 152 wmb();
188 while (!need_resched()) {
189#ifdef CONFIG_HOTPLUG_CPU
190 if (cpu_is_offline(smp_processor_id()))
191 cpu_die();
192#endif 153#endif
154}
193 155
194 /* 156void arch_cpu_idle_exit(void)
195 * We need to disable interrupts here 157{
196 * to ensure we don't miss a wakeup call. 158 ledtrig_cpu(CPU_LED_IDLE_END);
197 */ 159}
198 local_irq_disable(); 160
199#ifdef CONFIG_PL310_ERRATA_769419 161#ifdef CONFIG_HOTPLUG_CPU
200 wmb(); 162void arch_cpu_idle_dead(void)
163{
164 cpu_die();
165}
201#endif 166#endif
202 if (hlt_counter) { 167
203 local_irq_enable(); 168/*
204 cpu_relax(); 169 * Called from the core idle loop.
205 } else if (!need_resched()) { 170 */
206 stop_critical_timings(); 171void arch_cpu_idle(void)
207 if (cpuidle_idle_call()) 172{
208 default_idle(); 173 if (cpuidle_idle_call())
209 start_critical_timings(); 174 default_idle();
210 /*
211 * default_idle functions must always
212 * return with IRQs enabled.
213 */
214 WARN_ON(irqs_disabled());
215 } else
216 local_irq_enable();
217 }
218 ledtrig_cpu(CPU_LED_IDLE_END);
219 rcu_idle_exit();
220 tick_nohz_idle_exit();
221 schedule_preempt_disabled();
222 }
223} 175}
224 176
225static char reboot_mode = 'h'; 177static char reboot_mode = 'h';
@@ -273,11 +225,8 @@ void __show_regs(struct pt_regs *regs)
273 unsigned long flags; 225 unsigned long flags;
274 char buf[64]; 226 char buf[64];
275 227
276 printk("CPU: %d %s (%s %.*s)\n", 228 show_regs_print_info(KERN_DEFAULT);
277 raw_smp_processor_id(), print_tainted(), 229
278 init_utsname()->release,
279 (int)strcspn(init_utsname()->version, " "),
280 init_utsname()->version);
281 print_symbol("PC is at %s\n", instruction_pointer(regs)); 230 print_symbol("PC is at %s\n", instruction_pointer(regs));
282 print_symbol("LR is at %s\n", regs->ARM_lr); 231 print_symbol("LR is at %s\n", regs->ARM_lr);
283 printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" 232 printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
@@ -332,7 +281,6 @@ void __show_regs(struct pt_regs *regs)
332void show_regs(struct pt_regs * regs) 281void show_regs(struct pt_regs * regs)
333{ 282{
334 printk("\n"); 283 printk("\n");
335 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
336 __show_regs(regs); 284 __show_regs(regs);
337 dump_stack(); 285 dump_stack();
338} 286}
@@ -459,15 +407,16 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
459 * atomic helpers and the signal restart code. Insert it into the 407 * atomic helpers and the signal restart code. Insert it into the
460 * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. 408 * gate_vma so that it is visible through ptrace and /proc/<pid>/mem.
461 */ 409 */
462static struct vm_area_struct gate_vma; 410static struct vm_area_struct gate_vma = {
411 .vm_start = 0xffff0000,
412 .vm_end = 0xffff0000 + PAGE_SIZE,
413 .vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYEXEC,
414 .vm_mm = &init_mm,
415};
463 416
464static int __init gate_vma_init(void) 417static int __init gate_vma_init(void)
465{ 418{
466 gate_vma.vm_start = 0xffff0000; 419 gate_vma.vm_page_prot = PAGE_READONLY_EXEC;
467 gate_vma.vm_end = 0xffff0000 + PAGE_SIZE;
468 gate_vma.vm_page_prot = PAGE_READONLY_EXEC;
469 gate_vma.vm_flags = VM_READ | VM_EXEC |
470 VM_MAYREAD | VM_MAYEXEC;
471 return 0; 420 return 0;
472} 421}
473arch_initcall(gate_vma_init); 422arch_initcall(gate_vma_init);
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index 8085417555dd..fafedd86885d 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -26,7 +26,7 @@ static int save_return_addr(struct stackframe *frame, void *d)
26 struct return_address_data *data = d; 26 struct return_address_data *data = d;
27 27
28 if (!data->level) { 28 if (!data->level) {
29 data->addr = (void *)frame->lr; 29 data->addr = (void *)frame->pc;
30 30
31 return 1; 31 return 1;
32 } else { 32 } else {
@@ -41,7 +41,8 @@ void *return_address(unsigned int level)
41 struct stackframe frame; 41 struct stackframe frame;
42 register unsigned long current_sp asm ("sp"); 42 register unsigned long current_sp asm ("sp");
43 43
44 data.level = level + 1; 44 data.level = level + 2;
45 data.addr = NULL;
45 46
46 frame.fp = (unsigned long)__builtin_frame_address(0); 47 frame.fp = (unsigned long)__builtin_frame_address(0);
47 frame.sp = current_sp; 48 frame.sp = current_sp;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 234e339196c0..728007c4a2b7 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -290,10 +290,10 @@ static int cpu_has_aliasing_icache(unsigned int arch)
290 290
291static void __init cacheid_init(void) 291static void __init cacheid_init(void)
292{ 292{
293 unsigned int cachetype = read_cpuid_cachetype();
294 unsigned int arch = cpu_architecture(); 293 unsigned int arch = cpu_architecture();
295 294
296 if (arch >= CPU_ARCH_ARMv6) { 295 if (arch >= CPU_ARCH_ARMv6) {
296 unsigned int cachetype = read_cpuid_cachetype();
297 if ((cachetype & (7 << 29)) == 4 << 29) { 297 if ((cachetype & (7 << 29)) == 4 << 29) {
298 /* ARMv7 register format */ 298 /* ARMv7 register format */
299 arch = CPU_ARCH_ARMv7; 299 arch = CPU_ARCH_ARMv7;
@@ -389,7 +389,7 @@ static void __init feat_v6_fixup(void)
389 * 389 *
390 * cpu_init sets up the per-CPU stacks. 390 * cpu_init sets up the per-CPU stacks.
391 */ 391 */
392void cpu_init(void) 392void notrace cpu_init(void)
393{ 393{
394 unsigned int cpu = smp_processor_id(); 394 unsigned int cpu = smp_processor_id();
395 struct stack *stk = &stacks[cpu]; 395 struct stack *stk = &stacks[cpu];
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 1f2ccccaf009..47ab90563bf4 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -211,6 +211,13 @@ void __cpuinit __cpu_die(unsigned int cpu)
211 } 211 }
212 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu); 212 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
213 213
214 /*
215 * platform_cpu_kill() is generally expected to do the powering off
216 * and/or cutting of clocks to the dying CPU. Optionally, this may
217 * be done by the CPU which is dying in preference to supporting
218 * this call, but that means there is _no_ synchronisation between
219 * the requesting CPU and the dying CPU actually losing power.
220 */
214 if (!platform_cpu_kill(cpu)) 221 if (!platform_cpu_kill(cpu))
215 printk("CPU%u: unable to kill\n", cpu); 222 printk("CPU%u: unable to kill\n", cpu);
216} 223}
@@ -230,14 +237,41 @@ void __ref cpu_die(void)
230 idle_task_exit(); 237 idle_task_exit();
231 238
232 local_irq_disable(); 239 local_irq_disable();
233 mb();
234 240
235 /* Tell __cpu_die() that this CPU is now safe to dispose of */ 241 /*
242 * Flush the data out of the L1 cache for this CPU. This must be
243 * before the completion to ensure that data is safely written out
244 * before platform_cpu_kill() gets called - which may disable
245 * *this* CPU and power down its cache.
246 */
247 flush_cache_louis();
248
249 /*
250 * Tell __cpu_die() that this CPU is now safe to dispose of. Once
251 * this returns, power and/or clocks can be removed at any point
252 * from this CPU and its cache by platform_cpu_kill().
253 */
236 RCU_NONIDLE(complete(&cpu_died)); 254 RCU_NONIDLE(complete(&cpu_died));
237 255
238 /* 256 /*
239 * actual CPU shutdown procedure is at least platform (if not 257 * Ensure that the cache lines associated with that completion are
240 * CPU) specific. 258 * written out. This covers the case where _this_ CPU is doing the
259 * powering down, to ensure that the completion is visible to the
260 * CPU waiting for this one.
261 */
262 flush_cache_louis();
263
264 /*
265 * The actual CPU shutdown procedure is at least platform (if not
266 * CPU) specific. This may remove power, or it may simply spin.
267 *
268 * Platforms are generally expected *NOT* to return from this call,
269 * although there are some which do because they have no way to
270 * power down the CPU. These platforms are the _only_ reason we
271 * have a return path which uses the fragment of assembly below.
272 *
273 * The return path should not be used for platforms which can
274 * power off the CPU.
241 */ 275 */
242 if (smp_ops.cpu_die) 276 if (smp_ops.cpu_die)
243 smp_ops.cpu_die(cpu); 277 smp_ops.cpu_die(cpu);
@@ -336,7 +370,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
336 /* 370 /*
337 * OK, it's off to the idle thread for us 371 * OK, it's off to the idle thread for us
338 */ 372 */
339 cpu_idle(); 373 cpu_startup_entry(CPUHP_ONLINE);
340} 374}
341 375
342void __init smp_cpus_done(unsigned int max_cpus) 376void __init smp_cpus_done(unsigned int max_cpus)
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 45eac87ed66a..5bc1a63284e3 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -41,7 +41,7 @@ void scu_enable(void __iomem *scu_base)
41 41
42#ifdef CONFIG_ARM_ERRATA_764369 42#ifdef CONFIG_ARM_ERRATA_764369
43 /* Cortex-A9 only */ 43 /* Cortex-A9 only */
44 if ((read_cpuid(CPUID_ID) & 0xff0ffff0) == 0x410fc090) { 44 if ((read_cpuid_id() & 0xff0ffff0) == 0x410fc090) {
45 scu_ctrl = __raw_readl(scu_base + 0x30); 45 scu_ctrl = __raw_readl(scu_base + 0x30);
46 if (!(scu_ctrl & 1)) 46 if (!(scu_ctrl & 1))
47 __raw_writel(scu_ctrl | 0x1, scu_base + 0x30); 47 __raw_writel(scu_ctrl | 0x1, scu_base + 0x30);
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index e82e1d248772..9a52a07aa40e 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -98,21 +98,21 @@ static void broadcast_tlb_a15_erratum(void)
98 return; 98 return;
99 99
100 dummy_flush_tlb_a15_erratum(); 100 dummy_flush_tlb_a15_erratum();
101 smp_call_function_many(cpu_online_mask, ipi_flush_tlb_a15_erratum, 101 smp_call_function(ipi_flush_tlb_a15_erratum, NULL, 1);
102 NULL, 1);
103} 102}
104 103
105static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm) 104static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
106{ 105{
107 int cpu; 106 int cpu, this_cpu;
108 cpumask_t mask = { CPU_BITS_NONE }; 107 cpumask_t mask = { CPU_BITS_NONE };
109 108
110 if (!erratum_a15_798181()) 109 if (!erratum_a15_798181())
111 return; 110 return;
112 111
113 dummy_flush_tlb_a15_erratum(); 112 dummy_flush_tlb_a15_erratum();
113 this_cpu = get_cpu();
114 for_each_online_cpu(cpu) { 114 for_each_online_cpu(cpu) {
115 if (cpu == smp_processor_id()) 115 if (cpu == this_cpu)
116 continue; 116 continue;
117 /* 117 /*
118 * We only need to send an IPI if the other CPUs are running 118 * We only need to send an IPI if the other CPUs are running
@@ -127,6 +127,7 @@ static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
127 cpumask_set_cpu(cpu, &mask); 127 cpumask_set_cpu(cpu, &mask);
128 } 128 }
129 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1); 129 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
130 put_cpu();
130} 131}
131 132
132void flush_tlb_all(void) 133void flush_tlb_all(void)
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 3f2565037480..90525d9d290b 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -362,25 +362,13 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt)
362} 362}
363 363
364#ifdef CONFIG_OF 364#ifdef CONFIG_OF
365const static struct of_device_id twd_of_match[] __initconst = { 365static void __init twd_local_timer_of_register(struct device_node *np)
366 { .compatible = "arm,cortex-a9-twd-timer", },
367 { .compatible = "arm,cortex-a5-twd-timer", },
368 { .compatible = "arm,arm11mp-twd-timer", },
369 { },
370};
371
372void __init twd_local_timer_of_register(void)
373{ 366{
374 struct device_node *np;
375 int err; 367 int err;
376 368
377 if (!is_smp() || !setup_max_cpus) 369 if (!is_smp() || !setup_max_cpus)
378 return; 370 return;
379 371
380 np = of_find_matching_node(NULL, twd_of_match);
381 if (!np)
382 return;
383
384 twd_ppi = irq_of_parse_and_map(np, 0); 372 twd_ppi = irq_of_parse_and_map(np, 0);
385 if (!twd_ppi) { 373 if (!twd_ppi) {
386 err = -EINVAL; 374 err = -EINVAL;
@@ -398,4 +386,7 @@ void __init twd_local_timer_of_register(void)
398out: 386out:
399 WARN(err, "twd_local_timer_of_register failed (%d)\n", err); 387 WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
400} 388}
389CLOCKSOURCE_OF_DECLARE(arm_twd_a9, "arm,cortex-a9-twd-timer", twd_local_timer_of_register);
390CLOCKSOURCE_OF_DECLARE(arm_twd_a5, "arm,cortex-a5-twd-timer", twd_local_timer_of_register);
391CLOCKSOURCE_OF_DECLARE(arm_twd_11mp, "arm,arm11mp-twd-timer", twd_local_timer_of_register);
401#endif 392#endif
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index ab1017bd1667..b1b89882b113 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/proc_fs.h> 23#include <linux/proc_fs.h>
24#include <linux/seq_file.h>
24#include <linux/sched.h> 25#include <linux/sched.h>
25#include <linux/syscalls.h> 26#include <linux/syscalls.h>
26#include <linux/perf_event.h> 27#include <linux/perf_event.h>
@@ -79,27 +80,27 @@ static unsigned long abtcounter;
79static pid_t previous_pid; 80static pid_t previous_pid;
80 81
81#ifdef CONFIG_PROC_FS 82#ifdef CONFIG_PROC_FS
82static int proc_read_status(char *page, char **start, off_t off, int count, 83static int proc_status_show(struct seq_file *m, void *v)
83 int *eof, void *data)
84{ 84{
85 char *p = page; 85 seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter);
86 int len; 86 seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter);
87 87 seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
88 p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter);
89 p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter);
90 p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
91 if (previous_pid != 0) 88 if (previous_pid != 0)
92 p += sprintf(p, "Last process:\t\t%d\n", previous_pid); 89 seq_printf(m, "Last process:\t\t%d\n", previous_pid);
93 90 return 0;
94 len = (p - page) - off; 91}
95 if (len < 0)
96 len = 0;
97
98 *eof = (len <= count) ? 1 : 0;
99 *start = page + off;
100 92
101 return len; 93static int proc_status_open(struct inode *inode, struct file *file)
94{
95 return single_open(file, proc_status_show, PDE_DATA(inode));
102} 96}
97
98static const struct file_operations proc_status_fops = {
99 .open = proc_status_open,
100 .read = seq_read,
101 .llseek = seq_lseek,
102 .release = single_release,
103};
103#endif 104#endif
104 105
105/* 106/*
@@ -266,14 +267,8 @@ static struct undef_hook swp_hook = {
266static int __init swp_emulation_init(void) 267static int __init swp_emulation_init(void)
267{ 268{
268#ifdef CONFIG_PROC_FS 269#ifdef CONFIG_PROC_FS
269 struct proc_dir_entry *res; 270 if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
270
271 res = create_proc_entry("cpu/swp_emulation", S_IRUGO, NULL);
272
273 if (!res)
274 return -ENOMEM; 271 return -ENOMEM;
275
276 res->read_proc = proc_read_status;
277#endif /* CONFIG_PROC_FS */ 272#endif /* CONFIG_PROC_FS */
278 273
279 printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n"); 274 printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n");
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 79282ebcd939..f10316b4ecdc 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -100,7 +100,7 @@ static void __init parse_dt_topology(void)
100 int alloc_size, cpu = 0; 100 int alloc_size, cpu = 0;
101 101
102 alloc_size = nr_cpu_ids * sizeof(struct cpu_capacity); 102 alloc_size = nr_cpu_ids * sizeof(struct cpu_capacity);
103 cpu_capacity = (struct cpu_capacity *)kzalloc(alloc_size, GFP_NOWAIT); 103 cpu_capacity = kzalloc(alloc_size, GFP_NOWAIT);
104 104
105 while ((cn = of_find_node_by_type(cn, "cpu"))) { 105 while ((cn = of_find_node_by_type(cn, "cpu"))) {
106 const u32 *rate, *reg; 106 const u32 *rate, *reg;
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 1c089119b2d7..18b32e8e4497 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -204,13 +204,6 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
204} 204}
205#endif 205#endif
206 206
207void dump_stack(void)
208{
209 dump_backtrace(NULL, NULL);
210}
211
212EXPORT_SYMBOL(dump_stack);
213
214void show_stack(struct task_struct *tsk, unsigned long *sp) 207void show_stack(struct task_struct *tsk, unsigned long *sp)
215{ 208{
216 dump_backtrace(NULL, tsk); 209 dump_backtrace(NULL, tsk);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index b571484e9f03..a871b8e00fca 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -20,7 +20,7 @@
20 VMLINUX_SYMBOL(__idmap_text_start) = .; \ 20 VMLINUX_SYMBOL(__idmap_text_start) = .; \
21 *(.idmap.text) \ 21 *(.idmap.text) \
22 VMLINUX_SYMBOL(__idmap_text_end) = .; \ 22 VMLINUX_SYMBOL(__idmap_text_end) = .; \
23 ALIGN_FUNCTION(); \ 23 . = ALIGN(32); \
24 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ 24 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
25 *(.hyp.idmap.text) \ 25 *(.hyp.idmap.text) \
26 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; 26 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
@@ -315,3 +315,8 @@ SECTIONS
315 */ 315 */
316ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") 316ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
317ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") 317ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
318/*
319 * The HYP init code can't be more than a page long.
320 * The above comment applies as well.
321 */
322ASSERT(((__hyp_idmap_text_end - __hyp_idmap_text_start) <= PAGE_SIZE), "HYP init code too big")
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index 49dd64e579c2..370e1a8af6ac 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -41,9 +41,9 @@ config KVM_ARM_HOST
41 Provides host support for ARM processors. 41 Provides host support for ARM processors.
42 42
43config KVM_ARM_MAX_VCPUS 43config KVM_ARM_MAX_VCPUS
44 int "Number maximum supported virtual CPUs per VM" 44 int "Number maximum supported virtual CPUs per VM" if KVM_ARM_HOST
45 depends on KVM_ARM_HOST 45 default 4 if KVM_ARM_HOST
46 default 4 46 default 0
47 help 47 help
48 Static number of max supported virtual CPUs per VM. 48 Static number of max supported virtual CPUs per VM.
49 49
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index fc96ce6f2357..53c5ed83d16f 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -17,7 +17,7 @@ AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
17kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) 17kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)
18 18
19obj-y += kvm-arm.o init.o interrupts.o 19obj-y += kvm-arm.o init.o interrupts.o
20obj-y += arm.o guest.o mmu.o emulate.o reset.o 20obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
21obj-y += coproc.o coproc_a15.o mmio.o psci.o 21obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
22obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o 22obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
23obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o 23obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
diff --git a/arch/arm/kvm/arch_timer.c b/arch/arm/kvm/arch_timer.c
index 6ac938d46297..c55b6089e923 100644
--- a/arch/arm/kvm/arch_timer.c
+++ b/arch/arm/kvm/arch_timer.c
@@ -22,6 +22,7 @@
22#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24 24
25#include <clocksource/arm_arch_timer.h>
25#include <asm/arch_timer.h> 26#include <asm/arch_timer.h>
26 27
27#include <asm/kvm_vgic.h> 28#include <asm/kvm_vgic.h>
@@ -64,7 +65,7 @@ static void kvm_timer_inject_irq(struct kvm_vcpu *vcpu)
64{ 65{
65 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu; 66 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
66 67
67 timer->cntv_ctl |= 1 << 1; /* Mask the interrupt in the guest */ 68 timer->cntv_ctl |= ARCH_TIMER_CTRL_IT_MASK;
68 kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id, 69 kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id,
69 vcpu->arch.timer_cpu.irq->irq, 70 vcpu->arch.timer_cpu.irq->irq,
70 vcpu->arch.timer_cpu.irq->level); 71 vcpu->arch.timer_cpu.irq->level);
@@ -133,8 +134,8 @@ void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu)
133 cycle_t cval, now; 134 cycle_t cval, now;
134 u64 ns; 135 u64 ns;
135 136
136 /* Check if the timer is enabled and unmasked first */ 137 if ((timer->cntv_ctl & ARCH_TIMER_CTRL_IT_MASK) ||
137 if ((timer->cntv_ctl & 3) != 1) 138 !(timer->cntv_ctl & ARCH_TIMER_CTRL_ENABLE))
138 return; 139 return;
139 140
140 cval = timer->cntv_cval; 141 cval = timer->cntv_cval;
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index c1fe498983ac..37d216d814cd 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -16,6 +16,7 @@
16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */ 17 */
18 18
19#include <linux/cpu.h>
19#include <linux/errno.h> 20#include <linux/errno.h>
20#include <linux/err.h> 21#include <linux/err.h>
21#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
@@ -30,11 +31,9 @@
30#define CREATE_TRACE_POINTS 31#define CREATE_TRACE_POINTS
31#include "trace.h" 32#include "trace.h"
32 33
33#include <asm/unified.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/ptrace.h> 35#include <asm/ptrace.h>
36#include <asm/mman.h> 36#include <asm/mman.h>
37#include <asm/cputype.h>
38#include <asm/tlbflush.h> 37#include <asm/tlbflush.h>
39#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
40#include <asm/virt.h> 39#include <asm/virt.h>
@@ -44,14 +43,13 @@
44#include <asm/kvm_emulate.h> 43#include <asm/kvm_emulate.h>
45#include <asm/kvm_coproc.h> 44#include <asm/kvm_coproc.h>
46#include <asm/kvm_psci.h> 45#include <asm/kvm_psci.h>
47#include <asm/opcodes.h>
48 46
49#ifdef REQUIRES_VIRT 47#ifdef REQUIRES_VIRT
50__asm__(".arch_extension virt"); 48__asm__(".arch_extension virt");
51#endif 49#endif
52 50
53static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page); 51static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
54static struct vfp_hard_struct __percpu *kvm_host_vfp_state; 52static kvm_cpu_context_t __percpu *kvm_host_cpu_state;
55static unsigned long hyp_default_vectors; 53static unsigned long hyp_default_vectors;
56 54
57/* Per-CPU variable containing the currently running vcpu. */ 55/* Per-CPU variable containing the currently running vcpu. */
@@ -209,7 +207,7 @@ int kvm_dev_ioctl_check_extension(long ext)
209 r = KVM_MAX_VCPUS; 207 r = KVM_MAX_VCPUS;
210 break; 208 break;
211 default: 209 default:
212 r = 0; 210 r = kvm_arch_dev_ioctl_check_extension(ext);
213 break; 211 break;
214 } 212 }
215 return r; 213 return r;
@@ -221,27 +219,18 @@ long kvm_arch_dev_ioctl(struct file *filp,
221 return -EINVAL; 219 return -EINVAL;
222} 220}
223 221
224int kvm_arch_set_memory_region(struct kvm *kvm,
225 struct kvm_userspace_memory_region *mem,
226 struct kvm_memory_slot old,
227 int user_alloc)
228{
229 return 0;
230}
231
232int kvm_arch_prepare_memory_region(struct kvm *kvm, 222int kvm_arch_prepare_memory_region(struct kvm *kvm,
233 struct kvm_memory_slot *memslot, 223 struct kvm_memory_slot *memslot,
234 struct kvm_memory_slot old,
235 struct kvm_userspace_memory_region *mem, 224 struct kvm_userspace_memory_region *mem,
236 bool user_alloc) 225 enum kvm_mr_change change)
237{ 226{
238 return 0; 227 return 0;
239} 228}
240 229
241void kvm_arch_commit_memory_region(struct kvm *kvm, 230void kvm_arch_commit_memory_region(struct kvm *kvm,
242 struct kvm_userspace_memory_region *mem, 231 struct kvm_userspace_memory_region *mem,
243 struct kvm_memory_slot old, 232 const struct kvm_memory_slot *old,
244 bool user_alloc) 233 enum kvm_mr_change change)
245{ 234{
246} 235}
247 236
@@ -304,22 +293,6 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
304 return 0; 293 return 0;
305} 294}
306 295
307int __attribute_const__ kvm_target_cpu(void)
308{
309 unsigned long implementor = read_cpuid_implementor();
310 unsigned long part_number = read_cpuid_part_number();
311
312 if (implementor != ARM_CPU_IMP_ARM)
313 return -EINVAL;
314
315 switch (part_number) {
316 case ARM_CPU_PART_CORTEX_A15:
317 return KVM_ARM_TARGET_CORTEX_A15;
318 default:
319 return -EINVAL;
320 }
321}
322
323int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 296int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
324{ 297{
325 int ret; 298 int ret;
@@ -345,7 +318,7 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
345void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 318void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
346{ 319{
347 vcpu->cpu = cpu; 320 vcpu->cpu = cpu;
348 vcpu->arch.vfp_host = this_cpu_ptr(kvm_host_vfp_state); 321 vcpu->arch.host_cpu_context = this_cpu_ptr(kvm_host_cpu_state);
349 322
350 /* 323 /*
351 * Check whether this vcpu requires the cache to be flushed on 324 * Check whether this vcpu requires the cache to be flushed on
@@ -482,163 +455,6 @@ static void update_vttbr(struct kvm *kvm)
482 spin_unlock(&kvm_vmid_lock); 455 spin_unlock(&kvm_vmid_lock);
483} 456}
484 457
485static int handle_svc_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
486{
487 /* SVC called from Hyp mode should never get here */
488 kvm_debug("SVC called from Hyp mode shouldn't go here\n");
489 BUG();
490 return -EINVAL; /* Squash warning */
491}
492
493static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
494{
495 trace_kvm_hvc(*vcpu_pc(vcpu), *vcpu_reg(vcpu, 0),
496 vcpu->arch.hsr & HSR_HVC_IMM_MASK);
497
498 if (kvm_psci_call(vcpu))
499 return 1;
500
501 kvm_inject_undefined(vcpu);
502 return 1;
503}
504
505static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
506{
507 if (kvm_psci_call(vcpu))
508 return 1;
509
510 kvm_inject_undefined(vcpu);
511 return 1;
512}
513
514static int handle_pabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
515{
516 /* The hypervisor should never cause aborts */
517 kvm_err("Prefetch Abort taken from Hyp mode at %#08x (HSR: %#08x)\n",
518 vcpu->arch.hxfar, vcpu->arch.hsr);
519 return -EFAULT;
520}
521
522static int handle_dabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
523{
524 /* This is either an error in the ws. code or an external abort */
525 kvm_err("Data Abort taken from Hyp mode at %#08x (HSR: %#08x)\n",
526 vcpu->arch.hxfar, vcpu->arch.hsr);
527 return -EFAULT;
528}
529
530typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);
531static exit_handle_fn arm_exit_handlers[] = {
532 [HSR_EC_WFI] = kvm_handle_wfi,
533 [HSR_EC_CP15_32] = kvm_handle_cp15_32,
534 [HSR_EC_CP15_64] = kvm_handle_cp15_64,
535 [HSR_EC_CP14_MR] = kvm_handle_cp14_access,
536 [HSR_EC_CP14_LS] = kvm_handle_cp14_load_store,
537 [HSR_EC_CP14_64] = kvm_handle_cp14_access,
538 [HSR_EC_CP_0_13] = kvm_handle_cp_0_13_access,
539 [HSR_EC_CP10_ID] = kvm_handle_cp10_id,
540 [HSR_EC_SVC_HYP] = handle_svc_hyp,
541 [HSR_EC_HVC] = handle_hvc,
542 [HSR_EC_SMC] = handle_smc,
543 [HSR_EC_IABT] = kvm_handle_guest_abort,
544 [HSR_EC_IABT_HYP] = handle_pabt_hyp,
545 [HSR_EC_DABT] = kvm_handle_guest_abort,
546 [HSR_EC_DABT_HYP] = handle_dabt_hyp,
547};
548
549/*
550 * A conditional instruction is allowed to trap, even though it
551 * wouldn't be executed. So let's re-implement the hardware, in
552 * software!
553 */
554static bool kvm_condition_valid(struct kvm_vcpu *vcpu)
555{
556 unsigned long cpsr, cond, insn;
557
558 /*
559 * Exception Code 0 can only happen if we set HCR.TGE to 1, to
560 * catch undefined instructions, and then we won't get past
561 * the arm_exit_handlers test anyway.
562 */
563 BUG_ON(((vcpu->arch.hsr & HSR_EC) >> HSR_EC_SHIFT) == 0);
564
565 /* Top two bits non-zero? Unconditional. */
566 if (vcpu->arch.hsr >> 30)
567 return true;
568
569 cpsr = *vcpu_cpsr(vcpu);
570
571 /* Is condition field valid? */
572 if ((vcpu->arch.hsr & HSR_CV) >> HSR_CV_SHIFT)
573 cond = (vcpu->arch.hsr & HSR_COND) >> HSR_COND_SHIFT;
574 else {
575 /* This can happen in Thumb mode: examine IT state. */
576 unsigned long it;
577
578 it = ((cpsr >> 8) & 0xFC) | ((cpsr >> 25) & 0x3);
579
580 /* it == 0 => unconditional. */
581 if (it == 0)
582 return true;
583
584 /* The cond for this insn works out as the top 4 bits. */
585 cond = (it >> 4);
586 }
587
588 /* Shift makes it look like an ARM-mode instruction */
589 insn = cond << 28;
590 return arm_check_condition(insn, cpsr) != ARM_OPCODE_CONDTEST_FAIL;
591}
592
593/*
594 * Return > 0 to return to guest, < 0 on error, 0 (and set exit_reason) on
595 * proper exit to QEMU.
596 */
597static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
598 int exception_index)
599{
600 unsigned long hsr_ec;
601
602 switch (exception_index) {
603 case ARM_EXCEPTION_IRQ:
604 return 1;
605 case ARM_EXCEPTION_UNDEFINED:
606 kvm_err("Undefined exception in Hyp mode at: %#08x\n",
607 vcpu->arch.hyp_pc);
608 BUG();
609 panic("KVM: Hypervisor undefined exception!\n");
610 case ARM_EXCEPTION_DATA_ABORT:
611 case ARM_EXCEPTION_PREF_ABORT:
612 case ARM_EXCEPTION_HVC:
613 hsr_ec = (vcpu->arch.hsr & HSR_EC) >> HSR_EC_SHIFT;
614
615 if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers)
616 || !arm_exit_handlers[hsr_ec]) {
617 kvm_err("Unkown exception class: %#08lx, "
618 "hsr: %#08x\n", hsr_ec,
619 (unsigned int)vcpu->arch.hsr);
620 BUG();
621 }
622
623 /*
624 * See ARM ARM B1.14.1: "Hyp traps on instructions
625 * that fail their condition code check"
626 */
627 if (!kvm_condition_valid(vcpu)) {
628 bool is_wide = vcpu->arch.hsr & HSR_IL;
629 kvm_skip_instr(vcpu, is_wide);
630 return 1;
631 }
632
633 return arm_exit_handlers[hsr_ec](vcpu, run);
634 default:
635 kvm_pr_unimpl("Unsupported exception type: %d",
636 exception_index);
637 run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
638 return 0;
639 }
640}
641
642static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) 458static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
643{ 459{
644 if (likely(vcpu->arch.has_run_once)) 460 if (likely(vcpu->arch.has_run_once))
@@ -815,7 +631,8 @@ static int vcpu_interrupt_line(struct kvm_vcpu *vcpu, int number, bool level)
815 return 0; 631 return 0;
816} 632}
817 633
818int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level) 634int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
635 bool line_status)
819{ 636{
820 u32 irq = irq_level->irq; 637 u32 irq = irq_level->irq;
821 unsigned int irq_type, vcpu_idx, irq_num; 638 unsigned int irq_type, vcpu_idx, irq_num;
@@ -970,40 +787,48 @@ long kvm_arch_vm_ioctl(struct file *filp,
970 } 787 }
971} 788}
972 789
973static void cpu_init_hyp_mode(void *vector) 790static void cpu_init_hyp_mode(void *dummy)
974{ 791{
792 unsigned long long boot_pgd_ptr;
975 unsigned long long pgd_ptr; 793 unsigned long long pgd_ptr;
976 unsigned long pgd_low, pgd_high;
977 unsigned long hyp_stack_ptr; 794 unsigned long hyp_stack_ptr;
978 unsigned long stack_page; 795 unsigned long stack_page;
979 unsigned long vector_ptr; 796 unsigned long vector_ptr;
980 797
981 /* Switch from the HYP stub to our own HYP init vector */ 798 /* Switch from the HYP stub to our own HYP init vector */
982 __hyp_set_vectors((unsigned long)vector); 799 __hyp_set_vectors(kvm_get_idmap_vector());
983 800
801 boot_pgd_ptr = (unsigned long long)kvm_mmu_get_boot_httbr();
984 pgd_ptr = (unsigned long long)kvm_mmu_get_httbr(); 802 pgd_ptr = (unsigned long long)kvm_mmu_get_httbr();
985 pgd_low = (pgd_ptr & ((1ULL << 32) - 1));
986 pgd_high = (pgd_ptr >> 32ULL);
987 stack_page = __get_cpu_var(kvm_arm_hyp_stack_page); 803 stack_page = __get_cpu_var(kvm_arm_hyp_stack_page);
988 hyp_stack_ptr = stack_page + PAGE_SIZE; 804 hyp_stack_ptr = stack_page + PAGE_SIZE;
989 vector_ptr = (unsigned long)__kvm_hyp_vector; 805 vector_ptr = (unsigned long)__kvm_hyp_vector;
990 806
991 /* 807 __cpu_init_hyp_mode(boot_pgd_ptr, pgd_ptr, hyp_stack_ptr, vector_ptr);
992 * Call initialization code, and switch to the full blown 808}
993 * HYP code. The init code doesn't need to preserve these registers as 809
994 * r1-r3 and r12 are already callee save according to the AAPCS. 810static int hyp_init_cpu_notify(struct notifier_block *self,
995 * Note that we slightly misuse the prototype by casing the pgd_low to 811 unsigned long action, void *cpu)
996 * a void *. 812{
997 */ 813 switch (action) {
998 kvm_call_hyp((void *)pgd_low, pgd_high, hyp_stack_ptr, vector_ptr); 814 case CPU_STARTING:
815 case CPU_STARTING_FROZEN:
816 cpu_init_hyp_mode(NULL);
817 break;
818 }
819
820 return NOTIFY_OK;
999} 821}
1000 822
823static struct notifier_block hyp_init_cpu_nb = {
824 .notifier_call = hyp_init_cpu_notify,
825};
826
1001/** 827/**
1002 * Inits Hyp-mode on all online CPUs 828 * Inits Hyp-mode on all online CPUs
1003 */ 829 */
1004static int init_hyp_mode(void) 830static int init_hyp_mode(void)
1005{ 831{
1006 phys_addr_t init_phys_addr;
1007 int cpu; 832 int cpu;
1008 int err = 0; 833 int err = 0;
1009 834
@@ -1036,24 +861,6 @@ static int init_hyp_mode(void)
1036 } 861 }
1037 862
1038 /* 863 /*
1039 * Execute the init code on each CPU.
1040 *
1041 * Note: The stack is not mapped yet, so don't do anything else than
1042 * initializing the hypervisor mode on each CPU using a local stack
1043 * space for temporary storage.
1044 */
1045 init_phys_addr = virt_to_phys(__kvm_hyp_init);
1046 for_each_online_cpu(cpu) {
1047 smp_call_function_single(cpu, cpu_init_hyp_mode,
1048 (void *)(long)init_phys_addr, 1);
1049 }
1050
1051 /*
1052 * Unmap the identity mapping
1053 */
1054 kvm_clear_hyp_idmap();
1055
1056 /*
1057 * Map the Hyp-code called directly from the host 864 * Map the Hyp-code called directly from the host
1058 */ 865 */
1059 err = create_hyp_mappings(__kvm_hyp_code_start, __kvm_hyp_code_end); 866 err = create_hyp_mappings(__kvm_hyp_code_start, __kvm_hyp_code_end);
@@ -1076,33 +883,38 @@ static int init_hyp_mode(void)
1076 } 883 }
1077 884
1078 /* 885 /*
1079 * Map the host VFP structures 886 * Map the host CPU structures
1080 */ 887 */
1081 kvm_host_vfp_state = alloc_percpu(struct vfp_hard_struct); 888 kvm_host_cpu_state = alloc_percpu(kvm_cpu_context_t);
1082 if (!kvm_host_vfp_state) { 889 if (!kvm_host_cpu_state) {
1083 err = -ENOMEM; 890 err = -ENOMEM;
1084 kvm_err("Cannot allocate host VFP state\n"); 891 kvm_err("Cannot allocate host CPU state\n");
1085 goto out_free_mappings; 892 goto out_free_mappings;
1086 } 893 }
1087 894
1088 for_each_possible_cpu(cpu) { 895 for_each_possible_cpu(cpu) {
1089 struct vfp_hard_struct *vfp; 896 kvm_cpu_context_t *cpu_ctxt;
1090 897
1091 vfp = per_cpu_ptr(kvm_host_vfp_state, cpu); 898 cpu_ctxt = per_cpu_ptr(kvm_host_cpu_state, cpu);
1092 err = create_hyp_mappings(vfp, vfp + 1); 899 err = create_hyp_mappings(cpu_ctxt, cpu_ctxt + 1);
1093 900
1094 if (err) { 901 if (err) {
1095 kvm_err("Cannot map host VFP state: %d\n", err); 902 kvm_err("Cannot map host CPU state: %d\n", err);
1096 goto out_free_vfp; 903 goto out_free_context;
1097 } 904 }
1098 } 905 }
1099 906
1100 /* 907 /*
908 * Execute the init code on each CPU.
909 */
910 on_each_cpu(cpu_init_hyp_mode, NULL, 1);
911
912 /*
1101 * Init HYP view of VGIC 913 * Init HYP view of VGIC
1102 */ 914 */
1103 err = kvm_vgic_hyp_init(); 915 err = kvm_vgic_hyp_init();
1104 if (err) 916 if (err)
1105 goto out_free_vfp; 917 goto out_free_context;
1106 918
1107#ifdef CONFIG_KVM_ARM_VGIC 919#ifdef CONFIG_KVM_ARM_VGIC
1108 vgic_present = true; 920 vgic_present = true;
@@ -1115,12 +927,19 @@ static int init_hyp_mode(void)
1115 if (err) 927 if (err)
1116 goto out_free_mappings; 928 goto out_free_mappings;
1117 929
930#ifndef CONFIG_HOTPLUG_CPU
931 free_boot_hyp_pgd();
932#endif
933
934 kvm_perf_init();
935
1118 kvm_info("Hyp mode initialized successfully\n"); 936 kvm_info("Hyp mode initialized successfully\n");
937
1119 return 0; 938 return 0;
1120out_free_vfp: 939out_free_context:
1121 free_percpu(kvm_host_vfp_state); 940 free_percpu(kvm_host_cpu_state);
1122out_free_mappings: 941out_free_mappings:
1123 free_hyp_pmds(); 942 free_hyp_pgds();
1124out_free_stack_pages: 943out_free_stack_pages:
1125 for_each_possible_cpu(cpu) 944 for_each_possible_cpu(cpu)
1126 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu)); 945 free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
@@ -1129,27 +948,42 @@ out_err:
1129 return err; 948 return err;
1130} 949}
1131 950
951static void check_kvm_target_cpu(void *ret)
952{
953 *(int *)ret = kvm_target_cpu();
954}
955
1132/** 956/**
1133 * Initialize Hyp-mode and memory mappings on all CPUs. 957 * Initialize Hyp-mode and memory mappings on all CPUs.
1134 */ 958 */
1135int kvm_arch_init(void *opaque) 959int kvm_arch_init(void *opaque)
1136{ 960{
1137 int err; 961 int err;
962 int ret, cpu;
1138 963
1139 if (!is_hyp_mode_available()) { 964 if (!is_hyp_mode_available()) {
1140 kvm_err("HYP mode not available\n"); 965 kvm_err("HYP mode not available\n");
1141 return -ENODEV; 966 return -ENODEV;
1142 } 967 }
1143 968
1144 if (kvm_target_cpu() < 0) { 969 for_each_online_cpu(cpu) {
1145 kvm_err("Target CPU not supported!\n"); 970 smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1);
1146 return -ENODEV; 971 if (ret < 0) {
972 kvm_err("Error, CPU %d not supported!\n", cpu);
973 return -ENODEV;
974 }
1147 } 975 }
1148 976
1149 err = init_hyp_mode(); 977 err = init_hyp_mode();
1150 if (err) 978 if (err)
1151 goto out_err; 979 goto out_err;
1152 980
981 err = register_cpu_notifier(&hyp_init_cpu_nb);
982 if (err) {
983 kvm_err("Cannot register HYP init CPU notifier (%d)\n", err);
984 goto out_err;
985 }
986
1153 kvm_coproc_table_init(); 987 kvm_coproc_table_init();
1154 return 0; 988 return 0;
1155out_err: 989out_err:
@@ -1159,6 +993,7 @@ out_err:
1159/* NOP: Compiling as a module not supported */ 993/* NOP: Compiling as a module not supported */
1160void kvm_arch_exit(void) 994void kvm_arch_exit(void)
1161{ 995{
996 kvm_perf_teardown();
1162} 997}
1163 998
1164static int arm_init(void) 999static int arm_init(void)
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 7bed7556077a..8eea97be1ed5 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -76,7 +76,7 @@ static bool access_dcsw(struct kvm_vcpu *vcpu,
76 const struct coproc_params *p, 76 const struct coproc_params *p,
77 const struct coproc_reg *r) 77 const struct coproc_reg *r)
78{ 78{
79 u32 val; 79 unsigned long val;
80 int cpu; 80 int cpu;
81 81
82 if (!p->is_write) 82 if (!p->is_write)
@@ -293,12 +293,12 @@ static int emulate_cp15(struct kvm_vcpu *vcpu,
293 293
294 if (likely(r->access(vcpu, params, r))) { 294 if (likely(r->access(vcpu, params, r))) {
295 /* Skip instruction, since it was emulated */ 295 /* Skip instruction, since it was emulated */
296 kvm_skip_instr(vcpu, (vcpu->arch.hsr >> 25) & 1); 296 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
297 return 1; 297 return 1;
298 } 298 }
299 /* If access function fails, it should complain. */ 299 /* If access function fails, it should complain. */
300 } else { 300 } else {
301 kvm_err("Unsupported guest CP15 access at: %08x\n", 301 kvm_err("Unsupported guest CP15 access at: %08lx\n",
302 *vcpu_pc(vcpu)); 302 *vcpu_pc(vcpu));
303 print_cp_instr(params); 303 print_cp_instr(params);
304 } 304 }
@@ -315,14 +315,14 @@ int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run)
315{ 315{
316 struct coproc_params params; 316 struct coproc_params params;
317 317
318 params.CRm = (vcpu->arch.hsr >> 1) & 0xf; 318 params.CRm = (kvm_vcpu_get_hsr(vcpu) >> 1) & 0xf;
319 params.Rt1 = (vcpu->arch.hsr >> 5) & 0xf; 319 params.Rt1 = (kvm_vcpu_get_hsr(vcpu) >> 5) & 0xf;
320 params.is_write = ((vcpu->arch.hsr & 1) == 0); 320 params.is_write = ((kvm_vcpu_get_hsr(vcpu) & 1) == 0);
321 params.is_64bit = true; 321 params.is_64bit = true;
322 322
323 params.Op1 = (vcpu->arch.hsr >> 16) & 0xf; 323 params.Op1 = (kvm_vcpu_get_hsr(vcpu) >> 16) & 0xf;
324 params.Op2 = 0; 324 params.Op2 = 0;
325 params.Rt2 = (vcpu->arch.hsr >> 10) & 0xf; 325 params.Rt2 = (kvm_vcpu_get_hsr(vcpu) >> 10) & 0xf;
326 params.CRn = 0; 326 params.CRn = 0;
327 327
328 return emulate_cp15(vcpu, &params); 328 return emulate_cp15(vcpu, &params);
@@ -347,14 +347,14 @@ int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run)
347{ 347{
348 struct coproc_params params; 348 struct coproc_params params;
349 349
350 params.CRm = (vcpu->arch.hsr >> 1) & 0xf; 350 params.CRm = (kvm_vcpu_get_hsr(vcpu) >> 1) & 0xf;
351 params.Rt1 = (vcpu->arch.hsr >> 5) & 0xf; 351 params.Rt1 = (kvm_vcpu_get_hsr(vcpu) >> 5) & 0xf;
352 params.is_write = ((vcpu->arch.hsr & 1) == 0); 352 params.is_write = ((kvm_vcpu_get_hsr(vcpu) & 1) == 0);
353 params.is_64bit = false; 353 params.is_64bit = false;
354 354
355 params.CRn = (vcpu->arch.hsr >> 10) & 0xf; 355 params.CRn = (kvm_vcpu_get_hsr(vcpu) >> 10) & 0xf;
356 params.Op1 = (vcpu->arch.hsr >> 14) & 0x7; 356 params.Op1 = (kvm_vcpu_get_hsr(vcpu) >> 14) & 0x7;
357 params.Op2 = (vcpu->arch.hsr >> 17) & 0x7; 357 params.Op2 = (kvm_vcpu_get_hsr(vcpu) >> 17) & 0x7;
358 params.Rt2 = 0; 358 params.Rt2 = 0;
359 359
360 return emulate_cp15(vcpu, &params); 360 return emulate_cp15(vcpu, &params);
diff --git a/arch/arm/kvm/coproc.h b/arch/arm/kvm/coproc.h
index 992adfafa2ff..b7301d3e4799 100644
--- a/arch/arm/kvm/coproc.h
+++ b/arch/arm/kvm/coproc.h
@@ -84,7 +84,7 @@ static inline bool read_zero(struct kvm_vcpu *vcpu,
84static inline bool write_to_read_only(struct kvm_vcpu *vcpu, 84static inline bool write_to_read_only(struct kvm_vcpu *vcpu,
85 const struct coproc_params *params) 85 const struct coproc_params *params)
86{ 86{
87 kvm_debug("CP15 write to read-only register at: %08x\n", 87 kvm_debug("CP15 write to read-only register at: %08lx\n",
88 *vcpu_pc(vcpu)); 88 *vcpu_pc(vcpu));
89 print_cp_instr(params); 89 print_cp_instr(params);
90 return false; 90 return false;
@@ -93,7 +93,7 @@ static inline bool write_to_read_only(struct kvm_vcpu *vcpu,
93static inline bool read_from_write_only(struct kvm_vcpu *vcpu, 93static inline bool read_from_write_only(struct kvm_vcpu *vcpu,
94 const struct coproc_params *params) 94 const struct coproc_params *params)
95{ 95{
96 kvm_debug("CP15 read to write-only register at: %08x\n", 96 kvm_debug("CP15 read to write-only register at: %08lx\n",
97 *vcpu_pc(vcpu)); 97 *vcpu_pc(vcpu));
98 print_cp_instr(params); 98 print_cp_instr(params);
99 return false; 99 return false;
diff --git a/arch/arm/kvm/emulate.c b/arch/arm/kvm/emulate.c
index d61450ac6665..bdede9e7da51 100644
--- a/arch/arm/kvm/emulate.c
+++ b/arch/arm/kvm/emulate.c
@@ -20,6 +20,7 @@
20#include <linux/kvm_host.h> 20#include <linux/kvm_host.h>
21#include <asm/kvm_arm.h> 21#include <asm/kvm_arm.h>
22#include <asm/kvm_emulate.h> 22#include <asm/kvm_emulate.h>
23#include <asm/opcodes.h>
23#include <trace/events/kvm.h> 24#include <trace/events/kvm.h>
24 25
25#include "trace.h" 26#include "trace.h"
@@ -109,10 +110,10 @@ static const unsigned long vcpu_reg_offsets[VCPU_NR_MODES][15] = {
109 * Return a pointer to the register number valid in the current mode of 110 * Return a pointer to the register number valid in the current mode of
110 * the virtual CPU. 111 * the virtual CPU.
111 */ 112 */
112u32 *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num) 113unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num)
113{ 114{
114 u32 *reg_array = (u32 *)&vcpu->arch.regs; 115 unsigned long *reg_array = (unsigned long *)&vcpu->arch.regs;
115 u32 mode = *vcpu_cpsr(vcpu) & MODE_MASK; 116 unsigned long mode = *vcpu_cpsr(vcpu) & MODE_MASK;
116 117
117 switch (mode) { 118 switch (mode) {
118 case USR_MODE...SVC_MODE: 119 case USR_MODE...SVC_MODE:
@@ -141,9 +142,9 @@ u32 *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num)
141/* 142/*
142 * Return the SPSR for the current mode of the virtual CPU. 143 * Return the SPSR for the current mode of the virtual CPU.
143 */ 144 */
144u32 *vcpu_spsr(struct kvm_vcpu *vcpu) 145unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu)
145{ 146{
146 u32 mode = *vcpu_cpsr(vcpu) & MODE_MASK; 147 unsigned long mode = *vcpu_cpsr(vcpu) & MODE_MASK;
147 switch (mode) { 148 switch (mode) {
148 case SVC_MODE: 149 case SVC_MODE:
149 return &vcpu->arch.regs.KVM_ARM_SVC_spsr; 150 return &vcpu->arch.regs.KVM_ARM_SVC_spsr;
@@ -160,20 +161,48 @@ u32 *vcpu_spsr(struct kvm_vcpu *vcpu)
160 } 161 }
161} 162}
162 163
163/** 164/*
164 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest 165 * A conditional instruction is allowed to trap, even though it
165 * @vcpu: the vcpu pointer 166 * wouldn't be executed. So let's re-implement the hardware, in
166 * @run: the kvm_run structure pointer 167 * software!
167 *
168 * Simply sets the wait_for_interrupts flag on the vcpu structure, which will
169 * halt execution of world-switches and schedule other host processes until
170 * there is an incoming IRQ or FIQ to the VM.
171 */ 168 */
172int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run) 169bool kvm_condition_valid(struct kvm_vcpu *vcpu)
173{ 170{
174 trace_kvm_wfi(*vcpu_pc(vcpu)); 171 unsigned long cpsr, cond, insn;
175 kvm_vcpu_block(vcpu); 172
176 return 1; 173 /*
174 * Exception Code 0 can only happen if we set HCR.TGE to 1, to
175 * catch undefined instructions, and then we won't get past
176 * the arm_exit_handlers test anyway.
177 */
178 BUG_ON(!kvm_vcpu_trap_get_class(vcpu));
179
180 /* Top two bits non-zero? Unconditional. */
181 if (kvm_vcpu_get_hsr(vcpu) >> 30)
182 return true;
183
184 cpsr = *vcpu_cpsr(vcpu);
185
186 /* Is condition field valid? */
187 if ((kvm_vcpu_get_hsr(vcpu) & HSR_CV) >> HSR_CV_SHIFT)
188 cond = (kvm_vcpu_get_hsr(vcpu) & HSR_COND) >> HSR_COND_SHIFT;
189 else {
190 /* This can happen in Thumb mode: examine IT state. */
191 unsigned long it;
192
193 it = ((cpsr >> 8) & 0xFC) | ((cpsr >> 25) & 0x3);
194
195 /* it == 0 => unconditional. */
196 if (it == 0)
197 return true;
198
199 /* The cond for this insn works out as the top 4 bits. */
200 cond = (it >> 4);
201 }
202
203 /* Shift makes it look like an ARM-mode instruction */
204 insn = cond << 28;
205 return arm_check_condition(insn, cpsr) != ARM_OPCODE_CONDTEST_FAIL;
177} 206}
178 207
179/** 208/**
@@ -257,9 +286,9 @@ static u32 exc_vector_base(struct kvm_vcpu *vcpu)
257 */ 286 */
258void kvm_inject_undefined(struct kvm_vcpu *vcpu) 287void kvm_inject_undefined(struct kvm_vcpu *vcpu)
259{ 288{
260 u32 new_lr_value; 289 unsigned long new_lr_value;
261 u32 new_spsr_value; 290 unsigned long new_spsr_value;
262 u32 cpsr = *vcpu_cpsr(vcpu); 291 unsigned long cpsr = *vcpu_cpsr(vcpu);
263 u32 sctlr = vcpu->arch.cp15[c1_SCTLR]; 292 u32 sctlr = vcpu->arch.cp15[c1_SCTLR];
264 bool is_thumb = (cpsr & PSR_T_BIT); 293 bool is_thumb = (cpsr & PSR_T_BIT);
265 u32 vect_offset = 4; 294 u32 vect_offset = 4;
@@ -291,9 +320,9 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
291 */ 320 */
292static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr) 321static void inject_abt(struct kvm_vcpu *vcpu, bool is_pabt, unsigned long addr)
293{ 322{
294 u32 new_lr_value; 323 unsigned long new_lr_value;
295 u32 new_spsr_value; 324 unsigned long new_spsr_value;
296 u32 cpsr = *vcpu_cpsr(vcpu); 325 unsigned long cpsr = *vcpu_cpsr(vcpu);
297 u32 sctlr = vcpu->arch.cp15[c1_SCTLR]; 326 u32 sctlr = vcpu->arch.cp15[c1_SCTLR];
298 bool is_thumb = (cpsr & PSR_T_BIT); 327 bool is_thumb = (cpsr & PSR_T_BIT);
299 u32 vect_offset; 328 u32 vect_offset;
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index 2339d9609d36..152d03612181 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/vmalloc.h> 23#include <linux/vmalloc.h>
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <asm/cputype.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/kvm.h> 27#include <asm/kvm.h>
27#include <asm/kvm_asm.h> 28#include <asm/kvm_asm.h>
@@ -180,6 +181,22 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
180 return -EINVAL; 181 return -EINVAL;
181} 182}
182 183
184int __attribute_const__ kvm_target_cpu(void)
185{
186 unsigned long implementor = read_cpuid_implementor();
187 unsigned long part_number = read_cpuid_part_number();
188
189 if (implementor != ARM_CPU_IMP_ARM)
190 return -EINVAL;
191
192 switch (part_number) {
193 case ARM_CPU_PART_CORTEX_A15:
194 return KVM_ARM_TARGET_CORTEX_A15;
195 default:
196 return -EINVAL;
197 }
198}
199
183int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, 200int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
184 const struct kvm_vcpu_init *init) 201 const struct kvm_vcpu_init *init)
185{ 202{
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c
new file mode 100644
index 000000000000..3d74a0be47db
--- /dev/null
+++ b/arch/arm/kvm/handle_exit.c
@@ -0,0 +1,164 @@
1/*
2 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3 * Author: Christoffer Dall <c.dall@virtualopensystems.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, version 2, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#include <linux/kvm.h>
20#include <linux/kvm_host.h>
21#include <asm/kvm_emulate.h>
22#include <asm/kvm_coproc.h>
23#include <asm/kvm_mmu.h>
24#include <asm/kvm_psci.h>
25#include <trace/events/kvm.h>
26
27#include "trace.h"
28
29#include "trace.h"
30
31typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);
32
33static int handle_svc_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
34{
35 /* SVC called from Hyp mode should never get here */
36 kvm_debug("SVC called from Hyp mode shouldn't go here\n");
37 BUG();
38 return -EINVAL; /* Squash warning */
39}
40
41static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
42{
43 trace_kvm_hvc(*vcpu_pc(vcpu), *vcpu_reg(vcpu, 0),
44 kvm_vcpu_hvc_get_imm(vcpu));
45
46 if (kvm_psci_call(vcpu))
47 return 1;
48
49 kvm_inject_undefined(vcpu);
50 return 1;
51}
52
53static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
54{
55 if (kvm_psci_call(vcpu))
56 return 1;
57
58 kvm_inject_undefined(vcpu);
59 return 1;
60}
61
62static int handle_pabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
63{
64 /* The hypervisor should never cause aborts */
65 kvm_err("Prefetch Abort taken from Hyp mode at %#08lx (HSR: %#08x)\n",
66 kvm_vcpu_get_hfar(vcpu), kvm_vcpu_get_hsr(vcpu));
67 return -EFAULT;
68}
69
70static int handle_dabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
71{
72 /* This is either an error in the ws. code or an external abort */
73 kvm_err("Data Abort taken from Hyp mode at %#08lx (HSR: %#08x)\n",
74 kvm_vcpu_get_hfar(vcpu), kvm_vcpu_get_hsr(vcpu));
75 return -EFAULT;
76}
77
78/**
79 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest
80 * @vcpu: the vcpu pointer
81 * @run: the kvm_run structure pointer
82 *
83 * Simply sets the wait_for_interrupts flag on the vcpu structure, which will
84 * halt execution of world-switches and schedule other host processes until
85 * there is an incoming IRQ or FIQ to the VM.
86 */
87static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run)
88{
89 trace_kvm_wfi(*vcpu_pc(vcpu));
90 kvm_vcpu_block(vcpu);
91 return 1;
92}
93
94static exit_handle_fn arm_exit_handlers[] = {
95 [HSR_EC_WFI] = kvm_handle_wfi,
96 [HSR_EC_CP15_32] = kvm_handle_cp15_32,
97 [HSR_EC_CP15_64] = kvm_handle_cp15_64,
98 [HSR_EC_CP14_MR] = kvm_handle_cp14_access,
99 [HSR_EC_CP14_LS] = kvm_handle_cp14_load_store,
100 [HSR_EC_CP14_64] = kvm_handle_cp14_access,
101 [HSR_EC_CP_0_13] = kvm_handle_cp_0_13_access,
102 [HSR_EC_CP10_ID] = kvm_handle_cp10_id,
103 [HSR_EC_SVC_HYP] = handle_svc_hyp,
104 [HSR_EC_HVC] = handle_hvc,
105 [HSR_EC_SMC] = handle_smc,
106 [HSR_EC_IABT] = kvm_handle_guest_abort,
107 [HSR_EC_IABT_HYP] = handle_pabt_hyp,
108 [HSR_EC_DABT] = kvm_handle_guest_abort,
109 [HSR_EC_DABT_HYP] = handle_dabt_hyp,
110};
111
112static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu)
113{
114 u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
115
116 if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
117 !arm_exit_handlers[hsr_ec]) {
118 kvm_err("Unknown exception class: hsr: %#08x\n",
119 (unsigned int)kvm_vcpu_get_hsr(vcpu));
120 BUG();
121 }
122
123 return arm_exit_handlers[hsr_ec];
124}
125
126/*
127 * Return > 0 to return to guest, < 0 on error, 0 (and set exit_reason) on
128 * proper exit to userspace.
129 */
130int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
131 int exception_index)
132{
133 exit_handle_fn exit_handler;
134
135 switch (exception_index) {
136 case ARM_EXCEPTION_IRQ:
137 return 1;
138 case ARM_EXCEPTION_UNDEFINED:
139 kvm_err("Undefined exception in Hyp mode at: %#08lx\n",
140 kvm_vcpu_get_hyp_pc(vcpu));
141 BUG();
142 panic("KVM: Hypervisor undefined exception!\n");
143 case ARM_EXCEPTION_DATA_ABORT:
144 case ARM_EXCEPTION_PREF_ABORT:
145 case ARM_EXCEPTION_HVC:
146 /*
147 * See ARM ARM B1.14.1: "Hyp traps on instructions
148 * that fail their condition code check"
149 */
150 if (!kvm_condition_valid(vcpu)) {
151 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
152 return 1;
153 }
154
155 exit_handler = kvm_get_exit_handler(vcpu);
156
157 return exit_handler(vcpu, run);
158 default:
159 kvm_pr_unimpl("Unsupported exception type: %d",
160 exception_index);
161 run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
162 return 0;
163 }
164}
diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S
index 9f37a79b880b..f048338135f7 100644
--- a/arch/arm/kvm/init.S
+++ b/arch/arm/kvm/init.S
@@ -21,13 +21,33 @@
21#include <asm/asm-offsets.h> 21#include <asm/asm-offsets.h>
22#include <asm/kvm_asm.h> 22#include <asm/kvm_asm.h>
23#include <asm/kvm_arm.h> 23#include <asm/kvm_arm.h>
24#include <asm/kvm_mmu.h>
24 25
25/******************************************************************** 26/********************************************************************
26 * Hypervisor initialization 27 * Hypervisor initialization
27 * - should be called with: 28 * - should be called with:
28 * r0,r1 = Hypervisor pgd pointer 29 * r0 = top of Hyp stack (kernel VA)
29 * r2 = top of Hyp stack (kernel VA) 30 * r1 = pointer to hyp vectors
30 * r3 = pointer to hyp vectors 31 * r2,r3 = Hypervisor pgd pointer
32 *
33 * The init scenario is:
34 * - We jump in HYP with four parameters: boot HYP pgd, runtime HYP pgd,
35 * runtime stack, runtime vectors
36 * - Enable the MMU with the boot pgd
37 * - Jump to a target into the trampoline page (remember, this is the same
38 * physical page!)
39 * - Now switch to the runtime pgd (same VA, and still the same physical
40 * page!)
41 * - Invalidate TLBs
42 * - Set stack and vectors
43 * - Profit! (or eret, if you only care about the code).
44 *
45 * As we only have four registers available to pass parameters (and we
46 * need six), we split the init in two phases:
47 * - Phase 1: r0 = 0, r1 = 0, r2,r3 contain the boot PGD.
48 * Provides the basic HYP init, and enable the MMU.
49 * - Phase 2: r0 = ToS, r1 = vectors, r2,r3 contain the runtime PGD.
50 * Switches to the runtime PGD, set stack and vectors.
31 */ 51 */
32 52
33 .text 53 .text
@@ -47,22 +67,25 @@ __kvm_hyp_init:
47 W(b) . 67 W(b) .
48 68
49__do_hyp_init: 69__do_hyp_init:
70 cmp r0, #0 @ We have a SP?
71 bne phase2 @ Yes, second stage init
72
50 @ Set the HTTBR to point to the hypervisor PGD pointer passed 73 @ Set the HTTBR to point to the hypervisor PGD pointer passed
51 mcrr p15, 4, r0, r1, c2 74 mcrr p15, 4, r2, r3, c2
52 75
53 @ Set the HTCR and VTCR to the same shareability and cacheability 76 @ Set the HTCR and VTCR to the same shareability and cacheability
54 @ settings as the non-secure TTBCR and with T0SZ == 0. 77 @ settings as the non-secure TTBCR and with T0SZ == 0.
55 mrc p15, 4, r0, c2, c0, 2 @ HTCR 78 mrc p15, 4, r0, c2, c0, 2 @ HTCR
56 ldr r12, =HTCR_MASK 79 ldr r2, =HTCR_MASK
57 bic r0, r0, r12 80 bic r0, r0, r2
58 mrc p15, 0, r1, c2, c0, 2 @ TTBCR 81 mrc p15, 0, r1, c2, c0, 2 @ TTBCR
59 and r1, r1, #(HTCR_MASK & ~TTBCR_T0SZ) 82 and r1, r1, #(HTCR_MASK & ~TTBCR_T0SZ)
60 orr r0, r0, r1 83 orr r0, r0, r1
61 mcr p15, 4, r0, c2, c0, 2 @ HTCR 84 mcr p15, 4, r0, c2, c0, 2 @ HTCR
62 85
63 mrc p15, 4, r1, c2, c1, 2 @ VTCR 86 mrc p15, 4, r1, c2, c1, 2 @ VTCR
64 ldr r12, =VTCR_MASK 87 ldr r2, =VTCR_MASK
65 bic r1, r1, r12 88 bic r1, r1, r2
66 bic r0, r0, #(~VTCR_HTCR_SH) @ clear non-reusable HTCR bits 89 bic r0, r0, #(~VTCR_HTCR_SH) @ clear non-reusable HTCR bits
67 orr r1, r0, r1 90 orr r1, r0, r1
68 orr r1, r1, #(KVM_VTCR_SL0 | KVM_VTCR_T0SZ | KVM_VTCR_S) 91 orr r1, r1, #(KVM_VTCR_SL0 | KVM_VTCR_T0SZ | KVM_VTCR_S)
@@ -85,24 +108,41 @@ __do_hyp_init:
85 @ - Memory alignment checks: enabled 108 @ - Memory alignment checks: enabled
86 @ - MMU: enabled (this code must be run from an identity mapping) 109 @ - MMU: enabled (this code must be run from an identity mapping)
87 mrc p15, 4, r0, c1, c0, 0 @ HSCR 110 mrc p15, 4, r0, c1, c0, 0 @ HSCR
88 ldr r12, =HSCTLR_MASK 111 ldr r2, =HSCTLR_MASK
89 bic r0, r0, r12 112 bic r0, r0, r2
90 mrc p15, 0, r1, c1, c0, 0 @ SCTLR 113 mrc p15, 0, r1, c1, c0, 0 @ SCTLR
91 ldr r12, =(HSCTLR_EE | HSCTLR_FI | HSCTLR_I | HSCTLR_C) 114 ldr r2, =(HSCTLR_EE | HSCTLR_FI | HSCTLR_I | HSCTLR_C)
92 and r1, r1, r12 115 and r1, r1, r2
93 ARM( ldr r12, =(HSCTLR_M | HSCTLR_A) ) 116 ARM( ldr r2, =(HSCTLR_M | HSCTLR_A) )
94 THUMB( ldr r12, =(HSCTLR_M | HSCTLR_A | HSCTLR_TE) ) 117 THUMB( ldr r2, =(HSCTLR_M | HSCTLR_A | HSCTLR_TE) )
95 orr r1, r1, r12 118 orr r1, r1, r2
96 orr r0, r0, r1 119 orr r0, r0, r1
97 isb 120 isb
98 mcr p15, 4, r0, c1, c0, 0 @ HSCR 121 mcr p15, 4, r0, c1, c0, 0 @ HSCR
99 isb
100 122
101 @ Set stack pointer and return to the kernel 123 @ End of init phase-1
102 mov sp, r2 124 eret
125
126phase2:
127 @ Set stack pointer
128 mov sp, r0
103 129
104 @ Set HVBAR to point to the HYP vectors 130 @ Set HVBAR to point to the HYP vectors
105 mcr p15, 4, r3, c12, c0, 0 @ HVBAR 131 mcr p15, 4, r1, c12, c0, 0 @ HVBAR
132
133 @ Jump to the trampoline page
134 ldr r0, =TRAMPOLINE_VA
135 adr r1, target
136 bfi r0, r1, #0, #PAGE_SHIFT
137 mov pc, r0
138
139target: @ We're now in the trampoline code, switch page tables
140 mcrr p15, 4, r2, r3, c2
141 isb
142
143 @ Invalidate the old TLBs
144 mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH
145 dsb
106 146
107 eret 147 eret
108 148
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
index 8ca87ab0919d..f7793df62f58 100644
--- a/arch/arm/kvm/interrupts.S
+++ b/arch/arm/kvm/interrupts.S
@@ -35,15 +35,18 @@ __kvm_hyp_code_start:
35/******************************************************************** 35/********************************************************************
36 * Flush per-VMID TLBs 36 * Flush per-VMID TLBs
37 * 37 *
38 * void __kvm_tlb_flush_vmid(struct kvm *kvm); 38 * void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
39 * 39 *
40 * We rely on the hardware to broadcast the TLB invalidation to all CPUs 40 * We rely on the hardware to broadcast the TLB invalidation to all CPUs
41 * inside the inner-shareable domain (which is the case for all v7 41 * inside the inner-shareable domain (which is the case for all v7
42 * implementations). If we come across a non-IS SMP implementation, we'll 42 * implementations). If we come across a non-IS SMP implementation, we'll
43 * have to use an IPI based mechanism. Until then, we stick to the simple 43 * have to use an IPI based mechanism. Until then, we stick to the simple
44 * hardware assisted version. 44 * hardware assisted version.
45 *
46 * As v7 does not support flushing per IPA, just nuke the whole TLB
47 * instead, ignoring the ipa value.
45 */ 48 */
46ENTRY(__kvm_tlb_flush_vmid) 49ENTRY(__kvm_tlb_flush_vmid_ipa)
47 push {r2, r3} 50 push {r2, r3}
48 51
49 add r0, r0, #KVM_VTTBR 52 add r0, r0, #KVM_VTTBR
@@ -60,7 +63,7 @@ ENTRY(__kvm_tlb_flush_vmid)
60 63
61 pop {r2, r3} 64 pop {r2, r3}
62 bx lr 65 bx lr
63ENDPROC(__kvm_tlb_flush_vmid) 66ENDPROC(__kvm_tlb_flush_vmid_ipa)
64 67
65/******************************************************************** 68/********************************************************************
66 * Flush TLBs and instruction caches of all CPUs inside the inner-shareable 69 * Flush TLBs and instruction caches of all CPUs inside the inner-shareable
@@ -235,9 +238,9 @@ ENTRY(kvm_call_hyp)
235 * instruction is issued since all traps are disabled when running the host 238 * instruction is issued since all traps are disabled when running the host
236 * kernel as per the Hyp-mode initialization at boot time. 239 * kernel as per the Hyp-mode initialization at boot time.
237 * 240 *
238 * HVC instructions cause a trap to the vector page + offset 0x18 (see hyp_hvc 241 * HVC instructions cause a trap to the vector page + offset 0x14 (see hyp_hvc
239 * below) when the HVC instruction is called from SVC mode (i.e. a guest or the 242 * below) when the HVC instruction is called from SVC mode (i.e. a guest or the
240 * host kernel) and they cause a trap to the vector page + offset 0xc when HVC 243 * host kernel) and they cause a trap to the vector page + offset 0x8 when HVC
241 * instructions are called from within Hyp-mode. 244 * instructions are called from within Hyp-mode.
242 * 245 *
243 * Hyp-ABI: Calling HYP-mode functions from host (in SVC mode): 246 * Hyp-ABI: Calling HYP-mode functions from host (in SVC mode):
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 98a870ff1a5c..72a12f2171b2 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -33,16 +33,16 @@
33 */ 33 */
34int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) 34int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
35{ 35{
36 __u32 *dest; 36 unsigned long *dest;
37 unsigned int len; 37 unsigned int len;
38 int mask; 38 int mask;
39 39
40 if (!run->mmio.is_write) { 40 if (!run->mmio.is_write) {
41 dest = vcpu_reg(vcpu, vcpu->arch.mmio_decode.rt); 41 dest = vcpu_reg(vcpu, vcpu->arch.mmio_decode.rt);
42 memset(dest, 0, sizeof(int)); 42 *dest = 0;
43 43
44 len = run->mmio.len; 44 len = run->mmio.len;
45 if (len > 4) 45 if (len > sizeof(unsigned long))
46 return -EINVAL; 46 return -EINVAL;
47 47
48 memcpy(dest, run->mmio.data, len); 48 memcpy(dest, run->mmio.data, len);
@@ -50,7 +50,8 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
50 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr, 50 trace_kvm_mmio(KVM_TRACE_MMIO_READ, len, run->mmio.phys_addr,
51 *((u64 *)run->mmio.data)); 51 *((u64 *)run->mmio.data));
52 52
53 if (vcpu->arch.mmio_decode.sign_extend && len < 4) { 53 if (vcpu->arch.mmio_decode.sign_extend &&
54 len < sizeof(unsigned long)) {
54 mask = 1U << ((len * 8) - 1); 55 mask = 1U << ((len * 8) - 1);
55 *dest = (*dest ^ mask) - mask; 56 *dest = (*dest ^ mask) - mask;
56 } 57 }
@@ -65,40 +66,29 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
65 unsigned long rt, len; 66 unsigned long rt, len;
66 bool is_write, sign_extend; 67 bool is_write, sign_extend;
67 68
68 if ((vcpu->arch.hsr >> 8) & 1) { 69 if (kvm_vcpu_dabt_isextabt(vcpu)) {
69 /* cache operation on I/O addr, tell guest unsupported */ 70 /* cache operation on I/O addr, tell guest unsupported */
70 kvm_inject_dabt(vcpu, vcpu->arch.hxfar); 71 kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
71 return 1; 72 return 1;
72 } 73 }
73 74
74 if ((vcpu->arch.hsr >> 7) & 1) { 75 if (kvm_vcpu_dabt_iss1tw(vcpu)) {
75 /* page table accesses IO mem: tell guest to fix its TTBR */ 76 /* page table accesses IO mem: tell guest to fix its TTBR */
76 kvm_inject_dabt(vcpu, vcpu->arch.hxfar); 77 kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
77 return 1; 78 return 1;
78 } 79 }
79 80
80 switch ((vcpu->arch.hsr >> 22) & 0x3) { 81 len = kvm_vcpu_dabt_get_as(vcpu);
81 case 0: 82 if (unlikely(len < 0))
82 len = 1; 83 return len;
83 break;
84 case 1:
85 len = 2;
86 break;
87 case 2:
88 len = 4;
89 break;
90 default:
91 kvm_err("Hardware is weird: SAS 0b11 is reserved\n");
92 return -EFAULT;
93 }
94 84
95 is_write = vcpu->arch.hsr & HSR_WNR; 85 is_write = kvm_vcpu_dabt_iswrite(vcpu);
96 sign_extend = vcpu->arch.hsr & HSR_SSE; 86 sign_extend = kvm_vcpu_dabt_issext(vcpu);
97 rt = (vcpu->arch.hsr & HSR_SRT_MASK) >> HSR_SRT_SHIFT; 87 rt = kvm_vcpu_dabt_get_rd(vcpu);
98 88
99 if (kvm_vcpu_reg_is_pc(vcpu, rt)) { 89 if (kvm_vcpu_reg_is_pc(vcpu, rt)) {
100 /* IO memory trying to read/write pc */ 90 /* IO memory trying to read/write pc */
101 kvm_inject_pabt(vcpu, vcpu->arch.hxfar); 91 kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
102 return 1; 92 return 1;
103 } 93 }
104 94
@@ -112,7 +102,7 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
112 * The MMIO instruction is emulated and should not be re-executed 102 * The MMIO instruction is emulated and should not be re-executed
113 * in the guest. 103 * in the guest.
114 */ 104 */
115 kvm_skip_instr(vcpu, (vcpu->arch.hsr >> 25) & 1); 105 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
116 return 0; 106 return 0;
117} 107}
118 108
@@ -130,7 +120,7 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
130 * space do its magic. 120 * space do its magic.
131 */ 121 */
132 122
133 if (vcpu->arch.hsr & HSR_ISV) { 123 if (kvm_vcpu_dabt_isvalid(vcpu)) {
134 ret = decode_hsr(vcpu, fault_ipa, &mmio); 124 ret = decode_hsr(vcpu, fault_ipa, &mmio);
135 if (ret) 125 if (ret)
136 return ret; 126 return ret;
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 99e07c7dd745..965706578f13 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -20,7 +20,6 @@
20#include <linux/kvm_host.h> 20#include <linux/kvm_host.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <trace/events/kvm.h> 22#include <trace/events/kvm.h>
23#include <asm/idmap.h>
24#include <asm/pgalloc.h> 23#include <asm/pgalloc.h>
25#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
26#include <asm/kvm_arm.h> 25#include <asm/kvm_arm.h>
@@ -28,28 +27,23 @@
28#include <asm/kvm_mmio.h> 27#include <asm/kvm_mmio.h>
29#include <asm/kvm_asm.h> 28#include <asm/kvm_asm.h>
30#include <asm/kvm_emulate.h> 29#include <asm/kvm_emulate.h>
31#include <asm/mach/map.h>
32#include <trace/events/kvm.h>
33 30
34#include "trace.h" 31#include "trace.h"
35 32
36extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[]; 33extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[];
37 34
35static pgd_t *boot_hyp_pgd;
36static pgd_t *hyp_pgd;
38static DEFINE_MUTEX(kvm_hyp_pgd_mutex); 37static DEFINE_MUTEX(kvm_hyp_pgd_mutex);
39 38
40static void kvm_tlb_flush_vmid(struct kvm *kvm) 39static void *init_bounce_page;
41{ 40static unsigned long hyp_idmap_start;
42 kvm_call_hyp(__kvm_tlb_flush_vmid, kvm); 41static unsigned long hyp_idmap_end;
43} 42static phys_addr_t hyp_idmap_vector;
44 43
45static void kvm_set_pte(pte_t *pte, pte_t new_pte) 44static void kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa)
46{ 45{
47 pte_val(*pte) = new_pte; 46 kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, kvm, ipa);
48 /*
49 * flush_pmd_entry just takes a void pointer and cleans the necessary
50 * cache entries, so we can reuse the function for ptes.
51 */
52 flush_pmd_entry(pte);
53} 47}
54 48
55static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, 49static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
@@ -84,88 +78,165 @@ static void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc)
84 return p; 78 return p;
85} 79}
86 80
87static void free_ptes(pmd_t *pmd, unsigned long addr) 81static void clear_pud_entry(pud_t *pud)
88{ 82{
89 pte_t *pte; 83 pmd_t *pmd_table = pmd_offset(pud, 0);
90 unsigned int i; 84 pud_clear(pud);
85 pmd_free(NULL, pmd_table);
86 put_page(virt_to_page(pud));
87}
91 88
92 for (i = 0; i < PTRS_PER_PMD; i++, addr += PMD_SIZE) { 89static void clear_pmd_entry(pmd_t *pmd)
93 if (!pmd_none(*pmd) && pmd_table(*pmd)) { 90{
94 pte = pte_offset_kernel(pmd, addr); 91 pte_t *pte_table = pte_offset_kernel(pmd, 0);
95 pte_free_kernel(NULL, pte); 92 pmd_clear(pmd);
96 } 93 pte_free_kernel(NULL, pte_table);
97 pmd++; 94 put_page(virt_to_page(pmd));
95}
96
97static bool pmd_empty(pmd_t *pmd)
98{
99 struct page *pmd_page = virt_to_page(pmd);
100 return page_count(pmd_page) == 1;
101}
102
103static void clear_pte_entry(pte_t *pte)
104{
105 if (pte_present(*pte)) {
106 kvm_set_pte(pte, __pte(0));
107 put_page(virt_to_page(pte));
98 } 108 }
99} 109}
100 110
101/** 111static bool pte_empty(pte_t *pte)
102 * free_hyp_pmds - free a Hyp-mode level-2 tables and child level-3 tables 112{
103 * 113 struct page *pte_page = virt_to_page(pte);
104 * Assumes this is a page table used strictly in Hyp-mode and therefore contains 114 return page_count(pte_page) == 1;
105 * only mappings in the kernel memory area, which is above PAGE_OFFSET. 115}
106 */ 116
107void free_hyp_pmds(void) 117static void unmap_range(pgd_t *pgdp, unsigned long long start, u64 size)
108{ 118{
109 pgd_t *pgd; 119 pgd_t *pgd;
110 pud_t *pud; 120 pud_t *pud;
111 pmd_t *pmd; 121 pmd_t *pmd;
112 unsigned long addr; 122 pte_t *pte;
123 unsigned long long addr = start, end = start + size;
124 u64 range;
113 125
114 mutex_lock(&kvm_hyp_pgd_mutex); 126 while (addr < end) {
115 for (addr = PAGE_OFFSET; addr != 0; addr += PGDIR_SIZE) { 127 pgd = pgdp + pgd_index(addr);
116 pgd = hyp_pgd + pgd_index(addr);
117 pud = pud_offset(pgd, addr); 128 pud = pud_offset(pgd, addr);
118 129 if (pud_none(*pud)) {
119 if (pud_none(*pud)) 130 addr += PUD_SIZE;
120 continue; 131 continue;
121 BUG_ON(pud_bad(*pud)); 132 }
122 133
123 pmd = pmd_offset(pud, addr); 134 pmd = pmd_offset(pud, addr);
124 free_ptes(pmd, addr); 135 if (pmd_none(*pmd)) {
125 pmd_free(NULL, pmd); 136 addr += PMD_SIZE;
126 pud_clear(pud); 137 continue;
138 }
139
140 pte = pte_offset_kernel(pmd, addr);
141 clear_pte_entry(pte);
142 range = PAGE_SIZE;
143
144 /* If we emptied the pte, walk back up the ladder */
145 if (pte_empty(pte)) {
146 clear_pmd_entry(pmd);
147 range = PMD_SIZE;
148 if (pmd_empty(pmd)) {
149 clear_pud_entry(pud);
150 range = PUD_SIZE;
151 }
152 }
153
154 addr += range;
155 }
156}
157
158/**
159 * free_boot_hyp_pgd - free HYP boot page tables
160 *
161 * Free the HYP boot page tables. The bounce page is also freed.
162 */
163void free_boot_hyp_pgd(void)
164{
165 mutex_lock(&kvm_hyp_pgd_mutex);
166
167 if (boot_hyp_pgd) {
168 unmap_range(boot_hyp_pgd, hyp_idmap_start, PAGE_SIZE);
169 unmap_range(boot_hyp_pgd, TRAMPOLINE_VA, PAGE_SIZE);
170 kfree(boot_hyp_pgd);
171 boot_hyp_pgd = NULL;
127 } 172 }
173
174 if (hyp_pgd)
175 unmap_range(hyp_pgd, TRAMPOLINE_VA, PAGE_SIZE);
176
177 kfree(init_bounce_page);
178 init_bounce_page = NULL;
179
128 mutex_unlock(&kvm_hyp_pgd_mutex); 180 mutex_unlock(&kvm_hyp_pgd_mutex);
129} 181}
130 182
131static void create_hyp_pte_mappings(pmd_t *pmd, unsigned long start, 183/**
132 unsigned long end) 184 * free_hyp_pgds - free Hyp-mode page tables
185 *
186 * Assumes hyp_pgd is a page table used strictly in Hyp-mode and
187 * therefore contains either mappings in the kernel memory area (above
188 * PAGE_OFFSET), or device mappings in the vmalloc range (from
189 * VMALLOC_START to VMALLOC_END).
190 *
191 * boot_hyp_pgd should only map two pages for the init code.
192 */
193void free_hyp_pgds(void)
133{ 194{
134 pte_t *pte;
135 unsigned long addr; 195 unsigned long addr;
136 struct page *page;
137 196
138 for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { 197 free_boot_hyp_pgd();
139 pte = pte_offset_kernel(pmd, addr); 198
140 BUG_ON(!virt_addr_valid(addr)); 199 mutex_lock(&kvm_hyp_pgd_mutex);
141 page = virt_to_page(addr); 200
142 kvm_set_pte(pte, mk_pte(page, PAGE_HYP)); 201 if (hyp_pgd) {
202 for (addr = PAGE_OFFSET; virt_addr_valid(addr); addr += PGDIR_SIZE)
203 unmap_range(hyp_pgd, KERN_TO_HYP(addr), PGDIR_SIZE);
204 for (addr = VMALLOC_START; is_vmalloc_addr((void*)addr); addr += PGDIR_SIZE)
205 unmap_range(hyp_pgd, KERN_TO_HYP(addr), PGDIR_SIZE);
206 kfree(hyp_pgd);
207 hyp_pgd = NULL;
143 } 208 }
209
210 mutex_unlock(&kvm_hyp_pgd_mutex);
144} 211}
145 212
146static void create_hyp_io_pte_mappings(pmd_t *pmd, unsigned long start, 213static void create_hyp_pte_mappings(pmd_t *pmd, unsigned long start,
147 unsigned long end, 214 unsigned long end, unsigned long pfn,
148 unsigned long *pfn_base) 215 pgprot_t prot)
149{ 216{
150 pte_t *pte; 217 pte_t *pte;
151 unsigned long addr; 218 unsigned long addr;
152 219
153 for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { 220 addr = start;
221 do {
154 pte = pte_offset_kernel(pmd, addr); 222 pte = pte_offset_kernel(pmd, addr);
155 BUG_ON(pfn_valid(*pfn_base)); 223 kvm_set_pte(pte, pfn_pte(pfn, prot));
156 kvm_set_pte(pte, pfn_pte(*pfn_base, PAGE_HYP_DEVICE)); 224 get_page(virt_to_page(pte));
157 (*pfn_base)++; 225 kvm_flush_dcache_to_poc(pte, sizeof(*pte));
158 } 226 pfn++;
227 } while (addr += PAGE_SIZE, addr != end);
159} 228}
160 229
161static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start, 230static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start,
162 unsigned long end, unsigned long *pfn_base) 231 unsigned long end, unsigned long pfn,
232 pgprot_t prot)
163{ 233{
164 pmd_t *pmd; 234 pmd_t *pmd;
165 pte_t *pte; 235 pte_t *pte;
166 unsigned long addr, next; 236 unsigned long addr, next;
167 237
168 for (addr = start; addr < end; addr = next) { 238 addr = start;
239 do {
169 pmd = pmd_offset(pud, addr); 240 pmd = pmd_offset(pud, addr);
170 241
171 BUG_ON(pmd_sect(*pmd)); 242 BUG_ON(pmd_sect(*pmd));
@@ -177,42 +248,34 @@ static int create_hyp_pmd_mappings(pud_t *pud, unsigned long start,
177 return -ENOMEM; 248 return -ENOMEM;
178 } 249 }
179 pmd_populate_kernel(NULL, pmd, pte); 250 pmd_populate_kernel(NULL, pmd, pte);
251 get_page(virt_to_page(pmd));
252 kvm_flush_dcache_to_poc(pmd, sizeof(*pmd));
180 } 253 }
181 254
182 next = pmd_addr_end(addr, end); 255 next = pmd_addr_end(addr, end);
183 256
184 /* 257 create_hyp_pte_mappings(pmd, addr, next, pfn, prot);
185 * If pfn_base is NULL, we map kernel pages into HYP with the 258 pfn += (next - addr) >> PAGE_SHIFT;
186 * virtual address. Otherwise, this is considered an I/O 259 } while (addr = next, addr != end);
187 * mapping and we map the physical region starting at
188 * *pfn_base to [start, end[.
189 */
190 if (!pfn_base)
191 create_hyp_pte_mappings(pmd, addr, next);
192 else
193 create_hyp_io_pte_mappings(pmd, addr, next, pfn_base);
194 }
195 260
196 return 0; 261 return 0;
197} 262}
198 263
199static int __create_hyp_mappings(void *from, void *to, unsigned long *pfn_base) 264static int __create_hyp_mappings(pgd_t *pgdp,
265 unsigned long start, unsigned long end,
266 unsigned long pfn, pgprot_t prot)
200{ 267{
201 unsigned long start = (unsigned long)from;
202 unsigned long end = (unsigned long)to;
203 pgd_t *pgd; 268 pgd_t *pgd;
204 pud_t *pud; 269 pud_t *pud;
205 pmd_t *pmd; 270 pmd_t *pmd;
206 unsigned long addr, next; 271 unsigned long addr, next;
207 int err = 0; 272 int err = 0;
208 273
209 BUG_ON(start > end);
210 if (start < PAGE_OFFSET)
211 return -EINVAL;
212
213 mutex_lock(&kvm_hyp_pgd_mutex); 274 mutex_lock(&kvm_hyp_pgd_mutex);
214 for (addr = start; addr < end; addr = next) { 275 addr = start & PAGE_MASK;
215 pgd = hyp_pgd + pgd_index(addr); 276 end = PAGE_ALIGN(end);
277 do {
278 pgd = pgdp + pgd_index(addr);
216 pud = pud_offset(pgd, addr); 279 pud = pud_offset(pgd, addr);
217 280
218 if (pud_none_or_clear_bad(pud)) { 281 if (pud_none_or_clear_bad(pud)) {
@@ -223,43 +286,64 @@ static int __create_hyp_mappings(void *from, void *to, unsigned long *pfn_base)
223 goto out; 286 goto out;
224 } 287 }
225 pud_populate(NULL, pud, pmd); 288 pud_populate(NULL, pud, pmd);
289 get_page(virt_to_page(pud));
290 kvm_flush_dcache_to_poc(pud, sizeof(*pud));
226 } 291 }
227 292
228 next = pgd_addr_end(addr, end); 293 next = pgd_addr_end(addr, end);
229 err = create_hyp_pmd_mappings(pud, addr, next, pfn_base); 294 err = create_hyp_pmd_mappings(pud, addr, next, pfn, prot);
230 if (err) 295 if (err)
231 goto out; 296 goto out;
232 } 297 pfn += (next - addr) >> PAGE_SHIFT;
298 } while (addr = next, addr != end);
233out: 299out:
234 mutex_unlock(&kvm_hyp_pgd_mutex); 300 mutex_unlock(&kvm_hyp_pgd_mutex);
235 return err; 301 return err;
236} 302}
237 303
238/** 304/**
239 * create_hyp_mappings - map a kernel virtual address range in Hyp mode 305 * create_hyp_mappings - duplicate a kernel virtual address range in Hyp mode
240 * @from: The virtual kernel start address of the range 306 * @from: The virtual kernel start address of the range
241 * @to: The virtual kernel end address of the range (exclusive) 307 * @to: The virtual kernel end address of the range (exclusive)
242 * 308 *
243 * The same virtual address as the kernel virtual address is also used in 309 * The same virtual address as the kernel virtual address is also used
244 * Hyp-mode mapping to the same underlying physical pages. 310 * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying
245 * 311 * physical pages.
246 * Note: Wrapping around zero in the "to" address is not supported.
247 */ 312 */
248int create_hyp_mappings(void *from, void *to) 313int create_hyp_mappings(void *from, void *to)
249{ 314{
250 return __create_hyp_mappings(from, to, NULL); 315 unsigned long phys_addr = virt_to_phys(from);
316 unsigned long start = KERN_TO_HYP((unsigned long)from);
317 unsigned long end = KERN_TO_HYP((unsigned long)to);
318
319 /* Check for a valid kernel memory mapping */
320 if (!virt_addr_valid(from) || !virt_addr_valid(to - 1))
321 return -EINVAL;
322
323 return __create_hyp_mappings(hyp_pgd, start, end,
324 __phys_to_pfn(phys_addr), PAGE_HYP);
251} 325}
252 326
253/** 327/**
254 * create_hyp_io_mappings - map a physical IO range in Hyp mode 328 * create_hyp_io_mappings - duplicate a kernel IO mapping into Hyp mode
255 * @from: The virtual HYP start address of the range 329 * @from: The kernel start VA of the range
256 * @to: The virtual HYP end address of the range (exclusive) 330 * @to: The kernel end VA of the range (exclusive)
257 * @addr: The physical start address which gets mapped 331 * @phys_addr: The physical start address which gets mapped
332 *
333 * The resulting HYP VA is the same as the kernel VA, modulo
334 * HYP_PAGE_OFFSET.
258 */ 335 */
259int create_hyp_io_mappings(void *from, void *to, phys_addr_t addr) 336int create_hyp_io_mappings(void *from, void *to, phys_addr_t phys_addr)
260{ 337{
261 unsigned long pfn = __phys_to_pfn(addr); 338 unsigned long start = KERN_TO_HYP((unsigned long)from);
262 return __create_hyp_mappings(from, to, &pfn); 339 unsigned long end = KERN_TO_HYP((unsigned long)to);
340
341 /* Check for a valid kernel IO mapping */
342 if (!is_vmalloc_addr(from) || !is_vmalloc_addr(to - 1))
343 return -EINVAL;
344
345 return __create_hyp_mappings(hyp_pgd, start, end,
346 __phys_to_pfn(phys_addr), PAGE_HYP_DEVICE);
263} 347}
264 348
265/** 349/**
@@ -290,48 +374,12 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm)
290 VM_BUG_ON((unsigned long)pgd & (S2_PGD_SIZE - 1)); 374 VM_BUG_ON((unsigned long)pgd & (S2_PGD_SIZE - 1));
291 375
292 memset(pgd, 0, PTRS_PER_S2_PGD * sizeof(pgd_t)); 376 memset(pgd, 0, PTRS_PER_S2_PGD * sizeof(pgd_t));
293 clean_dcache_area(pgd, PTRS_PER_S2_PGD * sizeof(pgd_t)); 377 kvm_clean_pgd(pgd);
294 kvm->arch.pgd = pgd; 378 kvm->arch.pgd = pgd;
295 379
296 return 0; 380 return 0;
297} 381}
298 382
299static void clear_pud_entry(pud_t *pud)
300{
301 pmd_t *pmd_table = pmd_offset(pud, 0);
302 pud_clear(pud);
303 pmd_free(NULL, pmd_table);
304 put_page(virt_to_page(pud));
305}
306
307static void clear_pmd_entry(pmd_t *pmd)
308{
309 pte_t *pte_table = pte_offset_kernel(pmd, 0);
310 pmd_clear(pmd);
311 pte_free_kernel(NULL, pte_table);
312 put_page(virt_to_page(pmd));
313}
314
315static bool pmd_empty(pmd_t *pmd)
316{
317 struct page *pmd_page = virt_to_page(pmd);
318 return page_count(pmd_page) == 1;
319}
320
321static void clear_pte_entry(pte_t *pte)
322{
323 if (pte_present(*pte)) {
324 kvm_set_pte(pte, __pte(0));
325 put_page(virt_to_page(pte));
326 }
327}
328
329static bool pte_empty(pte_t *pte)
330{
331 struct page *pte_page = virt_to_page(pte);
332 return page_count(pte_page) == 1;
333}
334
335/** 383/**
336 * unmap_stage2_range -- Clear stage2 page table entries to unmap a range 384 * unmap_stage2_range -- Clear stage2 page table entries to unmap a range
337 * @kvm: The VM pointer 385 * @kvm: The VM pointer
@@ -345,43 +393,7 @@ static bool pte_empty(pte_t *pte)
345 */ 393 */
346static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size) 394static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
347{ 395{
348 pgd_t *pgd; 396 unmap_range(kvm->arch.pgd, start, size);
349 pud_t *pud;
350 pmd_t *pmd;
351 pte_t *pte;
352 phys_addr_t addr = start, end = start + size;
353 u64 range;
354
355 while (addr < end) {
356 pgd = kvm->arch.pgd + pgd_index(addr);
357 pud = pud_offset(pgd, addr);
358 if (pud_none(*pud)) {
359 addr += PUD_SIZE;
360 continue;
361 }
362
363 pmd = pmd_offset(pud, addr);
364 if (pmd_none(*pmd)) {
365 addr += PMD_SIZE;
366 continue;
367 }
368
369 pte = pte_offset_kernel(pmd, addr);
370 clear_pte_entry(pte);
371 range = PAGE_SIZE;
372
373 /* If we emptied the pte, walk back up the ladder */
374 if (pte_empty(pte)) {
375 clear_pmd_entry(pmd);
376 range = PMD_SIZE;
377 if (pmd_empty(pmd)) {
378 clear_pud_entry(pud);
379 range = PUD_SIZE;
380 }
381 }
382
383 addr += range;
384 }
385} 397}
386 398
387/** 399/**
@@ -422,22 +434,22 @@ static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
422 return 0; /* ignore calls from kvm_set_spte_hva */ 434 return 0; /* ignore calls from kvm_set_spte_hva */
423 pmd = mmu_memory_cache_alloc(cache); 435 pmd = mmu_memory_cache_alloc(cache);
424 pud_populate(NULL, pud, pmd); 436 pud_populate(NULL, pud, pmd);
425 pmd += pmd_index(addr);
426 get_page(virt_to_page(pud)); 437 get_page(virt_to_page(pud));
427 } else 438 }
428 pmd = pmd_offset(pud, addr); 439
440 pmd = pmd_offset(pud, addr);
429 441
430 /* Create 2nd stage page table mapping - Level 2 */ 442 /* Create 2nd stage page table mapping - Level 2 */
431 if (pmd_none(*pmd)) { 443 if (pmd_none(*pmd)) {
432 if (!cache) 444 if (!cache)
433 return 0; /* ignore calls from kvm_set_spte_hva */ 445 return 0; /* ignore calls from kvm_set_spte_hva */
434 pte = mmu_memory_cache_alloc(cache); 446 pte = mmu_memory_cache_alloc(cache);
435 clean_pte_table(pte); 447 kvm_clean_pte(pte);
436 pmd_populate_kernel(NULL, pmd, pte); 448 pmd_populate_kernel(NULL, pmd, pte);
437 pte += pte_index(addr);
438 get_page(virt_to_page(pmd)); 449 get_page(virt_to_page(pmd));
439 } else 450 }
440 pte = pte_offset_kernel(pmd, addr); 451
452 pte = pte_offset_kernel(pmd, addr);
441 453
442 if (iomap && pte_present(*pte)) 454 if (iomap && pte_present(*pte))
443 return -EFAULT; 455 return -EFAULT;
@@ -446,7 +458,7 @@ static int stage2_set_pte(struct kvm *kvm, struct kvm_mmu_memory_cache *cache,
446 old_pte = *pte; 458 old_pte = *pte;
447 kvm_set_pte(pte, *new_pte); 459 kvm_set_pte(pte, *new_pte);
448 if (pte_present(old_pte)) 460 if (pte_present(old_pte))
449 kvm_tlb_flush_vmid(kvm); 461 kvm_tlb_flush_vmid_ipa(kvm, addr);
450 else 462 else
451 get_page(virt_to_page(pte)); 463 get_page(virt_to_page(pte));
452 464
@@ -473,7 +485,8 @@ int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
473 pfn = __phys_to_pfn(pa); 485 pfn = __phys_to_pfn(pa);
474 486
475 for (addr = guest_ipa; addr < end; addr += PAGE_SIZE) { 487 for (addr = guest_ipa; addr < end; addr += PAGE_SIZE) {
476 pte_t pte = pfn_pte(pfn, PAGE_S2_DEVICE | L_PTE_S2_RDWR); 488 pte_t pte = pfn_pte(pfn, PAGE_S2_DEVICE);
489 kvm_set_s2pte_writable(&pte);
477 490
478 ret = mmu_topup_memory_cache(&cache, 2, 2); 491 ret = mmu_topup_memory_cache(&cache, 2, 2);
479 if (ret) 492 if (ret)
@@ -492,29 +505,6 @@ out:
492 return ret; 505 return ret;
493} 506}
494 507
495static void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn)
496{
497 /*
498 * If we are going to insert an instruction page and the icache is
499 * either VIPT or PIPT, there is a potential problem where the host
500 * (or another VM) may have used the same page as this guest, and we
501 * read incorrect data from the icache. If we're using a PIPT cache,
502 * we can invalidate just that page, but if we are using a VIPT cache
503 * we need to invalidate the entire icache - damn shame - as written
504 * in the ARM ARM (DDI 0406C.b - Page B3-1393).
505 *
506 * VIVT caches are tagged using both the ASID and the VMID and doesn't
507 * need any kind of flushing (DDI 0406C.b - Page B3-1392).
508 */
509 if (icache_is_pipt()) {
510 unsigned long hva = gfn_to_hva(kvm, gfn);
511 __cpuc_coherent_user_range(hva, hva + PAGE_SIZE);
512 } else if (!icache_is_vivt_asid_tagged()) {
513 /* any kind of VIPT cache */
514 __flush_icache_all();
515 }
516}
517
518static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, 508static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
519 gfn_t gfn, struct kvm_memory_slot *memslot, 509 gfn_t gfn, struct kvm_memory_slot *memslot,
520 unsigned long fault_status) 510 unsigned long fault_status)
@@ -526,7 +516,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
526 unsigned long mmu_seq; 516 unsigned long mmu_seq;
527 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache; 517 struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;
528 518
529 write_fault = kvm_is_write_fault(vcpu->arch.hsr); 519 write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu));
530 if (fault_status == FSC_PERM && !write_fault) { 520 if (fault_status == FSC_PERM && !write_fault) {
531 kvm_err("Unexpected L2 read permission error\n"); 521 kvm_err("Unexpected L2 read permission error\n");
532 return -EFAULT; 522 return -EFAULT;
@@ -560,7 +550,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
560 if (mmu_notifier_retry(vcpu->kvm, mmu_seq)) 550 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
561 goto out_unlock; 551 goto out_unlock;
562 if (writable) { 552 if (writable) {
563 pte_val(new_pte) |= L_PTE_S2_RDWR; 553 kvm_set_s2pte_writable(&new_pte);
564 kvm_set_pfn_dirty(pfn); 554 kvm_set_pfn_dirty(pfn);
565 } 555 }
566 stage2_set_pte(vcpu->kvm, memcache, fault_ipa, &new_pte, false); 556 stage2_set_pte(vcpu->kvm, memcache, fault_ipa, &new_pte, false);
@@ -585,7 +575,6 @@ out_unlock:
585 */ 575 */
586int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run) 576int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
587{ 577{
588 unsigned long hsr_ec;
589 unsigned long fault_status; 578 unsigned long fault_status;
590 phys_addr_t fault_ipa; 579 phys_addr_t fault_ipa;
591 struct kvm_memory_slot *memslot; 580 struct kvm_memory_slot *memslot;
@@ -593,18 +582,17 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
593 gfn_t gfn; 582 gfn_t gfn;
594 int ret, idx; 583 int ret, idx;
595 584
596 hsr_ec = vcpu->arch.hsr >> HSR_EC_SHIFT; 585 is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
597 is_iabt = (hsr_ec == HSR_EC_IABT); 586 fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
598 fault_ipa = ((phys_addr_t)vcpu->arch.hpfar & HPFAR_MASK) << 8;
599 587
600 trace_kvm_guest_fault(*vcpu_pc(vcpu), vcpu->arch.hsr, 588 trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu),
601 vcpu->arch.hxfar, fault_ipa); 589 kvm_vcpu_get_hfar(vcpu), fault_ipa);
602 590
603 /* Check the stage-2 fault is trans. fault or write fault */ 591 /* Check the stage-2 fault is trans. fault or write fault */
604 fault_status = (vcpu->arch.hsr & HSR_FSC_TYPE); 592 fault_status = kvm_vcpu_trap_get_fault(vcpu);
605 if (fault_status != FSC_FAULT && fault_status != FSC_PERM) { 593 if (fault_status != FSC_FAULT && fault_status != FSC_PERM) {
606 kvm_err("Unsupported fault status: EC=%#lx DFCS=%#lx\n", 594 kvm_err("Unsupported fault status: EC=%#x DFCS=%#lx\n",
607 hsr_ec, fault_status); 595 kvm_vcpu_trap_get_class(vcpu), fault_status);
608 return -EFAULT; 596 return -EFAULT;
609 } 597 }
610 598
@@ -614,7 +602,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
614 if (!kvm_is_visible_gfn(vcpu->kvm, gfn)) { 602 if (!kvm_is_visible_gfn(vcpu->kvm, gfn)) {
615 if (is_iabt) { 603 if (is_iabt) {
616 /* Prefetch Abort on I/O address */ 604 /* Prefetch Abort on I/O address */
617 kvm_inject_pabt(vcpu, vcpu->arch.hxfar); 605 kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
618 ret = 1; 606 ret = 1;
619 goto out_unlock; 607 goto out_unlock;
620 } 608 }
@@ -626,8 +614,13 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
626 goto out_unlock; 614 goto out_unlock;
627 } 615 }
628 616
629 /* Adjust page offset */ 617 /*
630 fault_ipa |= vcpu->arch.hxfar & ~PAGE_MASK; 618 * The IPA is reported as [MAX:12], so we need to
619 * complement it with the bottom 12 bits from the
620 * faulting VA. This is always 12 bits, irrespective
621 * of the page size.
622 */
623 fault_ipa |= kvm_vcpu_get_hfar(vcpu) & ((1 << 12) - 1);
631 ret = io_mem_abort(vcpu, run, fault_ipa); 624 ret = io_mem_abort(vcpu, run, fault_ipa);
632 goto out_unlock; 625 goto out_unlock;
633 } 626 }
@@ -682,7 +675,7 @@ static void handle_hva_to_gpa(struct kvm *kvm,
682static void kvm_unmap_hva_handler(struct kvm *kvm, gpa_t gpa, void *data) 675static void kvm_unmap_hva_handler(struct kvm *kvm, gpa_t gpa, void *data)
683{ 676{
684 unmap_stage2_range(kvm, gpa, PAGE_SIZE); 677 unmap_stage2_range(kvm, gpa, PAGE_SIZE);
685 kvm_tlb_flush_vmid(kvm); 678 kvm_tlb_flush_vmid_ipa(kvm, gpa);
686} 679}
687 680
688int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) 681int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
@@ -736,47 +729,105 @@ void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu)
736 729
737phys_addr_t kvm_mmu_get_httbr(void) 730phys_addr_t kvm_mmu_get_httbr(void)
738{ 731{
739 VM_BUG_ON(!virt_addr_valid(hyp_pgd));
740 return virt_to_phys(hyp_pgd); 732 return virt_to_phys(hyp_pgd);
741} 733}
742 734
735phys_addr_t kvm_mmu_get_boot_httbr(void)
736{
737 return virt_to_phys(boot_hyp_pgd);
738}
739
740phys_addr_t kvm_get_idmap_vector(void)
741{
742 return hyp_idmap_vector;
743}
744
743int kvm_mmu_init(void) 745int kvm_mmu_init(void)
744{ 746{
745 if (!hyp_pgd) { 747 int err;
748
749 hyp_idmap_start = virt_to_phys(__hyp_idmap_text_start);
750 hyp_idmap_end = virt_to_phys(__hyp_idmap_text_end);
751 hyp_idmap_vector = virt_to_phys(__kvm_hyp_init);
752
753 if ((hyp_idmap_start ^ hyp_idmap_end) & PAGE_MASK) {
754 /*
755 * Our init code is crossing a page boundary. Allocate
756 * a bounce page, copy the code over and use that.
757 */
758 size_t len = __hyp_idmap_text_end - __hyp_idmap_text_start;
759 phys_addr_t phys_base;
760
761 init_bounce_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
762 if (!init_bounce_page) {
763 kvm_err("Couldn't allocate HYP init bounce page\n");
764 err = -ENOMEM;
765 goto out;
766 }
767
768 memcpy(init_bounce_page, __hyp_idmap_text_start, len);
769 /*
770 * Warning: the code we just copied to the bounce page
771 * must be flushed to the point of coherency.
772 * Otherwise, the data may be sitting in L2, and HYP
773 * mode won't be able to observe it as it runs with
774 * caches off at that point.
775 */
776 kvm_flush_dcache_to_poc(init_bounce_page, len);
777
778 phys_base = virt_to_phys(init_bounce_page);
779 hyp_idmap_vector += phys_base - hyp_idmap_start;
780 hyp_idmap_start = phys_base;
781 hyp_idmap_end = phys_base + len;
782
783 kvm_info("Using HYP init bounce page @%lx\n",
784 (unsigned long)phys_base);
785 }
786
787 hyp_pgd = kzalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL);
788 boot_hyp_pgd = kzalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL);
789 if (!hyp_pgd || !boot_hyp_pgd) {
746 kvm_err("Hyp mode PGD not allocated\n"); 790 kvm_err("Hyp mode PGD not allocated\n");
747 return -ENOMEM; 791 err = -ENOMEM;
792 goto out;
748 } 793 }
749 794
750 return 0; 795 /* Create the idmap in the boot page tables */
751} 796 err = __create_hyp_mappings(boot_hyp_pgd,
797 hyp_idmap_start, hyp_idmap_end,
798 __phys_to_pfn(hyp_idmap_start),
799 PAGE_HYP);
752 800
753/** 801 if (err) {
754 * kvm_clear_idmap - remove all idmaps from the hyp pgd 802 kvm_err("Failed to idmap %lx-%lx\n",
755 * 803 hyp_idmap_start, hyp_idmap_end);
756 * Free the underlying pmds for all pgds in range and clear the pgds (but 804 goto out;
757 * don't free them) afterwards. 805 }
758 */
759void kvm_clear_hyp_idmap(void)
760{
761 unsigned long addr, end;
762 unsigned long next;
763 pgd_t *pgd = hyp_pgd;
764 pud_t *pud;
765 pmd_t *pmd;
766 806
767 addr = virt_to_phys(__hyp_idmap_text_start); 807 /* Map the very same page at the trampoline VA */
768 end = virt_to_phys(__hyp_idmap_text_end); 808 err = __create_hyp_mappings(boot_hyp_pgd,
809 TRAMPOLINE_VA, TRAMPOLINE_VA + PAGE_SIZE,
810 __phys_to_pfn(hyp_idmap_start),
811 PAGE_HYP);
812 if (err) {
813 kvm_err("Failed to map trampoline @%lx into boot HYP pgd\n",
814 TRAMPOLINE_VA);
815 goto out;
816 }
769 817
770 pgd += pgd_index(addr); 818 /* Map the same page again into the runtime page tables */
771 do { 819 err = __create_hyp_mappings(hyp_pgd,
772 next = pgd_addr_end(addr, end); 820 TRAMPOLINE_VA, TRAMPOLINE_VA + PAGE_SIZE,
773 if (pgd_none_or_clear_bad(pgd)) 821 __phys_to_pfn(hyp_idmap_start),
774 continue; 822 PAGE_HYP);
775 pud = pud_offset(pgd, addr); 823 if (err) {
776 pmd = pmd_offset(pud, addr); 824 kvm_err("Failed to map trampoline @%lx into runtime HYP pgd\n",
825 TRAMPOLINE_VA);
826 goto out;
827 }
777 828
778 pud_clear(pud); 829 return 0;
779 clean_pmd_entry(pmd); 830out:
780 pmd_free(NULL, (pmd_t *)((unsigned long)pmd & PAGE_MASK)); 831 free_hyp_pgds();
781 } while (pgd++, addr = next, addr < end); 832 return err;
782} 833}
diff --git a/arch/arm/kvm/perf.c b/arch/arm/kvm/perf.c
new file mode 100644
index 000000000000..1a3849da0b4b
--- /dev/null
+++ b/arch/arm/kvm/perf.c
@@ -0,0 +1,68 @@
1/*
2 * Based on the x86 implementation.
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Marc Zyngier <marc.zyngier@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/perf_event.h>
21#include <linux/kvm_host.h>
22
23#include <asm/kvm_emulate.h>
24
25static int kvm_is_in_guest(void)
26{
27 return kvm_arm_get_running_vcpu() != NULL;
28}
29
30static int kvm_is_user_mode(void)
31{
32 struct kvm_vcpu *vcpu;
33
34 vcpu = kvm_arm_get_running_vcpu();
35
36 if (vcpu)
37 return !vcpu_mode_priv(vcpu);
38
39 return 0;
40}
41
42static unsigned long kvm_get_guest_ip(void)
43{
44 struct kvm_vcpu *vcpu;
45
46 vcpu = kvm_arm_get_running_vcpu();
47
48 if (vcpu)
49 return *vcpu_pc(vcpu);
50
51 return 0;
52}
53
54static struct perf_guest_info_callbacks kvm_guest_cbs = {
55 .is_in_guest = kvm_is_in_guest,
56 .is_user_mode = kvm_is_user_mode,
57 .get_guest_ip = kvm_get_guest_ip,
58};
59
60int kvm_perf_init(void)
61{
62 return perf_register_guest_info_callbacks(&kvm_guest_cbs);
63}
64
65int kvm_perf_teardown(void)
66{
67 return perf_unregister_guest_info_callbacks(&kvm_guest_cbs);
68}
diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
index 0e4cfe123b38..17c5ac7d10ed 100644
--- a/arch/arm/kvm/vgic.c
+++ b/arch/arm/kvm/vgic.c
@@ -1477,7 +1477,7 @@ int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr)
1477 if (addr & ~KVM_PHYS_MASK) 1477 if (addr & ~KVM_PHYS_MASK)
1478 return -E2BIG; 1478 return -E2BIG;
1479 1479
1480 if (addr & ~PAGE_MASK) 1480 if (addr & (SZ_4K - 1))
1481 return -EINVAL; 1481 return -EINVAL;
1482 1482
1483 mutex_lock(&kvm->lock); 1483 mutex_lock(&kvm->lock);
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 6071f4c3d654..02802386b894 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -1,14 +1,15 @@
1if ARCH_AT91 1if ARCH_AT91
2 2
3config HAVE_AT91_DATAFLASH_CARD
4 bool
5
6config HAVE_AT91_DBGU0 3config HAVE_AT91_DBGU0
7 bool 4 bool
8 5
9config HAVE_AT91_DBGU1 6config HAVE_AT91_DBGU1
10 bool 7 bool
11 8
9config AT91_PMC_UNIT
10 bool
11 default !ARCH_AT91X40
12
12config AT91_SAM9_ALT_RESET 13config AT91_SAM9_ALT_RESET
13 bool 14 bool
14 default !ARCH_AT91X40 15 default !ARCH_AT91X40
@@ -17,17 +18,59 @@ config AT91_SAM9G45_RESET
17 bool 18 bool
18 default !ARCH_AT91X40 19 default !ARCH_AT91X40
19 20
21config AT91_SAM9_TIME
22 bool
23
20config SOC_AT91SAM9 24config SOC_AT91SAM9
21 bool 25 bool
26 select AT91_SAM9_TIME
22 select CPU_ARM926T 27 select CPU_ARM926T
23 select GENERIC_CLOCKEVENTS 28 select GENERIC_CLOCKEVENTS
24 select MULTI_IRQ_HANDLER 29 select MULTI_IRQ_HANDLER
25 select SPARSE_IRQ 30 select SPARSE_IRQ
26 31
32config SOC_SAMA5
33 bool
34 select AT91_SAM9_TIME
35 select CPU_V7
36 select GENERIC_CLOCKEVENTS
37 select MULTI_IRQ_HANDLER
38 select SPARSE_IRQ
39
27menu "Atmel AT91 System-on-Chip" 40menu "Atmel AT91 System-on-Chip"
28 41
42choice
43
44 prompt "Core type"
45
46config SOC_SAM_V4_V5
47 bool "ARM7/ARM9"
48 help
49 Select this if you are using one of Atmel's AT91SAM9, AT91RM9200
50 or AT91X40 SoC.
51
52config SOC_SAM_V7
53 bool "Cortex A5"
54 help
55 Select this if you are using one of Atmel's SAMA5D3 SoC.
56
57endchoice
58
29comment "Atmel AT91 Processor" 59comment "Atmel AT91 Processor"
30 60
61if SOC_SAM_V7
62config SOC_SAMA5D3
63 bool "SAMA5D3 family"
64 depends on SOC_SAM_V7
65 select SOC_SAMA5
66 select HAVE_FB_ATMEL
67 select HAVE_AT91_DBGU1
68 help
69 Select this if you are using one of Atmel's SAMA5D3 family SoC.
70 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35.
71endif
72
73if SOC_SAM_V4_V5
31config SOC_AT91RM9200 74config SOC_AT91RM9200
32 bool "AT91RM9200" 75 bool "AT91RM9200"
33 select CPU_ARM920T 76 select CPU_ARM920T
@@ -93,394 +136,10 @@ config SOC_AT91SAM9N12
93 help 136 help
94 Select this if you are using Atmel's AT91SAM9N12 SoC. 137 Select this if you are using Atmel's AT91SAM9N12 SoC.
95 138
96choice
97 prompt "Atmel AT91 Processor Devices for non DT boards"
98
99config ARCH_AT91_NONE
100 bool "None"
101
102config ARCH_AT91RM9200
103 bool "AT91RM9200"
104 select SOC_AT91RM9200
105
106config ARCH_AT91SAM9260
107 bool "AT91SAM9260 or AT91SAM9XE"
108 select SOC_AT91SAM9260
109
110config ARCH_AT91SAM9261
111 bool "AT91SAM9261"
112 select SOC_AT91SAM9261
113
114config ARCH_AT91SAM9G10
115 bool "AT91SAM9G10"
116 select SOC_AT91SAM9261
117
118config ARCH_AT91SAM9263
119 bool "AT91SAM9263"
120 select SOC_AT91SAM9263
121
122config ARCH_AT91SAM9RL
123 bool "AT91SAM9RL"
124 select SOC_AT91SAM9RL
125
126config ARCH_AT91SAM9G20
127 bool "AT91SAM9G20"
128 select SOC_AT91SAM9260
129
130config ARCH_AT91SAM9G45
131 bool "AT91SAM9G45"
132 select SOC_AT91SAM9G45
133
134config ARCH_AT91X40
135 bool "AT91x40"
136 depends on !MMU
137 select ARCH_USES_GETTIMEOFFSET
138 select MULTI_IRQ_HANDLER
139 select SPARSE_IRQ
140
141endchoice
142
143config AT91_PMC_UNIT
144 bool
145 default !ARCH_AT91X40
146
147# ----------------------------------------------------------
148
149if ARCH_AT91RM9200
150
151comment "AT91RM9200 Board Type"
152
153config MACH_ONEARM
154 bool "Ajeco 1ARM Single Board Computer"
155 help
156 Select this if you are using Ajeco's 1ARM Single Board Computer.
157 <http://www.ajeco.fi/>
158
159config ARCH_AT91RM9200DK
160 bool "Atmel AT91RM9200-DK Development board"
161 select HAVE_AT91_DATAFLASH_CARD
162 help
163 Select this if you are using Atmel's AT91RM9200-DK Development board.
164 (Discontinued)
165
166config MACH_AT91RM9200EK
167 bool "Atmel AT91RM9200-EK Evaluation Kit"
168 select HAVE_AT91_DATAFLASH_CARD
169 help
170 Select this if you are using Atmel's AT91RM9200-EK Evaluation Kit.
171 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507>
172
173config MACH_CSB337
174 bool "Cogent CSB337"
175 help
176 Select this if you are using Cogent's CSB337 board.
177 <http://www.cogcomp.com/csb_csb337.htm>
178
179config MACH_CSB637
180 bool "Cogent CSB637"
181 help
182 Select this if you are using Cogent's CSB637 board.
183 <http://www.cogcomp.com/csb_csb637.htm>
184
185config MACH_CARMEVA
186 bool "Conitec ARM&EVA"
187 help
188 Select this if you are using Conitec's AT91RM9200-MCU-Module.
189 <http://www.conitec.net/english/linuxboard.php>
190
191config MACH_ATEB9200
192 bool "Embest ATEB9200"
193 help
194 Select this if you are using Embest's ATEB9200 board.
195 <http://www.embedinfo.com/english/product/ATEB9200.asp>
196
197config MACH_KB9200
198 bool "KwikByte KB920x"
199 help
200 Select this if you are using KwikByte's KB920x board.
201 <http://www.kwikbyte.com/KB9202.html>
202
203config MACH_PICOTUX2XX
204 bool "picotux 200"
205 help
206 Select this if you are using a picotux 200.
207 <http://www.picotux.com/>
208
209config MACH_KAFA
210 bool "Sperry-Sun KAFA board"
211 help
212 Select this if you are using Sperry-Sun's KAFA board.
213
214config MACH_ECBAT91
215 bool "emQbit ECB_AT91 SBC"
216 select HAVE_AT91_DATAFLASH_CARD
217 help
218 Select this if you are using emQbit's ECB_AT91 board.
219 <http://wiki.emqbit.com/free-ecb-at91>
220
221config MACH_YL9200
222 bool "ucDragon YL-9200"
223 help
224 Select this if you are using the ucDragon YL-9200 board.
225
226config MACH_CPUAT91
227 bool "Eukrea CPUAT91"
228 help
229 Select this if you are using the Eukrea Electromatique's
230 CPUAT91 board <http://www.eukrea.com/>.
231
232config MACH_ECO920
233 bool "eco920"
234 help
235 Select this if you are using the eco920 board
236
237config MACH_RSI_EWS
238 bool "RSI Embedded Webserver"
239 depends on ARCH_AT91RM9200
240 help
241 Select this if you are using RSIs EWS board.
242endif
243
244# ----------------------------------------------------------
245
246if ARCH_AT91SAM9260
247
248comment "AT91SAM9260 Variants"
249
250comment "AT91SAM9260 / AT91SAM9XE Board Type"
251
252config MACH_AT91SAM9260EK
253 bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit"
254 select HAVE_AT91_DATAFLASH_CARD
255 help
256 Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
257 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
258
259config MACH_CAM60
260 bool "KwikByte KB9260 (CAM60) board"
261 help
262 Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260.
263 <http://www.kwikbyte.com/KB9260.html>
264
265config MACH_SAM9_L9260
266 bool "Olimex SAM9-L9260 board"
267 select HAVE_AT91_DATAFLASH_CARD
268 help
269 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
270 <http://www.olimex.com/dev/sam9-L9260.html>
271
272config MACH_AFEB9260
273 bool "Custom afeb9260 board v1"
274 help
275 Select this if you are using custom afeb9260 board based on
276 open hardware design. Select this for revision 1 of the board.
277 <svn://194.85.238.22/home/users/george/svn/arm9eb>
278 <http://groups.google.com/group/arm9fpga-evolution-board>
279
280config MACH_USB_A9260
281 bool "CALAO USB-A9260"
282 help
283 Select this if you are using a Calao Systems USB-A9260.
284 <http://www.calao-systems.com>
285
286config MACH_QIL_A9260
287 bool "CALAO QIL-A9260 board"
288 help
289 Select this if you are using a Calao Systems QIL-A9260 Board.
290 <http://www.calao-systems.com>
291
292config MACH_CPU9260
293 bool "Eukrea CPU9260 board"
294 help
295 Select this if you are using a Eukrea Electromatique's
296 CPU9260 Board <http://www.eukrea.com/>
297
298config MACH_FLEXIBITY
299 bool "Flexibity Connect board"
300 help
301 Select this if you are using Flexibity Connect board
302 <http://www.flexibity.com>
303
304endif
305
306# ----------------------------------------------------------
307
308if ARCH_AT91SAM9261
309
310comment "AT91SAM9261 Board Type"
311
312config MACH_AT91SAM9261EK
313 bool "Atmel AT91SAM9261-EK Evaluation Kit"
314 select HAVE_AT91_DATAFLASH_CARD
315 help
316 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
317 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
318
319endif
320
321# ----------------------------------------------------------
322
323if ARCH_AT91SAM9G10
324
325comment "AT91SAM9G10 Board Type"
326
327config MACH_AT91SAM9G10EK
328 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
329 select HAVE_AT91_DATAFLASH_CARD
330 help
331 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
332 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
333
334endif
335
336# ----------------------------------------------------------
337
338if ARCH_AT91SAM9263
339
340comment "AT91SAM9263 Board Type"
341
342config MACH_AT91SAM9263EK
343 bool "Atmel AT91SAM9263-EK Evaluation Kit"
344 select HAVE_AT91_DATAFLASH_CARD
345 help
346 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
347 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
348
349config MACH_USB_A9263
350 bool "CALAO USB-A9263"
351 help
352 Select this if you are using a Calao Systems USB-A9263.
353 <http://www.calao-systems.com>
354
355endif
356
357# ----------------------------------------------------------
358
359if ARCH_AT91SAM9RL
360
361comment "AT91SAM9RL Board Type"
362
363config MACH_AT91SAM9RLEK
364 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
365 help
366 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
367
368endif
369
370# ---------------------------------------------------------- 139# ----------------------------------------------------------
371 140
372if ARCH_AT91SAM9G20 141source arch/arm/mach-at91/Kconfig.non_dt
373 142endif # SOC_SAM_V4_V5
374comment "AT91SAM9G20 Board Type"
375
376config MACH_AT91SAM9G20EK
377 bool "Atmel AT91SAM9G20-EK Evaluation Kit"
378 select HAVE_AT91_DATAFLASH_CARD
379 help
380 Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit
381 that embeds only one SD/MMC slot.
382
383config MACH_AT91SAM9G20EK_2MMC
384 depends on MACH_AT91SAM9G20EK
385 bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots"
386 help
387 Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
388 with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and
389 onwards.
390 <http://www.atmel.com/tools/SAM9G20-EK.aspx>
391
392config MACH_CPU9G20
393 bool "Eukrea CPU9G20 board"
394 help
395 Select this if you are using a Eukrea Electromatique's
396 CPU9G20 Board <http://www.eukrea.com/>
397
398config MACH_ACMENETUSFOXG20
399 bool "Acme Systems srl FOX Board G20"
400 help
401 Select this if you are using Acme Systems
402 FOX Board G20 <http://www.acmesystems.it>
403
404config MACH_PORTUXG20
405 bool "taskit PortuxG20"
406 help
407 Select this if you are using taskit's PortuxG20.
408 <http://www.taskit.de/en/>
409
410config MACH_STAMP9G20
411 bool "taskit Stamp9G20 CPU module"
412 help
413 Select this if you are using taskit's Stamp9G20 CPU module on its
414 evaluation board.
415 <http://www.taskit.de/en/>
416
417config MACH_PCONTROL_G20
418 bool "PControl G20 CPU module"
419 help
420 Select this if you are using taskit's Stamp9G20 CPU module on this
421 carrier board, beeing the decentralized unit of a building automation
422 system; featuring nvram, eth-switch, iso-rs485, display, io
423
424config MACH_GSIA18S
425 bool "GS_IA18_S board"
426 help
427 This enables support for the GS_IA18_S board
428 produced by GeoSIG Ltd company. This is an internet accelerograph.
429 <http://www.geosig.com>
430
431config MACH_USB_A9G20
432 bool "CALAO USB-A9G20"
433 depends on ARCH_AT91SAM9G20
434 help
435 Select this if you are using a Calao Systems USB-A9G20.
436 <http://www.calao-systems.com>
437
438endif
439
440if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
441comment "AT91SAM9260/AT91SAM9G20 boards"
442
443config MACH_SNAPPER_9260
444 bool "Bluewater Systems Snapper 9260/9G20 module"
445 help
446 Select this if you are using the Bluewater Systems Snapper 9260 or
447 Snapper 9G20 modules.
448 <http://www.bluewatersys.com/>
449endif
450
451# ----------------------------------------------------------
452
453if ARCH_AT91SAM9G45
454
455comment "AT91SAM9G45 Board Type"
456
457config MACH_AT91SAM9M10G45EK
458 bool "Atmel AT91SAM9M10G45-EK Evaluation Kits"
459 help
460 Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit.
461 Those boards can be populated with any SoC of AT91SAM9G45 or AT91SAM9M10
462 families: AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
463 <http://www.atmel.com/tools/SAM9M10-G45-EK.aspx>
464
465endif
466
467# ----------------------------------------------------------
468
469if ARCH_AT91X40
470
471comment "AT91X40 Board Type"
472
473config MACH_AT91EB01
474 bool "Atmel AT91EB01 Evaluation Kit"
475 help
476 Select this if you are using Atmel's AT91EB01 Evaluation Kit.
477 It is also a popular target for simulators such as GDB's
478 ARM simulator (commonly known as the ARMulator) and the
479 Skyeye simulator.
480
481endif
482
483# ----------------------------------------------------------
484 143
485comment "Generic Board Type" 144comment "Generic Board Type"
486 145
@@ -492,7 +151,7 @@ config MACH_AT91RM9200_DT
492 Select this if you want to experiment device-tree with 151 Select this if you want to experiment device-tree with
493 an Atmel RM9200 Evaluation Kit. 152 an Atmel RM9200 Evaluation Kit.
494 153
495config MACH_AT91SAM_DT 154config MACH_AT91SAM9_DT
496 bool "Atmel AT91SAM Evaluation Kits with device-tree support" 155 bool "Atmel AT91SAM Evaluation Kits with device-tree support"
497 depends on SOC_AT91SAM9 156 depends on SOC_AT91SAM9
498 select USE_OF 157 select USE_OF
@@ -500,15 +159,13 @@ config MACH_AT91SAM_DT
500 Select this if you want to experiment device-tree with 159 Select this if you want to experiment device-tree with
501 an Atmel Evaluation Kit. 160 an Atmel Evaluation Kit.
502 161
503# ---------------------------------------------------------- 162config MACH_SAMA5_DT
504 163 bool "Atmel SAMA5 Evaluation Kits with device-tree support"
505comment "AT91 Board Options" 164 depends on SOC_SAMA5
506 165 select USE_OF
507config MTD_AT91_DATAFLASH_CARD
508 bool "Enable DataFlash Card support"
509 depends on HAVE_AT91_DATAFLASH_CARD
510 help 166 help
511 Enable support for the DataFlash card. 167 Select this if you want to experiment device-tree with
168 an Atmel Evaluation Kit.
512 169
513# ---------------------------------------------------------- 170# ----------------------------------------------------------
514 171
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
new file mode 100644
index 000000000000..6c24985515a2
--- /dev/null
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -0,0 +1,399 @@
1menu "Atmel Non-DT world"
2
3config HAVE_AT91_DATAFLASH_CARD
4 bool
5
6choice
7 prompt "Atmel AT91 Processor Devices for non DT boards"
8
9config ARCH_AT91_NONE
10 bool "None"
11
12config ARCH_AT91RM9200
13 bool "AT91RM9200"
14 select SOC_AT91RM9200
15
16config ARCH_AT91SAM9260
17 bool "AT91SAM9260 or AT91SAM9XE"
18 select SOC_AT91SAM9260
19
20config ARCH_AT91SAM9261
21 bool "AT91SAM9261"
22 select SOC_AT91SAM9261
23
24config ARCH_AT91SAM9G10
25 bool "AT91SAM9G10"
26 select SOC_AT91SAM9261
27
28config ARCH_AT91SAM9263
29 bool "AT91SAM9263"
30 select SOC_AT91SAM9263
31
32config ARCH_AT91SAM9RL
33 bool "AT91SAM9RL"
34 select SOC_AT91SAM9RL
35
36config ARCH_AT91SAM9G20
37 bool "AT91SAM9G20"
38 select SOC_AT91SAM9260
39
40config ARCH_AT91SAM9G45
41 bool "AT91SAM9G45"
42 select SOC_AT91SAM9G45
43
44config ARCH_AT91X40
45 bool "AT91x40"
46 depends on !MMU
47 select ARCH_USES_GETTIMEOFFSET
48 select MULTI_IRQ_HANDLER
49 select SPARSE_IRQ
50
51endchoice
52
53# ----------------------------------------------------------
54
55if ARCH_AT91RM9200
56
57comment "AT91RM9200 Board Type"
58
59config MACH_ONEARM
60 bool "Ajeco 1ARM Single Board Computer"
61 help
62 Select this if you are using Ajeco's 1ARM Single Board Computer.
63 <http://www.ajeco.fi/>
64
65config ARCH_AT91RM9200DK
66 bool "Atmel AT91RM9200-DK Development board"
67 select HAVE_AT91_DATAFLASH_CARD
68 help
69 Select this if you are using Atmel's AT91RM9200-DK Development board.
70 (Discontinued)
71
72config MACH_AT91RM9200EK
73 bool "Atmel AT91RM9200-EK Evaluation Kit"
74 select HAVE_AT91_DATAFLASH_CARD
75 help
76 Select this if you are using Atmel's AT91RM9200-EK Evaluation Kit.
77 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507>
78
79config MACH_CSB337
80 bool "Cogent CSB337"
81 help
82 Select this if you are using Cogent's CSB337 board.
83 <http://www.cogcomp.com/csb_csb337.htm>
84
85config MACH_CSB637
86 bool "Cogent CSB637"
87 help
88 Select this if you are using Cogent's CSB637 board.
89 <http://www.cogcomp.com/csb_csb637.htm>
90
91config MACH_CARMEVA
92 bool "Conitec ARM&EVA"
93 help
94 Select this if you are using Conitec's AT91RM9200-MCU-Module.
95 <http://www.conitec.net/english/linuxboard.php>
96
97config MACH_ATEB9200
98 bool "Embest ATEB9200"
99 help
100 Select this if you are using Embest's ATEB9200 board.
101 <http://www.embedinfo.com/english/product/ATEB9200.asp>
102
103config MACH_KB9200
104 bool "KwikByte KB920x"
105 help
106 Select this if you are using KwikByte's KB920x board.
107 <http://www.kwikbyte.com/KB9202.html>
108
109config MACH_PICOTUX2XX
110 bool "picotux 200"
111 help
112 Select this if you are using a picotux 200.
113 <http://www.picotux.com/>
114
115config MACH_KAFA
116 bool "Sperry-Sun KAFA board"
117 help
118 Select this if you are using Sperry-Sun's KAFA board.
119
120config MACH_ECBAT91
121 bool "emQbit ECB_AT91 SBC"
122 select HAVE_AT91_DATAFLASH_CARD
123 help
124 Select this if you are using emQbit's ECB_AT91 board.
125 <http://wiki.emqbit.com/free-ecb-at91>
126
127config MACH_YL9200
128 bool "ucDragon YL-9200"
129 help
130 Select this if you are using the ucDragon YL-9200 board.
131
132config MACH_CPUAT91
133 bool "Eukrea CPUAT91"
134 help
135 Select this if you are using the Eukrea Electromatique's
136 CPUAT91 board <http://www.eukrea.com/>.
137
138config MACH_ECO920
139 bool "eco920"
140 help
141 Select this if you are using the eco920 board
142
143config MACH_RSI_EWS
144 bool "RSI Embedded Webserver"
145 depends on ARCH_AT91RM9200
146 help
147 Select this if you are using RSIs EWS board.
148endif
149
150# ----------------------------------------------------------
151
152if ARCH_AT91SAM9260
153
154comment "AT91SAM9260 Variants"
155
156comment "AT91SAM9260 / AT91SAM9XE Board Type"
157
158config MACH_AT91SAM9260EK
159 bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit"
160 select HAVE_AT91_DATAFLASH_CARD
161 help
162 Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
163 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
164
165config MACH_CAM60
166 bool "KwikByte KB9260 (CAM60) board"
167 help
168 Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260.
169 <http://www.kwikbyte.com/KB9260.html>
170
171config MACH_SAM9_L9260
172 bool "Olimex SAM9-L9260 board"
173 select HAVE_AT91_DATAFLASH_CARD
174 help
175 Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
176 <http://www.olimex.com/dev/sam9-L9260.html>
177
178config MACH_AFEB9260
179 bool "Custom afeb9260 board v1"
180 help
181 Select this if you are using custom afeb9260 board based on
182 open hardware design. Select this for revision 1 of the board.
183 <svn://194.85.238.22/home/users/george/svn/arm9eb>
184 <http://groups.google.com/group/arm9fpga-evolution-board>
185
186config MACH_USB_A9260
187 bool "CALAO USB-A9260"
188 help
189 Select this if you are using a Calao Systems USB-A9260.
190 <http://www.calao-systems.com>
191
192config MACH_QIL_A9260
193 bool "CALAO QIL-A9260 board"
194 help
195 Select this if you are using a Calao Systems QIL-A9260 Board.
196 <http://www.calao-systems.com>
197
198config MACH_CPU9260
199 bool "Eukrea CPU9260 board"
200 help
201 Select this if you are using a Eukrea Electromatique's
202 CPU9260 Board <http://www.eukrea.com/>
203
204config MACH_FLEXIBITY
205 bool "Flexibity Connect board"
206 help
207 Select this if you are using Flexibity Connect board
208 <http://www.flexibity.com>
209
210endif
211
212# ----------------------------------------------------------
213
214if ARCH_AT91SAM9261
215
216comment "AT91SAM9261 Board Type"
217
218config MACH_AT91SAM9261EK
219 bool "Atmel AT91SAM9261-EK Evaluation Kit"
220 select HAVE_AT91_DATAFLASH_CARD
221 help
222 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
223 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
224
225endif
226
227# ----------------------------------------------------------
228
229if ARCH_AT91SAM9G10
230
231comment "AT91SAM9G10 Board Type"
232
233config MACH_AT91SAM9G10EK
234 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
235 select HAVE_AT91_DATAFLASH_CARD
236 help
237 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
238 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
239
240endif
241
242# ----------------------------------------------------------
243
244if ARCH_AT91SAM9263
245
246comment "AT91SAM9263 Board Type"
247
248config MACH_AT91SAM9263EK
249 bool "Atmel AT91SAM9263-EK Evaluation Kit"
250 select HAVE_AT91_DATAFLASH_CARD
251 help
252 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
253 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
254
255config MACH_USB_A9263
256 bool "CALAO USB-A9263"
257 help
258 Select this if you are using a Calao Systems USB-A9263.
259 <http://www.calao-systems.com>
260
261endif
262
263# ----------------------------------------------------------
264
265if ARCH_AT91SAM9RL
266
267comment "AT91SAM9RL Board Type"
268
269config MACH_AT91SAM9RLEK
270 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
271 help
272 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
273
274endif
275
276# ----------------------------------------------------------
277
278if ARCH_AT91SAM9G20
279
280comment "AT91SAM9G20 Board Type"
281
282config MACH_AT91SAM9G20EK
283 bool "Atmel AT91SAM9G20-EK Evaluation Kit"
284 select HAVE_AT91_DATAFLASH_CARD
285 help
286 Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit
287 that embeds only one SD/MMC slot.
288
289config MACH_AT91SAM9G20EK_2MMC
290 depends on MACH_AT91SAM9G20EK
291 bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots"
292 help
293 Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
294 with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and
295 onwards.
296 <http://www.atmel.com/tools/SAM9G20-EK.aspx>
297
298config MACH_CPU9G20
299 bool "Eukrea CPU9G20 board"
300 help
301 Select this if you are using a Eukrea Electromatique's
302 CPU9G20 Board <http://www.eukrea.com/>
303
304config MACH_ACMENETUSFOXG20
305 bool "Acme Systems srl FOX Board G20"
306 help
307 Select this if you are using Acme Systems
308 FOX Board G20 <http://www.acmesystems.it>
309
310config MACH_PORTUXG20
311 bool "taskit PortuxG20"
312 help
313 Select this if you are using taskit's PortuxG20.
314 <http://www.taskit.de/en/>
315
316config MACH_STAMP9G20
317 bool "taskit Stamp9G20 CPU module"
318 help
319 Select this if you are using taskit's Stamp9G20 CPU module on its
320 evaluation board.
321 <http://www.taskit.de/en/>
322
323config MACH_PCONTROL_G20
324 bool "PControl G20 CPU module"
325 help
326 Select this if you are using taskit's Stamp9G20 CPU module on this
327 carrier board, beeing the decentralized unit of a building automation
328 system; featuring nvram, eth-switch, iso-rs485, display, io
329
330config MACH_GSIA18S
331 bool "GS_IA18_S board"
332 help
333 This enables support for the GS_IA18_S board
334 produced by GeoSIG Ltd company. This is an internet accelerograph.
335 <http://www.geosig.com>
336
337config MACH_USB_A9G20
338 bool "CALAO USB-A9G20"
339 depends on ARCH_AT91SAM9G20
340 help
341 Select this if you are using a Calao Systems USB-A9G20.
342 <http://www.calao-systems.com>
343
344endif
345
346if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
347comment "AT91SAM9260/AT91SAM9G20 boards"
348
349config MACH_SNAPPER_9260
350 bool "Bluewater Systems Snapper 9260/9G20 module"
351 help
352 Select this if you are using the Bluewater Systems Snapper 9260 or
353 Snapper 9G20 modules.
354 <http://www.bluewatersys.com/>
355endif
356
357# ----------------------------------------------------------
358
359if ARCH_AT91SAM9G45
360
361comment "AT91SAM9G45 Board Type"
362
363config MACH_AT91SAM9M10G45EK
364 bool "Atmel AT91SAM9M10G45-EK Evaluation Kits"
365 help
366 Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit.
367 Those boards can be populated with any SoC of AT91SAM9G45 or AT91SAM9M10
368 families: AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
369 <http://www.atmel.com/tools/SAM9M10-G45-EK.aspx>
370
371endif
372
373# ----------------------------------------------------------
374
375if ARCH_AT91X40
376
377comment "AT91X40 Board Type"
378
379config MACH_AT91EB01
380 bool "Atmel AT91EB01 Evaluation Kit"
381 help
382 Select this if you are using Atmel's AT91EB01 Evaluation Kit.
383 It is also a popular target for simulators such as GDB's
384 ARM simulator (commonly known as the ARMulator) and the
385 Skyeye simulator.
386
387endif
388
389# ----------------------------------------------------------
390
391comment "AT91 Board Options"
392
393config MTD_AT91_DATAFLASH_CARD
394 bool "Enable DataFlash Card support"
395 depends on HAVE_AT91_DATAFLASH_CARD
396 help
397 Enable support for the DataFlash card.
398
399endmenu
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 39218ca6d8e8..788562dccb43 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -10,7 +10,8 @@ obj- :=
10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o 10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o
11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o 11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o 12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
13obj-$(CONFIG_SOC_AT91SAM9) += at91sam926x_time.o sam9_smc.o 13obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o
14obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o
14 15
15# CPU-specific support 16# CPU-specific support
16obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o 17obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o
@@ -21,6 +22,7 @@ obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o
21obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o 22obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o
22obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o 23obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o
23obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o 24obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o
25obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
24 26
25obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o 27obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
26obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o 28obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
@@ -87,8 +89,11 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
87obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o 89obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
88 90
89# AT91SAM board with device-tree 91# AT91SAM board with device-tree
90obj-$(CONFIG_MACH_AT91RM9200_DT) += board-rm9200-dt.o 92obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o
91obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o 93obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o
94
95# SAMA5 board with device-tree
96obj-$(CONFIG_MACH_SAMA5_DT) += board-dt-sama5.o
92 97
93# AT91X40 board-specific support 98# AT91X40 board-specific support
94obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o 99obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
diff --git a/arch/arm/mach-at91/at91_rstc.h b/arch/arm/mach-at91/at91_rstc.h
index 875fa336800b..a600e6992920 100644
--- a/arch/arm/mach-at91/at91_rstc.h
+++ b/arch/arm/mach-at91/at91_rstc.h
@@ -23,7 +23,7 @@ extern void __iomem *at91_rstc_base;
23 __raw_readl(at91_rstc_base + field) 23 __raw_readl(at91_rstc_base + field)
24 24
25#define at91_rstc_write(field, value) \ 25#define at91_rstc_write(field, value) \
26 __raw_writel(value, at91_rstc_base + field); 26 __raw_writel(value, at91_rstc_base + field)
27#else 27#else
28.extern at91_rstc_base 28.extern at91_rstc_base
29#endif 29#endif
diff --git a/arch/arm/mach-at91/at91_shdwc.h b/arch/arm/mach-at91/at91_shdwc.h
index 60478ea8bd46..9e29f31ec9a6 100644
--- a/arch/arm/mach-at91/at91_shdwc.h
+++ b/arch/arm/mach-at91/at91_shdwc.h
@@ -23,7 +23,7 @@ extern void __iomem *at91_shdwc_base;
23 __raw_readl(at91_shdwc_base + field) 23 __raw_readl(at91_shdwc_base + field)
24 24
25#define at91_shdwc_write(field, value) \ 25#define at91_shdwc_write(field, value) \
26 __raw_writel(value, at91_shdwc_base + field); 26 __raw_writel(value, at91_shdwc_base + field)
27#endif 27#endif
28 28
29#define AT91_SHDW_CR 0x00 /* Shut Down Control Register */ 29#define AT91_SHDW_CR 0x00 /* Shut Down Control Register */
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 9706c000f294..d193a409bc45 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -212,6 +212,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
212 CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk), 212 CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk),
213 CLKDEV_CON_DEV_ID("mci_clk", "fffb4000.mmc", &mmc_clk), 213 CLKDEV_CON_DEV_ID("mci_clk", "fffb4000.mmc", &mmc_clk),
214 CLKDEV_CON_DEV_ID("emac_clk", "fffbc000.ethernet", &ether_clk), 214 CLKDEV_CON_DEV_ID("emac_clk", "fffbc000.ethernet", &ether_clk),
215 CLKDEV_CON_DEV_ID(NULL, "fffb8000.i2c", &twi_clk),
215 CLKDEV_CON_DEV_ID("hclk", "300000.ohci", &ohci_clk), 216 CLKDEV_CON_DEV_ID("hclk", "300000.ohci", &ohci_clk),
216 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk), 217 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
217 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk), 218 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
@@ -384,7 +385,7 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
384 0 /* Advanced Interrupt Controller (IRQ6) */ 385 0 /* Advanced Interrupt Controller (IRQ6) */
385}; 386};
386 387
387AT91_SOC_START(rm9200) 388AT91_SOC_START(at91rm9200)
388 .map_io = at91rm9200_map_io, 389 .map_io = at91rm9200_map_io,
389 .default_irq_priority = at91rm9200_default_irq_priority, 390 .default_irq_priority = at91rm9200_default_irq_priority,
390 .ioremap_registers = at91rm9200_ioremap_registers, 391 .ioremap_registers = at91rm9200_ioremap_registers,
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index b67cd5374117..a8ce24538da6 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -232,6 +232,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
232 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk), 232 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
233 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk), 233 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
234 CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk), 234 CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk),
235 CLKDEV_CON_DEV_ID("spi_clk", "fffc8000.spi", &spi0_clk),
236 CLKDEV_CON_DEV_ID("spi_clk", "fffcc000.spi", &spi1_clk),
235 /* fake hclk clock */ 237 /* fake hclk clock */
236 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 238 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
237 CLKDEV_CON_ID("pioA", &pioA_clk), 239 CLKDEV_CON_ID("pioA", &pioA_clk),
@@ -395,7 +397,7 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
395 0, /* Advanced Interrupt Controller */ 397 0, /* Advanced Interrupt Controller */
396}; 398};
397 399
398AT91_SOC_START(sam9260) 400AT91_SOC_START(at91sam9260)
399 .map_io = at91sam9260_map_io, 401 .map_io = at91sam9260_map_io,
400 .default_irq_priority = at91sam9260_default_irq_priority, 402 .default_irq_priority = at91sam9260_default_irq_priority,
401 .ioremap_registers = at91sam9260_ioremap_registers, 403 .ioremap_registers = at91sam9260_ioremap_registers,
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 2998a08afc2d..25efb5ac30f1 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -169,6 +169,8 @@ static struct clk *periph_clocks[] __initdata = {
169}; 169};
170 170
171static struct clk_lookup periph_clocks_lookups[] = { 171static struct clk_lookup periph_clocks_lookups[] = {
172 CLKDEV_CON_DEV_ID("hclk", "at91sam9261-lcdfb.0", &hck1),
173 CLKDEV_CON_DEV_ID("hclk", "at91sam9g10-lcdfb.0", &hck1),
172 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 174 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
173 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 175 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
174 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), 176 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
@@ -337,7 +339,7 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
337 0, /* Advanced Interrupt Controller */ 339 0, /* Advanced Interrupt Controller */
338}; 340};
339 341
340AT91_SOC_START(sam9261) 342AT91_SOC_START(at91sam9261)
341 .map_io = at91sam9261_map_io, 343 .map_io = at91sam9261_map_io,
342 .default_irq_priority = at91sam9261_default_irq_priority, 344 .default_irq_priority = at91sam9261_default_irq_priority,
343 .ioremap_registers = at91sam9261_ioremap_registers, 345 .ioremap_registers = at91sam9261_ioremap_registers,
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 92e0f861084a..629ea5fc95cf 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -488,7 +488,6 @@ static struct resource lcdc_resources[] = {
488}; 488};
489 489
490static struct platform_device at91_lcdc_device = { 490static struct platform_device at91_lcdc_device = {
491 .name = "atmel_lcdfb",
492 .id = 0, 491 .id = 0,
493 .dev = { 492 .dev = {
494 .dma_mask = &lcdc_dmamask, 493 .dma_mask = &lcdc_dmamask,
@@ -505,6 +504,11 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
505 return; 504 return;
506 } 505 }
507 506
507 if (cpu_is_at91sam9g10())
508 at91_lcdc_device.name = "at91sam9g10-lcdfb";
509 else
510 at91_lcdc_device.name = "at91sam9261-lcdfb";
511
508#if defined(CONFIG_FB_ATMEL_STN) 512#if defined(CONFIG_FB_ATMEL_STN)
509 at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */ 513 at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */
510 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ 514 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index b9fc60d1b33a..f44ffd2105a7 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -190,6 +190,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
190 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), 190 CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk),
191 CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), 191 CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk),
192 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), 192 CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk),
193 CLKDEV_CON_DEV_ID("hclk", "at91sam9263-lcdfb.0", &lcdc_clk),
193 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), 194 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
194 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), 195 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
195 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 196 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
@@ -374,7 +375,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
374 0, /* Advanced Interrupt Controller (IRQ1) */ 375 0, /* Advanced Interrupt Controller (IRQ1) */
375}; 376};
376 377
377AT91_SOC_START(sam9263) 378AT91_SOC_START(at91sam9263)
378 .map_io = at91sam9263_map_io, 379 .map_io = at91sam9263_map_io,
379 .default_irq_priority = at91sam9263_default_irq_priority, 380 .default_irq_priority = at91sam9263_default_irq_priority,
380 .ioremap_registers = at91sam9263_ioremap_registers, 381 .ioremap_registers = at91sam9263_ioremap_registers,
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index ed666f5cb01d..858c8aac2daf 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -848,7 +848,7 @@ static struct resource lcdc_resources[] = {
848}; 848};
849 849
850static struct platform_device at91_lcdc_device = { 850static struct platform_device at91_lcdc_device = {
851 .name = "atmel_lcdfb", 851 .name = "at91sam9263-lcdfb",
852 .id = 0, 852 .id = 0,
853 .dev = { 853 .dev = {
854 .dma_mask = &lcdc_dmamask, 854 .dma_mask = &lcdc_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index d3addee43d8d..8b7fce067652 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -228,6 +228,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
228 CLKDEV_CON_ID("hclk", &macb_clk), 228 CLKDEV_CON_ID("hclk", &macb_clk),
229 /* One additional fake clock for ohci */ 229 /* One additional fake clock for ohci */
230 CLKDEV_CON_ID("ohci_clk", &uhphs_clk), 230 CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
231 CLKDEV_CON_DEV_ID("hclk", "at91sam9g45-lcdfb.0", &lcdc_clk),
232 CLKDEV_CON_DEV_ID("hclk", "at91sam9g45es-lcdfb.0", &lcdc_clk),
231 CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), 233 CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
232 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), 234 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
233 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), 235 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
@@ -262,6 +264,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
262 CLKDEV_CON_DEV_ID("mci_clk", "fffd0000.mmc", &mmc1_clk), 264 CLKDEV_CON_DEV_ID("mci_clk", "fffd0000.mmc", &mmc1_clk),
263 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk), 265 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
264 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk), 266 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
267 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
268 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
265 /* fake hclk clock */ 269 /* fake hclk clock */
266 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), 270 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
267 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk), 271 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
@@ -418,7 +422,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
418 0, /* Advanced Interrupt Controller (IRQ0) */ 422 0, /* Advanced Interrupt Controller (IRQ0) */
419}; 423};
420 424
421AT91_SOC_START(sam9g45) 425AT91_SOC_START(at91sam9g45)
422 .map_io = at91sam9g45_map_io, 426 .map_io = at91sam9g45_map_io,
423 .default_irq_priority = at91sam9g45_default_irq_priority, 427 .default_irq_priority = at91sam9g45_default_irq_priority,
424 .ioremap_registers = at91sam9g45_ioremap_registers, 428 .ioremap_registers = at91sam9g45_ioremap_registers,
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 827c9f2a70fb..acb703e13331 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -18,7 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
20#include <linux/atmel-mci.h> 20#include <linux/atmel-mci.h>
21#include <linux/platform_data/atmel-aes.h> 21#include <linux/platform_data/crypto-atmel.h>
22 22
23#include <linux/platform_data/at91_adc.h> 23#include <linux/platform_data/at91_adc.h>
24 24
@@ -981,7 +981,6 @@ static struct resource lcdc_resources[] = {
981}; 981};
982 982
983static struct platform_device at91_lcdc_device = { 983static struct platform_device at91_lcdc_device = {
984 .name = "atmel_lcdfb",
985 .id = 0, 984 .id = 0,
986 .dev = { 985 .dev = {
987 .dma_mask = &lcdc_dmamask, 986 .dma_mask = &lcdc_dmamask,
@@ -997,6 +996,11 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
997 if (!data) 996 if (!data)
998 return; 997 return;
999 998
999 if (cpu_is_at91sam9g45es())
1000 at91_lcdc_device.name = "at91sam9g45es-lcdfb";
1001 else
1002 at91_lcdc_device.name = "at91sam9g45-lcdfb";
1003
1000 at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */ 1004 at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */
1001 1005
1002 at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */ 1006 at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */
@@ -1900,7 +1904,8 @@ static void __init at91_add_device_tdes(void) {}
1900 * -------------------------------------------------------------------- */ 1904 * -------------------------------------------------------------------- */
1901 1905
1902#if defined(CONFIG_CRYPTO_DEV_ATMEL_AES) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE) 1906#if defined(CONFIG_CRYPTO_DEV_ATMEL_AES) || defined(CONFIG_CRYPTO_DEV_ATMEL_AES_MODULE)
1903static struct aes_platform_data aes_data; 1907static struct crypto_platform_data aes_data;
1908static struct crypto_dma_data alt_atslave;
1904static u64 aes_dmamask = DMA_BIT_MASK(32); 1909static u64 aes_dmamask = DMA_BIT_MASK(32);
1905 1910
1906static struct resource aes_resources[] = { 1911static struct resource aes_resources[] = {
@@ -1931,23 +1936,20 @@ static struct platform_device at91sam9g45_aes_device = {
1931static void __init at91_add_device_aes(void) 1936static void __init at91_add_device_aes(void)
1932{ 1937{
1933 struct at_dma_slave *atslave; 1938 struct at_dma_slave *atslave;
1934 struct aes_dma_data *alt_atslave;
1935
1936 alt_atslave = kzalloc(sizeof(struct aes_dma_data), GFP_KERNEL);
1937 1939
1938 /* DMA TX slave channel configuration */ 1940 /* DMA TX slave channel configuration */
1939 atslave = &alt_atslave->txdata; 1941 atslave = &alt_atslave.txdata;
1940 atslave->dma_dev = &at_hdmac_device.dev; 1942 atslave->dma_dev = &at_hdmac_device.dev;
1941 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_SRC_H2SEL_HW | 1943 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_SRC_H2SEL_HW |
1942 ATC_SRC_PER(AT_DMA_ID_AES_RX); 1944 ATC_SRC_PER(AT_DMA_ID_AES_RX);
1943 1945
1944 /* DMA RX slave channel configuration */ 1946 /* DMA RX slave channel configuration */
1945 atslave = &alt_atslave->rxdata; 1947 atslave = &alt_atslave.rxdata;
1946 atslave->dma_dev = &at_hdmac_device.dev; 1948 atslave->dma_dev = &at_hdmac_device.dev;
1947 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_DST_H2SEL_HW | 1949 atslave->cfg = ATC_FIFOCFG_ENOUGHSPACE | ATC_DST_H2SEL_HW |
1948 ATC_DST_PER(AT_DMA_ID_AES_TX); 1950 ATC_DST_PER(AT_DMA_ID_AES_TX);
1949 1951
1950 aes_data.dma_slave = alt_atslave; 1952 aes_data.dma_slave = &alt_atslave;
1951 platform_device_register(&at91sam9g45_aes_device); 1953 platform_device_register(&at91sam9g45_aes_device);
1952} 1954}
1953#else 1955#else
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 5dfc8fd87103..13cdbcd48f51 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -172,6 +172,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
172 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk), 172 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
173 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 173 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
174 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 174 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
175 CLKDEV_CON_DEV_ID("spi_clk", "f0000000.spi", &spi0_clk),
176 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi1_clk),
175 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk), 177 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
176 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk), 178 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
177 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk), 179 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
@@ -226,7 +228,7 @@ void __init at91sam9n12_initialize(void)
226 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0); 228 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0);
227} 229}
228 230
229AT91_SOC_START(sam9n12) 231AT91_SOC_START(at91sam9n12)
230 .map_io = at91sam9n12_map_io, 232 .map_io = at91sam9n12_map_io,
231 .register_clocks = at91sam9n12_register_clocks, 233 .register_clocks = at91sam9n12_register_clocks,
232 .init = at91sam9n12_initialize, 234 .init = at91sam9n12_initialize,
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index eb98704db2d9..f77fae5591bc 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -179,6 +179,7 @@ static struct clk *periph_clocks[] __initdata = {
179}; 179};
180 180
181static struct clk_lookup periph_clocks_lookups[] = { 181static struct clk_lookup periph_clocks_lookups[] = {
182 CLKDEV_CON_DEV_ID("hclk", "at91sam9rl-lcdfb.0", &lcdc_clk),
182 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), 183 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
183 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), 184 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
184 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), 185 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
@@ -340,7 +341,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
340 0, /* Advanced Interrupt Controller */ 341 0, /* Advanced Interrupt Controller */
341}; 342};
342 343
343AT91_SOC_START(sam9rl) 344AT91_SOC_START(at91sam9rl)
344 .map_io = at91sam9rl_map_io, 345 .map_io = at91sam9rl_map_io,
345 .default_irq_priority = at91sam9rl_default_irq_priority, 346 .default_irq_priority = at91sam9rl_default_irq_priority,
346 .ioremap_registers = at91sam9rl_ioremap_registers, 347 .ioremap_registers = at91sam9rl_ioremap_registers,
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index ddf223ff35c4..352468f265a9 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -514,7 +514,7 @@ static struct resource lcdc_resources[] = {
514}; 514};
515 515
516static struct platform_device at91_lcdc_device = { 516static struct platform_device at91_lcdc_device = {
517 .name = "atmel_lcdfb", 517 .name = "at91sam9rl-lcdfb",
518 .id = 0, 518 .id = 0,
519 .dev = { 519 .dev = {
520 .dma_mask = &lcdc_dmamask, 520 .dma_mask = &lcdc_dmamask,
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 44a9a62dcc13..e631fec040ce 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -237,6 +237,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
237 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 237 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
238 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 238 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
239 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk), 239 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
240 CLKDEV_CON_DEV_ID("spi_clk", "f0000000.spi", &spi0_clk),
241 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi1_clk),
240 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk), 242 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
241 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk), 243 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
242 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk), 244 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
@@ -320,7 +322,7 @@ static void __init at91sam9x5_map_io(void)
320 * Interrupt initialization 322 * Interrupt initialization
321 * -------------------------------------------------------------------- */ 323 * -------------------------------------------------------------------- */
322 324
323AT91_SOC_START(sam9x5) 325AT91_SOC_START(at91sam9x5)
324 .map_io = at91sam9x5_map_io, 326 .map_io = at91sam9x5_map_io,
325 .register_clocks = at91sam9x5_register_clocks, 327 .register_clocks = at91sam9x5_register_clocks,
326AT91_SOC_END 328AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index 0c07a4459cb2..2919eba41ff4 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -33,7 +33,7 @@
33 __raw_readl(AT91_IO_P2V(AT91_TC) + field) 33 __raw_readl(AT91_IO_P2V(AT91_TC) + field)
34 34
35#define at91_tc_write(field, value) \ 35#define at91_tc_write(field, value) \
36 __raw_writel(value, AT91_IO_P2V(AT91_TC) + field); 36 __raw_writel(value, AT91_IO_P2V(AT91_TC) + field)
37 37
38/* 38/*
39 * 3 counter/timer units present. 39 * 3 counter/timer units present.
diff --git a/arch/arm/mach-at91/board-rm9200-dt.c b/arch/arm/mach-at91/board-dt-rm9200.c
index 3fcb6623a33e..3fcb6623a33e 100644
--- a/arch/arm/mach-at91/board-rm9200-dt.c
+++ b/arch/arm/mach-at91/board-dt-rm9200.c
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt-sam9.c
index 8db30132abed..8db30132abed 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt-sam9.c
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
new file mode 100644
index 000000000000..705305e62bbc
--- /dev/null
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -0,0 +1,86 @@
1/*
2 * Setup code for SAMA5 Evaluation Kits with Device Tree support
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/types.h>
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/gpio.h>
14#include <linux/micrel_phy.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18#include <linux/phy.h>
19
20#include <asm/setup.h>
21#include <asm/irq.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
25
26#include "at91_aic.h"
27#include "generic.h"
28
29
30static const struct of_device_id irq_of_match[] __initconst = {
31
32 { .compatible = "atmel,sama5d3-aic", .data = at91_aic5_of_init },
33 { /*sentinel*/ }
34};
35
36static void __init at91_dt_init_irq(void)
37{
38 of_irq_init(irq_of_match);
39}
40
41static int ksz9021rn_phy_fixup(struct phy_device *phy)
42{
43 int value;
44
45#define GMII_RCCPSR 260
46#define GMII_RRDPSR 261
47#define GMII_ERCR 11
48#define GMII_ERDWR 12
49
50 /* Set delay values */
51 value = GMII_RCCPSR | 0x8000;
52 phy_write(phy, GMII_ERCR, value);
53 value = 0xF2F4;
54 phy_write(phy, GMII_ERDWR, value);
55 value = GMII_RRDPSR | 0x8000;
56 phy_write(phy, GMII_ERCR, value);
57 value = 0x2222;
58 phy_write(phy, GMII_ERDWR, value);
59
60 return 0;
61}
62
63static void __init sama5_dt_device_init(void)
64{
65 if (of_machine_is_compatible("atmel,sama5d3xcm"))
66 phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
67 ksz9021rn_phy_fixup);
68
69 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
70}
71
72static const char *sama5_dt_board_compat[] __initdata = {
73 "atmel,sama5",
74 NULL
75};
76
77DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
78 /* Maintainer: Atmel */
79 .init_time = at91sam926x_pit_init,
80 .map_io = at91_map_io,
81 .handle_irq = at91_aic5_handle_irq,
82 .init_early = at91_dt_initialize,
83 .init_irq = at91_dt_init_irq,
84 .init_machine = sama5_dt_device_init,
85 .dt_compat = sama5_dt_board_compat,
86MACHINE_END
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 33361505c0cd..da841885d01c 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -54,7 +54,10 @@ EXPORT_SYMBOL_GPL(at91_pmc_base);
54 */ 54 */
55#define cpu_has_utmi() ( cpu_is_at91sam9rl() \ 55#define cpu_has_utmi() ( cpu_is_at91sam9rl() \
56 || cpu_is_at91sam9g45() \ 56 || cpu_is_at91sam9g45() \
57 || cpu_is_at91sam9x5()) 57 || cpu_is_at91sam9x5() \
58 || cpu_is_sama5d3())
59
60#define cpu_has_1056M_plla() (cpu_is_sama5d3())
58 61
59#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ 62#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \
60 || cpu_is_at91sam9g45() \ 63 || cpu_is_at91sam9g45() \
@@ -75,7 +78,8 @@ EXPORT_SYMBOL_GPL(at91_pmc_base);
75 || cpu_is_at91sam9n12())) 78 || cpu_is_at91sam9n12()))
76 79
77#define cpu_has_upll() (cpu_is_at91sam9g45() \ 80#define cpu_has_upll() (cpu_is_at91sam9g45() \
78 || cpu_is_at91sam9x5()) 81 || cpu_is_at91sam9x5() \
82 || cpu_is_sama5d3())
79 83
80/* USB host HS & FS */ 84/* USB host HS & FS */
81#define cpu_has_uhp() (!cpu_is_at91sam9rl()) 85#define cpu_has_uhp() (!cpu_is_at91sam9rl())
@@ -83,18 +87,22 @@ EXPORT_SYMBOL_GPL(at91_pmc_base);
83/* USB device FS only */ 87/* USB device FS only */
84#define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \ 88#define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \
85 || cpu_is_at91sam9g45() \ 89 || cpu_is_at91sam9g45() \
86 || cpu_is_at91sam9x5())) 90 || cpu_is_at91sam9x5() \
91 || cpu_is_sama5d3()))
87 92
88#define cpu_has_plladiv2() (cpu_is_at91sam9g45() \ 93#define cpu_has_plladiv2() (cpu_is_at91sam9g45() \
89 || cpu_is_at91sam9x5() \ 94 || cpu_is_at91sam9x5() \
90 || cpu_is_at91sam9n12()) 95 || cpu_is_at91sam9n12() \
96 || cpu_is_sama5d3())
91 97
92#define cpu_has_mdiv3() (cpu_is_at91sam9g45() \ 98#define cpu_has_mdiv3() (cpu_is_at91sam9g45() \
93 || cpu_is_at91sam9x5() \ 99 || cpu_is_at91sam9x5() \
94 || cpu_is_at91sam9n12()) 100 || cpu_is_at91sam9n12() \
101 || cpu_is_sama5d3())
95 102
96#define cpu_has_alt_prescaler() (cpu_is_at91sam9x5() \ 103#define cpu_has_alt_prescaler() (cpu_is_at91sam9x5() \
97 || cpu_is_at91sam9n12()) 104 || cpu_is_at91sam9n12() \
105 || cpu_is_sama5d3())
98 106
99static LIST_HEAD(clocks); 107static LIST_HEAD(clocks);
100static DEFINE_SPINLOCK(clk_lock); 108static DEFINE_SPINLOCK(clk_lock);
@@ -210,10 +218,26 @@ struct clk mck = {
210 218
211static void pmc_periph_mode(struct clk *clk, int is_on) 219static void pmc_periph_mode(struct clk *clk, int is_on)
212{ 220{
213 if (is_on) 221 u32 regval = 0;
214 at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask); 222
215 else 223 /*
216 at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask); 224 * With sama5d3 devices, we are managing clock division so we have to
225 * use the Peripheral Control Register introduced from at91sam9x5
226 * devices.
227 */
228 if (cpu_is_sama5d3()) {
229 regval |= AT91_PMC_PCR_CMD; /* write command */
230 regval |= clk->pid & AT91_PMC_PCR_PID; /* peripheral selection */
231 regval |= AT91_PMC_PCR_DIV(clk->div);
232 if (is_on)
233 regval |= AT91_PMC_PCR_EN; /* enable clock */
234 at91_pmc_write(AT91_PMC_PCR, regval);
235 } else {
236 if (is_on)
237 at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask);
238 else
239 at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask);
240 }
217} 241}
218 242
219static struct clk __init *at91_css_to_clk(unsigned long css) 243static struct clk __init *at91_css_to_clk(unsigned long css)
@@ -443,14 +467,18 @@ static void __init init_programmable_clock(struct clk *clk)
443 467
444static int at91_clk_show(struct seq_file *s, void *unused) 468static int at91_clk_show(struct seq_file *s, void *unused)
445{ 469{
446 u32 scsr, pcsr, uckr = 0, sr; 470 u32 scsr, pcsr, pcsr1 = 0, uckr = 0, sr;
447 struct clk *clk; 471 struct clk *clk;
448 472
449 scsr = at91_pmc_read(AT91_PMC_SCSR); 473 scsr = at91_pmc_read(AT91_PMC_SCSR);
450 pcsr = at91_pmc_read(AT91_PMC_PCSR); 474 pcsr = at91_pmc_read(AT91_PMC_PCSR);
475 if (cpu_is_sama5d3())
476 pcsr1 = at91_pmc_read(AT91_PMC_PCSR1);
451 sr = at91_pmc_read(AT91_PMC_SR); 477 sr = at91_pmc_read(AT91_PMC_SR);
452 seq_printf(s, "SCSR = %8x\n", scsr); 478 seq_printf(s, "SCSR = %8x\n", scsr);
453 seq_printf(s, "PCSR = %8x\n", pcsr); 479 seq_printf(s, "PCSR = %8x\n", pcsr);
480 if (cpu_is_sama5d3())
481 seq_printf(s, "PCSR1 = %8x\n", pcsr1);
454 seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR)); 482 seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR));
455 seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR)); 483 seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR));
456 seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR)); 484 seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR));
@@ -470,20 +498,30 @@ static int at91_clk_show(struct seq_file *s, void *unused)
470 list_for_each_entry(clk, &clocks, node) { 498 list_for_each_entry(clk, &clocks, node) {
471 char *state; 499 char *state;
472 500
473 if (clk->mode == pmc_sys_mode) 501 if (clk->mode == pmc_sys_mode) {
474 state = (scsr & clk->pmc_mask) ? "on" : "off"; 502 state = (scsr & clk->pmc_mask) ? "on" : "off";
475 else if (clk->mode == pmc_periph_mode) 503 } else if (clk->mode == pmc_periph_mode) {
476 state = (pcsr & clk->pmc_mask) ? "on" : "off"; 504 if (cpu_is_sama5d3()) {
477 else if (clk->mode == pmc_uckr_mode) 505 u32 pmc_mask = 1 << (clk->pid % 32);
506
507 if (clk->pid > 31)
508 state = (pcsr1 & pmc_mask) ? "on" : "off";
509 else
510 state = (pcsr & pmc_mask) ? "on" : "off";
511 } else {
512 state = (pcsr & clk->pmc_mask) ? "on" : "off";
513 }
514 } else if (clk->mode == pmc_uckr_mode) {
478 state = (uckr & clk->pmc_mask) ? "on" : "off"; 515 state = (uckr & clk->pmc_mask) ? "on" : "off";
479 else if (clk->pmc_mask) 516 } else if (clk->pmc_mask) {
480 state = (sr & clk->pmc_mask) ? "on" : "off"; 517 state = (sr & clk->pmc_mask) ? "on" : "off";
481 else if (clk == &clk32k || clk == &main_clk) 518 } else if (clk == &clk32k || clk == &main_clk) {
482 state = "on"; 519 state = "on";
483 else 520 } else {
484 state = ""; 521 state = "";
522 }
485 523
486 seq_printf(s, "%-10s users=%2d %-3s %9ld Hz %s\n", 524 seq_printf(s, "%-10s users=%2d %-3s %9lu Hz %s\n",
487 clk->name, clk->users, state, clk_get_rate(clk), 525 clk->name, clk->users, state, clk_get_rate(clk),
488 clk->parent ? clk->parent->name : ""); 526 clk->parent ? clk->parent->name : "");
489 } 527 }
@@ -530,6 +568,9 @@ int __init clk_register(struct clk *clk)
530 if (clk_is_peripheral(clk)) { 568 if (clk_is_peripheral(clk)) {
531 if (!clk->parent) 569 if (!clk->parent)
532 clk->parent = &mck; 570 clk->parent = &mck;
571 if (cpu_is_sama5d3())
572 clk->rate_hz = DIV_ROUND_UP(clk->parent->rate_hz,
573 1 << clk->div);
533 clk->mode = pmc_periph_mode; 574 clk->mode = pmc_periph_mode;
534 } 575 }
535 else if (clk_is_sys(clk)) { 576 else if (clk_is_sys(clk)) {
@@ -555,7 +596,11 @@ static u32 __init at91_pll_rate(struct clk *pll, u32 freq, u32 reg)
555 unsigned mul, div; 596 unsigned mul, div;
556 597
557 div = reg & 0xff; 598 div = reg & 0xff;
558 mul = (reg >> 16) & 0x7ff; 599 if (cpu_is_sama5d3())
600 mul = AT91_PMC3_MUL_GET(reg);
601 else
602 mul = AT91_PMC_MUL_GET(reg);
603
559 if (div && mul) { 604 if (div && mul) {
560 freq /= div; 605 freq /= div;
561 freq *= mul + 1; 606 freq *= mul + 1;
@@ -706,12 +751,15 @@ static int __init at91_pmc_init(unsigned long main_clock)
706 751
707 /* report if PLLA is more than mildly overclocked */ 752 /* report if PLLA is more than mildly overclocked */
708 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR)); 753 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR));
709 if (cpu_has_300M_plla()) { 754 if (cpu_has_1056M_plla()) {
710 if (plla.rate_hz > 300000000) 755 if (plla.rate_hz > 1056000000)
711 pll_overclock = true; 756 pll_overclock = true;
712 } else if (cpu_has_800M_plla()) { 757 } else if (cpu_has_800M_plla()) {
713 if (plla.rate_hz > 800000000) 758 if (plla.rate_hz > 800000000)
714 pll_overclock = true; 759 pll_overclock = true;
760 } else if (cpu_has_300M_plla()) {
761 if (plla.rate_hz > 300000000)
762 pll_overclock = true;
715 } else if (cpu_has_240M_plla()) { 763 } else if (cpu_has_240M_plla()) {
716 if (plla.rate_hz > 240000000) 764 if (plla.rate_hz > 240000000)
717 pll_overclock = true; 765 pll_overclock = true;
@@ -872,6 +920,7 @@ int __init at91_clock_init(unsigned long main_clock)
872static int __init at91_clock_reset(void) 920static int __init at91_clock_reset(void)
873{ 921{
874 unsigned long pcdr = 0; 922 unsigned long pcdr = 0;
923 unsigned long pcdr1 = 0;
875 unsigned long scdr = 0; 924 unsigned long scdr = 0;
876 struct clk *clk; 925 struct clk *clk;
877 926
@@ -879,8 +928,17 @@ static int __init at91_clock_reset(void)
879 if (clk->users > 0) 928 if (clk->users > 0)
880 continue; 929 continue;
881 930
882 if (clk->mode == pmc_periph_mode) 931 if (clk->mode == pmc_periph_mode) {
883 pcdr |= clk->pmc_mask; 932 if (cpu_is_sama5d3()) {
933 u32 pmc_mask = 1 << (clk->pid % 32);
934
935 if (clk->pid > 31)
936 pcdr1 |= pmc_mask;
937 else
938 pcdr |= pmc_mask;
939 } else
940 pcdr |= clk->pmc_mask;
941 }
884 942
885 if (clk->mode == pmc_sys_mode) 943 if (clk->mode == pmc_sys_mode)
886 scdr |= clk->pmc_mask; 944 scdr |= clk->pmc_mask;
@@ -888,8 +946,9 @@ static int __init at91_clock_reset(void)
888 pr_debug("Clocks: disable unused %s\n", clk->name); 946 pr_debug("Clocks: disable unused %s\n", clk->name);
889 } 947 }
890 948
891 at91_pmc_write(AT91_PMC_PCDR, pcdr);
892 at91_pmc_write(AT91_PMC_SCDR, scdr); 949 at91_pmc_write(AT91_PMC_SCDR, scdr);
950 if (cpu_is_sama5d3())
951 at91_pmc_write(AT91_PMC_PCDR1, pcdr1);
893 952
894 return 0; 953 return 0;
895} 954}
diff --git a/arch/arm/mach-at91/clock.h b/arch/arm/mach-at91/clock.h
index c2e63e47dcbe..a98a39bbd883 100644
--- a/arch/arm/mach-at91/clock.h
+++ b/arch/arm/mach-at91/clock.h
@@ -20,7 +20,9 @@ struct clk {
20 const char *name; /* unique clock name */ 20 const char *name; /* unique clock name */
21 struct clk_lookup cl; 21 struct clk_lookup cl;
22 unsigned long rate_hz; 22 unsigned long rate_hz;
23 unsigned div; /* parent clock divider */
23 struct clk *parent; 24 struct clk *parent;
25 unsigned pid; /* peripheral ID */
24 u32 pmc_mask; 26 u32 pmc_mask;
25 void (*mode)(struct clk *, int); 27 void (*mode)(struct clk *, int);
26 unsigned id:3; /* PCK0..4, or 32k/main/a/b */ 28 unsigned id:3; /* PCK0..4, or 32k/main/a/b */
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index 0c6381516a5a..48f1228c611c 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -27,8 +27,6 @@
27 27
28#define AT91_MAX_STATES 2 28#define AT91_MAX_STATES 2
29 29
30static DEFINE_PER_CPU(struct cpuidle_device, at91_cpuidle_device);
31
32/* Actual code that puts the SoC in different idle states */ 30/* Actual code that puts the SoC in different idle states */
33static int at91_enter_idle(struct cpuidle_device *dev, 31static int at91_enter_idle(struct cpuidle_device *dev,
34 struct cpuidle_driver *drv, 32 struct cpuidle_driver *drv,
@@ -47,7 +45,6 @@ static int at91_enter_idle(struct cpuidle_device *dev,
47static struct cpuidle_driver at91_idle_driver = { 45static struct cpuidle_driver at91_idle_driver = {
48 .name = "at91_idle", 46 .name = "at91_idle",
49 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
50 .en_core_tk_irqen = 1,
51 .states[0] = ARM_CPUIDLE_WFI_STATE, 48 .states[0] = ARM_CPUIDLE_WFI_STATE,
52 .states[1] = { 49 .states[1] = {
53 .enter = at91_enter_idle, 50 .enter = at91_enter_idle,
@@ -61,20 +58,9 @@ static struct cpuidle_driver at91_idle_driver = {
61}; 58};
62 59
63/* Initialize CPU idle by registering the idle states */ 60/* Initialize CPU idle by registering the idle states */
64static int at91_init_cpuidle(void) 61static int __init at91_init_cpuidle(void)
65{ 62{
66 struct cpuidle_device *device; 63 return cpuidle_register(&at91_idle_driver, NULL);
67
68 device = &per_cpu(at91_cpuidle_device, smp_processor_id());
69 device->state_count = AT91_MAX_STATES;
70
71 cpuidle_register_driver(&at91_idle_driver);
72
73 if (cpuidle_register_device(device)) {
74 printk(KERN_ERR "at91_init_cpuidle: Failed registering\n");
75 return -EIO;
76 }
77 return 0;
78} 64}
79 65
80device_initcall(at91_init_cpuidle); 66device_initcall(at91_init_cpuidle);
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index c5d7e1e9d757..a5afcf76550e 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -22,10 +22,9 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/irqdomain.h> 24#include <linux/irqdomain.h>
25#include <linux/irqchip/chained_irq.h>
25#include <linux/of_address.h> 26#include <linux/of_address.h>
26 27
27#include <asm/mach/irq.h>
28
29#include <mach/hardware.h> 28#include <mach/hardware.h>
30#include <mach/at91_pio.h> 29#include <mach/at91_pio.h>
31 30
diff --git a/arch/arm/mach-at91/include/mach/at91_dbgu.h b/arch/arm/mach-at91/include/mach/at91_dbgu.h
index 2aa0c5e13495..3b5948566e52 100644
--- a/arch/arm/mach-at91/include/mach/at91_dbgu.h
+++ b/arch/arm/mach-at91/include/mach/at91_dbgu.h
@@ -16,9 +16,6 @@
16#ifndef AT91_DBGU_H 16#ifndef AT91_DBGU_H
17#define AT91_DBGU_H 17#define AT91_DBGU_H
18 18
19#define dbgu_readl(dbgu, field) \
20 __raw_readl(AT91_VA_BASE_SYS + dbgu + AT91_DBGU_ ## field)
21
22#if !defined(CONFIG_ARCH_AT91X40) 19#if !defined(CONFIG_ARCH_AT91X40)
23#define AT91_DBGU_CR (0x00) /* Control Register */ 20#define AT91_DBGU_CR (0x00) /* Control Register */
24#define AT91_DBGU_MR (0x04) /* Mode Register */ 21#define AT91_DBGU_MR (0x04) /* Mode Register */
diff --git a/arch/arm/mach-at91/include/mach/at91_matrix.h b/arch/arm/mach-at91/include/mach/at91_matrix.h
index 02fae9de746b..f8996c954131 100644
--- a/arch/arm/mach-at91/include/mach/at91_matrix.h
+++ b/arch/arm/mach-at91/include/mach/at91_matrix.h
@@ -14,7 +14,7 @@ extern void __iomem *at91_matrix_base;
14 __raw_readl(at91_matrix_base + field) 14 __raw_readl(at91_matrix_base + field)
15 15
16#define at91_matrix_write(field, value) \ 16#define at91_matrix_write(field, value) \
17 __raw_writel(value, at91_matrix_base + field); 17 __raw_writel(value, at91_matrix_base + field)
18 18
19#else 19#else
20.extern at91_matrix_base 20.extern at91_matrix_base
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index ea2c57a86ca6..31df12029c4e 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -75,6 +75,9 @@ extern void __iomem *at91_pmc_base;
75#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */ 75#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
76#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */ 76#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
77#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */ 77#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
78#define AT91_PMC_MUL_GET(n) ((n) >> 16 & 0x7ff)
79#define AT91_PMC3_MUL (0x7f << 18) /* PLL Multiplier [SAMA5 only] */
80#define AT91_PMC3_MUL_GET(n) ((n) >> 18 & 0x7f)
78#define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */ 81#define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */
79#define AT91_PMC_USBDIV_1 (0 << 28) 82#define AT91_PMC_USBDIV_1 (0 << 28)
80#define AT91_PMC_USBDIV_2 (1 << 28) 83#define AT91_PMC_USBDIV_2 (1 << 28)
@@ -167,11 +170,18 @@ extern void __iomem *at91_pmc_base;
167#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ 170#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
168#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ 171#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
169 172
170#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9] */ 173#define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
174#define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */
175#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
176
177#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */
171#define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */ 178#define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */
172#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command */ 179#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */
173#define AT91_PMC_PCR_DIV (0x3 << 16) /* Divisor Value */ 180#define AT91_PMC_PCR_DIV(n) ((n) << 16) /* Divisor Value */
174#define AT91_PMC_PCRDIV(n) (((n) << 16) & AT91_PMC_PCR_DIV) 181#define AT91_PMC_PCR_DIV0 0x0 /* Peripheral clock is MCK */
182#define AT91_PMC_PCR_DIV2 0x2 /* Peripheral clock is MCK/2 */
183#define AT91_PMC_PCR_DIV4 0x4 /* Peripheral clock is MCK/4 */
184#define AT91_PMC_PCR_DIV8 0x8 /* Peripheral clock is MCK/8 */
175#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */ 185#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */
176 186
177#endif 187#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_st.h b/arch/arm/mach-at91/include/mach/at91_st.h
index 969aac27109f..67fdbd13c3ed 100644
--- a/arch/arm/mach-at91/include/mach/at91_st.h
+++ b/arch/arm/mach-at91/include/mach/at91_st.h
@@ -23,7 +23,7 @@ extern void __iomem *at91_st_base;
23 __raw_readl(at91_st_base + field) 23 __raw_readl(at91_st_base + field)
24 24
25#define at91_st_write(field, value) \ 25#define at91_st_write(field, value) \
26 __raw_writel(value, at91_st_base + field); 26 __raw_writel(value, at91_st_base + field)
27#else 27#else
28.extern at91_st_base 28.extern at91_st_base
29#endif 29#endif
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index b6504c19d55c..0f3379fe645f 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -36,6 +36,8 @@
36#define ARCH_ID_AT91M40807 0x14080745 36#define ARCH_ID_AT91M40807 0x14080745
37#define ARCH_ID_AT91R40008 0x44000840 37#define ARCH_ID_AT91R40008 0x44000840
38 38
39#define ARCH_ID_SAMA5D3 0x8A5C07C0
40
39#define ARCH_EXID_AT91SAM9M11 0x00000001 41#define ARCH_EXID_AT91SAM9M11 0x00000001
40#define ARCH_EXID_AT91SAM9M10 0x00000002 42#define ARCH_EXID_AT91SAM9M10 0x00000002
41#define ARCH_EXID_AT91SAM9G46 0x00000003 43#define ARCH_EXID_AT91SAM9G46 0x00000003
@@ -47,6 +49,11 @@
47#define ARCH_EXID_AT91SAM9G25 0x00000003 49#define ARCH_EXID_AT91SAM9G25 0x00000003
48#define ARCH_EXID_AT91SAM9X25 0x00000004 50#define ARCH_EXID_AT91SAM9X25 0x00000004
49 51
52#define ARCH_EXID_SAMA5D31 0x00444300
53#define ARCH_EXID_SAMA5D33 0x00414300
54#define ARCH_EXID_SAMA5D34 0x00414301
55#define ARCH_EXID_SAMA5D35 0x00584300
56
50#define ARCH_FAMILY_AT91X92 0x09200000 57#define ARCH_FAMILY_AT91X92 0x09200000
51#define ARCH_FAMILY_AT91SAM9 0x01900000 58#define ARCH_FAMILY_AT91SAM9 0x01900000
52#define ARCH_FAMILY_AT91SAM9XE 0x02900000 59#define ARCH_FAMILY_AT91SAM9XE 0x02900000
@@ -75,6 +82,9 @@ enum at91_soc_type {
75 /* SAM9N12 */ 82 /* SAM9N12 */
76 AT91_SOC_SAM9N12, 83 AT91_SOC_SAM9N12,
77 84
85 /* SAMA5D3 */
86 AT91_SOC_SAMA5D3,
87
78 /* Unknown type */ 88 /* Unknown type */
79 AT91_SOC_NONE 89 AT91_SOC_NONE
80}; 90};
@@ -93,6 +103,10 @@ enum at91_soc_subtype {
93 AT91_SOC_SAM9G15, AT91_SOC_SAM9G35, AT91_SOC_SAM9X35, 103 AT91_SOC_SAM9G15, AT91_SOC_SAM9G35, AT91_SOC_SAM9X35,
94 AT91_SOC_SAM9G25, AT91_SOC_SAM9X25, 104 AT91_SOC_SAM9G25, AT91_SOC_SAM9X25,
95 105
106 /* SAMA5D3 */
107 AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34,
108 AT91_SOC_SAMA5D35,
109
96 /* Unknown subtype */ 110 /* Unknown subtype */
97 AT91_SOC_SUBTYPE_NONE 111 AT91_SOC_SUBTYPE_NONE
98}; 112};
@@ -187,6 +201,12 @@ static inline int at91_soc_is_detected(void)
187#define cpu_is_at91sam9n12() (0) 201#define cpu_is_at91sam9n12() (0)
188#endif 202#endif
189 203
204#ifdef CONFIG_SOC_SAMA5D3
205#define cpu_is_sama5d3() (at91_soc_initdata.type == AT91_SOC_SAMA5D3)
206#else
207#define cpu_is_sama5d3() (0)
208#endif
209
190/* 210/*
191 * Since this is ARM, we will never run on any AVR32 CPU. But these 211 * Since this is ARM, we will never run on any AVR32 CPU. But these
192 * definitions may reduce clutter in common drivers. 212 * definitions may reduce clutter in common drivers.
diff --git a/arch/arm/mach-at91/include/mach/sama5d3.h b/arch/arm/mach-at91/include/mach/sama5d3.h
new file mode 100644
index 000000000000..6dc81ee38048
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/sama5d3.h
@@ -0,0 +1,73 @@
1/*
2 * Chip-specific header file for the SAMA5D3 family
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Common definitions.
8 * Based on SAMA5D3 datasheet.
9 *
10 * Licensed under GPLv2 or later.
11 */
12
13#ifndef SAMA5D3_H
14#define SAMA5D3_H
15
16/*
17 * Peripheral identifiers/interrupts.
18 */
19#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
20#define AT91_ID_SYS 1 /* System Peripherals */
21#define SAMA5D3_ID_DBGU 2 /* debug Unit (usually no special interrupt line) */
22#define AT91_ID_PIT 3 /* PIT */
23#define SAMA5D3_ID_WDT 4 /* Watchdog Timer Interrupt */
24#define SAMA5D3_ID_HSMC 5 /* Static Memory Controller */
25#define SAMA5D3_ID_PIOA 6 /* PIOA */
26#define SAMA5D3_ID_PIOB 7 /* PIOB */
27#define SAMA5D3_ID_PIOC 8 /* PIOC */
28#define SAMA5D3_ID_PIOD 9 /* PIOD */
29#define SAMA5D3_ID_PIOE 10 /* PIOE */
30#define SAMA5D3_ID_SMD 11 /* SMD Soft Modem */
31#define SAMA5D3_ID_USART0 12 /* USART0 */
32#define SAMA5D3_ID_USART1 13 /* USART1 */
33#define SAMA5D3_ID_USART2 14 /* USART2 */
34#define SAMA5D3_ID_USART3 15 /* USART3 */
35#define SAMA5D3_ID_UART0 16 /* UART 0 */
36#define SAMA5D3_ID_UART1 17 /* UART 1 */
37#define SAMA5D3_ID_TWI0 18 /* Two-Wire Interface 0 */
38#define SAMA5D3_ID_TWI1 19 /* Two-Wire Interface 1 */
39#define SAMA5D3_ID_TWI2 20 /* Two-Wire Interface 2 */
40#define SAMA5D3_ID_HSMCI0 21 /* MCI */
41#define SAMA5D3_ID_HSMCI1 22 /* MCI */
42#define SAMA5D3_ID_HSMCI2 23 /* MCI */
43#define SAMA5D3_ID_SPI0 24 /* Serial Peripheral Interface 0 */
44#define SAMA5D3_ID_SPI1 25 /* Serial Peripheral Interface 1 */
45#define SAMA5D3_ID_TC0 26 /* Timer Counter 0 */
46#define SAMA5D3_ID_TC1 27 /* Timer Counter 2 */
47#define SAMA5D3_ID_PWM 28 /* Pulse Width Modulation Controller */
48#define SAMA5D3_ID_ADC 29 /* Touch Screen ADC Controller */
49#define SAMA5D3_ID_DMA0 30 /* DMA Controller 0 */
50#define SAMA5D3_ID_DMA1 31 /* DMA Controller 1 */
51#define SAMA5D3_ID_UHPHS 32 /* USB Host High Speed */
52#define SAMA5D3_ID_UDPHS 33 /* USB Device High Speed */
53#define SAMA5D3_ID_GMAC 34 /* Gigabit Ethernet MAC */
54#define SAMA5D3_ID_EMAC 35 /* Ethernet MAC */
55#define SAMA5D3_ID_LCDC 36 /* LCD Controller */
56#define SAMA5D3_ID_ISI 37 /* Image Sensor Interface */
57#define SAMA5D3_ID_SSC0 38 /* Synchronous Serial Controller 0 */
58#define SAMA5D3_ID_SSC1 39 /* Synchronous Serial Controller 1 */
59#define SAMA5D3_ID_CAN0 40 /* CAN Controller 0 */
60#define SAMA5D3_ID_CAN1 41 /* CAN Controller 1 */
61#define SAMA5D3_ID_SHA 42 /* Secure Hash Algorithm */
62#define SAMA5D3_ID_AES 43 /* Advanced Encryption Standard */
63#define SAMA5D3_ID_TDES 44 /* Triple Data Encryption Standard */
64#define SAMA5D3_ID_TRNG 45 /* True Random Generator Number */
65#define SAMA5D3_ID_IRQ0 47 /* Advanced Interrupt Controller (IRQ0) */
66
67/*
68 * Internal Memory
69 */
70#define SAMA5D3_SRAM_BASE 0x00300000 /* Internal SRAM base address */
71#define SAMA5D3_SRAM_SIZE (128 * SZ_1K) /* Internal SRAM size (128Kb) */
72
73#endif
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
new file mode 100644
index 000000000000..401279715ab1
--- /dev/null
+++ b/arch/arm/mach-at91/sama5d3.c
@@ -0,0 +1,377 @@
1/*
2 * Chip-specific setup code for the SAMA5D3 family
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/module.h>
11#include <linux/dma-mapping.h>
12
13#include <asm/irq.h>
14#include <asm/mach/arch.h>
15#include <asm/mach/map.h>
16#include <mach/sama5d3.h>
17#include <mach/at91_pmc.h>
18#include <mach/cpu.h>
19
20#include "soc.h"
21#include "generic.h"
22#include "clock.h"
23#include "sam9_smc.h"
24
25/* --------------------------------------------------------------------
26 * Clocks
27 * -------------------------------------------------------------------- */
28
29/*
30 * The peripheral clocks.
31 */
32
33static struct clk pioA_clk = {
34 .name = "pioA_clk",
35 .pid = SAMA5D3_ID_PIOA,
36 .type = CLK_TYPE_PERIPHERAL,
37};
38static struct clk pioB_clk = {
39 .name = "pioB_clk",
40 .pid = SAMA5D3_ID_PIOB,
41 .type = CLK_TYPE_PERIPHERAL,
42};
43static struct clk pioC_clk = {
44 .name = "pioC_clk",
45 .pid = SAMA5D3_ID_PIOC,
46 .type = CLK_TYPE_PERIPHERAL,
47};
48static struct clk pioD_clk = {
49 .name = "pioD_clk",
50 .pid = SAMA5D3_ID_PIOD,
51 .type = CLK_TYPE_PERIPHERAL,
52};
53static struct clk pioE_clk = {
54 .name = "pioE_clk",
55 .pid = SAMA5D3_ID_PIOE,
56 .type = CLK_TYPE_PERIPHERAL,
57};
58static struct clk usart0_clk = {
59 .name = "usart0_clk",
60 .pid = SAMA5D3_ID_USART0,
61 .type = CLK_TYPE_PERIPHERAL,
62 .div = AT91_PMC_PCR_DIV2,
63};
64static struct clk usart1_clk = {
65 .name = "usart1_clk",
66 .pid = SAMA5D3_ID_USART1,
67 .type = CLK_TYPE_PERIPHERAL,
68 .div = AT91_PMC_PCR_DIV2,
69};
70static struct clk usart2_clk = {
71 .name = "usart2_clk",
72 .pid = SAMA5D3_ID_USART2,
73 .type = CLK_TYPE_PERIPHERAL,
74 .div = AT91_PMC_PCR_DIV2,
75};
76static struct clk usart3_clk = {
77 .name = "usart3_clk",
78 .pid = SAMA5D3_ID_USART3,
79 .type = CLK_TYPE_PERIPHERAL,
80 .div = AT91_PMC_PCR_DIV2,
81};
82static struct clk uart0_clk = {
83 .name = "uart0_clk",
84 .pid = SAMA5D3_ID_UART0,
85 .type = CLK_TYPE_PERIPHERAL,
86 .div = AT91_PMC_PCR_DIV2,
87};
88static struct clk uart1_clk = {
89 .name = "uart1_clk",
90 .pid = SAMA5D3_ID_UART1,
91 .type = CLK_TYPE_PERIPHERAL,
92 .div = AT91_PMC_PCR_DIV2,
93};
94static struct clk twi0_clk = {
95 .name = "twi0_clk",
96 .pid = SAMA5D3_ID_TWI0,
97 .type = CLK_TYPE_PERIPHERAL,
98 .div = AT91_PMC_PCR_DIV2,
99};
100static struct clk twi1_clk = {
101 .name = "twi1_clk",
102 .pid = SAMA5D3_ID_TWI1,
103 .type = CLK_TYPE_PERIPHERAL,
104 .div = AT91_PMC_PCR_DIV2,
105};
106static struct clk twi2_clk = {
107 .name = "twi2_clk",
108 .pid = SAMA5D3_ID_TWI2,
109 .type = CLK_TYPE_PERIPHERAL,
110 .div = AT91_PMC_PCR_DIV2,
111};
112static struct clk mmc0_clk = {
113 .name = "mci0_clk",
114 .pid = SAMA5D3_ID_HSMCI0,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk mmc1_clk = {
118 .name = "mci1_clk",
119 .pid = SAMA5D3_ID_HSMCI1,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk mmc2_clk = {
123 .name = "mci2_clk",
124 .pid = SAMA5D3_ID_HSMCI2,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk spi0_clk = {
128 .name = "spi0_clk",
129 .pid = SAMA5D3_ID_SPI0,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk spi1_clk = {
133 .name = "spi1_clk",
134 .pid = SAMA5D3_ID_SPI1,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137static struct clk tcb0_clk = {
138 .name = "tcb0_clk",
139 .pid = SAMA5D3_ID_TC0,
140 .type = CLK_TYPE_PERIPHERAL,
141 .div = AT91_PMC_PCR_DIV2,
142};
143static struct clk tcb1_clk = {
144 .name = "tcb1_clk",
145 .pid = SAMA5D3_ID_TC1,
146 .type = CLK_TYPE_PERIPHERAL,
147 .div = AT91_PMC_PCR_DIV2,
148};
149static struct clk adc_clk = {
150 .name = "adc_clk",
151 .pid = SAMA5D3_ID_ADC,
152 .type = CLK_TYPE_PERIPHERAL,
153 .div = AT91_PMC_PCR_DIV2,
154};
155static struct clk adc_op_clk = {
156 .name = "adc_op_clk",
157 .type = CLK_TYPE_PERIPHERAL,
158 .rate_hz = 5000000,
159};
160static struct clk dma0_clk = {
161 .name = "dma0_clk",
162 .pid = SAMA5D3_ID_DMA0,
163 .type = CLK_TYPE_PERIPHERAL,
164};
165static struct clk dma1_clk = {
166 .name = "dma1_clk",
167 .pid = SAMA5D3_ID_DMA1,
168 .type = CLK_TYPE_PERIPHERAL,
169};
170static struct clk uhphs_clk = {
171 .name = "uhphs",
172 .pid = SAMA5D3_ID_UHPHS,
173 .type = CLK_TYPE_PERIPHERAL,
174};
175static struct clk udphs_clk = {
176 .name = "udphs_clk",
177 .pid = SAMA5D3_ID_UDPHS,
178 .type = CLK_TYPE_PERIPHERAL,
179};
180/* gmac only for sama5d33, sama5d34, sama5d35 */
181static struct clk macb0_clk = {
182 .name = "macb0_clk",
183 .pid = SAMA5D3_ID_GMAC,
184 .type = CLK_TYPE_PERIPHERAL,
185};
186/* emac only for sama5d31, sama5d35 */
187static struct clk macb1_clk = {
188 .name = "macb1_clk",
189 .pid = SAMA5D3_ID_EMAC,
190 .type = CLK_TYPE_PERIPHERAL,
191};
192/* lcd only for sama5d31, sama5d33, sama5d34 */
193static struct clk lcdc_clk = {
194 .name = "lcdc_clk",
195 .pid = SAMA5D3_ID_LCDC,
196 .type = CLK_TYPE_PERIPHERAL,
197};
198/* isi only for sama5d33, sama5d35 */
199static struct clk isi_clk = {
200 .name = "isi_clk",
201 .pid = SAMA5D3_ID_ISI,
202 .type = CLK_TYPE_PERIPHERAL,
203};
204static struct clk can0_clk = {
205 .name = "can0_clk",
206 .pid = SAMA5D3_ID_CAN0,
207 .type = CLK_TYPE_PERIPHERAL,
208 .div = AT91_PMC_PCR_DIV2,
209};
210static struct clk can1_clk = {
211 .name = "can1_clk",
212 .pid = SAMA5D3_ID_CAN1,
213 .type = CLK_TYPE_PERIPHERAL,
214 .div = AT91_PMC_PCR_DIV2,
215};
216static struct clk ssc0_clk = {
217 .name = "ssc0_clk",
218 .pid = SAMA5D3_ID_SSC0,
219 .type = CLK_TYPE_PERIPHERAL,
220 .div = AT91_PMC_PCR_DIV2,
221};
222static struct clk ssc1_clk = {
223 .name = "ssc1_clk",
224 .pid = SAMA5D3_ID_SSC1,
225 .type = CLK_TYPE_PERIPHERAL,
226 .div = AT91_PMC_PCR_DIV2,
227};
228static struct clk sha_clk = {
229 .name = "sha_clk",
230 .pid = SAMA5D3_ID_SHA,
231 .type = CLK_TYPE_PERIPHERAL,
232 .div = AT91_PMC_PCR_DIV8,
233};
234static struct clk aes_clk = {
235 .name = "aes_clk",
236 .pid = SAMA5D3_ID_AES,
237 .type = CLK_TYPE_PERIPHERAL,
238};
239static struct clk tdes_clk = {
240 .name = "tdes_clk",
241 .pid = SAMA5D3_ID_TDES,
242 .type = CLK_TYPE_PERIPHERAL,
243};
244
245static struct clk *periph_clocks[] __initdata = {
246 &pioA_clk,
247 &pioB_clk,
248 &pioC_clk,
249 &pioD_clk,
250 &pioE_clk,
251 &usart0_clk,
252 &usart1_clk,
253 &usart2_clk,
254 &usart3_clk,
255 &uart0_clk,
256 &uart1_clk,
257 &twi0_clk,
258 &twi1_clk,
259 &twi2_clk,
260 &mmc0_clk,
261 &mmc1_clk,
262 &mmc2_clk,
263 &spi0_clk,
264 &spi1_clk,
265 &tcb0_clk,
266 &tcb1_clk,
267 &adc_clk,
268 &adc_op_clk,
269 &dma0_clk,
270 &dma1_clk,
271 &uhphs_clk,
272 &udphs_clk,
273 &macb0_clk,
274 &macb1_clk,
275 &lcdc_clk,
276 &isi_clk,
277 &can0_clk,
278 &can1_clk,
279 &ssc0_clk,
280 &ssc1_clk,
281 &sha_clk,
282 &aes_clk,
283 &tdes_clk,
284};
285
286static struct clk pck0 = {
287 .name = "pck0",
288 .pmc_mask = AT91_PMC_PCK0,
289 .type = CLK_TYPE_PROGRAMMABLE,
290 .id = 0,
291};
292
293static struct clk pck1 = {
294 .name = "pck1",
295 .pmc_mask = AT91_PMC_PCK1,
296 .type = CLK_TYPE_PROGRAMMABLE,
297 .id = 1,
298};
299
300static struct clk pck2 = {
301 .name = "pck2",
302 .pmc_mask = AT91_PMC_PCK2,
303 .type = CLK_TYPE_PROGRAMMABLE,
304 .id = 2,
305};
306
307static struct clk_lookup periph_clocks_lookups[] = {
308 /* lookup table for DT entries */
309 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
310 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
311 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
312 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
313 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk),
314 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk),
315 CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk),
316 CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk),
317 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk),
318 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk),
319 CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk),
320 CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk),
321 CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk),
322 CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk),
323 CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk),
324 CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk),
325 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk),
326 CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk),
327 CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk),
328 CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk),
329 CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk),
330 CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk),
331 CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk),
332 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
333 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
334 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
335 CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk),
336 CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk),
337 CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk),
338 CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk),
339 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk),
340 CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk),
341 CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk),
342 CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk),
343 CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk),
344 CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk),
345 CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk),
346 CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk),
347 CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk),
348};
349
350static void __init sama5d3_register_clocks(void)
351{
352 int i;
353
354 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
355 clk_register(periph_clocks[i]);
356
357 clkdev_add_table(periph_clocks_lookups,
358 ARRAY_SIZE(periph_clocks_lookups));
359
360 clk_register(&pck0);
361 clk_register(&pck1);
362 clk_register(&pck2);
363}
364
365/* --------------------------------------------------------------------
366 * AT91SAM9x5 processor initialization
367 * -------------------------------------------------------------------- */
368
369static void __init sama5d3_map_io(void)
370{
371 at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE);
372}
373
374AT91_SOC_START(sama5d3)
375 .map_io = sama5d3_map_io,
376 .register_clocks = sama5d3_register_clocks,
377AT91_SOC_END
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 4b678478cf95..e8491e77b1f7 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -151,6 +151,11 @@ static void __init soc_detect(u32 dbgu_base)
151 at91_soc_initdata.type = AT91_SOC_SAM9N12; 151 at91_soc_initdata.type = AT91_SOC_SAM9N12;
152 at91_boot_soc = at91sam9n12_soc; 152 at91_boot_soc = at91sam9n12_soc;
153 break; 153 break;
154
155 case ARCH_ID_SAMA5D3:
156 at91_soc_initdata.type = AT91_SOC_SAMA5D3;
157 at91_boot_soc = sama5d3_soc;
158 break;
154 } 159 }
155 160
156 /* at91sam9g10 */ 161 /* at91sam9g10 */
@@ -206,6 +211,23 @@ static void __init soc_detect(u32 dbgu_base)
206 break; 211 break;
207 } 212 }
208 } 213 }
214
215 if (at91_soc_initdata.type == AT91_SOC_SAMA5D3) {
216 switch (at91_soc_initdata.exid) {
217 case ARCH_EXID_SAMA5D31:
218 at91_soc_initdata.subtype = AT91_SOC_SAMA5D31;
219 break;
220 case ARCH_EXID_SAMA5D33:
221 at91_soc_initdata.subtype = AT91_SOC_SAMA5D33;
222 break;
223 case ARCH_EXID_SAMA5D34:
224 at91_soc_initdata.subtype = AT91_SOC_SAMA5D34;
225 break;
226 case ARCH_EXID_SAMA5D35:
227 at91_soc_initdata.subtype = AT91_SOC_SAMA5D35;
228 break;
229 }
230 }
209} 231}
210 232
211static const char *soc_name[] = { 233static const char *soc_name[] = {
@@ -219,6 +241,7 @@ static const char *soc_name[] = {
219 [AT91_SOC_SAM9RL] = "at91sam9rl", 241 [AT91_SOC_SAM9RL] = "at91sam9rl",
220 [AT91_SOC_SAM9X5] = "at91sam9x5", 242 [AT91_SOC_SAM9X5] = "at91sam9x5",
221 [AT91_SOC_SAM9N12] = "at91sam9n12", 243 [AT91_SOC_SAM9N12] = "at91sam9n12",
244 [AT91_SOC_SAMA5D3] = "sama5d3",
222 [AT91_SOC_NONE] = "Unknown" 245 [AT91_SOC_NONE] = "Unknown"
223}; 246};
224 247
@@ -241,6 +264,10 @@ static const char *soc_subtype_name[] = {
241 [AT91_SOC_SAM9X35] = "at91sam9x35", 264 [AT91_SOC_SAM9X35] = "at91sam9x35",
242 [AT91_SOC_SAM9G25] = "at91sam9g25", 265 [AT91_SOC_SAM9G25] = "at91sam9g25",
243 [AT91_SOC_SAM9X25] = "at91sam9x25", 266 [AT91_SOC_SAM9X25] = "at91sam9x25",
267 [AT91_SOC_SAMA5D31] = "sama5d31",
268 [AT91_SOC_SAMA5D33] = "sama5d33",
269 [AT91_SOC_SAMA5D34] = "sama5d34",
270 [AT91_SOC_SAMA5D35] = "sama5d35",
244 [AT91_SOC_SUBTYPE_NONE] = "Unknown" 271 [AT91_SOC_SUBTYPE_NONE] = "Unknown"
245}; 272};
246 273
@@ -333,7 +360,7 @@ static void at91_dt_rstc(void)
333 360
334 of_id = of_match_node(rstc_ids, np); 361 of_id = of_match_node(rstc_ids, np);
335 if (!of_id) 362 if (!of_id)
336 panic("AT91: rtsc no restart function availlable\n"); 363 panic("AT91: rtsc no restart function available\n");
337 364
338 arm_pm_restart = of_id->data; 365 arm_pm_restart = of_id->data;
339 366
@@ -353,7 +380,7 @@ static void at91_dt_ramc(void)
353 380
354 np = of_find_matching_node(NULL, ramc_ids); 381 np = of_find_matching_node(NULL, ramc_ids);
355 if (!np) 382 if (!np)
356 panic("unable to find compatible ram conroller node in dtb\n"); 383 panic("unable to find compatible ram controller node in dtb\n");
357 384
358 at91_ramc_base[0] = of_iomap(np, 0); 385 at91_ramc_base[0] = of_iomap(np, 0);
359 if (!at91_ramc_base[0]) 386 if (!at91_ramc_base[0])
@@ -403,7 +430,7 @@ static void at91_dt_shdwc(void)
403 430
404 np = of_find_matching_node(NULL, shdwc_ids); 431 np = of_find_matching_node(NULL, shdwc_ids);
405 if (!np) { 432 if (!np) {
406 pr_debug("AT91: unable to find compatible shutdown (shdwc) conroller node in dtb\n"); 433 pr_debug("AT91: unable to find compatible shutdown (shdwc) controller node in dtb\n");
407 return; 434 return;
408 } 435 }
409 436
@@ -419,7 +446,7 @@ static void at91_dt_shdwc(void)
419 446
420 if (!of_property_read_u32(np, "atmel,wakeup-counter", &reg)) { 447 if (!of_property_read_u32(np, "atmel,wakeup-counter", &reg)) {
421 if (reg > AT91_SHDW_CPTWK0_MAX) { 448 if (reg > AT91_SHDW_CPTWK0_MAX) {
422 pr_warn("AT91: shdwc wakeup conter 0x%x > 0x%x reduce it to 0x%x\n", 449 pr_warn("AT91: shdwc wakeup counter 0x%x > 0x%x reduce it to 0x%x\n",
423 reg, AT91_SHDW_CPTWK0_MAX, AT91_SHDW_CPTWK0_MAX); 450 reg, AT91_SHDW_CPTWK0_MAX, AT91_SHDW_CPTWK0_MAX);
424 reg = AT91_SHDW_CPTWK0_MAX; 451 reg = AT91_SHDW_CPTWK0_MAX;
425 } 452 }
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index 9c6d3d4f9a23..43a225f9e713 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -22,9 +22,10 @@ extern struct at91_init_soc at91sam9g45_soc;
22extern struct at91_init_soc at91sam9rl_soc; 22extern struct at91_init_soc at91sam9rl_soc;
23extern struct at91_init_soc at91sam9x5_soc; 23extern struct at91_init_soc at91sam9x5_soc;
24extern struct at91_init_soc at91sam9n12_soc; 24extern struct at91_init_soc at91sam9n12_soc;
25extern struct at91_init_soc sama5d3_soc;
25 26
26#define AT91_SOC_START(_name) \ 27#define AT91_SOC_START(_name) \
27struct at91_init_soc __initdata at91##_name##_soc \ 28struct at91_init_soc __initdata _name##_soc \
28 __used \ 29 __used \
29 = { \ 30 = { \
30 .builtin = 1, \ 31 .builtin = 1, \
@@ -68,3 +69,7 @@ static inline int at91_soc_is_enabled(void)
68#if !defined(CONFIG_SOC_AT91SAM9N12) 69#if !defined(CONFIG_SOC_AT91SAM9N12)
69#define at91sam9n12_soc at91_boot_soc 70#define at91sam9n12_soc at91_boot_soc
70#endif 71#endif
72
73#if !defined(CONFIG_SOC_SAMA5D3)
74#define sama5d3_soc at91_boot_soc
75#endif
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index bf02471d7e7c..f11289519c39 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -6,6 +6,7 @@ config ARCH_BCM
6 select ARM_ERRATA_764369 if SMP 6 select ARM_ERRATA_764369 if SMP
7 select ARM_GIC 7 select ARM_GIC
8 select CPU_V7 8 select CPU_V7
9 select CLKSRC_OF
9 select GENERIC_CLOCKEVENTS 10 select GENERIC_CLOCKEVENTS
10 select GENERIC_TIME 11 select GENERIC_TIME
11 select GPIO_BCM 12 select GPIO_BCM
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index bbf412261e5e..6adb6aecf48f 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -10,4 +10,6 @@
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) := board_bcm.o 13obj-$(CONFIG_ARCH_BCM) := board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o
14plus_sec := $(call as-instr,.arch_extension sec,+sec)
15AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
new file mode 100644
index 000000000000..56d9d19b2470
--- /dev/null
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -0,0 +1,118 @@
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 <stdarg.h>
15#include <linux/smp.h>
16#include <linux/io.h>
17#include <linux/ioport.h>
18
19#include <asm/cacheflush.h>
20#include <linux/of_address.h>
21
22#include "bcm_kona_smc.h"
23
24struct secure_bridge_data {
25 void __iomem *bounce; /* virtual address */
26 u32 __iomem buffer_addr; /* physical address */
27 int initialized;
28} bridge_data;
29
30struct bcm_kona_smc_data {
31 unsigned service_id;
32 unsigned arg0;
33 unsigned arg1;
34 unsigned arg2;
35 unsigned arg3;
36};
37
38static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
39 {.compatible = "bcm,kona-smc"},
40 {},
41};
42
43/* Map in the bounce area */
44void __init bcm_kona_smc_init(void)
45{
46 struct device_node *node;
47
48 /* Read buffer addr and size from the device tree node */
49 node = of_find_matching_node(NULL, bcm_kona_smc_ids);
50 BUG_ON(!node);
51
52 /* Don't care about size or flags of the DT node */
53 bridge_data.buffer_addr =
54 be32_to_cpu(*of_get_address(node, 0, NULL, NULL));
55 BUG_ON(!bridge_data.buffer_addr);
56
57 bridge_data.bounce = of_iomap(node, 0);
58 BUG_ON(!bridge_data.bounce);
59
60 bridge_data.initialized = 1;
61
62 pr_info("Secure API initialized!\n");
63}
64
65/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */
66static void __bcm_kona_smc(void *info)
67{
68 struct bcm_kona_smc_data *data = info;
69 u32 *args = bridge_data.bounce;
70 int rc = 0;
71
72 /* Must run on CPU 0 */
73 BUG_ON(smp_processor_id() != 0);
74
75 /* Check map in the bounce area */
76 BUG_ON(!bridge_data.initialized);
77
78 /* Copy one 32 bit word into the bounce area */
79 args[0] = data->arg0;
80 args[1] = data->arg1;
81 args[2] = data->arg2;
82 args[3] = data->arg3;
83
84 /* Flush caches for input data passed to Secure Monitor */
85 if (data->service_id != SSAPI_BRCM_START_VC_CORE)
86 flush_cache_all();
87
88 /* Trap into Secure Monitor */
89 rc = bcm_kona_smc_asm(data->service_id, bridge_data.buffer_addr);
90
91 if (rc != SEC_ROM_RET_OK)
92 pr_err("Secure Monitor call failed (0x%x)!\n", rc);
93}
94
95unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
96 unsigned arg2, unsigned arg3)
97{
98 struct bcm_kona_smc_data data;
99
100 data.service_id = service_id;
101 data.arg0 = arg0;
102 data.arg1 = arg1;
103 data.arg2 = arg2;
104 data.arg3 = arg3;
105
106 /*
107 * Due to a limitation of the secure monitor, we must use the SMP
108 * infrastructure to forward all secure monitor calls to Core 0.
109 */
110 if (get_cpu() != 0)
111 smp_call_function_single(0, __bcm_kona_smc, (void *)&data, 1);
112 else
113 __bcm_kona_smc(&data);
114
115 put_cpu();
116
117 return 0;
118}
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.h b/arch/arm/mach-bcm/bcm_kona_smc.h
new file mode 100644
index 000000000000..3bedbed1c21b
--- /dev/null
+++ b/arch/arm/mach-bcm/bcm_kona_smc.h
@@ -0,0 +1,80 @@
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#ifndef BCM_KONA_SMC_H
15#define BCM_KONA_SMC_H
16
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
21/*!
22 * Definitions for IRQ & FIQ Mask for ARM
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
58#define SEC_ROM_RET_FAIL 0x00000009
59
60#define SSAPI_RET_FROM_INT_SERV 0x4
61#define SEC_EXIT_NORMAL 0x1
62
63#define SSAPI_ROW_AES 0x0E000006
64#define SSAPI_BRCM_START_VC_CORE 0x0E000008
65
66#ifndef __ASSEMBLY__
67extern void bcm_kona_smc_init(void);
68
69extern unsigned bcm_kona_smc(unsigned service_id,
70 unsigned arg0,
71 unsigned arg1,
72 unsigned arg2,
73 unsigned arg3);
74
75extern int bcm_kona_smc_asm(u32 service_id,
76 u32 buffer_addr);
77
78#endif /* __ASSEMBLY__ */
79
80#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
new file mode 100644
index 000000000000..a1608480d60d
--- /dev/null
+++ b/arch/arm/mach-bcm/bcm_kona_smc_asm.S
@@ -0,0 +1,41 @@
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_bcm.c b/arch/arm/mach-bcm/board_bcm.c
index f0f9abafad29..22e8421b1df3 100644
--- a/arch/arm/mach-bcm/board_bcm.c
+++ b/arch/arm/mach-bcm/board_bcm.c
@@ -16,26 +16,46 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/irqchip.h> 18#include <linux/irqchip.h>
19#include <linux/clocksource.h>
19 20
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
21#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <asm/hardware/cache-l2x0.h>
22 24
23static void timer_init(void) 25
26#include "bcm_kona_smc.h"
27
28static int __init kona_l2_cache_init(void)
24{ 29{
25} 30 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
31 return 0;
32
33 bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
26 34
35 /*
36 * The aux_val and aux_mask have no effect since L2 cache is already
37 * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
38 */
39 l2x0_of_init(0, ~0);
40
41 return 0;
42}
27 43
28static void __init board_init(void) 44static void __init board_init(void)
29{ 45{
30 of_platform_populate(NULL, of_default_bus_match_table, NULL, 46 of_platform_populate(NULL, of_default_bus_match_table, NULL,
31 &platform_bus); 47 &platform_bus);
48
49 bcm_kona_smc_init();
50
51 kona_l2_cache_init();
32} 52}
33 53
34static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, }; 54static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, };
35 55
36DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor") 56DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
37 .init_irq = irqchip_init, 57 .init_irq = irqchip_init,
38 .init_time = timer_init, 58 .init_time = clocksource_of_init,
39 .init_machine = board_init, 59 .init_machine = board_init,
40 .dt_compat = bcm11351_dt_compat, 60 .dt_compat = bcm11351_dt_compat,
41MACHINE_END 61MACHINE_END
diff --git a/arch/arm/mach-bcm2835/Kconfig b/arch/arm/mach-bcm2835/Kconfig
new file mode 100644
index 000000000000..560045cafc34
--- /dev/null
+++ b/arch/arm/mach-bcm2835/Kconfig
@@ -0,0 +1,15 @@
1config ARCH_BCM2835
2 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6
3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_AMBA
5 select ARM_ERRATA_411920
6 select ARM_TIMER_SP804
7 select CLKDEV_LOOKUP
8 select CLKSRC_OF
9 select CPU_V6
10 select GENERIC_CLOCKEVENTS
11 select PINCTRL
12 select PINCTRL_BCM2835
13 help
14 This enables support for the Broadcom BCM2835 SoC. This SoC is
15 use in the Raspberry Pi, and Roku 2 devices.
diff --git a/arch/arm/mach-bcm2835/Makefile.boot b/arch/arm/mach-bcm2835/Makefile.boot
deleted file mode 100644
index b3271754e9fd..000000000000
--- a/arch/arm/mach-bcm2835/Makefile.boot
+++ /dev/null
@@ -1 +0,0 @@
1zreladdr-y := 0x00008000
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index 6f5785985dd1..740fa9ebe249 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -23,8 +23,6 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include <mach/bcm2835_soc.h>
27
28#define PM_RSTC 0x1c 26#define PM_RSTC 0x1c
29#define PM_RSTS 0x20 27#define PM_RSTS 0x20
30#define PM_WDOG 0x24 28#define PM_WDOG 0x24
@@ -34,6 +32,10 @@
34#define PM_RSTC_WRCFG_FULL_RESET 0x00000020 32#define PM_RSTC_WRCFG_FULL_RESET 0x00000020
35#define PM_RSTS_HADWRH_SET 0x00000040 33#define PM_RSTS_HADWRH_SET 0x00000040
36 34
35#define BCM2835_PERIPH_PHYS 0x20000000
36#define BCM2835_PERIPH_VIRT 0xf0000000
37#define BCM2835_PERIPH_SIZE SZ_16M
38
37static void __iomem *wdt_regs; 39static void __iomem *wdt_regs;
38 40
39/* 41/*
diff --git a/arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h b/arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h
deleted file mode 100644
index d4dfcf7a9cda..000000000000
--- a/arch/arm/mach-bcm2835/include/mach/bcm2835_soc.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2012 Stephen Warren
3 *
4 * Derived from code:
5 * Copyright (C) 2010 Broadcom
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#ifndef __MACH_BCM2835_BCM2835_SOC_H__
19#define __MACH_BCM2835_BCM2835_SOC_H__
20
21#include <asm/sizes.h>
22
23#define BCM2835_PERIPH_PHYS 0x20000000
24#define BCM2835_PERIPH_VIRT 0xf0000000
25#define BCM2835_PERIPH_SIZE SZ_16M
26#define BCM2835_DEBUG_PHYS 0x20201000
27#define BCM2835_DEBUG_VIRT 0xf0201000
28
29#endif
diff --git a/arch/arm/mach-bcm2835/include/mach/gpio.h b/arch/arm/mach-bcm2835/include/mach/gpio.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-bcm2835/include/mach/gpio.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-bcm2835/include/mach/timex.h b/arch/arm/mach-bcm2835/include/mach/timex.h
deleted file mode 100644
index 6d021e136ae3..000000000000
--- a/arch/arm/mach-bcm2835/include/mach/timex.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * BCM2835 system clock frequency
3 *
4 * Copyright (C) 2010 Broadcom
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H
23
24#define CLOCK_TICK_RATE (1000000)
25
26#endif
diff --git a/arch/arm/mach-bcm2835/include/mach/uncompress.h b/arch/arm/mach-bcm2835/include/mach/uncompress.h
deleted file mode 100644
index bf86dca3bf71..000000000000
--- a/arch/arm/mach-bcm2835/include/mach/uncompress.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) 2010 Broadcom
3 * Copyright (C) 2003 ARM Limited
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
16#include <linux/io.h>
17#include <linux/amba/serial.h>
18#include <mach/bcm2835_soc.h>
19
20#define UART0_BASE BCM2835_DEBUG_PHYS
21
22#define BCM2835_UART_DR IOMEM(UART0_BASE + UART01x_DR)
23#define BCM2835_UART_FR IOMEM(UART0_BASE + UART01x_FR)
24#define BCM2835_UART_CR IOMEM(UART0_BASE + UART011_CR)
25
26static inline void putc(int c)
27{
28 while (__raw_readl(BCM2835_UART_FR) & UART01x_FR_TXFF)
29 barrier();
30
31 __raw_writel(c, BCM2835_UART_DR);
32}
33
34static inline void flush(void)
35{
36 int fr;
37
38 do {
39 fr = __raw_readl(BCM2835_UART_FR);
40 barrier();
41 } while ((fr & (UART011_FR_TXFE | UART01x_FR_BUSY)) != UART011_FR_TXFE);
42}
43
44#define arch_decomp_setup()
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index 9ebfcc46feb1..dbf0df8bb0ac 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -1,8 +1,20 @@
1config ARCH_CNS3XXX
2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6
3 select ARM_GIC
4 select CPU_V6K
5 select GENERIC_CLOCKEVENTS
6 select MIGHT_HAVE_CACHE_L2X0
7 select MIGHT_HAVE_PCI
8 select PCI_DOMAINS if PCI
9 help
10 Support for Cavium Networks CNS3XXX platform.
11
1menu "CNS3XXX platform type" 12menu "CNS3XXX platform type"
2 depends on ARCH_CNS3XXX 13 depends on ARCH_CNS3XXX
3 14
4config MACH_CNS3420VB 15config MACH_CNS3420VB
5 bool "Support for CNS3420 Validation Board" 16 bool "Support for CNS3420 Validation Board"
17 depends on ATAGS
6 help 18 help
7 Include support for the Cavium Networks CNS3420 MPCore Platform 19 Include support for the Cavium Networks CNS3420 MPCore Platform
8 Baseboard. 20 Baseboard.
diff --git a/arch/arm/mach-cns3xxx/Makefile b/arch/arm/mach-cns3xxx/Makefile
index 11033f1c2e23..a1ff10848698 100644
--- a/arch/arm/mach-cns3xxx/Makefile
+++ b/arch/arm/mach-cns3xxx/Makefile
@@ -1,3 +1,5 @@
1obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o devices.o 1obj-$(CONFIG_ARCH_CNS3XXX) += cns3xxx.o
2obj-$(CONFIG_PCI) += pcie.o 2cns3xxx-y += core.o pm.o
3obj-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o 3cns3xxx-$(CONFIG_ATAGS) += devices.o
4cns3xxx-$(CONFIG_PCI) += pcie.o
5cns3xxx-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index a71867e1d8d6..ce096d678aa4 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -31,9 +31,8 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <mach/cns3xxx.h> 34#include "cns3xxx.h"
35#include <mach/irqs.h> 35#include "pm.h"
36#include <mach/pm.h>
37#include "core.h" 36#include "core.h"
38#include "devices.h" 37#include "devices.h"
39 38
@@ -247,6 +246,7 @@ static void __init cns3420_map_io(void)
247 246
248MACHINE_START(CNS3420VB, "Cavium Networks CNS3420 Validation Board") 247MACHINE_START(CNS3420VB, "Cavium Networks CNS3420 Validation Board")
249 .atag_offset = 0x100, 248 .atag_offset = 0x100,
249 .nr_irqs = NR_IRQS_CNS3XXX,
250 .map_io = cns3420_map_io, 250 .map_io = cns3420_map_io,
251 .init_irq = cns3xxx_init_irq, 251 .init_irq = cns3xxx_init_irq,
252 .init_time = cns3xxx_timer_init, 252 .init_time = cns3xxx_timer_init,
diff --git a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h b/arch/arm/mach-cns3xxx/cns3xxx.h
index b1021aafa481..a0f5b60662ae 100644
--- a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
+++ b/arch/arm/mach-cns3xxx/cns3xxx.h
@@ -20,22 +20,16 @@
20#define CNS3XXX_SPI_FLASH_BASE 0x60000000 /* SPI Serial Flash Memory */ 20#define CNS3XXX_SPI_FLASH_BASE 0x60000000 /* SPI Serial Flash Memory */
21 21
22#define CNS3XXX_SWITCH_BASE 0x70000000 /* Switch and HNAT Control */ 22#define CNS3XXX_SWITCH_BASE 0x70000000 /* Switch and HNAT Control */
23#define CNS3XXX_SWITCH_BASE_VIRT 0xFFF00000
24 23
25#define CNS3XXX_PPE_BASE 0x70001000 /* HANT */ 24#define CNS3XXX_PPE_BASE 0x70001000 /* HANT */
26#define CNS3XXX_PPE_BASE_VIRT 0xFFF50000
27 25
28#define CNS3XXX_EMBEDDED_SRAM_BASE 0x70002000 /* HANT Embedded SRAM */ 26#define CNS3XXX_EMBEDDED_SRAM_BASE 0x70002000 /* HANT Embedded SRAM */
29#define CNS3XXX_EMBEDDED_SRAM_BASE_VIRT 0xFFF60000
30 27
31#define CNS3XXX_SSP_BASE 0x71000000 /* Synchronous Serial Port - SPI/PCM/I2C */ 28#define CNS3XXX_SSP_BASE 0x71000000 /* Synchronous Serial Port - SPI/PCM/I2C */
32#define CNS3XXX_SSP_BASE_VIRT 0xFFF01000
33 29
34#define CNS3XXX_DMC_BASE 0x72000000 /* DMC Control (DDR2 SDRAM) */ 30#define CNS3XXX_DMC_BASE 0x72000000 /* DMC Control (DDR2 SDRAM) */
35#define CNS3XXX_DMC_BASE_VIRT 0xFFF02000
36 31
37#define CNS3XXX_SMC_BASE 0x73000000 /* SMC Control */ 32#define CNS3XXX_SMC_BASE 0x73000000 /* SMC Control */
38#define CNS3XXX_SMC_BASE_VIRT 0xFFF03000
39 33
40#define SMC_MEMC_STATUS_OFFSET 0x000 34#define SMC_MEMC_STATUS_OFFSET 0x000
41#define SMC_MEMIF_CFG_OFFSET 0x004 35#define SMC_MEMIF_CFG_OFFSET 0x004
@@ -74,13 +68,10 @@
74#define SMC_PCELL_ID_3_OFFSET 0xFFC 68#define SMC_PCELL_ID_3_OFFSET 0xFFC
75 69
76#define CNS3XXX_GPIOA_BASE 0x74000000 /* GPIO port A */ 70#define CNS3XXX_GPIOA_BASE 0x74000000 /* GPIO port A */
77#define CNS3XXX_GPIOA_BASE_VIRT 0xFFF04000
78 71
79#define CNS3XXX_GPIOB_BASE 0x74800000 /* GPIO port B */ 72#define CNS3XXX_GPIOB_BASE 0x74800000 /* GPIO port B */
80#define CNS3XXX_GPIOB_BASE_VIRT 0xFFF05000
81 73
82#define CNS3XXX_RTC_BASE 0x75000000 /* Real Time Clock */ 74#define CNS3XXX_RTC_BASE 0x75000000 /* Real Time Clock */
83#define CNS3XXX_RTC_BASE_VIRT 0xFFF06000
84 75
85#define RTC_SEC_OFFSET 0x00 76#define RTC_SEC_OFFSET 0x00
86#define RTC_MIN_OFFSET 0x04 77#define RTC_MIN_OFFSET 0x04
@@ -112,22 +103,16 @@
112#define CNS3XXX_UART0_BASE_VIRT 0xFB002000 103#define CNS3XXX_UART0_BASE_VIRT 0xFB002000
113 104
114#define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */ 105#define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */
115#define CNS3XXX_UART1_BASE_VIRT 0xFFF0A000
116 106
117#define CNS3XXX_UART2_BASE 0x78800000 /* UART 2 */ 107#define CNS3XXX_UART2_BASE 0x78800000 /* UART 2 */
118#define CNS3XXX_UART2_BASE_VIRT 0xFFF0B000
119 108
120#define CNS3XXX_DMAC_BASE 0x79000000 /* Generic DMA Control */ 109#define CNS3XXX_DMAC_BASE 0x79000000 /* Generic DMA Control */
121#define CNS3XXX_DMAC_BASE_VIRT 0xFFF0D000
122 110
123#define CNS3XXX_CORESIGHT_BASE 0x7A000000 /* CoreSight */ 111#define CNS3XXX_CORESIGHT_BASE 0x7A000000 /* CoreSight */
124#define CNS3XXX_CORESIGHT_BASE_VIRT 0xFFF0E000
125 112
126#define CNS3XXX_CRYPTO_BASE 0x7B000000 /* Crypto */ 113#define CNS3XXX_CRYPTO_BASE 0x7B000000 /* Crypto */
127#define CNS3XXX_CRYPTO_BASE_VIRT 0xFFF0F000
128 114
129#define CNS3XXX_I2S_BASE 0x7C000000 /* I2S */ 115#define CNS3XXX_I2S_BASE 0x7C000000 /* I2S */
130#define CNS3XXX_I2S_BASE_VIRT 0xFFF10000
131 116
132#define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */ 117#define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */
133#define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFB003000 118#define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFB003000
@@ -150,42 +135,31 @@
150#define TIMER_FREERUN_CONTROL_OFFSET 0x44 135#define TIMER_FREERUN_CONTROL_OFFSET 0x44
151 136
152#define CNS3XXX_HCIE_BASE 0x7D000000 /* HCIE Control */ 137#define CNS3XXX_HCIE_BASE 0x7D000000 /* HCIE Control */
153#define CNS3XXX_HCIE_BASE_VIRT 0xFFF30000
154 138
155#define CNS3XXX_RAID_BASE 0x7E000000 /* RAID Control */ 139#define CNS3XXX_RAID_BASE 0x7E000000 /* RAID Control */
156#define CNS3XXX_RAID_BASE_VIRT 0xFFF12000
157 140
158#define CNS3XXX_AXI_IXC_BASE 0x7F000000 /* AXI IXC */ 141#define CNS3XXX_AXI_IXC_BASE 0x7F000000 /* AXI IXC */
159#define CNS3XXX_AXI_IXC_BASE_VIRT 0xFFF13000
160 142
161#define CNS3XXX_CLCD_BASE 0x80000000 /* LCD Control */ 143#define CNS3XXX_CLCD_BASE 0x80000000 /* LCD Control */
162#define CNS3XXX_CLCD_BASE_VIRT 0xFFF14000
163 144
164#define CNS3XXX_USBOTG_BASE 0x81000000 /* USB OTG Control */ 145#define CNS3XXX_USBOTG_BASE 0x81000000 /* USB OTG Control */
165#define CNS3XXX_USBOTG_BASE_VIRT 0xFFF15000
166 146
167#define CNS3XXX_USB_BASE 0x82000000 /* USB Host Control */ 147#define CNS3XXX_USB_BASE 0x82000000 /* USB Host Control */
168 148
169#define CNS3XXX_SATA2_BASE 0x83000000 /* SATA */ 149#define CNS3XXX_SATA2_BASE 0x83000000 /* SATA */
170#define CNS3XXX_SATA2_SIZE SZ_16M 150#define CNS3XXX_SATA2_SIZE SZ_16M
171#define CNS3XXX_SATA2_BASE_VIRT 0xFFF17000
172 151
173#define CNS3XXX_CAMERA_BASE 0x84000000 /* Camera Interface */ 152#define CNS3XXX_CAMERA_BASE 0x84000000 /* Camera Interface */
174#define CNS3XXX_CAMERA_BASE_VIRT 0xFFF18000
175 153
176#define CNS3XXX_SDIO_BASE 0x85000000 /* SDIO */ 154#define CNS3XXX_SDIO_BASE 0x85000000 /* SDIO */
177#define CNS3XXX_SDIO_BASE_VIRT 0xFFF19000
178 155
179#define CNS3XXX_I2S_TDM_BASE 0x86000000 /* I2S TDM */ 156#define CNS3XXX_I2S_TDM_BASE 0x86000000 /* I2S TDM */
180#define CNS3XXX_I2S_TDM_BASE_VIRT 0xFFF1A000
181 157
182#define CNS3XXX_2DG_BASE 0x87000000 /* 2D Graphic Control */ 158#define CNS3XXX_2DG_BASE 0x87000000 /* 2D Graphic Control */
183#define CNS3XXX_2DG_BASE_VIRT 0xFFF1B000
184 159
185#define CNS3XXX_USB_OHCI_BASE 0x88000000 /* USB OHCI */ 160#define CNS3XXX_USB_OHCI_BASE 0x88000000 /* USB OHCI */
186 161
187#define CNS3XXX_L2C_BASE 0x92000000 /* L2 Cache Control */ 162#define CNS3XXX_L2C_BASE 0x92000000 /* L2 Cache Control */
188#define CNS3XXX_L2C_BASE_VIRT 0xFFF27000
189 163
190#define CNS3XXX_PCIE0_MEM_BASE 0xA0000000 /* PCIe Port 0 IO/Memory Space */ 164#define CNS3XXX_PCIE0_MEM_BASE 0xA0000000 /* PCIe Port 0 IO/Memory Space */
191#define CNS3XXX_PCIE0_MEM_BASE_VIRT 0xE0000000 165#define CNS3XXX_PCIE0_MEM_BASE_VIRT 0xE0000000
@@ -239,7 +213,6 @@
239#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000) 213#define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000)
240 214
241#define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */ 215#define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */
242#define CNS3XXX_TC11MP_L220_BASE_VIRT 0xFF002000
243 216
244/* 217/*
245 * Misc block 218 * Misc block
@@ -553,6 +526,8 @@ int cns3xxx_cpu_clock(void);
553/* 526/*
554 * ARM11 MPCore interrupt sources (primary GIC) 527 * ARM11 MPCore interrupt sources (primary GIC)
555 */ 528 */
529#define IRQ_TC11MP_GIC_START 32
530
556#define IRQ_CNS3XXX_PMU (IRQ_TC11MP_GIC_START + 0) 531#define IRQ_CNS3XXX_PMU (IRQ_TC11MP_GIC_START + 0)
557#define IRQ_CNS3XXX_SDIO (IRQ_TC11MP_GIC_START + 1) 532#define IRQ_CNS3XXX_SDIO (IRQ_TC11MP_GIC_START + 1)
558#define IRQ_CNS3XXX_L2CC (IRQ_TC11MP_GIC_START + 2) 533#define IRQ_CNS3XXX_L2CC (IRQ_TC11MP_GIC_START + 2)
@@ -624,9 +599,4 @@ int cns3xxx_cpu_clock(void);
624 599
625#define NR_IRQS_CNS3XXX (IRQ_TC11MP_GIC_START + 64) 600#define NR_IRQS_CNS3XXX (IRQ_TC11MP_GIC_START + 64)
626 601
627#if !defined(NR_IRQS) || (NR_IRQS < NR_IRQS_CNS3XXX)
628#undef NR_IRQS
629#define NR_IRQS NR_IRQS_CNS3XXX
630#endif
631
632#endif /* __MACH_BOARD_CNS3XXX_H */ 602#endif /* __MACH_BOARD_CNS3XXX_H */
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index 52e4bb5cf12d..e38b279f402c 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -13,12 +13,18 @@
13#include <linux/clockchips.h> 13#include <linux/clockchips.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/irqchip/arm-gic.h> 15#include <linux/irqchip/arm-gic.h>
16#include <linux/of_platform.h>
17#include <linux/platform_device.h>
18#include <linux/usb/ehci_pdriver.h>
19#include <linux/usb/ohci_pdriver.h>
20#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 21#include <asm/mach/map.h>
17#include <asm/mach/time.h> 22#include <asm/mach/time.h>
18#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
19#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
20#include <mach/cns3xxx.h> 25#include "cns3xxx.h"
21#include "core.h" 26#include "core.h"
27#include "pm.h"
22 28
23static struct map_desc cns3xxx_io_desc[] __initdata = { 29static struct map_desc cns3xxx_io_desc[] __initdata = {
24 { 30 {
@@ -32,16 +38,6 @@ static struct map_desc cns3xxx_io_desc[] __initdata = {
32 .length = SZ_4K, 38 .length = SZ_4K,
33 .type = MT_DEVICE, 39 .type = MT_DEVICE,
34 }, { 40 }, {
35 .virtual = CNS3XXX_GPIOA_BASE_VIRT,
36 .pfn = __phys_to_pfn(CNS3XXX_GPIOA_BASE),
37 .length = SZ_4K,
38 .type = MT_DEVICE,
39 }, {
40 .virtual = CNS3XXX_GPIOB_BASE_VIRT,
41 .pfn = __phys_to_pfn(CNS3XXX_GPIOB_BASE),
42 .length = SZ_4K,
43 .type = MT_DEVICE,
44 }, {
45 .virtual = CNS3XXX_MISC_BASE_VIRT, 41 .virtual = CNS3XXX_MISC_BASE_VIRT,
46 .pfn = __phys_to_pfn(CNS3XXX_MISC_BASE), 42 .pfn = __phys_to_pfn(CNS3XXX_MISC_BASE),
47 .length = SZ_4K, 43 .length = SZ_4K,
@@ -266,3 +262,116 @@ void __init cns3xxx_l2x0_init(void)
266} 262}
267 263
268#endif /* CONFIG_CACHE_L2X0 */ 264#endif /* CONFIG_CACHE_L2X0 */
265
266static int csn3xxx_usb_power_on(struct platform_device *pdev)
267{
268 /*
269 * EHCI and OHCI share the same clock and power,
270 * resetting twice would cause the 1st controller been reset.
271 * Therefore only do power up at the first up device, and
272 * power down at the last down device.
273 *
274 * Set USB AHB INCR length to 16
275 */
276 if (atomic_inc_return(&usb_pwr_ref) == 1) {
277 cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
278 cns3xxx_pwr_clk_en(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
279 cns3xxx_pwr_soft_rst(1 << PM_SOFT_RST_REG_OFFST_USB_HOST);
280 __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 << 24)),
281 MISC_CHIP_CONFIG_REG);
282 }
283
284 return 0;
285}
286
287static void csn3xxx_usb_power_off(struct platform_device *pdev)
288{
289 /*
290 * EHCI and OHCI share the same clock and power,
291 * resetting twice would cause the 1st controller been reset.
292 * Therefore only do power up at the first up device, and
293 * power down at the last down device.
294 */
295 if (atomic_dec_return(&usb_pwr_ref) == 0)
296 cns3xxx_pwr_clk_dis(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
297}
298
299static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
300 .power_on = csn3xxx_usb_power_on,
301 .power_off = csn3xxx_usb_power_off,
302};
303
304static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
305 .num_ports = 1,
306 .power_on = csn3xxx_usb_power_on,
307 .power_off = csn3xxx_usb_power_off,
308};
309
310static struct of_dev_auxdata cns3xxx_auxdata[] __initconst = {
311 { "intel,usb-ehci", CNS3XXX_USB_BASE, "ehci-platform", &cns3xxx_usb_ehci_pdata },
312 { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata },
313 { "cavium,cns3420-ahci", CNS3XXX_SATA2_BASE, "ahci", NULL },
314 { "cavium,cns3420-sdhci", CNS3XXX_SDIO_BASE, "ahci", NULL },
315 {},
316};
317
318static void __init cns3xxx_init(void)
319{
320 struct device_node *dn;
321
322 cns3xxx_l2x0_init();
323
324 dn = of_find_compatible_node(NULL, NULL, "cavium,cns3420-ahci");
325 if (of_device_is_available(dn)) {
326 u32 tmp;
327
328 tmp = __raw_readl(MISC_SATA_POWER_MODE);
329 tmp |= 0x1 << 16; /* Disable SATA PHY 0 from SLUMBER Mode */
330 tmp |= 0x1 << 17; /* Disable SATA PHY 1 from SLUMBER Mode */
331 __raw_writel(tmp, MISC_SATA_POWER_MODE);
332
333 /* Enable SATA PHY */
334 cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0);
335 cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1);
336
337 /* Enable SATA Clock */
338 cns3xxx_pwr_clk_en(0x1 << PM_CLK_GATE_REG_OFFSET_SATA);
339
340 /* De-Asscer SATA Reset */
341 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SATA));
342 }
343
344 dn = of_find_compatible_node(NULL, NULL, "cavium,cns3420-sdhci");
345 if (of_device_is_available(dn)) {
346 u32 __iomem *gpioa = IOMEM(CNS3XXX_MISC_BASE_VIRT + 0x0014);
347 u32 gpioa_pins = __raw_readl(gpioa);
348
349 /* MMC/SD pins share with GPIOA */
350 gpioa_pins |= 0x1fff0004;
351 __raw_writel(gpioa_pins, gpioa);
352
353 cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO));
354 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
355 }
356
357 pm_power_off = cns3xxx_power_off;
358
359 of_platform_populate(NULL, of_default_bus_match_table,
360 cns3xxx_auxdata, NULL);
361}
362
363static const char *cns3xxx_dt_compat[] __initdata = {
364 "cavium,cns3410",
365 "cavium,cns3420",
366 NULL,
367};
368
369DT_MACHINE_START(CNS3XXX_DT, "Cavium Networks CNS3xxx")
370 .dt_compat = cns3xxx_dt_compat,
371 .nr_irqs = NR_IRQS_CNS3XXX,
372 .map_io = cns3xxx_map_io,
373 .init_irq = cns3xxx_init_irq,
374 .init_time = cns3xxx_timer_init,
375 .init_machine = cns3xxx_init,
376 .restart = cns3xxx_restart,
377MACHINE_END
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c
index 1e40c99b015f..7da78a2451f1 100644
--- a/arch/arm/mach-cns3xxx/devices.c
+++ b/arch/arm/mach-cns3xxx/devices.c
@@ -16,9 +16,8 @@
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <mach/cns3xxx.h> 19#include "cns3xxx.h"
20#include <mach/irqs.h> 20#include "pm.h"
21#include <mach/pm.h>
22#include "core.h" 21#include "core.h"
23#include "devices.h" 22#include "devices.h"
24 23
diff --git a/arch/arm/mach-cns3xxx/include/mach/irqs.h b/arch/arm/mach-cns3xxx/include/mach/irqs.h
deleted file mode 100644
index 2ab96f8085c8..000000000000
--- a/arch/arm/mach-cns3xxx/include/mach/irqs.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright 2000 Deep Blue Solutions Ltd.
3 * Copyright 2003 ARM Limited
4 * Copyright 2008 Cavium Networks
5 *
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, Version 2, as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __MACH_IRQS_H
12#define __MACH_IRQS_H
13
14#define IRQ_LOCALTIMER 29
15#define IRQ_LOCALWDOG 30
16#define IRQ_TC11MP_GIC_START 32
17
18#include <mach/cns3xxx.h>
19
20#ifndef NR_IRQS
21#error "NR_IRQS not defined by the board-specific files"
22#endif
23
24#endif
diff --git a/arch/arm/mach-cns3xxx/include/mach/timex.h b/arch/arm/mach-cns3xxx/include/mach/timex.h
deleted file mode 100644
index 1fd04217cacb..000000000000
--- a/arch/arm/mach-cns3xxx/include/mach/timex.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * Cavium Networks architecture timex specifications
3 *
4 * Copyright 2003 ARM Limited
5 * Copyright 2008 Cavium Networks
6 *
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, Version 2, as
9 * published by the Free Software Foundation.
10 */
11
12#define CLOCK_TICK_RATE (50000000 / 16)
diff --git a/arch/arm/mach-cns3xxx/include/mach/uncompress.h b/arch/arm/mach-cns3xxx/include/mach/uncompress.h
deleted file mode 100644
index 7a030b99df84..000000000000
--- a/arch/arm/mach-cns3xxx/include/mach/uncompress.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * Copyright 2003 ARM Limited
3 * Copyright 2008 Cavium Networks
4 *
5 * This file is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, Version 2, as
7 * published by the Free Software Foundation.
8 */
9
10#include <asm/mach-types.h>
11#include <mach/cns3xxx.h>
12
13#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00))
14#define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c))
15#define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30))
16#define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18))
17
18/*
19 * Return the UART base address
20 */
21static inline unsigned long get_uart_base(void)
22{
23 if (machine_is_cns3420vb())
24 return CNS3XXX_UART0_BASE;
25 else
26 return 0;
27}
28
29/*
30 * This does not append a newline
31 */
32static inline void putc(int c)
33{
34 unsigned long base = get_uart_base();
35
36 while (AMBA_UART_FR(base) & (1 << 5))
37 barrier();
38
39 AMBA_UART_DR(base) = c;
40}
41
42static inline void flush(void)
43{
44 unsigned long base = get_uart_base();
45
46 while (AMBA_UART_FR(base) & (1 << 3))
47 barrier();
48}
49
50/*
51 * nothing to do
52 */
53#define arch_decomp_setup()
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
index 311328314163..c7b204bff386 100644
--- a/arch/arm/mach-cns3xxx/pcie.c
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -20,7 +20,7 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23#include <mach/cns3xxx.h> 23#include "cns3xxx.h"
24#include "core.h" 24#include "core.h"
25 25
26enum cns3xxx_access_type { 26enum cns3xxx_access_type {
diff --git a/arch/arm/mach-cns3xxx/pm.c b/arch/arm/mach-cns3xxx/pm.c
index 36458080332a..79e3d47aad65 100644
--- a/arch/arm/mach-cns3xxx/pm.c
+++ b/arch/arm/mach-cns3xxx/pm.c
@@ -11,8 +11,8 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <mach/cns3xxx.h> 14#include "cns3xxx.h"
15#include <mach/pm.h> 15#include "pm.h"
16#include "core.h" 16#include "core.h"
17 17
18void cns3xxx_pwr_clk_en(unsigned int block) 18void cns3xxx_pwr_clk_en(unsigned int block)
diff --git a/arch/arm/mach-cns3xxx/include/mach/pm.h b/arch/arm/mach-cns3xxx/pm.h
index c2588cc991d1..c2588cc991d1 100644
--- a/arch/arm/mach-cns3xxx/include/mach/pm.h
+++ b/arch/arm/mach-cns3xxx/pm.h
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index fb5c1aa98a63..dd1ffccc75e9 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o
37obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o 37obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o
38 38
39# Power Management 39# Power Management
40obj-$(CONFIG_CPU_FREQ) += cpufreq.o
41obj-$(CONFIG_CPU_IDLE) += cpuidle.o 40obj-$(CONFIG_CPU_IDLE) += cpuidle.o
42obj-$(CONFIG_SUSPEND) += pm.o sleep.o 41obj-$(CONFIG_SUSPEND) += pm.o sleep.o
43obj-$(CONFIG_HAVE_CLK) += pm_domain.o 42obj-$(CONFIG_HAVE_CLK) += pm_domain.o
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 6da25eebf911..1332de8c52c9 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -246,7 +246,6 @@ static struct davinci_mmc_config da830_evm_mmc_config = {
246 .wires = 8, 246 .wires = 8,
247 .max_freq = 50000000, 247 .max_freq = 50000000,
248 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 248 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
249 .version = MMC_CTLR_VERSION_2,
250}; 249};
251 250
252static inline void da830_evm_init_mmc(void) 251static inline void da830_evm_init_mmc(void)
@@ -298,11 +297,7 @@ static const short da830_evm_emif25_pins[] = {
298 -1 297 -1
299}; 298};
300 299
301#if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE) 300#define HAS_MMC IS_ENABLED(CONFIG_MMC_DAVINCI)
302#define HAS_MMC 1
303#else
304#define HAS_MMC 0
305#endif
306 301
307#ifdef CONFIG_DA830_UI_NAND 302#ifdef CONFIG_DA830_UI_NAND
308static struct mtd_partition da830_evm_nand_partitions[] = { 303static struct mtd_partition da830_evm_nand_partitions[] = {
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index c2dfe06563df..8a24b6c6339f 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -335,12 +335,7 @@ static const short da850_evm_nor_pins[] = {
335 -1 335 -1
336}; 336};
337 337
338#if defined(CONFIG_MMC_DAVINCI) || \ 338#define HAS_MMC IS_ENABLED(CONFIG_MMC_DAVINCI)
339 defined(CONFIG_MMC_DAVINCI_MODULE)
340#define HAS_MMC 1
341#else
342#define HAS_MMC 0
343#endif
344 339
345static inline void da850_evm_setup_nor_nand(void) 340static inline void da850_evm_setup_nor_nand(void)
346{ 341{
@@ -401,7 +396,7 @@ enum da850_evm_ui_exp_pins {
401 DA850_EVM_UI_EXP_PB1, 396 DA850_EVM_UI_EXP_PB1,
402}; 397};
403 398
404static const char const *da850_evm_ui_exp[] = { 399static const char * const da850_evm_ui_exp[] = {
405 [DA850_EVM_UI_EXP_SEL_C] = "sel_c", 400 [DA850_EVM_UI_EXP_SEL_C] = "sel_c",
406 [DA850_EVM_UI_EXP_SEL_B] = "sel_b", 401 [DA850_EVM_UI_EXP_SEL_B] = "sel_b",
407 [DA850_EVM_UI_EXP_SEL_A] = "sel_a", 402 [DA850_EVM_UI_EXP_SEL_A] = "sel_a",
@@ -565,7 +560,7 @@ enum da850_evm_bb_exp_pins {
565 DA850_EVM_BB_EXP_USER_SW8 560 DA850_EVM_BB_EXP_USER_SW8
566}; 561};
567 562
568static const char const *da850_evm_bb_exp[] = { 563static const char * const da850_evm_bb_exp[] = {
569 [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en", 564 [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en",
570 [DA850_EVM_BB_EXP_SW_RST] = "sw_rst", 565 [DA850_EVM_BB_EXP_SW_RST] = "sw_rst",
571 [DA850_EVM_BB_EXP_TP_23] = "tp_23", 566 [DA850_EVM_BB_EXP_TP_23] = "tp_23",
@@ -802,7 +797,6 @@ static struct davinci_mmc_config da850_mmc_config = {
802 .wires = 4, 797 .wires = 4,
803 .max_freq = 50000000, 798 .max_freq = 50000000,
804 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 799 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
805 .version = MMC_CTLR_VERSION_2,
806}; 800};
807 801
808static const short da850_evm_mmcsd0_pins[] __initconst = { 802static const short da850_evm_mmcsd0_pins[] __initconst = {
@@ -1372,7 +1366,6 @@ static struct davinci_mmc_config da850_wl12xx_mmc_config = {
1372 .max_freq = 25000000, 1366 .max_freq = 25000000,
1373 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE | 1367 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
1374 MMC_CAP_POWER_OFF_CARD, 1368 MMC_CAP_POWER_OFF_CARD,
1375 .version = MMC_CTLR_VERSION_2,
1376}; 1369};
1377 1370
1378static const short da850_wl12xx_pins[] __initconst = { 1371static const short da850_wl12xx_pins[] __initconst = {
@@ -1579,6 +1572,11 @@ static __init void da850_evm_init(void)
1579 pr_warn("%s: SATA registration failed: %d\n", __func__, ret); 1572 pr_warn("%s: SATA registration failed: %d\n", __func__, ret);
1580 1573
1581 da850_evm_setup_mac_addr(); 1574 da850_evm_setup_mac_addr();
1575
1576 ret = da8xx_register_rproc();
1577 if (ret)
1578 pr_warn("%s: dsp/rproc registration failed: %d\n",
1579 __func__, ret);
1582} 1580}
1583 1581
1584#ifdef CONFIG_SERIAL_8250_CONSOLE 1582#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -1606,4 +1604,5 @@ MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
1606 .init_late = davinci_init_late, 1604 .init_late = davinci_init_late,
1607 .dma_zone_size = SZ_128M, 1605 .dma_zone_size = SZ_128M,
1608 .restart = da8xx_restart, 1606 .restart = da8xx_restart,
1607 .reserve = da8xx_rproc_reserve_cma,
1609MACHINE_END 1608MACHINE_END
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 147b8e1a4407..c2a0a67d09e0 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -242,6 +242,73 @@ static struct vpfe_config vpfe_cfg = {
242 .ccdc = "DM355 CCDC", 242 .ccdc = "DM355 CCDC",
243}; 243};
244 244
245/* venc standards timings */
246static struct vpbe_enc_mode_info dm355evm_enc_preset_timing[] = {
247 {
248 .name = "ntsc",
249 .timings_type = VPBE_ENC_STD,
250 .std_id = V4L2_STD_NTSC,
251 .interlaced = 1,
252 .xres = 720,
253 .yres = 480,
254 .aspect = {11, 10},
255 .fps = {30000, 1001},
256 .left_margin = 0x79,
257 .upper_margin = 0x10,
258 },
259 {
260 .name = "pal",
261 .timings_type = VPBE_ENC_STD,
262 .std_id = V4L2_STD_PAL,
263 .interlaced = 1,
264 .xres = 720,
265 .yres = 576,
266 .aspect = {54, 59},
267 .fps = {25, 1},
268 .left_margin = 0x7E,
269 .upper_margin = 0x16
270 },
271};
272
273#define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
274
275/*
276 * The outputs available from VPBE + ecnoders. Keep the
277 * the order same as that of encoders. First those from venc followed by that
278 * from encoders. Index in the output refers to index on a particular encoder.
279 * Driver uses this index to pass it to encoder when it supports more than
280 * one output. Application uses index of the array to set an output.
281 */
282static struct vpbe_output dm355evm_vpbe_outputs[] = {
283 {
284 .output = {
285 .index = 0,
286 .name = "Composite",
287 .type = V4L2_OUTPUT_TYPE_ANALOG,
288 .std = VENC_STD_ALL,
289 .capabilities = V4L2_OUT_CAP_STD,
290 },
291 .subdev_name = DM355_VPBE_VENC_SUBDEV_NAME,
292 .default_mode = "ntsc",
293 .num_modes = ARRAY_SIZE(dm355evm_enc_preset_timing),
294 .modes = dm355evm_enc_preset_timing,
295 .if_params = V4L2_MBUS_FMT_FIXED,
296 },
297};
298
299static struct vpbe_config dm355evm_display_cfg = {
300 .module_name = "dm355-vpbe-display",
301 .i2c_adapter_id = 1,
302 .osd = {
303 .module_name = DM355_VPBE_OSD_SUBDEV_NAME,
304 },
305 .venc = {
306 .module_name = DM355_VPBE_VENC_SUBDEV_NAME,
307 },
308 .num_outputs = ARRAY_SIZE(dm355evm_vpbe_outputs),
309 .outputs = dm355evm_vpbe_outputs,
310};
311
245static struct platform_device *davinci_evm_devices[] __initdata = { 312static struct platform_device *davinci_evm_devices[] __initdata = {
246 &dm355evm_dm9000, 313 &dm355evm_dm9000,
247 &davinci_nand_device, 314 &davinci_nand_device,
@@ -253,8 +320,6 @@ static struct davinci_uart_config uart_config __initdata = {
253 320
254static void __init dm355_evm_map_io(void) 321static void __init dm355_evm_map_io(void)
255{ 322{
256 /* setup input configuration for VPFE input devices */
257 dm355_set_vpfe_config(&vpfe_cfg);
258 dm355_init(); 323 dm355_init();
259} 324}
260 325
@@ -280,7 +345,6 @@ static struct davinci_mmc_config dm355evm_mmc_config = {
280 .wires = 4, 345 .wires = 4,
281 .max_freq = 50000000, 346 .max_freq = 50000000,
282 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 347 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
283 .version = MMC_CTLR_VERSION_1,
284}; 348};
285 349
286/* Don't connect anything to J10 unless you're only using USB host 350/* Don't connect anything to J10 unless you're only using USB host
@@ -344,6 +408,8 @@ static __init void dm355_evm_init(void)
344 davinci_setup_mmc(0, &dm355evm_mmc_config); 408 davinci_setup_mmc(0, &dm355evm_mmc_config);
345 davinci_setup_mmc(1, &dm355evm_mmc_config); 409 davinci_setup_mmc(1, &dm355evm_mmc_config);
346 410
411 dm355_init_video(&vpfe_cfg, &dm355evm_display_cfg);
412
347 dm355_init_spi0(BIT(0), dm355_evm_spi_info, 413 dm355_init_spi0(BIT(0), dm355_evm_spi_info,
348 ARRAY_SIZE(dm355_evm_spi_info)); 414 ARRAY_SIZE(dm355_evm_spi_info));
349 415
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index c2d4958a0cb6..fd38c8d22e3c 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -27,6 +27,7 @@
27#include <linux/input.h> 27#include <linux/input.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/spi/eeprom.h> 29#include <linux/spi/eeprom.h>
30#include <linux/v4l2-dv-timings.h>
30 31
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
@@ -39,6 +40,7 @@
39#include <linux/platform_data/mtd-davinci.h> 40#include <linux/platform_data/mtd-davinci.h>
40#include <linux/platform_data/keyscan-davinci.h> 41#include <linux/platform_data/keyscan-davinci.h>
41 42
43#include <media/ths7303.h>
42#include <media/tvp514x.h> 44#include <media/tvp514x.h>
43 45
44#include "davinci.h" 46#include "davinci.h"
@@ -253,7 +255,6 @@ static struct davinci_mmc_config dm365evm_mmc_config = {
253 .wires = 4, 255 .wires = 4,
254 .max_freq = 50000000, 256 .max_freq = 50000000,
255 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 257 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
256 .version = MMC_CTLR_VERSION_2,
257}; 258};
258 259
259static void dm365evm_emac_configure(void) 260static void dm365evm_emac_configure(void)
@@ -374,6 +375,166 @@ static struct vpfe_config vpfe_cfg = {
374 .ccdc = "ISIF", 375 .ccdc = "ISIF",
375}; 376};
376 377
378/* venc standards timings */
379static struct vpbe_enc_mode_info dm365evm_enc_std_timing[] = {
380 {
381 .name = "ntsc",
382 .timings_type = VPBE_ENC_STD,
383 .std_id = V4L2_STD_NTSC,
384 .interlaced = 1,
385 .xres = 720,
386 .yres = 480,
387 .aspect = {11, 10},
388 .fps = {30000, 1001},
389 .left_margin = 0x79,
390 .upper_margin = 0x10,
391 },
392 {
393 .name = "pal",
394 .timings_type = VPBE_ENC_STD,
395 .std_id = V4L2_STD_PAL,
396 .interlaced = 1,
397 .xres = 720,
398 .yres = 576,
399 .aspect = {54, 59},
400 .fps = {25, 1},
401 .left_margin = 0x7E,
402 .upper_margin = 0x16,
403 },
404};
405
406/* venc dv timings */
407static struct vpbe_enc_mode_info dm365evm_enc_preset_timing[] = {
408 {
409 .name = "480p59_94",
410 .timings_type = VPBE_ENC_DV_TIMINGS,
411 .dv_timings = V4L2_DV_BT_CEA_720X480P59_94,
412 .interlaced = 0,
413 .xres = 720,
414 .yres = 480,
415 .aspect = {1, 1},
416 .fps = {5994, 100},
417 .left_margin = 0x8F,
418 .upper_margin = 0x2D,
419 },
420 {
421 .name = "576p50",
422 .timings_type = VPBE_ENC_DV_TIMINGS,
423 .dv_timings = V4L2_DV_BT_CEA_720X576P50,
424 .interlaced = 0,
425 .xres = 720,
426 .yres = 576,
427 .aspect = {1, 1},
428 .fps = {50, 1},
429 .left_margin = 0x8C,
430 .upper_margin = 0x36,
431 },
432 {
433 .name = "720p60",
434 .timings_type = VPBE_ENC_DV_TIMINGS,
435 .dv_timings = V4L2_DV_BT_CEA_1280X720P60,
436 .interlaced = 0,
437 .xres = 1280,
438 .yres = 720,
439 .aspect = {1, 1},
440 .fps = {60, 1},
441 .left_margin = 0x117,
442 .right_margin = 70,
443 .upper_margin = 38,
444 .lower_margin = 3,
445 .hsync_len = 80,
446 .vsync_len = 5,
447 },
448 {
449 .name = "1080i60",
450 .timings_type = VPBE_ENC_DV_TIMINGS,
451 .dv_timings = V4L2_DV_BT_CEA_1920X1080I60,
452 .interlaced = 1,
453 .xres = 1920,
454 .yres = 1080,
455 .aspect = {1, 1},
456 .fps = {30, 1},
457 .left_margin = 0xc9,
458 .right_margin = 80,
459 .upper_margin = 30,
460 .lower_margin = 3,
461 .hsync_len = 88,
462 .vsync_len = 5,
463 },
464};
465
466#define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
467
468/*
469 * The outputs available from VPBE + ecnoders. Keep the
470 * the order same as that of encoders. First those from venc followed by that
471 * from encoders. Index in the output refers to index on a particular
472 * encoder.Driver uses this index to pass it to encoder when it supports more
473 * than one output. Application uses index of the array to set an output.
474 */
475static struct vpbe_output dm365evm_vpbe_outputs[] = {
476 {
477 .output = {
478 .index = 0,
479 .name = "Composite",
480 .type = V4L2_OUTPUT_TYPE_ANALOG,
481 .std = VENC_STD_ALL,
482 .capabilities = V4L2_OUT_CAP_STD,
483 },
484 .subdev_name = DM365_VPBE_VENC_SUBDEV_NAME,
485 .default_mode = "ntsc",
486 .num_modes = ARRAY_SIZE(dm365evm_enc_std_timing),
487 .modes = dm365evm_enc_std_timing,
488 .if_params = V4L2_MBUS_FMT_FIXED,
489 },
490 {
491 .output = {
492 .index = 1,
493 .name = "Component",
494 .type = V4L2_OUTPUT_TYPE_ANALOG,
495 .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
496 },
497 .subdev_name = DM365_VPBE_VENC_SUBDEV_NAME,
498 .default_mode = "480p59_94",
499 .num_modes = ARRAY_SIZE(dm365evm_enc_preset_timing),
500 .modes = dm365evm_enc_preset_timing,
501 .if_params = V4L2_MBUS_FMT_FIXED,
502 },
503};
504
505/*
506 * Amplifiers on the board
507 */
508struct ths7303_platform_data ths7303_pdata = {
509 .ch_1 = 3,
510 .ch_2 = 3,
511 .ch_3 = 3,
512 .init_enable = 1,
513};
514
515static struct amp_config_info vpbe_amp = {
516 .module_name = "ths7303",
517 .is_i2c = 1,
518 .board_info = {
519 I2C_BOARD_INFO("ths7303", 0x2c),
520 .platform_data = &ths7303_pdata,
521 }
522};
523
524static struct vpbe_config dm365evm_display_cfg = {
525 .module_name = "dm365-vpbe-display",
526 .i2c_adapter_id = 1,
527 .amp = &vpbe_amp,
528 .osd = {
529 .module_name = DM365_VPBE_OSD_SUBDEV_NAME,
530 },
531 .venc = {
532 .module_name = DM365_VPBE_VENC_SUBDEV_NAME,
533 },
534 .num_outputs = ARRAY_SIZE(dm365evm_vpbe_outputs),
535 .outputs = dm365evm_vpbe_outputs,
536};
537
377static void __init evm_init_i2c(void) 538static void __init evm_init_i2c(void)
378{ 539{
379 davinci_init_i2c(&i2c_pdata); 540 davinci_init_i2c(&i2c_pdata);
@@ -564,8 +725,6 @@ static struct davinci_uart_config uart_config __initdata = {
564 725
565static void __init dm365_evm_map_io(void) 726static void __init dm365_evm_map_io(void)
566{ 727{
567 /* setup input configuration for VPFE input devices */
568 dm365_set_vpfe_config(&vpfe_cfg);
569 dm365_init(); 728 dm365_init();
570} 729}
571 730
@@ -597,6 +756,8 @@ static __init void dm365_evm_init(void)
597 756
598 davinci_setup_mmc(0, &dm365evm_mmc_config); 757 davinci_setup_mmc(0, &dm365evm_mmc_config);
599 758
759 dm365_init_video(&vpfe_cfg, &dm365evm_display_cfg);
760
600 /* maybe setup mmc1/etc ... _after_ mmc0 */ 761 /* maybe setup mmc1/etc ... _after_ mmc0 */
601 evm_init_cpld(); 762 evm_init_cpld();
602 763
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 71735e7797cc..a33686a6fbb2 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -570,7 +570,6 @@ static struct davinci_mmc_config dm6446evm_mmc_config = {
570 .get_cd = dm6444evm_mmc_get_cd, 570 .get_cd = dm6444evm_mmc_get_cd,
571 .get_ro = dm6444evm_mmc_get_ro, 571 .get_ro = dm6444evm_mmc_get_ro,
572 .wires = 4, 572 .wires = 4,
573 .version = MMC_CTLR_VERSION_1
574}; 573};
575 574
576static struct i2c_board_info __initdata i2c_info[] = { 575static struct i2c_board_info __initdata i2c_info[] = {
@@ -622,7 +621,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
622 { 621 {
623 .name = "ntsc", 622 .name = "ntsc",
624 .timings_type = VPBE_ENC_STD, 623 .timings_type = VPBE_ENC_STD,
625 .std_id = V4L2_STD_525_60, 624 .std_id = V4L2_STD_NTSC,
626 .interlaced = 1, 625 .interlaced = 1,
627 .xres = 720, 626 .xres = 720,
628 .yres = 480, 627 .yres = 480,
@@ -634,7 +633,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
634 { 633 {
635 .name = "pal", 634 .name = "pal",
636 .timings_type = VPBE_ENC_STD, 635 .timings_type = VPBE_ENC_STD,
637 .std_id = V4L2_STD_625_50, 636 .std_id = V4L2_STD_PAL,
638 .interlaced = 1, 637 .interlaced = 1,
639 .xres = 720, 638 .xres = 720,
640 .yres = 576, 639 .yres = 576,
@@ -649,7 +648,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
649static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = { 648static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
650 { 649 {
651 .name = "480p59_94", 650 .name = "480p59_94",
652 .timings_type = VPBE_ENC_CUSTOM_TIMINGS, 651 .timings_type = VPBE_ENC_DV_TIMINGS,
653 .dv_timings = V4L2_DV_BT_CEA_720X480P59_94, 652 .dv_timings = V4L2_DV_BT_CEA_720X480P59_94,
654 .interlaced = 0, 653 .interlaced = 0,
655 .xres = 720, 654 .xres = 720,
@@ -661,7 +660,7 @@ static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
661 }, 660 },
662 { 661 {
663 .name = "576p50", 662 .name = "576p50",
664 .timings_type = VPBE_ENC_CUSTOM_TIMINGS, 663 .timings_type = VPBE_ENC_DV_TIMINGS,
665 .dv_timings = V4L2_DV_BT_CEA_720X576P50, 664 .dv_timings = V4L2_DV_BT_CEA_720X576P50,
666 .interlaced = 0, 665 .interlaced = 0,
667 .xres = 720, 666 .xres = 720,
@@ -750,26 +749,11 @@ static int davinci_phy_fixup(struct phy_device *phydev)
750 return 0; 749 return 0;
751} 750}
752 751
753#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 752#define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
754 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 753
755#define HAS_ATA 1 754#define HAS_NOR IS_ENABLED(CONFIG_MTD_PHYSMAP)
756#else 755
757#define HAS_ATA 0 756#define HAS_NAND IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
758#endif
759
760#if defined(CONFIG_MTD_PHYSMAP) || \
761 defined(CONFIG_MTD_PHYSMAP_MODULE)
762#define HAS_NOR 1
763#else
764#define HAS_NOR 0
765#endif
766
767#if defined(CONFIG_MTD_NAND_DAVINCI) || \
768 defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
769#define HAS_NAND 1
770#else
771#define HAS_NAND 0
772#endif
773 757
774static __init void davinci_evm_init(void) 758static __init void davinci_evm_init(void)
775{ 759{
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index de7adff324dc..fbb8e5ab1dc1 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -117,12 +117,7 @@ static struct platform_device davinci_nand_device = {
117 }, 117 },
118}; 118};
119 119
120#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 120#define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
121 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
122#define HAS_ATA 1
123#else
124#define HAS_ATA 0
125#endif
126 121
127/* CPLD Register 0 bits to control ATA */ 122/* CPLD Register 0 bits to control ATA */
128#define DM646X_EVM_ATA_RST BIT(0) 123#define DM646X_EVM_ATA_RST BIT(0)
@@ -514,7 +509,7 @@ static const struct vpif_output dm6467_ch0_outputs[] = {
514 .index = 1, 509 .index = 1,
515 .name = "Component", 510 .name = "Component",
516 .type = V4L2_OUTPUT_TYPE_ANALOG, 511 .type = V4L2_OUTPUT_TYPE_ANALOG,
517 .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS, 512 .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
518 }, 513 },
519 .subdev_name = "adv7343", 514 .subdev_name = "adv7343",
520 .output_route = ADV7343_COMPONENT_ID, 515 .output_route = ADV7343_COMPONENT_ID,
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 1c98107527fa..2bc112adf565 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -164,23 +164,11 @@ static void __init davinci_ntosd2_map_io(void)
164 164
165static struct davinci_mmc_config davinci_ntosd2_mmc_config = { 165static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
166 .wires = 4, 166 .wires = 4,
167 .version = MMC_CTLR_VERSION_1
168}; 167};
169 168
169#define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
170 170
171#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 171#define HAS_NAND IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
172 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
173#define HAS_ATA 1
174#else
175#define HAS_ATA 0
176#endif
177
178#if defined(CONFIG_MTD_NAND_DAVINCI) || \
179 defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
180#define HAS_NAND 1
181#else
182#define HAS_NAND 0
183#endif
184 172
185static __init void davinci_ntosd2_init(void) 173static __init void davinci_ntosd2_init(void)
186{ 174{
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index 5a2bd44da54d..b8c20de10ca2 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -136,7 +136,6 @@ static struct davinci_mmc_config da850_mmc_config = {
136 .wires = 4, 136 .wires = 4,
137 .max_freq = 50000000, 137 .max_freq = 50000000,
138 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 138 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
139 .version = MMC_CTLR_VERSION_2,
140}; 139};
141 140
142static __init void omapl138_hawk_mmc_init(void) 141static __init void omapl138_hawk_mmc_init(void)
@@ -311,6 +310,11 @@ static __init void omapl138_hawk_init(void)
311 if (ret) 310 if (ret)
312 pr_warn("%s: watchdog registration failed: %d\n", 311 pr_warn("%s: watchdog registration failed: %d\n",
313 __func__, ret); 312 __func__, ret);
313
314 ret = da8xx_register_rproc();
315 if (ret)
316 pr_warn("%s: dsp/rproc registration failed: %d\n",
317 __func__, ret);
314} 318}
315 319
316#ifdef CONFIG_SERIAL_8250_CONSOLE 320#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -338,4 +342,5 @@ MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
338 .init_late = davinci_init_late, 342 .init_late = davinci_init_late,
339 .dma_zone_size = SZ_128M, 343 .dma_zone_size = SZ_128M,
340 .restart = da8xx_restart, 344 .restart = da8xx_restart,
345 .reserve = da8xx_rproc_reserve_cma,
341MACHINE_END 346MACHINE_END
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index 4f416023d4e2..ba798370fc96 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -85,7 +85,6 @@ static struct davinci_mmc_config mmc_config = {
85 .wires = 4, 85 .wires = 4,
86 .max_freq = 50000000, 86 .max_freq = 50000000,
87 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 87 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
88 .version = MMC_CTLR_VERSION_1,
89}; 88};
90 89
91static const short sdio1_pins[] __initconst = { 90static const short sdio1_pins[] __initconst = {
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index d458558ee84a..dc9a470ff9c5 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -35,19 +35,26 @@ static void __clk_enable(struct clk *clk)
35{ 35{
36 if (clk->parent) 36 if (clk->parent)
37 __clk_enable(clk->parent); 37 __clk_enable(clk->parent);
38 if (clk->usecount++ == 0 && (clk->flags & CLK_PSC)) 38 if (clk->usecount++ == 0) {
39 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 39 if (clk->flags & CLK_PSC)
40 true, clk->flags); 40 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
41 true, clk->flags);
42 else if (clk->clk_enable)
43 clk->clk_enable(clk);
44 }
41} 45}
42 46
43static void __clk_disable(struct clk *clk) 47static void __clk_disable(struct clk *clk)
44{ 48{
45 if (WARN_ON(clk->usecount == 0)) 49 if (WARN_ON(clk->usecount == 0))
46 return; 50 return;
47 if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) && 51 if (--clk->usecount == 0) {
48 (clk->flags & CLK_PSC)) 52 if (!(clk->flags & CLK_PLL) && (clk->flags & CLK_PSC))
49 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 53 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
50 false, clk->flags); 54 false, clk->flags);
55 else if (clk->clk_disable)
56 clk->clk_disable(clk);
57 }
51 if (clk->parent) 58 if (clk->parent)
52 __clk_disable(clk->parent); 59 __clk_disable(clk->parent);
53} 60}
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 8694b395fc92..1e4e836173a1 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -104,6 +104,8 @@ struct clk {
104 int (*set_rate) (struct clk *clk, unsigned long rate); 104 int (*set_rate) (struct clk *clk, unsigned long rate);
105 int (*round_rate) (struct clk *clk, unsigned long rate); 105 int (*round_rate) (struct clk *clk, unsigned long rate);
106 int (*reset) (struct clk *clk, bool reset); 106 int (*reset) (struct clk *clk, bool reset);
107 void (*clk_enable) (struct clk *clk);
108 void (*clk_disable) (struct clk *clk);
107}; 109};
108 110
109/* Clock flags: SoC-specific flags start at BIT(16) */ 111/* Clock flags: SoC-specific flags start at BIT(16) */
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
deleted file mode 100644
index 4729eaab0f40..000000000000
--- a/arch/arm/mach-davinci/cpufreq.c
+++ /dev/null
@@ -1,248 +0,0 @@
1/*
2 * CPU frequency scaling for DaVinci
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Based on linux/arch/arm/plat-omap/cpu-omap.c. Original Copyright follows:
7 *
8 * Copyright (C) 2005 Nokia Corporation
9 * Written by Tony Lindgren <tony@atomide.com>
10 *
11 * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
12 *
13 * Copyright (C) 2007-2008 Texas Instruments, Inc.
14 * Updated to support OMAP3
15 * Rajendra Nayak <rnayak@ti.com>
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21#include <linux/types.h>
22#include <linux/cpufreq.h>
23#include <linux/init.h>
24#include <linux/err.h>
25#include <linux/clk.h>
26#include <linux/platform_device.h>
27#include <linux/export.h>
28
29#include <mach/hardware.h>
30#include <mach/cpufreq.h>
31#include <mach/common.h>
32
33#include "clock.h"
34
35struct davinci_cpufreq {
36 struct device *dev;
37 struct clk *armclk;
38 struct clk *asyncclk;
39 unsigned long asyncrate;
40};
41static struct davinci_cpufreq cpufreq;
42
43static int davinci_verify_speed(struct cpufreq_policy *policy)
44{
45 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
46 struct cpufreq_frequency_table *freq_table = pdata->freq_table;
47 struct clk *armclk = cpufreq.armclk;
48
49 if (freq_table)
50 return cpufreq_frequency_table_verify(policy, freq_table);
51
52 if (policy->cpu)
53 return -EINVAL;
54
55 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
56 policy->cpuinfo.max_freq);
57
58 policy->min = clk_round_rate(armclk, policy->min * 1000) / 1000;
59 policy->max = clk_round_rate(armclk, policy->max * 1000) / 1000;
60 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
61 policy->cpuinfo.max_freq);
62 return 0;
63}
64
65static unsigned int davinci_getspeed(unsigned int cpu)
66{
67 if (cpu)
68 return 0;
69
70 return clk_get_rate(cpufreq.armclk) / 1000;
71}
72
73static int davinci_target(struct cpufreq_policy *policy,
74 unsigned int target_freq, unsigned int relation)
75{
76 int ret = 0;
77 unsigned int idx;
78 struct cpufreq_freqs freqs;
79 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
80 struct clk *armclk = cpufreq.armclk;
81
82 /*
83 * Ensure desired rate is within allowed range. Some govenors
84 * (ondemand) will just pass target_freq=0 to get the minimum.
85 */
86 if (target_freq < policy->cpuinfo.min_freq)
87 target_freq = policy->cpuinfo.min_freq;
88 if (target_freq > policy->cpuinfo.max_freq)
89 target_freq = policy->cpuinfo.max_freq;
90
91 freqs.old = davinci_getspeed(0);
92 freqs.new = clk_round_rate(armclk, target_freq * 1000) / 1000;
93 freqs.cpu = 0;
94
95 if (freqs.old == freqs.new)
96 return ret;
97
98 dev_dbg(cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new);
99
100 ret = cpufreq_frequency_table_target(policy, pdata->freq_table,
101 freqs.new, relation, &idx);
102 if (ret)
103 return -EINVAL;
104
105 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
106
107 /* if moving to higher frequency, up the voltage beforehand */
108 if (pdata->set_voltage && freqs.new > freqs.old) {
109 ret = pdata->set_voltage(idx);
110 if (ret)
111 goto out;
112 }
113
114 ret = clk_set_rate(armclk, idx);
115 if (ret)
116 goto out;
117
118 if (cpufreq.asyncclk) {
119 ret = clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate);
120 if (ret)
121 goto out;
122 }
123
124 /* if moving to lower freq, lower the voltage after lowering freq */
125 if (pdata->set_voltage && freqs.new < freqs.old)
126 pdata->set_voltage(idx);
127
128out:
129 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
130
131 return ret;
132}
133
134static int davinci_cpu_init(struct cpufreq_policy *policy)
135{
136 int result = 0;
137 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
138 struct cpufreq_frequency_table *freq_table = pdata->freq_table;
139
140 if (policy->cpu != 0)
141 return -EINVAL;
142
143 /* Finish platform specific initialization */
144 if (pdata->init) {
145 result = pdata->init();
146 if (result)
147 return result;
148 }
149
150 policy->cur = policy->min = policy->max = davinci_getspeed(0);
151
152 if (freq_table) {
153 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
154 if (!result)
155 cpufreq_frequency_table_get_attr(freq_table,
156 policy->cpu);
157 } else {
158 policy->cpuinfo.min_freq = policy->min;
159 policy->cpuinfo.max_freq = policy->max;
160 }
161
162 policy->min = policy->cpuinfo.min_freq;
163 policy->max = policy->cpuinfo.max_freq;
164 policy->cur = davinci_getspeed(0);
165
166 /*
167 * Time measurement across the target() function yields ~1500-1800us
168 * time taken with no drivers on notification list.
169 * Setting the latency to 2000 us to accommodate addition of drivers
170 * to pre/post change notification list.
171 */
172 policy->cpuinfo.transition_latency = 2000 * 1000;
173 return 0;
174}
175
176static int davinci_cpu_exit(struct cpufreq_policy *policy)
177{
178 cpufreq_frequency_table_put_attr(policy->cpu);
179 return 0;
180}
181
182static struct freq_attr *davinci_cpufreq_attr[] = {
183 &cpufreq_freq_attr_scaling_available_freqs,
184 NULL,
185};
186
187static struct cpufreq_driver davinci_driver = {
188 .flags = CPUFREQ_STICKY,
189 .verify = davinci_verify_speed,
190 .target = davinci_target,
191 .get = davinci_getspeed,
192 .init = davinci_cpu_init,
193 .exit = davinci_cpu_exit,
194 .name = "davinci",
195 .attr = davinci_cpufreq_attr,
196};
197
198static int __init davinci_cpufreq_probe(struct platform_device *pdev)
199{
200 struct davinci_cpufreq_config *pdata = pdev->dev.platform_data;
201 struct clk *asyncclk;
202
203 if (!pdata)
204 return -EINVAL;
205 if (!pdata->freq_table)
206 return -EINVAL;
207
208 cpufreq.dev = &pdev->dev;
209
210 cpufreq.armclk = clk_get(NULL, "arm");
211 if (IS_ERR(cpufreq.armclk)) {
212 dev_err(cpufreq.dev, "Unable to get ARM clock\n");
213 return PTR_ERR(cpufreq.armclk);
214 }
215
216 asyncclk = clk_get(cpufreq.dev, "async");
217 if (!IS_ERR(asyncclk)) {
218 cpufreq.asyncclk = asyncclk;
219 cpufreq.asyncrate = clk_get_rate(asyncclk);
220 }
221
222 return cpufreq_register_driver(&davinci_driver);
223}
224
225static int __exit davinci_cpufreq_remove(struct platform_device *pdev)
226{
227 clk_put(cpufreq.armclk);
228
229 if (cpufreq.asyncclk)
230 clk_put(cpufreq.asyncclk);
231
232 return cpufreq_unregister_driver(&davinci_driver);
233}
234
235static struct platform_driver davinci_cpufreq_driver = {
236 .driver = {
237 .name = "cpufreq-davinci",
238 .owner = THIS_MODULE,
239 },
240 .remove = __exit_p(davinci_cpufreq_remove),
241};
242
243int __init davinci_cpufreq_init(void)
244{
245 return platform_driver_probe(&davinci_cpufreq_driver,
246 davinci_cpufreq_probe);
247}
248
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
index 5ac9e9384b15..36aef3a7dedb 100644
--- a/arch/arm/mach-davinci/cpuidle.c
+++ b/arch/arm/mach-davinci/cpuidle.c
@@ -25,7 +25,6 @@
25 25
26#define DAVINCI_CPUIDLE_MAX_STATES 2 26#define DAVINCI_CPUIDLE_MAX_STATES 2
27 27
28static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device);
29static void __iomem *ddr2_reg_base; 28static void __iomem *ddr2_reg_base;
30static bool ddr2_pdown; 29static bool ddr2_pdown;
31 30
@@ -50,14 +49,10 @@ static void davinci_save_ddr_power(int enter, bool pdown)
50 49
51/* Actual code that puts the SoC in different idle states */ 50/* Actual code that puts the SoC in different idle states */
52static int davinci_enter_idle(struct cpuidle_device *dev, 51static int davinci_enter_idle(struct cpuidle_device *dev,
53 struct cpuidle_driver *drv, 52 struct cpuidle_driver *drv, int index)
54 int index)
55{ 53{
56 davinci_save_ddr_power(1, ddr2_pdown); 54 davinci_save_ddr_power(1, ddr2_pdown);
57 55 cpu_do_idle();
58 index = cpuidle_wrap_enter(dev, drv, index,
59 arm_cpuidle_simple_enter);
60
61 davinci_save_ddr_power(0, ddr2_pdown); 56 davinci_save_ddr_power(0, ddr2_pdown);
62 57
63 return index; 58 return index;
@@ -66,7 +61,6 @@ static int davinci_enter_idle(struct cpuidle_device *dev,
66static struct cpuidle_driver davinci_idle_driver = { 61static struct cpuidle_driver davinci_idle_driver = {
67 .name = "cpuidle-davinci", 62 .name = "cpuidle-davinci",
68 .owner = THIS_MODULE, 63 .owner = THIS_MODULE,
69 .en_core_tk_irqen = 1,
70 .states[0] = ARM_CPUIDLE_WFI_STATE, 64 .states[0] = ARM_CPUIDLE_WFI_STATE,
71 .states[1] = { 65 .states[1] = {
72 .enter = davinci_enter_idle, 66 .enter = davinci_enter_idle,
@@ -81,12 +75,8 @@ static struct cpuidle_driver davinci_idle_driver = {
81 75
82static int __init davinci_cpuidle_probe(struct platform_device *pdev) 76static int __init davinci_cpuidle_probe(struct platform_device *pdev)
83{ 77{
84 int ret;
85 struct cpuidle_device *device;
86 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; 78 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
87 79
88 device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
89
90 if (!pdata) { 80 if (!pdata) {
91 dev_err(&pdev->dev, "cannot get platform data\n"); 81 dev_err(&pdev->dev, "cannot get platform data\n");
92 return -ENOENT; 82 return -ENOENT;
@@ -96,20 +86,7 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
96 86
97 ddr2_pdown = pdata->ddr2_pdown; 87 ddr2_pdown = pdata->ddr2_pdown;
98 88
99 ret = cpuidle_register_driver(&davinci_idle_driver); 89 return cpuidle_register(&davinci_idle_driver, NULL);
100 if (ret) {
101 dev_err(&pdev->dev, "failed to register driver\n");
102 return ret;
103 }
104
105 ret = cpuidle_register_device(device);
106 if (ret) {
107 dev_err(&pdev->dev, "failed to register device\n");
108 cpuidle_unregister_driver(&davinci_idle_driver);
109 return ret;
110 }
111
112 return 0;
113} 90}
114 91
115static struct platform_driver davinci_cpuidle_driver = { 92static struct platform_driver davinci_cpuidle_driver = {
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 678a54a64dae..abbaf0270be6 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -394,7 +394,7 @@ static struct clk_lookup da830_clks[] = {
394 CLK(NULL, "tpcc", &tpcc_clk), 394 CLK(NULL, "tpcc", &tpcc_clk),
395 CLK(NULL, "tptc0", &tptc0_clk), 395 CLK(NULL, "tptc0", &tptc0_clk),
396 CLK(NULL, "tptc1", &tptc1_clk), 396 CLK(NULL, "tptc1", &tptc1_clk),
397 CLK("davinci_mmc.0", NULL, &mmcsd_clk), 397 CLK("da830-mmc.0", NULL, &mmcsd_clk),
398 CLK(NULL, "uart0", &uart0_clk), 398 CLK(NULL, "uart0", &uart0_clk),
399 CLK(NULL, "uart1", &uart1_clk), 399 CLK(NULL, "uart1", &uart1_clk),
400 CLK(NULL, "uart2", &uart2_clk), 400 CLK(NULL, "uart2", &uart2_clk),
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0c4a26ddebba..4d6933848abf 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -383,6 +383,49 @@ static struct clk dsp_clk = {
383 .flags = PSC_LRST | PSC_FORCE, 383 .flags = PSC_LRST | PSC_FORCE,
384}; 384};
385 385
386static struct clk ehrpwm_clk = {
387 .name = "ehrpwm",
388 .parent = &pll0_sysclk2,
389 .lpsc = DA8XX_LPSC1_PWM,
390 .gpsc = 1,
391 .flags = DA850_CLK_ASYNC3,
392};
393
394#define DA8XX_EHRPWM_TBCLKSYNC BIT(12)
395
396static void ehrpwm_tblck_enable(struct clk *clk)
397{
398 u32 val;
399
400 val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
401 val |= DA8XX_EHRPWM_TBCLKSYNC;
402 writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
403}
404
405static void ehrpwm_tblck_disable(struct clk *clk)
406{
407 u32 val;
408
409 val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
410 val &= ~DA8XX_EHRPWM_TBCLKSYNC;
411 writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG));
412}
413
414static struct clk ehrpwm_tbclk = {
415 .name = "ehrpwm_tbclk",
416 .parent = &ehrpwm_clk,
417 .clk_enable = ehrpwm_tblck_enable,
418 .clk_disable = ehrpwm_tblck_disable,
419};
420
421static struct clk ecap_clk = {
422 .name = "ecap",
423 .parent = &pll0_sysclk2,
424 .lpsc = DA8XX_LPSC1_ECAP,
425 .gpsc = 1,
426 .flags = DA850_CLK_ASYNC3,
427};
428
386static struct clk_lookup da850_clks[] = { 429static struct clk_lookup da850_clks[] = {
387 CLK(NULL, "ref", &ref_clk), 430 CLK(NULL, "ref", &ref_clk),
388 CLK(NULL, "pll0", &pll0_clk), 431 CLK(NULL, "pll0", &pll0_clk),
@@ -420,8 +463,8 @@ static struct clk_lookup da850_clks[] = {
420 CLK("davinci_emac.1", NULL, &emac_clk), 463 CLK("davinci_emac.1", NULL, &emac_clk),
421 CLK("davinci-mcasp.0", NULL, &mcasp_clk), 464 CLK("davinci-mcasp.0", NULL, &mcasp_clk),
422 CLK("da8xx_lcdc.0", "fck", &lcdc_clk), 465 CLK("da8xx_lcdc.0", "fck", &lcdc_clk),
423 CLK("davinci_mmc.0", NULL, &mmcsd0_clk), 466 CLK("da830-mmc.0", NULL, &mmcsd0_clk),
424 CLK("davinci_mmc.1", NULL, &mmcsd1_clk), 467 CLK("da830-mmc.1", NULL, &mmcsd1_clk),
425 CLK(NULL, "aemif", &aemif_clk), 468 CLK(NULL, "aemif", &aemif_clk),
426 CLK(NULL, "usb11", &usb11_clk), 469 CLK(NULL, "usb11", &usb11_clk),
427 CLK(NULL, "usb20", &usb20_clk), 470 CLK(NULL, "usb20", &usb20_clk),
@@ -430,6 +473,9 @@ static struct clk_lookup da850_clks[] = {
430 CLK("vpif", NULL, &vpif_clk), 473 CLK("vpif", NULL, &vpif_clk),
431 CLK("ahci", NULL, &sata_clk), 474 CLK("ahci", NULL, &sata_clk),
432 CLK("davinci-rproc.0", NULL, &dsp_clk), 475 CLK("davinci-rproc.0", NULL, &dsp_clk),
476 CLK("ehrpwm", "fck", &ehrpwm_clk),
477 CLK("ehrpwm", "tbclk", &ehrpwm_tbclk),
478 CLK("ecap", "fck", &ecap_clk),
433 CLK(NULL, NULL, NULL), 479 CLK(NULL, NULL, NULL),
434}; 480};
435 481
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 6b7a0a27fbd1..b1c0a5958275 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -20,7 +20,7 @@
20 20
21#define DA8XX_NUM_UARTS 3 21#define DA8XX_NUM_UARTS 3
22 22
23void __init da8xx_uart_clk_enable(void) 23static void __init da8xx_uart_clk_enable(void)
24{ 24{
25 int i; 25 int i;
26 for (i = 0; i < DA8XX_NUM_UARTS; i++) 26 for (i = 0; i < DA8XX_NUM_UARTS; i++)
@@ -37,9 +37,10 @@ static void __init da8xx_init_irq(void)
37 of_irq_init(da8xx_irq_match); 37 of_irq_init(da8xx_irq_match);
38} 38}
39 39
40struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { 40static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
41 OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), 41 OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
42 OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL), 42 OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
43 OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL),
43 {} 44 {}
44}; 45};
45 46
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 12d544befcfa..1ab3df423dac 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -36,12 +36,19 @@
36#include <media/davinci/vpbe_osd.h> 36#include <media/davinci/vpbe_osd.h>
37 37
38#define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000 38#define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000
39#define SYSMOD_VDAC_CONFIG 0x2c
39#define SYSMOD_VIDCLKCTL 0x38 40#define SYSMOD_VIDCLKCTL 0x38
40#define SYSMOD_VPSS_CLKCTL 0x44 41#define SYSMOD_VPSS_CLKCTL 0x44
41#define SYSMOD_VDD3P3VPWDN 0x48 42#define SYSMOD_VDD3P3VPWDN 0x48
42#define SYSMOD_VSCLKDIS 0x6c 43#define SYSMOD_VSCLKDIS 0x6c
43#define SYSMOD_PUPDCTL1 0x7c 44#define SYSMOD_PUPDCTL1 0x7c
44 45
46/* VPSS CLKCTL bit definitions */
47#define VPSS_MUXSEL_EXTCLK_ENABLE BIT(1)
48#define VPSS_VENCCLKEN_ENABLE BIT(3)
49#define VPSS_DACCLKEN_ENABLE BIT(4)
50#define VPSS_PLLC2SYSCLK5_ENABLE BIT(5)
51
45extern void __iomem *davinci_sysmod_base; 52extern void __iomem *davinci_sysmod_base;
46#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x)) 53#define DAVINCI_SYSMOD_VIRT(x) (davinci_sysmod_base + (x))
47void davinci_map_sysmod(void); 54void davinci_map_sysmod(void);
@@ -74,7 +81,7 @@ void __init dm355_init(void);
74void dm355_init_spi0(unsigned chipselect_mask, 81void dm355_init_spi0(unsigned chipselect_mask,
75 const struct spi_board_info *info, unsigned len); 82 const struct spi_board_info *info, unsigned len);
76void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); 83void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
77void dm355_set_vpfe_config(struct vpfe_config *cfg); 84int dm355_init_video(struct vpfe_config *, struct vpbe_config *);
78 85
79/* DM365 function declarations */ 86/* DM365 function declarations */
80void __init dm365_init(void); 87void __init dm365_init(void);
@@ -84,7 +91,7 @@ void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
84void __init dm365_init_rtc(void); 91void __init dm365_init_rtc(void);
85void dm365_init_spi0(unsigned chipselect_mask, 92void dm365_init_spi0(unsigned chipselect_mask,
86 const struct spi_board_info *info, unsigned len); 93 const struct spi_board_info *info, unsigned len);
87void dm365_set_vpfe_config(struct vpfe_config *cfg); 94int dm365_init_video(struct vpfe_config *, struct vpbe_config *);
88 95
89/* DM644x function declarations */ 96/* DM644x function declarations */
90void __init dm644x_init(void); 97void __init dm644x_init(void);
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index fc50243b1481..bf572525175d 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-contiguous.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/ahci_platform.h> 17#include <linux/ahci_platform.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
@@ -664,7 +664,7 @@ static struct resource da8xx_mmcsd0_resources[] = {
664}; 664};
665 665
666static struct platform_device da8xx_mmcsd0_device = { 666static struct platform_device da8xx_mmcsd0_device = {
667 .name = "davinci_mmc", 667 .name = "da830-mmc",
668 .id = 0, 668 .id = 0,
669 .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources), 669 .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources),
670 .resource = da8xx_mmcsd0_resources, 670 .resource = da8xx_mmcsd0_resources,
@@ -701,7 +701,7 @@ static struct resource da850_mmcsd1_resources[] = {
701}; 701};
702 702
703static struct platform_device da850_mmcsd1_device = { 703static struct platform_device da850_mmcsd1_device = {
704 .name = "davinci_mmc", 704 .name = "da830-mmc",
705 .id = 1, 705 .id = 1,
706 .num_resources = ARRAY_SIZE(da850_mmcsd1_resources), 706 .num_resources = ARRAY_SIZE(da850_mmcsd1_resources),
707 .resource = da850_mmcsd1_resources, 707 .resource = da850_mmcsd1_resources,
@@ -714,6 +714,92 @@ int __init da850_register_mmcsd1(struct davinci_mmc_config *config)
714} 714}
715#endif 715#endif
716 716
717static struct resource da8xx_rproc_resources[] = {
718 { /* DSP boot address */
719 .start = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG,
720 .end = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG + 3,
721 .flags = IORESOURCE_MEM,
722 },
723 { /* DSP interrupt registers */
724 .start = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG,
725 .end = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG + 7,
726 .flags = IORESOURCE_MEM,
727 },
728 { /* dsp irq */
729 .start = IRQ_DA8XX_CHIPINT0,
730 .end = IRQ_DA8XX_CHIPINT0,
731 .flags = IORESOURCE_IRQ,
732 },
733};
734
735static struct platform_device da8xx_dsp = {
736 .name = "davinci-rproc",
737 .dev = {
738 .coherent_dma_mask = DMA_BIT_MASK(32),
739 },
740 .num_resources = ARRAY_SIZE(da8xx_rproc_resources),
741 .resource = da8xx_rproc_resources,
742};
743
744#if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC)
745
746static phys_addr_t rproc_base __initdata;
747static unsigned long rproc_size __initdata;
748
749static int __init early_rproc_mem(char *p)
750{
751 char *endp;
752
753 if (p == NULL)
754 return 0;
755
756 rproc_size = memparse(p, &endp);
757 if (*endp == '@')
758 rproc_base = memparse(endp + 1, NULL);
759
760 return 0;
761}
762early_param("rproc_mem", early_rproc_mem);
763
764void __init da8xx_rproc_reserve_cma(void)
765{
766 int ret;
767
768 if (!rproc_base || !rproc_size) {
769 pr_err("%s: 'rproc_mem=nn@address' badly specified\n"
770 " 'nn' and 'address' must both be non-zero\n",
771 __func__);
772
773 return;
774 }
775
776 pr_info("%s: reserving 0x%lx @ 0x%lx...\n",
777 __func__, rproc_size, (unsigned long)rproc_base);
778
779 ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0);
780 if (ret)
781 pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret);
782}
783
784#else
785
786void __init da8xx_rproc_reserve_cma(void)
787{
788}
789
790#endif
791
792int __init da8xx_register_rproc(void)
793{
794 int ret;
795
796 ret = platform_device_register(&da8xx_dsp);
797 if (ret)
798 pr_err("%s: can't register DSP device: %d\n", __func__, ret);
799
800 return ret;
801};
802
717static struct resource da8xx_rtc_resources[] = { 803static struct resource da8xx_rtc_resources[] = {
718 { 804 {
719 .start = DA8XX_RTC_BASE, 805 .start = DA8XX_RTC_BASE,
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index 773ab07a71a0..cfb194df18ed 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -218,7 +218,7 @@ static u64 mmc1_dma_mask = DMA_BIT_MASK(32);
218 218
219static struct platform_device mmc_devices[2] = { 219static struct platform_device mmc_devices[2] = {
220 { 220 {
221 .name = "davinci_mmc", 221 .name = "dm6441-mmc",
222 .id = 0, 222 .id = 0,
223 .dev = { 223 .dev = {
224 .dma_mask = &mmc0_dma_mask, 224 .dma_mask = &mmc0_dma_mask,
@@ -228,7 +228,7 @@ static struct platform_device mmc_devices[2] = {
228 .resource = mmc0_resources 228 .resource = mmc0_resources
229 }, 229 },
230 { 230 {
231 .name = "davinci_mmc", 231 .name = "dm6441-mmc",
232 .id = 1, 232 .id = 1,
233 .dev = { 233 .dev = {
234 .dma_mask = &mmc1_dma_mask, 234 .dma_mask = &mmc1_dma_mask,
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 4c48a36ee567..a7068a3aa9d3 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -119,7 +119,7 @@ void __init davinci_init_ide(void)
119 platform_device_register(&ide_device); 119 platform_device_register(&ide_device);
120} 120}
121 121
122#if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE) 122#if IS_ENABLED(CONFIG_MMC_DAVINCI)
123 123
124static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32); 124static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32);
125 125
@@ -150,7 +150,7 @@ static struct resource mmcsd0_resources[] = {
150}; 150};
151 151
152static struct platform_device davinci_mmcsd0_device = { 152static struct platform_device davinci_mmcsd0_device = {
153 .name = "davinci_mmc", 153 .name = "dm6441-mmc",
154 .id = 0, 154 .id = 0,
155 .dev = { 155 .dev = {
156 .dma_mask = &mmcsd0_dma_mask, 156 .dma_mask = &mmcsd0_dma_mask,
@@ -187,7 +187,7 @@ static struct resource mmcsd1_resources[] = {
187}; 187};
188 188
189static struct platform_device davinci_mmcsd1_device = { 189static struct platform_device davinci_mmcsd1_device = {
190 .name = "davinci_mmc", 190 .name = "dm6441-mmc",
191 .id = 1, 191 .id = 1,
192 .dev = { 192 .dev = {
193 .dma_mask = &mmcsd1_dma_mask, 193 .dma_mask = &mmcsd1_dma_mask,
@@ -235,6 +235,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
235 mmcsd1_resources[0].end = DM365_MMCSD1_BASE + 235 mmcsd1_resources[0].end = DM365_MMCSD1_BASE +
236 SZ_4K - 1; 236 SZ_4K - 1;
237 mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1; 237 mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1;
238 davinci_mmcsd1_device.name = "da830-mmc";
238 } else 239 } else
239 break; 240 break;
240 241
@@ -256,6 +257,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
256 mmcsd0_resources[0].end = DM365_MMCSD0_BASE + 257 mmcsd0_resources[0].end = DM365_MMCSD0_BASE +
257 SZ_4K - 1; 258 SZ_4K - 1;
258 mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0; 259 mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0;
260 davinci_mmcsd0_device.name = "da830-mmc";
259 } else if (cpu_is_davinci_dm644x()) { 261 } else if (cpu_is_davinci_dm644x()) {
260 /* REVISIT: should this be in board-init code? */ 262 /* REVISIT: should this be in board-init code? */
261 /* Power-on 3.3V IO cells */ 263 /* Power-on 3.3V IO cells */
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index b49c3b77d55e..a11034a358f1 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -35,6 +35,8 @@
35#include "asp.h" 35#include "asp.h"
36 36
37#define DM355_UART2_BASE (IO_PHYS + 0x206000) 37#define DM355_UART2_BASE (IO_PHYS + 0x206000)
38#define DM355_OSD_BASE (IO_PHYS + 0x70200)
39#define DM355_VENC_BASE (IO_PHYS + 0x70400)
38 40
39/* 41/*
40 * Device specific clocks 42 * Device specific clocks
@@ -345,8 +347,8 @@ static struct clk_lookup dm355_clks[] = {
345 CLK(NULL, "pll1_aux", &pll1_aux_clk), 347 CLK(NULL, "pll1_aux", &pll1_aux_clk),
346 CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp), 348 CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp),
347 CLK(NULL, "vpss_dac", &vpss_dac_clk), 349 CLK(NULL, "vpss_dac", &vpss_dac_clk),
348 CLK(NULL, "vpss_master", &vpss_master_clk), 350 CLK("vpss", "master", &vpss_master_clk),
349 CLK(NULL, "vpss_slave", &vpss_slave_clk), 351 CLK("vpss", "slave", &vpss_slave_clk),
350 CLK(NULL, "clkout1", &clkout1_clk), 352 CLK(NULL, "clkout1", &clkout1_clk),
351 CLK(NULL, "clkout2", &clkout2_clk), 353 CLK(NULL, "clkout2", &clkout2_clk),
352 CLK(NULL, "pll2", &pll2_clk), 354 CLK(NULL, "pll2", &pll2_clk),
@@ -361,8 +363,8 @@ static struct clk_lookup dm355_clks[] = {
361 CLK("i2c_davinci.1", NULL, &i2c_clk), 363 CLK("i2c_davinci.1", NULL, &i2c_clk),
362 CLK("davinci-mcbsp.0", NULL, &asp0_clk), 364 CLK("davinci-mcbsp.0", NULL, &asp0_clk),
363 CLK("davinci-mcbsp.1", NULL, &asp1_clk), 365 CLK("davinci-mcbsp.1", NULL, &asp1_clk),
364 CLK("davinci_mmc.0", NULL, &mmcsd0_clk), 366 CLK("dm6441-mmc.0", NULL, &mmcsd0_clk),
365 CLK("davinci_mmc.1", NULL, &mmcsd1_clk), 367 CLK("dm6441-mmc.1", NULL, &mmcsd1_clk),
366 CLK("spi_davinci.0", NULL, &spi0_clk), 368 CLK("spi_davinci.0", NULL, &spi0_clk),
367 CLK("spi_davinci.1", NULL, &spi1_clk), 369 CLK("spi_davinci.1", NULL, &spi1_clk),
368 CLK("spi_davinci.2", NULL, &spi2_clk), 370 CLK("spi_davinci.2", NULL, &spi2_clk),
@@ -744,11 +746,146 @@ static struct platform_device vpfe_capture_dev = {
744 }, 746 },
745}; 747};
746 748
747void dm355_set_vpfe_config(struct vpfe_config *cfg) 749static struct resource dm355_osd_resources[] = {
750 {
751 .start = DM355_OSD_BASE,
752 .end = DM355_OSD_BASE + 0x17f,
753 .flags = IORESOURCE_MEM,
754 },
755};
756
757static struct platform_device dm355_osd_dev = {
758 .name = DM355_VPBE_OSD_SUBDEV_NAME,
759 .id = -1,
760 .num_resources = ARRAY_SIZE(dm355_osd_resources),
761 .resource = dm355_osd_resources,
762 .dev = {
763 .dma_mask = &vpfe_capture_dma_mask,
764 .coherent_dma_mask = DMA_BIT_MASK(32),
765 },
766};
767
768static struct resource dm355_venc_resources[] = {
769 {
770 .start = IRQ_VENCINT,
771 .end = IRQ_VENCINT,
772 .flags = IORESOURCE_IRQ,
773 },
774 /* venc registers io space */
775 {
776 .start = DM355_VENC_BASE,
777 .end = DM355_VENC_BASE + 0x17f,
778 .flags = IORESOURCE_MEM,
779 },
780 /* VDAC config register io space */
781 {
782 .start = DAVINCI_SYSTEM_MODULE_BASE + SYSMOD_VDAC_CONFIG,
783 .end = DAVINCI_SYSTEM_MODULE_BASE + SYSMOD_VDAC_CONFIG + 3,
784 .flags = IORESOURCE_MEM,
785 },
786};
787
788static struct resource dm355_v4l2_disp_resources[] = {
789 {
790 .start = IRQ_VENCINT,
791 .end = IRQ_VENCINT,
792 .flags = IORESOURCE_IRQ,
793 },
794 /* venc registers io space */
795 {
796 .start = DM355_VENC_BASE,
797 .end = DM355_VENC_BASE + 0x17f,
798 .flags = IORESOURCE_MEM,
799 },
800};
801
802static int dm355_vpbe_setup_pinmux(enum v4l2_mbus_pixelcode if_type,
803 int field)
804{
805 switch (if_type) {
806 case V4L2_MBUS_FMT_SGRBG8_1X8:
807 davinci_cfg_reg(DM355_VOUT_FIELD_G70);
808 break;
809 case V4L2_MBUS_FMT_YUYV10_1X20:
810 if (field)
811 davinci_cfg_reg(DM355_VOUT_FIELD);
812 else
813 davinci_cfg_reg(DM355_VOUT_FIELD_G70);
814 break;
815 default:
816 return -EINVAL;
817 }
818
819 davinci_cfg_reg(DM355_VOUT_COUTL_EN);
820 davinci_cfg_reg(DM355_VOUT_COUTH_EN);
821
822 return 0;
823}
824
825static int dm355_venc_setup_clock(enum vpbe_enc_timings_type type,
826 unsigned int pclock)
748{ 827{
749 vpfe_capture_dev.dev.platform_data = cfg; 828 void __iomem *vpss_clk_ctrl_reg;
829
830 vpss_clk_ctrl_reg = DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL);
831
832 switch (type) {
833 case VPBE_ENC_STD:
834 writel(VPSS_DACCLKEN_ENABLE | VPSS_VENCCLKEN_ENABLE,
835 vpss_clk_ctrl_reg);
836 break;
837 case VPBE_ENC_DV_TIMINGS:
838 if (pclock > 27000000)
839 /*
840 * For HD, use external clock source since we cannot
841 * support HD mode with internal clocks.
842 */
843 writel(VPSS_MUXSEL_EXTCLK_ENABLE, vpss_clk_ctrl_reg);
844 break;
845 default:
846 return -EINVAL;
847 }
848
849 return 0;
750} 850}
751 851
852static struct platform_device dm355_vpbe_display = {
853 .name = "vpbe-v4l2",
854 .id = -1,
855 .num_resources = ARRAY_SIZE(dm355_v4l2_disp_resources),
856 .resource = dm355_v4l2_disp_resources,
857 .dev = {
858 .dma_mask = &vpfe_capture_dma_mask,
859 .coherent_dma_mask = DMA_BIT_MASK(32),
860 },
861};
862
863struct venc_platform_data dm355_venc_pdata = {
864 .setup_pinmux = dm355_vpbe_setup_pinmux,
865 .setup_clock = dm355_venc_setup_clock,
866};
867
868static struct platform_device dm355_venc_dev = {
869 .name = DM355_VPBE_VENC_SUBDEV_NAME,
870 .id = -1,
871 .num_resources = ARRAY_SIZE(dm355_venc_resources),
872 .resource = dm355_venc_resources,
873 .dev = {
874 .dma_mask = &vpfe_capture_dma_mask,
875 .coherent_dma_mask = DMA_BIT_MASK(32),
876 .platform_data = (void *)&dm355_venc_pdata,
877 },
878};
879
880static struct platform_device dm355_vpbe_dev = {
881 .name = "vpbe_controller",
882 .id = -1,
883 .dev = {
884 .dma_mask = &vpfe_capture_dma_mask,
885 .coherent_dma_mask = DMA_BIT_MASK(32),
886 },
887};
888
752/*----------------------------------------------------------------------*/ 889/*----------------------------------------------------------------------*/
753 890
754static struct map_desc dm355_io_desc[] = { 891static struct map_desc dm355_io_desc[] = {
@@ -868,19 +1005,36 @@ void __init dm355_init(void)
868 davinci_map_sysmod(); 1005 davinci_map_sysmod();
869} 1006}
870 1007
1008int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
1009 struct vpbe_config *vpbe_cfg)
1010{
1011 if (vpfe_cfg || vpbe_cfg)
1012 platform_device_register(&dm355_vpss_device);
1013
1014 if (vpfe_cfg) {
1015 vpfe_capture_dev.dev.platform_data = vpfe_cfg;
1016 platform_device_register(&dm355_ccdc_dev);
1017 platform_device_register(&vpfe_capture_dev);
1018 }
1019
1020 if (vpbe_cfg) {
1021 dm355_vpbe_dev.dev.platform_data = vpbe_cfg;
1022 platform_device_register(&dm355_osd_dev);
1023 platform_device_register(&dm355_venc_dev);
1024 platform_device_register(&dm355_vpbe_dev);
1025 platform_device_register(&dm355_vpbe_display);
1026 }
1027
1028 return 0;
1029}
1030
871static int __init dm355_init_devices(void) 1031static int __init dm355_init_devices(void)
872{ 1032{
873 if (!cpu_is_davinci_dm355()) 1033 if (!cpu_is_davinci_dm355())
874 return 0; 1034 return 0;
875 1035
876 /* Add ccdc clock aliases */
877 clk_add_alias("master", dm355_ccdc_dev.name, "vpss_master", NULL);
878 clk_add_alias("slave", dm355_ccdc_dev.name, "vpss_master", NULL);
879 davinci_cfg_reg(DM355_INT_EDMA_CC); 1036 davinci_cfg_reg(DM355_INT_EDMA_CC);
880 platform_device_register(&dm355_edma_device); 1037 platform_device_register(&dm355_edma_device);
881 platform_device_register(&dm355_vpss_device);
882 platform_device_register(&dm355_ccdc_dev);
883 platform_device_register(&vpfe_capture_dev);
884 1038
885 return 0; 1039 return 0;
886} 1040}
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 6c3980540be0..40fa4fee9331 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -39,16 +39,13 @@
39#include "asp.h" 39#include "asp.h"
40 40
41#define DM365_REF_FREQ 24000000 /* 24 MHz on the DM365 EVM */ 41#define DM365_REF_FREQ 24000000 /* 24 MHz on the DM365 EVM */
42
43/* Base of key scan register bank */
44#define DM365_KEYSCAN_BASE 0x01c69400
45
46#define DM365_RTC_BASE 0x01c69000 42#define DM365_RTC_BASE 0x01c69000
47 43#define DM365_KEYSCAN_BASE 0x01c69400
44#define DM365_OSD_BASE 0x01c71c00
45#define DM365_VENC_BASE 0x01c71e00
48#define DAVINCI_DM365_VC_BASE 0x01d0c000 46#define DAVINCI_DM365_VC_BASE 0x01d0c000
49#define DAVINCI_DMA_VC_TX 2 47#define DAVINCI_DMA_VC_TX 2
50#define DAVINCI_DMA_VC_RX 3 48#define DAVINCI_DMA_VC_RX 3
51
52#define DM365_EMAC_BASE 0x01d07000 49#define DM365_EMAC_BASE 0x01d07000
53#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000) 50#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000)
54#define DM365_EMAC_CNTRL_OFFSET 0x0000 51#define DM365_EMAC_CNTRL_OFFSET 0x0000
@@ -257,6 +254,12 @@ static struct clk vpss_master_clk = {
257 .flags = CLK_PSC, 254 .flags = CLK_PSC,
258}; 255};
259 256
257static struct clk vpss_slave_clk = {
258 .name = "vpss_slave",
259 .parent = &pll1_sysclk5,
260 .lpsc = DAVINCI_LPSC_VPSSSLV,
261};
262
260static struct clk arm_clk = { 263static struct clk arm_clk = {
261 .name = "arm_clk", 264 .name = "arm_clk",
262 .parent = &pll2_sysclk2, 265 .parent = &pll2_sysclk2,
@@ -449,13 +452,14 @@ static struct clk_lookup dm365_clks[] = {
449 CLK(NULL, "pll2_sysclk8", &pll2_sysclk8), 452 CLK(NULL, "pll2_sysclk8", &pll2_sysclk8),
450 CLK(NULL, "pll2_sysclk9", &pll2_sysclk9), 453 CLK(NULL, "pll2_sysclk9", &pll2_sysclk9),
451 CLK(NULL, "vpss_dac", &vpss_dac_clk), 454 CLK(NULL, "vpss_dac", &vpss_dac_clk),
452 CLK(NULL, "vpss_master", &vpss_master_clk), 455 CLK("vpss", "master", &vpss_master_clk),
456 CLK("vpss", "slave", &vpss_slave_clk),
453 CLK(NULL, "arm", &arm_clk), 457 CLK(NULL, "arm", &arm_clk),
454 CLK(NULL, "uart0", &uart0_clk), 458 CLK(NULL, "uart0", &uart0_clk),
455 CLK(NULL, "uart1", &uart1_clk), 459 CLK(NULL, "uart1", &uart1_clk),
456 CLK("i2c_davinci.1", NULL, &i2c_clk), 460 CLK("i2c_davinci.1", NULL, &i2c_clk),
457 CLK("davinci_mmc.0", NULL, &mmcsd0_clk), 461 CLK("da830-mmc.0", NULL, &mmcsd0_clk),
458 CLK("davinci_mmc.1", NULL, &mmcsd1_clk), 462 CLK("da830-mmc.1", NULL, &mmcsd1_clk),
459 CLK("spi_davinci.0", NULL, &spi0_clk), 463 CLK("spi_davinci.0", NULL, &spi0_clk),
460 CLK("spi_davinci.1", NULL, &spi1_clk), 464 CLK("spi_davinci.1", NULL, &spi1_clk),
461 CLK("spi_davinci.2", NULL, &spi2_clk), 465 CLK("spi_davinci.2", NULL, &spi2_clk),
@@ -1226,6 +1230,173 @@ static struct platform_device dm365_isif_dev = {
1226 }, 1230 },
1227}; 1231};
1228 1232
1233static struct resource dm365_osd_resources[] = {
1234 {
1235 .start = DM365_OSD_BASE,
1236 .end = DM365_OSD_BASE + 0xff,
1237 .flags = IORESOURCE_MEM,
1238 },
1239};
1240
1241static u64 dm365_video_dma_mask = DMA_BIT_MASK(32);
1242
1243static struct platform_device dm365_osd_dev = {
1244 .name = DM365_VPBE_OSD_SUBDEV_NAME,
1245 .id = -1,
1246 .num_resources = ARRAY_SIZE(dm365_osd_resources),
1247 .resource = dm365_osd_resources,
1248 .dev = {
1249 .dma_mask = &dm365_video_dma_mask,
1250 .coherent_dma_mask = DMA_BIT_MASK(32),
1251 },
1252};
1253
1254static struct resource dm365_venc_resources[] = {
1255 {
1256 .start = IRQ_VENCINT,
1257 .end = IRQ_VENCINT,
1258 .flags = IORESOURCE_IRQ,
1259 },
1260 /* venc registers io space */
1261 {
1262 .start = DM365_VENC_BASE,
1263 .end = DM365_VENC_BASE + 0x177,
1264 .flags = IORESOURCE_MEM,
1265 },
1266 /* vdaccfg registers io space */
1267 {
1268 .start = DAVINCI_SYSTEM_MODULE_BASE + SYSMOD_VDAC_CONFIG,
1269 .end = DAVINCI_SYSTEM_MODULE_BASE + SYSMOD_VDAC_CONFIG + 3,
1270 .flags = IORESOURCE_MEM,
1271 },
1272};
1273
1274static struct resource dm365_v4l2_disp_resources[] = {
1275 {
1276 .start = IRQ_VENCINT,
1277 .end = IRQ_VENCINT,
1278 .flags = IORESOURCE_IRQ,
1279 },
1280 /* venc registers io space */
1281 {
1282 .start = DM365_VENC_BASE,
1283 .end = DM365_VENC_BASE + 0x177,
1284 .flags = IORESOURCE_MEM,
1285 },
1286};
1287
1288static int dm365_vpbe_setup_pinmux(enum v4l2_mbus_pixelcode if_type,
1289 int field)
1290{
1291 switch (if_type) {
1292 case V4L2_MBUS_FMT_SGRBG8_1X8:
1293 davinci_cfg_reg(DM365_VOUT_FIELD_G81);
1294 davinci_cfg_reg(DM365_VOUT_COUTL_EN);
1295 davinci_cfg_reg(DM365_VOUT_COUTH_EN);
1296 break;
1297 case V4L2_MBUS_FMT_YUYV10_1X20:
1298 if (field)
1299 davinci_cfg_reg(DM365_VOUT_FIELD);
1300 else
1301 davinci_cfg_reg(DM365_VOUT_FIELD_G81);
1302 davinci_cfg_reg(DM365_VOUT_COUTL_EN);
1303 davinci_cfg_reg(DM365_VOUT_COUTH_EN);
1304 break;
1305 default:
1306 return -EINVAL;
1307 }
1308
1309 return 0;
1310}
1311
1312static int dm365_venc_setup_clock(enum vpbe_enc_timings_type type,
1313 unsigned int pclock)
1314{
1315 void __iomem *vpss_clkctl_reg;
1316 u32 val;
1317
1318 vpss_clkctl_reg = DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL);
1319
1320 switch (type) {
1321 case VPBE_ENC_STD:
1322 val = VPSS_VENCCLKEN_ENABLE | VPSS_DACCLKEN_ENABLE;
1323 break;
1324 case VPBE_ENC_DV_TIMINGS:
1325 if (pclock <= 27000000) {
1326 val = VPSS_VENCCLKEN_ENABLE | VPSS_DACCLKEN_ENABLE;
1327 } else {
1328 /* set sysclk4 to output 74.25 MHz from pll1 */
1329 val = VPSS_PLLC2SYSCLK5_ENABLE | VPSS_DACCLKEN_ENABLE |
1330 VPSS_VENCCLKEN_ENABLE;
1331 }
1332 break;
1333 default:
1334 return -EINVAL;
1335 }
1336 writel(val, vpss_clkctl_reg);
1337
1338 return 0;
1339}
1340
1341static struct platform_device dm365_vpbe_display = {
1342 .name = "vpbe-v4l2",
1343 .id = -1,
1344 .num_resources = ARRAY_SIZE(dm365_v4l2_disp_resources),
1345 .resource = dm365_v4l2_disp_resources,
1346 .dev = {
1347 .dma_mask = &dm365_video_dma_mask,
1348 .coherent_dma_mask = DMA_BIT_MASK(32),
1349 },
1350};
1351
1352struct venc_platform_data dm365_venc_pdata = {
1353 .setup_pinmux = dm365_vpbe_setup_pinmux,
1354 .setup_clock = dm365_venc_setup_clock,
1355};
1356
1357static struct platform_device dm365_venc_dev = {
1358 .name = DM365_VPBE_VENC_SUBDEV_NAME,
1359 .id = -1,
1360 .num_resources = ARRAY_SIZE(dm365_venc_resources),
1361 .resource = dm365_venc_resources,
1362 .dev = {
1363 .dma_mask = &dm365_video_dma_mask,
1364 .coherent_dma_mask = DMA_BIT_MASK(32),
1365 .platform_data = (void *)&dm365_venc_pdata,
1366 },
1367};
1368
1369static struct platform_device dm365_vpbe_dev = {
1370 .name = "vpbe_controller",
1371 .id = -1,
1372 .dev = {
1373 .dma_mask = &dm365_video_dma_mask,
1374 .coherent_dma_mask = DMA_BIT_MASK(32),
1375 },
1376};
1377
1378int __init dm365_init_video(struct vpfe_config *vpfe_cfg,
1379 struct vpbe_config *vpbe_cfg)
1380{
1381 if (vpfe_cfg || vpbe_cfg)
1382 platform_device_register(&dm365_vpss_device);
1383
1384 if (vpfe_cfg) {
1385 vpfe_capture_dev.dev.platform_data = vpfe_cfg;
1386 platform_device_register(&dm365_isif_dev);
1387 platform_device_register(&vpfe_capture_dev);
1388 }
1389 if (vpbe_cfg) {
1390 dm365_vpbe_dev.dev.platform_data = vpbe_cfg;
1391 platform_device_register(&dm365_osd_dev);
1392 platform_device_register(&dm365_venc_dev);
1393 platform_device_register(&dm365_vpbe_dev);
1394 platform_device_register(&dm365_vpbe_display);
1395 }
1396
1397 return 0;
1398}
1399
1229static int __init dm365_init_devices(void) 1400static int __init dm365_init_devices(void)
1230{ 1401{
1231 if (!cpu_is_davinci_dm365()) 1402 if (!cpu_is_davinci_dm365())
@@ -1239,16 +1410,6 @@ static int __init dm365_init_devices(void)
1239 clk_add_alias(NULL, dev_name(&dm365_mdio_device.dev), 1410 clk_add_alias(NULL, dev_name(&dm365_mdio_device.dev),
1240 NULL, &dm365_emac_device.dev); 1411 NULL, &dm365_emac_device.dev);
1241 1412
1242 /* Add isif clock alias */
1243 clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
1244 platform_device_register(&dm365_vpss_device);
1245 platform_device_register(&dm365_isif_dev);
1246 platform_device_register(&vpfe_capture_dev);
1247 return 0; 1413 return 0;
1248} 1414}
1249postcore_initcall(dm365_init_devices); 1415postcore_initcall(dm365_init_devices);
1250
1251void dm365_set_vpfe_config(struct vpfe_config *cfg)
1252{
1253 vpfe_capture_dev.dev.platform_data = cfg;
1254}
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index db1dd92e00af..4d37d3e2a193 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -300,8 +300,8 @@ static struct clk_lookup dm644x_clks[] = {
300 CLK(NULL, "dsp", &dsp_clk), 300 CLK(NULL, "dsp", &dsp_clk),
301 CLK(NULL, "arm", &arm_clk), 301 CLK(NULL, "arm", &arm_clk),
302 CLK(NULL, "vicp", &vicp_clk), 302 CLK(NULL, "vicp", &vicp_clk),
303 CLK(NULL, "vpss_master", &vpss_master_clk), 303 CLK("vpss", "master", &vpss_master_clk),
304 CLK(NULL, "vpss_slave", &vpss_slave_clk), 304 CLK("vpss", "slave", &vpss_slave_clk),
305 CLK(NULL, "arm", &arm_clk), 305 CLK(NULL, "arm", &arm_clk),
306 CLK(NULL, "uart0", &uart0_clk), 306 CLK(NULL, "uart0", &uart0_clk),
307 CLK(NULL, "uart1", &uart1_clk), 307 CLK(NULL, "uart1", &uart1_clk),
@@ -310,7 +310,7 @@ static struct clk_lookup dm644x_clks[] = {
310 CLK("i2c_davinci.1", NULL, &i2c_clk), 310 CLK("i2c_davinci.1", NULL, &i2c_clk),
311 CLK("palm_bk3710", NULL, &ide_clk), 311 CLK("palm_bk3710", NULL, &ide_clk),
312 CLK("davinci-mcbsp", NULL, &asp_clk), 312 CLK("davinci-mcbsp", NULL, &asp_clk),
313 CLK("davinci_mmc.0", NULL, &mmcsd_clk), 313 CLK("dm6441-mmc.0", NULL, &mmcsd_clk),
314 CLK(NULL, "spi", &spi_clk), 314 CLK(NULL, "spi", &spi_clk),
315 CLK(NULL, "gpio", &gpio_clk), 315 CLK(NULL, "gpio", &gpio_clk),
316 CLK(NULL, "usb", &usb_clk), 316 CLK(NULL, "usb", &usb_clk),
@@ -706,7 +706,7 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
706 v |= DM644X_VPSS_DACCLKEN; 706 v |= DM644X_VPSS_DACCLKEN;
707 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); 707 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
708 break; 708 break;
709 case VPBE_ENC_CUSTOM_TIMINGS: 709 case VPBE_ENC_DV_TIMINGS:
710 if (pclock <= 27000000) { 710 if (pclock <= 27000000) {
711 v |= DM644X_VPSS_DACCLKEN; 711 v |= DM644X_VPSS_DACCLKEN;
712 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); 712 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
@@ -901,11 +901,6 @@ int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
901 dm644x_vpfe_dev.dev.platform_data = vpfe_cfg; 901 dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
902 platform_device_register(&dm644x_ccdc_dev); 902 platform_device_register(&dm644x_ccdc_dev);
903 platform_device_register(&dm644x_vpfe_dev); 903 platform_device_register(&dm644x_vpfe_dev);
904 /* Add ccdc clock aliases */
905 clk_add_alias("master", dm644x_ccdc_dev.name,
906 "vpss_master", NULL);
907 clk_add_alias("slave", dm644x_ccdc_dev.name,
908 "vpss_slave", NULL);
909 } 904 }
910 905
911 if (vpbe_cfg) { 906 if (vpbe_cfg) {
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index de439b7b9af1..2e1c9eae0a58 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -54,7 +54,10 @@ extern unsigned int da850_max_speed;
54#define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000) 54#define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000)
55#define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x)) 55#define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x))
56#define DA8XX_JTAG_ID_REG 0x18 56#define DA8XX_JTAG_ID_REG 0x18
57#define DA8XX_HOST1CFG_REG 0x44
58#define DA8XX_CHIPSIG_REG 0x174
57#define DA8XX_CFGCHIP0_REG 0x17c 59#define DA8XX_CFGCHIP0_REG 0x17c
60#define DA8XX_CFGCHIP1_REG 0x180
58#define DA8XX_CFGCHIP2_REG 0x184 61#define DA8XX_CFGCHIP2_REG 0x184
59#define DA8XX_CFGCHIP3_REG 0x188 62#define DA8XX_CFGCHIP3_REG 0x188
60 63
@@ -104,6 +107,8 @@ int __init da850_register_vpif_display
104int __init da850_register_vpif_capture 107int __init da850_register_vpif_capture
105 (struct vpif_capture_config *capture_config); 108 (struct vpif_capture_config *capture_config);
106void da8xx_restart(char mode, const char *cmd); 109void da8xx_restart(char mode, const char *cmd);
110void da8xx_rproc_reserve_cma(void);
111int da8xx_register_rproc(void);
107 112
108extern struct platform_device da8xx_serial_device; 113extern struct platform_device da8xx_serial_device;
109extern struct emac_platform_data da8xx_emac_pdata; 114extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index 34290d14754b..b18b8ebc6508 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -24,8 +24,6 @@
24 24
25#if defined(CONFIG_DEBUG_DAVINCI_DMx_UART0) 25#if defined(CONFIG_DEBUG_DAVINCI_DMx_UART0)
26#define UART_BASE DAVINCI_UART0_BASE 26#define UART_BASE DAVINCI_UART0_BASE
27#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART0)
28#define UART_BASE DA8XX_UART0_BASE
29#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART1) 27#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART1)
30#define UART_BASE DA8XX_UART1_BASE 28#define UART_BASE DA8XX_UART1_BASE
31#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART2) 29#elif defined(CONFIG_DEBUG_DAVINCI_DA8XX_UART2)
diff --git a/arch/arm/mach-davinci/pm.c b/arch/arm/mach-davinci/pm.c
index eb8360b33aa9..a508fe587af7 100644
--- a/arch/arm/mach-davinci/pm.c
+++ b/arch/arm/mach-davinci/pm.c
@@ -19,6 +19,7 @@
19#include <asm/delay.h> 19#include <asm/delay.h>
20#include <asm/io.h> 20#include <asm/io.h>
21 21
22#include <mach/common.h>
22#include <mach/da8xx.h> 23#include <mach/da8xx.h>
23#include <mach/sram.h> 24#include <mach/sram.h>
24#include <mach/pm.h> 25#include <mach/pm.h>
diff --git a/arch/arm/mach-davinci/pm_domain.c b/arch/arm/mach-davinci/pm_domain.c
index c90250e3bef8..6b98413cebd6 100644
--- a/arch/arm/mach-davinci/pm_domain.c
+++ b/arch/arm/mach-davinci/pm_domain.c
@@ -53,7 +53,7 @@ static struct dev_pm_domain davinci_pm_domain = {
53 53
54static struct pm_clk_notifier_block platform_bus_notifier = { 54static struct pm_clk_notifier_block platform_bus_notifier = {
55 .pm_domain = &davinci_pm_domain, 55 .pm_domain = &davinci_pm_domain,
56 .con_ids = { "fck", NULL, }, 56 .con_ids = { "fck", "master", "slave", NULL },
57}; 57};
58 58
59static int __init davinci_pm_runtime_init(void) 59static int __init davinci_pm_runtime_init(void)
diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c
index c5f7ee5cc80a..f18928b073f5 100644
--- a/arch/arm/mach-davinci/sram.c
+++ b/arch/arm/mach-davinci/sram.c
@@ -62,7 +62,7 @@ static int __init sram_init(void)
62 phys_addr_t phys = davinci_soc_info.sram_dma; 62 phys_addr_t phys = davinci_soc_info.sram_dma;
63 unsigned len = davinci_soc_info.sram_len; 63 unsigned len = davinci_soc_info.sram_len;
64 int status = 0; 64 int status = 0;
65 void *addr; 65 void __iomem *addr;
66 66
67 if (len) { 67 if (len) {
68 len = min_t(unsigned, len, SRAM_SIZE); 68 len = min_t(unsigned, len, SRAM_SIZE);
@@ -75,7 +75,7 @@ static int __init sram_init(void)
75 addr = ioremap(phys, len); 75 addr = ioremap(phys, len);
76 if (!addr) 76 if (!addr)
77 return -ENOMEM; 77 return -ENOMEM;
78 status = gen_pool_add_virt(sram_pool, (unsigned)addr, 78 status = gen_pool_add_virt(sram_pool, (unsigned long) addr,
79 phys, len, -1); 79 phys, len, -1);
80 if (status < 0) 80 if (status < 0)
81 iounmap(addr); 81 iounmap(addr);
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index dc1a209b9b66..3b2a70d43efa 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -272,7 +272,7 @@ static struct clk_lookup clks[] = {
272 CLK("tnetv107x-keypad.0", NULL, &clk_keypad), 272 CLK("tnetv107x-keypad.0", NULL, &clk_keypad),
273 CLK(NULL, "clk_gpio", &clk_gpio), 273 CLK(NULL, "clk_gpio", &clk_gpio),
274 CLK(NULL, "clk_mdio", &clk_mdio), 274 CLK(NULL, "clk_mdio", &clk_mdio),
275 CLK("davinci_mmc.0", NULL, &clk_sdio0), 275 CLK("dm6441-mmc.0", NULL, &clk_sdio0),
276 CLK(NULL, "uart0", &clk_uart0), 276 CLK(NULL, "uart0", &clk_uart0),
277 CLK(NULL, "uart1", &clk_uart1), 277 CLK(NULL, "uart1", &clk_uart1),
278 CLK(NULL, "timer0", &clk_timer0), 278 CLK(NULL, "timer0", &clk_timer0),
@@ -292,7 +292,7 @@ static struct clk_lookup clks[] = {
292 CLK(NULL, "clk_system", &clk_system), 292 CLK(NULL, "clk_system", &clk_system),
293 CLK(NULL, "clk_imcop", &clk_imcop), 293 CLK(NULL, "clk_imcop", &clk_imcop),
294 CLK(NULL, "clk_spare", &clk_spare), 294 CLK(NULL, "clk_spare", &clk_spare),
295 CLK("davinci_mmc.1", NULL, &clk_sdio1), 295 CLK("dm6441-mmc.1", NULL, &clk_sdio1),
296 CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst), 296 CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst),
297 CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst), 297 CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst),
298 CLK(NULL, NULL, NULL), 298 CLK(NULL, NULL, NULL),
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 34509ffba221..b0a6b522575f 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -10,6 +10,7 @@
10#include <mach/common.h> 10#include <mach/common.h>
11#include <mach/irqs.h> 11#include <mach/irqs.h>
12#include <mach/cputype.h> 12#include <mach/cputype.h>
13#include <mach/da8xx.h>
13#include <linux/platform_data/usb-davinci.h> 14#include <linux/platform_data/usb-davinci.h>
14 15
15#define DAVINCI_USB_OTG_BASE 0x01c64000 16#define DAVINCI_USB_OTG_BASE 0x01c64000
@@ -17,7 +18,7 @@
17#define DA8XX_USB0_BASE 0x01e00000 18#define DA8XX_USB0_BASE 0x01e00000
18#define DA8XX_USB1_BASE 0x01e25000 19#define DA8XX_USB1_BASE 0x01e25000
19 20
20#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 21#if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
21static struct musb_hdrc_eps_bits musb_eps[] = { 22static struct musb_hdrc_eps_bits musb_eps[] = {
22 { "ep1_tx", 8, }, 23 { "ep1_tx", 8, },
23 { "ep1_rx", 8, }, 24 { "ep1_rx", 8, },
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 70f94c87479d..d19edff0ea6e 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -14,6 +14,7 @@ menu "SAMSUNG EXYNOS SoCs Support"
14config ARCH_EXYNOS4 14config ARCH_EXYNOS4
15 bool "SAMSUNG EXYNOS4" 15 bool "SAMSUNG EXYNOS4"
16 default y 16 default y
17 select HAVE_ARM_SCU if SMP
17 select HAVE_SMP 18 select HAVE_SMP
18 select MIGHT_HAVE_CACHE_L2X0 19 select MIGHT_HAVE_CACHE_L2X0
19 help 20 help
@@ -21,6 +22,7 @@ config ARCH_EXYNOS4
21 22
22config ARCH_EXYNOS5 23config ARCH_EXYNOS5
23 bool "SAMSUNG EXYNOS5" 24 bool "SAMSUNG EXYNOS5"
25 select HAVE_ARM_SCU if SMP
24 select HAVE_SMP 26 select HAVE_SMP
25 help 27 help
26 Samsung EXYNOS5 (Cortex-A15) SoC based systems 28 Samsung EXYNOS5 (Cortex-A15) SoC based systems
@@ -61,6 +63,7 @@ config SOC_EXYNOS5250
61 bool "SAMSUNG EXYNOS5250" 63 bool "SAMSUNG EXYNOS5250"
62 default y 64 default y
63 depends on ARCH_EXYNOS5 65 depends on ARCH_EXYNOS5
66 select PM_GENERIC_DOMAINS if PM
64 select S5P_PM if PM 67 select S5P_PM if PM
65 select S5P_SLEEP if PM 68 select S5P_SLEEP if PM
66 select S5P_DEV_MFC 69 select S5P_DEV_MFC
@@ -72,18 +75,27 @@ config SOC_EXYNOS5440
72 bool "SAMSUNG EXYNOS5440" 75 bool "SAMSUNG EXYNOS5440"
73 default y 76 default y
74 depends on ARCH_EXYNOS5 77 depends on ARCH_EXYNOS5
78 select ARCH_HAS_OPP
75 select ARM_ARCH_TIMER 79 select ARM_ARCH_TIMER
76 select AUTO_ZRELADDR 80 select AUTO_ZRELADDR
77 select PINCTRL 81 select PINCTRL
78 select PINCTRL_EXYNOS5440 82 select PINCTRL_EXYNOS5440
83 select PM_OPP
79 help 84 help
80 Enable EXYNOS5440 SoC support 85 Enable EXYNOS5440 SoC support
81 86
82config EXYNOS4_MCT 87config EXYNOS_ATAGS
83 bool 88 bool "ATAGS based boot for EXYNOS (deprecated)"
89 depends on !ARCH_MULTIPLATFORM
90 depends on ATAGS
84 default y 91 default y
85 help 92 help
86 Use MCT (Multi Core Timer) as kernel timers 93 The EXYNOS platform is moving towards being completely probed
94 through device tree. This enables support for board files using
95 the traditional ATAGS boot format.
96 Note that this option is not available for multiplatform builds.
97
98if EXYNOS_ATAGS
87 99
88config EXYNOS_DEV_DMA 100config EXYNOS_DEV_DMA
89 bool 101 bool
@@ -95,11 +107,6 @@ config EXYNOS4_DEV_AHCI
95 help 107 help
96 Compile in platform device definitions for AHCI 108 Compile in platform device definitions for AHCI
97 109
98config EXYNOS_DEV_DRM
99 bool
100 help
101 Compile in platform device definitions for core DRM device
102
103config EXYNOS4_SETUP_FIMD0 110config EXYNOS4_SETUP_FIMD0
104 bool 111 bool
105 help 112 help
@@ -199,7 +206,6 @@ config MACH_SMDKV310
199 select EXYNOS4_SETUP_SDHCI 206 select EXYNOS4_SETUP_SDHCI
200 select EXYNOS4_SETUP_USB_PHY 207 select EXYNOS4_SETUP_USB_PHY
201 select EXYNOS_DEV_DMA 208 select EXYNOS_DEV_DMA
202 select EXYNOS_DEV_DRM
203 select EXYNOS_DEV_SYSMMU 209 select EXYNOS_DEV_SYSMMU
204 select S3C24XX_PWM 210 select S3C24XX_PWM
205 select S3C_DEV_HSMMC 211 select S3C_DEV_HSMMC
@@ -253,9 +259,7 @@ config MACH_UNIVERSAL_C210
253 select EXYNOS4_SETUP_SDHCI 259 select EXYNOS4_SETUP_SDHCI
254 select EXYNOS4_SETUP_USB_PHY 260 select EXYNOS4_SETUP_USB_PHY
255 select EXYNOS_DEV_DMA 261 select EXYNOS_DEV_DMA
256 select EXYNOS_DEV_DRM
257 select EXYNOS_DEV_SYSMMU 262 select EXYNOS_DEV_SYSMMU
258 select HAVE_SCHED_CLOCK
259 select S3C_DEV_HSMMC 263 select S3C_DEV_HSMMC
260 select S3C_DEV_HSMMC2 264 select S3C_DEV_HSMMC2
261 select S3C_DEV_HSMMC3 265 select S3C_DEV_HSMMC3
@@ -276,8 +280,8 @@ config MACH_UNIVERSAL_C210
276 select S5P_DEV_ONENAND 280 select S5P_DEV_ONENAND
277 select S5P_DEV_TV 281 select S5P_DEV_TV
278 select S5P_GPIO_INT 282 select S5P_GPIO_INT
279 select S5P_HRT
280 select S5P_SETUP_MIPIPHY 283 select S5P_SETUP_MIPIPHY
284 select SAMSUNG_HRT
281 help 285 help
282 Machine support for Samsung Mobile Universal S5PC210 Reference 286 Machine support for Samsung Mobile Universal S5PC210 Reference
283 Board. 287 Board.
@@ -294,7 +298,6 @@ config MACH_NURI
294 select EXYNOS4_SETUP_SDHCI 298 select EXYNOS4_SETUP_SDHCI
295 select EXYNOS4_SETUP_USB_PHY 299 select EXYNOS4_SETUP_USB_PHY
296 select EXYNOS_DEV_DMA 300 select EXYNOS_DEV_DMA
297 select EXYNOS_DEV_DRM
298 select S3C_DEV_HSMMC 301 select S3C_DEV_HSMMC
299 select S3C_DEV_HSMMC2 302 select S3C_DEV_HSMMC2
300 select S3C_DEV_HSMMC3 303 select S3C_DEV_HSMMC3
@@ -330,7 +333,6 @@ config MACH_ORIGEN
330 select EXYNOS4_SETUP_SDHCI 333 select EXYNOS4_SETUP_SDHCI
331 select EXYNOS4_SETUP_USB_PHY 334 select EXYNOS4_SETUP_USB_PHY
332 select EXYNOS_DEV_DMA 335 select EXYNOS_DEV_DMA
333 select EXYNOS_DEV_DRM
334 select EXYNOS_DEV_SYSMMU 336 select EXYNOS_DEV_SYSMMU
335 select S3C24XX_PWM 337 select S3C24XX_PWM
336 select S3C_DEV_HSMMC 338 select S3C_DEV_HSMMC
@@ -366,7 +368,6 @@ config MACH_SMDK4212
366 select EXYNOS4_SETUP_SDHCI 368 select EXYNOS4_SETUP_SDHCI
367 select EXYNOS4_SETUP_USB_PHY 369 select EXYNOS4_SETUP_USB_PHY
368 select EXYNOS_DEV_DMA 370 select EXYNOS_DEV_DMA
369 select EXYNOS_DEV_DRM
370 select EXYNOS_DEV_SYSMMU 371 select EXYNOS_DEV_SYSMMU
371 select S3C24XX_PWM 372 select S3C24XX_PWM
372 select S3C_DEV_HSMMC2 373 select S3C_DEV_HSMMC2
@@ -400,16 +401,20 @@ config MACH_SMDK4412
400 Machine support for Samsung SMDK4412 401 Machine support for Samsung SMDK4412
401endif 402endif
402 403
404endif
405
403comment "Flattened Device Tree based board for EXYNOS SoCs" 406comment "Flattened Device Tree based board for EXYNOS SoCs"
404 407
405config MACH_EXYNOS4_DT 408config MACH_EXYNOS4_DT
406 bool "Samsung Exynos4 Machine using device tree" 409 bool "Samsung Exynos4 Machine using device tree"
407 depends on ARCH_EXYNOS4 410 depends on ARCH_EXYNOS4
408 select ARM_AMBA 411 select ARM_AMBA
412 select CLKSRC_OF
409 select CPU_EXYNOS4210 413 select CPU_EXYNOS4210
410 select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD 414 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
411 select PINCTRL 415 select PINCTRL
412 select PINCTRL_EXYNOS 416 select PINCTRL_EXYNOS
417 select S5P_DEV_MFC
413 select USE_OF 418 select USE_OF
414 help 419 help
415 Machine support for Samsung Exynos4 machine with device tree enabled. 420 Machine support for Samsung Exynos4 machine with device tree enabled.
@@ -422,6 +427,7 @@ config MACH_EXYNOS5_DT
422 default y 427 default y
423 depends on ARCH_EXYNOS5 428 depends on ARCH_EXYNOS5
424 select ARM_AMBA 429 select ARM_AMBA
430 select CLKSRC_OF
425 select USE_OF 431 select USE_OF
426 help 432 help
427 Machine support for Samsung EXYNOS5 machine with device tree enabled. 433 Machine support for Samsung EXYNOS5 machine with device tree enabled.
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 435757e57bb4..b09b027178f3 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -13,10 +13,6 @@ obj- :=
13# Core 13# Core
14 14
15obj-$(CONFIG_ARCH_EXYNOS) += common.o 15obj-$(CONFIG_ARCH_EXYNOS) += common.o
16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o
17obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o
18obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o
19obj-$(CONFIG_SOC_EXYNOS5250) += clock-exynos5.o
20 16
21obj-$(CONFIG_PM) += pm.o 17obj-$(CONFIG_PM) += pm.o
22obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 18obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
@@ -26,10 +22,14 @@ obj-$(CONFIG_ARCH_EXYNOS) += pmu.o
26 22
27obj-$(CONFIG_SMP) += platsmp.o headsmp.o 23obj-$(CONFIG_SMP) += platsmp.o headsmp.o
28 24
29obj-$(CONFIG_EXYNOS4_MCT) += mct.o
30
31obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 25obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
32 26
27obj-$(CONFIG_ARCH_EXYNOS) += exynos-smc.o
28obj-$(CONFIG_ARCH_EXYNOS) += firmware.o
29
30plus_sec := $(call as-instr,.arch_extension sec,+sec)
31AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec)
32
33# machine support 33# machine support
34 34
35obj-$(CONFIG_MACH_SMDKC210) += mach-smdkv310.o 35obj-$(CONFIG_MACH_SMDKC210) += mach-smdkv310.o
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
deleted file mode 100644
index 8a8468d83c8c..000000000000
--- a/arch/arm/mach-exynos/clock-exynos4.c
+++ /dev/null
@@ -1,1601 +0,0 @@
1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4 - Clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27
28#include "common.h"
29#include "clock-exynos4.h"
30
31#ifdef CONFIG_PM_SLEEP
32static struct sleep_save exynos4_clock_save[] = {
33 SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS),
34 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS),
35 SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS),
36 SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS),
37 SAVE_ITEM(EXYNOS4_CLKSRC_TOP0),
38 SAVE_ITEM(EXYNOS4_CLKSRC_TOP1),
39 SAVE_ITEM(EXYNOS4_CLKSRC_CAM),
40 SAVE_ITEM(EXYNOS4_CLKSRC_TV),
41 SAVE_ITEM(EXYNOS4_CLKSRC_MFC),
42 SAVE_ITEM(EXYNOS4_CLKSRC_G3D),
43 SAVE_ITEM(EXYNOS4_CLKSRC_LCD0),
44 SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO),
45 SAVE_ITEM(EXYNOS4_CLKSRC_FSYS),
46 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0),
47 SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1),
48 SAVE_ITEM(EXYNOS4_CLKDIV_CAM),
49 SAVE_ITEM(EXYNOS4_CLKDIV_TV),
50 SAVE_ITEM(EXYNOS4_CLKDIV_MFC),
51 SAVE_ITEM(EXYNOS4_CLKDIV_G3D),
52 SAVE_ITEM(EXYNOS4_CLKDIV_LCD0),
53 SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO),
54 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0),
55 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1),
56 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2),
57 SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3),
58 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0),
59 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1),
60 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2),
61 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3),
62 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4),
63 SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5),
64 SAVE_ITEM(EXYNOS4_CLKDIV_TOP),
65 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP),
66 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM),
67 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV),
68 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0),
69 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO),
70 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS),
71 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0),
72 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1),
73 SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO),
74 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM),
75 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM),
76 SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV),
77 SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC),
78 SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D),
79 SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0),
80 SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS),
81 SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS),
82 SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL),
83 SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK),
84 SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC),
85 SAVE_ITEM(EXYNOS4_CLKSRC_DMC),
86 SAVE_ITEM(EXYNOS4_CLKDIV_DMC0),
87 SAVE_ITEM(EXYNOS4_CLKDIV_DMC1),
88 SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC),
89 SAVE_ITEM(EXYNOS4_CLKSRC_CPU),
90 SAVE_ITEM(EXYNOS4_CLKDIV_CPU),
91 SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4),
92 SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU),
93 SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU),
94};
95#endif
96
97static struct clk exynos4_clk_sclk_hdmi27m = {
98 .name = "sclk_hdmi27m",
99 .rate = 27000000,
100};
101
102static struct clk exynos4_clk_sclk_hdmiphy = {
103 .name = "sclk_hdmiphy",
104};
105
106static struct clk exynos4_clk_sclk_usbphy0 = {
107 .name = "sclk_usbphy0",
108 .rate = 27000000,
109};
110
111static struct clk exynos4_clk_sclk_usbphy1 = {
112 .name = "sclk_usbphy1",
113};
114
115static struct clk dummy_apb_pclk = {
116 .name = "apb_pclk",
117 .id = -1,
118};
119
120static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
121{
122 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable);
123}
124
125static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
126{
127 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable);
128}
129
130static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
131{
132 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable);
133}
134
135int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
136{
137 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable);
138}
139
140static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
141{
142 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable);
143}
144
145static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
146{
147 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable);
148}
149
150static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
151{
152 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable);
153}
154
155static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
156{
157 return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable);
158}
159
160static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
161{
162 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable);
163}
164
165static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
166{
167 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable);
168}
169
170int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
171{
172 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable);
173}
174
175static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
176{
177 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable);
178}
179
180int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
181{
182 return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable);
183}
184
185int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
186{
187 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable);
188}
189
190static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
191{
192 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable);
193}
194
195static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
196{
197 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable);
198}
199
200int exynos4_clk_ip_dmc_ctrl(struct clk *clk, int enable)
201{
202 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_DMC, clk, enable);
203}
204
205static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
206{
207 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
208}
209
210static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
211{
212 return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
213}
214
215/* Core list of CMU_CPU side */
216
217static struct clksrc_clk exynos4_clk_mout_apll = {
218 .clk = {
219 .name = "mout_apll",
220 },
221 .sources = &clk_src_apll,
222 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 },
223};
224
225static struct clksrc_clk exynos4_clk_sclk_apll = {
226 .clk = {
227 .name = "sclk_apll",
228 .parent = &exynos4_clk_mout_apll.clk,
229 },
230 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 },
231};
232
233static struct clksrc_clk exynos4_clk_mout_epll = {
234 .clk = {
235 .name = "mout_epll",
236 },
237 .sources = &clk_src_epll,
238 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 },
239};
240
241struct clksrc_clk exynos4_clk_mout_mpll = {
242 .clk = {
243 .name = "mout_mpll",
244 },
245 .sources = &clk_src_mpll,
246
247 /* reg_src will be added in each SoCs' clock */
248};
249
250static struct clk *exynos4_clkset_moutcore_list[] = {
251 [0] = &exynos4_clk_mout_apll.clk,
252 [1] = &exynos4_clk_mout_mpll.clk,
253};
254
255static struct clksrc_sources exynos4_clkset_moutcore = {
256 .sources = exynos4_clkset_moutcore_list,
257 .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list),
258};
259
260static struct clksrc_clk exynos4_clk_moutcore = {
261 .clk = {
262 .name = "moutcore",
263 },
264 .sources = &exynos4_clkset_moutcore,
265 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 },
266};
267
268static struct clksrc_clk exynos4_clk_coreclk = {
269 .clk = {
270 .name = "core_clk",
271 .parent = &exynos4_clk_moutcore.clk,
272 },
273 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 },
274};
275
276static struct clksrc_clk exynos4_clk_armclk = {
277 .clk = {
278 .name = "armclk",
279 .parent = &exynos4_clk_coreclk.clk,
280 },
281};
282
283static struct clksrc_clk exynos4_clk_aclk_corem0 = {
284 .clk = {
285 .name = "aclk_corem0",
286 .parent = &exynos4_clk_coreclk.clk,
287 },
288 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
289};
290
291static struct clksrc_clk exynos4_clk_aclk_cores = {
292 .clk = {
293 .name = "aclk_cores",
294 .parent = &exynos4_clk_coreclk.clk,
295 },
296 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
297};
298
299static struct clksrc_clk exynos4_clk_aclk_corem1 = {
300 .clk = {
301 .name = "aclk_corem1",
302 .parent = &exynos4_clk_coreclk.clk,
303 },
304 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 },
305};
306
307static struct clksrc_clk exynos4_clk_periphclk = {
308 .clk = {
309 .name = "periphclk",
310 .parent = &exynos4_clk_coreclk.clk,
311 },
312 .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 },
313};
314
315/* Core list of CMU_CORE side */
316
317static struct clk *exynos4_clkset_corebus_list[] = {
318 [0] = &exynos4_clk_mout_mpll.clk,
319 [1] = &exynos4_clk_sclk_apll.clk,
320};
321
322struct clksrc_sources exynos4_clkset_mout_corebus = {
323 .sources = exynos4_clkset_corebus_list,
324 .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list),
325};
326
327static struct clksrc_clk exynos4_clk_mout_corebus = {
328 .clk = {
329 .name = "mout_corebus",
330 },
331 .sources = &exynos4_clkset_mout_corebus,
332 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 },
333};
334
335static struct clksrc_clk exynos4_clk_sclk_dmc = {
336 .clk = {
337 .name = "sclk_dmc",
338 .parent = &exynos4_clk_mout_corebus.clk,
339 },
340 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 },
341};
342
343static struct clksrc_clk exynos4_clk_aclk_cored = {
344 .clk = {
345 .name = "aclk_cored",
346 .parent = &exynos4_clk_sclk_dmc.clk,
347 },
348 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 },
349};
350
351static struct clksrc_clk exynos4_clk_aclk_corep = {
352 .clk = {
353 .name = "aclk_corep",
354 .parent = &exynos4_clk_aclk_cored.clk,
355 },
356 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 },
357};
358
359static struct clksrc_clk exynos4_clk_aclk_acp = {
360 .clk = {
361 .name = "aclk_acp",
362 .parent = &exynos4_clk_mout_corebus.clk,
363 },
364 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 },
365};
366
367static struct clksrc_clk exynos4_clk_pclk_acp = {
368 .clk = {
369 .name = "pclk_acp",
370 .parent = &exynos4_clk_aclk_acp.clk,
371 },
372 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 },
373};
374
375/* Core list of CMU_TOP side */
376
377struct clk *exynos4_clkset_aclk_top_list[] = {
378 [0] = &exynos4_clk_mout_mpll.clk,
379 [1] = &exynos4_clk_sclk_apll.clk,
380};
381
382static struct clksrc_sources exynos4_clkset_aclk = {
383 .sources = exynos4_clkset_aclk_top_list,
384 .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list),
385};
386
387static struct clksrc_clk exynos4_clk_aclk_200 = {
388 .clk = {
389 .name = "aclk_200",
390 },
391 .sources = &exynos4_clkset_aclk,
392 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 },
393 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 },
394};
395
396static struct clksrc_clk exynos4_clk_aclk_100 = {
397 .clk = {
398 .name = "aclk_100",
399 },
400 .sources = &exynos4_clkset_aclk,
401 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 },
402 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 },
403};
404
405static struct clksrc_clk exynos4_clk_aclk_160 = {
406 .clk = {
407 .name = "aclk_160",
408 },
409 .sources = &exynos4_clkset_aclk,
410 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 },
411 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 },
412};
413
414struct clksrc_clk exynos4_clk_aclk_133 = {
415 .clk = {
416 .name = "aclk_133",
417 },
418 .sources = &exynos4_clkset_aclk,
419 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 },
420 .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 },
421};
422
423static struct clk *exynos4_clkset_vpllsrc_list[] = {
424 [0] = &clk_fin_vpll,
425 [1] = &exynos4_clk_sclk_hdmi27m,
426};
427
428static struct clksrc_sources exynos4_clkset_vpllsrc = {
429 .sources = exynos4_clkset_vpllsrc_list,
430 .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list),
431};
432
433static struct clksrc_clk exynos4_clk_vpllsrc = {
434 .clk = {
435 .name = "vpll_src",
436 .enable = exynos4_clksrc_mask_top_ctrl,
437 .ctrlbit = (1 << 0),
438 },
439 .sources = &exynos4_clkset_vpllsrc,
440 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 },
441};
442
443static struct clk *exynos4_clkset_sclk_vpll_list[] = {
444 [0] = &exynos4_clk_vpllsrc.clk,
445 [1] = &clk_fout_vpll,
446};
447
448static struct clksrc_sources exynos4_clkset_sclk_vpll = {
449 .sources = exynos4_clkset_sclk_vpll_list,
450 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list),
451};
452
453static struct clksrc_clk exynos4_clk_sclk_vpll = {
454 .clk = {
455 .name = "sclk_vpll",
456 },
457 .sources = &exynos4_clkset_sclk_vpll,
458 .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 },
459};
460
461static struct clk exynos4_init_clocks_off[] = {
462 {
463 .name = "timers",
464 .parent = &exynos4_clk_aclk_100.clk,
465 .enable = exynos4_clk_ip_peril_ctrl,
466 .ctrlbit = (1<<24),
467 }, {
468 .name = "csis",
469 .devname = "s5p-mipi-csis.0",
470 .enable = exynos4_clk_ip_cam_ctrl,
471 .ctrlbit = (1 << 4),
472 }, {
473 .name = "csis",
474 .devname = "s5p-mipi-csis.1",
475 .enable = exynos4_clk_ip_cam_ctrl,
476 .ctrlbit = (1 << 5),
477 }, {
478 .name = "jpeg",
479 .id = 0,
480 .enable = exynos4_clk_ip_cam_ctrl,
481 .ctrlbit = (1 << 6),
482 }, {
483 .name = "fimc",
484 .devname = "exynos4-fimc.0",
485 .enable = exynos4_clk_ip_cam_ctrl,
486 .ctrlbit = (1 << 0),
487 }, {
488 .name = "fimc",
489 .devname = "exynos4-fimc.1",
490 .enable = exynos4_clk_ip_cam_ctrl,
491 .ctrlbit = (1 << 1),
492 }, {
493 .name = "fimc",
494 .devname = "exynos4-fimc.2",
495 .enable = exynos4_clk_ip_cam_ctrl,
496 .ctrlbit = (1 << 2),
497 }, {
498 .name = "fimc",
499 .devname = "exynos4-fimc.3",
500 .enable = exynos4_clk_ip_cam_ctrl,
501 .ctrlbit = (1 << 3),
502 }, {
503 .name = "tsi",
504 .enable = exynos4_clk_ip_fsys_ctrl,
505 .ctrlbit = (1 << 4),
506 }, {
507 .name = "hsmmc",
508 .devname = "exynos4-sdhci.0",
509 .parent = &exynos4_clk_aclk_133.clk,
510 .enable = exynos4_clk_ip_fsys_ctrl,
511 .ctrlbit = (1 << 5),
512 }, {
513 .name = "hsmmc",
514 .devname = "exynos4-sdhci.1",
515 .parent = &exynos4_clk_aclk_133.clk,
516 .enable = exynos4_clk_ip_fsys_ctrl,
517 .ctrlbit = (1 << 6),
518 }, {
519 .name = "hsmmc",
520 .devname = "exynos4-sdhci.2",
521 .parent = &exynos4_clk_aclk_133.clk,
522 .enable = exynos4_clk_ip_fsys_ctrl,
523 .ctrlbit = (1 << 7),
524 }, {
525 .name = "hsmmc",
526 .devname = "exynos4-sdhci.3",
527 .parent = &exynos4_clk_aclk_133.clk,
528 .enable = exynos4_clk_ip_fsys_ctrl,
529 .ctrlbit = (1 << 8),
530 }, {
531 .name = "biu",
532 .parent = &exynos4_clk_aclk_133.clk,
533 .enable = exynos4_clk_ip_fsys_ctrl,
534 .ctrlbit = (1 << 9),
535 }, {
536 .name = "onenand",
537 .enable = exynos4_clk_ip_fsys_ctrl,
538 .ctrlbit = (1 << 15),
539 }, {
540 .name = "nfcon",
541 .enable = exynos4_clk_ip_fsys_ctrl,
542 .ctrlbit = (1 << 16),
543 }, {
544 .name = "dac",
545 .devname = "s5p-sdo",
546 .enable = exynos4_clk_ip_tv_ctrl,
547 .ctrlbit = (1 << 2),
548 }, {
549 .name = "mixer",
550 .devname = "s5p-mixer",
551 .enable = exynos4_clk_ip_tv_ctrl,
552 .ctrlbit = (1 << 1),
553 }, {
554 .name = "vp",
555 .devname = "s5p-mixer",
556 .enable = exynos4_clk_ip_tv_ctrl,
557 .ctrlbit = (1 << 0),
558 }, {
559 .name = "hdmi",
560 .devname = "exynos4-hdmi",
561 .enable = exynos4_clk_ip_tv_ctrl,
562 .ctrlbit = (1 << 3),
563 }, {
564 .name = "hdmiphy",
565 .devname = "exynos4-hdmi",
566 .enable = exynos4_clk_hdmiphy_ctrl,
567 .ctrlbit = (1 << 0),
568 }, {
569 .name = "dacphy",
570 .devname = "s5p-sdo",
571 .enable = exynos4_clk_dac_ctrl,
572 .ctrlbit = (1 << 0),
573 }, {
574 .name = "adc",
575 .enable = exynos4_clk_ip_peril_ctrl,
576 .ctrlbit = (1 << 15),
577 }, {
578 .name = "tmu_apbif",
579 .enable = exynos4_clk_ip_perir_ctrl,
580 .ctrlbit = (1 << 17),
581 }, {
582 .name = "keypad",
583 .enable = exynos4_clk_ip_perir_ctrl,
584 .ctrlbit = (1 << 16),
585 }, {
586 .name = "rtc",
587 .enable = exynos4_clk_ip_perir_ctrl,
588 .ctrlbit = (1 << 15),
589 }, {
590 .name = "watchdog",
591 .parent = &exynos4_clk_aclk_100.clk,
592 .enable = exynos4_clk_ip_perir_ctrl,
593 .ctrlbit = (1 << 14),
594 }, {
595 .name = "usbhost",
596 .enable = exynos4_clk_ip_fsys_ctrl ,
597 .ctrlbit = (1 << 12),
598 }, {
599 .name = "otg",
600 .enable = exynos4_clk_ip_fsys_ctrl,
601 .ctrlbit = (1 << 13),
602 }, {
603 .name = "spi",
604 .devname = "exynos4210-spi.0",
605 .enable = exynos4_clk_ip_peril_ctrl,
606 .ctrlbit = (1 << 16),
607 }, {
608 .name = "spi",
609 .devname = "exynos4210-spi.1",
610 .enable = exynos4_clk_ip_peril_ctrl,
611 .ctrlbit = (1 << 17),
612 }, {
613 .name = "spi",
614 .devname = "exynos4210-spi.2",
615 .enable = exynos4_clk_ip_peril_ctrl,
616 .ctrlbit = (1 << 18),
617 }, {
618 .name = "iis",
619 .devname = "samsung-i2s.1",
620 .enable = exynos4_clk_ip_peril_ctrl,
621 .ctrlbit = (1 << 20),
622 }, {
623 .name = "iis",
624 .devname = "samsung-i2s.2",
625 .enable = exynos4_clk_ip_peril_ctrl,
626 .ctrlbit = (1 << 21),
627 }, {
628 .name = "pcm",
629 .devname = "samsung-pcm.1",
630 .enable = exynos4_clk_ip_peril_ctrl,
631 .ctrlbit = (1 << 22),
632 }, {
633 .name = "pcm",
634 .devname = "samsung-pcm.2",
635 .enable = exynos4_clk_ip_peril_ctrl,
636 .ctrlbit = (1 << 23),
637 }, {
638 .name = "slimbus",
639 .enable = exynos4_clk_ip_peril_ctrl,
640 .ctrlbit = (1 << 25),
641 }, {
642 .name = "spdif",
643 .devname = "samsung-spdif",
644 .enable = exynos4_clk_ip_peril_ctrl,
645 .ctrlbit = (1 << 26),
646 }, {
647 .name = "ac97",
648 .devname = "samsung-ac97",
649 .enable = exynos4_clk_ip_peril_ctrl,
650 .ctrlbit = (1 << 27),
651 }, {
652 .name = "mfc",
653 .devname = "s5p-mfc",
654 .enable = exynos4_clk_ip_mfc_ctrl,
655 .ctrlbit = (1 << 0),
656 }, {
657 .name = "i2c",
658 .devname = "s3c2440-i2c.0",
659 .parent = &exynos4_clk_aclk_100.clk,
660 .enable = exynos4_clk_ip_peril_ctrl,
661 .ctrlbit = (1 << 6),
662 }, {
663 .name = "i2c",
664 .devname = "s3c2440-i2c.1",
665 .parent = &exynos4_clk_aclk_100.clk,
666 .enable = exynos4_clk_ip_peril_ctrl,
667 .ctrlbit = (1 << 7),
668 }, {
669 .name = "i2c",
670 .devname = "s3c2440-i2c.2",
671 .parent = &exynos4_clk_aclk_100.clk,
672 .enable = exynos4_clk_ip_peril_ctrl,
673 .ctrlbit = (1 << 8),
674 }, {
675 .name = "i2c",
676 .devname = "s3c2440-i2c.3",
677 .parent = &exynos4_clk_aclk_100.clk,
678 .enable = exynos4_clk_ip_peril_ctrl,
679 .ctrlbit = (1 << 9),
680 }, {
681 .name = "i2c",
682 .devname = "s3c2440-i2c.4",
683 .parent = &exynos4_clk_aclk_100.clk,
684 .enable = exynos4_clk_ip_peril_ctrl,
685 .ctrlbit = (1 << 10),
686 }, {
687 .name = "i2c",
688 .devname = "s3c2440-i2c.5",
689 .parent = &exynos4_clk_aclk_100.clk,
690 .enable = exynos4_clk_ip_peril_ctrl,
691 .ctrlbit = (1 << 11),
692 }, {
693 .name = "i2c",
694 .devname = "s3c2440-i2c.6",
695 .parent = &exynos4_clk_aclk_100.clk,
696 .enable = exynos4_clk_ip_peril_ctrl,
697 .ctrlbit = (1 << 12),
698 }, {
699 .name = "i2c",
700 .devname = "s3c2440-i2c.7",
701 .parent = &exynos4_clk_aclk_100.clk,
702 .enable = exynos4_clk_ip_peril_ctrl,
703 .ctrlbit = (1 << 13),
704 }, {
705 .name = "i2c",
706 .devname = "s3c2440-hdmiphy-i2c",
707 .parent = &exynos4_clk_aclk_100.clk,
708 .enable = exynos4_clk_ip_peril_ctrl,
709 .ctrlbit = (1 << 14),
710 }, {
711 .name = "sysmmu",
712 .devname = "exynos-sysmmu.0",
713 .enable = exynos4_clk_ip_mfc_ctrl,
714 .ctrlbit = (1 << 1),
715 }, {
716 .name = "sysmmu",
717 .devname = "exynos-sysmmu.1",
718 .enable = exynos4_clk_ip_mfc_ctrl,
719 .ctrlbit = (1 << 2),
720 }, {
721 .name = "sysmmu",
722 .devname = "exynos-sysmmu.2",
723 .enable = exynos4_clk_ip_tv_ctrl,
724 .ctrlbit = (1 << 4),
725 }, {
726 .name = "sysmmu",
727 .devname = "exynos-sysmmu.3",
728 .enable = exynos4_clk_ip_cam_ctrl,
729 .ctrlbit = (1 << 11),
730 }, {
731 .name = "sysmmu",
732 .devname = "exynos-sysmmu.4",
733 .enable = exynos4_clk_ip_image_ctrl,
734 .ctrlbit = (1 << 4),
735 }, {
736 .name = "sysmmu",
737 .devname = "exynos-sysmmu.5",
738 .enable = exynos4_clk_ip_cam_ctrl,
739 .ctrlbit = (1 << 7),
740 }, {
741 .name = "sysmmu",
742 .devname = "exynos-sysmmu.6",
743 .enable = exynos4_clk_ip_cam_ctrl,
744 .ctrlbit = (1 << 8),
745 }, {
746 .name = "sysmmu",
747 .devname = "exynos-sysmmu.7",
748 .enable = exynos4_clk_ip_cam_ctrl,
749 .ctrlbit = (1 << 9),
750 }, {
751 .name = "sysmmu",
752 .devname = "exynos-sysmmu.8",
753 .enable = exynos4_clk_ip_cam_ctrl,
754 .ctrlbit = (1 << 10),
755 }, {
756 .name = "sysmmu",
757 .devname = "exynos-sysmmu.10",
758 .enable = exynos4_clk_ip_lcd0_ctrl,
759 .ctrlbit = (1 << 4),
760 }
761};
762
763static struct clk exynos4_init_clocks_on[] = {
764 {
765 .name = "uart",
766 .devname = "s5pv210-uart.0",
767 .enable = exynos4_clk_ip_peril_ctrl,
768 .ctrlbit = (1 << 0),
769 }, {
770 .name = "uart",
771 .devname = "s5pv210-uart.1",
772 .enable = exynos4_clk_ip_peril_ctrl,
773 .ctrlbit = (1 << 1),
774 }, {
775 .name = "uart",
776 .devname = "s5pv210-uart.2",
777 .enable = exynos4_clk_ip_peril_ctrl,
778 .ctrlbit = (1 << 2),
779 }, {
780 .name = "uart",
781 .devname = "s5pv210-uart.3",
782 .enable = exynos4_clk_ip_peril_ctrl,
783 .ctrlbit = (1 << 3),
784 }, {
785 .name = "uart",
786 .devname = "s5pv210-uart.4",
787 .enable = exynos4_clk_ip_peril_ctrl,
788 .ctrlbit = (1 << 4),
789 }, {
790 .name = "uart",
791 .devname = "s5pv210-uart.5",
792 .enable = exynos4_clk_ip_peril_ctrl,
793 .ctrlbit = (1 << 5),
794 }
795};
796
797static struct clk exynos4_clk_pdma0 = {
798 .name = "dma",
799 .devname = "dma-pl330.0",
800 .enable = exynos4_clk_ip_fsys_ctrl,
801 .ctrlbit = (1 << 0),
802};
803
804static struct clk exynos4_clk_pdma1 = {
805 .name = "dma",
806 .devname = "dma-pl330.1",
807 .enable = exynos4_clk_ip_fsys_ctrl,
808 .ctrlbit = (1 << 1),
809};
810
811static struct clk exynos4_clk_mdma1 = {
812 .name = "dma",
813 .devname = "dma-pl330.2",
814 .enable = exynos4_clk_ip_image_ctrl,
815 .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)),
816};
817
818static struct clk exynos4_clk_fimd0 = {
819 .name = "fimd",
820 .devname = "exynos4-fb.0",
821 .enable = exynos4_clk_ip_lcd0_ctrl,
822 .ctrlbit = (1 << 0),
823};
824
825struct clk *exynos4_clkset_group_list[] = {
826 [0] = &clk_ext_xtal_mux,
827 [1] = &clk_xusbxti,
828 [2] = &exynos4_clk_sclk_hdmi27m,
829 [3] = &exynos4_clk_sclk_usbphy0,
830 [4] = &exynos4_clk_sclk_usbphy1,
831 [5] = &exynos4_clk_sclk_hdmiphy,
832 [6] = &exynos4_clk_mout_mpll.clk,
833 [7] = &exynos4_clk_mout_epll.clk,
834 [8] = &exynos4_clk_sclk_vpll.clk,
835};
836
837struct clksrc_sources exynos4_clkset_group = {
838 .sources = exynos4_clkset_group_list,
839 .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list),
840};
841
842static struct clk *exynos4_clkset_mout_g2d0_list[] = {
843 [0] = &exynos4_clk_mout_mpll.clk,
844 [1] = &exynos4_clk_sclk_apll.clk,
845};
846
847struct clksrc_sources exynos4_clkset_mout_g2d0 = {
848 .sources = exynos4_clkset_mout_g2d0_list,
849 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list),
850};
851
852static struct clk *exynos4_clkset_mout_g2d1_list[] = {
853 [0] = &exynos4_clk_mout_epll.clk,
854 [1] = &exynos4_clk_sclk_vpll.clk,
855};
856
857struct clksrc_sources exynos4_clkset_mout_g2d1 = {
858 .sources = exynos4_clkset_mout_g2d1_list,
859 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list),
860};
861
862static struct clk *exynos4_clkset_mout_mfc0_list[] = {
863 [0] = &exynos4_clk_mout_mpll.clk,
864 [1] = &exynos4_clk_sclk_apll.clk,
865};
866
867static struct clksrc_sources exynos4_clkset_mout_mfc0 = {
868 .sources = exynos4_clkset_mout_mfc0_list,
869 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list),
870};
871
872static struct clksrc_clk exynos4_clk_mout_mfc0 = {
873 .clk = {
874 .name = "mout_mfc0",
875 },
876 .sources = &exynos4_clkset_mout_mfc0,
877 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 },
878};
879
880static struct clk *exynos4_clkset_mout_mfc1_list[] = {
881 [0] = &exynos4_clk_mout_epll.clk,
882 [1] = &exynos4_clk_sclk_vpll.clk,
883};
884
885static struct clksrc_sources exynos4_clkset_mout_mfc1 = {
886 .sources = exynos4_clkset_mout_mfc1_list,
887 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list),
888};
889
890static struct clksrc_clk exynos4_clk_mout_mfc1 = {
891 .clk = {
892 .name = "mout_mfc1",
893 },
894 .sources = &exynos4_clkset_mout_mfc1,
895 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 },
896};
897
898static struct clk *exynos4_clkset_mout_mfc_list[] = {
899 [0] = &exynos4_clk_mout_mfc0.clk,
900 [1] = &exynos4_clk_mout_mfc1.clk,
901};
902
903static struct clksrc_sources exynos4_clkset_mout_mfc = {
904 .sources = exynos4_clkset_mout_mfc_list,
905 .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list),
906};
907
908static struct clk *exynos4_clkset_sclk_dac_list[] = {
909 [0] = &exynos4_clk_sclk_vpll.clk,
910 [1] = &exynos4_clk_sclk_hdmiphy,
911};
912
913static struct clksrc_sources exynos4_clkset_sclk_dac = {
914 .sources = exynos4_clkset_sclk_dac_list,
915 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list),
916};
917
918static struct clksrc_clk exynos4_clk_sclk_dac = {
919 .clk = {
920 .name = "sclk_dac",
921 .enable = exynos4_clksrc_mask_tv_ctrl,
922 .ctrlbit = (1 << 8),
923 },
924 .sources = &exynos4_clkset_sclk_dac,
925 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 },
926};
927
928static struct clksrc_clk exynos4_clk_sclk_pixel = {
929 .clk = {
930 .name = "sclk_pixel",
931 .parent = &exynos4_clk_sclk_vpll.clk,
932 },
933 .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 },
934};
935
936static struct clk *exynos4_clkset_sclk_hdmi_list[] = {
937 [0] = &exynos4_clk_sclk_pixel.clk,
938 [1] = &exynos4_clk_sclk_hdmiphy,
939};
940
941static struct clksrc_sources exynos4_clkset_sclk_hdmi = {
942 .sources = exynos4_clkset_sclk_hdmi_list,
943 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list),
944};
945
946static struct clksrc_clk exynos4_clk_sclk_hdmi = {
947 .clk = {
948 .name = "sclk_hdmi",
949 .enable = exynos4_clksrc_mask_tv_ctrl,
950 .ctrlbit = (1 << 0),
951 },
952 .sources = &exynos4_clkset_sclk_hdmi,
953 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 },
954};
955
956static struct clk *exynos4_clkset_sclk_mixer_list[] = {
957 [0] = &exynos4_clk_sclk_dac.clk,
958 [1] = &exynos4_clk_sclk_hdmi.clk,
959};
960
961static struct clksrc_sources exynos4_clkset_sclk_mixer = {
962 .sources = exynos4_clkset_sclk_mixer_list,
963 .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list),
964};
965
966static struct clksrc_clk exynos4_clk_sclk_mixer = {
967 .clk = {
968 .name = "sclk_mixer",
969 .enable = exynos4_clksrc_mask_tv_ctrl,
970 .ctrlbit = (1 << 4),
971 },
972 .sources = &exynos4_clkset_sclk_mixer,
973 .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 },
974};
975
976static struct clksrc_clk *exynos4_sclk_tv[] = {
977 &exynos4_clk_sclk_dac,
978 &exynos4_clk_sclk_pixel,
979 &exynos4_clk_sclk_hdmi,
980 &exynos4_clk_sclk_mixer,
981};
982
983static struct clksrc_clk exynos4_clk_dout_mmc0 = {
984 .clk = {
985 .name = "dout_mmc0",
986 },
987 .sources = &exynos4_clkset_group,
988 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 },
989 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 },
990};
991
992static struct clksrc_clk exynos4_clk_dout_mmc1 = {
993 .clk = {
994 .name = "dout_mmc1",
995 },
996 .sources = &exynos4_clkset_group,
997 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 },
998 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 },
999};
1000
1001static struct clksrc_clk exynos4_clk_dout_mmc2 = {
1002 .clk = {
1003 .name = "dout_mmc2",
1004 },
1005 .sources = &exynos4_clkset_group,
1006 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 },
1007 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 },
1008};
1009
1010static struct clksrc_clk exynos4_clk_dout_mmc3 = {
1011 .clk = {
1012 .name = "dout_mmc3",
1013 },
1014 .sources = &exynos4_clkset_group,
1015 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 },
1016 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1017};
1018
1019static struct clksrc_clk exynos4_clk_dout_mmc4 = {
1020 .clk = {
1021 .name = "dout_mmc4",
1022 },
1023 .sources = &exynos4_clkset_group,
1024 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 },
1025 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1026};
1027
1028static struct clksrc_clk exynos4_clksrcs[] = {
1029 {
1030 .clk = {
1031 .name = "sclk_pwm",
1032 .enable = exynos4_clksrc_mask_peril0_ctrl,
1033 .ctrlbit = (1 << 24),
1034 },
1035 .sources = &exynos4_clkset_group,
1036 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 },
1037 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 },
1038 }, {
1039 .clk = {
1040 .name = "sclk_csis",
1041 .devname = "s5p-mipi-csis.0",
1042 .enable = exynos4_clksrc_mask_cam_ctrl,
1043 .ctrlbit = (1 << 24),
1044 },
1045 .sources = &exynos4_clkset_group,
1046 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 },
1047 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 },
1048 }, {
1049 .clk = {
1050 .name = "sclk_csis",
1051 .devname = "s5p-mipi-csis.1",
1052 .enable = exynos4_clksrc_mask_cam_ctrl,
1053 .ctrlbit = (1 << 28),
1054 },
1055 .sources = &exynos4_clkset_group,
1056 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 },
1057 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 },
1058 }, {
1059 .clk = {
1060 .name = "sclk_cam0",
1061 .enable = exynos4_clksrc_mask_cam_ctrl,
1062 .ctrlbit = (1 << 16),
1063 },
1064 .sources = &exynos4_clkset_group,
1065 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 },
1066 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 },
1067 }, {
1068 .clk = {
1069 .name = "sclk_cam1",
1070 .enable = exynos4_clksrc_mask_cam_ctrl,
1071 .ctrlbit = (1 << 20),
1072 },
1073 .sources = &exynos4_clkset_group,
1074 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 },
1075 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 },
1076 }, {
1077 .clk = {
1078 .name = "sclk_fimc",
1079 .devname = "exynos4-fimc.0",
1080 .enable = exynos4_clksrc_mask_cam_ctrl,
1081 .ctrlbit = (1 << 0),
1082 },
1083 .sources = &exynos4_clkset_group,
1084 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 },
1085 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 },
1086 }, {
1087 .clk = {
1088 .name = "sclk_fimc",
1089 .devname = "exynos4-fimc.1",
1090 .enable = exynos4_clksrc_mask_cam_ctrl,
1091 .ctrlbit = (1 << 4),
1092 },
1093 .sources = &exynos4_clkset_group,
1094 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 },
1095 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 },
1096 }, {
1097 .clk = {
1098 .name = "sclk_fimc",
1099 .devname = "exynos4-fimc.2",
1100 .enable = exynos4_clksrc_mask_cam_ctrl,
1101 .ctrlbit = (1 << 8),
1102 },
1103 .sources = &exynos4_clkset_group,
1104 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 },
1105 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 },
1106 }, {
1107 .clk = {
1108 .name = "sclk_fimc",
1109 .devname = "exynos4-fimc.3",
1110 .enable = exynos4_clksrc_mask_cam_ctrl,
1111 .ctrlbit = (1 << 12),
1112 },
1113 .sources = &exynos4_clkset_group,
1114 .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 },
1115 .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 },
1116 }, {
1117 .clk = {
1118 .name = "sclk_fimd",
1119 .devname = "exynos4-fb.0",
1120 .enable = exynos4_clksrc_mask_lcd0_ctrl,
1121 .ctrlbit = (1 << 0),
1122 },
1123 .sources = &exynos4_clkset_group,
1124 .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 },
1125 .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 },
1126 }, {
1127 .clk = {
1128 .name = "sclk_mfc",
1129 .devname = "s5p-mfc",
1130 },
1131 .sources = &exynos4_clkset_mout_mfc,
1132 .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 },
1133 .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 },
1134 }, {
1135 .clk = {
1136 .name = "ciu",
1137 .parent = &exynos4_clk_dout_mmc4.clk,
1138 .enable = exynos4_clksrc_mask_fsys_ctrl,
1139 .ctrlbit = (1 << 16),
1140 },
1141 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 },
1142 }
1143};
1144
1145static struct clksrc_clk exynos4_clk_sclk_uart0 = {
1146 .clk = {
1147 .name = "uclk1",
1148 .devname = "exynos4210-uart.0",
1149 .enable = exynos4_clksrc_mask_peril0_ctrl,
1150 .ctrlbit = (1 << 0),
1151 },
1152 .sources = &exynos4_clkset_group,
1153 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 },
1154 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 },
1155};
1156
1157static struct clksrc_clk exynos4_clk_sclk_uart1 = {
1158 .clk = {
1159 .name = "uclk1",
1160 .devname = "exynos4210-uart.1",
1161 .enable = exynos4_clksrc_mask_peril0_ctrl,
1162 .ctrlbit = (1 << 4),
1163 },
1164 .sources = &exynos4_clkset_group,
1165 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 },
1166 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 },
1167};
1168
1169static struct clksrc_clk exynos4_clk_sclk_uart2 = {
1170 .clk = {
1171 .name = "uclk1",
1172 .devname = "exynos4210-uart.2",
1173 .enable = exynos4_clksrc_mask_peril0_ctrl,
1174 .ctrlbit = (1 << 8),
1175 },
1176 .sources = &exynos4_clkset_group,
1177 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 },
1178 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 },
1179};
1180
1181static struct clksrc_clk exynos4_clk_sclk_uart3 = {
1182 .clk = {
1183 .name = "uclk1",
1184 .devname = "exynos4210-uart.3",
1185 .enable = exynos4_clksrc_mask_peril0_ctrl,
1186 .ctrlbit = (1 << 12),
1187 },
1188 .sources = &exynos4_clkset_group,
1189 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 },
1190 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 },
1191};
1192
1193static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1194 .clk = {
1195 .name = "sclk_mmc",
1196 .devname = "exynos4-sdhci.0",
1197 .parent = &exynos4_clk_dout_mmc0.clk,
1198 .enable = exynos4_clksrc_mask_fsys_ctrl,
1199 .ctrlbit = (1 << 0),
1200 },
1201 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1202};
1203
1204static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1205 .clk = {
1206 .name = "sclk_mmc",
1207 .devname = "exynos4-sdhci.1",
1208 .parent = &exynos4_clk_dout_mmc1.clk,
1209 .enable = exynos4_clksrc_mask_fsys_ctrl,
1210 .ctrlbit = (1 << 4),
1211 },
1212 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1213};
1214
1215static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1216 .clk = {
1217 .name = "sclk_mmc",
1218 .devname = "exynos4-sdhci.2",
1219 .parent = &exynos4_clk_dout_mmc2.clk,
1220 .enable = exynos4_clksrc_mask_fsys_ctrl,
1221 .ctrlbit = (1 << 8),
1222 },
1223 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1224};
1225
1226static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1227 .clk = {
1228 .name = "sclk_mmc",
1229 .devname = "exynos4-sdhci.3",
1230 .parent = &exynos4_clk_dout_mmc3.clk,
1231 .enable = exynos4_clksrc_mask_fsys_ctrl,
1232 .ctrlbit = (1 << 12),
1233 },
1234 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1235};
1236
1237static struct clksrc_clk exynos4_clk_mdout_spi0 = {
1238 .clk = {
1239 .name = "mdout_spi",
1240 .devname = "exynos4210-spi.0",
1241 },
1242 .sources = &exynos4_clkset_group,
1243 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
1244 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
1245};
1246
1247static struct clksrc_clk exynos4_clk_mdout_spi1 = {
1248 .clk = {
1249 .name = "mdout_spi",
1250 .devname = "exynos4210-spi.1",
1251 },
1252 .sources = &exynos4_clkset_group,
1253 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
1254 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
1255};
1256
1257static struct clksrc_clk exynos4_clk_mdout_spi2 = {
1258 .clk = {
1259 .name = "mdout_spi",
1260 .devname = "exynos4210-spi.2",
1261 },
1262 .sources = &exynos4_clkset_group,
1263 .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
1264 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
1265};
1266
1267static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1268 .clk = {
1269 .name = "sclk_spi",
1270 .devname = "exynos4210-spi.0",
1271 .parent = &exynos4_clk_mdout_spi0.clk,
1272 .enable = exynos4_clksrc_mask_peril1_ctrl,
1273 .ctrlbit = (1 << 16),
1274 },
1275 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 8, .size = 8 },
1276};
1277
1278static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1279 .clk = {
1280 .name = "sclk_spi",
1281 .devname = "exynos4210-spi.1",
1282 .parent = &exynos4_clk_mdout_spi1.clk,
1283 .enable = exynos4_clksrc_mask_peril1_ctrl,
1284 .ctrlbit = (1 << 20),
1285 },
1286 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 24, .size = 8 },
1287};
1288
1289static struct clksrc_clk exynos4_clk_sclk_spi2 = {
1290 .clk = {
1291 .name = "sclk_spi",
1292 .devname = "exynos4210-spi.2",
1293 .parent = &exynos4_clk_mdout_spi2.clk,
1294 .enable = exynos4_clksrc_mask_peril1_ctrl,
1295 .ctrlbit = (1 << 24),
1296 },
1297 .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 8, .size = 8 },
1298};
1299
1300/* Clock initialization code */
1301static struct clksrc_clk *exynos4_sysclks[] = {
1302 &exynos4_clk_mout_apll,
1303 &exynos4_clk_sclk_apll,
1304 &exynos4_clk_mout_epll,
1305 &exynos4_clk_mout_mpll,
1306 &exynos4_clk_moutcore,
1307 &exynos4_clk_coreclk,
1308 &exynos4_clk_armclk,
1309 &exynos4_clk_aclk_corem0,
1310 &exynos4_clk_aclk_cores,
1311 &exynos4_clk_aclk_corem1,
1312 &exynos4_clk_periphclk,
1313 &exynos4_clk_mout_corebus,
1314 &exynos4_clk_sclk_dmc,
1315 &exynos4_clk_aclk_cored,
1316 &exynos4_clk_aclk_corep,
1317 &exynos4_clk_aclk_acp,
1318 &exynos4_clk_pclk_acp,
1319 &exynos4_clk_vpllsrc,
1320 &exynos4_clk_sclk_vpll,
1321 &exynos4_clk_aclk_200,
1322 &exynos4_clk_aclk_100,
1323 &exynos4_clk_aclk_160,
1324 &exynos4_clk_aclk_133,
1325 &exynos4_clk_dout_mmc0,
1326 &exynos4_clk_dout_mmc1,
1327 &exynos4_clk_dout_mmc2,
1328 &exynos4_clk_dout_mmc3,
1329 &exynos4_clk_dout_mmc4,
1330 &exynos4_clk_mout_mfc0,
1331 &exynos4_clk_mout_mfc1,
1332};
1333
1334static struct clk *exynos4_clk_cdev[] = {
1335 &exynos4_clk_pdma0,
1336 &exynos4_clk_pdma1,
1337 &exynos4_clk_mdma1,
1338 &exynos4_clk_fimd0,
1339};
1340
1341static struct clksrc_clk *exynos4_clksrc_cdev[] = {
1342 &exynos4_clk_sclk_uart0,
1343 &exynos4_clk_sclk_uart1,
1344 &exynos4_clk_sclk_uart2,
1345 &exynos4_clk_sclk_uart3,
1346 &exynos4_clk_sclk_mmc0,
1347 &exynos4_clk_sclk_mmc1,
1348 &exynos4_clk_sclk_mmc2,
1349 &exynos4_clk_sclk_mmc3,
1350 &exynos4_clk_sclk_spi0,
1351 &exynos4_clk_sclk_spi1,
1352 &exynos4_clk_sclk_spi2,
1353 &exynos4_clk_mdout_spi0,
1354 &exynos4_clk_mdout_spi1,
1355 &exynos4_clk_mdout_spi2,
1356};
1357
1358static struct clk_lookup exynos4_clk_lookup[] = {
1359 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk),
1360 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk),
1361 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk),
1362 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk),
1363 CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk),
1364 CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
1365 CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
1366 CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
1367 CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0),
1368 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1369 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
1370 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
1371 CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
1372 CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
1373 CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
1374};
1375
1376static int xtal_rate;
1377
1378static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
1379{
1380 if (soc_is_exynos4210())
1381 return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0),
1382 pll_4508);
1383 else if (soc_is_exynos4212() || soc_is_exynos4412())
1384 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0));
1385 else
1386 return 0;
1387}
1388
1389static struct clk_ops exynos4_fout_apll_ops = {
1390 .get_rate = exynos4_fout_apll_get_rate,
1391};
1392
1393static u32 exynos4_vpll_div[][8] = {
1394 { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
1395 { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
1396};
1397
1398static unsigned long exynos4_vpll_get_rate(struct clk *clk)
1399{
1400 return clk->rate;
1401}
1402
1403static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
1404{
1405 unsigned int vpll_con0, vpll_con1 = 0;
1406 unsigned int i;
1407
1408 /* Return if nothing changed */
1409 if (clk->rate == rate)
1410 return 0;
1411
1412 vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0);
1413 vpll_con0 &= ~(0x1 << 27 | \
1414 PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1415 PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1416 PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1417
1418 vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1);
1419 vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
1420 PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
1421 PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
1422
1423 for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) {
1424 if (exynos4_vpll_div[i][0] == rate) {
1425 vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
1426 vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
1427 vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
1428 vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
1429 vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT;
1430 vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT;
1431 vpll_con0 |= exynos4_vpll_div[i][7] << 27;
1432 break;
1433 }
1434 }
1435
1436 if (i == ARRAY_SIZE(exynos4_vpll_div)) {
1437 printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
1438 __func__);
1439 return -EINVAL;
1440 }
1441
1442 __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0);
1443 __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1);
1444
1445 /* Wait for VPLL lock */
1446 while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
1447 continue;
1448
1449 clk->rate = rate;
1450 return 0;
1451}
1452
1453static struct clk_ops exynos4_vpll_ops = {
1454 .get_rate = exynos4_vpll_get_rate,
1455 .set_rate = exynos4_vpll_set_rate,
1456};
1457
1458void __init_or_cpufreq exynos4_setup_clocks(void)
1459{
1460 struct clk *xtal_clk;
1461 unsigned long apll = 0;
1462 unsigned long mpll = 0;
1463 unsigned long epll = 0;
1464 unsigned long vpll = 0;
1465 unsigned long vpllsrc;
1466 unsigned long xtal;
1467 unsigned long armclk;
1468 unsigned long sclk_dmc;
1469 unsigned long aclk_200;
1470 unsigned long aclk_100;
1471 unsigned long aclk_160;
1472 unsigned long aclk_133;
1473 unsigned int ptr;
1474
1475 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1476
1477 xtal_clk = clk_get(NULL, "xtal");
1478 BUG_ON(IS_ERR(xtal_clk));
1479
1480 xtal = clk_get_rate(xtal_clk);
1481
1482 xtal_rate = xtal;
1483
1484 clk_put(xtal_clk);
1485
1486 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1487
1488 if (soc_is_exynos4210()) {
1489 apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0),
1490 pll_4508);
1491 mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0),
1492 pll_4508);
1493 epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1494 __raw_readl(EXYNOS4_EPLL_CON1), pll_4600);
1495
1496 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1497 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1498 __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c);
1499 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
1500 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0));
1501 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0));
1502 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
1503 __raw_readl(EXYNOS4_EPLL_CON1));
1504
1505 vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
1506 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
1507 __raw_readl(EXYNOS4_VPLL_CON1));
1508 } else {
1509 /* nothing */
1510 }
1511
1512 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1513 clk_fout_mpll.rate = mpll;
1514 clk_fout_epll.rate = epll;
1515 clk_fout_vpll.ops = &exynos4_vpll_ops;
1516 clk_fout_vpll.rate = vpll;
1517
1518 printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
1519 apll, mpll, epll, vpll);
1520
1521 armclk = clk_get_rate(&exynos4_clk_armclk.clk);
1522 sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk);
1523
1524 aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk);
1525 aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk);
1526 aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk);
1527 aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk);
1528
1529 printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
1530 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
1531 armclk, sclk_dmc, aclk_200,
1532 aclk_100, aclk_160, aclk_133);
1533
1534 clk_f.rate = armclk;
1535 clk_h.rate = sclk_dmc;
1536 clk_p.rate = aclk_100;
1537
1538 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++)
1539 s3c_set_clksrc(&exynos4_clksrcs[ptr], true);
1540}
1541
1542static struct clk *exynos4_clks[] __initdata = {
1543 &exynos4_clk_sclk_hdmi27m,
1544 &exynos4_clk_sclk_hdmiphy,
1545 &exynos4_clk_sclk_usbphy0,
1546 &exynos4_clk_sclk_usbphy1,
1547};
1548
1549#ifdef CONFIG_PM_SLEEP
1550static int exynos4_clock_suspend(void)
1551{
1552 s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1553 return 0;
1554}
1555
1556static void exynos4_clock_resume(void)
1557{
1558 s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
1559}
1560
1561#else
1562#define exynos4_clock_suspend NULL
1563#define exynos4_clock_resume NULL
1564#endif
1565
1566static struct syscore_ops exynos4_clock_syscore_ops = {
1567 .suspend = exynos4_clock_suspend,
1568 .resume = exynos4_clock_resume,
1569};
1570
1571void __init exynos4_register_clocks(void)
1572{
1573 int ptr;
1574
1575 s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks));
1576
1577 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++)
1578 s3c_register_clksrc(exynos4_sysclks[ptr], 1);
1579
1580 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++)
1581 s3c_register_clksrc(exynos4_sclk_tv[ptr], 1);
1582
1583 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++)
1584 s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1);
1585
1586 s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs));
1587 s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on));
1588
1589 s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev));
1590 for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++)
1591 s3c_disable_clocks(exynos4_clk_cdev[ptr], 1);
1592
1593 s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1594 s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
1595 clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
1596
1597 register_syscore_ops(&exynos4_clock_syscore_ops);
1598 s3c24xx_register_clock(&dummy_apb_pclk);
1599
1600 s3c_pwmclk_init();
1601}
diff --git a/arch/arm/mach-exynos/clock-exynos4.h b/arch/arm/mach-exynos/clock-exynos4.h
deleted file mode 100644
index bd12d5f8b63d..000000000000
--- a/arch/arm/mach-exynos/clock-exynos4.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Header file for exynos4 clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_CLOCK_H
13#define __ASM_ARCH_CLOCK_H __FILE__
14
15#include <linux/clk.h>
16
17extern struct clksrc_clk exynos4_clk_aclk_133;
18extern struct clksrc_clk exynos4_clk_mout_mpll;
19
20extern struct clksrc_sources exynos4_clkset_mout_corebus;
21extern struct clksrc_sources exynos4_clkset_group;
22
23extern struct clk *exynos4_clkset_aclk_top_list[];
24extern struct clk *exynos4_clkset_group_list[];
25
26extern struct clksrc_sources exynos4_clkset_mout_g2d0;
27extern struct clksrc_sources exynos4_clkset_mout_g2d1;
28
29extern int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable);
30extern int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable);
31extern int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable);
32extern int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable);
33extern int exynos4_clk_ip_dmc_ctrl(struct clk *clk, int enable);
34
35#endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/mach-exynos/clock-exynos4210.c b/arch/arm/mach-exynos/clock-exynos4210.c
deleted file mode 100644
index 19af9f783c56..000000000000
--- a/arch/arm/mach-exynos/clock-exynos4210.c
+++ /dev/null
@@ -1,187 +0,0 @@
1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4210 - Clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/clk.h>
15#include <linux/io.h>
16#include <linux/syscore_ops.h>
17
18#include <plat/cpu-freq.h>
19#include <plat/clock.h>
20#include <plat/cpu.h>
21#include <plat/pll.h>
22#include <plat/s5p-clock.h>
23#include <plat/clock-clksrc.h>
24#include <plat/pm.h>
25
26#include <mach/hardware.h>
27#include <mach/map.h>
28#include <mach/regs-clock.h>
29
30#include "common.h"
31#include "clock-exynos4.h"
32
33#ifdef CONFIG_PM_SLEEP
34static struct sleep_save exynos4210_clock_save[] = {
35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
37 SAVE_ITEM(EXYNOS4210_CLKSRC_LCD1),
38 SAVE_ITEM(EXYNOS4210_CLKDIV_LCD1),
39 SAVE_ITEM(EXYNOS4210_CLKSRC_MASK_LCD1),
40 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_IMAGE),
41 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_LCD1),
42 SAVE_ITEM(EXYNOS4210_CLKGATE_IP_PERIR),
43};
44#endif
45
46static struct clksrc_clk *sysclks[] = {
47 /* nothing here yet */
48};
49
50static struct clksrc_clk exynos4210_clk_mout_g2d0 = {
51 .clk = {
52 .name = "mout_g2d0",
53 },
54 .sources = &exynos4_clkset_mout_g2d0,
55 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 },
56};
57
58static struct clksrc_clk exynos4210_clk_mout_g2d1 = {
59 .clk = {
60 .name = "mout_g2d1",
61 },
62 .sources = &exynos4_clkset_mout_g2d1,
63 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 },
64};
65
66static struct clk *exynos4210_clkset_mout_g2d_list[] = {
67 [0] = &exynos4210_clk_mout_g2d0.clk,
68 [1] = &exynos4210_clk_mout_g2d1.clk,
69};
70
71static struct clksrc_sources exynos4210_clkset_mout_g2d = {
72 .sources = exynos4210_clkset_mout_g2d_list,
73 .nr_sources = ARRAY_SIZE(exynos4210_clkset_mout_g2d_list),
74};
75
76static int exynos4_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
77{
78 return s5p_gatectrl(EXYNOS4210_CLKSRC_MASK_LCD1, clk, enable);
79}
80
81static struct clksrc_clk clksrcs[] = {
82 {
83 .clk = {
84 .name = "sclk_sata",
85 .id = -1,
86 .enable = exynos4_clksrc_mask_fsys_ctrl,
87 .ctrlbit = (1 << 24),
88 },
89 .sources = &exynos4_clkset_mout_corebus,
90 .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 24, .size = 1 },
91 .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS0, .shift = 20, .size = 4 },
92 }, {
93 .clk = {
94 .name = "sclk_fimd",
95 .devname = "exynos4-fb.1",
96 .enable = exynos4_clksrc_mask_lcd1_ctrl,
97 .ctrlbit = (1 << 0),
98 },
99 .sources = &exynos4_clkset_group,
100 .reg_src = { .reg = EXYNOS4210_CLKSRC_LCD1, .shift = 0, .size = 4 },
101 .reg_div = { .reg = EXYNOS4210_CLKDIV_LCD1, .shift = 0, .size = 4 },
102 }, {
103 .clk = {
104 .name = "sclk_fimg2d",
105 },
106 .sources = &exynos4210_clkset_mout_g2d,
107 .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 },
108 .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 },
109 },
110};
111
112static struct clk init_clocks_off[] = {
113 {
114 .name = "sataphy",
115 .id = -1,
116 .parent = &exynos4_clk_aclk_133.clk,
117 .enable = exynos4_clk_ip_fsys_ctrl,
118 .ctrlbit = (1 << 3),
119 }, {
120 .name = "sata",
121 .id = -1,
122 .parent = &exynos4_clk_aclk_133.clk,
123 .enable = exynos4_clk_ip_fsys_ctrl,
124 .ctrlbit = (1 << 10),
125 }, {
126 .name = "fimd",
127 .devname = "exynos4-fb.1",
128 .enable = exynos4_clk_ip_lcd1_ctrl,
129 .ctrlbit = (1 << 0),
130 }, {
131 .name = "sysmmu",
132 .devname = "exynos-sysmmu.9",
133 .enable = exynos4_clk_ip_image_ctrl,
134 .ctrlbit = (1 << 3),
135 }, {
136 .name = "sysmmu",
137 .devname = "exynos-sysmmu.11",
138 .enable = exynos4_clk_ip_lcd1_ctrl,
139 .ctrlbit = (1 << 4),
140 }, {
141 .name = "fimg2d",
142 .enable = exynos4_clk_ip_image_ctrl,
143 .ctrlbit = (1 << 0),
144 },
145};
146
147#ifdef CONFIG_PM_SLEEP
148static int exynos4210_clock_suspend(void)
149{
150 s3c_pm_do_save(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save));
151
152 return 0;
153}
154
155static void exynos4210_clock_resume(void)
156{
157 s3c_pm_do_restore_core(exynos4210_clock_save, ARRAY_SIZE(exynos4210_clock_save));
158}
159
160#else
161#define exynos4210_clock_suspend NULL
162#define exynos4210_clock_resume NULL
163#endif
164
165static struct syscore_ops exynos4210_clock_syscore_ops = {
166 .suspend = exynos4210_clock_suspend,
167 .resume = exynos4210_clock_resume,
168};
169
170void __init exynos4210_register_clocks(void)
171{
172 int ptr;
173
174 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_CPU;
175 exynos4_clk_mout_mpll.reg_src.shift = 8;
176 exynos4_clk_mout_mpll.reg_src.size = 1;
177
178 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
179 s3c_register_clksrc(sysclks[ptr], 1);
180
181 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
182
183 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
184 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
185
186 register_syscore_ops(&exynos4210_clock_syscore_ops);
187}
diff --git a/arch/arm/mach-exynos/clock-exynos4212.c b/arch/arm/mach-exynos/clock-exynos4212.c
deleted file mode 100644
index 529476f8ec71..000000000000
--- a/arch/arm/mach-exynos/clock-exynos4212.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS4212 - Clock support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/clk.h>
15#include <linux/io.h>
16#include <linux/syscore_ops.h>
17
18#include <plat/cpu-freq.h>
19#include <plat/clock.h>
20#include <plat/cpu.h>
21#include <plat/pll.h>
22#include <plat/s5p-clock.h>
23#include <plat/clock-clksrc.h>
24#include <plat/pm.h>
25
26#include <mach/hardware.h>
27#include <mach/map.h>
28#include <mach/regs-clock.h>
29
30#include "common.h"
31#include "clock-exynos4.h"
32
33#ifdef CONFIG_PM_SLEEP
34static struct sleep_save exynos4212_clock_save[] = {
35 SAVE_ITEM(EXYNOS4_CLKSRC_IMAGE),
36 SAVE_ITEM(EXYNOS4_CLKDIV_IMAGE),
37 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_IMAGE),
38 SAVE_ITEM(EXYNOS4212_CLKGATE_IP_PERIR),
39};
40#endif
41
42static int exynos4212_clk_ip_isp0_ctrl(struct clk *clk, int enable)
43{
44 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_ISP0, clk, enable);
45}
46
47static int exynos4212_clk_ip_isp1_ctrl(struct clk *clk, int enable)
48{
49 return s5p_gatectrl(EXYNOS4_CLKGATE_IP_ISP1, clk, enable);
50}
51
52static struct clk *clk_src_mpll_user_list[] = {
53 [0] = &clk_fin_mpll,
54 [1] = &exynos4_clk_mout_mpll.clk,
55};
56
57static struct clksrc_sources clk_src_mpll_user = {
58 .sources = clk_src_mpll_user_list,
59 .nr_sources = ARRAY_SIZE(clk_src_mpll_user_list),
60};
61
62static struct clksrc_clk clk_mout_mpll_user = {
63 .clk = {
64 .name = "mout_mpll_user",
65 },
66 .sources = &clk_src_mpll_user,
67 .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 24, .size = 1 },
68};
69
70static struct clksrc_clk exynos4x12_clk_mout_g2d0 = {
71 .clk = {
72 .name = "mout_g2d0",
73 },
74 .sources = &exynos4_clkset_mout_g2d0,
75 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 20, .size = 1 },
76};
77
78static struct clksrc_clk exynos4x12_clk_mout_g2d1 = {
79 .clk = {
80 .name = "mout_g2d1",
81 },
82 .sources = &exynos4_clkset_mout_g2d1,
83 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 24, .size = 1 },
84};
85
86static struct clk *exynos4x12_clkset_mout_g2d_list[] = {
87 [0] = &exynos4x12_clk_mout_g2d0.clk,
88 [1] = &exynos4x12_clk_mout_g2d1.clk,
89};
90
91static struct clksrc_sources exynos4x12_clkset_mout_g2d = {
92 .sources = exynos4x12_clkset_mout_g2d_list,
93 .nr_sources = ARRAY_SIZE(exynos4x12_clkset_mout_g2d_list),
94};
95
96static struct clksrc_clk *sysclks[] = {
97 &clk_mout_mpll_user,
98};
99
100static struct clksrc_clk clksrcs[] = {
101 {
102 .clk = {
103 .name = "sclk_fimg2d",
104 },
105 .sources = &exynos4x12_clkset_mout_g2d,
106 .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 28, .size = 1 },
107 .reg_div = { .reg = EXYNOS4_CLKDIV_DMC1, .shift = 0, .size = 4 },
108 },
109};
110
111static struct clk init_clocks_off[] = {
112 {
113 .name = "sysmmu",
114 .devname = "exynos-sysmmu.9",
115 .enable = exynos4_clk_ip_dmc_ctrl,
116 .ctrlbit = (1 << 24),
117 }, {
118 .name = "sysmmu",
119 .devname = "exynos-sysmmu.12",
120 .enable = exynos4212_clk_ip_isp0_ctrl,
121 .ctrlbit = (7 << 8),
122 }, {
123 .name = "sysmmu",
124 .devname = "exynos-sysmmu.13",
125 .enable = exynos4212_clk_ip_isp1_ctrl,
126 .ctrlbit = (1 << 4),
127 }, {
128 .name = "sysmmu",
129 .devname = "exynos-sysmmu.14",
130 .enable = exynos4212_clk_ip_isp0_ctrl,
131 .ctrlbit = (1 << 11),
132 }, {
133 .name = "sysmmu",
134 .devname = "exynos-sysmmu.15",
135 .enable = exynos4212_clk_ip_isp0_ctrl,
136 .ctrlbit = (1 << 12),
137 }, {
138 .name = "flite",
139 .devname = "exynos-fimc-lite.0",
140 .enable = exynos4212_clk_ip_isp0_ctrl,
141 .ctrlbit = (1 << 4),
142 }, {
143 .name = "flite",
144 .devname = "exynos-fimc-lite.1",
145 .enable = exynos4212_clk_ip_isp0_ctrl,
146 .ctrlbit = (1 << 3),
147 }, {
148 .name = "fimg2d",
149 .enable = exynos4_clk_ip_dmc_ctrl,
150 .ctrlbit = (1 << 23),
151 },
152};
153
154#ifdef CONFIG_PM_SLEEP
155static int exynos4212_clock_suspend(void)
156{
157 s3c_pm_do_save(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save));
158
159 return 0;
160}
161
162static void exynos4212_clock_resume(void)
163{
164 s3c_pm_do_restore_core(exynos4212_clock_save, ARRAY_SIZE(exynos4212_clock_save));
165}
166
167#else
168#define exynos4212_clock_suspend NULL
169#define exynos4212_clock_resume NULL
170#endif
171
172static struct syscore_ops exynos4212_clock_syscore_ops = {
173 .suspend = exynos4212_clock_suspend,
174 .resume = exynos4212_clock_resume,
175};
176
177void __init exynos4212_register_clocks(void)
178{
179 int ptr;
180
181 /* usbphy1 is removed */
182 exynos4_clkset_group_list[4] = NULL;
183
184 /* mout_mpll_user is used */
185 exynos4_clkset_group_list[6] = &clk_mout_mpll_user.clk;
186 exynos4_clkset_aclk_top_list[0] = &clk_mout_mpll_user.clk;
187
188 exynos4_clk_mout_mpll.reg_src.reg = EXYNOS4_CLKSRC_DMC;
189 exynos4_clk_mout_mpll.reg_src.shift = 12;
190 exynos4_clk_mout_mpll.reg_src.size = 1;
191
192 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
193 s3c_register_clksrc(sysclks[ptr], 1);
194
195 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
196
197 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
198 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
199
200 register_syscore_ops(&exynos4212_clock_syscore_ops);
201}
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
deleted file mode 100644
index b0ea31fc9fb8..000000000000
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ /dev/null
@@ -1,1645 +0,0 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Clock support for EXYNOS5 SoCs
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27
28#include "common.h"
29
30#ifdef CONFIG_PM_SLEEP
31static struct sleep_save exynos5_clock_save[] = {
32 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_TOP),
33 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_GSCL),
34 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_DISP1_0),
35 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_FSYS),
36 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_MAUDIO),
37 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC0),
38 SAVE_ITEM(EXYNOS5_CLKSRC_MASK_PERIC1),
39 SAVE_ITEM(EXYNOS5_CLKGATE_IP_GSCL),
40 SAVE_ITEM(EXYNOS5_CLKGATE_IP_DISP1),
41 SAVE_ITEM(EXYNOS5_CLKGATE_IP_MFC),
42 SAVE_ITEM(EXYNOS5_CLKGATE_IP_G3D),
43 SAVE_ITEM(EXYNOS5_CLKGATE_IP_GEN),
44 SAVE_ITEM(EXYNOS5_CLKGATE_IP_FSYS),
45 SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIC),
46 SAVE_ITEM(EXYNOS5_CLKGATE_IP_PERIS),
47 SAVE_ITEM(EXYNOS5_CLKGATE_BLOCK),
48 SAVE_ITEM(EXYNOS5_CLKDIV_TOP0),
49 SAVE_ITEM(EXYNOS5_CLKDIV_TOP1),
50 SAVE_ITEM(EXYNOS5_CLKDIV_GSCL),
51 SAVE_ITEM(EXYNOS5_CLKDIV_DISP1_0),
52 SAVE_ITEM(EXYNOS5_CLKDIV_GEN),
53 SAVE_ITEM(EXYNOS5_CLKDIV_MAUDIO),
54 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS0),
55 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS1),
56 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS2),
57 SAVE_ITEM(EXYNOS5_CLKDIV_FSYS3),
58 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC0),
59 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC1),
60 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC2),
61 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC3),
62 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC4),
63 SAVE_ITEM(EXYNOS5_CLKDIV_PERIC5),
64 SAVE_ITEM(EXYNOS5_SCLK_DIV_ISP),
65 SAVE_ITEM(EXYNOS5_CLKSRC_TOP0),
66 SAVE_ITEM(EXYNOS5_CLKSRC_TOP1),
67 SAVE_ITEM(EXYNOS5_CLKSRC_TOP2),
68 SAVE_ITEM(EXYNOS5_CLKSRC_TOP3),
69 SAVE_ITEM(EXYNOS5_CLKSRC_GSCL),
70 SAVE_ITEM(EXYNOS5_CLKSRC_DISP1_0),
71 SAVE_ITEM(EXYNOS5_CLKSRC_MAUDIO),
72 SAVE_ITEM(EXYNOS5_CLKSRC_FSYS),
73 SAVE_ITEM(EXYNOS5_CLKSRC_PERIC0),
74 SAVE_ITEM(EXYNOS5_CLKSRC_PERIC1),
75 SAVE_ITEM(EXYNOS5_SCLK_SRC_ISP),
76 SAVE_ITEM(EXYNOS5_EPLL_CON0),
77 SAVE_ITEM(EXYNOS5_EPLL_CON1),
78 SAVE_ITEM(EXYNOS5_EPLL_CON2),
79 SAVE_ITEM(EXYNOS5_VPLL_CON0),
80 SAVE_ITEM(EXYNOS5_VPLL_CON1),
81 SAVE_ITEM(EXYNOS5_VPLL_CON2),
82 SAVE_ITEM(EXYNOS5_PWR_CTRL1),
83 SAVE_ITEM(EXYNOS5_PWR_CTRL2),
84};
85#endif
86
87static struct clk exynos5_clk_sclk_dptxphy = {
88 .name = "sclk_dptx",
89};
90
91static struct clk exynos5_clk_sclk_hdmi24m = {
92 .name = "sclk_hdmi24m",
93 .rate = 24000000,
94};
95
96static struct clk exynos5_clk_sclk_hdmi27m = {
97 .name = "sclk_hdmi27m",
98 .rate = 27000000,
99};
100
101static struct clk exynos5_clk_sclk_hdmiphy = {
102 .name = "sclk_hdmiphy",
103};
104
105static struct clk exynos5_clk_sclk_usbphy = {
106 .name = "sclk_usbphy",
107 .rate = 48000000,
108};
109
110static int exynos5_clksrc_mask_top_ctrl(struct clk *clk, int enable)
111{
112 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_TOP, clk, enable);
113}
114
115static int exynos5_clksrc_mask_disp1_0_ctrl(struct clk *clk, int enable)
116{
117 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_DISP1_0, clk, enable);
118}
119
120static int exynos5_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
121{
122 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_FSYS, clk, enable);
123}
124
125static int exynos5_clksrc_mask_gscl_ctrl(struct clk *clk, int enable)
126{
127 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_GSCL, clk, enable);
128}
129
130static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable)
131{
132 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable);
133}
134
135static int exynos5_clksrc_mask_peric1_ctrl(struct clk *clk, int enable)
136{
137 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC1, clk, enable);
138}
139
140static int exynos5_clk_ip_acp_ctrl(struct clk *clk, int enable)
141{
142 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ACP, clk, enable);
143}
144
145static int exynos5_clk_ip_core_ctrl(struct clk *clk, int enable)
146{
147 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_CORE, clk, enable);
148}
149
150static int exynos5_clk_ip_disp1_ctrl(struct clk *clk, int enable)
151{
152 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_DISP1, clk, enable);
153}
154
155static int exynos5_clk_ip_fsys_ctrl(struct clk *clk, int enable)
156{
157 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_FSYS, clk, enable);
158}
159
160static int exynos5_clk_block_ctrl(struct clk *clk, int enable)
161{
162 return s5p_gatectrl(EXYNOS5_CLKGATE_BLOCK, clk, enable);
163}
164
165static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable)
166{
167 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable);
168}
169
170static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable)
171{
172 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable);
173}
174
175static int exynos5_clk_ip_peric_ctrl(struct clk *clk, int enable)
176{
177 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIC, clk, enable);
178}
179
180static int exynos5_clk_ip_peris_ctrl(struct clk *clk, int enable)
181{
182 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIS, clk, enable);
183}
184
185static int exynos5_clk_ip_gscl_ctrl(struct clk *clk, int enable)
186{
187 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GSCL, clk, enable);
188}
189
190static int exynos5_clk_ip_isp0_ctrl(struct clk *clk, int enable)
191{
192 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP0, clk, enable);
193}
194
195static int exynos5_clk_ip_isp1_ctrl(struct clk *clk, int enable)
196{
197 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ISP1, clk, enable);
198}
199
200static int exynos5_clk_hdmiphy_ctrl(struct clk *clk, int enable)
201{
202 return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
203}
204
205/* Core list of CMU_CPU side */
206
207static struct clksrc_clk exynos5_clk_mout_apll = {
208 .clk = {
209 .name = "mout_apll",
210 },
211 .sources = &clk_src_apll,
212 .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 0, .size = 1 },
213};
214
215static struct clksrc_clk exynos5_clk_sclk_apll = {
216 .clk = {
217 .name = "sclk_apll",
218 .parent = &exynos5_clk_mout_apll.clk,
219 },
220 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 24, .size = 3 },
221};
222
223static struct clksrc_clk exynos5_clk_mout_bpll_fout = {
224 .clk = {
225 .name = "mout_bpll_fout",
226 },
227 .sources = &clk_src_bpll_fout,
228 .reg_src = { .reg = EXYNOS5_PLL_DIV2_SEL, .shift = 0, .size = 1 },
229};
230
231static struct clk *exynos5_clk_src_bpll_list[] = {
232 [0] = &clk_fin_bpll,
233 [1] = &exynos5_clk_mout_bpll_fout.clk,
234};
235
236static struct clksrc_sources exynos5_clk_src_bpll = {
237 .sources = exynos5_clk_src_bpll_list,
238 .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_list),
239};
240
241static struct clksrc_clk exynos5_clk_mout_bpll = {
242 .clk = {
243 .name = "mout_bpll",
244 },
245 .sources = &exynos5_clk_src_bpll,
246 .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 0, .size = 1 },
247};
248
249static struct clk *exynos5_clk_src_bpll_user_list[] = {
250 [0] = &clk_fin_mpll,
251 [1] = &exynos5_clk_mout_bpll.clk,
252};
253
254static struct clksrc_sources exynos5_clk_src_bpll_user = {
255 .sources = exynos5_clk_src_bpll_user_list,
256 .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_user_list),
257};
258
259static struct clksrc_clk exynos5_clk_mout_bpll_user = {
260 .clk = {
261 .name = "mout_bpll_user",
262 },
263 .sources = &exynos5_clk_src_bpll_user,
264 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 24, .size = 1 },
265};
266
267static struct clksrc_clk exynos5_clk_mout_cpll = {
268 .clk = {
269 .name = "mout_cpll",
270 },
271 .sources = &clk_src_cpll,
272 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 8, .size = 1 },
273};
274
275static struct clksrc_clk exynos5_clk_mout_epll = {
276 .clk = {
277 .name = "mout_epll",
278 },
279 .sources = &clk_src_epll,
280 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 12, .size = 1 },
281};
282
283static struct clksrc_clk exynos5_clk_mout_mpll_fout = {
284 .clk = {
285 .name = "mout_mpll_fout",
286 },
287 .sources = &clk_src_mpll_fout,
288 .reg_src = { .reg = EXYNOS5_PLL_DIV2_SEL, .shift = 4, .size = 1 },
289};
290
291static struct clk *exynos5_clk_src_mpll_list[] = {
292 [0] = &clk_fin_mpll,
293 [1] = &exynos5_clk_mout_mpll_fout.clk,
294};
295
296static struct clksrc_sources exynos5_clk_src_mpll = {
297 .sources = exynos5_clk_src_mpll_list,
298 .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_list),
299};
300
301static struct clksrc_clk exynos5_clk_mout_mpll = {
302 .clk = {
303 .name = "mout_mpll",
304 },
305 .sources = &exynos5_clk_src_mpll,
306 .reg_src = { .reg = EXYNOS5_CLKSRC_CORE1, .shift = 8, .size = 1 },
307};
308
309static struct clk *exynos_clkset_vpllsrc_list[] = {
310 [0] = &clk_fin_vpll,
311 [1] = &exynos5_clk_sclk_hdmi27m,
312};
313
314static struct clksrc_sources exynos5_clkset_vpllsrc = {
315 .sources = exynos_clkset_vpllsrc_list,
316 .nr_sources = ARRAY_SIZE(exynos_clkset_vpllsrc_list),
317};
318
319static struct clksrc_clk exynos5_clk_vpllsrc = {
320 .clk = {
321 .name = "vpll_src",
322 .enable = exynos5_clksrc_mask_top_ctrl,
323 .ctrlbit = (1 << 0),
324 },
325 .sources = &exynos5_clkset_vpllsrc,
326 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 0, .size = 1 },
327};
328
329static struct clk *exynos5_clkset_sclk_vpll_list[] = {
330 [0] = &exynos5_clk_vpllsrc.clk,
331 [1] = &clk_fout_vpll,
332};
333
334static struct clksrc_sources exynos5_clkset_sclk_vpll = {
335 .sources = exynos5_clkset_sclk_vpll_list,
336 .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_vpll_list),
337};
338
339static struct clksrc_clk exynos5_clk_sclk_vpll = {
340 .clk = {
341 .name = "sclk_vpll",
342 },
343 .sources = &exynos5_clkset_sclk_vpll,
344 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 16, .size = 1 },
345};
346
347static struct clksrc_clk exynos5_clk_sclk_pixel = {
348 .clk = {
349 .name = "sclk_pixel",
350 .parent = &exynos5_clk_sclk_vpll.clk,
351 },
352 .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 28, .size = 4 },
353};
354
355static struct clk *exynos5_clkset_sclk_hdmi_list[] = {
356 [0] = &exynos5_clk_sclk_pixel.clk,
357 [1] = &exynos5_clk_sclk_hdmiphy,
358};
359
360static struct clksrc_sources exynos5_clkset_sclk_hdmi = {
361 .sources = exynos5_clkset_sclk_hdmi_list,
362 .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_hdmi_list),
363};
364
365static struct clksrc_clk exynos5_clk_sclk_hdmi = {
366 .clk = {
367 .name = "sclk_hdmi",
368 .enable = exynos5_clksrc_mask_disp1_0_ctrl,
369 .ctrlbit = (1 << 20),
370 },
371 .sources = &exynos5_clkset_sclk_hdmi,
372 .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 20, .size = 1 },
373};
374
375static struct clksrc_clk *exynos5_sclk_tv[] = {
376 &exynos5_clk_sclk_pixel,
377 &exynos5_clk_sclk_hdmi,
378};
379
380static struct clk *exynos5_clk_src_mpll_user_list[] = {
381 [0] = &clk_fin_mpll,
382 [1] = &exynos5_clk_mout_mpll.clk,
383};
384
385static struct clksrc_sources exynos5_clk_src_mpll_user = {
386 .sources = exynos5_clk_src_mpll_user_list,
387 .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_user_list),
388};
389
390static struct clksrc_clk exynos5_clk_mout_mpll_user = {
391 .clk = {
392 .name = "mout_mpll_user",
393 },
394 .sources = &exynos5_clk_src_mpll_user,
395 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 20, .size = 1 },
396};
397
398static struct clk *exynos5_clkset_mout_cpu_list[] = {
399 [0] = &exynos5_clk_mout_apll.clk,
400 [1] = &exynos5_clk_mout_mpll.clk,
401};
402
403static struct clksrc_sources exynos5_clkset_mout_cpu = {
404 .sources = exynos5_clkset_mout_cpu_list,
405 .nr_sources = ARRAY_SIZE(exynos5_clkset_mout_cpu_list),
406};
407
408static struct clksrc_clk exynos5_clk_mout_cpu = {
409 .clk = {
410 .name = "mout_cpu",
411 },
412 .sources = &exynos5_clkset_mout_cpu,
413 .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 16, .size = 1 },
414};
415
416static struct clksrc_clk exynos5_clk_dout_armclk = {
417 .clk = {
418 .name = "dout_armclk",
419 .parent = &exynos5_clk_mout_cpu.clk,
420 },
421 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 0, .size = 3 },
422};
423
424static struct clksrc_clk exynos5_clk_dout_arm2clk = {
425 .clk = {
426 .name = "dout_arm2clk",
427 .parent = &exynos5_clk_dout_armclk.clk,
428 },
429 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 28, .size = 3 },
430};
431
432static struct clk exynos5_clk_armclk = {
433 .name = "armclk",
434 .parent = &exynos5_clk_dout_arm2clk.clk,
435};
436
437/* Core list of CMU_CDREX side */
438
439static struct clk *exynos5_clkset_cdrex_list[] = {
440 [0] = &exynos5_clk_mout_mpll.clk,
441 [1] = &exynos5_clk_mout_bpll.clk,
442};
443
444static struct clksrc_sources exynos5_clkset_cdrex = {
445 .sources = exynos5_clkset_cdrex_list,
446 .nr_sources = ARRAY_SIZE(exynos5_clkset_cdrex_list),
447};
448
449static struct clksrc_clk exynos5_clk_cdrex = {
450 .clk = {
451 .name = "clk_cdrex",
452 },
453 .sources = &exynos5_clkset_cdrex,
454 .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 4, .size = 1 },
455 .reg_div = { .reg = EXYNOS5_CLKDIV_CDREX, .shift = 16, .size = 3 },
456};
457
458static struct clksrc_clk exynos5_clk_aclk_acp = {
459 .clk = {
460 .name = "aclk_acp",
461 .parent = &exynos5_clk_mout_mpll.clk,
462 },
463 .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 0, .size = 3 },
464};
465
466static struct clksrc_clk exynos5_clk_pclk_acp = {
467 .clk = {
468 .name = "pclk_acp",
469 .parent = &exynos5_clk_aclk_acp.clk,
470 },
471 .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 4, .size = 3 },
472};
473
474/* Core list of CMU_TOP side */
475
476static struct clk *exynos5_clkset_aclk_top_list[] = {
477 [0] = &exynos5_clk_mout_mpll_user.clk,
478 [1] = &exynos5_clk_mout_bpll_user.clk,
479};
480
481static struct clksrc_sources exynos5_clkset_aclk = {
482 .sources = exynos5_clkset_aclk_top_list,
483 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list),
484};
485
486static struct clksrc_clk exynos5_clk_aclk_400 = {
487 .clk = {
488 .name = "aclk_400",
489 },
490 .sources = &exynos5_clkset_aclk,
491 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 },
492 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
493};
494
495static struct clk *exynos5_clkset_aclk_333_166_list[] = {
496 [0] = &exynos5_clk_mout_cpll.clk,
497 [1] = &exynos5_clk_mout_mpll_user.clk,
498};
499
500static struct clksrc_sources exynos5_clkset_aclk_333_166 = {
501 .sources = exynos5_clkset_aclk_333_166_list,
502 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list),
503};
504
505static struct clksrc_clk exynos5_clk_aclk_333 = {
506 .clk = {
507 .name = "aclk_333",
508 },
509 .sources = &exynos5_clkset_aclk_333_166,
510 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 16, .size = 1 },
511 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 20, .size = 3 },
512};
513
514static struct clksrc_clk exynos5_clk_aclk_166 = {
515 .clk = {
516 .name = "aclk_166",
517 },
518 .sources = &exynos5_clkset_aclk_333_166,
519 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 8, .size = 1 },
520 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 8, .size = 3 },
521};
522
523static struct clksrc_clk exynos5_clk_aclk_266 = {
524 .clk = {
525 .name = "aclk_266",
526 .parent = &exynos5_clk_mout_mpll_user.clk,
527 },
528 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 16, .size = 3 },
529};
530
531static struct clksrc_clk exynos5_clk_aclk_200 = {
532 .clk = {
533 .name = "aclk_200",
534 },
535 .sources = &exynos5_clkset_aclk,
536 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 12, .size = 1 },
537 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 12, .size = 3 },
538};
539
540static struct clksrc_clk exynos5_clk_aclk_66_pre = {
541 .clk = {
542 .name = "aclk_66_pre",
543 .parent = &exynos5_clk_mout_mpll_user.clk,
544 },
545 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP1, .shift = 24, .size = 3 },
546};
547
548static struct clksrc_clk exynos5_clk_aclk_66 = {
549 .clk = {
550 .name = "aclk_66",
551 .parent = &exynos5_clk_aclk_66_pre.clk,
552 },
553 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 },
554};
555
556static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid = {
557 .clk = {
558 .name = "mout_aclk_300_gscl_mid",
559 },
560 .sources = &exynos5_clkset_aclk,
561 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 24, .size = 1 },
562};
563
564static struct clk *exynos5_clkset_aclk_300_mid1_list[] = {
565 [0] = &exynos5_clk_sclk_vpll.clk,
566 [1] = &exynos5_clk_mout_cpll.clk,
567};
568
569static struct clksrc_sources exynos5_clkset_aclk_300_gscl_mid1 = {
570 .sources = exynos5_clkset_aclk_300_mid1_list,
571 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_mid1_list),
572};
573
574static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid1 = {
575 .clk = {
576 .name = "mout_aclk_300_gscl_mid1",
577 },
578 .sources = &exynos5_clkset_aclk_300_gscl_mid1,
579 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP1, .shift = 12, .size = 1 },
580};
581
582static struct clk *exynos5_clkset_aclk_300_gscl_list[] = {
583 [0] = &exynos5_clk_mout_aclk_300_gscl_mid.clk,
584 [1] = &exynos5_clk_mout_aclk_300_gscl_mid1.clk,
585};
586
587static struct clksrc_sources exynos5_clkset_aclk_300_gscl = {
588 .sources = exynos5_clkset_aclk_300_gscl_list,
589 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_gscl_list),
590};
591
592static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl = {
593 .clk = {
594 .name = "mout_aclk_300_gscl",
595 },
596 .sources = &exynos5_clkset_aclk_300_gscl,
597 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 25, .size = 1 },
598};
599
600static struct clk *exynos5_clk_src_gscl_300_list[] = {
601 [0] = &clk_ext_xtal_mux,
602 [1] = &exynos5_clk_mout_aclk_300_gscl.clk,
603};
604
605static struct clksrc_sources exynos5_clk_src_gscl_300 = {
606 .sources = exynos5_clk_src_gscl_300_list,
607 .nr_sources = ARRAY_SIZE(exynos5_clk_src_gscl_300_list),
608};
609
610static struct clksrc_clk exynos5_clk_aclk_300_gscl = {
611 .clk = {
612 .name = "aclk_300_gscl",
613 },
614 .sources = &exynos5_clk_src_gscl_300,
615 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 10, .size = 1 },
616};
617
618static struct clk exynos5_init_clocks_off[] = {
619 {
620 .name = "timers",
621 .parent = &exynos5_clk_aclk_66.clk,
622 .enable = exynos5_clk_ip_peric_ctrl,
623 .ctrlbit = (1 << 24),
624 }, {
625 .name = "tmu_apbif",
626 .parent = &exynos5_clk_aclk_66.clk,
627 .enable = exynos5_clk_ip_peris_ctrl,
628 .ctrlbit = (1 << 21),
629 }, {
630 .name = "rtc",
631 .parent = &exynos5_clk_aclk_66.clk,
632 .enable = exynos5_clk_ip_peris_ctrl,
633 .ctrlbit = (1 << 20),
634 }, {
635 .name = "watchdog",
636 .parent = &exynos5_clk_aclk_66.clk,
637 .enable = exynos5_clk_ip_peris_ctrl,
638 .ctrlbit = (1 << 19),
639 }, {
640 .name = "biu", /* bus interface unit clock */
641 .devname = "dw_mmc.0",
642 .parent = &exynos5_clk_aclk_200.clk,
643 .enable = exynos5_clk_ip_fsys_ctrl,
644 .ctrlbit = (1 << 12),
645 }, {
646 .name = "biu",
647 .devname = "dw_mmc.1",
648 .parent = &exynos5_clk_aclk_200.clk,
649 .enable = exynos5_clk_ip_fsys_ctrl,
650 .ctrlbit = (1 << 13),
651 }, {
652 .name = "biu",
653 .devname = "dw_mmc.2",
654 .parent = &exynos5_clk_aclk_200.clk,
655 .enable = exynos5_clk_ip_fsys_ctrl,
656 .ctrlbit = (1 << 14),
657 }, {
658 .name = "biu",
659 .devname = "dw_mmc.3",
660 .parent = &exynos5_clk_aclk_200.clk,
661 .enable = exynos5_clk_ip_fsys_ctrl,
662 .ctrlbit = (1 << 15),
663 }, {
664 .name = "sata",
665 .devname = "exynos5-sata",
666 .parent = &exynos5_clk_aclk_200.clk,
667 .enable = exynos5_clk_ip_fsys_ctrl,
668 .ctrlbit = (1 << 6),
669 }, {
670 .name = "sata-phy",
671 .devname = "exynos5-sata-phy",
672 .parent = &exynos5_clk_aclk_200.clk,
673 .enable = exynos5_clk_ip_fsys_ctrl,
674 .ctrlbit = (1 << 24),
675 }, {
676 .name = "i2c",
677 .devname = "exynos5-sata-phy-i2c",
678 .parent = &exynos5_clk_aclk_200.clk,
679 .enable = exynos5_clk_ip_fsys_ctrl,
680 .ctrlbit = (1 << 25),
681 }, {
682 .name = "mfc",
683 .devname = "s5p-mfc-v6",
684 .enable = exynos5_clk_ip_mfc_ctrl,
685 .ctrlbit = (1 << 0),
686 }, {
687 .name = "hdmi",
688 .devname = "exynos5-hdmi",
689 .enable = exynos5_clk_ip_disp1_ctrl,
690 .ctrlbit = (1 << 6),
691 }, {
692 .name = "hdmiphy",
693 .devname = "exynos5-hdmi",
694 .enable = exynos5_clk_hdmiphy_ctrl,
695 .ctrlbit = (1 << 0),
696 }, {
697 .name = "mixer",
698 .devname = "exynos5-mixer",
699 .enable = exynos5_clk_ip_disp1_ctrl,
700 .ctrlbit = (1 << 5),
701 }, {
702 .name = "dp",
703 .devname = "exynos-dp",
704 .enable = exynos5_clk_ip_disp1_ctrl,
705 .ctrlbit = (1 << 4),
706 }, {
707 .name = "jpeg",
708 .enable = exynos5_clk_ip_gen_ctrl,
709 .ctrlbit = (1 << 2),
710 }, {
711 .name = "dsim0",
712 .enable = exynos5_clk_ip_disp1_ctrl,
713 .ctrlbit = (1 << 3),
714 }, {
715 .name = "iis",
716 .devname = "samsung-i2s.1",
717 .enable = exynos5_clk_ip_peric_ctrl,
718 .ctrlbit = (1 << 20),
719 }, {
720 .name = "iis",
721 .devname = "samsung-i2s.2",
722 .enable = exynos5_clk_ip_peric_ctrl,
723 .ctrlbit = (1 << 21),
724 }, {
725 .name = "pcm",
726 .devname = "samsung-pcm.1",
727 .enable = exynos5_clk_ip_peric_ctrl,
728 .ctrlbit = (1 << 22),
729 }, {
730 .name = "pcm",
731 .devname = "samsung-pcm.2",
732 .enable = exynos5_clk_ip_peric_ctrl,
733 .ctrlbit = (1 << 23),
734 }, {
735 .name = "spdif",
736 .devname = "samsung-spdif",
737 .enable = exynos5_clk_ip_peric_ctrl,
738 .ctrlbit = (1 << 26),
739 }, {
740 .name = "ac97",
741 .devname = "samsung-ac97",
742 .enable = exynos5_clk_ip_peric_ctrl,
743 .ctrlbit = (1 << 27),
744 }, {
745 .name = "usbhost",
746 .enable = exynos5_clk_ip_fsys_ctrl ,
747 .ctrlbit = (1 << 18),
748 }, {
749 .name = "usbotg",
750 .enable = exynos5_clk_ip_fsys_ctrl,
751 .ctrlbit = (1 << 7),
752 }, {
753 .name = "nfcon",
754 .enable = exynos5_clk_ip_fsys_ctrl,
755 .ctrlbit = (1 << 22),
756 }, {
757 .name = "iop",
758 .enable = exynos5_clk_ip_fsys_ctrl,
759 .ctrlbit = ((1 << 30) | (1 << 26) | (1 << 23)),
760 }, {
761 .name = "core_iop",
762 .enable = exynos5_clk_ip_core_ctrl,
763 .ctrlbit = ((1 << 21) | (1 << 3)),
764 }, {
765 .name = "mcu_iop",
766 .enable = exynos5_clk_ip_fsys_ctrl,
767 .ctrlbit = (1 << 0),
768 }, {
769 .name = "i2c",
770 .devname = "s3c2440-i2c.0",
771 .parent = &exynos5_clk_aclk_66.clk,
772 .enable = exynos5_clk_ip_peric_ctrl,
773 .ctrlbit = (1 << 6),
774 }, {
775 .name = "i2c",
776 .devname = "s3c2440-i2c.1",
777 .parent = &exynos5_clk_aclk_66.clk,
778 .enable = exynos5_clk_ip_peric_ctrl,
779 .ctrlbit = (1 << 7),
780 }, {
781 .name = "i2c",
782 .devname = "s3c2440-i2c.2",
783 .parent = &exynos5_clk_aclk_66.clk,
784 .enable = exynos5_clk_ip_peric_ctrl,
785 .ctrlbit = (1 << 8),
786 }, {
787 .name = "i2c",
788 .devname = "s3c2440-i2c.3",
789 .parent = &exynos5_clk_aclk_66.clk,
790 .enable = exynos5_clk_ip_peric_ctrl,
791 .ctrlbit = (1 << 9),
792 }, {
793 .name = "i2c",
794 .devname = "s3c2440-i2c.4",
795 .parent = &exynos5_clk_aclk_66.clk,
796 .enable = exynos5_clk_ip_peric_ctrl,
797 .ctrlbit = (1 << 10),
798 }, {
799 .name = "i2c",
800 .devname = "s3c2440-i2c.5",
801 .parent = &exynos5_clk_aclk_66.clk,
802 .enable = exynos5_clk_ip_peric_ctrl,
803 .ctrlbit = (1 << 11),
804 }, {
805 .name = "i2c",
806 .devname = "s3c2440-i2c.6",
807 .parent = &exynos5_clk_aclk_66.clk,
808 .enable = exynos5_clk_ip_peric_ctrl,
809 .ctrlbit = (1 << 12),
810 }, {
811 .name = "i2c",
812 .devname = "s3c2440-i2c.7",
813 .parent = &exynos5_clk_aclk_66.clk,
814 .enable = exynos5_clk_ip_peric_ctrl,
815 .ctrlbit = (1 << 13),
816 }, {
817 .name = "i2c",
818 .devname = "s3c2440-hdmiphy-i2c",
819 .parent = &exynos5_clk_aclk_66.clk,
820 .enable = exynos5_clk_ip_peric_ctrl,
821 .ctrlbit = (1 << 14),
822 }, {
823 .name = "spi",
824 .devname = "exynos4210-spi.0",
825 .parent = &exynos5_clk_aclk_66.clk,
826 .enable = exynos5_clk_ip_peric_ctrl,
827 .ctrlbit = (1 << 16),
828 }, {
829 .name = "spi",
830 .devname = "exynos4210-spi.1",
831 .parent = &exynos5_clk_aclk_66.clk,
832 .enable = exynos5_clk_ip_peric_ctrl,
833 .ctrlbit = (1 << 17),
834 }, {
835 .name = "spi",
836 .devname = "exynos4210-spi.2",
837 .parent = &exynos5_clk_aclk_66.clk,
838 .enable = exynos5_clk_ip_peric_ctrl,
839 .ctrlbit = (1 << 18),
840 }, {
841 .name = "gscl",
842 .devname = "exynos-gsc.0",
843 .enable = exynos5_clk_ip_gscl_ctrl,
844 .ctrlbit = (1 << 0),
845 }, {
846 .name = "gscl",
847 .devname = "exynos-gsc.1",
848 .enable = exynos5_clk_ip_gscl_ctrl,
849 .ctrlbit = (1 << 1),
850 }, {
851 .name = "gscl",
852 .devname = "exynos-gsc.2",
853 .enable = exynos5_clk_ip_gscl_ctrl,
854 .ctrlbit = (1 << 2),
855 }, {
856 .name = "gscl",
857 .devname = "exynos-gsc.3",
858 .enable = exynos5_clk_ip_gscl_ctrl,
859 .ctrlbit = (1 << 3),
860 }, {
861 .name = "sysmmu",
862 .devname = "exynos-sysmmu.1",
863 .enable = &exynos5_clk_ip_mfc_ctrl,
864 .ctrlbit = (1 << 1),
865 }, {
866 .name = "sysmmu",
867 .devname = "exynos-sysmmu.0",
868 .enable = &exynos5_clk_ip_mfc_ctrl,
869 .ctrlbit = (1 << 2),
870 }, {
871 .name = "sysmmu",
872 .devname = "exynos-sysmmu.2",
873 .enable = &exynos5_clk_ip_disp1_ctrl,
874 .ctrlbit = (1 << 9)
875 }, {
876 .name = "sysmmu",
877 .devname = "exynos-sysmmu.3",
878 .enable = &exynos5_clk_ip_gen_ctrl,
879 .ctrlbit = (1 << 7),
880 }, {
881 .name = "sysmmu",
882 .devname = "exynos-sysmmu.4",
883 .enable = &exynos5_clk_ip_gen_ctrl,
884 .ctrlbit = (1 << 6)
885 }, {
886 .name = "sysmmu",
887 .devname = "exynos-sysmmu.5",
888 .enable = &exynos5_clk_ip_gscl_ctrl,
889 .ctrlbit = (1 << 7),
890 }, {
891 .name = "sysmmu",
892 .devname = "exynos-sysmmu.6",
893 .enable = &exynos5_clk_ip_gscl_ctrl,
894 .ctrlbit = (1 << 8),
895 }, {
896 .name = "sysmmu",
897 .devname = "exynos-sysmmu.7",
898 .enable = &exynos5_clk_ip_gscl_ctrl,
899 .ctrlbit = (1 << 9),
900 }, {
901 .name = "sysmmu",
902 .devname = "exynos-sysmmu.8",
903 .enable = &exynos5_clk_ip_gscl_ctrl,
904 .ctrlbit = (1 << 10),
905 }, {
906 .name = "sysmmu",
907 .devname = "exynos-sysmmu.9",
908 .enable = &exynos5_clk_ip_isp0_ctrl,
909 .ctrlbit = (0x3F << 8),
910 }, {
911 .name = "sysmmu",
912 .devname = "exynos-sysmmu.10",
913 .enable = &exynos5_clk_ip_isp1_ctrl,
914 .ctrlbit = (0xF << 4),
915 }, {
916 .name = "sysmmu",
917 .devname = "exynos-sysmmu.11",
918 .enable = &exynos5_clk_ip_disp1_ctrl,
919 .ctrlbit = (1 << 8)
920 }, {
921 .name = "sysmmu",
922 .devname = "exynos-sysmmu.12",
923 .enable = &exynos5_clk_ip_gscl_ctrl,
924 .ctrlbit = (1 << 11),
925 }, {
926 .name = "sysmmu",
927 .devname = "exynos-sysmmu.13",
928 .enable = &exynos5_clk_ip_gscl_ctrl,
929 .ctrlbit = (1 << 12),
930 }, {
931 .name = "sysmmu",
932 .devname = "exynos-sysmmu.14",
933 .enable = &exynos5_clk_ip_acp_ctrl,
934 .ctrlbit = (1 << 7)
935 }
936};
937
938static struct clk exynos5_init_clocks_on[] = {
939 {
940 .name = "uart",
941 .devname = "s5pv210-uart.0",
942 .enable = exynos5_clk_ip_peric_ctrl,
943 .ctrlbit = (1 << 0),
944 }, {
945 .name = "uart",
946 .devname = "s5pv210-uart.1",
947 .enable = exynos5_clk_ip_peric_ctrl,
948 .ctrlbit = (1 << 1),
949 }, {
950 .name = "uart",
951 .devname = "s5pv210-uart.2",
952 .enable = exynos5_clk_ip_peric_ctrl,
953 .ctrlbit = (1 << 2),
954 }, {
955 .name = "uart",
956 .devname = "s5pv210-uart.3",
957 .enable = exynos5_clk_ip_peric_ctrl,
958 .ctrlbit = (1 << 3),
959 }, {
960 .name = "uart",
961 .devname = "s5pv210-uart.4",
962 .enable = exynos5_clk_ip_peric_ctrl,
963 .ctrlbit = (1 << 4),
964 }, {
965 .name = "uart",
966 .devname = "s5pv210-uart.5",
967 .enable = exynos5_clk_ip_peric_ctrl,
968 .ctrlbit = (1 << 5),
969 }
970};
971
972static struct clk exynos5_clk_pdma0 = {
973 .name = "dma",
974 .devname = "dma-pl330.0",
975 .enable = exynos5_clk_ip_fsys_ctrl,
976 .ctrlbit = (1 << 1),
977};
978
979static struct clk exynos5_clk_pdma1 = {
980 .name = "dma",
981 .devname = "dma-pl330.1",
982 .enable = exynos5_clk_ip_fsys_ctrl,
983 .ctrlbit = (1 << 2),
984};
985
986static struct clk exynos5_clk_mdma1 = {
987 .name = "dma",
988 .devname = "dma-pl330.2",
989 .enable = exynos5_clk_ip_gen_ctrl,
990 .ctrlbit = (1 << 4),
991};
992
993static struct clk exynos5_clk_fimd1 = {
994 .name = "fimd",
995 .devname = "exynos5-fb.1",
996 .enable = exynos5_clk_ip_disp1_ctrl,
997 .ctrlbit = (1 << 0),
998};
999
1000static struct clk *exynos5_clkset_group_list[] = {
1001 [0] = &clk_ext_xtal_mux,
1002 [1] = NULL,
1003 [2] = &exynos5_clk_sclk_hdmi24m,
1004 [3] = &exynos5_clk_sclk_dptxphy,
1005 [4] = &exynos5_clk_sclk_usbphy,
1006 [5] = &exynos5_clk_sclk_hdmiphy,
1007 [6] = &exynos5_clk_mout_mpll_user.clk,
1008 [7] = &exynos5_clk_mout_epll.clk,
1009 [8] = &exynos5_clk_sclk_vpll.clk,
1010 [9] = &exynos5_clk_mout_cpll.clk,
1011};
1012
1013static struct clksrc_sources exynos5_clkset_group = {
1014 .sources = exynos5_clkset_group_list,
1015 .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
1016};
1017
1018/* Possible clock sources for aclk_266_gscl_sub Mux */
1019static struct clk *clk_src_gscl_266_list[] = {
1020 [0] = &clk_ext_xtal_mux,
1021 [1] = &exynos5_clk_aclk_266.clk,
1022};
1023
1024static struct clksrc_sources clk_src_gscl_266 = {
1025 .sources = clk_src_gscl_266_list,
1026 .nr_sources = ARRAY_SIZE(clk_src_gscl_266_list),
1027};
1028
1029static struct clksrc_clk exynos5_clk_dout_mmc0 = {
1030 .clk = {
1031 .name = "dout_mmc0",
1032 },
1033 .sources = &exynos5_clkset_group,
1034 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 0, .size = 4 },
1035 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 0, .size = 4 },
1036};
1037
1038static struct clksrc_clk exynos5_clk_dout_mmc1 = {
1039 .clk = {
1040 .name = "dout_mmc1",
1041 },
1042 .sources = &exynos5_clkset_group,
1043 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 4, .size = 4 },
1044 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 16, .size = 4 },
1045};
1046
1047static struct clksrc_clk exynos5_clk_dout_mmc2 = {
1048 .clk = {
1049 .name = "dout_mmc2",
1050 },
1051 .sources = &exynos5_clkset_group,
1052 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 8, .size = 4 },
1053 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 0, .size = 4 },
1054};
1055
1056static struct clksrc_clk exynos5_clk_dout_mmc3 = {
1057 .clk = {
1058 .name = "dout_mmc3",
1059 },
1060 .sources = &exynos5_clkset_group,
1061 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 12, .size = 4 },
1062 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 16, .size = 4 },
1063};
1064
1065static struct clksrc_clk exynos5_clk_dout_mmc4 = {
1066 .clk = {
1067 .name = "dout_mmc4",
1068 },
1069 .sources = &exynos5_clkset_group,
1070 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 16, .size = 4 },
1071 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 0, .size = 4 },
1072};
1073
1074static struct clksrc_clk exynos5_clk_sclk_uart0 = {
1075 .clk = {
1076 .name = "uclk1",
1077 .devname = "exynos4210-uart.0",
1078 .enable = exynos5_clksrc_mask_peric0_ctrl,
1079 .ctrlbit = (1 << 0),
1080 },
1081 .sources = &exynos5_clkset_group,
1082 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 0, .size = 4 },
1083 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 0, .size = 4 },
1084};
1085
1086static struct clksrc_clk exynos5_clk_sclk_uart1 = {
1087 .clk = {
1088 .name = "uclk1",
1089 .devname = "exynos4210-uart.1",
1090 .enable = exynos5_clksrc_mask_peric0_ctrl,
1091 .ctrlbit = (1 << 4),
1092 },
1093 .sources = &exynos5_clkset_group,
1094 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 4, .size = 4 },
1095 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 4, .size = 4 },
1096};
1097
1098static struct clksrc_clk exynos5_clk_sclk_uart2 = {
1099 .clk = {
1100 .name = "uclk1",
1101 .devname = "exynos4210-uart.2",
1102 .enable = exynos5_clksrc_mask_peric0_ctrl,
1103 .ctrlbit = (1 << 8),
1104 },
1105 .sources = &exynos5_clkset_group,
1106 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 8, .size = 4 },
1107 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 8, .size = 4 },
1108};
1109
1110static struct clksrc_clk exynos5_clk_sclk_uart3 = {
1111 .clk = {
1112 .name = "uclk1",
1113 .devname = "exynos4210-uart.3",
1114 .enable = exynos5_clksrc_mask_peric0_ctrl,
1115 .ctrlbit = (1 << 12),
1116 },
1117 .sources = &exynos5_clkset_group,
1118 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 12, .size = 4 },
1119 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 12, .size = 4 },
1120};
1121
1122static struct clksrc_clk exynos5_clk_sclk_mmc0 = {
1123 .clk = {
1124 .name = "ciu", /* card interface unit clock */
1125 .devname = "dw_mmc.0",
1126 .parent = &exynos5_clk_dout_mmc0.clk,
1127 .enable = exynos5_clksrc_mask_fsys_ctrl,
1128 .ctrlbit = (1 << 0),
1129 },
1130 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 8, .size = 8 },
1131};
1132
1133static struct clksrc_clk exynos5_clk_sclk_mmc1 = {
1134 .clk = {
1135 .name = "ciu",
1136 .devname = "dw_mmc.1",
1137 .parent = &exynos5_clk_dout_mmc1.clk,
1138 .enable = exynos5_clksrc_mask_fsys_ctrl,
1139 .ctrlbit = (1 << 4),
1140 },
1141 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 24, .size = 8 },
1142};
1143
1144static struct clksrc_clk exynos5_clk_sclk_mmc2 = {
1145 .clk = {
1146 .name = "ciu",
1147 .devname = "dw_mmc.2",
1148 .parent = &exynos5_clk_dout_mmc2.clk,
1149 .enable = exynos5_clksrc_mask_fsys_ctrl,
1150 .ctrlbit = (1 << 8),
1151 },
1152 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 8, .size = 8 },
1153};
1154
1155static struct clksrc_clk exynos5_clk_sclk_mmc3 = {
1156 .clk = {
1157 .name = "ciu",
1158 .devname = "dw_mmc.3",
1159 .parent = &exynos5_clk_dout_mmc3.clk,
1160 .enable = exynos5_clksrc_mask_fsys_ctrl,
1161 .ctrlbit = (1 << 12),
1162 },
1163 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 },
1164};
1165
1166static struct clksrc_clk exynos5_clk_mdout_spi0 = {
1167 .clk = {
1168 .name = "mdout_spi",
1169 .devname = "exynos4210-spi.0",
1170 },
1171 .sources = &exynos5_clkset_group,
1172 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 16, .size = 4 },
1173 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 0, .size = 4 },
1174};
1175
1176static struct clksrc_clk exynos5_clk_mdout_spi1 = {
1177 .clk = {
1178 .name = "mdout_spi",
1179 .devname = "exynos4210-spi.1",
1180 },
1181 .sources = &exynos5_clkset_group,
1182 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 20, .size = 4 },
1183 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 16, .size = 4 },
1184};
1185
1186static struct clksrc_clk exynos5_clk_mdout_spi2 = {
1187 .clk = {
1188 .name = "mdout_spi",
1189 .devname = "exynos4210-spi.2",
1190 },
1191 .sources = &exynos5_clkset_group,
1192 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 24, .size = 4 },
1193 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 0, .size = 4 },
1194};
1195
1196static struct clksrc_clk exynos5_clk_sclk_spi0 = {
1197 .clk = {
1198 .name = "sclk_spi",
1199 .devname = "exynos4210-spi.0",
1200 .parent = &exynos5_clk_mdout_spi0.clk,
1201 .enable = exynos5_clksrc_mask_peric1_ctrl,
1202 .ctrlbit = (1 << 16),
1203 },
1204 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 8, .size = 8 },
1205};
1206
1207static struct clksrc_clk exynos5_clk_sclk_spi1 = {
1208 .clk = {
1209 .name = "sclk_spi",
1210 .devname = "exynos4210-spi.1",
1211 .parent = &exynos5_clk_mdout_spi1.clk,
1212 .enable = exynos5_clksrc_mask_peric1_ctrl,
1213 .ctrlbit = (1 << 20),
1214 },
1215 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 24, .size = 8 },
1216};
1217
1218static struct clksrc_clk exynos5_clk_sclk_spi2 = {
1219 .clk = {
1220 .name = "sclk_spi",
1221 .devname = "exynos4210-spi.2",
1222 .parent = &exynos5_clk_mdout_spi2.clk,
1223 .enable = exynos5_clksrc_mask_peric1_ctrl,
1224 .ctrlbit = (1 << 24),
1225 },
1226 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 },
1227};
1228
1229static struct clksrc_clk exynos5_clk_sclk_fimd1 = {
1230 .clk = {
1231 .name = "sclk_fimd",
1232 .devname = "exynos5-fb.1",
1233 .enable = exynos5_clksrc_mask_disp1_0_ctrl,
1234 .ctrlbit = (1 << 0),
1235 },
1236 .sources = &exynos5_clkset_group,
1237 .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 },
1238 .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 },
1239};
1240
1241static struct clksrc_clk exynos5_clksrcs[] = {
1242 {
1243 .clk = {
1244 .name = "aclk_266_gscl",
1245 },
1246 .sources = &clk_src_gscl_266,
1247 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 8, .size = 1 },
1248 }, {
1249 .clk = {
1250 .name = "sclk_g3d",
1251 .devname = "mali-t604.0",
1252 .enable = exynos5_clk_block_ctrl,
1253 .ctrlbit = (1 << 1),
1254 },
1255 .sources = &exynos5_clkset_aclk,
1256 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 },
1257 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
1258 }, {
1259 .clk = {
1260 .name = "sclk_sata",
1261 .devname = "exynos5-sata",
1262 .enable = exynos5_clksrc_mask_fsys_ctrl,
1263 .ctrlbit = (1 << 24),
1264 },
1265 .sources = &exynos5_clkset_aclk,
1266 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 24, .size = 1 },
1267 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS0, .shift = 20, .size = 4 },
1268 }, {
1269 .clk = {
1270 .name = "sclk_gscl_wrap",
1271 .devname = "s5p-mipi-csis.0",
1272 .enable = exynos5_clksrc_mask_gscl_ctrl,
1273 .ctrlbit = (1 << 24),
1274 },
1275 .sources = &exynos5_clkset_group,
1276 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 24, .size = 4 },
1277 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 24, .size = 4 },
1278 }, {
1279 .clk = {
1280 .name = "sclk_gscl_wrap",
1281 .devname = "s5p-mipi-csis.1",
1282 .enable = exynos5_clksrc_mask_gscl_ctrl,
1283 .ctrlbit = (1 << 28),
1284 },
1285 .sources = &exynos5_clkset_group,
1286 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 28, .size = 4 },
1287 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 28, .size = 4 },
1288 }, {
1289 .clk = {
1290 .name = "sclk_cam0",
1291 .enable = exynos5_clksrc_mask_gscl_ctrl,
1292 .ctrlbit = (1 << 16),
1293 },
1294 .sources = &exynos5_clkset_group,
1295 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 16, .size = 4 },
1296 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 16, .size = 4 },
1297 }, {
1298 .clk = {
1299 .name = "sclk_cam1",
1300 .enable = exynos5_clksrc_mask_gscl_ctrl,
1301 .ctrlbit = (1 << 20),
1302 },
1303 .sources = &exynos5_clkset_group,
1304 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 20, .size = 4 },
1305 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 20, .size = 4 },
1306 }, {
1307 .clk = {
1308 .name = "sclk_jpeg",
1309 .parent = &exynos5_clk_mout_cpll.clk,
1310 },
1311 .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
1312 },
1313};
1314
1315/* Clock initialization code */
1316static struct clksrc_clk *exynos5_sysclks[] = {
1317 &exynos5_clk_mout_apll,
1318 &exynos5_clk_sclk_apll,
1319 &exynos5_clk_mout_bpll,
1320 &exynos5_clk_mout_bpll_fout,
1321 &exynos5_clk_mout_bpll_user,
1322 &exynos5_clk_mout_cpll,
1323 &exynos5_clk_mout_epll,
1324 &exynos5_clk_mout_mpll,
1325 &exynos5_clk_mout_mpll_fout,
1326 &exynos5_clk_mout_mpll_user,
1327 &exynos5_clk_vpllsrc,
1328 &exynos5_clk_sclk_vpll,
1329 &exynos5_clk_mout_cpu,
1330 &exynos5_clk_dout_armclk,
1331 &exynos5_clk_dout_arm2clk,
1332 &exynos5_clk_cdrex,
1333 &exynos5_clk_aclk_400,
1334 &exynos5_clk_aclk_333,
1335 &exynos5_clk_aclk_266,
1336 &exynos5_clk_aclk_200,
1337 &exynos5_clk_aclk_166,
1338 &exynos5_clk_aclk_300_gscl,
1339 &exynos5_clk_mout_aclk_300_gscl,
1340 &exynos5_clk_mout_aclk_300_gscl_mid,
1341 &exynos5_clk_mout_aclk_300_gscl_mid1,
1342 &exynos5_clk_aclk_66_pre,
1343 &exynos5_clk_aclk_66,
1344 &exynos5_clk_dout_mmc0,
1345 &exynos5_clk_dout_mmc1,
1346 &exynos5_clk_dout_mmc2,
1347 &exynos5_clk_dout_mmc3,
1348 &exynos5_clk_dout_mmc4,
1349 &exynos5_clk_aclk_acp,
1350 &exynos5_clk_pclk_acp,
1351 &exynos5_clk_sclk_spi0,
1352 &exynos5_clk_sclk_spi1,
1353 &exynos5_clk_sclk_spi2,
1354 &exynos5_clk_mdout_spi0,
1355 &exynos5_clk_mdout_spi1,
1356 &exynos5_clk_mdout_spi2,
1357 &exynos5_clk_sclk_fimd1,
1358};
1359
1360static struct clk *exynos5_clk_cdev[] = {
1361 &exynos5_clk_pdma0,
1362 &exynos5_clk_pdma1,
1363 &exynos5_clk_mdma1,
1364 &exynos5_clk_fimd1,
1365};
1366
1367static struct clksrc_clk *exynos5_clksrc_cdev[] = {
1368 &exynos5_clk_sclk_uart0,
1369 &exynos5_clk_sclk_uart1,
1370 &exynos5_clk_sclk_uart2,
1371 &exynos5_clk_sclk_uart3,
1372 &exynos5_clk_sclk_mmc0,
1373 &exynos5_clk_sclk_mmc1,
1374 &exynos5_clk_sclk_mmc2,
1375 &exynos5_clk_sclk_mmc3,
1376};
1377
1378static struct clk_lookup exynos5_clk_lookup[] = {
1379 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos5_clk_sclk_uart0.clk),
1380 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk),
1381 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk),
1382 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk),
1383 CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk),
1384 CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk),
1385 CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk),
1386 CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk),
1387 CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos5_clk_sclk_spi0.clk),
1388 CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos5_clk_sclk_spi1.clk),
1389 CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos5_clk_sclk_spi2.clk),
1390 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0),
1391 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1),
1392 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1),
1393 CLKDEV_INIT("exynos5-fb.1", "lcd", &exynos5_clk_fimd1),
1394};
1395
1396static unsigned long exynos5_epll_get_rate(struct clk *clk)
1397{
1398 return clk->rate;
1399}
1400
1401static struct clk *exynos5_clks[] __initdata = {
1402 &exynos5_clk_sclk_hdmi27m,
1403 &exynos5_clk_sclk_hdmiphy,
1404 &clk_fout_bpll,
1405 &clk_fout_bpll_div2,
1406 &clk_fout_cpll,
1407 &clk_fout_mpll_div2,
1408 &exynos5_clk_armclk,
1409};
1410
1411static u32 epll_div[][6] = {
1412 { 192000000, 0, 48, 3, 1, 0 },
1413 { 180000000, 0, 45, 3, 1, 0 },
1414 { 73728000, 1, 73, 3, 3, 47710 },
1415 { 67737600, 1, 90, 4, 3, 20762 },
1416 { 49152000, 0, 49, 3, 3, 9961 },
1417 { 45158400, 0, 45, 3, 3, 10381 },
1418 { 180633600, 0, 45, 3, 1, 10381 },
1419};
1420
1421static int exynos5_epll_set_rate(struct clk *clk, unsigned long rate)
1422{
1423 unsigned int epll_con, epll_con_k;
1424 unsigned int i;
1425 unsigned int tmp;
1426 unsigned int epll_rate;
1427 unsigned int locktime;
1428 unsigned int lockcnt;
1429
1430 /* Return if nothing changed */
1431 if (clk->rate == rate)
1432 return 0;
1433
1434 if (clk->parent)
1435 epll_rate = clk_get_rate(clk->parent);
1436 else
1437 epll_rate = clk_ext_xtal_mux.rate;
1438
1439 if (epll_rate != 24000000) {
1440 pr_err("Invalid Clock : recommended clock is 24MHz.\n");
1441 return -EINVAL;
1442 }
1443
1444 epll_con = __raw_readl(EXYNOS5_EPLL_CON0);
1445 epll_con &= ~(0x1 << 27 | \
1446 PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1447 PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1448 PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1449
1450 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
1451 if (epll_div[i][0] == rate) {
1452 epll_con_k = epll_div[i][5] << 0;
1453 epll_con |= epll_div[i][1] << 27;
1454 epll_con |= epll_div[i][2] << PLL46XX_MDIV_SHIFT;
1455 epll_con |= epll_div[i][3] << PLL46XX_PDIV_SHIFT;
1456 epll_con |= epll_div[i][4] << PLL46XX_SDIV_SHIFT;
1457 break;
1458 }
1459 }
1460
1461 if (i == ARRAY_SIZE(epll_div)) {
1462 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n",
1463 __func__);
1464 return -EINVAL;
1465 }
1466
1467 epll_rate /= 1000000;
1468
1469 /* 3000 max_cycls : specification data */
1470 locktime = 3000 / epll_rate * epll_div[i][3];
1471 lockcnt = locktime * 10000 / (10000 / epll_rate);
1472
1473 __raw_writel(lockcnt, EXYNOS5_EPLL_LOCK);
1474
1475 __raw_writel(epll_con, EXYNOS5_EPLL_CON0);
1476 __raw_writel(epll_con_k, EXYNOS5_EPLL_CON1);
1477
1478 do {
1479 tmp = __raw_readl(EXYNOS5_EPLL_CON0);
1480 } while (!(tmp & 0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT));
1481
1482 clk->rate = rate;
1483
1484 return 0;
1485}
1486
1487static struct clk_ops exynos5_epll_ops = {
1488 .get_rate = exynos5_epll_get_rate,
1489 .set_rate = exynos5_epll_set_rate,
1490};
1491
1492static int xtal_rate;
1493
1494static unsigned long exynos5_fout_apll_get_rate(struct clk *clk)
1495{
1496 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS5_APLL_CON0));
1497}
1498
1499static struct clk_ops exynos5_fout_apll_ops = {
1500 .get_rate = exynos5_fout_apll_get_rate,
1501};
1502
1503#ifdef CONFIG_PM
1504static int exynos5_clock_suspend(void)
1505{
1506 s3c_pm_do_save(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save));
1507
1508 return 0;
1509}
1510
1511static void exynos5_clock_resume(void)
1512{
1513 s3c_pm_do_restore_core(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save));
1514}
1515#else
1516#define exynos5_clock_suspend NULL
1517#define exynos5_clock_resume NULL
1518#endif
1519
1520static struct syscore_ops exynos5_clock_syscore_ops = {
1521 .suspend = exynos5_clock_suspend,
1522 .resume = exynos5_clock_resume,
1523};
1524
1525void __init_or_cpufreq exynos5_setup_clocks(void)
1526{
1527 struct clk *xtal_clk;
1528 unsigned long apll;
1529 unsigned long bpll;
1530 unsigned long cpll;
1531 unsigned long mpll;
1532 unsigned long epll;
1533 unsigned long vpll;
1534 unsigned long vpllsrc;
1535 unsigned long xtal;
1536 unsigned long armclk;
1537 unsigned long mout_cdrex;
1538 unsigned long aclk_400;
1539 unsigned long aclk_333;
1540 unsigned long aclk_266;
1541 unsigned long aclk_200;
1542 unsigned long aclk_166;
1543 unsigned long aclk_66;
1544 unsigned int ptr;
1545
1546 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1547
1548 xtal_clk = clk_get(NULL, "xtal");
1549 BUG_ON(IS_ERR(xtal_clk));
1550
1551 xtal = clk_get_rate(xtal_clk);
1552
1553 xtal_rate = xtal;
1554
1555 clk_put(xtal_clk);
1556
1557 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1558
1559 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_APLL_CON0));
1560 bpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_BPLL_CON0));
1561 cpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_CPLL_CON0));
1562 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_MPLL_CON0));
1563 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS5_EPLL_CON0),
1564 __raw_readl(EXYNOS5_EPLL_CON1));
1565
1566 vpllsrc = clk_get_rate(&exynos5_clk_vpllsrc.clk);
1567 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS5_VPLL_CON0),
1568 __raw_readl(EXYNOS5_VPLL_CON1));
1569
1570 clk_fout_apll.ops = &exynos5_fout_apll_ops;
1571 clk_fout_bpll.rate = bpll;
1572 clk_fout_bpll_div2.rate = bpll >> 1;
1573 clk_fout_cpll.rate = cpll;
1574 clk_fout_mpll.rate = mpll;
1575 clk_fout_mpll_div2.rate = mpll >> 1;
1576 clk_fout_epll.rate = epll;
1577 clk_fout_vpll.rate = vpll;
1578
1579 printk(KERN_INFO "EXYNOS5: PLL settings, A=%ld, B=%ld, C=%ld\n"
1580 "M=%ld, E=%ld V=%ld",
1581 apll, bpll, cpll, mpll, epll, vpll);
1582
1583 armclk = clk_get_rate(&exynos5_clk_armclk);
1584 mout_cdrex = clk_get_rate(&exynos5_clk_cdrex.clk);
1585
1586 aclk_400 = clk_get_rate(&exynos5_clk_aclk_400.clk);
1587 aclk_333 = clk_get_rate(&exynos5_clk_aclk_333.clk);
1588 aclk_266 = clk_get_rate(&exynos5_clk_aclk_266.clk);
1589 aclk_200 = clk_get_rate(&exynos5_clk_aclk_200.clk);
1590 aclk_166 = clk_get_rate(&exynos5_clk_aclk_166.clk);
1591 aclk_66 = clk_get_rate(&exynos5_clk_aclk_66.clk);
1592
1593 printk(KERN_INFO "EXYNOS5: ARMCLK=%ld, CDREX=%ld, ACLK400=%ld\n"
1594 "ACLK333=%ld, ACLK266=%ld, ACLK200=%ld\n"
1595 "ACLK166=%ld, ACLK66=%ld\n",
1596 armclk, mout_cdrex, aclk_400,
1597 aclk_333, aclk_266, aclk_200,
1598 aclk_166, aclk_66);
1599
1600
1601 clk_fout_epll.ops = &exynos5_epll_ops;
1602
1603 if (clk_set_parent(&exynos5_clk_mout_epll.clk, &clk_fout_epll))
1604 printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
1605 clk_fout_epll.name, exynos5_clk_mout_epll.clk.name);
1606
1607 clk_set_rate(&exynos5_clk_sclk_apll.clk, 100000000);
1608 clk_set_rate(&exynos5_clk_aclk_266.clk, 300000000);
1609
1610 clk_set_rate(&exynos5_clk_aclk_acp.clk, 267000000);
1611 clk_set_rate(&exynos5_clk_pclk_acp.clk, 134000000);
1612
1613 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrcs); ptr++)
1614 s3c_set_clksrc(&exynos5_clksrcs[ptr], true);
1615}
1616
1617void __init exynos5_register_clocks(void)
1618{
1619 int ptr;
1620
1621 s3c24xx_register_clocks(exynos5_clks, ARRAY_SIZE(exynos5_clks));
1622
1623 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sysclks); ptr++)
1624 s3c_register_clksrc(exynos5_sysclks[ptr], 1);
1625
1626 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sclk_tv); ptr++)
1627 s3c_register_clksrc(exynos5_sclk_tv[ptr], 1);
1628
1629 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrc_cdev); ptr++)
1630 s3c_register_clksrc(exynos5_clksrc_cdev[ptr], 1);
1631
1632 s3c_register_clksrc(exynos5_clksrcs, ARRAY_SIZE(exynos5_clksrcs));
1633 s3c_register_clocks(exynos5_init_clocks_on, ARRAY_SIZE(exynos5_init_clocks_on));
1634
1635 s3c24xx_register_clocks(exynos5_clk_cdev, ARRAY_SIZE(exynos5_clk_cdev));
1636 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clk_cdev); ptr++)
1637 s3c_disable_clocks(exynos5_clk_cdev[ptr], 1);
1638
1639 s3c_register_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off));
1640 s3c_disable_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off));
1641 clkdev_add_table(exynos5_clk_lookup, ARRAY_SIZE(exynos5_clk_lookup));
1642
1643 register_syscore_ops(&exynos5_clock_syscore_ops);
1644 s3c_pwmclk_init();
1645}
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index d63d399c7bae..46089fe24705 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -23,9 +23,11 @@
23#include <linux/of_irq.h> 23#include <linux/of_irq.h>
24#include <linux/export.h> 24#include <linux/export.h>
25#include <linux/irqdomain.h> 25#include <linux/irqdomain.h>
26#include <linux/irqchip.h>
27#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/clocksource.h>
28#include <linux/clk-provider.h>
28#include <linux/irqchip/arm-gic.h> 29#include <linux/irqchip/arm-gic.h>
30#include <linux/irqchip/chained_irq.h>
29 31
30#include <asm/proc-fns.h> 32#include <asm/proc-fns.h>
31#include <asm/exception.h> 33#include <asm/exception.h>
@@ -37,9 +39,9 @@
37#include <mach/regs-irq.h> 39#include <mach/regs-irq.h>
38#include <mach/regs-pmu.h> 40#include <mach/regs-pmu.h>
39#include <mach/regs-gpio.h> 41#include <mach/regs-gpio.h>
42#include <mach/irqs.h>
40 43
41#include <plat/cpu.h> 44#include <plat/cpu.h>
42#include <plat/clock.h>
43#include <plat/devs.h> 45#include <plat/devs.h>
44#include <plat/pm.h> 46#include <plat/pm.h>
45#include <plat/sdhci.h> 47#include <plat/sdhci.h>
@@ -65,17 +67,16 @@ static const char name_exynos5440[] = "EXYNOS5440";
65static void exynos4_map_io(void); 67static void exynos4_map_io(void);
66static void exynos5_map_io(void); 68static void exynos5_map_io(void);
67static void exynos5440_map_io(void); 69static void exynos5440_map_io(void);
68static void exynos4_init_clocks(int xtal);
69static void exynos5_init_clocks(int xtal);
70static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no); 70static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no);
71static int exynos_init(void); 71static int exynos_init(void);
72 72
73unsigned long xxti_f = 0, xusbxti_f = 0;
74
73static struct cpu_table cpu_ids[] __initdata = { 75static struct cpu_table cpu_ids[] __initdata = {
74 { 76 {
75 .idcode = EXYNOS4210_CPU_ID, 77 .idcode = EXYNOS4210_CPU_ID,
76 .idmask = EXYNOS4_CPU_MASK, 78 .idmask = EXYNOS4_CPU_MASK,
77 .map_io = exynos4_map_io, 79 .map_io = exynos4_map_io,
78 .init_clocks = exynos4_init_clocks,
79 .init_uarts = exynos4_init_uarts, 80 .init_uarts = exynos4_init_uarts,
80 .init = exynos_init, 81 .init = exynos_init,
81 .name = name_exynos4210, 82 .name = name_exynos4210,
@@ -83,7 +84,6 @@ static struct cpu_table cpu_ids[] __initdata = {
83 .idcode = EXYNOS4212_CPU_ID, 84 .idcode = EXYNOS4212_CPU_ID,
84 .idmask = EXYNOS4_CPU_MASK, 85 .idmask = EXYNOS4_CPU_MASK,
85 .map_io = exynos4_map_io, 86 .map_io = exynos4_map_io,
86 .init_clocks = exynos4_init_clocks,
87 .init_uarts = exynos4_init_uarts, 87 .init_uarts = exynos4_init_uarts,
88 .init = exynos_init, 88 .init = exynos_init,
89 .name = name_exynos4212, 89 .name = name_exynos4212,
@@ -91,7 +91,6 @@ static struct cpu_table cpu_ids[] __initdata = {
91 .idcode = EXYNOS4412_CPU_ID, 91 .idcode = EXYNOS4412_CPU_ID,
92 .idmask = EXYNOS4_CPU_MASK, 92 .idmask = EXYNOS4_CPU_MASK,
93 .map_io = exynos4_map_io, 93 .map_io = exynos4_map_io,
94 .init_clocks = exynos4_init_clocks,
95 .init_uarts = exynos4_init_uarts, 94 .init_uarts = exynos4_init_uarts,
96 .init = exynos_init, 95 .init = exynos_init,
97 .name = name_exynos4412, 96 .name = name_exynos4412,
@@ -99,7 +98,6 @@ static struct cpu_table cpu_ids[] __initdata = {
99 .idcode = EXYNOS5250_SOC_ID, 98 .idcode = EXYNOS5250_SOC_ID,
100 .idmask = EXYNOS5_SOC_MASK, 99 .idmask = EXYNOS5_SOC_MASK,
101 .map_io = exynos5_map_io, 100 .map_io = exynos5_map_io,
102 .init_clocks = exynos5_init_clocks,
103 .init = exynos_init, 101 .init = exynos_init,
104 .name = name_exynos5250, 102 .name = name_exynos5250,
105 }, { 103 }, {
@@ -235,6 +233,33 @@ static struct map_desc exynos4_iodesc1[] __initdata = {
235 }, 233 },
236}; 234};
237 235
236static struct map_desc exynos4210_iodesc[] __initdata = {
237 {
238 .virtual = (unsigned long)S5P_VA_SYSRAM_NS,
239 .pfn = __phys_to_pfn(EXYNOS4210_PA_SYSRAM_NS),
240 .length = SZ_4K,
241 .type = MT_DEVICE,
242 },
243};
244
245static struct map_desc exynos4x12_iodesc[] __initdata = {
246 {
247 .virtual = (unsigned long)S5P_VA_SYSRAM_NS,
248 .pfn = __phys_to_pfn(EXYNOS4x12_PA_SYSRAM_NS),
249 .length = SZ_4K,
250 .type = MT_DEVICE,
251 },
252};
253
254static struct map_desc exynos5250_iodesc[] __initdata = {
255 {
256 .virtual = (unsigned long)S5P_VA_SYSRAM_NS,
257 .pfn = __phys_to_pfn(EXYNOS5250_PA_SYSRAM_NS),
258 .length = SZ_4K,
259 .type = MT_DEVICE,
260 },
261};
262
238static struct map_desc exynos5_iodesc[] __initdata = { 263static struct map_desc exynos5_iodesc[] __initdata = {
239 { 264 {
240 .virtual = (unsigned long)S3C_VA_SYS, 265 .virtual = (unsigned long)S3C_VA_SYS,
@@ -257,11 +282,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
257 .length = SZ_4K, 282 .length = SZ_4K,
258 .type = MT_DEVICE, 283 .type = MT_DEVICE,
259 }, { 284 }, {
260 .virtual = (unsigned long)S5P_VA_SYSTIMER,
261 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSTIMER),
262 .length = SZ_4K,
263 .type = MT_DEVICE,
264 }, {
265 .virtual = (unsigned long)S5P_VA_SYSRAM, 285 .virtual = (unsigned long)S5P_VA_SYSRAM,
266 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), 286 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM),
267 .length = SZ_4K, 287 .length = SZ_4K,
@@ -368,6 +388,11 @@ static void __init exynos4_map_io(void)
368 else 388 else
369 iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1)); 389 iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1));
370 390
391 if (soc_is_exynos4210())
392 iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc));
393 if (soc_is_exynos4212() || soc_is_exynos4412())
394 iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc));
395
371 /* initialize device information early */ 396 /* initialize device information early */
372 exynos4_default_sdhci0(); 397 exynos4_default_sdhci0();
373 exynos4_default_sdhci1(); 398 exynos4_default_sdhci1();
@@ -400,22 +425,9 @@ static void __init exynos4_map_io(void)
400static void __init exynos5_map_io(void) 425static void __init exynos5_map_io(void)
401{ 426{
402 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); 427 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
403}
404
405static void __init exynos4_init_clocks(int xtal)
406{
407 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
408
409 s3c24xx_register_baseclocks(xtal);
410 s5p_register_clocks(xtal);
411
412 if (soc_is_exynos4210())
413 exynos4210_register_clocks();
414 else if (soc_is_exynos4212() || soc_is_exynos4412())
415 exynos4212_register_clocks();
416 428
417 exynos4_register_clocks(); 429 if (soc_is_exynos5250())
418 exynos4_setup_clocks(); 430 iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
419} 431}
420 432
421static void __init exynos5440_map_io(void) 433static void __init exynos5440_map_io(void)
@@ -423,22 +435,21 @@ static void __init exynos5440_map_io(void)
423 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); 435 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0));
424} 436}
425 437
426static void __init exynos5_init_clocks(int xtal) 438void __init exynos_init_time(void)
427{ 439{
428 printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 440 if (of_have_populated_dt()) {
429 441#ifdef CONFIG_OF
430 /* EXYNOS5440 can support only common clock framework */ 442 of_clk_init(NULL);
431 443 clocksource_of_init();
432 if (soc_is_exynos5440()) 444#endif
433 return; 445 } else {
434 446 /* todo: remove after migrating legacy E4 platforms to dt */
435#ifdef CONFIG_SOC_EXYNOS5250 447#ifdef CONFIG_ARCH_EXYNOS4
436 s3c24xx_register_baseclocks(xtal); 448 exynos4_clk_init(NULL);
437 s5p_register_clocks(xtal); 449 exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f);
438
439 exynos5_register_clocks();
440 exynos5_setup_clocks();
441#endif 450#endif
451 mct_init();
452 }
442} 453}
443 454
444void __init exynos4_init_irq(void) 455void __init exynos4_init_irq(void)
@@ -463,6 +474,8 @@ void __init exynos4_init_irq(void)
463 * uses GIC instead of VIC. 474 * uses GIC instead of VIC.
464 */ 475 */
465 s5p_init_irq(NULL, 0); 476 s5p_init_irq(NULL, 0);
477
478 gic_arch_extn.irq_set_wake = s3c_irq_wake;
466} 479}
467 480
468void __init exynos5_init_irq(void) 481void __init exynos5_init_irq(void)
@@ -822,6 +835,7 @@ static int __init exynos_init_irq_eint(void)
822 static const struct of_device_id exynos_pinctrl_ids[] = { 835 static const struct of_device_id exynos_pinctrl_ids[] = {
823 { .compatible = "samsung,exynos4210-pinctrl", }, 836 { .compatible = "samsung,exynos4210-pinctrl", },
824 { .compatible = "samsung,exynos4x12-pinctrl", }, 837 { .compatible = "samsung,exynos4x12-pinctrl", },
838 { .compatible = "samsung,exynos5250-pinctrl", },
825 }; 839 };
826 struct device_node *pctrl_np, *wkup_np; 840 struct device_node *pctrl_np, *wkup_np;
827 const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; 841 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
@@ -875,3 +889,30 @@ static int __init exynos_init_irq_eint(void)
875 return 0; 889 return 0;
876} 890}
877arch_initcall(exynos_init_irq_eint); 891arch_initcall(exynos_init_irq_eint);
892
893static struct resource exynos4_pmu_resource[] = {
894 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU),
895 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1),
896#if defined(CONFIG_SOC_EXYNOS4412)
897 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2),
898 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3),
899#endif
900};
901
902static struct platform_device exynos4_device_pmu = {
903 .name = "arm-pmu",
904 .num_resources = ARRAY_SIZE(exynos4_pmu_resource),
905 .resource = exynos4_pmu_resource,
906};
907
908static int __init exynos_armpmu_init(void)
909{
910 if (!of_have_populated_dt()) {
911 if (soc_is_exynos4210() || soc_is_exynos4212())
912 exynos4_device_pmu.num_resources = 2;
913 platform_device_register(&exynos4_device_pmu);
914 }
915
916 return 0;
917}
918arch_initcall(exynos_armpmu_init);
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9339bb8954be..b17448c1a164 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,7 +12,11 @@
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H 13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14 14
15extern void exynos4_timer_init(void); 15#include <linux/of.h>
16
17extern void mct_init(void);
18void exynos_init_time(void);
19extern unsigned long xxti_f, xusbxti_f;
16 20
17struct map_desc; 21struct map_desc;
18void exynos_init_io(struct map_desc *mach_desc, int size); 22void exynos_init_io(struct map_desc *mach_desc, int size);
@@ -22,6 +26,12 @@ void exynos4_restart(char mode, const char *cmd);
22void exynos5_restart(char mode, const char *cmd); 26void exynos5_restart(char mode, const char *cmd);
23void exynos_init_late(void); 27void exynos_init_late(void);
24 28
29/* ToDo: remove these after migrating legacy exynos4 platforms to dt */
30void exynos4_clk_init(struct device_node *np);
31void exynos4_clk_register_fixed_ext(unsigned long, unsigned long);
32
33void exynos_firmware_init(void);
34
25#ifdef CONFIG_PM_GENERIC_DOMAINS 35#ifdef CONFIG_PM_GENERIC_DOMAINS
26int exynos_pm_late_initcall(void); 36int exynos_pm_late_initcall(void);
27#else 37#else
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index fcfe0251aa3e..17a18ff3d71e 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -41,24 +41,24 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
41 struct cpuidle_driver *drv, 41 struct cpuidle_driver *drv,
42 int index); 42 int index);
43 43
44static struct cpuidle_state exynos4_cpuidle_set[] __initdata = {
45 [0] = ARM_CPUIDLE_WFI_STATE,
46 [1] = {
47 .enter = exynos4_enter_lowpower,
48 .exit_latency = 300,
49 .target_residency = 100000,
50 .flags = CPUIDLE_FLAG_TIME_VALID,
51 .name = "C1",
52 .desc = "ARM power down",
53 },
54};
55
56static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); 44static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
57 45
58static struct cpuidle_driver exynos4_idle_driver = { 46static struct cpuidle_driver exynos4_idle_driver = {
59 .name = "exynos4_idle", 47 .name = "exynos4_idle",
60 .owner = THIS_MODULE, 48 .owner = THIS_MODULE,
61 .en_core_tk_irqen = 1, 49 .states = {
50 [0] = ARM_CPUIDLE_WFI_STATE,
51 [1] = {
52 .enter = exynos4_enter_lowpower,
53 .exit_latency = 300,
54 .target_residency = 100000,
55 .flags = CPUIDLE_FLAG_TIME_VALID,
56 .name = "C1",
57 .desc = "ARM power down",
58 },
59 },
60 .state_count = 2,
61 .safe_state_index = 0,
62}; 62};
63 63
64/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ 64/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
@@ -193,37 +193,30 @@ static void __init exynos5_core_down_clk(void)
193 193
194static int __init exynos4_init_cpuidle(void) 194static int __init exynos4_init_cpuidle(void)
195{ 195{
196 int i, max_cpuidle_state, cpu_id; 196 int cpu_id, ret;
197 struct cpuidle_device *device; 197 struct cpuidle_device *device;
198 struct cpuidle_driver *drv = &exynos4_idle_driver;
199 198
200 if (soc_is_exynos5250()) 199 if (soc_is_exynos5250())
201 exynos5_core_down_clk(); 200 exynos5_core_down_clk();
202 201
203 /* Setup cpuidle driver */ 202 ret = cpuidle_register_driver(&exynos4_idle_driver);
204 drv->state_count = (sizeof(exynos4_cpuidle_set) / 203 if (ret) {
205 sizeof(struct cpuidle_state)); 204 printk(KERN_ERR "CPUidle failed to register driver\n");
206 max_cpuidle_state = drv->state_count; 205 return ret;
207 for (i = 0; i < max_cpuidle_state; i++) {
208 memcpy(&drv->states[i], &exynos4_cpuidle_set[i],
209 sizeof(struct cpuidle_state));
210 } 206 }
211 drv->safe_state_index = 0;
212 cpuidle_register_driver(&exynos4_idle_driver);
213 207
214 for_each_cpu(cpu_id, cpu_online_mask) { 208 for_each_online_cpu(cpu_id) {
215 device = &per_cpu(exynos4_cpuidle_device, cpu_id); 209 device = &per_cpu(exynos4_cpuidle_device, cpu_id);
216 device->cpu = cpu_id; 210 device->cpu = cpu_id;
217 211
218 if (cpu_id == 0) 212 /* Support IDLE only */
219 device->state_count = (sizeof(exynos4_cpuidle_set) / 213 if (cpu_id != 0)
220 sizeof(struct cpuidle_state)); 214 device->state_count = 1;
221 else
222 device->state_count = 1; /* Support IDLE only */
223 215
224 if (cpuidle_register_device(device)) { 216 ret = cpuidle_register_device(device);
225 printk(KERN_ERR "CPUidle register device failed\n,"); 217 if (ret) {
226 return -EIO; 218 printk(KERN_ERR "CPUidle register device failed\n");
219 return ret;
227 } 220 }
228 } 221 }
229 222
diff --git a/arch/arm/mach-exynos/dev-ohci.c b/arch/arm/mach-exynos/dev-ohci.c
index 4244d02dafbd..d5bc129e6bb7 100644
--- a/arch/arm/mach-exynos/dev-ohci.c
+++ b/arch/arm/mach-exynos/dev-ohci.c
@@ -12,7 +12,7 @@
12 12
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/platform_data/usb-exynos.h> 15#include <linux/platform_data/usb-ohci-exynos.h>
16 16
17#include <mach/irqs.h> 17#include <mach/irqs.h>
18#include <mach/map.h> 18#include <mach/map.h>
diff --git a/arch/arm/mach-exynos/dev-uart.c b/arch/arm/mach-exynos/dev-uart.c
index 7c42f4b7c8be..c48aff02c786 100644
--- a/arch/arm/mach-exynos/dev-uart.c
+++ b/arch/arm/mach-exynos/dev-uart.c
@@ -20,6 +20,7 @@
20#include <asm/mach/irq.h> 20#include <asm/mach/irq.h>
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/map.h> 22#include <mach/map.h>
23#include <mach/irqs.h>
23 24
24#include <plat/devs.h> 25#include <plat/devs.h>
25 26
diff --git a/arch/arm/mach-exynos/exynos-smc.S b/arch/arm/mach-exynos/exynos-smc.S
new file mode 100644
index 000000000000..2e27aa3813fd
--- /dev/null
+++ b/arch/arm/mach-exynos/exynos-smc.S
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics.
3 *
4 * Copied from omap-smc.S Copyright (C) 2010 Texas Instruments, Inc.
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/linkage.h>
12
13/*
14 * Function signature: void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3)
15 */
16
17ENTRY(exynos_smc)
18 stmfd sp!, {r4-r11, lr}
19 dsb
20 smc #0
21 ldmfd sp!, {r4-r11, pc}
22ENDPROC(exynos_smc)
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
new file mode 100644
index 000000000000..ed11f100d479
--- /dev/null
+++ b/arch/arm/mach-exynos/firmware.c
@@ -0,0 +1,70 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics.
3 * Kyungmin Park <kyungmin.park@samsung.com>
4 * Tomasz Figa <t.figa@samsung.com>
5 *
6 * This program is free software,you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/io.h>
13#include <linux/init.h>
14#include <linux/of.h>
15#include <linux/of_address.h>
16
17#include <asm/firmware.h>
18
19#include <mach/map.h>
20
21#include "smc.h"
22
23static int exynos_do_idle(void)
24{
25 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
26 return 0;
27}
28
29static int exynos_cpu_boot(int cpu)
30{
31 exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
32 return 0;
33}
34
35static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
36{
37 void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c + 4*cpu;
38
39 __raw_writel(boot_addr, boot_reg);
40 return 0;
41}
42
43static const struct firmware_ops exynos_firmware_ops = {
44 .do_idle = exynos_do_idle,
45 .set_cpu_boot_addr = exynos_set_cpu_boot_addr,
46 .cpu_boot = exynos_cpu_boot,
47};
48
49void __init exynos_firmware_init(void)
50{
51 if (of_have_populated_dt()) {
52 struct device_node *nd;
53 const __be32 *addr;
54
55 nd = of_find_compatible_node(NULL, NULL,
56 "samsung,secure-firmware");
57 if (!nd)
58 return;
59
60 addr = of_get_address(nd, 0, NULL, NULL);
61 if (!addr) {
62 pr_err("%s: No address specified.\n", __func__);
63 return;
64 }
65 }
66
67 pr_info("Running under secure firmware.\n");
68
69 register_firmware_ops(&exynos_firmware_ops);
70}
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index c3f825b27947..af90cfa2f826 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -28,7 +28,6 @@ static inline void cpu_enter_lowpower_a9(void)
28{ 28{
29 unsigned int v; 29 unsigned int v;
30 30
31 flush_cache_all();
32 asm volatile( 31 asm volatile(
33 " mcr p15, 0, %1, c7, c5, 0\n" 32 " mcr p15, 0, %1, c7, c5, 0\n"
34 " mcr p15, 0, %1, c7, c10, 4\n" 33 " mcr p15, 0, %1, c7, c10, 4\n"
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 1f4dc35cd4b9..c72f59d91fce 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -30,8 +30,6 @@
30 30
31/* For EXYNOS4 and EXYNOS5 */ 31/* For EXYNOS4 and EXYNOS5 */
32 32
33#define EXYNOS_IRQ_MCT_LOCALTIMER IRQ_PPI(12)
34
35#define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32) 33#define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32)
36 34
37/* For EXYNOS4 SoCs */ 35/* For EXYNOS4 SoCs */
@@ -128,7 +126,7 @@
128#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107) 126#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)
129#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108) 127#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)
130#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) 128#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109)
131#define EXYNOS4_IRQ_PMU IRQ_SPI(110) 129#define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110)
132#define EXYNOS4_IRQ_GPS IRQ_SPI(111) 130#define EXYNOS4_IRQ_GPS IRQ_SPI(111)
133#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) 131#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
134#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113) 132#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)
@@ -136,6 +134,11 @@
136#define EXYNOS4_IRQ_TSI IRQ_SPI(115) 134#define EXYNOS4_IRQ_TSI IRQ_SPI(115)
137#define EXYNOS4_IRQ_SATA IRQ_SPI(116) 135#define EXYNOS4_IRQ_SATA IRQ_SPI(116)
138 136
137#define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2)
138#define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2)
139#define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2)
140#define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2)
141
139#define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4) 142#define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4)
140#define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4) 143#define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4)
141 144
@@ -168,7 +171,10 @@
168#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) 171#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)
169#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) 172#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2)
170 173
171#define EXYNOS4_MAX_COMBINER_NR 16 174#define EXYNOS4210_MAX_COMBINER_NR 16
175#define EXYNOS4212_MAX_COMBINER_NR 18
176#define EXYNOS4412_MAX_COMBINER_NR 20
177#define EXYNOS4_MAX_COMBINER_NR EXYNOS4412_MAX_COMBINER_NR
172 178
173#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16 179#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16
174#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9 180#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9
@@ -233,7 +239,6 @@
233#define IRQ_TC EXYNOS4_IRQ_PEN0 239#define IRQ_TC EXYNOS4_IRQ_PEN0
234 240
235#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD 241#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD
236#define IRQ_PMU EXYNOS4_IRQ_PMU
237 242
238#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO 243#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO
239#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC 244#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC
@@ -323,8 +328,6 @@
323#define EXYNOS5_IRQ_CEC IRQ_SPI(114) 328#define EXYNOS5_IRQ_CEC IRQ_SPI(114)
324#define EXYNOS5_IRQ_SATA IRQ_SPI(115) 329#define EXYNOS5_IRQ_SATA IRQ_SPI(115)
325 330
326#define EXYNOS5_IRQ_MCT_L0 IRQ_SPI(120)
327#define EXYNOS5_IRQ_MCT_L1 IRQ_SPI(121)
328#define EXYNOS5_IRQ_MMC44 IRQ_SPI(123) 331#define EXYNOS5_IRQ_MMC44 IRQ_SPI(123)
329#define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124) 332#define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124)
330#define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125) 333#define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125)
@@ -419,8 +422,6 @@
419#define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4) 422#define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4)
420 423
421#define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0) 424#define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0)
422#define EXYNOS5_IRQ_MCT_G0 COMBINER_IRQ(23, 3)
423#define EXYNOS5_IRQ_MCT_G1 COMBINER_IRQ(23, 4)
424 425
425#define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0) 426#define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0)
426#define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1) 427#define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1)
@@ -466,7 +467,10 @@
466#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64) 467#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64)
467 468
468/* Set the default NR_IRQS */ 469/* Set the default NR_IRQS */
470#define EXYNOS_NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
469 471
470#define NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT) 472#ifndef CONFIG_SPARSE_IRQ
473#define NR_IRQS EXYNOS_NR_IRQS
474#endif
471 475
472#endif /* __ASM_ARCH_IRQS_H */ 476#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 1df6abbf53b8..99e0a79f3b1f 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -26,6 +26,9 @@
26#define EXYNOS4_PA_SYSRAM0 0x02025000 26#define EXYNOS4_PA_SYSRAM0 0x02025000
27#define EXYNOS4_PA_SYSRAM1 0x02020000 27#define EXYNOS4_PA_SYSRAM1 0x02020000
28#define EXYNOS5_PA_SYSRAM 0x02020000 28#define EXYNOS5_PA_SYSRAM 0x02020000
29#define EXYNOS4210_PA_SYSRAM_NS 0x0203F000
30#define EXYNOS4x12_PA_SYSRAM_NS 0x0204F000
31#define EXYNOS5250_PA_SYSRAM_NS 0x0204F000
29 32
30#define EXYNOS4_PA_FIMC0 0x11800000 33#define EXYNOS4_PA_FIMC0 0x11800000
31#define EXYNOS4_PA_FIMC1 0x11810000 34#define EXYNOS4_PA_FIMC1 0x11810000
@@ -65,7 +68,6 @@
65#define EXYNOS5_PA_CMU 0x10010000 68#define EXYNOS5_PA_CMU 0x10010000
66 69
67#define EXYNOS4_PA_SYSTIMER 0x10050000 70#define EXYNOS4_PA_SYSTIMER 0x10050000
68#define EXYNOS5_PA_SYSTIMER 0x101C0000
69 71
70#define EXYNOS4_PA_WATCHDOG 0x10060000 72#define EXYNOS4_PA_WATCHDOG 0x10060000
71#define EXYNOS5_PA_WATCHDOG 0x101D0000 73#define EXYNOS5_PA_WATCHDOG 0x101D0000
diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h
index a67ecfaf1216..7dbbfec13ea5 100644
--- a/arch/arm/mach-exynos/include/mach/pm-core.h
+++ b/arch/arm/mach-exynos/include/mach/pm-core.h
@@ -27,13 +27,8 @@ static inline void s3c_pm_debug_init_uart(void)
27 27
28static inline void s3c_pm_arch_prepare_irqs(void) 28static inline void s3c_pm_arch_prepare_irqs(void)
29{ 29{
30 unsigned int tmp; 30 __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK);
31 tmp = __raw_readl(S5P_WAKEUP_MASK); 31 __raw_writel(s3c_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK);
32 tmp &= ~(1 << 31);
33 __raw_writel(tmp, S5P_WAKEUP_MASK);
34
35 __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK);
36 __raw_writel(s3c_irqwake_eintmask & 0xFFFFFFFE, S5P_EINT_WAKEUP_MASK);
37} 32}
38 33
39static inline void s3c_pm_arch_stop_clocks(void) 34static inline void s3c_pm_arch_stop_clocks(void)
diff --git a/arch/arm/mach-exynos/include/mach/regs-mct.h b/arch/arm/mach-exynos/include/mach/regs-mct.h
deleted file mode 100644
index 80dd02ad6d61..000000000000
--- a/arch/arm/mach-exynos/include/mach/regs-mct.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* arch/arm/mach-exynos4/include/mach/regs-mct.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 MCT configutation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_MCT_H
14#define __ASM_ARCH_REGS_MCT_H __FILE__
15
16#include <mach/map.h>
17
18#define EXYNOS4_MCTREG(x) (S5P_VA_SYSTIMER + (x))
19
20#define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100)
21#define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104)
22#define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110)
23
24#define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200)
25#define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204)
26#define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208)
27
28#define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240)
29
30#define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244)
31#define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248)
32#define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C)
33
34#define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300)
35#define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x))
36#define EXYNOS4_MCT_L_MASK (0xffffff00)
37
38#define MCT_L_TCNTB_OFFSET (0x00)
39#define MCT_L_ICNTB_OFFSET (0x08)
40#define MCT_L_TCON_OFFSET (0x20)
41#define MCT_L_INT_CSTAT_OFFSET (0x30)
42#define MCT_L_INT_ENB_OFFSET (0x34)
43#define MCT_L_WSTAT_OFFSET (0x40)
44
45#define MCT_G_TCON_START (1 << 8)
46#define MCT_G_TCON_COMP0_AUTO_INC (1 << 1)
47#define MCT_G_TCON_COMP0_ENABLE (1 << 0)
48
49#define MCT_L_TCON_INTERVAL_MODE (1 << 2)
50#define MCT_L_TCON_INT_START (1 << 1)
51#define MCT_L_TCON_TIMER_START (1 << 0)
52
53#endif /* __ASM_ARCH_REGS_MCT_H */
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
index 685f29173afa..5f0f55701374 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -25,6 +25,7 @@
25#include <plat/regs-srom.h> 25#include <plat/regs-srom.h>
26#include <plat/sdhci.h> 26#include <plat/sdhci.h>
27 27
28#include <mach/irqs.h>
28#include <mach/map.h> 29#include <mach/map.h>
29 30
30#include "common.h" 31#include "common.h"
@@ -177,7 +178,6 @@ static void __init armlex4210_smsc911x_init(void)
177static void __init armlex4210_map_io(void) 178static void __init armlex4210_map_io(void)
178{ 179{
179 exynos_init_io(NULL, 0); 180 exynos_init_io(NULL, 0);
180 s3c24xx_init_clocks(24000000);
181 s3c24xx_init_uarts(armlex4210_uartcfgs, 181 s3c24xx_init_uarts(armlex4210_uartcfgs,
182 ARRAY_SIZE(armlex4210_uartcfgs)); 182 ARRAY_SIZE(armlex4210_uartcfgs));
183} 183}
@@ -202,6 +202,6 @@ MACHINE_START(ARMLEX4210, "ARMLEX4210")
202 .map_io = armlex4210_map_io, 202 .map_io = armlex4210_map_io,
203 .init_machine = armlex4210_machine_init, 203 .init_machine = armlex4210_machine_init,
204 .init_late = exynos_init_late, 204 .init_late = exynos_init_late,
205 .init_time = exynos4_timer_init, 205 .init_time = exynos_init_time,
206 .restart = exynos4_restart, 206 .restart = exynos4_restart,
207MACHINE_END 207MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 3358088c822a..b9ed834a7eee 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -11,121 +11,26 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14#include <linux/kernel.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <linux/of_fdt.h>
15#include <linux/serial_core.h> 17#include <linux/serial_core.h>
18#include <linux/memblock.h>
19#include <linux/clocksource.h>
16 20
17#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
18#include <mach/map.h> 22#include <plat/mfc.h>
19
20#include <plat/cpu.h>
21#include <plat/regs-serial.h>
22 23
23#include "common.h" 24#include "common.h"
24 25
25/*
26 * The following lookup table is used to override device names when devices
27 * are registered from device tree. This is temporarily added to enable
28 * device tree support addition for the Exynos4 architecture.
29 *
30 * For drivers that require platform data to be provided from the machine
31 * file, a platform data pointer can also be supplied along with the
32 * devices names. Usually, the platform data elements that cannot be parsed
33 * from the device tree by the drivers (example: function pointers) are
34 * supplied. But it should be noted that this is a temporary mechanism and
35 * at some point, the drivers should be capable of parsing all the platform
36 * data from the device tree.
37 */
38static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = {
39 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0,
40 "exynos4210-uart.0", NULL),
41 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1,
42 "exynos4210-uart.1", NULL),
43 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART2,
44 "exynos4210-uart.2", NULL),
45 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART3,
46 "exynos4210-uart.3", NULL),
47 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0),
48 "exynos4-sdhci.0", NULL),
49 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(1),
50 "exynos4-sdhci.1", NULL),
51 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(2),
52 "exynos4-sdhci.2", NULL),
53 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(3),
54 "exynos4-sdhci.3", NULL),
55 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0),
56 "s3c2440-i2c.0", NULL),
57 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(1),
58 "s3c2440-i2c.1", NULL),
59 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(2),
60 "s3c2440-i2c.2", NULL),
61 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(3),
62 "s3c2440-i2c.3", NULL),
63 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(4),
64 "s3c2440-i2c.4", NULL),
65 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(5),
66 "s3c2440-i2c.5", NULL),
67 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(6),
68 "s3c2440-i2c.6", NULL),
69 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(7),
70 "s3c2440-i2c.7", NULL),
71 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0,
72 "exynos4210-spi.0", NULL),
73 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1,
74 "exynos4210-spi.1", NULL),
75 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI2,
76 "exynos4210-spi.2", NULL),
77 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL),
78 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL),
79 OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_MDMA1, "dma-pl330.2", NULL),
80 OF_DEV_AUXDATA("samsung,exynos4210-tmu", EXYNOS4_PA_TMU,
81 "exynos-tmu", NULL),
82 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13620000,
83 "exynos-sysmmu.0", NULL), /* MFC_L */
84 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13630000,
85 "exynos-sysmmu.1", NULL), /* MFC_R */
86 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E20000,
87 "exynos-sysmmu.2", NULL), /* TV */
88 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A60000,
89 "exynos-sysmmu.3", NULL), /* JPEG */
90 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12A30000,
91 "exynos-sysmmu.4", NULL), /* ROTATOR */
92 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A20000,
93 "exynos-sysmmu.5", NULL), /* FIMC0 */
94 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A30000,
95 "exynos-sysmmu.6", NULL), /* FIMC1 */
96 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A40000,
97 "exynos-sysmmu.7", NULL), /* FIMC2 */
98 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11A50000,
99 "exynos-sysmmu.8", NULL), /* FIMC3 */
100 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12A20000,
101 "exynos-sysmmu.9", NULL), /* G2D(4210) */
102 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A40000,
103 "exynos-sysmmu.9", NULL), /* G2D(4x12) */
104 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11E20000,
105 "exynos-sysmmu.10", NULL), /* FIMD0 */
106 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12220000,
107 "exynos-sysmmu.11", NULL), /* FIMD1(4210) */
108 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x12260000,
109 "exynos-sysmmu.12", NULL), /* IS0(4x12) */
110 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x122B0000,
111 "exynos-sysmmu.13", NULL), /* IS1(4x12) */
112 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x123B0000,
113 "exynos-sysmmu.14", NULL), /* FIMC-LITE0(4x12) */
114 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x123C0000,
115 "exynos-sysmmu.15", NULL), /* FIMC-LITE1(4x12) */
116 {},
117};
118
119static void __init exynos4_dt_map_io(void) 26static void __init exynos4_dt_map_io(void)
120{ 27{
121 exynos_init_io(NULL, 0); 28 exynos_init_io(NULL, 0);
122 s3c24xx_init_clocks(24000000);
123} 29}
124 30
125static void __init exynos4_dt_machine_init(void) 31static void __init exynos4_dt_machine_init(void)
126{ 32{
127 of_platform_populate(NULL, of_default_bus_match_table, 33 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
128 exynos4_auxdata_lookup, NULL);
129} 34}
130 35
131static char const *exynos4_dt_compat[] __initdata = { 36static char const *exynos4_dt_compat[] __initdata = {
@@ -135,14 +40,28 @@ static char const *exynos4_dt_compat[] __initdata = {
135 NULL 40 NULL
136}; 41};
137 42
43static void __init exynos4_reserve(void)
44{
45#ifdef CONFIG_S5P_DEV_MFC
46 struct s5p_mfc_dt_meminfo mfc_mem;
47
48 /* Reserve memory for MFC only if it's available */
49 mfc_mem.compatible = "samsung,mfc-v5";
50 if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
51 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
52 mfc_mem.lsize);
53#endif
54}
138DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") 55DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
139 /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ 56 /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */
140 .smp = smp_ops(exynos_smp_ops), 57 .smp = smp_ops(exynos_smp_ops),
141 .init_irq = exynos4_init_irq, 58 .init_irq = exynos4_init_irq,
142 .map_io = exynos4_dt_map_io, 59 .map_io = exynos4_dt_map_io,
60 .init_early = exynos_firmware_init,
143 .init_machine = exynos4_dt_machine_init, 61 .init_machine = exynos4_dt_machine_init,
144 .init_late = exynos_init_late, 62 .init_late = exynos_init_late,
145 .init_time = exynos4_timer_init, 63 .init_time = exynos_init_time,
146 .dt_compat = exynos4_dt_compat, 64 .dt_compat = exynos4_dt_compat,
147 .restart = exynos4_restart, 65 .restart = exynos4_restart,
66 .reserve = exynos4_reserve,
148MACHINE_END 67MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index acaeb14db54b..753b94f3fca7 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -11,151 +11,21 @@
11 11
12#include <linux/of_platform.h> 12#include <linux/of_platform.h>
13#include <linux/of_fdt.h> 13#include <linux/of_fdt.h>
14#include <linux/serial_core.h>
15#include <linux/memblock.h> 14#include <linux/memblock.h>
16#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/clocksource.h>
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <mach/map.h>
20#include <mach/regs-pmu.h> 19#include <mach/regs-pmu.h>
21 20
22#include <plat/cpu.h> 21#include <plat/cpu.h>
23#include <plat/regs-serial.h>
24#include <plat/mfc.h> 22#include <plat/mfc.h>
25 23
26#include "common.h" 24#include "common.h"
27 25
28/*
29 * The following lookup table is used to override device names when devices
30 * are registered from device tree. This is temporarily added to enable
31 * device tree support addition for the EXYNOS5 architecture.
32 *
33 * For drivers that require platform data to be provided from the machine
34 * file, a platform data pointer can also be supplied along with the
35 * devices names. Usually, the platform data elements that cannot be parsed
36 * from the device tree by the drivers (example: function pointers) are
37 * supplied. But it should be noted that this is a temporary mechanism and
38 * at some point, the drivers should be capable of parsing all the platform
39 * data from the device tree.
40 */
41static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
42 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
43 "exynos4210-uart.0", NULL),
44 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
45 "exynos4210-uart.1", NULL),
46 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
47 "exynos4210-uart.2", NULL),
48 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
49 "exynos4210-uart.3", NULL),
50 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
51 "s3c2440-i2c.0", NULL),
52 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
53 "s3c2440-i2c.1", NULL),
54 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
55 "s3c2440-i2c.2", NULL),
56 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
57 "s3c2440-i2c.3", NULL),
58 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
59 "s3c2440-i2c.4", NULL),
60 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
61 "s3c2440-i2c.5", NULL),
62 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
63 "s3c2440-i2c.6", NULL),
64 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
65 "s3c2440-i2c.7", NULL),
66 OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8),
67 "s3c2440-hdmiphy-i2c", NULL),
68 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
69 "dw_mmc.0", NULL),
70 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
71 "dw_mmc.1", NULL),
72 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2,
73 "dw_mmc.2", NULL),
74 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3,
75 "dw_mmc.3", NULL),
76 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
77 "exynos4210-spi.0", NULL),
78 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
79 "exynos4210-spi.1", NULL),
80 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
81 "exynos4210-spi.2", NULL),
82 OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000,
83 "exynos5-sata", NULL),
84 OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000,
85 "exynos5-sata-phy", NULL),
86 OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000,
87 "exynos5-sata-phy-i2c", NULL),
88 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
89 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
90 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
91 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
92 "exynos-gsc.0", NULL),
93 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
94 "exynos-gsc.1", NULL),
95 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
96 "exynos-gsc.2", NULL),
97 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
98 "exynos-gsc.3", NULL),
99 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
100 "exynos5-hdmi", NULL),
101 OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000,
102 "exynos5-mixer", NULL),
103 OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
104 OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
105 "exynos-tmu", NULL),
106 OF_DEV_AUXDATA("samsung,i2s-v5", 0x03830000,
107 "samsung-i2s.0", NULL),
108 OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D60000,
109 "samsung-i2s.1", NULL),
110 OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D70000,
111 "samsung-i2s.2", NULL),
112 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11210000,
113 "exynos-sysmmu.0", "mfc"), /* MFC_L */
114 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11200000,
115 "exynos-sysmmu.1", "mfc"), /* MFC_R */
116 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14650000,
117 "exynos-sysmmu.2", NULL), /* TV */
118 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11F20000,
119 "exynos-sysmmu.3", "jpeg"), /* JPEG */
120 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11D40000,
121 "exynos-sysmmu.4", NULL), /* ROTATOR */
122 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E80000,
123 "exynos-sysmmu.5", "gscl"), /* GSCL0 */
124 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E90000,
125 "exynos-sysmmu.6", "gscl"), /* GSCL1 */
126 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EA0000,
127 "exynos-sysmmu.7", "gscl"), /* GSCL2 */
128 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EB0000,
129 "exynos-sysmmu.8", "gscl"), /* GSCL3 */
130 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13260000,
131 "exynos-sysmmu.9", NULL), /* FIMC-IS0 */
132 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x132C0000,
133 "exynos-sysmmu.10", NULL), /* FIMC-IS1 */
134 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14640000,
135 "exynos-sysmmu.11", NULL), /* FIMD1 */
136 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C40000,
137 "exynos-sysmmu.12", NULL), /* FIMC-LITE0 */
138 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C50000,
139 "exynos-sysmmu.13", NULL), /* FIMC-LITE1 */
140 OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A60000,
141 "exynos-sysmmu.14", NULL), /* G2D */
142 {},
143};
144
145static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = {
146 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0,
147 "exynos4210-uart.0", NULL),
148 {},
149};
150
151static void __init exynos5_dt_map_io(void) 26static void __init exynos5_dt_map_io(void)
152{ 27{
153 unsigned long root = of_get_flat_dt_root();
154
155 exynos_init_io(NULL, 0); 28 exynos_init_io(NULL, 0);
156
157 if (of_flat_dt_is_compatible(root, "samsung,exynos5250"))
158 s3c24xx_init_clocks(24000000);
159} 29}
160 30
161static void __init exynos5_dt_machine_init(void) 31static void __init exynos5_dt_machine_init(void)
@@ -182,12 +52,7 @@ static void __init exynos5_dt_machine_init(void)
182 } 52 }
183 } 53 }
184 54
185 if (of_machine_is_compatible("samsung,exynos5250")) 55 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
186 of_platform_populate(NULL, of_default_bus_match_table,
187 exynos5250_auxdata_lookup, NULL);
188 else if (of_machine_is_compatible("samsung,exynos5440"))
189 of_platform_populate(NULL, of_default_bus_match_table,
190 exynos5440_auxdata_lookup, NULL);
191} 56}
192 57
193static char const *exynos5_dt_compat[] __initdata = { 58static char const *exynos5_dt_compat[] __initdata = {
@@ -216,7 +81,7 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
216 .map_io = exynos5_dt_map_io, 81 .map_io = exynos5_dt_map_io,
217 .init_machine = exynos5_dt_machine_init, 82 .init_machine = exynos5_dt_machine_init,
218 .init_late = exynos_init_late, 83 .init_late = exynos_init_late,
219 .init_time = exynos4_timer_init, 84 .init_time = exynos_init_time,
220 .dt_compat = exynos5_dt_compat, 85 .dt_compat = exynos5_dt_compat,
221 .restart = exynos5_restart, 86 .restart = exynos5_restart,
222 .reserve = exynos5_reserve, 87 .reserve = exynos5_reserve,
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index 1ea79730187f..5c8b2878dbbd 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -53,6 +53,7 @@
53#include <plat/fimc-core.h> 53#include <plat/fimc-core.h>
54#include <plat/camport.h> 54#include <plat/camport.h>
55 55
56#include <mach/irqs.h>
56#include <mach/map.h> 57#include <mach/map.h>
57 58
58#include "common.h" 59#include "common.h"
@@ -1251,7 +1252,7 @@ static void __init nuri_camera_init(void)
1251 } 1252 }
1252 1253
1253 m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT); 1254 m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
1254 if (!IS_ERR_VALUE(m5mols_board_info.irq)) 1255 if (m5mols_board_info.irq >= 0)
1255 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF)); 1256 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
1256 else 1257 else
1257 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__); 1258 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
@@ -1330,8 +1331,9 @@ static struct platform_device *nuri_devices[] __initdata = {
1330static void __init nuri_map_io(void) 1331static void __init nuri_map_io(void)
1331{ 1332{
1332 exynos_init_io(NULL, 0); 1333 exynos_init_io(NULL, 0);
1333 s3c24xx_init_clocks(clk_xusbxti.rate);
1334 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); 1334 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1335 xxti_f = 0;
1336 xusbxti_f = 24000000;
1335} 1337}
1336 1338
1337static void __init nuri_reserve(void) 1339static void __init nuri_reserve(void)
@@ -1380,7 +1382,7 @@ MACHINE_START(NURI, "NURI")
1380 .map_io = nuri_map_io, 1382 .map_io = nuri_map_io,
1381 .init_machine = nuri_machine_init, 1383 .init_machine = nuri_machine_init,
1382 .init_late = exynos_init_late, 1384 .init_late = exynos_init_late,
1383 .init_time = exynos4_timer_init, 1385 .init_time = exynos_init_time,
1384 .reserve = &nuri_reserve, 1386 .reserve = &nuri_reserve,
1385 .restart = exynos4_restart, 1387 .restart = exynos4_restart,
1386MACHINE_END 1388MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index 579d2d171daa..27f03ed5d067 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -26,7 +26,7 @@
26#include <linux/platform_data/i2c-s3c2410.h> 26#include <linux/platform_data/i2c-s3c2410.h>
27#include <linux/platform_data/s3c-hsotg.h> 27#include <linux/platform_data/s3c-hsotg.h>
28#include <linux/platform_data/usb-ehci-s5p.h> 28#include <linux/platform_data/usb-ehci-s5p.h>
29#include <linux/platform_data/usb-exynos.h> 29#include <linux/platform_data/usb-ohci-exynos.h>
30 30
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -46,6 +46,7 @@
46#include <plat/hdmi.h> 46#include <plat/hdmi.h>
47 47
48#include <mach/map.h> 48#include <mach/map.h>
49#include <mach/irqs.h>
49 50
50#include <drm/exynos_drm.h> 51#include <drm/exynos_drm.h>
51#include "common.h" 52#include "common.h"
@@ -754,8 +755,9 @@ static void s5p_tv_setup(void)
754static void __init origen_map_io(void) 755static void __init origen_map_io(void)
755{ 756{
756 exynos_init_io(NULL, 0); 757 exynos_init_io(NULL, 0);
757 s3c24xx_init_clocks(clk_xusbxti.rate);
758 s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs)); 758 s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs));
759 xxti_f = 0;
760 xusbxti_f = 24000000;
759} 761}
760 762
761static void __init origen_power_init(void) 763static void __init origen_power_init(void)
@@ -815,7 +817,7 @@ MACHINE_START(ORIGEN, "ORIGEN")
815 .map_io = origen_map_io, 817 .map_io = origen_map_io,
816 .init_machine = origen_machine_init, 818 .init_machine = origen_machine_init,
817 .init_late = exynos_init_late, 819 .init_late = exynos_init_late,
818 .init_time = exynos4_timer_init, 820 .init_time = exynos_init_time,
819 .reserve = &origen_reserve, 821 .reserve = &origen_reserve,
820 .restart = exynos4_restart, 822 .restart = exynos4_restart,
821MACHINE_END 823MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c
index fe6149624b84..2c8af9617920 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -39,6 +39,7 @@
39#include <plat/regs-serial.h> 39#include <plat/regs-serial.h>
40#include <plat/sdhci.h> 40#include <plat/sdhci.h>
41 41
42#include <mach/irqs.h>
42#include <mach/map.h> 43#include <mach/map.h>
43 44
44#include <drm/exynos_drm.h> 45#include <drm/exynos_drm.h>
@@ -322,7 +323,6 @@ static struct platform_device *smdk4x12_devices[] __initdata = {
322static void __init smdk4x12_map_io(void) 323static void __init smdk4x12_map_io(void)
323{ 324{
324 exynos_init_io(NULL, 0); 325 exynos_init_io(NULL, 0);
325 s3c24xx_init_clocks(clk_xusbxti.rate);
326 s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs)); 326 s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
327} 327}
328 328
@@ -376,7 +376,7 @@ MACHINE_START(SMDK4212, "SMDK4212")
376 .init_irq = exynos4_init_irq, 376 .init_irq = exynos4_init_irq,
377 .map_io = smdk4x12_map_io, 377 .map_io = smdk4x12_map_io,
378 .init_machine = smdk4x12_machine_init, 378 .init_machine = smdk4x12_machine_init,
379 .init_time = exynos4_timer_init, 379 .init_time = exynos_init_time,
380 .restart = exynos4_restart, 380 .restart = exynos4_restart,
381 .reserve = &smdk4x12_reserve, 381 .reserve = &smdk4x12_reserve,
382MACHINE_END 382MACHINE_END
@@ -390,7 +390,7 @@ MACHINE_START(SMDK4412, "SMDK4412")
390 .map_io = smdk4x12_map_io, 390 .map_io = smdk4x12_map_io,
391 .init_machine = smdk4x12_machine_init, 391 .init_machine = smdk4x12_machine_init,
392 .init_late = exynos_init_late, 392 .init_late = exynos_init_late,
393 .init_time = exynos4_timer_init, 393 .init_time = exynos_init_time,
394 .restart = exynos4_restart, 394 .restart = exynos4_restart,
395 .reserve = &smdk4x12_reserve, 395 .reserve = &smdk4x12_reserve,
396MACHINE_END 396MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index d71672922b19..d95b8cf85253 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -23,7 +23,7 @@
23#include <linux/platform_data/i2c-s3c2410.h> 23#include <linux/platform_data/i2c-s3c2410.h>
24#include <linux/platform_data/s3c-hsotg.h> 24#include <linux/platform_data/s3c-hsotg.h>
25#include <linux/platform_data/usb-ehci-s5p.h> 25#include <linux/platform_data/usb-ehci-s5p.h>
26#include <linux/platform_data/usb-exynos.h> 26#include <linux/platform_data/usb-ohci-exynos.h>
27 27
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -43,6 +43,7 @@
43#include <plat/clock.h> 43#include <plat/clock.h>
44#include <plat/hdmi.h> 44#include <plat/hdmi.h>
45 45
46#include <mach/irqs.h>
46#include <mach/map.h> 47#include <mach/map.h>
47 48
48#include <drm/exynos_drm.h> 49#include <drm/exynos_drm.h>
@@ -371,8 +372,9 @@ static void s5p_tv_setup(void)
371static void __init smdkv310_map_io(void) 372static void __init smdkv310_map_io(void)
372{ 373{
373 exynos_init_io(NULL, 0); 374 exynos_init_io(NULL, 0);
374 s3c24xx_init_clocks(clk_xusbxti.rate);
375 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs)); 375 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
376 xxti_f = 12000000;
377 xusbxti_f = 24000000;
376} 378}
377 379
378static void __init smdkv310_reserve(void) 380static void __init smdkv310_reserve(void)
@@ -423,7 +425,7 @@ MACHINE_START(SMDKV310, "SMDKV310")
423 .init_irq = exynos4_init_irq, 425 .init_irq = exynos4_init_irq,
424 .map_io = smdkv310_map_io, 426 .map_io = smdkv310_map_io,
425 .init_machine = smdkv310_machine_init, 427 .init_machine = smdkv310_machine_init,
426 .init_time = exynos4_timer_init, 428 .init_time = exynos_init_time,
427 .reserve = &smdkv310_reserve, 429 .reserve = &smdkv310_reserve,
428 .restart = exynos4_restart, 430 .restart = exynos4_restart,
429MACHINE_END 431MACHINE_END
@@ -436,7 +438,7 @@ MACHINE_START(SMDKC210, "SMDKC210")
436 .map_io = smdkv310_map_io, 438 .map_io = smdkv310_map_io,
437 .init_machine = smdkv310_machine_init, 439 .init_machine = smdkv310_machine_init,
438 .init_late = exynos_init_late, 440 .init_late = exynos_init_late,
439 .init_time = exynos4_timer_init, 441 .init_time = exynos_init_time,
440 .reserve = &smdkv310_reserve, 442 .reserve = &smdkv310_reserve,
441 .restart = exynos4_restart, 443 .restart = exynos4_restart,
442MACHINE_END 444MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 497fcb793dc1..327d50d4681d 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -41,7 +41,7 @@
41#include <plat/mfc.h> 41#include <plat/mfc.h>
42#include <plat/sdhci.h> 42#include <plat/sdhci.h>
43#include <plat/fimc-core.h> 43#include <plat/fimc-core.h>
44#include <plat/s5p-time.h> 44#include <plat/samsung-time.h>
45#include <plat/camport.h> 45#include <plat/camport.h>
46 46
47#include <mach/map.h> 47#include <mach/map.h>
@@ -97,6 +97,19 @@ static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
97static struct regulator_consumer_supply max8952_consumer = 97static struct regulator_consumer_supply max8952_consumer =
98 REGULATOR_SUPPLY("vdd_arm", NULL); 98 REGULATOR_SUPPLY("vdd_arm", NULL);
99 99
100static struct regulator_init_data universal_max8952_reg_data = {
101 .constraints = {
102 .name = "VARM_1.2V",
103 .min_uV = 770000,
104 .max_uV = 1400000,
105 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
106 .always_on = 1,
107 .boot_on = 1,
108 },
109 .num_consumer_supplies = 1,
110 .consumer_supplies = &max8952_consumer,
111};
112
100static struct max8952_platform_data universal_max8952_pdata __initdata = { 113static struct max8952_platform_data universal_max8952_pdata __initdata = {
101 .gpio_vid0 = EXYNOS4_GPX0(3), 114 .gpio_vid0 = EXYNOS4_GPX0(3),
102 .gpio_vid1 = EXYNOS4_GPX0(4), 115 .gpio_vid1 = EXYNOS4_GPX0(4),
@@ -105,19 +118,7 @@ static struct max8952_platform_data universal_max8952_pdata __initdata = {
105 .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */ 118 .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
106 .sync_freq = 0, /* default: fastest */ 119 .sync_freq = 0, /* default: fastest */
107 .ramp_speed = 0, /* default: fastest */ 120 .ramp_speed = 0, /* default: fastest */
108 121 .reg_data = &universal_max8952_reg_data,
109 .reg_data = {
110 .constraints = {
111 .name = "VARM_1.2V",
112 .min_uV = 770000,
113 .max_uV = 1400000,
114 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
115 .always_on = 1,
116 .boot_on = 1,
117 },
118 .num_consumer_supplies = 1,
119 .consumer_supplies = &max8952_consumer,
120 },
121}; 122};
122 123
123static struct regulator_consumer_supply lp3974_buck1_consumer = 124static struct regulator_consumer_supply lp3974_buck1_consumer =
@@ -1092,9 +1093,10 @@ static struct platform_device *universal_devices[] __initdata = {
1092static void __init universal_map_io(void) 1093static void __init universal_map_io(void)
1093{ 1094{
1094 exynos_init_io(NULL, 0); 1095 exynos_init_io(NULL, 0);
1095 s3c24xx_init_clocks(clk_xusbxti.rate);
1096 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); 1096 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
1097 s5p_set_timer_source(S5P_PWM2, S5P_PWM4); 1097 samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
1098 xxti_f = 0;
1099 xusbxti_f = 24000000;
1098} 1100}
1099 1101
1100static void s5p_tv_setup(void) 1102static void s5p_tv_setup(void)
@@ -1152,7 +1154,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
1152 .map_io = universal_map_io, 1154 .map_io = universal_map_io,
1153 .init_machine = universal_machine_init, 1155 .init_machine = universal_machine_init,
1154 .init_late = exynos_init_late, 1156 .init_late = exynos_init_late,
1155 .init_time = s5p_timer_init, 1157 .init_time = samsung_timer_init,
1156 .reserve = &universal_reserve, 1158 .reserve = &universal_reserve,
1157 .restart = exynos4_restart, 1159 .restart = exynos4_restart,
1158MACHINE_END 1160MACHINE_END
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
deleted file mode 100644
index c9d6650f9b5d..000000000000
--- a/arch/arm/mach-exynos/mct.c
+++ /dev/null
@@ -1,485 +0,0 @@
1/* linux/arch/arm/mach-exynos4/mct.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 MCT(Multi-Core Timer) support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/sched.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/err.h>
17#include <linux/clk.h>
18#include <linux/clockchips.h>
19#include <linux/platform_device.h>
20#include <linux/delay.h>
21#include <linux/percpu.h>
22#include <linux/of.h>
23
24#include <asm/arch_timer.h>
25#include <asm/localtimer.h>
26
27#include <plat/cpu.h>
28
29#include <mach/map.h>
30#include <mach/irqs.h>
31#include <mach/regs-mct.h>
32#include <asm/mach/time.h>
33
34#define TICK_BASE_CNT 1
35
36enum {
37 MCT_INT_SPI,
38 MCT_INT_PPI
39};
40
41static unsigned long clk_rate;
42static unsigned int mct_int_type;
43
44struct mct_clock_event_device {
45 struct clock_event_device *evt;
46 void __iomem *base;
47 char name[10];
48};
49
50static void exynos4_mct_write(unsigned int value, void *addr)
51{
52 void __iomem *stat_addr;
53 u32 mask;
54 u32 i;
55
56 __raw_writel(value, addr);
57
58 if (likely(addr >= EXYNOS4_MCT_L_BASE(0))) {
59 u32 base = (u32) addr & EXYNOS4_MCT_L_MASK;
60 switch ((u32) addr & ~EXYNOS4_MCT_L_MASK) {
61 case (u32) MCT_L_TCON_OFFSET:
62 stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET;
63 mask = 1 << 3; /* L_TCON write status */
64 break;
65 case (u32) MCT_L_ICNTB_OFFSET:
66 stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET;
67 mask = 1 << 1; /* L_ICNTB write status */
68 break;
69 case (u32) MCT_L_TCNTB_OFFSET:
70 stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET;
71 mask = 1 << 0; /* L_TCNTB write status */
72 break;
73 default:
74 return;
75 }
76 } else {
77 switch ((u32) addr) {
78 case (u32) EXYNOS4_MCT_G_TCON:
79 stat_addr = EXYNOS4_MCT_G_WSTAT;
80 mask = 1 << 16; /* G_TCON write status */
81 break;
82 case (u32) EXYNOS4_MCT_G_COMP0_L:
83 stat_addr = EXYNOS4_MCT_G_WSTAT;
84 mask = 1 << 0; /* G_COMP0_L write status */
85 break;
86 case (u32) EXYNOS4_MCT_G_COMP0_U:
87 stat_addr = EXYNOS4_MCT_G_WSTAT;
88 mask = 1 << 1; /* G_COMP0_U write status */
89 break;
90 case (u32) EXYNOS4_MCT_G_COMP0_ADD_INCR:
91 stat_addr = EXYNOS4_MCT_G_WSTAT;
92 mask = 1 << 2; /* G_COMP0_ADD_INCR w status */
93 break;
94 case (u32) EXYNOS4_MCT_G_CNT_L:
95 stat_addr = EXYNOS4_MCT_G_CNT_WSTAT;
96 mask = 1 << 0; /* G_CNT_L write status */
97 break;
98 case (u32) EXYNOS4_MCT_G_CNT_U:
99 stat_addr = EXYNOS4_MCT_G_CNT_WSTAT;
100 mask = 1 << 1; /* G_CNT_U write status */
101 break;
102 default:
103 return;
104 }
105 }
106
107 /* Wait maximum 1 ms until written values are applied */
108 for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++)
109 if (__raw_readl(stat_addr) & mask) {
110 __raw_writel(mask, stat_addr);
111 return;
112 }
113
114 panic("MCT hangs after writing %d (addr:0x%08x)\n", value, (u32)addr);
115}
116
117/* Clocksource handling */
118static void exynos4_mct_frc_start(u32 hi, u32 lo)
119{
120 u32 reg;
121
122 exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L);
123 exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U);
124
125 reg = __raw_readl(EXYNOS4_MCT_G_TCON);
126 reg |= MCT_G_TCON_START;
127 exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON);
128}
129
130static cycle_t exynos4_frc_read(struct clocksource *cs)
131{
132 unsigned int lo, hi;
133 u32 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U);
134
135 do {
136 hi = hi2;
137 lo = __raw_readl(EXYNOS4_MCT_G_CNT_L);
138 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U);
139 } while (hi != hi2);
140
141 return ((cycle_t)hi << 32) | lo;
142}
143
144static void exynos4_frc_resume(struct clocksource *cs)
145{
146 exynos4_mct_frc_start(0, 0);
147}
148
149struct clocksource mct_frc = {
150 .name = "mct-frc",
151 .rating = 400,
152 .read = exynos4_frc_read,
153 .mask = CLOCKSOURCE_MASK(64),
154 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
155 .resume = exynos4_frc_resume,
156};
157
158static void __init exynos4_clocksource_init(void)
159{
160 exynos4_mct_frc_start(0, 0);
161
162 if (clocksource_register_hz(&mct_frc, clk_rate))
163 panic("%s: can't register clocksource\n", mct_frc.name);
164}
165
166static void exynos4_mct_comp0_stop(void)
167{
168 unsigned int tcon;
169
170 tcon = __raw_readl(EXYNOS4_MCT_G_TCON);
171 tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC);
172
173 exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON);
174 exynos4_mct_write(0, EXYNOS4_MCT_G_INT_ENB);
175}
176
177static void exynos4_mct_comp0_start(enum clock_event_mode mode,
178 unsigned long cycles)
179{
180 unsigned int tcon;
181 cycle_t comp_cycle;
182
183 tcon = __raw_readl(EXYNOS4_MCT_G_TCON);
184
185 if (mode == CLOCK_EVT_MODE_PERIODIC) {
186 tcon |= MCT_G_TCON_COMP0_AUTO_INC;
187 exynos4_mct_write(cycles, EXYNOS4_MCT_G_COMP0_ADD_INCR);
188 }
189
190 comp_cycle = exynos4_frc_read(&mct_frc) + cycles;
191 exynos4_mct_write((u32)comp_cycle, EXYNOS4_MCT_G_COMP0_L);
192 exynos4_mct_write((u32)(comp_cycle >> 32), EXYNOS4_MCT_G_COMP0_U);
193
194 exynos4_mct_write(0x1, EXYNOS4_MCT_G_INT_ENB);
195
196 tcon |= MCT_G_TCON_COMP0_ENABLE;
197 exynos4_mct_write(tcon , EXYNOS4_MCT_G_TCON);
198}
199
200static int exynos4_comp_set_next_event(unsigned long cycles,
201 struct clock_event_device *evt)
202{
203 exynos4_mct_comp0_start(evt->mode, cycles);
204
205 return 0;
206}
207
208static void exynos4_comp_set_mode(enum clock_event_mode mode,
209 struct clock_event_device *evt)
210{
211 unsigned long cycles_per_jiffy;
212 exynos4_mct_comp0_stop();
213
214 switch (mode) {
215 case CLOCK_EVT_MODE_PERIODIC:
216 cycles_per_jiffy =
217 (((unsigned long long) NSEC_PER_SEC / HZ * evt->mult) >> evt->shift);
218 exynos4_mct_comp0_start(mode, cycles_per_jiffy);
219 break;
220
221 case CLOCK_EVT_MODE_ONESHOT:
222 case CLOCK_EVT_MODE_UNUSED:
223 case CLOCK_EVT_MODE_SHUTDOWN:
224 case CLOCK_EVT_MODE_RESUME:
225 break;
226 }
227}
228
229static struct clock_event_device mct_comp_device = {
230 .name = "mct-comp",
231 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
232 .rating = 250,
233 .set_next_event = exynos4_comp_set_next_event,
234 .set_mode = exynos4_comp_set_mode,
235};
236
237static irqreturn_t exynos4_mct_comp_isr(int irq, void *dev_id)
238{
239 struct clock_event_device *evt = dev_id;
240
241 exynos4_mct_write(0x1, EXYNOS4_MCT_G_INT_CSTAT);
242
243 evt->event_handler(evt);
244
245 return IRQ_HANDLED;
246}
247
248static struct irqaction mct_comp_event_irq = {
249 .name = "mct_comp_irq",
250 .flags = IRQF_TIMER | IRQF_IRQPOLL,
251 .handler = exynos4_mct_comp_isr,
252 .dev_id = &mct_comp_device,
253};
254
255static void exynos4_clockevent_init(void)
256{
257 mct_comp_device.cpumask = cpumask_of(0);
258 clockevents_config_and_register(&mct_comp_device, clk_rate,
259 0xf, 0xffffffff);
260
261 if (soc_is_exynos5250())
262 setup_irq(EXYNOS5_IRQ_MCT_G0, &mct_comp_event_irq);
263 else
264 setup_irq(EXYNOS4_IRQ_MCT_G0, &mct_comp_event_irq);
265}
266
267#ifdef CONFIG_LOCAL_TIMERS
268
269static DEFINE_PER_CPU(struct mct_clock_event_device, percpu_mct_tick);
270
271/* Clock event handling */
272static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt)
273{
274 unsigned long tmp;
275 unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START;
276 void __iomem *addr = mevt->base + MCT_L_TCON_OFFSET;
277
278 tmp = __raw_readl(addr);
279 if (tmp & mask) {
280 tmp &= ~mask;
281 exynos4_mct_write(tmp, addr);
282 }
283}
284
285static void exynos4_mct_tick_start(unsigned long cycles,
286 struct mct_clock_event_device *mevt)
287{
288 unsigned long tmp;
289
290 exynos4_mct_tick_stop(mevt);
291
292 tmp = (1 << 31) | cycles; /* MCT_L_UPDATE_ICNTB */
293
294 /* update interrupt count buffer */
295 exynos4_mct_write(tmp, mevt->base + MCT_L_ICNTB_OFFSET);
296
297 /* enable MCT tick interrupt */
298 exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET);
299
300 tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET);
301 tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START |
302 MCT_L_TCON_INTERVAL_MODE;
303 exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET);
304}
305
306static int exynos4_tick_set_next_event(unsigned long cycles,
307 struct clock_event_device *evt)
308{
309 struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick);
310
311 exynos4_mct_tick_start(cycles, mevt);
312
313 return 0;
314}
315
316static inline void exynos4_tick_set_mode(enum clock_event_mode mode,
317 struct clock_event_device *evt)
318{
319 struct mct_clock_event_device *mevt = this_cpu_ptr(&percpu_mct_tick);
320 unsigned long cycles_per_jiffy;
321
322 exynos4_mct_tick_stop(mevt);
323
324 switch (mode) {
325 case CLOCK_EVT_MODE_PERIODIC:
326 cycles_per_jiffy =
327 (((unsigned long long) NSEC_PER_SEC / HZ * evt->mult) >> evt->shift);
328 exynos4_mct_tick_start(cycles_per_jiffy, mevt);
329 break;
330
331 case CLOCK_EVT_MODE_ONESHOT:
332 case CLOCK_EVT_MODE_UNUSED:
333 case CLOCK_EVT_MODE_SHUTDOWN:
334 case CLOCK_EVT_MODE_RESUME:
335 break;
336 }
337}
338
339static int exynos4_mct_tick_clear(struct mct_clock_event_device *mevt)
340{
341 struct clock_event_device *evt = mevt->evt;
342
343 /*
344 * This is for supporting oneshot mode.
345 * Mct would generate interrupt periodically
346 * without explicit stopping.
347 */
348 if (evt->mode != CLOCK_EVT_MODE_PERIODIC)
349 exynos4_mct_tick_stop(mevt);
350
351 /* Clear the MCT tick interrupt */
352 if (__raw_readl(mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) {
353 exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET);
354 return 1;
355 } else {
356 return 0;
357 }
358}
359
360static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id)
361{
362 struct mct_clock_event_device *mevt = dev_id;
363 struct clock_event_device *evt = mevt->evt;
364
365 exynos4_mct_tick_clear(mevt);
366
367 evt->event_handler(evt);
368
369 return IRQ_HANDLED;
370}
371
372static struct irqaction mct_tick0_event_irq = {
373 .name = "mct_tick0_irq",
374 .flags = IRQF_TIMER | IRQF_NOBALANCING,
375 .handler = exynos4_mct_tick_isr,
376};
377
378static struct irqaction mct_tick1_event_irq = {
379 .name = "mct_tick1_irq",
380 .flags = IRQF_TIMER | IRQF_NOBALANCING,
381 .handler = exynos4_mct_tick_isr,
382};
383
384static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt)
385{
386 struct mct_clock_event_device *mevt;
387 unsigned int cpu = smp_processor_id();
388 int mct_lx_irq;
389
390 mevt = this_cpu_ptr(&percpu_mct_tick);
391 mevt->evt = evt;
392
393 mevt->base = EXYNOS4_MCT_L_BASE(cpu);
394 sprintf(mevt->name, "mct_tick%d", cpu);
395
396 evt->name = mevt->name;
397 evt->cpumask = cpumask_of(cpu);
398 evt->set_next_event = exynos4_tick_set_next_event;
399 evt->set_mode = exynos4_tick_set_mode;
400 evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
401 evt->rating = 450;
402 clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1),
403 0xf, 0x7fffffff);
404
405 exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET);
406
407 if (mct_int_type == MCT_INT_SPI) {
408 if (cpu == 0) {
409 mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L0 :
410 EXYNOS5_IRQ_MCT_L0;
411 mct_tick0_event_irq.dev_id = mevt;
412 evt->irq = mct_lx_irq;
413 setup_irq(mct_lx_irq, &mct_tick0_event_irq);
414 } else {
415 mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L1 :
416 EXYNOS5_IRQ_MCT_L1;
417 mct_tick1_event_irq.dev_id = mevt;
418 evt->irq = mct_lx_irq;
419 setup_irq(mct_lx_irq, &mct_tick1_event_irq);
420 irq_set_affinity(mct_lx_irq, cpumask_of(1));
421 }
422 } else {
423 enable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 0);
424 }
425
426 return 0;
427}
428
429static void exynos4_local_timer_stop(struct clock_event_device *evt)
430{
431 unsigned int cpu = smp_processor_id();
432 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
433 if (mct_int_type == MCT_INT_SPI)
434 if (cpu == 0)
435 remove_irq(evt->irq, &mct_tick0_event_irq);
436 else
437 remove_irq(evt->irq, &mct_tick1_event_irq);
438 else
439 disable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER);
440}
441
442static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = {
443 .setup = exynos4_local_timer_setup,
444 .stop = exynos4_local_timer_stop,
445};
446#endif /* CONFIG_LOCAL_TIMERS */
447
448static void __init exynos4_timer_resources(void)
449{
450 struct clk *mct_clk;
451 mct_clk = clk_get(NULL, "xtal");
452
453 clk_rate = clk_get_rate(mct_clk);
454
455#ifdef CONFIG_LOCAL_TIMERS
456 if (mct_int_type == MCT_INT_PPI) {
457 int err;
458
459 err = request_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER,
460 exynos4_mct_tick_isr, "MCT",
461 &percpu_mct_tick);
462 WARN(err, "MCT: can't request IRQ %d (%d)\n",
463 EXYNOS_IRQ_MCT_LOCALTIMER, err);
464 }
465
466 local_timer_register(&exynos4_mct_tick_ops);
467#endif /* CONFIG_LOCAL_TIMERS */
468}
469
470void __init exynos4_timer_init(void)
471{
472 if (soc_is_exynos5440()) {
473 arch_timer_of_register();
474 return;
475 }
476
477 if ((soc_is_exynos4210()) || (soc_is_exynos5250()))
478 mct_int_type = MCT_INT_SPI;
479 else
480 mct_int_type = MCT_INT_PPI;
481
482 exynos4_timer_resources();
483 exynos4_clocksource_init();
484 exynos4_clockevent_init();
485}
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 60f7c5be057d..a0e8ff7758a4 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -20,11 +20,11 @@
20#include <linux/jiffies.h> 20#include <linux/jiffies.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irqchip/arm-gic.h>
24 23
25#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
26#include <asm/smp_plat.h> 25#include <asm/smp_plat.h>
27#include <asm/smp_scu.h> 26#include <asm/smp_scu.h>
27#include <asm/firmware.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/regs-clock.h> 30#include <mach/regs-clock.h>
@@ -76,13 +76,6 @@ static DEFINE_SPINLOCK(boot_lock);
76static void __cpuinit exynos_secondary_init(unsigned int cpu) 76static void __cpuinit exynos_secondary_init(unsigned int cpu)
77{ 77{
78 /* 78 /*
79 * if any interrupts are already enabled for the primary
80 * core (e.g. timer irq), then they will not have been enabled
81 * for us: do so
82 */
83 gic_secondary_init(0);
84
85 /*
86 * let the primary processor know we're out of the 79 * let the primary processor know we're out of the
87 * pen, then head off into the C entry point 80 * pen, then head off into the C entry point
88 */ 81 */
@@ -145,10 +138,21 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct
145 138
146 timeout = jiffies + (1 * HZ); 139 timeout = jiffies + (1 * HZ);
147 while (time_before(jiffies, timeout)) { 140 while (time_before(jiffies, timeout)) {
141 unsigned long boot_addr;
142
148 smp_rmb(); 143 smp_rmb();
149 144
150 __raw_writel(virt_to_phys(exynos4_secondary_startup), 145 boot_addr = virt_to_phys(exynos4_secondary_startup);
151 cpu_boot_reg(phys_cpu)); 146
147 /*
148 * Try to set boot address using firmware first
149 * and fall back to boot register if it fails.
150 */
151 if (call_firmware_op(set_cpu_boot_addr, phys_cpu, boot_addr))
152 __raw_writel(boot_addr, cpu_boot_reg(phys_cpu));
153
154 call_firmware_op(cpu_boot, phys_cpu);
155
152 arch_send_wakeup_ipi_mask(cpumask_of(cpu)); 156 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
153 157
154 if (pen_release == -1) 158 if (pen_release == -1)
@@ -204,10 +208,20 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
204 * system-wide flags register. The boot monitor waits 208 * system-wide flags register. The boot monitor waits
205 * until it receives a soft interrupt, and then the 209 * until it receives a soft interrupt, and then the
206 * secondary CPU branches to this address. 210 * secondary CPU branches to this address.
211 *
212 * Try using firmware operation first and fall back to
213 * boot register if it fails.
207 */ 214 */
208 for (i = 1; i < max_cpus; ++i) 215 for (i = 1; i < max_cpus; ++i) {
209 __raw_writel(virt_to_phys(exynos4_secondary_startup), 216 unsigned long phys_cpu;
210 cpu_boot_reg(cpu_logical_map(i))); 217 unsigned long boot_addr;
218
219 phys_cpu = cpu_logical_map(i);
220 boot_addr = virt_to_phys(exynos4_secondary_startup);
221
222 if (call_firmware_op(set_cpu_boot_addr, phys_cpu, boot_addr))
223 __raw_writel(boot_addr, cpu_boot_reg(phys_cpu));
224 }
211} 225}
212 226
213struct smp_operations exynos_smp_ops __initdata = { 227struct smp_operations exynos_smp_ops __initdata = {
diff --git a/arch/arm/mach-exynos/setup-sdhci-gpio.c b/arch/arm/mach-exynos/setup-sdhci-gpio.c
index e8d08bf8965a..d5b98c866738 100644
--- a/arch/arm/mach-exynos/setup-sdhci-gpio.c
+++ b/arch/arm/mach-exynos/setup-sdhci-gpio.c
@@ -19,8 +19,8 @@
19#include <linux/mmc/host.h> 19#include <linux/mmc/host.h>
20#include <linux/mmc/card.h> 20#include <linux/mmc/card.h>
21 21
22#include <mach/gpio.h>
22#include <plat/gpio-cfg.h> 23#include <plat/gpio-cfg.h>
23#include <plat/regs-sdhci.h>
24#include <plat/sdhci.h> 24#include <plat/sdhci.h>
25 25
26void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 26void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
index b81cc569a8dd..6af40662a449 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -204,9 +204,9 @@ static int exynos4210_usb_phy1_exit(struct platform_device *pdev)
204 204
205int s5p_usb_phy_init(struct platform_device *pdev, int type) 205int s5p_usb_phy_init(struct platform_device *pdev, int type)
206{ 206{
207 if (type == S5P_USB_PHY_DEVICE) 207 if (type == USB_PHY_TYPE_DEVICE)
208 return exynos4210_usb_phy0_init(pdev); 208 return exynos4210_usb_phy0_init(pdev);
209 else if (type == S5P_USB_PHY_HOST) 209 else if (type == USB_PHY_TYPE_HOST)
210 return exynos4210_usb_phy1_init(pdev); 210 return exynos4210_usb_phy1_init(pdev);
211 211
212 return -EINVAL; 212 return -EINVAL;
@@ -214,9 +214,9 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
214 214
215int s5p_usb_phy_exit(struct platform_device *pdev, int type) 215int s5p_usb_phy_exit(struct platform_device *pdev, int type)
216{ 216{
217 if (type == S5P_USB_PHY_DEVICE) 217 if (type == USB_PHY_TYPE_DEVICE)
218 return exynos4210_usb_phy0_exit(pdev); 218 return exynos4210_usb_phy0_exit(pdev);
219 else if (type == S5P_USB_PHY_HOST) 219 else if (type == USB_PHY_TYPE_HOST)
220 return exynos4210_usb_phy1_exit(pdev); 220 return exynos4210_usb_phy1_exit(pdev);
221 221
222 return -EINVAL; 222 return -EINVAL;
diff --git a/arch/arm/mach-exynos/smc.h b/arch/arm/mach-exynos/smc.h
new file mode 100644
index 000000000000..13a1dc8ecbf2
--- /dev/null
+++ b/arch/arm/mach-exynos/smc.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics.
3 *
4 * EXYNOS - SMC Call
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_EXYNOS_SMC_H
12#define __ASM_ARCH_EXYNOS_SMC_H
13
14#define SMC_CMD_INIT (-1)
15#define SMC_CMD_INFO (-2)
16/* For Power Management */
17#define SMC_CMD_SLEEP (-3)
18#define SMC_CMD_CPU1BOOT (-4)
19#define SMC_CMD_CPU0AFTR (-5)
20/* For CP15 Access */
21#define SMC_CMD_C15RESUME (-11)
22/* For L2 Cache Access */
23#define SMC_CMD_L2X0CTRL (-21)
24#define SMC_CMD_L2X0SETUP1 (-22)
25#define SMC_CMD_L2X0SETUP2 (-23)
26#define SMC_CMD_L2X0INVALL (-24)
27#define SMC_CMD_L2X0DEBUG (-25)
28
29extern void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3);
30
31#endif
diff --git a/arch/arm/mach-gemini/Makefile b/arch/arm/mach-gemini/Makefile
index 7355c0bbcb5e..7963a77be637 100644
--- a/arch/arm/mach-gemini/Makefile
+++ b/arch/arm/mach-gemini/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := irq.o mm.o time.o devices.o gpio.o idle.o 7obj-y := irq.o mm.o time.o devices.o gpio.o idle.o reset.o
8 8
9# Board-specific support 9# Board-specific support
10obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o 10obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o
diff --git a/arch/arm/mach-gemini/board-nas4220b.c b/arch/arm/mach-gemini/board-nas4220b.c
index 08bd650c42f3..ca8a25bb3521 100644
--- a/arch/arm/mach-gemini/board-nas4220b.c
+++ b/arch/arm/mach-gemini/board-nas4220b.c
@@ -103,4 +103,5 @@ MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
103 .init_irq = gemini_init_irq, 103 .init_irq = gemini_init_irq,
104 .init_time = gemini_timer_init, 104 .init_time = gemini_timer_init,
105 .init_machine = ib4220b_init, 105 .init_machine = ib4220b_init,
106 .restart = gemini_restart,
106MACHINE_END 107MACHINE_END
diff --git a/arch/arm/mach-gemini/board-rut1xx.c b/arch/arm/mach-gemini/board-rut1xx.c
index fa0a36337f4d..7a675f88ffd6 100644
--- a/arch/arm/mach-gemini/board-rut1xx.c
+++ b/arch/arm/mach-gemini/board-rut1xx.c
@@ -14,6 +14,7 @@
14#include <linux/leds.h> 14#include <linux/leds.h>
15#include <linux/input.h> 15#include <linux/input.h>
16#include <linux/gpio_keys.h> 16#include <linux/gpio_keys.h>
17#include <linux/sizes.h>
17 18
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -87,4 +88,5 @@ MACHINE_START(RUT100, "Teltonika RUT100")
87 .init_irq = gemini_init_irq, 88 .init_irq = gemini_init_irq,
88 .init_time = gemini_timer_init, 89 .init_time = gemini_timer_init,
89 .init_machine = rut1xx_init, 90 .init_machine = rut1xx_init,
91 .restart = gemini_restart,
90MACHINE_END 92MACHINE_END
diff --git a/arch/arm/mach-gemini/board-wbd111.c b/arch/arm/mach-gemini/board-wbd111.c
index 3321cd6cc1f3..418188cd1712 100644
--- a/arch/arm/mach-gemini/board-wbd111.c
+++ b/arch/arm/mach-gemini/board-wbd111.c
@@ -130,4 +130,5 @@ MACHINE_START(WBD111, "Wiliboard WBD-111")
130 .init_irq = gemini_init_irq, 130 .init_irq = gemini_init_irq,
131 .init_time = gemini_timer_init, 131 .init_time = gemini_timer_init,
132 .init_machine = wbd111_init, 132 .init_machine = wbd111_init,
133 .restart = gemini_restart,
133MACHINE_END 134MACHINE_END
diff --git a/arch/arm/mach-gemini/board-wbd222.c b/arch/arm/mach-gemini/board-wbd222.c
index fe33c825fdaf..266b265090cd 100644
--- a/arch/arm/mach-gemini/board-wbd222.c
+++ b/arch/arm/mach-gemini/board-wbd222.c
@@ -130,4 +130,5 @@ MACHINE_START(WBD222, "Wiliboard WBD-222")
130 .init_irq = gemini_init_irq, 130 .init_irq = gemini_init_irq,
131 .init_time = gemini_timer_init, 131 .init_time = gemini_timer_init,
132 .init_machine = wbd222_init, 132 .init_machine = wbd222_init,
133 .restart = gemini_restart,
133MACHINE_END 134MACHINE_END
diff --git a/arch/arm/mach-gemini/common.h b/arch/arm/mach-gemini/common.h
index 7670c39acb2f..38a45260a7c8 100644
--- a/arch/arm/mach-gemini/common.h
+++ b/arch/arm/mach-gemini/common.h
@@ -26,4 +26,6 @@ extern int platform_register_pflash(unsigned int size,
26 struct mtd_partition *parts, 26 struct mtd_partition *parts,
27 unsigned int nr_parts); 27 unsigned int nr_parts);
28 28
29extern void gemini_restart(char mode, const char *cmd);
30
29#endif /* __GEMINI_COMMON_H__ */ 31#endif /* __GEMINI_COMMON_H__ */
diff --git a/arch/arm/mach-gemini/gpio.c b/arch/arm/mach-gemini/gpio.c
index fdc7ef1391d3..70bfa571b24b 100644
--- a/arch/arm/mach-gemini/gpio.c
+++ b/arch/arm/mach-gemini/gpio.c
@@ -21,6 +21,7 @@
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/gpio.h>
24 25
25#define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x)) 26#define GPIO_BASE(x) IO_ADDRESS(GEMINI_GPIO_BASE(x))
26 27
@@ -44,7 +45,7 @@
44 45
45#define GPIO_PORT_NUM 3 46#define GPIO_PORT_NUM 3
46 47
47static void _set_gpio_irqenable(unsigned int base, unsigned int index, 48static void _set_gpio_irqenable(void __iomem *base, unsigned int index,
48 int enable) 49 int enable)
49{ 50{
50 unsigned int reg; 51 unsigned int reg;
@@ -57,7 +58,7 @@ static void _set_gpio_irqenable(unsigned int base, unsigned int index,
57static void gpio_ack_irq(struct irq_data *d) 58static void gpio_ack_irq(struct irq_data *d)
58{ 59{
59 unsigned int gpio = irq_to_gpio(d->irq); 60 unsigned int gpio = irq_to_gpio(d->irq);
60 unsigned int base = GPIO_BASE(gpio / 32); 61 void __iomem *base = GPIO_BASE(gpio / 32);
61 62
62 __raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR); 63 __raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR);
63} 64}
@@ -65,7 +66,7 @@ static void gpio_ack_irq(struct irq_data *d)
65static void gpio_mask_irq(struct irq_data *d) 66static void gpio_mask_irq(struct irq_data *d)
66{ 67{
67 unsigned int gpio = irq_to_gpio(d->irq); 68 unsigned int gpio = irq_to_gpio(d->irq);
68 unsigned int base = GPIO_BASE(gpio / 32); 69 void __iomem *base = GPIO_BASE(gpio / 32);
69 70
70 _set_gpio_irqenable(base, gpio % 32, 0); 71 _set_gpio_irqenable(base, gpio % 32, 0);
71} 72}
@@ -73,7 +74,7 @@ static void gpio_mask_irq(struct irq_data *d)
73static void gpio_unmask_irq(struct irq_data *d) 74static void gpio_unmask_irq(struct irq_data *d)
74{ 75{
75 unsigned int gpio = irq_to_gpio(d->irq); 76 unsigned int gpio = irq_to_gpio(d->irq);
76 unsigned int base = GPIO_BASE(gpio / 32); 77 void __iomem *base = GPIO_BASE(gpio / 32);
77 78
78 _set_gpio_irqenable(base, gpio % 32, 1); 79 _set_gpio_irqenable(base, gpio % 32, 1);
79} 80}
@@ -82,7 +83,7 @@ static int gpio_set_irq_type(struct irq_data *d, unsigned int type)
82{ 83{
83 unsigned int gpio = irq_to_gpio(d->irq); 84 unsigned int gpio = irq_to_gpio(d->irq);
84 unsigned int gpio_mask = 1 << (gpio % 32); 85 unsigned int gpio_mask = 1 << (gpio % 32);
85 unsigned int base = GPIO_BASE(gpio / 32); 86 void __iomem *base = GPIO_BASE(gpio / 32);
86 unsigned int reg_both, reg_level, reg_type; 87 unsigned int reg_both, reg_level, reg_type;
87 88
88 reg_type = __raw_readl(base + GPIO_INT_TYPE); 89 reg_type = __raw_readl(base + GPIO_INT_TYPE);
@@ -120,7 +121,7 @@ static int gpio_set_irq_type(struct irq_data *d, unsigned int type)
120 __raw_writel(reg_level, base + GPIO_INT_LEVEL); 121 __raw_writel(reg_level, base + GPIO_INT_LEVEL);
121 __raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE); 122 __raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE);
122 123
123 gpio_ack_irq(d->irq); 124 gpio_ack_irq(d);
124 125
125 return 0; 126 return 0;
126} 127}
@@ -153,7 +154,7 @@ static struct irq_chip gpio_irq_chip = {
153static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, 154static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
154 int dir) 155 int dir)
155{ 156{
156 unsigned int base = GPIO_BASE(offset / 32); 157 void __iomem *base = GPIO_BASE(offset / 32);
157 unsigned int reg; 158 unsigned int reg;
158 159
159 reg = __raw_readl(base + GPIO_DIR); 160 reg = __raw_readl(base + GPIO_DIR);
@@ -166,7 +167,7 @@ static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
166 167
167static void gemini_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 168static void gemini_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
168{ 169{
169 unsigned int base = GPIO_BASE(offset / 32); 170 void __iomem *base = GPIO_BASE(offset / 32);
170 171
171 if (value) 172 if (value)
172 __raw_writel(1 << (offset % 32), base + GPIO_DATA_SET); 173 __raw_writel(1 << (offset % 32), base + GPIO_DATA_SET);
@@ -176,7 +177,7 @@ static void gemini_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
176 177
177static int gemini_gpio_get(struct gpio_chip *chip, unsigned offset) 178static int gemini_gpio_get(struct gpio_chip *chip, unsigned offset)
178{ 179{
179 unsigned int base = GPIO_BASE(offset / 32); 180 void __iomem *base = GPIO_BASE(offset / 32);
180 181
181 return (__raw_readl(base + GPIO_DATA_IN) >> (offset % 32)) & 1; 182 return (__raw_readl(base + GPIO_DATA_IN) >> (offset % 32)) & 1;
182} 183}
diff --git a/arch/arm/mach-gemini/idle.c b/arch/arm/mach-gemini/idle.c
index 92bbd6bb600a..87dff4f5059e 100644
--- a/arch/arm/mach-gemini/idle.c
+++ b/arch/arm/mach-gemini/idle.c
@@ -13,9 +13,11 @@ static void gemini_idle(void)
13 * will never wakeup... Acctualy it is not very good to enable 13 * will never wakeup... Acctualy it is not very good to enable
14 * interrupts first since scheduler can miss a tick, but there is 14 * interrupts first since scheduler can miss a tick, but there is
15 * no other way around this. Platforms that needs it for power saving 15 * no other way around this. Platforms that needs it for power saving
16 * should call enable_hlt() in init code, since by default it is 16 * should enable it in init code, since by default it is
17 * disabled. 17 * disabled.
18 */ 18 */
19
20 /* FIXME: Enabling interrupts here is racy! */
19 local_irq_enable(); 21 local_irq_enable();
20 cpu_do_idle(); 22 cpu_do_idle();
21} 23}
diff --git a/arch/arm/mach-gemini/include/mach/hardware.h b/arch/arm/mach-gemini/include/mach/hardware.h
index 8c950e1d06be..98e7b0f286bf 100644
--- a/arch/arm/mach-gemini/include/mach/hardware.h
+++ b/arch/arm/mach-gemini/include/mach/hardware.h
@@ -69,6 +69,6 @@
69/* 69/*
70 * macro to get at IO space when running virtually 70 * macro to get at IO space when running virtually
71 */ 71 */
72#define IO_ADDRESS(x) ((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000) 72#define IO_ADDRESS(x) IOMEM((((x) & 0xFFF00000) >> 4) | ((x) & 0x000FFFFF) | 0xF0000000)
73 73
74#endif 74#endif
diff --git a/arch/arm/mach-gemini/irq.c b/arch/arm/mach-gemini/irq.c
index 020852d3bdd8..44f50dcb616d 100644
--- a/arch/arm/mach-gemini/irq.c
+++ b/arch/arm/mach-gemini/irq.c
@@ -15,6 +15,8 @@
15#include <linux/stddef.h> 15#include <linux/stddef.h>
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/cpu.h>
19
18#include <asm/irq.h> 20#include <asm/irq.h>
19#include <asm/mach/irq.h> 21#include <asm/mach/irq.h>
20#include <asm/system_misc.h> 22#include <asm/system_misc.h>
@@ -65,8 +67,8 @@ static struct irq_chip gemini_irq_chip = {
65 67
66static struct resource irq_resource = { 68static struct resource irq_resource = {
67 .name = "irq_handler", 69 .name = "irq_handler",
68 .start = IO_ADDRESS(GEMINI_INTERRUPT_BASE), 70 .start = GEMINI_INTERRUPT_BASE,
69 .end = IO_ADDRESS(FIQ_STATUS(GEMINI_INTERRUPT_BASE)) + 4, 71 .end = FIQ_STATUS(GEMINI_INTERRUPT_BASE) + 4,
70}; 72};
71 73
72void __init gemini_init_irq(void) 74void __init gemini_init_irq(void)
@@ -77,7 +79,7 @@ void __init gemini_init_irq(void)
77 * Disable the idle handler by default since it is buggy 79 * Disable the idle handler by default since it is buggy
78 * For more info see arch/arm/mach-gemini/idle.c 80 * For more info see arch/arm/mach-gemini/idle.c
79 */ 81 */
80 disable_hlt(); 82 cpu_idle_poll_ctrl(true);
81 83
82 request_resource(&iomem_resource, &irq_resource); 84 request_resource(&iomem_resource, &irq_resource);
83 85
diff --git a/arch/arm/mach-gemini/mm.c b/arch/arm/mach-gemini/mm.c
index 51948242ec09..2c2cd284bb6a 100644
--- a/arch/arm/mach-gemini/mm.c
+++ b/arch/arm/mach-gemini/mm.c
@@ -19,57 +19,57 @@
19/* Page table mapping for I/O region */ 19/* Page table mapping for I/O region */
20static struct map_desc gemini_io_desc[] __initdata = { 20static struct map_desc gemini_io_desc[] __initdata = {
21 { 21 {
22 .virtual = IO_ADDRESS(GEMINI_GLOBAL_BASE), 22 .virtual = (unsigned long)IO_ADDRESS(GEMINI_GLOBAL_BASE),
23 .pfn =__phys_to_pfn(GEMINI_GLOBAL_BASE), 23 .pfn =__phys_to_pfn(GEMINI_GLOBAL_BASE),
24 .length = SZ_512K, 24 .length = SZ_512K,
25 .type = MT_DEVICE, 25 .type = MT_DEVICE,
26 }, { 26 }, {
27 .virtual = IO_ADDRESS(GEMINI_UART_BASE), 27 .virtual = (unsigned long)IO_ADDRESS(GEMINI_UART_BASE),
28 .pfn = __phys_to_pfn(GEMINI_UART_BASE), 28 .pfn = __phys_to_pfn(GEMINI_UART_BASE),
29 .length = SZ_512K, 29 .length = SZ_512K,
30 .type = MT_DEVICE, 30 .type = MT_DEVICE,
31 }, { 31 }, {
32 .virtual = IO_ADDRESS(GEMINI_TIMER_BASE), 32 .virtual = (unsigned long)IO_ADDRESS(GEMINI_TIMER_BASE),
33 .pfn = __phys_to_pfn(GEMINI_TIMER_BASE), 33 .pfn = __phys_to_pfn(GEMINI_TIMER_BASE),
34 .length = SZ_512K, 34 .length = SZ_512K,
35 .type = MT_DEVICE, 35 .type = MT_DEVICE,
36 }, { 36 }, {
37 .virtual = IO_ADDRESS(GEMINI_INTERRUPT_BASE), 37 .virtual = (unsigned long)IO_ADDRESS(GEMINI_INTERRUPT_BASE),
38 .pfn = __phys_to_pfn(GEMINI_INTERRUPT_BASE), 38 .pfn = __phys_to_pfn(GEMINI_INTERRUPT_BASE),
39 .length = SZ_512K, 39 .length = SZ_512K,
40 .type = MT_DEVICE, 40 .type = MT_DEVICE,
41 }, { 41 }, {
42 .virtual = IO_ADDRESS(GEMINI_POWER_CTRL_BASE), 42 .virtual = (unsigned long)IO_ADDRESS(GEMINI_POWER_CTRL_BASE),
43 .pfn = __phys_to_pfn(GEMINI_POWER_CTRL_BASE), 43 .pfn = __phys_to_pfn(GEMINI_POWER_CTRL_BASE),
44 .length = SZ_512K, 44 .length = SZ_512K,
45 .type = MT_DEVICE, 45 .type = MT_DEVICE,
46 }, { 46 }, {
47 .virtual = IO_ADDRESS(GEMINI_GPIO_BASE(0)), 47 .virtual = (unsigned long)IO_ADDRESS(GEMINI_GPIO_BASE(0)),
48 .pfn = __phys_to_pfn(GEMINI_GPIO_BASE(0)), 48 .pfn = __phys_to_pfn(GEMINI_GPIO_BASE(0)),
49 .length = SZ_512K, 49 .length = SZ_512K,
50 .type = MT_DEVICE, 50 .type = MT_DEVICE,
51 }, { 51 }, {
52 .virtual = IO_ADDRESS(GEMINI_GPIO_BASE(1)), 52 .virtual = (unsigned long)IO_ADDRESS(GEMINI_GPIO_BASE(1)),
53 .pfn = __phys_to_pfn(GEMINI_GPIO_BASE(1)), 53 .pfn = __phys_to_pfn(GEMINI_GPIO_BASE(1)),
54 .length = SZ_512K, 54 .length = SZ_512K,
55 .type = MT_DEVICE, 55 .type = MT_DEVICE,
56 }, { 56 }, {
57 .virtual = IO_ADDRESS(GEMINI_GPIO_BASE(2)), 57 .virtual = (unsigned long)IO_ADDRESS(GEMINI_GPIO_BASE(2)),
58 .pfn = __phys_to_pfn(GEMINI_GPIO_BASE(2)), 58 .pfn = __phys_to_pfn(GEMINI_GPIO_BASE(2)),
59 .length = SZ_512K, 59 .length = SZ_512K,
60 .type = MT_DEVICE, 60 .type = MT_DEVICE,
61 }, { 61 }, {
62 .virtual = IO_ADDRESS(GEMINI_FLASH_CTRL_BASE), 62 .virtual = (unsigned long)IO_ADDRESS(GEMINI_FLASH_CTRL_BASE),
63 .pfn = __phys_to_pfn(GEMINI_FLASH_CTRL_BASE), 63 .pfn = __phys_to_pfn(GEMINI_FLASH_CTRL_BASE),
64 .length = SZ_512K, 64 .length = SZ_512K,
65 .type = MT_DEVICE, 65 .type = MT_DEVICE,
66 }, { 66 }, {
67 .virtual = IO_ADDRESS(GEMINI_DRAM_CTRL_BASE), 67 .virtual = (unsigned long)IO_ADDRESS(GEMINI_DRAM_CTRL_BASE),
68 .pfn = __phys_to_pfn(GEMINI_DRAM_CTRL_BASE), 68 .pfn = __phys_to_pfn(GEMINI_DRAM_CTRL_BASE),
69 .length = SZ_512K, 69 .length = SZ_512K,
70 .type = MT_DEVICE, 70 .type = MT_DEVICE,
71 }, { 71 }, {
72 .virtual = IO_ADDRESS(GEMINI_GENERAL_DMA_BASE), 72 .virtual = (unsigned long)IO_ADDRESS(GEMINI_GENERAL_DMA_BASE),
73 .pfn = __phys_to_pfn(GEMINI_GENERAL_DMA_BASE), 73 .pfn = __phys_to_pfn(GEMINI_GENERAL_DMA_BASE),
74 .length = SZ_512K, 74 .length = SZ_512K,
75 .type = MT_DEVICE, 75 .type = MT_DEVICE,
diff --git a/arch/arm/mach-gemini/include/mach/system.h b/arch/arm/mach-gemini/reset.c
index a33b5a1f8ab4..b26659759e27 100644
--- a/arch/arm/mach-gemini/include/mach/system.h
+++ b/arch/arm/mach-gemini/reset.c
@@ -14,7 +14,7 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/global_reg.h> 15#include <mach/global_reg.h>
16 16
17static inline void arch_reset(char mode, const char *cmd) 17void gemini_restart(char mode, const char *cmd)
18{ 18{
19 __raw_writel(RESET_GLOBAL | RESET_CPU1, 19 __raw_writel(RESET_GLOBAL | RESET_CPU1,
20 IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET); 20 IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
diff --git a/arch/arm/mach-h720x/Kconfig b/arch/arm/mach-h720x/Kconfig
deleted file mode 100644
index 6bb755bcb6f5..000000000000
--- a/arch/arm/mach-h720x/Kconfig
+++ /dev/null
@@ -1,40 +0,0 @@
1if ARCH_H720X
2
3menu "h720x Implementations"
4
5config ARCH_H7201
6 bool "gms30c7201"
7 depends on ARCH_H720X
8 select CPU_H7201
9 select ZONE_DMA
10 help
11 Say Y here if you are using the Hynix GMS30C7201 Reference Board
12
13config ARCH_H7202
14 bool "hms30c7202"
15 depends on ARCH_H720X
16 select CPU_H7202
17 select ZONE_DMA
18 help
19 Say Y here if you are using the Hynix HMS30C7202 Reference Board
20
21endmenu
22
23config CPU_H7201
24 bool
25 help
26 Select code specific to h7201 variants
27
28config CPU_H7202
29 bool
30 help
31 Select code specific to h7202 variants
32config H7202_SERIAL23
33 depends on CPU_H7202
34 bool "Use serial ports 2+3"
35 help
36 Say Y here if you wish to use serial ports 2+3. They share their
37 pins with the keyboard matrix controller, so you have to decide.
38
39
40endif
diff --git a/arch/arm/mach-h720x/Makefile b/arch/arm/mach-h720x/Makefile
deleted file mode 100644
index e4cf728948eb..000000000000
--- a/arch/arm/mach-h720x/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common support
6obj-y := common.o
7obj-m :=
8obj-n :=
9obj- :=
10
11# Specific board support
12
13obj-$(CONFIG_ARCH_H7201) += h7201-eval.o
14obj-$(CONFIG_ARCH_H7202) += h7202-eval.o
15obj-$(CONFIG_CPU_H7201) += cpu-h7201.o
16obj-$(CONFIG_CPU_H7202) += cpu-h7202.o
diff --git a/arch/arm/mach-h720x/Makefile.boot b/arch/arm/mach-h720x/Makefile.boot
deleted file mode 100644
index d875a7094dfe..000000000000
--- a/arch/arm/mach-h720x/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-$(CONFIG_ARCH_H720X) += 0x40008000
2
diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
deleted file mode 100644
index 17ef91fa3d56..000000000000
--- a/arch/arm/mach-h720x/common.c
+++ /dev/null
@@ -1,268 +0,0 @@
1/*
2 * linux/arch/arm/mach-h720x/common.c
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * 2004 Sascha Hauer <s.hauer@pengutronix.de>
7 *
8 * common stuff for Hynix h720x processors
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
16#include <linux/sched.h>
17#include <linux/mman.h>
18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/io.h>
21
22#include <asm/page.h>
23#include <asm/pgtable.h>
24#include <asm/dma.h>
25#include <mach/hardware.h>
26#include <asm/irq.h>
27#include <asm/system_misc.h>
28#include <asm/mach/irq.h>
29#include <asm/mach/map.h>
30#include <mach/irqs.h>
31
32#include <asm/mach/dma.h>
33
34#if 0
35#define IRQDBG(args...) printk(args)
36#else
37#define IRQDBG(args...) do {} while(0)
38#endif
39
40void __init arch_dma_init(dma_t *dma)
41{
42}
43
44/*
45 * Return nsecs since last timer reload
46 * (timercount * (usecs perjiffie)) / (ticks per jiffie)
47 */
48u32 h720x_gettimeoffset(void)
49{
50 return ((CPU_REG(TIMER_VIRT, TM0_COUNT) * tick_usec) / LATCH) * 1000;
51}
52
53/*
54 * mask Global irq's
55 */
56static void mask_global_irq(struct irq_data *d)
57{
58 CPU_REG (IRQC_VIRT, IRQC_IER) &= ~(1 << d->irq);
59}
60
61/*
62 * unmask Global irq's
63 */
64static void unmask_global_irq(struct irq_data *d)
65{
66 CPU_REG (IRQC_VIRT, IRQC_IER) |= (1 << d->irq);
67}
68
69
70/*
71 * ack GPIO irq's
72 * Ack only for edge triggered int's valid
73 */
74static void inline ack_gpio_irq(struct irq_data *d)
75{
76 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(d->irq));
77 u32 bit = IRQ_TO_BIT(d->irq);
78 if ( (CPU_REG (reg_base, GPIO_EDGE) & bit))
79 CPU_REG (reg_base, GPIO_CLR) = bit;
80}
81
82/*
83 * mask GPIO irq's
84 */
85static void inline mask_gpio_irq(struct irq_data *d)
86{
87 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(d->irq));
88 u32 bit = IRQ_TO_BIT(d->irq);
89 CPU_REG (reg_base, GPIO_MASK) &= ~bit;
90}
91
92/*
93 * unmask GPIO irq's
94 */
95static void inline unmask_gpio_irq(struct irq_data *d)
96{
97 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(d->irq));
98 u32 bit = IRQ_TO_BIT(d->irq);
99 CPU_REG (reg_base, GPIO_MASK) |= bit;
100}
101
102static void
103h720x_gpio_handler(unsigned int mask, unsigned int irq,
104 struct irq_desc *desc)
105{
106 IRQDBG("%s irq: %d\n", __func__, irq);
107 while (mask) {
108 if (mask & 1) {
109 IRQDBG("handling irq %d\n", irq);
110 generic_handle_irq(irq);
111 }
112 irq++;
113 mask >>= 1;
114 }
115}
116
117static void
118h720x_gpioa_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
119{
120 unsigned int mask, irq;
121
122 mask = CPU_REG(GPIO_A_VIRT,GPIO_STAT);
123 irq = IRQ_CHAINED_GPIOA(0);
124 IRQDBG("%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
125 h720x_gpio_handler(mask, irq, desc);
126}
127
128static void
129h720x_gpiob_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
130{
131 unsigned int mask, irq;
132 mask = CPU_REG(GPIO_B_VIRT,GPIO_STAT);
133 irq = IRQ_CHAINED_GPIOB(0);
134 IRQDBG("%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
135 h720x_gpio_handler(mask, irq, desc);
136}
137
138static void
139h720x_gpioc_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
140{
141 unsigned int mask, irq;
142
143 mask = CPU_REG(GPIO_C_VIRT,GPIO_STAT);
144 irq = IRQ_CHAINED_GPIOC(0);
145 IRQDBG("%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
146 h720x_gpio_handler(mask, irq, desc);
147}
148
149static void
150h720x_gpiod_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
151{
152 unsigned int mask, irq;
153
154 mask = CPU_REG(GPIO_D_VIRT,GPIO_STAT);
155 irq = IRQ_CHAINED_GPIOD(0);
156 IRQDBG("%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
157 h720x_gpio_handler(mask, irq, desc);
158}
159
160#ifdef CONFIG_CPU_H7202
161static void
162h720x_gpioe_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
163{
164 unsigned int mask, irq;
165
166 mask = CPU_REG(GPIO_E_VIRT,GPIO_STAT);
167 irq = IRQ_CHAINED_GPIOE(0);
168 IRQDBG("%s mask: 0x%08x irq: %d\n", __func__, mask,irq);
169 h720x_gpio_handler(mask, irq, desc);
170}
171#endif
172
173static struct irq_chip h720x_global_chip = {
174 .irq_ack = mask_global_irq,
175 .irq_mask = mask_global_irq,
176 .irq_unmask = unmask_global_irq,
177};
178
179static struct irq_chip h720x_gpio_chip = {
180 .irq_ack = ack_gpio_irq,
181 .irq_mask = mask_gpio_irq,
182 .irq_unmask = unmask_gpio_irq,
183};
184
185/*
186 * Initialize IRQ's, mask all, enable multiplexed irq's
187 */
188void __init h720x_init_irq (void)
189{
190 int irq;
191
192 /* Mask global irq's */
193 CPU_REG (IRQC_VIRT, IRQC_IER) = 0x0;
194
195 /* Mask all multiplexed irq's */
196 CPU_REG (GPIO_A_VIRT, GPIO_MASK) = 0x0;
197 CPU_REG (GPIO_B_VIRT, GPIO_MASK) = 0x0;
198 CPU_REG (GPIO_C_VIRT, GPIO_MASK) = 0x0;
199 CPU_REG (GPIO_D_VIRT, GPIO_MASK) = 0x0;
200
201 /* Initialize global IRQ's, fast path */
202 for (irq = 0; irq < NR_GLBL_IRQS; irq++) {
203 irq_set_chip_and_handler(irq, &h720x_global_chip,
204 handle_level_irq);
205 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
206 }
207
208 /* Initialize multiplexed IRQ's, slow path */
209 for (irq = IRQ_CHAINED_GPIOA(0) ; irq <= IRQ_CHAINED_GPIOD(31); irq++) {
210 irq_set_chip_and_handler(irq, &h720x_gpio_chip,
211 handle_edge_irq);
212 set_irq_flags(irq, IRQF_VALID );
213 }
214 irq_set_chained_handler(IRQ_GPIOA, h720x_gpioa_demux_handler);
215 irq_set_chained_handler(IRQ_GPIOB, h720x_gpiob_demux_handler);
216 irq_set_chained_handler(IRQ_GPIOC, h720x_gpioc_demux_handler);
217 irq_set_chained_handler(IRQ_GPIOD, h720x_gpiod_demux_handler);
218
219#ifdef CONFIG_CPU_H7202
220 for (irq = IRQ_CHAINED_GPIOE(0) ; irq <= IRQ_CHAINED_GPIOE(31); irq++) {
221 irq_set_chip_and_handler(irq, &h720x_gpio_chip,
222 handle_edge_irq);
223 set_irq_flags(irq, IRQF_VALID );
224 }
225 irq_set_chained_handler(IRQ_GPIOE, h720x_gpioe_demux_handler);
226#endif
227
228 /* Enable multiplexed irq's */
229 CPU_REG (IRQC_VIRT, IRQC_IER) = IRQ_ENA_MUX;
230}
231
232static struct map_desc h720x_io_desc[] __initdata = {
233 {
234 .virtual = IO_VIRT,
235 .pfn = __phys_to_pfn(IO_PHYS),
236 .length = IO_SIZE,
237 .type = MT_DEVICE
238 },
239};
240
241/* Initialize io tables */
242void __init h720x_map_io(void)
243{
244 iotable_init(h720x_io_desc,ARRAY_SIZE(h720x_io_desc));
245}
246
247void h720x_restart(char mode, const char *cmd)
248{
249 CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET;
250}
251
252static void h720x__idle(void)
253{
254 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_IDLE;
255 nop();
256 nop();
257 CPU_REG (PMU_BASE, PMU_MODE) = PMU_MODE_RUN;
258 nop();
259 nop();
260}
261
262static int __init h720x_idle_init(void)
263{
264 arm_pm_idle = h720x__idle;
265 return 0;
266}
267
268arch_initcall(h720x_idle_init);
diff --git a/arch/arm/mach-h720x/common.h b/arch/arm/mach-h720x/common.h
deleted file mode 100644
index 7e738410ca93..000000000000
--- a/arch/arm/mach-h720x/common.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * linux/arch/arm/mach-h720x/common.h
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * 2004 Sascha Hauer <s.hauer@pengutronix.de>
7 *
8 * Architecture specific stuff for Hynix GMS30C7201 development board
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
16extern u32 h720x_gettimeoffset(void);
17extern void __init h720x_init_irq(void);
18extern void __init h720x_map_io(void);
19extern void h720x_restart(char, const char *);
20
21#ifdef CONFIG_ARCH_H7202
22extern void h7202_timer_init(void);
23extern void __init init_hw_h7202(void);
24extern void __init h7202_init_irq(void);
25extern void __init h7202_init_time(void);
26#endif
27
28#ifdef CONFIG_ARCH_H7201
29extern void h7201_timer_init(void);
30#endif
diff --git a/arch/arm/mach-h720x/cpu-h7201.c b/arch/arm/mach-h720x/cpu-h7201.c
deleted file mode 100644
index 13c741215387..000000000000
--- a/arch/arm/mach-h720x/cpu-h7201.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/arch/arm/mach-h720x/cpu-h7201.c
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * 2004 Sascha Hauer <s.hauer@pengutronix.de>
7 *
8 * processor specific stuff for the Hynix h7201
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
16#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/module.h>
19#include <asm/types.h>
20#include <mach/hardware.h>
21#include <asm/irq.h>
22#include <mach/irqs.h>
23#include <asm/mach/irq.h>
24#include <asm/mach/time.h>
25#include "common.h"
26/*
27 * Timer interrupt handler
28 */
29static irqreturn_t
30h7201_timer_interrupt(int irq, void *dev_id)
31{
32 CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
33 timer_tick();
34
35 return IRQ_HANDLED;
36}
37
38static struct irqaction h7201_timer_irq = {
39 .name = "h7201 Timer Tick",
40 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
41 .handler = h7201_timer_interrupt,
42};
43
44/*
45 * Setup TIMER0 as system timer
46 */
47void __init h7201_timer_init(void)
48{
49 arch_gettimeoffset = h720x_gettimeoffset;
50
51 CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
52 CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
53 CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
54 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT;
55
56 setup_irq(IRQ_TIMER0, &h7201_timer_irq);
57}
diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c
deleted file mode 100644
index e2ae7e898f9d..000000000000
--- a/arch/arm/mach-h720x/cpu-h7202.c
+++ /dev/null
@@ -1,225 +0,0 @@
1/*
2 * linux/arch/arm/mach-h720x/cpu-h7202.c
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * 2004 Sascha Hauer <s.hauer@pengutronix.de>
7 *
8 * processor specific stuff for the Hynix h7202
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
16#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/module.h>
19#include <asm/types.h>
20#include <mach/hardware.h>
21#include <asm/irq.h>
22#include <mach/irqs.h>
23#include <asm/mach/irq.h>
24#include <asm/mach/time.h>
25#include <linux/device.h>
26#include <linux/serial_8250.h>
27#include "common.h"
28
29static struct resource h7202ps2_resources[] = {
30 [0] = {
31 .start = 0x8002c000,
32 .end = 0x8002c040,
33 .flags = IORESOURCE_MEM,
34 },
35 [1] = {
36 .start = IRQ_PS2,
37 .end = IRQ_PS2,
38 .flags = IORESOURCE_IRQ,
39 },
40};
41
42static struct platform_device h7202ps2_device = {
43 .name = "h7202ps2",
44 .id = -1,
45 .num_resources = ARRAY_SIZE(h7202ps2_resources),
46 .resource = h7202ps2_resources,
47};
48
49static struct plat_serial8250_port serial_platform_data[] = {
50 {
51 .membase = (void*)SERIAL0_VIRT,
52 .mapbase = SERIAL0_BASE,
53 .irq = IRQ_UART0,
54 .uartclk = 2*1843200,
55 .regshift = 2,
56 .iotype = UPIO_MEM,
57 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
58 },
59 {
60 .membase = (void*)SERIAL1_VIRT,
61 .mapbase = SERIAL1_BASE,
62 .irq = IRQ_UART1,
63 .uartclk = 2*1843200,
64 .regshift = 2,
65 .iotype = UPIO_MEM,
66 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
67 },
68#ifdef CONFIG_H7202_SERIAL23
69 {
70 .membase = (void*)SERIAL2_VIRT,
71 .mapbase = SERIAL2_BASE,
72 .irq = IRQ_UART2,
73 .uartclk = 2*1843200,
74 .regshift = 2,
75 .iotype = UPIO_MEM,
76 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
77 },
78 {
79 .membase = (void*)SERIAL3_VIRT,
80 .mapbase = SERIAL3_BASE,
81 .irq = IRQ_UART3,
82 .uartclk = 2*1843200,
83 .regshift = 2,
84 .iotype = UPIO_MEM,
85 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
86 },
87#endif
88 { },
89};
90
91static struct platform_device serial_device = {
92 .name = "serial8250",
93 .id = PLAT8250_DEV_PLATFORM,
94 .dev = {
95 .platform_data = serial_platform_data,
96 },
97};
98
99static struct platform_device *devices[] __initdata = {
100 &h7202ps2_device,
101 &serial_device,
102};
103
104/* Although we have two interrupt lines for the timers, we only have one
105 * status register which clears all pending timer interrupts on reading. So
106 * we have to handle all timer interrupts in one place.
107 */
108static void
109h7202_timerx_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
110{
111 unsigned int mask, irq;
112
113 mask = CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
114
115 if ( mask & TSTAT_T0INT ) {
116 timer_tick();
117 if( mask == TSTAT_T0INT )
118 return;
119 }
120
121 mask >>= 1;
122 irq = IRQ_TIMER1;
123 while (mask) {
124 if (mask & 1)
125 generic_handle_irq(irq);
126 irq++;
127 mask >>= 1;
128 }
129}
130
131/*
132 * Timer interrupt handler
133 */
134static irqreturn_t
135h7202_timer_interrupt(int irq, void *dev_id)
136{
137 h7202_timerx_demux_handler(0, NULL);
138 return IRQ_HANDLED;
139}
140
141/*
142 * mask multiplexed timer IRQs
143 */
144static void inline __mask_timerx_irq(unsigned int irq)
145{
146 unsigned int bit;
147 bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1));
148 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) &= ~bit;
149}
150
151static void inline mask_timerx_irq(struct irq_data *d)
152{
153 __mask_timerx_irq(d->irq);
154}
155
156/*
157 * unmask multiplexed timer IRQs
158 */
159static void inline unmask_timerx_irq(struct irq_data *d)
160{
161 unsigned int bit;
162 bit = 2 << ((d->irq == IRQ_TIMER64B) ? 4 : (d->irq - IRQ_TIMER1));
163 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) |= bit;
164}
165
166static struct irq_chip h7202_timerx_chip = {
167 .irq_ack = mask_timerx_irq,
168 .irq_mask = mask_timerx_irq,
169 .irq_unmask = unmask_timerx_irq,
170};
171
172static struct irqaction h7202_timer_irq = {
173 .name = "h7202 Timer Tick",
174 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
175 .handler = h7202_timer_interrupt,
176};
177
178/*
179 * Setup TIMER0 as system timer
180 */
181void __init h7202_timer_init(void)
182{
183 arch_gettimeoffset = h720x_gettimeoffset;
184
185 CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
186 CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
187 CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
188 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT;
189
190 setup_irq(IRQ_TIMER0, &h7202_timer_irq);
191}
192
193void __init h7202_init_irq (void)
194{
195 int irq;
196
197 CPU_REG (GPIO_E_VIRT, GPIO_MASK) = 0x0;
198
199 for (irq = IRQ_TIMER1;
200 irq < IRQ_CHAINED_TIMERX(NR_TIMERX_IRQS); irq++) {
201 __mask_timerx_irq(irq);
202 irq_set_chip_and_handler(irq, &h7202_timerx_chip,
203 handle_edge_irq);
204 set_irq_flags(irq, IRQF_VALID );
205 }
206 irq_set_chained_handler(IRQ_TIMERX, h7202_timerx_demux_handler);
207
208 h720x_init_irq();
209}
210
211void __init init_hw_h7202(void)
212{
213 /* Enable clocks */
214 CPU_REG (PMU_BASE, PMU_PLL_CTRL) |= PLL_2_EN | PLL_1_EN | PLL_3_MUTE;
215
216 CPU_REG (SERIAL0_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
217 CPU_REG (SERIAL1_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
218#ifdef CONFIG_H7202_SERIAL23
219 CPU_REG (SERIAL2_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
220 CPU_REG (SERIAL3_VIRT, SERIAL_ENABLE) = SERIAL_ENABLE_EN;
221 CPU_IO (GPIO_AMULSEL) = AMULSEL_USIN2 | AMULSEL_USOUT2 |
222 AMULSEL_USIN3 | AMULSEL_USOUT3;
223#endif
224 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
225}
diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c
deleted file mode 100644
index 4fdeb686c0a9..000000000000
--- a/arch/arm/mach-h720x/h7201-eval.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * linux/arch/arm/mach-h720x/h7201-eval.c
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * 2004 Sascha Hauer <s.hauer@pengutronix.de>
7 *
8 * Architecture specific stuff for Hynix GMS30C7201 development board
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
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/types.h>
19#include <linux/string.h>
20#include <linux/device.h>
21
22#include <asm/setup.h>
23#include <asm/types.h>
24#include <asm/mach-types.h>
25#include <asm/page.h>
26#include <asm/mach/arch.h>
27#include <mach/hardware.h>
28#include "common.h"
29
30MACHINE_START(H7201, "Hynix GMS30C7201")
31 /* Maintainer: Robert Schwebel, Pengutronix */
32 .atag_offset = 0x1000,
33 .map_io = h720x_map_io,
34 .init_irq = h720x_init_irq,
35 .init_time = h7201_timer_init,
36 .dma_zone_size = SZ_256M,
37 .restart = h720x_restart,
38MACHINE_END
diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c
deleted file mode 100644
index f68e967a2062..000000000000
--- a/arch/arm/mach-h720x/h7202-eval.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * linux/arch/arm/mach-h720x/h7202-eval.c
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * 2004 Sascha Hauer <s.hauer@pengutronix.de>
7 *
8 * Architecture specific stuff for Hynix HMS30C7202 development board
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
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/types.h>
19#include <linux/string.h>
20#include <linux/platform_device.h>
21
22#include <asm/setup.h>
23#include <asm/types.h>
24#include <asm/mach-types.h>
25#include <asm/page.h>
26#include <asm/mach/arch.h>
27#include <mach/irqs.h>
28#include <mach/hardware.h>
29#include "common.h"
30
31static struct resource cirrus_resources[] = {
32 [0] = {
33 .start = ETH0_PHYS + 0x300,
34 .end = ETH0_PHYS + 0x300 + 0x10,
35 .flags = IORESOURCE_MEM,
36 },
37 [1] = {
38 .start = IRQ_CHAINED_GPIOB(8),
39 .end = IRQ_CHAINED_GPIOB(8),
40 .flags = IORESOURCE_IRQ,
41 },
42};
43
44static struct platform_device cirrus_device = {
45 .name = "cirrus-cs89x0",
46 .id = -1,
47 .num_resources = ARRAY_SIZE(cirrus_resources),
48 .resource = cirrus_resources,
49};
50
51static struct platform_device *devices[] __initdata = {
52 &cirrus_device,
53};
54
55/*
56 * Hardware init. This is called early in initcalls
57 * Place pin inits here. So you avoid adding ugly
58 * #ifdef stuff to common drivers.
59 * Use this only, if your bootloader is not able
60 * to initialize the pins proper.
61 */
62static void __init init_eval_h7202(void)
63{
64 init_hw_h7202();
65 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
66
67 /* Enable interrupt on portb bit 8 (ethernet) */
68 CPU_REG (GPIO_B_VIRT, GPIO_POL) &= ~(1 << 8);
69 CPU_REG (GPIO_B_VIRT, GPIO_EN) |= (1 << 8);
70}
71
72MACHINE_START(H7202, "Hynix HMS30C7202")
73 /* Maintainer: Robert Schwebel, Pengutronix */
74 .atag_offset = 0x100,
75 .map_io = h720x_map_io,
76 .init_irq = h7202_init_irq,
77 .init_time = h7202_timer_init,
78 .init_machine = init_eval_h7202,
79 .dma_zone_size = SZ_256M,
80 .restart = h720x_restart,
81MACHINE_END
diff --git a/arch/arm/mach-h720x/include/mach/boards.h b/arch/arm/mach-h720x/include/mach/boards.h
deleted file mode 100644
index 38b8e0d61fbf..000000000000
--- a/arch/arm/mach-h720x/include/mach/boards.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/boards.h
3 *
4 * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
5 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 *
7 * This file contains the board specific defines for various devices
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_INCMACH_H
15#error Do not include this file directly. Include asm/hardware.h instead !
16#endif
17
18/* Hynix H7202 developer board specific device defines */
19#ifdef CONFIG_ARCH_H7202
20
21/* FLASH */
22#define H720X_FLASH_VIRT 0xd0000000
23#define H720X_FLASH_PHYS 0x00000000
24#define H720X_FLASH_SIZE 0x02000000
25
26/* onboard LAN controller */
27# define ETH0_PHYS 0x08000000
28
29/* Touch screen defines */
30/* GPIO Port */
31#define PEN_GPIO GPIO_B_VIRT
32/* Bitmask for pen down interrupt */
33#define PEN_INT_BIT (1<<7)
34/* Bitmask for pen up interrupt */
35#define PEN_ENA_BIT (1<<6)
36/* pen up interrupt */
37#define IRQ_PEN IRQ_MUX_GPIOB(7)
38
39#endif
40
41/* Hynix H7201 developer board specific device defines */
42#if defined (CONFIG_ARCH_H7201)
43/* ROM DISK SPACE */
44#define ROM_DISK_BASE 0xc1800000
45#define ROM_DISK_START 0x41800000
46#define ROM_DISK_SIZE 0x00700000
47
48/* SRAM DISK SPACE */
49#define SRAM_DISK_BASE 0xf1000000
50#define SRAM_DISK_START 0x04000000
51#define SRAM_DISK_SIZE 0x00400000
52#endif
53
diff --git a/arch/arm/mach-h720x/include/mach/debug-macro.S b/arch/arm/mach-h720x/include/mach/debug-macro.S
deleted file mode 100644
index 8a46157b0582..000000000000
--- a/arch/arm/mach-h720x/include/mach/debug-macro.S
+++ /dev/null
@@ -1,40 +0,0 @@
1/* arch/arm/mach-h720x/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include <mach/hardware.h>
15
16 .equ io_virt, IO_VIRT
17 .equ io_phys, IO_PHYS
18
19 .macro addruart, rp, rv, tmp
20 mov \rp, #0x00020000 @ UART1
21 add \rv, \rp, #io_virt @ virtual address
22 add \rp, \rp, #io_phys @ physical base address
23 .endm
24
25 .macro senduart,rd,rx
26 str \rd, [\rx, #0x0] @ UARTDR
27
28 .endm
29
30 .macro waituart,rd,rx
311001: ldr \rd, [\rx, #0x18] @ UARTFLG
32 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
33 bne 1001b
34 .endm
35
36 .macro busyuart,rd,rx
371001: ldr \rd, [\rx, #0x18] @ UARTFLG
38 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
39 bne 1001b
40 .endm
diff --git a/arch/arm/mach-h720x/include/mach/entry-macro.S b/arch/arm/mach-h720x/include/mach/entry-macro.S
deleted file mode 100644
index 75267fad7012..000000000000
--- a/arch/arm/mach-h720x/include/mach/entry-macro.S
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Hynix HMS720x based platforms
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 .macro get_irqnr_preamble, base, tmp
12 .endm
13
14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
15#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202)
16 @ we could use the id register on H7202, but this is not
17 @ properly updated when we come back from asm_do_irq
18 @ without a previous return from interrupt
19 @ (see loops below in irq_svc, irq_usr)
20 @ We see unmasked pending ints only, as the masked pending ints
21 @ are not visible here
22
23 mov \base, #0xf0000000 @ base register
24 orr \base, \base, #0x24000 @ irqbase
25 ldr \irqstat, [\base, #0x04] @ get interrupt status
26#if defined (CONFIG_CPU_H7201)
27 ldr \tmp, =0x001fffff
28#else
29 mvn \tmp, #0xc0000000
30#endif
31 and \irqstat, \irqstat, \tmp @ mask out unused ints
32 mov \irqnr, #0
33
34 mov \tmp, #0xff00
35 orr \tmp, \tmp, #0xff
36 tst \irqstat, \tmp
37 addeq \irqnr, \irqnr, #16
38 moveq \irqstat, \irqstat, lsr #16
39 tst \irqstat, #255
40 addeq \irqnr, \irqnr, #8
41 moveq \irqstat, \irqstat, lsr #8
42 tst \irqstat, #15
43 addeq \irqnr, \irqnr, #4
44 moveq \irqstat, \irqstat, lsr #4
45 tst \irqstat, #3
46 addeq \irqnr, \irqnr, #2
47 moveq \irqstat, \irqstat, lsr #2
48 tst \irqstat, #1
49 addeq \irqnr, \irqnr, #1
50 moveq \irqstat, \irqstat, lsr #1
51 tst \irqstat, #1 @ bit 0 should be set
52 .endm
53
54#else
55#error hynix processor selection missmatch
56#endif
57
diff --git a/arch/arm/mach-h720x/include/mach/h7201-regs.h b/arch/arm/mach-h720x/include/mach/h7201-regs.h
deleted file mode 100644
index 611b4947ccfc..000000000000
--- a/arch/arm/mach-h720x/include/mach/h7201-regs.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/h7201-regs.h
3 *
4 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
5 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
6 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
7 * (C) 2004 Sascha Hauer <s.hauer@pengutronix.de>
8 *
9 * This file contains the hardware definitions of the h720x processors
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * Do not add implementations specific defines here. This files contains
16 * only defines of the onchip peripherals. Add those defines to boards.h,
17 * which is included by this file.
18 */
19
20#define SERIAL2_VIRT (IO_VIRT + 0x50100)
21#define SERIAL3_VIRT (IO_VIRT + 0x50200)
22
23/*
24 * PCMCIA
25 */
26#define PCMCIA0_ATT_BASE 0xe5000000
27#define PCMCIA0_ATT_SIZE 0x00200000
28#define PCMCIA0_ATT_START 0x20000000
29#define PCMCIA0_MEM_BASE 0xe5200000
30#define PCMCIA0_MEM_SIZE 0x00200000
31#define PCMCIA0_MEM_START 0x24000000
32#define PCMCIA0_IO_BASE 0xe5400000
33#define PCMCIA0_IO_SIZE 0x00200000
34#define PCMCIA0_IO_START 0x28000000
35
36#define PCMCIA1_ATT_BASE 0xe5600000
37#define PCMCIA1_ATT_SIZE 0x00200000
38#define PCMCIA1_ATT_START 0x30000000
39#define PCMCIA1_MEM_BASE 0xe5800000
40#define PCMCIA1_MEM_SIZE 0x00200000
41#define PCMCIA1_MEM_START 0x34000000
42#define PCMCIA1_IO_BASE 0xe5a00000
43#define PCMCIA1_IO_SIZE 0x00200000
44#define PCMCIA1_IO_START 0x38000000
45
46#define PRIME3C_BASE 0xf0050000
47#define PRIME3C_SIZE 0x00001000
48#define PRIME3C_START 0x10000000
49
50/* VGA Controller */
51#define VGA_RAMBASE 0x50
52#define VGA_TIMING0 0x60
53#define VGA_TIMING1 0x64
54#define VGA_TIMING2 0x68
55#define VGA_TIMING3 0x6c
56
57#define LCD_CTRL_VGA_ENABLE 0x00000100
58#define LCD_CTRL_VGA_BPP_MASK 0x00000600
59#define LCD_CTRL_VGA_4BPP 0x00000000
60#define LCD_CTRL_VGA_8BPP 0x00000200
61#define LCD_CTRL_VGA_16BPP 0x00000300
62#define LCD_CTRL_SHARE_DMA 0x00000800
63#define LCD_CTRL_VDE 0x00100000
64#define LCD_CTRL_LPE 0x00400000 /* LCD Power enable */
65#define LCD_CTRL_BLE 0x00800000 /* LCD backlight enable */
66
67#define VGA_PALETTE_BASE (IO_VIRT + 0x10800)
diff --git a/arch/arm/mach-h720x/include/mach/h7202-regs.h b/arch/arm/mach-h720x/include/mach/h7202-regs.h
deleted file mode 100644
index 17c12eb34995..000000000000
--- a/arch/arm/mach-h720x/include/mach/h7202-regs.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/h7202-regs.h
3 *
4 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
5 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
6 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
7 * (C) 2004 Sascha Hauer <s.hauer@pengutronix.de>
8 *
9 * This file contains the hardware definitions of the h720x processors
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * Do not add implementations specific defines here. This files contains
16 * only defines of the onchip peripherals. Add those defines to boards.h,
17 * which is included by this file.
18 */
19
20#define SERIAL2_OFS 0x2d000
21#define SERIAL2_BASE (IO_PHYS + SERIAL2_OFS)
22#define SERIAL2_VIRT (IO_VIRT + SERIAL2_OFS)
23#define SERIAL3_OFS 0x2e000
24#define SERIAL3_BASE (IO_PHYS + SERIAL3_OFS)
25#define SERIAL3_VIRT (IO_VIRT + SERIAL3_OFS)
26
27/* Matrix Keyboard Controller */
28#define KBD_VIRT (IO_VIRT + 0x22000)
29#define KBD_KBCR 0x00
30#define KBD_KBSC 0x04
31#define KBD_KBTR 0x08
32#define KBD_KBVR0 0x0C
33#define KBD_KBVR1 0x10
34#define KBD_KBSR 0x18
35
36#define KBD_KBCR_SCANENABLE (1 << 7)
37#define KBD_KBCR_NPOWERDOWN (1 << 2)
38#define KBD_KBCR_CLKSEL_MASK (3)
39#define KBD_KBCR_CLKSEL_PCLK2 0x0
40#define KBD_KBCR_CLKSEL_PCLK128 0x1
41#define KBD_KBCR_CLKSEL_PCLK256 0x2
42#define KBD_KBCR_CLKSEL_PCLK512 0x3
43
44#define KBD_KBSR_INTR (1 << 0)
45#define KBD_KBSR_WAKEUP (1 << 1)
46
47/* USB device controller */
48
49#define USBD_BASE (IO_VIRT + 0x12000)
50#define USBD_LENGTH 0x3C
51
52#define USBD_GCTRL 0x00
53#define USBD_EPCTRL 0x04
54#define USBD_INTMASK 0x08
55#define USBD_INTSTAT 0x0C
56#define USBD_PWR 0x10
57#define USBD_DMARXTX 0x14
58#define USBD_DEVID 0x18
59#define USBD_DEVCLASS 0x1C
60#define USBD_INTCLASS 0x20
61#define USBD_SETUP0 0x24
62#define USBD_SETUP1 0x28
63#define USBD_ENDP0RD 0x2C
64#define USBD_ENDP0WT 0x30
65#define USBD_ENDP1RD 0x34
66#define USBD_ENDP2WT 0x38
67
68/* PS/2 port */
69#define PSDATA 0x00
70#define PSSTAT 0x04
71#define PSSTAT_TXEMPTY (1<<0)
72#define PSSTAT_TXBUSY (1<<1)
73#define PSSTAT_RXFULL (1<<2)
74#define PSSTAT_RXBUSY (1<<3)
75#define PSSTAT_CLKIN (1<<4)
76#define PSSTAT_DATAIN (1<<5)
77#define PSSTAT_PARITY (1<<6)
78
79#define PSCONF 0x08
80#define PSCONF_ENABLE (1<<0)
81#define PSCONF_TXINTEN (1<<2)
82#define PSCONF_RXINTEN (1<<3)
83#define PSCONF_FORCECLKLOW (1<<4)
84#define PSCONF_FORCEDATLOW (1<<5)
85#define PSCONF_LCE (1<<6)
86
87#define PSINTR 0x0C
88#define PSINTR_TXINT (1<<0)
89#define PSINTR_RXINT (1<<1)
90#define PSINTR_PAR (1<<2)
91#define PSINTR_RXTO (1<<3)
92#define PSINTR_TXTO (1<<4)
93
94#define PSTDLO 0x10 /* clk low before start transmission */
95#define PSTPRI 0x14 /* PRI clock */
96#define PSTXMT 0x18 /* maximum transmission time */
97#define PSTREC 0x20 /* maximum receive time */
98#define PSPWDN 0x3c
99
100/* ADC converter */
101#define ADC_BASE (IO_VIRT + 0x29000)
102#define ADC_CR 0x00
103#define ADC_TSCTRL 0x04
104#define ADC_BT_CTRL 0x08
105#define ADC_MC_CTRL 0x0C
106#define ADC_STATUS 0x10
107
108/* ADC control register bits */
109#define ADC_CR_PW_CTRL 0x80
110#define ADC_CR_DIRECTC 0x04
111#define ADC_CR_CONTIME_NO 0x00
112#define ADC_CR_CONTIME_2 0x04
113#define ADC_CR_CONTIME_4 0x08
114#define ADC_CR_CONTIME_ADE 0x0c
115#define ADC_CR_LONGCALTIME 0x01
116
117/* ADC touch panel register bits */
118#define ADC_TSCTRL_ENABLE 0x80
119#define ADC_TSCTRL_INTR 0x40
120#define ADC_TSCTRL_SWBYPSS 0x20
121#define ADC_TSCTRL_SWINVT 0x10
122#define ADC_TSCTRL_S400 0x03
123#define ADC_TSCTRL_S200 0x02
124#define ADC_TSCTRL_S100 0x01
125#define ADC_TSCTRL_S50 0x00
126
127/* ADC Interrupt Status Register bits */
128#define ADC_STATUS_TS_BIT 0x80
129#define ADC_STATUS_MBT_BIT 0x40
130#define ADC_STATUS_BBT_BIT 0x20
131#define ADC_STATUS_MIC_BIT 0x10
132
133/* Touch data registers */
134#define ADC_TS_X0X1 0x30
135#define ADC_TS_X2X3 0x34
136#define ADC_TS_Y0Y1 0x38
137#define ADC_TS_Y2Y3 0x3c
138#define ADC_TS_X4X5 0x40
139#define ADC_TS_X6X7 0x44
140#define ADC_TS_Y4Y5 0x48
141#define ADC_TS_Y6Y7 0x50
142
143/* battery data */
144#define ADC_MB_DATA 0x54
145#define ADC_BB_DATA 0x58
146
147/* Sound data register */
148#define ADC_SD_DAT0 0x60
149#define ADC_SD_DAT1 0x64
150#define ADC_SD_DAT2 0x68
151#define ADC_SD_DAT3 0x6c
152#define ADC_SD_DAT4 0x70
153#define ADC_SD_DAT5 0x74
154#define ADC_SD_DAT6 0x78
155#define ADC_SD_DAT7 0x7c
diff --git a/arch/arm/mach-h720x/include/mach/hardware.h b/arch/arm/mach-h720x/include/mach/hardware.h
deleted file mode 100644
index c55a52c6541d..000000000000
--- a/arch/arm/mach-h720x/include/mach/hardware.h
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/hardware.h
3 *
4 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
5 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
6 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
7 *
8 * This file contains the hardware definitions of the h720x processors
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 * Do not add implementations specific defines here. This files contains
15 * only defines of the onchip peripherals. Add those defines to boards.h,
16 * which is included by this file.
17 */
18
19#ifndef __ASM_ARCH_HARDWARE_H
20#define __ASM_ARCH_HARDWARE_H
21
22#define IOCLK (3686400L)
23
24/* Onchip peripherals */
25
26#define IO_VIRT 0xf0000000 /* IO peripherals */
27#define IO_PHYS 0x80000000
28#define IO_SIZE 0x00050000
29
30#ifdef CONFIG_CPU_H7202
31#include "h7202-regs.h"
32#elif defined CONFIG_CPU_H7201
33#include "h7201-regs.h"
34#else
35#error machine definition mismatch
36#endif
37
38/* Macro to access the CPU IO */
39#define CPU_IO(x) (*(volatile u32*)(x))
40
41/* Macro to access general purpose regs (base, offset) */
42#define CPU_REG(x,y) CPU_IO(x+y)
43
44/* Macro to access irq related regs */
45#define IRQ_REG(x) CPU_REG(IRQC_VIRT,x)
46
47/* CPU registers */
48/* general purpose I/O */
49#define GPIO_VIRT(x) (IO_VIRT + 0x23000 + ((x)<<5))
50#define GPIO_A_VIRT (GPIO_VIRT(0))
51#define GPIO_B_VIRT (GPIO_VIRT(1))
52#define GPIO_C_VIRT (GPIO_VIRT(2))
53#define GPIO_D_VIRT (GPIO_VIRT(3))
54#define GPIO_E_VIRT (GPIO_VIRT(4))
55#define GPIO_AMULSEL (GPIO_VIRT(0) + 0xA4)
56
57#define AMULSEL_USIN2 (1<<5)
58#define AMULSEL_USOUT2 (1<<6)
59#define AMULSEL_USIN3 (1<<13)
60#define AMULSEL_USOUT3 (1<<14)
61#define AMULSEL_IRDIN (1<<15)
62#define AMULSEL_IRDOUT (1<<7)
63
64/* Register offsets general purpose I/O */
65#define GPIO_DATA 0x00
66#define GPIO_DIR 0x04
67#define GPIO_MASK 0x08
68#define GPIO_STAT 0x0C
69#define GPIO_EDGE 0x10
70#define GPIO_CLR 0x14
71#define GPIO_POL 0x18
72#define GPIO_EN 0x1C
73
74/*interrupt controller */
75#define IRQC_VIRT (IO_VIRT + 0x24000)
76/* register offset interrupt controller */
77#define IRQC_IER 0x00
78#define IRQC_ISR 0x04
79
80/* timer unit */
81#define TIMER_VIRT (IO_VIRT + 0x25000)
82/* Register offsets timer unit */
83#define TM0_PERIOD 0x00
84#define TM0_COUNT 0x08
85#define TM0_CTRL 0x10
86#define TM1_PERIOD 0x20
87#define TM1_COUNT 0x28
88#define TM1_CTRL 0x30
89#define TM2_PERIOD 0x40
90#define TM2_COUNT 0x48
91#define TM2_CTRL 0x50
92#define TIMER_TOPCTRL 0x60
93#define TIMER_TOPSTAT 0x64
94#define T64_COUNTL 0x80
95#define T64_COUNTH 0x84
96#define T64_CTRL 0x88
97#define T64_BASEL 0x94
98#define T64_BASEH 0x98
99/* Bitmaks timer unit TOPSTAT reg */
100#define TSTAT_T0INT 0x1
101#define TSTAT_T1INT 0x2
102#define TSTAT_T2INT 0x4
103#define TSTAT_T3INT 0x8
104/* Bit description of TMx_CTRL register */
105#define TM_START 0x1
106#define TM_REPEAT 0x2
107#define TM_RESET 0x4
108/* Bit description of TIMER_CTRL register */
109#define ENABLE_TM0_INTR 0x1
110#define ENABLE_TM1_INTR 0x2
111#define ENABLE_TM2_INTR 0x4
112#define TIMER_ENABLE_BIT 0x8
113#define ENABLE_TIMER64 0x10
114#define ENABLE_TIMER64_INT 0x20
115
116/* PMU & PLL */
117#define PMU_BASE (IO_VIRT + 0x1000)
118#define PMU_MODE 0x00
119#define PMU_STAT 0x20
120#define PMU_PLL_CTRL 0x28
121
122/* PMU Mode bits */
123#define PMU_MODE_SLOW 0x00
124#define PMU_MODE_RUN 0x01
125#define PMU_MODE_IDLE 0x02
126#define PMU_MODE_SLEEP 0x03
127#define PMU_MODE_INIT 0x04
128#define PMU_MODE_DEEPSLEEP 0x07
129#define PMU_MODE_WAKEUP 0x08
130
131/* PMU ... */
132#define PLL_2_EN 0x8000
133#define PLL_1_EN 0x4000
134#define PLL_3_MUTE 0x0080
135
136/* Control bits for PMU/ PLL */
137#define PMU_WARMRESET 0x00010000
138#define PLL_CTRL_MASK23 0x000080ff
139
140/* LCD Controller */
141#define LCD_BASE (IO_VIRT + 0x10000)
142#define LCD_CTRL 0x00
143#define LCD_STATUS 0x04
144#define LCD_STATUS_M 0x08
145#define LCD_INTERRUPT 0x0C
146#define LCD_DBAR 0x10
147#define LCD_DCAR 0x14
148#define LCD_TIMING0 0x20
149#define LCD_TIMING1 0x24
150#define LCD_TIMING2 0x28
151#define LCD_TEST 0x40
152
153/* LCD Control Bits */
154#define LCD_CTRL_LCD_ENABLE 0x00000001
155/* Bits per pixel */
156#define LCD_CTRL_LCD_BPP_MASK 0x00000006
157#define LCD_CTRL_LCD_4BPP 0x00000000
158#define LCD_CTRL_LCD_8BPP 0x00000002
159#define LCD_CTRL_LCD_16BPP 0x00000004
160#define LCD_CTRL_LCD_BW 0x00000008
161#define LCD_CTRL_LCD_TFT 0x00000010
162#define LCD_CTRL_BGR 0x00001000
163#define LCD_CTRL_LCD_VCOMP 0x00080000
164#define LCD_CTRL_LCD_MONO8 0x00200000
165#define LCD_CTRL_LCD_PWR 0x00400000
166#define LCD_CTRL_LCD_BLE 0x00800000
167#define LCD_CTRL_LDBUSEN 0x01000000
168
169/* Palette */
170#define LCD_PALETTE_BASE (IO_VIRT + 0x10400)
171
172/* Serial ports */
173#define SERIAL0_OFS 0x20000
174#define SERIAL0_VIRT (IO_VIRT + SERIAL0_OFS)
175#define SERIAL0_BASE (IO_PHYS + SERIAL0_OFS)
176
177#define SERIAL1_OFS 0x21000
178#define SERIAL1_VIRT (IO_VIRT + SERIAL1_OFS)
179#define SERIAL1_BASE (IO_PHYS + SERIAL1_OFS)
180
181#define SERIAL_ENABLE 0x30
182#define SERIAL_ENABLE_EN (1<<0)
183
184/* General defines to pacify gcc */
185
186#define __ASM_ARCH_HARDWARE_INCMACH_H
187#include "boards.h"
188#undef __ASM_ARCH_HARDWARE_INCMACH_H
189
190#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-h720x/include/mach/irqs.h b/arch/arm/mach-h720x/include/mach/irqs.h
deleted file mode 100644
index 430a92b492f1..000000000000
--- a/arch/arm/mach-h720x/include/mach/irqs.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/irqs.h
3 *
4 * Copyright (C) 2000 Jungjun Kim
5 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
7 *
8 */
9
10#ifndef __ASM_ARCH_IRQS_H
11#define __ASM_ARCH_IRQS_H
12
13#if defined (CONFIG_CPU_H7201)
14
15#define IRQ_PMU 0 /* 0x000001 */
16#define IRQ_DMA 1 /* 0x000002 */
17#define IRQ_LCD 2 /* 0x000004 */
18#define IRQ_VGA 3 /* 0x000008 */
19#define IRQ_PCMCIA1 4 /* 0x000010 */
20#define IRQ_PCMCIA2 5 /* 0x000020 */
21#define IRQ_AFE 6 /* 0x000040 */
22#define IRQ_AIC 7 /* 0x000080 */
23#define IRQ_KEYBOARD 8 /* 0x000100 */
24#define IRQ_TIMER0 9 /* 0x000200 */
25#define IRQ_RTC 10 /* 0x000400 */
26#define IRQ_SOUND 11 /* 0x000800 */
27#define IRQ_USB 12 /* 0x001000 */
28#define IRQ_IrDA 13 /* 0x002000 */
29#define IRQ_UART0 14 /* 0x004000 */
30#define IRQ_UART1 15 /* 0x008000 */
31#define IRQ_SPI 16 /* 0x010000 */
32#define IRQ_GPIOA 17 /* 0x020000 */
33#define IRQ_GPIOB 18 /* 0x040000 */
34#define IRQ_GPIOC 19 /* 0x080000 */
35#define IRQ_GPIOD 20 /* 0x100000 */
36#define IRQ_CommRX 21 /* 0x200000 */
37#define IRQ_CommTX 22 /* 0x400000 */
38#define IRQ_Soft 23 /* 0x800000 */
39
40#define NR_GLBL_IRQS 24
41
42#define IRQ_CHAINED_GPIOA(x) (NR_GLBL_IRQS + x)
43#define IRQ_CHAINED_GPIOB(x) (IRQ_CHAINED_GPIOA(32) + x)
44#define IRQ_CHAINED_GPIOC(x) (IRQ_CHAINED_GPIOB(32) + x)
45#define IRQ_CHAINED_GPIOD(x) (IRQ_CHAINED_GPIOC(32) + x)
46#define NR_IRQS IRQ_CHAINED_GPIOD(32)
47
48/* Enable mask for multiplexed interrupts */
49#define IRQ_ENA_MUX (1<<IRQ_GPIOA) | (1<<IRQ_GPIOB) \
50 | (1<<IRQ_GPIOC) | (1<<IRQ_GPIOD)
51
52
53#elif defined (CONFIG_CPU_H7202)
54
55#define IRQ_PMU 0 /* 0x00000001 */
56#define IRQ_DMA 1 /* 0x00000002 */
57#define IRQ_LCD 2 /* 0x00000004 */
58#define IRQ_SOUND 3 /* 0x00000008 */
59#define IRQ_I2S 4 /* 0x00000010 */
60#define IRQ_USB 5 /* 0x00000020 */
61#define IRQ_MMC 6 /* 0x00000040 */
62#define IRQ_RTC 7 /* 0x00000080 */
63#define IRQ_UART0 8 /* 0x00000100 */
64#define IRQ_UART1 9 /* 0x00000200 */
65#define IRQ_UART2 10 /* 0x00000400 */
66#define IRQ_UART3 11 /* 0x00000800 */
67#define IRQ_KBD 12 /* 0x00001000 */
68#define IRQ_PS2 13 /* 0x00002000 */
69#define IRQ_AIC 14 /* 0x00004000 */
70#define IRQ_TIMER0 15 /* 0x00008000 */
71#define IRQ_TIMERX 16 /* 0x00010000 */
72#define IRQ_WDT 17 /* 0x00020000 */
73#define IRQ_CAN0 18 /* 0x00040000 */
74#define IRQ_CAN1 19 /* 0x00080000 */
75#define IRQ_EXT0 20 /* 0x00100000 */
76#define IRQ_EXT1 21 /* 0x00200000 */
77#define IRQ_GPIOA 22 /* 0x00400000 */
78#define IRQ_GPIOB 23 /* 0x00800000 */
79#define IRQ_GPIOC 24 /* 0x01000000 */
80#define IRQ_GPIOD 25 /* 0x02000000 */
81#define IRQ_GPIOE 26 /* 0x04000000 */
82#define IRQ_COMMRX 27 /* 0x08000000 */
83#define IRQ_COMMTX 28 /* 0x10000000 */
84#define IRQ_SMC 29 /* 0x20000000 */
85#define IRQ_Soft 30 /* 0x40000000 */
86#define IRQ_RESERVED1 31 /* 0x80000000 */
87#define NR_GLBL_IRQS 32
88
89#define NR_TIMERX_IRQS 3
90
91#define IRQ_CHAINED_GPIOA(x) (NR_GLBL_IRQS + x)
92#define IRQ_CHAINED_GPIOB(x) (IRQ_CHAINED_GPIOA(32) + x)
93#define IRQ_CHAINED_GPIOC(x) (IRQ_CHAINED_GPIOB(32) + x)
94#define IRQ_CHAINED_GPIOD(x) (IRQ_CHAINED_GPIOC(32) + x)
95#define IRQ_CHAINED_GPIOE(x) (IRQ_CHAINED_GPIOD(32) + x)
96#define IRQ_CHAINED_TIMERX(x) (IRQ_CHAINED_GPIOE(32) + x)
97#define IRQ_TIMER1 (IRQ_CHAINED_TIMERX(0))
98#define IRQ_TIMER2 (IRQ_CHAINED_TIMERX(1))
99#define IRQ_TIMER64B (IRQ_CHAINED_TIMERX(2))
100
101#define NR_IRQS (IRQ_CHAINED_TIMERX(NR_TIMERX_IRQS))
102
103/* Enable mask for multiplexed interrupts */
104#define IRQ_ENA_MUX (1<<IRQ_TIMERX) | (1<<IRQ_GPIOA) | (1<<IRQ_GPIOB) | \
105 (1<<IRQ_GPIOC) | (1<<IRQ_GPIOD) | (1<<IRQ_GPIOE) | \
106 (1<<IRQ_TIMERX)
107
108#else
109#error cpu definition mismatch
110#endif
111
112/* decode irq number to register number */
113#define IRQ_TO_REGNO(irq) ((irq - NR_GLBL_IRQS) >> 5)
114#define IRQ_TO_BIT(irq) (1 << ((irq - NR_GLBL_IRQS) % 32))
115
116#endif
diff --git a/arch/arm/mach-h720x/include/mach/isa-dma.h b/arch/arm/mach-h720x/include/mach/isa-dma.h
deleted file mode 100644
index 3eafb3f163c0..000000000000
--- a/arch/arm/mach-h720x/include/mach/isa-dma.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/isa-dma.h
3 *
4 * Architecture DMA routes
5 *
6 * Copyright (C) 1997.1998 Russell King
7 */
8#ifndef __ASM_ARCH_DMA_H
9#define __ASM_ARCH_DMA_H
10
11#if defined (CONFIG_CPU_H7201)
12#define MAX_DMA_CHANNELS 3
13#elif defined (CONFIG_CPU_H7202)
14#define MAX_DMA_CHANNELS 4
15#else
16#error processor definition missmatch
17#endif
18
19#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-h720x/include/mach/uncompress.h b/arch/arm/mach-h720x/include/mach/uncompress.h
deleted file mode 100644
index 43e343c4b50a..000000000000
--- a/arch/arm/mach-h720x/include/mach/uncompress.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/uncompress.h
3 *
4 * Copyright (C) 2001-2002 Jungjun Kim
5 */
6
7#ifndef __ASM_ARCH_UNCOMPRESS_H
8#define __ASM_ARCH_UNCOMPRESS_H
9
10#include <mach/hardware.h>
11
12#define LSR 0x14
13#define TEMPTY 0x40
14
15static inline void putc(int c)
16{
17 volatile unsigned char *p = (volatile unsigned char *)(IO_PHYS+0x20000);
18
19 /* wait until transmit buffer is empty */
20 while((p[LSR] & TEMPTY) == 0x0)
21 barrier();
22
23 /* write next character */
24 *p = c;
25}
26
27static inline void flush(void)
28{
29}
30
31/*
32 * nothing to do
33 */
34#define arch_decomp_setup()
35
36#endif
diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index 44b12f9c1584..cd9fcb1cd7ab 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -12,6 +12,7 @@ config ARCH_HIGHBANK
12 select CPU_V7 12 select CPU_V7
13 select GENERIC_CLOCKEVENTS 13 select GENERIC_CLOCKEVENTS
14 select HAVE_ARM_SCU 14 select HAVE_ARM_SCU
15 select HAVE_ARM_TWD if LOCAL_TIMERS
15 select HAVE_SMP 16 select HAVE_SMP
16 select MAILBOX 17 select MAILBOX
17 select PL320_MBOX 18 select PL320_MBOX
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index a4f9f50247d4..76c1170b3528 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -32,7 +32,6 @@
32#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
33#include <asm/cputype.h> 33#include <asm/cputype.h>
34#include <asm/smp_plat.h> 34#include <asm/smp_plat.h>
35#include <asm/smp_twd.h>
36#include <asm/hardware/arm_timer.h> 35#include <asm/hardware/arm_timer.h>
37#include <asm/hardware/timer-sp.h> 36#include <asm/hardware/timer-sp.h>
38#include <asm/hardware/cache-l2x0.h> 37#include <asm/hardware/cache-l2x0.h>
@@ -119,10 +118,10 @@ static void __init highbank_timer_init(void)
119 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1"); 118 sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1");
120 sp804_clockevents_init(timer_base, irq, "timer0"); 119 sp804_clockevents_init(timer_base, irq, "timer0");
121 120
122 twd_local_timer_of_register();
123
124 arch_timer_of_register(); 121 arch_timer_of_register();
125 arch_timer_sched_clock_init(); 122 arch_timer_sched_clock_init();
123
124 clocksource_of_init();
126} 125}
127 126
128static void highbank_power_off(void) 127static void highbank_power_off(void)
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index 890cae23c12a..a019e4e86e51 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -14,7 +14,6 @@
14 * this program. If not, see <http://www.gnu.org/licenses/>. 14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17
18#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
19 18
20#include "core.h" 19#include "core.h"
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index 8797a7001720..a984573e0d02 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -17,7 +17,6 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/irqchip/arm-gic.h>
21 20
22#include <asm/smp_scu.h> 21#include <asm/smp_scu.h>
23 22
@@ -25,11 +24,6 @@
25 24
26extern void secondary_startup(void); 25extern void secondary_startup(void);
27 26
28static void __cpuinit highbank_secondary_init(unsigned int cpu)
29{
30 gic_secondary_init(0);
31}
32
33static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle) 27static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
34{ 28{
35 highbank_set_cpu_jump(cpu, secondary_startup); 29 highbank_set_cpu_jump(cpu, secondary_startup);
@@ -67,7 +61,6 @@ static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
67struct smp_operations highbank_smp_ops __initdata = { 61struct smp_operations highbank_smp_ops __initdata = {
68 .smp_init_cpus = highbank_smp_init_cpus, 62 .smp_init_cpus = highbank_smp_init_cpus,
69 .smp_prepare_cpus = highbank_smp_prepare_cpus, 63 .smp_prepare_cpus = highbank_smp_prepare_cpus,
70 .smp_secondary_init = highbank_secondary_init,
71 .smp_boot_secondary = highbank_boot_secondary, 64 .smp_boot_secondary = highbank_boot_secondary,
72#ifdef CONFIG_HOTPLUG_CPU 65#ifdef CONFIG_HOTPLUG_CPU
73 .cpu_die = highbank_cpu_die, 66 .cpu_die = highbank_cpu_die,
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 4c9c6f9d2c55..2ebc97e16b91 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -83,24 +83,12 @@ config ARCH_MXC_IOMUX_V3
83config ARCH_MX1 83config ARCH_MX1
84 bool 84 bool
85 85
86config MACH_MX21
87 bool
88
89config ARCH_MX25 86config ARCH_MX25
90 bool 87 bool
91 88
92config MACH_MX27 89config MACH_MX27
93 bool 90 bool
94 91
95config ARCH_MX5
96 bool
97
98config ARCH_MX51
99 bool
100
101config ARCH_MX53
102 bool
103
104config SOC_IMX1 92config SOC_IMX1
105 bool 93 bool
106 select ARCH_MX1 94 select ARCH_MX1
@@ -114,7 +102,6 @@ config SOC_IMX21
114 select COMMON_CLK 102 select COMMON_CLK
115 select CPU_ARM926T 103 select CPU_ARM926T
116 select IMX_HAVE_IOMUX_V1 104 select IMX_HAVE_IOMUX_V1
117 select MACH_MX21
118 select MXC_AVIC 105 select MXC_AVIC
119 106
120config SOC_IMX25 107config SOC_IMX25
@@ -155,7 +142,6 @@ config SOC_IMX35
155config SOC_IMX5 142config SOC_IMX5
156 bool 143 bool
157 select ARCH_HAS_CPUFREQ 144 select ARCH_HAS_CPUFREQ
158 select ARCH_MX5
159 select ARCH_MXC_IOMUX_V3 145 select ARCH_MXC_IOMUX_V3
160 select COMMON_CLK 146 select COMMON_CLK
161 select CPU_V7 147 select CPU_V7
@@ -163,8 +149,7 @@ config SOC_IMX5
163 149
164config SOC_IMX51 150config SOC_IMX51
165 bool 151 bool
166 select ARCH_MX5 152 select HAVE_IMX_SRC
167 select ARCH_MX51
168 select PINCTRL 153 select PINCTRL
169 select PINCTRL_IMX51 154 select PINCTRL_IMX51
170 select SOC_IMX5 155 select SOC_IMX5
@@ -481,8 +466,6 @@ config MACH_MX31ADS_WM1133_EV1
481 depends on MACH_MX31ADS 466 depends on MACH_MX31ADS
482 depends on MFD_WM8350_I2C 467 depends on MFD_WM8350_I2C
483 depends on REGULATOR_WM8350 = y 468 depends on REGULATOR_WM8350 = y
484 select MFD_WM8350_CONFIG_MODE_0
485 select MFD_WM8352_CONFIG_MODE_0
486 help 469 help
487 Include support for the Wolfson Microelectronics 1133-EV1 PMU 470 Include support for the Wolfson Microelectronics 1133-EV1 PMU
488 and audio module for the MX31ADS platform. 471 and audio module for the MX31ADS platform.
@@ -789,9 +772,8 @@ comment "Device tree only"
789 772
790config SOC_IMX53 773config SOC_IMX53
791 bool "i.MX53 support" 774 bool "i.MX53 support"
792 select ARCH_MX5
793 select ARCH_MX53
794 select HAVE_CAN_FLEXCAN if CAN 775 select HAVE_CAN_FLEXCAN if CAN
776 select HAVE_IMX_SRC
795 select IMX_HAVE_PLATFORM_IMX2_WDT 777 select IMX_HAVE_PLATFORM_IMX2_WDT
796 select PINCTRL 778 select PINCTRL
797 select PINCTRL_IMX53 779 select PINCTRL_IMX53
@@ -811,7 +793,8 @@ config SOC_IMX6Q
811 select ARM_GIC 793 select ARM_GIC
812 select COMMON_CLK 794 select COMMON_CLK
813 select CPU_V7 795 select CPU_V7
814 select HAVE_ARM_SCU 796 select HAVE_ARM_SCU if SMP
797 select HAVE_ARM_TWD if LOCAL_TIMERS
815 select HAVE_CAN_FLEXCAN if CAN 798 select HAVE_CAN_FLEXCAN if CAN
816 select HAVE_IMX_GPC 799 select HAVE_IMX_GPC
817 select HAVE_IMX_MMDC 800 select HAVE_IMX_MMDC
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index c4ce0906d76a..fbe60a145344 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o clk-imx31.o iomux-imx31.o ehci-
12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o 12obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o clk-imx35.o ehci-imx35.o pm-imx3.o
13 13
14imx5-pm-$(CONFIG_PM) += pm-imx5.o 14imx5-pm-$(CONFIG_PM) += pm-imx5.o
15obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(imx5-pm-y) cpu_op-mx51.o 15obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o mm-imx5.o clk-imx51-imx53.o ehci-imx5.o $(imx5-pm-y)
16 16
17obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \ 17obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-gate2.o \
18 clk-pfd.o clk-busy.o clk.o 18 clk-pfd.o clk-busy.o clk.o
@@ -27,10 +27,9 @@ obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
27obj-$(CONFIG_MXC_ULPI) += ulpi.o 27obj-$(CONFIG_MXC_ULPI) += ulpi.o
28obj-$(CONFIG_MXC_USE_EPIT) += epit.o 28obj-$(CONFIG_MXC_USE_EPIT) += epit.o
29obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 29obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
30obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
31 30
32ifeq ($(CONFIG_CPU_IDLE),y) 31ifeq ($(CONFIG_CPU_IDLE),y)
33obj-y += cpuidle.o 32obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
34obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o 33obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
35endif 34endif
36 35
diff --git a/arch/arm/mach-imx/Makefile.boot b/arch/arm/mach-imx/Makefile.boot
deleted file mode 100644
index 41ba1bb0437b..000000000000
--- a/arch/arm/mach-imx/Makefile.boot
+++ /dev/null
@@ -1,35 +0,0 @@
1zreladdr-$(CONFIG_SOC_IMX1) += 0x08008000
2params_phys-$(CONFIG_SOC_IMX1) := 0x08000100
3initrd_phys-$(CONFIG_SOC_IMX1) := 0x08800000
4
5zreladdr-$(CONFIG_SOC_IMX21) += 0xC0008000
6params_phys-$(CONFIG_SOC_IMX21) := 0xC0000100
7initrd_phys-$(CONFIG_SOC_IMX21) := 0xC0800000
8
9zreladdr-$(CONFIG_SOC_IMX25) += 0x80008000
10params_phys-$(CONFIG_SOC_IMX25) := 0x80000100
11initrd_phys-$(CONFIG_SOC_IMX25) := 0x80800000
12
13zreladdr-$(CONFIG_SOC_IMX27) += 0xA0008000
14params_phys-$(CONFIG_SOC_IMX27) := 0xA0000100
15initrd_phys-$(CONFIG_SOC_IMX27) := 0xA0800000
16
17zreladdr-$(CONFIG_SOC_IMX31) += 0x80008000
18params_phys-$(CONFIG_SOC_IMX31) := 0x80000100
19initrd_phys-$(CONFIG_SOC_IMX31) := 0x80800000
20
21zreladdr-$(CONFIG_SOC_IMX35) += 0x80008000
22params_phys-$(CONFIG_SOC_IMX35) := 0x80000100
23initrd_phys-$(CONFIG_SOC_IMX35) := 0x80800000
24
25zreladdr-$(CONFIG_SOC_IMX51) += 0x90008000
26params_phys-$(CONFIG_SOC_IMX51) := 0x90000100
27initrd_phys-$(CONFIG_SOC_IMX51) := 0x90800000
28
29zreladdr-$(CONFIG_SOC_IMX53) += 0x70008000
30params_phys-$(CONFIG_SOC_IMX53) := 0x70000100
31initrd_phys-$(CONFIG_SOC_IMX53) := 0x70800000
32
33zreladdr-$(CONFIG_SOC_IMX6Q) += 0x10008000
34params_phys-$(CONFIG_SOC_IMX6Q) := 0x10000100
35initrd_phys-$(CONFIG_SOC_IMX6Q) := 0x10800000
diff --git a/arch/arm/mach-imx/avic.c b/arch/arm/mach-imx/avic.c
index 0eff23ed92b9..e163ec7a8441 100644
--- a/arch/arm/mach-imx/avic.c
+++ b/arch/arm/mach-imx/avic.c
@@ -51,11 +51,9 @@
51 51
52#define AVIC_NUM_IRQS 64 52#define AVIC_NUM_IRQS 64
53 53
54void __iomem *avic_base; 54static void __iomem *avic_base;
55static struct irq_domain *domain; 55static struct irq_domain *domain;
56 56
57static u32 avic_saved_mask_reg[2];
58
59#ifdef CONFIG_MXC_IRQ_PRIOR 57#ifdef CONFIG_MXC_IRQ_PRIOR
60static int avic_irq_set_priority(unsigned char irq, unsigned char prio) 58static int avic_irq_set_priority(unsigned char irq, unsigned char prio)
61{ 59{
@@ -113,6 +111,8 @@ static struct mxc_extra_irq avic_extra_irq = {
113}; 111};
114 112
115#ifdef CONFIG_PM 113#ifdef CONFIG_PM
114static u32 avic_saved_mask_reg[2];
115
116static void avic_irq_suspend(struct irq_data *d) 116static void avic_irq_suspend(struct irq_data *d)
117{ 117{
118 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 118 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
diff --git a/arch/arm/mach-imx/clk-busy.c b/arch/arm/mach-imx/clk-busy.c
index 1ab91b5209e6..4bb1bc419b79 100644
--- a/arch/arm/mach-imx/clk-busy.c
+++ b/arch/arm/mach-imx/clk-busy.c
@@ -147,7 +147,7 @@ static int clk_busy_mux_set_parent(struct clk_hw *hw, u8 index)
147 return ret; 147 return ret;
148} 148}
149 149
150struct clk_ops clk_busy_mux_ops = { 150static struct clk_ops clk_busy_mux_ops = {
151 .get_parent = clk_busy_mux_get_parent, 151 .get_parent = clk_busy_mux_get_parent,
152 .set_parent = clk_busy_mux_set_parent, 152 .set_parent = clk_busy_mux_set_parent,
153}; 153};
@@ -169,7 +169,7 @@ struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
169 169
170 busy->mux.reg = reg; 170 busy->mux.reg = reg;
171 busy->mux.shift = shift; 171 busy->mux.shift = shift;
172 busy->mux.width = width; 172 busy->mux.mask = BIT(width) - 1;
173 busy->mux.lock = &imx_ccm_lock; 173 busy->mux.lock = &imx_ccm_lock;
174 busy->mux_ops = &clk_mux_ops; 174 busy->mux_ops = &clk_mux_ops;
175 175
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index cc49c7ae186e..a63e415609a8 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include "clk.h"
18 19
19/** 20/**
20 * DOC: basic gatable clock which can gate and ungate it's ouput 21 * DOC: basic gatable clock which can gate and ungate it's ouput
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 30b3242a7d49..c3cfa4116dc0 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -86,10 +86,12 @@ enum mx27_clks {
86}; 86};
87 87
88static struct clk *clk[clk_max]; 88static struct clk *clk[clk_max];
89static struct clk_onecell_data clk_data;
89 90
90int __init mx27_clocks_init(unsigned long fref) 91int __init mx27_clocks_init(unsigned long fref)
91{ 92{
92 int i; 93 int i;
94 struct device_node *np;
93 95
94 clk[dummy] = imx_clk_fixed("dummy", 0); 96 clk[dummy] = imx_clk_fixed("dummy", 0);
95 clk[ckih] = imx_clk_fixed("ckih", fref); 97 clk[ckih] = imx_clk_fixed("ckih", fref);
@@ -198,6 +200,13 @@ int __init mx27_clocks_init(unsigned long fref)
198 pr_err("i.MX27 clk %d: register failed with %ld\n", 200 pr_err("i.MX27 clk %d: register failed with %ld\n",
199 i, PTR_ERR(clk[i])); 201 i, PTR_ERR(clk[i]));
200 202
203 np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm");
204 if (np) {
205 clk_data.clks = clk;
206 clk_data.clk_num = ARRAY_SIZE(clk);
207 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
208 }
209
201 clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0"); 210 clk_register_clkdev(clk[uart1_ipg_gate], "ipg", "imx21-uart.0");
202 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.0"); 211 clk_register_clkdev(clk[per1_gate], "per", "imx21-uart.0");
203 clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1"); 212 clk_register_clkdev(clk[uart2_ipg_gate], "ipg", "imx21-uart.1");
@@ -276,10 +285,8 @@ int __init mx27_clocks_init(unsigned long fref)
276 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL); 285 clk_register_clkdev(clk[ata_ahb_gate], "ata", NULL);
277 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc"); 286 clk_register_clkdev(clk[rtc_ipg_gate], NULL, "imx21-rtc");
278 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL); 287 clk_register_clkdev(clk[scc_ipg_gate], "scc", NULL);
279 clk_register_clkdev(clk[cpu_div], "cpu", NULL); 288 clk_register_clkdev(clk[cpu_div], NULL, "cpufreq-cpu0.0");
280 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL); 289 clk_register_clkdev(clk[emi_ahb_gate], "emi_ahb" , NULL);
281 clk_register_clkdev(clk[ssi1_baud_gate], "bitrate" , "imx-ssi.0");
282 clk_register_clkdev(clk[ssi2_baud_gate], "bitrate" , "imx-ssi.1");
283 290
284 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1); 291 mxc_timer_init(MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR), MX27_INT_GPT1);
285 292
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 0f39f8c93b94..2bc623b414c1 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -281,7 +281,7 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
281 clk_register_clkdev(clk[ssi_ext1_gate], "ssi_ext1", NULL); 281 clk_register_clkdev(clk[ssi_ext1_gate], "ssi_ext1", NULL);
282 clk_register_clkdev(clk[ssi_ext2_gate], "ssi_ext2", NULL); 282 clk_register_clkdev(clk[ssi_ext2_gate], "ssi_ext2", NULL);
283 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); 283 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
284 clk_register_clkdev(clk[cpu_podf], "cpu", NULL); 284 clk_register_clkdev(clk[cpu_podf], NULL, "cpufreq-cpu0.0");
285 clk_register_clkdev(clk[iim_gate], "iim", NULL); 285 clk_register_clkdev(clk[iim_gate], "iim", NULL);
286 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0"); 286 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0");
287 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1"); 287 clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1");
@@ -362,9 +362,6 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
362 clk_register_clkdev(clk[mx51_mipi], "mipi_hsp", NULL); 362 clk_register_clkdev(clk[mx51_mipi], "mipi_hsp", NULL);
363 clk_register_clkdev(clk[vpu_gate], NULL, "imx51-vpu.0"); 363 clk_register_clkdev(clk[vpu_gate], NULL, "imx51-vpu.0");
364 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0"); 364 clk_register_clkdev(clk[fec_gate], NULL, "imx27-fec.0");
365 clk_register_clkdev(clk[ipu_gate], "bus", "40000000.ipu");
366 clk_register_clkdev(clk[ipu_di0_gate], "di0", "40000000.ipu");
367 clk_register_clkdev(clk[ipu_di1_gate], "di1", "40000000.ipu");
368 clk_register_clkdev(clk[usb_phy_gate], "phy", "mxc-ehci.0"); 365 clk_register_clkdev(clk[usb_phy_gate], "phy", "mxc-ehci.0");
369 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx51.0"); 366 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx51.0");
370 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.0"); 367 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx51.0");
@@ -471,10 +468,6 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
471 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0"); 468 clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
472 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2"); 469 clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
473 clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0"); 470 clk_register_clkdev(clk[fec_gate], NULL, "imx25-fec.0");
474 clk_register_clkdev(clk[ipu_gate], "bus", "18000000.ipu");
475 clk_register_clkdev(clk[ipu_di0_gate], "di0", "18000000.ipu");
476 clk_register_clkdev(clk[ipu_di1_gate], "di1", "18000000.ipu");
477 clk_register_clkdev(clk[ipu_gate], "hsp", "18000000.ipu");
478 clk_register_clkdev(clk[usb_phy1_gate], "usb_phy1", "mxc-ehci.0"); 471 clk_register_clkdev(clk[usb_phy1_gate], "usb_phy1", "mxc-ehci.0");
479 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx53.0"); 472 clk_register_clkdev(clk[esdhc1_ipg_gate], "ipg", "sdhci-esdhc-imx53.0");
480 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.0"); 473 clk_register_clkdev(clk[dummy], "ahb", "sdhci-esdhc-imx53.0");
diff --git a/arch/arm/mach-imx/clk-pllv1.c b/arch/arm/mach-imx/clk-pllv1.c
index abff350ba24c..c1eaee346954 100644
--- a/arch/arm/mach-imx/clk-pllv1.c
+++ b/arch/arm/mach-imx/clk-pllv1.c
@@ -78,7 +78,7 @@ static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw,
78 return ll; 78 return ll;
79} 79}
80 80
81struct clk_ops clk_pllv1_ops = { 81static struct clk_ops clk_pllv1_ops = {
82 .recalc_rate = clk_pllv1_recalc_rate, 82 .recalc_rate = clk_pllv1_recalc_rate,
83}; 83};
84 84
diff --git a/arch/arm/mach-imx/clk-pllv2.c b/arch/arm/mach-imx/clk-pllv2.c
index 0440379e3628..20889d59b44d 100644
--- a/arch/arm/mach-imx/clk-pllv2.c
+++ b/arch/arm/mach-imx/clk-pllv2.c
@@ -229,7 +229,7 @@ static void clk_pllv2_unprepare(struct clk_hw *hw)
229 __raw_writel(reg, pllbase + MXC_PLL_DP_CTL); 229 __raw_writel(reg, pllbase + MXC_PLL_DP_CTL);
230} 230}
231 231
232struct clk_ops clk_pllv2_ops = { 232static struct clk_ops clk_pllv2_ops = {
233 .prepare = clk_pllv2_prepare, 233 .prepare = clk_pllv2_prepare,
234 .unprepare = clk_pllv2_unprepare, 234 .unprepare = clk_pllv2_unprepare,
235 .recalc_rate = clk_pllv2_recalc_rate, 235 .recalc_rate = clk_pllv2_recalc_rate,
diff --git a/arch/arm/mach-imx/clk.c b/arch/arm/mach-imx/clk.c
index f5e8be8e7f11..37e884ed1cd4 100644
--- a/arch/arm/mach-imx/clk.c
+++ b/arch/arm/mach-imx/clk.c
@@ -1,3 +1,4 @@
1#include <linux/spinlock.h> 1#include <linux/spinlock.h>
2#include "clk.h"
2 3
3DEFINE_SPINLOCK(imx_ccm_lock); 4DEFINE_SPINLOCK(imx_ccm_lock);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 5bf4a97ab241..9fea2522d7a3 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -113,7 +113,6 @@ extern void imx_set_cpu_jump(int cpu, void *jump_addr);
113extern u32 imx_get_cpu_arg(int cpu); 113extern u32 imx_get_cpu_arg(int cpu);
114extern void imx_set_cpu_arg(int cpu, u32 arg); 114extern void imx_set_cpu_arg(int cpu, u32 arg);
115extern void v7_cpu_resume(void); 115extern void v7_cpu_resume(void);
116extern u32 *pl310_get_save_ptr(void);
117#ifdef CONFIG_SMP 116#ifdef CONFIG_SMP
118extern void v7_secondary_startup(void); 117extern void v7_secondary_startup(void);
119extern void imx_scu_map_io(void); 118extern void imx_scu_map_io(void);
@@ -124,8 +123,6 @@ static inline void imx_scu_map_io(void) {}
124static inline void imx_smp_prepare(void) {} 123static inline void imx_smp_prepare(void) {}
125static inline void imx_scu_standby_enable(void) {} 124static inline void imx_scu_standby_enable(void) {}
126#endif 125#endif
127extern void imx_enable_cpu(int cpu, bool enable);
128extern void imx_set_cpu_jump(int cpu, void *jump_addr);
129extern void imx_src_init(void); 126extern void imx_src_init(void);
130extern void imx_src_prepare_restart(void); 127extern void imx_src_prepare_restart(void);
131extern void imx_gpc_init(void); 128extern void imx_gpc_init(void);
diff --git a/arch/arm/mach-imx/cpu-imx5.c b/arch/arm/mach-imx/cpu-imx5.c
index d7ce72252a4e..c1c99a72c6a1 100644
--- a/arch/arm/mach-imx/cpu-imx5.c
+++ b/arch/arm/mach-imx/cpu-imx5.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include "hardware.h" 20#include "hardware.h"
21#include "common.h"
21 22
22static int mx5_cpu_rev = -1; 23static int mx5_cpu_rev = -1;
23 24
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 03fcbd082593..e70e3acbf9bd 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -3,6 +3,7 @@
3#include <linux/io.h> 3#include <linux/io.h>
4 4
5#include "hardware.h" 5#include "hardware.h"
6#include "common.h"
6 7
7unsigned int __mxc_cpu_type; 8unsigned int __mxc_cpu_type;
8EXPORT_SYMBOL(__mxc_cpu_type); 9EXPORT_SYMBOL(__mxc_cpu_type);
diff --git a/arch/arm/mach-imx/cpu_op-mx51.c b/arch/arm/mach-imx/cpu_op-mx51.c
deleted file mode 100644
index b9ef692b61a2..000000000000
--- a/arch/arm/mach-imx/cpu_op-mx51.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14#include <linux/bug.h>
15#include <linux/types.h>
16#include <linux/kernel.h>
17
18#include "hardware.h"
19
20static struct cpu_op mx51_cpu_op[] = {
21 {
22 .cpu_rate = 160000000,},
23 {
24 .cpu_rate = 800000000,},
25};
26
27struct cpu_op *mx51_get_cpu_op(int *op)
28{
29 *op = ARRAY_SIZE(mx51_cpu_op);
30 return mx51_cpu_op;
31}
diff --git a/arch/arm/mach-imx/cpu_op-mx51.h b/arch/arm/mach-imx/cpu_op-mx51.h
deleted file mode 100644
index 97477fecb469..000000000000
--- a/arch/arm/mach-imx/cpu_op-mx51.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14extern struct cpu_op *mx51_get_cpu_op(int *op);
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
deleted file mode 100644
index d8c75c3c925d..000000000000
--- a/arch/arm/mach-imx/cpufreq.c
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/*
15 * A driver for the Freescale Semiconductor i.MXC CPUfreq module.
16 * The CPUFREQ driver is for controlling CPU frequency. It allows you to change
17 * the CPU clock speed on the fly.
18 */
19
20#include <linux/module.h>
21#include <linux/cpufreq.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/slab.h>
25
26#include "hardware.h"
27
28#define CLK32_FREQ 32768
29#define NANOSECOND (1000 * 1000 * 1000)
30
31struct cpu_op *(*get_cpu_op)(int *op);
32
33static int cpu_freq_khz_min;
34static int cpu_freq_khz_max;
35
36static struct clk *cpu_clk;
37static struct cpufreq_frequency_table *imx_freq_table;
38
39static int cpu_op_nr;
40static struct cpu_op *cpu_op_tbl;
41
42static int set_cpu_freq(int freq)
43{
44 int ret = 0;
45 int org_cpu_rate;
46
47 org_cpu_rate = clk_get_rate(cpu_clk);
48 if (org_cpu_rate == freq)
49 return ret;
50
51 ret = clk_set_rate(cpu_clk, freq);
52 if (ret != 0) {
53 printk(KERN_DEBUG "cannot set CPU clock rate\n");
54 return ret;
55 }
56
57 return ret;
58}
59
60static int mxc_verify_speed(struct cpufreq_policy *policy)
61{
62 if (policy->cpu != 0)
63 return -EINVAL;
64
65 return cpufreq_frequency_table_verify(policy, imx_freq_table);
66}
67
68static unsigned int mxc_get_speed(unsigned int cpu)
69{
70 if (cpu)
71 return 0;
72
73 return clk_get_rate(cpu_clk) / 1000;
74}
75
76static int mxc_set_target(struct cpufreq_policy *policy,
77 unsigned int target_freq, unsigned int relation)
78{
79 struct cpufreq_freqs freqs;
80 int freq_Hz;
81 int ret = 0;
82 unsigned int index;
83
84 cpufreq_frequency_table_target(policy, imx_freq_table,
85 target_freq, relation, &index);
86 freq_Hz = imx_freq_table[index].frequency * 1000;
87
88 freqs.old = clk_get_rate(cpu_clk) / 1000;
89 freqs.new = freq_Hz / 1000;
90 freqs.cpu = 0;
91 freqs.flags = 0;
92 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
93
94 ret = set_cpu_freq(freq_Hz);
95
96 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
97
98 return ret;
99}
100
101static int mxc_cpufreq_init(struct cpufreq_policy *policy)
102{
103 int ret;
104 int i;
105
106 printk(KERN_INFO "i.MXC CPU frequency driver\n");
107
108 if (policy->cpu != 0)
109 return -EINVAL;
110
111 if (!get_cpu_op)
112 return -EINVAL;
113
114 cpu_clk = clk_get(NULL, "cpu_clk");
115 if (IS_ERR(cpu_clk)) {
116 printk(KERN_ERR "%s: failed to get cpu clock\n", __func__);
117 return PTR_ERR(cpu_clk);
118 }
119
120 cpu_op_tbl = get_cpu_op(&cpu_op_nr);
121
122 cpu_freq_khz_min = cpu_op_tbl[0].cpu_rate / 1000;
123 cpu_freq_khz_max = cpu_op_tbl[0].cpu_rate / 1000;
124
125 imx_freq_table = kmalloc(
126 sizeof(struct cpufreq_frequency_table) * (cpu_op_nr + 1),
127 GFP_KERNEL);
128 if (!imx_freq_table) {
129 ret = -ENOMEM;
130 goto err1;
131 }
132
133 for (i = 0; i < cpu_op_nr; i++) {
134 imx_freq_table[i].index = i;
135 imx_freq_table[i].frequency = cpu_op_tbl[i].cpu_rate / 1000;
136
137 if ((cpu_op_tbl[i].cpu_rate / 1000) < cpu_freq_khz_min)
138 cpu_freq_khz_min = cpu_op_tbl[i].cpu_rate / 1000;
139
140 if ((cpu_op_tbl[i].cpu_rate / 1000) > cpu_freq_khz_max)
141 cpu_freq_khz_max = cpu_op_tbl[i].cpu_rate / 1000;
142 }
143
144 imx_freq_table[i].index = i;
145 imx_freq_table[i].frequency = CPUFREQ_TABLE_END;
146
147 policy->cur = clk_get_rate(cpu_clk) / 1000;
148 policy->min = policy->cpuinfo.min_freq = cpu_freq_khz_min;
149 policy->max = policy->cpuinfo.max_freq = cpu_freq_khz_max;
150
151 /* Manual states, that PLL stabilizes in two CLK32 periods */
152 policy->cpuinfo.transition_latency = 2 * NANOSECOND / CLK32_FREQ;
153
154 ret = cpufreq_frequency_table_cpuinfo(policy, imx_freq_table);
155
156 if (ret < 0) {
157 printk(KERN_ERR "%s: failed to register i.MXC CPUfreq with error code %d\n",
158 __func__, ret);
159 goto err;
160 }
161
162 cpufreq_frequency_table_get_attr(imx_freq_table, policy->cpu);
163 return 0;
164err:
165 kfree(imx_freq_table);
166err1:
167 clk_put(cpu_clk);
168 return ret;
169}
170
171static int mxc_cpufreq_exit(struct cpufreq_policy *policy)
172{
173 cpufreq_frequency_table_put_attr(policy->cpu);
174
175 set_cpu_freq(cpu_freq_khz_max * 1000);
176 clk_put(cpu_clk);
177 kfree(imx_freq_table);
178 return 0;
179}
180
181static struct cpufreq_driver mxc_driver = {
182 .flags = CPUFREQ_STICKY,
183 .verify = mxc_verify_speed,
184 .target = mxc_set_target,
185 .get = mxc_get_speed,
186 .init = mxc_cpufreq_init,
187 .exit = mxc_cpufreq_exit,
188 .name = "imx",
189};
190
191static int mxc_cpufreq_driver_init(void)
192{
193 return cpufreq_register_driver(&mxc_driver);
194}
195
196static void mxc_cpufreq_driver_exit(void)
197{
198 cpufreq_unregister_driver(&mxc_driver);
199}
200
201module_init(mxc_cpufreq_driver_init);
202module_exit(mxc_cpufreq_driver_exit);
203
204MODULE_AUTHOR("Freescale Semiconductor Inc. Yong Shen <yong.shen@linaro.org>");
205MODULE_DESCRIPTION("CPUfreq driver for i.MX");
206MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-imx/cpuidle-imx5.c b/arch/arm/mach-imx/cpuidle-imx5.c
new file mode 100644
index 000000000000..5a47e3c6172f
--- /dev/null
+++ b/arch/arm/mach-imx/cpuidle-imx5.c
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2012 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/cpuidle.h>
10#include <linux/module.h>
11#include <asm/system_misc.h>
12
13static int imx5_cpuidle_enter(struct cpuidle_device *dev,
14 struct cpuidle_driver *drv, int index)
15{
16 arm_pm_idle();
17 return index;
18}
19
20static struct cpuidle_driver imx5_cpuidle_driver = {
21 .name = "imx5_cpuidle",
22 .owner = THIS_MODULE,
23 .states[0] = {
24 .enter = imx5_cpuidle_enter,
25 .exit_latency = 2,
26 .target_residency = 1,
27 .flags = CPUIDLE_FLAG_TIME_VALID,
28 .name = "IMX5 SRPG",
29 .desc = "CPU state retained,powered off",
30 },
31 .state_count = 1,
32};
33
34int __init imx5_cpuidle_init(void)
35{
36 return cpuidle_register(&imx5_cpuidle_driver, NULL);
37}
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index d533e2695f0e..23ddfb693b2d 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -6,7 +6,6 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <linux/clockchips.h>
10#include <linux/cpuidle.h> 9#include <linux/cpuidle.h>
11#include <linux/module.h> 10#include <linux/module.h>
12#include <asm/cpuidle.h> 11#include <asm/cpuidle.h>
@@ -21,10 +20,6 @@ static DEFINE_SPINLOCK(master_lock);
21static int imx6q_enter_wait(struct cpuidle_device *dev, 20static int imx6q_enter_wait(struct cpuidle_device *dev,
22 struct cpuidle_driver *drv, int index) 21 struct cpuidle_driver *drv, int index)
23{ 22{
24 int cpu = dev->cpu;
25
26 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
27
28 if (atomic_inc_return(&master) == num_online_cpus()) { 23 if (atomic_inc_return(&master) == num_online_cpus()) {
29 /* 24 /*
30 * With this lock, we prevent other cpu to exit and enter 25 * With this lock, we prevent other cpu to exit and enter
@@ -43,26 +38,13 @@ idle:
43 cpu_do_idle(); 38 cpu_do_idle();
44done: 39done:
45 atomic_dec(&master); 40 atomic_dec(&master);
46 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
47 41
48 return index; 42 return index;
49} 43}
50 44
51/*
52 * For each cpu, setup the broadcast timer because local timer
53 * stops for the states other than WFI.
54 */
55static void imx6q_setup_broadcast_timer(void *arg)
56{
57 int cpu = smp_processor_id();
58
59 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
60}
61
62static struct cpuidle_driver imx6q_cpuidle_driver = { 45static struct cpuidle_driver imx6q_cpuidle_driver = {
63 .name = "imx6q_cpuidle", 46 .name = "imx6q_cpuidle",
64 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
65 .en_core_tk_irqen = 1,
66 .states = { 48 .states = {
67 /* WFI */ 49 /* WFI */
68 ARM_CPUIDLE_WFI_STATE, 50 ARM_CPUIDLE_WFI_STATE,
@@ -70,7 +52,8 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
70 { 52 {
71 .exit_latency = 50, 53 .exit_latency = 50,
72 .target_residency = 75, 54 .target_residency = 75,
73 .flags = CPUIDLE_FLAG_TIME_VALID, 55 .flags = CPUIDLE_FLAG_TIME_VALID |
56 CPUIDLE_FLAG_TIMER_STOP,
74 .enter = imx6q_enter_wait, 57 .enter = imx6q_enter_wait,
75 .name = "WAIT", 58 .name = "WAIT",
76 .desc = "Clock off", 59 .desc = "Clock off",
@@ -88,8 +71,5 @@ int __init imx6q_cpuidle_init(void)
88 /* Set chicken bit to get a reliable WAIT mode support */ 71 /* Set chicken bit to get a reliable WAIT mode support */
89 imx6q_set_chicken_bit(); 72 imx6q_set_chicken_bit();
90 73
91 /* Configure the broadcast timer on each cpu */ 74 return cpuidle_register(&imx6q_cpuidle_driver, NULL);
92 on_each_cpu(imx6q_setup_broadcast_timer, NULL, 1);
93
94 return imx_cpuidle_init(&imx6q_cpuidle_driver);
95} 75}
diff --git a/arch/arm/mach-imx/cpuidle.c b/arch/arm/mach-imx/cpuidle.c
deleted file mode 100644
index d4cb511a44a8..000000000000
--- a/arch/arm/mach-imx/cpuidle.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2012 Linaro Ltd.
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/cpuidle.h>
14#include <linux/err.h>
15#include <linux/hrtimer.h>
16#include <linux/io.h>
17#include <linux/kernel.h>
18#include <linux/slab.h>
19
20static struct cpuidle_device __percpu * imx_cpuidle_devices;
21
22static void __init imx_cpuidle_devices_uninit(void)
23{
24 int cpu_id;
25 struct cpuidle_device *dev;
26
27 for_each_possible_cpu(cpu_id) {
28 dev = per_cpu_ptr(imx_cpuidle_devices, cpu_id);
29 cpuidle_unregister_device(dev);
30 }
31
32 free_percpu(imx_cpuidle_devices);
33}
34
35int __init imx_cpuidle_init(struct cpuidle_driver *drv)
36{
37 struct cpuidle_device *dev;
38 int cpu_id, ret;
39
40 if (drv->state_count > CPUIDLE_STATE_MAX) {
41 pr_err("%s: state_count exceeds maximum\n", __func__);
42 return -EINVAL;
43 }
44
45 ret = cpuidle_register_driver(drv);
46 if (ret) {
47 pr_err("%s: Failed to register cpuidle driver with error: %d\n",
48 __func__, ret);
49 return ret;
50 }
51
52 imx_cpuidle_devices = alloc_percpu(struct cpuidle_device);
53 if (imx_cpuidle_devices == NULL) {
54 ret = -ENOMEM;
55 goto unregister_drv;
56 }
57
58 /* initialize state data for each cpuidle_device */
59 for_each_possible_cpu(cpu_id) {
60 dev = per_cpu_ptr(imx_cpuidle_devices, cpu_id);
61 dev->cpu = cpu_id;
62 dev->state_count = drv->state_count;
63
64 ret = cpuidle_register_device(dev);
65 if (ret) {
66 pr_err("%s: Failed to register cpu %u, error: %d\n",
67 __func__, cpu_id, ret);
68 goto uninit;
69 }
70 }
71
72 return 0;
73
74uninit:
75 imx_cpuidle_devices_uninit();
76
77unregister_drv:
78 cpuidle_unregister_driver(drv);
79 return ret;
80}
diff --git a/arch/arm/mach-imx/cpuidle.h b/arch/arm/mach-imx/cpuidle.h
index e092d1359d94..786f98ecc145 100644
--- a/arch/arm/mach-imx/cpuidle.h
+++ b/arch/arm/mach-imx/cpuidle.h
@@ -10,18 +10,16 @@
10 * http://www.gnu.org/copyleft/gpl.html 10 * http://www.gnu.org/copyleft/gpl.html
11 */ 11 */
12 12
13#include <linux/cpuidle.h>
14
15#ifdef CONFIG_CPU_IDLE 13#ifdef CONFIG_CPU_IDLE
16extern int imx_cpuidle_init(struct cpuidle_driver *drv); 14extern int imx5_cpuidle_init(void);
17extern int imx6q_cpuidle_init(void); 15extern int imx6q_cpuidle_init(void);
18#else 16#else
19static inline int imx_cpuidle_init(struct cpuidle_driver *drv) 17static inline int imx5_cpuidle_init(void)
20{ 18{
21 return -ENODEV; 19 return 0;
22} 20}
23static inline int imx6q_cpuidle_init(void) 21static inline int imx6q_cpuidle_init(void)
24{ 22{
25 return -ENODEV; 23 return 0;
26} 24}
27#endif 25#endif
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index 9b9ba1f4ffe1..3dd2b1b041d1 100644
--- a/arch/arm/mach-imx/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -86,7 +86,3 @@ config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
86 86
87config IMX_HAVE_PLATFORM_SPI_IMX 87config IMX_HAVE_PLATFORM_SPI_IMX
88 bool 88 bool
89
90config IMX_HAVE_PLATFORM_AHCI
91 bool
92 default y if ARCH_MX53
diff --git a/arch/arm/mach-imx/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
index 6acf37e0c119..67416fb1dc69 100644
--- a/arch/arm/mach-imx/devices/Makefile
+++ b/arch/arm/mach-imx/devices/Makefile
@@ -29,5 +29,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o
29obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o 29obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
30obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o 30obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o
31obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o 31obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
32obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o
33obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_EMMA) += platform-mx2-emma.o 32obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_EMMA) += platform-mx2-emma.o
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index 9bd5777ff0e7..453e20bc2657 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -344,13 +344,3 @@ struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
344 int irq, int irq_err); 344 int irq, int irq_err);
345struct platform_device *imx_add_imx_sdma(char *name, 345struct platform_device *imx_add_imx_sdma(char *name,
346 resource_size_t iobase, int irq, struct sdma_platform_data *pdata); 346 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
347
348#include <linux/ahci_platform.h>
349struct imx_ahci_imx_data {
350 const char *devid;
351 resource_size_t iobase;
352 resource_size_t irq;
353};
354struct platform_device *__init imx_add_ahci_imx(
355 const struct imx_ahci_imx_data *data,
356 const struct ahci_platform_data *pdata);
diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
index 1b37482407f9..1b4366a0e7c0 100644
--- a/arch/arm/mach-imx/devices/devices.c
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -37,7 +37,7 @@ int __init mxc_device_init(void)
37 int ret; 37 int ret;
38 38
39 ret = device_register(&mxc_aips_bus); 39 ret = device_register(&mxc_aips_bus);
40 if (IS_ERR_VALUE(ret)) 40 if (ret < 0)
41 goto done; 41 goto done;
42 42
43 ret = device_register(&mxc_ahb_bus); 43 ret = device_register(&mxc_ahb_bus);
diff --git a/arch/arm/mach-imx/devices/platform-ahci-imx.c b/arch/arm/mach-imx/devices/platform-ahci-imx.c
deleted file mode 100644
index 3d87dd9c284a..000000000000
--- a/arch/arm/mach-imx/devices/platform-ahci-imx.c
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/io.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/device.h>
25#include <linux/dma-mapping.h>
26#include <asm/sizes.h>
27
28#include "../hardware.h"
29#include "devices-common.h"
30
31#define imx_ahci_imx_data_entry_single(soc, _devid) \
32 { \
33 .devid = _devid, \
34 .iobase = soc ## _SATA_BASE_ADDR, \
35 .irq = soc ## _INT_SATA, \
36 }
37
38#ifdef CONFIG_SOC_IMX53
39const struct imx_ahci_imx_data imx53_ahci_imx_data __initconst =
40 imx_ahci_imx_data_entry_single(MX53, "imx53-ahci");
41#endif
42
43enum {
44 HOST_CAP = 0x00,
45 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */
46 HOST_PORTS_IMPL = 0x0c,
47 HOST_TIMER1MS = 0xe0, /* Timer 1-ms */
48};
49
50static struct clk *sata_clk, *sata_ref_clk;
51
52/* AHCI module Initialization, if return 0, initialization is successful. */
53static int imx_sata_init(struct device *dev, void __iomem *addr)
54{
55 u32 tmpdata;
56 int ret = 0;
57 struct clk *clk;
58
59 sata_clk = clk_get(dev, "ahci");
60 if (IS_ERR(sata_clk)) {
61 dev_err(dev, "no sata clock.\n");
62 return PTR_ERR(sata_clk);
63 }
64 ret = clk_prepare_enable(sata_clk);
65 if (ret) {
66 dev_err(dev, "can't prepare/enable sata clock.\n");
67 goto put_sata_clk;
68 }
69
70 /* Get the AHCI SATA PHY CLK */
71 sata_ref_clk = clk_get(dev, "ahci_phy");
72 if (IS_ERR(sata_ref_clk)) {
73 dev_err(dev, "no sata ref clock.\n");
74 ret = PTR_ERR(sata_ref_clk);
75 goto release_sata_clk;
76 }
77 ret = clk_prepare_enable(sata_ref_clk);
78 if (ret) {
79 dev_err(dev, "can't prepare/enable sata ref clock.\n");
80 goto put_sata_ref_clk;
81 }
82
83 /* Get the AHB clock rate, and configure the TIMER1MS reg later */
84 clk = clk_get(dev, "ahci_dma");
85 if (IS_ERR(clk)) {
86 dev_err(dev, "no dma clock.\n");
87 ret = PTR_ERR(clk);
88 goto release_sata_ref_clk;
89 }
90 tmpdata = clk_get_rate(clk) / 1000;
91 clk_put(clk);
92
93 writel(tmpdata, addr + HOST_TIMER1MS);
94
95 tmpdata = readl(addr + HOST_CAP);
96 if (!(tmpdata & HOST_CAP_SSS)) {
97 tmpdata |= HOST_CAP_SSS;
98 writel(tmpdata, addr + HOST_CAP);
99 }
100
101 if (!(readl(addr + HOST_PORTS_IMPL) & 0x1))
102 writel((readl(addr + HOST_PORTS_IMPL) | 0x1),
103 addr + HOST_PORTS_IMPL);
104
105 return 0;
106
107release_sata_ref_clk:
108 clk_disable_unprepare(sata_ref_clk);
109put_sata_ref_clk:
110 clk_put(sata_ref_clk);
111release_sata_clk:
112 clk_disable_unprepare(sata_clk);
113put_sata_clk:
114 clk_put(sata_clk);
115
116 return ret;
117}
118
119static void imx_sata_exit(struct device *dev)
120{
121 clk_disable_unprepare(sata_ref_clk);
122 clk_put(sata_ref_clk);
123
124 clk_disable_unprepare(sata_clk);
125 clk_put(sata_clk);
126
127}
128struct platform_device *__init imx_add_ahci_imx(
129 const struct imx_ahci_imx_data *data,
130 const struct ahci_platform_data *pdata)
131{
132 struct resource res[] = {
133 {
134 .start = data->iobase,
135 .end = data->iobase + SZ_4K - 1,
136 .flags = IORESOURCE_MEM,
137 }, {
138 .start = data->irq,
139 .end = data->irq,
140 .flags = IORESOURCE_IRQ,
141 },
142 };
143
144 return imx_add_platform_device_dmamask(data->devid, 0,
145 res, ARRAY_SIZE(res),
146 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
147}
148
149struct platform_device *__init imx53_add_ahci_imx(void)
150{
151 struct ahci_platform_data pdata = {
152 .init = imx_sata_init,
153 .exit = imx_sata_exit,
154 };
155
156 return imx_add_ahci_imx(&imx53_ahci_imx_data, &pdata);
157}
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index b4c70028d359..b2f08bfbbdd3 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -46,7 +46,7 @@ static const int eukrea_mbimx27_pins[] __initconst = {
46 PE10_PF_UART3_CTS, 46 PE10_PF_UART3_CTS,
47 PE11_PF_UART3_RTS, 47 PE11_PF_UART3_RTS,
48 /* UART4 */ 48 /* UART4 */
49#if !defined(MACH_EUKREA_CPUIMX27_USEUART4) 49#if !defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
50 PB26_AF_UART4_RTS, 50 PB26_AF_UART4_RTS,
51 PB28_AF_UART4_TXD, 51 PB28_AF_UART4_TXD,
52 PB29_AF_UART4_CTS, 52 PB29_AF_UART4_CTS,
@@ -306,7 +306,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
306 306
307 imx27_add_imx_uart1(&uart_pdata); 307 imx27_add_imx_uart1(&uart_pdata);
308 imx27_add_imx_uart2(&uart_pdata); 308 imx27_add_imx_uart2(&uart_pdata);
309#if !defined(MACH_EUKREA_CPUIMX27_USEUART4) 309#if !defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
310 imx27_add_imx_uart3(&uart_pdata); 310 imx27_add_imx_uart3(&uart_pdata);
311#endif 311#endif
312 312
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index a96ccc7f5012..02b61cdf39b9 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -16,6 +16,7 @@
16#include <linux/of_address.h> 16#include <linux/of_address.h>
17#include <linux/of_irq.h> 17#include <linux/of_irq.h>
18#include <linux/irqchip/arm-gic.h> 18#include <linux/irqchip/arm-gic.h>
19#include "common.h"
19 20
20#define GPC_IMR1 0x008 21#define GPC_IMR1 0x008
21#define GPC_PGC_CPU_PDN 0x2a0 22#define GPC_PGC_CPU_PDN 0x2a0
diff --git a/arch/arm/mach-imx/hardware.h b/arch/arm/mach-imx/hardware.h
index 911e9b31b03f..356131f7b591 100644
--- a/arch/arm/mach-imx/hardware.h
+++ b/arch/arm/mach-imx/hardware.h
@@ -102,7 +102,6 @@
102 102
103#include "mxc.h" 103#include "mxc.h"
104 104
105#include "mx6q.h"
106#include "mx51.h" 105#include "mx51.h"
107#include "mx53.h" 106#include "mx53.h"
108#include "mx3x.h" 107#include "mx3x.h"
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 361a253e2b63..5e91112dcbee 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <asm/cacheflush.h>
15#include <asm/cp15.h> 14#include <asm/cp15.h>
16 15
17#include "common.h" 16#include "common.h"
@@ -20,7 +19,6 @@ static inline void cpu_enter_lowpower(void)
20{ 19{
21 unsigned int v; 20 unsigned int v;
22 21
23 flush_cache_all();
24 asm volatile( 22 asm volatile(
25 "mcr p15, 0, %1, c7, c5, 0\n" 23 "mcr p15, 0, %1, c7, c5, 0\n"
26 " mcr p15, 0, %1, c7, c10, 4\n" 24 " mcr p15, 0, %1, c7, c10, 4\n"
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index c915a490a11c..4aaead0a77ff 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -18,25 +18,13 @@
18#include "common.h" 18#include "common.h"
19#include "mx27.h" 19#include "mx27.h"
20 20
21static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
22 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL),
23 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL),
24 OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL),
25 OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL),
26 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx21-i2c.0", NULL),
27 OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx21-i2c.1", NULL),
28 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL),
29 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL),
30 OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL),
31 OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL),
32 OF_DEV_AUXDATA("fsl,imx27-nand", MX27_NFC_BASE_ADDR, "imx27-nand.0", NULL),
33 { /* sentinel */ }
34};
35
36static void __init imx27_dt_init(void) 21static void __init imx27_dt_init(void)
37{ 22{
38 of_platform_populate(NULL, of_default_bus_match_table, 23 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
39 imx27_auxdata_lookup, NULL); 24
25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
26
27 platform_device_register_full(&devinfo);
40} 28}
41 29
42static const char * const imx27_dt_board_compat[] __initconst = { 30static const char * const imx27_dt_board_compat[] __initconst = {
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index e2926a8863f8..ab24cc322111 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -21,7 +21,10 @@
21 21
22static void __init imx51_dt_init(void) 22static void __init imx51_dt_init(void)
23{ 23{
24 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
25
24 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 26 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
27 platform_device_register_full(&devinfo);
25} 28}
26 29
27static const char *imx51_dt_board_compat[] __initdata = { 30static const char *imx51_dt_board_compat[] __initdata = {
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index cabefbc5e7c1..7c66805d2cc0 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -40,7 +40,7 @@ static DEFINE_SPINLOCK(gpio_mux_lock);
40 40
41#define IOMUX_REG_MASK (IOMUX_PADNUM_MASK & ~0x3) 41#define IOMUX_REG_MASK (IOMUX_PADNUM_MASK & ~0x3)
42 42
43unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG]; 43static unsigned long mxc_pin_alloc_map[NB_PORTS * 32 / BITS_PER_LONG];
44/* 44/*
45 * set the mode for a IOMUX pin. 45 * set the mode for a IOMUX pin.
46 */ 46 */
diff --git a/arch/arm/mach-imx/irq-common.c b/arch/arm/mach-imx/irq-common.c
index b6e11458e5ae..4b34f52dc46b 100644
--- a/arch/arm/mach-imx/irq-common.c
+++ b/arch/arm/mach-imx/irq-common.c
@@ -21,25 +21,6 @@
21 21
22#include "irq-common.h" 22#include "irq-common.h"
23 23
24int imx_irq_set_priority(unsigned char irq, unsigned char prio)
25{
26 struct irq_chip_generic *gc;
27 struct mxc_extra_irq *exirq;
28 int ret;
29
30 ret = -ENOSYS;
31
32 gc = irq_get_chip_data(irq);
33 if (gc && gc->private) {
34 exirq = gc->private;
35 if (exirq->set_priority)
36 ret = exirq->set_priority(irq, prio);
37 }
38
39 return ret;
40}
41EXPORT_SYMBOL(imx_irq_set_priority);
42
43int mxc_set_irq_fiq(unsigned int irq, unsigned int type) 24int mxc_set_irq_fiq(unsigned int irq, unsigned int type)
44{ 25{
45 struct irq_chip_generic *gc; 26 struct irq_chip_generic *gc;
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 146559311bd2..ea50870bda80 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -48,7 +48,7 @@ static const int eukrea_cpuimx27_pins[] __initconst = {
48 PE14_PF_UART1_CTS, 48 PE14_PF_UART1_CTS,
49 PE15_PF_UART1_RTS, 49 PE15_PF_UART1_RTS,
50 /* UART4 */ 50 /* UART4 */
51#if defined(MACH_EUKREA_CPUIMX27_USEUART4) 51#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
52 PB26_AF_UART4_RTS, 52 PB26_AF_UART4_RTS,
53 PB28_AF_UART4_TXD, 53 PB28_AF_UART4_TXD,
54 PB29_AF_UART4_CTS, 54 PB29_AF_UART4_CTS,
@@ -272,7 +272,7 @@ static void __init eukrea_cpuimx27_init(void)
272 /* SDHC2 can be used for Wifi */ 272 /* SDHC2 can be used for Wifi */
273 imx27_add_mxc_mmc(1, NULL); 273 imx27_add_mxc_mmc(1, NULL);
274#endif 274#endif
275#if defined(MACH_EUKREA_CPUIMX27_USEUART4) 275#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USEUART4)
276 /* in which case UART4 is also used for Bluetooth */ 276 /* in which case UART4 is also used for Bluetooth */
277 imx27_add_imx_uart3(&uart_pdata); 277 imx27_add_imx_uart3(&uart_pdata);
278#endif 278#endif
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
index 9b7393234f6f..9b5ddf5bbd33 100644
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c
@@ -33,7 +33,6 @@
33 33
34#include "common.h" 34#include "common.h"
35#include "devices-imx51.h" 35#include "devices-imx51.h"
36#include "cpu_op-mx51.h"
37#include "eukrea-baseboards.h" 36#include "eukrea-baseboards.h"
38#include "hardware.h" 37#include "hardware.h"
39#include "iomux-mx51.h" 38#include "iomux-mx51.h"
@@ -285,10 +284,6 @@ static void __init eukrea_cpuimx51sd_init(void)
285 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads, 284 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
286 ARRAY_SIZE(eukrea_cpuimx51sd_pads)); 285 ARRAY_SIZE(eukrea_cpuimx51sd_pads));
287 286
288#if defined(CONFIG_CPU_FREQ_IMX)
289 get_cpu_op = mx51_get_cpu_op;
290#endif
291
292 imx51_add_imx_uart(0, &uart_pdata); 287 imx51_add_imx_uart(0, &uart_pdata);
293 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info); 288 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
294 imx51_add_imx2_wdt(0); 289 imx51_add_imx2_wdt(0);
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 9ffd103b27e4..99502eeefdf7 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clkdev.h> 14#include <linux/clkdev.h>
15#include <linux/clocksource.h>
15#include <linux/cpu.h> 16#include <linux/cpu.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/export.h> 18#include <linux/export.h>
@@ -28,11 +29,9 @@
28#include <linux/regmap.h> 29#include <linux/regmap.h>
29#include <linux/micrel_phy.h> 30#include <linux/micrel_phy.h>
30#include <linux/mfd/syscon.h> 31#include <linux/mfd/syscon.h>
31#include <asm/smp_twd.h>
32#include <asm/hardware/cache-l2x0.h> 32#include <asm/hardware/cache-l2x0.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <asm/mach/time.h>
36#include <asm/system_misc.h> 35#include <asm/system_misc.h>
37 36
38#include "common.h" 37#include "common.h"
@@ -73,7 +72,7 @@ static int imx6q_revision(void)
73 } 72 }
74} 73}
75 74
76void imx6q_restart(char mode, const char *cmd) 75static void imx6q_restart(char mode, const char *cmd)
77{ 76{
78 struct device_node *np; 77 struct device_node *np;
79 void __iomem *wdog_base; 78 void __iomem *wdog_base;
@@ -256,7 +255,7 @@ put_node:
256 of_node_put(np); 255 of_node_put(np);
257} 256}
258 257
259struct platform_device imx6q_cpufreq_pdev = { 258static struct platform_device imx6q_cpufreq_pdev = {
260 .name = "imx6q-cpufreq", 259 .name = "imx6q-cpufreq",
261}; 260};
262 261
@@ -292,7 +291,7 @@ static void __init imx6q_init_irq(void)
292static void __init imx6q_timer_init(void) 291static void __init imx6q_timer_init(void)
293{ 292{
294 mx6q_clocks_init(); 293 mx6q_clocks_init();
295 twd_local_timer_of_register(); 294 clocksource_of_init();
296 imx_print_silicon_rev("i.MX6Q", imx6q_revision()); 295 imx_print_silicon_rev("i.MX6Q", imx6q_revision());
297} 296}
298 297
diff --git a/arch/arm/mach-imx/mach-mx51_babbage.c b/arch/arm/mach-imx/mach-mx51_babbage.c
index 6c4d7feb4520..f3d264a636fa 100644
--- a/arch/arm/mach-imx/mach-mx51_babbage.c
+++ b/arch/arm/mach-imx/mach-mx51_babbage.c
@@ -27,7 +27,6 @@
27 27
28#include "common.h" 28#include "common.h"
29#include "devices-imx51.h" 29#include "devices-imx51.h"
30#include "cpu_op-mx51.h"
31#include "hardware.h" 30#include "hardware.h"
32#include "iomux-mx51.h" 31#include "iomux-mx51.h"
33 32
@@ -371,9 +370,6 @@ static void __init mx51_babbage_init(void)
371 370
372 imx51_soc_init(); 371 imx51_soc_init();
373 372
374#if defined(CONFIG_CPU_FREQ_IMX)
375 get_cpu_op = mx51_get_cpu_op;
376#endif
377 imx51_babbage_common_init(); 373 imx51_babbage_common_init();
378 374
379 imx51_add_imx_uart(0, &uart_pdata); 375 imx51_add_imx_uart(0, &uart_pdata);
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index cefa047c4053..e0e69a682174 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -82,7 +82,7 @@ static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size,
82 return __arm_ioremap_caller(phys_addr, size, mtype, caller); 82 return __arm_ioremap_caller(phys_addr, size, mtype, caller);
83} 83}
84 84
85void __init imx3_init_l2x0(void) 85static void __init imx3_init_l2x0(void)
86{ 86{
87#ifdef CONFIG_CACHE_L2X0 87#ifdef CONFIG_CACHE_L2X0
88 void __iomem *l2x0_base; 88 void __iomem *l2x0_base;
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index cf34994cfe28..b7c4e70e5081 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -84,6 +84,7 @@ void __init imx51_init_early(void)
84 mxc_set_cpu_type(MXC_CPU_MX51); 84 mxc_set_cpu_type(MXC_CPU_MX51);
85 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); 85 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
86 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); 86 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
87 imx_src_init();
87} 88}
88 89
89void __init imx53_init_early(void) 90void __init imx53_init_early(void)
@@ -91,6 +92,7 @@ void __init imx53_init_early(void)
91 mxc_set_cpu_type(MXC_CPU_MX53); 92 mxc_set_cpu_type(MXC_CPU_MX53);
92 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR)); 93 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR));
93 mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR)); 94 mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
95 imx_src_init();
94} 96}
95 97
96void __init mx51_init_irq(void) 98void __init mx51_init_irq(void)
diff --git a/arch/arm/mach-imx/mx6q.h b/arch/arm/mach-imx/mx6q.h
deleted file mode 100644
index 19d3f54db5af..000000000000
--- a/arch/arm/mach-imx/mx6q.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2011 Linaro Ltd.
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#ifndef __MACH_MX6Q_H__
14#define __MACH_MX6Q_H__
15
16#define MX6Q_IO_P2V(x) IMX_IO_P2V(x)
17#define MX6Q_IO_ADDRESS(x) IOMEM(MX6Q_IO_P2V(x))
18
19/*
20 * The following are the blocks that need to be statically mapped.
21 * For other blocks, the base address really should be retrieved from
22 * device tree.
23 */
24#define MX6Q_SCU_BASE_ADDR 0x00a00000
25#define MX6Q_SCU_SIZE 0x1000
26#define MX6Q_CCM_BASE_ADDR 0x020c4000
27#define MX6Q_CCM_SIZE 0x4000
28#define MX6Q_ANATOP_BASE_ADDR 0x020c8000
29#define MX6Q_ANATOP_SIZE 0x1000
30
31#endif /* __MACH_MX6Q_H__ */
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 7c0b03f67b05..77e9a25ed0f6 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/irqchip/arm-gic.h>
16#include <asm/page.h> 15#include <asm/page.h>
17#include <asm/smp_scu.h> 16#include <asm/smp_scu.h>
18#include <asm/mach/map.h> 17#include <asm/mach/map.h>
@@ -52,16 +51,6 @@ void imx_scu_standby_enable(void)
52 writel_relaxed(val, scu_base); 51 writel_relaxed(val, scu_base);
53} 52}
54 53
55static void __cpuinit imx_secondary_init(unsigned int cpu)
56{
57 /*
58 * if any interrupts are already enabled for the primary
59 * core (e.g. timer irq), then they will not have been enabled
60 * for us: do so
61 */
62 gic_secondary_init(0);
63}
64
65static int __cpuinit imx_boot_secondary(unsigned int cpu, struct task_struct *idle) 54static int __cpuinit imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
66{ 55{
67 imx_set_cpu_jump(cpu, v7_secondary_startup); 56 imx_set_cpu_jump(cpu, v7_secondary_startup);
@@ -96,7 +85,6 @@ static void __init imx_smp_prepare_cpus(unsigned int max_cpus)
96struct smp_operations imx_smp_ops __initdata = { 85struct smp_operations imx_smp_ops __initdata = {
97 .smp_init_cpus = imx_smp_init_cpus, 86 .smp_init_cpus = imx_smp_init_cpus,
98 .smp_prepare_cpus = imx_smp_prepare_cpus, 87 .smp_prepare_cpus = imx_smp_prepare_cpus,
99 .smp_secondary_init = imx_secondary_init,
100 .smp_boot_secondary = imx_boot_secondary, 88 .smp_boot_secondary = imx_boot_secondary,
101#ifdef CONFIG_HOTPLUG_CPU 89#ifdef CONFIG_HOTPLUG_CPU
102 .cpu_die = imx_cpu_die, 90 .cpu_die = imx_cpu_die,
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index f67fd7ee8127..82e79c658eb2 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -149,33 +149,6 @@ static void imx5_pm_idle(void)
149 imx5_cpu_do_idle(); 149 imx5_cpu_do_idle();
150} 150}
151 151
152static int imx5_cpuidle_enter(struct cpuidle_device *dev,
153 struct cpuidle_driver *drv, int idx)
154{
155 int ret;
156
157 ret = imx5_cpu_do_idle();
158 if (ret < 0)
159 return ret;
160
161 return idx;
162}
163
164static struct cpuidle_driver imx5_cpuidle_driver = {
165 .name = "imx5_cpuidle",
166 .owner = THIS_MODULE,
167 .en_core_tk_irqen = 1,
168 .states[0] = {
169 .enter = imx5_cpuidle_enter,
170 .exit_latency = 2,
171 .target_residency = 1,
172 .flags = CPUIDLE_FLAG_TIME_VALID,
173 .name = "IMX5 SRPG",
174 .desc = "CPU state retained,powered off",
175 },
176 .state_count = 1,
177};
178
179static int __init imx5_pm_common_init(void) 152static int __init imx5_pm_common_init(void)
180{ 153{
181 int ret; 154 int ret;
@@ -193,8 +166,7 @@ static int __init imx5_pm_common_init(void)
193 /* Set the registers to the default cpu idle state. */ 166 /* Set the registers to the default cpu idle state. */
194 mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE); 167 mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE);
195 168
196 imx_cpuidle_init(&imx5_cpuidle_driver); 169 return imx5_cpuidle_init();
197 return 0;
198} 170}
199 171
200void __init imx51_pm_init(void) 172void __init imx51_pm_init(void)
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c
index 09a742f8c7ab..97d086889481 100644
--- a/arch/arm/mach-imx/src.c
+++ b/arch/arm/mach-imx/src.c
@@ -16,6 +16,7 @@
16#include <linux/of_address.h> 16#include <linux/of_address.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <asm/smp_plat.h> 18#include <asm/smp_plat.h>
19#include "common.h"
19 20
20#define SRC_SCR 0x000 21#define SRC_SCR 0x000
21#define SRC_GPR1 0x020 22#define SRC_GPR1 0x020
@@ -73,7 +74,9 @@ void __init imx_src_init(void)
73 struct device_node *np; 74 struct device_node *np;
74 u32 val; 75 u32 val;
75 76
76 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-src"); 77 np = of_find_compatible_node(NULL, NULL, "fsl,imx51-src");
78 if (!np)
79 return;
77 src_base = of_iomap(np, 0); 80 src_base = of_iomap(np, 0);
78 WARN_ON(!src_base); 81 WARN_ON(!src_base);
79 82
diff --git a/arch/arm/mach-imx/tzic.c b/arch/arm/mach-imx/tzic.c
index 9721161f208f..8183178d5aa3 100644
--- a/arch/arm/mach-imx/tzic.c
+++ b/arch/arm/mach-imx/tzic.c
@@ -49,7 +49,7 @@
49#define TZIC_SWINT 0x0F00 /* Software Interrupt Rigger Register */ 49#define TZIC_SWINT 0x0F00 /* Software Interrupt Rigger Register */
50#define TZIC_ID0 0x0FD0 /* Indentification Register 0 */ 50#define TZIC_ID0 0x0FD0 /* Indentification Register 0 */
51 51
52void __iomem *tzic_base; /* Used as irq controller base in entry-macro.S */ 52static void __iomem *tzic_base;
53static struct irq_domain *domain; 53static struct irq_domain *domain;
54 54
55#define TZIC_NUM_IRQS 128 55#define TZIC_NUM_IRQS 128
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index 5521d18bf19a..d14d6b76f4c2 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -9,5 +9,4 @@ obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
11obj-$(CONFIG_PCI) += pci_v3.o pci.o 11obj-$(CONFIG_PCI) += pci_v3.o pci.o
12obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o
13obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o 12obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o
diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
deleted file mode 100644
index 590c192cdf4d..000000000000
--- a/arch/arm/mach-integrator/cpu.c
+++ /dev/null
@@ -1,224 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/cpu.c
3 *
4 * Copyright (C) 2001-2002 Deep Blue Solutions Ltd.
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 * CPU support functions
11 */
12#include <linux/module.h>
13#include <linux/types.h>
14#include <linux/kernel.h>
15#include <linux/cpufreq.h>
16#include <linux/sched.h>
17#include <linux/smp.h>
18#include <linux/init.h>
19#include <linux/io.h>
20
21#include <mach/hardware.h>
22#include <mach/platform.h>
23#include <asm/mach-types.h>
24#include <asm/hardware/icst.h>
25
26static struct cpufreq_driver integrator_driver;
27
28#define CM_ID __io_address(INTEGRATOR_HDR_ID)
29#define CM_OSC __io_address(INTEGRATOR_HDR_OSC)
30#define CM_STAT __io_address(INTEGRATOR_HDR_STAT)
31#define CM_LOCK __io_address(INTEGRATOR_HDR_LOCK)
32
33static const struct icst_params lclk_params = {
34 .ref = 24000000,
35 .vco_max = ICST525_VCO_MAX_5V,
36 .vco_min = ICST525_VCO_MIN,
37 .vd_min = 8,
38 .vd_max = 132,
39 .rd_min = 24,
40 .rd_max = 24,
41 .s2div = icst525_s2div,
42 .idx2s = icst525_idx2s,
43};
44
45static const struct icst_params cclk_params = {
46 .ref = 24000000,
47 .vco_max = ICST525_VCO_MAX_5V,
48 .vco_min = ICST525_VCO_MIN,
49 .vd_min = 12,
50 .vd_max = 160,
51 .rd_min = 24,
52 .rd_max = 24,
53 .s2div = icst525_s2div,
54 .idx2s = icst525_idx2s,
55};
56
57/*
58 * Validate the speed policy.
59 */
60static int integrator_verify_policy(struct cpufreq_policy *policy)
61{
62 struct icst_vco vco;
63
64 cpufreq_verify_within_limits(policy,
65 policy->cpuinfo.min_freq,
66 policy->cpuinfo.max_freq);
67
68 vco = icst_hz_to_vco(&cclk_params, policy->max * 1000);
69 policy->max = icst_hz(&cclk_params, vco) / 1000;
70
71 vco = icst_hz_to_vco(&cclk_params, policy->min * 1000);
72 policy->min = icst_hz(&cclk_params, vco) / 1000;
73
74 cpufreq_verify_within_limits(policy,
75 policy->cpuinfo.min_freq,
76 policy->cpuinfo.max_freq);
77
78 return 0;
79}
80
81
82static int integrator_set_target(struct cpufreq_policy *policy,
83 unsigned int target_freq,
84 unsigned int relation)
85{
86 cpumask_t cpus_allowed;
87 int cpu = policy->cpu;
88 struct icst_vco vco;
89 struct cpufreq_freqs freqs;
90 u_int cm_osc;
91
92 /*
93 * Save this threads cpus_allowed mask.
94 */
95 cpus_allowed = current->cpus_allowed;
96
97 /*
98 * Bind to the specified CPU. When this call returns,
99 * we should be running on the right CPU.
100 */
101 set_cpus_allowed(current, cpumask_of_cpu(cpu));
102 BUG_ON(cpu != smp_processor_id());
103
104 /* get current setting */
105 cm_osc = __raw_readl(CM_OSC);
106
107 if (machine_is_integrator()) {
108 vco.s = (cm_osc >> 8) & 7;
109 } else if (machine_is_cintegrator()) {
110 vco.s = 1;
111 }
112 vco.v = cm_osc & 255;
113 vco.r = 22;
114 freqs.old = icst_hz(&cclk_params, vco) / 1000;
115
116 /* icst_hz_to_vco rounds down -- so we need the next
117 * larger freq in case of CPUFREQ_RELATION_L.
118 */
119 if (relation == CPUFREQ_RELATION_L)
120 target_freq += 999;
121 if (target_freq > policy->max)
122 target_freq = policy->max;
123 vco = icst_hz_to_vco(&cclk_params, target_freq * 1000);
124 freqs.new = icst_hz(&cclk_params, vco) / 1000;
125
126 freqs.cpu = policy->cpu;
127
128 if (freqs.old == freqs.new) {
129 set_cpus_allowed(current, cpus_allowed);
130 return 0;
131 }
132
133 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
134
135 cm_osc = __raw_readl(CM_OSC);
136
137 if (machine_is_integrator()) {
138 cm_osc &= 0xfffff800;
139 cm_osc |= vco.s << 8;
140 } else if (machine_is_cintegrator()) {
141 cm_osc &= 0xffffff00;
142 }
143 cm_osc |= vco.v;
144
145 __raw_writel(0xa05f, CM_LOCK);
146 __raw_writel(cm_osc, CM_OSC);
147 __raw_writel(0, CM_LOCK);
148
149 /*
150 * Restore the CPUs allowed mask.
151 */
152 set_cpus_allowed(current, cpus_allowed);
153
154 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
155
156 return 0;
157}
158
159static unsigned int integrator_get(unsigned int cpu)
160{
161 cpumask_t cpus_allowed;
162 unsigned int current_freq;
163 u_int cm_osc;
164 struct icst_vco vco;
165
166 cpus_allowed = current->cpus_allowed;
167
168 set_cpus_allowed(current, cpumask_of_cpu(cpu));
169 BUG_ON(cpu != smp_processor_id());
170
171 /* detect memory etc. */
172 cm_osc = __raw_readl(CM_OSC);
173
174 if (machine_is_integrator()) {
175 vco.s = (cm_osc >> 8) & 7;
176 } else {
177 vco.s = 1;
178 }
179 vco.v = cm_osc & 255;
180 vco.r = 22;
181
182 current_freq = icst_hz(&cclk_params, vco) / 1000; /* current freq */
183
184 set_cpus_allowed(current, cpus_allowed);
185
186 return current_freq;
187}
188
189static int integrator_cpufreq_init(struct cpufreq_policy *policy)
190{
191
192 /* set default policy and cpuinfo */
193 policy->cpuinfo.max_freq = 160000;
194 policy->cpuinfo.min_freq = 12000;
195 policy->cpuinfo.transition_latency = 1000000; /* 1 ms, assumed */
196 policy->cur = policy->min = policy->max = integrator_get(policy->cpu);
197
198 return 0;
199}
200
201static struct cpufreq_driver integrator_driver = {
202 .verify = integrator_verify_policy,
203 .target = integrator_set_target,
204 .get = integrator_get,
205 .init = integrator_cpufreq_init,
206 .name = "integrator",
207};
208
209static int __init integrator_cpu_init(void)
210{
211 return cpufreq_register_driver(&integrator_driver);
212}
213
214static void __exit integrator_cpu_exit(void)
215{
216 cpufreq_unregister_driver(&integrator_driver);
217}
218
219MODULE_AUTHOR ("Russell M. King");
220MODULE_DESCRIPTION ("cpufreq driver for ARM Integrator CPUs");
221MODULE_LICENSE ("GPL");
222
223module_init(integrator_cpu_init);
224module_exit(integrator_cpu_exit);
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index ea961445e0e9..b23c8e4f28e8 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -536,16 +536,14 @@ static void __init ap_init_of(void)
536 'A' + (ap_sc_id & 0x0f)); 536 'A' + (ap_sc_id & 0x0f));
537 537
538 soc_dev = soc_device_register(soc_dev_attr); 538 soc_dev = soc_device_register(soc_dev_attr);
539 if (IS_ERR_OR_NULL(soc_dev)) { 539 if (IS_ERR(soc_dev)) {
540 kfree(soc_dev_attr->revision); 540 kfree(soc_dev_attr->revision);
541 kfree(soc_dev_attr); 541 kfree(soc_dev_attr);
542 return; 542 return;
543 } 543 }
544 544
545 parent = soc_device_to_device(soc_dev); 545 parent = soc_device_to_device(soc_dev);
546 546 integrator_init_sysfs(parent, ap_sc_id);
547 if (!IS_ERR_OR_NULL(parent))
548 integrator_init_sysfs(parent, ap_sc_id);
549 547
550 of_platform_populate(root, of_default_bus_match_table, 548 of_platform_populate(root, of_default_bus_match_table,
551 ap_auxdata_lookup, parent); 549 ap_auxdata_lookup, parent);
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 2b0db82a5381..da1091be0887 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -360,17 +360,14 @@ static void __init intcp_init_of(void)
360 'A' + (intcp_sc_id & 0x0f)); 360 'A' + (intcp_sc_id & 0x0f));
361 361
362 soc_dev = soc_device_register(soc_dev_attr); 362 soc_dev = soc_device_register(soc_dev_attr);
363 if (IS_ERR_OR_NULL(soc_dev)) { 363 if (IS_ERR(soc_dev)) {
364 kfree(soc_dev_attr->revision); 364 kfree(soc_dev_attr->revision);
365 kfree(soc_dev_attr); 365 kfree(soc_dev_attr);
366 return; 366 return;
367 } 367 }
368 368
369 parent = soc_device_to_device(soc_dev); 369 parent = soc_device_to_device(soc_dev);
370 370 integrator_init_sysfs(parent, intcp_sc_id);
371 if (!IS_ERR_OR_NULL(parent))
372 integrator_init_sysfs(parent, intcp_sc_id);
373
374 of_platform_populate(root, of_default_bus_match_table, 371 of_platform_populate(root, of_default_bus_match_table,
375 intcp_auxdata_lookup, parent); 372 intcp_auxdata_lookup, parent);
376} 373}
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 1dbeb7c99d58..6600cff6bd92 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -29,6 +29,7 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/export.h> 30#include <linux/export.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/cpu.h>
32 33
33#include <mach/udc.h> 34#include <mach/udc.h>
34#include <mach/hardware.h> 35#include <mach/hardware.h>
@@ -239,7 +240,7 @@ void __init ixp4xx_init_irq(void)
239 * ixp4xx does not implement the XScale PWRMODE register 240 * ixp4xx does not implement the XScale PWRMODE register
240 * so it must not call cpu_do_idle(). 241 * so it must not call cpu_do_idle().
241 */ 242 */
242 disable_hlt(); 243 cpu_idle_poll_ctrl(true);
243 244
244 /* Route all sources to IRQ instead of FIQ */ 245 /* Route all sources to IRQ instead of FIQ */
245 *IXP4XX_ICLR = 0x0; 246 *IXP4XX_ICLR = 0x0;
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 7b6a64bc5f40..7509a89af967 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -2,23 +2,41 @@ if ARCH_KIRKWOOD
2 2
3menu "Marvell Kirkwood Implementations" 3menu "Marvell Kirkwood Implementations"
4 4
5config MACH_D2NET_V2
6 bool "LaCie d2 Network v2 NAS Board"
7 help
8 Say 'Y' here if you want your kernel to support the
9 LaCie d2 Network v2 NAS.
10
5config MACH_DB88F6281_BP 11config MACH_DB88F6281_BP
6 bool "Marvell DB-88F6281-BP Development Board" 12 bool "Marvell DB-88F6281-BP Development Board"
7 help 13 help
8 Say 'Y' here if you want your kernel to support the 14 Say 'Y' here if you want your kernel to support the
9 Marvell DB-88F6281-BP Development Board. 15 Marvell DB-88F6281-BP Development Board.
10 16
11config MACH_RD88F6192_NAS 17config MACH_DOCKSTAR
12 bool "Marvell RD-88F6192-NAS Reference Board" 18 bool "Seagate FreeAgent DockStar"
13 help 19 help
14 Say 'Y' here if you want your kernel to support the 20 Say 'Y' here if you want your kernel to support the
15 Marvell RD-88F6192-NAS Reference Board. 21 Seagate FreeAgent DockStar.
16 22
17config MACH_RD88F6281 23config MACH_ESATA_SHEEVAPLUG
18 bool "Marvell RD-88F6281 Reference Board" 24 bool "Marvell eSATA SheevaPlug Reference Board"
19 help 25 help
20 Say 'Y' here if you want your kernel to support the 26 Say 'Y' here if you want your kernel to support the
21 Marvell RD-88F6281 Reference Board. 27 Marvell eSATA SheevaPlug Reference Board.
28
29config MACH_GURUPLUG
30 bool "Marvell GuruPlug Reference Board"
31 help
32 Say 'Y' here if you want your kernel to support the
33 Marvell GuruPlug Reference Board.
34
35config MACH_INETSPACE_V2
36 bool "LaCie Internet Space v2 NAS Board"
37 help
38 Say 'Y' here if you want your kernel to support the
39 LaCie Internet Space v2 NAS.
22 40
23config MACH_MV88F6281GTW_GE 41config MACH_MV88F6281GTW_GE
24 bool "Marvell 88F6281 GTW GE Board" 42 bool "Marvell 88F6281 GTW GE Board"
@@ -26,23 +44,93 @@ config MACH_MV88F6281GTW_GE
26 Say 'Y' here if you want your kernel to support the 44 Say 'Y' here if you want your kernel to support the
27 Marvell 88F6281 GTW GE Board. 45 Marvell 88F6281 GTW GE Board.
28 46
47config MACH_NET2BIG_V2
48 bool "LaCie 2Big Network v2 NAS Board"
49 help
50 Say 'Y' here if you want your kernel to support the
51 LaCie 2Big Network v2 NAS.
52
53config MACH_NET5BIG_V2
54 bool "LaCie 5Big Network v2 NAS Board"
55 help
56 Say 'Y' here if you want your kernel to support the
57 LaCie 5Big Network v2 NAS.
58
59config MACH_NETSPACE_MAX_V2
60 bool "LaCie Network Space Max v2 NAS Board"
61 help
62 Say 'Y' here if you want your kernel to support the
63 LaCie Network Space Max v2 NAS.
64
65config MACH_NETSPACE_V2
66 bool "LaCie Network Space v2 NAS Board"
67 help
68 Say 'Y' here if you want your kernel to support the
69 LaCie Network Space v2 NAS.
70
71config MACH_OPENRD
72 bool
73
74config MACH_OPENRD_BASE
75 bool "Marvell OpenRD Base Board"
76 select MACH_OPENRD
77 help
78 Say 'Y' here if you want your kernel to support the
79 Marvell OpenRD Base Board.
80
81config MACH_OPENRD_CLIENT
82 bool "Marvell OpenRD Client Board"
83 select MACH_OPENRD
84 help
85 Say 'Y' here if you want your kernel to support the
86 Marvell OpenRD Client Board.
87
88config MACH_OPENRD_ULTIMATE
89 bool "Marvell OpenRD Ultimate Board"
90 select MACH_OPENRD
91 help
92 Say 'Y' here if you want your kernel to support the
93 Marvell OpenRD Ultimate Board.
94
95config MACH_RD88F6192_NAS
96 bool "Marvell RD-88F6192-NAS Reference Board"
97 help
98 Say 'Y' here if you want your kernel to support the
99 Marvell RD-88F6192-NAS Reference Board.
100
101config MACH_RD88F6281
102 bool "Marvell RD-88F6281 Reference Board"
103 help
104 Say 'Y' here if you want your kernel to support the
105 Marvell RD-88F6281 Reference Board.
106
29config MACH_SHEEVAPLUG 107config MACH_SHEEVAPLUG
30 bool "Marvell SheevaPlug Reference Board" 108 bool "Marvell SheevaPlug Reference Board"
31 help 109 help
32 Say 'Y' here if you want your kernel to support the 110 Say 'Y' here if you want your kernel to support the
33 Marvell SheevaPlug Reference Board. 111 Marvell SheevaPlug Reference Board.
34 112
35config MACH_ESATA_SHEEVAPLUG 113config MACH_T5325
36 bool "Marvell eSATA SheevaPlug Reference Board" 114 bool "HP t5325 Thin Client"
37 help 115 help
38 Say 'Y' here if you want your kernel to support the 116 Say 'Y' here if you want your kernel to support the
39 Marvell eSATA SheevaPlug Reference Board. 117 HP t5325 Thin Client.
40 118
41config MACH_GURUPLUG 119config MACH_TS219
42 bool "Marvell GuruPlug Reference Board" 120 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
43 help 121 help
44 Say 'Y' here if you want your kernel to support the 122 Say 'Y' here if you want your kernel to support the
45 Marvell GuruPlug Reference Board. 123 QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
124 TS-219P+ Turbo NAS devices.
125
126config MACH_TS41X
127 bool "QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo NAS"
128 help
129 Say 'Y' here if you want your kernel to support the
130 QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
131 NAS devices.
132
133comment "Device tree entries"
46 134
47config ARCH_KIRKWOOD_DT 135config ARCH_KIRKWOOD_DT
48 bool "Marvell Kirkwood Flattened Device Tree" 136 bool "Marvell Kirkwood Flattened Device Tree"
@@ -58,12 +146,27 @@ config ARCH_KIRKWOOD_DT
58 Say 'Y' here if you want your kernel to support the 146 Say 'Y' here if you want your kernel to support the
59 Marvell Kirkwood using flattened device tree. 147 Marvell Kirkwood using flattened device tree.
60 148
61config MACH_GURUPLUG_DT 149config MACH_CLOUDBOX_DT
62 bool "Marvell GuruPlug Reference Board (Flattened Device Tree)" 150 bool "LaCie CloudBox NAS (Flattened Device Tree)"
151 select ARCH_KIRKWOOD_DT
152 help
153 Say 'Y' here if you want your kernel to support the LaCie
154 CloudBox NAS, using Flattened Device Tree.
155
156config MACH_DLINK_KIRKWOOD_DT
157 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
63 select ARCH_KIRKWOOD_DT 158 select ARCH_KIRKWOOD_DT
64 help 159 help
65 Say 'Y' here if you want your kernel to support the 160 Say 'Y' here if you want your kernel to support the
66 Marvell GuruPlug Reference Board (Flattened Device Tree). 161 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
162 using Flattened Device Tree.
163
164config MACH_DOCKSTAR_DT
165 bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
166 select ARCH_KIRKWOOD_DT
167 help
168 Say 'Y' here if you want your kernel to support the
169 Seagate FreeAgent Dockstar (Flattened Device Tree).
67 170
68config MACH_DREAMPLUG_DT 171config MACH_DREAMPLUG_DT
69 bool "Marvell DreamPlug (Flattened Device Tree)" 172 bool "Marvell DreamPlug (Flattened Device Tree)"
@@ -72,19 +175,19 @@ config MACH_DREAMPLUG_DT
72 Say 'Y' here if you want your kernel to support the 175 Say 'Y' here if you want your kernel to support the
73 Marvell DreamPlug (Flattened Device Tree). 176 Marvell DreamPlug (Flattened Device Tree).
74 177
75config MACH_ICONNECT_DT 178config MACH_GOFLEXNET_DT
76 bool "Iomega Iconnect (Flattened Device Tree)" 179 bool "Seagate GoFlex Net (Flattened Device Tree)"
77 select ARCH_KIRKWOOD_DT 180 select ARCH_KIRKWOOD_DT
78 help 181 help
79 Say 'Y' here to enable Iomega Iconnect support. 182 Say 'Y' here if you want your kernel to support the
183 Seagate GoFlex Net (Flattened Device Tree).
80 184
81config MACH_DLINK_KIRKWOOD_DT 185config MACH_GURUPLUG_DT
82 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" 186 bool "Marvell GuruPlug Reference Board (Flattened Device Tree)"
83 select ARCH_KIRKWOOD_DT 187 select ARCH_KIRKWOOD_DT
84 help 188 help
85 Say 'Y' here if you want your kernel to support the 189 Say 'Y' here if you want your kernel to support the
86 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325, 190 Marvell GuruPlug Reference Board (Flattened Device Tree).
87 using Flattened Device Tree.
88 191
89config MACH_IB62X0_DT 192config MACH_IB62X0_DT
90 bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)" 193 bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)"
@@ -94,41 +197,18 @@ config MACH_IB62X0_DT
94 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using 197 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
95 Flattened Device Tree. 198 Flattened Device Tree.
96 199
97config MACH_TS219_DT 200config MACH_ICONNECT_DT
98 bool "Device Tree for QNAP TS-11X, TS-21X NAS" 201 bool "Iomega Iconnect (Flattened Device Tree)"
99 select ARCH_KIRKWOOD_DT
100 select ARM_APPENDED_DTB
101 select ARM_ATAG_DTB_COMPAT
102 help
103 Say 'Y' here if you want your kernel to support the QNAP
104 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
105 TS-219P+ Turbo NAS devices using Fattened Device Tree.
106 There are two different Device Tree descriptions, depending
107 on if the device is based on an if the board uses the MV6281
108 or MV6282. If you have the wrong one, the buttons will not
109 work.
110
111config MACH_DOCKSTAR_DT
112 bool "Seagate FreeAgent Dockstar (Flattened Device Tree)"
113 select ARCH_KIRKWOOD_DT
114 help
115 Say 'Y' here if you want your kernel to support the
116 Seagate FreeAgent Dockstar (Flattened Device Tree).
117
118config MACH_GOFLEXNET_DT
119 bool "Seagate GoFlex Net (Flattened Device Tree)"
120 select ARCH_KIRKWOOD_DT 202 select ARCH_KIRKWOOD_DT
121 help 203 help
122 Say 'Y' here if you want your kernel to support the 204 Say 'Y' here to enable Iomega Iconnect support.
123 Seagate GoFlex Net (Flattened Device Tree).
124 205
125config MACH_LSXL_DT 206config MACH_INETSPACE_V2_DT
126 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)" 207 bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
127 select ARCH_KIRKWOOD_DT 208 select ARCH_KIRKWOOD_DT
128 help 209 help
129 Say 'Y' here if you want your kernel to support the 210 Say 'Y' here if you want your kernel to support the LaCie
130 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using 211 Internet Space v2 NAS, using Flattened Device Tree.
131 Flattened Device Tree.
132 212
133config MACH_IOMEGA_IX2_200_DT 213config MACH_IOMEGA_IX2_200_DT
134 bool "Iomega StorCenter ix2-200 (Flattened Device Tree)" 214 bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
@@ -144,12 +224,13 @@ config MACH_KM_KIRKWOOD_DT
144 Say 'Y' here if you want your kernel to support the 224 Say 'Y' here if you want your kernel to support the
145 Keymile Kirkwood Reference Desgin, using Flattened Device Tree. 225 Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
146 226
147config MACH_INETSPACE_V2_DT 227config MACH_LSXL_DT
148 bool "LaCie Internet Space v2 NAS (Flattened Device Tree)" 228 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
149 select ARCH_KIRKWOOD_DT 229 select ARCH_KIRKWOOD_DT
150 help 230 help
151 Say 'Y' here if you want your kernel to support the LaCie 231 Say 'Y' here if you want your kernel to support the
152 Internet Space v2 NAS, using Flattened Device Tree. 232 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
233 Flattened Device Tree.
153 234
154config MACH_MPLCEC4_DT 235config MACH_MPLCEC4_DT
155 bool "MPL CEC4 (Flattened Device Tree)" 236 bool "MPL CEC4 (Flattened Device Tree)"
@@ -158,12 +239,12 @@ config MACH_MPLCEC4_DT
158 Say 'Y' here if you want your kernel to support the 239 Say 'Y' here if you want your kernel to support the
159 MPL CEC4 (Flattened Device Tree). 240 MPL CEC4 (Flattened Device Tree).
160 241
161config MACH_NETSPACE_V2_DT 242config MACH_NETSPACE_LITE_V2_DT
162 bool "LaCie Network Space v2 NAS (Flattened Device Tree)" 243 bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
163 select ARCH_KIRKWOOD_DT 244 select ARCH_KIRKWOOD_DT
164 help 245 help
165 Say 'Y' here if you want your kernel to support the LaCie 246 Say 'Y' here if you want your kernel to support the LaCie
166 Network Space v2 NAS, using Flattened Device Tree. 247 Network Space Lite v2 NAS, using Flattened Device Tree.
167 248
168config MACH_NETSPACE_MAX_V2_DT 249config MACH_NETSPACE_MAX_V2_DT
169 bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)" 250 bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
@@ -172,128 +253,69 @@ config MACH_NETSPACE_MAX_V2_DT
172 Say 'Y' here if you want your kernel to support the LaCie 253 Say 'Y' here if you want your kernel to support the LaCie
173 Network Space Max v2 NAS, using Flattened Device Tree. 254 Network Space Max v2 NAS, using Flattened Device Tree.
174 255
175config MACH_NETSPACE_LITE_V2_DT
176 bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
177 select ARCH_KIRKWOOD_DT
178 help
179 Say 'Y' here if you want your kernel to support the LaCie
180 Network Space Lite v2 NAS, using Flattened Device Tree.
181
182config MACH_NETSPACE_MINI_V2_DT 256config MACH_NETSPACE_MINI_V2_DT
183 bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)" 257 bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)"
184 select ARCH_KIRKWOOD_DT 258 select ARCH_KIRKWOOD_DT
185 help 259 help
186 Say 'Y' here if you want your kernel to support the LaCie 260 Say 'Y' here if you want your kernel to support the LaCie
187 Network Space Mini v2 NAS (aka SafeBox), using Flattened 261 Network Space Mini v2 NAS using Flattened Device Tree.
188 Device Tree.
189 262
190config MACH_OPENBLOCKS_A6_DT 263 This board is embedded in a product named CloudBox, which
191 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)" 264 provides automatic backup on a 100GB cloud storage. This
192 select ARCH_KIRKWOOD_DT 265 should not confused with a more recent LaCie NAS also named
193 help 266 CloudBox. For this last, the disk capacity is 1TB or above.
194 Say 'Y' here if you want your kernel to support the
195 Plat'Home OpenBlocks A6 (Flattened Device Tree).
196 267
197config MACH_TOPKICK_DT 268config MACH_NETSPACE_V2_DT
198 bool "USI Topkick (Flattened Device Tree)" 269 bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
199 select ARCH_KIRKWOOD_DT 270 select ARCH_KIRKWOOD_DT
200 help 271 help
201 Say 'Y' here if you want your kernel to support the 272 Say 'Y' here if you want your kernel to support the LaCie
202 USI Topkick, using Flattened Device Tree 273 Network Space v2 NAS, using Flattened Device Tree.
203
204config MACH_TS219
205 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
206 help
207 Say 'Y' here if you want your kernel to support the
208 QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
209 TS-219P+ Turbo NAS devices.
210
211config MACH_TS41X
212 bool "QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo NAS"
213 help
214 Say 'Y' here if you want your kernel to support the
215 QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
216 NAS devices.
217
218config MACH_DOCKSTAR
219 bool "Seagate FreeAgent DockStar"
220 help
221 Say 'Y' here if you want your kernel to support the
222 Seagate FreeAgent DockStar.
223
224config MACH_OPENRD
225 bool
226
227config MACH_OPENRD_BASE
228 bool "Marvell OpenRD Base Board"
229 select MACH_OPENRD
230 help
231 Say 'Y' here if you want your kernel to support the
232 Marvell OpenRD Base Board.
233
234config MACH_OPENRD_CLIENT
235 bool "Marvell OpenRD Client Board"
236 select MACH_OPENRD
237 help
238 Say 'Y' here if you want your kernel to support the
239 Marvell OpenRD Client Board.
240
241config MACH_OPENRD_ULTIMATE
242 bool "Marvell OpenRD Ultimate Board"
243 select MACH_OPENRD
244 help
245 Say 'Y' here if you want your kernel to support the
246 Marvell OpenRD Ultimate Board.
247
248config MACH_NETSPACE_V2
249 bool "LaCie Network Space v2 NAS Board"
250 help
251 Say 'Y' here if you want your kernel to support the
252 LaCie Network Space v2 NAS.
253
254config MACH_INETSPACE_V2
255 bool "LaCie Internet Space v2 NAS Board"
256 help
257 Say 'Y' here if you want your kernel to support the
258 LaCie Internet Space v2 NAS.
259
260config MACH_NETSPACE_MAX_V2
261 bool "LaCie Network Space Max v2 NAS Board"
262 help
263 Say 'Y' here if you want your kernel to support the
264 LaCie Network Space Max v2 NAS.
265 274
266config MACH_D2NET_V2 275config MACH_NSA310_DT
267 bool "LaCie d2 Network v2 NAS Board" 276 bool "ZyXEL NSA-310 (Flattened Device Tree)"
277 select ARCH_KIRKWOOD_DT
278 select ARM_ATAG_DTB_COMPAT
268 help 279 help
269 Say 'Y' here if you want your kernel to support the 280 Say 'Y' here if you want your kernel to support the
270 LaCie d2 Network v2 NAS. 281 ZyXEL NSA-310 board (Flattened Device Tree).
271 282
272config MACH_NET2BIG_V2 283config MACH_OPENBLOCKS_A6_DT
273 bool "LaCie 2Big Network v2 NAS Board" 284 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
285 select ARCH_KIRKWOOD_DT
274 help 286 help
275 Say 'Y' here if you want your kernel to support the 287 Say 'Y' here if you want your kernel to support the
276 LaCie 2Big Network v2 NAS. 288 Plat'Home OpenBlocks A6 (Flattened Device Tree).
277 289
278config MACH_NET5BIG_V2 290config MACH_READYNAS_DT
279 bool "LaCie 5Big Network v2 NAS Board" 291 bool "NETGEAR ReadyNAS Duo v2 (Flattened Device Tree)"
292 select ARCH_KIRKWOOD_DT
293 select ARM_APPENDED_DTB
294 select ARM_ATAG_DTB_COMPAT
280 help 295 help
281 Say 'Y' here if you want your kernel to support the 296 Say 'Y' here if you want your kernel to support the
282 LaCie 5Big Network v2 NAS. 297 NETGEAR ReadyNAS Duo v2 using Fattened Device Tree.
283 298
284config MACH_T5325 299config MACH_TOPKICK_DT
285 bool "HP t5325 Thin Client" 300 bool "USI Topkick (Flattened Device Tree)"
301 select ARCH_KIRKWOOD_DT
286 help 302 help
287 Say 'Y' here if you want your kernel to support the 303 Say 'Y' here if you want your kernel to support the
288 HP t5325 Thin Client. 304 USI Topkick, using Flattened Device Tree
289 305
290config MACH_NSA310_DT 306config MACH_TS219_DT
291 bool "ZyXEL NSA-310 (Flattened Device Tree)" 307 bool "Device Tree for QNAP TS-11X, TS-21X NAS"
292 select ARCH_KIRKWOOD_DT 308 select ARCH_KIRKWOOD_DT
309 select ARM_APPENDED_DTB
293 select ARM_ATAG_DTB_COMPAT 310 select ARM_ATAG_DTB_COMPAT
294 help 311 help
295 Say 'Y' here if you want your kernel to support the 312 Say 'Y' here if you want your kernel to support the QNAP
296 ZyXEL NSA-310 board (Flattened Device Tree). 313 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
314 TS-219P+ Turbo NAS devices using Fattened Device Tree.
315 There are two different Device Tree descriptions, depending
316 on if the device is based on an if the board uses the MV6281
317 or MV6282. If you have the wrong one, the buttons will not
318 work.
297 319
298endmenu 320endmenu
299 321
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 4cc4bee4d0cf..cdbca328a412 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,42 +1,44 @@
1obj-y += common.o addr-map.o irq.o pcie.o mpp.o 1obj-y += common.o addr-map.o irq.o pcie.o mpp.o
2 2
3obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
3obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o 4obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o
4obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o 5obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
5obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o
6obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
7obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
8obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o 6obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
9obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o 7obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
10obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
11obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
12obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
13obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
14obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
15obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o 8obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
16obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o 9obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
17obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
18obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 10obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
19obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 11obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
12obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o
13obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
14obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
15obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o
16obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o
17obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
20obj-$(CONFIG_MACH_T5325) += t5325-setup.o 18obj-$(CONFIG_MACH_T5325) += t5325-setup.o
19obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
20obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
21 21
22obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 22obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
23obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o 23obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
24obj-$(CONFIG_MACH_GURUPLUG_DT) += board-guruplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 24obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
29obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o 25obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
26obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
30obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o 27obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
31obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o 28obj-$(CONFIG_MACH_GURUPLUG_DT) += board-guruplug.o
29obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
30obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
31obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o
32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o 32obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o 33obj-$(CONFIG_MACH_KM_KIRKWOOD_DT) += board-km_kirkwood.o
34obj-$(CONFIG_MACH_INETSPACE_V2_DT) += board-ns2.o 34obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
35obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o 35obj-$(CONFIG_MACH_MPLCEC4_DT) += board-mplcec4.o
36obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
38obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o 36obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
39obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o 38obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
39obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
40obj-$(CONFIG_MACH_NSA310_DT) += board-nsa310.o 40obj-$(CONFIG_MACH_NSA310_DT) += board-nsa310.o
41obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o 41obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
42obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o
42obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o 43obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
44obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index d367aa6b47bb..7904758e771f 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -139,16 +139,20 @@ static void __init kirkwood_dt_init(void)
139 if (of_machine_is_compatible("keymile,km_kirkwood")) 139 if (of_machine_is_compatible("keymile,km_kirkwood"))
140 km_kirkwood_init(); 140 km_kirkwood_init();
141 141
142 if (of_machine_is_compatible("lacie,inetspace_v2") || 142 if (of_machine_is_compatible("lacie,cloudbox") ||
143 of_machine_is_compatible("lacie,netspace_v2") || 143 of_machine_is_compatible("lacie,inetspace_v2") ||
144 of_machine_is_compatible("lacie,netspace_max_v2") ||
145 of_machine_is_compatible("lacie,netspace_lite_v2") || 144 of_machine_is_compatible("lacie,netspace_lite_v2") ||
146 of_machine_is_compatible("lacie,netspace_mini_v2")) 145 of_machine_is_compatible("lacie,netspace_max_v2") ||
146 of_machine_is_compatible("lacie,netspace_mini_v2") ||
147 of_machine_is_compatible("lacie,netspace_v2"))
147 ns2_init(); 148 ns2_init();
148 149
149 if (of_machine_is_compatible("mpl,cec4")) 150 if (of_machine_is_compatible("mpl,cec4"))
150 mplcec4_init(); 151 mplcec4_init();
151 152
153 if (of_machine_is_compatible("netgear,readynas-duo-v2"))
154 netgear_readynas_init();
155
152 if (of_machine_is_compatible("plathome,openblocks-a6")) 156 if (of_machine_is_compatible("plathome,openblocks-a6"))
153 openblocks_a6_init(); 157 openblocks_a6_init();
154 158
@@ -171,12 +175,14 @@ static const char * const kirkwood_dt_board_compat[] = {
171 "buffalo,lsxl", 175 "buffalo,lsxl",
172 "iom,ix2-200", 176 "iom,ix2-200",
173 "keymile,km_kirkwood", 177 "keymile,km_kirkwood",
178 "lacie,cloudbox",
174 "lacie,inetspace_v2", 179 "lacie,inetspace_v2",
175 "lacie,netspace_max_v2",
176 "lacie,netspace_v2",
177 "lacie,netspace_lite_v2", 180 "lacie,netspace_lite_v2",
181 "lacie,netspace_max_v2",
178 "lacie,netspace_mini_v2", 182 "lacie,netspace_mini_v2",
183 "lacie,netspace_v2",
179 "mpl,cec4", 184 "mpl,cec4",
185 "netgear,readynas-duo-v2",
180 "plathome,openblocks-a6", 186 "plathome,openblocks-a6",
181 "usi,topkick", 187 "usi,topkick",
182 "zyxel,nsa310", 188 "zyxel,nsa310",
diff --git a/arch/arm/mach-kirkwood/board-guruplug.c b/arch/arm/mach-kirkwood/board-guruplug.c
index 0a0df4554d8b..a857163954a5 100644
--- a/arch/arm/mach-kirkwood/board-guruplug.c
+++ b/arch/arm/mach-kirkwood/board-guruplug.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/mv643xx_eth.h> 14#include <linux/mv643xx_eth.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/platform_data/mmc-mvsdio.h>
17#include "common.h" 16#include "common.h"
18 17
19static struct mv643xx_eth_platform_data guruplug_ge00_data = { 18static struct mv643xx_eth_platform_data guruplug_ge00_data = {
@@ -24,10 +23,6 @@ static struct mv643xx_eth_platform_data guruplug_ge01_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(1), 23 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
25}; 24};
26 25
27static struct mvsdio_platform_data guruplug_mvsdio_data = {
28 /* unfortunately the CD signal has not been connected */
29};
30
31void __init guruplug_dt_init(void) 26void __init guruplug_dt_init(void)
32{ 27{
33 /* 28 /*
@@ -35,5 +30,4 @@ void __init guruplug_dt_init(void)
35 */ 30 */
36 kirkwood_ge00_init(&guruplug_ge00_data); 31 kirkwood_ge00_init(&guruplug_ge00_data);
37 kirkwood_ge01_init(&guruplug_ge01_data); 32 kirkwood_ge01_init(&guruplug_ge01_data);
38 kirkwood_sdio_init(&guruplug_mvsdio_data);
39} 33}
diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
index f2ea3b7ad726..f8f660525ace 100644
--- a/arch/arm/mach-kirkwood/board-ns2.c
+++ b/arch/arm/mach-kirkwood/board-ns2.c
@@ -27,7 +27,8 @@ void __init ns2_init(void)
27 /* 27 /*
28 * Basic setup. Needs to be called early. 28 * Basic setup. Needs to be called early.
29 */ 29 */
30 if (of_machine_is_compatible("lacie,netspace_lite_v2") || 30 if (of_machine_is_compatible("lacie,cloudbox") ||
31 of_machine_is_compatible("lacie,netspace_lite_v2") ||
31 of_machine_is_compatible("lacie,netspace_mini_v2")) 32 of_machine_is_compatible("lacie,netspace_mini_v2"))
32 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); 33 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
33 kirkwood_ge00_init(&ns2_ge00_data); 34 kirkwood_ge00_init(&ns2_ge00_data);
diff --git a/arch/arm/mach-kirkwood/board-readynas.c b/arch/arm/mach-kirkwood/board-readynas.c
new file mode 100644
index 000000000000..fb42c20e273f
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-readynas.c
@@ -0,0 +1,28 @@
1/*
2 * NETGEAR ReadyNAS Duo v2 Board setup for drivers not already
3 * converted to DT.
4 *
5 * Copyright (C) 2013, Arnaud EBALARD <arno@natisbad.org>
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
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mv643xx_eth.h>
17#include <mach/kirkwood.h>
18#include "common.h"
19
20static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = {
21 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
22};
23
24void __init netgear_readynas_init(void)
25{
26 kirkwood_ge00_init(&netgear_readynas_ge00_data);
27 kirkwood_pcie_init(KW_PCIE0);
28}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 5ed70565c843..3147be2f34da 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -141,12 +141,24 @@ void openblocks_a6_init(void);
141static inline void openblocks_a6_init(void) {}; 141static inline void openblocks_a6_init(void) {};
142#endif 142#endif
143 143
144#ifdef CONFIG_MACH_READYNAS_DT
145void netgear_readynas_init(void);
146#else
147static inline void netgear_readynas_init(void) {};
148#endif
149
144#ifdef CONFIG_MACH_TOPKICK_DT 150#ifdef CONFIG_MACH_TOPKICK_DT
145void usi_topkick_init(void); 151void usi_topkick_init(void);
146#else 152#else
147static inline void usi_topkick_init(void) {}; 153static inline void usi_topkick_init(void) {};
148#endif 154#endif
149 155
156#ifdef CONFIG_MACH_CLOUDBOX_DT
157void cloudbox_init(void);
158#else
159static inline void cloudbox_init(void) {};
160#endif
161
150/* early init functions not converted to fdt yet */ 162/* early init functions not converted to fdt yet */
151char *kirkwood_id(void); 163char *kirkwood_id(void);
152void kirkwood_l2_init(void); 164void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-l7200/include/mach/debug-macro.S b/arch/arm/mach-l7200/include/mach/debug-macro.S
deleted file mode 100644
index 0b4e760159b9..000000000000
--- a/arch/arm/mach-l7200/include/mach/debug-macro.S
+++ /dev/null
@@ -1,38 +0,0 @@
1/* arch/arm/mach-l7200/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .equ io_virt, IO_BASE
15 .equ io_phys, IO_START
16
17 .macro addruart, rp, rv, tmp
18 mov \rp, #0x00044000 @ UART1
19@ mov \rp, #0x00045000 @ UART2
20 add \rv, \rp, #io_virt @ virtual address
21 add \rp, \rp, #io_phys @ physical base address
22 .endm
23
24 .macro senduart,rd,rx
25 str \rd, [\rx, #0x0] @ UARTDR
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #0x18] @ UARTFLG
30 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
31 bne 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #0x18] @ UARTFLG
36 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
37 bne 1001b
38 .endm
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 9f64d5632e07..5b660ec09ef5 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -9,6 +9,7 @@
9 * publishhed by the Free Software Foundation. 9 * publishhed by the Free Software Foundation.
10 */ 10 */
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/gpio-pxa.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -110,6 +111,10 @@ static unsigned long common_pin_config[] __initdata = {
110 GPIO121_KP_MKIN4, 111 GPIO121_KP_MKIN4,
111}; 112};
112 113
114static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
115 .irq_base = MMP_GPIO_TO_IRQ(0),
116};
117
113static struct smc91x_platdata smc91x_info = { 118static struct smc91x_platdata smc91x_info = {
114 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 119 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
115}; 120};
@@ -223,13 +228,7 @@ static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
223}; 228};
224 229
225#if defined(CONFIG_USB_EHCI_MV) 230#if defined(CONFIG_USB_EHCI_MV)
226static char *pxa168_sph_clock_name[] = {
227 [0] = "PXA168-USBCLK",
228};
229
230static struct mv_usb_platform_data pxa168_sph_pdata = { 231static struct mv_usb_platform_data pxa168_sph_pdata = {
231 .clknum = 1,
232 .clkname = pxa168_sph_clock_name,
233 .mode = MV_USB_MODE_HOST, 232 .mode = MV_USB_MODE_HOST,
234 .phy_init = pxa_usb_phy_init, 233 .phy_init = pxa_usb_phy_init,
235 .phy_deinit = pxa_usb_phy_deinit, 234 .phy_deinit = pxa_usb_phy_deinit,
@@ -248,6 +247,8 @@ static void __init common_init(void)
248 pxa168_add_nand(&aspenite_nand_info); 247 pxa168_add_nand(&aspenite_nand_info);
249 pxa168_add_fb(&aspenite_lcd_info); 248 pxa168_add_fb(&aspenite_lcd_info);
250 pxa168_add_keypad(&aspenite_keypad_info); 249 pxa168_add_keypad(&aspenite_keypad_info);
250 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
251 sizeof(struct pxa_gpio_platform_data));
251 platform_device_register(&pxa168_device_gpio); 252 platform_device_register(&pxa168_device_gpio);
252 253
253 /* off-chip devices */ 254 /* off-chip devices */
diff --git a/arch/arm/mach-mmp/avengers_lite.c b/arch/arm/mach-mmp/avengers_lite.c
index 1f94957b56ae..a451a0f4d512 100644
--- a/arch/arm/mach-mmp/avengers_lite.c
+++ b/arch/arm/mach-mmp/avengers_lite.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/gpio-pxa.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
@@ -32,12 +33,18 @@ static unsigned long avengers_lite_pin_config_V16F[] __initdata = {
32 GPIO89_UART2_RXD, 33 GPIO89_UART2_RXD,
33}; 34};
34 35
36static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
37 .irq_base = MMP_GPIO_TO_IRQ(0),
38};
39
35static void __init avengers_lite_init(void) 40static void __init avengers_lite_init(void)
36{ 41{
37 mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F)); 42 mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F));
38 43
39 /* on-chip devices */ 44 /* on-chip devices */
40 pxa168_add_uart(2); 45 pxa168_add_uart(2);
46 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
47 sizeof(struct pxa_gpio_platform_data));
41 platform_device_register(&pxa168_device_gpio); 48 platform_device_register(&pxa168_device_gpio);
42} 49}
43 50
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index 2358011c7d8e..ac25544b8cdb 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/gpio-pxa.h>
17#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
18#include <linux/regulator/max8649.h> 19#include <linux/regulator/max8649.h>
19#include <linux/regulator/fixed.h> 20#include <linux/regulator/fixed.h>
@@ -104,6 +105,10 @@ static unsigned long brownstone_pin_config[] __initdata = {
104 GPIO89_GPIO, 105 GPIO89_GPIO,
105}; 106};
106 107
108static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
109 .irq_base = MMP_GPIO_TO_IRQ(0),
110};
111
107static struct regulator_consumer_supply max8649_supply[] = { 112static struct regulator_consumer_supply max8649_supply[] = {
108 REGULATOR_SUPPLY("vcc_core", NULL), 113 REGULATOR_SUPPLY("vcc_core", NULL),
109}; 114};
@@ -202,6 +207,8 @@ static void __init brownstone_init(void)
202 /* on-chip devices */ 207 /* on-chip devices */
203 mmp2_add_uart(1); 208 mmp2_add_uart(1);
204 mmp2_add_uart(3); 209 mmp2_add_uart(3);
210 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
211 sizeof(struct pxa_gpio_platform_data));
205 platform_device_register(&mmp2_device_gpio); 212 platform_device_register(&mmp2_device_gpio);
206 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); 213 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
207 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 214 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
diff --git a/arch/arm/mach-mmp/clock-mmp2.c b/arch/arm/mach-mmp/clock-mmp2.c
index 21d22002cd19..53d77cbd6000 100644
--- a/arch/arm/mach-mmp/clock-mmp2.c
+++ b/arch/arm/mach-mmp/clock-mmp2.c
@@ -98,7 +98,7 @@ static struct clk_lookup mmp2_clkregs[] = {
98 INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL), 98 INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
99 INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL), 99 INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
100 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 100 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
101 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 101 INIT_CLKREG(&clk_gpio, "mmp2-gpio", NULL),
102 INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"), 102 INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"),
103 INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"), 103 INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"),
104 INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"), 104 INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"),
diff --git a/arch/arm/mach-mmp/clock-pxa168.c b/arch/arm/mach-mmp/clock-pxa168.c
index 5e6c18ccebd4..c572f219ae26 100644
--- a/arch/arm/mach-mmp/clock-pxa168.c
+++ b/arch/arm/mach-mmp/clock-pxa168.c
@@ -78,7 +78,7 @@ static struct clk_lookup pxa168_clkregs[] = {
78 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL), 78 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
79 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 79 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
80 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), 80 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
81 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 81 INIT_CLKREG(&clk_gpio, "mmp-gpio", NULL),
82 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 82 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
83 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 83 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
84 INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"), 84 INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"),
diff --git a/arch/arm/mach-mmp/clock-pxa910.c b/arch/arm/mach-mmp/clock-pxa910.c
index 933ea71d0b56..379e1df61c70 100644
--- a/arch/arm/mach-mmp/clock-pxa910.c
+++ b/arch/arm/mach-mmp/clock-pxa910.c
@@ -56,7 +56,7 @@ static struct clk_lookup pxa910_clkregs[] = {
56 INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL), 56 INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
57 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), 57 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
58 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 58 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
59 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 59 INIT_CLKREG(&clk_gpio, "mmp-gpio", NULL),
60 INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"), 60 INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"),
61 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 61 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
62}; 62};
diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
index 754c352dd02b..6291c33d83e2 100644
--- a/arch/arm/mach-mmp/flint.c
+++ b/arch/arm/mach-mmp/flint.c
@@ -16,6 +16,7 @@
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/gpio-pxa.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
@@ -77,6 +78,10 @@ static unsigned long flint_pin_config[] __initdata = {
77 GPIO160_ND_RDY1, 78 GPIO160_ND_RDY1,
78}; 79};
79 80
81static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
82 .irq_base = MMP_GPIO_TO_IRQ(0),
83};
84
80static struct smc91x_platdata flint_smc91x_info = { 85static struct smc91x_platdata flint_smc91x_info = {
81 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 86 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
82}; 87};
@@ -111,6 +116,8 @@ static void __init flint_init(void)
111 /* on-chip devices */ 116 /* on-chip devices */
112 mmp2_add_uart(1); 117 mmp2_add_uart(1);
113 mmp2_add_uart(2); 118 mmp2_add_uart(2);
119 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
120 sizeof(struct pxa_gpio_platform_data));
114 platform_device_register(&mmp2_device_gpio); 121 platform_device_register(&mmp2_device_gpio);
115 122
116 /* off-chip devices */ 123 /* off-chip devices */
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index f62b68d926f4..d81b2475e67e 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <linux/gpio-pxa.h>
14 15
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
16#include <asm/mach-types.h> 17#include <asm/mach-types.h>
@@ -128,6 +129,10 @@ static unsigned long gplugd_pin_config[] __initdata = {
128 GPIO116_I2S_TXD 129 GPIO116_I2S_TXD
129}; 130};
130 131
132static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
133 .irq_base = MMP_GPIO_TO_IRQ(0),
134};
135
131static struct i2c_board_info gplugd_i2c_board_info[] = { 136static struct i2c_board_info gplugd_i2c_board_info[] = {
132 { 137 {
133 .type = "isl1208", 138 .type = "isl1208",
@@ -186,6 +191,8 @@ static void __init gplugd_init(void)
186 pxa168_add_uart(3); 191 pxa168_add_uart(3);
187 pxa168_add_ssp(1); 192 pxa168_add_ssp(1);
188 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); 193 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
194 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
195 sizeof(struct pxa_gpio_platform_data));
189 platform_device_register(&pxa168_device_gpio); 196 platform_device_register(&pxa168_device_gpio);
190 197
191 pxa168_add_eth(&gplugd_eth_platform_data); 198 pxa168_add_eth(&gplugd_eth_platform_data);
diff --git a/arch/arm/mach-mmp/include/mach/debug-macro.S b/arch/arm/mach-mmp/include/mach/debug-macro.S
deleted file mode 100644
index 5c3cc29688ab..000000000000
--- a/arch/arm/mach-mmp/include/mach/debug-macro.S
+++ /dev/null
@@ -1,30 +0,0 @@
1/* arch/arm/mach-mmp/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copied from arch/arm/mach-pxa/include/mach/debug.S
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#if defined(CONFIG_DEBUG_MMP_UART2)
13#define MMP_UART_OFFSET 0x00017000
14#elif defined(CONFIG_DEBUG_MMP_UART3)
15#define MMP_UART_OFFSET 0x00018000
16#else
17#error "Select uart for DEBUG_LL"
18#endif
19
20#include <mach/addr-map.h>
21
22 .macro addruart, rp, rv, tmp
23 ldr \rp, =APB_PHYS_BASE @ physical
24 ldr \rv, =APB_VIRT_BASE @ virtual
25 orr \rp, \rp, #MMP_UART_OFFSET
26 orr \rv, \rv, #MMP_UART_OFFSET
27 .endm
28
29#define UART_SHIFT 2
30#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c
index 66634fd0ecb0..0e9e5c05b37c 100644
--- a/arch/arm/mach-mmp/jasper.c
+++ b/arch/arm/mach-mmp/jasper.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/gpio-pxa.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
@@ -99,6 +100,10 @@ static unsigned long jasper_pin_config[] __initdata = {
99 GPIO151_MMC3_CLK, 100 GPIO151_MMC3_CLK,
100}; 101};
101 102
103static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
104 .irq_base = MMP_GPIO_TO_IRQ(0),
105};
106
102static struct regulator_consumer_supply max8649_supply[] = { 107static struct regulator_consumer_supply max8649_supply[] = {
103 REGULATOR_SUPPLY("vcc_core", NULL), 108 REGULATOR_SUPPLY("vcc_core", NULL),
104}; 109};
@@ -165,6 +170,9 @@ static void __init jasper_init(void)
165 mmp2_add_uart(1); 170 mmp2_add_uart(1);
166 mmp2_add_uart(3); 171 mmp2_add_uart(3);
167 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info)); 172 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
173 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
174 sizeof(struct pxa_gpio_platform_data));
175 platform_device_register(&mmp2_device_gpio);
168 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 176 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
169 177
170 regulator_has_full_constraints(); 178 regulator_has_full_constraints();
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
index d063efa0a4f1..b37915dc4470 100644
--- a/arch/arm/mach-mmp/mmp-dt.c
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = {
28 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL), 28 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
29 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), 29 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
30 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL), 30 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
31 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), 31 OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
32 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), 32 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
33 {} 33 {}
34}; 34};
@@ -39,7 +39,7 @@ static const struct of_dev_auxdata pxa910_auxdata_lookup[] __initconst = {
39 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL), 39 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL),
40 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), 40 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
41 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL), 41 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL),
42 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), 42 OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
43 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), 43 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
44 {} 44 {}
45}; 45};
diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c
index fad431aa6e09..4ac256720f7d 100644
--- a/arch/arm/mach-mmp/mmp2-dt.c
+++ b/arch/arm/mach-mmp/mmp2-dt.c
@@ -31,7 +31,7 @@ static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = {
31 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL), 31 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL),
32 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), 32 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
33 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL), 33 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
34 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), 34 OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp2-gpio", NULL),
35 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), 35 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
36 {} 36 {}
37}; 37};
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index d94d114eef7b..c7592f168bbd 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -164,7 +164,7 @@ struct resource mmp2_resource_gpio[] = {
164}; 164};
165 165
166struct platform_device mmp2_device_gpio = { 166struct platform_device mmp2_device_gpio = {
167 .name = "pxa-gpio", 167 .name = "mmp2-gpio",
168 .id = -1, 168 .id = -1,
169 .num_resources = ARRAY_SIZE(mmp2_resource_gpio), 169 .num_resources = ARRAY_SIZE(mmp2_resource_gpio),
170 .resource = mmp2_resource_gpio, 170 .resource = mmp2_resource_gpio,
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 9bc7b86a86a7..a30dcf3b7d9e 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -125,7 +125,7 @@ struct resource pxa168_resource_gpio[] = {
125}; 125};
126 126
127struct platform_device pxa168_device_gpio = { 127struct platform_device pxa168_device_gpio = {
128 .name = "pxa-gpio", 128 .name = "mmp-gpio",
129 .id = -1, 129 .id = -1,
130 .num_resources = ARRAY_SIZE(pxa168_resource_gpio), 130 .num_resources = ARRAY_SIZE(pxa168_resource_gpio),
131 .resource = pxa168_resource_gpio, 131 .resource = pxa168_resource_gpio,
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 36cb321a3d70..ce6393acad86 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -152,7 +152,7 @@ struct resource pxa910_resource_gpio[] = {
152}; 152};
153 153
154struct platform_device pxa910_device_gpio = { 154struct platform_device pxa910_device_gpio = {
155 .name = "pxa-gpio", 155 .name = "mmp-gpio",
156 .id = -1, 156 .id = -1,
157 .num_resources = ARRAY_SIZE(pxa910_resource_gpio), 157 .num_resources = ARRAY_SIZE(pxa910_resource_gpio),
158 .resource = pxa910_resource_gpio, 158 .resource = pxa910_resource_gpio,
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index 4c127d23955d..cdfc9bfee1a4 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -8,6 +8,7 @@
8 * publishhed by the Free Software Foundation. 8 * publishhed by the Free Software Foundation.
9 */ 9 */
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/gpio-pxa.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -60,6 +61,10 @@ static unsigned long tavorevb_pin_config[] __initdata = {
60 DF_RDY0_DF_RDY0, 61 DF_RDY0_DF_RDY0,
61}; 62};
62 63
64static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
65 .irq_base = MMP_GPIO_TO_IRQ(0),
66};
67
63static struct smc91x_platdata tavorevb_smc91x_info = { 68static struct smc91x_platdata tavorevb_smc91x_info = {
64 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 69 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
65}; 70};
@@ -93,6 +98,8 @@ static void __init tavorevb_init(void)
93 98
94 /* on-chip devices */ 99 /* on-chip devices */
95 pxa910_add_uart(1); 100 pxa910_add_uart(1);
101 platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
102 sizeof(struct pxa_gpio_platform_data));
96 platform_device_register(&pxa910_device_gpio); 103 platform_device_register(&pxa910_device_gpio);
97 104
98 /* off-chip devices */ 105 /* off-chip devices */
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index 8609967975ed..e4d95b4c6bb2 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -16,6 +16,7 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/gpio-pxa.h>
19#include <linux/input.h> 20#include <linux/input.h>
20#include <linux/platform_data/keypad-pxa27x.h> 21#include <linux/platform_data/keypad-pxa27x.h>
21#include <linux/i2c.h> 22#include <linux/i2c.h>
@@ -49,6 +50,10 @@ static unsigned long teton_bga_pin_config[] __initdata = {
49 GPIO78_GPIO, 50 GPIO78_GPIO,
50}; 51};
51 52
53static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
54 .irq_base = MMP_GPIO_TO_IRQ(0),
55};
56
52static unsigned int teton_bga_matrix_key_map[] = { 57static unsigned int teton_bga_matrix_key_map[] = {
53 KEY(0, 6, KEY_ESC), 58 KEY(0, 6, KEY_ESC),
54 KEY(0, 7, KEY_ENTER), 59 KEY(0, 7, KEY_ENTER),
@@ -79,6 +84,8 @@ static void __init teton_bga_init(void)
79 pxa168_add_uart(1); 84 pxa168_add_uart(1);
80 pxa168_add_keypad(&teton_bga_keypad_info); 85 pxa168_add_keypad(&teton_bga_keypad_info);
81 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info)); 86 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
87 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
88 sizeof(struct pxa_gpio_platform_data));
82 platform_device_register(&pxa168_device_gpio); 89 platform_device_register(&pxa168_device_gpio);
83} 90}
84 91
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 22a9058f9f4d..8483906d4308 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -17,6 +17,7 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/i2c/pca953x.h> 18#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/gpio-pxa.h>
20#include <linux/mfd/88pm860x.h> 21#include <linux/mfd/88pm860x.h>
21#include <linux/platform_data/mv_usb.h> 22#include <linux/platform_data/mv_usb.h>
22#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
@@ -75,6 +76,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
75 DF_RDY0_DF_RDY0, 76 DF_RDY0_DF_RDY0,
76}; 77};
77 78
79static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
80 .irq_base = MMP_GPIO_TO_IRQ(0),
81};
82
78static struct mtd_partition ttc_dkb_onenand_partitions[] = { 83static struct mtd_partition ttc_dkb_onenand_partitions[] = {
79 { 84 {
80 .name = "bootloader", 85 .name = "bootloader",
@@ -162,13 +167,7 @@ static struct i2c_board_info ttc_dkb_i2c_info[] = {
162#ifdef CONFIG_USB_SUPPORT 167#ifdef CONFIG_USB_SUPPORT
163#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O) 168#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O)
164 169
165static char *pxa910_usb_clock_name[] = {
166 [0] = "U2OCLK",
167};
168
169static struct mv_usb_platform_data ttc_usb_pdata = { 170static struct mv_usb_platform_data ttc_usb_pdata = {
170 .clknum = 1,
171 .clkname = pxa910_usb_clock_name,
172 .vbus = NULL, 171 .vbus = NULL,
173 .mode = MV_USB_MODE_OTG, 172 .mode = MV_USB_MODE_OTG,
174 .otg_force_a_bus_req = 1, 173 .otg_force_a_bus_req = 1,
@@ -284,6 +283,8 @@ static void __init ttc_dkb_init(void)
284 283
285 /* off-chip devices */ 284 /* off-chip devices */
286 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); 285 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
286 platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
287 sizeof(struct pxa_gpio_platform_data));
287 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); 288 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
288 289
289#ifdef CONFIG_USB_MV_UDC 290#ifdef CONFIG_USB_MV_UDC
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index b61908594b47..fceb093b9494 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -44,10 +44,10 @@ endchoice
44 44
45config ARCH_MSM8X60 45config ARCH_MSM8X60
46 bool "MSM8X60" 46 bool "MSM8X60"
47 select ARCH_MSM_SCORPIONMP
48 select ARM_GIC 47 select ARM_GIC
49 select CPU_V7 48 select CPU_V7
50 select GPIO_MSM_V2 49 select GPIO_MSM_V2
50 select HAVE_SMP
51 select MSM_GPIOMUX 51 select MSM_GPIOMUX
52 select MSM_SCM if SMP 52 select MSM_SCM if SMP
53 select MSM_V2_TLMM 53 select MSM_V2_TLMM
@@ -55,9 +55,9 @@ config ARCH_MSM8X60
55 55
56config ARCH_MSM8960 56config ARCH_MSM8960
57 bool "MSM8960" 57 bool "MSM8960"
58 select ARCH_MSM_SCORPIONMP
59 select ARM_GIC 58 select ARM_GIC
60 select CPU_V7 59 select CPU_V7
60 select HAVE_SMP
61 select MSM_GPIOMUX 61 select MSM_GPIOMUX
62 select MSM_SCM if SMP 62 select MSM_SCM if SMP
63 select MSM_V2_TLMM 63 select MSM_V2_TLMM
@@ -68,9 +68,6 @@ config MSM_HAS_DEBUG_UART_HS
68 68
69config MSM_SOC_REV_A 69config MSM_SOC_REV_A
70 bool 70 bool
71config ARCH_MSM_SCORPIONMP
72 bool
73 select HAVE_SMP
74 71
75config ARCH_MSM_ARM11 72config ARCH_MSM_ARM11
76 bool 73 bool
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 84d720af34ab..82eaf88d2026 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = {
59}; 59};
60 60
61static struct platform_device *devices[] __initdata = { 61static struct platform_device *devices[] __initdata = {
62 &msm_device_gpio_7201,
62 &msm_device_uart3, 63 &msm_device_uart3,
63 &msm_device_smd, 64 &msm_device_smd,
64 &msm_device_nand, 65 &msm_device_nand,
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 7bc3f82e3ec9..520c141acd03 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
89}; 89};
90 90
91static struct platform_device *devices[] __initdata = { 91static struct platform_device *devices[] __initdata = {
92 &msm_device_gpio_7x30,
92#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) 93#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
93 &msm_device_uart2, 94 &msm_device_uart2,
94#endif 95#endif
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 686e7949a73a..38a532d6937c 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = {
89}; 89};
90 90
91static struct platform_device *devices[] __initdata = { 91static struct platform_device *devices[] __initdata = {
92 &msm_device_gpio_8x50,
92 &msm_device_uart3, 93 &msm_device_uart3,
93 &msm_device_smd, 94 &msm_device_smd,
94 &msm_device_otg, 95 &msm_device_otg,
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 919bfa32871a..80fe1c5ff5c1 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -36,6 +36,7 @@
36extern int trout_init_mmc(unsigned int); 36extern int trout_init_mmc(unsigned int);
37 37
38static struct platform_device *devices[] __initdata = { 38static struct platform_device *devices[] __initdata = {
39 &msm_device_gpio_7201,
39 &msm_device_uart3, 40 &msm_device_uart3,
40 &msm_device_smd, 41 &msm_device_smd,
41 &msm_device_nand, 42 &msm_device_nand,
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index f66ee6ea8720..1a0a2306b115 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -29,6 +29,37 @@
29#include "clock-pcom.h" 29#include "clock-pcom.h"
30#include <linux/platform_data/mmc-msm_sdcc.h> 30#include <linux/platform_data/mmc-msm_sdcc.h>
31 31
32static struct resource msm_gpio_resources[] = {
33 {
34 .start = 32 + 0,
35 .end = 32 + 0,
36 .flags = IORESOURCE_IRQ,
37 },
38 {
39 .start = 32 + 1,
40 .end = 32 + 1,
41 .flags = IORESOURCE_IRQ,
42 },
43 {
44 .start = 0xa9200800,
45 .end = 0xa9200800 + SZ_4K - 1,
46 .flags = IORESOURCE_MEM,
47 .name = "gpio1"
48 },
49 {
50 .start = 0xa9300C00,
51 .end = 0xa9300C00 + SZ_4K - 1,
52 .flags = IORESOURCE_MEM,
53 .name = "gpio2"
54 },
55};
56
57struct platform_device msm_device_gpio_7201 = {
58 .name = "gpio-msm-7201",
59 .num_resources = ARRAY_SIZE(msm_gpio_resources),
60 .resource = msm_gpio_resources,
61};
62
32static struct resource resources_uart1[] = { 63static struct resource resources_uart1[] = {
33 { 64 {
34 .start = INT_UART1, 65 .start = INT_UART1,
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index e90ab5938c5f..12f482c07740 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -33,6 +33,37 @@
33 33
34#include <linux/platform_data/mmc-msm_sdcc.h> 34#include <linux/platform_data/mmc-msm_sdcc.h>
35 35
36static struct resource msm_gpio_resources[] = {
37 {
38 .start = 32 + 18,
39 .end = 32 + 18,
40 .flags = IORESOURCE_IRQ,
41 },
42 {
43 .start = 32 + 19,
44 .end = 32 + 19,
45 .flags = IORESOURCE_IRQ,
46 },
47 {
48 .start = 0xac001000,
49 .end = 0xac001000 + SZ_4K - 1,
50 .flags = IORESOURCE_MEM,
51 .name = "gpio1"
52 },
53 {
54 .start = 0xac101400,
55 .end = 0xac101400 + SZ_4K - 1,
56 .flags = IORESOURCE_MEM,
57 .name = "gpio2"
58 },
59};
60
61struct platform_device msm_device_gpio_7x30 = {
62 .name = "gpio-msm-7x30",
63 .num_resources = ARRAY_SIZE(msm_gpio_resources),
64 .resource = msm_gpio_resources,
65};
66
36static struct resource resources_uart2[] = { 67static struct resource resources_uart2[] = {
37 { 68 {
38 .start = INT_UART2, 69 .start = INT_UART2,
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 4db61d5fe317..2e1b3ec9dfc7 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -30,6 +30,37 @@
30#include <linux/platform_data/mmc-msm_sdcc.h> 30#include <linux/platform_data/mmc-msm_sdcc.h>
31#include "clock-pcom.h" 31#include "clock-pcom.h"
32 32
33static struct resource msm_gpio_resources[] = {
34 {
35 .start = 64 + 165 + 9,
36 .end = 64 + 165 + 9,
37 .flags = IORESOURCE_IRQ,
38 },
39 {
40 .start = 64 + 165 + 10,
41 .end = 64 + 165 + 10,
42 .flags = IORESOURCE_IRQ,
43 },
44 {
45 .start = 0xa9000800,
46 .end = 0xa9000800 + SZ_4K - 1,
47 .flags = IORESOURCE_MEM,
48 .name = "gpio1"
49 },
50 {
51 .start = 0xa9100C00,
52 .end = 0xa9100C00 + SZ_4K - 1,
53 .flags = IORESOURCE_MEM,
54 .name = "gpio2"
55 },
56};
57
58struct platform_device msm_device_gpio_8x50 = {
59 .name = "gpio-msm-8x50",
60 .num_resources = ARRAY_SIZE(msm_gpio_resources),
61 .resource = msm_gpio_resources,
62};
63
33static struct resource resources_uart3[] = { 64static struct resource resources_uart3[] = {
34 { 65 {
35 .start = INT_UART3, 66 .start = INT_UART3,
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index 9545c196c6e8..da902cf51161 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -20,6 +20,10 @@
20 20
21#include "clock.h" 21#include "clock.h"
22 22
23extern struct platform_device msm_device_gpio_7201;
24extern struct platform_device msm_device_gpio_7x30;
25extern struct platform_device msm_device_gpio_8x50;
26
23extern struct platform_device msm_device_uart1; 27extern struct platform_device msm_device_uart1;
24extern struct platform_device msm_device_uart2; 28extern struct platform_device msm_device_uart2;
25extern struct platform_device msm_device_uart3; 29extern struct platform_device msm_device_uart3;
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
index 354b91d4c3ac..b279fd8a31b1 100644
--- a/arch/arm/mach-msm/dma.c
+++ b/arch/arm/mach-msm/dma.c
@@ -19,9 +19,35 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/completion.h> 20#include <linux/completion.h>
21#include <mach/dma.h> 21#include <mach/dma.h>
22#include <mach/msm_iomap.h>
22 23
23#define MSM_DMOV_CHANNEL_COUNT 16 24#define MSM_DMOV_CHANNEL_COUNT 16
24 25
26#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
27#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
28#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
29#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
30
31#if defined(CONFIG_ARCH_MSM7X30)
32#define DMOV_SD_AARM DMOV_SD2
33#else
34#define DMOV_SD_AARM DMOV_SD3
35#endif
36
37#define DMOV_CMD_PTR(ch) DMOV_SD_AARM(0x000, ch)
38#define DMOV_RSLT(ch) DMOV_SD_AARM(0x040, ch)
39#define DMOV_FLUSH0(ch) DMOV_SD_AARM(0x080, ch)
40#define DMOV_FLUSH1(ch) DMOV_SD_AARM(0x0C0, ch)
41#define DMOV_FLUSH2(ch) DMOV_SD_AARM(0x100, ch)
42#define DMOV_FLUSH3(ch) DMOV_SD_AARM(0x140, ch)
43#define DMOV_FLUSH4(ch) DMOV_SD_AARM(0x180, ch)
44#define DMOV_FLUSH5(ch) DMOV_SD_AARM(0x1C0, ch)
45
46#define DMOV_STATUS(ch) DMOV_SD_AARM(0x200, ch)
47#define DMOV_ISR DMOV_SD_AARM(0x380, 0)
48
49#define DMOV_CONFIG(ch) DMOV_SD_AARM(0x300, ch)
50
25enum { 51enum {
26 MSM_DMOV_PRINT_ERRORS = 1, 52 MSM_DMOV_PRINT_ERRORS = 1,
27 MSM_DMOV_PRINT_IO = 2, 53 MSM_DMOV_PRINT_IO = 2,
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index 750446feb444..326a87261f9a 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -10,16 +10,12 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/smp.h> 11#include <linux/smp.h>
12 12
13#include <asm/cacheflush.h>
14#include <asm/smp_plat.h> 13#include <asm/smp_plat.h>
15 14
16#include "common.h" 15#include "common.h"
17 16
18static inline void cpu_enter_lowpower(void) 17static inline void cpu_enter_lowpower(void)
19{ 18{
20 /* Just flush the cache. Changing the coherency is not yet
21 * available on msm. */
22 flush_cache_all();
23} 19}
24 20
25static inline void cpu_leave_lowpower(void) 21static inline void cpu_leave_lowpower(void)
diff --git a/arch/arm/mach-msm/include/mach/cpu.h b/arch/arm/mach-msm/include/mach/cpu.h
deleted file mode 100644
index a9481b08d5c7..000000000000
--- a/arch/arm/mach-msm/include/mach/cpu.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#ifndef __ARCH_ARM_MACH_MSM_CPU_H__
19#define __ARCH_ARM_MACH_MSM_CPU_H__
20
21/* TODO: For now, only one CPU can be compiled at a time. */
22
23#define cpu_is_msm7x01() 0
24#define cpu_is_msm7x30() 0
25#define cpu_is_qsd8x50() 0
26#define cpu_is_msm8x60() 0
27#define cpu_is_msm8960() 0
28
29#ifdef CONFIG_ARCH_MSM7X00A
30# undef cpu_is_msm7x01
31# define cpu_is_msm7x01() 1
32#endif
33
34#ifdef CONFIG_ARCH_MSM7X30
35# undef cpu_is_msm7x30
36# define cpu_is_msm7x30() 1
37#endif
38
39#ifdef CONFIG_ARCH_QSD8X50
40# undef cpu_is_qsd8x50
41# define cpu_is_qsd8x50() 1
42#endif
43
44#ifdef CONFIG_ARCH_MSM8X60
45# undef cpu_is_msm8x60
46# define cpu_is_msm8x60() 1
47#endif
48
49#ifdef CONFIG_ARCH_MSM8960
50# undef cpu_is_msm8960
51# define cpu_is_msm8960() 1
52#endif
53
54#endif
diff --git a/arch/arm/mach-msm/include/mach/dma.h b/arch/arm/mach-msm/include/mach/dma.h
index 05583f569524..a72d48d42342 100644
--- a/arch/arm/mach-msm/include/mach/dma.h
+++ b/arch/arm/mach-msm/include/mach/dma.h
@@ -16,7 +16,6 @@
16#ifndef __ASM_ARCH_MSM_DMA_H 16#ifndef __ASM_ARCH_MSM_DMA_H
17 17
18#include <linux/list.h> 18#include <linux/list.h>
19#include <mach/msm_iomap.h>
20 19
21struct msm_dmov_errdata { 20struct msm_dmov_errdata {
22 uint32_t flush[6]; 21 uint32_t flush[6];
@@ -45,48 +44,23 @@ static inline
45int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; } 44int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; }
46#endif 45#endif
47 46
48
49#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))
50#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))
51#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))
52#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))
53
54#if defined(CONFIG_ARCH_MSM7X30)
55#define DMOV_SD_AARM DMOV_SD2
56#else
57#define DMOV_SD_AARM DMOV_SD3
58#endif
59
60#define DMOV_CMD_PTR(ch) DMOV_SD_AARM(0x000, ch)
61#define DMOV_CMD_LIST (0 << 29) /* does not work */ 47#define DMOV_CMD_LIST (0 << 29) /* does not work */
62#define DMOV_CMD_PTR_LIST (1 << 29) /* works */ 48#define DMOV_CMD_PTR_LIST (1 << 29) /* works */
63#define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */ 49#define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */
64#define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */ 50#define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */
65#define DMOV_CMD_ADDR(addr) ((addr) >> 3) 51#define DMOV_CMD_ADDR(addr) ((addr) >> 3)
66 52
67#define DMOV_RSLT(ch) DMOV_SD_AARM(0x040, ch)
68#define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */ 53#define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */
69#define DMOV_RSLT_ERROR (1 << 3) 54#define DMOV_RSLT_ERROR (1 << 3)
70#define DMOV_RSLT_FLUSH (1 << 2) 55#define DMOV_RSLT_FLUSH (1 << 2)
71#define DMOV_RSLT_DONE (1 << 1) /* top pointer done */ 56#define DMOV_RSLT_DONE (1 << 1) /* top pointer done */
72#define DMOV_RSLT_USER (1 << 0) /* command with FR force result */ 57#define DMOV_RSLT_USER (1 << 0) /* command with FR force result */
73 58
74#define DMOV_FLUSH0(ch) DMOV_SD_AARM(0x080, ch)
75#define DMOV_FLUSH1(ch) DMOV_SD_AARM(0x0C0, ch)
76#define DMOV_FLUSH2(ch) DMOV_SD_AARM(0x100, ch)
77#define DMOV_FLUSH3(ch) DMOV_SD_AARM(0x140, ch)
78#define DMOV_FLUSH4(ch) DMOV_SD_AARM(0x180, ch)
79#define DMOV_FLUSH5(ch) DMOV_SD_AARM(0x1C0, ch)
80
81#define DMOV_STATUS(ch) DMOV_SD_AARM(0x200, ch)
82#define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29)) 59#define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29))
83#define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3) 60#define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3)
84#define DMOV_STATUS_RSLT_VALID (1 << 1) 61#define DMOV_STATUS_RSLT_VALID (1 << 1)
85#define DMOV_STATUS_CMD_PTR_RDY (1 << 0) 62#define DMOV_STATUS_CMD_PTR_RDY (1 << 0)
86 63
87#define DMOV_ISR DMOV_SD_AARM(0x380, 0)
88
89#define DMOV_CONFIG(ch) DMOV_SD_AARM(0x300, ch)
90#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2) 64#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)
91#define DMOV_CONFIG_FORCE_FLUSH_RSLT (1 << 1) 65#define DMOV_CONFIG_FORCE_FLUSH_RSLT (1 << 1)
92#define DMOV_CONFIG_IRQ_EN (1 << 0) 66#define DMOV_CONFIG_IRQ_EN (1 << 0)
diff --git a/arch/arm/mach-msm/include/mach/uncompress.h b/arch/arm/mach-msm/include/mach/uncompress.h
index fa97a10d8695..94324870fb04 100644
--- a/arch/arm/mach-msm/include/mach/uncompress.h
+++ b/arch/arm/mach-msm/include/mach/uncompress.h
@@ -37,7 +37,7 @@ static void putc(int c)
37 * Wait for TX_READY to be set; but skip it if we have a 37 * Wait for TX_READY to be set; but skip it if we have a
38 * TX underrun. 38 * TX underrun.
39 */ 39 */
40 if (UART_DM_SR & 0x08) 40 if (!(UART_DM_SR & 0x08))
41 while (!(UART_DM_ISR & 0x80)) 41 while (!(UART_DM_ISR & 0x80))
42 cpu_relax(); 42 cpu_relax();
43 43
diff --git a/arch/arm/mach-msm/last_radio_log.c b/arch/arm/mach-msm/last_radio_log.c
index 1e243f46a969..7777767ee89a 100644
--- a/arch/arm/mach-msm/last_radio_log.c
+++ b/arch/arm/mach-msm/last_radio_log.c
@@ -31,20 +31,8 @@ extern void *smem_item(unsigned id, unsigned *size);
31static ssize_t last_radio_log_read(struct file *file, char __user *buf, 31static ssize_t last_radio_log_read(struct file *file, char __user *buf,
32 size_t len, loff_t *offset) 32 size_t len, loff_t *offset)
33{ 33{
34 loff_t pos = *offset; 34 return simple_read_from_buffer(buf, len, offset,
35 ssize_t count; 35 radio_log_base, radio_log_size);
36
37 if (pos >= radio_log_size)
38 return 0;
39
40 count = min(len, (size_t)(radio_log_size - pos));
41 if (copy_to_user(buf, radio_log_base + pos, count)) {
42 pr_err("%s: copy to user failed\n", __func__);
43 return -EFAULT;
44 }
45
46 *offset += count;
47 return count;
48} 36}
49 37
50static struct file_operations last_radio_log_fops = { 38static struct file_operations last_radio_log_fops = {
@@ -67,7 +55,8 @@ void msm_init_last_radio_log(struct module *owner)
67 return; 55 return;
68 } 56 }
69 57
70 entry = create_proc_entry("last_radio_log", S_IFREG | S_IRUGO, NULL); 58 entry = proc_create("last_radio_log", S_IRUGO, NULL,
59 &last_radio_log_fops);
71 if (!entry) { 60 if (!entry) {
72 pr_err("%s: could not create proc entry for radio log\n", 61 pr_err("%s: could not create proc entry for radio log\n",
73 __func__); 62 __func__);
@@ -77,7 +66,6 @@ void msm_init_last_radio_log(struct module *owner)
77 pr_err("%s: last radio log is %d bytes long\n", __func__, 66 pr_err("%s: last radio log is %d bytes long\n", __func__,
78 radio_log_size); 67 radio_log_size);
79 last_radio_log_fops.owner = owner; 68 last_radio_log_fops.owner = owner;
80 entry->proc_fops = &last_radio_log_fops;
81 entry->size = radio_log_size; 69 entry->size = radio_log_size;
82} 70}
83EXPORT_SYMBOL(msm_init_last_radio_log); 71EXPORT_SYMBOL(msm_init_last_radio_log);
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index 42932865416a..00cdb0a5dac8 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -15,7 +15,6 @@
15#include <linux/jiffies.h> 15#include <linux/jiffies.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/irqchip/arm-gic.h>
19 18
20#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
21#include <asm/cputype.h> 20#include <asm/cputype.h>
@@ -42,13 +41,6 @@ static inline int get_core_count(void)
42static void __cpuinit msm_secondary_init(unsigned int cpu) 41static void __cpuinit msm_secondary_init(unsigned int cpu)
43{ 42{
44 /* 43 /*
45 * if any interrupts are already enabled for the primary
46 * core (e.g. timer irq), then they will not have been enabled
47 * for us: do so
48 */
49 gic_secondary_init(0);
50
51 /*
52 * let the primary processor know we're out of the 44 * let the primary processor know we're out of the
53 * pen, then head off into the C entry point 45 * pen, then head off into the C entry point
54 */ 46 */
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index f9fd77e8f1f5..284313f3e02c 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -30,19 +30,22 @@
30 30
31#include "common.h" 31#include "common.h"
32 32
33#define TIMER_MATCH_VAL 0x0000 33#define TIMER_MATCH_VAL 0x0000
34#define TIMER_COUNT_VAL 0x0004 34#define TIMER_COUNT_VAL 0x0004
35#define TIMER_ENABLE 0x0008 35#define TIMER_ENABLE 0x0008
36#define TIMER_ENABLE_CLR_ON_MATCH_EN BIT(1) 36#define TIMER_ENABLE_CLR_ON_MATCH_EN BIT(1)
37#define TIMER_ENABLE_EN BIT(0) 37#define TIMER_ENABLE_EN BIT(0)
38#define TIMER_CLEAR 0x000C 38#define TIMER_CLEAR 0x000C
39#define DGT_CLK_CTL_DIV_4 0x3 39#define DGT_CLK_CTL 0x10
40#define DGT_CLK_CTL_DIV_4 0x3
41#define TIMER_STS_GPT0_CLR_PEND BIT(10)
40 42
41#define GPT_HZ 32768 43#define GPT_HZ 32768
42 44
43#define MSM_DGT_SHIFT 5 45#define MSM_DGT_SHIFT 5
44 46
45static void __iomem *event_base; 47static void __iomem *event_base;
48static void __iomem *sts_base;
46 49
47static irqreturn_t msm_timer_interrupt(int irq, void *dev_id) 50static irqreturn_t msm_timer_interrupt(int irq, void *dev_id)
48{ 51{
@@ -67,6 +70,11 @@ static int msm_timer_set_next_event(unsigned long cycles,
67 70
68 writel_relaxed(ctrl, event_base + TIMER_CLEAR); 71 writel_relaxed(ctrl, event_base + TIMER_CLEAR);
69 writel_relaxed(cycles, event_base + TIMER_MATCH_VAL); 72 writel_relaxed(cycles, event_base + TIMER_MATCH_VAL);
73
74 if (sts_base)
75 while (readl_relaxed(sts_base) & TIMER_STS_GPT0_CLR_PEND)
76 cpu_relax();
77
70 writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE); 78 writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE);
71 return 0; 79 return 0;
72} 80}
@@ -137,9 +145,6 @@ static int __cpuinit msm_local_timer_setup(struct clock_event_device *evt)
137 if (!smp_processor_id()) 145 if (!smp_processor_id())
138 return 0; 146 return 0;
139 147
140 writel_relaxed(0, event_base + TIMER_ENABLE);
141 writel_relaxed(0, event_base + TIMER_CLEAR);
142 writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
143 evt->irq = msm_clockevent.irq; 148 evt->irq = msm_clockevent.irq;
144 evt->name = "local_timer"; 149 evt->name = "local_timer";
145 evt->features = msm_clockevent.features; 150 evt->features = msm_clockevent.features;
@@ -177,9 +182,6 @@ static void __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq,
177 struct clocksource *cs = &msm_clocksource; 182 struct clocksource *cs = &msm_clocksource;
178 int res; 183 int res;
179 184
180 writel_relaxed(0, event_base + TIMER_ENABLE);
181 writel_relaxed(0, event_base + TIMER_CLEAR);
182 writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
183 ce->cpumask = cpumask_of(0); 185 ce->cpumask = cpumask_of(0);
184 ce->irq = irq; 186 ce->irq = irq;
185 187
@@ -217,13 +219,9 @@ err:
217} 219}
218 220
219#ifdef CONFIG_OF 221#ifdef CONFIG_OF
220static const struct of_device_id msm_dgt_match[] __initconst = { 222static const struct of_device_id msm_timer_match[] __initconst = {
221 { .compatible = "qcom,msm-dgt" }, 223 { .compatible = "qcom,kpss-timer" },
222 { }, 224 { .compatible = "qcom,scss-timer" },
223};
224
225static const struct of_device_id msm_gpt_match[] __initconst = {
226 { .compatible = "qcom,msm-gpt" },
227 { }, 225 { },
228}; 226};
229 227
@@ -234,33 +232,29 @@ void __init msm_dt_timer_init(void)
234 int irq; 232 int irq;
235 struct resource res; 233 struct resource res;
236 u32 percpu_offset; 234 u32 percpu_offset;
237 void __iomem *dgt_clk_ctl; 235 void __iomem *base;
236 void __iomem *cpu0_base;
238 237
239 np = of_find_matching_node(NULL, msm_gpt_match); 238 np = of_find_matching_node(NULL, msm_timer_match);
240 if (!np) { 239 if (!np) {
241 pr_err("Can't find GPT DT node\n"); 240 pr_err("Can't find msm timer DT node\n");
242 return; 241 return;
243 } 242 }
244 243
245 event_base = of_iomap(np, 0); 244 base = of_iomap(np, 0);
246 if (!event_base) { 245 if (!base) {
247 pr_err("Failed to map event base\n"); 246 pr_err("Failed to map event base\n");
248 return; 247 return;
249 } 248 }
250 249
251 irq = irq_of_parse_and_map(np, 0); 250 /* We use GPT0 for the clockevent */
251 irq = irq_of_parse_and_map(np, 1);
252 if (irq <= 0) { 252 if (irq <= 0) {
253 pr_err("Can't get irq\n"); 253 pr_err("Can't get irq\n");
254 return; 254 return;
255 } 255 }
256 of_node_put(np);
257
258 np = of_find_matching_node(NULL, msm_dgt_match);
259 if (!np) {
260 pr_err("Can't find DGT DT node\n");
261 return;
262 }
263 256
257 /* We use CPU0's DGT for the clocksource */
264 if (of_property_read_u32(np, "cpu-offset", &percpu_offset)) 258 if (of_property_read_u32(np, "cpu-offset", &percpu_offset))
265 percpu_offset = 0; 259 percpu_offset = 0;
266 260
@@ -269,45 +263,43 @@ void __init msm_dt_timer_init(void)
269 return; 263 return;
270 } 264 }
271 265
272 source_base = ioremap(res.start + percpu_offset, resource_size(&res)); 266 cpu0_base = ioremap(res.start + percpu_offset, resource_size(&res));
273 if (!source_base) { 267 if (!cpu0_base) {
274 pr_err("Failed to map source base\n"); 268 pr_err("Failed to map source base\n");
275 return; 269 return;
276 } 270 }
277 271
278 if (!of_address_to_resource(np, 1, &res)) {
279 dgt_clk_ctl = ioremap(res.start + percpu_offset,
280 resource_size(&res));
281 if (!dgt_clk_ctl) {
282 pr_err("Failed to map DGT control base\n");
283 return;
284 }
285 writel_relaxed(DGT_CLK_CTL_DIV_4, dgt_clk_ctl);
286 iounmap(dgt_clk_ctl);
287 }
288
289 if (of_property_read_u32(np, "clock-frequency", &freq)) { 272 if (of_property_read_u32(np, "clock-frequency", &freq)) {
290 pr_err("Unknown frequency\n"); 273 pr_err("Unknown frequency\n");
291 return; 274 return;
292 } 275 }
293 of_node_put(np); 276 of_node_put(np);
294 277
278 event_base = base + 0x4;
279 sts_base = base + 0x88;
280 source_base = cpu0_base + 0x24;
281 freq /= 4;
282 writel_relaxed(DGT_CLK_CTL_DIV_4, source_base + DGT_CLK_CTL);
283
295 msm_timer_init(freq, 32, irq, !!percpu_offset); 284 msm_timer_init(freq, 32, irq, !!percpu_offset);
296} 285}
297#endif 286#endif
298 287
299static int __init msm_timer_map(phys_addr_t event, phys_addr_t source) 288static int __init msm_timer_map(phys_addr_t addr, u32 event, u32 source,
289 u32 sts)
300{ 290{
301 event_base = ioremap(event, SZ_64); 291 void __iomem *base;
302 if (!event_base) { 292
303 pr_err("Failed to map event base\n"); 293 base = ioremap(addr, SZ_256);
304 return 1; 294 if (!base) {
305 } 295 pr_err("Failed to map timer base\n");
306 source_base = ioremap(source, SZ_64); 296 return -ENOMEM;
307 if (!source_base) {
308 pr_err("Failed to map source base\n");
309 return 1;
310 } 297 }
298 event_base = base + event;
299 source_base = base + source;
300 if (sts)
301 sts_base = base + sts;
302
311 return 0; 303 return 0;
312} 304}
313 305
@@ -315,7 +307,7 @@ void __init msm7x01_timer_init(void)
315{ 307{
316 struct clocksource *cs = &msm_clocksource; 308 struct clocksource *cs = &msm_clocksource;
317 309
318 if (msm_timer_map(0xc0100000, 0xc0100010)) 310 if (msm_timer_map(0xc0100000, 0x0, 0x10, 0x0))
319 return; 311 return;
320 cs->read = msm_read_timer_count_shift; 312 cs->read = msm_read_timer_count_shift;
321 cs->mask = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT)); 313 cs->mask = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT));
@@ -326,14 +318,14 @@ void __init msm7x01_timer_init(void)
326 318
327void __init msm7x30_timer_init(void) 319void __init msm7x30_timer_init(void)
328{ 320{
329 if (msm_timer_map(0xc0100004, 0xc0100024)) 321 if (msm_timer_map(0xc0100000, 0x4, 0x24, 0x80))
330 return; 322 return;
331 msm_timer_init(24576000 / 4, 32, 1, false); 323 msm_timer_init(24576000 / 4, 32, 1, false);
332} 324}
333 325
334void __init qsd8x50_timer_init(void) 326void __init qsd8x50_timer_init(void)
335{ 327{
336 if (msm_timer_map(0xAC100000, 0xAC100010)) 328 if (msm_timer_map(0xAC100000, 0x0, 0x10, 0x34))
337 return; 329 return;
338 msm_timer_init(19200000 / 4, 32, 7, false); 330 msm_timer_init(19200000 / 4, 32, 7, false);
339} 331}
diff --git a/arch/arm/mach-mvebu/irq-armada-370-xp.c b/arch/arm/mach-mvebu/irq-armada-370-xp.c
index d5970f5a1e8d..830139a3e2ba 100644
--- a/arch/arm/mach-mvebu/irq-armada-370-xp.c
+++ b/arch/arm/mach-mvebu/irq-armada-370-xp.c
@@ -57,7 +57,7 @@ static struct irq_domain *armada_370_xp_mpic_domain;
57/* 57/*
58 * In SMP mode: 58 * In SMP mode:
59 * For shared global interrupts, mask/unmask global enable bit 59 * For shared global interrupts, mask/unmask global enable bit
60 * For CPU interrtups, mask/unmask the calling CPU's bit 60 * For CPU interrupts, mask/unmask the calling CPU's bit
61 */ 61 */
62static void armada_370_xp_irq_mask(struct irq_data *d) 62static void armada_370_xp_irq_mask(struct irq_data *d)
63{ 63{
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index ecc431909d6f..4dc2fbba0ecd 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -1,8 +1,7 @@
1if ARCH_MXS
2
3config SOC_IMX23 1config SOC_IMX23
4 bool 2 bool
5 select ARM_AMBA 3 select ARM_AMBA
4 select ARM_CPU_SUSPEND if PM
6 select CPU_ARM926T 5 select CPU_ARM926T
7 select HAVE_PWM 6 select HAVE_PWM
8 select PINCTRL_IMX23 7 select PINCTRL_IMX23
@@ -10,19 +9,24 @@ config SOC_IMX23
10config SOC_IMX28 9config SOC_IMX28
11 bool 10 bool
12 select ARM_AMBA 11 select ARM_AMBA
12 select ARM_CPU_SUSPEND if PM
13 select CPU_ARM926T 13 select CPU_ARM926T
14 select HAVE_CAN_FLEXCAN if CAN 14 select HAVE_CAN_FLEXCAN if CAN
15 select HAVE_PWM 15 select HAVE_PWM
16 select PINCTRL_IMX28 16 select PINCTRL_IMX28
17 17
18comment "MXS platforms:" 18config ARCH_MXS
19 19 bool "Freescale MXS (i.MX23, i.MX28) support"
20config MACH_MXS_DT 20 depends on ARCH_MULTI_V5
21 bool "Support MXS platforms from device tree" 21 select ARCH_REQUIRE_GPIOLIB
22 select CLKDEV_LOOKUP
23 select CLKSRC_MMIO
24 select CLKSRC_OF
25 select GENERIC_CLOCKEVENTS
26 select HAVE_CLK_PREPARE
27 select PINCTRL
22 select SOC_IMX23 28 select SOC_IMX23
23 select SOC_IMX28 29 select SOC_IMX28
30 select STMP_DEVICE
24 help 31 help
25 Include support for Freescale MXS platforms(i.MX23 and i.MX28) 32 Support for Freescale MXS-based family of processors
26 using the device tree for discovery
27
28endif
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index 3d3c8a973062..cc2bf6748ade 100644
--- a/arch/arm/mach-mxs/Makefile
+++ b/arch/arm/mach-mxs/Makefile
@@ -1,6 +1,2 @@
1# Common support
2obj-y := icoll.o ocotp.o system.o timer.o mm.o
3
4obj-$(CONFIG_PM) += pm.o 1obj-$(CONFIG_PM) += pm.o
5 2obj-$(CONFIG_ARCH_MXS) += mach-mxs.o
6obj-$(CONFIG_MACH_MXS_DT) += mach-mxs.o
diff --git a/arch/arm/mach-mxs/Makefile.boot b/arch/arm/mach-mxs/Makefile.boot
deleted file mode 100644
index 07b11fe6453f..000000000000
--- a/arch/arm/mach-mxs/Makefile.boot
+++ /dev/null
@@ -1 +0,0 @@
1zreladdr-y += 0x40008000
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c
deleted file mode 100644
index e26eeba46598..000000000000
--- a/arch/arm/mach-mxs/icoll.c
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/irq.h>
22#include <linux/irqdomain.h>
23#include <linux/io.h>
24#include <linux/of.h>
25#include <linux/of_irq.h>
26#include <asm/exception.h>
27#include <mach/mxs.h>
28#include <mach/common.h>
29
30#define HW_ICOLL_VECTOR 0x0000
31#define HW_ICOLL_LEVELACK 0x0010
32#define HW_ICOLL_CTRL 0x0020
33#define HW_ICOLL_STAT_OFFSET 0x0070
34#define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10)
35#define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10)
36#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004
37#define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1
38
39#define ICOLL_NUM_IRQS 128
40
41static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR);
42static struct irq_domain *icoll_domain;
43
44static void icoll_ack_irq(struct irq_data *d)
45{
46 /*
47 * The Interrupt Collector is able to prioritize irqs.
48 * Currently only level 0 is used. So acking can use
49 * BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally.
50 */
51 __raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0,
52 icoll_base + HW_ICOLL_LEVELACK);
53}
54
55static void icoll_mask_irq(struct irq_data *d)
56{
57 __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
58 icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq));
59}
60
61static void icoll_unmask_irq(struct irq_data *d)
62{
63 __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
64 icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq));
65}
66
67static struct irq_chip mxs_icoll_chip = {
68 .irq_ack = icoll_ack_irq,
69 .irq_mask = icoll_mask_irq,
70 .irq_unmask = icoll_unmask_irq,
71};
72
73asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs)
74{
75 u32 irqnr;
76
77 do {
78 irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET);
79 if (irqnr != 0x7f) {
80 __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR);
81 irqnr = irq_find_mapping(icoll_domain, irqnr);
82 handle_IRQ(irqnr, regs);
83 continue;
84 }
85 break;
86 } while (1);
87}
88
89static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq,
90 irq_hw_number_t hw)
91{
92 irq_set_chip_and_handler(virq, &mxs_icoll_chip, handle_level_irq);
93 set_irq_flags(virq, IRQF_VALID);
94
95 return 0;
96}
97
98static struct irq_domain_ops icoll_irq_domain_ops = {
99 .map = icoll_irq_domain_map,
100 .xlate = irq_domain_xlate_onecell,
101};
102
103static void __init icoll_of_init(struct device_node *np,
104 struct device_node *interrupt_parent)
105{
106 /*
107 * Interrupt Collector reset, which initializes the priority
108 * for each irq to level 0.
109 */
110 mxs_reset_block(icoll_base + HW_ICOLL_CTRL);
111
112 icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS,
113 &icoll_irq_domain_ops, NULL);
114 WARN_ON(!icoll_domain);
115}
116
117static const struct of_device_id icoll_of_match[] __initconst = {
118 {.compatible = "fsl,icoll", .data = icoll_of_init},
119 { /* sentinel */ }
120};
121
122void __init icoll_init_irq(void)
123{
124 of_irq_init(icoll_of_match);
125}
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
deleted file mode 100644
index be5a9c93cb2a..000000000000
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __MACH_MXS_COMMON_H__
12#define __MACH_MXS_COMMON_H__
13
14extern const u32 *mxs_get_ocotp(void);
15extern int mxs_reset_block(void __iomem *);
16extern void mxs_timer_init(void);
17extern void mxs_restart(char, const char *);
18extern int mxs_saif_clkmux_select(unsigned int clkmux);
19
20extern int mx23_clocks_init(void);
21extern void mx23_map_io(void);
22
23extern int mx28_clocks_init(void);
24extern void mx28_map_io(void);
25
26extern void icoll_init_irq(void);
27extern void icoll_handle_irq(struct pt_regs *);
28
29#endif /* __MACH_MXS_COMMON_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/digctl.h b/arch/arm/mach-mxs/include/mach/digctl.h
deleted file mode 100644
index 17964066303f..000000000000
--- a/arch/arm/mach-mxs/include/mach/digctl.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
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#ifndef __MACH_DIGCTL_H__
10#define __MACH_DIGCTL_H__
11
12/* MXS DIGCTL SAIF CLKMUX */
13#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT 0x0
14#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT 0x1
15#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0 0x2
16#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1 0x3
17
18#define HW_DIGCTL_CTRL 0x0
19#define BP_DIGCTL_CTRL_SAIF_CLKMUX 10
20#define BM_DIGCTL_CTRL_SAIF_CLKMUX (0x3 << 10)
21#define HW_DIGCTL_CHIPID 0x310
22#endif
diff --git a/arch/arm/mach-mxs/include/mach/hardware.h b/arch/arm/mach-mxs/include/mach/hardware.h
deleted file mode 100644
index 4c0e8a64d8c7..000000000000
--- a/arch/arm/mach-mxs/include/mach/hardware.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#ifndef __MACH_MXS_HARDWARE_H__
21#define __MACH_MXS_HARDWARE_H__
22
23#endif /* __MACH_MXS_HARDWARE_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/mx23.h b/arch/arm/mach-mxs/include/mach/mx23.h
deleted file mode 100644
index 599094bc99de..000000000000
--- a/arch/arm/mach-mxs/include/mach/mx23.h
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef __MACH_MX23_H__
20#define __MACH_MX23_H__
21
22#include <mach/mxs.h>
23
24/*
25 * OCRAM
26 */
27#define MX23_OCRAM_BASE_ADDR 0x00000000
28#define MX23_OCRAM_SIZE SZ_32K
29
30/*
31 * IO
32 */
33#define MX23_IO_BASE_ADDR 0x80000000
34#define MX23_IO_SIZE SZ_1M
35
36#define MX23_ICOLL_BASE_ADDR (MX23_IO_BASE_ADDR + 0x000000)
37#define MX23_APBH_DMA_BASE_ADDR (MX23_IO_BASE_ADDR + 0x004000)
38#define MX23_BCH_BASE_ADDR (MX23_IO_BASE_ADDR + 0x00a000)
39#define MX23_GPMI_BASE_ADDR (MX23_IO_BASE_ADDR + 0x00c000)
40#define MX23_SSP1_BASE_ADDR (MX23_IO_BASE_ADDR + 0x010000)
41#define MX23_PINCTRL_BASE_ADDR (MX23_IO_BASE_ADDR + 0x018000)
42#define MX23_DIGCTL_BASE_ADDR (MX23_IO_BASE_ADDR + 0x01c000)
43#define MX23_ETM_BASE_ADDR (MX23_IO_BASE_ADDR + 0x020000)
44#define MX23_APBX_DMA_BASE_ADDR (MX23_IO_BASE_ADDR + 0x024000)
45#define MX23_DCP_BASE_ADDR (MX23_IO_BASE_ADDR + 0x028000)
46#define MX23_PXP_BASE_ADDR (MX23_IO_BASE_ADDR + 0x02a000)
47#define MX23_OCOTP_BASE_ADDR (MX23_IO_BASE_ADDR + 0x02c000)
48#define MX23_AXI_AHB0_BASE_ADDR (MX23_IO_BASE_ADDR + 0x02e000)
49#define MX23_LCDIF_BASE_ADDR (MX23_IO_BASE_ADDR + 0x030000)
50#define MX23_SSP2_BASE_ADDR (MX23_IO_BASE_ADDR + 0x034000)
51#define MX23_TVENC_BASE_ADDR (MX23_IO_BASE_ADDR + 0x038000)
52#define MX23_CLKCTRL_BASE_ADDR (MX23_IO_BASE_ADDR + 0x040000)
53#define MX23_SAIF0_BASE_ADDR (MX23_IO_BASE_ADDR + 0x042000)
54#define MX23_POWER_BASE_ADDR (MX23_IO_BASE_ADDR + 0x044000)
55#define MX23_SAIF1_BASE_ADDR (MX23_IO_BASE_ADDR + 0x046000)
56#define MX23_AUDIOOUT_BASE_ADDR (MX23_IO_BASE_ADDR + 0x048000)
57#define MX23_AUDIOIN_BASE_ADDR (MX23_IO_BASE_ADDR + 0x04c000)
58#define MX23_LRADC_BASE_ADDR (MX23_IO_BASE_ADDR + 0x050000)
59#define MX23_SPDIF_BASE_ADDR (MX23_IO_BASE_ADDR + 0x054000)
60#define MX23_I2C_BASE_ADDR (MX23_IO_BASE_ADDR + 0x058000)
61#define MX23_RTC_BASE_ADDR (MX23_IO_BASE_ADDR + 0x05c000)
62#define MX23_PWM_BASE_ADDR (MX23_IO_BASE_ADDR + 0x064000)
63#define MX23_TIMROT_BASE_ADDR (MX23_IO_BASE_ADDR + 0x068000)
64#define MX23_AUART1_BASE_ADDR (MX23_IO_BASE_ADDR + 0x06c000)
65#define MX23_AUART2_BASE_ADDR (MX23_IO_BASE_ADDR + 0x06e000)
66#define MX23_DUART_BASE_ADDR (MX23_IO_BASE_ADDR + 0x070000)
67#define MX23_USBPHY_BASE_ADDR (MX23_IO_BASE_ADDR + 0x07c000)
68#define MX23_USBCTRL_BASE_ADDR (MX23_IO_BASE_ADDR + 0x080000)
69#define MX23_DRAM_BASE_ADDR (MX23_IO_BASE_ADDR + 0x0e0000)
70
71#define MX23_IO_P2V(x) MXS_IO_P2V(x)
72#define MX23_IO_ADDRESS(x) IOMEM(MX23_IO_P2V(x))
73
74/*
75 * IRQ
76 */
77#define MX23_INT_DUART 0
78#define MX23_INT_COMMS_RX 1
79#define MX23_INT_COMMS_TX 1
80#define MX23_INT_SSP2_ERROR 2
81#define MX23_INT_VDD5V 3
82#define MX23_INT_HEADPHONE_SHORT 4
83#define MX23_INT_DAC_DMA 5
84#define MX23_INT_DAC_ERROR 6
85#define MX23_INT_ADC_DMA 7
86#define MX23_INT_ADC_ERROR 8
87#define MX23_INT_SPDIF_DMA 9
88#define MX23_INT_SAIF2_DMA 9
89#define MX23_INT_SPDIF_ERROR 10
90#define MX23_INT_SAIF1_IRQ 10
91#define MX23_INT_SAIF2_IRQ 10
92#define MX23_INT_USB_CTRL 11
93#define MX23_INT_USB_WAKEUP 12
94#define MX23_INT_GPMI_DMA 13
95#define MX23_INT_SSP1_DMA 14
96#define MX23_INT_SSP1_ERROR 15
97#define MX23_INT_GPIO0 16
98#define MX23_INT_GPIO1 17
99#define MX23_INT_GPIO2 18
100#define MX23_INT_SAIF1_DMA 19
101#define MX23_INT_SSP2_DMA 20
102#define MX23_INT_ECC8_IRQ 21
103#define MX23_INT_RTC_ALARM 22
104#define MX23_INT_AUART1_TX_DMA 23
105#define MX23_INT_AUART1 24
106#define MX23_INT_AUART1_RX_DMA 25
107#define MX23_INT_I2C_DMA 26
108#define MX23_INT_I2C_ERROR 27
109#define MX23_INT_TIMER0 28
110#define MX23_INT_TIMER1 29
111#define MX23_INT_TIMER2 30
112#define MX23_INT_TIMER3 31
113#define MX23_INT_BATT_BRNOUT 32
114#define MX23_INT_VDDD_BRNOUT 33
115#define MX23_INT_VDDIO_BRNOUT 34
116#define MX23_INT_VDD18_BRNOUT 35
117#define MX23_INT_TOUCH_DETECT 36
118#define MX23_INT_LRADC_CH0 37
119#define MX23_INT_LRADC_CH1 38
120#define MX23_INT_LRADC_CH2 39
121#define MX23_INT_LRADC_CH3 40
122#define MX23_INT_LRADC_CH4 41
123#define MX23_INT_LRADC_CH5 42
124#define MX23_INT_LRADC_CH6 43
125#define MX23_INT_LRADC_CH7 44
126#define MX23_INT_LCDIF_DMA 45
127#define MX23_INT_LCDIF_ERROR 46
128#define MX23_INT_DIGCTL_DEBUG_TRAP 47
129#define MX23_INT_RTC_1MSEC 48
130#define MX23_INT_DRI_DMA 49
131#define MX23_INT_DRI_ATTENTION 50
132#define MX23_INT_GPMI_ATTENTION 51
133#define MX23_INT_IR 52
134#define MX23_INT_DCP_VMI 53
135#define MX23_INT_DCP 54
136#define MX23_INT_BCH 56
137#define MX23_INT_PXP 57
138#define MX23_INT_AUART2_TX_DMA 58
139#define MX23_INT_AUART2 59
140#define MX23_INT_AUART2_RX_DMA 60
141#define MX23_INT_VDAC_DETECT 61
142#define MX23_INT_VDD5V_DROOP 64
143#define MX23_INT_DCDC4P2_BO 65
144
145/*
146 * APBH DMA
147 */
148#define MX23_DMA_SSP1 1
149#define MX23_DMA_SSP2 2
150#define MX23_DMA_GPMI0 4
151#define MX23_DMA_GPMI1 5
152#define MX23_DMA_GPMI2 6
153#define MX23_DMA_GPMI3 7
154
155/*
156 * APBX DMA
157 */
158#define MX23_DMA_ADC 0
159#define MX23_DMA_DAC 1
160#define MX23_DMA_SPDIF 2
161#define MX23_DMA_I2C 3
162#define MX23_DMA_SAIF0 4
163#define MX23_DMA_UART0_RX 6
164#define MX23_DMA_UART0_TX 7
165#define MX23_DMA_UART1_RX 8
166#define MX23_DMA_UART1_TX 9
167#define MX23_DMA_SAIF1 10
168
169#endif /* __MACH_MX23_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/mx28.h b/arch/arm/mach-mxs/include/mach/mx28.h
deleted file mode 100644
index 30c7990f3c01..000000000000
--- a/arch/arm/mach-mxs/include/mach/mx28.h
+++ /dev/null
@@ -1,225 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef __MACH_MX28_H__
20#define __MACH_MX28_H__
21
22#include <mach/mxs.h>
23
24/*
25 * OCRAM
26 */
27#define MX28_OCRAM_BASE_ADDR 0x00000000
28#define MX28_OCRAM_SIZE SZ_128K
29
30/*
31 * IO
32 */
33#define MX28_IO_BASE_ADDR 0x80000000
34#define MX28_IO_SIZE SZ_1M
35
36#define MX28_ICOLL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x000000)
37#define MX28_HSADC_BASE_ADDR (MX28_IO_BASE_ADDR + 0x002000)
38#define MX28_APBH_DMA_BASE_ADDR (MX28_IO_BASE_ADDR + 0x004000)
39#define MX28_PERFMON_BASE_ADDR (MX28_IO_BASE_ADDR + 0x006000)
40#define MX28_BCH_BASE_ADDR (MX28_IO_BASE_ADDR + 0x00a000)
41#define MX28_GPMI_BASE_ADDR (MX28_IO_BASE_ADDR + 0x00c000)
42#define MX28_SSP0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x010000)
43#define MX28_SSP1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x012000)
44#define MX28_SSP2_BASE_ADDR (MX28_IO_BASE_ADDR + 0x014000)
45#define MX28_SSP3_BASE_ADDR (MX28_IO_BASE_ADDR + 0x016000)
46#define MX28_PINCTRL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x018000)
47#define MX28_DIGCTL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x01c000)
48#define MX28_ETM_BASE_ADDR (MX28_IO_BASE_ADDR + 0x022000)
49#define MX28_APBX_DMA_BASE_ADDR (MX28_IO_BASE_ADDR + 0x024000)
50#define MX28_DCP_BASE_ADDR (MX28_IO_BASE_ADDR + 0x028000)
51#define MX28_PXP_BASE_ADDR (MX28_IO_BASE_ADDR + 0x02a000)
52#define MX28_OCOTP_BASE_ADDR (MX28_IO_BASE_ADDR + 0x02c000)
53#define MX28_AXI_AHB0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x02e000)
54#define MX28_LCDIF_BASE_ADDR (MX28_IO_BASE_ADDR + 0x030000)
55#define MX28_CAN0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x032000)
56#define MX28_CAN1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x034000)
57#define MX28_SIMDBG_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c000)
58#define MX28_SIMGPMISEL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c200)
59#define MX28_SIMSSPSEL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c300)
60#define MX28_SIMMEMSEL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c400)
61#define MX28_GPIOMON_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c500)
62#define MX28_SIMENET_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c700)
63#define MX28_ARMJTAG_BASE_ADDR (MX28_IO_BASE_ADDR + 0x03c800)
64#define MX28_CLKCTRL_BASE_ADDR (MX28_IO_BASE_ADDR + 0x040000)
65#define MX28_SAIF0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x042000)
66#define MX28_POWER_BASE_ADDR (MX28_IO_BASE_ADDR + 0x044000)
67#define MX28_SAIF1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x046000)
68#define MX28_LRADC_BASE_ADDR (MX28_IO_BASE_ADDR + 0x050000)
69#define MX28_SPDIF_BASE_ADDR (MX28_IO_BASE_ADDR + 0x054000)
70#define MX28_RTC_BASE_ADDR (MX28_IO_BASE_ADDR + 0x056000)
71#define MX28_I2C0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x058000)
72#define MX28_I2C1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x05a000)
73#define MX28_PWM_BASE_ADDR (MX28_IO_BASE_ADDR + 0x064000)
74#define MX28_TIMROT_BASE_ADDR (MX28_IO_BASE_ADDR + 0x068000)
75#define MX28_AUART0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x06a000)
76#define MX28_AUART1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x06c000)
77#define MX28_AUART2_BASE_ADDR (MX28_IO_BASE_ADDR + 0x06e000)
78#define MX28_AUART3_BASE_ADDR (MX28_IO_BASE_ADDR + 0x070000)
79#define MX28_AUART4_BASE_ADDR (MX28_IO_BASE_ADDR + 0x072000)
80#define MX28_DUART_BASE_ADDR (MX28_IO_BASE_ADDR + 0x074000)
81#define MX28_USBPHY0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x07C000)
82#define MX28_USBPHY1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x07e000)
83#define MX28_USBCTRL0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x080000)
84#define MX28_USBCTRL1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x090000)
85#define MX28_DFLPT_BASE_ADDR (MX28_IO_BASE_ADDR + 0x0c0000)
86#define MX28_DRAM_BASE_ADDR (MX28_IO_BASE_ADDR + 0x0e0000)
87#define MX28_ENET_MAC0_BASE_ADDR (MX28_IO_BASE_ADDR + 0x0f0000)
88#define MX28_ENET_MAC1_BASE_ADDR (MX28_IO_BASE_ADDR + 0x0f4000)
89
90#define MX28_IO_P2V(x) MXS_IO_P2V(x)
91#define MX28_IO_ADDRESS(x) IOMEM(MX28_IO_P2V(x))
92
93/*
94 * IRQ
95 */
96#define MX28_INT_BATT_BRNOUT 0
97#define MX28_INT_VDDD_BRNOUT 1
98#define MX28_INT_VDDIO_BRNOUT 2
99#define MX28_INT_VDDA_BRNOUT 3
100#define MX28_INT_VDD5V_DROOP 4
101#define MX28_INT_DCDC4P2_BRNOUT 5
102#define MX28_INT_VDD5V 6
103#define MX28_INT_CAN0 8
104#define MX28_INT_CAN1 9
105#define MX28_INT_LRADC_TOUCH 10
106#define MX28_INT_HSADC 13
107#define MX28_INT_LRADC_THRESH0 14
108#define MX28_INT_LRADC_THRESH1 15
109#define MX28_INT_LRADC_CH0 16
110#define MX28_INT_LRADC_CH1 17
111#define MX28_INT_LRADC_CH2 18
112#define MX28_INT_LRADC_CH3 19
113#define MX28_INT_LRADC_CH4 20
114#define MX28_INT_LRADC_CH5 21
115#define MX28_INT_LRADC_CH6 22
116#define MX28_INT_LRADC_CH7 23
117#define MX28_INT_LRADC_BUTTON0 24
118#define MX28_INT_LRADC_BUTTON1 25
119#define MX28_INT_PERFMON 27
120#define MX28_INT_RTC_1MSEC 28
121#define MX28_INT_RTC_ALARM 29
122#define MX28_INT_COMMS 31
123#define MX28_INT_EMI_ERR 32
124#define MX28_INT_LCDIF 38
125#define MX28_INT_PXP 39
126#define MX28_INT_BCH 41
127#define MX28_INT_GPMI 42
128#define MX28_INT_SPDIF_ERROR 45
129#define MX28_INT_DUART 47
130#define MX28_INT_TIMER0 48
131#define MX28_INT_TIMER1 49
132#define MX28_INT_TIMER2 50
133#define MX28_INT_TIMER3 51
134#define MX28_INT_DCP_VMI 52
135#define MX28_INT_DCP 53
136#define MX28_INT_DCP_SECURE 54
137#define MX28_INT_SAIF1 58
138#define MX28_INT_SAIF0 59
139#define MX28_INT_SPDIF_DMA 66
140#define MX28_INT_I2C0_DMA 68
141#define MX28_INT_I2C1_DMA 69
142#define MX28_INT_AUART0_RX_DMA 70
143#define MX28_INT_AUART0_TX_DMA 71
144#define MX28_INT_AUART1_RX_DMA 72
145#define MX28_INT_AUART1_TX_DMA 73
146#define MX28_INT_AUART2_RX_DMA 74
147#define MX28_INT_AUART2_TX_DMA 75
148#define MX28_INT_AUART3_RX_DMA 76
149#define MX28_INT_AUART3_TX_DMA 77
150#define MX28_INT_AUART4_RX_DMA 78
151#define MX28_INT_AUART4_TX_DMA 79
152#define MX28_INT_SAIF0_DMA 80
153#define MX28_INT_SAIF1_DMA 81
154#define MX28_INT_SSP0_DMA 82
155#define MX28_INT_SSP1_DMA 83
156#define MX28_INT_SSP2_DMA 84
157#define MX28_INT_SSP3_DMA 85
158#define MX28_INT_LCDIF_DMA 86
159#define MX28_INT_HSADC_DMA 87
160#define MX28_INT_GPMI_DMA 88
161#define MX28_INT_DIGCTL_DEBUG_TRAP 89
162#define MX28_INT_USB1 92
163#define MX28_INT_USB0 93
164#define MX28_INT_USB1_WAKEUP 94
165#define MX28_INT_USB0_WAKEUP 95
166#define MX28_INT_SSP0_ERROR 96
167#define MX28_INT_SSP1_ERROR 97
168#define MX28_INT_SSP2_ERROR 98
169#define MX28_INT_SSP3_ERROR 99
170#define MX28_INT_ENET_SWI 100
171#define MX28_INT_ENET_MAC0 101
172#define MX28_INT_ENET_MAC1 102
173#define MX28_INT_ENET_MAC0_1588 103
174#define MX28_INT_ENET_MAC1_1588 104
175#define MX28_INT_I2C1_ERROR 110
176#define MX28_INT_I2C0_ERROR 111
177#define MX28_INT_AUART0 112
178#define MX28_INT_AUART1 113
179#define MX28_INT_AUART2 114
180#define MX28_INT_AUART3 115
181#define MX28_INT_AUART4 116
182#define MX28_INT_GPIO4 123
183#define MX28_INT_GPIO3 124
184#define MX28_INT_GPIO2 125
185#define MX28_INT_GPIO1 126
186#define MX28_INT_GPIO0 127
187
188/*
189 * APBH DMA
190 */
191#define MX28_DMA_SSP0 0
192#define MX28_DMA_SSP1 1
193#define MX28_DMA_SSP2 2
194#define MX28_DMA_SSP3 3
195#define MX28_DMA_GPMI0 4
196#define MX28_DMA_GPMI1 5
197#define MX28_DMA_GPMI2 6
198#define MX28_DMA_GPMI3 7
199#define MX28_DMA_GPMI4 8
200#define MX28_DMA_GPMI5 9
201#define MX28_DMA_GPMI6 10
202#define MX28_DMA_GPMI7 11
203#define MX28_DMA_HSADC 12
204#define MX28_DMA_LCDIF 13
205
206/*
207 * APBX DMA
208 */
209#define MX28_DMA_AUART4_RX 0
210#define MX28_DMA_AUART4_TX 1
211#define MX28_DMA_SPDIF_TX 2
212#define MX28_DMA_SAIF0 4
213#define MX28_DMA_SAIF1 5
214#define MX28_DMA_I2C0 6
215#define MX28_DMA_I2C1 7
216#define MX28_DMA_AUART0_RX 8
217#define MX28_DMA_AUART0_TX 9
218#define MX28_DMA_AUART1_RX 10
219#define MX28_DMA_AUART1_TX 11
220#define MX28_DMA_AUART2_RX 12
221#define MX28_DMA_AUART2_TX 13
222#define MX28_DMA_AUART3_RX 14
223#define MX28_DMA_AUART3_TX 15
224
225#endif /* __MACH_MX28_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h
deleted file mode 100644
index 7d4fb6d0afda..000000000000
--- a/arch/arm/mach-mxs/include/mach/mxs.h
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef __MACH_MXS_H__
20#define __MACH_MXS_H__
21
22#ifndef __ASSEMBLER__
23#include <linux/io.h>
24#endif
25#include <asm/mach-types.h>
26#include <mach/digctl.h>
27#include <mach/hardware.h>
28
29/*
30 * IO addresses common to MXS-based
31 */
32#define MXS_IO_BASE_ADDR 0x80000000
33#define MXS_IO_SIZE SZ_1M
34
35#define MXS_ICOLL_BASE_ADDR (MXS_IO_BASE_ADDR + 0x000000)
36#define MXS_APBH_DMA_BASE_ADDR (MXS_IO_BASE_ADDR + 0x004000)
37#define MXS_BCH_BASE_ADDR (MXS_IO_BASE_ADDR + 0x00a000)
38#define MXS_GPMI_BASE_ADDR (MXS_IO_BASE_ADDR + 0x00c000)
39#define MXS_PINCTRL_BASE_ADDR (MXS_IO_BASE_ADDR + 0x018000)
40#define MXS_DIGCTL_BASE_ADDR (MXS_IO_BASE_ADDR + 0x01c000)
41#define MXS_APBX_DMA_BASE_ADDR (MXS_IO_BASE_ADDR + 0x024000)
42#define MXS_DCP_BASE_ADDR (MXS_IO_BASE_ADDR + 0x028000)
43#define MXS_PXP_BASE_ADDR (MXS_IO_BASE_ADDR + 0x02a000)
44#define MXS_OCOTP_BASE_ADDR (MXS_IO_BASE_ADDR + 0x02c000)
45#define MXS_AXI_AHB0_BASE_ADDR (MXS_IO_BASE_ADDR + 0x02e000)
46#define MXS_LCDIF_BASE_ADDR (MXS_IO_BASE_ADDR + 0x030000)
47#define MXS_CLKCTRL_BASE_ADDR (MXS_IO_BASE_ADDR + 0x040000)
48#define MXS_SAIF0_BASE_ADDR (MXS_IO_BASE_ADDR + 0x042000)
49#define MXS_POWER_BASE_ADDR (MXS_IO_BASE_ADDR + 0x044000)
50#define MXS_SAIF1_BASE_ADDR (MXS_IO_BASE_ADDR + 0x046000)
51#define MXS_LRADC_BASE_ADDR (MXS_IO_BASE_ADDR + 0x050000)
52#define MXS_SPDIF_BASE_ADDR (MXS_IO_BASE_ADDR + 0x054000)
53#define MXS_I2C0_BASE_ADDR (MXS_IO_BASE_ADDR + 0x058000)
54#define MXS_PWM_BASE_ADDR (MXS_IO_BASE_ADDR + 0x064000)
55#define MXS_TIMROT_BASE_ADDR (MXS_IO_BASE_ADDR + 0x068000)
56#define MXS_AUART1_BASE_ADDR (MXS_IO_BASE_ADDR + 0x06c000)
57#define MXS_AUART2_BASE_ADDR (MXS_IO_BASE_ADDR + 0x06e000)
58#define MXS_DRAM_BASE_ADDR (MXS_IO_BASE_ADDR + 0x0e0000)
59
60/*
61 * It maps the whole address space to [0xf4000000, 0xf50fffff].
62 *
63 * OCRAM 0x00000000+0x020000 -> 0xf4000000+0x020000
64 * IO 0x80000000+0x100000 -> 0xf5000000+0x100000
65 */
66#define MXS_IO_P2V(x) (0xf4000000 + \
67 (((x) & 0x80000000) >> 7) + \
68 (((x) & 0x000fffff)))
69
70#define MXS_IO_ADDRESS(x) IOMEM(MXS_IO_P2V(x))
71
72#define mxs_map_entry(soc, name, _type) { \
73 .virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR), \
74 .pfn = __phys_to_pfn(soc ## _ ## name ## _BASE_ADDR), \
75 .length = soc ## _ ## name ## _SIZE, \
76 .type = _type, \
77}
78
79#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
80
81#define MXS_SET_ADDR 0x4
82#define MXS_CLR_ADDR 0x8
83#define MXS_TOG_ADDR 0xc
84
85#ifndef __ASSEMBLER__
86static inline void __mxs_setl(u32 mask, void __iomem *reg)
87{
88 __raw_writel(mask, reg + MXS_SET_ADDR);
89}
90
91static inline void __mxs_clrl(u32 mask, void __iomem *reg)
92{
93 __raw_writel(mask, reg + MXS_CLR_ADDR);
94}
95
96static inline void __mxs_togl(u32 mask, void __iomem *reg)
97{
98 __raw_writel(mask, reg + MXS_TOG_ADDR);
99}
100
101/*
102 * MXS CPU types
103 */
104#define MXS_CHIPID (MXS_IO_ADDRESS(MXS_DIGCTL_BASE_ADDR) + HW_DIGCTL_CHIPID)
105
106static inline int cpu_is_mx23(void)
107{
108 return ((__raw_readl(MXS_CHIPID) >> 16) == 0x3780);
109}
110
111static inline int cpu_is_mx28(void)
112{
113 return ((__raw_readl(MXS_CHIPID) >> 16) == 0x2800);
114}
115#endif
116
117#endif /* __MACH_MXS_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/timex.h b/arch/arm/mach-mxs/include/mach/timex.h
deleted file mode 100644
index 734ce8984a64..000000000000
--- a/arch/arm/mach-mxs/include/mach/timex.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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
16#ifndef __MACH_MXS_TIMEX_H__
17#define __MACH_MXS_TIMEX_H__
18
19#define CLOCK_TICK_RATE 32000 /* 32K */
20
21#endif /* __MACH_MXS_TIMEX_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/uncompress.h b/arch/arm/mach-mxs/include/mach/uncompress.h
deleted file mode 100644
index 533f5186e200..000000000000
--- a/arch/arm/mach-mxs/include/mach/uncompress.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * arch/arm/mach-mxs/include/mach/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) Shane Nay (shane@minirl.com)
6 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License 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#ifndef __MACH_MXS_UNCOMPRESS_H__
19#define __MACH_MXS_UNCOMPRESS_H__
20
21unsigned long mxs_duart_base;
22
23#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x)))
24
25#define MXS_DUART_DR 0x00
26#define MXS_DUART_FR 0x18
27#define MXS_DUART_FR_TXFE (1 << 7)
28#define MXS_DUART_CR 0x30
29#define MXS_DUART_CR_UARTEN (1 << 0)
30
31/*
32 * The following code assumes the serial port has already been
33 * initialized by the bootloader. If it's not, the output is
34 * simply discarded.
35 */
36
37static void putc(int ch)
38{
39 if (!mxs_duart_base)
40 return;
41 if (!(MXS_DUART(MXS_DUART_CR) & MXS_DUART_CR_UARTEN))
42 return;
43
44 while (!(MXS_DUART(MXS_DUART_FR) & MXS_DUART_FR_TXFE))
45 barrier();
46
47 MXS_DUART(MXS_DUART_DR) = ch;
48}
49
50static inline void flush(void)
51{
52}
53
54#define MX23_DUART_BASE_ADDR 0x80070000
55#define MX28_DUART_BASE_ADDR 0x80074000
56#define MXS_DIGCTL_CHIPID 0x8001c310
57
58static inline void __arch_decomp_setup(unsigned long arch_id)
59{
60 u16 chipid = (*(volatile unsigned long *) MXS_DIGCTL_CHIPID) >> 16;
61
62 switch (chipid) {
63 case 0x3780:
64 mxs_duart_base = MX23_DUART_BASE_ADDR;
65 break;
66 case 0x2800:
67 mxs_duart_base = MX28_DUART_BASE_ADDR;
68 break;
69 default:
70 break;
71 }
72}
73
74#define arch_decomp_setup() __arch_decomp_setup(arch_id)
75
76#endif /* __MACH_MXS_UNCOMPRESS_H__ */
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index e7b781d3788f..b5c1bdd3dcdf 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -11,22 +11,55 @@
11 */ 11 */
12 12
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clk/mxs.h>
14#include <linux/clkdev.h> 15#include <linux/clkdev.h>
16#include <linux/clocksource.h>
15#include <linux/can/platform/flexcan.h> 17#include <linux/can/platform/flexcan.h>
16#include <linux/delay.h> 18#include <linux/delay.h>
17#include <linux/err.h> 19#include <linux/err.h>
18#include <linux/gpio.h> 20#include <linux/gpio.h>
19#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/irqchip.h>
23#include <linux/irqchip/mxs.h>
20#include <linux/micrel_phy.h> 24#include <linux/micrel_phy.h>
21#include <linux/mxsfb.h> 25#include <linux/mxsfb.h>
26#include <linux/of_address.h>
22#include <linux/of_platform.h> 27#include <linux/of_platform.h>
23#include <linux/phy.h> 28#include <linux/phy.h>
24#include <linux/pinctrl/consumer.h> 29#include <linux/pinctrl/consumer.h>
25#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
26#include <asm/mach/time.h> 32#include <asm/mach/time.h>
27#include <mach/common.h> 33#include <asm/system_misc.h>
28#include <mach/digctl.h> 34
29#include <mach/mxs.h> 35#include "pm.h"
36
37/* MXS DIGCTL SAIF CLKMUX */
38#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT 0x0
39#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT 0x1
40#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0 0x2
41#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1 0x3
42
43#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
44
45#define MXS_SET_ADDR 0x4
46#define MXS_CLR_ADDR 0x8
47#define MXS_TOG_ADDR 0xc
48
49static inline void __mxs_setl(u32 mask, void __iomem *reg)
50{
51 __raw_writel(mask, reg + MXS_SET_ADDR);
52}
53
54static inline void __mxs_clrl(u32 mask, void __iomem *reg)
55{
56 __raw_writel(mask, reg + MXS_CLR_ADDR);
57}
58
59static inline void __mxs_togl(u32 mask, void __iomem *reg)
60{
61 __raw_writel(mask, reg + MXS_TOG_ADDR);
62}
30 63
31static struct fb_videomode mx23evk_video_modes[] = { 64static struct fb_videomode mx23evk_video_modes[] = {
32 { 65 {
@@ -165,14 +198,80 @@ static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
165 { /* sentinel */ } 198 { /* sentinel */ }
166}; 199};
167 200
168static void __init imx23_timer_init(void) 201#define OCOTP_WORD_OFFSET 0x20
169{ 202#define OCOTP_WORD_COUNT 0x20
170 mx23_clocks_init(); 203
171} 204#define BM_OCOTP_CTRL_BUSY (1 << 8)
205#define BM_OCOTP_CTRL_ERROR (1 << 9)
206#define BM_OCOTP_CTRL_RD_BANK_OPEN (1 << 12)
172 207
173static void __init imx28_timer_init(void) 208static DEFINE_MUTEX(ocotp_mutex);
209static u32 ocotp_words[OCOTP_WORD_COUNT];
210
211static const u32 *mxs_get_ocotp(void)
174{ 212{
175 mx28_clocks_init(); 213 struct device_node *np;
214 void __iomem *ocotp_base;
215 int timeout = 0x400;
216 size_t i;
217 static int once;
218
219 if (once)
220 return ocotp_words;
221
222 np = of_find_compatible_node(NULL, NULL, "fsl,ocotp");
223 ocotp_base = of_iomap(np, 0);
224 WARN_ON(!ocotp_base);
225
226 mutex_lock(&ocotp_mutex);
227
228 /*
229 * clk_enable(hbus_clk) for ocotp can be skipped
230 * as it must be on when system is running.
231 */
232
233 /* try to clear ERROR bit */
234 __mxs_clrl(BM_OCOTP_CTRL_ERROR, ocotp_base);
235
236 /* check both BUSY and ERROR cleared */
237 while ((__raw_readl(ocotp_base) &
238 (BM_OCOTP_CTRL_BUSY | BM_OCOTP_CTRL_ERROR)) && --timeout)
239 cpu_relax();
240
241 if (unlikely(!timeout))
242 goto error_unlock;
243
244 /* open OCOTP banks for read */
245 __mxs_setl(BM_OCOTP_CTRL_RD_BANK_OPEN, ocotp_base);
246
247 /* approximately wait 32 hclk cycles */
248 udelay(1);
249
250 /* poll BUSY bit becoming cleared */
251 timeout = 0x400;
252 while ((__raw_readl(ocotp_base) & BM_OCOTP_CTRL_BUSY) && --timeout)
253 cpu_relax();
254
255 if (unlikely(!timeout))
256 goto error_unlock;
257
258 for (i = 0; i < OCOTP_WORD_COUNT; i++)
259 ocotp_words[i] = __raw_readl(ocotp_base + OCOTP_WORD_OFFSET +
260 i * 0x10);
261
262 /* close banks for power saving */
263 __mxs_clrl(BM_OCOTP_CTRL_RD_BANK_OPEN, ocotp_base);
264
265 once = 1;
266
267 mutex_unlock(&ocotp_mutex);
268
269 return ocotp_words;
270
271error_unlock:
272 mutex_unlock(&ocotp_mutex);
273 pr_err("%s: timeout in reading OCOTP\n", __func__);
274 return NULL;
176} 275}
177 276
178enum mac_oui { 277enum mac_oui {
@@ -454,32 +553,63 @@ static void __init mxs_machine_init(void)
454 imx28_evk_post_init(); 553 imx28_evk_post_init();
455} 554}
456 555
457static const char *imx23_dt_compat[] __initdata = { 556#define MX23_CLKCTRL_RESET_OFFSET 0x120
458 "fsl,imx23", 557#define MX28_CLKCTRL_RESET_OFFSET 0x1e0
459 NULL, 558#define MXS_CLKCTRL_RESET_CHIP (1 << 1)
460}; 559
560/*
561 * Reset the system. It is called by machine_restart().
562 */
563static void mxs_restart(char mode, const char *cmd)
564{
565 struct device_node *np;
566 void __iomem *reset_addr;
567
568 np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl");
569 reset_addr = of_iomap(np, 0);
570 if (!reset_addr)
571 goto soft;
572
573 if (of_device_is_compatible(np, "fsl,imx23-clkctrl"))
574 reset_addr += MX23_CLKCTRL_RESET_OFFSET;
575 else
576 reset_addr += MX28_CLKCTRL_RESET_OFFSET;
461 577
462static const char *imx28_dt_compat[] __initdata = { 578 /* reset the chip */
579 __mxs_setl(MXS_CLKCTRL_RESET_CHIP, reset_addr);
580
581 pr_err("Failed to assert the chip reset\n");
582
583 /* Delay to allow the serial port to show the message */
584 mdelay(50);
585
586soft:
587 /* We'll take a jump through zero as a poor second */
588 soft_restart(0);
589}
590
591static void __init mxs_timer_init(void)
592{
593 if (of_machine_is_compatible("fsl,imx23"))
594 mx23_clocks_init();
595 else
596 mx28_clocks_init();
597 clocksource_of_init();
598}
599
600static const char *mxs_dt_compat[] __initdata = {
463 "fsl,imx28", 601 "fsl,imx28",
602 "fsl,imx23",
464 NULL, 603 NULL,
465}; 604};
466 605
467DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)") 606DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
468 .map_io = mx23_map_io, 607 .map_io = debug_ll_io_init,
469 .init_irq = icoll_init_irq, 608 .init_irq = irqchip_init,
470 .handle_irq = icoll_handle_irq,
471 .init_time = imx23_timer_init,
472 .init_machine = mxs_machine_init,
473 .dt_compat = imx23_dt_compat,
474 .restart = mxs_restart,
475MACHINE_END
476
477DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
478 .map_io = mx28_map_io,
479 .init_irq = icoll_init_irq,
480 .handle_irq = icoll_handle_irq, 609 .handle_irq = icoll_handle_irq,
481 .init_time = imx28_timer_init, 610 .init_time = mxs_timer_init,
482 .init_machine = mxs_machine_init, 611 .init_machine = mxs_machine_init,
483 .dt_compat = imx28_dt_compat, 612 .init_late = mxs_pm_init,
613 .dt_compat = mxs_dt_compat,
484 .restart = mxs_restart, 614 .restart = mxs_restart,
485MACHINE_END 615MACHINE_END
diff --git a/arch/arm/mach-mxs/mm.c b/arch/arm/mach-mxs/mm.c
deleted file mode 100644
index e63b7d87acbd..000000000000
--- a/arch/arm/mach-mxs/mm.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 *
11 * Create static mapping between physical to virtual memory.
12 */
13
14#include <linux/mm.h>
15#include <linux/init.h>
16
17#include <asm/mach/map.h>
18
19#include <mach/mx23.h>
20#include <mach/mx28.h>
21#include <mach/common.h>
22
23/*
24 * Define the MX23 memory map.
25 */
26static struct map_desc mx23_io_desc[] __initdata = {
27 mxs_map_entry(MX23, OCRAM, MT_DEVICE),
28 mxs_map_entry(MX23, IO, MT_DEVICE),
29};
30
31/*
32 * Define the MX28 memory map.
33 */
34static struct map_desc mx28_io_desc[] __initdata = {
35 mxs_map_entry(MX28, OCRAM, MT_DEVICE),
36 mxs_map_entry(MX28, IO, MT_DEVICE),
37};
38
39/*
40 * This function initializes the memory map. It is called during the
41 * system startup to create static physical to virtual memory mappings
42 * for the IO modules.
43 */
44void __init mx23_map_io(void)
45{
46 iotable_init(mx23_io_desc, ARRAY_SIZE(mx23_io_desc));
47}
48
49void __init mx28_map_io(void)
50{
51 iotable_init(mx28_io_desc, ARRAY_SIZE(mx28_io_desc));
52}
diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c
deleted file mode 100644
index 1dff46703753..000000000000
--- a/arch/arm/mach-mxs/ocotp.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/delay.h>
16#include <linux/err.h>
17#include <linux/mutex.h>
18
19#include <asm/processor.h> /* for cpu_relax() */
20
21#include <mach/mxs.h>
22#include <mach/common.h>
23
24#define OCOTP_WORD_OFFSET 0x20
25#define OCOTP_WORD_COUNT 0x20
26
27#define BM_OCOTP_CTRL_BUSY (1 << 8)
28#define BM_OCOTP_CTRL_ERROR (1 << 9)
29#define BM_OCOTP_CTRL_RD_BANK_OPEN (1 << 12)
30
31static DEFINE_MUTEX(ocotp_mutex);
32static u32 ocotp_words[OCOTP_WORD_COUNT];
33
34const u32 *mxs_get_ocotp(void)
35{
36 void __iomem *ocotp_base = MXS_IO_ADDRESS(MXS_OCOTP_BASE_ADDR);
37 int timeout = 0x400;
38 size_t i;
39 static int once = 0;
40
41 if (once)
42 return ocotp_words;
43
44 mutex_lock(&ocotp_mutex);
45
46 /*
47 * clk_enable(hbus_clk) for ocotp can be skipped
48 * as it must be on when system is running.
49 */
50
51 /* try to clear ERROR bit */
52 __mxs_clrl(BM_OCOTP_CTRL_ERROR, ocotp_base);
53
54 /* check both BUSY and ERROR cleared */
55 while ((__raw_readl(ocotp_base) &
56 (BM_OCOTP_CTRL_BUSY | BM_OCOTP_CTRL_ERROR)) && --timeout)
57 cpu_relax();
58
59 if (unlikely(!timeout))
60 goto error_unlock;
61
62 /* open OCOTP banks for read */
63 __mxs_setl(BM_OCOTP_CTRL_RD_BANK_OPEN, ocotp_base);
64
65 /* approximately wait 32 hclk cycles */
66 udelay(1);
67
68 /* poll BUSY bit becoming cleared */
69 timeout = 0x400;
70 while ((__raw_readl(ocotp_base) & BM_OCOTP_CTRL_BUSY) && --timeout)
71 cpu_relax();
72
73 if (unlikely(!timeout))
74 goto error_unlock;
75
76 for (i = 0; i < OCOTP_WORD_COUNT; i++)
77 ocotp_words[i] = __raw_readl(ocotp_base + OCOTP_WORD_OFFSET +
78 i * 0x10);
79
80 /* close banks for power saving */
81 __mxs_clrl(BM_OCOTP_CTRL_RD_BANK_OPEN, ocotp_base);
82
83 once = 1;
84
85 mutex_unlock(&ocotp_mutex);
86
87 return ocotp_words;
88
89error_unlock:
90 mutex_unlock(&ocotp_mutex);
91 pr_err("%s: timeout in reading OCOTP\n", __func__);
92 return NULL;
93}
diff --git a/arch/arm/mach-mxs/pm.c b/arch/arm/mach-mxs/pm.c
index a9b4bbcdafb4..b2494d2db2c4 100644
--- a/arch/arm/mach-mxs/pm.c
+++ b/arch/arm/mach-mxs/pm.c
@@ -34,9 +34,7 @@ static struct platform_suspend_ops mxs_suspend_ops = {
34 .valid = suspend_valid_only_mem, 34 .valid = suspend_valid_only_mem,
35}; 35};
36 36
37static int __init mxs_pm_init(void) 37void __init mxs_pm_init(void)
38{ 38{
39 suspend_set_ops(&mxs_suspend_ops); 39 suspend_set_ops(&mxs_suspend_ops);
40 return 0;
41} 40}
42device_initcall(mxs_pm_init);
diff --git a/arch/arm/mach-h720x/include/mach/timex.h b/arch/arm/mach-mxs/pm.h
index 3f2f447ff36b..f57e7cdece2e 100644
--- a/arch/arm/mach-h720x/include/mach/timex.h
+++ b/arch/arm/mach-mxs/pm.h
@@ -1,15 +1,14 @@
1/* 1/*
2 * arch/arm/mach-h720x/include/mach/timex.h 2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
3 * Copyright (C) 2000 Jungjun Kim, Hynix Semiconductor Inc.
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
8 */ 7 */
9 8
10#ifndef __ASM_ARCH_TIMEX 9#ifndef __ARCH_MXS_PM_H
11#define __ASM_ARCH_TIMEX 10#define __ARCH_MXS_PM_H
12 11
13#define CLOCK_TICK_RATE 3686400 12void mxs_pm_init(void);
14 13
15#endif 14#endif
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
deleted file mode 100644
index 30042e23bfa7..000000000000
--- a/arch/arm/mach-mxs/system.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * Copyright (C) 1999 ARM Limited
3 * Copyright (C) 2000 Deep Blue Solutions Ltd
4 * Copyright 2006-2007,2010 Freescale Semiconductor, Inc. All Rights Reserved.
5 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
6 * Copyright 2009 Ilya Yanok, Emcraft Systems Ltd, yanok@emcraft.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20#include <linux/clk.h>
21#include <linux/io.h>
22#include <linux/err.h>
23#include <linux/delay.h>
24#include <linux/init.h>
25#include <linux/module.h>
26
27#include <asm/proc-fns.h>
28#include <asm/system_misc.h>
29
30#include <mach/mxs.h>
31#include <mach/common.h>
32
33#define MX23_CLKCTRL_RESET_OFFSET 0x120
34#define MX28_CLKCTRL_RESET_OFFSET 0x1e0
35#define MXS_CLKCTRL_RESET_CHIP (1 << 1)
36
37#define MXS_MODULE_CLKGATE (1 << 30)
38#define MXS_MODULE_SFTRST (1 << 31)
39
40static void __iomem *mxs_clkctrl_reset_addr;
41
42/*
43 * Reset the system. It is called by machine_restart().
44 */
45void mxs_restart(char mode, const char *cmd)
46{
47 /* reset the chip */
48 __mxs_setl(MXS_CLKCTRL_RESET_CHIP, mxs_clkctrl_reset_addr);
49
50 pr_err("Failed to assert the chip reset\n");
51
52 /* Delay to allow the serial port to show the message */
53 mdelay(50);
54
55 /* We'll take a jump through zero as a poor second */
56 soft_restart(0);
57}
58
59static int __init mxs_arch_reset_init(void)
60{
61 struct clk *clk;
62
63 mxs_clkctrl_reset_addr = MXS_IO_ADDRESS(MXS_CLKCTRL_BASE_ADDR) +
64 (cpu_is_mx23() ? MX23_CLKCTRL_RESET_OFFSET :
65 MX28_CLKCTRL_RESET_OFFSET);
66
67 clk = clk_get_sys("rtc", NULL);
68 if (!IS_ERR(clk))
69 clk_prepare_enable(clk);
70
71 return 0;
72}
73core_initcall(mxs_arch_reset_init);
74
75/*
76 * Clear the bit and poll it cleared. This is usually called with
77 * a reset address and mask being either SFTRST(bit 31) or CLKGATE
78 * (bit 30).
79 */
80static int clear_poll_bit(void __iomem *addr, u32 mask)
81{
82 int timeout = 0x400;
83
84 /* clear the bit */
85 __mxs_clrl(mask, addr);
86
87 /*
88 * SFTRST needs 3 GPMI clocks to settle, the reference manual
89 * recommends to wait 1us.
90 */
91 udelay(1);
92
93 /* poll the bit becoming clear */
94 while ((__raw_readl(addr) & mask) && --timeout)
95 /* nothing */;
96
97 return !timeout;
98}
99
100int mxs_reset_block(void __iomem *reset_addr)
101{
102 int ret;
103 int timeout = 0x400;
104
105 /* clear and poll SFTRST */
106 ret = clear_poll_bit(reset_addr, MXS_MODULE_SFTRST);
107 if (unlikely(ret))
108 goto error;
109
110 /* clear CLKGATE */
111 __mxs_clrl(MXS_MODULE_CLKGATE, reset_addr);
112
113 /* set SFTRST to reset the block */
114 __mxs_setl(MXS_MODULE_SFTRST, reset_addr);
115 udelay(1);
116
117 /* poll CLKGATE becoming set */
118 while ((!(__raw_readl(reset_addr) & MXS_MODULE_CLKGATE)) && --timeout)
119 /* nothing */;
120 if (unlikely(!timeout))
121 goto error;
122
123 /* clear and poll SFTRST */
124 ret = clear_poll_bit(reset_addr, MXS_MODULE_SFTRST);
125 if (unlikely(ret))
126 goto error;
127
128 /* clear and poll CLKGATE */
129 ret = clear_poll_bit(reset_addr, MXS_MODULE_CLKGATE);
130 if (unlikely(ret))
131 goto error;
132
133 return 0;
134
135error:
136 pr_err("%s(%p): module reset timeout\n", __func__, reset_addr);
137 return -ETIMEDOUT;
138}
139EXPORT_SYMBOL(mxs_reset_block);
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
deleted file mode 100644
index 421020498a1b..000000000000
--- a/arch/arm/mach-mxs/timer.c
+++ /dev/null
@@ -1,306 +0,0 @@
1/*
2 * Copyright (C) 2000-2001 Deep Blue Solutions
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com)
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 * MA 02110-1301, USA.
21 */
22
23#include <linux/err.h>
24#include <linux/interrupt.h>
25#include <linux/irq.h>
26#include <linux/clockchips.h>
27#include <linux/clk.h>
28#include <linux/of.h>
29#include <linux/of_irq.h>
30
31#include <asm/mach/time.h>
32#include <asm/sched_clock.h>
33#include <mach/mxs.h>
34#include <mach/common.h>
35
36/*
37 * There are 2 versions of the timrot on Freescale MXS-based SoCs.
38 * The v1 on MX23 only gets 16 bits counter, while v2 on MX28
39 * extends the counter to 32 bits.
40 *
41 * The implementation uses two timers, one for clock_event and
42 * another for clocksource. MX28 uses timrot 0 and 1, while MX23
43 * uses 0 and 2.
44 */
45
46#define MX23_TIMROT_VERSION_OFFSET 0x0a0
47#define MX28_TIMROT_VERSION_OFFSET 0x120
48#define BP_TIMROT_MAJOR_VERSION 24
49#define BV_TIMROT_VERSION_1 0x01
50#define BV_TIMROT_VERSION_2 0x02
51#define timrot_is_v1() (timrot_major_version == BV_TIMROT_VERSION_1)
52
53/*
54 * There are 4 registers for each timrotv2 instance, and 2 registers
55 * for each timrotv1. So address step 0x40 in macros below strides
56 * one instance of timrotv2 while two instances of timrotv1.
57 *
58 * As the result, HW_TIMROT_XXXn(1) defines the address of timrot1
59 * on MX28 while timrot2 on MX23.
60 */
61/* common between v1 and v2 */
62#define HW_TIMROT_ROTCTRL 0x00
63#define HW_TIMROT_TIMCTRLn(n) (0x20 + (n) * 0x40)
64/* v1 only */
65#define HW_TIMROT_TIMCOUNTn(n) (0x30 + (n) * 0x40)
66/* v2 only */
67#define HW_TIMROT_RUNNING_COUNTn(n) (0x30 + (n) * 0x40)
68#define HW_TIMROT_FIXED_COUNTn(n) (0x40 + (n) * 0x40)
69
70#define BM_TIMROT_TIMCTRLn_RELOAD (1 << 6)
71#define BM_TIMROT_TIMCTRLn_UPDATE (1 << 7)
72#define BM_TIMROT_TIMCTRLn_IRQ_EN (1 << 14)
73#define BM_TIMROT_TIMCTRLn_IRQ (1 << 15)
74#define BP_TIMROT_TIMCTRLn_SELECT 0
75#define BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL 0x8
76#define BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL 0xb
77#define BV_TIMROTv2_TIMCTRLn_SELECT__TICK_ALWAYS 0xf
78
79static struct clock_event_device mxs_clockevent_device;
80static enum clock_event_mode mxs_clockevent_mode = CLOCK_EVT_MODE_UNUSED;
81
82static void __iomem *mxs_timrot_base = MXS_IO_ADDRESS(MXS_TIMROT_BASE_ADDR);
83static u32 timrot_major_version;
84
85static inline void timrot_irq_disable(void)
86{
87 __mxs_clrl(BM_TIMROT_TIMCTRLn_IRQ_EN,
88 mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
89}
90
91static inline void timrot_irq_enable(void)
92{
93 __mxs_setl(BM_TIMROT_TIMCTRLn_IRQ_EN,
94 mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
95}
96
97static void timrot_irq_acknowledge(void)
98{
99 __mxs_clrl(BM_TIMROT_TIMCTRLn_IRQ,
100 mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
101}
102
103static cycle_t timrotv1_get_cycles(struct clocksource *cs)
104{
105 return ~((__raw_readl(mxs_timrot_base + HW_TIMROT_TIMCOUNTn(1))
106 & 0xffff0000) >> 16);
107}
108
109static int timrotv1_set_next_event(unsigned long evt,
110 struct clock_event_device *dev)
111{
112 /* timrot decrements the count */
113 __raw_writel(evt, mxs_timrot_base + HW_TIMROT_TIMCOUNTn(0));
114
115 return 0;
116}
117
118static int timrotv2_set_next_event(unsigned long evt,
119 struct clock_event_device *dev)
120{
121 /* timrot decrements the count */
122 __raw_writel(evt, mxs_timrot_base + HW_TIMROT_FIXED_COUNTn(0));
123
124 return 0;
125}
126
127static irqreturn_t mxs_timer_interrupt(int irq, void *dev_id)
128{
129 struct clock_event_device *evt = dev_id;
130
131 timrot_irq_acknowledge();
132 evt->event_handler(evt);
133
134 return IRQ_HANDLED;
135}
136
137static struct irqaction mxs_timer_irq = {
138 .name = "MXS Timer Tick",
139 .dev_id = &mxs_clockevent_device,
140 .flags = IRQF_TIMER | IRQF_IRQPOLL,
141 .handler = mxs_timer_interrupt,
142};
143
144#ifdef DEBUG
145static const char *clock_event_mode_label[] const = {
146 [CLOCK_EVT_MODE_PERIODIC] = "CLOCK_EVT_MODE_PERIODIC",
147 [CLOCK_EVT_MODE_ONESHOT] = "CLOCK_EVT_MODE_ONESHOT",
148 [CLOCK_EVT_MODE_SHUTDOWN] = "CLOCK_EVT_MODE_SHUTDOWN",
149 [CLOCK_EVT_MODE_UNUSED] = "CLOCK_EVT_MODE_UNUSED"
150};
151#endif /* DEBUG */
152
153static void mxs_set_mode(enum clock_event_mode mode,
154 struct clock_event_device *evt)
155{
156 /* Disable interrupt in timer module */
157 timrot_irq_disable();
158
159 if (mode != mxs_clockevent_mode) {
160 /* Set event time into the furthest future */
161 if (timrot_is_v1())
162 __raw_writel(0xffff,
163 mxs_timrot_base + HW_TIMROT_TIMCOUNTn(1));
164 else
165 __raw_writel(0xffffffff,
166 mxs_timrot_base + HW_TIMROT_FIXED_COUNTn(1));
167
168 /* Clear pending interrupt */
169 timrot_irq_acknowledge();
170 }
171
172#ifdef DEBUG
173 pr_info("%s: changing mode from %s to %s\n", __func__,
174 clock_event_mode_label[mxs_clockevent_mode],
175 clock_event_mode_label[mode]);
176#endif /* DEBUG */
177
178 /* Remember timer mode */
179 mxs_clockevent_mode = mode;
180
181 switch (mode) {
182 case CLOCK_EVT_MODE_PERIODIC:
183 pr_err("%s: Periodic mode is not implemented\n", __func__);
184 break;
185 case CLOCK_EVT_MODE_ONESHOT:
186 timrot_irq_enable();
187 break;
188 case CLOCK_EVT_MODE_SHUTDOWN:
189 case CLOCK_EVT_MODE_UNUSED:
190 case CLOCK_EVT_MODE_RESUME:
191 /* Left event sources disabled, no more interrupts appear */
192 break;
193 }
194}
195
196static struct clock_event_device mxs_clockevent_device = {
197 .name = "mxs_timrot",
198 .features = CLOCK_EVT_FEAT_ONESHOT,
199 .set_mode = mxs_set_mode,
200 .set_next_event = timrotv2_set_next_event,
201 .rating = 200,
202};
203
204static int __init mxs_clockevent_init(struct clk *timer_clk)
205{
206 if (timrot_is_v1())
207 mxs_clockevent_device.set_next_event = timrotv1_set_next_event;
208 mxs_clockevent_device.cpumask = cpumask_of(0);
209 clockevents_config_and_register(&mxs_clockevent_device,
210 clk_get_rate(timer_clk),
211 timrot_is_v1() ? 0xf : 0x2,
212 timrot_is_v1() ? 0xfffe : 0xfffffffe);
213
214 return 0;
215}
216
217static struct clocksource clocksource_mxs = {
218 .name = "mxs_timer",
219 .rating = 200,
220 .read = timrotv1_get_cycles,
221 .mask = CLOCKSOURCE_MASK(16),
222 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
223};
224
225static u32 notrace mxs_read_sched_clock_v2(void)
226{
227 return ~readl_relaxed(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1));
228}
229
230static int __init mxs_clocksource_init(struct clk *timer_clk)
231{
232 unsigned int c = clk_get_rate(timer_clk);
233
234 if (timrot_is_v1())
235 clocksource_register_hz(&clocksource_mxs, c);
236 else {
237 clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
238 "mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
239 setup_sched_clock(mxs_read_sched_clock_v2, 32, c);
240 }
241
242 return 0;
243}
244
245void __init mxs_timer_init(void)
246{
247 struct device_node *np;
248 struct clk *timer_clk;
249 int irq;
250
251 np = of_find_compatible_node(NULL, NULL, "fsl,timrot");
252 if (!np) {
253 pr_err("%s: failed find timrot node\n", __func__);
254 return;
255 }
256
257 timer_clk = clk_get_sys("timrot", NULL);
258 if (IS_ERR(timer_clk)) {
259 pr_err("%s: failed to get clk\n", __func__);
260 return;
261 }
262
263 clk_prepare_enable(timer_clk);
264
265 /*
266 * Initialize timers to a known state
267 */
268 mxs_reset_block(mxs_timrot_base + HW_TIMROT_ROTCTRL);
269
270 /* get timrot version */
271 timrot_major_version = __raw_readl(mxs_timrot_base +
272 (cpu_is_mx23() ? MX23_TIMROT_VERSION_OFFSET :
273 MX28_TIMROT_VERSION_OFFSET));
274 timrot_major_version >>= BP_TIMROT_MAJOR_VERSION;
275
276 /* one for clock_event */
277 __raw_writel((timrot_is_v1() ?
278 BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL :
279 BV_TIMROTv2_TIMCTRLn_SELECT__TICK_ALWAYS) |
280 BM_TIMROT_TIMCTRLn_UPDATE |
281 BM_TIMROT_TIMCTRLn_IRQ_EN,
282 mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
283
284 /* another for clocksource */
285 __raw_writel((timrot_is_v1() ?
286 BV_TIMROTv1_TIMCTRLn_SELECT__32KHZ_XTAL :
287 BV_TIMROTv2_TIMCTRLn_SELECT__TICK_ALWAYS) |
288 BM_TIMROT_TIMCTRLn_RELOAD,
289 mxs_timrot_base + HW_TIMROT_TIMCTRLn(1));
290
291 /* set clocksource timer fixed count to the maximum */
292 if (timrot_is_v1())
293 __raw_writel(0xffff,
294 mxs_timrot_base + HW_TIMROT_TIMCOUNTn(1));
295 else
296 __raw_writel(0xffffffff,
297 mxs_timrot_base + HW_TIMROT_FIXED_COUNTn(1));
298
299 /* init and register the timer to the framework */
300 mxs_clocksource_init(timer_clk);
301 mxs_clockevent_init(timer_clk);
302
303 /* Make irqs happen */
304 irq = irq_of_parse_and_map(np, 0);
305 setup_irq(irq, &mxs_timer_irq);
306}
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 82226a5d60ef..9b9d105f194c 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -1,5 +1,24 @@
1if ARCH_NOMADIK 1config ARCH_NOMADIK
2 bool "ST-Ericsson Nomadik"
3 depends on ARCH_MULTI_V5
4 select ARCH_REQUIRE_GPIOLIB
5 select ARM_AMBA
6 select ARM_VIC
7 select CLKSRC_NOMADIK_MTU
8 select CLKSRC_NOMADIK_MTU_SCHED_CLOCK
9 select COMMON_CLK
10 select CPU_ARM926T
11 select GENERIC_CLOCKEVENTS
12 select MIGHT_HAVE_CACHE_L2X0
13 select PINCTRL
14 select PINCTRL_NOMADIK
15 select PINCTRL_STN8815
16 select SPARSE_IRQ
17 select USE_OF
18 help
19 Support for the Nomadik platform by ST-Ericsson
2 20
21if ARCH_NOMADIK
3menu "Nomadik boards" 22menu "Nomadik boards"
4 23
5config MACH_NOMADIK_8815NHK 24config MACH_NOMADIK_8815NHK
@@ -9,8 +28,8 @@ config MACH_NOMADIK_8815NHK
9 select I2C_ALGOBIT 28 select I2C_ALGOBIT
10 29
11endmenu 30endmenu
31endif
12 32
13config NOMADIK_8815 33config NOMADIK_8815
34 depends on ARCH_NOMADIK
14 bool 35 bool
15
16endif
diff --git a/arch/arm/mach-nomadik/Makefile.boot b/arch/arm/mach-nomadik/Makefile.boot
deleted file mode 100644
index ff0a4b5b0a82..000000000000
--- a/arch/arm/mach-nomadik/Makefile.boot
+++ /dev/null
@@ -1,4 +0,0 @@
1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
4
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 21c1aa512640..59f6ff5c9bae 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -38,7 +38,6 @@
38#include <linux/gpio.h> 38#include <linux/gpio.h>
39#include <linux/amba/mmci.h> 39#include <linux/amba/mmci.h>
40 40
41#include <mach/irqs.h>
42#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
43#include <asm/mach/map.h> 42#include <asm/mach/map.h>
44#include <asm/mach/time.h> 43#include <asm/mach/time.h>
diff --git a/arch/arm/mach-nomadik/include/mach/irqs.h b/arch/arm/mach-nomadik/include/mach/irqs.h
deleted file mode 100644
index 90ac965a92fe..000000000000
--- a/arch/arm/mach-nomadik/include/mach/irqs.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * mach-nomadik/include/mach/irqs.h
3 *
4 * Copyright (C) ST Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARCH_IRQS_H
21#define __ASM_ARCH_IRQS_H
22
23#define IRQ_VIC_START 32 /* first VIC interrupt is 1 */
24
25/*
26 * Interrupt numbers generic for all Nomadik Chip cuts
27 */
28#define IRQ_WATCHDOG (IRQ_VIC_START+0)
29#define IRQ_SOFTINT (IRQ_VIC_START+1)
30#define IRQ_CRYPTO (IRQ_VIC_START+2)
31#define IRQ_OWM (IRQ_VIC_START+3)
32#define IRQ_MTU0 (IRQ_VIC_START+4)
33#define IRQ_MTU1 (IRQ_VIC_START+5)
34#define IRQ_GPIO0 (IRQ_VIC_START+6)
35#define IRQ_GPIO1 (IRQ_VIC_START+7)
36#define IRQ_GPIO2 (IRQ_VIC_START+8)
37#define IRQ_GPIO3 (IRQ_VIC_START+9)
38#define IRQ_RTC_RTT (IRQ_VIC_START+10)
39#define IRQ_SSP (IRQ_VIC_START+11)
40#define IRQ_UART0 (IRQ_VIC_START+12)
41#define IRQ_DMA1 (IRQ_VIC_START+13)
42#define IRQ_CLCD_MDIF (IRQ_VIC_START+14)
43#define IRQ_DMA0 (IRQ_VIC_START+15)
44#define IRQ_PWRFAIL (IRQ_VIC_START+16)
45#define IRQ_UART1 (IRQ_VIC_START+17)
46#define IRQ_FIRDA (IRQ_VIC_START+18)
47#define IRQ_MSP0 (IRQ_VIC_START+19)
48#define IRQ_I2C0 (IRQ_VIC_START+20)
49#define IRQ_I2C1 (IRQ_VIC_START+21)
50#define IRQ_SDMMC (IRQ_VIC_START+22)
51#define IRQ_USBOTG (IRQ_VIC_START+23)
52#define IRQ_SVA_IT0 (IRQ_VIC_START+24)
53#define IRQ_SVA_IT1 (IRQ_VIC_START+25)
54#define IRQ_SAA_IT0 (IRQ_VIC_START+26)
55#define IRQ_SAA_IT1 (IRQ_VIC_START+27)
56#define IRQ_UART2 (IRQ_VIC_START+28)
57#define IRQ_MSP2 (IRQ_VIC_START+29)
58#define IRQ_L2CC (IRQ_VIC_START+30)
59#define IRQ_HPI (IRQ_VIC_START+31)
60#define IRQ_SKE (IRQ_VIC_START+32)
61#define IRQ_KP (IRQ_VIC_START+33)
62#define IRQ_MEMST (IRQ_VIC_START+34)
63#define IRQ_SGA_IT (IRQ_VIC_START+35)
64#define IRQ_USBM (IRQ_VIC_START+36)
65#define IRQ_MSP1 (IRQ_VIC_START+37)
66
67#define NOMADIK_GPIO_OFFSET (IRQ_VIC_START+64)
68
69/* After chip-specific IRQ numbers we have the GPIO ones */
70#define NOMADIK_NR_GPIO 128 /* last 4 not wired to pins */
71#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + NOMADIK_GPIO_OFFSET)
72#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - NOMADIK_GPIO_OFFSET)
73#define NOMADIK_NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO)
74
75/* Following two are used by entry_macro.S, to access our dual-vic */
76#define VIC_REG_IRQSR0 0
77#define VIC_REG_IRQSR1 0x20
78
79#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-nomadik/include/mach/timex.h b/arch/arm/mach-nomadik/include/mach/timex.h
deleted file mode 100644
index 318b8896ce96..000000000000
--- a/arch/arm/mach-nomadik/include/mach/timex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARCH_TIMEX_H
2#define __ASM_ARCH_TIMEX_H
3
4#define CLOCK_TICK_RATE 2400000
5
6#endif
diff --git a/arch/arm/mach-nomadik/include/mach/uncompress.h b/arch/arm/mach-nomadik/include/mach/uncompress.h
deleted file mode 100644
index 106fccca2021..000000000000
--- a/arch/arm/mach-nomadik/include/mach/uncompress.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2008 STMicroelectronics
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARCH_UNCOMPRESS_H
20#define __ASM_ARCH_UNCOMPRESS_H
21
22#include <asm/setup.h>
23#include <asm/io.h>
24
25/* we need the constants in amba/serial.h, but it refers to amba_device */
26struct amba_device;
27#include <linux/amba/serial.h>
28
29#define NOMADIK_UART_DR (void __iomem *)0x101FB000
30#define NOMADIK_UART_LCRH (void __iomem *)0x101FB02c
31#define NOMADIK_UART_CR (void __iomem *)0x101FB030
32#define NOMADIK_UART_FR (void __iomem *)0x101FB018
33
34static void putc(const char c)
35{
36 /* Do nothing if the UART is not enabled. */
37 if (!(readb(NOMADIK_UART_CR) & UART01x_CR_UARTEN))
38 return;
39
40 if (c == '\n')
41 putc('\r');
42
43 while (readb(NOMADIK_UART_FR) & UART01x_FR_TXFF)
44 barrier();
45 writeb(c, NOMADIK_UART_DR);
46}
47
48static void flush(void)
49{
50 if (!(readb(NOMADIK_UART_CR) & UART01x_CR_UARTEN))
51 return;
52 while (readb(NOMADIK_UART_FR) & UART01x_FR_BUSY)
53 barrier();
54}
55
56static inline void arch_decomp_setup(void)
57{
58}
59
60#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 903da8eb886c..cdd05f2e67ee 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -55,12 +55,6 @@ config MACH_OMAP_H3
55 TI OMAP 1710 H3 board support. Say Y here if you have such 55 TI OMAP 1710 H3 board support. Say Y here if you have such
56 a board. 56 a board.
57 57
58config MACH_OMAP_HTCWIZARD
59 bool "HTC Wizard"
60 depends on ARCH_OMAP850
61 help
62 HTC Wizard smartphone support (AKA QTEK 9100, ...)
63
64config MACH_HERALD 58config MACH_HERALD
65 bool "HTC Herald" 59 bool "HTC Herald"
66 depends on ARCH_OMAP850 60 depends on ARCH_OMAP850
diff --git a/arch/arm/mach-omap1/dma.h b/arch/arm/mach-omap1/dma.h
index da6345dab03f..d05909c96715 100644
--- a/arch/arm/mach-omap1/dma.h
+++ b/arch/arm/mach-omap1/dma.h
@@ -21,21 +21,10 @@
21 21
22/* DMA channels for omap1 */ 22/* DMA channels for omap1 */
23#define OMAP_DMA_NO_DEVICE 0 23#define OMAP_DMA_NO_DEVICE 0
24#define OMAP_DMA_MCSI1_TX 1
25#define OMAP_DMA_MCSI1_RX 2
26#define OMAP_DMA_I2C_RX 3
27#define OMAP_DMA_I2C_TX 4
28#define OMAP_DMA_EXT_NDMA_REQ 5
29#define OMAP_DMA_EXT_NDMA_REQ2 6
30#define OMAP_DMA_UWIRE_TX 7
31#define OMAP_DMA_MCBSP1_TX 8 24#define OMAP_DMA_MCBSP1_TX 8
32#define OMAP_DMA_MCBSP1_RX 9 25#define OMAP_DMA_MCBSP1_RX 9
33#define OMAP_DMA_MCBSP3_TX 10 26#define OMAP_DMA_MCBSP3_TX 10
34#define OMAP_DMA_MCBSP3_RX 11 27#define OMAP_DMA_MCBSP3_RX 11
35#define OMAP_DMA_UART1_TX 12
36#define OMAP_DMA_UART1_RX 13
37#define OMAP_DMA_UART2_TX 14
38#define OMAP_DMA_UART2_RX 15
39#define OMAP_DMA_MCBSP2_TX 16 28#define OMAP_DMA_MCBSP2_TX 16
40#define OMAP_DMA_MCBSP2_RX 17 29#define OMAP_DMA_MCBSP2_RX 17
41#define OMAP_DMA_UART3_TX 18 30#define OMAP_DMA_UART3_TX 18
@@ -43,41 +32,11 @@
43#define OMAP_DMA_CAMERA_IF_RX 20 32#define OMAP_DMA_CAMERA_IF_RX 20
44#define OMAP_DMA_MMC_TX 21 33#define OMAP_DMA_MMC_TX 21
45#define OMAP_DMA_MMC_RX 22 34#define OMAP_DMA_MMC_RX 22
46#define OMAP_DMA_NAND 23
47#define OMAP_DMA_IRQ_LCD_LINE 24
48#define OMAP_DMA_MEMORY_STICK 25
49#define OMAP_DMA_USB_W2FC_RX0 26 35#define OMAP_DMA_USB_W2FC_RX0 26
50#define OMAP_DMA_USB_W2FC_RX1 27
51#define OMAP_DMA_USB_W2FC_RX2 28
52#define OMAP_DMA_USB_W2FC_TX0 29 36#define OMAP_DMA_USB_W2FC_TX0 29
53#define OMAP_DMA_USB_W2FC_TX1 30
54#define OMAP_DMA_USB_W2FC_TX2 31
55 37
56/* These are only for 1610 */ 38/* These are only for 1610 */
57#define OMAP_DMA_CRYPTO_DES_IN 32
58#define OMAP_DMA_SPI_TX 33
59#define OMAP_DMA_SPI_RX 34
60#define OMAP_DMA_CRYPTO_HASH 35
61#define OMAP_DMA_CCP_ATTN 36
62#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
63#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
64#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
65#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
66#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
67#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
68#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
69#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
70#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
71#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
72#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
73#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
74#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
75#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
76#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
77#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
78#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
79#define OMAP_DMA_MMC2_TX 54 39#define OMAP_DMA_MMC2_TX 54
80#define OMAP_DMA_MMC2_RX 55 40#define OMAP_DMA_MMC2_RX 55
81#define OMAP_DMA_CRYPTO_DES_OUT 56
82 41
83#endif /* __OMAP1_DMA_CHANNEL_H */ 42#endif /* __OMAP1_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap1/include/mach/usb.h b/arch/arm/mach-omap1/include/mach/usb.h
index 753cd5ce6949..45e5ac707cbb 100644
--- a/arch/arm/mach-omap1/include/mach/usb.h
+++ b/arch/arm/mach-omap1/include/mach/usb.h
@@ -2,7 +2,7 @@
2 * FIXME correct answer depends on hmc_mode, 2 * FIXME correct answer depends on hmc_mode,
3 * as does (on omap1) any nonzero value for config->otg port number 3 * as does (on omap1) any nonzero value for config->otg port number
4 */ 4 */
5#ifdef CONFIG_USB_GADGET_OMAP 5#if IS_ENABLED(CONFIG_USB_OMAP)
6#define is_usb0_device(config) 1 6#define is_usb0_device(config) 1
7#else 7#else
8#define is_usb0_device(config) 0 8#define is_usb0_device(config) 0
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 7a7690ab6cb8..358b82cb9f78 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -37,12 +37,14 @@
37 37
38#include <linux/suspend.h> 38#include <linux/suspend.h>
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/proc_fs.h> 40#include <linux/debugfs.h>
41#include <linux/seq_file.h>
41#include <linux/interrupt.h> 42#include <linux/interrupt.h>
42#include <linux/sysfs.h> 43#include <linux/sysfs.h>
43#include <linux/module.h> 44#include <linux/module.h>
44#include <linux/io.h> 45#include <linux/io.h>
45#include <linux/atomic.h> 46#include <linux/atomic.h>
47#include <linux/cpu.h>
46 48
47#include <asm/fncpy.h> 49#include <asm/fncpy.h>
48#include <asm/system_misc.h> 50#include <asm/system_misc.h>
@@ -422,23 +424,12 @@ void omap1_pm_suspend(void)
422 omap_rev()); 424 omap_rev());
423} 425}
424 426
425#if defined(DEBUG) && defined(CONFIG_PROC_FS) 427#ifdef CONFIG_DEBUG_FS
426static int g_read_completed;
427
428/* 428/*
429 * Read system PM registers for debugging 429 * Read system PM registers for debugging
430 */ 430 */
431static int omap_pm_read_proc( 431static int omap_pm_debug_show(struct seq_file *m, void *v)
432 char *page_buffer,
433 char **my_first_byte,
434 off_t virtual_start,
435 int length,
436 int *eof,
437 void *data)
438{ 432{
439 int my_buffer_offset = 0;
440 char * const my_base = page_buffer;
441
442 ARM_SAVE(ARM_CKCTL); 433 ARM_SAVE(ARM_CKCTL);
443 ARM_SAVE(ARM_IDLECT1); 434 ARM_SAVE(ARM_IDLECT1);
444 ARM_SAVE(ARM_IDLECT2); 435 ARM_SAVE(ARM_IDLECT2);
@@ -479,10 +470,7 @@ static int omap_pm_read_proc(
479 MPUI1610_SAVE(EMIFS_CONFIG); 470 MPUI1610_SAVE(EMIFS_CONFIG);
480 } 471 }
481 472
482 if (virtual_start == 0) { 473 seq_printf(m,
483 g_read_completed = 0;
484
485 my_buffer_offset += sprintf(my_base + my_buffer_offset,
486 "ARM_CKCTL_REG: 0x%-8x \n" 474 "ARM_CKCTL_REG: 0x%-8x \n"
487 "ARM_IDLECT1_REG: 0x%-8x \n" 475 "ARM_IDLECT1_REG: 0x%-8x \n"
488 "ARM_IDLECT2_REG: 0x%-8x \n" 476 "ARM_IDLECT2_REG: 0x%-8x \n"
@@ -512,8 +500,8 @@ static int omap_pm_read_proc(
512 ULPD_SHOW(ULPD_STATUS_REQ), 500 ULPD_SHOW(ULPD_STATUS_REQ),
513 ULPD_SHOW(ULPD_POWER_CTRL)); 501 ULPD_SHOW(ULPD_POWER_CTRL));
514 502
515 if (cpu_is_omap7xx()) { 503 if (cpu_is_omap7xx()) {
516 my_buffer_offset += sprintf(my_base + my_buffer_offset, 504 seq_printf(m,
517 "MPUI7XX_CTRL_REG 0x%-8x \n" 505 "MPUI7XX_CTRL_REG 0x%-8x \n"
518 "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" 506 "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n"
519 "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" 507 "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
@@ -526,8 +514,8 @@ static int omap_pm_read_proc(
526 MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), 514 MPUI7XX_SHOW(MPUI_DSP_API_CONFIG),
527 MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), 515 MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG),
528 MPUI7XX_SHOW(EMIFS_CONFIG)); 516 MPUI7XX_SHOW(EMIFS_CONFIG));
529 } else if (cpu_is_omap15xx()) { 517 } else if (cpu_is_omap15xx()) {
530 my_buffer_offset += sprintf(my_base + my_buffer_offset, 518 seq_printf(m,
531 "MPUI1510_CTRL_REG 0x%-8x \n" 519 "MPUI1510_CTRL_REG 0x%-8x \n"
532 "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" 520 "MPUI1510_DSP_STATUS_REG: 0x%-8x \n"
533 "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" 521 "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
@@ -540,8 +528,8 @@ static int omap_pm_read_proc(
540 MPUI1510_SHOW(MPUI_DSP_API_CONFIG), 528 MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
541 MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), 529 MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
542 MPUI1510_SHOW(EMIFS_CONFIG)); 530 MPUI1510_SHOW(EMIFS_CONFIG));
543 } else if (cpu_is_omap16xx()) { 531 } else if (cpu_is_omap16xx()) {
544 my_buffer_offset += sprintf(my_base + my_buffer_offset, 532 seq_printf(m,
545 "MPUI1610_CTRL_REG 0x%-8x \n" 533 "MPUI1610_CTRL_REG 0x%-8x \n"
546 "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" 534 "MPUI1610_DSP_STATUS_REG: 0x%-8x \n"
547 "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" 535 "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
@@ -554,28 +542,37 @@ static int omap_pm_read_proc(
554 MPUI1610_SHOW(MPUI_DSP_API_CONFIG), 542 MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
555 MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), 543 MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
556 MPUI1610_SHOW(EMIFS_CONFIG)); 544 MPUI1610_SHOW(EMIFS_CONFIG));
557 }
558
559 g_read_completed++;
560 } else if (g_read_completed >= 1) {
561 *eof = 1;
562 return 0;
563 } 545 }
564 g_read_completed++;
565 546
566 *my_first_byte = page_buffer; 547 return 0;
567 return my_buffer_offset;
568} 548}
569 549
570static void omap_pm_init_proc(void) 550static int omap_pm_debug_open(struct inode *inode, struct file *file)
571{ 551{
572 /* XXX Appears to leak memory */ 552 return single_open(file, omap_pm_debug_show,
573 create_proc_read_entry("driver/omap_pm", 553 &inode->i_private);
574 S_IWUSR | S_IRUGO, NULL,
575 omap_pm_read_proc, NULL);
576} 554}
577 555
578#endif /* DEBUG && CONFIG_PROC_FS */ 556static const struct file_operations omap_pm_debug_fops = {
557 .open = omap_pm_debug_open,
558 .read = seq_read,
559 .llseek = seq_lseek,
560 .release = single_release,
561};
562
563static void omap_pm_init_debugfs(void)
564{
565 struct dentry *d;
566
567 d = debugfs_create_dir("pm_debug", NULL);
568 if (!d)
569 return;
570
571 (void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO,
572 d, NULL, &omap_pm_debug_fops);
573}
574
575#endif /* CONFIG_DEBUG_FS */
579 576
580/* 577/*
581 * omap_pm_prepare - Do preliminary suspend work. 578 * omap_pm_prepare - Do preliminary suspend work.
@@ -584,8 +581,7 @@ static void omap_pm_init_proc(void)
584static int omap_pm_prepare(void) 581static int omap_pm_prepare(void)
585{ 582{
586 /* We cannot sleep in idle until we have resumed */ 583 /* We cannot sleep in idle until we have resumed */
587 disable_hlt(); 584 cpu_idle_poll_ctrl(true);
588
589 return 0; 585 return 0;
590} 586}
591 587
@@ -621,7 +617,7 @@ static int omap_pm_enter(suspend_state_t state)
621 617
622static void omap_pm_finish(void) 618static void omap_pm_finish(void)
623{ 619{
624 enable_hlt(); 620 cpu_idle_poll_ctrl(false);
625} 621}
626 622
627 623
@@ -701,8 +697,8 @@ static int __init omap_pm_init(void)
701 697
702 suspend_set_ops(&omap_pm_ops); 698 suspend_set_ops(&omap_pm_ops);
703 699
704#if defined(DEBUG) && defined(CONFIG_PROC_FS) 700#ifdef CONFIG_DEBUG_FS
705 omap_pm_init_proc(); 701 omap_pm_init_debugfs();
706#endif 702#endif
707 703
708#ifdef CONFIG_OMAP_32K_TIMER 704#ifdef CONFIG_OMAP_32K_TIMER
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c
index 1a1db5971cd9..4118db50d5e8 100644
--- a/arch/arm/mach-omap1/usb.c
+++ b/arch/arm/mach-omap1/usb.c
@@ -123,7 +123,7 @@ omap_otg_init(struct omap_usb_config *config)
123 syscon = omap_readl(OTG_SYSCON_1); 123 syscon = omap_readl(OTG_SYSCON_1);
124 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; 124 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN;
125 125
126#ifdef CONFIG_USB_GADGET_OMAP 126#if IS_ENABLED(CONFIG_USB_OMAP)
127 if (config->otg || config->register_dev) { 127 if (config->otg || config->register_dev) {
128 struct platform_device *udc_device = config->udc_device; 128 struct platform_device *udc_device = config->udc_device;
129 int status; 129 int status;
@@ -169,7 +169,7 @@ omap_otg_init(struct omap_usb_config *config)
169void omap_otg_init(struct omap_usb_config *config) {} 169void omap_otg_init(struct omap_usb_config *config) {}
170#endif 170#endif
171 171
172#ifdef CONFIG_USB_GADGET_OMAP 172#if IS_ENABLED(CONFIG_USB_OMAP)
173 173
174static struct resource udc_resources[] = { 174static struct resource udc_resources[] = {
175 /* order is significant! */ 175 /* order is significant! */
@@ -600,7 +600,7 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config)
600 while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK)) 600 while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK))
601 cpu_relax(); 601 cpu_relax();
602 602
603#ifdef CONFIG_USB_GADGET_OMAP 603#if IS_ENABLED(CONFIG_USB_OMAP)
604 if (config->register_dev) { 604 if (config->register_dev) {
605 int status; 605 int status;
606 606
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 8111cd9ff3e5..857b1f097fd8 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -15,6 +15,7 @@ config ARCH_OMAP2PLUS
15 select OMAP_DM_TIMER 15 select OMAP_DM_TIMER
16 select PINCTRL 16 select PINCTRL
17 select PROC_DEVICETREE if PROC_FS 17 select PROC_DEVICETREE if PROC_FS
18 select SOC_BUS
18 select SPARSE_IRQ 19 select SPARSE_IRQ
19 select USE_OF 20 select USE_OF
20 help 21 help
@@ -55,6 +56,7 @@ config SOC_HAS_REALTIME_COUNTER
55config ARCH_OMAP2 56config ARCH_OMAP2
56 bool "TI OMAP2" 57 bool "TI OMAP2"
57 depends on ARCH_OMAP2PLUS 58 depends on ARCH_OMAP2PLUS
59 depends on ARCH_MULTI_V6
58 default y 60 default y
59 select CPU_V6 61 select CPU_V6
60 select MULTI_IRQ_HANDLER 62 select MULTI_IRQ_HANDLER
@@ -64,6 +66,7 @@ config ARCH_OMAP2
64config ARCH_OMAP3 66config ARCH_OMAP3
65 bool "TI OMAP3" 67 bool "TI OMAP3"
66 depends on ARCH_OMAP2PLUS 68 depends on ARCH_OMAP2PLUS
69 depends on ARCH_MULTI_V7
67 default y 70 default y
68 select ARCH_HAS_OPP 71 select ARCH_HAS_OPP
69 select ARM_CPU_SUSPEND if PM 72 select ARM_CPU_SUSPEND if PM
@@ -80,6 +83,7 @@ config ARCH_OMAP4
80 bool "TI OMAP4" 83 bool "TI OMAP4"
81 default y 84 default y
82 depends on ARCH_OMAP2PLUS 85 depends on ARCH_OMAP2PLUS
86 depends on ARCH_MULTI_V7
83 select ARCH_HAS_OPP 87 select ARCH_HAS_OPP
84 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP 88 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
85 select ARM_CPU_SUSPEND if PM 89 select ARM_CPU_SUSPEND if PM
@@ -87,6 +91,8 @@ config ARCH_OMAP4
87 select ARM_GIC 91 select ARM_GIC
88 select CACHE_L2X0 92 select CACHE_L2X0
89 select CPU_V7 93 select CPU_V7
94 select HAVE_ARM_SCU if SMP
95 select HAVE_ARM_TWD if LOCAL_TIMERS
90 select HAVE_SMP 96 select HAVE_SMP
91 select LOCAL_TIMERS if SMP 97 select LOCAL_TIMERS if SMP
92 select OMAP_INTERCONNECT 98 select OMAP_INTERCONNECT
@@ -96,9 +102,12 @@ config ARCH_OMAP4
96 select PM_RUNTIME if CPU_IDLE 102 select PM_RUNTIME if CPU_IDLE
97 select USB_ARCH_HAS_EHCI if USB_SUPPORT 103 select USB_ARCH_HAS_EHCI if USB_SUPPORT
98 select COMMON_CLK 104 select COMMON_CLK
105 select ARM_ERRATA_754322
106 select ARM_ERRATA_775420
99 107
100config SOC_OMAP5 108config SOC_OMAP5
101 bool "TI OMAP5" 109 bool "TI OMAP5"
110 depends on ARCH_MULTI_V7
102 select ARM_CPU_SUSPEND if PM 111 select ARM_CPU_SUSPEND if PM
103 select ARM_GIC 112 select ARM_GIC
104 select CPU_V7 113 select CPU_V7
@@ -135,6 +144,7 @@ config SOC_TI81XX
135 144
136config SOC_AM33XX 145config SOC_AM33XX
137 bool "AM33XX support" 146 bool "AM33XX support"
147 depends on ARCH_MULTI_V7
138 default y 148 default y
139 select ARM_CPU_SUSPEND if PM 149 select ARM_CPU_SUSPEND if PM
140 select CPU_V7 150 select CPU_V7
@@ -408,7 +418,7 @@ config OMAP3_SDRC_AC_TIMING
408 418
409config OMAP4_ERRATA_I688 419config OMAP4_ERRATA_I688
410 bool "OMAP4 errata: Async Bridge Corruption" 420 bool "OMAP4 errata: Async Bridge Corruption"
411 depends on ARCH_OMAP4 && !ARCH_MULTIPLATFORM 421 depends on (ARCH_OMAP4 || SOC_OMAP5) && !ARCH_MULTIPLATFORM
412 select ARCH_HAS_BARRIERS 422 select ARCH_HAS_BARRIERS
413 help 423 help
414 If a data is stalled inside asynchronous bridge because of back 424 If a data is stalled inside asynchronous bridge because of back
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index b068b7fe99ef..62bb352c2d37 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,7 +229,6 @@ obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
229obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 229obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
230obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 230obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
231obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 231obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
232obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
233obj-$(CONFIG_MACH_OVERO) += board-overo.o 232obj-$(CONFIG_MACH_OVERO) += board-overo.o
234obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o 233obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
235obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o 234obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
@@ -255,8 +254,6 @@ obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o
255obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o 254obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
256obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o 255obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o
257 256
258obj-$(CONFIG_MACH_PCM049) += board-omap4pcm049.o
259
260obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o 257obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
261 258
262obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o 259obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index a3e0aaa4886b..5b86423c89fa 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -38,7 +38,7 @@
38#include "gpmc-smc91x.h" 38#include "gpmc-smc91x.h"
39 39
40#include <video/omapdss.h> 40#include <video/omapdss.h>
41#include <video/omap-panel-generic-dpi.h> 41#include <video/omap-panel-data.h>
42 42
43#include "mux.h" 43#include "mux.h"
44#include "hsmmc.h" 44#include "hsmmc.h"
@@ -166,7 +166,7 @@ static void __init sdp2430_display_init(void)
166 omap_display_init(&sdp2430_dss_data); 166 omap_display_init(&sdp2430_dss_data);
167} 167}
168 168
169#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) 169#if IS_ENABLED(CONFIG_SMC91X)
170 170
171static struct omap_smc91x_platform_data board_smc91x_data = { 171static struct omap_smc91x_platform_data board_smc91x_data = {
172 .cs = 5, 172 .cs = 5,
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index ce812decfaca..a4d4664894e1 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -35,7 +35,7 @@
35#include "common.h" 35#include "common.h"
36#include <linux/omap-dma.h> 36#include <linux/omap-dma.h>
37#include <video/omapdss.h> 37#include <video/omapdss.h>
38#include <video/omap-panel-tfp410.h> 38#include <video/omap-panel-data.h>
39 39
40#include "gpmc.h" 40#include "gpmc.h"
41#include "gpmc-smc91x.h" 41#include "gpmc-smc91x.h"
@@ -445,16 +445,23 @@ static void enable_board_wakeup_source(void)
445 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); 445 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
446} 446}
447 447
448static struct usbhs_phy_data phy_data[] __initdata = {
449 {
450 .port = 1,
451 .reset_gpio = 57,
452 .vcc_gpio = -EINVAL,
453 },
454 {
455 .port = 2,
456 .reset_gpio = 61,
457 .vcc_gpio = -EINVAL,
458 },
459};
460
448static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 461static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
449 462
450 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 463 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
451 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 464 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
452 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
453
454 .phy_reset = true,
455 .reset_gpio_port[0] = 57,
456 .reset_gpio_port[1] = 61,
457 .reset_gpio_port[2] = -EINVAL
458}; 465};
459 466
460#ifdef CONFIG_OMAP_MUX 467#ifdef CONFIG_OMAP_MUX
@@ -606,6 +613,8 @@ static void __init omap_3430sdp_init(void)
606 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); 613 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0);
607 sdp3430_display_init(); 614 sdp3430_display_init();
608 enable_board_wakeup_source(); 615 enable_board_wakeup_source();
616
617 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
609 usbhs_init(&usbhs_bdata); 618 usbhs_init(&usbhs_bdata);
610} 619}
611 620
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 67447bd4564f..20d6d8189240 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -53,16 +53,23 @@ static void enable_board_wakeup_source(void)
53 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); 53 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
54} 54}
55 55
56static struct usbhs_phy_data phy_data[] __initdata = {
57 {
58 .port = 1,
59 .reset_gpio = 126,
60 .vcc_gpio = -EINVAL,
61 },
62 {
63 .port = 2,
64 .reset_gpio = 61,
65 .vcc_gpio = -EINVAL,
66 },
67};
68
56static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 69static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
57 70
58 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 71 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
59 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 72 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
60 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
61
62 .phy_reset = true,
63 .reset_gpio_port[0] = 126,
64 .reset_gpio_port[1] = 61,
65 .reset_gpio_port[2] = -EINVAL
66}; 73};
67 74
68#ifdef CONFIG_OMAP_MUX 75#ifdef CONFIG_OMAP_MUX
@@ -199,6 +206,8 @@ static void __init omap_sdp_init(void)
199 board_smc91x_init(); 206 board_smc91x_init();
200 board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); 207 board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16);
201 enable_board_wakeup_source(); 208 enable_board_wakeup_source();
209
210 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
202 usbhs_init(&usbhs_bdata); 211 usbhs_init(&usbhs_bdata);
203} 212}
204 213
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 35f3ad0cb7c7..00d72902ef4f 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -291,6 +291,10 @@ static struct platform_device sdp4430_leds_pwm = {
291 }, 291 },
292}; 292};
293 293
294/* Dummy regulator for pwm-backlight driver */
295static struct regulator_consumer_supply backlight_supply =
296 REGULATOR_SUPPLY("enable", "pwm-backlight");
297
294static struct platform_pwm_backlight_data sdp4430_backlight_data = { 298static struct platform_pwm_backlight_data sdp4430_backlight_data = {
295 .max_brightness = 127, 299 .max_brightness = 127,
296 .dft_brightness = 127, 300 .dft_brightness = 127,
@@ -718,6 +722,8 @@ static void __init omap_4430sdp_init(void)
718 722
719 omap4_i2c_init(); 723 omap4_i2c_init();
720 omap_sfh7741prox_init(); 724 omap_sfh7741prox_init();
725 regulator_register_always_on(0, "backlight-enable",
726 &backlight_supply, 1, 0);
721 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 727 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
722 omap_serial_init(); 728 omap_serial_init();
723 omap_sdrc_init(NULL, NULL); 729 omap_sdrc_init(NULL, NULL);
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 7d3358b2e593..fc53911d0d13 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -47,15 +47,17 @@ static struct omap_board_mux board_mux[] __initdata = {
47}; 47};
48#endif 48#endif
49 49
50static struct usbhs_phy_data phy_data[] __initdata = {
51 {
52 .port = 1,
53 .reset_gpio = GPIO_USB_NRESET,
54 .vcc_gpio = GPIO_USB_POWER,
55 .vcc_polarity = 1,
56 },
57};
58
50static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 59static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
51 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 60 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
52 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
53 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
54
55 .phy_reset = true,
56 .reset_gpio_port[0] = GPIO_USB_NRESET,
57 .reset_gpio_port[1] = -EINVAL,
58 .reset_gpio_port[2] = -EINVAL
59}; 61};
60 62
61static struct mtd_partition crane_nand_partitions[] = { 63static struct mtd_partition crane_nand_partitions[] = {
@@ -131,13 +133,7 @@ static void __init am3517_crane_init(void)
131 return; 133 return;
132 } 134 }
133 135
134 ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH, 136 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
135 "usb_ehci_enable");
136 if (ret < 0) {
137 pr_err("Can not request GPIO %d\n", GPIO_USB_POWER);
138 return;
139 }
140
141 usbhs_init(&usbhs_bdata); 137 usbhs_init(&usbhs_bdata);
142 am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1); 138 am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
143} 139}
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 9fb85908a61e..c29d2e743688 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -35,8 +35,7 @@
35 35
36#include "common.h" 36#include "common.h"
37#include <video/omapdss.h> 37#include <video/omapdss.h>
38#include <video/omap-panel-generic-dpi.h> 38#include <video/omap-panel-data.h>
39#include <video/omap-panel-tfp410.h>
40 39
41#include "am35xx-emac.h" 40#include "am35xx-emac.h"
42#include "mux.h" 41#include "mux.h"
@@ -274,6 +273,14 @@ static __init void am3517_evm_mcbsp1_init(void)
274 omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0); 273 omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0);
275} 274}
276 275
276static struct usbhs_phy_data phy_data[] __initdata = {
277 {
278 .port = 1,
279 .reset_gpio = 57,
280 .vcc_gpio = -EINVAL,
281 },
282};
283
277static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 284static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
278 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 285 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
279#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ 286#if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \
@@ -282,12 +289,6 @@ static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
282#else 289#else
283 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 290 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
284#endif 291#endif
285 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
286
287 .phy_reset = true,
288 .reset_gpio_port[0] = 57,
289 .reset_gpio_port[1] = -EINVAL,
290 .reset_gpio_port[2] = -EINVAL
291}; 292};
292 293
293#ifdef CONFIG_OMAP_MUX 294#ifdef CONFIG_OMAP_MUX
@@ -349,7 +350,6 @@ static struct omap2_hsmmc_info mmc[] = {
349 {} /* Terminator */ 350 {} /* Terminator */
350}; 351};
351 352
352
353static void __init am3517_evm_init(void) 353static void __init am3517_evm_init(void)
354{ 354{
355 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 355 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -361,6 +361,8 @@ static void __init am3517_evm_init(void)
361 361
362 /* Configure GPIO for EHCI port */ 362 /* Configure GPIO for EHCI port */
363 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); 363 omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
364
365 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
364 usbhs_init(&usbhs_bdata); 366 usbhs_init(&usbhs_bdata);
365 am3517_evm_hecc_init(&am3517_evm_hecc_pdata); 367 am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
366 /* DSS */ 368 /* DSS */
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index af2bb219e214..e0ed8c07fc54 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -41,8 +41,7 @@
41 41
42#include <linux/platform_data/mtd-nand-omap2.h> 42#include <linux/platform_data/mtd-nand-omap2.h>
43#include <video/omapdss.h> 43#include <video/omapdss.h>
44#include <video/omap-panel-generic-dpi.h> 44#include <video/omap-panel-data.h>
45#include <video/omap-panel-tfp410.h>
46#include <linux/platform_data/spi-omap2-mcspi.h> 45#include <linux/platform_data/spi-omap2-mcspi.h>
47 46
48#include "common.h" 47#include "common.h"
@@ -419,15 +418,22 @@ static struct omap2_hsmmc_info mmc[] = {
419 {} /* Terminator */ 418 {} /* Terminator */
420}; 419};
421 420
421static struct usbhs_phy_data phy_data[] __initdata = {
422 {
423 .port = 1,
424 .reset_gpio = OMAP_MAX_GPIO_LINES + 6,
425 .vcc_gpio = -EINVAL,
426 },
427 {
428 .port = 2,
429 .reset_gpio = OMAP_MAX_GPIO_LINES + 7,
430 .vcc_gpio = -EINVAL,
431 },
432};
433
422static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 434static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
423 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 435 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
424 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 436 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
425 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
426
427 .phy_reset = true,
428 .reset_gpio_port[0] = OMAP_MAX_GPIO_LINES + 6,
429 .reset_gpio_port[1] = OMAP_MAX_GPIO_LINES + 7,
430 .reset_gpio_port[2] = -EINVAL
431}; 437};
432 438
433static void __init cm_t35_init_usbh(void) 439static void __init cm_t35_init_usbh(void)
@@ -444,6 +450,7 @@ static void __init cm_t35_init_usbh(void)
444 msleep(1); 450 msleep(1);
445 } 451 }
446 452
453 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
447 usbhs_init(&usbhs_bdata); 454 usbhs_init(&usbhs_bdata);
448} 455}
449 456
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index a66da808cc4a..4eb5e6f2f7f5 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -188,15 +188,22 @@ static inline void cm_t3517_init_rtc(void) {}
188#define HSUSB2_RESET_GPIO (147) 188#define HSUSB2_RESET_GPIO (147)
189#define USB_HUB_RESET_GPIO (152) 189#define USB_HUB_RESET_GPIO (152)
190 190
191static struct usbhs_phy_data phy_data[] __initdata = {
192 {
193 .port = 1,
194 .reset_gpio = HSUSB1_RESET_GPIO,
195 .vcc_gpio = -EINVAL,
196 },
197 {
198 .port = 2,
199 .reset_gpio = HSUSB2_RESET_GPIO,
200 .vcc_gpio = -EINVAL,
201 },
202};
203
191static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = { 204static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = {
192 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 205 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
193 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 206 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
194 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
195
196 .phy_reset = true,
197 .reset_gpio_port[0] = HSUSB1_RESET_GPIO,
198 .reset_gpio_port[1] = HSUSB2_RESET_GPIO,
199 .reset_gpio_port[2] = -EINVAL,
200}; 207};
201 208
202static int __init cm_t3517_init_usbh(void) 209static int __init cm_t3517_init_usbh(void)
@@ -213,6 +220,7 @@ static int __init cm_t3517_init_usbh(void)
213 msleep(1); 220 msleep(1);
214 } 221 }
215 222
223 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
216 usbhs_init(&cm_t3517_ehci_pdata); 224 usbhs_init(&cm_t3517_ehci_pdata);
217 225
218 return 0; 226 return 0;
@@ -324,6 +332,6 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
324 .handle_irq = omap3_intc_handle_irq, 332 .handle_irq = omap3_intc_handle_irq,
325 .init_machine = cm_t3517_init, 333 .init_machine = cm_t3517_init,
326 .init_late = am35xx_init_late, 334 .init_late = am35xx_init_late,
327 .init_time = omap3_gp_gptimer_timer_init, 335 .init_time = omap3_gptimer_timer_init,
328 .restart = omap3xxx_restart, 336 .restart = omap3xxx_restart,
329MACHINE_END 337MACHINE_END
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 53056c3b0836..e44b804f75ae 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -43,8 +43,7 @@
43#include "gpmc.h" 43#include "gpmc.h"
44#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
45#include <video/omapdss.h> 45#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 46#include <video/omap-panel-data.h>
47#include <video/omap-panel-tfp410.h>
48 47
49#include <linux/platform_data/spi-omap2-mcspi.h> 48#include <linux/platform_data/spi-omap2-mcspi.h>
50#include <linux/input/matrix_keypad.h> 49#include <linux/input/matrix_keypad.h>
@@ -437,15 +436,7 @@ static struct platform_device *devkit8000_devices[] __initdata = {
437}; 436};
438 437
439static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 438static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
440
441 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 439 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
442 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
443 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
444
445 .phy_reset = true,
446 .reset_gpio_port[0] = -EINVAL,
447 .reset_gpio_port[1] = -EINVAL,
448 .reset_gpio_port[2] = -EINVAL
449}; 440};
450 441
451#ifdef CONFIG_OMAP_MUX 442#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index e54a48060198..78813b397209 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -140,7 +140,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
140 .init_irq = omap_intc_of_init, 140 .init_irq = omap_intc_of_init,
141 .handle_irq = omap3_intc_handle_irq, 141 .handle_irq = omap3_intc_handle_irq,
142 .init_machine = omap_generic_init, 142 .init_machine = omap_generic_init,
143 .init_time = omap3_am33xx_gptimer_timer_init, 143 .init_time = omap3_gptimer_timer_init,
144 .dt_compat = am33xx_boards_compat, 144 .dt_compat = am33xx_boards_compat,
145 .restart = am33xx_restart, 145 .restart = am33xx_restart,
146MACHINE_END 146MACHINE_END
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 812c829fa46f..69c0acf5aa63 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -34,7 +34,7 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <video/omapdss.h> 36#include <video/omapdss.h>
37#include <video/omap-panel-generic-dpi.h> 37#include <video/omap-panel-data.h>
38 38
39#include "common.h" 39#include "common.h"
40#include "mux.h" 40#include "mux.h"
@@ -246,7 +246,7 @@ static u32 is_gpmc_muxed(void)
246 return 0; 246 return 0;
247} 247}
248 248
249#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) 249#if IS_ENABLED(CONFIG_SMC91X)
250 250
251static struct omap_smc91x_platform_data board_smc91x_data = { 251static struct omap_smc91x_platform_data board_smc91x_data = {
252 .cs = 1, 252 .cs = 1,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index bf92678a01d0..b54562d1235e 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -31,7 +31,7 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32 32
33#include <video/omapdss.h> 33#include <video/omapdss.h>
34#include <video/omap-panel-tfp410.h> 34#include <video/omap-panel-data.h>
35#include <linux/platform_data/mtd-onenand-omap2.h> 35#include <linux/platform_data/mtd-onenand-omap2.h>
36 36
37#include "common.h" 37#include "common.h"
@@ -527,26 +527,28 @@ static void __init igep_i2c_init(void)
527 omap3_pmic_init("twl4030", &igep_twldata); 527 omap3_pmic_init("twl4030", &igep_twldata);
528} 528}
529 529
530static struct usbhs_phy_data igep2_phy_data[] __initdata = {
531 {
532 .port = 1,
533 .reset_gpio = IGEP2_GPIO_USBH_NRESET,
534 .vcc_gpio = -EINVAL,
535 },
536};
537
538static struct usbhs_phy_data igep3_phy_data[] __initdata = {
539 {
540 .port = 2,
541 .reset_gpio = IGEP3_GPIO_USBH_NRESET,
542 .vcc_gpio = -EINVAL,
543 },
544};
545
530static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = { 546static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = {
531 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 547 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
532 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
533 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
534
535 .phy_reset = true,
536 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
537 .reset_gpio_port[1] = -EINVAL,
538 .reset_gpio_port[2] = -EINVAL,
539}; 548};
540 549
541static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = { 550static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = {
542 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
543 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 551 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
544 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
545
546 .phy_reset = true,
547 .reset_gpio_port[0] = -EINVAL,
548 .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
549 .reset_gpio_port[2] = -EINVAL,
550}; 552};
551 553
552#ifdef CONFIG_OMAP_MUX 554#ifdef CONFIG_OMAP_MUX
@@ -642,8 +644,10 @@ static void __init igep_init(void)
642 if (machine_is_igep0020()) { 644 if (machine_is_igep0020()) {
643 omap_display_init(&igep2_dss_data); 645 omap_display_init(&igep2_dss_data);
644 igep2_init_smsc911x(); 646 igep2_init_smsc911x();
647 usbhs_init_phys(igep2_phy_data, ARRAY_SIZE(igep2_phy_data));
645 usbhs_init(&igep2_usbhs_bdata); 648 usbhs_init(&igep2_usbhs_bdata);
646 } else { 649 } else {
650 usbhs_init_phys(igep3_phy_data, ARRAY_SIZE(igep3_phy_data));
647 usbhs_init(&igep3_usbhs_bdata); 651 usbhs_init(&igep3_usbhs_bdata);
648 } 652 }
649} 653}
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index b12fe966a7b9..8a8e505a0e90 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -41,7 +41,7 @@
41#include "gpmc-smsc911x.h" 41#include "gpmc-smsc911x.h"
42 42
43#include <video/omapdss.h> 43#include <video/omapdss.h>
44#include <video/omap-panel-generic-dpi.h> 44#include <video/omap-panel-data.h>
45 45
46#include "board-flash.h" 46#include "board-flash.h"
47#include "mux.h" 47#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index c3558f93d42c..6de78605c0af 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -33,6 +33,7 @@
33#include <linux/mtd/nand.h> 33#include <linux/mtd/nand.h>
34#include <linux/mmc/host.h> 34#include <linux/mmc/host.h>
35#include <linux/usb/phy.h> 35#include <linux/usb/phy.h>
36#include <linux/usb/nop-usb-xceiv.h>
36 37
37#include <linux/regulator/machine.h> 38#include <linux/regulator/machine.h>
38#include <linux/i2c/twl.h> 39#include <linux/i2c/twl.h>
@@ -43,7 +44,7 @@
43#include <asm/mach/flash.h> 44#include <asm/mach/flash.h>
44 45
45#include <video/omapdss.h> 46#include <video/omapdss.h>
46#include <video/omap-panel-tfp410.h> 47#include <video/omap-panel-data.h>
47#include <linux/platform_data/mtd-nand-omap2.h> 48#include <linux/platform_data/mtd-nand-omap2.h>
48 49
49#include "common.h" 50#include "common.h"
@@ -277,6 +278,21 @@ static struct regulator_consumer_supply beagle_vsim_supply[] = {
277 278
278static struct gpio_led gpio_leds[]; 279static struct gpio_led gpio_leds[];
279 280
281/* PHY's VCC regulator might be added later, so flag that we need it */
282static struct nop_usb_xceiv_platform_data hsusb2_phy_data = {
283 .needs_vcc = true,
284};
285
286static struct usbhs_phy_data phy_data[] = {
287 {
288 .port = 2,
289 .reset_gpio = 147,
290 .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */
291 .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */
292 .platform_data = &hsusb2_phy_data,
293 },
294};
295
280static int beagle_twl_gpio_setup(struct device *dev, 296static int beagle_twl_gpio_setup(struct device *dev,
281 unsigned gpio, unsigned ngpio) 297 unsigned gpio, unsigned ngpio)
282{ 298{
@@ -318,9 +334,11 @@ static int beagle_twl_gpio_setup(struct device *dev,
318 } 334 }
319 dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; 335 dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
320 336
321 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, 337 /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */
322 "nEN_USB_PWR"); 338 phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX;
339 phy_data[0].vcc_polarity = beagle_config.usb_pwr_level;
323 340
341 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
324 return 0; 342 return 0;
325} 343}
326 344
@@ -453,15 +471,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
453}; 471};
454 472
455static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 473static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
456
457 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
458 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 474 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
459 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
460
461 .phy_reset = true,
462 .reset_gpio_port[0] = -EINVAL,
463 .reset_gpio_port[1] = 147,
464 .reset_gpio_port[2] = -EINVAL
465}; 475};
466 476
467#ifdef CONFIG_OMAP_MUX 477#ifdef CONFIG_OMAP_MUX
@@ -479,7 +489,7 @@ static int __init beagle_opp_init(void)
479 489
480 /* Initialize the omap3 opp table if not already created. */ 490 /* Initialize the omap3 opp table if not already created. */
481 r = omap3_opp_init(); 491 r = omap3_opp_init();
482 if (IS_ERR_VALUE(r) && (r != -EEXIST)) { 492 if (r < 0 && (r != -EEXIST)) {
483 pr_err("%s: opp default init failed\n", __func__); 493 pr_err("%s: opp default init failed\n", __func__);
484 return r; 494 return r;
485 } 495 }
@@ -543,7 +553,9 @@ static void __init omap3_beagle_init(void)
543 553
544 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 554 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
545 usb_musb_init(NULL); 555 usb_musb_init(NULL);
556
546 usbhs_init(&usbhs_bdata); 557 usbhs_init(&usbhs_bdata);
558
547 board_nand_init(omap3beagle_nand_partitions, 559 board_nand_init(omap3beagle_nand_partitions,
548 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, 560 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
549 NAND_BUSWIDTH_16, NULL); 561 NAND_BUSWIDTH_16, NULL);
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 48789e0bb915..4f1bbc3cc29b 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -51,7 +51,7 @@
51#include "common.h" 51#include "common.h"
52#include <linux/platform_data/spi-omap2-mcspi.h> 52#include <linux/platform_data/spi-omap2-mcspi.h>
53#include <video/omapdss.h> 53#include <video/omapdss.h>
54#include <video/omap-panel-tfp410.h> 54#include <video/omap-panel-data.h>
55 55
56#include "soc.h" 56#include "soc.h"
57#include "mux.h" 57#include "mux.h"
@@ -496,7 +496,7 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
496static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = { 496static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
497 REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */ 497 REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */
498 REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */ 498 REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */
499 REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), 499 REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */
500 REGULATOR_SUPPLY("vaux2", NULL), 500 REGULATOR_SUPPLY("vaux2", NULL),
501}; 501};
502 502
@@ -539,17 +539,16 @@ static int __init omap3_evm_i2c_init(void)
539 return 0; 539 return 0;
540} 540}
541 541
542static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 542static struct usbhs_phy_data phy_data[] __initdata = {
543 {
544 .port = 2,
545 .reset_gpio = -1, /* set at runtime */
546 .vcc_gpio = -EINVAL,
547 },
548};
543 549
544 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 550static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
545 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 551 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
546 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
547
548 .phy_reset = true,
549 /* PHY reset GPIO will be runtime programmed based on EVM version */
550 .reset_gpio_port[0] = -EINVAL,
551 .reset_gpio_port[1] = -EINVAL,
552 .reset_gpio_port[2] = -EINVAL
553}; 552};
554 553
555#ifdef CONFIG_OMAP_MUX 554#ifdef CONFIG_OMAP_MUX
@@ -725,7 +724,7 @@ static void __init omap3_evm_init(void)
725 724
726 /* setup EHCI phy reset config */ 725 /* setup EHCI phy reset config */
727 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); 726 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
728 usbhs_bdata.reset_gpio_port[1] = 21; 727 phy_data[0].reset_gpio = 21;
729 728
730 /* EVM REV >= E can supply 500mA with EXTVBUS programming */ 729 /* EVM REV >= E can supply 500mA with EXTVBUS programming */
731 musb_board_data.power = 500; 730 musb_board_data.power = 500;
@@ -733,10 +732,12 @@ static void __init omap3_evm_init(void)
733 } else { 732 } else {
734 /* setup EHCI phy reset on MDC */ 733 /* setup EHCI phy reset on MDC */
735 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); 734 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
736 usbhs_bdata.reset_gpio_port[1] = 135; 735 phy_data[0].reset_gpio = 135;
737 } 736 }
738 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 737 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
739 usb_musb_init(&musb_board_data); 738 usb_musb_init(&musb_board_data);
739
740 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
740 usbhs_init(&usbhs_bdata); 741 usbhs_init(&usbhs_bdata);
741 board_nand_init(omap3evm_nand_partitions, 742 board_nand_init(omap3evm_nand_partitions,
742 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS, 743 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 2bba362148a0..1004d2aaa68f 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -346,7 +346,7 @@ static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
346}; 346};
347 347
348static struct regulator_consumer_supply pandora_usb_phy_supply[] = { 348static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
349 REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), 349 REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */
350}; 350};
351 351
352/* ads7846 on SPI and 2 nub controllers on I2C */ 352/* ads7846 on SPI and 2 nub controllers on I2C */
@@ -561,6 +561,14 @@ fail:
561 printk(KERN_ERR "wl1251 board initialisation failed\n"); 561 printk(KERN_ERR "wl1251 board initialisation failed\n");
562} 562}
563 563
564static struct usbhs_phy_data phy_data[] __initdata = {
565 {
566 .port = 2,
567 .reset_gpio = 16,
568 .vcc_gpio = -EINVAL,
569 },
570};
571
564static struct platform_device *omap3pandora_devices[] __initdata = { 572static struct platform_device *omap3pandora_devices[] __initdata = {
565 &pandora_leds_gpio, 573 &pandora_leds_gpio,
566 &pandora_keys_gpio, 574 &pandora_keys_gpio,
@@ -569,15 +577,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
569}; 577};
570 578
571static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 579static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
572
573 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
574 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 580 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
575 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
576
577 .phy_reset = true,
578 .reset_gpio_port[0] = -EINVAL,
579 .reset_gpio_port[1] = 16,
580 .reset_gpio_port[2] = -EINVAL
581}; 581};
582 582
583#ifdef CONFIG_OMAP_MUX 583#ifdef CONFIG_OMAP_MUX
@@ -601,7 +601,10 @@ static void __init omap3pandora_init(void)
601 spi_register_board_info(omap3pandora_spi_board_info, 601 spi_register_board_info(omap3pandora_spi_board_info,
602 ARRAY_SIZE(omap3pandora_spi_board_info)); 602 ARRAY_SIZE(omap3pandora_spi_board_info));
603 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 603 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
604
605 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
604 usbhs_init(&usbhs_bdata); 606 usbhs_init(&usbhs_bdata);
607
605 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 608 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
606 usb_musb_init(NULL); 609 usb_musb_init(NULL);
607 gpmc_nand_init(&pandora_nand_data, NULL); 610 gpmc_nand_init(&pandora_nand_data, NULL);
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 95c10b3aa678..8afbba0923d6 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -44,8 +44,7 @@
44#include "gpmc.h" 44#include "gpmc.h"
45#include <linux/platform_data/mtd-nand-omap2.h> 45#include <linux/platform_data/mtd-nand-omap2.h>
46#include <video/omapdss.h> 46#include <video/omapdss.h>
47#include <video/omap-panel-generic-dpi.h> 47#include <video/omap-panel-data.h>
48#include <video/omap-panel-tfp410.h>
49 48
50#include <linux/platform_data/spi-omap2-mcspi.h> 49#include <linux/platform_data/spi-omap2-mcspi.h>
51 50
@@ -358,19 +357,20 @@ static int __init omap3_stalker_i2c_init(void)
358 357
359#define OMAP3_STALKER_TS_GPIO 175 358#define OMAP3_STALKER_TS_GPIO 175
360 359
360static struct usbhs_phy_data phy_data[] __initdata = {
361 {
362 .port = 2,
363 .reset_gpio = 21,
364 .vcc_gpio = -EINVAL,
365 },
366};
367
361static struct platform_device *omap3_stalker_devices[] __initdata = { 368static struct platform_device *omap3_stalker_devices[] __initdata = {
362 &keys_gpio, 369 &keys_gpio,
363}; 370};
364 371
365static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 372static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
366 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
367 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 373 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
368 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
369
370 .phy_reset = true,
371 .reset_gpio_port[0] = -EINVAL,
372 .reset_gpio_port[1] = 21,
373 .reset_gpio_port[2] = -EINVAL,
374}; 374};
375 375
376#ifdef CONFIG_OMAP_MUX 376#ifdef CONFIG_OMAP_MUX
@@ -407,6 +407,8 @@ static void __init omap3_stalker_init(void)
407 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); 407 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
408 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 408 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
409 usb_musb_init(NULL); 409 usb_musb_init(NULL);
410
411 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
410 usbhs_init(&usbhs_bdata); 412 usbhs_init(&usbhs_bdata);
411 omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); 413 omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL);
412 414
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index bcd44fbcd877..7da48bc42bbf 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -305,21 +305,22 @@ static struct omap_board_mux board_mux[] __initdata = {
305}; 305};
306#endif 306#endif
307 307
308static struct usbhs_phy_data phy_data[] __initdata = {
309 {
310 .port = 2,
311 .reset_gpio = 147,
312 .vcc_gpio = -EINVAL,
313 },
314};
315
308static struct platform_device *omap3_touchbook_devices[] __initdata = { 316static struct platform_device *omap3_touchbook_devices[] __initdata = {
309 &leds_gpio, 317 &leds_gpio,
310 &keys_gpio, 318 &keys_gpio,
311}; 319};
312 320
313static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 321static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
314
315 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 322 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
316 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 323 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
317 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
318
319 .phy_reset = true,
320 .reset_gpio_port[0] = -EINVAL,
321 .reset_gpio_port[1] = 147,
322 .reset_gpio_port[2] = -EINVAL
323}; 324};
324 325
325static void omap3_touchbook_poweroff(void) 326static void omap3_touchbook_poweroff(void)
@@ -368,6 +369,8 @@ static void __init omap3_touchbook_init(void)
368 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 369 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
369 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 370 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
370 usb_musb_init(NULL); 371 usb_musb_init(NULL);
372
373 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
371 usbhs_init(&usbhs_bdata); 374 usbhs_init(&usbhs_bdata);
372 board_nand_init(omap3touchbook_nand_partitions, 375 board_nand_init(omap3touchbook_nand_partitions,
373 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS, 376 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index b02c2f00609b..a71ad345f20d 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -31,6 +31,7 @@
31#include <linux/ti_wilink_st.h> 31#include <linux/ti_wilink_st.h>
32#include <linux/usb/musb.h> 32#include <linux/usb/musb.h>
33#include <linux/usb/phy.h> 33#include <linux/usb/phy.h>
34#include <linux/usb/nop-usb-xceiv.h>
34#include <linux/wl12xx.h> 35#include <linux/wl12xx.h>
35#include <linux/irqchip/arm-gic.h> 36#include <linux/irqchip/arm-gic.h>
36#include <linux/platform_data/omap-abe-twl6040.h> 37#include <linux/platform_data/omap-abe-twl6040.h>
@@ -132,6 +133,22 @@ static struct platform_device btwilink_device = {
132 .id = -1, 133 .id = -1,
133}; 134};
134 135
136/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
137static struct nop_usb_xceiv_platform_data hsusb1_phy_data = {
138 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
139 .clk_rate = 19200000,
140};
141
142static struct usbhs_phy_data phy_data[] __initdata = {
143 {
144 .port = 1,
145 .reset_gpio = GPIO_HUB_NRESET,
146 .vcc_gpio = GPIO_HUB_POWER,
147 .vcc_polarity = 1,
148 .platform_data = &hsusb1_phy_data,
149 },
150};
151
135static struct platform_device *panda_devices[] __initdata = { 152static struct platform_device *panda_devices[] __initdata = {
136 &leds_gpio, 153 &leds_gpio,
137 &wl1271_device, 154 &wl1271_device,
@@ -142,49 +159,19 @@ static struct platform_device *panda_devices[] __initdata = {
142 159
143static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 160static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
144 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 161 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
145 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
146 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
147 .phy_reset = false,
148 .reset_gpio_port[0] = -EINVAL,
149 .reset_gpio_port[1] = -EINVAL,
150 .reset_gpio_port[2] = -EINVAL
151};
152
153static struct gpio panda_ehci_gpios[] __initdata = {
154 { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" },
155 { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" },
156}; 162};
157 163
158static void __init omap4_ehci_init(void) 164static void __init omap4_ehci_init(void)
159{ 165{
160 int ret; 166 int ret;
161 struct clk *phy_ref_clk;
162 167
163 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ 168 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
164 phy_ref_clk = clk_get(NULL, "auxclk3_ck"); 169 ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL);
165 if (IS_ERR(phy_ref_clk)) { 170 if (ret)
166 pr_err("Cannot request auxclk3\n"); 171 pr_err("Failed to add main_clk alias to auxclk3_ck\n");
167 return;
168 }
169 clk_set_rate(phy_ref_clk, 19200000);
170 clk_prepare_enable(phy_ref_clk);
171
172 /* disable the power to the usb hub prior to init and reset phy+hub */
173 ret = gpio_request_array(panda_ehci_gpios,
174 ARRAY_SIZE(panda_ehci_gpios));
175 if (ret) {
176 pr_err("Unable to initialize EHCI power/reset\n");
177 return;
178 }
179
180 gpio_export(GPIO_HUB_POWER, 0);
181 gpio_export(GPIO_HUB_NRESET, 0);
182 gpio_set_value(GPIO_HUB_NRESET, 1);
183 172
173 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
184 usbhs_init(&usbhs_bdata); 174 usbhs_init(&usbhs_bdata);
185
186 /* enable power to hub */
187 gpio_set_value(GPIO_HUB_POWER, 1);
188} 175}
189 176
190static struct omap_musb_board_data musb_board_data = { 177static struct omap_musb_board_data musb_board_data = {
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 86bab51154ee..f9101407cd56 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -47,8 +47,7 @@
47#include <asm/mach/map.h> 47#include <asm/mach/map.h>
48 48
49#include <video/omapdss.h> 49#include <video/omapdss.h>
50#include <video/omap-panel-generic-dpi.h> 50#include <video/omap-panel-data.h>
51#include <video/omap-panel-tfp410.h>
52 51
53#include "common.h" 52#include "common.h"
54#include "mux.h" 53#include "mux.h"
@@ -458,14 +457,16 @@ static int __init overo_spi_init(void)
458 return 0; 457 return 0;
459} 458}
460 459
460static struct usbhs_phy_data phy_data[] __initdata = {
461 {
462 .port = 2,
463 .reset_gpio = OVERO_GPIO_USBH_NRESET,
464 .vcc_gpio = -EINVAL,
465 },
466};
467
461static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 468static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
462 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
463 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 469 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
464 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
465 .phy_reset = true,
466 .reset_gpio_port[0] = -EINVAL,
467 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
468 .reset_gpio_port[2] = -EINVAL
469}; 470};
470 471
471#ifdef CONFIG_OMAP_MUX 472#ifdef CONFIG_OMAP_MUX
@@ -502,6 +503,8 @@ static void __init overo_init(void)
502 ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL); 503 ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
503 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 504 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
504 usb_musb_init(NULL); 505 usb_musb_init(NULL);
506
507 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
505 usbhs_init(&usbhs_bdata); 508 usbhs_init(&usbhs_bdata);
506 overo_spi_init(); 509 overo_spi_init();
507 overo_init_smsc911x(); 510 overo_init_smsc911x();
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 3a077df6b8df..1a884670a6c4 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -547,12 +547,16 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {
547 REGULATOR_SUPPLY("DVDD", "2-0019"), 547 REGULATOR_SUPPLY("DVDD", "2-0019"),
548 /* Si4713 IO supply */ 548 /* Si4713 IO supply */
549 REGULATOR_SUPPLY("vio", "2-0063"), 549 REGULATOR_SUPPLY("vio", "2-0063"),
550 /* lis3lv02d */
551 REGULATOR_SUPPLY("Vdd_IO", "3-001d"),
550}; 552};
551 553
552static struct regulator_consumer_supply rx51_vaux1_consumers[] = { 554static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
553 REGULATOR_SUPPLY("vdds_sdi", "omapdss"), 555 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
554 /* Si4713 supply */ 556 /* Si4713 supply */
555 REGULATOR_SUPPLY("vdd", "2-0063"), 557 REGULATOR_SUPPLY("vdd", "2-0063"),
558 /* lis3lv02d */
559 REGULATOR_SUPPLY("Vdd", "3-001d"),
556}; 560};
557 561
558static struct regulator_init_data rx51_vaux1 = { 562static struct regulator_init_data rx51_vaux1 = {
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index 8cef477d6b00..9a7174faac51 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -12,7 +12,6 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/i2c/twl.h>
16#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
17#include <linux/platform_data/spi-omap2-mcspi.h> 16#include <linux/platform_data/spi-omap2-mcspi.h>
18#include <video/omapdss.h> 17#include <video/omapdss.h>
@@ -49,59 +48,6 @@ static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev)
49{ 48{
50} 49}
51 50
52/* Register offsets in TWL4030_MODULE_INTBR */
53#define TWL_INTBR_PMBR1 0xD
54#define TWL_INTBR_GPBR1 0xC
55
56/* Register offsets in TWL_MODULE_PWM */
57#define TWL_LED_PWMON 0x3
58#define TWL_LED_PWMOFF 0x4
59
60static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level)
61{
62#ifdef CONFIG_TWL4030_CORE
63 unsigned char c;
64 u8 mux_pwm, enb_pwm;
65
66 if (level > 100)
67 return -1;
68
69 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &mux_pwm, TWL_INTBR_PMBR1);
70 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &enb_pwm, TWL_INTBR_GPBR1);
71
72 if (level == 0) {
73 /* disable pwm1 output and clock */
74 enb_pwm = enb_pwm & 0xF5;
75 /* change pwm1 pin to gpio pin */
76 mux_pwm = mux_pwm & 0xCF;
77 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
78 enb_pwm, TWL_INTBR_GPBR1);
79 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
80 mux_pwm, TWL_INTBR_PMBR1);
81 return 0;
82 }
83
84 if (!((enb_pwm & 0xA) && (mux_pwm & 0x30))) {
85 /* change gpio pin to pwm1 pin */
86 mux_pwm = mux_pwm | 0x30;
87 /* enable pwm1 output and clock*/
88 enb_pwm = enb_pwm | 0x0A;
89 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
90 mux_pwm, TWL_INTBR_PMBR1);
91 twl_i2c_write_u8(TWL4030_MODULE_INTBR,
92 enb_pwm, TWL_INTBR_GPBR1);
93 }
94
95 c = ((50 * (100 - level)) / 100) + 1;
96 twl_i2c_write_u8(TWL_MODULE_PWM, 0x7F, TWL_LED_PWMOFF);
97 twl_i2c_write_u8(TWL_MODULE_PWM, c, TWL_LED_PWMON);
98#else
99 pr_warn("Backlight not enabled\n");
100#endif
101
102 return 0;
103}
104
105static struct omap_dss_device zoom_lcd_device = { 51static struct omap_dss_device zoom_lcd_device = {
106 .name = "lcd", 52 .name = "lcd",
107 .driver_name = "NEC_8048_panel", 53 .driver_name = "NEC_8048_panel",
@@ -109,8 +55,6 @@ static struct omap_dss_device zoom_lcd_device = {
109 .phy.dpi.data_lines = 24, 55 .phy.dpi.data_lines = 24,
110 .platform_enable = zoom_panel_enable_lcd, 56 .platform_enable = zoom_panel_enable_lcd,
111 .platform_disable = zoom_panel_disable_lcd, 57 .platform_disable = zoom_panel_disable_lcd,
112 .max_backlight_level = 100,
113 .set_backlight = zoom_set_bl_intensity,
114}; 58};
115 59
116static struct omap_dss_device *zoom_dss_devices[] = { 60static struct omap_dss_device *zoom_dss_devices[] = {
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index cdc0c1021863..a90375d5b2b6 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -22,6 +22,9 @@
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/platform_data/omap-twl4030.h> 23#include <linux/platform_data/omap-twl4030.h>
24#include <linux/usb/phy.h> 24#include <linux/usb/phy.h>
25#include <linux/pwm.h>
26#include <linux/leds_pwm.h>
27#include <linux/pwm_backlight.h>
25 28
26#include <asm/mach-types.h> 29#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
@@ -193,6 +196,53 @@ static struct platform_device omap_vwlan_device = {
193 }, 196 },
194}; 197};
195 198
199static struct pwm_lookup zoom_pwm_lookup[] = {
200 PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "zoom::keypad"),
201 PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", "backlight"),
202};
203
204static struct led_pwm zoom_pwm_leds[] = {
205 {
206 .name = "zoom::keypad",
207 .max_brightness = 127,
208 .pwm_period_ns = 7812500,
209 },
210};
211
212static struct led_pwm_platform_data zoom_pwm_data = {
213 .num_leds = ARRAY_SIZE(zoom_pwm_leds),
214 .leds = zoom_pwm_leds,
215};
216
217static struct platform_device zoom_leds_pwm = {
218 .name = "leds_pwm",
219 .id = -1,
220 .dev = {
221 .platform_data = &zoom_pwm_data,
222 },
223};
224
225static struct platform_pwm_backlight_data zoom_backlight_data = {
226 .pwm_id = 1,
227 .max_brightness = 127,
228 .dft_brightness = 127,
229 .pwm_period_ns = 7812500,
230};
231
232static struct platform_device zoom_backlight_pwm = {
233 .name = "pwm-backlight",
234 .id = -1,
235 .dev = {
236 .platform_data = &zoom_backlight_data,
237 },
238};
239
240static struct platform_device *zoom_devices[] __initdata = {
241 &omap_vwlan_device,
242 &zoom_leds_pwm,
243 &zoom_backlight_pwm,
244};
245
196static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = { 246static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
197 .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */ 247 .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
198}; 248};
@@ -301,7 +351,8 @@ void __init zoom_peripherals_init(void)
301 351
302 omap_hsmmc_init(mmc); 352 omap_hsmmc_init(mmc);
303 omap_i2c_init(); 353 omap_i2c_init();
304 platform_device_register(&omap_vwlan_device); 354 pwm_add_table(zoom_pwm_lookup, ARRAY_SIZE(zoom_pwm_lookup));
355 platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
305 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); 356 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
306 usb_musb_init(NULL); 357 usb_musb_init(NULL);
307 enable_board_wakeup_source(); 358 enable_board_wakeup_source();
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 5e4d4c9fe61a..1a3dd865d8eb 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -92,14 +92,16 @@ static struct mtd_partition zoom_nand_partitions[] = {
92 }, 92 },
93}; 93};
94 94
95static struct usbhs_phy_data phy_data[] __initdata = {
96 {
97 .port = 2,
98 .reset_gpio = ZOOM3_EHCI_RESET_GPIO,
99 .vcc_gpio = -EINVAL,
100 },
101};
102
95static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 103static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
96 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
97 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 104 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
98 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
99 .phy_reset = true,
100 .reset_gpio_port[0] = -EINVAL,
101 .reset_gpio_port[1] = ZOOM3_EHCI_RESET_GPIO,
102 .reset_gpio_port[2] = -EINVAL,
103}; 105};
104 106
105static void __init omap_zoom_init(void) 107static void __init omap_zoom_init(void)
@@ -109,6 +111,8 @@ static void __init omap_zoom_init(void)
109 } else if (machine_is_omap_zoom3()) { 111 } else if (machine_is_omap_zoom3()) {
110 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); 112 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
111 omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT); 113 omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT);
114
115 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
112 usbhs_init(&usbhs_bdata); 116 usbhs_init(&usbhs_bdata);
113 } 117 }
114 118
diff --git a/arch/arm/mach-omap2/cclock2420_data.c b/arch/arm/mach-omap2/cclock2420_data.c
index 0f0a97c1fcc0..3662f4d4c8ea 100644
--- a/arch/arm/mach-omap2/cclock2420_data.c
+++ b/arch/arm/mach-omap2/cclock2420_data.c
@@ -1739,153 +1739,153 @@ DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1739 1739
1740static struct omap_clk omap2420_clks[] = { 1740static struct omap_clk omap2420_clks[] = {
1741 /* external root sources */ 1741 /* external root sources */
1742 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X), 1742 CLK(NULL, "func_32k_ck", &func_32k_ck),
1743 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X), 1743 CLK(NULL, "secure_32k_ck", &secure_32k_ck),
1744 CLK(NULL, "osc_ck", &osc_ck, CK_242X), 1744 CLK(NULL, "osc_ck", &osc_ck),
1745 CLK(NULL, "sys_ck", &sys_ck, CK_242X), 1745 CLK(NULL, "sys_ck", &sys_ck),
1746 CLK(NULL, "alt_ck", &alt_ck, CK_242X), 1746 CLK(NULL, "alt_ck", &alt_ck),
1747 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X), 1747 CLK(NULL, "mcbsp_clks", &mcbsp_clks),
1748 /* internal analog sources */ 1748 /* internal analog sources */
1749 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X), 1749 CLK(NULL, "dpll_ck", &dpll_ck),
1750 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X), 1750 CLK(NULL, "apll96_ck", &apll96_ck),
1751 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X), 1751 CLK(NULL, "apll54_ck", &apll54_ck),
1752 /* internal prcm root sources */ 1752 /* internal prcm root sources */
1753 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X), 1753 CLK(NULL, "func_54m_ck", &func_54m_ck),
1754 CLK(NULL, "core_ck", &core_ck, CK_242X), 1754 CLK(NULL, "core_ck", &core_ck),
1755 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X), 1755 CLK(NULL, "func_96m_ck", &func_96m_ck),
1756 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X), 1756 CLK(NULL, "func_48m_ck", &func_48m_ck),
1757 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X), 1757 CLK(NULL, "func_12m_ck", &func_12m_ck),
1758 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X), 1758 CLK(NULL, "sys_clkout_src", &sys_clkout_src),
1759 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X), 1759 CLK(NULL, "sys_clkout", &sys_clkout),
1760 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X), 1760 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src),
1761 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X), 1761 CLK(NULL, "sys_clkout2", &sys_clkout2),
1762 CLK(NULL, "emul_ck", &emul_ck, CK_242X), 1762 CLK(NULL, "emul_ck", &emul_ck),
1763 /* mpu domain clocks */ 1763 /* mpu domain clocks */
1764 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X), 1764 CLK(NULL, "mpu_ck", &mpu_ck),
1765 /* dsp domain clocks */ 1765 /* dsp domain clocks */
1766 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X), 1766 CLK(NULL, "dsp_fck", &dsp_fck),
1767 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X), 1767 CLK(NULL, "dsp_ick", &dsp_ick),
1768 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X), 1768 CLK(NULL, "iva1_ifck", &iva1_ifck),
1769 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X), 1769 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck),
1770 /* GFX domain clocks */ 1770 /* GFX domain clocks */
1771 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X), 1771 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck),
1772 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X), 1772 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck),
1773 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X), 1773 CLK(NULL, "gfx_ick", &gfx_ick),
1774 /* DSS domain clocks */ 1774 /* DSS domain clocks */
1775 CLK("omapdss_dss", "ick", &dss_ick, CK_242X), 1775 CLK("omapdss_dss", "ick", &dss_ick),
1776 CLK(NULL, "dss_ick", &dss_ick, CK_242X), 1776 CLK(NULL, "dss_ick", &dss_ick),
1777 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X), 1777 CLK(NULL, "dss1_fck", &dss1_fck),
1778 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X), 1778 CLK(NULL, "dss2_fck", &dss2_fck),
1779 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X), 1779 CLK(NULL, "dss_54m_fck", &dss_54m_fck),
1780 /* L3 domain clocks */ 1780 /* L3 domain clocks */
1781 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X), 1781 CLK(NULL, "core_l3_ck", &core_l3_ck),
1782 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X), 1782 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck),
1783 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X), 1783 CLK(NULL, "usb_l4_ick", &usb_l4_ick),
1784 /* L4 domain clocks */ 1784 /* L4 domain clocks */
1785 CLK(NULL, "l4_ck", &l4_ck, CK_242X), 1785 CLK(NULL, "l4_ck", &l4_ck),
1786 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X), 1786 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick),
1787 /* virtual meta-group clock */ 1787 /* virtual meta-group clock */
1788 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X), 1788 CLK(NULL, "virt_prcm_set", &virt_prcm_set),
1789 /* general l4 interface ck, multi-parent functional clk */ 1789 /* general l4 interface ck, multi-parent functional clk */
1790 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X), 1790 CLK(NULL, "gpt1_ick", &gpt1_ick),
1791 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X), 1791 CLK(NULL, "gpt1_fck", &gpt1_fck),
1792 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X), 1792 CLK(NULL, "gpt2_ick", &gpt2_ick),
1793 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X), 1793 CLK(NULL, "gpt2_fck", &gpt2_fck),
1794 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X), 1794 CLK(NULL, "gpt3_ick", &gpt3_ick),
1795 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X), 1795 CLK(NULL, "gpt3_fck", &gpt3_fck),
1796 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X), 1796 CLK(NULL, "gpt4_ick", &gpt4_ick),
1797 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X), 1797 CLK(NULL, "gpt4_fck", &gpt4_fck),
1798 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X), 1798 CLK(NULL, "gpt5_ick", &gpt5_ick),
1799 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X), 1799 CLK(NULL, "gpt5_fck", &gpt5_fck),
1800 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X), 1800 CLK(NULL, "gpt6_ick", &gpt6_ick),
1801 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X), 1801 CLK(NULL, "gpt6_fck", &gpt6_fck),
1802 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X), 1802 CLK(NULL, "gpt7_ick", &gpt7_ick),
1803 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X), 1803 CLK(NULL, "gpt7_fck", &gpt7_fck),
1804 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X), 1804 CLK(NULL, "gpt8_ick", &gpt8_ick),
1805 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X), 1805 CLK(NULL, "gpt8_fck", &gpt8_fck),
1806 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X), 1806 CLK(NULL, "gpt9_ick", &gpt9_ick),
1807 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X), 1807 CLK(NULL, "gpt9_fck", &gpt9_fck),
1808 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X), 1808 CLK(NULL, "gpt10_ick", &gpt10_ick),
1809 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X), 1809 CLK(NULL, "gpt10_fck", &gpt10_fck),
1810 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X), 1810 CLK(NULL, "gpt11_ick", &gpt11_ick),
1811 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X), 1811 CLK(NULL, "gpt11_fck", &gpt11_fck),
1812 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X), 1812 CLK(NULL, "gpt12_ick", &gpt12_ick),
1813 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X), 1813 CLK(NULL, "gpt12_fck", &gpt12_fck),
1814 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X), 1814 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick),
1815 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X), 1815 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick),
1816 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X), 1816 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck),
1817 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X), 1817 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick),
1818 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X), 1818 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick),
1819 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X), 1819 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck),
1820 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X), 1820 CLK("omap2_mcspi.1", "ick", &mcspi1_ick),
1821 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X), 1821 CLK(NULL, "mcspi1_ick", &mcspi1_ick),
1822 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X), 1822 CLK(NULL, "mcspi1_fck", &mcspi1_fck),
1823 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X), 1823 CLK("omap2_mcspi.2", "ick", &mcspi2_ick),
1824 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X), 1824 CLK(NULL, "mcspi2_ick", &mcspi2_ick),
1825 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X), 1825 CLK(NULL, "mcspi2_fck", &mcspi2_fck),
1826 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X), 1826 CLK(NULL, "uart1_ick", &uart1_ick),
1827 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X), 1827 CLK(NULL, "uart1_fck", &uart1_fck),
1828 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X), 1828 CLK(NULL, "uart2_ick", &uart2_ick),
1829 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X), 1829 CLK(NULL, "uart2_fck", &uart2_fck),
1830 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X), 1830 CLK(NULL, "uart3_ick", &uart3_ick),
1831 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X), 1831 CLK(NULL, "uart3_fck", &uart3_fck),
1832 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X), 1832 CLK(NULL, "gpios_ick", &gpios_ick),
1833 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X), 1833 CLK(NULL, "gpios_fck", &gpios_fck),
1834 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X), 1834 CLK("omap_wdt", "ick", &mpu_wdt_ick),
1835 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X), 1835 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick),
1836 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X), 1836 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck),
1837 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X), 1837 CLK(NULL, "sync_32k_ick", &sync_32k_ick),
1838 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X), 1838 CLK(NULL, "wdt1_ick", &wdt1_ick),
1839 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X), 1839 CLK(NULL, "omapctrl_ick", &omapctrl_ick),
1840 CLK("omap24xxcam", "fck", &cam_fck, CK_242X), 1840 CLK("omap24xxcam", "fck", &cam_fck),
1841 CLK(NULL, "cam_fck", &cam_fck, CK_242X), 1841 CLK(NULL, "cam_fck", &cam_fck),
1842 CLK("omap24xxcam", "ick", &cam_ick, CK_242X), 1842 CLK("omap24xxcam", "ick", &cam_ick),
1843 CLK(NULL, "cam_ick", &cam_ick, CK_242X), 1843 CLK(NULL, "cam_ick", &cam_ick),
1844 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X), 1844 CLK(NULL, "mailboxes_ick", &mailboxes_ick),
1845 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X), 1845 CLK(NULL, "wdt4_ick", &wdt4_ick),
1846 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X), 1846 CLK(NULL, "wdt4_fck", &wdt4_fck),
1847 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X), 1847 CLK(NULL, "wdt3_ick", &wdt3_ick),
1848 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X), 1848 CLK(NULL, "wdt3_fck", &wdt3_fck),
1849 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X), 1849 CLK(NULL, "mspro_ick", &mspro_ick),
1850 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X), 1850 CLK(NULL, "mspro_fck", &mspro_fck),
1851 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X), 1851 CLK("mmci-omap.0", "ick", &mmc_ick),
1852 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X), 1852 CLK(NULL, "mmc_ick", &mmc_ick),
1853 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X), 1853 CLK("mmci-omap.0", "fck", &mmc_fck),
1854 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X), 1854 CLK(NULL, "mmc_fck", &mmc_fck),
1855 CLK(NULL, "fac_ick", &fac_ick, CK_242X), 1855 CLK(NULL, "fac_ick", &fac_ick),
1856 CLK(NULL, "fac_fck", &fac_fck, CK_242X), 1856 CLK(NULL, "fac_fck", &fac_fck),
1857 CLK(NULL, "eac_ick", &eac_ick, CK_242X), 1857 CLK(NULL, "eac_ick", &eac_ick),
1858 CLK(NULL, "eac_fck", &eac_fck, CK_242X), 1858 CLK(NULL, "eac_fck", &eac_fck),
1859 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X), 1859 CLK("omap_hdq.0", "ick", &hdq_ick),
1860 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X), 1860 CLK(NULL, "hdq_ick", &hdq_ick),
1861 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X), 1861 CLK("omap_hdq.0", "fck", &hdq_fck),
1862 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X), 1862 CLK(NULL, "hdq_fck", &hdq_fck),
1863 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X), 1863 CLK("omap_i2c.1", "ick", &i2c1_ick),
1864 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X), 1864 CLK(NULL, "i2c1_ick", &i2c1_ick),
1865 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X), 1865 CLK(NULL, "i2c1_fck", &i2c1_fck),
1866 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X), 1866 CLK("omap_i2c.2", "ick", &i2c2_ick),
1867 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X), 1867 CLK(NULL, "i2c2_ick", &i2c2_ick),
1868 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X), 1868 CLK(NULL, "i2c2_fck", &i2c2_fck),
1869 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X), 1869 CLK(NULL, "gpmc_fck", &gpmc_fck),
1870 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X), 1870 CLK(NULL, "sdma_fck", &sdma_fck),
1871 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X), 1871 CLK(NULL, "sdma_ick", &sdma_ick),
1872 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X), 1872 CLK(NULL, "sdrc_ick", &sdrc_ick),
1873 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X), 1873 CLK(NULL, "vlynq_ick", &vlynq_ick),
1874 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X), 1874 CLK(NULL, "vlynq_fck", &vlynq_fck),
1875 CLK(NULL, "des_ick", &des_ick, CK_242X), 1875 CLK(NULL, "des_ick", &des_ick),
1876 CLK("omap-sham", "ick", &sha_ick, CK_242X), 1876 CLK("omap-sham", "ick", &sha_ick),
1877 CLK(NULL, "sha_ick", &sha_ick, CK_242X), 1877 CLK(NULL, "sha_ick", &sha_ick),
1878 CLK("omap_rng", "ick", &rng_ick, CK_242X), 1878 CLK("omap_rng", "ick", &rng_ick),
1879 CLK(NULL, "rng_ick", &rng_ick, CK_242X), 1879 CLK(NULL, "rng_ick", &rng_ick),
1880 CLK("omap-aes", "ick", &aes_ick, CK_242X), 1880 CLK("omap-aes", "ick", &aes_ick),
1881 CLK(NULL, "aes_ick", &aes_ick, CK_242X), 1881 CLK(NULL, "aes_ick", &aes_ick),
1882 CLK(NULL, "pka_ick", &pka_ick, CK_242X), 1882 CLK(NULL, "pka_ick", &pka_ick),
1883 CLK(NULL, "usb_fck", &usb_fck, CK_242X), 1883 CLK(NULL, "usb_fck", &usb_fck),
1884 CLK("musb-hdrc", "fck", &osc_ck, CK_242X), 1884 CLK("musb-hdrc", "fck", &osc_ck),
1885 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X), 1885 CLK(NULL, "timer_32k_ck", &func_32k_ck),
1886 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X), 1886 CLK(NULL, "timer_sys_ck", &sys_ck),
1887 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X), 1887 CLK(NULL, "timer_ext_ck", &alt_ck),
1888 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X), 1888 CLK(NULL, "cpufreq_ck", &virt_prcm_set),
1889}; 1889};
1890 1890
1891 1891
@@ -1904,8 +1904,6 @@ static const char *enable_init_clks[] = {
1904 1904
1905int __init omap2420_clk_init(void) 1905int __init omap2420_clk_init(void)
1906{ 1906{
1907 struct omap_clk *c;
1908
1909 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL; 1907 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1910 cpu_mask = RATE_IN_242X; 1908 cpu_mask = RATE_IN_242X;
1911 rate_table = omap2420_rate_table; 1909 rate_table = omap2420_rate_table;
@@ -1914,12 +1912,7 @@ int __init omap2420_clk_init(void)
1914 1912
1915 omap2xxx_clkt_vps_check_bootloader_rates(); 1913 omap2xxx_clkt_vps_check_bootloader_rates();
1916 1914
1917 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks); 1915 omap_clocks_register(omap2420_clks, ARRAY_SIZE(omap2420_clks));
1918 c++) {
1919 clkdev_add(&c->lk);
1920 if (!__clk_init(NULL, c->lk.clk))
1921 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1922 }
1923 1916
1924 omap2xxx_clkt_vps_late_init(); 1917 omap2xxx_clkt_vps_late_init();
1925 1918
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
index aed8f74ca076..5e4b037bb24c 100644
--- a/arch/arm/mach-omap2/cclock2430_data.c
+++ b/arch/arm/mach-omap2/cclock2430_data.c
@@ -1840,168 +1840,170 @@ DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1840 1840
1841static struct omap_clk omap2430_clks[] = { 1841static struct omap_clk omap2430_clks[] = {
1842 /* external root sources */ 1842 /* external root sources */
1843 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X), 1843 CLK(NULL, "func_32k_ck", &func_32k_ck),
1844 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X), 1844 CLK(NULL, "secure_32k_ck", &secure_32k_ck),
1845 CLK(NULL, "osc_ck", &osc_ck, CK_243X), 1845 CLK(NULL, "osc_ck", &osc_ck),
1846 CLK("twl", "fck", &osc_ck, CK_243X), 1846 CLK("twl", "fck", &osc_ck),
1847 CLK(NULL, "sys_ck", &sys_ck, CK_243X), 1847 CLK(NULL, "sys_ck", &sys_ck),
1848 CLK(NULL, "alt_ck", &alt_ck, CK_243X), 1848 CLK(NULL, "alt_ck", &alt_ck),
1849 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X), 1849 CLK(NULL, "mcbsp_clks", &mcbsp_clks),
1850 /* internal analog sources */ 1850 /* internal analog sources */
1851 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X), 1851 CLK(NULL, "dpll_ck", &dpll_ck),
1852 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X), 1852 CLK(NULL, "apll96_ck", &apll96_ck),
1853 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X), 1853 CLK(NULL, "apll54_ck", &apll54_ck),
1854 /* internal prcm root sources */ 1854 /* internal prcm root sources */
1855 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X), 1855 CLK(NULL, "func_54m_ck", &func_54m_ck),
1856 CLK(NULL, "core_ck", &core_ck, CK_243X), 1856 CLK(NULL, "core_ck", &core_ck),
1857 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X), 1857 CLK(NULL, "func_96m_ck", &func_96m_ck),
1858 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X), 1858 CLK(NULL, "func_48m_ck", &func_48m_ck),
1859 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X), 1859 CLK(NULL, "func_12m_ck", &func_12m_ck),
1860 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X), 1860 CLK(NULL, "sys_clkout_src", &sys_clkout_src),
1861 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X), 1861 CLK(NULL, "sys_clkout", &sys_clkout),
1862 CLK(NULL, "emul_ck", &emul_ck, CK_243X), 1862 CLK(NULL, "emul_ck", &emul_ck),
1863 /* mpu domain clocks */ 1863 /* mpu domain clocks */
1864 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X), 1864 CLK(NULL, "mpu_ck", &mpu_ck),
1865 /* dsp domain clocks */ 1865 /* dsp domain clocks */
1866 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X), 1866 CLK(NULL, "dsp_fck", &dsp_fck),
1867 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X), 1867 CLK(NULL, "iva2_1_ick", &iva2_1_ick),
1868 /* GFX domain clocks */ 1868 /* GFX domain clocks */
1869 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X), 1869 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck),
1870 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X), 1870 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck),
1871 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X), 1871 CLK(NULL, "gfx_ick", &gfx_ick),
1872 /* Modem domain clocks */ 1872 /* Modem domain clocks */
1873 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X), 1873 CLK(NULL, "mdm_ick", &mdm_ick),
1874 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X), 1874 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck),
1875 /* DSS domain clocks */ 1875 /* DSS domain clocks */
1876 CLK("omapdss_dss", "ick", &dss_ick, CK_243X), 1876 CLK("omapdss_dss", "ick", &dss_ick),
1877 CLK(NULL, "dss_ick", &dss_ick, CK_243X), 1877 CLK(NULL, "dss_ick", &dss_ick),
1878 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X), 1878 CLK(NULL, "dss1_fck", &dss1_fck),
1879 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X), 1879 CLK(NULL, "dss2_fck", &dss2_fck),
1880 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X), 1880 CLK(NULL, "dss_54m_fck", &dss_54m_fck),
1881 /* L3 domain clocks */ 1881 /* L3 domain clocks */
1882 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X), 1882 CLK(NULL, "core_l3_ck", &core_l3_ck),
1883 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X), 1883 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck),
1884 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X), 1884 CLK(NULL, "usb_l4_ick", &usb_l4_ick),
1885 /* L4 domain clocks */ 1885 /* L4 domain clocks */
1886 CLK(NULL, "l4_ck", &l4_ck, CK_243X), 1886 CLK(NULL, "l4_ck", &l4_ck),
1887 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X), 1887 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick),
1888 /* virtual meta-group clock */ 1888 /* virtual meta-group clock */
1889 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X), 1889 CLK(NULL, "virt_prcm_set", &virt_prcm_set),
1890 /* general l4 interface ck, multi-parent functional clk */ 1890 /* general l4 interface ck, multi-parent functional clk */
1891 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X), 1891 CLK(NULL, "gpt1_ick", &gpt1_ick),
1892 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X), 1892 CLK(NULL, "gpt1_fck", &gpt1_fck),
1893 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X), 1893 CLK(NULL, "gpt2_ick", &gpt2_ick),
1894 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X), 1894 CLK(NULL, "gpt2_fck", &gpt2_fck),
1895 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X), 1895 CLK(NULL, "gpt3_ick", &gpt3_ick),
1896 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X), 1896 CLK(NULL, "gpt3_fck", &gpt3_fck),
1897 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X), 1897 CLK(NULL, "gpt4_ick", &gpt4_ick),
1898 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X), 1898 CLK(NULL, "gpt4_fck", &gpt4_fck),
1899 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X), 1899 CLK(NULL, "gpt5_ick", &gpt5_ick),
1900 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X), 1900 CLK(NULL, "gpt5_fck", &gpt5_fck),
1901 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X), 1901 CLK(NULL, "gpt6_ick", &gpt6_ick),
1902 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X), 1902 CLK(NULL, "gpt6_fck", &gpt6_fck),
1903 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X), 1903 CLK(NULL, "gpt7_ick", &gpt7_ick),
1904 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X), 1904 CLK(NULL, "gpt7_fck", &gpt7_fck),
1905 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X), 1905 CLK(NULL, "gpt8_ick", &gpt8_ick),
1906 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X), 1906 CLK(NULL, "gpt8_fck", &gpt8_fck),
1907 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X), 1907 CLK(NULL, "gpt9_ick", &gpt9_ick),
1908 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X), 1908 CLK(NULL, "gpt9_fck", &gpt9_fck),
1909 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X), 1909 CLK(NULL, "gpt10_ick", &gpt10_ick),
1910 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X), 1910 CLK(NULL, "gpt10_fck", &gpt10_fck),
1911 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X), 1911 CLK(NULL, "gpt11_ick", &gpt11_ick),
1912 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X), 1912 CLK(NULL, "gpt11_fck", &gpt11_fck),
1913 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X), 1913 CLK(NULL, "gpt12_ick", &gpt12_ick),
1914 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X), 1914 CLK(NULL, "gpt12_fck", &gpt12_fck),
1915 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X), 1915 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick),
1916 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X), 1916 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick),
1917 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X), 1917 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck),
1918 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X), 1918 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick),
1919 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X), 1919 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick),
1920 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X), 1920 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck),
1921 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X), 1921 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick),
1922 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X), 1922 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick),
1923 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X), 1923 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck),
1924 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X), 1924 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick),
1925 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X), 1925 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick),
1926 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X), 1926 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck),
1927 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X), 1927 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick),
1928 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X), 1928 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick),
1929 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X), 1929 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck),
1930 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X), 1930 CLK("omap2_mcspi.1", "ick", &mcspi1_ick),
1931 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X), 1931 CLK(NULL, "mcspi1_ick", &mcspi1_ick),
1932 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X), 1932 CLK(NULL, "mcspi1_fck", &mcspi1_fck),
1933 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X), 1933 CLK("omap2_mcspi.2", "ick", &mcspi2_ick),
1934 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X), 1934 CLK(NULL, "mcspi2_ick", &mcspi2_ick),
1935 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X), 1935 CLK(NULL, "mcspi2_fck", &mcspi2_fck),
1936 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X), 1936 CLK("omap2_mcspi.3", "ick", &mcspi3_ick),
1937 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X), 1937 CLK(NULL, "mcspi3_ick", &mcspi3_ick),
1938 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X), 1938 CLK(NULL, "mcspi3_fck", &mcspi3_fck),
1939 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X), 1939 CLK(NULL, "uart1_ick", &uart1_ick),
1940 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X), 1940 CLK(NULL, "uart1_fck", &uart1_fck),
1941 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X), 1941 CLK(NULL, "uart2_ick", &uart2_ick),
1942 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X), 1942 CLK(NULL, "uart2_fck", &uart2_fck),
1943 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X), 1943 CLK(NULL, "uart3_ick", &uart3_ick),
1944 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X), 1944 CLK(NULL, "uart3_fck", &uart3_fck),
1945 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X), 1945 CLK(NULL, "gpios_ick", &gpios_ick),
1946 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X), 1946 CLK(NULL, "gpios_fck", &gpios_fck),
1947 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X), 1947 CLK("omap_wdt", "ick", &mpu_wdt_ick),
1948 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X), 1948 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick),
1949 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X), 1949 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck),
1950 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X), 1950 CLK(NULL, "sync_32k_ick", &sync_32k_ick),
1951 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X), 1951 CLK(NULL, "wdt1_ick", &wdt1_ick),
1952 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X), 1952 CLK(NULL, "omapctrl_ick", &omapctrl_ick),
1953 CLK(NULL, "icr_ick", &icr_ick, CK_243X), 1953 CLK(NULL, "icr_ick", &icr_ick),
1954 CLK("omap24xxcam", "fck", &cam_fck, CK_243X), 1954 CLK("omap24xxcam", "fck", &cam_fck),
1955 CLK(NULL, "cam_fck", &cam_fck, CK_243X), 1955 CLK(NULL, "cam_fck", &cam_fck),
1956 CLK("omap24xxcam", "ick", &cam_ick, CK_243X), 1956 CLK("omap24xxcam", "ick", &cam_ick),
1957 CLK(NULL, "cam_ick", &cam_ick, CK_243X), 1957 CLK(NULL, "cam_ick", &cam_ick),
1958 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X), 1958 CLK(NULL, "mailboxes_ick", &mailboxes_ick),
1959 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X), 1959 CLK(NULL, "wdt4_ick", &wdt4_ick),
1960 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X), 1960 CLK(NULL, "wdt4_fck", &wdt4_fck),
1961 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X), 1961 CLK(NULL, "mspro_ick", &mspro_ick),
1962 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X), 1962 CLK(NULL, "mspro_fck", &mspro_fck),
1963 CLK(NULL, "fac_ick", &fac_ick, CK_243X), 1963 CLK(NULL, "fac_ick", &fac_ick),
1964 CLK(NULL, "fac_fck", &fac_fck, CK_243X), 1964 CLK(NULL, "fac_fck", &fac_fck),
1965 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X), 1965 CLK("omap_hdq.0", "ick", &hdq_ick),
1966 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X), 1966 CLK(NULL, "hdq_ick", &hdq_ick),
1967 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X), 1967 CLK("omap_hdq.1", "fck", &hdq_fck),
1968 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X), 1968 CLK(NULL, "hdq_fck", &hdq_fck),
1969 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X), 1969 CLK("omap_i2c.1", "ick", &i2c1_ick),
1970 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X), 1970 CLK(NULL, "i2c1_ick", &i2c1_ick),
1971 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X), 1971 CLK(NULL, "i2chs1_fck", &i2chs1_fck),
1972 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X), 1972 CLK("omap_i2c.2", "ick", &i2c2_ick),
1973 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X), 1973 CLK(NULL, "i2c2_ick", &i2c2_ick),
1974 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X), 1974 CLK(NULL, "i2chs2_fck", &i2chs2_fck),
1975 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X), 1975 CLK(NULL, "gpmc_fck", &gpmc_fck),
1976 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X), 1976 CLK(NULL, "sdma_fck", &sdma_fck),
1977 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X), 1977 CLK(NULL, "sdma_ick", &sdma_ick),
1978 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X), 1978 CLK(NULL, "sdrc_ick", &sdrc_ick),
1979 CLK(NULL, "des_ick", &des_ick, CK_243X), 1979 CLK(NULL, "des_ick", &des_ick),
1980 CLK("omap-sham", "ick", &sha_ick, CK_243X), 1980 CLK("omap-sham", "ick", &sha_ick),
1981 CLK("omap_rng", "ick", &rng_ick, CK_243X), 1981 CLK(NULL, "sha_ick", &sha_ick),
1982 CLK(NULL, "rng_ick", &rng_ick, CK_243X), 1982 CLK("omap_rng", "ick", &rng_ick),
1983 CLK("omap-aes", "ick", &aes_ick, CK_243X), 1983 CLK(NULL, "rng_ick", &rng_ick),
1984 CLK(NULL, "pka_ick", &pka_ick, CK_243X), 1984 CLK("omap-aes", "ick", &aes_ick),
1985 CLK(NULL, "usb_fck", &usb_fck, CK_243X), 1985 CLK(NULL, "aes_ick", &aes_ick),
1986 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X), 1986 CLK(NULL, "pka_ick", &pka_ick),
1987 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X), 1987 CLK(NULL, "usb_fck", &usb_fck),
1988 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X), 1988 CLK("musb-omap2430", "ick", &usbhs_ick),
1989 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X), 1989 CLK(NULL, "usbhs_ick", &usbhs_ick),
1990 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X), 1990 CLK("omap_hsmmc.0", "ick", &mmchs1_ick),
1991 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X), 1991 CLK(NULL, "mmchs1_ick", &mmchs1_ick),
1992 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X), 1992 CLK(NULL, "mmchs1_fck", &mmchs1_fck),
1993 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X), 1993 CLK("omap_hsmmc.1", "ick", &mmchs2_ick),
1994 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X), 1994 CLK(NULL, "mmchs2_ick", &mmchs2_ick),
1995 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X), 1995 CLK(NULL, "mmchs2_fck", &mmchs2_fck),
1996 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X), 1996 CLK(NULL, "gpio5_ick", &gpio5_ick),
1997 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X), 1997 CLK(NULL, "gpio5_fck", &gpio5_fck),
1998 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X), 1998 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick),
1999 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X), 1999 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck),
2000 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X), 2000 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck),
2001 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X), 2001 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck),
2002 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X), 2002 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck),
2003 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X), 2003 CLK(NULL, "timer_32k_ck", &func_32k_ck),
2004 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X), 2004 CLK(NULL, "timer_sys_ck", &sys_ck),
2005 CLK(NULL, "timer_ext_ck", &alt_ck),
2006 CLK(NULL, "cpufreq_ck", &virt_prcm_set),
2005}; 2007};
2006 2008
2007static const char *enable_init_clks[] = { 2009static const char *enable_init_clks[] = {
@@ -2019,8 +2021,6 @@ static const char *enable_init_clks[] = {
2019 2021
2020int __init omap2430_clk_init(void) 2022int __init omap2430_clk_init(void)
2021{ 2023{
2022 struct omap_clk *c;
2023
2024 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL; 2024 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2025 cpu_mask = RATE_IN_243X; 2025 cpu_mask = RATE_IN_243X;
2026 rate_table = omap2430_rate_table; 2026 rate_table = omap2430_rate_table;
@@ -2029,12 +2029,7 @@ int __init omap2430_clk_init(void)
2029 2029
2030 omap2xxx_clkt_vps_check_bootloader_rates(); 2030 omap2xxx_clkt_vps_check_bootloader_rates();
2031 2031
2032 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks); 2032 omap_clocks_register(omap2430_clks, ARRAY_SIZE(omap2430_clks));
2033 c++) {
2034 clkdev_add(&c->lk);
2035 if (!__clk_init(NULL, c->lk.clk))
2036 omap2_init_clk_hw_omap_clocks(c->lk.clk);
2037 }
2038 2033
2039 omap2xxx_clkt_vps_late_init(); 2034 omap2xxx_clkt_vps_late_init();
2040 2035
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
index 476b82066cb6..6ebc7803bc3e 100644
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -413,6 +413,14 @@ static struct clk smartreflex1_fck;
413DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL); 413DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
414DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null); 414DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
415 415
416static struct clk sha0_fck;
417DEFINE_STRUCT_CLK_HW_OMAP(sha0_fck, NULL);
418DEFINE_STRUCT_CLK(sha0_fck, dpll_core_ck_parents, clk_ops_null);
419
420static struct clk aes0_fck;
421DEFINE_STRUCT_CLK_HW_OMAP(aes0_fck, NULL);
422DEFINE_STRUCT_CLK(aes0_fck, dpll_core_ck_parents, clk_ops_null);
423
416/* 424/*
417 * Modules clock nodes 425 * Modules clock nodes
418 * 426 *
@@ -838,80 +846,82 @@ DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
838 * clkdev 846 * clkdev
839 */ 847 */
840static struct omap_clk am33xx_clks[] = { 848static struct omap_clk am33xx_clks[] = {
841 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX), 849 CLK(NULL, "clk_32768_ck", &clk_32768_ck),
842 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX), 850 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck),
843 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX), 851 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck),
844 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX), 852 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck),
845 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX), 853 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck),
846 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX), 854 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck),
847 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX), 855 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck),
848 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX), 856 CLK(NULL, "tclkin_ck", &tclkin_ck),
849 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX), 857 CLK(NULL, "dpll_core_ck", &dpll_core_ck),
850 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX), 858 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck),
851 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX), 859 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck),
852 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX), 860 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck),
853 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX), 861 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck),
854 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX), 862 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck),
855 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX), 863 CLK("cpu0", NULL, &dpll_mpu_ck),
856 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX), 864 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck),
857 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX), 865 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck),
858 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX), 866 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck),
859 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX), 867 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck),
860 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX), 868 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck),
861 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX), 869 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck),
862 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX), 870 CLK(NULL, "dpll_per_ck", &dpll_per_ck),
863 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX), 871 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck),
864 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX), 872 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck),
865 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX), 873 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck),
866 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX), 874 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck),
867 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX), 875 CLK(NULL, "cefuse_fck", &cefuse_fck),
868 CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck, CK_AM33XX), 876 CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck),
869 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX), 877 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick),
870 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX), 878 CLK(NULL, "dcan0_fck", &dcan0_fck),
871 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX), 879 CLK("481cc000.d_can", NULL, &dcan0_fck),
872 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX), 880 CLK(NULL, "dcan1_fck", &dcan1_fck),
873 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX), 881 CLK("481d0000.d_can", NULL, &dcan1_fck),
874 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX), 882 CLK(NULL, "debugss_ick", &debugss_ick),
875 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX), 883 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk),
876 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX), 884 CLK(NULL, "mcasp0_fck", &mcasp0_fck),
877 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX), 885 CLK(NULL, "mcasp1_fck", &mcasp1_fck),
878 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX), 886 CLK(NULL, "mmu_fck", &mmu_fck),
879 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX), 887 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck),
880 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX), 888 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck),
881 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX), 889 CLK(NULL, "sha0_fck", &sha0_fck),
882 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX), 890 CLK(NULL, "aes0_fck", &aes0_fck),
883 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX), 891 CLK(NULL, "timer1_fck", &timer1_fck),
884 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX), 892 CLK(NULL, "timer2_fck", &timer2_fck),
885 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX), 893 CLK(NULL, "timer3_fck", &timer3_fck),
886 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX), 894 CLK(NULL, "timer4_fck", &timer4_fck),
887 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX), 895 CLK(NULL, "timer5_fck", &timer5_fck),
888 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX), 896 CLK(NULL, "timer6_fck", &timer6_fck),
889 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX), 897 CLK(NULL, "timer7_fck", &timer7_fck),
890 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX), 898 CLK(NULL, "usbotg_fck", &usbotg_fck),
891 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX), 899 CLK(NULL, "ieee5000_fck", &ieee5000_fck),
892 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX), 900 CLK(NULL, "wdt1_fck", &wdt1_fck),
893 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX), 901 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk),
894 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX), 902 CLK(NULL, "l3_gclk", &l3_gclk),
895 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX), 903 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck),
896 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX), 904 CLK(NULL, "l4hs_gclk", &l4hs_gclk),
897 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX), 905 CLK(NULL, "l3s_gclk", &l3s_gclk),
898 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX), 906 CLK(NULL, "l4fw_gclk", &l4fw_gclk),
899 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX), 907 CLK(NULL, "l4ls_gclk", &l4ls_gclk),
900 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX), 908 CLK(NULL, "clk_24mhz", &clk_24mhz),
901 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX), 909 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck),
902 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX), 910 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk),
903 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX), 911 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk),
904 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX), 912 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck),
905 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX), 913 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk),
906 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX), 914 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk),
907 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX), 915 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk),
908 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX), 916 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk),
909 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX), 917 CLK(NULL, "lcd_gclk", &lcd_gclk),
910 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX), 918 CLK(NULL, "mmc_clk", &mmc_clk),
911 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX), 919 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck),
912 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck, CK_AM33XX), 920 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck),
913 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX), 921 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck),
914 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX), 922 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck),
923 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick),
924 CLK(NULL, "timer_sys_ck", &sys_clkin_ck),
915}; 925};
916 926
917 927
@@ -926,21 +936,10 @@ static const char *enable_init_clks[] = {
926 936
927int __init am33xx_clk_init(void) 937int __init am33xx_clk_init(void)
928{ 938{
929 struct omap_clk *c; 939 if (soc_is_am33xx())
930 u32 cpu_clkflg;
931
932 if (soc_is_am33xx()) {
933 cpu_mask = RATE_IN_AM33XX; 940 cpu_mask = RATE_IN_AM33XX;
934 cpu_clkflg = CK_AM33XX;
935 }
936 941
937 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) { 942 omap_clocks_register(am33xx_clks, ARRAY_SIZE(am33xx_clks));
938 if (c->cpu & cpu_clkflg) {
939 clkdev_add(&c->lk);
940 if (!__clk_init(NULL, c->lk.clk))
941 omap2_init_clk_hw_omap_clocks(c->lk.clk);
942 }
943 }
944 943
945 omap2_clk_disable_autoidle_all(); 944 omap2_clk_disable_autoidle_all();
946 945
@@ -958,6 +957,14 @@ int __init am33xx_clk_init(void)
958 957
959 clk_set_parent(&timer3_fck, &sys_clkin_ck); 958 clk_set_parent(&timer3_fck, &sys_clkin_ck);
960 clk_set_parent(&timer6_fck, &sys_clkin_ck); 959 clk_set_parent(&timer6_fck, &sys_clkin_ck);
960 /*
961 * The On-Chip 32K RC Osc clock is not an accurate clock-source as per
962 * the design/spec, so as a result, for example, timer which supposed
963 * to get expired @60Sec, but will expire somewhere ~@40Sec, which is
964 * not expected by any use-case, so change WDT1 clock source to PRCM
965 * 32KHz clock.
966 */
967 clk_set_parent(&wdt1_fck, &clkdiv32k_ick);
961 968
962 return 0; 969 return 0;
963} 970}
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 4579c3c5338f..45cd26430d1f 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -3219,289 +3219,327 @@ static struct clk_hw_omap wdt3_ick_hw = {
3219DEFINE_STRUCT_CLK(wdt3_ick, gpio2_ick_parent_names, aes2_ick_ops); 3219DEFINE_STRUCT_CLK(wdt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
3220 3220
3221/* 3221/*
3222 * clkdev 3222 * clocks specific to omap3430es1
3223 */
3224static struct omap_clk omap3430es1_clks[] = {
3225 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck),
3226 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck),
3227 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick),
3228 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck),
3229 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck),
3230 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck),
3231 CLK(NULL, "fshostusb_fck", &fshostusb_fck),
3232 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1),
3233 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1),
3234 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1),
3235 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1),
3236 CLK(NULL, "fac_ick", &fac_ick),
3237 CLK(NULL, "ssi_ick", &ssi_ick_3430es1),
3238 CLK(NULL, "usb_l4_ick", &usb_l4_ick),
3239 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1),
3240 CLK("omapdss_dss", "ick", &dss_ick_3430es1),
3241 CLK(NULL, "dss_ick", &dss_ick_3430es1),
3242};
3243
3244/*
3245 * clocks specific to am35xx
3246 */
3247static struct omap_clk am35xx_clks[] = {
3248 CLK(NULL, "ipss_ick", &ipss_ick),
3249 CLK(NULL, "rmii_ck", &rmii_ck),
3250 CLK(NULL, "pclk_ck", &pclk_ck),
3251 CLK(NULL, "emac_ick", &emac_ick),
3252 CLK(NULL, "emac_fck", &emac_fck),
3253 CLK("davinci_emac.0", NULL, &emac_ick),
3254 CLK("davinci_mdio.0", NULL, &emac_fck),
3255 CLK("vpfe-capture", "master", &vpfe_ick),
3256 CLK("vpfe-capture", "slave", &vpfe_fck),
3257 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx),
3258 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx),
3259 CLK(NULL, "hecc_ck", &hecc_ck),
3260 CLK(NULL, "uart4_ick", &uart4_ick_am35xx),
3261 CLK(NULL, "uart4_fck", &uart4_fck_am35xx),
3262};
3263
3264/*
3265 * clocks specific to omap36xx
3266 */
3267static struct omap_clk omap36xx_clks[] = {
3268 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck),
3269 CLK(NULL, "uart4_fck", &uart4_fck),
3270};
3271
3272/*
3273 * clocks common to omap36xx omap34xx
3274 */
3275static struct omap_clk omap34xx_omap36xx_clks[] = {
3276 CLK(NULL, "aes1_ick", &aes1_ick),
3277 CLK("omap_rng", "ick", &rng_ick),
3278 CLK(NULL, "sha11_ick", &sha11_ick),
3279 CLK(NULL, "des1_ick", &des1_ick),
3280 CLK(NULL, "cam_mclk", &cam_mclk),
3281 CLK(NULL, "cam_ick", &cam_ick),
3282 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck),
3283 CLK(NULL, "security_l3_ick", &security_l3_ick),
3284 CLK(NULL, "pka_ick", &pka_ick),
3285 CLK(NULL, "icr_ick", &icr_ick),
3286 CLK("omap-aes", "ick", &aes2_ick),
3287 CLK("omap-sham", "ick", &sha12_ick),
3288 CLK(NULL, "des2_ick", &des2_ick),
3289 CLK(NULL, "mspro_ick", &mspro_ick),
3290 CLK(NULL, "mailboxes_ick", &mailboxes_ick),
3291 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick),
3292 CLK(NULL, "sr1_fck", &sr1_fck),
3293 CLK(NULL, "sr2_fck", &sr2_fck),
3294 CLK(NULL, "sr_l4_ick", &sr_l4_ick),
3295 CLK(NULL, "security_l4_ick2", &security_l4_ick2),
3296 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick),
3297 CLK(NULL, "dpll2_fck", &dpll2_fck),
3298 CLK(NULL, "iva2_ck", &iva2_ck),
3299 CLK(NULL, "modem_fck", &modem_fck),
3300 CLK(NULL, "sad2d_ick", &sad2d_ick),
3301 CLK(NULL, "mad2d_ick", &mad2d_ick),
3302 CLK(NULL, "mspro_fck", &mspro_fck),
3303 CLK(NULL, "dpll2_ck", &dpll2_ck),
3304 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck),
3305};
3306
3307/*
3308 * clocks common to omap36xx and omap3430es2plus
3309 */
3310static struct omap_clk omap36xx_omap3430es2plus_clks[] = {
3311 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2),
3312 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2),
3313 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2),
3314 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2),
3315 CLK(NULL, "ssi_ick", &ssi_ick_3430es2),
3316 CLK(NULL, "usim_fck", &usim_fck),
3317 CLK(NULL, "usim_ick", &usim_ick),
3318};
3319
3320/*
3321 * clocks common to am35xx omap36xx and omap3430es2plus
3322 */
3323static struct omap_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
3324 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck),
3325 CLK(NULL, "dpll5_ck", &dpll5_ck),
3326 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck),
3327 CLK(NULL, "sgx_fck", &sgx_fck),
3328 CLK(NULL, "sgx_ick", &sgx_ick),
3329 CLK(NULL, "cpefuse_fck", &cpefuse_fck),
3330 CLK(NULL, "ts_fck", &ts_fck),
3331 CLK(NULL, "usbtll_fck", &usbtll_fck),
3332 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck),
3333 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck),
3334 CLK(NULL, "usbtll_ick", &usbtll_ick),
3335 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick),
3336 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick),
3337 CLK("omap_hsmmc.2", "ick", &mmchs3_ick),
3338 CLK(NULL, "mmchs3_ick", &mmchs3_ick),
3339 CLK(NULL, "mmchs3_fck", &mmchs3_fck),
3340 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2),
3341 CLK("omapdss_dss", "ick", &dss_ick_3430es2),
3342 CLK(NULL, "dss_ick", &dss_ick_3430es2),
3343 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck),
3344 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck),
3345 CLK(NULL, "usbhost_ick", &usbhost_ick),
3346 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick),
3347};
3348
3349/*
3350 * common clocks
3223 */ 3351 */
3224static struct omap_clk omap3xxx_clks[] = { 3352static struct omap_clk omap3xxx_clks[] = {
3225 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX), 3353 CLK(NULL, "apb_pclk", &dummy_apb_pclk),
3226 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX), 3354 CLK(NULL, "omap_32k_fck", &omap_32k_fck),
3227 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX), 3355 CLK(NULL, "virt_12m_ck", &virt_12m_ck),
3228 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX), 3356 CLK(NULL, "virt_13m_ck", &virt_13m_ck),
3229 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3357 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck),
3230 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX), 3358 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck),
3231 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX), 3359 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck),
3232 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX), 3360 CLK(NULL, "osc_sys_ck", &osc_sys_ck),
3233 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX), 3361 CLK("twl", "fck", &osc_sys_ck),
3234 CLK("twl", "fck", &osc_sys_ck, CK_3XXX), 3362 CLK(NULL, "sys_ck", &sys_ck),
3235 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX), 3363 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck),
3236 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX), 3364 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck),
3237 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX), 3365 CLK(NULL, "sys_altclk", &sys_altclk),
3238 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX), 3366 CLK(NULL, "mcbsp_clks", &mcbsp_clks),
3239 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX), 3367 CLK(NULL, "sys_clkout1", &sys_clkout1),
3240 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX), 3368 CLK(NULL, "dpll1_ck", &dpll1_ck),
3241 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX), 3369 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck),
3242 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX), 3370 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck),
3243 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX), 3371 CLK(NULL, "dpll3_ck", &dpll3_ck),
3244 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX), 3372 CLK(NULL, "core_ck", &core_ck),
3245 CLK(NULL, "core_ck", &core_ck, CK_3XXX), 3373 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck),
3246 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX), 3374 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck),
3247 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX), 3375 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck),
3248 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX), 3376 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck),
3249 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX), 3377 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck),
3250 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX), 3378 CLK(NULL, "dpll4_ck", &dpll4_ck),
3251 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX), 3379 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck),
3252 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX), 3380 CLK(NULL, "omap_96m_fck", &omap_96m_fck),
3253 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX), 3381 CLK(NULL, "cm_96m_fck", &cm_96m_fck),
3254 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX), 3382 CLK(NULL, "omap_54m_fck", &omap_54m_fck),
3255 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX), 3383 CLK(NULL, "omap_48m_fck", &omap_48m_fck),
3256 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX), 3384 CLK(NULL, "omap_12m_fck", &omap_12m_fck),
3257 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX), 3385 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck),
3258 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX), 3386 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck),
3259 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX), 3387 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck),
3260 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX), 3388 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck),
3261 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX), 3389 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck),
3262 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX), 3390 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck),
3263 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX), 3391 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck),
3264 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX), 3392 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck),
3265 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX), 3393 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck),
3266 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX), 3394 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck),
3267 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX), 3395 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck),
3268 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX), 3396 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck),
3269 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX), 3397 CLK(NULL, "sys_clkout2", &sys_clkout2),
3270 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX), 3398 CLK(NULL, "corex2_fck", &corex2_fck),
3271 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX), 3399 CLK(NULL, "dpll1_fck", &dpll1_fck),
3272 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3400 CLK(NULL, "mpu_ck", &mpu_ck),
3273 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3401 CLK(NULL, "arm_fck", &arm_fck),
3274 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX), 3402 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck),
3275 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX), 3403 CLK(NULL, "l3_ick", &l3_ick),
3276 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX), 3404 CLK(NULL, "l4_ick", &l4_ick),
3277 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX), 3405 CLK(NULL, "rm_ick", &rm_ick),
3278 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX), 3406 CLK(NULL, "gpt10_fck", &gpt10_fck),
3279 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX), 3407 CLK(NULL, "gpt11_fck", &gpt11_fck),
3280 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX), 3408 CLK(NULL, "core_96m_fck", &core_96m_fck),
3281 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX), 3409 CLK(NULL, "mmchs2_fck", &mmchs2_fck),
3282 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX), 3410 CLK(NULL, "mmchs1_fck", &mmchs1_fck),
3283 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX), 3411 CLK(NULL, "i2c3_fck", &i2c3_fck),
3284 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX), 3412 CLK(NULL, "i2c2_fck", &i2c2_fck),
3285 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX), 3413 CLK(NULL, "i2c1_fck", &i2c1_fck),
3286 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1), 3414 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck),
3287 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1), 3415 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck),
3288 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1), 3416 CLK(NULL, "core_48m_fck", &core_48m_fck),
3289 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1), 3417 CLK(NULL, "mcspi4_fck", &mcspi4_fck),
3290 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1), 3418 CLK(NULL, "mcspi3_fck", &mcspi3_fck),
3291 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3419 CLK(NULL, "mcspi2_fck", &mcspi2_fck),
3292 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3420 CLK(NULL, "mcspi1_fck", &mcspi1_fck),
3293 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1), 3421 CLK(NULL, "uart2_fck", &uart2_fck),
3294 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX), 3422 CLK(NULL, "uart1_fck", &uart1_fck),
3295 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX), 3423 CLK(NULL, "core_12m_fck", &core_12m_fck),
3296 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX), 3424 CLK("omap_hdq.0", "fck", &hdq_fck),
3297 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX), 3425 CLK(NULL, "hdq_fck", &hdq_fck),
3298 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX), 3426 CLK(NULL, "core_l3_ick", &core_l3_ick),
3299 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3427 CLK(NULL, "sdrc_ick", &sdrc_ick),
3300 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3428 CLK(NULL, "gpmc_fck", &gpmc_fck),
3301 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3429 CLK(NULL, "core_l4_ick", &core_l4_ick),
3302 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3430 CLK("omap_hsmmc.1", "ick", &mmchs2_ick),
3303 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3431 CLK("omap_hsmmc.0", "ick", &mmchs1_ick),
3304 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), 3432 CLK(NULL, "mmchs2_ick", &mmchs2_ick),
3305 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3433 CLK(NULL, "mmchs1_ick", &mmchs1_ick),
3306 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX), 3434 CLK("omap_hdq.0", "ick", &hdq_ick),
3307 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX), 3435 CLK(NULL, "hdq_ick", &hdq_ick),
3308 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX), 3436 CLK("omap2_mcspi.4", "ick", &mcspi4_ick),
3309 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX), 3437 CLK("omap2_mcspi.3", "ick", &mcspi3_ick),
3310 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX), 3438 CLK("omap2_mcspi.2", "ick", &mcspi2_ick),
3311 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX), 3439 CLK("omap2_mcspi.1", "ick", &mcspi1_ick),
3312 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX), 3440 CLK(NULL, "mcspi4_ick", &mcspi4_ick),
3313 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX), 3441 CLK(NULL, "mcspi3_ick", &mcspi3_ick),
3314 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX), 3442 CLK(NULL, "mcspi2_ick", &mcspi2_ick),
3315 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX), 3443 CLK(NULL, "mcspi1_ick", &mcspi1_ick),
3316 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX), 3444 CLK("omap_i2c.3", "ick", &i2c3_ick),
3317 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX), 3445 CLK("omap_i2c.2", "ick", &i2c2_ick),
3318 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX), 3446 CLK("omap_i2c.1", "ick", &i2c1_ick),
3319 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX), 3447 CLK(NULL, "i2c3_ick", &i2c3_ick),
3320 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX), 3448 CLK(NULL, "i2c2_ick", &i2c2_ick),
3321 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1), 3449 CLK(NULL, "i2c1_ick", &i2c1_ick),
3322 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX), 3450 CLK(NULL, "uart2_ick", &uart2_ick),
3323 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX), 3451 CLK(NULL, "uart1_ick", &uart1_ick),
3324 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX), 3452 CLK(NULL, "gpt11_ick", &gpt11_ick),
3325 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1), 3453 CLK(NULL, "gpt10_ick", &gpt10_ick),
3326 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX), 3454 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick),
3327 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1), 3455 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick),
3328 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX), 3456 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick),
3329 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX), 3457 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick),
3330 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1), 3458 CLK(NULL, "omapctrl_ick", &omapctrl_ick),
3331 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX), 3459 CLK(NULL, "dss_tv_fck", &dss_tv_fck),
3332 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1), 3460 CLK(NULL, "dss_96m_fck", &dss_96m_fck),
3333 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX), 3461 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck),
3334 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX), 3462 CLK(NULL, "utmi_p1_gfclk", &dummy_ck),
3335 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX), 3463 CLK(NULL, "utmi_p2_gfclk", &dummy_ck),
3336 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX), 3464 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck),
3337 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX), 3465 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck),
3338 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX), 3466 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck),
3339 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3467 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck),
3340 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3468 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck),
3341 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3469 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck),
3342 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3470 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck),
3343 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3471 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck),
3344 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX), 3472 CLK(NULL, "init_60m_fclk", &dummy_ck),
3345 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX), 3473 CLK(NULL, "gpt1_fck", &gpt1_fck),
3346 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX), 3474 CLK(NULL, "aes2_ick", &aes2_ick),
3347 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX), 3475 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck),
3348 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX), 3476 CLK(NULL, "gpio1_dbck", &gpio1_dbck),
3349 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX), 3477 CLK(NULL, "sha12_ick", &sha12_ick),
3350 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX), 3478 CLK(NULL, "wdt2_fck", &wdt2_fck),
3351 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX), 3479 CLK("omap_wdt", "ick", &wdt2_ick),
3352 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX), 3480 CLK(NULL, "wdt2_ick", &wdt2_ick),
3353 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX), 3481 CLK(NULL, "wdt1_ick", &wdt1_ick),
3354 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX), 3482 CLK(NULL, "gpio1_ick", &gpio1_ick),
3355 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX), 3483 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick),
3356 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX), 3484 CLK(NULL, "gpt12_ick", &gpt12_ick),
3357 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX), 3485 CLK(NULL, "gpt1_ick", &gpt1_ick),
3358 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX), 3486 CLK(NULL, "per_96m_fck", &per_96m_fck),
3359 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX), 3487 CLK(NULL, "per_48m_fck", &per_48m_fck),
3360 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX), 3488 CLK(NULL, "uart3_fck", &uart3_fck),
3361 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX), 3489 CLK(NULL, "gpt2_fck", &gpt2_fck),
3362 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX), 3490 CLK(NULL, "gpt3_fck", &gpt3_fck),
3363 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX), 3491 CLK(NULL, "gpt4_fck", &gpt4_fck),
3364 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX), 3492 CLK(NULL, "gpt5_fck", &gpt5_fck),
3365 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX), 3493 CLK(NULL, "gpt6_fck", &gpt6_fck),
3366 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX), 3494 CLK(NULL, "gpt7_fck", &gpt7_fck),
3367 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX), 3495 CLK(NULL, "gpt8_fck", &gpt8_fck),
3368 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX), 3496 CLK(NULL, "gpt9_fck", &gpt9_fck),
3369 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX), 3497 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck),
3370 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX), 3498 CLK(NULL, "gpio6_dbck", &gpio6_dbck),
3371 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX), 3499 CLK(NULL, "gpio5_dbck", &gpio5_dbck),
3372 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX), 3500 CLK(NULL, "gpio4_dbck", &gpio4_dbck),
3373 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX), 3501 CLK(NULL, "gpio3_dbck", &gpio3_dbck),
3374 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX), 3502 CLK(NULL, "gpio2_dbck", &gpio2_dbck),
3375 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX), 3503 CLK(NULL, "wdt3_fck", &wdt3_fck),
3376 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX), 3504 CLK(NULL, "per_l4_ick", &per_l4_ick),
3377 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1), 3505 CLK(NULL, "gpio6_ick", &gpio6_ick),
3378 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX), 3506 CLK(NULL, "gpio5_ick", &gpio5_ick),
3379 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX), 3507 CLK(NULL, "gpio4_ick", &gpio4_ick),
3380 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX), 3508 CLK(NULL, "gpio3_ick", &gpio3_ick),
3381 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1), 3509 CLK(NULL, "gpio2_ick", &gpio2_ick),
3382 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX), 3510 CLK(NULL, "wdt3_ick", &wdt3_ick),
3383 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1), 3511 CLK(NULL, "uart3_ick", &uart3_ick),
3384 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX), 3512 CLK(NULL, "uart4_ick", &uart4_ick),
3385 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX), 3513 CLK(NULL, "gpt9_ick", &gpt9_ick),
3386 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX), 3514 CLK(NULL, "gpt8_ick", &gpt8_ick),
3387 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX), 3515 CLK(NULL, "gpt7_ick", &gpt7_ick),
3388 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX), 3516 CLK(NULL, "gpt6_ick", &gpt6_ick),
3389 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1), 3517 CLK(NULL, "gpt5_ick", &gpt5_ick),
3390 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3518 CLK(NULL, "gpt4_ick", &gpt4_ick),
3391 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX), 3519 CLK(NULL, "gpt3_ick", &gpt3_ick),
3392 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX), 3520 CLK(NULL, "gpt2_ick", &gpt2_ick),
3393 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX), 3521 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick),
3394 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1), 3522 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick),
3395 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1), 3523 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick),
3396 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3524 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick),
3397 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3525 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick),
3398 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX), 3526 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick),
3399 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX), 3527 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck),
3400 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX), 3528 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck),
3401 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3529 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck),
3402 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3530 CLK("etb", "emu_src_ck", &emu_src_ck),
3403 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3531 CLK(NULL, "emu_src_ck", &emu_src_ck),
3404 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3532 CLK(NULL, "pclk_fck", &pclk_fck),
3405 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX), 3533 CLK(NULL, "pclkx2_fck", &pclkx2_fck),
3406 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX), 3534 CLK(NULL, "atclk_fck", &atclk_fck),
3407 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX), 3535 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck),
3408 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX), 3536 CLK(NULL, "traceclk_fck", &traceclk_fck),
3409 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX), 3537 CLK(NULL, "secure_32k_fck", &secure_32k_fck),
3410 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX), 3538 CLK(NULL, "gpt12_fck", &gpt12_fck),
3411 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX), 3539 CLK(NULL, "wdt1_fck", &wdt1_fck),
3412 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX), 3540 CLK(NULL, "timer_32k_ck", &omap_32k_fck),
3413 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX), 3541 CLK(NULL, "timer_sys_ck", &sys_ck),
3414 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX), 3542 CLK(NULL, "cpufreq_ck", &dpll1_ck),
3415 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3416 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3417 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3418 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3419 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3420 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3421 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3422 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3423 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3424 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3425 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3426 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3427 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3428 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3429 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3430 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3431 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3432 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3433 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3434 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3435 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3436 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3437 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3438 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3439 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3440 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3441 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3442 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3443 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3444 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3445 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3446 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3447 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3448 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3449 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3450 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3451 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3452 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3453 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3454 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3455 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3456 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3457 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3458 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3459 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3460 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3461 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3462 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3463 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3464 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3465 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3466 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3467 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3468 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3469 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3470 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3471 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3472 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3473 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3474 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3475 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3476 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3477 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3478 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3479 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3480 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3481 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3482 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3483 CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX),
3484 CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX),
3485 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3486 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3487 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3488 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3489 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3490 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3491 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3492 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3493 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3494 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3495 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3496 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3497 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3498 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3499 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3500 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3501 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3502 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3503 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3504 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3505}; 3543};
3506 3544
3507static const char *enable_init_clks[] = { 3545static const char *enable_init_clks[] = {
@@ -3512,8 +3550,27 @@ static const char *enable_init_clks[] = {
3512 3550
3513int __init omap3xxx_clk_init(void) 3551int __init omap3xxx_clk_init(void)
3514{ 3552{
3515 struct omap_clk *c; 3553 if (omap3_has_192mhz_clk())
3516 u32 cpu_clkflg = 0; 3554 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3555
3556 if (cpu_is_omap3630()) {
3557 dpll3_m3x2_ck = dpll3_m3x2_ck_3630;
3558 dpll4_m2x2_ck = dpll4_m2x2_ck_3630;
3559 dpll4_m3x2_ck = dpll4_m3x2_ck_3630;
3560 dpll4_m4x2_ck = dpll4_m4x2_ck_3630;
3561 dpll4_m5x2_ck = dpll4_m5x2_ck_3630;
3562 dpll4_m6x2_ck = dpll4_m6x2_ck_3630;
3563 }
3564
3565 /*
3566 * XXX This type of dynamic rewriting of the clock tree is
3567 * deprecated and should be revised soon.
3568 */
3569 if (cpu_is_omap3630())
3570 dpll4_dd = dpll4_dd_3630;
3571 else
3572 dpll4_dd = dpll4_dd_34xx;
3573
3517 3574
3518 /* 3575 /*
3519 * 3505 must be tested before 3517, since 3517 returns true 3576 * 3505 must be tested before 3517, since 3517 returns true
@@ -3523,13 +3580,20 @@ int __init omap3xxx_clk_init(void)
3523 */ 3580 */
3524 if (soc_is_am35xx()) { 3581 if (soc_is_am35xx()) {
3525 cpu_mask = RATE_IN_34XX; 3582 cpu_mask = RATE_IN_34XX;
3526 cpu_clkflg = CK_AM35XX; 3583 omap_clocks_register(am35xx_clks, ARRAY_SIZE(am35xx_clks));
3584 omap_clocks_register(omap36xx_am35xx_omap3430es2plus_clks,
3585 ARRAY_SIZE(omap36xx_am35xx_omap3430es2plus_clks));
3586 omap_clocks_register(omap3xxx_clks, ARRAY_SIZE(omap3xxx_clks));
3527 } else if (cpu_is_omap3630()) { 3587 } else if (cpu_is_omap3630()) {
3528 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX); 3588 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3529 cpu_clkflg = CK_36XX; 3589 omap_clocks_register(omap36xx_clks, ARRAY_SIZE(omap36xx_clks));
3530 } else if (cpu_is_ti816x()) { 3590 omap_clocks_register(omap36xx_omap3430es2plus_clks,
3531 cpu_mask = RATE_IN_TI816X; 3591 ARRAY_SIZE(omap36xx_omap3430es2plus_clks));
3532 cpu_clkflg = CK_TI816X; 3592 omap_clocks_register(omap34xx_omap36xx_clks,
3593 ARRAY_SIZE(omap34xx_omap36xx_clks));
3594 omap_clocks_register(omap36xx_am35xx_omap3430es2plus_clks,
3595 ARRAY_SIZE(omap36xx_am35xx_omap3430es2plus_clks));
3596 omap_clocks_register(omap3xxx_clks, ARRAY_SIZE(omap3xxx_clks));
3533 } else if (soc_is_am33xx()) { 3597 } else if (soc_is_am33xx()) {
3534 cpu_mask = RATE_IN_AM33XX; 3598 cpu_mask = RATE_IN_AM33XX;
3535 } else if (cpu_is_ti814x()) { 3599 } else if (cpu_is_ti814x()) {
@@ -3537,49 +3601,32 @@ int __init omap3xxx_clk_init(void)
3537 } else if (cpu_is_omap34xx()) { 3601 } else if (cpu_is_omap34xx()) {
3538 if (omap_rev() == OMAP3430_REV_ES1_0) { 3602 if (omap_rev() == OMAP3430_REV_ES1_0) {
3539 cpu_mask = RATE_IN_3430ES1; 3603 cpu_mask = RATE_IN_3430ES1;
3540 cpu_clkflg = CK_3430ES1; 3604 omap_clocks_register(omap3430es1_clks,
3605 ARRAY_SIZE(omap3430es1_clks));
3606 omap_clocks_register(omap34xx_omap36xx_clks,
3607 ARRAY_SIZE(omap34xx_omap36xx_clks));
3608 omap_clocks_register(omap3xxx_clks,
3609 ARRAY_SIZE(omap3xxx_clks));
3541 } else { 3610 } else {
3542 /* 3611 /*
3543 * Assume that anything that we haven't matched yet 3612 * Assume that anything that we haven't matched yet
3544 * has 3430ES2-type clocks. 3613 * has 3430ES2-type clocks.
3545 */ 3614 */
3546 cpu_mask = RATE_IN_3430ES2PLUS; 3615 cpu_mask = RATE_IN_3430ES2PLUS;
3547 cpu_clkflg = CK_3430ES2PLUS; 3616 omap_clocks_register(omap34xx_omap36xx_clks,
3617 ARRAY_SIZE(omap34xx_omap36xx_clks));
3618 omap_clocks_register(omap36xx_omap3430es2plus_clks,
3619 ARRAY_SIZE(omap36xx_omap3430es2plus_clks));
3620 omap_clocks_register(omap36xx_am35xx_omap3430es2plus_clks,
3621 ARRAY_SIZE(omap36xx_am35xx_omap3430es2plus_clks));
3622 omap_clocks_register(omap3xxx_clks,
3623 ARRAY_SIZE(omap3xxx_clks));
3548 } 3624 }
3549 } else { 3625 } else {
3550 WARN(1, "clock: could not identify OMAP3 variant\n"); 3626 WARN(1, "clock: could not identify OMAP3 variant\n");
3551 } 3627 }
3552 3628
3553 if (omap3_has_192mhz_clk()) 3629 omap2_clk_disable_autoidle_all();
3554 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3555
3556 if (cpu_is_omap3630()) {
3557 dpll3_m3x2_ck = dpll3_m3x2_ck_3630;
3558 dpll4_m2x2_ck = dpll4_m2x2_ck_3630;
3559 dpll4_m3x2_ck = dpll4_m3x2_ck_3630;
3560 dpll4_m4x2_ck = dpll4_m4x2_ck_3630;
3561 dpll4_m5x2_ck = dpll4_m5x2_ck_3630;
3562 dpll4_m6x2_ck = dpll4_m6x2_ck_3630;
3563 }
3564
3565 /*
3566 * XXX This type of dynamic rewriting of the clock tree is
3567 * deprecated and should be revised soon.
3568 */
3569 if (cpu_is_omap3630())
3570 dpll4_dd = dpll4_dd_3630;
3571 else
3572 dpll4_dd = dpll4_dd_34xx;
3573
3574 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3575 c++)
3576 if (c->cpu & cpu_clkflg) {
3577 clkdev_add(&c->lk);
3578 if (!__clk_init(NULL, c->lk.clk))
3579 omap2_init_clk_hw_omap_clocks(c->lk.clk);
3580 }
3581
3582 omap2_clk_disable_autoidle_all();
3583 3630
3584 omap2_clk_enable_init_clocks(enable_init_clks, 3631 omap2_clk_enable_init_clocks(enable_init_clks,
3585 ARRAY_SIZE(enable_init_clks)); 3632 ARRAY_SIZE(enable_init_clks));
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
index 0c6834ae1fc4..88e37a474334 100644
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -1424,284 +1424,285 @@ DEFINE_CLK_MUX(auxclkreq5_ck, auxclkreq_ck_parents, NULL, 0x0,
1424 0x0, NULL); 1424 0x0, NULL);
1425 1425
1426/* 1426/*
1427 * clkdev 1427 * clocks specific to omap4460
1428 */ 1428 */
1429static struct omap_clk omap446x_clks[] = {
1430 CLK(NULL, "div_ts_ck", &div_ts_ck),
1431 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk),
1432};
1433
1434/*
1435 * clocks specific to omap4430
1436 */
1437static struct omap_clk omap443x_clks[] = {
1438 CLK(NULL, "bandgap_fclk", &bandgap_fclk),
1439};
1429 1440
1441/*
1442 * clocks common to omap44xx
1443 */
1430static struct omap_clk omap44xx_clks[] = { 1444static struct omap_clk omap44xx_clks[] = {
1431 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X), 1445 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck),
1432 CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck, CK_443X), 1446 CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck),
1433 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X), 1447 CLK(NULL, "pad_clks_ck", &pad_clks_ck),
1434 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X), 1448 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck),
1435 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X), 1449 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck),
1436 CLK(NULL, "slimbus_src_clk", &slimbus_src_clk, CK_443X), 1450 CLK(NULL, "slimbus_src_clk", &slimbus_src_clk),
1437 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X), 1451 CLK(NULL, "slimbus_clk", &slimbus_clk),
1438 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X), 1452 CLK(NULL, "sys_32k_ck", &sys_32k_ck),
1439 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X), 1453 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck),
1440 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X), 1454 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck),
1441 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X), 1455 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck),
1442 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X), 1456 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck),
1443 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X), 1457 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck),
1444 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X), 1458 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck),
1445 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X), 1459 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck),
1446 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X), 1460 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck),
1447 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X), 1461 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck),
1448 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X), 1462 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck),
1449 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X), 1463 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck),
1450 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X), 1464 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck),
1451 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X), 1465 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck),
1452 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X), 1466 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck),
1453 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X), 1467 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck),
1454 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X), 1468 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck),
1455 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X), 1469 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck),
1456 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X), 1470 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck),
1457 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X), 1471 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk),
1458 CLK(NULL, "abe_clk", &abe_clk, CK_443X), 1472 CLK(NULL, "abe_clk", &abe_clk),
1459 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X), 1473 CLK(NULL, "aess_fclk", &aess_fclk),
1460 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X), 1474 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck),
1461 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X), 1475 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck),
1462 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X), 1476 CLK(NULL, "dpll_core_ck", &dpll_core_ck),
1463 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X), 1477 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck),
1464 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X), 1478 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck),
1465 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X), 1479 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck),
1466 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X), 1480 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck),
1467 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X), 1481 CLK(NULL, "ddrphy_ck", &ddrphy_ck),
1468 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X), 1482 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck),
1469 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X), 1483 CLK(NULL, "div_core_ck", &div_core_ck),
1470 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X), 1484 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk),
1471 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X), 1485 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk),
1472 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X), 1486 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck),
1473 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X), 1487 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck),
1474 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X), 1488 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck),
1475 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X), 1489 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck),
1476 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X), 1490 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck),
1477 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X), 1491 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck),
1478 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X), 1492 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck),
1479 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X), 1493 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck),
1480 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X), 1494 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck),
1481 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X), 1495 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck),
1482 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X), 1496 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck),
1483 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X), 1497 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck),
1484 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X), 1498 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck),
1485 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X), 1499 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck),
1486 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X), 1500 CLK(NULL, "dpll_per_ck", &dpll_per_ck),
1487 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X), 1501 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck),
1488 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X), 1502 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck),
1489 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X), 1503 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck),
1490 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X), 1504 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck),
1491 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X), 1505 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck),
1492 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X), 1506 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck),
1493 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X), 1507 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck),
1494 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X), 1508 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck),
1495 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X), 1509 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck),
1496 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X), 1510 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck),
1497 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X), 1511 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck),
1498 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X), 1512 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck),
1499 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X), 1513 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck),
1500 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X), 1514 CLK(NULL, "func_12m_fclk", &func_12m_fclk),
1501 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X), 1515 CLK(NULL, "func_24m_clk", &func_24m_clk),
1502 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X), 1516 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk),
1503 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X), 1517 CLK(NULL, "func_48m_fclk", &func_48m_fclk),
1504 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X), 1518 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk),
1505 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X), 1519 CLK(NULL, "func_64m_fclk", &func_64m_fclk),
1506 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X), 1520 CLK(NULL, "func_96m_fclk", &func_96m_fclk),
1507 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X), 1521 CLK(NULL, "init_60m_fclk", &init_60m_fclk),
1508 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X), 1522 CLK(NULL, "l3_div_ck", &l3_div_ck),
1509 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X), 1523 CLK(NULL, "l4_div_ck", &l4_div_ck),
1510 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X), 1524 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck),
1511 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X), 1525 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck),
1512 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X), 1526 CLK("smp_twd", NULL, &mpu_periphclk),
1513 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X), 1527 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk),
1514 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X), 1528 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk),
1515 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X), 1529 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk),
1516 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X), 1530 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck),
1517 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X), 1531 CLK(NULL, "aes1_fck", &aes1_fck),
1518 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X), 1532 CLK(NULL, "aes2_fck", &aes2_fck),
1519 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X), 1533 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck),
1520 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X), 1534 CLK(NULL, "func_dmic_abe_gfclk", &func_dmic_abe_gfclk),
1521 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X), 1535 CLK(NULL, "dss_sys_clk", &dss_sys_clk),
1522 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X), 1536 CLK(NULL, "dss_tv_clk", &dss_tv_clk),
1523 CLK(NULL, "func_dmic_abe_gfclk", &func_dmic_abe_gfclk, CK_443X), 1537 CLK(NULL, "dss_dss_clk", &dss_dss_clk),
1524 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X), 1538 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk),
1525 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X), 1539 CLK(NULL, "dss_fck", &dss_fck),
1526 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X), 1540 CLK("omapdss_dss", "ick", &dss_fck),
1527 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X), 1541 CLK(NULL, "fdif_fck", &fdif_fck),
1528 CLK(NULL, "dss_fck", &dss_fck, CK_443X), 1542 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk),
1529 CLK("omapdss_dss", "ick", &dss_fck, CK_443X), 1543 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk),
1530 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X), 1544 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk),
1531 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X), 1545 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk),
1532 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X), 1546 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk),
1533 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X), 1547 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk),
1534 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X), 1548 CLK(NULL, "sgx_clk_mux", &sgx_clk_mux),
1535 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X), 1549 CLK(NULL, "hsi_fck", &hsi_fck),
1536 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X), 1550 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk),
1537 CLK(NULL, "sgx_clk_mux", &sgx_clk_mux, CK_443X), 1551 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck),
1538 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X), 1552 CLK(NULL, "func_mcasp_abe_gfclk", &func_mcasp_abe_gfclk),
1539 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X), 1553 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck),
1540 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X), 1554 CLK(NULL, "func_mcbsp1_gfclk", &func_mcbsp1_gfclk),
1541 CLK(NULL, "func_mcasp_abe_gfclk", &func_mcasp_abe_gfclk, CK_443X), 1555 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck),
1542 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X), 1556 CLK(NULL, "func_mcbsp2_gfclk", &func_mcbsp2_gfclk),
1543 CLK(NULL, "func_mcbsp1_gfclk", &func_mcbsp1_gfclk, CK_443X), 1557 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck),
1544 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X), 1558 CLK(NULL, "func_mcbsp3_gfclk", &func_mcbsp3_gfclk),
1545 CLK(NULL, "func_mcbsp2_gfclk", &func_mcbsp2_gfclk, CK_443X), 1559 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck),
1546 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X), 1560 CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk),
1547 CLK(NULL, "func_mcbsp3_gfclk", &func_mcbsp3_gfclk, CK_443X), 1561 CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk),
1548 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X), 1562 CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk),
1549 CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk, CK_443X), 1563 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m),
1550 CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk, CK_443X), 1564 CLK(NULL, "sha2md5_fck", &sha2md5_fck),
1551 CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk, CK_443X), 1565 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1),
1552 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X), 1566 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0),
1553 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X), 1567 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2),
1554 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X), 1568 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk),
1555 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X), 1569 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1),
1556 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X), 1570 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0),
1557 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X), 1571 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk),
1558 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X), 1572 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck),
1559 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X), 1573 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck),
1560 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X), 1574 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck),
1561 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X), 1575 CLK(NULL, "dmt1_clk_mux", &dmt1_clk_mux),
1562 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X), 1576 CLK(NULL, "cm2_dm10_mux", &cm2_dm10_mux),
1563 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X), 1577 CLK(NULL, "cm2_dm11_mux", &cm2_dm11_mux),
1564 CLK(NULL, "dmt1_clk_mux", &dmt1_clk_mux, CK_443X), 1578 CLK(NULL, "cm2_dm2_mux", &cm2_dm2_mux),
1565 CLK(NULL, "cm2_dm10_mux", &cm2_dm10_mux, CK_443X), 1579 CLK(NULL, "cm2_dm3_mux", &cm2_dm3_mux),
1566 CLK(NULL, "cm2_dm11_mux", &cm2_dm11_mux, CK_443X), 1580 CLK(NULL, "cm2_dm4_mux", &cm2_dm4_mux),
1567 CLK(NULL, "cm2_dm2_mux", &cm2_dm2_mux, CK_443X), 1581 CLK(NULL, "timer5_sync_mux", &timer5_sync_mux),
1568 CLK(NULL, "cm2_dm3_mux", &cm2_dm3_mux, CK_443X), 1582 CLK(NULL, "timer6_sync_mux", &timer6_sync_mux),
1569 CLK(NULL, "cm2_dm4_mux", &cm2_dm4_mux, CK_443X), 1583 CLK(NULL, "timer7_sync_mux", &timer7_sync_mux),
1570 CLK(NULL, "timer5_sync_mux", &timer5_sync_mux, CK_443X), 1584 CLK(NULL, "timer8_sync_mux", &timer8_sync_mux),
1571 CLK(NULL, "timer6_sync_mux", &timer6_sync_mux, CK_443X), 1585 CLK(NULL, "cm2_dm9_mux", &cm2_dm9_mux),
1572 CLK(NULL, "timer7_sync_mux", &timer7_sync_mux, CK_443X), 1586 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck),
1573 CLK(NULL, "timer8_sync_mux", &timer8_sync_mux, CK_443X), 1587 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck),
1574 CLK(NULL, "cm2_dm9_mux", &cm2_dm9_mux, CK_443X), 1588 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk),
1575 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X), 1589 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk),
1576 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X), 1590 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk),
1577 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X), 1591 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk),
1578 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X), 1592 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk),
1579 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X), 1593 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk),
1580 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X), 1594 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk),
1581 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X), 1595 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk),
1582 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X), 1596 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk),
1583 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X), 1597 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk),
1584 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X), 1598 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck),
1585 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X), 1599 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck),
1586 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X), 1600 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk),
1587 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X), 1601 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk),
1588 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X), 1602 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick),
1589 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X), 1603 CLK("musb-omap2430", "ick", &usb_otg_hs_ick),
1590 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X), 1604 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k),
1591 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X), 1605 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk),
1592 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X), 1606 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk),
1593 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X), 1607 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk),
1594 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X), 1608 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick),
1595 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X), 1609 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick),
1596 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X), 1610 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick),
1597 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X), 1611 CLK(NULL, "usim_ck", &usim_ck),
1598 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X), 1612 CLK(NULL, "usim_fclk", &usim_fclk),
1599 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X), 1613 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck),
1600 CLK(NULL, "usim_ck", &usim_ck, CK_443X), 1614 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck),
1601 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X), 1615 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck),
1602 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X), 1616 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck),
1603 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X), 1617 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck),
1604 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X), 1618 CLK(NULL, "auxclk0_ck", &auxclk0_ck),
1605 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X), 1619 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck),
1606 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X), 1620 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck),
1607 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X), 1621 CLK(NULL, "auxclk1_ck", &auxclk1_ck),
1608 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X), 1622 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck),
1609 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X), 1623 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck),
1610 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X), 1624 CLK(NULL, "auxclk2_ck", &auxclk2_ck),
1611 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X), 1625 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck),
1612 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X), 1626 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck),
1613 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X), 1627 CLK(NULL, "auxclk3_ck", &auxclk3_ck),
1614 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X), 1628 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck),
1615 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X), 1629 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck),
1616 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X), 1630 CLK(NULL, "auxclk4_ck", &auxclk4_ck),
1617 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X), 1631 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck),
1618 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X), 1632 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck),
1619 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X), 1633 CLK(NULL, "auxclk5_ck", &auxclk5_ck),
1620 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X), 1634 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck),
1621 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X), 1635 CLK("omap-gpmc", "fck", &dummy_ck),
1622 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X), 1636 CLK("omap_i2c.1", "ick", &dummy_ck),
1623 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X), 1637 CLK("omap_i2c.2", "ick", &dummy_ck),
1624 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X), 1638 CLK("omap_i2c.3", "ick", &dummy_ck),
1625 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X), 1639 CLK("omap_i2c.4", "ick", &dummy_ck),
1626 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X), 1640 CLK(NULL, "mailboxes_ick", &dummy_ck),
1627 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X), 1641 CLK("omap_hsmmc.0", "ick", &dummy_ck),
1628 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X), 1642 CLK("omap_hsmmc.1", "ick", &dummy_ck),
1629 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X), 1643 CLK("omap_hsmmc.2", "ick", &dummy_ck),
1630 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X), 1644 CLK("omap_hsmmc.3", "ick", &dummy_ck),
1631 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X), 1645 CLK("omap_hsmmc.4", "ick", &dummy_ck),
1632 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X), 1646 CLK("omap-mcbsp.1", "ick", &dummy_ck),
1633 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X), 1647 CLK("omap-mcbsp.2", "ick", &dummy_ck),
1634 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X), 1648 CLK("omap-mcbsp.3", "ick", &dummy_ck),
1635 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X), 1649 CLK("omap-mcbsp.4", "ick", &dummy_ck),
1636 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X), 1650 CLK("omap2_mcspi.1", "ick", &dummy_ck),
1637 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X), 1651 CLK("omap2_mcspi.2", "ick", &dummy_ck),
1638 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X), 1652 CLK("omap2_mcspi.3", "ick", &dummy_ck),
1639 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X), 1653 CLK("omap2_mcspi.4", "ick", &dummy_ck),
1640 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X), 1654 CLK(NULL, "uart1_ick", &dummy_ck),
1641 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X), 1655 CLK(NULL, "uart2_ick", &dummy_ck),
1642 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X), 1656 CLK(NULL, "uart3_ick", &dummy_ck),
1643 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X), 1657 CLK(NULL, "uart4_ick", &dummy_ck),
1644 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X), 1658 CLK("usbhs_omap", "usbhost_ick", &dummy_ck),
1645 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X), 1659 CLK("usbhs_omap", "usbtll_fck", &dummy_ck),
1646 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X), 1660 CLK("usbhs_tll", "usbtll_fck", &dummy_ck),
1647 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X), 1661 CLK("omap_wdt", "ick", &dummy_ck),
1648 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X), 1662 CLK(NULL, "timer_32k_ck", &sys_32k_ck),
1649 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
1650 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
1651 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
1652 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */ 1663 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
1653 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1664 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck),
1654 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1665 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck),
1655 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1666 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck),
1656 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1667 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck),
1657 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1668 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck),
1658 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1669 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck),
1659 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1670 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck),
1660 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1671 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck),
1661 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1672 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck),
1662 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1673 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck),
1663 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1674 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck),
1664 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1675 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck),
1665 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1676 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck),
1666 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1677 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck),
1667 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1678 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck),
1668 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1679 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck),
1669 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1680 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck),
1670 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), 1681 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck),
1671 CLK("40138000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1682 CLK("40138000.timer", "timer_sys_ck", &syc_clk_div_ck),
1672 CLK("4013a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1683 CLK("4013a000.timer", "timer_sys_ck", &syc_clk_div_ck),
1673 CLK("4013c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1684 CLK("4013c000.timer", "timer_sys_ck", &syc_clk_div_ck),
1674 CLK("4013e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), 1685 CLK("4013e000.timer", "timer_sys_ck", &syc_clk_div_ck),
1675 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), 1686 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck),
1676}; 1687};
1677 1688
1678int __init omap4xxx_clk_init(void) 1689int __init omap4xxx_clk_init(void)
1679{ 1690{
1680 u32 cpu_clkflg;
1681 struct omap_clk *c;
1682 int rc; 1691 int rc;
1683 1692
1684 if (cpu_is_omap443x()) { 1693 if (cpu_is_omap443x()) {
1685 cpu_mask = RATE_IN_4430; 1694 cpu_mask = RATE_IN_4430;
1686 cpu_clkflg = CK_443X; 1695 omap_clocks_register(omap443x_clks, ARRAY_SIZE(omap443x_clks));
1687 } else if (cpu_is_omap446x() || cpu_is_omap447x()) { 1696 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
1688 cpu_mask = RATE_IN_4460 | RATE_IN_4430; 1697 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
1689 cpu_clkflg = CK_446X | CK_443X; 1698 omap_clocks_register(omap446x_clks, ARRAY_SIZE(omap446x_clks));
1690
1691 if (cpu_is_omap447x()) 1699 if (cpu_is_omap447x())
1692 pr_warn("WARNING: OMAP4470 clock data incomplete!\n"); 1700 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
1693 } else { 1701 } else {
1694 return 0; 1702 return 0;
1695 } 1703 }
1696 1704
1697 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks); 1705 omap_clocks_register(omap44xx_clks, ARRAY_SIZE(omap44xx_clks));
1698 c++) {
1699 if (c->cpu & cpu_clkflg) {
1700 clkdev_add(&c->lk);
1701 if (!__clk_init(NULL, c->lk.clk))
1702 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1703 }
1704 }
1705 1706
1706 omap2_clk_disable_autoidle_all(); 1707 omap2_clk_disable_autoidle_all();
1707 1708
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index e4ec3a69ee2e..0c38ca96c840 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -23,7 +23,7 @@
23#include <linux/clk-provider.h> 23#include <linux/clk-provider.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26 26#include <linux/clk-private.h>
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28 28
29 29
@@ -569,6 +569,21 @@ const struct clk_hw_omap_ops clkhwops_wait = {
569}; 569};
570 570
571/** 571/**
572 * omap_clocks_register - register an array of omap_clk
573 * @ocs: pointer to an array of omap_clk to register
574 */
575void __init omap_clocks_register(struct omap_clk oclks[], int cnt)
576{
577 struct omap_clk *c;
578
579 for (c = oclks; c < oclks + cnt; c++) {
580 clkdev_add(&c->lk);
581 if (!__clk_init(NULL, c->lk.clk))
582 omap2_init_clk_hw_omap_clocks(c->lk.clk);
583 }
584}
585
586/**
572 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument 587 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument
573 * @mpurate_ck_name: clk name of the clock to change rate 588 * @mpurate_ck_name: clk name of the clock to change rate
574 * 589 *
@@ -596,7 +611,7 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
596 return -ENOENT; 611 return -ENOENT;
597 612
598 r = clk_set_rate(mpurate_ck, mpurate); 613 r = clk_set_rate(mpurate_ck, mpurate);
599 if (IS_ERR_VALUE(r)) { 614 if (r < 0) {
600 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", 615 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
601 mpurate_ck_name, mpurate, r); 616 mpurate_ck_name, mpurate, r);
602 clk_put(mpurate_ck); 617 clk_put(mpurate_ck);
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 60ddd8612b4d..7aa32cd292f9 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -27,9 +27,8 @@ struct omap_clk {
27 struct clk_lookup lk; 27 struct clk_lookup lk;
28}; 28};
29 29
30#define CLK(dev, con, ck, cp) \ 30#define CLK(dev, con, ck) \
31 { \ 31 { \
32 .cpu = cp, \
33 .lk = { \ 32 .lk = { \
34 .dev_id = dev, \ 33 .dev_id = dev, \
35 .con_id = con, \ 34 .con_id = con, \
@@ -37,22 +36,6 @@ struct omap_clk {
37 }, \ 36 }, \
38 } 37 }
39 38
40/* Platform flags for the clkdev-OMAP integration code */
41#define CK_242X (1 << 0)
42#define CK_243X (1 << 1) /* 243x, 253x */
43#define CK_3430ES1 (1 << 2) /* 34xxES1 only */
44#define CK_3430ES2PLUS (1 << 3) /* 34xxES2, ES3, non-Sitara 35xx only */
45#define CK_AM35XX (1 << 4) /* Sitara AM35xx */
46#define CK_36XX (1 << 5) /* 36xx/37xx-specific clocks */
47#define CK_443X (1 << 6)
48#define CK_TI816X (1 << 7)
49#define CK_446X (1 << 8)
50#define CK_AM33XX (1 << 9) /* AM33xx specific clocks */
51
52
53#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
54#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
55
56struct clockdomain; 39struct clockdomain;
57#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw) 40#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
58 41
@@ -480,4 +463,5 @@ extern int am33xx_clk_init(void);
480extern int omap2_clkops_enable_clkdm(struct clk_hw *hw); 463extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
481extern void omap2_clkops_disable_clkdm(struct clk_hw *hw); 464extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
482 465
466extern void omap_clocks_register(struct omap_clk *oclks, int cnt);
483#endif 467#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index d6ba13e1c540..d555cf2459e1 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -82,8 +82,7 @@ extern void omap2_init_common_infrastructure(void);
82extern void omap2_sync32k_timer_init(void); 82extern void omap2_sync32k_timer_init(void);
83extern void omap3_sync32k_timer_init(void); 83extern void omap3_sync32k_timer_init(void);
84extern void omap3_secure_sync32k_timer_init(void); 84extern void omap3_secure_sync32k_timer_init(void);
85extern void omap3_gp_gptimer_timer_init(void); 85extern void omap3_gptimer_timer_init(void);
86extern void omap3_am33xx_gptimer_timer_init(void);
87extern void omap4_local_timer_init(void); 86extern void omap4_local_timer_init(void);
88extern void omap5_realtime_timer_init(void); 87extern void omap5_realtime_timer_init(void);
89 88
@@ -110,6 +109,14 @@ void am35xx_init_late(void);
110void ti81xx_init_late(void); 109void ti81xx_init_late(void);
111int omap2_common_pm_late_init(void); 110int omap2_common_pm_late_init(void);
112 111
112#ifdef CONFIG_SOC_BUS
113void omap_soc_device_init(void);
114#else
115static inline void omap_soc_device_init(void)
116{
117}
118#endif
119
113#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) 120#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
114void omap2xxx_restart(char mode, const char *cmd); 121void omap2xxx_restart(char mode, const char *cmd);
115#else 122#else
@@ -249,7 +256,6 @@ extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);
249extern int omap4_finish_suspend(unsigned long cpu_state); 256extern int omap4_finish_suspend(unsigned long cpu_state);
250extern void omap4_cpu_resume(void); 257extern void omap4_cpu_resume(void);
251extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state); 258extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state);
252extern u32 omap4_mpuss_read_prev_context_state(void);
253#else 259#else
254static inline int omap4_enter_lowpower(unsigned int cpu, 260static inline int omap4_enter_lowpower(unsigned int cpu,
255 unsigned int power_state) 261 unsigned int power_state)
@@ -277,10 +283,6 @@ static inline int omap4_finish_suspend(unsigned long cpu_state)
277static inline void omap4_cpu_resume(void) 283static inline void omap4_cpu_resume(void)
278{} 284{}
279 285
280static inline u32 omap4_mpuss_read_prev_context_state(void)
281{
282 return 0;
283}
284#endif 286#endif
285 287
286struct omap_sdrc_params; 288struct omap_sdrc_params;
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 80392fca86c6..e18709d3b95d 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -26,6 +26,7 @@
26#include <linux/cpuidle.h> 26#include <linux/cpuidle.h>
27#include <linux/export.h> 27#include <linux/export.h>
28#include <linux/cpu_pm.h> 28#include <linux/cpu_pm.h>
29#include <asm/cpuidle.h>
29 30
30#include "powerdomain.h" 31#include "powerdomain.h"
31#include "clockdomain.h" 32#include "clockdomain.h"
@@ -99,16 +100,18 @@ static struct omap3_idle_statedata omap3_idle_data[] = {
99 }, 100 },
100}; 101};
101 102
102/* Private functions */ 103/**
103 104 * omap3_enter_idle - Programs OMAP3 to enter the specified state
104static int __omap3_enter_idle(struct cpuidle_device *dev, 105 * @dev: cpuidle device
105 struct cpuidle_driver *drv, 106 * @drv: cpuidle driver
106 int index) 107 * @index: the index of state to be entered
108 */
109static int omap3_enter_idle(struct cpuidle_device *dev,
110 struct cpuidle_driver *drv,
111 int index)
107{ 112{
108 struct omap3_idle_statedata *cx = &omap3_idle_data[index]; 113 struct omap3_idle_statedata *cx = &omap3_idle_data[index];
109 114
110 local_fiq_disable();
111
112 if (omap_irq_pending() || need_resched()) 115 if (omap_irq_pending() || need_resched())
113 goto return_sleep_time; 116 goto return_sleep_time;
114 117
@@ -143,28 +146,11 @@ static int __omap3_enter_idle(struct cpuidle_device *dev,
143 clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]); 146 clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);
144 147
145return_sleep_time: 148return_sleep_time:
146 local_fiq_enable();
147 149
148 return index; 150 return index;
149} 151}
150 152
151/** 153/**
152 * omap3_enter_idle - Programs OMAP3 to enter the specified state
153 * @dev: cpuidle device
154 * @drv: cpuidle driver
155 * @index: the index of state to be entered
156 *
157 * Called from the CPUidle framework to program the device to the
158 * specified target state selected by the governor.
159 */
160static inline int omap3_enter_idle(struct cpuidle_device *dev,
161 struct cpuidle_driver *drv,
162 int index)
163{
164 return cpuidle_wrap_enter(dev, drv, index, __omap3_enter_idle);
165}
166
167/**
168 * next_valid_state - Find next valid C-state 154 * next_valid_state - Find next valid C-state
169 * @dev: cpuidle device 155 * @dev: cpuidle device
170 * @drv: cpuidle driver 156 * @drv: cpuidle driver
@@ -271,11 +257,9 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
271 return ret; 257 return ret;
272} 258}
273 259
274static DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
275
276static struct cpuidle_driver omap3_idle_driver = { 260static struct cpuidle_driver omap3_idle_driver = {
277 .name = "omap3_idle", 261 .name = "omap3_idle",
278 .owner = THIS_MODULE, 262 .owner = THIS_MODULE,
279 .states = { 263 .states = {
280 { 264 {
281 .enter = omap3_enter_idle_bm, 265 .enter = omap3_enter_idle_bm,
@@ -348,8 +332,6 @@ static struct cpuidle_driver omap3_idle_driver = {
348 */ 332 */
349int __init omap3_idle_init(void) 333int __init omap3_idle_init(void)
350{ 334{
351 struct cpuidle_device *dev;
352
353 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 335 mpu_pd = pwrdm_lookup("mpu_pwrdm");
354 core_pd = pwrdm_lookup("core_pwrdm"); 336 core_pd = pwrdm_lookup("core_pwrdm");
355 per_pd = pwrdm_lookup("per_pwrdm"); 337 per_pd = pwrdm_lookup("per_pwrdm");
@@ -358,16 +340,5 @@ int __init omap3_idle_init(void)
358 if (!mpu_pd || !core_pd || !per_pd || !cam_pd) 340 if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
359 return -ENODEV; 341 return -ENODEV;
360 342
361 cpuidle_register_driver(&omap3_idle_driver); 343 return cpuidle_register(&omap3_idle_driver, NULL);
362
363 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
364 dev->cpu = 0;
365
366 if (cpuidle_register_device(dev)) {
367 printk(KERN_ERR "%s: CPUidle register device failed\n",
368 __func__);
369 return -EIO;
370 }
371
372 return 0;
373} 344}
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index d639aef0deda..c443f2e97e10 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 CPU idle Routines 2 * OMAP4+ CPU idle Routines
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 4 * Copyright (C) 2011-2013 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shilimkar@ti.com> 5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 * Rajendra Nayak <rnayak@ti.com> 6 * Rajendra Nayak <rnayak@ti.com>
7 * 7 *
@@ -14,8 +14,8 @@
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>
18 17
18#include <asm/cpuidle.h>
19#include <asm/proc-fns.h> 19#include <asm/proc-fns.h>
20 20
21#include "common.h" 21#include "common.h"
@@ -24,13 +24,13 @@
24#include "clockdomain.h" 24#include "clockdomain.h"
25 25
26/* Machine specific information */ 26/* Machine specific information */
27struct omap4_idle_statedata { 27struct idle_statedata {
28 u32 cpu_state; 28 u32 cpu_state;
29 u32 mpu_logic_state; 29 u32 mpu_logic_state;
30 u32 mpu_state; 30 u32 mpu_state;
31}; 31};
32 32
33static struct omap4_idle_statedata omap4_idle_data[] = { 33static struct idle_statedata omap4_idle_data[] = {
34 { 34 {
35 .cpu_state = PWRDM_POWER_ON, 35 .cpu_state = PWRDM_POWER_ON,
36 .mpu_state = PWRDM_POWER_ON, 36 .mpu_state = PWRDM_POWER_ON,
@@ -53,11 +53,12 @@ static struct clockdomain *cpu_clkdm[NR_CPUS];
53 53
54static atomic_t abort_barrier; 54static atomic_t abort_barrier;
55static bool cpu_done[NR_CPUS]; 55static bool cpu_done[NR_CPUS];
56static struct idle_statedata *state_ptr = &omap4_idle_data[0];
56 57
57/* Private functions */ 58/* Private functions */
58 59
59/** 60/**
60 * omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions 61 * omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions
61 * @dev: cpuidle device 62 * @dev: cpuidle device
62 * @drv: cpuidle driver 63 * @drv: cpuidle driver
63 * @index: the index of state to be entered 64 * @index: the index of state to be entered
@@ -66,25 +67,19 @@ static bool cpu_done[NR_CPUS];
66 * specified low power state selected by the governor. 67 * specified low power state selected by the governor.
67 * Returns the amount of time spent in the low power state. 68 * Returns the amount of time spent in the low power state.
68 */ 69 */
69static int omap4_enter_idle_simple(struct cpuidle_device *dev, 70static int omap_enter_idle_simple(struct cpuidle_device *dev,
70 struct cpuidle_driver *drv, 71 struct cpuidle_driver *drv,
71 int index) 72 int index)
72{ 73{
73 local_fiq_disable();
74 omap_do_wfi(); 74 omap_do_wfi();
75 local_fiq_enable();
76
77 return index; 75 return index;
78} 76}
79 77
80static int omap4_enter_idle_coupled(struct cpuidle_device *dev, 78static int omap_enter_idle_coupled(struct cpuidle_device *dev,
81 struct cpuidle_driver *drv, 79 struct cpuidle_driver *drv,
82 int index) 80 int index)
83{ 81{
84 struct omap4_idle_statedata *cx = &omap4_idle_data[index]; 82 struct idle_statedata *cx = state_ptr + index;
85 int cpu_id = smp_processor_id();
86
87 local_fiq_disable();
88 83
89 /* 84 /*
90 * CPU0 has to wait and stay ON until CPU1 is OFF state. 85 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -109,8 +104,6 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
109 } 104 }
110 } 105 }
111 106
112 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);
113
114 /* 107 /*
115 * Call idle CPU PM enter notifier chain so that 108 * Call idle CPU PM enter notifier chain so that
116 * VFP and per CPU interrupt context is saved. 109 * VFP and per CPU interrupt context is saved.
@@ -136,6 +129,7 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
136 /* Wakeup CPU1 only if it is not offlined */ 129 /* Wakeup CPU1 only if it is not offlined */
137 if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) { 130 if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
138 clkdm_wakeup(cpu_clkdm[1]); 131 clkdm_wakeup(cpu_clkdm[1]);
132 omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
139 clkdm_allow_idle(cpu_clkdm[1]); 133 clkdm_allow_idle(cpu_clkdm[1]);
140 } 134 }
141 135
@@ -149,63 +143,49 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
149 * Call idle CPU cluster PM exit notifier chain 143 * Call idle CPU cluster PM exit notifier chain
150 * to restore GIC and wakeupgen context. 144 * to restore GIC and wakeupgen context.
151 */ 145 */
152 if (omap4_mpuss_read_prev_context_state()) 146 if ((cx->mpu_state == PWRDM_POWER_RET) &&
147 (cx->mpu_logic_state == PWRDM_POWER_OFF))
153 cpu_cluster_pm_exit(); 148 cpu_cluster_pm_exit();
154 149
155 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);
156
157fail: 150fail:
158 cpuidle_coupled_parallel_barrier(dev, &abort_barrier); 151 cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
159 cpu_done[dev->cpu] = false; 152 cpu_done[dev->cpu] = false;
160 153
161 local_fiq_enable();
162
163 return index; 154 return index;
164} 155}
165 156
166/*
167 * For each cpu, setup the broadcast timer because local timers
168 * stops for the states above C1.
169 */
170static void omap_setup_broadcast_timer(void *arg)
171{
172 int cpu = smp_processor_id();
173 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
174}
175
176static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev);
177
178static struct cpuidle_driver omap4_idle_driver = { 157static struct cpuidle_driver omap4_idle_driver = {
179 .name = "omap4_idle", 158 .name = "omap4_idle",
180 .owner = THIS_MODULE, 159 .owner = THIS_MODULE,
181 .en_core_tk_irqen = 1,
182 .states = { 160 .states = {
183 { 161 {
184 /* C1 - CPU0 ON + CPU1 ON + MPU ON */ 162 /* C1 - CPU0 ON + CPU1 ON + MPU ON */
185 .exit_latency = 2 + 2, 163 .exit_latency = 2 + 2,
186 .target_residency = 5, 164 .target_residency = 5,
187 .flags = CPUIDLE_FLAG_TIME_VALID, 165 .flags = CPUIDLE_FLAG_TIME_VALID,
188 .enter = omap4_enter_idle_simple, 166 .enter = omap_enter_idle_simple,
189 .name = "C1", 167 .name = "C1",
190 .desc = "MPUSS ON" 168 .desc = "CPUx ON, MPUSS ON"
191 }, 169 },
192 { 170 {
193 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ 171 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
194 .exit_latency = 328 + 440, 172 .exit_latency = 328 + 440,
195 .target_residency = 960, 173 .target_residency = 960,
196 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, 174 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
197 .enter = omap4_enter_idle_coupled, 175 CPUIDLE_FLAG_TIMER_STOP,
176 .enter = omap_enter_idle_coupled,
198 .name = "C2", 177 .name = "C2",
199 .desc = "MPUSS CSWR", 178 .desc = "CPUx OFF, MPUSS CSWR",
200 }, 179 },
201 { 180 {
202 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ 181 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
203 .exit_latency = 460 + 518, 182 .exit_latency = 460 + 518,
204 .target_residency = 1100, 183 .target_residency = 1100,
205 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, 184 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
206 .enter = omap4_enter_idle_coupled, 185 CPUIDLE_FLAG_TIMER_STOP,
186 .enter = omap_enter_idle_coupled,
207 .name = "C3", 187 .name = "C3",
208 .desc = "MPUSS OSWR", 188 .desc = "CPUx OFF, MPUSS OSWR",
209 }, 189 },
210 }, 190 },
211 .state_count = ARRAY_SIZE(omap4_idle_data), 191 .state_count = ARRAY_SIZE(omap4_idle_data),
@@ -215,16 +195,13 @@ static struct cpuidle_driver omap4_idle_driver = {
215/* Public functions */ 195/* Public functions */
216 196
217/** 197/**
218 * omap4_idle_init - Init routine for OMAP4 idle 198 * omap4_idle_init - Init routine for OMAP4+ idle
219 * 199 *
220 * Registers the OMAP4 specific cpuidle driver to the cpuidle 200 * Registers the OMAP4+ specific cpuidle driver to the cpuidle
221 * framework with the valid set of states. 201 * framework with the valid set of states.
222 */ 202 */
223int __init omap4_idle_init(void) 203int __init omap4_idle_init(void)
224{ 204{
225 struct cpuidle_device *dev;
226 unsigned int cpu_id = 0;
227
228 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 205 mpu_pd = pwrdm_lookup("mpu_pwrdm");
229 cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm"); 206 cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm");
230 cpu_pd[1] = pwrdm_lookup("cpu1_pwrdm"); 207 cpu_pd[1] = pwrdm_lookup("cpu1_pwrdm");
@@ -236,22 +213,5 @@ int __init omap4_idle_init(void)
236 if (!cpu_clkdm[0] || !cpu_clkdm[1]) 213 if (!cpu_clkdm[0] || !cpu_clkdm[1])
237 return -ENODEV; 214 return -ENODEV;
238 215
239 /* Configure the broadcast timer on each cpu */ 216 return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
240 on_each_cpu(omap_setup_broadcast_timer, NULL, 1);
241
242 for_each_cpu(cpu_id, cpu_online_mask) {
243 dev = &per_cpu(omap4_idle_dev, cpu_id);
244 dev->cpu = cpu_id;
245#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
246 dev->coupled_cpus = *cpu_online_mask;
247#endif
248 cpuidle_register_driver(&omap4_idle_driver);
249
250 if (cpuidle_register_device(dev)) {
251 pr_err("%s: CPUidle register failed\n", __func__);
252 return -EIO;
253 }
254 }
255
256 return 0;
257} 217}
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1ec7f0597710..4269fc145698 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -504,140 +504,31 @@ static void omap_init_rng(void)
504 WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n"); 504 WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
505} 505}
506 506
507#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) 507static void __init omap_init_sham(void)
508
509#ifdef CONFIG_ARCH_OMAP2
510static struct resource omap2_sham_resources[] = {
511 {
512 .start = OMAP24XX_SEC_SHA1MD5_BASE,
513 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
514 .flags = IORESOURCE_MEM,
515 },
516 {
517 .start = 51 + OMAP_INTC_START,
518 .flags = IORESOURCE_IRQ,
519 }
520};
521static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
522#else
523#define omap2_sham_resources NULL
524#define omap2_sham_resources_sz 0
525#endif
526
527#ifdef CONFIG_ARCH_OMAP3
528static struct resource omap3_sham_resources[] = {
529 {
530 .start = OMAP34XX_SEC_SHA1MD5_BASE,
531 .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
532 .flags = IORESOURCE_MEM,
533 },
534 {
535 .start = 49 + OMAP_INTC_START,
536 .flags = IORESOURCE_IRQ,
537 },
538 {
539 .start = OMAP34XX_DMA_SHA1MD5_RX,
540 .flags = IORESOURCE_DMA,
541 }
542};
543static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
544#else
545#define omap3_sham_resources NULL
546#define omap3_sham_resources_sz 0
547#endif
548
549static struct platform_device sham_device = {
550 .name = "omap-sham",
551 .id = -1,
552};
553
554static void omap_init_sham(void)
555{ 508{
556 if (cpu_is_omap24xx()) { 509 struct omap_hwmod *oh;
557 sham_device.resource = omap2_sham_resources; 510 struct platform_device *pdev;
558 sham_device.num_resources = omap2_sham_resources_sz;
559 } else if (cpu_is_omap34xx()) {
560 sham_device.resource = omap3_sham_resources;
561 sham_device.num_resources = omap3_sham_resources_sz;
562 } else {
563 pr_err("%s: platform not supported\n", __func__);
564 return;
565 }
566 platform_device_register(&sham_device);
567}
568#else
569static inline void omap_init_sham(void) { }
570#endif
571
572#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
573
574#ifdef CONFIG_ARCH_OMAP2
575static struct resource omap2_aes_resources[] = {
576 {
577 .start = OMAP24XX_SEC_AES_BASE,
578 .end = OMAP24XX_SEC_AES_BASE + 0x4C,
579 .flags = IORESOURCE_MEM,
580 },
581 {
582 .start = OMAP24XX_DMA_AES_TX,
583 .flags = IORESOURCE_DMA,
584 },
585 {
586 .start = OMAP24XX_DMA_AES_RX,
587 .flags = IORESOURCE_DMA,
588 }
589};
590static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
591#else
592#define omap2_aes_resources NULL
593#define omap2_aes_resources_sz 0
594#endif
595 511
596#ifdef CONFIG_ARCH_OMAP3 512 oh = omap_hwmod_lookup("sham");
597static struct resource omap3_aes_resources[] = { 513 if (!oh)
598 { 514 return;
599 .start = OMAP34XX_SEC_AES_BASE,
600 .end = OMAP34XX_SEC_AES_BASE + 0x4C,
601 .flags = IORESOURCE_MEM,
602 },
603 {
604 .start = OMAP34XX_DMA_AES2_TX,
605 .flags = IORESOURCE_DMA,
606 },
607 {
608 .start = OMAP34XX_DMA_AES2_RX,
609 .flags = IORESOURCE_DMA,
610 }
611};
612static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
613#else
614#define omap3_aes_resources NULL
615#define omap3_aes_resources_sz 0
616#endif
617 515
618static struct platform_device aes_device = { 516 pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
619 .name = "omap-aes", 517 WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
620 .id = -1, 518}
621};
622 519
623static void omap_init_aes(void) 520static void __init omap_init_aes(void)
624{ 521{
625 if (cpu_is_omap24xx()) { 522 struct omap_hwmod *oh;
626 aes_device.resource = omap2_aes_resources; 523 struct platform_device *pdev;
627 aes_device.num_resources = omap2_aes_resources_sz; 524
628 } else if (cpu_is_omap34xx()) { 525 oh = omap_hwmod_lookup("aes");
629 aes_device.resource = omap3_aes_resources; 526 if (!oh)
630 aes_device.num_resources = omap3_aes_resources_sz;
631 } else {
632 pr_err("%s: platform not supported\n", __func__);
633 return; 527 return;
634 }
635 platform_device_register(&aes_device);
636}
637 528
638#else 529 pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
639static inline void omap_init_aes(void) { } 530 WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
640#endif 531}
641 532
642/*-------------------------------------------------------------------------*/ 533/*-------------------------------------------------------------------------*/
643 534
@@ -764,11 +655,11 @@ static int __init omap2_init_devices(void)
764 omap_init_dmic(); 655 omap_init_dmic();
765 omap_init_mcpdm(); 656 omap_init_mcpdm();
766 omap_init_mcspi(); 657 omap_init_mcspi();
658 omap_init_sham();
659 omap_init_aes();
767 } 660 }
768 omap_init_sti(); 661 omap_init_sti();
769 omap_init_rng(); 662 omap_init_rng();
770 omap_init_sham();
771 omap_init_aes();
772 omap_init_vout(); 663 omap_init_vout();
773 omap_init_ocp2scp(); 664 omap_init_ocp2scp();
774 665
diff --git a/arch/arm/mach-omap2/dma.h b/arch/arm/mach-omap2/dma.h
index eba80dbc5218..65f80cacf178 100644
--- a/arch/arm/mach-omap2/dma.h
+++ b/arch/arm/mach-omap2/dma.h
@@ -22,69 +22,20 @@
22 22
23/* DMA channels for 24xx */ 23/* DMA channels for 24xx */
24#define OMAP24XX_DMA_NO_DEVICE 0 24#define OMAP24XX_DMA_NO_DEVICE 0
25#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
26#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */ 25#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
27#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */ 26#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
28#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */ 27#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
29#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
30#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
31#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
32#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
33#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
34#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */ 28#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
35#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */ 29#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
36#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
37#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
38#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
39#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
40#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */ 30#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
41#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */ 31#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
42#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */ 32#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
43#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
44#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
45#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
46#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
47#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
48#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
49#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
50#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
51#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
52#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
53#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
54#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
55#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
56#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
57#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
58#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
59#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
60#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
61#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
62#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
63#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
64#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
65#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
66#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */ 33#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
67#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */ 34#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
68#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */ 35#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
69#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */ 36#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
70#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */ 37#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
71#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */ 38#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
72#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
73#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
74#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
75#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
76#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
77#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
78#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
79#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
80#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
81#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
82#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
83#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
84#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
85#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
86#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
87#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
88#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */ 39#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
89#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */ 40#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
90#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */ 41#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
@@ -93,33 +44,12 @@
93#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */ 44#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
94#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */ 45#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
95#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */ 46#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
96#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
97#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
98#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
99#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
100#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
101#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
102#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */ 47#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
103#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */ 48#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
104#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
105#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */ 49#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
106#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
107#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
108#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */ 50#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
109#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */ 51#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
110#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
111#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
112#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */ 52#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
113#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
114#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
115#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
116#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
117#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
118#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
119#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
120#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
121#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
122#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
123 53
124#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */ 54#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
125#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */ 55#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 3aed4b0b9563..3a0296cfcace 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -307,10 +307,10 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
307 _omap3_noncore_dpll_bypass(clk); 307 _omap3_noncore_dpll_bypass(clk);
308 308
309 /* 309 /*
310 * Set jitter correction. No jitter correction for OMAP4 and 3630 310 * Set jitter correction. Jitter correction applicable for OMAP343X
311 * since freqsel field is no longer present 311 * only since freqsel field is no longer present on other devices.
312 */ 312 */
313 if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { 313 if (cpu_is_omap343x()) {
314 v = __raw_readl(dd->control_reg); 314 v = __raw_readl(dd->control_reg);
315 v &= ~dd->freqsel_mask; 315 v &= ~dd->freqsel_mask;
316 v |= freqsel << __ffs(dd->freqsel_mask); 316 v |= freqsel << __ffs(dd->freqsel_mask);
@@ -480,29 +480,30 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
480 if (!dd) 480 if (!dd)
481 return -EINVAL; 481 return -EINVAL;
482 482
483 __clk_prepare(dd->clk_bypass);
484 clk_enable(dd->clk_bypass);
485 __clk_prepare(dd->clk_ref);
486 clk_enable(dd->clk_ref);
487
488 if (__clk_get_rate(dd->clk_bypass) == rate && 483 if (__clk_get_rate(dd->clk_bypass) == rate &&
489 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 484 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
490 pr_debug("%s: %s: set rate: entering bypass.\n", 485 pr_debug("%s: %s: set rate: entering bypass.\n",
491 __func__, __clk_get_name(hw->clk)); 486 __func__, __clk_get_name(hw->clk));
492 487
488 __clk_prepare(dd->clk_bypass);
489 clk_enable(dd->clk_bypass);
493 ret = _omap3_noncore_dpll_bypass(clk); 490 ret = _omap3_noncore_dpll_bypass(clk);
494 if (!ret) 491 if (!ret)
495 new_parent = dd->clk_bypass; 492 new_parent = dd->clk_bypass;
493 clk_disable(dd->clk_bypass);
494 __clk_unprepare(dd->clk_bypass);
496 } else { 495 } else {
496 __clk_prepare(dd->clk_ref);
497 clk_enable(dd->clk_ref);
498
497 if (dd->last_rounded_rate != rate) 499 if (dd->last_rounded_rate != rate)
498 rate = __clk_round_rate(hw->clk, rate); 500 rate = __clk_round_rate(hw->clk, rate);
499 501
500 if (dd->last_rounded_rate == 0) 502 if (dd->last_rounded_rate == 0)
501 return -EINVAL; 503 return -EINVAL;
502 504
503 /* No freqsel on AM335x, OMAP4 and OMAP3630 */ 505 /* Freqsel is available only on OMAP343X devices */
504 if (!soc_is_am33xx() && !cpu_is_omap44xx() && 506 if (cpu_is_omap343x()) {
505 !cpu_is_omap3630()) {
506 freqsel = _omap3_dpll_compute_freqsel(clk, 507 freqsel = _omap3_dpll_compute_freqsel(clk,
507 dd->last_rounded_n); 508 dd->last_rounded_n);
508 WARN_ON(!freqsel); 509 WARN_ON(!freqsel);
@@ -514,6 +515,8 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
514 ret = omap3_noncore_dpll_program(clk, freqsel); 515 ret = omap3_noncore_dpll_program(clk, freqsel);
515 if (!ret) 516 if (!ret)
516 new_parent = dd->clk_ref; 517 new_parent = dd->clk_ref;
518 clk_disable(dd->clk_ref);
519 __clk_unprepare(dd->clk_ref);
517 } 520 }
518 /* 521 /*
519 * FIXME - this is all wrong. common code handles reparenting and 522 * FIXME - this is all wrong. common code handles reparenting and
@@ -525,11 +528,6 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
525 if (!ret) 528 if (!ret)
526 __clk_reparent(hw->clk, new_parent); 529 __clk_reparent(hw->clk, new_parent);
527 530
528 clk_disable(dd->clk_ref);
529 __clk_unprepare(dd->clk_ref);
530 clk_disable(dd->clk_bypass);
531 __clk_unprepare(dd->clk_bypass);
532
533 return 0; 531 return 0;
534} 532}
535 533
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index b155500e84a8..b8208b4b1bd9 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -26,7 +26,7 @@
26#include "control.h" 26#include "control.h"
27#include "cm2xxx_3xxx.h" 27#include "cm2xxx_3xxx.h"
28#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
29#ifdef CONFIG_BRIDGE_DVFS 29#ifdef CONFIG_TIDSPBRIDGE_DVFS
30#include "omap-pm.h" 30#include "omap-pm.h"
31#endif 31#endif
32 32
@@ -35,7 +35,7 @@
35static struct platform_device *omap_dsp_pdev; 35static struct platform_device *omap_dsp_pdev;
36 36
37static struct omap_dsp_platform_data omap_dsp_pdata __initdata = { 37static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
38#ifdef CONFIG_BRIDGE_DVFS 38#ifdef CONFIG_TIDSPBRIDGE_DVFS
39 .dsp_set_min_opp = omap_pm_dsp_set_min_opp, 39 .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
40 .dsp_get_opp = omap_pm_dsp_get_opp, 40 .dsp_get_opp = omap_pm_dsp_get_opp,
41 .cpu_set_freq = omap_pm_cpu_set_freq, 41 .cpu_set_freq = omap_pm_cpu_set_freq,
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 4be5cfc81ab8..9c49bbe825f7 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -27,9 +27,7 @@
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28 28
29#include <video/omapdss.h> 29#include <video/omapdss.h>
30#include <video/omap-panel-tfp410.h> 30#include <video/omap-panel-data.h>
31#include <video/omap-panel-nokia-dsi.h>
32#include <video/omap-panel-picodlp.h>
33 31
34#include "soc.h" 32#include "soc.h"
35#include "dss-common.h" 33#include "dss-common.h"
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index afc1e8c32d6c..d9c27195caf0 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -74,14 +74,6 @@ static int omap2_nand_gpmc_retime(
74 t.cs_wr_off = gpmc_t->cs_wr_off; 74 t.cs_wr_off = gpmc_t->cs_wr_off;
75 t.wr_cycle = gpmc_t->wr_cycle; 75 t.wr_cycle = gpmc_t->wr_cycle;
76 76
77 /* Configure GPMC */
78 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
79 gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 1);
80 else
81 gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 0);
82 gpmc_cs_configure(gpmc_nand_data->cs,
83 GPMC_CONFIG_DEV_TYPE, GPMC_DEVICETYPE_NAND);
84 gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_WP, 0);
85 err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); 77 err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t);
86 if (err) 78 if (err)
87 return err; 79 return err;
@@ -115,14 +107,18 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
115 struct gpmc_timings *gpmc_t) 107 struct gpmc_timings *gpmc_t)
116{ 108{
117 int err = 0; 109 int err = 0;
110 struct gpmc_settings s;
118 struct device *dev = &gpmc_nand_device.dev; 111 struct device *dev = &gpmc_nand_device.dev;
119 112
113 memset(&s, 0, sizeof(struct gpmc_settings));
114
120 gpmc_nand_device.dev.platform_data = gpmc_nand_data; 115 gpmc_nand_device.dev.platform_data = gpmc_nand_data;
121 116
122 err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, 117 err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE,
123 (unsigned long *)&gpmc_nand_resource[0].start); 118 (unsigned long *)&gpmc_nand_resource[0].start);
124 if (err < 0) { 119 if (err < 0) {
125 dev_err(dev, "Cannot request GPMC CS\n"); 120 dev_err(dev, "Cannot request GPMC CS %d, error %d\n",
121 gpmc_nand_data->cs, err);
126 return err; 122 return err;
127 } 123 }
128 124
@@ -140,11 +136,31 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
140 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 136 dev_err(dev, "Unable to set gpmc timings: %d\n", err);
141 return err; 137 return err;
142 } 138 }
143 }
144 139
145 /* Enable RD PIN Monitoring Reg */ 140 if (gpmc_nand_data->of_node) {
146 if (gpmc_nand_data->dev_ready) { 141 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
147 gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_RDY_BSY, 1); 142 } else {
143 s.device_nand = true;
144
145 /* Enable RD PIN Monitoring Reg */
146 if (gpmc_nand_data->dev_ready) {
147 s.wait_on_read = true;
148 s.wait_on_write = true;
149 }
150 }
151
152 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
153 s.device_width = GPMC_DEVWIDTH_16BIT;
154 else
155 s.device_width = GPMC_DEVWIDTH_8BIT;
156
157 err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s);
158 if (err < 0)
159 goto out_free_cs;
160
161 err = gpmc_configure(GPMC_CONFIG_WP, 0);
162 if (err < 0)
163 goto out_free_cs;
148 } 164 }
149 165
150 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 166 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index fadd87435cd0..64b5a8346982 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -47,11 +47,23 @@ static struct platform_device gpmc_onenand_device = {
47 .resource = &gpmc_onenand_resource, 47 .resource = &gpmc_onenand_resource,
48}; 48};
49 49
50static struct gpmc_timings omap2_onenand_calc_async_timings(void) 50static struct gpmc_settings onenand_async = {
51 .device_width = GPMC_DEVWIDTH_16BIT,
52 .mux_add_data = GPMC_MUX_AD,
53};
54
55static struct gpmc_settings onenand_sync = {
56 .burst_read = true,
57 .burst_wrap = true,
58 .burst_len = GPMC_BURST_16,
59 .device_width = GPMC_DEVWIDTH_16BIT,
60 .mux_add_data = GPMC_MUX_AD,
61 .wait_pin = 0,
62};
63
64static void omap2_onenand_calc_async_timings(struct gpmc_timings *t)
51{ 65{
52 struct gpmc_device_timings dev_t; 66 struct gpmc_device_timings dev_t;
53 struct gpmc_timings t;
54
55 const int t_cer = 15; 67 const int t_cer = 15;
56 const int t_avdp = 12; 68 const int t_avdp = 12;
57 const int t_aavdh = 7; 69 const int t_aavdh = 7;
@@ -64,7 +76,6 @@ static struct gpmc_timings omap2_onenand_calc_async_timings(void)
64 76
65 memset(&dev_t, 0, sizeof(dev_t)); 77 memset(&dev_t, 0, sizeof(dev_t));
66 78
67 dev_t.mux = true;
68 dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; 79 dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000;
69 dev_t.t_avdp_w = dev_t.t_avdp_r; 80 dev_t.t_avdp_w = dev_t.t_avdp_r;
70 dev_t.t_aavdh = t_aavdh * 1000; 81 dev_t.t_aavdh = t_aavdh * 1000;
@@ -76,19 +87,7 @@ static struct gpmc_timings omap2_onenand_calc_async_timings(void)
76 dev_t.t_wpl = t_wpl * 1000; 87 dev_t.t_wpl = t_wpl * 1000;
77 dev_t.t_wph = t_wph * 1000; 88 dev_t.t_wph = t_wph * 1000;
78 89
79 gpmc_calc_timings(&t, &dev_t); 90 gpmc_calc_timings(t, &onenand_async, &dev_t);
80
81 return t;
82}
83
84static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
85{
86 /* Configure GPMC for asynchronous read */
87 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
88 GPMC_CONFIG1_DEVICESIZE_16 |
89 GPMC_CONFIG1_MUXADDDATA);
90
91 return gpmc_cs_set_timings(cs, t);
92} 91}
93 92
94static void omap2_onenand_set_async_mode(void __iomem *onenand_base) 93static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
@@ -158,12 +157,11 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
158 return freq; 157 return freq;
159} 158}
160 159
161static struct gpmc_timings 160static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t,
162omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, 161 unsigned int flags,
163 int freq) 162 int freq)
164{ 163{
165 struct gpmc_device_timings dev_t; 164 struct gpmc_device_timings dev_t;
166 struct gpmc_timings t;
167 const int t_cer = 15; 165 const int t_cer = 15;
168 const int t_avdp = 12; 166 const int t_avdp = 12;
169 const int t_cez = 20; /* max of t_cez, t_oez */ 167 const int t_cez = 20; /* max of t_cez, t_oez */
@@ -172,9 +170,9 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
172 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; 170 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
173 int div, gpmc_clk_ns; 171 int div, gpmc_clk_ns;
174 172
175 if (cfg->flags & ONENAND_SYNC_READ) 173 if (flags & ONENAND_SYNC_READ)
176 onenand_flags = ONENAND_FLAG_SYNCREAD; 174 onenand_flags = ONENAND_FLAG_SYNCREAD;
177 else if (cfg->flags & ONENAND_SYNC_READWRITE) 175 else if (flags & ONENAND_SYNC_READWRITE)
178 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; 176 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
179 177
180 switch (freq) { 178 switch (freq) {
@@ -239,10 +237,11 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
239 /* Set synchronous read timings */ 237 /* Set synchronous read timings */
240 memset(&dev_t, 0, sizeof(dev_t)); 238 memset(&dev_t, 0, sizeof(dev_t));
241 239
242 dev_t.mux = true; 240 if (onenand_flags & ONENAND_FLAG_SYNCREAD)
243 dev_t.sync_read = true; 241 onenand_sync.sync_read = true;
244 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { 242 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
245 dev_t.sync_write = true; 243 onenand_sync.sync_write = true;
244 onenand_sync.burst_write = true;
246 } else { 245 } else {
247 dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; 246 dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000;
248 dev_t.t_wpl = t_wpl * 1000; 247 dev_t.t_wpl = t_wpl * 1000;
@@ -265,32 +264,7 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
265 dev_t.cyc_aavdh_oe = 1; 264 dev_t.cyc_aavdh_oe = 1;
266 dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; 265 dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period;
267 266
268 gpmc_calc_timings(&t, &dev_t); 267 gpmc_calc_timings(t, &onenand_sync, &dev_t);
269
270 return t;
271}
272
273static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t)
274{
275 unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD;
276 unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE;
277
278 /* Configure GPMC for synchronous read */
279 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
280 GPMC_CONFIG1_WRAPBURST_SUPP |
281 GPMC_CONFIG1_READMULTIPLE_SUPP |
282 (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) |
283 (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) |
284 (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) |
285 GPMC_CONFIG1_PAGE_LEN(2) |
286 (cpu_is_omap34xx() ? 0 :
287 (GPMC_CONFIG1_WAIT_READ_MON |
288 GPMC_CONFIG1_WAIT_PIN_SEL(0))) |
289 GPMC_CONFIG1_DEVICESIZE_16 |
290 GPMC_CONFIG1_DEVICETYPE_NOR |
291 GPMC_CONFIG1_MUXADDDATA);
292
293 return gpmc_cs_set_timings(cs, t);
294} 268}
295 269
296static int omap2_onenand_setup_async(void __iomem *onenand_base) 270static int omap2_onenand_setup_async(void __iomem *onenand_base)
@@ -298,12 +272,20 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base)
298 struct gpmc_timings t; 272 struct gpmc_timings t;
299 int ret; 273 int ret;
300 274
275 if (gpmc_onenand_data->of_node)
276 gpmc_read_settings_dt(gpmc_onenand_data->of_node,
277 &onenand_async);
278
301 omap2_onenand_set_async_mode(onenand_base); 279 omap2_onenand_set_async_mode(onenand_base);
302 280
303 t = omap2_onenand_calc_async_timings(); 281 omap2_onenand_calc_async_timings(&t);
282
283 ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async);
284 if (ret < 0)
285 return ret;
304 286
305 ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); 287 ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t);
306 if (IS_ERR_VALUE(ret)) 288 if (ret < 0)
307 return ret; 289 return ret;
308 290
309 omap2_onenand_set_async_mode(onenand_base); 291 omap2_onenand_set_async_mode(onenand_base);
@@ -322,10 +304,26 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
322 set_onenand_cfg(onenand_base); 304 set_onenand_cfg(onenand_base);
323 } 305 }
324 306
325 t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); 307 if (gpmc_onenand_data->of_node) {
308 gpmc_read_settings_dt(gpmc_onenand_data->of_node,
309 &onenand_sync);
310 } else {
311 /*
312 * FIXME: Appears to be legacy code from initial ONENAND commit.
313 * Unclear what boards this is for and if this can be removed.
314 */
315 if (!cpu_is_omap34xx())
316 onenand_sync.wait_on_read = true;
317 }
318
319 omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq);
326 320
327 ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); 321 ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync);
328 if (IS_ERR_VALUE(ret)) 322 if (ret < 0)
323 return ret;
324
325 ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t);
326 if (ret < 0)
329 return ret; 327 return ret;
330 328
331 set_onenand_cfg(onenand_base); 329 set_onenand_cfg(onenand_base);
@@ -359,6 +357,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
359void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) 357void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
360{ 358{
361 int err; 359 int err;
360 struct device *dev = &gpmc_onenand_device.dev;
362 361
363 gpmc_onenand_data = _onenand_data; 362 gpmc_onenand_data = _onenand_data;
364 gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; 363 gpmc_onenand_data->onenand_setup = gpmc_onenand_setup;
@@ -366,7 +365,7 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
366 365
367 if (cpu_is_omap24xx() && 366 if (cpu_is_omap24xx() &&
368 (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { 367 (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) {
369 printk(KERN_ERR "Onenand using only SYNC_READ on 24xx\n"); 368 dev_warn(dev, "OneNAND using only SYNC_READ on 24xx\n");
370 gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; 369 gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE;
371 gpmc_onenand_data->flags |= ONENAND_SYNC_READ; 370 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
372 } 371 }
@@ -379,7 +378,8 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
379 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, 378 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
380 (unsigned long *)&gpmc_onenand_resource.start); 379 (unsigned long *)&gpmc_onenand_resource.start);
381 if (err < 0) { 380 if (err < 0) {
382 pr_err("%s: Cannot request GPMC CS\n", __func__); 381 dev_err(dev, "Cannot request GPMC CS %d, error %d\n",
382 gpmc_onenand_data->cs, err);
383 return; 383 return;
384 } 384 }
385 385
@@ -387,7 +387,7 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
387 ONENAND_IO_SIZE - 1; 387 ONENAND_IO_SIZE - 1;
388 388
389 if (platform_device_register(&gpmc_onenand_device) < 0) { 389 if (platform_device_register(&gpmc_onenand_device) < 0) {
390 pr_err("%s: Unable to register OneNAND device\n", __func__); 390 dev_err(dev, "Unable to register OneNAND device\n");
391 gpmc_cs_free(gpmc_onenand_data->cs); 391 gpmc_cs_free(gpmc_onenand_data->cs);
392 return; 392 return;
393 } 393 }
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index 11d0b756f098..61a063595e66 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -49,6 +49,10 @@ static struct platform_device gpmc_smc91x_device = {
49 .resource = gpmc_smc91x_resources, 49 .resource = gpmc_smc91x_resources,
50}; 50};
51 51
52static struct gpmc_settings smc91x_settings = {
53 .device_width = GPMC_DEVWIDTH_16BIT,
54};
55
52/* 56/*
53 * Set the gpmc timings for smc91c96. The timings are taken 57 * Set the gpmc timings for smc91c96. The timings are taken
54 * from the data sheet available at: 58 * from the data sheet available at:
@@ -67,18 +71,6 @@ static int smc91c96_gpmc_retime(void)
67 const int t7 = 5; /* Figure 12.4 write */ 71 const int t7 = 5; /* Figure 12.4 write */
68 const int t8 = 5; /* Figure 12.4 write */ 72 const int t8 = 5; /* Figure 12.4 write */
69 const int t20 = 185; /* Figure 12.2 read and 12.4 write */ 73 const int t20 = 185; /* Figure 12.2 read and 12.4 write */
70 u32 l;
71
72 l = GPMC_CONFIG1_DEVICESIZE_16;
73 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)
74 l |= GPMC_CONFIG1_MUXADDDATA;
75 if (gpmc_cfg->flags & GPMC_READ_MON)
76 l |= GPMC_CONFIG1_WAIT_READ_MON;
77 if (gpmc_cfg->flags & GPMC_WRITE_MON)
78 l |= GPMC_CONFIG1_WAIT_WRITE_MON;
79 if (gpmc_cfg->wait_pin)
80 l |= GPMC_CONFIG1_WAIT_PIN_SEL(gpmc_cfg->wait_pin);
81 gpmc_cs_write_reg(gpmc_cfg->cs, GPMC_CS_CONFIG1, l);
82 74
83 /* 75 /*
84 * FIXME: Calculate the address and data bus muxed timings. 76 * FIXME: Calculate the address and data bus muxed timings.
@@ -104,7 +96,7 @@ static int smc91c96_gpmc_retime(void)
104 dev_t.t_cez_w = t4_w * 1000; 96 dev_t.t_cez_w = t4_w * 1000;
105 dev_t.t_wr_cycle = (t20 - t3) * 1000; 97 dev_t.t_wr_cycle = (t20 - t3) * 1000;
106 98
107 gpmc_calc_timings(&t, &dev_t); 99 gpmc_calc_timings(&t, &smc91x_settings, &dev_t);
108 100
109 return gpmc_cs_set_timings(gpmc_cfg->cs, &t); 101 return gpmc_cs_set_timings(gpmc_cfg->cs, &t);
110} 102}
@@ -133,6 +125,18 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data)
133 gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; 125 gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f;
134 gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); 126 gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK);
135 127
128 if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA)
129 smc91x_settings.mux_add_data = GPMC_MUX_AD;
130 if (gpmc_cfg->flags & GPMC_READ_MON)
131 smc91x_settings.wait_on_read = true;
132 if (gpmc_cfg->flags & GPMC_WRITE_MON)
133 smc91x_settings.wait_on_write = true;
134 if (gpmc_cfg->wait_pin)
135 smc91x_settings.wait_pin = gpmc_cfg->wait_pin;
136 ret = gpmc_cs_program_settings(gpmc_cfg->cs, &smc91x_settings);
137 if (ret < 0)
138 goto free1;
139
136 if (gpmc_cfg->retime) { 140 if (gpmc_cfg->retime) {
137 ret = gpmc_cfg->retime(); 141 ret = gpmc_cfg->retime();
138 if (ret != 0) 142 if (ret != 0)
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 410e1bac7815..ed946df5ad8a 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_address.h>
29#include <linux/of_mtd.h> 30#include <linux/of_mtd.h>
30#include <linux/of_device.h> 31#include <linux/of_device.h>
31#include <linux/mtd/nand.h> 32#include <linux/mtd/nand.h>
@@ -91,9 +92,7 @@
91#define GPMC_CS_SIZE 0x30 92#define GPMC_CS_SIZE 0x30
92#define GPMC_BCH_SIZE 0x10 93#define GPMC_BCH_SIZE 0x10
93 94
94#define GPMC_MEM_START 0x00000000
95#define GPMC_MEM_END 0x3FFFFFFF 95#define GPMC_MEM_END 0x3FFFFFFF
96#define BOOT_ROM_SPACE 0x100000 /* 1MB */
97 96
98#define GPMC_CHUNK_SHIFT 24 /* 16 MB */ 97#define GPMC_CHUNK_SHIFT 24 /* 16 MB */
99#define GPMC_SECTION_SHIFT 28 /* 128 MB */ 98#define GPMC_SECTION_SHIFT 28 /* 128 MB */
@@ -107,6 +106,9 @@
107 106
108#define GPMC_HAS_WR_ACCESS 0x1 107#define GPMC_HAS_WR_ACCESS 0x1
109#define GPMC_HAS_WR_DATA_MUX_BUS 0x2 108#define GPMC_HAS_WR_DATA_MUX_BUS 0x2
109#define GPMC_HAS_MUX_AAD 0x4
110
111#define GPMC_NR_WAITPINS 4
110 112
111/* XXX: Only NAND irq has been considered,currently these are the only ones used 113/* XXX: Only NAND irq has been considered,currently these are the only ones used
112 */ 114 */
@@ -153,6 +155,7 @@ static struct resource gpmc_cs_mem[GPMC_CS_NUM];
153static DEFINE_SPINLOCK(gpmc_mem_lock); 155static DEFINE_SPINLOCK(gpmc_mem_lock);
154/* Define chip-selects as reserved by default until probe completes */ 156/* Define chip-selects as reserved by default until probe completes */
155static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); 157static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1);
158static unsigned int gpmc_nr_waitpins;
156static struct device *gpmc_dev; 159static struct device *gpmc_dev;
157static int gpmc_irq; 160static int gpmc_irq;
158static resource_size_t phys_base, mem_size; 161static resource_size_t phys_base, mem_size;
@@ -181,7 +184,7 @@ void gpmc_cs_write_reg(int cs, int idx, u32 val)
181 __raw_writel(val, reg_addr); 184 __raw_writel(val, reg_addr);
182} 185}
183 186
184u32 gpmc_cs_read_reg(int cs, int idx) 187static u32 gpmc_cs_read_reg(int cs, int idx)
185{ 188{
186 void __iomem *reg_addr; 189 void __iomem *reg_addr;
187 190
@@ -190,7 +193,7 @@ u32 gpmc_cs_read_reg(int cs, int idx)
190} 193}
191 194
192/* TODO: Add support for gpmc_fck to clock framework and use it */ 195/* TODO: Add support for gpmc_fck to clock framework and use it */
193unsigned long gpmc_get_fclk_period(void) 196static unsigned long gpmc_get_fclk_period(void)
194{ 197{
195 unsigned long rate = clk_get_rate(gpmc_l3_clk); 198 unsigned long rate = clk_get_rate(gpmc_l3_clk);
196 199
@@ -205,7 +208,7 @@ unsigned long gpmc_get_fclk_period(void)
205 return rate; 208 return rate;
206} 209}
207 210
208unsigned int gpmc_ns_to_ticks(unsigned int time_ns) 211static unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
209{ 212{
210 unsigned long tick_ps; 213 unsigned long tick_ps;
211 214
@@ -215,7 +218,7 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
215 return (time_ns * 1000 + tick_ps - 1) / tick_ps; 218 return (time_ns * 1000 + tick_ps - 1) / tick_ps;
216} 219}
217 220
218unsigned int gpmc_ps_to_ticks(unsigned int time_ps) 221static unsigned int gpmc_ps_to_ticks(unsigned int time_ps)
219{ 222{
220 unsigned long tick_ps; 223 unsigned long tick_ps;
221 224
@@ -230,13 +233,6 @@ unsigned int gpmc_ticks_to_ns(unsigned int ticks)
230 return ticks * gpmc_get_fclk_period() / 1000; 233 return ticks * gpmc_get_fclk_period() / 1000;
231} 234}
232 235
233unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns)
234{
235 unsigned long ticks = gpmc_ns_to_ticks(time_ns);
236
237 return ticks * gpmc_get_fclk_period() / 1000;
238}
239
240static unsigned int gpmc_ticks_to_ps(unsigned int ticks) 236static unsigned int gpmc_ticks_to_ps(unsigned int ticks)
241{ 237{
242 return ticks * gpmc_get_fclk_period(); 238 return ticks * gpmc_get_fclk_period();
@@ -405,11 +401,18 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
405 return 0; 401 return 0;
406} 402}
407 403
408static void gpmc_cs_enable_mem(int cs, u32 base, u32 size) 404static int gpmc_cs_enable_mem(int cs, u32 base, u32 size)
409{ 405{
410 u32 l; 406 u32 l;
411 u32 mask; 407 u32 mask;
412 408
409 /*
410 * Ensure that base address is aligned on a
411 * boundary equal to or greater than size.
412 */
413 if (base & (size - 1))
414 return -EINVAL;
415
413 mask = (1 << GPMC_SECTION_SHIFT) - size; 416 mask = (1 << GPMC_SECTION_SHIFT) - size;
414 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 417 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
415 l &= ~0x3f; 418 l &= ~0x3f;
@@ -418,6 +421,8 @@ static void gpmc_cs_enable_mem(int cs, u32 base, u32 size)
418 l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; 421 l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8;
419 l |= GPMC_CONFIG7_CSVALID; 422 l |= GPMC_CONFIG7_CSVALID;
420 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); 423 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
424
425 return 0;
421} 426}
422 427
423static void gpmc_cs_disable_mem(int cs) 428static void gpmc_cs_disable_mem(int cs)
@@ -448,22 +453,14 @@ static int gpmc_cs_mem_enabled(int cs)
448 return l & GPMC_CONFIG7_CSVALID; 453 return l & GPMC_CONFIG7_CSVALID;
449} 454}
450 455
451int gpmc_cs_set_reserved(int cs, int reserved) 456static void gpmc_cs_set_reserved(int cs, int reserved)
452{ 457{
453 if (cs > GPMC_CS_NUM)
454 return -ENODEV;
455
456 gpmc_cs_map &= ~(1 << cs); 458 gpmc_cs_map &= ~(1 << cs);
457 gpmc_cs_map |= (reserved ? 1 : 0) << cs; 459 gpmc_cs_map |= (reserved ? 1 : 0) << cs;
458
459 return 0;
460} 460}
461 461
462int gpmc_cs_reserved(int cs) 462static bool gpmc_cs_reserved(int cs)
463{ 463{
464 if (cs > GPMC_CS_NUM)
465 return -ENODEV;
466
467 return gpmc_cs_map & (1 << cs); 464 return gpmc_cs_map & (1 << cs);
468} 465}
469 466
@@ -510,6 +507,39 @@ static int gpmc_cs_delete_mem(int cs)
510 return r; 507 return r;
511} 508}
512 509
510/**
511 * gpmc_cs_remap - remaps a chip-select physical base address
512 * @cs: chip-select to remap
513 * @base: physical base address to re-map chip-select to
514 *
515 * Re-maps a chip-select to a new physical base address specified by
516 * "base". Returns 0 on success and appropriate negative error code
517 * on failure.
518 */
519static int gpmc_cs_remap(int cs, u32 base)
520{
521 int ret;
522 u32 old_base, size;
523
524 if (cs > GPMC_CS_NUM)
525 return -ENODEV;
526 gpmc_cs_get_memconf(cs, &old_base, &size);
527 if (base == old_base)
528 return 0;
529 gpmc_cs_disable_mem(cs);
530 ret = gpmc_cs_delete_mem(cs);
531 if (ret < 0)
532 return ret;
533 ret = gpmc_cs_insert_mem(cs, base, size);
534 if (ret < 0)
535 return ret;
536 ret = gpmc_cs_enable_mem(cs, base, size);
537 if (ret < 0)
538 return ret;
539
540 return 0;
541}
542
513int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) 543int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
514{ 544{
515 struct resource *res = &gpmc_cs_mem[cs]; 545 struct resource *res = &gpmc_cs_mem[cs];
@@ -535,7 +565,12 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
535 if (r < 0) 565 if (r < 0)
536 goto out; 566 goto out;
537 567
538 gpmc_cs_enable_mem(cs, res->start, resource_size(res)); 568 r = gpmc_cs_enable_mem(cs, res->start, resource_size(res));
569 if (r < 0) {
570 release_resource(res);
571 goto out;
572 }
573
539 *base = res->start; 574 *base = res->start;
540 gpmc_cs_set_reserved(cs, 1); 575 gpmc_cs_set_reserved(cs, 1);
541out: 576out:
@@ -561,16 +596,14 @@ void gpmc_cs_free(int cs)
561EXPORT_SYMBOL(gpmc_cs_free); 596EXPORT_SYMBOL(gpmc_cs_free);
562 597
563/** 598/**
564 * gpmc_cs_configure - write request to configure gpmc 599 * gpmc_configure - write request to configure gpmc
565 * @cs: chip select number
566 * @cmd: command type 600 * @cmd: command type
567 * @wval: value to write 601 * @wval: value to write
568 * @return status of the operation 602 * @return status of the operation
569 */ 603 */
570int gpmc_cs_configure(int cs, int cmd, int wval) 604int gpmc_configure(int cmd, int wval)
571{ 605{
572 int err = 0; 606 u32 regval;
573 u32 regval = 0;
574 607
575 switch (cmd) { 608 switch (cmd) {
576 case GPMC_ENABLE_IRQ: 609 case GPMC_ENABLE_IRQ:
@@ -590,43 +623,14 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
590 gpmc_write_reg(GPMC_CONFIG, regval); 623 gpmc_write_reg(GPMC_CONFIG, regval);
591 break; 624 break;
592 625
593 case GPMC_CONFIG_RDY_BSY:
594 regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
595 if (wval)
596 regval |= WR_RD_PIN_MONITORING;
597 else
598 regval &= ~WR_RD_PIN_MONITORING;
599 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
600 break;
601
602 case GPMC_CONFIG_DEV_SIZE:
603 regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
604
605 /* clear 2 target bits */
606 regval &= ~GPMC_CONFIG1_DEVICESIZE(3);
607
608 /* set the proper value */
609 regval |= GPMC_CONFIG1_DEVICESIZE(wval);
610
611 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
612 break;
613
614 case GPMC_CONFIG_DEV_TYPE:
615 regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
616 regval |= GPMC_CONFIG1_DEVICETYPE(wval);
617 if (wval == GPMC_DEVICETYPE_NOR)
618 regval |= GPMC_CONFIG1_MUXADDDATA;
619 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval);
620 break;
621
622 default: 626 default:
623 printk(KERN_ERR "gpmc_configure_cs: Not supported\n"); 627 pr_err("%s: command not supported\n", __func__);
624 err = -EINVAL; 628 return -EINVAL;
625 } 629 }
626 630
627 return err; 631 return 0;
628} 632}
629EXPORT_SYMBOL(gpmc_cs_configure); 633EXPORT_SYMBOL(gpmc_configure);
630 634
631void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) 635void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
632{ 636{
@@ -716,7 +720,7 @@ static int gpmc_setup_irq(void)
716 return -EINVAL; 720 return -EINVAL;
717 721
718 gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0); 722 gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0);
719 if (IS_ERR_VALUE(gpmc_irq_start)) { 723 if (gpmc_irq_start < 0) {
720 pr_err("irq_alloc_descs failed\n"); 724 pr_err("irq_alloc_descs failed\n");
721 return gpmc_irq_start; 725 return gpmc_irq_start;
722 } 726 }
@@ -781,16 +785,16 @@ static void gpmc_mem_exit(void)
781 785
782} 786}
783 787
784static int gpmc_mem_init(void) 788static void gpmc_mem_init(void)
785{ 789{
786 int cs, rc; 790 int cs;
787 unsigned long boot_rom_space = 0;
788 791
789 /* never allocate the first page, to facilitate bug detection; 792 /*
790 * even if we didn't boot from ROM. 793 * The first 1MB of GPMC address space is typically mapped to
794 * the internal ROM. Never allocate the first page, to
795 * facilitate bug detection; even if we didn't boot from ROM.
791 */ 796 */
792 boot_rom_space = BOOT_ROM_SPACE; 797 gpmc_mem_root.start = SZ_1M;
793 gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space;
794 gpmc_mem_root.end = GPMC_MEM_END; 798 gpmc_mem_root.end = GPMC_MEM_END;
795 799
796 /* Reserve all regions that has been set up by bootloader */ 800 /* Reserve all regions that has been set up by bootloader */
@@ -800,16 +804,12 @@ static int gpmc_mem_init(void)
800 if (!gpmc_cs_mem_enabled(cs)) 804 if (!gpmc_cs_mem_enabled(cs))
801 continue; 805 continue;
802 gpmc_cs_get_memconf(cs, &base, &size); 806 gpmc_cs_get_memconf(cs, &base, &size);
803 rc = gpmc_cs_insert_mem(cs, base, size); 807 if (gpmc_cs_insert_mem(cs, base, size)) {
804 if (IS_ERR_VALUE(rc)) { 808 pr_warn("%s: disabling cs %d mapped at 0x%x-0x%x\n",
805 while (--cs >= 0) 809 __func__, cs, base, base + size);
806 if (gpmc_cs_mem_enabled(cs)) 810 gpmc_cs_disable_mem(cs);
807 gpmc_cs_delete_mem(cs);
808 return rc;
809 } 811 }
810 } 812 }
811
812 return 0;
813} 813}
814 814
815static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) 815static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk)
@@ -825,9 +825,9 @@ static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk)
825 825
826/* XXX: can the cycles be avoided ? */ 826/* XXX: can the cycles be avoided ? */
827static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, 827static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t,
828 struct gpmc_device_timings *dev_t) 828 struct gpmc_device_timings *dev_t,
829 bool mux)
829{ 830{
830 bool mux = dev_t->mux;
831 u32 temp; 831 u32 temp;
832 832
833 /* adv_rd_off */ 833 /* adv_rd_off */
@@ -880,9 +880,9 @@ static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t,
880} 880}
881 881
882static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, 882static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t,
883 struct gpmc_device_timings *dev_t) 883 struct gpmc_device_timings *dev_t,
884 bool mux)
884{ 885{
885 bool mux = dev_t->mux;
886 u32 temp; 886 u32 temp;
887 887
888 /* adv_wr_off */ 888 /* adv_wr_off */
@@ -942,9 +942,9 @@ static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t,
942} 942}
943 943
944static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, 944static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t,
945 struct gpmc_device_timings *dev_t) 945 struct gpmc_device_timings *dev_t,
946 bool mux)
946{ 947{
947 bool mux = dev_t->mux;
948 u32 temp; 948 u32 temp;
949 949
950 /* adv_rd_off */ 950 /* adv_rd_off */
@@ -982,9 +982,9 @@ static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t,
982} 982}
983 983
984static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t, 984static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t,
985 struct gpmc_device_timings *dev_t) 985 struct gpmc_device_timings *dev_t,
986 bool mux)
986{ 987{
987 bool mux = dev_t->mux;
988 u32 temp; 988 u32 temp;
989 989
990 /* adv_wr_off */ 990 /* adv_wr_off */
@@ -1054,7 +1054,8 @@ static int gpmc_calc_sync_common_timings(struct gpmc_timings *gpmc_t,
1054} 1054}
1055 1055
1056static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, 1056static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t,
1057 struct gpmc_device_timings *dev_t) 1057 struct gpmc_device_timings *dev_t,
1058 bool sync)
1058{ 1059{
1059 u32 temp; 1060 u32 temp;
1060 1061
@@ -1068,7 +1069,7 @@ static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t,
1068 gpmc_t->cs_on + dev_t->t_ce_avd); 1069 gpmc_t->cs_on + dev_t->t_ce_avd);
1069 gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp); 1070 gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp);
1070 1071
1071 if (dev_t->sync_write || dev_t->sync_read) 1072 if (sync)
1072 gpmc_calc_sync_common_timings(gpmc_t, dev_t); 1073 gpmc_calc_sync_common_timings(gpmc_t, dev_t);
1073 1074
1074 return 0; 1075 return 0;
@@ -1103,21 +1104,29 @@ static void gpmc_convert_ps_to_ns(struct gpmc_timings *t)
1103} 1104}
1104 1105
1105int gpmc_calc_timings(struct gpmc_timings *gpmc_t, 1106int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
1106 struct gpmc_device_timings *dev_t) 1107 struct gpmc_settings *gpmc_s,
1108 struct gpmc_device_timings *dev_t)
1107{ 1109{
1110 bool mux = false, sync = false;
1111
1112 if (gpmc_s) {
1113 mux = gpmc_s->mux_add_data ? true : false;
1114 sync = (gpmc_s->sync_read || gpmc_s->sync_write);
1115 }
1116
1108 memset(gpmc_t, 0, sizeof(*gpmc_t)); 1117 memset(gpmc_t, 0, sizeof(*gpmc_t));
1109 1118
1110 gpmc_calc_common_timings(gpmc_t, dev_t); 1119 gpmc_calc_common_timings(gpmc_t, dev_t, sync);
1111 1120
1112 if (dev_t->sync_read) 1121 if (gpmc_s && gpmc_s->sync_read)
1113 gpmc_calc_sync_read_timings(gpmc_t, dev_t); 1122 gpmc_calc_sync_read_timings(gpmc_t, dev_t, mux);
1114 else 1123 else
1115 gpmc_calc_async_read_timings(gpmc_t, dev_t); 1124 gpmc_calc_async_read_timings(gpmc_t, dev_t, mux);
1116 1125
1117 if (dev_t->sync_write) 1126 if (gpmc_s && gpmc_s->sync_write)
1118 gpmc_calc_sync_write_timings(gpmc_t, dev_t); 1127 gpmc_calc_sync_write_timings(gpmc_t, dev_t, mux);
1119 else 1128 else
1120 gpmc_calc_async_write_timings(gpmc_t, dev_t); 1129 gpmc_calc_async_write_timings(gpmc_t, dev_t, mux);
1121 1130
1122 /* TODO: remove, see function definition */ 1131 /* TODO: remove, see function definition */
1123 gpmc_convert_ps_to_ns(gpmc_t); 1132 gpmc_convert_ps_to_ns(gpmc_t);
@@ -1125,6 +1134,90 @@ int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
1125 return 0; 1134 return 0;
1126} 1135}
1127 1136
1137/**
1138 * gpmc_cs_program_settings - programs non-timing related settings
1139 * @cs: GPMC chip-select to program
1140 * @p: pointer to GPMC settings structure
1141 *
1142 * Programs non-timing related settings for a GPMC chip-select, such as
1143 * bus-width, burst configuration, etc. Function should be called once
1144 * for each chip-select that is being used and must be called before
1145 * calling gpmc_cs_set_timings() as timing parameters in the CONFIG1
1146 * register will be initialised to zero by this function. Returns 0 on
1147 * success and appropriate negative error code on failure.
1148 */
1149int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
1150{
1151 u32 config1;
1152
1153 if ((!p->device_width) || (p->device_width > GPMC_DEVWIDTH_16BIT)) {
1154 pr_err("%s: invalid width %d!", __func__, p->device_width);
1155 return -EINVAL;
1156 }
1157
1158 /* Address-data multiplexing not supported for NAND devices */
1159 if (p->device_nand && p->mux_add_data) {
1160 pr_err("%s: invalid configuration!\n", __func__);
1161 return -EINVAL;
1162 }
1163
1164 if ((p->mux_add_data > GPMC_MUX_AD) ||
1165 ((p->mux_add_data == GPMC_MUX_AAD) &&
1166 !(gpmc_capability & GPMC_HAS_MUX_AAD))) {
1167 pr_err("%s: invalid multiplex configuration!\n", __func__);
1168 return -EINVAL;
1169 }
1170
1171 /* Page/burst mode supports lengths of 4, 8 and 16 bytes */
1172 if (p->burst_read || p->burst_write) {
1173 switch (p->burst_len) {
1174 case GPMC_BURST_4:
1175 case GPMC_BURST_8:
1176 case GPMC_BURST_16:
1177 break;
1178 default:
1179 pr_err("%s: invalid page/burst-length (%d)\n",
1180 __func__, p->burst_len);
1181 return -EINVAL;
1182 }
1183 }
1184
1185 if ((p->wait_on_read || p->wait_on_write) &&
1186 (p->wait_pin > gpmc_nr_waitpins)) {
1187 pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin);
1188 return -EINVAL;
1189 }
1190
1191 config1 = GPMC_CONFIG1_DEVICESIZE((p->device_width - 1));
1192
1193 if (p->sync_read)
1194 config1 |= GPMC_CONFIG1_READTYPE_SYNC;
1195 if (p->sync_write)
1196 config1 |= GPMC_CONFIG1_WRITETYPE_SYNC;
1197 if (p->wait_on_read)
1198 config1 |= GPMC_CONFIG1_WAIT_READ_MON;
1199 if (p->wait_on_write)
1200 config1 |= GPMC_CONFIG1_WAIT_WRITE_MON;
1201 if (p->wait_on_read || p->wait_on_write)
1202 config1 |= GPMC_CONFIG1_WAIT_PIN_SEL(p->wait_pin);
1203 if (p->device_nand)
1204 config1 |= GPMC_CONFIG1_DEVICETYPE(GPMC_DEVICETYPE_NAND);
1205 if (p->mux_add_data)
1206 config1 |= GPMC_CONFIG1_MUXTYPE(p->mux_add_data);
1207 if (p->burst_read)
1208 config1 |= GPMC_CONFIG1_READMULTIPLE_SUPP;
1209 if (p->burst_write)
1210 config1 |= GPMC_CONFIG1_WRITEMULTIPLE_SUPP;
1211 if (p->burst_read || p->burst_write) {
1212 config1 |= GPMC_CONFIG1_PAGE_LEN(p->burst_len >> 3);
1213 config1 |= p->burst_wrap ? GPMC_CONFIG1_WRAPBURST_SUPP : 0;
1214 }
1215
1216 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, config1);
1217
1218 return 0;
1219}
1220
1128#ifdef CONFIG_OF 1221#ifdef CONFIG_OF
1129static struct of_device_id gpmc_dt_ids[] = { 1222static struct of_device_id gpmc_dt_ids[] = {
1130 { .compatible = "ti,omap2420-gpmc" }, 1223 { .compatible = "ti,omap2420-gpmc" },
@@ -1136,70 +1229,110 @@ static struct of_device_id gpmc_dt_ids[] = {
1136}; 1229};
1137MODULE_DEVICE_TABLE(of, gpmc_dt_ids); 1230MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
1138 1231
1232/**
1233 * gpmc_read_settings_dt - read gpmc settings from device-tree
1234 * @np: pointer to device-tree node for a gpmc child device
1235 * @p: pointer to gpmc settings structure
1236 *
1237 * Reads the GPMC settings for a GPMC child device from device-tree and
1238 * stores them in the GPMC settings structure passed. The GPMC settings
1239 * structure is initialised to zero by this function and so any
1240 * previously stored settings will be cleared.
1241 */
1242void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p)
1243{
1244 memset(p, 0, sizeof(struct gpmc_settings));
1245
1246 p->sync_read = of_property_read_bool(np, "gpmc,sync-read");
1247 p->sync_write = of_property_read_bool(np, "gpmc,sync-write");
1248 p->device_nand = of_property_read_bool(np, "gpmc,device-nand");
1249 of_property_read_u32(np, "gpmc,device-width", &p->device_width);
1250 of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data);
1251
1252 if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) {
1253 p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap");
1254 p->burst_read = of_property_read_bool(np, "gpmc,burst-read");
1255 p->burst_write = of_property_read_bool(np, "gpmc,burst-write");
1256 if (!p->burst_read && !p->burst_write)
1257 pr_warn("%s: page/burst-length set but not used!\n",
1258 __func__);
1259 }
1260
1261 if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) {
1262 p->wait_on_read = of_property_read_bool(np,
1263 "gpmc,wait-on-read");
1264 p->wait_on_write = of_property_read_bool(np,
1265 "gpmc,wait-on-write");
1266 if (!p->wait_on_read && !p->wait_on_write)
1267 pr_warn("%s: read/write wait monitoring not enabled!\n",
1268 __func__);
1269 }
1270}
1271
1139static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, 1272static void __maybe_unused gpmc_read_timings_dt(struct device_node *np,
1140 struct gpmc_timings *gpmc_t) 1273 struct gpmc_timings *gpmc_t)
1141{ 1274{
1142 u32 val; 1275 struct gpmc_bool_timings *p;
1276
1277 if (!np || !gpmc_t)
1278 return;
1143 1279
1144 memset(gpmc_t, 0, sizeof(*gpmc_t)); 1280 memset(gpmc_t, 0, sizeof(*gpmc_t));
1145 1281
1146 /* minimum clock period for syncronous mode */ 1282 /* minimum clock period for syncronous mode */
1147 if (!of_property_read_u32(np, "gpmc,sync-clk", &val)) 1283 of_property_read_u32(np, "gpmc,sync-clk-ps", &gpmc_t->sync_clk);
1148 gpmc_t->sync_clk = val;
1149 1284
1150 /* chip select timtings */ 1285 /* chip select timtings */
1151 if (!of_property_read_u32(np, "gpmc,cs-on", &val)) 1286 of_property_read_u32(np, "gpmc,cs-on-ns", &gpmc_t->cs_on);
1152 gpmc_t->cs_on = val; 1287 of_property_read_u32(np, "gpmc,cs-rd-off-ns", &gpmc_t->cs_rd_off);
1153 1288 of_property_read_u32(np, "gpmc,cs-wr-off-ns", &gpmc_t->cs_wr_off);
1154 if (!of_property_read_u32(np, "gpmc,cs-rd-off", &val))
1155 gpmc_t->cs_rd_off = val;
1156
1157 if (!of_property_read_u32(np, "gpmc,cs-wr-off", &val))
1158 gpmc_t->cs_wr_off = val;
1159 1289
1160 /* ADV signal timings */ 1290 /* ADV signal timings */
1161 if (!of_property_read_u32(np, "gpmc,adv-on", &val)) 1291 of_property_read_u32(np, "gpmc,adv-on-ns", &gpmc_t->adv_on);
1162 gpmc_t->adv_on = val; 1292 of_property_read_u32(np, "gpmc,adv-rd-off-ns", &gpmc_t->adv_rd_off);
1163 1293 of_property_read_u32(np, "gpmc,adv-wr-off-ns", &gpmc_t->adv_wr_off);
1164 if (!of_property_read_u32(np, "gpmc,adv-rd-off", &val))
1165 gpmc_t->adv_rd_off = val;
1166
1167 if (!of_property_read_u32(np, "gpmc,adv-wr-off", &val))
1168 gpmc_t->adv_wr_off = val;
1169 1294
1170 /* WE signal timings */ 1295 /* WE signal timings */
1171 if (!of_property_read_u32(np, "gpmc,we-on", &val)) 1296 of_property_read_u32(np, "gpmc,we-on-ns", &gpmc_t->we_on);
1172 gpmc_t->we_on = val; 1297 of_property_read_u32(np, "gpmc,we-off-ns", &gpmc_t->we_off);
1173
1174 if (!of_property_read_u32(np, "gpmc,we-off", &val))
1175 gpmc_t->we_off = val;
1176 1298
1177 /* OE signal timings */ 1299 /* OE signal timings */
1178 if (!of_property_read_u32(np, "gpmc,oe-on", &val)) 1300 of_property_read_u32(np, "gpmc,oe-on-ns", &gpmc_t->oe_on);
1179 gpmc_t->oe_on = val; 1301 of_property_read_u32(np, "gpmc,oe-off-ns", &gpmc_t->oe_off);
1180
1181 if (!of_property_read_u32(np, "gpmc,oe-off", &val))
1182 gpmc_t->oe_off = val;
1183 1302
1184 /* access and cycle timings */ 1303 /* access and cycle timings */
1185 if (!of_property_read_u32(np, "gpmc,page-burst-access", &val)) 1304 of_property_read_u32(np, "gpmc,page-burst-access-ns",
1186 gpmc_t->page_burst_access = val; 1305 &gpmc_t->page_burst_access);
1187 1306 of_property_read_u32(np, "gpmc,access-ns", &gpmc_t->access);
1188 if (!of_property_read_u32(np, "gpmc,access", &val)) 1307 of_property_read_u32(np, "gpmc,rd-cycle-ns", &gpmc_t->rd_cycle);
1189 gpmc_t->access = val; 1308 of_property_read_u32(np, "gpmc,wr-cycle-ns", &gpmc_t->wr_cycle);
1190 1309 of_property_read_u32(np, "gpmc,bus-turnaround-ns",
1191 if (!of_property_read_u32(np, "gpmc,rd-cycle", &val)) 1310 &gpmc_t->bus_turnaround);
1192 gpmc_t->rd_cycle = val; 1311 of_property_read_u32(np, "gpmc,cycle2cycle-delay-ns",
1193 1312 &gpmc_t->cycle2cycle_delay);
1194 if (!of_property_read_u32(np, "gpmc,wr-cycle", &val)) 1313 of_property_read_u32(np, "gpmc,wait-monitoring-ns",
1195 gpmc_t->wr_cycle = val; 1314 &gpmc_t->wait_monitoring);
1196 1315 of_property_read_u32(np, "gpmc,clk-activation-ns",
1197 /* only for OMAP3430 */ 1316 &gpmc_t->clk_activation);
1198 if (!of_property_read_u32(np, "gpmc,wr-access", &val)) 1317
1199 gpmc_t->wr_access = val; 1318 /* only applicable to OMAP3+ */
1200 1319 of_property_read_u32(np, "gpmc,wr-access-ns", &gpmc_t->wr_access);
1201 if (!of_property_read_u32(np, "gpmc,wr-data-mux-bus", &val)) 1320 of_property_read_u32(np, "gpmc,wr-data-mux-bus-ns",
1202 gpmc_t->wr_data_mux_bus = val; 1321 &gpmc_t->wr_data_mux_bus);
1322
1323 /* bool timing parameters */
1324 p = &gpmc_t->bool_timings;
1325
1326 p->cycle2cyclediffcsen =
1327 of_property_read_bool(np, "gpmc,cycle2cycle-diffcsen");
1328 p->cycle2cyclesamecsen =
1329 of_property_read_bool(np, "gpmc,cycle2cycle-samecsen");
1330 p->we_extra_delay = of_property_read_bool(np, "gpmc,we-extra-delay");
1331 p->oe_extra_delay = of_property_read_bool(np, "gpmc,oe-extra-delay");
1332 p->adv_extra_delay = of_property_read_bool(np, "gpmc,adv-extra-delay");
1333 p->cs_extra_delay = of_property_read_bool(np, "gpmc,cs-extra-delay");
1334 p->time_para_granularity =
1335 of_property_read_bool(np, "gpmc,time-para-granularity");
1203} 1336}
1204 1337
1205#ifdef CONFIG_MTD_NAND 1338#ifdef CONFIG_MTD_NAND
@@ -1295,6 +1428,81 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev,
1295} 1428}
1296#endif 1429#endif
1297 1430
1431/**
1432 * gpmc_probe_generic_child - configures the gpmc for a child device
1433 * @pdev: pointer to gpmc platform device
1434 * @child: pointer to device-tree node for child device
1435 *
1436 * Allocates and configures a GPMC chip-select for a child device.
1437 * Returns 0 on success and appropriate negative error code on failure.
1438 */
1439static int gpmc_probe_generic_child(struct platform_device *pdev,
1440 struct device_node *child)
1441{
1442 struct gpmc_settings gpmc_s;
1443 struct gpmc_timings gpmc_t;
1444 struct resource res;
1445 unsigned long base;
1446 int ret, cs;
1447
1448 if (of_property_read_u32(child, "reg", &cs) < 0) {
1449 dev_err(&pdev->dev, "%s has no 'reg' property\n",
1450 child->full_name);
1451 return -ENODEV;
1452 }
1453
1454 if (of_address_to_resource(child, 0, &res) < 0) {
1455 dev_err(&pdev->dev, "%s has malformed 'reg' property\n",
1456 child->full_name);
1457 return -ENODEV;
1458 }
1459
1460 ret = gpmc_cs_request(cs, resource_size(&res), &base);
1461 if (ret < 0) {
1462 dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs);
1463 return ret;
1464 }
1465
1466 /*
1467 * FIXME: gpmc_cs_request() will map the CS to an arbitary
1468 * location in the gpmc address space. When booting with
1469 * device-tree we want the NOR flash to be mapped to the
1470 * location specified in the device-tree blob. So remap the
1471 * CS to this location. Once DT migration is complete should
1472 * just make gpmc_cs_request() map a specific address.
1473 */
1474 ret = gpmc_cs_remap(cs, res.start);
1475 if (ret < 0) {
1476 dev_err(&pdev->dev, "cannot remap GPMC CS %d to 0x%x\n",
1477 cs, res.start);
1478 goto err;
1479 }
1480
1481 gpmc_read_settings_dt(child, &gpmc_s);
1482
1483 ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width);
1484 if (ret < 0)
1485 goto err;
1486
1487 ret = gpmc_cs_program_settings(cs, &gpmc_s);
1488 if (ret < 0)
1489 goto err;
1490
1491 gpmc_read_timings_dt(child, &gpmc_t);
1492 gpmc_cs_set_timings(cs, &gpmc_t);
1493
1494 if (of_platform_device_create(child, NULL, &pdev->dev))
1495 return 0;
1496
1497 dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
1498 ret = -ENODEV;
1499
1500err:
1501 gpmc_cs_free(cs);
1502
1503 return ret;
1504}
1505
1298static int gpmc_probe_dt(struct platform_device *pdev) 1506static int gpmc_probe_dt(struct platform_device *pdev)
1299{ 1507{
1300 int ret; 1508 int ret;
@@ -1305,6 +1513,13 @@ static int gpmc_probe_dt(struct platform_device *pdev)
1305 if (!of_id) 1513 if (!of_id)
1306 return 0; 1514 return 0;
1307 1515
1516 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins",
1517 &gpmc_nr_waitpins);
1518 if (ret < 0) {
1519 pr_err("%s: number of wait pins not found!\n", __func__);
1520 return ret;
1521 }
1522
1308 for_each_node_by_name(child, "nand") { 1523 for_each_node_by_name(child, "nand") {
1309 ret = gpmc_probe_nand_child(pdev, child); 1524 ret = gpmc_probe_nand_child(pdev, child);
1310 if (ret < 0) { 1525 if (ret < 0) {
@@ -1320,6 +1535,23 @@ static int gpmc_probe_dt(struct platform_device *pdev)
1320 return ret; 1535 return ret;
1321 } 1536 }
1322 } 1537 }
1538
1539 for_each_node_by_name(child, "nor") {
1540 ret = gpmc_probe_generic_child(pdev, child);
1541 if (ret < 0) {
1542 of_node_put(child);
1543 return ret;
1544 }
1545 }
1546
1547 for_each_node_by_name(child, "ethernet") {
1548 ret = gpmc_probe_generic_child(pdev, child);
1549 if (ret < 0) {
1550 of_node_put(child);
1551 return ret;
1552 }
1553 }
1554
1323 return 0; 1555 return 0;
1324} 1556}
1325#else 1557#else
@@ -1364,25 +1596,37 @@ static int gpmc_probe(struct platform_device *pdev)
1364 gpmc_dev = &pdev->dev; 1596 gpmc_dev = &pdev->dev;
1365 1597
1366 l = gpmc_read_reg(GPMC_REVISION); 1598 l = gpmc_read_reg(GPMC_REVISION);
1599
1600 /*
1601 * FIXME: Once device-tree migration is complete the below flags
1602 * should be populated based upon the device-tree compatible
1603 * string. For now just use the IP revision. OMAP3+ devices have
1604 * the wr_access and wr_data_mux_bus register fields. OMAP4+
1605 * devices support the addr-addr-data multiplex protocol.
1606 *
1607 * GPMC IP revisions:
1608 * - OMAP24xx = 2.0
1609 * - OMAP3xxx = 5.0
1610 * - OMAP44xx/54xx/AM335x = 6.0
1611 */
1367 if (GPMC_REVISION_MAJOR(l) > 0x4) 1612 if (GPMC_REVISION_MAJOR(l) > 0x4)
1368 gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; 1613 gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS;
1614 if (GPMC_REVISION_MAJOR(l) > 0x5)
1615 gpmc_capability |= GPMC_HAS_MUX_AAD;
1369 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), 1616 dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
1370 GPMC_REVISION_MINOR(l)); 1617 GPMC_REVISION_MINOR(l));
1371 1618
1372 rc = gpmc_mem_init(); 1619 gpmc_mem_init();
1373 if (IS_ERR_VALUE(rc)) {
1374 clk_disable_unprepare(gpmc_l3_clk);
1375 clk_put(gpmc_l3_clk);
1376 dev_err(gpmc_dev, "failed to reserve memory\n");
1377 return rc;
1378 }
1379 1620
1380 if (IS_ERR_VALUE(gpmc_setup_irq())) 1621 if (gpmc_setup_irq() < 0)
1381 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); 1622 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n");
1382 1623
1383 /* Now the GPMC is initialised, unreserve the chip-selects */ 1624 /* Now the GPMC is initialised, unreserve the chip-selects */
1384 gpmc_cs_map = 0; 1625 gpmc_cs_map = 0;
1385 1626
1627 if (!pdev->dev.of_node)
1628 gpmc_nr_waitpins = GPMC_NR_WAITPINS;
1629
1386 rc = gpmc_probe_dt(pdev); 1630 rc = gpmc_probe_dt(pdev);
1387 if (rc < 0) { 1631 if (rc < 0) {
1388 clk_disable_unprepare(gpmc_l3_clk); 1632 clk_disable_unprepare(gpmc_l3_clk);
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index fe0a844d5007..707f6d58edd5 100644
--- a/arch/arm/mach-omap2/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -58,7 +58,7 @@
58#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) 58#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
59#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) 59#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
60#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) 60#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
61#define GPMC_CONFIG1_MUXADDDATA (1 << 9) 61#define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8)
62#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) 62#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
63#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) 63#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
64#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) 64#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
@@ -73,6 +73,13 @@
73#define GPMC_IRQ_FIFOEVENTENABLE 0x01 73#define GPMC_IRQ_FIFOEVENTENABLE 0x01
74#define GPMC_IRQ_COUNT_EVENT 0x02 74#define GPMC_IRQ_COUNT_EVENT 0x02
75 75
76#define GPMC_BURST_4 4 /* 4 word burst */
77#define GPMC_BURST_8 8 /* 8 word burst */
78#define GPMC_BURST_16 16 /* 16 word burst */
79#define GPMC_DEVWIDTH_8BIT 1 /* 8-bit device width */
80#define GPMC_DEVWIDTH_16BIT 2 /* 16-bit device width */
81#define GPMC_MUX_AAD 1 /* Addr-Addr-Data multiplex */
82#define GPMC_MUX_AD 2 /* Addr-Data multiplex */
76 83
77/* bool type time settings */ 84/* bool type time settings */
78struct gpmc_bool_timings { 85struct gpmc_bool_timings {
@@ -178,10 +185,6 @@ struct gpmc_device_timings {
178 u8 cyc_wpl; /* write deassertion time in cycles */ 185 u8 cyc_wpl; /* write deassertion time in cycles */
179 u32 cyc_iaa; /* initial access time in cycles */ 186 u32 cyc_iaa; /* initial access time in cycles */
180 187
181 bool mux; /* address & data muxed */
182 bool sync_write;/* synchronous write */
183 bool sync_read; /* synchronous read */
184
185 /* extra delays */ 188 /* extra delays */
186 bool ce_xdelay; 189 bool ce_xdelay;
187 bool avd_xdelay; 190 bool avd_xdelay;
@@ -189,28 +192,40 @@ struct gpmc_device_timings {
189 bool we_xdelay; 192 bool we_xdelay;
190}; 193};
191 194
195struct gpmc_settings {
196 bool burst_wrap; /* enables wrap bursting */
197 bool burst_read; /* enables read page/burst mode */
198 bool burst_write; /* enables write page/burst mode */
199 bool device_nand; /* device is NAND */
200 bool sync_read; /* enables synchronous reads */
201 bool sync_write; /* enables synchronous writes */
202 bool wait_on_read; /* monitor wait on reads */
203 bool wait_on_write; /* monitor wait on writes */
204 u32 burst_len; /* page/burst length */
205 u32 device_width; /* device bus width (8 or 16 bit) */
206 u32 mux_add_data; /* multiplex address & data */
207 u32 wait_pin; /* wait-pin to be used */
208};
209
192extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t, 210extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
193 struct gpmc_device_timings *dev_t); 211 struct gpmc_settings *gpmc_s,
212 struct gpmc_device_timings *dev_t);
194 213
195extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); 214extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
196extern int gpmc_get_client_irq(unsigned irq_config); 215extern int gpmc_get_client_irq(unsigned irq_config);
197 216
198extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
199extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps);
200extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); 217extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
201extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns);
202extern unsigned long gpmc_get_fclk_period(void);
203 218
204extern void gpmc_cs_write_reg(int cs, int idx, u32 val); 219extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
205extern u32 gpmc_cs_read_reg(int cs, int idx);
206extern int gpmc_calc_divider(unsigned int sync_clk); 220extern int gpmc_calc_divider(unsigned int sync_clk);
207extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 221extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
222extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p);
208extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); 223extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
209extern void gpmc_cs_free(int cs); 224extern void gpmc_cs_free(int cs);
210extern int gpmc_cs_set_reserved(int cs, int reserved);
211extern int gpmc_cs_reserved(int cs);
212extern void omap3_gpmc_save_context(void); 225extern void omap3_gpmc_save_context(void);
213extern void omap3_gpmc_restore_context(void); 226extern void omap3_gpmc_restore_context(void);
214extern int gpmc_cs_configure(int cs, int cmd, int wval); 227extern int gpmc_configure(int cmd, int wval);
228extern void gpmc_read_settings_dt(struct device_node *np,
229 struct gpmc_settings *p);
215 230
216#endif 231#endif
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 8a68f1ec66b9..0f4c18e6e60c 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -18,6 +18,11 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/slab.h>
22
23#ifdef CONFIG_SOC_BUS
24#include <linux/sys_soc.h>
25#endif
21 26
22#include <asm/cputype.h> 27#include <asm/cputype.h>
23 28
@@ -31,8 +36,11 @@
31#define OMAP4_SILICON_TYPE_STANDARD 0x01 36#define OMAP4_SILICON_TYPE_STANDARD 0x01
32#define OMAP4_SILICON_TYPE_PERFORMANCE 0x02 37#define OMAP4_SILICON_TYPE_PERFORMANCE 0x02
33 38
39#define OMAP_SOC_MAX_NAME_LENGTH 16
40
34static unsigned int omap_revision; 41static unsigned int omap_revision;
35static const char *cpu_rev; 42static char soc_name[OMAP_SOC_MAX_NAME_LENGTH];
43static char soc_rev[OMAP_SOC_MAX_NAME_LENGTH];
36u32 omap_features; 44u32 omap_features;
37 45
38unsigned int omap_rev(void) 46unsigned int omap_rev(void)
@@ -169,9 +177,12 @@ void __init omap2xxx_check_revision(void)
169 j = i; 177 j = i;
170 } 178 }
171 179
172 pr_info("OMAP%04x", omap_rev() >> 16); 180 sprintf(soc_name, "OMAP%04x", omap_rev() >> 16);
181 sprintf(soc_rev, "ES%x", (omap_rev() >> 12) & 0xf);
182
183 pr_info("%s", soc_name);
173 if ((omap_rev() >> 8) & 0x0f) 184 if ((omap_rev() >> 8) & 0x0f)
174 pr_info("ES%x", (omap_rev() >> 12) & 0xf); 185 pr_info("%s", soc_rev);
175 pr_info("\n"); 186 pr_info("\n");
176} 187}
177 188
@@ -211,8 +222,10 @@ static void __init omap3_cpuinfo(void)
211 cpu_name = "OMAP3503"; 222 cpu_name = "OMAP3503";
212 } 223 }
213 224
225 sprintf(soc_name, "%s", cpu_name);
226
214 /* Print verbose information */ 227 /* Print verbose information */
215 pr_info("%s ES%s (", cpu_name, cpu_rev); 228 pr_info("%s %s (", soc_name, soc_rev);
216 229
217 OMAP3_SHOW_FEATURE(l2cache); 230 OMAP3_SHOW_FEATURE(l2cache);
218 OMAP3_SHOW_FEATURE(iva); 231 OMAP3_SHOW_FEATURE(iva);
@@ -291,6 +304,7 @@ void __init ti81xx_check_features(void)
291 304
292void __init omap3xxx_check_revision(void) 305void __init omap3xxx_check_revision(void)
293{ 306{
307 const char *cpu_rev;
294 u32 cpuid, idcode; 308 u32 cpuid, idcode;
295 u16 hawkeye; 309 u16 hawkeye;
296 u8 rev; 310 u8 rev;
@@ -300,7 +314,7 @@ void __init omap3xxx_check_revision(void)
300 * If the processor type is Cortex-A8 and the revision is 0x0 314 * If the processor type is Cortex-A8 and the revision is 0x0
301 * it means its Cortex r0p0 which is 3430 ES1.0. 315 * it means its Cortex r0p0 which is 3430 ES1.0.
302 */ 316 */
303 cpuid = read_cpuid(CPUID_ID); 317 cpuid = read_cpuid_id();
304 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { 318 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
305 omap_revision = OMAP3430_REV_ES1_0; 319 omap_revision = OMAP3430_REV_ES1_0;
306 cpu_rev = "1.0"; 320 cpu_rev = "1.0";
@@ -438,6 +452,7 @@ void __init omap3xxx_check_revision(void)
438 cpu_rev = "1.2"; 452 cpu_rev = "1.2";
439 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n"); 453 pr_warn("Warning: unknown chip type; assuming OMAP3630ES1.2\n");
440 } 454 }
455 sprintf(soc_rev, "ES%s", cpu_rev);
441} 456}
442 457
443void __init omap4xxx_check_revision(void) 458void __init omap4xxx_check_revision(void)
@@ -460,7 +475,7 @@ void __init omap4xxx_check_revision(void)
460 * Use ARM register to detect the correct ES version 475 * Use ARM register to detect the correct ES version
461 */ 476 */
462 if (!rev && (hawkeye != 0xb94e) && (hawkeye != 0xb975)) { 477 if (!rev && (hawkeye != 0xb94e) && (hawkeye != 0xb975)) {
463 idcode = read_cpuid(CPUID_ID); 478 idcode = read_cpuid_id();
464 rev = (idcode & 0xf) - 1; 479 rev = (idcode & 0xf) - 1;
465 } 480 }
466 481
@@ -512,8 +527,10 @@ void __init omap4xxx_check_revision(void)
512 omap_revision = OMAP4430_REV_ES2_3; 527 omap_revision = OMAP4430_REV_ES2_3;
513 } 528 }
514 529
515 pr_info("OMAP%04x ES%d.%d\n", omap_rev() >> 16, 530 sprintf(soc_name, "OMAP%04x", omap_rev() >> 16);
516 ((omap_rev() >> 12) & 0xf), ((omap_rev() >> 8) & 0xf)); 531 sprintf(soc_rev, "ES%d.%d", (omap_rev() >> 12) & 0xf,
532 (omap_rev() >> 8) & 0xf);
533 pr_info("%s %s\n", soc_name, soc_rev);
517} 534}
518 535
519void __init omap5xxx_check_revision(void) 536void __init omap5xxx_check_revision(void)
@@ -529,26 +546,34 @@ void __init omap5xxx_check_revision(void)
529 case 0xb942: 546 case 0xb942:
530 switch (rev) { 547 switch (rev) {
531 case 0: 548 case 0:
532 default:
533 omap_revision = OMAP5430_REV_ES1_0; 549 omap_revision = OMAP5430_REV_ES1_0;
550 break;
551 case 1:
552 default:
553 omap_revision = OMAP5430_REV_ES2_0;
534 } 554 }
535 break; 555 break;
536 556
537 case 0xb998: 557 case 0xb998:
538 switch (rev) { 558 switch (rev) {
539 case 0: 559 case 0:
540 default:
541 omap_revision = OMAP5432_REV_ES1_0; 560 omap_revision = OMAP5432_REV_ES1_0;
561 break;
562 case 1:
563 default:
564 omap_revision = OMAP5432_REV_ES2_0;
542 } 565 }
543 break; 566 break;
544 567
545 default: 568 default:
546 /* Unknown default to latest silicon rev as default*/ 569 /* Unknown default to latest silicon rev as default*/
547 omap_revision = OMAP5430_REV_ES1_0; 570 omap_revision = OMAP5430_REV_ES2_0;
548 } 571 }
549 572
550 pr_info("OMAP%04x ES%d.0\n", 573 sprintf(soc_name, "OMAP%04x", omap_rev() >> 16);
551 omap_rev() >> 16, ((omap_rev() >> 12) & 0xf)); 574 sprintf(soc_rev, "ES%d.0", (omap_rev() >> 12) & 0xf);
575
576 pr_info("%s %s\n", soc_name, soc_rev);
552} 577}
553 578
554/* 579/*
@@ -569,3 +594,63 @@ void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
569 else 594 else
570 tap_prod_id = 0x0208; 595 tap_prod_id = 0x0208;
571} 596}
597
598#ifdef CONFIG_SOC_BUS
599
600static const char const *omap_types[] = {
601 [OMAP2_DEVICE_TYPE_TEST] = "TST",
602 [OMAP2_DEVICE_TYPE_EMU] = "EMU",
603 [OMAP2_DEVICE_TYPE_SEC] = "HS",
604 [OMAP2_DEVICE_TYPE_GP] = "GP",
605 [OMAP2_DEVICE_TYPE_BAD] = "BAD",
606};
607
608static const char * __init omap_get_family(void)
609{
610 if (cpu_is_omap24xx())
611 return kasprintf(GFP_KERNEL, "OMAP2");
612 else if (cpu_is_omap34xx())
613 return kasprintf(GFP_KERNEL, "OMAP3");
614 else if (cpu_is_omap44xx())
615 return kasprintf(GFP_KERNEL, "OMAP4");
616 else if (soc_is_omap54xx())
617 return kasprintf(GFP_KERNEL, "OMAP5");
618 else
619 return kasprintf(GFP_KERNEL, "Unknown");
620}
621
622static ssize_t omap_get_type(struct device *dev,
623 struct device_attribute *attr,
624 char *buf)
625{
626 return sprintf(buf, "%s\n", omap_types[omap_type()]);
627}
628
629static struct device_attribute omap_soc_attr =
630 __ATTR(type, S_IRUGO, omap_get_type, NULL);
631
632void __init omap_soc_device_init(void)
633{
634 struct device *parent;
635 struct soc_device *soc_dev;
636 struct soc_device_attribute *soc_dev_attr;
637
638 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
639 if (!soc_dev_attr)
640 return;
641
642 soc_dev_attr->machine = soc_name;
643 soc_dev_attr->family = omap_get_family();
644 soc_dev_attr->revision = soc_rev;
645
646 soc_dev = soc_device_register(soc_dev_attr);
647 if (IS_ERR_OR_NULL(soc_dev)) {
648 kfree(soc_dev_attr);
649 return;
650 }
651
652 parent = soc_device_to_device(soc_dev);
653 if (!IS_ERR_OR_NULL(parent))
654 device_create_file(parent, &omap_soc_attr);
655}
656#endif /* CONFIG_SOC_BUS */
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 5c445ca1e271..09abf99e9e57 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -277,6 +277,14 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
277 .length = L4_PER_54XX_SIZE, 277 .length = L4_PER_54XX_SIZE,
278 .type = MT_DEVICE, 278 .type = MT_DEVICE,
279 }, 279 },
280#ifdef CONFIG_OMAP4_ERRATA_I688
281 {
282 .virtual = OMAP4_SRAM_VA,
283 .pfn = __phys_to_pfn(OMAP4_SRAM_PA),
284 .length = PAGE_SIZE,
285 .type = MT_MEMORY_SO,
286 },
287#endif
280}; 288};
281#endif 289#endif
282 290
@@ -329,6 +337,7 @@ void __init omap4_map_io(void)
329void __init omap5_map_io(void) 337void __init omap5_map_io(void)
330{ 338{
331 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 339 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
340 omap_barriers_init();
332} 341}
333#endif 342#endif
334/* 343/*
@@ -385,6 +394,13 @@ static void __init omap_hwmod_init_postsetup(void)
385 omap_pm_if_early_init(); 394 omap_pm_if_early_init();
386} 395}
387 396
397static void __init omap_common_late_init(void)
398{
399 omap_mux_late_init();
400 omap2_common_pm_late_init();
401 omap_soc_device_init();
402}
403
388#ifdef CONFIG_SOC_OMAP2420 404#ifdef CONFIG_SOC_OMAP2420
389void __init omap2420_init_early(void) 405void __init omap2420_init_early(void)
390{ 406{
@@ -408,8 +424,7 @@ void __init omap2420_init_early(void)
408 424
409void __init omap2420_init_late(void) 425void __init omap2420_init_late(void)
410{ 426{
411 omap_mux_late_init(); 427 omap_common_late_init();
412 omap2_common_pm_late_init();
413 omap2_pm_init(); 428 omap2_pm_init();
414 omap2_clk_enable_autoidle_all(); 429 omap2_clk_enable_autoidle_all();
415} 430}
@@ -438,8 +453,7 @@ void __init omap2430_init_early(void)
438 453
439void __init omap2430_init_late(void) 454void __init omap2430_init_late(void)
440{ 455{
441 omap_mux_late_init(); 456 omap_common_late_init();
442 omap2_common_pm_late_init();
443 omap2_pm_init(); 457 omap2_pm_init();
444 omap2_clk_enable_autoidle_all(); 458 omap2_clk_enable_autoidle_all();
445} 459}
@@ -511,48 +525,42 @@ void __init ti81xx_init_early(void)
511 525
512void __init omap3_init_late(void) 526void __init omap3_init_late(void)
513{ 527{
514 omap_mux_late_init(); 528 omap_common_late_init();
515 omap2_common_pm_late_init();
516 omap3_pm_init(); 529 omap3_pm_init();
517 omap2_clk_enable_autoidle_all(); 530 omap2_clk_enable_autoidle_all();
518} 531}
519 532
520void __init omap3430_init_late(void) 533void __init omap3430_init_late(void)
521{ 534{
522 omap_mux_late_init(); 535 omap_common_late_init();
523 omap2_common_pm_late_init();
524 omap3_pm_init(); 536 omap3_pm_init();
525 omap2_clk_enable_autoidle_all(); 537 omap2_clk_enable_autoidle_all();
526} 538}
527 539
528void __init omap35xx_init_late(void) 540void __init omap35xx_init_late(void)
529{ 541{
530 omap_mux_late_init(); 542 omap_common_late_init();
531 omap2_common_pm_late_init();
532 omap3_pm_init(); 543 omap3_pm_init();
533 omap2_clk_enable_autoidle_all(); 544 omap2_clk_enable_autoidle_all();
534} 545}
535 546
536void __init omap3630_init_late(void) 547void __init omap3630_init_late(void)
537{ 548{
538 omap_mux_late_init(); 549 omap_common_late_init();
539 omap2_common_pm_late_init();
540 omap3_pm_init(); 550 omap3_pm_init();
541 omap2_clk_enable_autoidle_all(); 551 omap2_clk_enable_autoidle_all();
542} 552}
543 553
544void __init am35xx_init_late(void) 554void __init am35xx_init_late(void)
545{ 555{
546 omap_mux_late_init(); 556 omap_common_late_init();
547 omap2_common_pm_late_init();
548 omap3_pm_init(); 557 omap3_pm_init();
549 omap2_clk_enable_autoidle_all(); 558 omap2_clk_enable_autoidle_all();
550} 559}
551 560
552void __init ti81xx_init_late(void) 561void __init ti81xx_init_late(void)
553{ 562{
554 omap_mux_late_init(); 563 omap_common_late_init();
555 omap2_common_pm_late_init();
556 omap3_pm_init(); 564 omap3_pm_init();
557 omap2_clk_enable_autoidle_all(); 565 omap2_clk_enable_autoidle_all();
558} 566}
@@ -604,8 +612,7 @@ void __init omap4430_init_early(void)
604 612
605void __init omap4430_init_late(void) 613void __init omap4430_init_late(void)
606{ 614{
607 omap_mux_late_init(); 615 omap_common_late_init();
608 omap2_common_pm_late_init();
609 omap4_pm_init(); 616 omap4_pm_init();
610 omap2_clk_enable_autoidle_all(); 617 omap2_clk_enable_autoidle_all();
611} 618}
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index e712d1725a8b..458f72f9dc8f 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -19,11 +19,8 @@
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/cacheflush.h>
23#include "omap-wakeupgen.h" 22#include "omap-wakeupgen.h"
24
25#include "common.h" 23#include "common.h"
26
27#include "powerdomain.h" 24#include "powerdomain.h"
28 25
29/* 26/*
@@ -35,9 +32,6 @@ void __ref omap4_cpu_die(unsigned int cpu)
35 unsigned int boot_cpu = 0; 32 unsigned int boot_cpu = 0;
36 void __iomem *base = omap_get_wakeupgen_base(); 33 void __iomem *base = omap_get_wakeupgen_base();
37 34
38 flush_cache_all();
39 dsb();
40
41 /* 35 /*
42 * we're ready for shutdown now, so do it 36 * we're ready for shutdown now, so do it
43 */ 37 */
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 8bcb64bcdcdb..e80327b6c81f 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -139,20 +139,6 @@ static inline void cpu_clear_prev_logic_pwrst(unsigned int cpu_id)
139 } 139 }
140} 140}
141 141
142/**
143 * omap4_mpuss_read_prev_context_state:
144 * Function returns the MPUSS previous context state
145 */
146u32 omap4_mpuss_read_prev_context_state(void)
147{
148 u32 reg;
149
150 reg = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
151 OMAP4430_PRM_MPU_INST, OMAP4_RM_MPU_MPU_CONTEXT_OFFSET);
152 reg &= OMAP4430_LOSTCONTEXT_DFF_MASK;
153 return reg;
154}
155
156/* 142/*
157 * Store the CPU cluster state for L2X0 low power operations. 143 * Store the CPU cluster state for L2X0 low power operations.
158 */ 144 */
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index d9727218dd0a..2a551f997aea 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -21,7 +21,6 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/irqchip/arm-gic.h> 22#include <linux/irqchip/arm-gic.h>
23 23
24#include <asm/cacheflush.h>
25#include <asm/smp_scu.h> 24#include <asm/smp_scu.h>
26 25
27#include "omap-secure.h" 26#include "omap-secure.h"
@@ -67,13 +66,6 @@ static void __cpuinit omap4_secondary_init(unsigned int cpu)
67 4, 0, 0, 0, 0, 0); 66 4, 0, 0, 0, 0, 0);
68 67
69 /* 68 /*
70 * If any interrupts are already enabled for the primary
71 * core (e.g. timer irq), then they will not have been enabled
72 * for us: do so
73 */
74 gic_secondary_init(0);
75
76 /*
77 * Synchronise with the boot thread. 69 * Synchronise with the boot thread.
78 */ 70 */
79 spin_lock(&boot_lock); 71 spin_lock(&boot_lock);
@@ -84,6 +76,7 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
84{ 76{
85 static struct clockdomain *cpu1_clkdm; 77 static struct clockdomain *cpu1_clkdm;
86 static bool booted; 78 static bool booted;
79 static struct powerdomain *cpu1_pwrdm;
87 void __iomem *base = omap_get_wakeupgen_base(); 80 void __iomem *base = omap_get_wakeupgen_base();
88 81
89 /* 82 /*
@@ -103,11 +96,10 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
103 else 96 else
104 __raw_writel(0x20, base + OMAP_AUX_CORE_BOOT_0); 97 __raw_writel(0x20, base + OMAP_AUX_CORE_BOOT_0);
105 98
106 flush_cache_all(); 99 if (!cpu1_clkdm && !cpu1_pwrdm) {
107 smp_wmb();
108
109 if (!cpu1_clkdm)
110 cpu1_clkdm = clkdm_lookup("mpu1_clkdm"); 100 cpu1_clkdm = clkdm_lookup("mpu1_clkdm");
101 cpu1_pwrdm = pwrdm_lookup("cpu1_pwrdm");
102 }
111 103
112 /* 104 /*
113 * The SGI(Software Generated Interrupts) are not wakeup capable 105 * The SGI(Software Generated Interrupts) are not wakeup capable
@@ -120,7 +112,7 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
120 * Section : 112 * Section :
121 * 4.3.4.2 Power States of CPU0 and CPU1 113 * 4.3.4.2 Power States of CPU0 and CPU1
122 */ 114 */
123 if (booted) { 115 if (booted && cpu1_pwrdm && cpu1_clkdm) {
124 /* 116 /*
125 * GIC distributor control register has changed between 117 * GIC distributor control register has changed between
126 * CortexA9 r1pX and r2pX. The Control Register secure 118 * CortexA9 r1pX and r2pX. The Control Register secure
@@ -141,7 +133,12 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
141 gic_dist_disable(); 133 gic_dist_disable();
142 } 134 }
143 135
136 /*
137 * Ensure that CPU power state is set to ON to avoid CPU
138 * powerdomain transition on wfi
139 */
144 clkdm_wakeup(cpu1_clkdm); 140 clkdm_wakeup(cpu1_clkdm);
141 omap_set_pwrdm_state(cpu1_pwrdm, PWRDM_POWER_ON);
145 clkdm_allow_idle(cpu1_clkdm); 142 clkdm_allow_idle(cpu1_clkdm);
146 143
147 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) { 144 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
@@ -168,38 +165,6 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
168 return 0; 165 return 0;
169} 166}
170 167
171static void __init wakeup_secondary(void)
172{
173 void *startup_addr = omap_secondary_startup;
174 void __iomem *base = omap_get_wakeupgen_base();
175
176 if (cpu_is_omap446x()) {
177 startup_addr = omap_secondary_startup_4460;
178 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
179 }
180
181 /*
182 * Write the address of secondary startup routine into the
183 * AuxCoreBoot1 where ROM code will jump and start executing
184 * on secondary core once out of WFE
185 * A barrier is added to ensure that write buffer is drained
186 */
187 if (omap_secure_apis_support())
188 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
189 else
190 __raw_writel(virt_to_phys(omap5_secondary_startup),
191 base + OMAP_AUX_CORE_BOOT_1);
192
193 smp_wmb();
194
195 /*
196 * Send a 'sev' to wake the secondary core from WFE.
197 * Drain the outstanding writes to memory
198 */
199 dsb_sev();
200 mb();
201}
202
203/* 168/*
204 * Initialise the CPU possible map early - this describes the CPUs 169 * Initialise the CPU possible map early - this describes the CPUs
205 * which may be present or become present in the system. 170 * which may be present or become present in the system.
@@ -209,7 +174,7 @@ static void __init omap4_smp_init_cpus(void)
209 unsigned int i = 0, ncores = 1, cpu_id; 174 unsigned int i = 0, ncores = 1, cpu_id;
210 175
211 /* Use ARM cpuid check here, as SoC detection will not work so early */ 176 /* Use ARM cpuid check here, as SoC detection will not work so early */
212 cpu_id = read_cpuid(CPUID_ID) & CPU_MASK; 177 cpu_id = read_cpuid_id() & CPU_MASK;
213 if (cpu_id == CPU_CORTEX_A9) { 178 if (cpu_id == CPU_CORTEX_A9) {
214 /* 179 /*
215 * Currently we can't call ioremap here because 180 * Currently we can't call ioremap here because
@@ -235,6 +200,8 @@ static void __init omap4_smp_init_cpus(void)
235 200
236static void __init omap4_smp_prepare_cpus(unsigned int max_cpus) 201static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
237{ 202{
203 void *startup_addr = omap_secondary_startup;
204 void __iomem *base = omap_get_wakeupgen_base();
238 205
239 /* 206 /*
240 * Initialise the SCU and wake up the secondary core using 207 * Initialise the SCU and wake up the secondary core using
@@ -242,7 +209,24 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
242 */ 209 */
243 if (scu_base) 210 if (scu_base)
244 scu_enable(scu_base); 211 scu_enable(scu_base);
245 wakeup_secondary(); 212
213 if (cpu_is_omap446x()) {
214 startup_addr = omap_secondary_startup_4460;
215 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
216 }
217
218 /*
219 * Write the address of secondary startup routine into the
220 * AuxCoreBoot1 where ROM code will jump and start executing
221 * on secondary core once out of WFE
222 * A barrier is added to ensure that write buffer is drained
223 */
224 if (omap_secure_apis_support())
225 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
226 else
227 __raw_writel(virt_to_phys(omap5_secondary_startup),
228 base + OMAP_AUX_CORE_BOOT_1);
229
246} 230}
247 231
248struct smp_operations omap4_smp_ops __initdata = { 232struct smp_operations omap4_smp_ops __initdata = {
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 708bb115a27f..13b27ffaf45e 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -22,6 +22,7 @@
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
25#include <linux/of_address.h>
25 26
26#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
27#include <asm/mach/map.h> 28#include <asm/mach/map.h>
@@ -240,15 +241,21 @@ void __iomem *omap4_get_sar_ram_base(void)
240 */ 241 */
241static int __init omap4_sar_ram_init(void) 242static int __init omap4_sar_ram_init(void)
242{ 243{
244 unsigned long sar_base;
245
243 /* 246 /*
244 * To avoid code running on other OMAPs in 247 * To avoid code running on other OMAPs in
245 * multi-omap builds 248 * multi-omap builds
246 */ 249 */
247 if (!cpu_is_omap44xx()) 250 if (cpu_is_omap44xx())
251 sar_base = OMAP44XX_SAR_RAM_BASE;
252 else if (soc_is_omap54xx())
253 sar_base = OMAP54XX_SAR_RAM_BASE;
254 else
248 return -ENOMEM; 255 return -ENOMEM;
249 256
250 /* Static mapping, never released */ 257 /* Static mapping, never released */
251 sar_ram_base = ioremap(OMAP44XX_SAR_RAM_BASE, SZ_16K); 258 sar_ram_base = ioremap(sar_base, SZ_16K);
252 if (WARN_ON(!sar_ram_base)) 259 if (WARN_ON(!sar_ram_base))
253 return -ENOMEM; 260 return -ENOMEM;
254 261
@@ -258,6 +265,21 @@ omap_early_initcall(omap4_sar_ram_init);
258 265
259void __init omap_gic_of_init(void) 266void __init omap_gic_of_init(void)
260{ 267{
268 struct device_node *np;
269
270 /* Extract GIC distributor and TWD bases for OMAP4460 ROM Errata WA */
271 if (!cpu_is_omap446x())
272 goto skip_errata_init;
273
274 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic");
275 gic_dist_base_addr = of_iomap(np, 0);
276 WARN_ON(!gic_dist_base_addr);
277
278 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-twd-timer");
279 twd_base = of_iomap(np, 0);
280 WARN_ON(!twd_base);
281
282skip_errata_init:
261 omap_wakeupgen_init(); 283 omap_wakeupgen_init();
262 irqchip_init(); 284 irqchip_init();
263} 285}
diff --git a/arch/arm/mach-omap2/omap4-sar-layout.h b/arch/arm/mach-omap2/omap4-sar-layout.h
index e170fe803b04..792b1069f724 100644
--- a/arch/arm/mach-omap2/omap4-sar-layout.h
+++ b/arch/arm/mach-omap2/omap4-sar-layout.h
@@ -20,13 +20,13 @@
20#define SAR_BANK4_OFFSET 0x3000 20#define SAR_BANK4_OFFSET 0x3000
21 21
22/* Scratch pad memory offsets from SAR_BANK1 */ 22/* Scratch pad memory offsets from SAR_BANK1 */
23#define SCU_OFFSET0 0xd00 23#define SCU_OFFSET0 0xfe4
24#define SCU_OFFSET1 0xd04 24#define SCU_OFFSET1 0xfe8
25#define OMAP_TYPE_OFFSET 0xd10 25#define OMAP_TYPE_OFFSET 0xfec
26#define L2X0_SAVE_OFFSET0 0xd14 26#define L2X0_SAVE_OFFSET0 0xff0
27#define L2X0_SAVE_OFFSET1 0xd18 27#define L2X0_SAVE_OFFSET1 0xff4
28#define L2X0_AUXCTRL_OFFSET 0xd1c 28#define L2X0_AUXCTRL_OFFSET 0xff8
29#define L2X0_PREFETCH_CTRL_OFFSET 0xd20 29#define L2X0_PREFETCH_CTRL_OFFSET 0xffc
30 30
31/* CPUx Wakeup Non-Secure Physical Address offsets in SAR_BANK3 */ 31/* CPUx Wakeup Non-Secure Physical Address offsets in SAR_BANK3 */
32#define CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xa04 32#define CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xa04
@@ -48,13 +48,13 @@
48#define SAR_BACKUP_STATUS_WAKEUPGEN 0x10 48#define SAR_BACKUP_STATUS_WAKEUPGEN 0x10
49 49
50/* WakeUpGen save restore offset from OMAP54XX_SAR_RAM_BASE */ 50/* WakeUpGen save restore offset from OMAP54XX_SAR_RAM_BASE */
51#define OMAP5_WAKEUPGENENB_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x8d4) 51#define OMAP5_WAKEUPGENENB_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x9dc)
52#define OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x8e8) 52#define OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU0 (SAR_BANK3_OFFSET + 0x9f0)
53#define OMAP5_WAKEUPGENENB_OFFSET_CPU1 (SAR_BANK3_OFFSET + 0x8fc) 53#define OMAP5_WAKEUPGENENB_OFFSET_CPU1 (SAR_BANK3_OFFSET + 0xa04)
54#define OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU1 (SAR_BANK3_OFFSET + 0x910) 54#define OMAP5_WAKEUPGENENB_SECURE_OFFSET_CPU1 (SAR_BANK3_OFFSET + 0xa18)
55#define OMAP5_AUXCOREBOOT0_OFFSET (SAR_BANK3_OFFSET + 0x924) 55#define OMAP5_AUXCOREBOOT0_OFFSET (SAR_BANK3_OFFSET + 0xa2c)
56#define OMAP5_AUXCOREBOOT1_OFFSET (SAR_BANK3_OFFSET + 0x928) 56#define OMAP5_AUXCOREBOOT1_OFFSET (SAR_BANK3_OFFSET + 0x930)
57#define OMAP5_AMBA_IF_MODE_OFFSET (SAR_BANK3_OFFSET + 0x92c) 57#define OMAP5_AMBA_IF_MODE_OFFSET (SAR_BANK3_OFFSET + 0xa34)
58#define OMAP5_SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x800) 58#define OMAP5_SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x800)
59 59
60#endif 60#endif
diff --git a/arch/arm/mach-omap2/omap54xx.h b/arch/arm/mach-omap2/omap54xx.h
index a2582bb3cab3..a086ba15868b 100644
--- a/arch/arm/mach-omap2/omap54xx.h
+++ b/arch/arm/mach-omap2/omap54xx.h
@@ -28,5 +28,6 @@
28#define OMAP54XX_PRCM_MPU_BASE 0x48243000 28#define OMAP54XX_PRCM_MPU_BASE 0x48243000
29#define OMAP54XX_SCM_BASE 0x4a002000 29#define OMAP54XX_SCM_BASE 0x4a002000
30#define OMAP54XX_CTRL_BASE 0x4a002800 30#define OMAP54XX_CTRL_BASE 0x4a002800
31#define OMAP54XX_SAR_RAM_BASE 0x4ae26000
31 32
32#endif /* __ASM_SOC_OMAP555554XX_H */ 33#endif /* __ASM_SOC_OMAP555554XX_H */
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 381be7ac0c17..eeea4fa28fbc 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -131,7 +131,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
131 int oh_cnt, i, ret = 0; 131 int oh_cnt, i, ret = 0;
132 132
133 oh_cnt = of_property_count_strings(node, "ti,hwmods"); 133 oh_cnt = of_property_count_strings(node, "ti,hwmods");
134 if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { 134 if (oh_cnt <= 0) {
135 dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); 135 dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n");
136 return -ENODEV; 136 return -ENODEV;
137 } 137 }
@@ -815,20 +815,17 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name)
815 } 815 }
816 816
817 oh = omap_hwmod_lookup(oh_name); 817 oh = omap_hwmod_lookup(oh_name);
818 if (IS_ERR_OR_NULL(oh)) { 818 if (!oh) {
819 WARN(1, "%s: no hwmod for %s\n", __func__, 819 WARN(1, "%s: no hwmod for %s\n", __func__,
820 oh_name); 820 oh_name);
821 return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV); 821 return ERR_PTR(-ENODEV);
822 } 822 }
823 if (IS_ERR_OR_NULL(oh->od)) { 823 if (!oh->od) {
824 WARN(1, "%s: no omap_device for %s\n", __func__, 824 WARN(1, "%s: no omap_device for %s\n", __func__,
825 oh_name); 825 oh_name);
826 return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV); 826 return ERR_PTR(-ENODEV);
827 } 827 }
828 828
829 if (IS_ERR_OR_NULL(oh->od->pdev))
830 return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
831
832 return &oh->od->pdev->dev; 829 return &oh->od->pdev->dev;
833} 830}
834 831
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index a202a4785104..93f213b6a784 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -138,6 +138,7 @@
138#include <linux/spinlock.h> 138#include <linux/spinlock.h>
139#include <linux/slab.h> 139#include <linux/slab.h>
140#include <linux/bootmem.h> 140#include <linux/bootmem.h>
141#include <linux/cpu.h>
141 142
142#include <asm/system_misc.h> 143#include <asm/system_misc.h>
143 144
@@ -610,8 +611,6 @@ static int _enable_wakeup(struct omap_hwmod *oh, u32 *v)
610 611
611 /* XXX test pwrdm_get_wken for this hwmod's subsystem */ 612 /* XXX test pwrdm_get_wken for this hwmod's subsystem */
612 613
613 oh->_int_flags |= _HWMOD_WAKEUP_ENABLED;
614
615 return 0; 614 return 0;
616} 615}
617 616
@@ -645,8 +644,6 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
645 644
646 /* XXX test pwrdm_get_wken for this hwmod's subsystem */ 645 /* XXX test pwrdm_get_wken for this hwmod's subsystem */
647 646
648 oh->_int_flags &= ~_HWMOD_WAKEUP_ENABLED;
649
650 return 0; 647 return 0;
651} 648}
652 649
@@ -1666,7 +1663,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1666 return -ENOSYS; 1663 return -ENOSYS;
1667 1664
1668 ret = _lookup_hardreset(oh, name, &ohri); 1665 ret = _lookup_hardreset(oh, name, &ohri);
1669 if (IS_ERR_VALUE(ret)) 1666 if (ret < 0)
1670 return ret; 1667 return ret;
1671 1668
1672 if (oh->clkdm) { 1669 if (oh->clkdm) {
@@ -2157,7 +2154,7 @@ static int _enable(struct omap_hwmod *oh)
2157 if (soc_ops.enable_module) 2154 if (soc_ops.enable_module)
2158 soc_ops.enable_module(oh); 2155 soc_ops.enable_module(oh);
2159 if (oh->flags & HWMOD_BLOCK_WFI) 2156 if (oh->flags & HWMOD_BLOCK_WFI)
2160 disable_hlt(); 2157 cpu_idle_poll_ctrl(true);
2161 2158
2162 if (soc_ops.update_context_lost) 2159 if (soc_ops.update_context_lost)
2163 soc_ops.update_context_lost(oh); 2160 soc_ops.update_context_lost(oh);
@@ -2221,7 +2218,7 @@ static int _idle(struct omap_hwmod *oh)
2221 _del_initiator_dep(oh, mpu_oh); 2218 _del_initiator_dep(oh, mpu_oh);
2222 2219
2223 if (oh->flags & HWMOD_BLOCK_WFI) 2220 if (oh->flags & HWMOD_BLOCK_WFI)
2224 enable_hlt(); 2221 cpu_idle_poll_ctrl(false);
2225 if (soc_ops.disable_module) 2222 if (soc_ops.disable_module)
2226 soc_ops.disable_module(oh); 2223 soc_ops.disable_module(oh);
2227 2224
@@ -2331,7 +2328,7 @@ static int _shutdown(struct omap_hwmod *oh)
2331 _del_initiator_dep(oh, mpu_oh); 2328 _del_initiator_dep(oh, mpu_oh);
2332 /* XXX what about the other system initiators here? dma, dsp */ 2329 /* XXX what about the other system initiators here? dma, dsp */
2333 if (oh->flags & HWMOD_BLOCK_WFI) 2330 if (oh->flags & HWMOD_BLOCK_WFI)
2334 enable_hlt(); 2331 cpu_idle_poll_ctrl(false);
2335 if (soc_ops.disable_module) 2332 if (soc_ops.disable_module)
2336 soc_ops.disable_module(oh); 2333 soc_ops.disable_module(oh);
2337 _disable_clocks(oh); 2334 _disable_clocks(oh);
@@ -2416,7 +2413,7 @@ static int __init _init(struct omap_hwmod *oh, void *data)
2416 _init_mpu_rt_base(oh, NULL); 2413 _init_mpu_rt_base(oh, NULL);
2417 2414
2418 r = _init_clocks(oh, NULL); 2415 r = _init_clocks(oh, NULL);
2419 if (IS_ERR_VALUE(r)) { 2416 if (r < 0) {
2420 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); 2417 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name);
2421 return -EINVAL; 2418 return -EINVAL;
2422 } 2419 }
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index d5dc935f6060..fe5962921f07 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -482,15 +482,13 @@ struct omap_hwmod_omap4_prcm {
482 * These are for internal use only and are managed by the omap_hwmod code. 482 * These are for internal use only and are managed by the omap_hwmod code.
483 * 483 *
484 * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module 484 * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module
485 * _HWMOD_WAKEUP_ENABLED: set when the omap_hwmod code has enabled ENAWAKEUP
486 * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached 485 * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached
487 * _HWMOD_SKIP_ENABLE: set if hwmod enabled during init (HWMOD_INIT_NO_IDLE) - 486 * _HWMOD_SKIP_ENABLE: set if hwmod enabled during init (HWMOD_INIT_NO_IDLE) -
488 * causes the first call to _enable() to only update the pinmux 487 * causes the first call to _enable() to only update the pinmux
489 */ 488 */
490#define _HWMOD_NO_MPU_PORT (1 << 0) 489#define _HWMOD_NO_MPU_PORT (1 << 0)
491#define _HWMOD_WAKEUP_ENABLED (1 << 1) 490#define _HWMOD_SYSCONFIG_LOADED (1 << 1)
492#define _HWMOD_SYSCONFIG_LOADED (1 << 2) 491#define _HWMOD_SKIP_ENABLE (1 << 2)
493#define _HWMOD_SKIP_ENABLE (1 << 3)
494 492
495/* 493/*
496 * omap_hwmod._state definitions 494 * omap_hwmod._state definitions
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 6a764af6c6d3..5137cc84b504 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -610,6 +610,8 @@ static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
610 &omap2420_l4_core__mcbsp2, 610 &omap2420_l4_core__mcbsp2,
611 &omap2420_l4_core__msdi1, 611 &omap2420_l4_core__msdi1,
612 &omap2xxx_l4_core__rng, 612 &omap2xxx_l4_core__rng,
613 &omap2xxx_l4_core__sham,
614 &omap2xxx_l4_core__aes,
613 &omap2420_l4_core__hdq1w, 615 &omap2420_l4_core__hdq1w,
614 &omap2420_l4_wkup__counter_32k, 616 &omap2420_l4_wkup__counter_32k,
615 &omap2420_l3__gpmc, 617 &omap2420_l3__gpmc,
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index d2d3840557c3..4ce999ee3ee9 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -963,6 +963,8 @@ static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
963 &omap2430_l4_core__mcbsp5, 963 &omap2430_l4_core__mcbsp5,
964 &omap2430_l4_core__hdq1w, 964 &omap2430_l4_core__hdq1w,
965 &omap2xxx_l4_core__rng, 965 &omap2xxx_l4_core__rng,
966 &omap2xxx_l4_core__sham,
967 &omap2xxx_l4_core__aes,
966 &omap2430_l4_wkup__counter_32k, 968 &omap2430_l4_wkup__counter_32k,
967 &omap2430_l3__gpmc, 969 &omap2430_l3__gpmc,
968 NULL, 970 NULL,
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
index 47901a5e76de..5fd40d4a989e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -138,6 +138,24 @@ static struct omap_hwmod_addr_space omap2_rng_addr_space[] = {
138 { } 138 { }
139}; 139};
140 140
141static struct omap_hwmod_addr_space omap2xxx_sham_addrs[] = {
142 {
143 .pa_start = 0x480a4000,
144 .pa_end = 0x480a4000 + 0x64 - 1,
145 .flags = ADDR_TYPE_RT
146 },
147 { }
148};
149
150static struct omap_hwmod_addr_space omap2xxx_aes_addrs[] = {
151 {
152 .pa_start = 0x480a6000,
153 .pa_end = 0x480a6000 + 0x50 - 1,
154 .flags = ADDR_TYPE_RT
155 },
156 { }
157};
158
141/* 159/*
142 * Common interconnect data 160 * Common interconnect data
143 */ 161 */
@@ -389,3 +407,21 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__rng = {
389 .addr = omap2_rng_addr_space, 407 .addr = omap2_rng_addr_space,
390 .user = OCP_USER_MPU | OCP_USER_SDMA, 408 .user = OCP_USER_MPU | OCP_USER_SDMA,
391}; 409};
410
411/* l4 core -> sham interface */
412struct omap_hwmod_ocp_if omap2xxx_l4_core__sham = {
413 .master = &omap2xxx_l4_core_hwmod,
414 .slave = &omap2xxx_sham_hwmod,
415 .clk = "sha_ick",
416 .addr = omap2xxx_sham_addrs,
417 .user = OCP_USER_MPU | OCP_USER_SDMA,
418};
419
420/* l4 core -> aes interface */
421struct omap_hwmod_ocp_if omap2xxx_l4_core__aes = {
422 .master = &omap2xxx_l4_core_hwmod,
423 .slave = &omap2xxx_aes_hwmod,
424 .clk = "aes_ick",
425 .addr = omap2xxx_aes_addrs,
426 .user = OCP_USER_MPU | OCP_USER_SDMA,
427};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index e596117004d4..c8c64b3e1acc 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -864,3 +864,84 @@ struct omap_hwmod omap2xxx_rng_hwmod = {
864 .flags = HWMOD_INIT_NO_RESET, 864 .flags = HWMOD_INIT_NO_RESET,
865 .class = &omap2_rng_hwmod_class, 865 .class = &omap2_rng_hwmod_class,
866}; 866};
867
868/* SHAM */
869
870static struct omap_hwmod_class_sysconfig omap2_sham_sysc = {
871 .rev_offs = 0x5c,
872 .sysc_offs = 0x60,
873 .syss_offs = 0x64,
874 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
875 SYSS_HAS_RESET_STATUS),
876 .sysc_fields = &omap_hwmod_sysc_type1,
877};
878
879static struct omap_hwmod_class omap2xxx_sham_class = {
880 .name = "sham",
881 .sysc = &omap2_sham_sysc,
882};
883
884static struct omap_hwmod_irq_info omap2_sham_mpu_irqs[] = {
885 { .irq = 51 + OMAP_INTC_START, },
886 { .irq = -1 }
887};
888
889static struct omap_hwmod_dma_info omap2_sham_sdma_chs[] = {
890 { .name = "rx", .dma_req = 13 },
891 { .dma_req = -1 }
892};
893
894struct omap_hwmod omap2xxx_sham_hwmod = {
895 .name = "sham",
896 .mpu_irqs = omap2_sham_mpu_irqs,
897 .sdma_reqs = omap2_sham_sdma_chs,
898 .main_clk = "l4_ck",
899 .prcm = {
900 .omap2 = {
901 .module_offs = CORE_MOD,
902 .prcm_reg_id = 4,
903 .module_bit = OMAP24XX_EN_SHA_SHIFT,
904 .idlest_reg_id = 4,
905 .idlest_idle_bit = OMAP24XX_ST_SHA_SHIFT,
906 },
907 },
908 .class = &omap2xxx_sham_class,
909};
910
911/* AES */
912
913static struct omap_hwmod_class_sysconfig omap2_aes_sysc = {
914 .rev_offs = 0x44,
915 .sysc_offs = 0x48,
916 .syss_offs = 0x4c,
917 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
918 SYSS_HAS_RESET_STATUS),
919 .sysc_fields = &omap_hwmod_sysc_type1,
920};
921
922static struct omap_hwmod_class omap2xxx_aes_class = {
923 .name = "aes",
924 .sysc = &omap2_aes_sysc,
925};
926
927static struct omap_hwmod_dma_info omap2_aes_sdma_chs[] = {
928 { .name = "tx", .dma_req = 9 },
929 { .name = "rx", .dma_req = 10 },
930 { .dma_req = -1 }
931};
932
933struct omap_hwmod omap2xxx_aes_hwmod = {
934 .name = "aes",
935 .sdma_reqs = omap2_aes_sdma_chs,
936 .main_clk = "l4_ck",
937 .prcm = {
938 .omap2 = {
939 .module_offs = CORE_MOD,
940 .prcm_reg_id = 4,
941 .module_bit = OMAP24XX_EN_AES_SHIFT,
942 .idlest_reg_id = 4,
943 .idlest_idle_bit = OMAP24XX_ST_AES_SHIFT,
944 },
945 },
946 .class = &omap2xxx_aes_class,
947};
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 26eee4a556ad..01d8f324450a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -28,6 +28,7 @@
28#include "prm-regbits-33xx.h" 28#include "prm-regbits-33xx.h"
29#include "i2c.h" 29#include "i2c.h"
30#include "mmc.h" 30#include "mmc.h"
31#include "wd_timer.h"
31 32
32/* 33/*
33 * IP blocks 34 * IP blocks
@@ -417,8 +418,6 @@ static struct omap_hwmod am33xx_adc_tsc_hwmod = {
417 * - clkdiv32k 418 * - clkdiv32k
418 * - debugss 419 * - debugss
419 * - ocp watch point 420 * - ocp watch point
420 * - aes0
421 * - sha0
422 */ 421 */
423#if 0 422#if 0
424/* 423/*
@@ -499,25 +498,41 @@ static struct omap_hwmod am33xx_ocpwp_hwmod = {
499 }, 498 },
500 }, 499 },
501}; 500};
501#endif
502 502
503/* 503/*
504 * 'aes' class 504 * 'aes0' class
505 */ 505 */
506static struct omap_hwmod_class am33xx_aes_hwmod_class = { 506static struct omap_hwmod_class_sysconfig am33xx_aes0_sysc = {
507 .name = "aes", 507 .rev_offs = 0x80,
508 .sysc_offs = 0x84,
509 .syss_offs = 0x88,
510 .sysc_flags = SYSS_HAS_RESET_STATUS,
511};
512
513static struct omap_hwmod_class am33xx_aes0_hwmod_class = {
514 .name = "aes0",
515 .sysc = &am33xx_aes0_sysc,
508}; 516};
509 517
510static struct omap_hwmod_irq_info am33xx_aes0_irqs[] = { 518static struct omap_hwmod_irq_info am33xx_aes0_irqs[] = {
511 { .irq = 102 + OMAP_INTC_START, }, 519 { .irq = 103 + OMAP_INTC_START, },
512 { .irq = -1 }, 520 { .irq = -1 },
513}; 521};
514 522
523static struct omap_hwmod_dma_info am33xx_aes0_edma_reqs[] = {
524 { .name = "tx", .dma_req = 6, },
525 { .name = "rx", .dma_req = 5, },
526 { .dma_req = -1 }
527};
528
515static struct omap_hwmod am33xx_aes0_hwmod = { 529static struct omap_hwmod am33xx_aes0_hwmod = {
516 .name = "aes0", 530 .name = "aes",
517 .class = &am33xx_aes_hwmod_class, 531 .class = &am33xx_aes0_hwmod_class,
518 .clkdm_name = "l3_clkdm", 532 .clkdm_name = "l3_clkdm",
519 .mpu_irqs = am33xx_aes0_irqs, 533 .mpu_irqs = am33xx_aes0_irqs,
520 .main_clk = "l3_gclk", 534 .sdma_reqs = am33xx_aes0_edma_reqs,
535 .main_clk = "aes0_fck",
521 .prcm = { 536 .prcm = {
522 .omap4 = { 537 .omap4 = {
523 .clkctrl_offs = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET, 538 .clkctrl_offs = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
@@ -526,21 +541,35 @@ static struct omap_hwmod am33xx_aes0_hwmod = {
526 }, 541 },
527}; 542};
528 543
529/* sha0 */ 544/* sha0 HIB2 (the 'P' (public) device) */
545static struct omap_hwmod_class_sysconfig am33xx_sha0_sysc = {
546 .rev_offs = 0x100,
547 .sysc_offs = 0x110,
548 .syss_offs = 0x114,
549 .sysc_flags = SYSS_HAS_RESET_STATUS,
550};
551
530static struct omap_hwmod_class am33xx_sha0_hwmod_class = { 552static struct omap_hwmod_class am33xx_sha0_hwmod_class = {
531 .name = "sha0", 553 .name = "sha0",
554 .sysc = &am33xx_sha0_sysc,
532}; 555};
533 556
534static struct omap_hwmod_irq_info am33xx_sha0_irqs[] = { 557static struct omap_hwmod_irq_info am33xx_sha0_irqs[] = {
535 { .irq = 108 + OMAP_INTC_START, }, 558 { .irq = 109 + OMAP_INTC_START, },
536 { .irq = -1 }, 559 { .irq = -1 },
537}; 560};
538 561
562static struct omap_hwmod_dma_info am33xx_sha0_edma_reqs[] = {
563 { .name = "rx", .dma_req = 36, },
564 { .dma_req = -1 }
565};
566
539static struct omap_hwmod am33xx_sha0_hwmod = { 567static struct omap_hwmod am33xx_sha0_hwmod = {
540 .name = "sha0", 568 .name = "sham",
541 .class = &am33xx_sha0_hwmod_class, 569 .class = &am33xx_sha0_hwmod_class,
542 .clkdm_name = "l3_clkdm", 570 .clkdm_name = "l3_clkdm",
543 .mpu_irqs = am33xx_sha0_irqs, 571 .mpu_irqs = am33xx_sha0_irqs,
572 .sdma_reqs = am33xx_sha0_edma_reqs,
544 .main_clk = "l3_gclk", 573 .main_clk = "l3_gclk",
545 .prcm = { 574 .prcm = {
546 .omap4 = { 575 .omap4 = {
@@ -550,8 +579,6 @@ static struct omap_hwmod am33xx_sha0_hwmod = {
550 }, 579 },
551}; 580};
552 581
553#endif
554
555/* ocmcram */ 582/* ocmcram */
556static struct omap_hwmod_class am33xx_ocmcram_hwmod_class = { 583static struct omap_hwmod_class am33xx_ocmcram_hwmod_class = {
557 .name = "ocmcram", 584 .name = "ocmcram",
@@ -2087,8 +2114,21 @@ static struct omap_hwmod am33xx_uart6_hwmod = {
2087}; 2114};
2088 2115
2089/* 'wd_timer' class */ 2116/* 'wd_timer' class */
2117static struct omap_hwmod_class_sysconfig wdt_sysc = {
2118 .rev_offs = 0x0,
2119 .sysc_offs = 0x10,
2120 .syss_offs = 0x14,
2121 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SIDLEMODE |
2122 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
2123 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
2124 SIDLE_SMART_WKUP),
2125 .sysc_fields = &omap_hwmod_sysc_type1,
2126};
2127
2090static struct omap_hwmod_class am33xx_wd_timer_hwmod_class = { 2128static struct omap_hwmod_class am33xx_wd_timer_hwmod_class = {
2091 .name = "wd_timer", 2129 .name = "wd_timer",
2130 .sysc = &wdt_sysc,
2131 .pre_shutdown = &omap2_wd_timer_disable,
2092}; 2132};
2093 2133
2094/* 2134/*
@@ -2099,6 +2139,7 @@ static struct omap_hwmod am33xx_wd_timer1_hwmod = {
2099 .name = "wd_timer2", 2139 .name = "wd_timer2",
2100 .class = &am33xx_wd_timer_hwmod_class, 2140 .class = &am33xx_wd_timer_hwmod_class,
2101 .clkdm_name = "l4_wkup_clkdm", 2141 .clkdm_name = "l4_wkup_clkdm",
2142 .flags = HWMOD_SWSUP_SIDLE,
2102 .main_clk = "wdt1_fck", 2143 .main_clk = "wdt1_fck",
2103 .prcm = { 2144 .prcm = {
2104 .omap4 = { 2145 .omap4 = {
@@ -3434,6 +3475,42 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = {
3434 .user = OCP_USER_MPU | OCP_USER_SDMA, 3475 .user = OCP_USER_MPU | OCP_USER_SDMA,
3435}; 3476};
3436 3477
3478/* l3 main -> sha0 HIB2 */
3479static struct omap_hwmod_addr_space am33xx_sha0_addrs[] = {
3480 {
3481 .pa_start = 0x53100000,
3482 .pa_end = 0x53100000 + SZ_512 - 1,
3483 .flags = ADDR_TYPE_RT
3484 },
3485 { }
3486};
3487
3488static struct omap_hwmod_ocp_if am33xx_l3_main__sha0 = {
3489 .master = &am33xx_l3_main_hwmod,
3490 .slave = &am33xx_sha0_hwmod,
3491 .clk = "sha0_fck",
3492 .addr = am33xx_sha0_addrs,
3493 .user = OCP_USER_MPU | OCP_USER_SDMA,
3494};
3495
3496/* l3 main -> AES0 HIB2 */
3497static struct omap_hwmod_addr_space am33xx_aes0_addrs[] = {
3498 {
3499 .pa_start = 0x53500000,
3500 .pa_end = 0x53500000 + SZ_1M - 1,
3501 .flags = ADDR_TYPE_RT
3502 },
3503 { }
3504};
3505
3506static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
3507 .master = &am33xx_l3_main_hwmod,
3508 .slave = &am33xx_aes0_hwmod,
3509 .clk = "aes0_fck",
3510 .addr = am33xx_aes0_addrs,
3511 .user = OCP_USER_MPU | OCP_USER_SDMA,
3512};
3513
3437static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = { 3514static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3438 &am33xx_l4_fw__emif_fw, 3515 &am33xx_l4_fw__emif_fw,
3439 &am33xx_l3_main__emif, 3516 &am33xx_l3_main__emif,
@@ -3514,6 +3591,8 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3514 &am33xx_l3_s__usbss, 3591 &am33xx_l3_s__usbss,
3515 &am33xx_l4_hs__cpgmac0, 3592 &am33xx_l4_hs__cpgmac0,
3516 &am33xx_cpgmac0__mdio, 3593 &am33xx_cpgmac0__mdio,
3594 &am33xx_l3_main__sha0,
3595 &am33xx_l3_main__aes0,
3517 NULL, 3596 NULL,
3518}; 3597};
3519 3598
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 5112d04e7b79..4083606ea1da 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -3550,6 +3550,132 @@ static struct omap_hwmod_ocp_if omap3xxx_l3_main__gpmc = {
3550 .user = OCP_USER_MPU | OCP_USER_SDMA, 3550 .user = OCP_USER_MPU | OCP_USER_SDMA,
3551}; 3551};
3552 3552
3553/* l4_core -> SHAM2 (SHA1/MD5) (similar to omap24xx) */
3554static struct omap_hwmod_sysc_fields omap3_sham_sysc_fields = {
3555 .sidle_shift = 4,
3556 .srst_shift = 1,
3557 .autoidle_shift = 0,
3558};
3559
3560static struct omap_hwmod_class_sysconfig omap3_sham_sysc = {
3561 .rev_offs = 0x5c,
3562 .sysc_offs = 0x60,
3563 .syss_offs = 0x64,
3564 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
3565 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
3566 .sysc_fields = &omap3_sham_sysc_fields,
3567};
3568
3569static struct omap_hwmod_class omap3xxx_sham_class = {
3570 .name = "sham",
3571 .sysc = &omap3_sham_sysc,
3572};
3573
3574static struct omap_hwmod_irq_info omap3_sham_mpu_irqs[] = {
3575 { .irq = 49 + OMAP_INTC_START, },
3576 { .irq = -1 }
3577};
3578
3579static struct omap_hwmod_dma_info omap3_sham_sdma_reqs[] = {
3580 { .name = "rx", .dma_req = OMAP34XX_DMA_SHA1MD5_RX, },
3581 { .dma_req = -1 }
3582};
3583
3584static struct omap_hwmod omap3xxx_sham_hwmod = {
3585 .name = "sham",
3586 .mpu_irqs = omap3_sham_mpu_irqs,
3587 .sdma_reqs = omap3_sham_sdma_reqs,
3588 .main_clk = "sha12_ick",
3589 .prcm = {
3590 .omap2 = {
3591 .module_offs = CORE_MOD,
3592 .prcm_reg_id = 1,
3593 .module_bit = OMAP3430_EN_SHA12_SHIFT,
3594 .idlest_reg_id = 1,
3595 .idlest_idle_bit = OMAP3430_ST_SHA12_SHIFT,
3596 },
3597 },
3598 .class = &omap3xxx_sham_class,
3599};
3600
3601static struct omap_hwmod_addr_space omap3xxx_sham_addrs[] = {
3602 {
3603 .pa_start = 0x480c3000,
3604 .pa_end = 0x480c3000 + 0x64 - 1,
3605 .flags = ADDR_TYPE_RT
3606 },
3607 { }
3608};
3609
3610static struct omap_hwmod_ocp_if omap3xxx_l4_core__sham = {
3611 .master = &omap3xxx_l4_core_hwmod,
3612 .slave = &omap3xxx_sham_hwmod,
3613 .clk = "sha12_ick",
3614 .addr = omap3xxx_sham_addrs,
3615 .user = OCP_USER_MPU | OCP_USER_SDMA,
3616};
3617
3618/* l4_core -> AES */
3619static struct omap_hwmod_sysc_fields omap3xxx_aes_sysc_fields = {
3620 .sidle_shift = 6,
3621 .srst_shift = 1,
3622 .autoidle_shift = 0,
3623};
3624
3625static struct omap_hwmod_class_sysconfig omap3_aes_sysc = {
3626 .rev_offs = 0x44,
3627 .sysc_offs = 0x48,
3628 .syss_offs = 0x4c,
3629 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
3630 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
3631 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
3632 .sysc_fields = &omap3xxx_aes_sysc_fields,
3633};
3634
3635static struct omap_hwmod_class omap3xxx_aes_class = {
3636 .name = "aes",
3637 .sysc = &omap3_aes_sysc,
3638};
3639
3640static struct omap_hwmod_dma_info omap3_aes_sdma_reqs[] = {
3641 { .name = "tx", .dma_req = OMAP34XX_DMA_AES2_TX, },
3642 { .name = "rx", .dma_req = OMAP34XX_DMA_AES2_RX, },
3643 { .dma_req = -1 }
3644};
3645
3646static struct omap_hwmod omap3xxx_aes_hwmod = {
3647 .name = "aes",
3648 .sdma_reqs = omap3_aes_sdma_reqs,
3649 .main_clk = "aes2_ick",
3650 .prcm = {
3651 .omap2 = {
3652 .module_offs = CORE_MOD,
3653 .prcm_reg_id = 1,
3654 .module_bit = OMAP3430_EN_AES2_SHIFT,
3655 .idlest_reg_id = 1,
3656 .idlest_idle_bit = OMAP3430_ST_AES2_SHIFT,
3657 },
3658 },
3659 .class = &omap3xxx_aes_class,
3660};
3661
3662static struct omap_hwmod_addr_space omap3xxx_aes_addrs[] = {
3663 {
3664 .pa_start = 0x480c5000,
3665 .pa_end = 0x480c5000 + 0x50 - 1,
3666 .flags = ADDR_TYPE_RT
3667 },
3668 { }
3669};
3670
3671static struct omap_hwmod_ocp_if omap3xxx_l4_core__aes = {
3672 .master = &omap3xxx_l4_core_hwmod,
3673 .slave = &omap3xxx_aes_hwmod,
3674 .clk = "aes2_ick",
3675 .addr = omap3xxx_aes_addrs,
3676 .user = OCP_USER_MPU | OCP_USER_SDMA,
3677};
3678
3553static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { 3679static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3554 &omap3xxx_l3_main__l4_core, 3680 &omap3xxx_l3_main__l4_core,
3555 &omap3xxx_l3_main__l4_per, 3681 &omap3xxx_l3_main__l4_per,
@@ -3601,8 +3727,32 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3601}; 3727};
3602 3728
3603/* GP-only hwmod links */ 3729/* GP-only hwmod links */
3604static struct omap_hwmod_ocp_if *omap3xxx_gp_hwmod_ocp_ifs[] __initdata = { 3730static struct omap_hwmod_ocp_if *omap34xx_gp_hwmod_ocp_ifs[] __initdata = {
3605 &omap3xxx_l4_sec__timer12, 3731 &omap3xxx_l4_sec__timer12,
3732 &omap3xxx_l4_core__sham,
3733 &omap3xxx_l4_core__aes,
3734 NULL
3735};
3736
3737static struct omap_hwmod_ocp_if *omap36xx_gp_hwmod_ocp_ifs[] __initdata = {
3738 &omap3xxx_l4_sec__timer12,
3739 &omap3xxx_l4_core__sham,
3740 &omap3xxx_l4_core__aes,
3741 NULL
3742};
3743
3744static struct omap_hwmod_ocp_if *am35xx_gp_hwmod_ocp_ifs[] __initdata = {
3745 &omap3xxx_l4_sec__timer12,
3746 /*
3747 * Apparently the SHA/MD5 and AES accelerator IP blocks are
3748 * only present on some AM35xx chips, and no one knows which
3749 * ones. See
3750 * http://www.spinics.net/lists/arm-kernel/msg215466.html So
3751 * if you need these IP blocks on an AM35xx, try uncommenting
3752 * the following lines.
3753 */
3754 /* &omap3xxx_l4_core__sham, */
3755 /* &omap3xxx_l4_core__aes, */
3606 NULL 3756 NULL
3607}; 3757};
3608 3758
@@ -3709,7 +3859,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = {
3709int __init omap3xxx_hwmod_init(void) 3859int __init omap3xxx_hwmod_init(void)
3710{ 3860{
3711 int r; 3861 int r;
3712 struct omap_hwmod_ocp_if **h = NULL; 3862 struct omap_hwmod_ocp_if **h = NULL, **h_gp = NULL;
3713 unsigned int rev; 3863 unsigned int rev;
3714 3864
3715 omap_hwmod_init(); 3865 omap_hwmod_init();
@@ -3719,13 +3869,6 @@ int __init omap3xxx_hwmod_init(void)
3719 if (r < 0) 3869 if (r < 0)
3720 return r; 3870 return r;
3721 3871
3722 /* Register GP-only hwmod links. */
3723 if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
3724 r = omap_hwmod_register_links(omap3xxx_gp_hwmod_ocp_ifs);
3725 if (r < 0)
3726 return r;
3727 }
3728
3729 rev = omap_rev(); 3872 rev = omap_rev();
3730 3873
3731 /* 3874 /*
@@ -3737,11 +3880,14 @@ int __init omap3xxx_hwmod_init(void)
3737 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 || 3880 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 ||
3738 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) { 3881 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) {
3739 h = omap34xx_hwmod_ocp_ifs; 3882 h = omap34xx_hwmod_ocp_ifs;
3883 h_gp = omap34xx_gp_hwmod_ocp_ifs;
3740 } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) { 3884 } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
3741 h = am35xx_hwmod_ocp_ifs; 3885 h = am35xx_hwmod_ocp_ifs;
3886 h_gp = am35xx_gp_hwmod_ocp_ifs;
3742 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 || 3887 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 ||
3743 rev == OMAP3630_REV_ES1_2) { 3888 rev == OMAP3630_REV_ES1_2) {
3744 h = omap36xx_hwmod_ocp_ifs; 3889 h = omap36xx_hwmod_ocp_ifs;
3890 h_gp = omap36xx_gp_hwmod_ocp_ifs;
3745 } else { 3891 } else {
3746 WARN(1, "OMAP3 hwmod family init: unknown chip type\n"); 3892 WARN(1, "OMAP3 hwmod family init: unknown chip type\n");
3747 return -EINVAL; 3893 return -EINVAL;
@@ -3751,6 +3897,14 @@ int __init omap3xxx_hwmod_init(void)
3751 if (r < 0) 3897 if (r < 0)
3752 return r; 3898 return r;
3753 3899
3900 /* Register GP-only hwmod links. */
3901 if (h_gp && omap_type() == OMAP2_DEVICE_TYPE_GP) {
3902 r = omap_hwmod_register_links(h_gp);
3903 if (r < 0)
3904 return r;
3905 }
3906
3907
3754 /* 3908 /*
3755 * Register hwmod links specific to certain ES levels of a 3909 * Register hwmod links specific to certain ES levels of a
3756 * particular family of silicon (e.g., 34xx ES1.0) 3910 * particular family of silicon (e.g., 34xx ES1.0)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 9e0576569e07..eaba9dc91a0d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2714,16 +2714,22 @@ static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
2714 { } 2714 { }
2715}; 2715};
2716 2716
2717static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = {
2718 { .role = "48mhz", .clk = "ocp2scp_usb_phy_phy_48m" },
2719};
2720
2721/* ocp2scp_usb_phy */ 2717/* ocp2scp_usb_phy */
2722static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { 2718static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2723 .name = "ocp2scp_usb_phy", 2719 .name = "ocp2scp_usb_phy",
2724 .class = &omap44xx_ocp2scp_hwmod_class, 2720 .class = &omap44xx_ocp2scp_hwmod_class,
2725 .clkdm_name = "l3_init_clkdm", 2721 .clkdm_name = "l3_init_clkdm",
2726 .main_clk = "func_48m_fclk", 2722 /*
2723 * ocp2scp_usb_phy_phy_48m is provided by the OMAP4 PRCM IP
2724 * block as an "optional clock," and normally should never be
2725 * specified as the main_clk for an OMAP IP block. However it
2726 * turns out that this clock is actually the main clock for
2727 * the ocp2scp_usb_phy IP block:
2728 * http://lists.infradead.org/pipermail/linux-arm-kernel/2012-September/119943.html
2729 * So listing ocp2scp_usb_phy_phy_48m as a main_clk here seems
2730 * to be the best workaround.
2731 */
2732 .main_clk = "ocp2scp_usb_phy_phy_48m",
2727 .prcm = { 2733 .prcm = {
2728 .omap4 = { 2734 .omap4 = {
2729 .clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET, 2735 .clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET,
@@ -2732,8 +2738,6 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2732 }, 2738 },
2733 }, 2739 },
2734 .dev_attr = ocp2scp_dev_attr, 2740 .dev_attr = ocp2scp_dev_attr,
2735 .opt_clks = ocp2scp_usb_phy_opt_clks,
2736 .opt_clks_cnt = ARRAY_SIZE(ocp2scp_usb_phy_opt_clks),
2737}; 2741};
2738 2742
2739/* 2743/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index cfcce299177c..6e04ff7065e1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -78,6 +78,8 @@ extern struct omap_hwmod omap2xxx_mcspi2_hwmod;
78extern struct omap_hwmod omap2xxx_counter_32k_hwmod; 78extern struct omap_hwmod omap2xxx_counter_32k_hwmod;
79extern struct omap_hwmod omap2xxx_gpmc_hwmod; 79extern struct omap_hwmod omap2xxx_gpmc_hwmod;
80extern struct omap_hwmod omap2xxx_rng_hwmod; 80extern struct omap_hwmod omap2xxx_rng_hwmod;
81extern struct omap_hwmod omap2xxx_sham_hwmod;
82extern struct omap_hwmod omap2xxx_aes_hwmod;
81 83
82/* Common interface data across OMAP2xxx */ 84/* Common interface data across OMAP2xxx */
83extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core; 85extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core;
@@ -105,6 +107,8 @@ extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc;
105extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi; 107extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi;
106extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc; 108extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc;
107extern struct omap_hwmod_ocp_if omap2xxx_l4_core__rng; 109extern struct omap_hwmod_ocp_if omap2xxx_l4_core__rng;
110extern struct omap_hwmod_ocp_if omap2xxx_l4_core__sham;
111extern struct omap_hwmod_ocp_if omap2xxx_l4_core__aes;
108 112
109/* Common IP block data */ 113/* Common IP block data */
110extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[]; 114extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[];
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 1edd000a8143..0b339861d751 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -217,7 +217,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
217 return 0; 217 return 0;
218 218
219 d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); 219 d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
220 if (!(IS_ERR_OR_NULL(d))) 220 if (d)
221 (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, 221 (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
222 (void *)pwrdm, &pwrdm_suspend_fops); 222 (void *)pwrdm, &pwrdm_suspend_fops);
223 223
@@ -261,8 +261,8 @@ static int __init pm_dbg_init(void)
261 return 0; 261 return 0;
262 262
263 d = debugfs_create_dir("pm_debug", NULL); 263 d = debugfs_create_dir("pm_debug", NULL);
264 if (IS_ERR_OR_NULL(d)) 264 if (!d)
265 return PTR_ERR(d); 265 return -EINVAL;
266 266
267 (void) debugfs_create_file("count", S_IRUGO, 267 (void) debugfs_create_file("count", S_IRUGO,
268 d, (void *)DEBUG_FILE_COUNTERS, &debug_fops); 268 d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 673a4c1d1d76..e742118fcfd2 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -218,7 +218,7 @@ static int omap_pm_enter(suspend_state_t suspend_state)
218 218
219static int omap_pm_begin(suspend_state_t state) 219static int omap_pm_begin(suspend_state_t state)
220{ 220{
221 disable_hlt(); 221 cpu_idle_poll_ctrl(true);
222 if (cpu_is_omap34xx()) 222 if (cpu_is_omap34xx())
223 omap_prcm_irq_prepare(); 223 omap_prcm_irq_prepare();
224 return 0; 224 return 0;
@@ -226,8 +226,7 @@ static int omap_pm_begin(suspend_state_t state)
226 226
227static void omap_pm_end(void) 227static void omap_pm_end(void)
228{ 228{
229 enable_hlt(); 229 cpu_idle_poll_ctrl(false);
230 return;
231} 230}
232 231
233static void omap_pm_finish(void) 232static void omap_pm_finish(void)
@@ -265,6 +264,12 @@ static void __init omap4_init_voltages(void)
265 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); 264 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
266} 265}
267 266
267static inline void omap_init_cpufreq(void)
268{
269 struct platform_device_info devinfo = { .name = "omap-cpufreq", };
270 platform_device_register_full(&devinfo);
271}
272
268static int __init omap2_common_pm_init(void) 273static int __init omap2_common_pm_init(void)
269{ 274{
270 if (!of_have_populated_dt()) 275 if (!of_have_populated_dt())
@@ -294,6 +299,9 @@ int __init omap2_common_pm_late_init(void)
294 299
295 /* Smartreflex device init */ 300 /* Smartreflex device init */
296 omap_devinit_smartreflex(); 301 omap_devinit_smartreflex();
302
303 /* cpufreq dummy device instantiation */
304 omap_init_cpufreq();
297 } 305 }
298 306
299#ifdef CONFIG_SUSPEND 307#ifdef CONFIG_SUSPEND
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index b59d93908341..ce956b0a7ba4 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -200,22 +200,17 @@ static int omap2_can_sleep(void)
200 200
201static void omap2_pm_idle(void) 201static void omap2_pm_idle(void)
202{ 202{
203 local_fiq_disable();
204
205 if (!omap2_can_sleep()) { 203 if (!omap2_can_sleep()) {
206 if (omap_irq_pending()) 204 if (omap_irq_pending())
207 goto out; 205 return;
208 omap2_enter_mpu_retention(); 206 omap2_enter_mpu_retention();
209 goto out; 207 return;
210 } 208 }
211 209
212 if (omap_irq_pending()) 210 if (omap_irq_pending())
213 goto out; 211 return;
214 212
215 omap2_enter_full_retention(); 213 omap2_enter_full_retention();
216
217out:
218 local_fiq_enable();
219} 214}
220 215
221static void __init prcm_setup_regs(void) 216static void __init prcm_setup_regs(void)
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2d93d8b23835..c01859398b54 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -346,19 +346,14 @@ void omap_sram_idle(void)
346 346
347static void omap3_pm_idle(void) 347static void omap3_pm_idle(void)
348{ 348{
349 local_fiq_disable();
350
351 if (omap_irq_pending()) 349 if (omap_irq_pending())
352 goto out; 350 return;
353 351
354 trace_cpu_idle(1, smp_processor_id()); 352 trace_cpu_idle(1, smp_processor_id());
355 353
356 omap_sram_idle(); 354 omap_sram_idle();
357 355
358 trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id()); 356 trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
359
360out:
361 local_fiq_enable();
362} 357}
363 358
364#ifdef CONFIG_SUSPEND 359#ifdef CONFIG_SUSPEND
@@ -757,14 +752,12 @@ int __init omap3_pm_init(void)
757 pr_err("Memory allocation failed when allocating for secure sram context\n"); 752 pr_err("Memory allocation failed when allocating for secure sram context\n");
758 753
759 local_irq_disable(); 754 local_irq_disable();
760 local_fiq_disable();
761 755
762 omap_dma_global_context_save(); 756 omap_dma_global_context_save();
763 omap3_save_secure_ram_context(); 757 omap3_save_secure_ram_context();
764 omap_dma_global_context_restore(); 758 omap_dma_global_context_restore();
765 759
766 local_irq_enable(); 760 local_irq_enable();
767 local_fiq_enable();
768 } 761 }
769 762
770 omap3_save_scratchpad_contents(); 763 omap3_save_scratchpad_contents();
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index ea62e75ef21d..a251f87fa2a2 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -126,16 +126,12 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
126 * omap_default_idle - OMAP4 default ilde routine.' 126 * omap_default_idle - OMAP4 default ilde routine.'
127 * 127 *
128 * Implements OMAP4 memory, IO ordering requirements which can't be addressed 128 * Implements OMAP4 memory, IO ordering requirements which can't be addressed
129 * with default cpu_do_idle() hook. Used by all CPUs with !CONFIG_CPUIDLE and 129 * with default cpu_do_idle() hook. Used by all CPUs with !CONFIG_CPU_IDLE and
130 * by secondary CPU with CONFIG_CPUIDLE. 130 * by secondary CPU with CONFIG_CPU_IDLE.
131 */ 131 */
132static void omap_default_idle(void) 132static void omap_default_idle(void)
133{ 133{
134 local_fiq_disable();
135
136 omap_do_wfi(); 134 omap_do_wfi();
137
138 local_fiq_enable();
139} 135}
140 136
141/** 137/**
@@ -147,8 +143,8 @@ static void omap_default_idle(void)
147int __init omap4_pm_init(void) 143int __init omap4_pm_init(void)
148{ 144{
149 int ret; 145 int ret;
150 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm, *l4wkup; 146 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm;
151 struct clockdomain *ducati_clkdm, *l3_2_clkdm, *l4_per_clkdm; 147 struct clockdomain *ducati_clkdm, *l3_2_clkdm;
152 148
153 if (omap_rev() == OMAP4430_REV_ES1_0) { 149 if (omap_rev() == OMAP4430_REV_ES1_0) {
154 WARN(1, "Power Management not supported on OMAP4430 ES1.0\n"); 150 WARN(1, "Power Management not supported on OMAP4430 ES1.0\n");
@@ -175,27 +171,19 @@ int __init omap4_pm_init(void)
175 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as 171 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
176 * expected. The hardware recommendation is to enable static 172 * expected. The hardware recommendation is to enable static
177 * dependencies for these to avoid system lock ups or random crashes. 173 * dependencies for these to avoid system lock ups or random crashes.
178 * The L4 wakeup depedency is added to workaround the OCP sync hardware
179 * BUG with 32K synctimer which lead to incorrect timer value read
180 * from the 32K counter. The BUG applies for GPTIMER1 and WDT2 which
181 * are part of L4 wakeup clockdomain.
182 */ 174 */
183 mpuss_clkdm = clkdm_lookup("mpuss_clkdm"); 175 mpuss_clkdm = clkdm_lookup("mpuss_clkdm");
184 emif_clkdm = clkdm_lookup("l3_emif_clkdm"); 176 emif_clkdm = clkdm_lookup("l3_emif_clkdm");
185 l3_1_clkdm = clkdm_lookup("l3_1_clkdm"); 177 l3_1_clkdm = clkdm_lookup("l3_1_clkdm");
186 l3_2_clkdm = clkdm_lookup("l3_2_clkdm"); 178 l3_2_clkdm = clkdm_lookup("l3_2_clkdm");
187 l4_per_clkdm = clkdm_lookup("l4_per_clkdm");
188 l4wkup = clkdm_lookup("l4_wkup_clkdm");
189 ducati_clkdm = clkdm_lookup("ducati_clkdm"); 179 ducati_clkdm = clkdm_lookup("ducati_clkdm");
190 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) || (!l4wkup) || 180 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) ||
191 (!l3_2_clkdm) || (!ducati_clkdm) || (!l4_per_clkdm)) 181 (!l3_2_clkdm) || (!ducati_clkdm))
192 goto err2; 182 goto err2;
193 183
194 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm); 184 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm);
195 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm); 185 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm);
196 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm); 186 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm);
197 ret |= clkdm_add_wkdep(mpuss_clkdm, l4_per_clkdm);
198 ret |= clkdm_add_wkdep(mpuss_clkdm, l4wkup);
199 ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm); 187 ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm);
200 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm); 188 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm);
201 if (ret) { 189 if (ret) {
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 8e61d80bf6b3..86babd740d41 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -52,7 +52,6 @@ enum {
52#define ALREADYACTIVE_SWITCH 0 52#define ALREADYACTIVE_SWITCH 0
53#define FORCEWAKEUP_SWITCH 1 53#define FORCEWAKEUP_SWITCH 1
54#define LOWPOWERSTATE_SWITCH 2 54#define LOWPOWERSTATE_SWITCH 2
55#define ERROR_SWITCH 3
56 55
57/* pwrdm_list contains all registered struct powerdomains */ 56/* pwrdm_list contains all registered struct powerdomains */
58static LIST_HEAD(pwrdm_list); 57static LIST_HEAD(pwrdm_list);
@@ -233,10 +232,7 @@ static u8 _pwrdm_save_clkdm_state_and_activate(struct powerdomain *pwrdm,
233{ 232{
234 u8 sleep_switch; 233 u8 sleep_switch;
235 234
236 if (curr_pwrst < 0) { 235 if (curr_pwrst < PWRDM_POWER_ON) {
237 WARN_ON(1);
238 sleep_switch = ERROR_SWITCH;
239 } else if (curr_pwrst < PWRDM_POWER_ON) {
240 if (curr_pwrst > pwrst && 236 if (curr_pwrst > pwrst &&
241 pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE && 237 pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE &&
242 arch_pwrdm->pwrdm_set_lowpwrstchange) { 238 arch_pwrdm->pwrdm_set_lowpwrstchange) {
@@ -1091,7 +1087,8 @@ int pwrdm_post_transition(struct powerdomain *pwrdm)
1091 */ 1087 */
1092int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 pwrst) 1088int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 pwrst)
1093{ 1089{
1094 u8 curr_pwrst, next_pwrst, sleep_switch; 1090 u8 next_pwrst, sleep_switch;
1091 int curr_pwrst;
1095 int ret = 0; 1092 int ret = 0;
1096 bool hwsup = false; 1093 bool hwsup = false;
1097 1094
@@ -1107,16 +1104,17 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 pwrst)
1107 pwrdm_lock(pwrdm); 1104 pwrdm_lock(pwrdm);
1108 1105
1109 curr_pwrst = pwrdm_read_pwrst(pwrdm); 1106 curr_pwrst = pwrdm_read_pwrst(pwrdm);
1107 if (curr_pwrst < 0) {
1108 ret = -EINVAL;
1109 goto osps_out;
1110 }
1111
1110 next_pwrst = pwrdm_read_next_pwrst(pwrdm); 1112 next_pwrst = pwrdm_read_next_pwrst(pwrdm);
1111 if (curr_pwrst == pwrst && next_pwrst == pwrst) 1113 if (curr_pwrst == pwrst && next_pwrst == pwrst)
1112 goto osps_out; 1114 goto osps_out;
1113 1115
1114 sleep_switch = _pwrdm_save_clkdm_state_and_activate(pwrdm, curr_pwrst, 1116 sleep_switch = _pwrdm_save_clkdm_state_and_activate(pwrdm, curr_pwrst,
1115 pwrst, &hwsup); 1117 pwrst, &hwsup);
1116 if (sleep_switch == ERROR_SWITCH) {
1117 ret = -EINVAL;
1118 goto osps_out;
1119 }
1120 1118
1121 ret = pwrdm_set_next_pwrst(pwrdm, pwrst); 1119 ret = pwrdm_set_next_pwrst(pwrdm, pwrst);
1122 if (ret) 1120 if (ret)
@@ -1182,7 +1180,7 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
1182{ 1180{
1183 int i; 1181 int i;
1184 1182
1185 if (IS_ERR_OR_NULL(pwrdm)) { 1183 if (!pwrdm) {
1186 pr_debug("powerdomain: %s: invalid powerdomain pointer\n", 1184 pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
1187 __func__); 1185 __func__);
1188 return 1; 1186 return 1;
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index d35f98aabf7a..415c7e0c9393 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -81,13 +81,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 */ 81/* Read a register in a CM/PRM instance in the PRM module */
82u32 omap4_prm_read_inst_reg(s16 inst, u16 reg) 82u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
83{ 83{
84 return __raw_readl(OMAP44XX_PRM_REGADDR(inst, reg)); 84 return __raw_readl(prm_base + inst + reg);
85} 85}
86 86
87/* Write into a register in a CM/PRM instance in the PRM module */ 87/* 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) 88void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
89{ 89{
90 __raw_writel(val, OMAP44XX_PRM_REGADDR(inst, reg)); 90 __raw_writel(val, prm_base + inst + reg);
91} 91}
92 92
93/* Read-modify-write a register in a PRM module. Caller must lock */ 93/* Read-modify-write a register in a PRM module. Caller must lock */
@@ -650,7 +650,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
650 650
651int __init omap44xx_prm_init(void) 651int __init omap44xx_prm_init(void)
652{ 652{
653 if (!cpu_is_omap44xx()) 653 if (!cpu_is_omap44xx() && !soc_is_omap54xx())
654 return 0; 654 return 0;
655 655
656 return prm_register(&omap44xx_prm_ll_data); 656 return prm_register(&omap44xx_prm_ll_data);
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index c62116bbc760..18fdeeb3a44a 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -413,7 +413,9 @@ IS_OMAP_TYPE(3430, 0x3430)
413 413
414#define OMAP54XX_CLASS 0x54000054 414#define OMAP54XX_CLASS 0x54000054
415#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8)) 415#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
416#define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
416#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8)) 417#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
418#define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
417 419
418void omap2xxx_check_revision(void); 420void omap2xxx_check_revision(void);
419void omap3xxx_check_revision(void); 421void omap3xxx_check_revision(void);
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index f62b509ed08d..f12aa6c15da4 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -57,15 +57,6 @@
57#include "common.h" 57#include "common.h"
58#include "powerdomain.h" 58#include "powerdomain.h"
59 59
60/* Parent clocks, eventually these will come from the clock framework */
61
62#define OMAP2_MPU_SOURCE "sys_ck"
63#define OMAP3_MPU_SOURCE OMAP2_MPU_SOURCE
64#define OMAP4_MPU_SOURCE "sys_clkin_ck"
65#define OMAP2_32K_SOURCE "func_32k_ck"
66#define OMAP3_32K_SOURCE "omap_32k_fck"
67#define OMAP4_32K_SOURCE "sys_32k_ck"
68
69#define REALTIME_COUNTER_BASE 0x48243200 60#define REALTIME_COUNTER_BASE 0x48243200
70#define INCREMENTER_NUMERATOR_OFFSET 0x10 61#define INCREMENTER_NUMERATOR_OFFSET 0x10
71#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 62#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14
@@ -129,7 +120,6 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
129} 120}
130 121
131static struct clock_event_device clockevent_gpt = { 122static struct clock_event_device clockevent_gpt = {
132 .name = "gp_timer",
133 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 123 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
134 .rating = 300, 124 .rating = 300,
135 .set_next_event = omap2_gp_timer_set_next_event, 125 .set_next_event = omap2_gp_timer_set_next_event,
@@ -170,6 +160,12 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match,
170 if (property && !of_get_property(np, property, NULL)) 160 if (property && !of_get_property(np, property, NULL))
171 continue; 161 continue;
172 162
163 if (!property && (of_get_property(np, "ti,timer-alwon", NULL) ||
164 of_get_property(np, "ti,timer-dsp", NULL) ||
165 of_get_property(np, "ti,timer-pwm", NULL) ||
166 of_get_property(np, "ti,timer-secure", NULL)))
167 continue;
168
173 of_add_property(np, &device_disabled); 169 of_add_property(np, &device_disabled);
174 return np; 170 return np;
175 } 171 }
@@ -214,16 +210,17 @@ static u32 __init omap_dm_timer_get_errata(void)
214} 210}
215 211
216static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, 212static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
217 int gptimer_id, 213 const char *fck_source,
218 const char *fck_source, 214 const char *property,
219 const char *property, 215 const char **timer_name,
220 int posted) 216 int posted)
221{ 217{
222 char name[10]; /* 10 = sizeof("gptXX_Xck0") */ 218 char name[10]; /* 10 = sizeof("gptXX_Xck0") */
223 const char *oh_name; 219 const char *oh_name;
224 struct device_node *np; 220 struct device_node *np;
225 struct omap_hwmod *oh; 221 struct omap_hwmod *oh;
226 struct resource irq, mem; 222 struct resource irq, mem;
223 struct clk *src;
227 int r = 0; 224 int r = 0;
228 225
229 if (of_have_populated_dt()) { 226 if (of_have_populated_dt()) {
@@ -243,10 +240,10 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
243 240
244 of_node_put(np); 241 of_node_put(np);
245 } else { 242 } else {
246 if (omap_dm_timer_reserve_systimer(gptimer_id)) 243 if (omap_dm_timer_reserve_systimer(timer->id))
247 return -ENODEV; 244 return -ENODEV;
248 245
249 sprintf(name, "timer%d", gptimer_id); 246 sprintf(name, "timer%d", timer->id);
250 oh_name = name; 247 oh_name = name;
251 } 248 }
252 249
@@ -254,6 +251,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
254 if (!oh) 251 if (!oh)
255 return -ENODEV; 252 return -ENODEV;
256 253
254 *timer_name = oh->name;
255
257 if (!of_have_populated_dt()) { 256 if (!of_have_populated_dt()) {
258 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, 257 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL,
259 &irq); 258 &irq);
@@ -276,24 +275,24 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
276 /* After the dmtimer is using hwmod these clocks won't be needed */ 275 /* After the dmtimer is using hwmod these clocks won't be needed */
277 timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); 276 timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh));
278 if (IS_ERR(timer->fclk)) 277 if (IS_ERR(timer->fclk))
279 return -ENODEV; 278 return PTR_ERR(timer->fclk);
280 279
281 /* FIXME: Need to remove hard-coded test on timer ID */ 280 src = clk_get(NULL, fck_source);
282 if (gptimer_id != 12) { 281 if (IS_ERR(src))
283 struct clk *src; 282 return PTR_ERR(src);
284 283
285 src = clk_get(NULL, fck_source); 284 if (clk_get_parent(timer->fclk) != src) {
286 if (IS_ERR(src)) { 285 r = clk_set_parent(timer->fclk, src);
287 r = -EINVAL; 286 if (r < 0) {
288 } else { 287 pr_warn("%s: %s cannot set source\n", __func__,
289 r = clk_set_parent(timer->fclk, src); 288 oh->name);
290 if (IS_ERR_VALUE(r))
291 pr_warn("%s: %s cannot set source\n",
292 __func__, oh->name);
293 clk_put(src); 289 clk_put(src);
290 return r;
294 } 291 }
295 } 292 }
296 293
294 clk_put(src);
295
297 omap_hwmod_setup_one(oh_name); 296 omap_hwmod_setup_one(oh_name);
298 omap_hwmod_enable(oh); 297 omap_hwmod_enable(oh);
299 __omap_dm_timer_init_regs(timer); 298 __omap_dm_timer_init_regs(timer);
@@ -317,6 +316,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
317{ 316{
318 int res; 317 int res;
319 318
319 clkev.id = gptimer_id;
320 clkev.errata = omap_dm_timer_get_errata(); 320 clkev.errata = omap_dm_timer_get_errata();
321 321
322 /* 322 /*
@@ -326,8 +326,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
326 */ 326 */
327 __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); 327 __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767);
328 328
329 res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source, property, 329 res = omap_dm_timer_init_one(&clkev, fck_source, property,
330 OMAP_TIMER_POSTED); 330 &clockevent_gpt.name, OMAP_TIMER_POSTED);
331 BUG_ON(res); 331 BUG_ON(res);
332 332
333 omap2_gp_timer_irq.dev_id = &clkev; 333 omap2_gp_timer_irq.dev_id = &clkev;
@@ -341,8 +341,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
341 3, /* Timer internal resynch latency */ 341 3, /* Timer internal resynch latency */
342 0xffffffff); 342 0xffffffff);
343 343
344 pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n", 344 pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name,
345 gptimer_id, clkev.rate); 345 clkev.rate);
346} 346}
347 347
348/* Clocksource code */ 348/* Clocksource code */
@@ -359,7 +359,6 @@ static cycle_t clocksource_read_cycles(struct clocksource *cs)
359} 359}
360 360
361static struct clocksource clocksource_gpt = { 361static struct clocksource clocksource_gpt = {
362 .name = "gp_timer",
363 .rating = 300, 362 .rating = 300,
364 .read = clocksource_read_cycles, 363 .read = clocksource_read_cycles,
365 .mask = CLOCKSOURCE_MASK(32), 364 .mask = CLOCKSOURCE_MASK(32),
@@ -442,13 +441,16 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
442} 441}
443 442
444static void __init omap2_gptimer_clocksource_init(int gptimer_id, 443static void __init omap2_gptimer_clocksource_init(int gptimer_id,
445 const char *fck_source) 444 const char *fck_source,
445 const char *property)
446{ 446{
447 int res; 447 int res;
448 448
449 clksrc.id = gptimer_id;
449 clksrc.errata = omap_dm_timer_get_errata(); 450 clksrc.errata = omap_dm_timer_get_errata();
450 451
451 res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source, NULL, 452 res = omap_dm_timer_init_one(&clksrc, fck_source, property,
453 &clocksource_gpt.name,
452 OMAP_TIMER_NONPOSTED); 454 OMAP_TIMER_NONPOSTED);
453 BUG_ON(res); 455 BUG_ON(res);
454 456
@@ -461,8 +463,8 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
461 pr_err("Could not register clocksource %s\n", 463 pr_err("Could not register clocksource %s\n",
462 clocksource_gpt.name); 464 clocksource_gpt.name);
463 else 465 else
464 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", 466 pr_info("OMAP clocksource: %s at %lu Hz\n",
465 gptimer_id, clksrc.rate); 467 clocksource_gpt.name, clksrc.rate);
466} 468}
467 469
468#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER 470#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
@@ -487,7 +489,7 @@ static void __init realtime_counter_init(void)
487 pr_err("%s: ioremap failed\n", __func__); 489 pr_err("%s: ioremap failed\n", __func__);
488 return; 490 return;
489 } 491 }
490 sys_clk = clk_get(NULL, "sys_clkin_ck"); 492 sys_clk = clk_get(NULL, "sys_clkin");
491 if (IS_ERR(sys_clk)) { 493 if (IS_ERR(sys_clk)) {
492 pr_err("%s: failed to get system clock handle\n", __func__); 494 pr_err("%s: failed to get system clock handle\n", __func__);
493 iounmap(base); 495 iounmap(base);
@@ -544,53 +546,52 @@ static inline void __init realtime_counter_init(void)
544#endif 546#endif
545 547
546#define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ 548#define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \
547 clksrc_nr, clksrc_src) \ 549 clksrc_nr, clksrc_src, clksrc_prop) \
548void __init omap##name##_gptimer_timer_init(void) \ 550void __init omap##name##_gptimer_timer_init(void) \
549{ \ 551{ \
550 if (omap_clk_init) \
551 omap_clk_init(); \
552 omap_dmtimer_init(); \ 552 omap_dmtimer_init(); \
553 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 553 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
554 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ 554 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \
555 clksrc_prop); \
555} 556}
556 557
557#define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ 558#define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \
558 clksrc_nr, clksrc_src) \ 559 clksrc_nr, clksrc_src, clksrc_prop) \
559void __init omap##name##_sync32k_timer_init(void) \ 560void __init omap##name##_sync32k_timer_init(void) \
560{ \ 561{ \
561 if (omap_clk_init) \
562 omap_clk_init(); \
563 omap_dmtimer_init(); \ 562 omap_dmtimer_init(); \
564 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ 563 omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \
565 /* Enable the use of clocksource="gp_timer" kernel parameter */ \ 564 /* Enable the use of clocksource="gp_timer" kernel parameter */ \
566 if (use_gptimer_clksrc) \ 565 if (use_gptimer_clksrc) \
567 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);\ 566 omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \
567 clksrc_prop); \
568 else \ 568 else \
569 omap2_sync32k_clocksource_init(); \ 569 omap2_sync32k_clocksource_init(); \
570} 570}
571 571
572#ifdef CONFIG_ARCH_OMAP2 572#ifdef CONFIG_ARCH_OMAP2
573OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", 573OMAP_SYS_32K_TIMER_INIT(2, 1, "timer_32k_ck", "ti,timer-alwon",
574 2, OMAP2_MPU_SOURCE); 574 2, "timer_sys_ck", NULL);
575#endif /* CONFIG_ARCH_OMAP2 */ 575#endif /* CONFIG_ARCH_OMAP2 */
576 576
577#ifdef CONFIG_ARCH_OMAP3 577#ifdef CONFIG_ARCH_OMAP3
578OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", 578OMAP_SYS_32K_TIMER_INIT(3, 1, "timer_32k_ck", "ti,timer-alwon",
579 2, OMAP3_MPU_SOURCE); 579 2, "timer_sys_ck", NULL);
580OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", 580OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure",
581 2, OMAP3_MPU_SOURCE); 581 2, "timer_sys_ck", NULL);
582OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon",
583 2, OMAP3_MPU_SOURCE);
584#endif /* CONFIG_ARCH_OMAP3 */ 582#endif /* CONFIG_ARCH_OMAP3 */
585 583
586#ifdef CONFIG_SOC_AM33XX 584#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX)
587OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", 585OMAP_SYS_GP_TIMER_INIT(3, 2, "timer_sys_ck", NULL,
588 2, OMAP4_MPU_SOURCE); 586 1, "timer_sys_ck", "ti,timer-alwon");
589#endif /* CONFIG_SOC_AM33XX */ 587#endif
588
589#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
590static OMAP_SYS_32K_TIMER_INIT(4, 1, "timer_32k_ck", "ti,timer-alwon",
591 2, "sys_clkin_ck", NULL);
592#endif
590 593
591#ifdef CONFIG_ARCH_OMAP4 594#ifdef CONFIG_ARCH_OMAP4
592OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
593 2, OMAP4_MPU_SOURCE);
594#ifdef CONFIG_LOCAL_TIMERS 595#ifdef CONFIG_LOCAL_TIMERS
595static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); 596static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29);
596void __init omap4_local_timer_init(void) 597void __init omap4_local_timer_init(void)
@@ -601,7 +602,7 @@ void __init omap4_local_timer_init(void)
601 int err; 602 int err;
602 603
603 if (of_have_populated_dt()) { 604 if (of_have_populated_dt()) {
604 twd_local_timer_of_register(); 605 clocksource_of_init();
605 return; 606 return;
606 } 607 }
607 608
@@ -619,13 +620,11 @@ void __init omap4_local_timer_init(void)
619#endif /* CONFIG_ARCH_OMAP4 */ 620#endif /* CONFIG_ARCH_OMAP4 */
620 621
621#ifdef CONFIG_SOC_OMAP5 622#ifdef CONFIG_SOC_OMAP5
622OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
623 2, OMAP4_MPU_SOURCE);
624void __init omap5_realtime_timer_init(void) 623void __init omap5_realtime_timer_init(void)
625{ 624{
626 int err; 625 int err;
627 626
628 omap5_sync32k_timer_init(); 627 omap4_sync32k_timer_init();
629 realtime_counter_init(); 628 realtime_counter_init();
630 629
631 err = arch_timer_of_register(); 630 err = arch_timer_of_register();
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 5706bdccf45e..aa27d7f5cbb7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -22,8 +22,12 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25 25#include <linux/regulator/machine.h>
26#include <asm/io.h> 26#include <linux/regulator/fixed.h>
27#include <linux/string.h>
28#include <linux/io.h>
29#include <linux/gpio.h>
30#include <linux/usb/phy.h>
27 31
28#include "soc.h" 32#include "soc.h"
29#include "omap_device.h" 33#include "omap_device.h"
@@ -526,3 +530,155 @@ void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
526} 530}
527 531
528#endif 532#endif
533
534/* Template for PHY regulators */
535static struct fixed_voltage_config hsusb_reg_config = {
536 /* .supply_name filled later */
537 .microvolts = 3300000,
538 .gpio = -1, /* updated later */
539 .startup_delay = 70000, /* 70msec */
540 .enable_high = 1, /* updated later */
541 .enabled_at_boot = 0, /* keep in RESET */
542 /* .init_data filled later */
543};
544
545static const char *nop_name = "nop_usb_xceiv"; /* NOP PHY driver */
546static const char *reg_name = "reg-fixed-voltage"; /* Regulator driver */
547
548/**
549 * usbhs_add_regulator - Add a gpio based fixed voltage regulator device
550 * @name: name for the regulator
551 * @dev_id: device id of the device this regulator supplies power to
552 * @dev_supply: supply name that the device expects
553 * @gpio: GPIO number
554 * @polarity: 1 - Active high, 0 - Active low
555 */
556static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply,
557 int gpio, int polarity)
558{
559 struct regulator_consumer_supply *supplies;
560 struct regulator_init_data *reg_data;
561 struct fixed_voltage_config *config;
562 struct platform_device *pdev;
563 int ret;
564
565 supplies = kzalloc(sizeof(*supplies), GFP_KERNEL);
566 if (!supplies)
567 return -ENOMEM;
568
569 supplies->supply = dev_supply;
570 supplies->dev_name = dev_id;
571
572 reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL);
573 if (!reg_data)
574 return -ENOMEM;
575
576 reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
577 reg_data->consumer_supplies = supplies;
578 reg_data->num_consumer_supplies = 1;
579
580 config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
581 GFP_KERNEL);
582 if (!config)
583 return -ENOMEM;
584
585 config->supply_name = name;
586 config->gpio = gpio;
587 config->enable_high = polarity;
588 config->init_data = reg_data;
589
590 /* create a regulator device */
591 pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
592 if (!pdev)
593 return -ENOMEM;
594
595 pdev->id = PLATFORM_DEVID_AUTO;
596 pdev->name = reg_name;
597 pdev->dev.platform_data = config;
598
599 ret = platform_device_register(pdev);
600 if (ret)
601 pr_err("%s: Failed registering regulator %s for %s\n",
602 __func__, name, dev_id);
603
604 return ret;
605}
606
607int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
608{
609 char *rail_name;
610 int i, len;
611 struct platform_device *pdev;
612 char *phy_id;
613
614 /* the phy_id will be something like "nop_usb_xceiv.1" */
615 len = strlen(nop_name) + 3; /* 3 -> ".1" and NULL terminator */
616
617 for (i = 0; i < num_phys; i++) {
618
619 if (!phy->port) {
620 pr_err("%s: Invalid port 0. Must start from 1\n",
621 __func__);
622 continue;
623 }
624
625 /* do we need a NOP PHY device ? */
626 if (!gpio_is_valid(phy->reset_gpio) &&
627 !gpio_is_valid(phy->vcc_gpio))
628 continue;
629
630 /* create a NOP PHY device */
631 pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
632 if (!pdev)
633 return -ENOMEM;
634
635 pdev->id = phy->port;
636 pdev->name = nop_name;
637 pdev->dev.platform_data = phy->platform_data;
638
639 phy_id = kmalloc(len, GFP_KERNEL);
640 if (!phy_id)
641 return -ENOMEM;
642
643 scnprintf(phy_id, len, "nop_usb_xceiv.%d\n",
644 pdev->id);
645
646 if (platform_device_register(pdev)) {
647 pr_err("%s: Failed to register device %s\n",
648 __func__, phy_id);
649 continue;
650 }
651
652 usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id);
653
654 /* Do we need RESET regulator ? */
655 if (gpio_is_valid(phy->reset_gpio)) {
656
657 rail_name = kmalloc(13, GFP_KERNEL);
658 if (!rail_name)
659 return -ENOMEM;
660
661 scnprintf(rail_name, 13, "hsusb%d_reset", phy->port);
662
663 usbhs_add_regulator(rail_name, phy_id, "reset",
664 phy->reset_gpio, 1);
665 }
666
667 /* Do we need VCC regulator ? */
668 if (gpio_is_valid(phy->vcc_gpio)) {
669
670 rail_name = kmalloc(13, GFP_KERNEL);
671 if (!rail_name)
672 return -ENOMEM;
673
674 scnprintf(rail_name, 13, "hsusb%d_vcc", phy->port);
675
676 usbhs_add_regulator(rail_name, phy_id, "vcc",
677 phy->vcc_gpio, phy->vcc_polarity);
678 }
679
680 phy++;
681 }
682
683 return 0;
684}
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index c5a3c6f9504e..e832bc7b8e2d 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/err.h>
11#include <linux/string.h> 12#include <linux/string.h>
12#include <linux/types.h> 13#include <linux/types.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
@@ -26,6 +27,24 @@
26static u8 async_cs, sync_cs; 27static u8 async_cs, sync_cs;
27static unsigned refclk_psec; 28static unsigned refclk_psec;
28 29
30static struct gpmc_settings tusb_async = {
31 .wait_on_read = true,
32 .wait_on_write = true,
33 .device_width = GPMC_DEVWIDTH_16BIT,
34 .mux_add_data = GPMC_MUX_AD,
35};
36
37static struct gpmc_settings tusb_sync = {
38 .burst_read = true,
39 .burst_write = true,
40 .sync_read = true,
41 .sync_write = true,
42 .wait_on_read = true,
43 .wait_on_write = true,
44 .burst_len = GPMC_BURST_16,
45 .device_width = GPMC_DEVWIDTH_16BIT,
46 .mux_add_data = GPMC_MUX_AD,
47};
29 48
30/* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ 49/* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */
31 50
@@ -37,8 +56,6 @@ static int tusb_set_async_mode(unsigned sysclk_ps)
37 56
38 memset(&dev_t, 0, sizeof(dev_t)); 57 memset(&dev_t, 0, sizeof(dev_t));
39 58
40 dev_t.mux = true;
41
42 dev_t.t_ceasu = 8 * 1000; 59 dev_t.t_ceasu = 8 * 1000;
43 dev_t.t_avdasu = t_acsnh_advnh - 7000; 60 dev_t.t_avdasu = t_acsnh_advnh - 7000;
44 dev_t.t_ce_avd = 1000; 61 dev_t.t_ce_avd = 1000;
@@ -52,7 +69,7 @@ static int tusb_set_async_mode(unsigned sysclk_ps)
52 dev_t.t_wpl = 300; 69 dev_t.t_wpl = 300;
53 dev_t.cyc_aavdh_we = 1; 70 dev_t.cyc_aavdh_we = 1;
54 71
55 gpmc_calc_timings(&t, &dev_t); 72 gpmc_calc_timings(&t, &tusb_async, &dev_t);
56 73
57 return gpmc_cs_set_timings(async_cs, &t); 74 return gpmc_cs_set_timings(async_cs, &t);
58} 75}
@@ -65,10 +82,6 @@ static int tusb_set_sync_mode(unsigned sysclk_ps)
65 82
66 memset(&dev_t, 0, sizeof(dev_t)); 83 memset(&dev_t, 0, sizeof(dev_t));
67 84
68 dev_t.mux = true;
69 dev_t.sync_read = true;
70 dev_t.sync_write = true;
71
72 dev_t.clk = 11100; 85 dev_t.clk = 11100;
73 dev_t.t_bacc = 1000; 86 dev_t.t_bacc = 1000;
74 dev_t.t_ces = 1000; 87 dev_t.t_ces = 1000;
@@ -84,7 +97,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps)
84 dev_t.cyc_wpl = 6; 97 dev_t.cyc_wpl = 6;
85 dev_t.t_ce_rdyz = 7000; 98 dev_t.t_ce_rdyz = 7000;
86 99
87 gpmc_calc_timings(&t, &dev_t); 100 gpmc_calc_timings(&t, &tusb_sync, &dev_t);
88 101
89 return gpmc_cs_set_timings(sync_cs, &t); 102 return gpmc_cs_set_timings(sync_cs, &t);
90} 103}
@@ -165,18 +178,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
165 return status; 178 return status;
166 } 179 }
167 tusb_resources[0].end = tusb_resources[0].start + 0x9ff; 180 tusb_resources[0].end = tusb_resources[0].start + 0x9ff;
181 tusb_async.wait_pin = waitpin;
168 async_cs = async; 182 async_cs = async;
169 gpmc_cs_write_reg(async, GPMC_CS_CONFIG1,
170 GPMC_CONFIG1_PAGE_LEN(2)
171 | GPMC_CONFIG1_WAIT_READ_MON
172 | GPMC_CONFIG1_WAIT_WRITE_MON
173 | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin)
174 | GPMC_CONFIG1_READTYPE_ASYNC
175 | GPMC_CONFIG1_WRITETYPE_ASYNC
176 | GPMC_CONFIG1_DEVICESIZE_16
177 | GPMC_CONFIG1_DEVICETYPE_NOR
178 | GPMC_CONFIG1_MUXADDDATA);
179 183
184 status = gpmc_cs_program_settings(async_cs, &tusb_async);
185 if (status < 0)
186 return status;
180 187
181 /* SYNC region, primarily for DMA */ 188 /* SYNC region, primarily for DMA */
182 status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) 189 status = gpmc_cs_request(sync, SZ_16M, (unsigned long *)
@@ -186,21 +193,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data,
186 return status; 193 return status;
187 } 194 }
188 tusb_resources[1].end = tusb_resources[1].start + 0x9ff; 195 tusb_resources[1].end = tusb_resources[1].start + 0x9ff;
196 tusb_sync.wait_pin = waitpin;
189 sync_cs = sync; 197 sync_cs = sync;
190 gpmc_cs_write_reg(sync, GPMC_CS_CONFIG1, 198
191 GPMC_CONFIG1_READMULTIPLE_SUPP 199 status = gpmc_cs_program_settings(sync_cs, &tusb_sync);
192 | GPMC_CONFIG1_READTYPE_SYNC 200 if (status < 0)
193 | GPMC_CONFIG1_WRITEMULTIPLE_SUPP 201 return status;
194 | GPMC_CONFIG1_WRITETYPE_SYNC
195 | GPMC_CONFIG1_PAGE_LEN(2)
196 | GPMC_CONFIG1_WAIT_READ_MON
197 | GPMC_CONFIG1_WAIT_WRITE_MON
198 | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin)
199 | GPMC_CONFIG1_DEVICESIZE_16
200 | GPMC_CONFIG1_DEVICETYPE_NOR
201 | GPMC_CONFIG1_MUXADDDATA
202 /* fclk divider gets set later */
203 );
204 202
205 /* IRQ */ 203 /* IRQ */
206 status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); 204 status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq");
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h
index 3319f5cf47a3..e7261ebcf7b0 100644
--- a/arch/arm/mach-omap2/usb.h
+++ b/arch/arm/mach-omap2/usb.h
@@ -53,8 +53,17 @@
53#define USBPHY_OTGSESSEND_EN (1 << 20) 53#define USBPHY_OTGSESSEND_EN (1 << 20)
54#define USBPHY_DATA_POLARITY (1 << 23) 54#define USBPHY_DATA_POLARITY (1 << 23)
55 55
56struct usbhs_phy_data {
57 int port; /* 1 indexed port number */
58 int reset_gpio;
59 int vcc_gpio;
60 bool vcc_polarity; /* 1 active high, 0 active low */
61 void *platform_data;
62};
63
56extern void usb_musb_init(struct omap_musb_board_data *board_data); 64extern void usb_musb_init(struct omap_musb_board_data *board_data);
57extern void usbhs_init(struct usbhs_omap_platform_data *pdata); 65extern void usbhs_init(struct usbhs_omap_platform_data *pdata);
66extern int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys);
58 67
59extern void am35x_musb_reset(void); 68extern void am35x_musb_reset(void);
60extern void am35x_musb_phy_power(u8 on); 69extern void am35x_musb_phy_power(u8 on);
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c
index 35a8014529ca..94fbb815680c 100644
--- a/arch/arm/mach-orion5x/board-dt.c
+++ b/arch/arm/mach-orion5x/board-dt.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/cpu.h>
17#include <asm/system_misc.h> 18#include <asm/system_misc.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <mach/orion5x.h> 20#include <mach/orion5x.h>
@@ -52,7 +53,7 @@ static void __init orion5x_dt_init(void)
52 */ 53 */
53 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) { 54 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
54 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n"); 55 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
55 disable_hlt(); 56 cpu_idle_poll_ctrl(true);
56 } 57 }
57 58
58 if (of_machine_is_compatible("lacie,ethernet-disk-mini-v2")) 59 if (of_machine_is_compatible("lacie,ethernet-disk-mini-v2"))
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index d068f1431c40..2075bf8e3d90 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -19,6 +19,7 @@
19#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/clk-provider.h> 21#include <linux/clk-provider.h>
22#include <linux/cpu.h>
22#include <net/dsa.h> 23#include <net/dsa.h>
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/setup.h> 25#include <asm/setup.h>
@@ -293,7 +294,7 @@ void __init orion5x_init(void)
293 */ 294 */
294 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) { 295 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
295 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n"); 296 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
296 disable_hlt(); 297 cpu_idle_poll_ctrl(true);
297 } 298 }
298 299
299 /* 300 /*
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index d9c7c3bf0d9c..973db98a3c27 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -402,8 +402,9 @@ static void __init orion5x_pci_master_slave_enable(void)
402 orion5x_pci_hw_wr_conf(bus_nr, 0, func, reg, 4, val | 0x7); 402 orion5x_pci_hw_wr_conf(bus_nr, 0, func, reg, 4, val | 0x7);
403} 403}
404 404
405static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram) 405static void __init orion5x_setup_pci_wins(void)
406{ 406{
407 const struct mbus_dram_target_info *dram = mv_mbus_dram_info();
407 u32 win_enable; 408 u32 win_enable;
408 int bus; 409 int bus;
409 int i; 410 int i;
@@ -420,7 +421,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram)
420 bus = orion5x_pci_local_bus_nr(); 421 bus = orion5x_pci_local_bus_nr();
421 422
422 for (i = 0; i < dram->num_cs; i++) { 423 for (i = 0; i < dram->num_cs; i++) {
423 struct mbus_dram_window *cs = dram->cs + i; 424 const struct mbus_dram_window *cs = dram->cs + i;
424 u32 func = PCI_CONF_FUNC_BAR_CS(cs->cs_index); 425 u32 func = PCI_CONF_FUNC_BAR_CS(cs->cs_index);
425 u32 reg; 426 u32 reg;
426 u32 val; 427 u32 val;
@@ -467,7 +468,7 @@ static int __init pci_setup(struct pci_sys_data *sys)
467 /* 468 /*
468 * Point PCI unit MBUS decode windows to DRAM space. 469 * Point PCI unit MBUS decode windows to DRAM space.
469 */ 470 */
470 orion5x_setup_pci_wins(&orion_mbus_dram_info); 471 orion5x_setup_pci_wins();
471 472
472 /* 473 /*
473 * Master + Slave enable 474 * Master + Slave enable
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index 4f7379fe01e2..80ca974b2f82 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,6 +1,26 @@
1config ARCH_SIRF
2 bool "CSR SiRF" if ARCH_MULTI_V7
3 select ARCH_REQUIRE_GPIOLIB
4 select GENERIC_CLOCKEVENTS
5 select GENERIC_IRQ_CHIP
6 select MIGHT_HAVE_CACHE_L2X0
7 select NO_IOPORT
8 select PINCTRL
9 select PINCTRL_SIRF
10 help
11 Support for CSR SiRFprimaII/Marco/Polo platforms
12
1if ARCH_SIRF 13if ARCH_SIRF
2 14
3menu "CSR SiRF primaII/Marco/Polo Specific Features" 15menu "CSR SiRF atlas6/primaII/Marco/Polo Specific Features"
16
17config ARCH_ATLAS6
18 bool "CSR SiRFSoC ATLAS6 ARM Cortex A9 Platform"
19 default y
20 select CPU_V7
21 select SIRF_IRQ
22 help
23 Support for CSR SiRFSoC ARM Cortex A9 Platform
4 24
5config ARCH_PRIMA2 25config ARCH_PRIMA2
6 bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform" 26 bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform"
@@ -16,6 +36,7 @@ config ARCH_MARCO
16 default y 36 default y
17 select ARM_GIC 37 select ARM_GIC
18 select CPU_V7 38 select CPU_V7
39 select HAVE_ARM_SCU if SMP
19 select HAVE_SMP 40 select HAVE_SMP
20 select SMP_ON_UP 41 select SMP_ON_UP
21 help 42 help
diff --git a/arch/arm/mach-prima2/Makefile b/arch/arm/mach-prima2/Makefile
index bfe360cbd177..7a6b4a323125 100644
--- a/arch/arm/mach-prima2/Makefile
+++ b/arch/arm/mach-prima2/Makefile
@@ -4,8 +4,7 @@ obj-y += rtciobrg.o
4obj-$(CONFIG_DEBUG_LL) += lluart.o 4obj-$(CONFIG_DEBUG_LL) += lluart.o
5obj-$(CONFIG_CACHE_L2X0) += l2x0.o 5obj-$(CONFIG_CACHE_L2X0) += l2x0.o
6obj-$(CONFIG_SUSPEND) += pm.o sleep.o 6obj-$(CONFIG_SUSPEND) += pm.o sleep.o
7obj-$(CONFIG_SIRF_IRQ) += irq.o
8obj-$(CONFIG_SMP) += platsmp.o headsmp.o 7obj-$(CONFIG_SMP) += platsmp.o headsmp.o
9obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 8obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
10obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o 9
11obj-$(CONFIG_ARCH_MARCO) += timer-marco.o 10CFLAGS_hotplug.o += -march=armv7-a
diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index 2d57aa479a7b..4f94cd87972a 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -6,6 +6,7 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8 8
9#include <linux/clocksource.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/irqchip.h> 12#include <linux/irqchip.h>
@@ -31,12 +32,38 @@ void __init sirfsoc_init_late(void)
31 sirfsoc_pm_init(); 32 sirfsoc_pm_init();
32} 33}
33 34
35static __init void sirfsoc_init_time(void)
36{
37 /* initialize clocking early, we want to set the OS timer */
38 sirfsoc_of_clk_init();
39 clocksource_of_init();
40}
41
34static __init void sirfsoc_map_io(void) 42static __init void sirfsoc_map_io(void)
35{ 43{
36 sirfsoc_map_lluart(); 44 sirfsoc_map_lluart();
37 sirfsoc_map_scu(); 45 sirfsoc_map_scu();
38} 46}
39 47
48#ifdef CONFIG_ARCH_ATLAS6
49static const char *atlas6_dt_match[] __initdata = {
50 "sirf,atlas6",
51 NULL
52};
53
54DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
55 /* Maintainer: Barry Song <baohua.song@csr.com> */
56 .nr_irqs = 128,
57 .map_io = sirfsoc_map_io,
58 .init_irq = irqchip_init,
59 .init_time = sirfsoc_init_time,
60 .init_machine = sirfsoc_mach_init,
61 .init_late = sirfsoc_init_late,
62 .dt_compat = atlas6_dt_match,
63 .restart = sirfsoc_restart,
64MACHINE_END
65#endif
66
40#ifdef CONFIG_ARCH_PRIMA2 67#ifdef CONFIG_ARCH_PRIMA2
41static const char *prima2_dt_match[] __initdata = { 68static const char *prima2_dt_match[] __initdata = {
42 "sirf,prima2", 69 "sirf,prima2",
@@ -45,12 +72,10 @@ static const char *prima2_dt_match[] __initdata = {
45 72
46DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") 73DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
47 /* Maintainer: Barry Song <baohua.song@csr.com> */ 74 /* Maintainer: Barry Song <baohua.song@csr.com> */
75 .nr_irqs = 128,
48 .map_io = sirfsoc_map_io, 76 .map_io = sirfsoc_map_io,
49 .init_irq = sirfsoc_of_irq_init, 77 .init_irq = irqchip_init,
50 .init_time = sirfsoc_prima2_timer_init, 78 .init_time = sirfsoc_init_time,
51#ifdef CONFIG_MULTI_IRQ_HANDLER
52 .handle_irq = sirfsoc_handle_irq,
53#endif
54 .dma_zone_size = SZ_256M, 79 .dma_zone_size = SZ_256M,
55 .init_machine = sirfsoc_mach_init, 80 .init_machine = sirfsoc_mach_init,
56 .init_late = sirfsoc_init_late, 81 .init_late = sirfsoc_init_late,
@@ -70,7 +95,7 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
70 .smp = smp_ops(sirfsoc_smp_ops), 95 .smp = smp_ops(sirfsoc_smp_ops),
71 .map_io = sirfsoc_map_io, 96 .map_io = sirfsoc_map_io,
72 .init_irq = irqchip_init, 97 .init_irq = irqchip_init,
73 .init_time = sirfsoc_marco_timer_init, 98 .init_time = sirfsoc_init_time,
74 .init_machine = sirfsoc_mach_init, 99 .init_machine = sirfsoc_mach_init,
75 .init_late = sirfsoc_init_late, 100 .init_late = sirfsoc_init_late,
76 .dt_compat = marco_dt_match, 101 .dt_compat = marco_dt_match,
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index b7c26b62e4a7..81135cd88e54 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -13,8 +13,8 @@
13#include <asm/mach/time.h> 13#include <asm/mach/time.h>
14#include <asm/exception.h> 14#include <asm/exception.h>
15 15
16extern void sirfsoc_prima2_timer_init(void); 16#define SIRFSOC_VA_BASE _AC(0xFEC00000, UL)
17extern void sirfsoc_marco_timer_init(void); 17#define SIRFSOC_VA(x) (SIRFSOC_VA_BASE + ((x) & 0x00FFF000))
18 18
19extern struct smp_operations sirfsoc_smp_ops; 19extern struct smp_operations sirfsoc_smp_ops;
20extern void sirfsoc_secondary_startup(void); 20extern void sirfsoc_secondary_startup(void);
diff --git a/arch/arm/mach-prima2/hotplug.c b/arch/arm/mach-prima2/hotplug.c
index f4b17cbababd..0ab2f8bae28e 100644
--- a/arch/arm/mach-prima2/hotplug.c
+++ b/arch/arm/mach-prima2/hotplug.c
@@ -10,13 +10,10 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/smp.h> 11#include <linux/smp.h>
12 12
13#include <asm/cacheflush.h>
14#include <asm/smp_plat.h> 13#include <asm/smp_plat.h>
15 14
16static inline void platform_do_lowpower(unsigned int cpu) 15static inline void platform_do_lowpower(unsigned int cpu)
17{ 16{
18 flush_cache_all();
19
20 /* we put the platform to just WFI */ 17 /* we put the platform to just WFI */
21 for (;;) { 18 for (;;) {
22 __asm__ __volatile__("dsb\n\t" "wfi\n\t" 19 __asm__ __volatile__("dsb\n\t" "wfi\n\t"
diff --git a/arch/arm/mach-prima2/include/mach/clkdev.h b/arch/arm/mach-prima2/include/mach/clkdev.h
deleted file mode 100644
index 66932518b1b7..000000000000
--- a/arch/arm/mach-prima2/include/mach/clkdev.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/clkdev.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_CLKDEV_H
10#define __MACH_CLKDEV_H
11
12#define __clk_get(clk) ({ 1; })
13#define __clk_put(clk) do { } while (0)
14
15#endif
diff --git a/arch/arm/mach-prima2/include/mach/debug-macro.S b/arch/arm/mach-prima2/include/mach/debug-macro.S
deleted file mode 100644
index cd97492bb075..000000000000
--- a/arch/arm/mach-prima2/include/mach/debug-macro.S
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/debug-macro.S
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <mach/hardware.h>
10#include <mach/uart.h>
11
12 .macro addruart, rp, rv, tmp
13 ldr \rp, =SIRFSOC_UART1_PA_BASE @ physical
14 ldr \rv, =SIRFSOC_UART1_VA_BASE @ virtual
15 .endm
16
17 .macro senduart,rd,rx
18 str \rd, [\rx, #SIRFSOC_UART_TXFIFO_DATA]
19 .endm
20
21 .macro busyuart,rd,rx
22 .endm
23
24 .macro waituart,rd,rx
251001: ldr \rd, [\rx, #SIRFSOC_UART_TXFIFO_STATUS]
26 tst \rd, #SIRFSOC_UART1_TXFIFO_EMPTY
27 beq 1001b
28 .endm
29
diff --git a/arch/arm/mach-prima2/include/mach/entry-macro.S b/arch/arm/mach-prima2/include/mach/entry-macro.S
deleted file mode 100644
index 86434e7a5be9..000000000000
--- a/arch/arm/mach-prima2/include/mach/entry-macro.S
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/entry-macro.S
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <mach/hardware.h>
10
11#define SIRFSOC_INT_ID 0x38
12
13 .macro get_irqnr_preamble, base, tmp
14 ldr \base, =sirfsoc_intc_base
15 ldr \base, [\base]
16 .endm
17
18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
19 ldr \irqnr, [\base, #SIRFSOC_INT_ID] @ Get the highest priority irq
20 cmp \irqnr, #0x40 @ the irq num can't be larger than 0x3f
21 movges \irqnr, #0
22 .endm
diff --git a/arch/arm/mach-prima2/include/mach/hardware.h b/arch/arm/mach-prima2/include/mach/hardware.h
deleted file mode 100644
index 105b96964f25..000000000000
--- a/arch/arm/mach-prima2/include/mach/hardware.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/hardware.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_HARDWARE_H__
10#define __MACH_HARDWARE_H__
11
12#include <asm/sizes.h>
13#include <mach/map.h>
14
15#endif
diff --git a/arch/arm/mach-prima2/include/mach/irqs.h b/arch/arm/mach-prima2/include/mach/irqs.h
deleted file mode 100644
index b778a0f248ed..000000000000
--- a/arch/arm/mach-prima2/include/mach/irqs.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/irqs.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __ASM_ARCH_IRQS_H
10#define __ASM_ARCH_IRQS_H
11
12#define SIRFSOC_INTENAL_IRQ_START 0
13#define SIRFSOC_INTENAL_IRQ_END 127
14#define SIRFSOC_GPIO_IRQ_START (SIRFSOC_INTENAL_IRQ_END + 1)
15#define NR_IRQS 288
16
17#endif
diff --git a/arch/arm/mach-prima2/include/mach/map.h b/arch/arm/mach-prima2/include/mach/map.h
deleted file mode 100644
index 6f243532570c..000000000000
--- a/arch/arm/mach-prima2/include/mach/map.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * memory & I/O static mapping definitions for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_PRIMA2_MAP_H__
10#define __MACH_PRIMA2_MAP_H__
11
12#include <linux/const.h>
13
14#define SIRFSOC_VA_BASE _AC(0xFEC00000, UL)
15
16#define SIRFSOC_VA(x) (SIRFSOC_VA_BASE + ((x) & 0x00FFF000))
17
18#endif
diff --git a/arch/arm/mach-prima2/include/mach/timex.h b/arch/arm/mach-prima2/include/mach/timex.h
deleted file mode 100644
index d6f98a75e562..000000000000
--- a/arch/arm/mach-prima2/include/mach/timex.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/timex.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_TIMEX_H__
10#define __MACH_TIMEX_H__
11
12#define CLOCK_TICK_RATE 1000000
13
14#endif
diff --git a/arch/arm/mach-prima2/include/mach/uncompress.h b/arch/arm/mach-prima2/include/mach/uncompress.h
deleted file mode 100644
index d1513a33709a..000000000000
--- a/arch/arm/mach-prima2/include/mach/uncompress.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/uncompress.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __ASM_ARCH_UNCOMPRESS_H
10#define __ASM_ARCH_UNCOMPRESS_H
11
12#include <linux/io.h>
13#include <mach/hardware.h>
14#include <mach/uart.h>
15
16void arch_decomp_setup(void)
17{
18}
19
20static __inline__ void putc(char c)
21{
22 /*
23 * during kernel decompression, all mappings are flat:
24 * virt_addr == phys_addr
25 */
26 if (!SIRFSOC_UART1_PA_BASE)
27 return;
28
29 while (__raw_readl((void __iomem *)SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_STATUS)
30 & SIRFSOC_UART1_TXFIFO_FULL)
31 barrier();
32
33 __raw_writel(c, (void __iomem *)SIRFSOC_UART1_PA_BASE + SIRFSOC_UART_TXFIFO_DATA);
34}
35
36static inline void flush(void)
37{
38}
39
40#endif
41
diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c
deleted file mode 100644
index 6c0f3e9c43fb..000000000000
--- a/arch/arm/mach-prima2/irq.c
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 * interrupt controller support for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/irq.h>
12#include <linux/of.h>
13#include <linux/of_address.h>
14#include <linux/irqdomain.h>
15#include <linux/syscore_ops.h>
16#include <asm/mach/irq.h>
17#include <asm/exception.h>
18#include <mach/hardware.h>
19
20#define SIRFSOC_INT_RISC_MASK0 0x0018
21#define SIRFSOC_INT_RISC_MASK1 0x001C
22#define SIRFSOC_INT_RISC_LEVEL0 0x0020
23#define SIRFSOC_INT_RISC_LEVEL1 0x0024
24#define SIRFSOC_INIT_IRQ_ID 0x0038
25
26void __iomem *sirfsoc_intc_base;
27
28static __init void
29sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
30{
31 struct irq_chip_generic *gc;
32 struct irq_chip_type *ct;
33
34 gc = irq_alloc_generic_chip("SIRFINTC", 1, irq_start, base, handle_level_irq);
35 ct = gc->chip_types;
36
37 ct->chip.irq_mask = irq_gc_mask_clr_bit;
38 ct->chip.irq_unmask = irq_gc_mask_set_bit;
39 ct->regs.mask = SIRFSOC_INT_RISC_MASK0;
40
41 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, 0);
42}
43
44static __init void sirfsoc_irq_init(void)
45{
46 sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32);
47 sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32,
48 SIRFSOC_INTENAL_IRQ_END + 1 - 32);
49
50 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0);
51 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1);
52
53 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK0);
54 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK1);
55}
56
57asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs)
58{
59 u32 irqstat, irqnr;
60
61 irqstat = readl_relaxed(sirfsoc_intc_base + SIRFSOC_INIT_IRQ_ID);
62 irqnr = irqstat & 0xff;
63
64 handle_IRQ(irqnr, regs);
65}
66
67static struct of_device_id intc_ids[] = {
68 { .compatible = "sirf,prima2-intc" },
69 {},
70};
71
72void __init sirfsoc_of_irq_init(void)
73{
74 struct device_node *np;
75
76 np = of_find_matching_node(NULL, intc_ids);
77 if (!np)
78 return;
79
80 sirfsoc_intc_base = of_iomap(np, 0);
81 if (!sirfsoc_intc_base)
82 panic("unable to map intc cpu registers\n");
83
84 irq_domain_add_legacy(np, SIRFSOC_INTENAL_IRQ_END + 1, 0, 0,
85 &irq_domain_simple_ops, NULL);
86
87 of_node_put(np);
88
89 sirfsoc_irq_init();
90}
91
92struct sirfsoc_irq_status {
93 u32 mask0;
94 u32 mask1;
95 u32 level0;
96 u32 level1;
97};
98
99static struct sirfsoc_irq_status sirfsoc_irq_st;
100
101static int sirfsoc_irq_suspend(void)
102{
103 sirfsoc_irq_st.mask0 = readl_relaxed(sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK0);
104 sirfsoc_irq_st.mask1 = readl_relaxed(sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK1);
105 sirfsoc_irq_st.level0 = readl_relaxed(sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0);
106 sirfsoc_irq_st.level1 = readl_relaxed(sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1);
107
108 return 0;
109}
110
111static void sirfsoc_irq_resume(void)
112{
113 writel_relaxed(sirfsoc_irq_st.mask0, sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK0);
114 writel_relaxed(sirfsoc_irq_st.mask1, sirfsoc_intc_base + SIRFSOC_INT_RISC_MASK1);
115 writel_relaxed(sirfsoc_irq_st.level0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0);
116 writel_relaxed(sirfsoc_irq_st.level1, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1);
117}
118
119static struct syscore_ops sirfsoc_irq_syscore_ops = {
120 .suspend = sirfsoc_irq_suspend,
121 .resume = sirfsoc_irq_resume,
122};
123
124static int __init sirfsoc_irq_pm_init(void)
125{
126 register_syscore_ops(&sirfsoc_irq_syscore_ops);
127 return 0;
128}
129device_initcall(sirfsoc_irq_pm_init);
diff --git a/arch/arm/mach-prima2/lluart.c b/arch/arm/mach-prima2/lluart.c
index a89f9b3c8cc5..99c0c927ca4a 100644
--- a/arch/arm/mach-prima2/lluart.c
+++ b/arch/arm/mach-prima2/lluart.c
@@ -9,8 +9,18 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <asm/page.h> 10#include <asm/page.h>
11#include <asm/mach/map.h> 11#include <asm/mach/map.h>
12#include <mach/map.h> 12#include "common.h"
13#include <mach/uart.h> 13
14#if defined(CONFIG_DEBUG_SIRFPRIMA2_UART1)
15#define SIRFSOC_UART1_PA_BASE 0xb0060000
16#elif defined(CONFIG_DEBUG_SIRFMARCO_UART1)
17#define SIRFSOC_UART1_PA_BASE 0xcc060000
18#else
19#define SIRFSOC_UART1_PA_BASE 0
20#endif
21
22#define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000)
23#define SIRFSOC_UART1_SIZE SZ_4K
14 24
15void __init sirfsoc_map_lluart(void) 25void __init sirfsoc_map_lluart(void)
16{ 26{
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c
index 4b788310f6a6..1c3de7bed841 100644
--- a/arch/arm/mach-prima2/platsmp.c
+++ b/arch/arm/mach-prima2/platsmp.c
@@ -11,14 +11,12 @@
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h> 13#include <linux/of_address.h>
14#include <linux/irqchip/arm-gic.h>
15#include <asm/page.h> 14#include <asm/page.h>
16#include <asm/mach/map.h> 15#include <asm/mach/map.h>
17#include <asm/smp_plat.h> 16#include <asm/smp_plat.h>
18#include <asm/smp_scu.h> 17#include <asm/smp_scu.h>
19#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
20#include <asm/cputype.h> 19#include <asm/cputype.h>
21#include <mach/map.h>
22 20
23#include "common.h" 21#include "common.h"
24 22
@@ -49,13 +47,6 @@ void __init sirfsoc_map_scu(void)
49static void __cpuinit sirfsoc_secondary_init(unsigned int cpu) 47static void __cpuinit sirfsoc_secondary_init(unsigned int cpu)
50{ 48{
51 /* 49 /*
52 * if any interrupts are already enabled for the primary
53 * core (e.g. timer irq), then they will not have been enabled
54 * for us: do so
55 */
56 gic_secondary_init(0);
57
58 /*
59 * let the primary processor know we're out of the 50 * let the primary processor know we're out of the
60 * pen, then head off into the C entry point 51 * pen, then head off into the C entry point
61 */ 52 */
diff --git a/arch/arm/mach-prima2/timer-marco.c b/arch/arm/mach-prima2/timer-marco.c
deleted file mode 100644
index f4eea2e97eb0..000000000000
--- a/arch/arm/mach-prima2/timer-marco.c
+++ /dev/null
@@ -1,316 +0,0 @@
1/*
2 * System timer for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/kernel.h>
10#include <linux/interrupt.h>
11#include <linux/clockchips.h>
12#include <linux/clocksource.h>
13#include <linux/bitops.h>
14#include <linux/irq.h>
15#include <linux/clk.h>
16#include <linux/slab.h>
17#include <linux/of.h>
18#include <linux/of_irq.h>
19#include <linux/of_address.h>
20#include <asm/sched_clock.h>
21#include <asm/localtimer.h>
22#include <asm/mach/time.h>
23
24#include "common.h"
25
26#define SIRFSOC_TIMER_32COUNTER_0_CTRL 0x0000
27#define SIRFSOC_TIMER_32COUNTER_1_CTRL 0x0004
28#define SIRFSOC_TIMER_MATCH_0 0x0018
29#define SIRFSOC_TIMER_MATCH_1 0x001c
30#define SIRFSOC_TIMER_COUNTER_0 0x0048
31#define SIRFSOC_TIMER_COUNTER_1 0x004c
32#define SIRFSOC_TIMER_INTR_STATUS 0x0060
33#define SIRFSOC_TIMER_WATCHDOG_EN 0x0064
34#define SIRFSOC_TIMER_64COUNTER_CTRL 0x0068
35#define SIRFSOC_TIMER_64COUNTER_LO 0x006c
36#define SIRFSOC_TIMER_64COUNTER_HI 0x0070
37#define SIRFSOC_TIMER_64COUNTER_LOAD_LO 0x0074
38#define SIRFSOC_TIMER_64COUNTER_LOAD_HI 0x0078
39#define SIRFSOC_TIMER_64COUNTER_RLATCHED_LO 0x007c
40#define SIRFSOC_TIMER_64COUNTER_RLATCHED_HI 0x0080
41
42#define SIRFSOC_TIMER_REG_CNT 6
43
44static const u32 sirfsoc_timer_reg_list[SIRFSOC_TIMER_REG_CNT] = {
45 SIRFSOC_TIMER_WATCHDOG_EN,
46 SIRFSOC_TIMER_32COUNTER_0_CTRL,
47 SIRFSOC_TIMER_32COUNTER_1_CTRL,
48 SIRFSOC_TIMER_64COUNTER_CTRL,
49 SIRFSOC_TIMER_64COUNTER_RLATCHED_LO,
50 SIRFSOC_TIMER_64COUNTER_RLATCHED_HI,
51};
52
53static u32 sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT];
54
55static void __iomem *sirfsoc_timer_base;
56static void __init sirfsoc_of_timer_map(void);
57
58/* disable count and interrupt */
59static inline void sirfsoc_timer_count_disable(int idx)
60{
61 writel_relaxed(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL + 4 * idx) & ~0x7,
62 sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL + 4 * idx);
63}
64
65/* enable count and interrupt */
66static inline void sirfsoc_timer_count_enable(int idx)
67{
68 writel_relaxed(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL + 4 * idx) | 0x7,
69 sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL + 4 * idx);
70}
71
72/* timer interrupt handler */
73static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
74{
75 struct clock_event_device *ce = dev_id;
76 int cpu = smp_processor_id();
77
78 /* clear timer interrupt */
79 writel_relaxed(BIT(cpu), sirfsoc_timer_base + SIRFSOC_TIMER_INTR_STATUS);
80
81 if (ce->mode == CLOCK_EVT_MODE_ONESHOT)
82 sirfsoc_timer_count_disable(cpu);
83
84 ce->event_handler(ce);
85
86 return IRQ_HANDLED;
87}
88
89/* read 64-bit timer counter */
90static cycle_t sirfsoc_timer_read(struct clocksource *cs)
91{
92 u64 cycles;
93
94 writel_relaxed((readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL) |
95 BIT(0)) & ~BIT(1), sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL);
96
97 cycles = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_RLATCHED_HI);
98 cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_RLATCHED_LO);
99
100 return cycles;
101}
102
103static int sirfsoc_timer_set_next_event(unsigned long delta,
104 struct clock_event_device *ce)
105{
106 int cpu = smp_processor_id();
107
108 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_0 +
109 4 * cpu);
110 writel_relaxed(delta, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0 +
111 4 * cpu);
112
113 /* enable the tick */
114 sirfsoc_timer_count_enable(cpu);
115
116 return 0;
117}
118
119static void sirfsoc_timer_set_mode(enum clock_event_mode mode,
120 struct clock_event_device *ce)
121{
122 switch (mode) {
123 case CLOCK_EVT_MODE_ONESHOT:
124 /* enable in set_next_event */
125 break;
126 default:
127 break;
128 }
129
130 sirfsoc_timer_count_disable(smp_processor_id());
131}
132
133static void sirfsoc_clocksource_suspend(struct clocksource *cs)
134{
135 int i;
136
137 for (i = 0; i < SIRFSOC_TIMER_REG_CNT; i++)
138 sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
139}
140
141static void sirfsoc_clocksource_resume(struct clocksource *cs)
142{
143 int i;
144
145 for (i = 0; i < SIRFSOC_TIMER_REG_CNT - 2; i++)
146 writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
147
148 writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2],
149 sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_LOAD_LO);
150 writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1],
151 sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_LOAD_HI);
152
153 writel_relaxed(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL) |
154 BIT(1) | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL);
155}
156
157static struct clock_event_device sirfsoc_clockevent = {
158 .name = "sirfsoc_clockevent",
159 .rating = 200,
160 .features = CLOCK_EVT_FEAT_ONESHOT,
161 .set_mode = sirfsoc_timer_set_mode,
162 .set_next_event = sirfsoc_timer_set_next_event,
163};
164
165static struct clocksource sirfsoc_clocksource = {
166 .name = "sirfsoc_clocksource",
167 .rating = 200,
168 .mask = CLOCKSOURCE_MASK(64),
169 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
170 .read = sirfsoc_timer_read,
171 .suspend = sirfsoc_clocksource_suspend,
172 .resume = sirfsoc_clocksource_resume,
173};
174
175static struct irqaction sirfsoc_timer_irq = {
176 .name = "sirfsoc_timer0",
177 .flags = IRQF_TIMER | IRQF_NOBALANCING,
178 .handler = sirfsoc_timer_interrupt,
179 .dev_id = &sirfsoc_clockevent,
180};
181
182#ifdef CONFIG_LOCAL_TIMERS
183
184static struct irqaction sirfsoc_timer1_irq = {
185 .name = "sirfsoc_timer1",
186 .flags = IRQF_TIMER | IRQF_NOBALANCING,
187 .handler = sirfsoc_timer_interrupt,
188};
189
190static int __cpuinit sirfsoc_local_timer_setup(struct clock_event_device *ce)
191{
192 /* Use existing clock_event for cpu 0 */
193 if (!smp_processor_id())
194 return 0;
195
196 ce->irq = sirfsoc_timer1_irq.irq;
197 ce->name = "local_timer";
198 ce->features = sirfsoc_clockevent.features;
199 ce->rating = sirfsoc_clockevent.rating;
200 ce->set_mode = sirfsoc_timer_set_mode;
201 ce->set_next_event = sirfsoc_timer_set_next_event;
202 ce->shift = sirfsoc_clockevent.shift;
203 ce->mult = sirfsoc_clockevent.mult;
204 ce->max_delta_ns = sirfsoc_clockevent.max_delta_ns;
205 ce->min_delta_ns = sirfsoc_clockevent.min_delta_ns;
206
207 sirfsoc_timer1_irq.dev_id = ce;
208 BUG_ON(setup_irq(ce->irq, &sirfsoc_timer1_irq));
209 irq_set_affinity(sirfsoc_timer1_irq.irq, cpumask_of(1));
210
211 clockevents_register_device(ce);
212 return 0;
213}
214
215static void sirfsoc_local_timer_stop(struct clock_event_device *ce)
216{
217 sirfsoc_timer_count_disable(1);
218
219 remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq);
220}
221
222static struct local_timer_ops sirfsoc_local_timer_ops __cpuinitdata = {
223 .setup = sirfsoc_local_timer_setup,
224 .stop = sirfsoc_local_timer_stop,
225};
226#endif /* CONFIG_LOCAL_TIMERS */
227
228static void __init sirfsoc_clockevent_init(void)
229{
230 clockevents_calc_mult_shift(&sirfsoc_clockevent, CLOCK_TICK_RATE, 60);
231
232 sirfsoc_clockevent.max_delta_ns =
233 clockevent_delta2ns(-2, &sirfsoc_clockevent);
234 sirfsoc_clockevent.min_delta_ns =
235 clockevent_delta2ns(2, &sirfsoc_clockevent);
236
237 sirfsoc_clockevent.cpumask = cpumask_of(0);
238 clockevents_register_device(&sirfsoc_clockevent);
239#ifdef CONFIG_LOCAL_TIMERS
240 local_timer_register(&sirfsoc_local_timer_ops);
241#endif
242}
243
244/* initialize the kernel jiffy timer source */
245void __init sirfsoc_marco_timer_init(void)
246{
247 unsigned long rate;
248 u32 timer_div;
249 struct clk *clk;
250
251 /* initialize clocking early, we want to set the OS timer */
252 sirfsoc_of_clk_init();
253
254 /* timer's input clock is io clock */
255 clk = clk_get_sys("io", NULL);
256
257 BUG_ON(IS_ERR(clk));
258 rate = clk_get_rate(clk);
259
260 BUG_ON(rate < CLOCK_TICK_RATE);
261 BUG_ON(rate % CLOCK_TICK_RATE);
262
263 sirfsoc_of_timer_map();
264
265 /* Initialize the timer dividers */
266 timer_div = rate / CLOCK_TICK_RATE - 1;
267 writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL);
268 writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_0_CTRL);
269 writel_relaxed(timer_div << 16, sirfsoc_timer_base + SIRFSOC_TIMER_32COUNTER_1_CTRL);
270
271 /* Initialize timer counters to 0 */
272 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_LOAD_LO);
273 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_LOAD_HI);
274 writel_relaxed(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL) |
275 BIT(1) | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_64COUNTER_CTRL);
276 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_0);
277 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_1);
278
279 /* Clear all interrupts */
280 writel_relaxed(0xFFFF, sirfsoc_timer_base + SIRFSOC_TIMER_INTR_STATUS);
281
282 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE));
283
284 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
285
286 sirfsoc_clockevent_init();
287}
288
289static struct of_device_id timer_ids[] = {
290 { .compatible = "sirf,marco-tick" },
291 {},
292};
293
294static void __init sirfsoc_of_timer_map(void)
295{
296 struct device_node *np;
297
298 np = of_find_matching_node(NULL, timer_ids);
299 if (!np)
300 return;
301 sirfsoc_timer_base = of_iomap(np, 0);
302 if (!sirfsoc_timer_base)
303 panic("unable to map timer cpu registers\n");
304
305 sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0);
306 if (!sirfsoc_timer_irq.irq)
307 panic("No irq passed for timer0 via DT\n");
308
309#ifdef CONFIG_LOCAL_TIMERS
310 sirfsoc_timer1_irq.irq = irq_of_parse_and_map(np, 1);
311 if (!sirfsoc_timer1_irq.irq)
312 panic("No irq passed for timer1 via DT\n");
313#endif
314
315 of_node_put(np);
316}
diff --git a/arch/arm/mach-prima2/timer-prima2.c b/arch/arm/mach-prima2/timer-prima2.c
deleted file mode 100644
index 6da584f8a949..000000000000
--- a/arch/arm/mach-prima2/timer-prima2.c
+++ /dev/null
@@ -1,241 +0,0 @@
1/*
2 * System timer for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/kernel.h>
10#include <linux/interrupt.h>
11#include <linux/clockchips.h>
12#include <linux/clocksource.h>
13#include <linux/bitops.h>
14#include <linux/irq.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/slab.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <mach/map.h>
21#include <asm/sched_clock.h>
22#include <asm/mach/time.h>
23
24#include "common.h"
25
26#define SIRFSOC_TIMER_COUNTER_LO 0x0000
27#define SIRFSOC_TIMER_COUNTER_HI 0x0004
28#define SIRFSOC_TIMER_MATCH_0 0x0008
29#define SIRFSOC_TIMER_MATCH_1 0x000C
30#define SIRFSOC_TIMER_MATCH_2 0x0010
31#define SIRFSOC_TIMER_MATCH_3 0x0014
32#define SIRFSOC_TIMER_MATCH_4 0x0018
33#define SIRFSOC_TIMER_MATCH_5 0x001C
34#define SIRFSOC_TIMER_STATUS 0x0020
35#define SIRFSOC_TIMER_INT_EN 0x0024
36#define SIRFSOC_TIMER_WATCHDOG_EN 0x0028
37#define SIRFSOC_TIMER_DIV 0x002C
38#define SIRFSOC_TIMER_LATCH 0x0030
39#define SIRFSOC_TIMER_LATCHED_LO 0x0034
40#define SIRFSOC_TIMER_LATCHED_HI 0x0038
41
42#define SIRFSOC_TIMER_WDT_INDEX 5
43
44#define SIRFSOC_TIMER_LATCH_BIT BIT(0)
45
46#define SIRFSOC_TIMER_REG_CNT 11
47
48static const u32 sirfsoc_timer_reg_list[SIRFSOC_TIMER_REG_CNT] = {
49 SIRFSOC_TIMER_MATCH_0, SIRFSOC_TIMER_MATCH_1, SIRFSOC_TIMER_MATCH_2,
50 SIRFSOC_TIMER_MATCH_3, SIRFSOC_TIMER_MATCH_4, SIRFSOC_TIMER_MATCH_5,
51 SIRFSOC_TIMER_INT_EN, SIRFSOC_TIMER_WATCHDOG_EN, SIRFSOC_TIMER_DIV,
52 SIRFSOC_TIMER_LATCHED_LO, SIRFSOC_TIMER_LATCHED_HI,
53};
54
55static u32 sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT];
56
57static void __iomem *sirfsoc_timer_base;
58static void __init sirfsoc_of_timer_map(void);
59
60/* timer0 interrupt handler */
61static irqreturn_t sirfsoc_timer_interrupt(int irq, void *dev_id)
62{
63 struct clock_event_device *ce = dev_id;
64
65 WARN_ON(!(readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_STATUS) & BIT(0)));
66
67 /* clear timer0 interrupt */
68 writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS);
69
70 ce->event_handler(ce);
71
72 return IRQ_HANDLED;
73}
74
75/* read 64-bit timer counter */
76static cycle_t sirfsoc_timer_read(struct clocksource *cs)
77{
78 u64 cycles;
79
80 /* latch the 64-bit timer counter */
81 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
82 cycles = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_HI);
83 cycles = (cycles << 32) | readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
84
85 return cycles;
86}
87
88static int sirfsoc_timer_set_next_event(unsigned long delta,
89 struct clock_event_device *ce)
90{
91 unsigned long now, next;
92
93 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
94 now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
95 next = now + delta;
96 writel_relaxed(next, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0);
97 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
98 now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
99
100 return next - now > delta ? -ETIME : 0;
101}
102
103static void sirfsoc_timer_set_mode(enum clock_event_mode mode,
104 struct clock_event_device *ce)
105{
106 u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
107 switch (mode) {
108 case CLOCK_EVT_MODE_PERIODIC:
109 WARN_ON(1);
110 break;
111 case CLOCK_EVT_MODE_ONESHOT:
112 writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
113 break;
114 case CLOCK_EVT_MODE_SHUTDOWN:
115 writel_relaxed(val & ~BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
116 break;
117 case CLOCK_EVT_MODE_UNUSED:
118 case CLOCK_EVT_MODE_RESUME:
119 break;
120 }
121}
122
123static void sirfsoc_clocksource_suspend(struct clocksource *cs)
124{
125 int i;
126
127 writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH);
128
129 for (i = 0; i < SIRFSOC_TIMER_REG_CNT; i++)
130 sirfsoc_timer_reg_val[i] = readl_relaxed(sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
131}
132
133static void sirfsoc_clocksource_resume(struct clocksource *cs)
134{
135 int i;
136
137 for (i = 0; i < SIRFSOC_TIMER_REG_CNT - 2; i++)
138 writel_relaxed(sirfsoc_timer_reg_val[i], sirfsoc_timer_base + sirfsoc_timer_reg_list[i]);
139
140 writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 2], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
141 writel_relaxed(sirfsoc_timer_reg_val[SIRFSOC_TIMER_REG_CNT - 1], sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
142}
143
144static struct clock_event_device sirfsoc_clockevent = {
145 .name = "sirfsoc_clockevent",
146 .rating = 200,
147 .features = CLOCK_EVT_FEAT_ONESHOT,
148 .set_mode = sirfsoc_timer_set_mode,
149 .set_next_event = sirfsoc_timer_set_next_event,
150};
151
152static struct clocksource sirfsoc_clocksource = {
153 .name = "sirfsoc_clocksource",
154 .rating = 200,
155 .mask = CLOCKSOURCE_MASK(64),
156 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
157 .read = sirfsoc_timer_read,
158 .suspend = sirfsoc_clocksource_suspend,
159 .resume = sirfsoc_clocksource_resume,
160};
161
162static struct irqaction sirfsoc_timer_irq = {
163 .name = "sirfsoc_timer0",
164 .flags = IRQF_TIMER,
165 .irq = 0,
166 .handler = sirfsoc_timer_interrupt,
167 .dev_id = &sirfsoc_clockevent,
168};
169
170/* Overwrite weak default sched_clock with more precise one */
171static u32 notrace sirfsoc_read_sched_clock(void)
172{
173 return (u32)(sirfsoc_timer_read(NULL) & 0xffffffff);
174}
175
176static void __init sirfsoc_clockevent_init(void)
177{
178 sirfsoc_clockevent.cpumask = cpumask_of(0);
179 clockevents_config_and_register(&sirfsoc_clockevent, CLOCK_TICK_RATE,
180 2, -2);
181}
182
183/* initialize the kernel jiffy timer source */
184void __init sirfsoc_prima2_timer_init(void)
185{
186 unsigned long rate;
187 struct clk *clk;
188
189 /* initialize clocking early, we want to set the OS timer */
190 sirfsoc_of_clk_init();
191
192 /* timer's input clock is io clock */
193 clk = clk_get_sys("io", NULL);
194
195 BUG_ON(IS_ERR(clk));
196
197 rate = clk_get_rate(clk);
198
199 BUG_ON(rate < CLOCK_TICK_RATE);
200 BUG_ON(rate % CLOCK_TICK_RATE);
201
202 sirfsoc_of_timer_map();
203
204 writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV);
205 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
206 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
207 writel_relaxed(BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_STATUS);
208
209 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE));
210
211 setup_sched_clock(sirfsoc_read_sched_clock, 32, CLOCK_TICK_RATE);
212
213 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
214
215 sirfsoc_clockevent_init();
216}
217
218static struct of_device_id timer_ids[] = {
219 { .compatible = "sirf,prima2-tick" },
220 {},
221};
222
223static void __init sirfsoc_of_timer_map(void)
224{
225 struct device_node *np;
226 const unsigned int *intspec;
227
228 np = of_find_matching_node(NULL, timer_ids);
229 if (!np)
230 return;
231 sirfsoc_timer_base = of_iomap(np, 0);
232 if (!sirfsoc_timer_base)
233 panic("unable to map timer cpu registers\n");
234
235 /* Get the interrupts property */
236 intspec = of_get_property(np, "interrupts", NULL);
237 BUG_ON(!intspec);
238 sirfsoc_timer_irq.irq = be32_to_cpup(intspec);
239
240 of_node_put(np);
241}
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 86eec4159cbc..9075461999c1 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -51,11 +51,13 @@ config MACH_LITTLETON
51config MACH_TAVOREVB 51config MACH_TAVOREVB
52 bool "PXA930 Evaluation Board (aka TavorEVB)" 52 bool "PXA930 Evaluation Board (aka TavorEVB)"
53 select CPU_PXA930 53 select CPU_PXA930
54 select CPU_PXA935
54 select PXA3xx 55 select PXA3xx
55 56
56config MACH_SAAR 57config MACH_SAAR
57 bool "PXA930 Handheld Platform (aka SAAR)" 58 bool "PXA930 Handheld Platform (aka SAAR)"
58 select CPU_PXA930 59 select CPU_PXA930
60 select CPU_PXA935
59 select PXA3xx 61 select PXA3xx
60 62
61comment "Third Party Dev Platforms (sorted by vendor name)" 63comment "Third Party Dev Platforms (sorted by vendor name)"
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 12c500558387..648867a8caa8 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -7,12 +7,6 @@ obj-y += clock.o devices.o generic.o irq.o \
7 time.o reset.o 7 time.o reset.o
8obj-$(CONFIG_PM) += pm.o sleep.o standby.o 8obj-$(CONFIG_PM) += pm.o sleep.o standby.o
9 9
10ifeq ($(CONFIG_CPU_FREQ),y)
11obj-$(CONFIG_PXA25x) += cpufreq-pxa2xx.o
12obj-$(CONFIG_PXA27x) += cpufreq-pxa2xx.o
13obj-$(CONFIG_PXA3xx) += cpufreq-pxa3xx.o
14endif
15
16# Generic drivers that other drivers may depend upon 10# Generic drivers that other drivers may depend upon
17 11
18# SoC-specific code 12# SoC-specific code
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
deleted file mode 100644
index 6a7aeab42f6c..000000000000
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ /dev/null
@@ -1,494 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/cpufreq-pxa2xx.c
3 *
4 * Copyright (C) 2002,2003 Intrinsyc Software
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * History:
21 * 31-Jul-2002 : Initial version [FB]
22 * 29-Jan-2003 : added PXA255 support [FB]
23 * 20-Apr-2003 : ported to v2.5 (Dustin McIntire, Sensoria Corp.)
24 *
25 * Note:
26 * This driver may change the memory bus clock rate, but will not do any
27 * platform specific access timing changes... for example if you have flash
28 * memory connected to CS0, you will need to register a platform specific
29 * notifier which will adjust the memory access strobes to maintain a
30 * minimum strobe width.
31 *
32 */
33
34#include <linux/kernel.h>
35#include <linux/module.h>
36#include <linux/sched.h>
37#include <linux/init.h>
38#include <linux/cpufreq.h>
39#include <linux/err.h>
40#include <linux/regulator/consumer.h>
41#include <linux/io.h>
42
43#include <mach/pxa2xx-regs.h>
44#include <mach/smemc.h>
45
46#ifdef DEBUG
47static unsigned int freq_debug;
48module_param(freq_debug, uint, 0);
49MODULE_PARM_DESC(freq_debug, "Set the debug messages to on=1/off=0");
50#else
51#define freq_debug 0
52#endif
53
54static struct regulator *vcc_core;
55
56static unsigned int pxa27x_maxfreq;
57module_param(pxa27x_maxfreq, uint, 0);
58MODULE_PARM_DESC(pxa27x_maxfreq, "Set the pxa27x maxfreq in MHz"
59 "(typically 624=>pxa270, 416=>pxa271, 520=>pxa272)");
60
61typedef struct {
62 unsigned int khz;
63 unsigned int membus;
64 unsigned int cccr;
65 unsigned int div2;
66 unsigned int cclkcfg;
67 int vmin;
68 int vmax;
69} pxa_freqs_t;
70
71/* Define the refresh period in mSec for the SDRAM and the number of rows */
72#define SDRAM_TREF 64 /* standard 64ms SDRAM */
73static unsigned int sdram_rows;
74
75#define CCLKCFG_TURBO 0x1
76#define CCLKCFG_FCS 0x2
77#define CCLKCFG_HALFTURBO 0x4
78#define CCLKCFG_FASTBUS 0x8
79#define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2)
80#define MDREFR_DRI_MASK 0xFFF
81
82#define MDCNFG_DRAC2(mdcnfg) (((mdcnfg) >> 21) & 0x3)
83#define MDCNFG_DRAC0(mdcnfg) (((mdcnfg) >> 5) & 0x3)
84
85/*
86 * PXA255 definitions
87 */
88/* Use the run mode frequencies for the CPUFREQ_POLICY_PERFORMANCE policy */
89#define CCLKCFG CCLKCFG_TURBO | CCLKCFG_FCS
90
91static pxa_freqs_t pxa255_run_freqs[] =
92{
93 /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */
94 { 99500, 99500, 0x121, 1, CCLKCFG, -1, -1}, /* 99, 99, 50, 50 */
95 {132700, 132700, 0x123, 1, CCLKCFG, -1, -1}, /* 133, 133, 66, 66 */
96 {199100, 99500, 0x141, 0, CCLKCFG, -1, -1}, /* 199, 199, 99, 99 */
97 {265400, 132700, 0x143, 1, CCLKCFG, -1, -1}, /* 265, 265, 133, 66 */
98 {331800, 165900, 0x145, 1, CCLKCFG, -1, -1}, /* 331, 331, 166, 83 */
99 {398100, 99500, 0x161, 0, CCLKCFG, -1, -1}, /* 398, 398, 196, 99 */
100};
101
102/* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */
103static pxa_freqs_t pxa255_turbo_freqs[] =
104{
105 /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */
106 { 99500, 99500, 0x121, 1, CCLKCFG, -1, -1}, /* 99, 99, 50, 50 */
107 {199100, 99500, 0x221, 0, CCLKCFG, -1, -1}, /* 99, 199, 50, 99 */
108 {298500, 99500, 0x321, 0, CCLKCFG, -1, -1}, /* 99, 287, 50, 99 */
109 {298600, 99500, 0x1c1, 0, CCLKCFG, -1, -1}, /* 199, 287, 99, 99 */
110 {398100, 99500, 0x241, 0, CCLKCFG, -1, -1}, /* 199, 398, 99, 99 */
111};
112
113#define NUM_PXA25x_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs)
114#define NUM_PXA25x_TURBO_FREQS ARRAY_SIZE(pxa255_turbo_freqs)
115
116static struct cpufreq_frequency_table
117 pxa255_run_freq_table[NUM_PXA25x_RUN_FREQS+1];
118static struct cpufreq_frequency_table
119 pxa255_turbo_freq_table[NUM_PXA25x_TURBO_FREQS+1];
120
121static unsigned int pxa255_turbo_table;
122module_param(pxa255_turbo_table, uint, 0);
123MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table, !0 = turbo table)");
124
125/*
126 * PXA270 definitions
127 *
128 * For the PXA27x:
129 * Control variables are A, L, 2N for CCCR; B, HT, T for CLKCFG.
130 *
131 * A = 0 => memory controller clock from table 3-7,
132 * A = 1 => memory controller clock = system bus clock
133 * Run mode frequency = 13 MHz * L
134 * Turbo mode frequency = 13 MHz * L * N
135 * System bus frequency = 13 MHz * L / (B + 1)
136 *
137 * In CCCR:
138 * A = 1
139 * L = 16 oscillator to run mode ratio
140 * 2N = 6 2 * (turbo mode to run mode ratio)
141 *
142 * In CCLKCFG:
143 * B = 1 Fast bus mode
144 * HT = 0 Half-Turbo mode
145 * T = 1 Turbo mode
146 *
147 * For now, just support some of the combinations in table 3-7 of
148 * PXA27x Processor Family Developer's Manual to simplify frequency
149 * change sequences.
150 */
151#define PXA27x_CCCR(A, L, N2) (A << 25 | N2 << 7 | L)
152#define CCLKCFG2(B, HT, T) \
153 (CCLKCFG_FCS | \
154 ((B) ? CCLKCFG_FASTBUS : 0) | \
155 ((HT) ? CCLKCFG_HALFTURBO : 0) | \
156 ((T) ? CCLKCFG_TURBO : 0))
157
158static pxa_freqs_t pxa27x_freqs[] = {
159 {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 },
160 {156000, 104000, PXA27x_CCCR(1, 8, 3), 0, CCLKCFG2(1, 0, 1), 1000000, 1705000 },
161 {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 },
162 {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 },
163 {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 },
164 {520000, 208000, PXA27x_CCCR(1, 16, 5), 1, CCLKCFG2(1, 0, 1), 1450000, 1705000 },
165 {624000, 208000, PXA27x_CCCR(1, 16, 6), 1, CCLKCFG2(1, 0, 1), 1550000, 1705000 }
166};
167
168#define NUM_PXA27x_FREQS ARRAY_SIZE(pxa27x_freqs)
169static struct cpufreq_frequency_table
170 pxa27x_freq_table[NUM_PXA27x_FREQS+1];
171
172extern unsigned get_clk_frequency_khz(int info);
173
174#ifdef CONFIG_REGULATOR
175
176static int pxa_cpufreq_change_voltage(pxa_freqs_t *pxa_freq)
177{
178 int ret = 0;
179 int vmin, vmax;
180
181 if (!cpu_is_pxa27x())
182 return 0;
183
184 vmin = pxa_freq->vmin;
185 vmax = pxa_freq->vmax;
186 if ((vmin == -1) || (vmax == -1))
187 return 0;
188
189 ret = regulator_set_voltage(vcc_core, vmin, vmax);
190 if (ret)
191 pr_err("cpufreq: Failed to set vcc_core in [%dmV..%dmV]\n",
192 vmin, vmax);
193 return ret;
194}
195
196static __init void pxa_cpufreq_init_voltages(void)
197{
198 vcc_core = regulator_get(NULL, "vcc_core");
199 if (IS_ERR(vcc_core)) {
200 pr_info("cpufreq: Didn't find vcc_core regulator\n");
201 vcc_core = NULL;
202 } else {
203 pr_info("cpufreq: Found vcc_core regulator\n");
204 }
205}
206#else
207static int pxa_cpufreq_change_voltage(pxa_freqs_t *pxa_freq)
208{
209 return 0;
210}
211
212static __init void pxa_cpufreq_init_voltages(void) { }
213#endif
214
215static void find_freq_tables(struct cpufreq_frequency_table **freq_table,
216 pxa_freqs_t **pxa_freqs)
217{
218 if (cpu_is_pxa25x()) {
219 if (!pxa255_turbo_table) {
220 *pxa_freqs = pxa255_run_freqs;
221 *freq_table = pxa255_run_freq_table;
222 } else {
223 *pxa_freqs = pxa255_turbo_freqs;
224 *freq_table = pxa255_turbo_freq_table;
225 }
226 }
227 if (cpu_is_pxa27x()) {
228 *pxa_freqs = pxa27x_freqs;
229 *freq_table = pxa27x_freq_table;
230 }
231}
232
233static void pxa27x_guess_max_freq(void)
234{
235 if (!pxa27x_maxfreq) {
236 pxa27x_maxfreq = 416000;
237 printk(KERN_INFO "PXA CPU 27x max frequency not defined "
238 "(pxa27x_maxfreq), assuming pxa271 with %dkHz maxfreq\n",
239 pxa27x_maxfreq);
240 } else {
241 pxa27x_maxfreq *= 1000;
242 }
243}
244
245static void init_sdram_rows(void)
246{
247 uint32_t mdcnfg = __raw_readl(MDCNFG);
248 unsigned int drac2 = 0, drac0 = 0;
249
250 if (mdcnfg & (MDCNFG_DE2 | MDCNFG_DE3))
251 drac2 = MDCNFG_DRAC2(mdcnfg);
252
253 if (mdcnfg & (MDCNFG_DE0 | MDCNFG_DE1))
254 drac0 = MDCNFG_DRAC0(mdcnfg);
255
256 sdram_rows = 1 << (11 + max(drac0, drac2));
257}
258
259static u32 mdrefr_dri(unsigned int freq)
260{
261 u32 interval = freq * SDRAM_TREF / sdram_rows;
262
263 return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32;
264}
265
266/* find a valid frequency point */
267static int pxa_verify_policy(struct cpufreq_policy *policy)
268{
269 struct cpufreq_frequency_table *pxa_freqs_table;
270 pxa_freqs_t *pxa_freqs;
271 int ret;
272
273 find_freq_tables(&pxa_freqs_table, &pxa_freqs);
274 ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table);
275
276 if (freq_debug)
277 pr_debug("Verified CPU policy: %dKhz min to %dKhz max\n",
278 policy->min, policy->max);
279
280 return ret;
281}
282
283static unsigned int pxa_cpufreq_get(unsigned int cpu)
284{
285 return get_clk_frequency_khz(0);
286}
287
288static int pxa_set_target(struct cpufreq_policy *policy,
289 unsigned int target_freq,
290 unsigned int relation)
291{
292 struct cpufreq_frequency_table *pxa_freqs_table;
293 pxa_freqs_t *pxa_freq_settings;
294 struct cpufreq_freqs freqs;
295 unsigned int idx;
296 unsigned long flags;
297 unsigned int new_freq_cpu, new_freq_mem;
298 unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg;
299 int ret = 0;
300
301 /* Get the current policy */
302 find_freq_tables(&pxa_freqs_table, &pxa_freq_settings);
303
304 /* Lookup the next frequency */
305 if (cpufreq_frequency_table_target(policy, pxa_freqs_table,
306 target_freq, relation, &idx)) {
307 return -EINVAL;
308 }
309
310 new_freq_cpu = pxa_freq_settings[idx].khz;
311 new_freq_mem = pxa_freq_settings[idx].membus;
312 freqs.old = policy->cur;
313 freqs.new = new_freq_cpu;
314 freqs.cpu = policy->cpu;
315
316 if (freq_debug)
317 pr_debug("Changing CPU frequency to %d Mhz, (SDRAM %d Mhz)\n",
318 freqs.new / 1000, (pxa_freq_settings[idx].div2) ?
319 (new_freq_mem / 2000) : (new_freq_mem / 1000));
320
321 if (vcc_core && freqs.new > freqs.old)
322 ret = pxa_cpufreq_change_voltage(&pxa_freq_settings[idx]);
323 if (ret)
324 return ret;
325 /*
326 * Tell everyone what we're about to do...
327 * you should add a notify client with any platform specific
328 * Vcc changing capability
329 */
330 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
331
332 /* Calculate the next MDREFR. If we're slowing down the SDRAM clock
333 * we need to preset the smaller DRI before the change. If we're
334 * speeding up we need to set the larger DRI value after the change.
335 */
336 preset_mdrefr = postset_mdrefr = __raw_readl(MDREFR);
337 if ((preset_mdrefr & MDREFR_DRI_MASK) > mdrefr_dri(new_freq_mem)) {
338 preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK);
339 preset_mdrefr |= mdrefr_dri(new_freq_mem);
340 }
341 postset_mdrefr =
342 (postset_mdrefr & ~MDREFR_DRI_MASK) | mdrefr_dri(new_freq_mem);
343
344 /* If we're dividing the memory clock by two for the SDRAM clock, this
345 * must be set prior to the change. Clearing the divide must be done
346 * after the change.
347 */
348 if (pxa_freq_settings[idx].div2) {
349 preset_mdrefr |= MDREFR_DB2_MASK;
350 postset_mdrefr |= MDREFR_DB2_MASK;
351 } else {
352 postset_mdrefr &= ~MDREFR_DB2_MASK;
353 }
354
355 local_irq_save(flags);
356
357 /* Set new the CCCR and prepare CCLKCFG */
358 CCCR = pxa_freq_settings[idx].cccr;
359 cclkcfg = pxa_freq_settings[idx].cclkcfg;
360
361 asm volatile(" \n\
362 ldr r4, [%1] /* load MDREFR */ \n\
363 b 2f \n\
364 .align 5 \n\
3651: \n\
366 str %3, [%1] /* preset the MDREFR */ \n\
367 mcr p14, 0, %2, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\
368 str %4, [%1] /* postset the MDREFR */ \n\
369 \n\
370 b 3f \n\
3712: b 1b \n\
3723: nop \n\
373 "
374 : "=&r" (unused)
375 : "r" (MDREFR), "r" (cclkcfg),
376 "r" (preset_mdrefr), "r" (postset_mdrefr)
377 : "r4", "r5");
378 local_irq_restore(flags);
379
380 /*
381 * Tell everyone what we've just done...
382 * you should add a notify client with any platform specific
383 * SDRAM refresh timer adjustments
384 */
385 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
386
387 /*
388 * Even if voltage setting fails, we don't report it, as the frequency
389 * change succeeded. The voltage reduction is not a critical failure,
390 * only power savings will suffer from this.
391 *
392 * Note: if the voltage change fails, and a return value is returned, a
393 * bug is triggered (seems a deadlock). Should anybody find out where,
394 * the "return 0" should become a "return ret".
395 */
396 if (vcc_core && freqs.new < freqs.old)
397 ret = pxa_cpufreq_change_voltage(&pxa_freq_settings[idx]);
398
399 return 0;
400}
401
402static int pxa_cpufreq_init(struct cpufreq_policy *policy)
403{
404 int i;
405 unsigned int freq;
406 struct cpufreq_frequency_table *pxa255_freq_table;
407 pxa_freqs_t *pxa255_freqs;
408
409 /* try to guess pxa27x cpu */
410 if (cpu_is_pxa27x())
411 pxa27x_guess_max_freq();
412
413 pxa_cpufreq_init_voltages();
414
415 init_sdram_rows();
416
417 /* set default policy and cpuinfo */
418 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */
419 policy->cur = get_clk_frequency_khz(0); /* current freq */
420 policy->min = policy->max = policy->cur;
421
422 /* Generate pxa25x the run cpufreq_frequency_table struct */
423 for (i = 0; i < NUM_PXA25x_RUN_FREQS; i++) {
424 pxa255_run_freq_table[i].frequency = pxa255_run_freqs[i].khz;
425 pxa255_run_freq_table[i].index = i;
426 }
427 pxa255_run_freq_table[i].frequency = CPUFREQ_TABLE_END;
428
429 /* Generate pxa25x the turbo cpufreq_frequency_table struct */
430 for (i = 0; i < NUM_PXA25x_TURBO_FREQS; i++) {
431 pxa255_turbo_freq_table[i].frequency =
432 pxa255_turbo_freqs[i].khz;
433 pxa255_turbo_freq_table[i].index = i;
434 }
435 pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END;
436
437 pxa255_turbo_table = !!pxa255_turbo_table;
438
439 /* Generate the pxa27x cpufreq_frequency_table struct */
440 for (i = 0; i < NUM_PXA27x_FREQS; i++) {
441 freq = pxa27x_freqs[i].khz;
442 if (freq > pxa27x_maxfreq)
443 break;
444 pxa27x_freq_table[i].frequency = freq;
445 pxa27x_freq_table[i].index = i;
446 }
447 pxa27x_freq_table[i].index = i;
448 pxa27x_freq_table[i].frequency = CPUFREQ_TABLE_END;
449
450 /*
451 * Set the policy's minimum and maximum frequencies from the tables
452 * just constructed. This sets cpuinfo.mxx_freq, min and max.
453 */
454 if (cpu_is_pxa25x()) {
455 find_freq_tables(&pxa255_freq_table, &pxa255_freqs);
456 pr_info("PXA255 cpufreq using %s frequency table\n",
457 pxa255_turbo_table ? "turbo" : "run");
458 cpufreq_frequency_table_cpuinfo(policy, pxa255_freq_table);
459 }
460 else if (cpu_is_pxa27x())
461 cpufreq_frequency_table_cpuinfo(policy, pxa27x_freq_table);
462
463 printk(KERN_INFO "PXA CPU frequency change support initialized\n");
464
465 return 0;
466}
467
468static struct cpufreq_driver pxa_cpufreq_driver = {
469 .verify = pxa_verify_policy,
470 .target = pxa_set_target,
471 .init = pxa_cpufreq_init,
472 .get = pxa_cpufreq_get,
473 .name = "PXA2xx",
474};
475
476static int __init pxa_cpu_init(void)
477{
478 int ret = -ENODEV;
479 if (cpu_is_pxa25x() || cpu_is_pxa27x())
480 ret = cpufreq_register_driver(&pxa_cpufreq_driver);
481 return ret;
482}
483
484static void __exit pxa_cpu_exit(void)
485{
486 cpufreq_unregister_driver(&pxa_cpufreq_driver);
487}
488
489
490MODULE_AUTHOR("Intrinsyc Software Inc.");
491MODULE_DESCRIPTION("CPU frequency changing driver for the PXA architecture");
492MODULE_LICENSE("GPL");
493module_init(pxa_cpu_init);
494module_exit(pxa_cpu_exit);
diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
deleted file mode 100644
index b85b4ab7aac6..000000000000
--- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2 * linux/arch/arm/mach-pxa/cpufreq-pxa3xx.c
3 *
4 * Copyright (C) 2008 Marvell International Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/sched.h>
15#include <linux/init.h>
16#include <linux/cpufreq.h>
17#include <linux/slab.h>
18#include <linux/io.h>
19
20#include <mach/pxa3xx-regs.h>
21
22#include "generic.h"
23
24#define HSS_104M (0)
25#define HSS_156M (1)
26#define HSS_208M (2)
27#define HSS_312M (3)
28
29#define SMCFS_78M (0)
30#define SMCFS_104M (2)
31#define SMCFS_208M (5)
32
33#define SFLFS_104M (0)
34#define SFLFS_156M (1)
35#define SFLFS_208M (2)
36#define SFLFS_312M (3)
37
38#define XSPCLK_156M (0)
39#define XSPCLK_NONE (3)
40
41#define DMCFS_26M (0)
42#define DMCFS_260M (3)
43
44struct pxa3xx_freq_info {
45 unsigned int cpufreq_mhz;
46 unsigned int core_xl : 5;
47 unsigned int core_xn : 3;
48 unsigned int hss : 2;
49 unsigned int dmcfs : 2;
50 unsigned int smcfs : 3;
51 unsigned int sflfs : 2;
52 unsigned int df_clkdiv : 3;
53
54 int vcc_core; /* in mV */
55 int vcc_sram; /* in mV */
56};
57
58#define OP(cpufreq, _xl, _xn, _hss, _dmc, _smc, _sfl, _dfi, vcore, vsram) \
59{ \
60 .cpufreq_mhz = cpufreq, \
61 .core_xl = _xl, \
62 .core_xn = _xn, \
63 .hss = HSS_##_hss##M, \
64 .dmcfs = DMCFS_##_dmc##M, \
65 .smcfs = SMCFS_##_smc##M, \
66 .sflfs = SFLFS_##_sfl##M, \
67 .df_clkdiv = _dfi, \
68 .vcc_core = vcore, \
69 .vcc_sram = vsram, \
70}
71
72static struct pxa3xx_freq_info pxa300_freqs[] = {
73 /* CPU XL XN HSS DMEM SMEM SRAM DFI VCC_CORE VCC_SRAM */
74 OP(104, 8, 1, 104, 260, 78, 104, 3, 1000, 1100), /* 104MHz */
75 OP(208, 16, 1, 104, 260, 104, 156, 2, 1000, 1100), /* 208MHz */
76 OP(416, 16, 2, 156, 260, 104, 208, 2, 1100, 1200), /* 416MHz */
77 OP(624, 24, 2, 208, 260, 208, 312, 3, 1375, 1400), /* 624MHz */
78};
79
80static struct pxa3xx_freq_info pxa320_freqs[] = {
81 /* CPU XL XN HSS DMEM SMEM SRAM DFI VCC_CORE VCC_SRAM */
82 OP(104, 8, 1, 104, 260, 78, 104, 3, 1000, 1100), /* 104MHz */
83 OP(208, 16, 1, 104, 260, 104, 156, 2, 1000, 1100), /* 208MHz */
84 OP(416, 16, 2, 156, 260, 104, 208, 2, 1100, 1200), /* 416MHz */
85 OP(624, 24, 2, 208, 260, 208, 312, 3, 1375, 1400), /* 624MHz */
86 OP(806, 31, 2, 208, 260, 208, 312, 3, 1400, 1400), /* 806MHz */
87};
88
89static unsigned int pxa3xx_freqs_num;
90static struct pxa3xx_freq_info *pxa3xx_freqs;
91static struct cpufreq_frequency_table *pxa3xx_freqs_table;
92
93static int setup_freqs_table(struct cpufreq_policy *policy,
94 struct pxa3xx_freq_info *freqs, int num)
95{
96 struct cpufreq_frequency_table *table;
97 int i;
98
99 table = kzalloc((num + 1) * sizeof(*table), GFP_KERNEL);
100 if (table == NULL)
101 return -ENOMEM;
102
103 for (i = 0; i < num; i++) {
104 table[i].index = i;
105 table[i].frequency = freqs[i].cpufreq_mhz * 1000;
106 }
107 table[num].index = i;
108 table[num].frequency = CPUFREQ_TABLE_END;
109
110 pxa3xx_freqs = freqs;
111 pxa3xx_freqs_num = num;
112 pxa3xx_freqs_table = table;
113
114 return cpufreq_frequency_table_cpuinfo(policy, table);
115}
116
117static void __update_core_freq(struct pxa3xx_freq_info *info)
118{
119 uint32_t mask = ACCR_XN_MASK | ACCR_XL_MASK;
120 uint32_t accr = ACCR;
121 uint32_t xclkcfg;
122
123 accr &= ~(ACCR_XN_MASK | ACCR_XL_MASK | ACCR_XSPCLK_MASK);
124 accr |= ACCR_XN(info->core_xn) | ACCR_XL(info->core_xl);
125
126 /* No clock until core PLL is re-locked */
127 accr |= ACCR_XSPCLK(XSPCLK_NONE);
128
129 xclkcfg = (info->core_xn == 2) ? 0x3 : 0x2; /* turbo bit */
130
131 ACCR = accr;
132 __asm__("mcr p14, 0, %0, c6, c0, 0\n" : : "r"(xclkcfg));
133
134 while ((ACSR & mask) != (accr & mask))
135 cpu_relax();
136}
137
138static void __update_bus_freq(struct pxa3xx_freq_info *info)
139{
140 uint32_t mask;
141 uint32_t accr = ACCR;
142
143 mask = ACCR_SMCFS_MASK | ACCR_SFLFS_MASK | ACCR_HSS_MASK |
144 ACCR_DMCFS_MASK;
145
146 accr &= ~mask;
147 accr |= ACCR_SMCFS(info->smcfs) | ACCR_SFLFS(info->sflfs) |
148 ACCR_HSS(info->hss) | ACCR_DMCFS(info->dmcfs);
149
150 ACCR = accr;
151
152 while ((ACSR & mask) != (accr & mask))
153 cpu_relax();
154}
155
156static int pxa3xx_cpufreq_verify(struct cpufreq_policy *policy)
157{
158 return cpufreq_frequency_table_verify(policy, pxa3xx_freqs_table);
159}
160
161static unsigned int pxa3xx_cpufreq_get(unsigned int cpu)
162{
163 return pxa3xx_get_clk_frequency_khz(0);
164}
165
166static int pxa3xx_cpufreq_set(struct cpufreq_policy *policy,
167 unsigned int target_freq,
168 unsigned int relation)
169{
170 struct pxa3xx_freq_info *next;
171 struct cpufreq_freqs freqs;
172 unsigned long flags;
173 int idx;
174
175 if (policy->cpu != 0)
176 return -EINVAL;
177
178 /* Lookup the next frequency */
179 if (cpufreq_frequency_table_target(policy, pxa3xx_freqs_table,
180 target_freq, relation, &idx))
181 return -EINVAL;
182
183 next = &pxa3xx_freqs[idx];
184
185 freqs.old = policy->cur;
186 freqs.new = next->cpufreq_mhz * 1000;
187 freqs.cpu = policy->cpu;
188
189 pr_debug("CPU frequency from %d MHz to %d MHz%s\n",
190 freqs.old / 1000, freqs.new / 1000,
191 (freqs.old == freqs.new) ? " (skipped)" : "");
192
193 if (freqs.old == target_freq)
194 return 0;
195
196 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
197
198 local_irq_save(flags);
199 __update_core_freq(next);
200 __update_bus_freq(next);
201 local_irq_restore(flags);
202
203 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
204
205 return 0;
206}
207
208static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy)
209{
210 int ret = -EINVAL;
211
212 /* set default policy and cpuinfo */
213 policy->cpuinfo.min_freq = 104000;
214 policy->cpuinfo.max_freq = (cpu_is_pxa320()) ? 806000 : 624000;
215 policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */
216 policy->max = pxa3xx_get_clk_frequency_khz(0);
217 policy->cur = policy->min = policy->max;
218
219 if (cpu_is_pxa300() || cpu_is_pxa310())
220 ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa300_freqs));
221
222 if (cpu_is_pxa320())
223 ret = setup_freqs_table(policy, ARRAY_AND_SIZE(pxa320_freqs));
224
225 if (ret) {
226 pr_err("failed to setup frequency table\n");
227 return ret;
228 }
229
230 pr_info("CPUFREQ support for PXA3xx initialized\n");
231 return 0;
232}
233
234static struct cpufreq_driver pxa3xx_cpufreq_driver = {
235 .verify = pxa3xx_cpufreq_verify,
236 .target = pxa3xx_cpufreq_set,
237 .init = pxa3xx_cpufreq_init,
238 .get = pxa3xx_cpufreq_get,
239 .name = "pxa3xx-cpufreq",
240};
241
242static int __init cpufreq_init(void)
243{
244 if (cpu_is_pxa3xx())
245 return cpufreq_register_driver(&pxa3xx_cpufreq_driver);
246
247 return 0;
248}
249module_init(cpufreq_init);
250
251static void __exit cpufreq_exit(void)
252{
253 cpufreq_unregister_driver(&pxa3xx_cpufreq_driver);
254}
255module_exit(cpufreq_exit);
256
257MODULE_DESCRIPTION("CPU frequency scaling driver for PXA3xx");
258MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index daa86d39ed9e..666094315ab1 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -1107,8 +1107,33 @@ struct resource pxa_resource_gpio[] = {
1107 }, 1107 },
1108}; 1108};
1109 1109
1110struct platform_device pxa_device_gpio = { 1110struct platform_device pxa25x_device_gpio = {
1111 .name = "pxa-gpio", 1111#ifdef CONFIG_CPU_PXA26x
1112 .name = "pxa26x-gpio",
1113#else
1114 .name = "pxa25x-gpio",
1115#endif
1116 .id = -1,
1117 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1118 .resource = pxa_resource_gpio,
1119};
1120
1121struct platform_device pxa27x_device_gpio = {
1122 .name = "pxa27x-gpio",
1123 .id = -1,
1124 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1125 .resource = pxa_resource_gpio,
1126};
1127
1128struct platform_device pxa3xx_device_gpio = {
1129 .name = "pxa3xx-gpio",
1130 .id = -1,
1131 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1132 .resource = pxa_resource_gpio,
1133};
1134
1135struct platform_device pxa93x_device_gpio = {
1136 .name = "pxa93x-gpio",
1112 .id = -1, 1137 .id = -1,
1113 .num_resources = ARRAY_SIZE(pxa_resource_gpio), 1138 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1114 .resource = pxa_resource_gpio, 1139 .resource = pxa_resource_gpio,
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 1475db107254..0f3fd0d65b12 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -16,7 +16,6 @@ extern struct platform_device pxa_device_ficp;
16extern struct platform_device sa1100_device_rtc; 16extern struct platform_device sa1100_device_rtc;
17extern struct platform_device pxa_device_rtc; 17extern struct platform_device pxa_device_rtc;
18extern struct platform_device pxa_device_ac97; 18extern struct platform_device pxa_device_ac97;
19extern struct platform_device pxa_device_gpio;
20 19
21extern struct platform_device pxa27x_device_i2c_power; 20extern struct platform_device pxa27x_device_i2c_power;
22extern struct platform_device pxa27x_device_ohci; 21extern struct platform_device pxa27x_device_ohci;
@@ -46,4 +45,9 @@ extern struct platform_device pxa_device_asoc_ssp2;
46extern struct platform_device pxa_device_asoc_ssp3; 45extern struct platform_device pxa_device_asoc_ssp3;
47extern struct platform_device pxa_device_asoc_ssp4; 46extern struct platform_device pxa_device_asoc_ssp4;
48 47
48extern struct platform_device pxa25x_device_gpio;
49extern struct platform_device pxa27x_device_gpio;
50extern struct platform_device pxa3xx_device_gpio;
51extern struct platform_device pxa93x_device_gpio;
52
49void __init pxa_register_device(struct platform_device *dev, void *data); 53void __init pxa_register_device(struct platform_device *dev, void *data);
diff --git a/arch/arm/mach-pxa/include/mach/debug-macro.S b/arch/arm/mach-pxa/include/mach/debug-macro.S
deleted file mode 100644
index 70b112e8ef68..000000000000
--- a/arch/arm/mach-pxa/include/mach/debug-macro.S
+++ /dev/null
@@ -1,23 +0,0 @@
1/* arch/arm/mach-pxa/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#include "hardware.h"
15
16 .macro addruart, rp, rv, tmp
17 mov \rp, #0x00100000
18 orr \rv, \rp, #io_p2v(0x40000000) @ virtual
19 orr \rp, \rp, #0x40000000 @ physical
20 .endm
21
22#define UART_SHIFT 2
23#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-pxa/include/mach/generic.h b/arch/arm/mach-pxa/include/mach/generic.h
new file mode 100644
index 000000000000..665542e0c9e2
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/generic.h
@@ -0,0 +1 @@
#include "../../generic.h"
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 3f5171eaf67b..f2c28972084d 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -208,7 +208,11 @@ static struct clk_lookup pxa25x_clkregs[] = {
208 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"), 208 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), 209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), 210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
211 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), 211#ifdef CONFIG_CPU_PXA26x
212 INIT_CLKREG(&clk_dummy, "pxa26x-gpio", NULL),
213#else
214 INIT_CLKREG(&clk_dummy, "pxa25x-gpio", NULL),
215#endif
212 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 216 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
213}; 217};
214 218
@@ -340,7 +344,8 @@ void __init pxa25x_map_io(void)
340} 344}
341 345
342static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = { 346static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = {
343 .gpio_set_wake = gpio_set_wake, 347 .irq_base = PXA_GPIO_TO_IRQ(0),
348 .gpio_set_wake = gpio_set_wake,
344}; 349};
345 350
346static struct platform_device *pxa25x_devices[] __initdata = { 351static struct platform_device *pxa25x_devices[] __initdata = {
@@ -375,7 +380,7 @@ static int __init pxa25x_init(void)
375 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 380 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
376 register_syscore_ops(&pxa2xx_clock_syscore_ops); 381 register_syscore_ops(&pxa2xx_clock_syscore_ops);
377 382
378 pxa_register_device(&pxa_device_gpio, &pxa25x_gpio_info); 383 pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
379 ret = platform_add_devices(pxa25x_devices, 384 ret = platform_add_devices(pxa25x_devices,
380 ARRAY_SIZE(pxa25x_devices)); 385 ARRAY_SIZE(pxa25x_devices));
381 if (ret) 386 if (ret)
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 3203a9f5b4a2..301471a07a10 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -237,7 +237,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
237 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"), 237 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
238 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), 238 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
239 INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), 239 INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL),
240 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), 240 INIT_CLKREG(&clk_dummy, "pxa27x-gpio", NULL),
241 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 241 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
242}; 242};
243 243
@@ -431,7 +431,8 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
431} 431}
432 432
433static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { 433static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
434 .gpio_set_wake = gpio_set_wake, 434 .irq_base = PXA_GPIO_TO_IRQ(0),
435 .gpio_set_wake = gpio_set_wake,
435}; 436};
436 437
437static struct platform_device *devices[] __initdata = { 438static struct platform_device *devices[] __initdata = {
@@ -470,7 +471,7 @@ static int __init pxa27x_init(void)
470 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 471 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
471 register_syscore_ops(&pxa2xx_clock_syscore_ops); 472 register_syscore_ops(&pxa2xx_clock_syscore_ops);
472 473
473 pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info); 474 pxa_register_device(&pxa27x_device_gpio, &pxa27x_gpio_info);
474 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 475 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
475 } 476 }
476 477
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 656a1bb16d14..87011f3de69d 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/gpio-pxa.h>
18#include <linux/pm.h> 19#include <linux/pm.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/irq.h> 21#include <linux/irq.h>
@@ -92,7 +93,8 @@ static struct clk_lookup pxa3xx_clkregs[] = {
92 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL), 93 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
93 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), 94 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
94 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), 95 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL),
95 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), 96 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa3xx-gpio", NULL),
97 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa93x-gpio", NULL),
96 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), 98 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
97}; 99};
98 100
@@ -435,8 +437,11 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
435 pxa_register_device(&pxa3xx_device_i2c_power, info); 437 pxa_register_device(&pxa3xx_device_i2c_power, info);
436} 438}
437 439
440static struct pxa_gpio_platform_data pxa3xx_gpio_pdata = {
441 .irq_base = PXA_GPIO_TO_IRQ(0),
442};
443
438static struct platform_device *devices[] __initdata = { 444static struct platform_device *devices[] __initdata = {
439 &pxa_device_gpio,
440 &pxa27x_device_udc, 445 &pxa27x_device_udc,
441 &pxa_device_pmu, 446 &pxa_device_pmu,
442 &pxa_device_i2s, 447 &pxa_device_i2s,
@@ -482,8 +487,18 @@ static int __init pxa3xx_init(void)
482 register_syscore_ops(&pxa3xx_mfp_syscore_ops); 487 register_syscore_ops(&pxa3xx_mfp_syscore_ops);
483 register_syscore_ops(&pxa3xx_clock_syscore_ops); 488 register_syscore_ops(&pxa3xx_clock_syscore_ops);
484 489
485 if (!of_have_populated_dt()) 490 if (of_have_populated_dt())
486 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 491 return 0;
492
493 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
494 if (ret)
495 return ret;
496 if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320()) {
497 platform_device_add_data(&pxa3xx_device_gpio,
498 &pxa3xx_gpio_pdata,
499 sizeof(pxa3xx_gpio_pdata));
500 ret = platform_device_register(&pxa3xx_device_gpio);
501 }
487 } 502 }
488 503
489 return ret; 504 return ret;
diff --git a/arch/arm/mach-pxa/pxa930.c b/arch/arm/mach-pxa/pxa930.c
index 8aeacf908784..ab624487cf39 100644
--- a/arch/arm/mach-pxa/pxa930.c
+++ b/arch/arm/mach-pxa/pxa930.c
@@ -12,12 +12,15 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/irq.h>
17#include <linux/gpio-pxa.h>
18#include <linux/platform_device.h>
18 19
19#include <mach/pxa930.h> 20#include <mach/pxa930.h>
20 21
22#include "devices.h"
23
21static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = { 24static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
22 25
23 MFP_ADDR(GPIO0, 0x02e0), 26 MFP_ADDR(GPIO0, 0x02e0),
@@ -190,11 +193,21 @@ static struct mfp_addr_map pxa935_mfp_addr_map[] __initdata = {
190 MFP_ADDR_END, 193 MFP_ADDR_END,
191}; 194};
192 195
196static struct pxa_gpio_platform_data pxa93x_gpio_pdata = {
197 .irq_base = PXA_GPIO_TO_IRQ(0),
198};
199
193static int __init pxa930_init(void) 200static int __init pxa930_init(void)
194{ 201{
202 int ret = 0;
203
195 if (cpu_is_pxa93x()) { 204 if (cpu_is_pxa93x()) {
196 mfp_init_base(io_p2v(MFPR_BASE)); 205 mfp_init_base(io_p2v(MFPR_BASE));
197 mfp_init_addr(pxa930_mfp_addr_map); 206 mfp_init_addr(pxa930_mfp_addr_map);
207 platform_device_add_data(&pxa93x_device_gpio,
208 &pxa93x_gpio_pdata,
209 sizeof(pxa93x_gpio_pdata));
210 ret = platform_device_register(&pxa93x_device_gpio);
198 } 211 }
199 212
200 if (cpu_is_pxa935()) 213 if (cpu_is_pxa935())
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index 14c1d47e1abf..d210c0f9c2c4 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -12,6 +12,8 @@ config REALVIEW_EB_A9MP
12 bool "Support Multicore Cortex-A9 Tile" 12 bool "Support Multicore Cortex-A9 Tile"
13 depends on MACH_REALVIEW_EB 13 depends on MACH_REALVIEW_EB
14 select CPU_V7 14 select CPU_V7
15 select HAVE_ARM_SCU if SMP
16 select HAVE_ARM_TWD if LOCAL_TIMERS
15 select HAVE_SMP 17 select HAVE_SMP
16 select MIGHT_HAVE_CACHE_L2X0 18 select MIGHT_HAVE_CACHE_L2X0
17 help 19 help
@@ -23,6 +25,8 @@ config REALVIEW_EB_ARM11MP
23 depends on MACH_REALVIEW_EB 25 depends on MACH_REALVIEW_EB
24 select ARCH_HAS_BARRIERS if SMP 26 select ARCH_HAS_BARRIERS if SMP
25 select CPU_V6K 27 select CPU_V6K
28 select HAVE_ARM_SCU if SMP
29 select HAVE_ARM_TWD if LOCAL_TIMERS
26 select HAVE_SMP 30 select HAVE_SMP
27 select MIGHT_HAVE_CACHE_L2X0 31 select MIGHT_HAVE_CACHE_L2X0
28 help 32 help
@@ -43,6 +47,8 @@ config MACH_REALVIEW_PB11MP
43 select ARCH_HAS_BARRIERS if SMP 47 select ARCH_HAS_BARRIERS if SMP
44 select ARM_GIC 48 select ARM_GIC
45 select CPU_V6K 49 select CPU_V6K
50 select HAVE_ARM_SCU if SMP
51 select HAVE_ARM_TWD if LOCAL_TIMERS
46 select HAVE_PATA_PLATFORM 52 select HAVE_PATA_PLATFORM
47 select HAVE_SMP 53 select HAVE_SMP
48 select MIGHT_HAVE_CACHE_L2X0 54 select MIGHT_HAVE_CACHE_L2X0
@@ -85,6 +91,8 @@ config MACH_REALVIEW_PBX
85 bool "Support RealView(R) Platform Baseboard Explore" 91 bool "Support RealView(R) Platform Baseboard Explore"
86 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET 92 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET
87 select ARM_GIC 93 select ARM_GIC
94 select HAVE_ARM_SCU if SMP
95 select HAVE_ARM_TWD if LOCAL_TIMERS
88 select HAVE_PATA_PLATFORM 96 select HAVE_PATA_PLATFORM
89 select HAVE_SMP 97 select HAVE_SMP
90 select MIGHT_HAVE_CACHE_L2X0 98 select MIGHT_HAVE_CACHE_L2X0
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index 53818e5cd3ad..ac22dd41b135 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -12,7 +12,6 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h>
16#include <asm/cp15.h> 15#include <asm/cp15.h>
17#include <asm/smp_plat.h> 16#include <asm/smp_plat.h>
18 17
@@ -20,7 +19,6 @@ static inline void cpu_enter_lowpower(void)
20{ 19{
21 unsigned int v; 20 unsigned int v;
22 21
23 flush_cache_all();
24 asm volatile( 22 asm volatile(
25 " mcr p15, 0, %1, c7, c5, 0\n" 23 " mcr p15, 0, %1, c7, c5, 0\n"
26 " mcr p15, 0, %1, c7, c10, 4\n" 24 " mcr p15, 0, %1, c7, c10, 4\n"
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 37f513d1588e..f2f7088bfd22 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -30,29 +30,30 @@ config CPU_S3C2410
30 select S3C2410_CLOCK 30 select S3C2410_CLOCK
31 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX 31 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX
32 select S3C2410_PM if PM 32 select S3C2410_PM if PM
33 select SAMSUNG_HRT
33 help 34 help
34 Support for S3C2410 and S3C2410A family from the S3C24XX line 35 Support for S3C2410 and S3C2410A family from the S3C24XX line
35 of Samsung Mobile CPUs. 36 of Samsung Mobile CPUs.
36 37
37config CPU_S3C2412 38config CPU_S3C2412
38 bool "SAMSUNG S3C2412" 39 bool "SAMSUNG S3C2412"
39 depends on ARCH_S3C24XX
40 select CPU_ARM926T 40 select CPU_ARM926T
41 select CPU_LLSERIAL_S3C2440 41 select CPU_LLSERIAL_S3C2440
42 select S3C2412_DMA if S3C24XX_DMA 42 select S3C2412_DMA if S3C24XX_DMA
43 select S3C2412_PM if PM 43 select S3C2412_PM if PM
44 select SAMSUNG_HRT
44 help 45 help
45 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line 46 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
46 47
47config CPU_S3C2416 48config CPU_S3C2416
48 bool "SAMSUNG S3C2416/S3C2450" 49 bool "SAMSUNG S3C2416/S3C2450"
49 depends on ARCH_S3C24XX
50 select CPU_ARM926T 50 select CPU_ARM926T
51 select CPU_LLSERIAL_S3C2440 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
54 select S3C2443_DMA if S3C24XX_DMA 54 select S3C2443_DMA if S3C24XX_DMA
55 select SAMSUNG_CLKSRC 55 select SAMSUNG_CLKSRC
56 select SAMSUNG_HRT
56 help 57 help
57 Support for the S3C2416 SoC from the S3C24XX line 58 Support for the S3C2416 SoC from the S3C24XX line
58 59
@@ -63,6 +64,7 @@ config CPU_S3C2440
63 select S3C2410_CLOCK 64 select S3C2410_CLOCK
64 select S3C2410_PM if PM 65 select S3C2410_PM if PM
65 select S3C2440_DMA if S3C24XX_DMA 66 select S3C2440_DMA if S3C24XX_DMA
67 select SAMSUNG_HRT
66 help 68 help
67 Support for S3C2440 Samsung Mobile CPU based systems. 69 Support for S3C2440 Samsung Mobile CPU based systems.
68 70
@@ -72,6 +74,7 @@ config CPU_S3C2442
72 select CPU_LLSERIAL_S3C2440 74 select CPU_LLSERIAL_S3C2440
73 select S3C2410_CLOCK 75 select S3C2410_CLOCK
74 select S3C2410_PM if PM 76 select S3C2410_PM if PM
77 select SAMSUNG_HRT
75 help 78 help
76 Support for S3C2442 Samsung Mobile CPU based systems. 79 Support for S3C2442 Samsung Mobile CPU based systems.
77 80
@@ -81,12 +84,12 @@ config CPU_S3C244X
81 84
82config CPU_S3C2443 85config CPU_S3C2443
83 bool "SAMSUNG S3C2443" 86 bool "SAMSUNG S3C2443"
84 depends on ARCH_S3C24XX
85 select CPU_ARM920T 87 select CPU_ARM920T
86 select CPU_LLSERIAL_S3C2440 88 select CPU_LLSERIAL_S3C2440
87 select S3C2443_COMMON 89 select S3C2443_COMMON
88 select S3C2443_DMA if S3C24XX_DMA 90 select S3C2443_DMA if S3C24XX_DMA
89 select SAMSUNG_CLKSRC 91 select SAMSUNG_CLKSRC
92 select SAMSUNG_HRT
90 help 93 help
91 Support for the S3C2443 SoC from the S3C24XX line 94 Support for the S3C2443 SoC from the S3C24XX line
92 95
@@ -133,7 +136,6 @@ config S3C24XX_SETUP_TS
133 136
134config S3C24XX_DMA 137config S3C24XX_DMA
135 bool "S3C2410 DMA support" 138 bool "S3C2410 DMA support"
136 depends on ARCH_S3C24XX
137 select S3C_DMA 139 select S3C_DMA
138 help 140 help
139 S3C2410 DMA support. This is needed for drivers like sound which 141 S3C2410 DMA support. This is needed for drivers like sound which
@@ -142,7 +144,7 @@ config S3C24XX_DMA
142 144
143config S3C2410_DMA_DEBUG 145config S3C2410_DMA_DEBUG
144 bool "S3C2410 DMA support debug" 146 bool "S3C2410 DMA support debug"
145 depends on ARCH_S3C24XX && S3C2410_DMA 147 depends on S3C2410_DMA
146 help 148 help
147 Enable debugging output for the DMA code. This option sends info 149 Enable debugging output for the DMA code. This option sends info
148 to the kernel log, at priority KERN_DEBUG. 150 to the kernel log, at priority KERN_DEBUG.
@@ -233,7 +235,7 @@ if CPU_S3C2410
233 235
234config S3C2410_CPUFREQ 236config S3C2410_CPUFREQ
235 bool 237 bool
236 depends on CPU_FREQ_S3C24XX && CPU_S3C2410 238 depends on CPU_FREQ_S3C24XX
237 select S3C2410_CPUFREQ_UTILS 239 select S3C2410_CPUFREQ_UTILS
238 help 240 help
239 CPU Frequency scaling support for S3C2410 241 CPU Frequency scaling support for S3C2410
@@ -320,7 +322,6 @@ config PM_H1940
320 322
321config MACH_N30 323config MACH_N30
322 bool "Acer N30 family" 324 bool "Acer N30 family"
323 select MACH_N35
324 select S3C_DEV_NAND 325 select S3C_DEV_NAND
325 select S3C_DEV_USB_HOST 326 select S3C_DEV_USB_HOST
326 help 327 help
@@ -380,14 +381,13 @@ if CPU_S3C2412
380 381
381config CPU_S3C2412_ONLY 382config CPU_S3C2412_ONLY
382 bool 383 bool
383 depends on ARCH_S3C24XX && !CPU_S3C2410 && \ 384 depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \
384 !CPU_S3C2416 && !CPU_S3C2440 && !CPU_S3C2442 && \ 385 !CPU_S3C2442 && !CPU_S3C2443
385 !CPU_S3C2443 && CPU_S3C2412
386 default y 386 default y
387 387
388config S3C2412_CPUFREQ 388config S3C2412_CPUFREQ
389 bool 389 bool
390 depends on CPU_FREQ_S3C24XX && CPU_S3C2412 390 depends on CPU_FREQ_S3C24XX
391 default y 391 default y
392 select S3C2412_IOTIMING 392 select S3C2412_IOTIMING
393 help 393 help
@@ -401,6 +401,7 @@ config S3C2412_DMA
401config S3C2412_PM 401config S3C2412_PM
402 bool 402 bool
403 select S3C2412_PM_SLEEP 403 select S3C2412_PM_SLEEP
404 select SAMSUNG_WAKEMASK
404 help 405 help
405 Internal config node to apply S3C2412 power management 406 Internal config node to apply S3C2412 power management
406 407
@@ -642,7 +643,6 @@ comment "S3C2442 Boards"
642config MACH_NEO1973_GTA02 643config MACH_NEO1973_GTA02
643 bool "Openmoko GTA02 / Freerunner phone" 644 bool "Openmoko GTA02 / Freerunner phone"
644 select I2C 645 select I2C
645 select MACH_NEO1973
646 select MFD_PCF50633 646 select MFD_PCF50633
647 select PCF50633_GPIO 647 select PCF50633_GPIO
648 select POWER_SUPPLY 648 select POWER_SUPPLY
@@ -663,10 +663,7 @@ config MACH_RX1950
663 help 663 help
664 Say Y here if you're using HP iPAQ rx1950 664 Say Y here if you're using HP iPAQ rx1950
665 665
666config SMDK2440_CPU2442 666endif # CPU_S3C2442
667 bool "SMDM2440 with S3C2442 CPU module"
668
669endif # CPU_S3C2440
670 667
671if CPU_S3C2443 || CPU_S3C2416 668if CPU_S3C2443 || CPU_S3C2416
672 669
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
index af53d27d5c36..6f46ecfc8396 100644
--- a/arch/arm/mach-s3c24xx/Makefile
+++ b/arch/arm/mach-s3c24xx/Makefile
@@ -14,7 +14,7 @@ obj- :=
14 14
15# core 15# core
16 16
17obj-y += common.o irq.o 17obj-y += common.o
18 18
19obj-$(CONFIG_CPU_S3C2410) += s3c2410.o 19obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
20obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o 20obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o
@@ -22,7 +22,7 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o
22obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o 22obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o
23obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o 23obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o
24 24
25obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o 25obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o
26obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o 26obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o
27obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o 27obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o
28obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o 28obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o
@@ -31,9 +31,9 @@ obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
31obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o 31obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o
32obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o 32obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o
33 33
34obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o 34obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o
35obj-$(CONFIG_CPU_S3C2442) += s3c2442.o 35obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
36obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o 36obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o
37obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o 37obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o
38obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o 38obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o
39obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o 39obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c
index c0daa9590b4c..cb1b791954de 100644
--- a/arch/arm/mach-s3c24xx/bast-irq.c
+++ b/arch/arm/mach-s3c24xx/bast-irq.c
@@ -34,8 +34,6 @@
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/regs-irq.h> 35#include <mach/regs-irq.h>
36 36
37#include <plat/irq.h>
38
39#include "bast.h" 37#include "bast.h"
40 38
41#define irqdbf(x...) 39#define irqdbf(x...)
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2410.c b/arch/arm/mach-s3c24xx/clock-s3c2410.c
index 641266f3d152..34fffdf6fc1d 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2410.c
@@ -40,7 +40,6 @@
40#include <mach/regs-clock.h> 40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h> 41#include <mach/regs-gpio.h>
42 42
43#include <plat/s3c2410.h>
44#include <plat/clock.h> 43#include <plat/clock.h>
45#include <plat/cpu.h> 44#include <plat/cpu.h>
46 45
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2412.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c
index d10b695a9066..2cc017da88fe 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2412.c
@@ -41,7 +41,6 @@
41#include <mach/regs-clock.h> 41#include <mach/regs-clock.h>
42#include <mach/regs-gpio.h> 42#include <mach/regs-gpio.h>
43 43
44#include <plat/s3c2412.h>
45#include <plat/clock.h> 44#include <plat/clock.h>
46#include <plat/cpu.h> 45#include <plat/cpu.h>
47 46
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2416.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c
index 14a81c2317a4..036056cea57c 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2416.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2416.c
@@ -14,7 +14,6 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16 16
17#include <plat/s3c2416.h>
18#include <plat/clock.h> 17#include <plat/clock.h>
19#include <plat/clock-clksrc.h> 18#include <plat/clock-clksrc.h>
20#include <plat/cpu.h> 19#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
index 04b87ec92537..1069b5680826 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c
@@ -123,6 +123,11 @@ static struct clk s3c2440_clk_ac97 = {
123 .ctrlbit = S3C2440_CLKCON_AC97, 123 .ctrlbit = S3C2440_CLKCON_AC97,
124}; 124};
125 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
126static unsigned long s3c2440_fclk_n_getrate(struct clk *clk) 131static unsigned long s3c2440_fclk_n_getrate(struct clk *clk)
127{ 132{
128 unsigned long ucon0, ucon1, ucon2, divisor; 133 unsigned long ucon0, ucon1, ucon2, divisor;
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c
index bdaba59b42dc..0a53051b0787 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2443.c
@@ -41,7 +41,6 @@
41 41
42#include <plat/cpu-freq.h> 42#include <plat/cpu-freq.h>
43 43
44#include <plat/s3c2443.h>
45#include <plat/clock.h> 44#include <plat/clock.h>
46#include <plat/clock-clksrc.h> 45#include <plat/clock-clksrc.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c24xx/common-smdk.c b/arch/arm/mach-s3c24xx/common-smdk.c
index 3b2cf6db3634..404444dd3840 100644
--- a/arch/arm/mach-s3c24xx/common-smdk.c
+++ b/arch/arm/mach-s3c24xx/common-smdk.c
@@ -41,11 +41,12 @@
41 41
42#include <linux/platform_data/mtd-nand-s3c2410.h> 42#include <linux/platform_data/mtd-nand-s3c2410.h>
43 43
44#include <plat/common-smdk.h>
45#include <plat/gpio-cfg.h> 44#include <plat/gpio-cfg.h>
46#include <plat/devs.h> 45#include <plat/devs.h>
47#include <plat/pm.h> 46#include <plat/pm.h>
48 47
48#include "common-smdk.h"
49
49/* LED devices */ 50/* LED devices */
50 51
51static struct s3c24xx_led_platdata smdk_pdata_led4 = { 52static struct s3c24xx_led_platdata smdk_pdata_led4 = {
diff --git a/arch/arm/plat-samsung/include/plat/common-smdk.h b/arch/arm/mach-s3c24xx/common-smdk.h
index ba028f1ed30b..98f733e1cb42 100644
--- a/arch/arm/plat-samsung/include/plat/common-smdk.h
+++ b/arch/arm/mach-s3c24xx/common-smdk.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/common-smdk.h 1/*
2 *
3 * Copyright (c) 2006 Simtec Electronics 2 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 6bcf87f65f9e..c157103ed8eb 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -47,14 +47,11 @@
47#include <plat/cpu.h> 47#include <plat/cpu.h>
48#include <plat/devs.h> 48#include <plat/devs.h>
49#include <plat/clock.h> 49#include <plat/clock.h>
50#include <plat/s3c2410.h>
51#include <plat/s3c2412.h>
52#include <plat/s3c2416.h>
53#include <plat/s3c244x.h>
54#include <plat/s3c2443.h>
55#include <plat/cpu-freq.h> 50#include <plat/cpu-freq.h>
56#include <plat/pll.h> 51#include <plat/pll.h>
57 52
53#include "common.h"
54
58/* table of supported CPUs */ 55/* table of supported CPUs */
59 56
60static const char name_s3c2410[] = "S3C2410"; 57static const char name_s3c2410[] = "S3C2410";
@@ -239,6 +236,11 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
239 236
240/* Serial port registrations */ 237/* Serial port registrations */
241 238
239#define S3C2410_PA_UART0 (S3C24XX_PA_UART)
240#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
241#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
242#define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
243
242static struct resource s3c2410_uart0_resource[] = { 244static struct resource s3c2410_uart0_resource[] = {
243 [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K), 245 [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
244 [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \ 246 [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index ed6276fcaa3b..307c3714be55 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -12,8 +12,98 @@
12#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H 12#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H
13#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__ 13#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__
14 14
15void s3c2410_restart(char mode, const char *cmd); 15struct s3c2410_uartcfg;
16void s3c244x_restart(char mode, const char *cmd); 16
17#ifdef CONFIG_CPU_S3C2410
18extern int s3c2410_init(void);
19extern int s3c2410a_init(void);
20extern void s3c2410_map_io(void);
21extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22extern void s3c2410_init_clocks(int xtal);
23extern void s3c2410_restart(char mode, const char *cmd);
24extern void s3c2410_init_irq(void);
25#else
26#define s3c2410_init_clocks NULL
27#define s3c2410_init_uarts NULL
28#define s3c2410_map_io NULL
29#define s3c2410_init NULL
30#define s3c2410a_init NULL
31#endif
32
33#ifdef CONFIG_CPU_S3C2412
34extern int s3c2412_init(void);
35extern void s3c2412_map_io(void);
36extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
37extern void s3c2412_init_clocks(int xtal);
38extern int s3c2412_baseclk_add(void);
39extern void s3c2412_restart(char mode, const char *cmd);
40extern void s3c2412_init_irq(void);
41#else
42#define s3c2412_init_clocks NULL
43#define s3c2412_init_uarts NULL
44#define s3c2412_map_io NULL
45#define s3c2412_init NULL
46#endif
47
48#ifdef CONFIG_CPU_S3C2416
49extern int s3c2416_init(void);
50extern void s3c2416_map_io(void);
51extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no);
52extern void s3c2416_init_clocks(int xtal);
53extern int s3c2416_baseclk_add(void);
54extern void s3c2416_restart(char mode, const char *cmd);
55extern void s3c2416_init_irq(void);
56
57extern struct syscore_ops s3c2416_irq_syscore_ops;
58#else
59#define s3c2416_init_clocks NULL
60#define s3c2416_init_uarts NULL
61#define s3c2416_map_io NULL
62#define s3c2416_init NULL
63#endif
64
65#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
66extern void s3c244x_map_io(void);
67extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
68extern void s3c244x_init_clocks(int xtal);
69extern void s3c244x_restart(char mode, const char *cmd);
70#else
71#define s3c244x_init_clocks NULL
72#define s3c244x_init_uarts NULL
73#endif
74
75#ifdef CONFIG_CPU_S3C2440
76extern int s3c2440_init(void);
77extern void s3c2440_map_io(void);
78extern void s3c2440_init_irq(void);
79#else
80#define s3c2440_init NULL
81#define s3c2440_map_io NULL
82#endif
83
84#ifdef CONFIG_CPU_S3C2442
85extern int s3c2442_init(void);
86extern void s3c2442_map_io(void);
87extern void s3c2442_init_irq(void);
88#else
89#define s3c2442_init NULL
90#define s3c2442_map_io NULL
91#endif
92
93#ifdef CONFIG_CPU_S3C2443
94extern int s3c2443_init(void);
95extern void s3c2443_map_io(void);
96extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
97extern void s3c2443_init_clocks(int xtal);
98extern int s3c2443_baseclk_add(void);
99extern void s3c2443_restart(char mode, const char *cmd);
100extern void s3c2443_init_irq(void);
101#else
102#define s3c2443_init_clocks NULL
103#define s3c2443_init_uarts NULL
104#define s3c2443_map_io NULL
105#define s3c2443_init NULL
106#endif
17 107
18extern struct syscore_ops s3c24xx_irq_syscore_ops; 108extern struct syscore_ops s3c24xx_irq_syscore_ops;
19 109
diff --git a/arch/arm/mach-s3c24xx/cpufreq.c b/arch/arm/mach-s3c24xx/cpufreq.c
index 5f181e733eee..3c0e78ede0da 100644
--- a/arch/arm/mach-s3c24xx/cpufreq.c
+++ b/arch/arm/mach-s3c24xx/cpufreq.c
@@ -204,7 +204,6 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
204 freqs.old = cpu_cur.freq; 204 freqs.old = cpu_cur.freq;
205 freqs.new = cpu_new.freq; 205 freqs.new = cpu_new.freq;
206 206
207 freqs.freqs.cpu = 0;
208 freqs.freqs.old = cpu_cur.freq.armclk / 1000; 207 freqs.freqs.old = cpu_cur.freq.armclk / 1000;
209 freqs.freqs.new = cpu_new.freq.armclk / 1000; 208 freqs.freqs.new = cpu_new.freq.armclk / 1000;
210 209
@@ -218,9 +217,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
218 s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk); 217 s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk);
219 218
220 /* start the frequency change */ 219 /* start the frequency change */
221 220 cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_PRECHANGE);
222 if (policy)
223 cpufreq_notify_transition(&freqs.freqs, CPUFREQ_PRECHANGE);
224 221
225 /* If hclk is staying the same, then we do not need to 222 /* If hclk is staying the same, then we do not need to
226 * re-write the IO or the refresh timings whilst we are changing 223 * re-write the IO or the refresh timings whilst we are changing
@@ -264,8 +261,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
264 local_irq_restore(flags); 261 local_irq_restore(flags);
265 262
266 /* notify everyone we've done this */ 263 /* notify everyone we've done this */
267 if (policy) 264 cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_POSTCHANGE);
268 cpufreq_notify_transition(&freqs.freqs, CPUFREQ_POSTCHANGE);
269 265
270 s3c_freq_dbg("%s: finished\n", __func__); 266 s3c_freq_dbg("%s: finished\n", __func__);
271 return 0; 267 return 0;
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2410.c b/arch/arm/mach-s3c24xx/dma-s3c2410.c
index 25d085adc93c..30aa53ff07a6 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2410.c
@@ -25,11 +25,8 @@
25 25
26#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
27#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <plat/regs-ac97.h>
29#include <plat/regs-dma.h> 28#include <plat/regs-dma.h>
30#include <mach/regs-lcd.h> 29#include <mach/regs-lcd.h>
31#include <mach/regs-sdi.h>
32#include <plat/regs-iis.h>
33#include <plat/regs-spi.h> 30#include <plat/regs-spi.h>
34 31
35static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = { 32static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = {
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2412.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c
index d2408ba372cb..ab1700ec8e64 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c
@@ -25,11 +25,8 @@
25 25
26#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
27#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <plat/regs-ac97.h>
29#include <plat/regs-dma.h> 28#include <plat/regs-dma.h>
30#include <mach/regs-lcd.h> 29#include <mach/regs-lcd.h>
31#include <mach/regs-sdi.h>
32#include <plat/regs-iis.h>
33#include <plat/regs-spi.h> 30#include <plat/regs-spi.h>
34 31
35#define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID } 32#define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2440.c b/arch/arm/mach-s3c24xx/dma-s3c2440.c
index 0b86e74d104f..cd25de28804c 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2440.c
@@ -25,11 +25,8 @@
25 25
26#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
27#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <plat/regs-ac97.h>
29#include <plat/regs-dma.h> 28#include <plat/regs-dma.h>
30#include <mach/regs-lcd.h> 29#include <mach/regs-lcd.h>
31#include <mach/regs-sdi.h>
32#include <plat/regs-iis.h>
33#include <plat/regs-spi.h> 30#include <plat/regs-spi.h>
34 31
35static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = { 32static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = {
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2443.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c
index 05536254a3f8..5fe3539dc2b5 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c
@@ -25,11 +25,8 @@
25 25
26#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
27#include <mach/regs-gpio.h> 27#include <mach/regs-gpio.h>
28#include <plat/regs-ac97.h>
29#include <plat/regs-dma.h> 28#include <plat/regs-dma.h>
30#include <mach/regs-lcd.h> 29#include <mach/regs-lcd.h>
31#include <mach/regs-sdi.h>
32#include <plat/regs-iis.h>
33#include <plat/regs-spi.h> 30#include <plat/regs-spi.h>
34 31
35#define MAP(x) { \ 32#define MAP(x) { \
diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
index 13ed33c69113..2558952e3147 100644
--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
@@ -98,4 +98,4 @@
98 98
99/* include the reset of the code which will do the work */ 99/* include the reset of the code which will do the work */
100 100
101#include <plat/debug-macro.S> 101#include <debug/samsung.S>
diff --git a/arch/arm/mach-s3c24xx/include/mach/dma.h b/arch/arm/mach-s3c24xx/include/mach/dma.h
index 6b72d5a4b377..b55da1d8cd8f 100644
--- a/arch/arm/mach-s3c24xx/include/mach/dma.h
+++ b/arch/arm/mach-s3c24xx/include/mach/dma.h
@@ -24,7 +24,6 @@
24*/ 24*/
25 25
26enum dma_ch { 26enum dma_ch {
27 DMACH_DT_PROP = -1, /* not yet supported, do not use */
28 DMACH_XD0 = 0, 27 DMACH_XD0 = 0,
29 DMACH_XD1, 28 DMACH_XD1,
30 DMACH_SDI, 29 DMACH_SDI,
diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
deleted file mode 100644
index 6a21beeba1da..000000000000
--- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * arch/arm/mach-s3c2410/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for S3C2410-based platforms
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/* We have a problem that the INTOFFSET register does not always
12 * show one interrupt. Occasionally we get two interrupts through
13 * the prioritiser, and this causes the INTOFFSET register to show
14 * what looks like the logical-or of the two interrupt numbers.
15 *
16 * Thanks to Klaus, Shannon, et al for helping to debug this problem
17*/
18
19#define INTPND (0x10)
20#define INTOFFSET (0x14)
21
22#include <mach/hardware.h>
23#include <asm/irq.h>
24
25 .macro get_irqnr_preamble, base, tmp
26 .endm
27
28 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
29
30 mov \base, #S3C24XX_VA_IRQ
31
32 @@ try the interrupt offset register, since it is there
33
34 ldr \irqstat, [\base, #INTPND ]
35 teq \irqstat, #0
36 beq 1002f
37 ldr \irqnr, [\base, #INTOFFSET ]
38 mov \tmp, #1
39 tst \irqstat, \tmp, lsl \irqnr
40 bne 1001f
41
42 @@ the number specified is not a valid irq, so try
43 @@ and work it out for ourselves
44
45 mov \irqnr, #0 @@ start here
46
47 @@ work out which irq (if any) we got
48
49 movs \tmp, \irqstat, lsl#16
50 addeq \irqnr, \irqnr, #16
51 moveq \irqstat, \irqstat, lsr#16
52 tst \irqstat, #0xff
53 addeq \irqnr, \irqnr, #8
54 moveq \irqstat, \irqstat, lsr#8
55 tst \irqstat, #0xf
56 addeq \irqnr, \irqnr, #4
57 moveq \irqstat, \irqstat, lsr#4
58 tst \irqstat, #0x3
59 addeq \irqnr, \irqnr, #2
60 moveq \irqstat, \irqstat, lsr#2
61 tst \irqstat, #0x1
62 addeq \irqnr, \irqnr, #1
63
64 @@ we have the value
651001:
66 adds \irqnr, \irqnr, #IRQ_EINT0
671002:
68 @@ exit here, Z flag unset if IRQ
69
70 .endm
diff --git a/arch/arm/mach-s3c24xx/include/mach/irqs.h b/arch/arm/mach-s3c24xx/include/mach/irqs.h
index 1e73f5fa8659..b6dd4cb5a2ec 100644
--- a/arch/arm/mach-s3c24xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c24xx/include/mach/irqs.h
@@ -59,49 +59,53 @@
59#define IRQ_ADCPARENT S3C2410_IRQ(31) 59#define IRQ_ADCPARENT S3C2410_IRQ(31)
60 60
61/* interrupts generated from the external interrupts sources */ 61/* interrupts generated from the external interrupts sources */
62#define IRQ_EINT4 S3C2410_IRQ(32) /* 48 */ 62#define IRQ_EINT0_2412 S3C2410_IRQ(32)
63#define IRQ_EINT5 S3C2410_IRQ(33) 63#define IRQ_EINT1_2412 S3C2410_IRQ(33)
64#define IRQ_EINT6 S3C2410_IRQ(34) 64#define IRQ_EINT2_2412 S3C2410_IRQ(34)
65#define IRQ_EINT7 S3C2410_IRQ(35) 65#define IRQ_EINT3_2412 S3C2410_IRQ(35)
66#define IRQ_EINT8 S3C2410_IRQ(36) 66#define IRQ_EINT4 S3C2410_IRQ(36) /* 52 */
67#define IRQ_EINT9 S3C2410_IRQ(37) 67#define IRQ_EINT5 S3C2410_IRQ(37)
68#define IRQ_EINT10 S3C2410_IRQ(38) 68#define IRQ_EINT6 S3C2410_IRQ(38)
69#define IRQ_EINT11 S3C2410_IRQ(39) 69#define IRQ_EINT7 S3C2410_IRQ(39)
70#define IRQ_EINT12 S3C2410_IRQ(40) 70#define IRQ_EINT8 S3C2410_IRQ(40)
71#define IRQ_EINT13 S3C2410_IRQ(41) 71#define IRQ_EINT9 S3C2410_IRQ(41)
72#define IRQ_EINT14 S3C2410_IRQ(42) 72#define IRQ_EINT10 S3C2410_IRQ(42)
73#define IRQ_EINT15 S3C2410_IRQ(43) 73#define IRQ_EINT11 S3C2410_IRQ(43)
74#define IRQ_EINT16 S3C2410_IRQ(44) 74#define IRQ_EINT12 S3C2410_IRQ(44)
75#define IRQ_EINT17 S3C2410_IRQ(45) 75#define IRQ_EINT13 S3C2410_IRQ(45)
76#define IRQ_EINT18 S3C2410_IRQ(46) 76#define IRQ_EINT14 S3C2410_IRQ(46)
77#define IRQ_EINT19 S3C2410_IRQ(47) 77#define IRQ_EINT15 S3C2410_IRQ(47)
78#define IRQ_EINT20 S3C2410_IRQ(48) /* 64 */ 78#define IRQ_EINT16 S3C2410_IRQ(48)
79#define IRQ_EINT21 S3C2410_IRQ(49) 79#define IRQ_EINT17 S3C2410_IRQ(49)
80#define IRQ_EINT22 S3C2410_IRQ(50) 80#define IRQ_EINT18 S3C2410_IRQ(50)
81#define IRQ_EINT23 S3C2410_IRQ(51) 81#define IRQ_EINT19 S3C2410_IRQ(51)
82#define IRQ_EINT20 S3C2410_IRQ(52) /* 68 */
83#define IRQ_EINT21 S3C2410_IRQ(53)
84#define IRQ_EINT22 S3C2410_IRQ(54)
85#define IRQ_EINT23 S3C2410_IRQ(55)
82 86
83#define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) 87#define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4)
84#define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) 88#define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x)))
85 89
86#define IRQ_LCD_FIFO S3C2410_IRQ(52) 90#define IRQ_LCD_FIFO S3C2410_IRQ(56)
87#define IRQ_LCD_FRAME S3C2410_IRQ(53) 91#define IRQ_LCD_FRAME S3C2410_IRQ(57)
88 92
89/* IRQs for the interal UARTs, and ADC 93/* IRQs for the interal UARTs, and ADC
90 * these need to be ordered in number of appearance in the 94 * these need to be ordered in number of appearance in the
91 * SUBSRC mask register 95 * SUBSRC mask register
92*/ 96*/
93 97
94#define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54) 98#define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+58)
95 99
96#define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */ 100#define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 74 */
97#define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) 101#define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1)
98#define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) 102#define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2)
99 103
100#define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */ 104#define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 77 */
101#define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) 105#define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4)
102#define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) 106#define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5)
103 107
104#define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */ 108#define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 80 */
105#define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) 109#define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7)
106#define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) 110#define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8)
107 111
@@ -136,7 +140,7 @@
136 140
137/* second interrupt-register of s3c2416/s3c2450 */ 141/* second interrupt-register of s3c2416/s3c2450 */
138 142
139#define S3C2416_IRQ(x) S3C2410_IRQ((x) + 54 + 29) 143#define S3C2416_IRQ(x) S3C2410_IRQ((x) + 58 + 29)
140#define IRQ_S3C2416_2D S3C2416_IRQ(0) 144#define IRQ_S3C2416_2D S3C2416_IRQ(0)
141#define IRQ_S3C2416_IIC1 S3C2416_IRQ(1) 145#define IRQ_S3C2416_IIC1 S3C2416_IRQ(1)
142#define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2) 146#define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2)
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h b/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h
deleted file mode 100644
index cbf2d8884e30..000000000000
--- a/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-sdi.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 MMC/SDIO register definitions
11*/
12
13#ifndef __ASM_ARM_REGS_SDI
14#define __ASM_ARM_REGS_SDI "regs-sdi.h"
15
16#define S3C2410_SDICON (0x00)
17#define S3C2410_SDIPRE (0x04)
18#define S3C2410_SDICMDARG (0x08)
19#define S3C2410_SDICMDCON (0x0C)
20#define S3C2410_SDICMDSTAT (0x10)
21#define S3C2410_SDIRSP0 (0x14)
22#define S3C2410_SDIRSP1 (0x18)
23#define S3C2410_SDIRSP2 (0x1C)
24#define S3C2410_SDIRSP3 (0x20)
25#define S3C2410_SDITIMER (0x24)
26#define S3C2410_SDIBSIZE (0x28)
27#define S3C2410_SDIDCON (0x2C)
28#define S3C2410_SDIDCNT (0x30)
29#define S3C2410_SDIDSTA (0x34)
30#define S3C2410_SDIFSTA (0x38)
31
32#define S3C2410_SDIDATA (0x3C)
33#define S3C2410_SDIIMSK (0x40)
34
35#define S3C2440_SDIDATA (0x40)
36#define S3C2440_SDIIMSK (0x3C)
37
38#define S3C2440_SDICON_SDRESET (1<<8)
39#define S3C2440_SDICON_MMCCLOCK (1<<5)
40#define S3C2410_SDICON_BYTEORDER (1<<4)
41#define S3C2410_SDICON_SDIOIRQ (1<<3)
42#define S3C2410_SDICON_RWAITEN (1<<2)
43#define S3C2410_SDICON_FIFORESET (1<<1)
44#define S3C2410_SDICON_CLOCKTYPE (1<<0)
45
46#define S3C2410_SDICMDCON_ABORT (1<<12)
47#define S3C2410_SDICMDCON_WITHDATA (1<<11)
48#define S3C2410_SDICMDCON_LONGRSP (1<<10)
49#define S3C2410_SDICMDCON_WAITRSP (1<<9)
50#define S3C2410_SDICMDCON_CMDSTART (1<<8)
51#define S3C2410_SDICMDCON_SENDERHOST (1<<6)
52#define S3C2410_SDICMDCON_INDEX (0x3f)
53
54#define S3C2410_SDICMDSTAT_CRCFAIL (1<<12)
55#define S3C2410_SDICMDSTAT_CMDSENT (1<<11)
56#define S3C2410_SDICMDSTAT_CMDTIMEOUT (1<<10)
57#define S3C2410_SDICMDSTAT_RSPFIN (1<<9)
58#define S3C2410_SDICMDSTAT_XFERING (1<<8)
59#define S3C2410_SDICMDSTAT_INDEX (0xff)
60
61#define S3C2440_SDIDCON_DS_BYTE (0<<22)
62#define S3C2440_SDIDCON_DS_HALFWORD (1<<22)
63#define S3C2440_SDIDCON_DS_WORD (2<<22)
64#define S3C2410_SDIDCON_IRQPERIOD (1<<21)
65#define S3C2410_SDIDCON_TXAFTERRESP (1<<20)
66#define S3C2410_SDIDCON_RXAFTERCMD (1<<19)
67#define S3C2410_SDIDCON_BUSYAFTERCMD (1<<18)
68#define S3C2410_SDIDCON_BLOCKMODE (1<<17)
69#define S3C2410_SDIDCON_WIDEBUS (1<<16)
70#define S3C2410_SDIDCON_DMAEN (1<<15)
71#define S3C2410_SDIDCON_STOP (1<<14)
72#define S3C2440_SDIDCON_DATSTART (1<<14)
73#define S3C2410_SDIDCON_DATMODE (3<<12)
74#define S3C2410_SDIDCON_BLKNUM (0x7ff)
75
76/* constants for S3C2410_SDIDCON_DATMODE */
77#define S3C2410_SDIDCON_XFER_READY (0<<12)
78#define S3C2410_SDIDCON_XFER_CHKSTART (1<<12)
79#define S3C2410_SDIDCON_XFER_RXSTART (2<<12)
80#define S3C2410_SDIDCON_XFER_TXSTART (3<<12)
81
82#define S3C2410_SDIDCON_BLKNUM_MASK (0xFFF)
83#define S3C2410_SDIDCNT_BLKNUM_SHIFT (12)
84
85#define S3C2410_SDIDSTA_RDYWAITREQ (1<<10)
86#define S3C2410_SDIDSTA_SDIOIRQDETECT (1<<9)
87#define S3C2410_SDIDSTA_FIFOFAIL (1<<8) /* reserved on 2440 */
88#define S3C2410_SDIDSTA_CRCFAIL (1<<7)
89#define S3C2410_SDIDSTA_RXCRCFAIL (1<<6)
90#define S3C2410_SDIDSTA_DATATIMEOUT (1<<5)
91#define S3C2410_SDIDSTA_XFERFINISH (1<<4)
92#define S3C2410_SDIDSTA_BUSYFINISH (1<<3)
93#define S3C2410_SDIDSTA_SBITERR (1<<2) /* reserved on 2410a/2440 */
94#define S3C2410_SDIDSTA_TXDATAON (1<<1)
95#define S3C2410_SDIDSTA_RXDATAON (1<<0)
96
97#define S3C2440_SDIFSTA_FIFORESET (1<<16)
98#define S3C2440_SDIFSTA_FIFOFAIL (3<<14) /* 3 is correct (2 bits) */
99#define S3C2410_SDIFSTA_TFDET (1<<13)
100#define S3C2410_SDIFSTA_RFDET (1<<12)
101#define S3C2410_SDIFSTA_TFHALF (1<<11)
102#define S3C2410_SDIFSTA_TFEMPTY (1<<10)
103#define S3C2410_SDIFSTA_RFLAST (1<<9)
104#define S3C2410_SDIFSTA_RFFULL (1<<8)
105#define S3C2410_SDIFSTA_RFHALF (1<<7)
106#define S3C2410_SDIFSTA_COUNTMASK (0x7f)
107
108#define S3C2410_SDIIMSK_RESPONSECRC (1<<17)
109#define S3C2410_SDIIMSK_CMDSENT (1<<16)
110#define S3C2410_SDIIMSK_CMDTIMEOUT (1<<15)
111#define S3C2410_SDIIMSK_RESPONSEND (1<<14)
112#define S3C2410_SDIIMSK_READWAIT (1<<13)
113#define S3C2410_SDIIMSK_SDIOIRQ (1<<12)
114#define S3C2410_SDIIMSK_FIFOFAIL (1<<11)
115#define S3C2410_SDIIMSK_CRCSTATUS (1<<10)
116#define S3C2410_SDIIMSK_DATACRC (1<<9)
117#define S3C2410_SDIIMSK_DATATIMEOUT (1<<8)
118#define S3C2410_SDIIMSK_DATAFINISH (1<<7)
119#define S3C2410_SDIIMSK_BUSYFINISH (1<<6)
120#define S3C2410_SDIIMSK_SBITERR (1<<5) /* reserved 2440/2410a */
121#define S3C2410_SDIIMSK_TXFIFOHALF (1<<4)
122#define S3C2410_SDIIMSK_TXFIFOEMPTY (1<<3)
123#define S3C2410_SDIIMSK_RXFIFOLAST (1<<2)
124#define S3C2410_SDIIMSK_RXFIFOFULL (1<<1)
125#define S3C2410_SDIIMSK_RXFIFOHALF (1<<0)
126
127#endif /* __ASM_ARM_REGS_SDI */
diff --git a/arch/arm/mach-s3c24xx/irq-pm.c b/arch/arm/mach-s3c24xx/irq-pm.c
index e1199599873e..b91341ef2b2e 100644
--- a/arch/arm/mach-s3c24xx/irq-pm.c
+++ b/arch/arm/mach-s3c24xx/irq-pm.c
@@ -16,10 +16,15 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/syscore_ops.h> 18#include <linux/syscore_ops.h>
19#include <linux/io.h>
19 20
20#include <plat/cpu.h> 21#include <plat/cpu.h>
21#include <plat/pm.h> 22#include <plat/pm.h>
22#include <plat/irq.h> 23#include <plat/map-base.h>
24#include <plat/map-s3c.h>
25
26#include <mach/regs-irq.h>
27#include <mach/regs-gpio.h>
23 28
24#include <asm/irq.h> 29#include <asm/irq.h>
25 30
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c
deleted file mode 100644
index 67d763178d3f..000000000000
--- a/arch/arm/mach-s3c24xx/irq-s3c2412.c
+++ /dev/null
@@ -1,215 +0,0 @@
1/* linux/arch/arm/mach-s3c2412/irq.c
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20*/
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/interrupt.h>
25#include <linux/ioport.h>
26#include <linux/device.h>
27#include <linux/io.h>
28
29#include <mach/hardware.h>
30#include <asm/irq.h>
31
32#include <asm/mach/irq.h>
33
34#include <mach/regs-irq.h>
35#include <mach/regs-gpio.h>
36
37#include <plat/cpu.h>
38#include <plat/irq.h>
39#include <plat/pm.h>
40
41#include "s3c2412-power.h"
42
43#define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1)
44#define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0))))
45
46/* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by
47 * having them turn up in both the INT* and the EINT* registers. Whilst
48 * both show the status, they both now need to be acked when the IRQs
49 * go off.
50*/
51
52static void
53s3c2412_irq_mask(struct irq_data *data)
54{
55 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
56 unsigned long mask;
57
58 mask = __raw_readl(S3C2410_INTMSK);
59 __raw_writel(mask | bitval, S3C2410_INTMSK);
60
61 mask = __raw_readl(S3C2412_EINTMASK);
62 __raw_writel(mask | bitval, S3C2412_EINTMASK);
63}
64
65static inline void
66s3c2412_irq_ack(struct irq_data *data)
67{
68 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
69
70 __raw_writel(bitval, S3C2412_EINTPEND);
71 __raw_writel(bitval, S3C2410_SRCPND);
72 __raw_writel(bitval, S3C2410_INTPND);
73}
74
75static inline void
76s3c2412_irq_maskack(struct irq_data *data)
77{
78 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
79 unsigned long mask;
80
81 mask = __raw_readl(S3C2410_INTMSK);
82 __raw_writel(mask|bitval, S3C2410_INTMSK);
83
84 mask = __raw_readl(S3C2412_EINTMASK);
85 __raw_writel(mask | bitval, S3C2412_EINTMASK);
86
87 __raw_writel(bitval, S3C2412_EINTPEND);
88 __raw_writel(bitval, S3C2410_SRCPND);
89 __raw_writel(bitval, S3C2410_INTPND);
90}
91
92static void
93s3c2412_irq_unmask(struct irq_data *data)
94{
95 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
96 unsigned long mask;
97
98 mask = __raw_readl(S3C2412_EINTMASK);
99 __raw_writel(mask & ~bitval, S3C2412_EINTMASK);
100
101 mask = __raw_readl(S3C2410_INTMSK);
102 __raw_writel(mask & ~bitval, S3C2410_INTMSK);
103}
104
105static struct irq_chip s3c2412_irq_eint0t4 = {
106 .irq_ack = s3c2412_irq_ack,
107 .irq_mask = s3c2412_irq_mask,
108 .irq_unmask = s3c2412_irq_unmask,
109 .irq_set_wake = s3c_irq_wake,
110 .irq_set_type = s3c_irqext_type,
111};
112
113#define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0)))
114
115/* CF and SDI sub interrupts */
116
117static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc)
118{
119 unsigned int subsrc, submsk;
120
121 subsrc = __raw_readl(S3C2410_SUBSRCPND);
122 submsk = __raw_readl(S3C2410_INTSUBMSK);
123
124 subsrc &= ~submsk;
125
126 if (subsrc & INTBIT(IRQ_S3C2412_SDI))
127 generic_handle_irq(IRQ_S3C2412_SDI);
128
129 if (subsrc & INTBIT(IRQ_S3C2412_CF))
130 generic_handle_irq(IRQ_S3C2412_CF);
131}
132
133#define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0))
134#define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF)
135
136static void s3c2412_irq_cfsdi_mask(struct irq_data *data)
137{
138 s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
139}
140
141static void s3c2412_irq_cfsdi_unmask(struct irq_data *data)
142{
143 s3c_irqsub_unmask(data->irq, INTMSK_CFSDI);
144}
145
146static void s3c2412_irq_cfsdi_ack(struct irq_data *data)
147{
148 s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
149}
150
151static struct irq_chip s3c2412_irq_cfsdi = {
152 .name = "s3c2412-cfsdi",
153 .irq_ack = s3c2412_irq_cfsdi_ack,
154 .irq_mask = s3c2412_irq_cfsdi_mask,
155 .irq_unmask = s3c2412_irq_cfsdi_unmask,
156};
157
158static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state)
159{
160 unsigned long pwrcfg;
161
162 pwrcfg = __raw_readl(S3C2412_PWRCFG);
163 if (state)
164 pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ;
165 else
166 pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ;
167 __raw_writel(pwrcfg, S3C2412_PWRCFG);
168
169 return s3c_irq_chip.irq_set_wake(data, state);
170}
171
172static struct irq_chip s3c2412_irq_rtc_chip;
173
174static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif)
175{
176 unsigned int irqno;
177
178 for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) {
179 irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4,
180 handle_edge_irq);
181 set_irq_flags(irqno, IRQF_VALID);
182 }
183
184 /* add demux support for CF/SDI */
185
186 irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi);
187
188 for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) {
189 irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi,
190 handle_level_irq);
191 set_irq_flags(irqno, IRQF_VALID);
192 }
193
194 /* change RTC IRQ's set wake method */
195
196 s3c2412_irq_rtc_chip = s3c_irq_chip;
197 s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake;
198
199 irq_set_chip(IRQ_RTC, &s3c2412_irq_rtc_chip);
200
201 return 0;
202}
203
204static struct subsys_interface s3c2412_irq_interface = {
205 .name = "s3c2412_irq",
206 .subsys = &s3c2412_subsys,
207 .add_dev = s3c2412_irq_add,
208};
209
210static int s3c2412_irq_init(void)
211{
212 return subsys_interface_register(&s3c2412_irq_interface);
213}
214
215arch_initcall(s3c2412_irq_init);
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2440.c b/arch/arm/mach-s3c24xx/irq-s3c2440.c
deleted file mode 100644
index 4a18cde439cc..000000000000
--- a/arch/arm/mach-s3c24xx/irq-s3c2440.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/* linux/arch/arm/mach-s3c2440/irq.c
2 *
3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20*/
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/interrupt.h>
25#include <linux/ioport.h>
26#include <linux/device.h>
27#include <linux/io.h>
28
29#include <mach/hardware.h>
30#include <asm/irq.h>
31
32#include <asm/mach/irq.h>
33
34#include <mach/regs-irq.h>
35#include <mach/regs-gpio.h>
36
37#include <plat/cpu.h>
38#include <plat/pm.h>
39#include <plat/irq.h>
40
41/* WDT/AC97 */
42
43static void s3c_irq_demux_wdtac97(unsigned int irq,
44 struct irq_desc *desc)
45{
46 unsigned int subsrc, submsk;
47
48 /* read the current pending interrupts, and the mask
49 * for what it is available */
50
51 subsrc = __raw_readl(S3C2410_SUBSRCPND);
52 submsk = __raw_readl(S3C2410_INTSUBMSK);
53
54 subsrc &= ~submsk;
55 subsrc >>= 13;
56 subsrc &= 3;
57
58 if (subsrc != 0) {
59 if (subsrc & 1) {
60 generic_handle_irq(IRQ_S3C2440_WDT);
61 }
62 if (subsrc & 2) {
63 generic_handle_irq(IRQ_S3C2440_AC97);
64 }
65 }
66}
67
68
69#define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0))
70
71static void
72s3c_irq_wdtac97_mask(struct irq_data *data)
73{
74 s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13);
75}
76
77static void
78s3c_irq_wdtac97_unmask(struct irq_data *data)
79{
80 s3c_irqsub_unmask(data->irq, INTMSK_WDT);
81}
82
83static void
84s3c_irq_wdtac97_ack(struct irq_data *data)
85{
86 s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13);
87}
88
89static struct irq_chip s3c_irq_wdtac97 = {
90 .irq_mask = s3c_irq_wdtac97_mask,
91 .irq_unmask = s3c_irq_wdtac97_unmask,
92 .irq_ack = s3c_irq_wdtac97_ack,
93};
94
95static int s3c2440_irq_add(struct device *dev, struct subsys_interface *sif)
96{
97 unsigned int irqno;
98
99 printk("S3C2440: IRQ Support\n");
100
101 /* add new chained handler for wdt, ac7 */
102
103 irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip,
104 handle_level_irq);
105 irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
106
107 for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
108 irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97,
109 handle_level_irq);
110 set_irq_flags(irqno, IRQF_VALID);
111 }
112
113 return 0;
114}
115
116static struct subsys_interface s3c2440_irq_interface = {
117 .name = "s3c2440_irq",
118 .subsys = &s3c2440_subsys,
119 .add_dev = s3c2440_irq_add,
120};
121
122static int s3c2440_irq_init(void)
123{
124 return subsys_interface_register(&s3c2440_irq_interface);
125}
126
127arch_initcall(s3c2440_irq_init);
128
diff --git a/arch/arm/mach-s3c24xx/irq-s3c244x.c b/arch/arm/mach-s3c24xx/irq-s3c244x.c
deleted file mode 100644
index 5fe8e58d3afd..000000000000
--- a/arch/arm/mach-s3c24xx/irq-s3c244x.c
+++ /dev/null
@@ -1,142 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/s3c244x-irq.c
2 *
3 * Copyright (c) 2003-2004 Simtec Electronics
4 * Ben Dooks <ben@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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20*/
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/interrupt.h>
25#include <linux/ioport.h>
26#include <linux/device.h>
27#include <linux/io.h>
28
29#include <mach/hardware.h>
30#include <asm/irq.h>
31
32#include <asm/mach/irq.h>
33
34#include <mach/regs-irq.h>
35#include <mach/regs-gpio.h>
36
37#include <plat/cpu.h>
38#include <plat/pm.h>
39#include <plat/irq.h>
40
41/* camera irq */
42
43static void s3c_irq_demux_cam(unsigned int irq,
44 struct irq_desc *desc)
45{
46 unsigned int subsrc, submsk;
47
48 /* read the current pending interrupts, and the mask
49 * for what it is available */
50
51 subsrc = __raw_readl(S3C2410_SUBSRCPND);
52 submsk = __raw_readl(S3C2410_INTSUBMSK);
53
54 subsrc &= ~submsk;
55 subsrc >>= 11;
56 subsrc &= 3;
57
58 if (subsrc != 0) {
59 if (subsrc & 1) {
60 generic_handle_irq(IRQ_S3C2440_CAM_C);
61 }
62 if (subsrc & 2) {
63 generic_handle_irq(IRQ_S3C2440_CAM_P);
64 }
65 }
66}
67
68#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
69
70static void
71s3c_irq_cam_mask(struct irq_data *data)
72{
73 s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11);
74}
75
76static void
77s3c_irq_cam_unmask(struct irq_data *data)
78{
79 s3c_irqsub_unmask(data->irq, INTMSK_CAM);
80}
81
82static void
83s3c_irq_cam_ack(struct irq_data *data)
84{
85 s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11);
86}
87
88static struct irq_chip s3c_irq_cam = {
89 .irq_mask = s3c_irq_cam_mask,
90 .irq_unmask = s3c_irq_cam_unmask,
91 .irq_ack = s3c_irq_cam_ack,
92};
93
94static int s3c244x_irq_add(struct device *dev, struct subsys_interface *sif)
95{
96 unsigned int irqno;
97
98 irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip,
99 handle_level_irq);
100 set_irq_flags(IRQ_NFCON, IRQF_VALID);
101
102 /* add chained handler for camera */
103
104 irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip,
105 handle_level_irq);
106 irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
107
108 for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
109 irq_set_chip_and_handler(irqno, &s3c_irq_cam,
110 handle_level_irq);
111 set_irq_flags(irqno, IRQF_VALID);
112 }
113
114 return 0;
115}
116
117static struct subsys_interface s3c2440_irq_interface = {
118 .name = "s3c2440_irq",
119 .subsys = &s3c2440_subsys,
120 .add_dev = s3c244x_irq_add,
121};
122
123static int s3c2440_irq_init(void)
124{
125 return subsys_interface_register(&s3c2440_irq_interface);
126}
127
128arch_initcall(s3c2440_irq_init);
129
130static struct subsys_interface s3c2442_irq_interface = {
131 .name = "s3c2442_irq",
132 .subsys = &s3c2442_subsys,
133 .add_dev = s3c244x_irq_add,
134};
135
136
137static int s3c2442_irq_init(void)
138{
139 return subsys_interface_register(&s3c2442_irq_interface);
140}
141
142arch_initcall(s3c2442_irq_init);
diff --git a/arch/arm/mach-s3c24xx/irq.c b/arch/arm/mach-s3c24xx/irq.c
deleted file mode 100644
index d8ba9bee4c7e..000000000000
--- a/arch/arm/mach-s3c24xx/irq.c
+++ /dev/null
@@ -1,822 +0,0 @@
1/*
2 * S3C24XX IRQ handling
3 *
4 * Copyright (c) 2003-2004 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17*/
18
19#include <linux/init.h>
20#include <linux/slab.h>
21#include <linux/module.h>
22#include <linux/io.h>
23#include <linux/err.h>
24#include <linux/interrupt.h>
25#include <linux/ioport.h>
26#include <linux/device.h>
27#include <linux/irqdomain.h>
28
29#include <asm/mach/irq.h>
30
31#include <mach/regs-irq.h>
32#include <mach/regs-gpio.h>
33
34#include <plat/cpu.h>
35#include <plat/regs-irqtype.h>
36#include <plat/pm.h>
37#include <plat/irq.h>
38
39#define S3C_IRQTYPE_NONE 0
40#define S3C_IRQTYPE_EINT 1
41#define S3C_IRQTYPE_EDGE 2
42#define S3C_IRQTYPE_LEVEL 3
43
44struct s3c_irq_data {
45 unsigned int type;
46 unsigned long parent_irq;
47
48 /* data gets filled during init */
49 struct s3c_irq_intc *intc;
50 unsigned long sub_bits;
51 struct s3c_irq_intc *sub_intc;
52};
53
54/*
55 * Sructure holding the controller data
56 * @reg_pending register holding pending irqs
57 * @reg_intpnd special register intpnd in main intc
58 * @reg_mask mask register
59 * @domain irq_domain of the controller
60 * @parent parent controller for ext and sub irqs
61 * @irqs irq-data, always s3c_irq_data[32]
62 */
63struct s3c_irq_intc {
64 void __iomem *reg_pending;
65 void __iomem *reg_intpnd;
66 void __iomem *reg_mask;
67 struct irq_domain *domain;
68 struct s3c_irq_intc *parent;
69 struct s3c_irq_data *irqs;
70};
71
72static void s3c_irq_mask(struct irq_data *data)
73{
74 struct s3c_irq_intc *intc = data->domain->host_data;
75 struct s3c_irq_intc *parent_intc = intc->parent;
76 struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq];
77 struct s3c_irq_data *parent_data;
78 unsigned long mask;
79 unsigned int irqno;
80
81 mask = __raw_readl(intc->reg_mask);
82 mask |= (1UL << data->hwirq);
83 __raw_writel(mask, intc->reg_mask);
84
85 if (parent_intc && irq_data->parent_irq) {
86 parent_data = &parent_intc->irqs[irq_data->parent_irq];
87
88 /* check to see if we need to mask the parent IRQ */
89 if ((mask & parent_data->sub_bits) == parent_data->sub_bits) {
90 irqno = irq_find_mapping(parent_intc->domain,
91 irq_data->parent_irq);
92 s3c_irq_mask(irq_get_irq_data(irqno));
93 }
94 }
95}
96
97static void s3c_irq_unmask(struct irq_data *data)
98{
99 struct s3c_irq_intc *intc = data->domain->host_data;
100 struct s3c_irq_intc *parent_intc = intc->parent;
101 struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq];
102 unsigned long mask;
103 unsigned int irqno;
104
105 mask = __raw_readl(intc->reg_mask);
106 mask &= ~(1UL << data->hwirq);
107 __raw_writel(mask, intc->reg_mask);
108
109 if (parent_intc && irq_data->parent_irq) {
110 irqno = irq_find_mapping(parent_intc->domain,
111 irq_data->parent_irq);
112 s3c_irq_unmask(irq_get_irq_data(irqno));
113 }
114}
115
116static inline void s3c_irq_ack(struct irq_data *data)
117{
118 struct s3c_irq_intc *intc = data->domain->host_data;
119 unsigned long bitval = 1UL << data->hwirq;
120
121 __raw_writel(bitval, intc->reg_pending);
122 if (intc->reg_intpnd)
123 __raw_writel(bitval, intc->reg_intpnd);
124}
125
126static int s3c_irqext_type_set(void __iomem *gpcon_reg,
127 void __iomem *extint_reg,
128 unsigned long gpcon_offset,
129 unsigned long extint_offset,
130 unsigned int type)
131{
132 unsigned long newvalue = 0, value;
133
134 /* Set the GPIO to external interrupt mode */
135 value = __raw_readl(gpcon_reg);
136 value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset);
137 __raw_writel(value, gpcon_reg);
138
139 /* Set the external interrupt to pointed trigger type */
140 switch (type)
141 {
142 case IRQ_TYPE_NONE:
143 pr_warn("No edge setting!\n");
144 break;
145
146 case IRQ_TYPE_EDGE_RISING:
147 newvalue = S3C2410_EXTINT_RISEEDGE;
148 break;
149
150 case IRQ_TYPE_EDGE_FALLING:
151 newvalue = S3C2410_EXTINT_FALLEDGE;
152 break;
153
154 case IRQ_TYPE_EDGE_BOTH:
155 newvalue = S3C2410_EXTINT_BOTHEDGE;
156 break;
157
158 case IRQ_TYPE_LEVEL_LOW:
159 newvalue = S3C2410_EXTINT_LOWLEV;
160 break;
161
162 case IRQ_TYPE_LEVEL_HIGH:
163 newvalue = S3C2410_EXTINT_HILEV;
164 break;
165
166 default:
167 pr_err("No such irq type %d", type);
168 return -EINVAL;
169 }
170
171 value = __raw_readl(extint_reg);
172 value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
173 __raw_writel(value, extint_reg);
174
175 return 0;
176}
177
178/* FIXME: make static when it's out of plat-samsung/irq.h */
179int s3c_irqext_type(struct irq_data *data, unsigned int type)
180{
181 void __iomem *extint_reg;
182 void __iomem *gpcon_reg;
183 unsigned long gpcon_offset, extint_offset;
184
185 if ((data->hwirq >= 4) && (data->hwirq <= 7)) {
186 gpcon_reg = S3C2410_GPFCON;
187 extint_reg = S3C24XX_EXTINT0;
188 gpcon_offset = (data->hwirq) * 2;
189 extint_offset = (data->hwirq) * 4;
190 } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) {
191 gpcon_reg = S3C2410_GPGCON;
192 extint_reg = S3C24XX_EXTINT1;
193 gpcon_offset = (data->hwirq - 8) * 2;
194 extint_offset = (data->hwirq - 8) * 4;
195 } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) {
196 gpcon_reg = S3C2410_GPGCON;
197 extint_reg = S3C24XX_EXTINT2;
198 gpcon_offset = (data->hwirq - 8) * 2;
199 extint_offset = (data->hwirq - 16) * 4;
200 } else {
201 return -EINVAL;
202 }
203
204 return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
205 extint_offset, type);
206}
207
208static int s3c_irqext0_type(struct irq_data *data, unsigned int type)
209{
210 void __iomem *extint_reg;
211 void __iomem *gpcon_reg;
212 unsigned long gpcon_offset, extint_offset;
213
214 if ((data->hwirq >= 0) && (data->hwirq <= 3)) {
215 gpcon_reg = S3C2410_GPFCON;
216 extint_reg = S3C24XX_EXTINT0;
217 gpcon_offset = (data->hwirq) * 2;
218 extint_offset = (data->hwirq) * 4;
219 } else {
220 return -EINVAL;
221 }
222
223 return s3c_irqext_type_set(gpcon_reg, extint_reg, gpcon_offset,
224 extint_offset, type);
225}
226
227struct irq_chip s3c_irq_chip = {
228 .name = "s3c",
229 .irq_ack = s3c_irq_ack,
230 .irq_mask = s3c_irq_mask,
231 .irq_unmask = s3c_irq_unmask,
232 .irq_set_wake = s3c_irq_wake
233};
234
235struct irq_chip s3c_irq_level_chip = {
236 .name = "s3c-level",
237 .irq_mask = s3c_irq_mask,
238 .irq_unmask = s3c_irq_unmask,
239 .irq_ack = s3c_irq_ack,
240};
241
242static struct irq_chip s3c_irqext_chip = {
243 .name = "s3c-ext",
244 .irq_mask = s3c_irq_mask,
245 .irq_unmask = s3c_irq_unmask,
246 .irq_ack = s3c_irq_ack,
247 .irq_set_type = s3c_irqext_type,
248 .irq_set_wake = s3c_irqext_wake
249};
250
251static struct irq_chip s3c_irq_eint0t4 = {
252 .name = "s3c-ext0",
253 .irq_ack = s3c_irq_ack,
254 .irq_mask = s3c_irq_mask,
255 .irq_unmask = s3c_irq_unmask,
256 .irq_set_wake = s3c_irq_wake,
257 .irq_set_type = s3c_irqext0_type,
258};
259
260static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc)
261{
262 struct irq_chip *chip = irq_desc_get_chip(desc);
263 struct s3c_irq_intc *intc = desc->irq_data.domain->host_data;
264 struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq];
265 struct s3c_irq_intc *sub_intc = irq_data->sub_intc;
266 unsigned long src;
267 unsigned long msk;
268 unsigned int n;
269
270 chained_irq_enter(chip, desc);
271
272 src = __raw_readl(sub_intc->reg_pending);
273 msk = __raw_readl(sub_intc->reg_mask);
274
275 src &= ~msk;
276 src &= irq_data->sub_bits;
277
278 while (src) {
279 n = __ffs(src);
280 src &= ~(1 << n);
281 generic_handle_irq(irq_find_mapping(sub_intc->domain, n));
282 }
283
284 chained_irq_exit(chip, desc);
285}
286
287#ifdef CONFIG_FIQ
288/**
289 * s3c24xx_set_fiq - set the FIQ routing
290 * @irq: IRQ number to route to FIQ on processor.
291 * @on: Whether to route @irq to the FIQ, or to remove the FIQ routing.
292 *
293 * Change the state of the IRQ to FIQ routing depending on @irq and @on. If
294 * @on is true, the @irq is checked to see if it can be routed and the
295 * interrupt controller updated to route the IRQ. If @on is false, the FIQ
296 * routing is cleared, regardless of which @irq is specified.
297 */
298int s3c24xx_set_fiq(unsigned int irq, bool on)
299{
300 u32 intmod;
301 unsigned offs;
302
303 if (on) {
304 offs = irq - FIQ_START;
305 if (offs > 31)
306 return -EINVAL;
307
308 intmod = 1 << offs;
309 } else {
310 intmod = 0;
311 }
312
313 __raw_writel(intmod, S3C2410_INTMOD);
314 return 0;
315}
316
317EXPORT_SYMBOL_GPL(s3c24xx_set_fiq);
318#endif
319
320static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
321 irq_hw_number_t hw)
322{
323 struct s3c_irq_intc *intc = h->host_data;
324 struct s3c_irq_data *irq_data = &intc->irqs[hw];
325 struct s3c_irq_intc *parent_intc;
326 struct s3c_irq_data *parent_irq_data;
327 unsigned int irqno;
328
329 if (!intc) {
330 pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw);
331 return -EINVAL;
332 }
333
334 if (!irq_data) {
335 pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw);
336 return -EINVAL;
337 }
338
339 /* attach controller pointer to irq_data */
340 irq_data->intc = intc;
341
342 /* set handler and flags */
343 switch (irq_data->type) {
344 case S3C_IRQTYPE_NONE:
345 return 0;
346 case S3C_IRQTYPE_EINT:
347 if (irq_data->parent_irq)
348 irq_set_chip_and_handler(virq, &s3c_irqext_chip,
349 handle_edge_irq);
350 else
351 irq_set_chip_and_handler(virq, &s3c_irq_eint0t4,
352 handle_edge_irq);
353 break;
354 case S3C_IRQTYPE_EDGE:
355 if (irq_data->parent_irq ||
356 intc->reg_pending == S3C2416_SRCPND2)
357 irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
358 handle_edge_irq);
359 else
360 irq_set_chip_and_handler(virq, &s3c_irq_chip,
361 handle_edge_irq);
362 break;
363 case S3C_IRQTYPE_LEVEL:
364 if (irq_data->parent_irq)
365 irq_set_chip_and_handler(virq, &s3c_irq_level_chip,
366 handle_level_irq);
367 else
368 irq_set_chip_and_handler(virq, &s3c_irq_chip,
369 handle_level_irq);
370 break;
371 default:
372 pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type);
373 return -EINVAL;
374 }
375 set_irq_flags(virq, IRQF_VALID);
376
377 if (irq_data->parent_irq) {
378 parent_intc = intc->parent;
379 if (!parent_intc) {
380 pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n",
381 hw);
382 goto err;
383 }
384
385 parent_irq_data = &parent_intc->irqs[irq_data->parent_irq];
386 if (!irq_data) {
387 pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n",
388 hw);
389 goto err;
390 }
391
392 parent_irq_data->sub_intc = intc;
393 parent_irq_data->sub_bits |= (1UL << hw);
394
395 /* attach the demuxer to the parent irq */
396 irqno = irq_find_mapping(parent_intc->domain,
397 irq_data->parent_irq);
398 if (!irqno) {
399 pr_err("irq-s3c24xx: could not find mapping for parent irq %lu\n",
400 irq_data->parent_irq);
401 goto err;
402 }
403 irq_set_chained_handler(irqno, s3c_irq_demux);
404 }
405
406 return 0;
407
408err:
409 set_irq_flags(virq, 0);
410
411 /* the only error can result from bad mapping data*/
412 return -EINVAL;
413}
414
415static struct irq_domain_ops s3c24xx_irq_ops = {
416 .map = s3c24xx_irq_map,
417 .xlate = irq_domain_xlate_twocell,
418};
419
420static void s3c24xx_clear_intc(struct s3c_irq_intc *intc)
421{
422 void __iomem *reg_source;
423 unsigned long pend;
424 unsigned long last;
425 int i;
426
427 /* if intpnd is set, read the next pending irq from there */
428 reg_source = intc->reg_intpnd ? intc->reg_intpnd : intc->reg_pending;
429
430 last = 0;
431 for (i = 0; i < 4; i++) {
432 pend = __raw_readl(reg_source);
433
434 if (pend == 0 || pend == last)
435 break;
436
437 __raw_writel(pend, intc->reg_pending);
438 if (intc->reg_intpnd)
439 __raw_writel(pend, intc->reg_intpnd);
440
441 pr_info("irq: clearing pending status %08x\n", (int)pend);
442 last = pend;
443 }
444}
445
446struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np,
447 struct s3c_irq_data *irq_data,
448 struct s3c_irq_intc *parent,
449 unsigned long address)
450{
451 struct s3c_irq_intc *intc;
452 void __iomem *base = (void *)0xf6000000; /* static mapping */
453 int irq_num;
454 int irq_start;
455 int irq_offset;
456 int ret;
457
458 intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL);
459 if (!intc)
460 return ERR_PTR(-ENOMEM);
461
462 intc->irqs = irq_data;
463
464 if (parent)
465 intc->parent = parent;
466
467 /* select the correct data for the controller.
468 * Need to hard code the irq num start and offset
469 * to preserve the static mapping for now
470 */
471 switch (address) {
472 case 0x4a000000:
473 pr_debug("irq: found main intc\n");
474 intc->reg_pending = base;
475 intc->reg_mask = base + 0x08;
476 intc->reg_intpnd = base + 0x10;
477 irq_num = 32;
478 irq_start = S3C2410_IRQ(0);
479 irq_offset = 0;
480 break;
481 case 0x4a000018:
482 pr_debug("irq: found subintc\n");
483 intc->reg_pending = base + 0x18;
484 intc->reg_mask = base + 0x1c;
485 irq_num = 29;
486 irq_start = S3C2410_IRQSUB(0);
487 irq_offset = 0;
488 break;
489 case 0x4a000040:
490 pr_debug("irq: found intc2\n");
491 intc->reg_pending = base + 0x40;
492 intc->reg_mask = base + 0x48;
493 intc->reg_intpnd = base + 0x50;
494 irq_num = 8;
495 irq_start = S3C2416_IRQ(0);
496 irq_offset = 0;
497 break;
498 case 0x560000a4:
499 pr_debug("irq: found eintc\n");
500 base = (void *)0xfd000000;
501
502 intc->reg_mask = base + 0xa4;
503 intc->reg_pending = base + 0xa8;
504 irq_num = 20;
505 irq_start = S3C2410_IRQ(32);
506 irq_offset = 4;
507 break;
508 default:
509 pr_err("irq: unsupported controller address\n");
510 ret = -EINVAL;
511 goto err;
512 }
513
514 /* now that all the data is complete, init the irq-domain */
515 s3c24xx_clear_intc(intc);
516 intc->domain = irq_domain_add_legacy(np, irq_num, irq_start,
517 irq_offset, &s3c24xx_irq_ops,
518 intc);
519 if (!intc->domain) {
520 pr_err("irq: could not create irq-domain\n");
521 ret = -EINVAL;
522 goto err;
523 }
524
525 return intc;
526
527err:
528 kfree(intc);
529 return ERR_PTR(ret);
530}
531
532/* s3c24xx_init_irq
533 *
534 * Initialise S3C2410 IRQ system
535*/
536
537static struct s3c_irq_data init_base[32] = {
538 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
539 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
540 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
541 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
542 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
543 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
544 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
545 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
546 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
547 { .type = S3C_IRQTYPE_EDGE, }, /* WDT */
548 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
549 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
550 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
551 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
552 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
553 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
554 { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
555 { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
556 { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
557 { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
558 { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
559 { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
560 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
561 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
562 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
563 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
564 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
565 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
566 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
567 { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
568 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
569 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
570};
571
572static struct s3c_irq_data init_eint[32] = {
573 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
574 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
575 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
576 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
577 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */
578 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */
579 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */
580 { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */
581 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */
582 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */
583 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */
584 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */
585 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */
586 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */
587 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */
588 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */
589 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */
590 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */
591 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */
592 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */
593 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */
594 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */
595 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */
596 { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */
597};
598
599static struct s3c_irq_data init_subint[32] = {
600 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
601 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
602 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
603 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
604 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
605 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
606 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
607 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
608 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
609 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
610 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
611};
612
613void __init s3c24xx_init_irq(void)
614{
615 struct s3c_irq_intc *main_intc;
616
617#ifdef CONFIG_FIQ
618 init_FIQ(FIQ_START);
619#endif
620
621 main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000);
622 if (IS_ERR(main_intc)) {
623 pr_err("irq: could not create main interrupt controller\n");
624 return;
625 }
626
627 s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018);
628 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
629}
630
631#ifdef CONFIG_CPU_S3C2416
632static struct s3c_irq_data init_s3c2416base[32] = {
633 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
634 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
635 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
636 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
637 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
638 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
639 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
640 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
641 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
642 { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
643 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
644 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
645 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
646 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
647 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
648 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
649 { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
650 { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
651 { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
652 { .type = S3C_IRQTYPE_NONE, }, /* reserved */
653 { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
654 { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
655 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
656 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
657 { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
658 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
659 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
660 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
661 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
662 { .type = S3C_IRQTYPE_NONE, },
663 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
664 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
665};
666
667static struct s3c_irq_data init_s3c2416subint[32] = {
668 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
669 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
670 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
671 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
672 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
673 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
674 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
675 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
676 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
677 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
678 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
679 { .type = S3C_IRQTYPE_NONE }, /* reserved */
680 { .type = S3C_IRQTYPE_NONE }, /* reserved */
681 { .type = S3C_IRQTYPE_NONE }, /* reserved */
682 { .type = S3C_IRQTYPE_NONE }, /* reserved */
683 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
684 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
685 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
686 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
687 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
688 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
689 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
690 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
691 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
692 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
693 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
694 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
695 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
696 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
697};
698
699static struct s3c_irq_data init_s3c2416_second[32] = {
700 { .type = S3C_IRQTYPE_EDGE }, /* 2D */
701 { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */
702 { .type = S3C_IRQTYPE_NONE }, /* reserved */
703 { .type = S3C_IRQTYPE_NONE }, /* reserved */
704 { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */
705 { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */
706 { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */
707 { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */
708};
709
710void __init s3c2416_init_irq(void)
711{
712 struct s3c_irq_intc *main_intc;
713
714 pr_info("S3C2416: IRQ Support\n");
715
716#ifdef CONFIG_FIQ
717 init_FIQ(FIQ_START);
718#endif
719
720 main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000);
721 if (IS_ERR(main_intc)) {
722 pr_err("irq: could not create main interrupt controller\n");
723 return;
724 }
725
726 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
727 s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018);
728
729 s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040);
730}
731
732#endif
733
734#ifdef CONFIG_CPU_S3C2443
735static struct s3c_irq_data init_s3c2443base[32] = {
736 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
737 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
738 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
739 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
740 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
741 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
742 { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
743 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
744 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
745 { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
746 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
747 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
748 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
749 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
750 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
751 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
752 { .type = S3C_IRQTYPE_LEVEL, }, /* LCD */
753 { .type = S3C_IRQTYPE_LEVEL, }, /* DMA */
754 { .type = S3C_IRQTYPE_LEVEL, }, /* UART3 */
755 { .type = S3C_IRQTYPE_EDGE, }, /* CFON */
756 { .type = S3C_IRQTYPE_EDGE, }, /* SDI1 */
757 { .type = S3C_IRQTYPE_EDGE, }, /* SDI0 */
758 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
759 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
760 { .type = S3C_IRQTYPE_EDGE, }, /* NAND */
761 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
762 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
763 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
764 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
765 { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
766 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
767 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
768};
769
770
771static struct s3c_irq_data init_s3c2443subint[32] = {
772 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
773 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
774 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
775 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
776 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
777 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
778 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
779 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
780 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
781 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
782 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
783 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */
784 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */
785 { .type = S3C_IRQTYPE_NONE }, /* reserved */
786 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD1 */
787 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD2 */
788 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD3 */
789 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 16 }, /* LCD4 */
790 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA0 */
791 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA1 */
792 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA2 */
793 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA3 */
794 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA4 */
795 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 17 }, /* DMA5 */
796 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-RX */
797 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-TX */
798 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 18 }, /* UART3-ERR */
799 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
800 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
801};
802
803void __init s3c2443_init_irq(void)
804{
805 struct s3c_irq_intc *main_intc;
806
807 pr_info("S3C2443: IRQ Support\n");
808
809#ifdef CONFIG_FIQ
810 init_FIQ(FIQ_START);
811#endif
812
813 main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000);
814 if (IS_ERR(main_intc)) {
815 pr_err("irq: could not create main interrupt controller\n");
816 return;
817 }
818
819 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
820 s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018);
821}
822#endif
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index 0e0279e79150..e27b5c91b3db 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -63,6 +63,8 @@
63#include <linux/mtd/map.h> 63#include <linux/mtd/map.h>
64#include <linux/mtd/physmap.h> 64#include <linux/mtd/physmap.h>
65 65
66#include <plat/samsung-time.h>
67
66#include "common.h" 68#include "common.h"
67 69
68static struct resource amlm5900_nor_resource = 70static struct resource amlm5900_nor_resource =
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void)
160 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); 162 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
161 s3c24xx_init_clocks(0); 163 s3c24xx_init_clocks(0);
162 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); 164 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
165 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
163} 166}
164 167
165#ifdef CONFIG_FB_S3C2410 168#ifdef CONFIG_FB_S3C2410
@@ -235,8 +238,8 @@ static void __init amlm5900_init(void)
235MACHINE_START(AML_M5900, "AML_M5900") 238MACHINE_START(AML_M5900, "AML_M5900")
236 .atag_offset = 0x100, 239 .atag_offset = 0x100,
237 .map_io = amlm5900_map_io, 240 .map_io = amlm5900_map_io,
238 .init_irq = s3c24xx_init_irq, 241 .init_irq = s3c2410_init_irq,
239 .init_machine = amlm5900_init, 242 .init_machine = amlm5900_init,
240 .init_time = s3c24xx_timer_init, 243 .init_time = samsung_timer_init,
241 .restart = s3c2410_restart, 244 .restart = s3c2410_restart,
242MACHINE_END 245MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index bb595f15ce36..c1fb6c37867f 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -49,6 +49,7 @@
49#include <plat/devs.h> 49#include <plat/devs.h>
50#include <plat/cpu.h> 50#include <plat/cpu.h>
51#include <linux/platform_data/asoc-s3c24xx_simtec.h> 51#include <linux/platform_data/asoc-s3c24xx_simtec.h>
52#include <plat/samsung-time.h>
52 53
53#include "anubis.h" 54#include "anubis.h"
54#include "common.h" 55#include "common.h"
@@ -410,6 +411,7 @@ static void __init anubis_map_io(void)
410 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); 411 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
411 s3c24xx_init_clocks(0); 412 s3c24xx_init_clocks(0);
412 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 413 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
414 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
413 415
414 /* check for the newer revision boards with large page nand */ 416 /* check for the newer revision boards with large page nand */
415 417
@@ -443,7 +445,7 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
443 .atag_offset = 0x100, 445 .atag_offset = 0x100,
444 .map_io = anubis_map_io, 446 .map_io = anubis_map_io,
445 .init_machine = anubis_init, 447 .init_machine = anubis_init,
446 .init_irq = s3c24xx_init_irq, 448 .init_irq = s3c2440_init_irq,
447 .init_time = s3c24xx_timer_init, 449 .init_time = samsung_timer_init,
448 .restart = s3c244x_restart, 450 .restart = s3c244x_restart,
449MACHINE_END 451MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index b4bc60c78ebb..6dfeeb7ef469 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -48,6 +48,7 @@
48#include <plat/devs.h> 48#include <plat/devs.h>
49#include <plat/cpu.h> 49#include <plat/cpu.h>
50#include <linux/platform_data/mmc-s3cmci.h> 50#include <linux/platform_data/mmc-s3cmci.h>
51#include <plat/samsung-time.h>
51 52
52#include "common.h" 53#include "common.h"
53 54
@@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void)
192 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); 193 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
193 s3c24xx_init_clocks(16934400); 194 s3c24xx_init_clocks(16934400);
194 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); 195 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
196 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
195} 197}
196 198
197static void __init at2440evb_init(void) 199static void __init at2440evb_init(void)
@@ -209,7 +211,7 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
209 .atag_offset = 0x100, 211 .atag_offset = 0x100,
210 .map_io = at2440evb_map_io, 212 .map_io = at2440evb_map_io,
211 .init_machine = at2440evb_init, 213 .init_machine = at2440evb_init,
212 .init_irq = s3c24xx_init_irq, 214 .init_irq = s3c2440_init_irq,
213 .init_time = s3c24xx_timer_init, 215 .init_time = samsung_timer_init,
214 .restart = s3c244x_restart, 216 .restart = s3c244x_restart,
215MACHINE_END 217MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index ca6618081041..22d6ae926d91 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -55,6 +55,7 @@
55#include <plat/devs.h> 55#include <plat/devs.h>
56#include <plat/gpio-cfg.h> 56#include <plat/gpio-cfg.h>
57#include <plat/regs-serial.h> 57#include <plat/regs-serial.h>
58#include <plat/samsung-time.h>
58 59
59#include "bast.h" 60#include "bast.h"
60#include "common.h" 61#include "common.h"
@@ -576,6 +577,7 @@ static void __init bast_map_io(void)
576 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 577 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
577 s3c24xx_init_clocks(0); 578 s3c24xx_init_clocks(0);
578 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); 579 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
580 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
579} 581}
580 582
581static void __init bast_init(void) 583static void __init bast_init(void)
@@ -603,8 +605,8 @@ MACHINE_START(BAST, "Simtec-BAST")
603 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 605 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
604 .atag_offset = 0x100, 606 .atag_offset = 0x100,
605 .map_io = bast_map_io, 607 .map_io = bast_map_io,
606 .init_irq = s3c24xx_init_irq, 608 .init_irq = s3c2410_init_irq,
607 .init_machine = bast_init, 609 .init_machine = bast_init,
608 .init_time = s3c24xx_timer_init, 610 .init_time = samsung_timer_init,
609 .restart = s3c2410_restart, 611 .restart = s3c2410_restart,
610MACHINE_END 612MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index a25e8c5a7b4c..13d8d073675a 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -81,6 +81,7 @@
81#include <plat/gpio-cfg.h> 81#include <plat/gpio-cfg.h>
82#include <plat/pm.h> 82#include <plat/pm.h>
83#include <plat/regs-serial.h> 83#include <plat/regs-serial.h>
84#include <plat/samsung-time.h>
84 85
85#include "common.h" 86#include "common.h"
86#include "gta02.h" 87#include "gta02.h"
@@ -501,6 +502,7 @@ static void __init gta02_map_io(void)
501 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); 502 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
502 s3c24xx_init_clocks(12000000); 503 s3c24xx_init_clocks(12000000);
503 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); 504 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
505 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
504} 506}
505 507
506 508
@@ -587,8 +589,8 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
587 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ 589 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */
588 .atag_offset = 0x100, 590 .atag_offset = 0x100,
589 .map_io = gta02_map_io, 591 .map_io = gta02_map_io,
590 .init_irq = s3c24xx_init_irq, 592 .init_irq = s3c2442_init_irq,
591 .init_machine = gta02_machine_init, 593 .init_machine = gta02_machine_init,
592 .init_time = s3c24xx_timer_init, 594 .init_time = samsung_timer_init,
593 .restart = s3c244x_restart, 595 .restart = s3c244x_restart,
594MACHINE_END 596MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 79bc0830d740..af4334d6b4d5 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -62,7 +62,7 @@
62#include <plat/pll.h> 62#include <plat/pll.h>
63#include <plat/pm.h> 63#include <plat/pm.h>
64#include <plat/regs-serial.h> 64#include <plat/regs-serial.h>
65 65#include <plat/samsung-time.h>
66 66
67#include "common.h" 67#include "common.h"
68#include "h1940.h" 68#include "h1940.h"
@@ -646,6 +646,7 @@ static void __init h1940_map_io(void)
646 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); 646 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
647 s3c24xx_init_clocks(0); 647 s3c24xx_init_clocks(0);
648 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); 648 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
649 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
649 650
650 /* setup PM */ 651 /* setup PM */
651 652
@@ -666,11 +667,6 @@ static void __init h1940_reserve(void)
666 memblock_reserve(0x30081000, 0x1000); 667 memblock_reserve(0x30081000, 0x1000);
667} 668}
668 669
669static void __init h1940_init_irq(void)
670{
671 s3c24xx_init_irq();
672}
673
674static void __init h1940_init(void) 670static void __init h1940_init(void)
675{ 671{
676 u32 tmp; 672 u32 tmp;
@@ -739,8 +735,8 @@ MACHINE_START(H1940, "IPAQ-H1940")
739 .atag_offset = 0x100, 735 .atag_offset = 0x100,
740 .map_io = h1940_map_io, 736 .map_io = h1940_map_io,
741 .reserve = h1940_reserve, 737 .reserve = h1940_reserve,
742 .init_irq = h1940_init_irq, 738 .init_irq = s3c2410_init_irq,
743 .init_machine = h1940_init, 739 .init_machine = h1940_init,
744 .init_time = s3c24xx_timer_init, 740 .init_time = samsung_timer_init,
745 .restart = s3c2410_restart, 741 .restart = s3c2410_restart,
746MACHINE_END 742MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index 54e83c1f780c..a45fcd8ccf79 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -46,14 +46,15 @@
46#include <linux/mtd/nand_ecc.h> 46#include <linux/mtd/nand_ecc.h>
47#include <linux/mtd/partitions.h> 47#include <linux/mtd/partitions.h>
48 48
49#include <plat/s3c2412.h>
50#include <plat/gpio-cfg.h> 49#include <plat/gpio-cfg.h>
51#include <plat/clock.h> 50#include <plat/clock.h>
52#include <plat/devs.h> 51#include <plat/devs.h>
53#include <plat/cpu.h> 52#include <plat/cpu.h>
54#include <plat/pm.h> 53#include <plat/pm.h>
55#include <linux/platform_data/usb-s3c2410_udc.h> 54#include <linux/platform_data/usb-s3c2410_udc.h>
55#include <plat/samsung-time.h>
56 56
57#include "common.h"
57#include "s3c2412-power.h" 58#include "s3c2412-power.h"
58 59
59static struct map_desc jive_iodesc[] __initdata = { 60static struct map_desc jive_iodesc[] __initdata = {
@@ -506,6 +507,7 @@ static void __init jive_map_io(void)
506 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); 507 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
507 s3c24xx_init_clocks(12000000); 508 s3c24xx_init_clocks(12000000);
508 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); 509 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
510 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
509} 511}
510 512
511static void jive_power_off(void) 513static void jive_power_off(void)
@@ -658,9 +660,9 @@ MACHINE_START(JIVE, "JIVE")
658 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ 660 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
659 .atag_offset = 0x100, 661 .atag_offset = 0x100,
660 662
661 .init_irq = s3c24xx_init_irq, 663 .init_irq = s3c2412_init_irq,
662 .map_io = jive_map_io, 664 .map_io = jive_map_io,
663 .init_machine = jive_machine_init, 665 .init_machine = jive_machine_init,
664 .init_time = s3c24xx_timer_init, 666 .init_time = samsung_timer_init,
665 .restart = s3c2412_restart, 667 .restart = s3c2412_restart,
666MACHINE_END 668MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 2865e5919f2c..a83db46320bc 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -56,6 +56,7 @@
56#include <plat/clock.h> 56#include <plat/clock.h>
57#include <plat/devs.h> 57#include <plat/devs.h>
58#include <plat/cpu.h> 58#include <plat/cpu.h>
59#include <plat/samsung-time.h>
59 60
60#include <sound/s3c24xx_uda134x.h> 61#include <sound/s3c24xx_uda134x.h>
61 62
@@ -525,6 +526,7 @@ static void __init mini2440_map_io(void)
525 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); 526 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
526 s3c24xx_init_clocks(12000000); 527 s3c24xx_init_clocks(12000000);
527 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); 528 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
529 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
528} 530}
529 531
530/* 532/*
@@ -686,7 +688,7 @@ MACHINE_START(MINI2440, "MINI2440")
686 .atag_offset = 0x100, 688 .atag_offset = 0x100,
687 .map_io = mini2440_map_io, 689 .map_io = mini2440_map_io,
688 .init_machine = mini2440_init, 690 .init_machine = mini2440_init,
689 .init_irq = s3c24xx_init_irq, 691 .init_irq = s3c2440_init_irq,
690 .init_time = s3c24xx_timer_init, 692 .init_time = samsung_timer_init,
691 .restart = s3c244x_restart, 693 .restart = s3c244x_restart,
692MACHINE_END 694MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index d9d04b240295..2cb46c37c920 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -48,8 +48,8 @@
48#include <plat/cpu.h> 48#include <plat/cpu.h>
49#include <plat/devs.h> 49#include <plat/devs.h>
50#include <linux/platform_data/mmc-s3cmci.h> 50#include <linux/platform_data/mmc-s3cmci.h>
51#include <plat/s3c2410.h>
52#include <linux/platform_data/usb-s3c2410_udc.h> 51#include <linux/platform_data/usb-s3c2410_udc.h>
52#include <plat/samsung-time.h>
53 53
54#include "common.h" 54#include "common.h"
55 55
@@ -536,6 +536,7 @@ static void __init n30_map_io(void)
536 n30_hwinit(); 536 n30_hwinit();
537 s3c24xx_init_clocks(0); 537 s3c24xx_init_clocks(0);
538 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); 538 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
539 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
539} 540}
540 541
541/* GPB3 is the line that controls the pull-up for the USB D+ line */ 542/* GPB3 is the line that controls the pull-up for the USB D+ line */
@@ -589,9 +590,9 @@ MACHINE_START(N30, "Acer-N30")
589 Ben Dooks <ben-linux@fluff.org> 590 Ben Dooks <ben-linux@fluff.org>
590 */ 591 */
591 .atag_offset = 0x100, 592 .atag_offset = 0x100,
592 .init_time = s3c24xx_timer_init, 593 .init_time = samsung_timer_init,
593 .init_machine = n30_init, 594 .init_machine = n30_init,
594 .init_irq = s3c24xx_init_irq, 595 .init_irq = s3c2410_init_irq,
595 .map_io = n30_map_io, 596 .map_io = n30_map_io,
596 .restart = s3c2410_restart, 597 .restart = s3c2410_restart,
597MACHINE_END 598MACHINE_END
@@ -600,9 +601,9 @@ MACHINE_START(N35, "Acer-N35")
600 /* Maintainer: Christer Weinigel <christer@weinigel.se> 601 /* Maintainer: Christer Weinigel <christer@weinigel.se>
601 */ 602 */
602 .atag_offset = 0x100, 603 .atag_offset = 0x100,
603 .init_time = s3c24xx_timer_init, 604 .init_time = samsung_timer_init,
604 .init_machine = n30_init, 605 .init_machine = n30_init,
605 .init_irq = s3c24xx_init_irq, 606 .init_irq = s3c2410_init_irq,
606 .map_io = n30_map_io, 607 .map_io = n30_map_io,
607 .restart = s3c2410_restart, 608 .restart = s3c2410_restart,
608MACHINE_END 609MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index a454e2461860..01f4354206f9 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -41,11 +41,10 @@
41#include <linux/platform_data/i2c-s3c2410.h> 41#include <linux/platform_data/i2c-s3c2410.h>
42 42
43#include <plat/gpio-cfg.h> 43#include <plat/gpio-cfg.h>
44#include <plat/s3c2410.h>
45#include <plat/s3c244x.h>
46#include <plat/clock.h> 44#include <plat/clock.h>
47#include <plat/devs.h> 45#include <plat/devs.h>
48#include <plat/cpu.h> 46#include <plat/cpu.h>
47#include <plat/samsung-time.h>
49 48
50#include "common.h" 49#include "common.h"
51 50
@@ -137,6 +136,7 @@ static void __init nexcoder_map_io(void)
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); 137 s3c24xx_init_clocks(0);
139 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); 138 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
139 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
140 140
141 nexcoder_sensorboard_init(); 141 nexcoder_sensorboard_init();
142} 142}
@@ -152,7 +152,7 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
152 .atag_offset = 0x100, 152 .atag_offset = 0x100,
153 .map_io = nexcoder_map_io, 153 .map_io = nexcoder_map_io,
154 .init_machine = nexcoder_init, 154 .init_machine = nexcoder_init,
155 .init_irq = s3c24xx_init_irq, 155 .init_irq = s3c2440_init_irq,
156 .init_time = s3c24xx_timer_init, 156 .init_time = samsung_timer_init,
157 .restart = s3c244x_restart, 157 .restart = s3c244x_restart,
158MACHINE_END 158MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index ae2cbdf3e3ca..58d6fbe5bf1f 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -45,6 +45,7 @@
45#include <plat/devs.h> 45#include <plat/devs.h>
46#include <plat/gpio-cfg.h> 46#include <plat/gpio-cfg.h>
47#include <plat/regs-serial.h> 47#include <plat/regs-serial.h>
48#include <plat/samsung-time.h>
48 49
49#include <mach/hardware.h> 50#include <mach/hardware.h>
50#include <mach/regs-gpio.h> 51#include <mach/regs-gpio.h>
@@ -384,6 +385,7 @@ static void __init osiris_map_io(void)
384 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); 385 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
385 s3c24xx_init_clocks(0); 386 s3c24xx_init_clocks(0);
386 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 387 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
388 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
387 389
388 /* check for the newer revision boards with large page nand */ 390 /* check for the newer revision boards with large page nand */
389 391
@@ -424,8 +426,8 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
424 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 426 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
425 .atag_offset = 0x100, 427 .atag_offset = 0x100,
426 .map_io = osiris_map_io, 428 .map_io = osiris_map_io,
427 .init_irq = s3c24xx_init_irq, 429 .init_irq = s3c2440_init_irq,
428 .init_machine = osiris_init, 430 .init_machine = osiris_init,
429 .init_time = s3c24xx_timer_init, 431 .init_time = samsung_timer_init,
430 .restart = s3c244x_restart, 432 .restart = s3c244x_restart,
431MACHINE_END 433MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 40a47d6c6a85..7e16b0740ec1 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -33,7 +33,7 @@
33#include <plat/cpu.h> 33#include <plat/cpu.h>
34#include <plat/devs.h> 34#include <plat/devs.h>
35#include <plat/regs-serial.h> 35#include <plat/regs-serial.h>
36#include <plat/s3c2410.h> 36#include <plat/samsung-time.h>
37 37
38#include "common.h" 38#include "common.h"
39#include "otom.h" 39#include "otom.h"
@@ -102,6 +102,7 @@ static void __init otom11_map_io(void)
102 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); 102 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
103 s3c24xx_init_clocks(0); 103 s3c24xx_init_clocks(0);
104 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); 104 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
105 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
105} 106}
106 107
107static void __init otom11_init(void) 108static void __init otom11_init(void)
@@ -115,7 +116,7 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
115 .atag_offset = 0x100, 116 .atag_offset = 0x100,
116 .map_io = otom11_map_io, 117 .map_io = otom11_map_io,
117 .init_machine = otom11_init, 118 .init_machine = otom11_init,
118 .init_irq = s3c24xx_init_irq, 119 .init_irq = s3c2410_init_irq,
119 .init_time = s3c24xx_timer_init, 120 .init_time = samsung_timer_init,
120 .restart = s3c2410_restart, 121 .restart = s3c2410_restart,
121MACHINE_END 122MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 56175f0941b1..f8feaeadb55a 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -55,13 +55,14 @@
55#include <linux/platform_data/usb-s3c2410_udc.h> 55#include <linux/platform_data/usb-s3c2410_udc.h>
56#include <linux/platform_data/i2c-s3c2410.h> 56#include <linux/platform_data/i2c-s3c2410.h>
57 57
58#include <plat/common-smdk.h>
59#include <plat/gpio-cfg.h> 58#include <plat/gpio-cfg.h>
60#include <plat/devs.h> 59#include <plat/devs.h>
61#include <plat/cpu.h> 60#include <plat/cpu.h>
62#include <plat/pm.h> 61#include <plat/pm.h>
62#include <plat/samsung-time.h>
63 63
64#include "common.h" 64#include "common.h"
65#include "common-smdk.h"
65 66
66static struct map_desc qt2410_iodesc[] __initdata = { 67static struct map_desc qt2410_iodesc[] __initdata = {
67 { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE } 68 { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void)
304 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); 305 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
305 s3c24xx_init_clocks(12*1000*1000); 306 s3c24xx_init_clocks(12*1000*1000);
306 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 307 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
308 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
307} 309}
308 310
309static void __init qt2410_machine_init(void) 311static void __init qt2410_machine_init(void)
@@ -341,8 +343,8 @@ static void __init qt2410_machine_init(void)
341MACHINE_START(QT2410, "QT2410") 343MACHINE_START(QT2410, "QT2410")
342 .atag_offset = 0x100, 344 .atag_offset = 0x100,
343 .map_io = qt2410_map_io, 345 .map_io = qt2410_map_io,
344 .init_irq = s3c24xx_init_irq, 346 .init_irq = s3c2410_init_irq,
345 .init_machine = qt2410_machine_init, 347 .init_machine = qt2410_machine_init,
346 .init_time = s3c24xx_timer_init, 348 .init_time = samsung_timer_init,
347 .restart = s3c2410_restart, 349 .restart = s3c2410_restart,
348MACHINE_END 350MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 1f9ba2ae5288..44ca018e1f96 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -56,8 +56,8 @@
56#include <plat/cpu.h> 56#include <plat/cpu.h>
57#include <plat/devs.h> 57#include <plat/devs.h>
58#include <plat/pm.h> 58#include <plat/pm.h>
59#include <plat/regs-iic.h>
60#include <plat/regs-serial.h> 59#include <plat/regs-serial.h>
60#include <plat/samsung-time.h>
61 61
62#include "common.h" 62#include "common.h"
63#include "h1940.h" 63#include "h1940.h"
@@ -741,6 +741,7 @@ static void __init rx1950_map_io(void)
741 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); 741 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
742 s3c24xx_init_clocks(16934000); 742 s3c24xx_init_clocks(16934000);
743 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); 743 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
744 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
744 745
745 /* setup PM */ 746 /* setup PM */
746 747
@@ -811,8 +812,8 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
811 .atag_offset = 0x100, 812 .atag_offset = 0x100,
812 .map_io = rx1950_map_io, 813 .map_io = rx1950_map_io,
813 .reserve = rx1950_reserve, 814 .reserve = rx1950_reserve,
814 .init_irq = s3c24xx_init_irq, 815 .init_irq = s3c2442_init_irq,
815 .init_machine = rx1950_init_machine, 816 .init_machine = rx1950_init_machine,
816 .init_time = s3c24xx_timer_init, 817 .init_time = samsung_timer_init,
817 .restart = s3c244x_restart, 818 .restart = s3c244x_restart,
818MACHINE_END 819MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index f20418a2fb1b..3bc6231d0a1f 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -49,6 +49,7 @@
49#include <plat/devs.h> 49#include <plat/devs.h>
50#include <plat/pm.h> 50#include <plat/pm.h>
51#include <plat/regs-serial.h> 51#include <plat/regs-serial.h>
52#include <plat/samsung-time.h>
52 53
53#include "common.h" 54#include "common.h"
54#include "h1940.h" 55#include "h1940.h"
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void)
179 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); 180 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
180 s3c24xx_init_clocks(16934000); 181 s3c24xx_init_clocks(16934000);
181 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 182 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
183 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
182} 184}
183 185
184/* H1940 and RX3715 need to reserve this for suspend */ 186/* H1940 and RX3715 need to reserve this for suspend */
@@ -188,11 +190,6 @@ static void __init rx3715_reserve(void)
188 memblock_reserve(0x30081000, 0x1000); 190 memblock_reserve(0x30081000, 0x1000);
189} 191}
190 192
191static void __init rx3715_init_irq(void)
192{
193 s3c24xx_init_irq();
194}
195
196static void __init rx3715_init_machine(void) 193static void __init rx3715_init_machine(void)
197{ 194{
198#ifdef CONFIG_PM_H1940 195#ifdef CONFIG_PM_H1940
@@ -210,8 +207,8 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
210 .atag_offset = 0x100, 207 .atag_offset = 0x100,
211 .map_io = rx3715_map_io, 208 .map_io = rx3715_map_io,
212 .reserve = rx3715_reserve, 209 .reserve = rx3715_reserve,
213 .init_irq = rx3715_init_irq, 210 .init_irq = s3c2440_init_irq,
214 .init_machine = rx3715_init_machine, 211 .init_machine = rx3715_init_machine,
215 .init_time = s3c24xx_timer_init, 212 .init_time = samsung_timer_init,
216 .restart = s3c244x_restart, 213 .restart = s3c244x_restart,
217MACHINE_END 214MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index e184bfa9613a..a773789e4f38 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -51,10 +51,10 @@
51 51
52#include <plat/devs.h> 52#include <plat/devs.h>
53#include <plat/cpu.h> 53#include <plat/cpu.h>
54 54#include <plat/samsung-time.h>
55#include <plat/common-smdk.h>
56 55
57#include "common.h" 56#include "common.h"
57#include "common-smdk.h"
58 58
59static struct map_desc smdk2410_iodesc[] __initdata = { 59static struct map_desc smdk2410_iodesc[] __initdata = {
60 /* nothing here yet */ 60 /* nothing here yet */
@@ -101,6 +101,7 @@ static void __init smdk2410_map_io(void)
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); 102 s3c24xx_init_clocks(0);
103 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 103 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
104 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
104} 105}
105 106
106static void __init smdk2410_init(void) 107static void __init smdk2410_init(void)
@@ -115,8 +116,8 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
115 /* Maintainer: Jonas Dietsche */ 116 /* Maintainer: Jonas Dietsche */
116 .atag_offset = 0x100, 117 .atag_offset = 0x100,
117 .map_io = smdk2410_map_io, 118 .map_io = smdk2410_map_io,
118 .init_irq = s3c24xx_init_irq, 119 .init_irq = s3c2410_init_irq,
119 .init_machine = smdk2410_init, 120 .init_machine = smdk2410_init,
120 .init_time = s3c24xx_timer_init, 121 .init_time = samsung_timer_init,
121 .restart = s3c2410_restart, 122 .restart = s3c2410_restart,
122MACHINE_END 123MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 86d7847c9d45..8146e920f10d 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -41,13 +41,13 @@
41#include <linux/platform_data/i2c-s3c2410.h> 41#include <linux/platform_data/i2c-s3c2410.h>
42#include <mach/fb.h> 42#include <mach/fb.h>
43 43
44#include <plat/s3c2410.h>
45#include <plat/s3c2412.h>
46#include <plat/clock.h> 44#include <plat/clock.h>
47#include <plat/devs.h> 45#include <plat/devs.h>
48#include <plat/cpu.h> 46#include <plat/cpu.h>
47#include <plat/samsung-time.h>
49 48
50#include <plat/common-smdk.h> 49#include "common.h"
50#include "common-smdk.h"
51 51
52static struct map_desc smdk2413_iodesc[] __initdata = { 52static struct map_desc smdk2413_iodesc[] __initdata = {
53}; 53};
@@ -106,6 +106,7 @@ static void __init smdk2413_map_io(void)
106 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); 106 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
107 s3c24xx_init_clocks(12000000); 107 s3c24xx_init_clocks(12000000);
108 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); 108 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
109 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
109} 110}
110 111
111static void __init smdk2413_machine_init(void) 112static void __init smdk2413_machine_init(void)
@@ -129,10 +130,10 @@ MACHINE_START(S3C2413, "S3C2413")
129 .atag_offset = 0x100, 130 .atag_offset = 0x100,
130 131
131 .fixup = smdk2413_fixup, 132 .fixup = smdk2413_fixup,
132 .init_irq = s3c24xx_init_irq, 133 .init_irq = s3c2412_init_irq,
133 .map_io = smdk2413_map_io, 134 .map_io = smdk2413_map_io,
134 .init_machine = smdk2413_machine_init, 135 .init_machine = smdk2413_machine_init,
135 .init_time = s3c24xx_timer_init, 136 .init_time = samsung_timer_init,
136 .restart = s3c2412_restart, 137 .restart = s3c2412_restart,
137MACHINE_END 138MACHINE_END
138 139
@@ -141,10 +142,10 @@ MACHINE_START(SMDK2412, "SMDK2412")
141 .atag_offset = 0x100, 142 .atag_offset = 0x100,
142 143
143 .fixup = smdk2413_fixup, 144 .fixup = smdk2413_fixup,
144 .init_irq = s3c24xx_init_irq, 145 .init_irq = s3c2412_init_irq,
145 .map_io = smdk2413_map_io, 146 .map_io = smdk2413_map_io,
146 .init_machine = smdk2413_machine_init, 147 .init_machine = smdk2413_machine_init,
147 .init_time = s3c24xx_timer_init, 148 .init_time = samsung_timer_init,
148 .restart = s3c2412_restart, 149 .restart = s3c2412_restart,
149MACHINE_END 150MACHINE_END
150 151
@@ -153,9 +154,9 @@ MACHINE_START(SMDK2413, "SMDK2413")
153 .atag_offset = 0x100, 154 .atag_offset = 0x100,
154 155
155 .fixup = smdk2413_fixup, 156 .fixup = smdk2413_fixup,
156 .init_irq = s3c24xx_init_irq, 157 .init_irq = s3c2412_init_irq,
157 .map_io = smdk2413_map_io, 158 .map_io = smdk2413_map_io,
158 .init_machine = smdk2413_machine_init, 159 .init_machine = smdk2413_machine_init,
159 .init_time = s3c24xx_timer_init, 160 .init_time = samsung_timer_init,
160 .restart = s3c2412_restart, 161 .restart = s3c2412_restart,
161MACHINE_END 162MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index ebb2e61f3d07..cb46847c66b4 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -42,7 +42,6 @@
42#include <linux/platform_data/leds-s3c24xx.h> 42#include <linux/platform_data/leds-s3c24xx.h>
43#include <linux/platform_data/i2c-s3c2410.h> 43#include <linux/platform_data/i2c-s3c2410.h>
44 44
45#include <plat/s3c2416.h>
46#include <plat/gpio-cfg.h> 45#include <plat/gpio-cfg.h>
47#include <plat/clock.h> 46#include <plat/clock.h>
48#include <plat/devs.h> 47#include <plat/devs.h>
@@ -51,10 +50,12 @@
51#include <plat/sdhci.h> 50#include <plat/sdhci.h>
52#include <linux/platform_data/usb-s3c2410_udc.h> 51#include <linux/platform_data/usb-s3c2410_udc.h>
53#include <linux/platform_data/s3c-hsudc.h> 52#include <linux/platform_data/s3c-hsudc.h>
53#include <plat/samsung-time.h>
54 54
55#include <plat/fb.h> 55#include <plat/fb.h>
56 56
57#include <plat/common-smdk.h> 57#include "common.h"
58#include "common-smdk.h"
58 59
59static struct map_desc smdk2416_iodesc[] __initdata = { 60static struct map_desc smdk2416_iodesc[] __initdata = {
60 /* ISA IO Space map (memory space selected by A24) */ 61 /* ISA IO Space map (memory space selected by A24) */
@@ -221,6 +222,7 @@ static void __init smdk2416_map_io(void)
221 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); 222 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
222 s3c24xx_init_clocks(12000000); 223 s3c24xx_init_clocks(12000000);
223 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); 224 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
225 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
224} 226}
225 227
226static void __init smdk2416_machine_init(void) 228static void __init smdk2416_machine_init(void)
@@ -253,6 +255,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
253 .init_irq = s3c2416_init_irq, 255 .init_irq = s3c2416_init_irq,
254 .map_io = smdk2416_map_io, 256 .map_io = smdk2416_map_io,
255 .init_machine = smdk2416_machine_init, 257 .init_machine = smdk2416_machine_init,
256 .init_time = s3c24xx_timer_init, 258 .init_time = samsung_timer_init,
257 .restart = s3c2416_restart, 259 .restart = s3c2416_restart,
258MACHINE_END 260MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index 08cc38c8a4ae..de2e5d39a847 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -38,15 +38,13 @@
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/s3c2410.h>
42#include <plat/s3c244x.h>
43#include <plat/clock.h> 41#include <plat/clock.h>
44#include <plat/devs.h> 42#include <plat/devs.h>
45#include <plat/cpu.h> 43#include <plat/cpu.h>
46 44#include <plat/samsung-time.h>
47#include <plat/common-smdk.h>
48 45
49#include "common.h" 46#include "common.h"
47#include "common-smdk.h"
50 48
51static struct map_desc smdk2440_iodesc[] __initdata = { 49static struct map_desc smdk2440_iodesc[] __initdata = {
52 /* ISA IO Space map (memory space selected by A24) */ 50 /* ISA IO Space map (memory space selected by A24) */
@@ -163,6 +161,7 @@ static void __init smdk2440_map_io(void)
163 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); 161 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
164 s3c24xx_init_clocks(16934400); 162 s3c24xx_init_clocks(16934400);
165 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); 163 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
164 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
166} 165}
167 166
168static void __init smdk2440_machine_init(void) 167static void __init smdk2440_machine_init(void)
@@ -178,9 +177,9 @@ MACHINE_START(S3C2440, "SMDK2440")
178 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ 177 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
179 .atag_offset = 0x100, 178 .atag_offset = 0x100,
180 179
181 .init_irq = s3c24xx_init_irq, 180 .init_irq = s3c2440_init_irq,
182 .map_io = smdk2440_map_io, 181 .map_io = smdk2440_map_io,
183 .init_machine = smdk2440_machine_init, 182 .init_machine = smdk2440_machine_init,
184 .init_time = s3c24xx_timer_init, 183 .init_time = samsung_timer_init,
185 .restart = s3c244x_restart, 184 .restart = s3c244x_restart,
186MACHINE_END 185MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index fc65d74d3c73..9435c3bef18a 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -38,13 +38,13 @@
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/s3c2410.h>
42#include <plat/s3c2443.h>
43#include <plat/clock.h> 41#include <plat/clock.h>
44#include <plat/devs.h> 42#include <plat/devs.h>
45#include <plat/cpu.h> 43#include <plat/cpu.h>
44#include <plat/samsung-time.h>
46 45
47#include <plat/common-smdk.h> 46#include "common.h"
47#include "common-smdk.h"
48 48
49static struct map_desc smdk2443_iodesc[] __initdata = { 49static struct map_desc smdk2443_iodesc[] __initdata = {
50 /* ISA IO Space map (memory space selected by A24) */ 50 /* ISA IO Space map (memory space selected by A24) */
@@ -122,6 +122,7 @@ static void __init smdk2443_map_io(void)
122 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); 122 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
123 s3c24xx_init_clocks(12000000); 123 s3c24xx_init_clocks(12000000);
124 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); 124 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
125 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
125} 126}
126 127
127static void __init smdk2443_machine_init(void) 128static void __init smdk2443_machine_init(void)
@@ -143,6 +144,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
143 .init_irq = s3c2443_init_irq, 144 .init_irq = s3c2443_init_irq,
144 .map_io = smdk2443_map_io, 145 .map_io = smdk2443_map_io,
145 .init_machine = smdk2443_machine_init, 146 .init_machine = smdk2443_machine_init,
146 .init_time = s3c24xx_timer_init, 147 .init_time = samsung_timer_init,
147 .restart = s3c2443_restart, 148 .restart = s3c2443_restart,
148MACHINE_END 149MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 24b3d79e7b2c..7fad8f055cab 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -53,6 +53,7 @@
53#include <linux/mtd/partitions.h> 53#include <linux/mtd/partitions.h>
54#include <linux/mtd/map.h> 54#include <linux/mtd/map.h>
55#include <linux/mtd/physmap.h> 55#include <linux/mtd/physmap.h>
56#include <plat/samsung-time.h>
56 57
57#include "common.h" 58#include "common.h"
58 59
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void)
136 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); 137 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
137 s3c24xx_init_clocks(0); 138 s3c24xx_init_clocks(0);
138 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); 139 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
140 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
139} 141}
140 142
141static void __init tct_hammer_init(void) 143static void __init tct_hammer_init(void)
@@ -147,8 +149,8 @@ static void __init tct_hammer_init(void)
147MACHINE_START(TCT_HAMMER, "TCT_HAMMER") 149MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
148 .atag_offset = 0x100, 150 .atag_offset = 0x100,
149 .map_io = tct_hammer_map_io, 151 .map_io = tct_hammer_map_io,
150 .init_irq = s3c24xx_init_irq, 152 .init_irq = s3c2410_init_irq,
151 .init_machine = tct_hammer_init, 153 .init_machine = tct_hammer_init,
152 .init_time = s3c24xx_timer_init, 154 .init_time = samsung_timer_init,
153 .restart = s3c2410_restart, 155 .restart = s3c2410_restart,
154MACHINE_END 156MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index ec42d1e4e465..42e7187fed60 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -45,6 +45,7 @@
45#include <plat/cpu.h> 45#include <plat/cpu.h>
46#include <plat/devs.h> 46#include <plat/devs.h>
47#include <plat/regs-serial.h> 47#include <plat/regs-serial.h>
48#include <plat/samsung-time.h>
48 49
49#include "bast.h" 50#include "bast.h"
50#include "common.h" 51#include "common.h"
@@ -332,6 +333,7 @@ static void __init vr1000_map_io(void)
332 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); 333 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
333 s3c24xx_init_clocks(0); 334 s3c24xx_init_clocks(0);
334 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); 335 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
336 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
335} 337}
336 338
337static void __init vr1000_init(void) 339static void __init vr1000_init(void)
@@ -353,7 +355,7 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
353 .atag_offset = 0x100, 355 .atag_offset = 0x100,
354 .map_io = vr1000_map_io, 356 .map_io = vr1000_map_io,
355 .init_machine = vr1000_init, 357 .init_machine = vr1000_init,
356 .init_irq = s3c24xx_init_irq, 358 .init_irq = s3c2410_init_irq,
357 .init_time = s3c24xx_timer_init, 359 .init_time = samsung_timer_init,
358 .restart = s3c2410_restart, 360 .restart = s3c2410_restart,
359MACHINE_END 361MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index 3e2bfddc9df1..b66588428ec9 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -41,12 +41,12 @@
41#include <linux/platform_data/i2c-s3c2410.h> 41#include <linux/platform_data/i2c-s3c2410.h>
42#include <linux/platform_data/mtd-nand-s3c2410.h> 42#include <linux/platform_data/mtd-nand-s3c2410.h>
43 43
44#include <plat/s3c2410.h>
45#include <plat/s3c2412.h>
46#include <plat/clock.h> 44#include <plat/clock.h>
47#include <plat/devs.h> 45#include <plat/devs.h>
48#include <plat/cpu.h> 46#include <plat/cpu.h>
47#include <plat/samsung-time.h>
49 48
49#include "common.h"
50 50
51static struct map_desc vstms_iodesc[] __initdata = { 51static struct map_desc vstms_iodesc[] __initdata = {
52}; 52};
@@ -143,6 +143,7 @@ static void __init vstms_map_io(void)
143 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); 143 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
144 s3c24xx_init_clocks(12000000); 144 s3c24xx_init_clocks(12000000);
145 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); 145 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
146 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
146} 147}
147 148
148static void __init vstms_init(void) 149static void __init vstms_init(void)
@@ -157,9 +158,9 @@ MACHINE_START(VSTMS, "VSTMS")
157 .atag_offset = 0x100, 158 .atag_offset = 0x100,
158 159
159 .fixup = vstms_fixup, 160 .fixup = vstms_fixup,
160 .init_irq = s3c24xx_init_irq, 161 .init_irq = s3c2412_init_irq,
161 .init_machine = vstms_init, 162 .init_machine = vstms_init,
162 .map_io = vstms_map_io, 163 .map_io = vstms_map_io,
163 .init_time = s3c24xx_timer_init, 164 .init_time = samsung_timer_init,
164 .restart = s3c2412_restart, 165 .restart = s3c2412_restart,
165MACHINE_END 166MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c
index 668a78a8b195..d75f95e487ee 100644
--- a/arch/arm/mach-s3c24xx/pm-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c
@@ -29,7 +29,7 @@
29 29
30#include <plat/cpu.h> 30#include <plat/cpu.h>
31#include <plat/pm.h> 31#include <plat/pm.h>
32#include <plat/s3c2412.h> 32#include <plat/wakeup-mask.h>
33 33
34#include "regs-dsc.h" 34#include "regs-dsc.h"
35#include "s3c2412-power.h" 35#include "s3c2412-power.h"
@@ -52,8 +52,15 @@ static int s3c2412_cpu_suspend(unsigned long arg)
52 return 1; /* Aborting suspend */ 52 return 1; /* Aborting suspend */
53} 53}
54 54
55/* mapping of interrupts to parts of the wakeup mask */
56static struct samsung_wakeup_mask wake_irqs[] = {
57 { .irq = IRQ_RTC, .bit = S3C2412_PWRCFG_RTC_MASKIRQ, },
58};
59
55static void s3c2412_pm_prepare(void) 60static void s3c2412_pm_prepare(void)
56{ 61{
62 samsung_sync_wakemask(S3C2412_PWRCFG,
63 wake_irqs, ARRAY_SIZE(wake_irqs));
57} 64}
58 65
59static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) 66static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif)
diff --git a/arch/arm/mach-s3c24xx/regs-dsc.h b/arch/arm/mach-s3c24xx/regs-dsc.h
index 98fd4a05587c..61b3d1387d76 100644
--- a/arch/arm/mach-s3c24xx/regs-dsc.h
+++ b/arch/arm/mach-s3c24xx/regs-dsc.h
@@ -1,5 +1,4 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-dsc.h 1/*
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> 2 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/ 3 * http://www.simtec.co.uk/products/SWLINUX/
5 * 4 *
@@ -12,209 +11,15 @@
12 11
13 12
14#ifndef __ASM_ARCH_REGS_DSC_H 13#ifndef __ASM_ARCH_REGS_DSC_H
15#define __ASM_ARCH_REGS_DSC_H "2440-dsc" 14#define __ASM_ARCH_REGS_DSC_H __FILE__
16 15
17#if defined(CONFIG_CPU_S3C2412) 16/* S3C2412 */
18#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc) 17#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)
19#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0) 18#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)
20#endif
21
22#if defined(CONFIG_CPU_S3C2416)
23#define S3C2416_DSC0 S3C2410_GPIOREG(0xc0)
24#define S3C2416_DSC1 S3C2410_GPIOREG(0xc4)
25#define S3C2416_DSC2 S3C2410_GPIOREG(0xc8)
26#define S3C2416_DSC3 S3C2410_GPIOREG(0x110)
27
28#define S3C2416_SELECT_DSC0 (0 << 30)
29#define S3C2416_SELECT_DSC1 (1 << 30)
30#define S3C2416_SELECT_DSC2 (2 << 30)
31#define S3C2416_SELECT_DSC3 (3 << 30)
32
33#define S3C2416_DSC_GETSHIFT(x) (x & 30)
34
35#define S3C2416_DSC0_CF (S3C2416_SELECT_DSC0 | 28)
36#define S3C2416_DSC0_CF_5mA (0 << 28)
37#define S3C2416_DSC0_CF_10mA (1 << 28)
38#define S3C2416_DSC0_CF_15mA (2 << 28)
39#define S3C2416_DSC0_CF_21mA (3 << 28)
40#define S3C2416_DSC0_CF_MASK (3 << 28)
41
42#define S3C2416_DSC0_nRBE (S3C2416_SELECT_DSC0 | 26)
43#define S3C2416_DSC0_nRBE_5mA (0 << 26)
44#define S3C2416_DSC0_nRBE_10mA (1 << 26)
45#define S3C2416_DSC0_nRBE_15mA (2 << 26)
46#define S3C2416_DSC0_nRBE_21mA (3 << 26)
47#define S3C2416_DSC0_nRBE_MASK (3 << 26)
48
49#define S3C2416_DSC0_nROE (S3C2416_SELECT_DSC0 | 24)
50#define S3C2416_DSC0_nROE_5mA (0 << 24)
51#define S3C2416_DSC0_nROE_10mA (1 << 24)
52#define S3C2416_DSC0_nROE_15mA (2 << 24)
53#define S3C2416_DSC0_nROE_21mA (3 << 24)
54#define S3C2416_DSC0_nROE_MASK (3 << 24)
55
56#endif
57
58#if defined(CONFIG_CPU_S3C244X)
59 19
20/* S3C2440 */
60#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4) 21#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4)
61#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8) 22#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8)
62 23
63#define S3C2440_SELECT_DSC0 (0)
64#define S3C2440_SELECT_DSC1 (1<<31)
65
66#define S3C2440_DSC_GETSHIFT(x) ((x) & 31)
67
68#define S3C2440_DSC0_DISABLE (1<<31)
69
70#define S3C2440_DSC0_ADDR (S3C2440_SELECT_DSC0 | 8)
71#define S3C2440_DSC0_ADDR_12mA (0<<8)
72#define S3C2440_DSC0_ADDR_10mA (1<<8)
73#define S3C2440_DSC0_ADDR_8mA (2<<8)
74#define S3C2440_DSC0_ADDR_6mA (3<<8)
75#define S3C2440_DSC0_ADDR_MASK (3<<8)
76
77/* D24..D31 */
78#define S3C2440_DSC0_DATA3 (S3C2440_SELECT_DSC0 | 6)
79#define S3C2440_DSC0_DATA3_12mA (0<<6)
80#define S3C2440_DSC0_DATA3_10mA (1<<6)
81#define S3C2440_DSC0_DATA3_8mA (2<<6)
82#define S3C2440_DSC0_DATA3_6mA (3<<6)
83#define S3C2440_DSC0_DATA3_MASK (3<<6)
84
85/* D16..D23 */
86#define S3C2440_DSC0_DATA2 (S3C2440_SELECT_DSC0 | 4)
87#define S3C2440_DSC0_DATA2_12mA (0<<4)
88#define S3C2440_DSC0_DATA2_10mA (1<<4)
89#define S3C2440_DSC0_DATA2_8mA (2<<4)
90#define S3C2440_DSC0_DATA2_6mA (3<<4)
91#define S3C2440_DSC0_DATA2_MASK (3<<4)
92
93/* D8..D15 */
94#define S3C2440_DSC0_DATA1 (S3C2440_SELECT_DSC0 | 2)
95#define S3C2440_DSC0_DATA1_12mA (0<<2)
96#define S3C2440_DSC0_DATA1_10mA (1<<2)
97#define S3C2440_DSC0_DATA1_8mA (2<<2)
98#define S3C2440_DSC0_DATA1_6mA (3<<2)
99#define S3C2440_DSC0_DATA1_MASK (3<<2)
100
101/* D0..D7 */
102#define S3C2440_DSC0_DATA0 (S3C2440_SELECT_DSC0 | 0)
103#define S3C2440_DSC0_DATA0_12mA (0<<0)
104#define S3C2440_DSC0_DATA0_10mA (1<<0)
105#define S3C2440_DSC0_DATA0_8mA (2<<0)
106#define S3C2440_DSC0_DATA0_6mA (3<<0)
107#define S3C2440_DSC0_DATA0_MASK (3<<0)
108
109#define S3C2440_DSC1_SCK1 (S3C2440_SELECT_DSC1 | 28)
110#define S3C2440_DSC1_SCK1_12mA (0<<28)
111#define S3C2440_DSC1_SCK1_10mA (1<<28)
112#define S3C2440_DSC1_SCK1_8mA (2<<28)
113#define S3C2440_DSC1_SCK1_6mA (3<<28)
114#define S3C2440_DSC1_SCK1_MASK (3<<28)
115
116#define S3C2440_DSC1_SCK0 (S3C2440_SELECT_DSC1 | 26)
117#define S3C2440_DSC1_SCK0_12mA (0<<26)
118#define S3C2440_DSC1_SCK0_10mA (1<<26)
119#define S3C2440_DSC1_SCK0_8mA (2<<26)
120#define S3C2440_DSC1_SCK0_6mA (3<<26)
121#define S3C2440_DSC1_SCK0_MASK (3<<26)
122
123#define S3C2440_DSC1_SCKE (S3C2440_SELECT_DSC1 | 24)
124#define S3C2440_DSC1_SCKE_10mA (0<<24)
125#define S3C2440_DSC1_SCKE_8mA (1<<24)
126#define S3C2440_DSC1_SCKE_6mA (2<<24)
127#define S3C2440_DSC1_SCKE_4mA (3<<24)
128#define S3C2440_DSC1_SCKE_MASK (3<<24)
129
130/* SDRAM nRAS/nCAS */
131#define S3C2440_DSC1_SDR (S3C2440_SELECT_DSC1 | 22)
132#define S3C2440_DSC1_SDR_10mA (0<<22)
133#define S3C2440_DSC1_SDR_8mA (1<<22)
134#define S3C2440_DSC1_SDR_6mA (2<<22)
135#define S3C2440_DSC1_SDR_4mA (3<<22)
136#define S3C2440_DSC1_SDR_MASK (3<<22)
137
138/* NAND Flash Controller */
139#define S3C2440_DSC1_NFC (S3C2440_SELECT_DSC1 | 20)
140#define S3C2440_DSC1_NFC_10mA (0<<20)
141#define S3C2440_DSC1_NFC_8mA (1<<20)
142#define S3C2440_DSC1_NFC_6mA (2<<20)
143#define S3C2440_DSC1_NFC_4mA (3<<20)
144#define S3C2440_DSC1_NFC_MASK (3<<20)
145
146/* nBE[0..3] */
147#define S3C2440_DSC1_nBE (S3C2440_SELECT_DSC1 | 18)
148#define S3C2440_DSC1_nBE_10mA (0<<18)
149#define S3C2440_DSC1_nBE_8mA (1<<18)
150#define S3C2440_DSC1_nBE_6mA (2<<18)
151#define S3C2440_DSC1_nBE_4mA (3<<18)
152#define S3C2440_DSC1_nBE_MASK (3<<18)
153
154#define S3C2440_DSC1_WOE (S3C2440_SELECT_DSC1 | 16)
155#define S3C2440_DSC1_WOE_10mA (0<<16)
156#define S3C2440_DSC1_WOE_8mA (1<<16)
157#define S3C2440_DSC1_WOE_6mA (2<<16)
158#define S3C2440_DSC1_WOE_4mA (3<<16)
159#define S3C2440_DSC1_WOE_MASK (3<<16)
160
161#define S3C2440_DSC1_CS7 (S3C2440_SELECT_DSC1 | 14)
162#define S3C2440_DSC1_CS7_10mA (0<<14)
163#define S3C2440_DSC1_CS7_8mA (1<<14)
164#define S3C2440_DSC1_CS7_6mA (2<<14)
165#define S3C2440_DSC1_CS7_4mA (3<<14)
166#define S3C2440_DSC1_CS7_MASK (3<<14)
167
168#define S3C2440_DSC1_CS6 (S3C2440_SELECT_DSC1 | 12)
169#define S3C2440_DSC1_CS6_10mA (0<<12)
170#define S3C2440_DSC1_CS6_8mA (1<<12)
171#define S3C2440_DSC1_CS6_6mA (2<<12)
172#define S3C2440_DSC1_CS6_4mA (3<<12)
173#define S3C2440_DSC1_CS6_MASK (3<<12)
174
175#define S3C2440_DSC1_CS5 (S3C2440_SELECT_DSC1 | 10)
176#define S3C2440_DSC1_CS5_10mA (0<<10)
177#define S3C2440_DSC1_CS5_8mA (1<<10)
178#define S3C2440_DSC1_CS5_6mA (2<<10)
179#define S3C2440_DSC1_CS5_4mA (3<<10)
180#define S3C2440_DSC1_CS5_MASK (3<<10)
181
182#define S3C2440_DSC1_CS4 (S3C2440_SELECT_DSC1 | 8)
183#define S3C2440_DSC1_CS4_10mA (0<<8)
184#define S3C2440_DSC1_CS4_8mA (1<<8)
185#define S3C2440_DSC1_CS4_6mA (2<<8)
186#define S3C2440_DSC1_CS4_4mA (3<<8)
187#define S3C2440_DSC1_CS4_MASK (3<<8)
188
189#define S3C2440_DSC1_CS3 (S3C2440_SELECT_DSC1 | 6)
190#define S3C2440_DSC1_CS3_10mA (0<<6)
191#define S3C2440_DSC1_CS3_8mA (1<<6)
192#define S3C2440_DSC1_CS3_6mA (2<<6)
193#define S3C2440_DSC1_CS3_4mA (3<<6)
194#define S3C2440_DSC1_CS3_MASK (3<<6)
195
196#define S3C2440_DSC1_CS2 (S3C2440_SELECT_DSC1 | 4)
197#define S3C2440_DSC1_CS2_10mA (0<<4)
198#define S3C2440_DSC1_CS2_8mA (1<<4)
199#define S3C2440_DSC1_CS2_6mA (2<<4)
200#define S3C2440_DSC1_CS2_4mA (3<<4)
201#define S3C2440_DSC1_CS2_MASK (3<<4)
202
203#define S3C2440_DSC1_CS1 (S3C2440_SELECT_DSC1 | 2)
204#define S3C2440_DSC1_CS1_10mA (0<<2)
205#define S3C2440_DSC1_CS1_8mA (1<<2)
206#define S3C2440_DSC1_CS1_6mA (2<<2)
207#define S3C2440_DSC1_CS1_4mA (3<<2)
208#define S3C2440_DSC1_CS1_MASK (3<<2)
209
210#define S3C2440_DSC1_CS0 (S3C2440_SELECT_DSC1 | 0)
211#define S3C2440_DSC1_CS0_10mA (0<<0)
212#define S3C2440_DSC1_CS0_8mA (1<<0)
213#define S3C2440_DSC1_CS0_6mA (2<<0)
214#define S3C2440_DSC1_CS0_4mA (3<<0)
215#define S3C2440_DSC1_CS0_MASK (3<<0)
216
217#endif /* CONFIG_CPU_S3C2440 */
218
219#endif /* __ASM_ARCH_REGS_DSC_H */ 24#endif /* __ASM_ARCH_REGS_DSC_H */
220 25
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 9ebef95da721..d850ea5adac2 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -37,7 +37,6 @@
37#include <mach/regs-clock.h> 37#include <mach/regs-clock.h>
38#include <plat/regs-serial.h> 38#include <plat/regs-serial.h>
39 39
40#include <plat/s3c2410.h>
41#include <plat/cpu.h> 40#include <plat/cpu.h>
42#include <plat/devs.h> 41#include <plat/devs.h>
43#include <plat/clock.h> 42#include <plat/clock.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index 0d592159a5c3..0f864d4c97de 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -44,7 +44,6 @@
44#include <plat/pm.h> 44#include <plat/pm.h>
45#include <plat/regs-serial.h> 45#include <plat/regs-serial.h>
46#include <plat/regs-spi.h> 46#include <plat/regs-spi.h>
47#include <plat/s3c2412.h>
48 47
49#include "common.h" 48#include "common.h"
50#include "regs-dsc.h" 49#include "regs-dsc.h"
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index e30476db0295..b9c5d382dafb 100644
--- a/arch/arm/mach-s3c24xx/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -50,7 +50,6 @@
50#include <plat/gpio-core.h> 50#include <plat/gpio-core.h>
51#include <plat/gpio-cfg.h> 51#include <plat/gpio-cfg.h>
52#include <plat/gpio-cfg-helpers.h> 52#include <plat/gpio-cfg-helpers.h>
53#include <plat/s3c2416.h>
54#include <plat/devs.h> 53#include <plat/devs.h>
55#include <plat/cpu.h> 54#include <plat/cpu.h>
56#include <plat/sdhci.h> 55#include <plat/sdhci.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c
index 559e394e8989..5f9d6569475d 100644
--- a/arch/arm/mach-s3c24xx/s3c2440.c
+++ b/arch/arm/mach-s3c24xx/s3c2440.c
@@ -33,7 +33,6 @@
33 33
34#include <plat/devs.h> 34#include <plat/devs.h>
35#include <plat/cpu.h> 35#include <plat/cpu.h>
36#include <plat/s3c244x.h>
37#include <plat/pm.h> 36#include <plat/pm.h>
38 37
39#include <plat/gpio-core.h> 38#include <plat/gpio-core.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
index f732826c2359..6819961f6b19 100644
--- a/arch/arm/mach-s3c24xx/s3c2442.c
+++ b/arch/arm/mach-s3c24xx/s3c2442.c
@@ -44,7 +44,6 @@
44 44
45#include <plat/clock.h> 45#include <plat/clock.h>
46#include <plat/cpu.h> 46#include <plat/cpu.h>
47#include <plat/s3c244x.h>
48#include <plat/pm.h> 47#include <plat/pm.h>
49 48
50#include <plat/gpio-core.h> 49#include <plat/gpio-core.h>
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index 165b6a6b3daa..8328cd65bf3d 100644
--- a/arch/arm/mach-s3c24xx/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -36,7 +36,6 @@
36#include <plat/gpio-core.h> 36#include <plat/gpio-core.h>
37#include <plat/gpio-cfg.h> 37#include <plat/gpio-cfg.h>
38#include <plat/gpio-cfg-helpers.h> 38#include <plat/gpio-cfg-helpers.h>
39#include <plat/s3c2443.h>
40#include <plat/devs.h> 39#include <plat/devs.h>
41#include <plat/cpu.h> 40#include <plat/cpu.h>
42#include <plat/fb-core.h> 41#include <plat/fb-core.h>
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index ad2671baa910..2a35edb67354 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -37,8 +37,6 @@
37#include <plat/regs-serial.h> 37#include <plat/regs-serial.h>
38#include <mach/regs-gpio.h> 38#include <mach/regs-gpio.h>
39 39
40#include <plat/s3c2410.h>
41#include <plat/s3c244x.h>
42#include <plat/clock.h> 40#include <plat/clock.h>
43#include <plat/devs.h> 41#include <plat/devs.h>
44#include <plat/cpu.h> 42#include <plat/cpu.h>
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 131c86284711..20578536aec7 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -17,11 +17,13 @@ config PLAT_S3C64XX
17# Configuration options for the S3C6410 CPU 17# Configuration options for the S3C6410 CPU
18 18
19config CPU_S3C6400 19config CPU_S3C6400
20 select SAMSUNG_HRT
20 bool 21 bool
21 help 22 help
22 Enable S3C6400 CPU support 23 Enable S3C6400 CPU support
23 24
24config CPU_S3C6410 25config CPU_S3C6410
26 select SAMSUNG_HRT
25 bool 27 bool
26 help 28 help
27 Enable S3C6410 CPU support 29 Enable S3C6410 CPU support
@@ -198,10 +200,7 @@ endchoice
198config SMDK6410_WM1190_EV1 200config SMDK6410_WM1190_EV1
199 bool "Support Wolfson Microelectronics 1190-EV1 PMIC card" 201 bool "Support Wolfson Microelectronics 1190-EV1 PMIC card"
200 depends on MACH_SMDK6410 202 depends on MACH_SMDK6410
201 select MFD_WM8350_CONFIG_MODE_0
202 select MFD_WM8350_CONFIG_MODE_3
203 select MFD_WM8350_I2C 203 select MFD_WM8350_I2C
204 select MFD_WM8352_CONFIG_MODE_0
205 select REGULATOR 204 select REGULATOR
206 select REGULATOR_WM8350 205 select REGULATOR_WM8350
207 select SAMSUNG_GPIO_EXTRA64 206 select SAMSUNG_GPIO_EXTRA64
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index f9ce1dc28ce4..31d0c9101272 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_S3C64XX_DMA) += dma.o
32 32
33obj-y += dev-uart.o 33obj-y += dev-uart.o
34obj-y += dev-audio.o 34obj-y += dev-audio.o
35obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
36 35
37# Device setup 36# Device setup
38 37
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
index ead5fab0dbb5..3c8ab07c2012 100644
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ b/arch/arm/mach-s3c64xx/cpuidle.c
@@ -40,12 +40,9 @@ static int s3c64xx_enter_idle(struct cpuidle_device *dev,
40 return index; 40 return index;
41} 41}
42 42
43static DEFINE_PER_CPU(struct cpuidle_device, s3c64xx_cpuidle_device);
44
45static struct cpuidle_driver s3c64xx_cpuidle_driver = { 43static struct cpuidle_driver s3c64xx_cpuidle_driver = {
46 .name = "s3c64xx_cpuidle", 44 .name = "s3c64xx_cpuidle",
47 .owner = THIS_MODULE, 45 .owner = THIS_MODULE,
48 .en_core_tk_irqen = 1,
49 .states = { 46 .states = {
50 { 47 {
51 .enter = s3c64xx_enter_idle, 48 .enter = s3c64xx_enter_idle,
@@ -61,16 +58,6 @@ static struct cpuidle_driver s3c64xx_cpuidle_driver = {
61 58
62static int __init s3c64xx_init_cpuidle(void) 59static int __init s3c64xx_init_cpuidle(void)
63{ 60{
64 int ret; 61 return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
65
66 cpuidle_register_driver(&s3c64xx_cpuidle_driver);
67
68 ret = cpuidle_register_device(&s3c64xx_cpuidle_device);
69 if (ret) {
70 pr_err("Failed to register cpuidle device: %d\n", ret);
71 return ret;
72 }
73
74 return 0;
75} 62}
76device_initcall(s3c64xx_init_cpuidle); 63device_initcall(s3c64xx_init_cpuidle);
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 6af1aa1ef213..759846c28d12 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -509,6 +509,7 @@ int s3c2410_dma_request(enum dma_ch channel,
509 chan->client = client; 509 chan->client = client;
510 chan->in_use = 1; 510 chan->in_use = 1;
511 chan->peripheral = channel; 511 chan->peripheral = channel;
512 chan->flags = 0;
512 513
513 local_irq_restore(flags); 514 local_irq_restore(flags);
514 515
diff --git a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
index c0c076a90f27..dd9ccca5de1f 100644
--- a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
@@ -35,4 +35,4 @@
35 * will be fine with us. 35 * will be fine with us.
36 */ 36 */
37 37
38#include <plat/debug-macro.S> 38#include <debug/samsung.S>
diff --git a/arch/arm/mach-s3c64xx/include/mach/dma.h b/arch/arm/mach-s3c64xx/include/mach/dma.h
index 57b1ff4b2d7c..fe1a98cf0e4c 100644
--- a/arch/arm/mach-s3c64xx/include/mach/dma.h
+++ b/arch/arm/mach-s3c64xx/include/mach/dma.h
@@ -21,7 +21,6 @@
21 */ 21 */
22enum dma_ch { 22enum dma_ch {
23 /* DMA0/SDMA0 */ 23 /* DMA0/SDMA0 */
24 DMACH_DT_PROP = -1, /* not yet supported, do not use */
25 DMACH_UART0 = 0, 24 DMACH_UART0 = 0,
26 DMACH_UART0_SRC2, 25 DMACH_UART0_SRC2,
27 DMACH_UART1, 26 DMACH_UART1,
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 728eef3296b2..35e3f54574ef 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -49,6 +49,7 @@
49#include <plat/devs.h> 49#include <plat/devs.h>
50#include <plat/cpu.h> 50#include <plat/cpu.h>
51#include <mach/regs-gpio.h> 51#include <mach/regs-gpio.h>
52#include <plat/samsung-time.h>
52 53
53#include "common.h" 54#include "common.h"
54#include "regs-modem.h" 55#include "regs-modem.h"
@@ -208,6 +209,7 @@ static void __init anw6410_map_io(void)
208 s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); 209 s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
209 s3c24xx_init_clocks(12000000); 210 s3c24xx_init_clocks(12000000);
210 s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); 211 s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
212 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
211 213
212 anw6410_lcd_mode_set(); 214 anw6410_lcd_mode_set();
213} 215}
@@ -232,6 +234,6 @@ MACHINE_START(ANW6410, "A&W6410")
232 .map_io = anw6410_map_io, 234 .map_io = anw6410_map_io,
233 .init_machine = anw6410_machine_init, 235 .init_machine = anw6410_machine_init,
234 .init_late = s3c64xx_init_late, 236 .init_late = s3c64xx_init_late,
235 .init_time = s3c24xx_timer_init, 237 .init_time = samsung_timer_init,
236 .restart = s3c64xx_restart, 238 .restart = s3c64xx_restart,
237MACHINE_END 239MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index bf3d1c09b085..7ccfef227c77 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -208,8 +208,9 @@ static const struct i2c_board_info wm1277_devs[] = {
208static struct arizona_pdata wm5102_reva_pdata = { 208static struct arizona_pdata wm5102_reva_pdata = {
209 .ldoena = S3C64XX_GPN(7), 209 .ldoena = S3C64XX_GPN(7),
210 .gpio_base = CODEC_GPIO_BASE, 210 .gpio_base = CODEC_GPIO_BASE,
211 .irq_active_high = true, 211 .irq_flags = IRQF_TRIGGER_HIGH,
212 .micd_pol_gpio = CODEC_GPIO_BASE + 4, 212 .micd_pol_gpio = CODEC_GPIO_BASE + 4,
213 .micd_rate = 6,
213 .gpio_defaults = { 214 .gpio_defaults = {
214 [2] = 0x10000, /* AIF3TXLRCLK */ 215 [2] = 0x10000, /* AIF3TXLRCLK */
215 [3] = 0x4, /* OPCLK */ 216 [3] = 0x4, /* OPCLK */
@@ -237,7 +238,7 @@ static struct spi_board_info wm5102_reva_spi_devs[] = {
237static struct arizona_pdata wm5102_pdata = { 238static struct arizona_pdata wm5102_pdata = {
238 .ldoena = S3C64XX_GPN(7), 239 .ldoena = S3C64XX_GPN(7),
239 .gpio_base = CODEC_GPIO_BASE, 240 .gpio_base = CODEC_GPIO_BASE,
240 .irq_active_high = true, 241 .irq_flags = IRQF_TRIGGER_HIGH,
241 .micd_pol_gpio = CODEC_GPIO_BASE + 2, 242 .micd_pol_gpio = CODEC_GPIO_BASE + 2,
242 .gpio_defaults = { 243 .gpio_defaults = {
243 [2] = 0x10000, /* AIF3TXLRCLK */ 244 [2] = 0x10000, /* AIF3TXLRCLK */
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 1acf02bace57..8ad88ace795a 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -64,6 +64,7 @@
64#include <plat/adc.h> 64#include <plat/adc.h>
65#include <linux/platform_data/i2c-s3c2410.h> 65#include <linux/platform_data/i2c-s3c2410.h>
66#include <plat/pm.h> 66#include <plat/pm.h>
67#include <plat/samsung-time.h>
67 68
68#include "common.h" 69#include "common.h"
69#include "crag6410.h" 70#include "crag6410.h"
@@ -744,6 +745,7 @@ static void __init crag6410_map_io(void)
744 s3c64xx_init_io(NULL, 0); 745 s3c64xx_init_io(NULL, 0);
745 s3c24xx_init_clocks(12000000); 746 s3c24xx_init_clocks(12000000);
746 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); 747 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
748 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
747 749
748 /* LCD type and Bypass set by bootloader */ 750 /* LCD type and Bypass set by bootloader */
749} 751}
@@ -868,6 +870,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
868 .map_io = crag6410_map_io, 870 .map_io = crag6410_map_io,
869 .init_machine = crag6410_machine_init, 871 .init_machine = crag6410_machine_init,
870 .init_late = s3c64xx_init_late, 872 .init_late = s3c64xx_init_late,
871 .init_time = s3c24xx_timer_init, 873 .init_time = samsung_timer_init,
872 .restart = s3c64xx_restart, 874 .restart = s3c64xx_restart,
873MACHINE_END 875MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index 7212eb9cfeb9..5b7f357d8c22 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -41,6 +41,7 @@
41#include <plat/clock.h> 41#include <plat/clock.h>
42#include <plat/devs.h> 42#include <plat/devs.h>
43#include <plat/cpu.h> 43#include <plat/cpu.h>
44#include <plat/samsung-time.h>
44 45
45#include "common.h" 46#include "common.h"
46 47
@@ -248,6 +249,7 @@ static void __init hmt_map_io(void)
248 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); 249 s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
249 s3c24xx_init_clocks(12000000); 250 s3c24xx_init_clocks(12000000);
250 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); 251 s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
252 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
251} 253}
252 254
253static void __init hmt_machine_init(void) 255static void __init hmt_machine_init(void)
@@ -275,6 +277,6 @@ MACHINE_START(HMT, "Airgoo-HMT")
275 .map_io = hmt_map_io, 277 .map_io = hmt_map_io,
276 .init_machine = hmt_machine_init, 278 .init_machine = hmt_machine_init,
277 .init_late = s3c64xx_init_late, 279 .init_late = s3c64xx_init_late,
278 .init_time = s3c24xx_timer_init, 280 .init_time = samsung_timer_init,
279 .restart = s3c64xx_restart, 281 .restart = s3c64xx_restart,
280MACHINE_END 282MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 4b41fcdaa7b6..fc043e3ecdf8 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -41,6 +41,7 @@
41 41
42#include <video/platform_lcd.h> 42#include <video/platform_lcd.h>
43#include <video/samsung_fimd.h> 43#include <video/samsung_fimd.h>
44#include <plat/samsung-time.h>
44 45
45#include "common.h" 46#include "common.h"
46#include "regs-modem.h" 47#include "regs-modem.h"
@@ -232,6 +233,7 @@ static void __init mini6410_map_io(void)
232 s3c64xx_init_io(NULL, 0); 233 s3c64xx_init_io(NULL, 0);
233 s3c24xx_init_clocks(12000000); 234 s3c24xx_init_clocks(12000000);
234 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); 235 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
236 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
235 237
236 /* set the LCD type */ 238 /* set the LCD type */
237 tmp = __raw_readl(S3C64XX_SPCON); 239 tmp = __raw_readl(S3C64XX_SPCON);
@@ -354,6 +356,6 @@ MACHINE_START(MINI6410, "MINI6410")
354 .map_io = mini6410_map_io, 356 .map_io = mini6410_map_io,
355 .init_machine = mini6410_machine_init, 357 .init_machine = mini6410_machine_init,
356 .init_late = s3c64xx_init_late, 358 .init_late = s3c64xx_init_late,
357 .init_time = s3c24xx_timer_init, 359 .init_time = samsung_timer_init,
358 .restart = s3c64xx_restart, 360 .restart = s3c64xx_restart,
359MACHINE_END 361MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 8d3cedd995ff..7e2c3908f1f8 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -43,6 +43,7 @@
43#include <plat/clock.h> 43#include <plat/clock.h>
44#include <plat/devs.h> 44#include <plat/devs.h>
45#include <plat/cpu.h> 45#include <plat/cpu.h>
46#include <plat/samsung-time.h>
46 47
47#include "common.h" 48#include "common.h"
48 49
@@ -87,6 +88,7 @@ static void __init ncp_map_io(void)
87 s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); 88 s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc));
88 s3c24xx_init_clocks(12000000); 89 s3c24xx_init_clocks(12000000);
89 s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); 90 s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs));
91 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
90} 92}
91 93
92static void __init ncp_machine_init(void) 94static void __init ncp_machine_init(void)
@@ -103,6 +105,6 @@ MACHINE_START(NCP, "NCP")
103 .map_io = ncp_map_io, 105 .map_io = ncp_map_io,
104 .init_machine = ncp_machine_init, 106 .init_machine = ncp_machine_init,
105 .init_late = s3c64xx_init_late, 107 .init_late = s3c64xx_init_late,
106 .init_time = s3c24xx_timer_init, 108 .init_time = samsung_timer_init,
107 .restart = s3c64xx_restart, 109 .restart = s3c64xx_restart,
108MACHINE_END 110MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index fa12bd21ad82..8bed37b3d5ac 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -42,6 +42,7 @@
42 42
43#include <video/platform_lcd.h> 43#include <video/platform_lcd.h>
44#include <video/samsung_fimd.h> 44#include <video/samsung_fimd.h>
45#include <plat/samsung-time.h>
45 46
46#include "common.h" 47#include "common.h"
47#include "regs-modem.h" 48#include "regs-modem.h"
@@ -211,6 +212,7 @@ static void __init real6410_map_io(void)
211 s3c64xx_init_io(NULL, 0); 212 s3c64xx_init_io(NULL, 0);
212 s3c24xx_init_clocks(12000000); 213 s3c24xx_init_clocks(12000000);
213 s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); 214 s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
215 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
214 216
215 /* set the LCD type */ 217 /* set the LCD type */
216 tmp = __raw_readl(S3C64XX_SPCON); 218 tmp = __raw_readl(S3C64XX_SPCON);
@@ -333,6 +335,6 @@ MACHINE_START(REAL6410, "REAL6410")
333 .map_io = real6410_map_io, 335 .map_io = real6410_map_io,
334 .init_machine = real6410_machine_init, 336 .init_machine = real6410_machine_init,
335 .init_late = s3c64xx_init_late, 337 .init_late = s3c64xx_init_late,
336 .init_time = s3c24xx_timer_init, 338 .init_time = samsung_timer_init,
337 .restart = s3c64xx_restart, 339 .restart = s3c64xx_restart,
338MACHINE_END 340MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index fc3e9b32e26f..58ac99041274 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -38,6 +38,7 @@
38#include <linux/platform_data/touchscreen-s3c2410.h> 38#include <linux/platform_data/touchscreen-s3c2410.h>
39 39
40#include <video/platform_lcd.h> 40#include <video/platform_lcd.h>
41#include <plat/samsung-time.h>
41 42
42#include "common.h" 43#include "common.h"
43#include "regs-modem.h" 44#include "regs-modem.h"
@@ -378,6 +379,7 @@ void __init smartq_map_io(void)
378 s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); 379 s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc));
379 s3c24xx_init_clocks(12000000); 380 s3c24xx_init_clocks(12000000);
380 s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); 381 s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs));
382 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
381 383
382 smartq_lcd_mode_set(); 384 smartq_lcd_mode_set();
383} 385}
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index ca2afcfce573..8aca5daf3d05 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -28,6 +28,7 @@
28#include <plat/devs.h> 28#include <plat/devs.h>
29#include <plat/fb.h> 29#include <plat/fb.h>
30#include <plat/gpio-cfg.h> 30#include <plat/gpio-cfg.h>
31#include <plat/samsung-time.h>
31 32
32#include "common.h" 33#include "common.h"
33#include "mach-smartq.h" 34#include "mach-smartq.h"
@@ -155,6 +156,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5")
155 .map_io = smartq_map_io, 156 .map_io = smartq_map_io,
156 .init_machine = smartq5_machine_init, 157 .init_machine = smartq5_machine_init,
157 .init_late = s3c64xx_init_late, 158 .init_late = s3c64xx_init_late,
158 .init_time = s3c24xx_timer_init, 159 .init_time = samsung_timer_init,
159 .restart = s3c64xx_restart, 160 .restart = s3c64xx_restart,
160MACHINE_END 161MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index 37bb0c632a5e..a052e107c0b4 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -28,6 +28,7 @@
28#include <plat/devs.h> 28#include <plat/devs.h>
29#include <plat/fb.h> 29#include <plat/fb.h>
30#include <plat/gpio-cfg.h> 30#include <plat/gpio-cfg.h>
31#include <plat/samsung-time.h>
31 32
32#include "common.h" 33#include "common.h"
33#include "mach-smartq.h" 34#include "mach-smartq.h"
@@ -171,6 +172,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7")
171 .map_io = smartq_map_io, 172 .map_io = smartq_map_io,
172 .init_machine = smartq7_machine_init, 173 .init_machine = smartq7_machine_init,
173 .init_late = s3c64xx_init_late, 174 .init_late = s3c64xx_init_late,
174 .init_time = s3c24xx_timer_init, 175 .init_time = samsung_timer_init,
175 .restart = s3c64xx_restart, 176 .restart = s3c64xx_restart,
176MACHINE_END 177MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index a392869c8342..d70c0843aea2 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -35,6 +35,7 @@
35#include <plat/devs.h> 35#include <plat/devs.h>
36#include <plat/cpu.h> 36#include <plat/cpu.h>
37#include <linux/platform_data/i2c-s3c2410.h> 37#include <linux/platform_data/i2c-s3c2410.h>
38#include <plat/samsung-time.h>
38 39
39#include "common.h" 40#include "common.h"
40 41
@@ -66,6 +67,7 @@ static void __init smdk6400_map_io(void)
66 s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); 67 s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
67 s3c24xx_init_clocks(12000000); 68 s3c24xx_init_clocks(12000000);
68 s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); 69 s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
70 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
69} 71}
70 72
71static struct platform_device *smdk6400_devices[] __initdata = { 73static struct platform_device *smdk6400_devices[] __initdata = {
@@ -92,6 +94,6 @@ MACHINE_START(SMDK6400, "SMDK6400")
92 .map_io = smdk6400_map_io, 94 .map_io = smdk6400_map_io,
93 .init_machine = smdk6400_machine_init, 95 .init_machine = smdk6400_machine_init,
94 .init_late = s3c64xx_init_late, 96 .init_late = s3c64xx_init_late,
95 .init_time = s3c24xx_timer_init, 97 .init_time = samsung_timer_init,
96 .restart = s3c64xx_restart, 98 .restart = s3c64xx_restart,
97MACHINE_END 99MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index ba7544e2d04d..bd3295a19ad7 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -69,6 +69,7 @@
69#include <linux/platform_data/touchscreen-s3c2410.h> 69#include <linux/platform_data/touchscreen-s3c2410.h>
70#include <plat/keypad.h> 70#include <plat/keypad.h>
71#include <plat/backlight.h> 71#include <plat/backlight.h>
72#include <plat/samsung-time.h>
72 73
73#include "common.h" 74#include "common.h"
74#include "regs-modem.h" 75#include "regs-modem.h"
@@ -634,6 +635,7 @@ static void __init smdk6410_map_io(void)
634 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); 635 s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc));
635 s3c24xx_init_clocks(12000000); 636 s3c24xx_init_clocks(12000000);
636 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); 637 s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs));
638 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
637 639
638 /* set the LCD type */ 640 /* set the LCD type */
639 641
@@ -702,6 +704,6 @@ MACHINE_START(SMDK6410, "SMDK6410")
702 .map_io = smdk6410_map_io, 704 .map_io = smdk6410_map_io,
703 .init_machine = smdk6410_machine_init, 705 .init_machine = smdk6410_machine_init,
704 .init_late = s3c64xx_init_late, 706 .init_late = s3c64xx_init_late,
705 .init_time = s3c24xx_timer_init, 707 .init_time = samsung_timer_init,
706 .restart = s3c64xx_restart, 708 .restart = s3c64xx_restart,
707MACHINE_END 709MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index c8174d95339b..ca960bda02fd 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -76,7 +76,7 @@ static int s3c_usb_otgphy_exit(struct platform_device *pdev)
76 76
77int s5p_usb_phy_init(struct platform_device *pdev, int type) 77int s5p_usb_phy_init(struct platform_device *pdev, int type)
78{ 78{
79 if (type == S5P_USB_PHY_DEVICE) 79 if (type == USB_PHY_TYPE_DEVICE)
80 return s3c_usb_otgphy_init(pdev); 80 return s3c_usb_otgphy_init(pdev);
81 81
82 return -EINVAL; 82 return -EINVAL;
@@ -84,7 +84,7 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
84 84
85int s5p_usb_phy_exit(struct platform_device *pdev, int type) 85int s5p_usb_phy_exit(struct platform_device *pdev, int type)
86{ 86{
87 if (type == S5P_USB_PHY_DEVICE) 87 if (type == USB_PHY_TYPE_DEVICE)
88 return s3c_usb_otgphy_exit(pdev); 88 return s3c_usb_otgphy_exit(pdev);
89 89
90 return -EINVAL; 90 return -EINVAL;
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index e8742cb7ddd9..5a707bdb9ea0 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,16 +9,16 @@ if ARCH_S5P64X0
9 9
10config CPU_S5P6440 10config CPU_S5P6440
11 bool 11 bool
12 select S5P_HRT
13 select S5P_SLEEP if PM 12 select S5P_SLEEP if PM
14 select SAMSUNG_DMADEV 13 select SAMSUNG_DMADEV
14 select SAMSUNG_HRT
15 select SAMSUNG_WAKEMASK if PM 15 select SAMSUNG_WAKEMASK if PM
16 help 16 help
17 Enable S5P6440 CPU support 17 Enable S5P6440 CPU support
18 18
19config CPU_S5P6450 19config CPU_S5P6450
20 bool 20 bool
21 select S5P_HRT 21 select SAMSUNG_HRT
22 select S5P_SLEEP if PM 22 select S5P_SLEEP if PM
23 select SAMSUNG_DMADEV 23 select SAMSUNG_DMADEV
24 select SAMSUNG_WAKEMASK if PM 24 select SAMSUNG_WAKEMASK if PM
diff --git a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
index e80ba3c69814..5e2916fb19a9 100644
--- a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
@@ -30,4 +30,4 @@
30#endif 30#endif
31 .endm 31 .endm
32 32
33#include <plat/debug-macro.S> 33#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index e23723a5a214..73f71a698a34 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -48,7 +48,7 @@
48#include <plat/pll.h> 48#include <plat/pll.h>
49#include <plat/adc.h> 49#include <plat/adc.h>
50#include <linux/platform_data/touchscreen-s3c2410.h> 50#include <linux/platform_data/touchscreen-s3c2410.h>
51#include <plat/s5p-time.h> 51#include <plat/samsung-time.h>
52#include <plat/backlight.h> 52#include <plat/backlight.h>
53#include <plat/fb.h> 53#include <plat/fb.h>
54#include <plat/sdhci.h> 54#include <plat/sdhci.h>
@@ -229,7 +229,7 @@ static void __init smdk6440_map_io(void)
229 s5p64x0_init_io(NULL, 0); 229 s5p64x0_init_io(NULL, 0);
230 s3c24xx_init_clocks(12000000); 230 s3c24xx_init_clocks(12000000);
231 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); 231 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
232 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 232 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
233} 233}
234 234
235static void s5p6440_set_lcd_interface(void) 235static void s5p6440_set_lcd_interface(void)
@@ -273,6 +273,6 @@ MACHINE_START(SMDK6440, "SMDK6440")
273 .init_irq = s5p6440_init_irq, 273 .init_irq = s5p6440_init_irq,
274 .map_io = smdk6440_map_io, 274 .map_io = smdk6440_map_io,
275 .init_machine = smdk6440_machine_init, 275 .init_machine = smdk6440_machine_init,
276 .init_time = s5p_timer_init, 276 .init_time = samsung_timer_init,
277 .restart = s5p64x0_restart, 277 .restart = s5p64x0_restart,
278MACHINE_END 278MACHINE_END
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index ca10963a959e..18303e12019f 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -48,7 +48,7 @@
48#include <plat/pll.h> 48#include <plat/pll.h>
49#include <plat/adc.h> 49#include <plat/adc.h>
50#include <linux/platform_data/touchscreen-s3c2410.h> 50#include <linux/platform_data/touchscreen-s3c2410.h>
51#include <plat/s5p-time.h> 51#include <plat/samsung-time.h>
52#include <plat/backlight.h> 52#include <plat/backlight.h>
53#include <plat/fb.h> 53#include <plat/fb.h>
54#include <plat/sdhci.h> 54#include <plat/sdhci.h>
@@ -248,7 +248,7 @@ static void __init smdk6450_map_io(void)
248 s5p64x0_init_io(NULL, 0); 248 s5p64x0_init_io(NULL, 0);
249 s3c24xx_init_clocks(19200000); 249 s3c24xx_init_clocks(19200000);
250 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); 250 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
251 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 251 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
252} 252}
253 253
254static void s5p6450_set_lcd_interface(void) 254static void s5p6450_set_lcd_interface(void)
@@ -292,6 +292,6 @@ MACHINE_START(SMDK6450, "SMDK6450")
292 .init_irq = s5p6450_init_irq, 292 .init_irq = s5p6450_init_irq,
293 .map_io = smdk6450_map_io, 293 .map_io = smdk6450_map_io,
294 .init_machine = smdk6450_machine_init, 294 .init_machine = smdk6450_machine_init,
295 .init_time = s5p_timer_init, 295 .init_time = samsung_timer_init,
296 .restart = s5p64x0_restart, 296 .restart = s5p64x0_restart,
297MACHINE_END 297MACHINE_END
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 15170be97a74..2f456a4533ba 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -11,6 +11,7 @@ config CPU_S5PC100
11 bool 11 bool
12 select S5P_EXT_INT 12 select S5P_EXT_INT
13 select SAMSUNG_DMADEV 13 select SAMSUNG_DMADEV
14 select SAMSUNG_HRT
14 help 15 help
15 Enable S5PC100 CPU support 16 Enable S5PC100 CPU support
16 17
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
index 9fbd3ae2b401..c41f912e9e1f 100644
--- a/arch/arm/mach-s5pc100/common.h
+++ b/arch/arm/mach-s5pc100/common.h
@@ -20,18 +20,9 @@ void s5pc100_setup_clocks(void);
20 20
21void s5pc100_restart(char mode, const char *cmd); 21void s5pc100_restart(char mode, const char *cmd);
22 22
23#ifdef CONFIG_CPU_S5PC100
24
25extern int s5pc100_init(void); 23extern int s5pc100_init(void);
26extern void s5pc100_map_io(void); 24extern void s5pc100_map_io(void);
27extern void s5pc100_init_clocks(int xtal); 25extern void s5pc100_init_clocks(int xtal);
28extern void s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no); 26extern void s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no);
29 27
30#else
31#define s5pc100_init_clocks NULL
32#define s5pc100_init_uarts NULL
33#define s5pc100_map_io NULL
34#define s5pc100_init NULL
35#endif
36
37#endif /* __ARCH_ARM_MACH_S5PC100_COMMON_H */ 28#endif /* __ARCH_ARM_MACH_S5PC100_COMMON_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
index 694f75937000..66cb7f16bf2a 100644
--- a/arch/arm/mach-s5pc100/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
@@ -36,4 +36,4 @@
36 * will be fine with us. 36 * will be fine with us.
37 */ 37 */
38 38
39#include <plat/debug-macro.S> 39#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 185a19583898..8c880f76f274 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -51,6 +51,7 @@
51#include <linux/platform_data/touchscreen-s3c2410.h> 51#include <linux/platform_data/touchscreen-s3c2410.h>
52#include <linux/platform_data/asoc-s3c.h> 52#include <linux/platform_data/asoc-s3c.h>
53#include <plat/backlight.h> 53#include <plat/backlight.h>
54#include <plat/samsung-time.h>
54 55
55#include "common.h" 56#include "common.h"
56 57
@@ -221,6 +222,7 @@ static void __init smdkc100_map_io(void)
221 s5pc100_init_io(NULL, 0); 222 s5pc100_init_io(NULL, 0);
222 s3c24xx_init_clocks(12000000); 223 s3c24xx_init_clocks(12000000);
223 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); 224 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
225 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
224} 226}
225 227
226static void __init smdkc100_machine_init(void) 228static void __init smdkc100_machine_init(void)
@@ -255,6 +257,6 @@ MACHINE_START(SMDKC100, "SMDKC100")
255 .init_irq = s5pc100_init_irq, 257 .init_irq = s5pc100_init_irq,
256 .map_io = smdkc100_map_io, 258 .map_io = smdkc100_map_io,
257 .init_machine = smdkc100_machine_init, 259 .init_machine = smdkc100_machine_init,
258 .init_time = s3c24xx_timer_init, 260 .init_time = samsung_timer_init,
259 .restart = s5pc100_restart, 261 .restart = s5pc100_restart,
260MACHINE_END 262MACHINE_END
diff --git a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
index 03c02d04c68c..6010c0310cb5 100644
--- a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
@@ -19,7 +19,6 @@
19#include <linux/mmc/card.h> 19#include <linux/mmc/card.h>
20 20
21#include <plat/gpio-cfg.h> 21#include <plat/gpio-cfg.h>
22#include <plat/regs-sdhci.h>
23#include <plat/sdhci.h> 22#include <plat/sdhci.h>
24 23
25void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 24void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 92ad72f0ef98..0963283a7c5d 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -12,10 +12,10 @@ if ARCH_S5PV210
12config CPU_S5PV210 12config CPU_S5PV210
13 bool 13 bool
14 select S5P_EXT_INT 14 select S5P_EXT_INT
15 select S5P_HRT
16 select S5P_PM if PM 15 select S5P_PM if PM
17 select S5P_SLEEP if PM 16 select S5P_SLEEP if PM
18 select SAMSUNG_DMADEV 17 select SAMSUNG_DMADEV
18 select SAMSUNG_HRT
19 help 19 help
20 Enable S5PV210 CPU support 20 Enable S5PV210 CPU support
21 21
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index 6ed2af5c7518..0a1cc0aef720 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -20,18 +20,9 @@ void s5pv210_setup_clocks(void);
20 20
21void s5pv210_restart(char mode, const char *cmd); 21void s5pv210_restart(char mode, const char *cmd);
22 22
23#ifdef CONFIG_CPU_S5PV210
24
25extern int s5pv210_init(void); 23extern int s5pv210_init(void);
26extern void s5pv210_map_io(void); 24extern void s5pv210_map_io(void);
27extern void s5pv210_init_clocks(int xtal); 25extern void s5pv210_init_clocks(int xtal);
28extern void s5pv210_init_uarts(struct s3c2410_uartcfg *cfg, int no); 26extern void s5pv210_init_uarts(struct s3c2410_uartcfg *cfg, int no);
29 27
30#else
31#define s5pv210_init_clocks NULL
32#define s5pv210_init_uarts NULL
33#define s5pv210_map_io NULL
34#define s5pv210_init NULL
35#endif
36
37#endif /* __ARCH_ARM_MACH_S5PV210_COMMON_H */ 28#endif /* __ARCH_ARM_MACH_S5PV210_COMMON_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/debug-macro.S b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
index 79e55597ab63..80c21996c943 100644
--- a/arch/arm/mach-s5pv210/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
@@ -38,4 +38,4 @@
38 * will be fine with us. 38 * will be fine with us.
39 */ 39 */
40 40
41#include <plat/debug-macro.S> 41#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 11900a8e88a3..ed2b85485b9d 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -38,7 +38,7 @@
38#include <plat/fb.h> 38#include <plat/fb.h>
39#include <plat/fimc-core.h> 39#include <plat/fimc-core.h>
40#include <plat/sdhci.h> 40#include <plat/sdhci.h>
41#include <plat/s5p-time.h> 41#include <plat/samsung-time.h>
42 42
43#include "common.h" 43#include "common.h"
44 44
@@ -651,7 +651,7 @@ static void __init aquila_map_io(void)
651 s5pv210_init_io(NULL, 0); 651 s5pv210_init_io(NULL, 0);
652 s3c24xx_init_clocks(24000000); 652 s3c24xx_init_clocks(24000000);
653 s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); 653 s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
654 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 654 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
655} 655}
656 656
657static void __init aquila_machine_init(void) 657static void __init aquila_machine_init(void)
@@ -686,6 +686,6 @@ MACHINE_START(AQUILA, "Aquila")
686 .init_irq = s5pv210_init_irq, 686 .init_irq = s5pv210_init_irq,
687 .map_io = aquila_map_io, 687 .map_io = aquila_map_io,
688 .init_machine = aquila_machine_init, 688 .init_machine = aquila_machine_init,
689 .init_time = s5p_timer_init, 689 .init_time = samsung_timer_init,
690 .restart = s5pv210_restart, 690 .restart = s5pv210_restart,
691MACHINE_END 691MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index e373de44a8b6..30b24ad84f49 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -47,7 +47,7 @@
47#include <plat/keypad.h> 47#include <plat/keypad.h>
48#include <plat/sdhci.h> 48#include <plat/sdhci.h>
49#include <plat/clock.h> 49#include <plat/clock.h>
50#include <plat/s5p-time.h> 50#include <plat/samsung-time.h>
51#include <plat/mfc.h> 51#include <plat/mfc.h>
52#include <plat/camport.h> 52#include <plat/camport.h>
53 53
@@ -908,7 +908,7 @@ static void __init goni_map_io(void)
908 s5pv210_init_io(NULL, 0); 908 s5pv210_init_io(NULL, 0);
909 s3c24xx_init_clocks(clk_xusbxti.rate); 909 s3c24xx_init_clocks(clk_xusbxti.rate);
910 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); 910 s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
911 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 911 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
912} 912}
913 913
914static void __init goni_reserve(void) 914static void __init goni_reserve(void)
@@ -973,7 +973,7 @@ MACHINE_START(GONI, "GONI")
973 .init_irq = s5pv210_init_irq, 973 .init_irq = s5pv210_init_irq,
974 .map_io = goni_map_io, 974 .map_io = goni_map_io,
975 .init_machine = goni_machine_init, 975 .init_machine = goni_machine_init,
976 .init_time = s5p_timer_init, 976 .init_time = samsung_timer_init,
977 .reserve = &goni_reserve, 977 .reserve = &goni_reserve,
978 .restart = s5pv210_restart, 978 .restart = s5pv210_restart,
979MACHINE_END 979MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index 28bd0248a3e2..7c0ed07a78a3 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -29,7 +29,7 @@
29#include <linux/platform_data/ata-samsung_cf.h> 29#include <linux/platform_data/ata-samsung_cf.h>
30#include <linux/platform_data/i2c-s3c2410.h> 30#include <linux/platform_data/i2c-s3c2410.h>
31#include <plat/pm.h> 31#include <plat/pm.h>
32#include <plat/s5p-time.h> 32#include <plat/samsung-time.h>
33#include <plat/mfc.h> 33#include <plat/mfc.h>
34 34
35#include "common.h" 35#include "common.h"
@@ -120,7 +120,7 @@ static void __init smdkc110_map_io(void)
120 s5pv210_init_io(NULL, 0); 120 s5pv210_init_io(NULL, 0);
121 s3c24xx_init_clocks(24000000); 121 s3c24xx_init_clocks(24000000);
122 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); 122 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
123 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 123 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
124} 124}
125 125
126static void __init smdkc110_reserve(void) 126static void __init smdkc110_reserve(void)
@@ -153,7 +153,7 @@ MACHINE_START(SMDKC110, "SMDKC110")
153 .init_irq = s5pv210_init_irq, 153 .init_irq = s5pv210_init_irq,
154 .map_io = smdkc110_map_io, 154 .map_io = smdkc110_map_io,
155 .init_machine = smdkc110_machine_init, 155 .init_machine = smdkc110_machine_init,
156 .init_time = s5p_timer_init, 156 .init_time = samsung_timer_init,
157 .restart = s5pv210_restart, 157 .restart = s5pv210_restart,
158 .reserve = &smdkc110_reserve, 158 .reserve = &smdkc110_reserve,
159MACHINE_END 159MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 3c73f36869bb..d50b6f124465 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -44,7 +44,7 @@
44#include <plat/keypad.h> 44#include <plat/keypad.h>
45#include <plat/pm.h> 45#include <plat/pm.h>
46#include <plat/fb.h> 46#include <plat/fb.h>
47#include <plat/s5p-time.h> 47#include <plat/samsung-time.h>
48#include <plat/backlight.h> 48#include <plat/backlight.h>
49#include <plat/mfc.h> 49#include <plat/mfc.h>
50#include <plat/clock.h> 50#include <plat/clock.h>
@@ -285,7 +285,7 @@ static void __init smdkv210_map_io(void)
285 s5pv210_init_io(NULL, 0); 285 s5pv210_init_io(NULL, 0);
286 s3c24xx_init_clocks(clk_xusbxti.rate); 286 s3c24xx_init_clocks(clk_xusbxti.rate);
287 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); 287 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
288 s5p_set_timer_source(S5P_PWM2, S5P_PWM4); 288 samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
289} 289}
290 290
291static void __init smdkv210_reserve(void) 291static void __init smdkv210_reserve(void)
@@ -329,7 +329,7 @@ MACHINE_START(SMDKV210, "SMDKV210")
329 .init_irq = s5pv210_init_irq, 329 .init_irq = s5pv210_init_irq,
330 .map_io = smdkv210_map_io, 330 .map_io = smdkv210_map_io,
331 .init_machine = smdkv210_machine_init, 331 .init_machine = smdkv210_machine_init,
332 .init_time = s5p_timer_init, 332 .init_time = samsung_timer_init,
333 .restart = s5pv210_restart, 333 .restart = s5pv210_restart,
334 .reserve = &smdkv210_reserve, 334 .reserve = &smdkv210_reserve,
335MACHINE_END 335MACHINE_END
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
index 2d4c5531819c..579afe89842a 100644
--- a/arch/arm/mach-s5pv210/mach-torbreck.c
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -26,7 +26,7 @@
26#include <plat/devs.h> 26#include <plat/devs.h>
27#include <plat/cpu.h> 27#include <plat/cpu.h>
28#include <linux/platform_data/i2c-s3c2410.h> 28#include <linux/platform_data/i2c-s3c2410.h>
29#include <plat/s5p-time.h> 29#include <plat/samsung-time.h>
30 30
31#include "common.h" 31#include "common.h"
32 32
@@ -106,7 +106,7 @@ static void __init torbreck_map_io(void)
106 s5pv210_init_io(NULL, 0); 106 s5pv210_init_io(NULL, 0);
107 s3c24xx_init_clocks(24000000); 107 s3c24xx_init_clocks(24000000);
108 s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs)); 108 s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
109 s5p_set_timer_source(S5P_PWM3, S5P_PWM4); 109 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
110} 110}
111 111
112static void __init torbreck_machine_init(void) 112static void __init torbreck_machine_init(void)
@@ -130,6 +130,6 @@ MACHINE_START(TORBRECK, "TORBRECK")
130 .init_irq = s5pv210_init_irq, 130 .init_irq = s5pv210_init_irq,
131 .map_io = torbreck_map_io, 131 .map_io = torbreck_map_io,
132 .init_machine = torbreck_machine_init, 132 .init_machine = torbreck_machine_init,
133 .init_time = s5p_timer_init, 133 .init_time = samsung_timer_init,
134 .restart = s5pv210_restart, 134 .restart = s5pv210_restart,
135MACHINE_END 135MACHINE_END
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
index 3e3ac05bb7b1..0512ada00522 100644
--- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
@@ -20,7 +20,6 @@
20#include <linux/mmc/card.h> 20#include <linux/mmc/card.h>
21 21
22#include <plat/gpio-cfg.h> 22#include <plat/gpio-cfg.h>
23#include <plat/regs-sdhci.h>
24#include <plat/sdhci.h> 23#include <plat/sdhci.h>
25 24
26void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 25void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c b/arch/arm/mach-s5pv210/setup-usb-phy.c
index 356a0900af03..b2ee5333f89c 100644
--- a/arch/arm/mach-s5pv210/setup-usb-phy.c
+++ b/arch/arm/mach-s5pv210/setup-usb-phy.c
@@ -80,7 +80,7 @@ static int s5pv210_usb_otgphy_exit(struct platform_device *pdev)
80 80
81int s5p_usb_phy_init(struct platform_device *pdev, int type) 81int s5p_usb_phy_init(struct platform_device *pdev, int type)
82{ 82{
83 if (type == S5P_USB_PHY_DEVICE) 83 if (type == USB_PHY_TYPE_DEVICE)
84 return s5pv210_usb_otgphy_init(pdev); 84 return s5pv210_usb_otgphy_init(pdev);
85 85
86 return -EINVAL; 86 return -EINVAL;
@@ -88,7 +88,7 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
88 88
89int s5p_usb_phy_exit(struct platform_device *pdev, int type) 89int s5p_usb_phy_exit(struct platform_device *pdev, int type)
90{ 90{
91 if (type == S5P_USB_PHY_DEVICE) 91 if (type == USB_PHY_TYPE_DEVICE)
92 return s5pv210_usb_otgphy_exit(pdev); 92 return s5pv210_usb_otgphy_exit(pdev);
93 93
94 return -EINVAL; 94 return -EINVAL;
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index ca14dbdcfb22..04f9784ff0ed 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -4,7 +4,7 @@ menu "SA11x0 Implementations"
4 4
5config SA1100_ASSABET 5config SA1100_ASSABET
6 bool "Assabet" 6 bool "Assabet"
7 select CPU_FREQ_SA1110 7 select ARM_SA1110_CPUFREQ
8 help 8 help
9 Say Y here if you are using the Intel(R) StrongARM(R) SA-1110 9 Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
10 Microprocessor Development Board (also known as the Assabet). 10 Microprocessor Development Board (also known as the Assabet).
@@ -20,7 +20,7 @@ config ASSABET_NEPONSET
20 20
21config SA1100_CERF 21config SA1100_CERF
22 bool "CerfBoard" 22 bool "CerfBoard"
23 select CPU_FREQ_SA1110 23 select ARM_SA1110_CPUFREQ
24 help 24 help
25 The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued). 25 The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued).
26 More information is available at: 26 More information is available at:
@@ -47,7 +47,7 @@ endchoice
47 47
48config SA1100_COLLIE 48config SA1100_COLLIE
49 bool "Sharp Zaurus SL5500" 49 bool "Sharp Zaurus SL5500"
50 # FIXME: select CPU_FREQ_SA11x0 50 # FIXME: select ARM_SA11x0_CPUFREQ
51 select SHARP_LOCOMO 51 select SHARP_LOCOMO
52 select SHARP_PARAM 52 select SHARP_PARAM
53 select SHARP_SCOOP 53 select SHARP_SCOOP
@@ -56,7 +56,7 @@ config SA1100_COLLIE
56 56
57config SA1100_H3100 57config SA1100_H3100
58 bool "Compaq iPAQ H3100" 58 bool "Compaq iPAQ H3100"
59 select CPU_FREQ_SA1110 59 select ARM_SA1110_CPUFREQ
60 select HTC_EGPIO 60 select HTC_EGPIO
61 help 61 help
62 Say Y here if you intend to run this kernel on the Compaq iPAQ 62 Say Y here if you intend to run this kernel on the Compaq iPAQ
@@ -67,7 +67,7 @@ config SA1100_H3100
67 67
68config SA1100_H3600 68config SA1100_H3600
69 bool "Compaq iPAQ H3600/H3700" 69 bool "Compaq iPAQ H3600/H3700"
70 select CPU_FREQ_SA1110 70 select ARM_SA1110_CPUFREQ
71 select HTC_EGPIO 71 select HTC_EGPIO
72 help 72 help
73 Say Y here if you intend to run this kernel on the Compaq iPAQ 73 Say Y here if you intend to run this kernel on the Compaq iPAQ
@@ -78,7 +78,7 @@ config SA1100_H3600
78 78
79config SA1100_BADGE4 79config SA1100_BADGE4
80 bool "HP Labs BadgePAD 4" 80 bool "HP Labs BadgePAD 4"
81 select CPU_FREQ_SA1100 81 select ARM_SA1100_CPUFREQ
82 select SA1111 82 select SA1111
83 help 83 help
84 Say Y here if you want to build a kernel for the HP Laboratories 84 Say Y here if you want to build a kernel for the HP Laboratories
@@ -86,7 +86,7 @@ config SA1100_BADGE4
86 86
87config SA1100_JORNADA720 87config SA1100_JORNADA720
88 bool "HP Jornada 720" 88 bool "HP Jornada 720"
89 # FIXME: select CPU_FREQ_SA11x0 89 # FIXME: select ARM_SA11x0_CPUFREQ
90 select SA1111 90 select SA1111
91 help 91 help
92 Say Y here if you want to build a kernel for the HP Jornada 720 92 Say Y here if you want to build a kernel for the HP Jornada 720
@@ -105,14 +105,14 @@ config SA1100_JORNADA720_SSP
105 105
106config SA1100_HACKKIT 106config SA1100_HACKKIT
107 bool "HackKit Core CPU Board" 107 bool "HackKit Core CPU Board"
108 select CPU_FREQ_SA1100 108 select ARM_SA1100_CPUFREQ
109 help 109 help
110 Say Y here to support the HackKit Core CPU Board 110 Say Y here to support the HackKit Core CPU Board
111 <http://hackkit.eletztrick.de>; 111 <http://hackkit.eletztrick.de>;
112 112
113config SA1100_LART 113config SA1100_LART
114 bool "LART" 114 bool "LART"
115 select CPU_FREQ_SA1100 115 select ARM_SA1100_CPUFREQ
116 help 116 help
117 Say Y here if you are using the Linux Advanced Radio Terminal 117 Say Y here if you are using the Linux Advanced Radio Terminal
118 (also known as the LART). See <http://www.lartmaker.nl/> for 118 (also known as the LART). See <http://www.lartmaker.nl/> for
@@ -120,7 +120,7 @@ config SA1100_LART
120 120
121config SA1100_NANOENGINE 121config SA1100_NANOENGINE
122 bool "nanoEngine" 122 bool "nanoEngine"
123 select CPU_FREQ_SA1110 123 select ARM_SA1110_CPUFREQ
124 select PCI 124 select PCI
125 select PCI_NANOENGINE 125 select PCI_NANOENGINE
126 help 126 help
@@ -130,7 +130,7 @@ config SA1100_NANOENGINE
130 130
131config SA1100_PLEB 131config SA1100_PLEB
132 bool "PLEB" 132 bool "PLEB"
133 select CPU_FREQ_SA1100 133 select ARM_SA1100_CPUFREQ
134 help 134 help
135 Say Y here if you are using version 1 of the Portable Linux 135 Say Y here if you are using version 1 of the Portable Linux
136 Embedded Board (also known as PLEB). 136 Embedded Board (also known as PLEB).
@@ -139,7 +139,7 @@ config SA1100_PLEB
139 139
140config SA1100_SHANNON 140config SA1100_SHANNON
141 bool "Shannon" 141 bool "Shannon"
142 select CPU_FREQ_SA1100 142 select ARM_SA1100_CPUFREQ
143 help 143 help
144 The Shannon (also known as a Tuxscreen, and also as a IS2630) was a 144 The Shannon (also known as a Tuxscreen, and also as a IS2630) was a
145 limited edition webphone produced by Philips. The Shannon is a SA1100 145 limited edition webphone produced by Philips. The Shannon is a SA1100
@@ -148,7 +148,7 @@ config SA1100_SHANNON
148 148
149config SA1100_SIMPAD 149config SA1100_SIMPAD
150 bool "Simpad" 150 bool "Simpad"
151 select CPU_FREQ_SA1110 151 select ARM_SA1110_CPUFREQ
152 help 152 help
153 The SIEMENS webpad SIMpad is based on the StrongARM 1110. There 153 The SIEMENS webpad SIMpad is based on the StrongARM 1110. There
154 are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB 154 are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 1aed9e70465d..2732eef48966 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -8,9 +8,6 @@ obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
10 10
11obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o
12obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o
13
14# Specific board support 11# Specific board support
15obj-$(CONFIG_SA1100_ASSABET) += assabet.o 12obj-$(CONFIG_SA1100_ASSABET) += assabet.o
16obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o 13obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
deleted file mode 100644
index e8f4d1e19233..000000000000
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ /dev/null
@@ -1,249 +0,0 @@
1/*
2 * cpu-sa1100.c: clock scaling for the SA1100
3 *
4 * Copyright (C) 2000 2001, The Delft University of Technology
5 *
6 * Authors:
7 * - Johan Pouwelse (J.A.Pouwelse@its.tudelft.nl): initial version
8 * - Erik Mouw (J.A.K.Mouw@its.tudelft.nl):
9 * - major rewrite for linux-2.3.99
10 * - rewritten for the more generic power management scheme in
11 * linux-2.4.5-rmk1
12 *
13 * This software has been developed while working on the LART
14 * computing board (http://www.lartmaker.nl/), which is
15 * sponsored by the Mobile Multi-media Communications
16 * (http://www.mobimedia.org/) and Ubiquitous Communications
17 * (http://www.ubicom.tudelft.nl/) projects.
18 *
19 * The authors can be reached at:
20 *
21 * Erik Mouw
22 * Information and Communication Theory Group
23 * Faculty of Information Technology and Systems
24 * Delft University of Technology
25 * P.O. Box 5031
26 * 2600 GA Delft
27 * The Netherlands
28 *
29 *
30 * This program is free software; you can redistribute it and/or modify
31 * it under the terms of the GNU General Public License as published by
32 * the Free Software Foundation; either version 2 of the License, or
33 * (at your option) any later version.
34 *
35 * This program is distributed in the hope that it will be useful,
36 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 * GNU General Public License for more details.
39 *
40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
43 *
44 *
45 * Theory of operations
46 * ====================
47 *
48 * Clock scaling can be used to lower the power consumption of the CPU
49 * core. This will give you a somewhat longer running time.
50 *
51 * The SA-1100 has a single register to change the core clock speed:
52 *
53 * PPCR 0x90020014 PLL config
54 *
55 * However, the DRAM timings are closely related to the core clock
56 * speed, so we need to change these, too. The used registers are:
57 *
58 * MDCNFG 0xA0000000 DRAM config
59 * MDCAS0 0xA0000004 Access waveform
60 * MDCAS1 0xA0000008 Access waveform
61 * MDCAS2 0xA000000C Access waveform
62 *
63 * Care must be taken to change the DRAM parameters the correct way,
64 * because otherwise the DRAM becomes unusable and the kernel will
65 * crash.
66 *
67 * The simple solution to avoid a kernel crash is to put the actual
68 * clock change in ROM and jump to that code from the kernel. The main
69 * disadvantage is that the ROM has to be modified, which is not
70 * possible on all SA-1100 platforms. Another disadvantage is that
71 * jumping to ROM makes clock switching unnecessary complicated.
72 *
73 * The idea behind this driver is that the memory configuration can be
74 * changed while running from DRAM (even with interrupts turned on!)
75 * as long as all re-configuration steps yield a valid DRAM
76 * configuration. The advantages are clear: it will run on all SA-1100
77 * platforms, and the code is very simple.
78 *
79 * If you really want to understand what is going on in
80 * sa1100_update_dram_timings(), you'll have to read sections 8.2,
81 * 9.5.7.3, and 10.2 from the "Intel StrongARM SA-1100 Microprocessor
82 * Developers Manual" (available for free from Intel).
83 *
84 */
85
86#include <linux/kernel.h>
87#include <linux/types.h>
88#include <linux/init.h>
89#include <linux/cpufreq.h>
90#include <linux/io.h>
91
92#include <asm/cputype.h>
93
94#include <mach/hardware.h>
95
96#include "generic.h"
97
98struct sa1100_dram_regs {
99 int speed;
100 u32 mdcnfg;
101 u32 mdcas0;
102 u32 mdcas1;
103 u32 mdcas2;
104};
105
106
107static struct cpufreq_driver sa1100_driver;
108
109static struct sa1100_dram_regs sa1100_dram_settings[] = {
110 /*speed, mdcnfg, mdcas0, mdcas1, mdcas2, clock freq */
111 { 59000, 0x00dc88a3, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 59.0 MHz */
112 { 73700, 0x011490a3, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 73.7 MHz */
113 { 88500, 0x014e90a3, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 88.5 MHz */
114 {103200, 0x01889923, 0xcccccccf, 0xfffffffc, 0xffffffff},/* 103.2 MHz */
115 {118000, 0x01c29923, 0x9999998f, 0xfffffff9, 0xffffffff},/* 118.0 MHz */
116 {132700, 0x01fb2123, 0x9999998f, 0xfffffff9, 0xffffffff},/* 132.7 MHz */
117 {147500, 0x02352123, 0x3333330f, 0xfffffff3, 0xffffffff},/* 147.5 MHz */
118 {162200, 0x026b29a3, 0x38e38e1f, 0xfff8e38e, 0xffffffff},/* 162.2 MHz */
119 {176900, 0x02a329a3, 0x71c71c1f, 0xfff1c71c, 0xffffffff},/* 176.9 MHz */
120 {191700, 0x02dd31a3, 0xe38e383f, 0xffe38e38, 0xffffffff},/* 191.7 MHz */
121 {206400, 0x03153223, 0xc71c703f, 0xffc71c71, 0xffffffff},/* 206.4 MHz */
122 {221200, 0x034fba23, 0xc71c703f, 0xffc71c71, 0xffffffff},/* 221.2 MHz */
123 {235900, 0x03853a23, 0xe1e1e07f, 0xe1e1e1e1, 0xffffffe1},/* 235.9 MHz */
124 {250700, 0x03bf3aa3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3},/* 250.7 MHz */
125 {265400, 0x03f7c2a3, 0xc3c3c07f, 0xc3c3c3c3, 0xffffffc3},/* 265.4 MHz */
126 {280200, 0x0431c2a3, 0x878780ff, 0x87878787, 0xffffff87},/* 280.2 MHz */
127 { 0, 0, 0, 0, 0 } /* last entry */
128};
129
130static void sa1100_update_dram_timings(int current_speed, int new_speed)
131{
132 struct sa1100_dram_regs *settings = sa1100_dram_settings;
133
134 /* find speed */
135 while (settings->speed != 0) {
136 if (new_speed == settings->speed)
137 break;
138
139 settings++;
140 }
141
142 if (settings->speed == 0) {
143 panic("%s: couldn't find dram setting for speed %d\n",
144 __func__, new_speed);
145 }
146
147 /* No risk, no fun: run with interrupts on! */
148 if (new_speed > current_speed) {
149 /* We're going FASTER, so first relax the memory
150 * timings before changing the core frequency
151 */
152
153 /* Half the memory access clock */
154 MDCNFG |= MDCNFG_CDB2;
155
156 /* The order of these statements IS important, keep 8
157 * pulses!!
158 */
159 MDCAS2 = settings->mdcas2;
160 MDCAS1 = settings->mdcas1;
161 MDCAS0 = settings->mdcas0;
162 MDCNFG = settings->mdcnfg;
163 } else {
164 /* We're going SLOWER: first decrease the core
165 * frequency and then tighten the memory settings.
166 */
167
168 /* Half the memory access clock */
169 MDCNFG |= MDCNFG_CDB2;
170
171 /* The order of these statements IS important, keep 8
172 * pulses!!
173 */
174 MDCAS0 = settings->mdcas0;
175 MDCAS1 = settings->mdcas1;
176 MDCAS2 = settings->mdcas2;
177 MDCNFG = settings->mdcnfg;
178 }
179}
180
181static int sa1100_target(struct cpufreq_policy *policy,
182 unsigned int target_freq,
183 unsigned int relation)
184{
185 unsigned int cur = sa11x0_getspeed(0);
186 unsigned int new_ppcr;
187 struct cpufreq_freqs freqs;
188
189 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
190 switch (relation) {
191 case CPUFREQ_RELATION_L:
192 if (sa11x0_ppcr_to_freq(new_ppcr) > policy->max)
193 new_ppcr--;
194 break;
195 case CPUFREQ_RELATION_H:
196 if ((sa11x0_ppcr_to_freq(new_ppcr) > target_freq) &&
197 (sa11x0_ppcr_to_freq(new_ppcr - 1) >= policy->min))
198 new_ppcr--;
199 break;
200 }
201
202 freqs.old = cur;
203 freqs.new = sa11x0_ppcr_to_freq(new_ppcr);
204 freqs.cpu = 0;
205
206 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
207
208 if (freqs.new > cur)
209 sa1100_update_dram_timings(cur, freqs.new);
210
211 PPCR = new_ppcr;
212
213 if (freqs.new < cur)
214 sa1100_update_dram_timings(cur, freqs.new);
215
216 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
217
218 return 0;
219}
220
221static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
222{
223 if (policy->cpu != 0)
224 return -EINVAL;
225 policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
226 policy->cpuinfo.min_freq = 59000;
227 policy->cpuinfo.max_freq = 287000;
228 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
229 return 0;
230}
231
232static struct cpufreq_driver sa1100_driver __refdata = {
233 .flags = CPUFREQ_STICKY,
234 .verify = sa11x0_verify_speed,
235 .target = sa1100_target,
236 .get = sa11x0_getspeed,
237 .init = sa1100_cpu_init,
238 .name = "sa1100",
239};
240
241static int __init sa1100_dram_init(void)
242{
243 if (cpu_is_sa1100())
244 return cpufreq_register_driver(&sa1100_driver);
245 else
246 return -ENODEV;
247}
248
249arch_initcall(sa1100_dram_init);
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
deleted file mode 100644
index 48c45b0c92bb..000000000000
--- a/arch/arm/mach-sa1100/cpu-sa1110.c
+++ /dev/null
@@ -1,408 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/cpu-sa1110.c
3 *
4 * Copyright (C) 2001 Russell King
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 * Note: there are two erratas that apply to the SA1110 here:
11 * 7 - SDRAM auto-power-up failure (rev A0)
12 * 13 - Corruption of internal register reads/writes following
13 * SDRAM reads (rev A0, B0, B1)
14 *
15 * We ignore rev. A0 and B0 devices; I don't think they're worth supporting.
16 *
17 * The SDRAM type can be passed on the command line as cpu_sa1110.sdram=type
18 */
19#include <linux/cpufreq.h>
20#include <linux/delay.h>
21#include <linux/init.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <linux/moduleparam.h>
25#include <linux/types.h>
26
27#include <asm/cputype.h>
28#include <asm/mach-types.h>
29
30#include <mach/hardware.h>
31
32#include "generic.h"
33
34#undef DEBUG
35
36struct sdram_params {
37 const char name[20];
38 u_char rows; /* bits */
39 u_char cas_latency; /* cycles */
40 u_char tck; /* clock cycle time (ns) */
41 u_char trcd; /* activate to r/w (ns) */
42 u_char trp; /* precharge to activate (ns) */
43 u_char twr; /* write recovery time (ns) */
44 u_short refresh; /* refresh time for array (us) */
45};
46
47struct sdram_info {
48 u_int mdcnfg;
49 u_int mdrefr;
50 u_int mdcas[3];
51};
52
53static struct sdram_params sdram_tbl[] __initdata = {
54 { /* Toshiba TC59SM716 CL2 */
55 .name = "TC59SM716-CL2",
56 .rows = 12,
57 .tck = 10,
58 .trcd = 20,
59 .trp = 20,
60 .twr = 10,
61 .refresh = 64000,
62 .cas_latency = 2,
63 }, { /* Toshiba TC59SM716 CL3 */
64 .name = "TC59SM716-CL3",
65 .rows = 12,
66 .tck = 8,
67 .trcd = 20,
68 .trp = 20,
69 .twr = 8,
70 .refresh = 64000,
71 .cas_latency = 3,
72 }, { /* Samsung K4S641632D TC75 */
73 .name = "K4S641632D",
74 .rows = 14,
75 .tck = 9,
76 .trcd = 27,
77 .trp = 20,
78 .twr = 9,
79 .refresh = 64000,
80 .cas_latency = 3,
81 }, { /* Samsung K4S281632B-1H */
82 .name = "K4S281632B-1H",
83 .rows = 12,
84 .tck = 10,
85 .trp = 20,
86 .twr = 10,
87 .refresh = 64000,
88 .cas_latency = 3,
89 }, { /* Samsung KM416S4030CT */
90 .name = "KM416S4030CT",
91 .rows = 13,
92 .tck = 8,
93 .trcd = 24, /* 3 CLKs */
94 .trp = 24, /* 3 CLKs */
95 .twr = 16, /* Trdl: 2 CLKs */
96 .refresh = 64000,
97 .cas_latency = 3,
98 }, { /* Winbond W982516AH75L CL3 */
99 .name = "W982516AH75L",
100 .rows = 16,
101 .tck = 8,
102 .trcd = 20,
103 .trp = 20,
104 .twr = 8,
105 .refresh = 64000,
106 .cas_latency = 3,
107 }, { /* Micron MT48LC8M16A2TG-75 */
108 .name = "MT48LC8M16A2TG-75",
109 .rows = 12,
110 .tck = 8,
111 .trcd = 20,
112 .trp = 20,
113 .twr = 8,
114 .refresh = 64000,
115 .cas_latency = 3,
116 },
117};
118
119static struct sdram_params sdram_params;
120
121/*
122 * Given a period in ns and frequency in khz, calculate the number of
123 * cycles of frequency in period. Note that we round up to the next
124 * cycle, even if we are only slightly over.
125 */
126static inline u_int ns_to_cycles(u_int ns, u_int khz)
127{
128 return (ns * khz + 999999) / 1000000;
129}
130
131/*
132 * Create the MDCAS register bit pattern.
133 */
134static inline void set_mdcas(u_int *mdcas, int delayed, u_int rcd)
135{
136 u_int shift;
137
138 rcd = 2 * rcd - 1;
139 shift = delayed + 1 + rcd;
140
141 mdcas[0] = (1 << rcd) - 1;
142 mdcas[0] |= 0x55555555 << shift;
143 mdcas[1] = mdcas[2] = 0x55555555 << (shift & 1);
144}
145
146static void
147sdram_calculate_timing(struct sdram_info *sd, u_int cpu_khz,
148 struct sdram_params *sdram)
149{
150 u_int mem_khz, sd_khz, trp, twr;
151
152 mem_khz = cpu_khz / 2;
153 sd_khz = mem_khz;
154
155 /*
156 * If SDCLK would invalidate the SDRAM timings,
157 * run SDCLK at half speed.
158 *
159 * CPU steppings prior to B2 must either run the memory at
160 * half speed or use delayed read latching (errata 13).
161 */
162 if ((ns_to_cycles(sdram->tck, sd_khz) > 1) ||
163 (CPU_REVISION < CPU_SA1110_B2 && sd_khz < 62000))
164 sd_khz /= 2;
165
166 sd->mdcnfg = MDCNFG & 0x007f007f;
167
168 twr = ns_to_cycles(sdram->twr, mem_khz);
169
170 /* trp should always be >1 */
171 trp = ns_to_cycles(sdram->trp, mem_khz) - 1;
172 if (trp < 1)
173 trp = 1;
174
175 sd->mdcnfg |= trp << 8;
176 sd->mdcnfg |= trp << 24;
177 sd->mdcnfg |= sdram->cas_latency << 12;
178 sd->mdcnfg |= sdram->cas_latency << 28;
179 sd->mdcnfg |= twr << 14;
180 sd->mdcnfg |= twr << 30;
181
182 sd->mdrefr = MDREFR & 0xffbffff0;
183 sd->mdrefr |= 7;
184
185 if (sd_khz != mem_khz)
186 sd->mdrefr |= MDREFR_K1DB2;
187
188 /* initial number of '1's in MDCAS + 1 */
189 set_mdcas(sd->mdcas, sd_khz >= 62000,
190 ns_to_cycles(sdram->trcd, mem_khz));
191
192#ifdef DEBUG
193 printk(KERN_DEBUG "MDCNFG: %08x MDREFR: %08x MDCAS0: %08x MDCAS1: %08x MDCAS2: %08x\n",
194 sd->mdcnfg, sd->mdrefr, sd->mdcas[0], sd->mdcas[1],
195 sd->mdcas[2]);
196#endif
197}
198
199/*
200 * Set the SDRAM refresh rate.
201 */
202static inline void sdram_set_refresh(u_int dri)
203{
204 MDREFR = (MDREFR & 0xffff000f) | (dri << 4);
205 (void) MDREFR;
206}
207
208/*
209 * Update the refresh period. We do this such that we always refresh
210 * the SDRAMs within their permissible period. The refresh period is
211 * always a multiple of the memory clock (fixed at cpu_clock / 2).
212 *
213 * FIXME: we don't currently take account of burst accesses here,
214 * but neither do Intels DM nor Angel.
215 */
216static void
217sdram_update_refresh(u_int cpu_khz, struct sdram_params *sdram)
218{
219 u_int ns_row = (sdram->refresh * 1000) >> sdram->rows;
220 u_int dri = ns_to_cycles(ns_row, cpu_khz / 2) / 32;
221
222#ifdef DEBUG
223 mdelay(250);
224 printk(KERN_DEBUG "new dri value = %d\n", dri);
225#endif
226
227 sdram_set_refresh(dri);
228}
229
230/*
231 * Ok, set the CPU frequency.
232 */
233static int sa1110_target(struct cpufreq_policy *policy,
234 unsigned int target_freq,
235 unsigned int relation)
236{
237 struct sdram_params *sdram = &sdram_params;
238 struct cpufreq_freqs freqs;
239 struct sdram_info sd;
240 unsigned long flags;
241 unsigned int ppcr, unused;
242
243 switch (relation) {
244 case CPUFREQ_RELATION_L:
245 ppcr = sa11x0_freq_to_ppcr(target_freq);
246 if (sa11x0_ppcr_to_freq(ppcr) > policy->max)
247 ppcr--;
248 break;
249 case CPUFREQ_RELATION_H:
250 ppcr = sa11x0_freq_to_ppcr(target_freq);
251 if (ppcr && (sa11x0_ppcr_to_freq(ppcr) > target_freq) &&
252 (sa11x0_ppcr_to_freq(ppcr-1) >= policy->min))
253 ppcr--;
254 break;
255 default:
256 return -EINVAL;
257 }
258
259 freqs.old = sa11x0_getspeed(0);
260 freqs.new = sa11x0_ppcr_to_freq(ppcr);
261 freqs.cpu = 0;
262
263 sdram_calculate_timing(&sd, freqs.new, sdram);
264
265#if 0
266 /*
267 * These values are wrong according to the SA1110 documentation
268 * and errata, but they seem to work. Need to get a storage
269 * scope on to the SDRAM signals to work out why.
270 */
271 if (policy->max < 147500) {
272 sd.mdrefr |= MDREFR_K1DB2;
273 sd.mdcas[0] = 0xaaaaaa7f;
274 } else {
275 sd.mdrefr &= ~MDREFR_K1DB2;
276 sd.mdcas[0] = 0xaaaaaa9f;
277 }
278 sd.mdcas[1] = 0xaaaaaaaa;
279 sd.mdcas[2] = 0xaaaaaaaa;
280#endif
281
282 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
283
284 /*
285 * The clock could be going away for some time. Set the SDRAMs
286 * to refresh rapidly (every 64 memory clock cycles). To get
287 * through the whole array, we need to wait 262144 mclk cycles.
288 * We wait 20ms to be safe.
289 */
290 sdram_set_refresh(2);
291 if (!irqs_disabled())
292 msleep(20);
293 else
294 mdelay(20);
295
296 /*
297 * Reprogram the DRAM timings with interrupts disabled, and
298 * ensure that we are doing this within a complete cache line.
299 * This means that we won't access SDRAM for the duration of
300 * the programming.
301 */
302 local_irq_save(flags);
303 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
304 udelay(10);
305 __asm__ __volatile__("\n\
306 b 2f \n\
307 .align 5 \n\
3081: str %3, [%1, #0] @ MDCNFG \n\
309 str %4, [%1, #28] @ MDREFR \n\
310 str %5, [%1, #4] @ MDCAS0 \n\
311 str %6, [%1, #8] @ MDCAS1 \n\
312 str %7, [%1, #12] @ MDCAS2 \n\
313 str %8, [%2, #0] @ PPCR \n\
314 ldr %0, [%1, #0] \n\
315 b 3f \n\
3162: b 1b \n\
3173: nop \n\
318 nop"
319 : "=&r" (unused)
320 : "r" (&MDCNFG), "r" (&PPCR), "0" (sd.mdcnfg),
321 "r" (sd.mdrefr), "r" (sd.mdcas[0]),
322 "r" (sd.mdcas[1]), "r" (sd.mdcas[2]), "r" (ppcr));
323 local_irq_restore(flags);
324
325 /*
326 * Now, return the SDRAM refresh back to normal.
327 */
328 sdram_update_refresh(freqs.new, sdram);
329
330 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
331
332 return 0;
333}
334
335static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
336{
337 if (policy->cpu != 0)
338 return -EINVAL;
339 policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
340 policy->cpuinfo.min_freq = 59000;
341 policy->cpuinfo.max_freq = 287000;
342 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
343 return 0;
344}
345
346/* sa1110_driver needs __refdata because it must remain after init registers
347 * it with cpufreq_register_driver() */
348static struct cpufreq_driver sa1110_driver __refdata = {
349 .flags = CPUFREQ_STICKY,
350 .verify = sa11x0_verify_speed,
351 .target = sa1110_target,
352 .get = sa11x0_getspeed,
353 .init = sa1110_cpu_init,
354 .name = "sa1110",
355};
356
357static struct sdram_params *sa1110_find_sdram(const char *name)
358{
359 struct sdram_params *sdram;
360
361 for (sdram = sdram_tbl; sdram < sdram_tbl + ARRAY_SIZE(sdram_tbl);
362 sdram++)
363 if (strcmp(name, sdram->name) == 0)
364 return sdram;
365
366 return NULL;
367}
368
369static char sdram_name[16];
370
371static int __init sa1110_clk_init(void)
372{
373 struct sdram_params *sdram;
374 const char *name = sdram_name;
375
376 if (!cpu_is_sa1110())
377 return -ENODEV;
378
379 if (!name[0]) {
380 if (machine_is_assabet())
381 name = "TC59SM716-CL3";
382 if (machine_is_pt_system3())
383 name = "K4S641632D";
384 if (machine_is_h3100())
385 name = "KM416S4030CT";
386 if (machine_is_jornada720())
387 name = "K4S281632B-1H";
388 if (machine_is_nanoengine())
389 name = "MT48LC8M16A2TG-75";
390 }
391
392 sdram = sa1110_find_sdram(name);
393 if (sdram) {
394 printk(KERN_DEBUG "SDRAM: tck: %d trcd: %d trp: %d"
395 " twr: %d refresh: %d cas_latency: %d\n",
396 sdram->tck, sdram->trcd, sdram->trp,
397 sdram->twr, sdram->refresh, sdram->cas_latency);
398
399 memcpy(&sdram_params, sdram, sizeof(sdram_params));
400
401 return cpufreq_register_driver(&sa1110_driver);
402 }
403
404 return 0;
405}
406
407module_param_string(sdram, sdram_name, sizeof(sdram_name), 0);
408arch_initcall(sa1110_clk_init);
diff --git a/arch/arm/mach-sa1100/include/mach/generic.h b/arch/arm/mach-sa1100/include/mach/generic.h
new file mode 100644
index 000000000000..665542e0c9e2
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/generic.h
@@ -0,0 +1 @@
#include "../../generic.h"
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index b63dec848195..153555724988 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -10,6 +10,7 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/serial_8250.h> 11#include <linux/serial_8250.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/cpu.h>
13 14
14#include <asm/setup.h> 15#include <asm/setup.h>
15#include <asm/mach-types.h> 16#include <asm/mach-types.h>
@@ -130,7 +131,7 @@ static void __init shark_timer_init(void)
130 131
131static void shark_init_early(void) 132static void shark_init_early(void)
132{ 133{
133 disable_hlt(); 134 cpu_idle_poll_ctrl(true);
134} 135}
135 136
136MACHINE_START(SHARK, "Shark") 137MACHINE_START(SHARK, "Shark")
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 9255546e7bf6..eb3a7ff19e72 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -16,6 +16,7 @@ config ARCH_SH73A0
16 select CPU_V7 16 select CPU_V7
17 select I2C 17 select I2C
18 select SH_CLK_CPG 18 select SH_CLK_CPG
19 select RENESAS_INTC_IRQPIN
19 20
20config ARCH_R8A7740 21config ARCH_R8A7740
21 bool "R-Mobile A1 (R8A77400)" 22 bool "R-Mobile A1 (R8A77400)"
@@ -31,6 +32,7 @@ config ARCH_R8A7779
31 select SH_CLK_CPG 32 select SH_CLK_CPG
32 select USB_ARCH_HAS_EHCI 33 select USB_ARCH_HAS_EHCI
33 select USB_ARCH_HAS_OHCI 34 select USB_ARCH_HAS_OHCI
35 select RENESAS_INTC_IRQPIN
34 36
35config ARCH_EMEV2 37config ARCH_EMEV2
36 bool "Emma Mobile EV2" 38 bool "Emma Mobile EV2"
@@ -102,6 +104,19 @@ config MACH_MARZEN
102 select ARCH_REQUIRE_GPIOLIB 104 select ARCH_REQUIRE_GPIOLIB
103 select REGULATOR_FIXED_VOLTAGE if REGULATOR 105 select REGULATOR_FIXED_VOLTAGE if REGULATOR
104 106
107config MACH_MARZEN_REFERENCE
108 bool "MARZEN board - Reference Device Tree Implementation"
109 depends on ARCH_R8A7779
110 select ARCH_REQUIRE_GPIOLIB
111 select REGULATOR_FIXED_VOLTAGE if REGULATOR
112 select USE_OF
113 ---help---
114 Use reference implementation of Marzen board support
115 which makes use of device tree at the expense
116 of not supporting a number of devices.
117
118 This is intended to aid developers
119
105config MACH_KZM9D 120config MACH_KZM9D
106 bool "KZM9D board" 121 bool "KZM9D board"
107 depends on ARCH_EMEV2 122 depends on ARCH_EMEV2
@@ -116,6 +131,20 @@ config MACH_KZM9G
116 select SND_SOC_AK4642 if SND_SIMPLE_CARD 131 select SND_SOC_AK4642 if SND_SIMPLE_CARD
117 select USE_OF 132 select USE_OF
118 133
134config MACH_KZM9G_REFERENCE
135 bool "KZM-A9-GT board - Reference Device Tree Implementation"
136 depends on ARCH_SH73A0
137 select ARCH_REQUIRE_GPIOLIB
138 select REGULATOR_FIXED_VOLTAGE if REGULATOR
139 select SND_SOC_AK4642 if SND_SIMPLE_CARD
140 select USE_OF
141 ---help---
142 Use reference implementation of KZM-A9-GT board support
143 which makes as greater use of device tree at the expense
144 of not supporting a number of devices.
145
146 This is intended to aid developers
147
119comment "SH-Mobile System Configuration" 148comment "SH-Mobile System Configuration"
120 149
121config CPU_HAS_INTEVT 150config CPU_HAS_INTEVT
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index e1fac57514b9..c621edfa6ead 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -14,10 +14,9 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o
14 14
15# SMP objects 15# SMP objects
16smp-y := platsmp.o headsmp.o 16smp-y := platsmp.o headsmp.o
17smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o 17smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o
18smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-sh73a0.o 18smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o
19smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o 19smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o
20smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o
21 20
22# IRQ objects 21# IRQ objects
23obj-$(CONFIG_ARCH_SH7372) += entry-intc.o 22obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
@@ -39,9 +38,11 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
39obj-$(CONFIG_MACH_KOTA2) += board-kota2.o 38obj-$(CONFIG_MACH_KOTA2) += board-kota2.o
40obj-$(CONFIG_MACH_BONITO) += board-bonito.o 39obj-$(CONFIG_MACH_BONITO) += board-bonito.o
41obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 40obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
41obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
42obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 42obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
43obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 43obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
44obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 44obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
45obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
45 46
46# Framework support 47# Framework support
47obj-$(CONFIG_SMP) += $(smp-y) 48obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 8ff53a19c48c..c7540710906f 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -23,6 +23,8 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/pinctrl/machine.h>
27#include <linux/pinctrl/pinconf-generic.h>
26#include <linux/platform_device.h> 28#include <linux/platform_device.h>
27#include <linux/delay.h> 29#include <linux/delay.h>
28#include <linux/io.h> 30#include <linux/io.h>
@@ -304,9 +306,9 @@ static int lcd_backlight_set_brightness(int brightness)
304 306
305 if (brightness == 0) { 307 if (brightness == 0) {
306 /* Reset the chip */ 308 /* Reset the chip */
307 gpio_set_value(GPIO_PORT235, 0); 309 gpio_set_value(235, 0);
308 mdelay(24); 310 mdelay(24);
309 gpio_set_value(GPIO_PORT235, 1); 311 gpio_set_value(235, 1);
310 return 0; 312 return 0;
311 } 313 }
312 314
@@ -406,7 +408,7 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
406 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 408 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
407 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 409 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
408 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 410 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
409 .cd_gpio = GPIO_PORT251, 411 .cd_gpio = 251,
410}; 412};
411 413
412static struct resource sdhi0_resources[] = { 414static struct resource sdhi0_resources[] = {
@@ -461,7 +463,7 @@ static struct regulator_init_data cn4_power_init_data = {
461static struct fixed_voltage_config cn4_power_info = { 463static struct fixed_voltage_config cn4_power_info = {
462 .supply_name = "CN4 SD/MMC Vdd", 464 .supply_name = "CN4 SD/MMC Vdd",
463 .microvolts = 3300000, 465 .microvolts = 3300000,
464 .gpio = GPIO_PORT114, 466 .gpio = 114,
465 .enable_high = 1, 467 .enable_high = 1,
466 .init_data = &cn4_power_init_data, 468 .init_data = &cn4_power_init_data,
467}; 469};
@@ -479,10 +481,10 @@ static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
479 static int power_gpio = -EINVAL; 481 static int power_gpio = -EINVAL;
480 482
481 if (power_gpio < 0) { 483 if (power_gpio < 0) {
482 int ret = gpio_request_one(GPIO_PORT114, GPIOF_OUT_INIT_LOW, 484 int ret = gpio_request_one(114, GPIOF_OUT_INIT_LOW,
483 "sdhi1_power"); 485 "sdhi1_power");
484 if (!ret) 486 if (!ret)
485 power_gpio = GPIO_PORT114; 487 power_gpio = 114;
486 } 488 }
487 489
488 /* 490 /*
@@ -493,7 +495,7 @@ static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
493 * regulator driver. We have to live with the race in case the driver 495 * regulator driver. We have to live with the race in case the driver
494 * gets unloaded and the GPIO freed between these two steps. 496 * gets unloaded and the GPIO freed between these two steps.
495 */ 497 */
496 gpio_set_value(GPIO_PORT114, state); 498 gpio_set_value(114, state);
497} 499}
498 500
499static struct sh_mobile_sdhi_info sh_sdhi1_info = { 501static struct sh_mobile_sdhi_info sh_sdhi1_info = {
@@ -550,6 +552,77 @@ static struct platform_device *ag5evm_devices[] __initdata = {
550 &sdhi1_device, 552 &sdhi1_device,
551}; 553};
552 554
555static unsigned long pin_pullup_conf[] = {
556 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
557};
558
559static const struct pinctrl_map ag5evm_pinctrl_map[] = {
560 /* FSIA */
561 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
562 "fsia_mclk_in", "fsia"),
563 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
564 "fsia_sclk_in", "fsia"),
565 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
566 "fsia_data_in", "fsia"),
567 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
568 "fsia_data_out", "fsia"),
569 /* I2C2 & I2C3 */
570 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.2", "pfc-sh73a0",
571 "i2c2_0", "i2c2"),
572 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
573 "i2c3_0", "i2c3"),
574 /* IrDA */
575 PIN_MAP_MUX_GROUP_DEFAULT("sh_irda.0", "pfc-sh73a0",
576 "irda_0", "irda"),
577 /* KEYSC */
578 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
579 "keysc_in8", "keysc"),
580 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
581 "keysc_out04", "keysc"),
582 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
583 "keysc_out5", "keysc"),
584 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
585 "keysc_out6_0", "keysc"),
586 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
587 "keysc_out7_0", "keysc"),
588 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
589 "keysc_out8_0", "keysc"),
590 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
591 "keysc_out9_2", "keysc"),
592 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
593 "keysc_in8", pin_pullup_conf),
594 /* MMCIF */
595 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
596 "mmc0_data8_0", "mmc0"),
597 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
598 "mmc0_ctrl_0", "mmc0"),
599 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
600 "PORT279", pin_pullup_conf),
601 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
602 "mmc0_data8_0", pin_pullup_conf),
603 /* SCIFA2 */
604 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
605 "scifa2_data_0", "scifa2"),
606 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
607 "scifa2_ctrl_0", "scifa2"),
608 /* SDHI0 (CN15 [SD I/F]) */
609 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
610 "sdhi0_data4", "sdhi0"),
611 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
612 "sdhi0_ctrl", "sdhi0"),
613 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
614 "sdhi0_wp", "sdhi0"),
615 /* SDHI1 (CN4 [WLAN I/F]) */
616 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
617 "sdhi1_data4", "sdhi1"),
618 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
619 "sdhi1_ctrl", "sdhi1"),
620 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
621 "sdhi1_data4", pin_pullup_conf),
622 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
623 "PORT263", pin_pullup_conf),
624};
625
553static void __init ag5evm_init(void) 626static void __init ag5evm_init(void)
554{ 627{
555 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, 628 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
@@ -558,96 +631,27 @@ static void __init ag5evm_init(void)
558 ARRAY_SIZE(fixed2v8_power_consumers), 3300000); 631 ARRAY_SIZE(fixed2v8_power_consumers), 3300000);
559 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 632 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
560 633
634 pinctrl_register_mappings(ag5evm_pinctrl_map,
635 ARRAY_SIZE(ag5evm_pinctrl_map));
561 sh73a0_pinmux_init(); 636 sh73a0_pinmux_init();
562 637
563 /* enable SCIFA2 */
564 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
565 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
566 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
567 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
568
569 /* enable KEYSC */
570 gpio_request(GPIO_FN_KEYIN0_PU, NULL);
571 gpio_request(GPIO_FN_KEYIN1_PU, NULL);
572 gpio_request(GPIO_FN_KEYIN2_PU, NULL);
573 gpio_request(GPIO_FN_KEYIN3_PU, NULL);
574 gpio_request(GPIO_FN_KEYIN4_PU, NULL);
575 gpio_request(GPIO_FN_KEYIN5_PU, NULL);
576 gpio_request(GPIO_FN_KEYIN6_PU, NULL);
577 gpio_request(GPIO_FN_KEYIN7_PU, NULL);
578 gpio_request(GPIO_FN_KEYOUT0, NULL);
579 gpio_request(GPIO_FN_KEYOUT1, NULL);
580 gpio_request(GPIO_FN_KEYOUT2, NULL);
581 gpio_request(GPIO_FN_KEYOUT3, NULL);
582 gpio_request(GPIO_FN_KEYOUT4, NULL);
583 gpio_request(GPIO_FN_KEYOUT5, NULL);
584 gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
585 gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
586 gpio_request(GPIO_FN_KEYOUT8, NULL);
587 gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL);
588
589 /* enable I2C channel 2 and 3 */
590 gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL);
591 gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL);
592 gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL);
593 gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL);
594
595 /* enable MMCIF */ 638 /* enable MMCIF */
596 gpio_request(GPIO_FN_MMCCLK0, NULL); 639 gpio_request_one(208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
597 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
598 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
599 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
600 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
601 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
602 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
603 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
604 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
605 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
606 gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
607 640
608 /* enable SMSC911X */ 641 /* enable SMSC911X */
609 gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */ 642 gpio_request_one(144, GPIOF_IN, NULL); /* PINTA2 */
610 gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */ 643 gpio_request_one(145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
611
612 /* FSI A */
613 gpio_request(GPIO_FN_FSIACK, NULL);
614 gpio_request(GPIO_FN_FSIAILR, NULL);
615 gpio_request(GPIO_FN_FSIAIBT, NULL);
616 gpio_request(GPIO_FN_FSIAISLD, NULL);
617 gpio_request(GPIO_FN_FSIAOSLD, NULL);
618
619 /* IrDA */
620 gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL);
621 gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL);
622 gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
623 644
624 /* LCD panel */ 645 /* LCD panel */
625 gpio_request_one(GPIO_PORT217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */ 646 gpio_request_one(217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
626 mdelay(1); 647 mdelay(1);
627 gpio_set_value(GPIO_PORT217, 1); 648 gpio_set_value(217, 1);
628 mdelay(100); 649 mdelay(100);
629 650
630 /* LCD backlight controller */ 651 /* LCD backlight controller */
631 gpio_request_one(GPIO_PORT235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */ 652 gpio_request_one(235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
632 lcd_backlight_set_brightness(0); 653 lcd_backlight_set_brightness(0);
633 654
634 /* enable SDHI0 on CN15 [SD I/F] */
635 gpio_request(GPIO_FN_SDHIWP0, NULL);
636 gpio_request(GPIO_FN_SDHICMD0, NULL);
637 gpio_request(GPIO_FN_SDHICLK0, NULL);
638 gpio_request(GPIO_FN_SDHID0_3, NULL);
639 gpio_request(GPIO_FN_SDHID0_2, NULL);
640 gpio_request(GPIO_FN_SDHID0_1, NULL);
641 gpio_request(GPIO_FN_SDHID0_0, NULL);
642
643 /* enable SDHI1 on CN4 [WLAN I/F] */
644 gpio_request(GPIO_FN_SDHICLK1, NULL);
645 gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
646 gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
647 gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
648 gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
649 gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
650
651#ifdef CONFIG_CACHE_L2X0 655#ifdef CONFIG_CACHE_L2X0
652 /* Shared attribute override enable, 64K*8way */ 656 /* Shared attribute override enable, 64K*8way */
653 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff); 657 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 38f1259a0daf..45f78cadec1d 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -34,6 +34,7 @@
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/i2c/tsc2007.h> 35#include <linux/i2c/tsc2007.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/pinctrl/machine.h>
37#include <linux/regulator/fixed.h> 38#include <linux/regulator/fixed.h>
38#include <linux/regulator/machine.h> 39#include <linux/regulator/machine.h>
39#include <linux/smsc911x.h> 40#include <linux/smsc911x.h>
@@ -273,11 +274,11 @@ static struct platform_device smc911x_device = {
273 274
274/* 275/*
275 * The card detect pin of the top SD/MMC slot (CN7) is active low and is 276 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
276 * connected to GPIO A22 of SH7372 (GPIO_PORT41). 277 * connected to GPIO A22 of SH7372 (GPIO 41).
277 */ 278 */
278static int slot_cn7_get_cd(struct platform_device *pdev) 279static int slot_cn7_get_cd(struct platform_device *pdev)
279{ 280{
280 return !gpio_get_value(GPIO_PORT41); 281 return !gpio_get_value(41);
281} 282}
282/* MERAM */ 283/* MERAM */
283static struct sh_mobile_meram_info meram_info = { 284static struct sh_mobile_meram_info meram_info = {
@@ -838,22 +839,22 @@ static struct platform_device fsi_hdmi_device = {
838static struct gpio_led ap4evb_leds[] = { 839static struct gpio_led ap4evb_leds[] = {
839 { 840 {
840 .name = "led4", 841 .name = "led4",
841 .gpio = GPIO_PORT185, 842 .gpio = 185,
842 .default_state = LEDS_GPIO_DEFSTATE_ON, 843 .default_state = LEDS_GPIO_DEFSTATE_ON,
843 }, 844 },
844 { 845 {
845 .name = "led2", 846 .name = "led2",
846 .gpio = GPIO_PORT186, 847 .gpio = 186,
847 .default_state = LEDS_GPIO_DEFSTATE_ON, 848 .default_state = LEDS_GPIO_DEFSTATE_ON,
848 }, 849 },
849 { 850 {
850 .name = "led3", 851 .name = "led3",
851 .gpio = GPIO_PORT187, 852 .gpio = 187,
852 .default_state = LEDS_GPIO_DEFSTATE_ON, 853 .default_state = LEDS_GPIO_DEFSTATE_ON,
853 }, 854 },
854 { 855 {
855 .name = "led1", 856 .name = "led1",
856 .gpio = GPIO_PORT188, 857 .gpio = 188,
857 .default_state = LEDS_GPIO_DEFSTATE_ON, 858 .default_state = LEDS_GPIO_DEFSTATE_ON,
858 } 859 }
859}; 860};
@@ -1026,10 +1027,10 @@ out:
1026/* TouchScreen */ 1027/* TouchScreen */
1027#ifdef CONFIG_AP4EVB_QHD 1028#ifdef CONFIG_AP4EVB_QHD
1028# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123 1029# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
1029# define GPIO_TSC_PORT GPIO_PORT123 1030# define GPIO_TSC_PORT 123
1030#else /* WVGA */ 1031#else /* WVGA */
1031# define GPIO_TSC_IRQ GPIO_FN_IRQ7_40 1032# define GPIO_TSC_IRQ GPIO_FN_IRQ7_40
1032# define GPIO_TSC_PORT GPIO_PORT40 1033# define GPIO_TSC_PORT 40
1033#endif 1034#endif
1034 1035
1035#define IRQ28 evt2irq(0x3380) /* IRQ28A */ 1036#define IRQ28 evt2irq(0x3380) /* IRQ28A */
@@ -1084,6 +1085,28 @@ static struct i2c_board_info i2c1_devices[] = {
1084}; 1085};
1085 1086
1086 1087
1088static const struct pinctrl_map ap4evb_pinctrl_map[] = {
1089 /* MMCIF */
1090 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1091 "mmc0_data8_0", "mmc0"),
1092 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1093 "mmc0_ctrl_0", "mmc0"),
1094 /* SDHI0 */
1095 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1096 "sdhi0_data4", "sdhi0"),
1097 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1098 "sdhi0_ctrl", "sdhi0"),
1099 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1100 "sdhi0_cd", "sdhi0"),
1101 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1102 "sdhi0_wp", "sdhi0"),
1103 /* SDHI1 */
1104 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1105 "sdhi1_data4", "sdhi1"),
1106 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1107 "sdhi1_ctrl", "sdhi1"),
1108};
1109
1087#define GPIO_PORT9CR IOMEM(0xE6051009) 1110#define GPIO_PORT9CR IOMEM(0xE6051009)
1088#define GPIO_PORT10CR IOMEM(0xE605100A) 1111#define GPIO_PORT10CR IOMEM(0xE605100A)
1089#define USCCR1 IOMEM(0xE6058144) 1112#define USCCR1 IOMEM(0xE6058144)
@@ -1110,6 +1133,8 @@ static void __init ap4evb_init(void)
1110 /* External clock source */ 1133 /* External clock source */
1111 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1134 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1112 1135
1136 pinctrl_register_mappings(ap4evb_pinctrl_map,
1137 ARRAY_SIZE(ap4evb_pinctrl_map));
1113 sh7372_pinmux_init(); 1138 sh7372_pinmux_init();
1114 1139
1115 /* enable SCIFA0 */ 1140 /* enable SCIFA0 */
@@ -1121,40 +1146,10 @@ static void __init ap4evb_init(void)
1121 gpio_request(GPIO_FN_IRQ6_39, NULL); 1146 gpio_request(GPIO_FN_IRQ6_39, NULL);
1122 1147
1123 /* enable Debug switch (S6) */ 1148 /* enable Debug switch (S6) */
1124 gpio_request_one(GPIO_PORT32, GPIOF_IN | GPIOF_EXPORT, NULL); 1149 gpio_request_one(32, GPIOF_IN | GPIOF_EXPORT, NULL);
1125 gpio_request_one(GPIO_PORT33, GPIOF_IN | GPIOF_EXPORT, NULL); 1150 gpio_request_one(33, GPIOF_IN | GPIOF_EXPORT, NULL);
1126 gpio_request_one(GPIO_PORT34, GPIOF_IN | GPIOF_EXPORT, NULL); 1151 gpio_request_one(34, GPIOF_IN | GPIOF_EXPORT, NULL);
1127 gpio_request_one(GPIO_PORT35, GPIOF_IN | GPIOF_EXPORT, NULL); 1152 gpio_request_one(35, GPIOF_IN | GPIOF_EXPORT, NULL);
1128
1129 /* SDHI0 */
1130 gpio_request(GPIO_FN_SDHICD0, NULL);
1131 gpio_request(GPIO_FN_SDHIWP0, NULL);
1132 gpio_request(GPIO_FN_SDHICMD0, NULL);
1133 gpio_request(GPIO_FN_SDHICLK0, NULL);
1134 gpio_request(GPIO_FN_SDHID0_3, NULL);
1135 gpio_request(GPIO_FN_SDHID0_2, NULL);
1136 gpio_request(GPIO_FN_SDHID0_1, NULL);
1137 gpio_request(GPIO_FN_SDHID0_0, NULL);
1138
1139 /* SDHI1 */
1140 gpio_request(GPIO_FN_SDHICMD1, NULL);
1141 gpio_request(GPIO_FN_SDHICLK1, NULL);
1142 gpio_request(GPIO_FN_SDHID1_3, NULL);
1143 gpio_request(GPIO_FN_SDHID1_2, NULL);
1144 gpio_request(GPIO_FN_SDHID1_1, NULL);
1145 gpio_request(GPIO_FN_SDHID1_0, NULL);
1146
1147 /* MMCIF */
1148 gpio_request(GPIO_FN_MMCD0_0, NULL);
1149 gpio_request(GPIO_FN_MMCD0_1, NULL);
1150 gpio_request(GPIO_FN_MMCD0_2, NULL);
1151 gpio_request(GPIO_FN_MMCD0_3, NULL);
1152 gpio_request(GPIO_FN_MMCD0_4, NULL);
1153 gpio_request(GPIO_FN_MMCD0_5, NULL);
1154 gpio_request(GPIO_FN_MMCD0_6, NULL);
1155 gpio_request(GPIO_FN_MMCD0_7, NULL);
1156 gpio_request(GPIO_FN_MMCCMD0, NULL);
1157 gpio_request(GPIO_FN_MMCCLK0, NULL);
1158 1153
1159 /* USB enable */ 1154 /* USB enable */
1160 gpio_request(GPIO_FN_VBUS0_1, NULL); 1155 gpio_request(GPIO_FN_VBUS0_1, NULL);
@@ -1172,15 +1167,15 @@ static void __init ap4evb_init(void)
1172 gpio_request(GPIO_FN_FSIAILR, NULL); 1167 gpio_request(GPIO_FN_FSIAILR, NULL);
1173 gpio_request(GPIO_FN_FSIAISLD, NULL); 1168 gpio_request(GPIO_FN_FSIAISLD, NULL);
1174 gpio_request(GPIO_FN_FSIAOSLD, NULL); 1169 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1175 gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ 1170 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1176 1171
1177 gpio_request(GPIO_PORT9, NULL); 1172 gpio_request(9, NULL);
1178 gpio_request(GPIO_PORT10, NULL); 1173 gpio_request(10, NULL);
1179 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1174 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1180 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1175 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1181 1176
1182 /* card detect pin for MMC slot (CN7) */ 1177 /* card detect pin for MMC slot (CN7) */
1183 gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL); 1178 gpio_request_one(41, GPIOF_IN, NULL);
1184 1179
1185 /* setup FSI2 port B (HDMI) */ 1180 /* setup FSI2 port B (HDMI) */
1186 gpio_request(GPIO_FN_FSIBCK, NULL); 1181 gpio_request(GPIO_FN_FSIBCK, NULL);
@@ -1268,8 +1263,8 @@ static void __init ap4evb_init(void)
1268 gpio_request(GPIO_FN_LCDDISP, NULL); 1263 gpio_request(GPIO_FN_LCDDISP, NULL);
1269 gpio_request(GPIO_FN_LCDDCK, NULL); 1264 gpio_request(GPIO_FN_LCDDCK, NULL);
1270 1265
1271 gpio_request_one(GPIO_PORT189, GPIOF_OUT_INIT_HIGH, NULL); /* backlight */ 1266 gpio_request_one(189, GPIOF_OUT_INIT_HIGH, NULL); /* backlight */
1272 gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1267 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1273 1268
1274 lcdc_info.clock_source = LCDC_CLK_BUS; 1269 lcdc_info.clock_source = LCDC_CLK_BUS;
1275 lcdc_info.ch[0].interface_type = RGB18; 1270 lcdc_info.ch[0].interface_type = RGB18;
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index f2ec0777cfbe..4dfe32262eb7 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -24,11 +24,15 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/platform_data/st1232_pdata.h>
27#include <linux/irq.h> 28#include <linux/irq.h>
28#include <linux/platform_device.h> 29#include <linux/platform_device.h>
29#include <linux/gpio.h> 30#include <linux/gpio.h>
30#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
32#include <linux/regulator/driver.h>
33#include <linux/pinctrl/machine.h>
31#include <linux/regulator/fixed.h> 34#include <linux/regulator/fixed.h>
35#include <linux/regulator/gpio-regulator.h>
32#include <linux/regulator/machine.h> 36#include <linux/regulator/machine.h>
33#include <linux/sh_eth.h> 37#include <linux/sh_eth.h>
34#include <linux/videodev2.h> 38#include <linux/videodev2.h>
@@ -169,7 +173,7 @@ static int usbhsf_get_id(struct platform_device *pdev)
169 return USBHS_GADGET; 173 return USBHS_GADGET;
170} 174}
171 175
172static void usbhsf_power_ctrl(struct platform_device *pdev, 176static int usbhsf_power_ctrl(struct platform_device *pdev,
173 void __iomem *base, int enable) 177 void __iomem *base, int enable)
174{ 178{
175 struct usbhsf_private *priv = usbhsf_get_priv(pdev); 179 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
@@ -223,11 +227,13 @@ static void usbhsf_power_ctrl(struct platform_device *pdev,
223 clk_disable(priv->pci); /* usb work around */ 227 clk_disable(priv->pci); /* usb work around */
224 clk_disable(priv->usb24); /* usb work around */ 228 clk_disable(priv->usb24); /* usb work around */
225 } 229 }
230
231 return 0;
226} 232}
227 233
228static int usbhsf_get_vbus(struct platform_device *pdev) 234static int usbhsf_get_vbus(struct platform_device *pdev)
229{ 235{
230 return gpio_get_value(GPIO_PORT209); 236 return gpio_get_value(209);
231} 237}
232 238
233static irqreturn_t usbhsf_interrupt(int irq, void *data) 239static irqreturn_t usbhsf_interrupt(int irq, void *data)
@@ -239,7 +245,7 @@ static irqreturn_t usbhsf_interrupt(int irq, void *data)
239 return IRQ_HANDLED; 245 return IRQ_HANDLED;
240} 246}
241 247
242static void usbhsf_hardware_exit(struct platform_device *pdev) 248static int usbhsf_hardware_exit(struct platform_device *pdev)
243{ 249{
244 struct usbhsf_private *priv = usbhsf_get_priv(pdev); 250 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
245 251
@@ -264,6 +270,8 @@ static void usbhsf_hardware_exit(struct platform_device *pdev)
264 priv->usbh_base = NULL; 270 priv->usbh_base = NULL;
265 271
266 free_irq(IRQ7, pdev); 272 free_irq(IRQ7, pdev);
273
274 return 0;
267} 275}
268 276
269static int usbhsf_hardware_init(struct platform_device *pdev) 277static int usbhsf_hardware_init(struct platform_device *pdev)
@@ -535,10 +543,10 @@ static struct platform_device hdmi_lcdc_device = {
535 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ } 543 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }
536 544
537static struct gpio_keys_button gpio_buttons[] = { 545static struct gpio_keys_button gpio_buttons[] = {
538 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW3", .wakeup = 1), 546 GPIO_KEY(KEY_POWER, 99, "SW3", .wakeup = 1),
539 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW4"), 547 GPIO_KEY(KEY_BACK, 100, "SW4"),
540 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW5"), 548 GPIO_KEY(KEY_MENU, 97, "SW5"),
541 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW6"), 549 GPIO_KEY(KEY_HOME, 98, "SW6"),
542}; 550};
543 551
544static struct gpio_keys_platform_data gpio_key_info = { 552static struct gpio_keys_platform_data gpio_key_info = {
@@ -554,15 +562,119 @@ static struct platform_device gpio_keys_device = {
554 }, 562 },
555}; 563};
556 564
557/* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */ 565/* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
558static struct regulator_consumer_supply fixed3v3_power_consumers[] = 566static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
559{ 567 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
568 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
569};
570
571/* Fixed 3.3V regulator to be used by SDHI0 */
572static struct regulator_consumer_supply vcc_sdhi0_consumers[] = {
560 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 573 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
574};
575
576static struct regulator_init_data vcc_sdhi0_init_data = {
577 .constraints = {
578 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
579 },
580 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
581 .consumer_supplies = vcc_sdhi0_consumers,
582};
583
584static struct fixed_voltage_config vcc_sdhi0_info = {
585 .supply_name = "SDHI0 Vcc",
586 .microvolts = 3300000,
587 .gpio = GPIO_PORT75,
588 .enable_high = 1,
589 .init_data = &vcc_sdhi0_init_data,
590};
591
592static struct platform_device vcc_sdhi0 = {
593 .name = "reg-fixed-voltage",
594 .id = 1,
595 .dev = {
596 .platform_data = &vcc_sdhi0_info,
597 },
598};
599
600/* 1.8 / 3.3V SDHI0 VccQ regulator */
601static struct regulator_consumer_supply vccq_sdhi0_consumers[] = {
561 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), 602 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
603};
604
605static struct regulator_init_data vccq_sdhi0_init_data = {
606 .constraints = {
607 .input_uV = 3300000,
608 .min_uV = 1800000,
609 .max_uV = 3300000,
610 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
611 REGULATOR_CHANGE_STATUS,
612 },
613 .num_consumer_supplies = ARRAY_SIZE(vccq_sdhi0_consumers),
614 .consumer_supplies = vccq_sdhi0_consumers,
615};
616
617static struct gpio vccq_sdhi0_gpios[] = {
618 {GPIO_PORT17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" },
619};
620
621static struct gpio_regulator_state vccq_sdhi0_states[] = {
622 { .value = 3300000, .gpios = (0 << 0) },
623 { .value = 1800000, .gpios = (1 << 0) },
624};
625
626static struct gpio_regulator_config vccq_sdhi0_info = {
627 .supply_name = "vqmmc",
628
629 .enable_gpio = GPIO_PORT74,
630 .enable_high = 1,
631 .enabled_at_boot = 0,
632
633 .gpios = vccq_sdhi0_gpios,
634 .nr_gpios = ARRAY_SIZE(vccq_sdhi0_gpios),
635
636 .states = vccq_sdhi0_states,
637 .nr_states = ARRAY_SIZE(vccq_sdhi0_states),
638
639 .type = REGULATOR_VOLTAGE,
640 .init_data = &vccq_sdhi0_init_data,
641};
642
643static struct platform_device vccq_sdhi0 = {
644 .name = "gpio-regulator",
645 .id = -1,
646 .dev = {
647 .platform_data = &vccq_sdhi0_info,
648 },
649};
650
651/* Fixed 3.3V regulator to be used by SDHI1 */
652static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
562 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), 653 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
563 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), 654};
564 REGULATOR_SUPPLY("vmmc", "sh_mmcif"), 655
565 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"), 656static struct regulator_init_data vcc_sdhi1_init_data = {
657 .constraints = {
658 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
659 },
660 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
661 .consumer_supplies = vcc_sdhi1_consumers,
662};
663
664static struct fixed_voltage_config vcc_sdhi1_info = {
665 .supply_name = "SDHI1 Vcc",
666 .microvolts = 3300000,
667 .gpio = GPIO_PORT16,
668 .enable_high = 1,
669 .init_data = &vcc_sdhi1_init_data,
670};
671
672static struct platform_device vcc_sdhi1 = {
673 .name = "reg-fixed-voltage",
674 .id = 2,
675 .dev = {
676 .platform_data = &vcc_sdhi1_info,
677 },
566}; 678};
567 679
568/* SDHI0 */ 680/* SDHI0 */
@@ -578,10 +690,10 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
578static struct sh_mobile_sdhi_info sdhi0_info = { 690static struct sh_mobile_sdhi_info sdhi0_info = {
579 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 691 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
580 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 692 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
581 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\ 693 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
582 MMC_CAP_NEEDS_POLL, 694 MMC_CAP_POWER_OFF_CARD,
583 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 695 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
584 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 696 .cd_gpio = GPIO_PORT167,
585}; 697};
586 698
587static struct resource sdhi0_resources[] = { 699static struct resource sdhi0_resources[] = {
@@ -620,9 +732,11 @@ static struct platform_device sdhi0_device = {
620static struct sh_mobile_sdhi_info sdhi1_info = { 732static struct sh_mobile_sdhi_info sdhi1_info = {
621 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 733 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
622 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 734 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
623 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 735 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
624 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 736 MMC_CAP_POWER_OFF_CARD,
625 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 737 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
738 /* Port72 cannot generate IRQs, will be used in polling mode. */
739 .cd_gpio = GPIO_PORT72,
626}; 740};
627 741
628static struct resource sdhi1_resources[] = { 742static struct resource sdhi1_resources[] = {
@@ -656,10 +770,20 @@ static struct platform_device sdhi1_device = {
656 .resource = sdhi1_resources, 770 .resource = sdhi1_resources,
657}; 771};
658 772
773static const struct pinctrl_map eva_sdhi1_pinctrl_map[] = {
774 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
775 "sdhi1_data4", "sdhi1"),
776 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
777 "sdhi1_ctrl", "sdhi1"),
778 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
779 "sdhi1_cd", "sdhi1"),
780 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
781 "sdhi1_wp", "sdhi1"),
782};
783
659/* MMCIF */ 784/* MMCIF */
660static struct sh_mmcif_plat_data sh_mmcif_plat = { 785static struct sh_mmcif_plat_data sh_mmcif_plat = {
661 .sup_pclk = 0, 786 .sup_pclk = 0,
662 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
663 .caps = MMC_CAP_4_BIT_DATA | 787 .caps = MMC_CAP_4_BIT_DATA |
664 MMC_CAP_8_BIT_DATA | 788 MMC_CAP_8_BIT_DATA |
665 MMC_CAP_NONREMOVABLE, 789 MMC_CAP_NONREMOVABLE,
@@ -708,9 +832,9 @@ static int mt9t111_power(struct device *dev, int mode)
708 /* video1 (= CON1 camera) expect 24MHz */ 832 /* video1 (= CON1 camera) expect 24MHz */
709 clk_set_rate(mclk, clk_round_rate(mclk, 24000000)); 833 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
710 clk_enable(mclk); 834 clk_enable(mclk);
711 gpio_set_value(GPIO_PORT158, 1); 835 gpio_set_value(158, 1);
712 } else { 836 } else {
713 gpio_set_value(GPIO_PORT158, 0); 837 gpio_set_value(158, 0);
714 clk_disable(mclk); 838 clk_disable(mclk);
715 } 839 }
716 840
@@ -864,8 +988,8 @@ static struct platform_device fsi_hdmi_device = {
864 988
865/* RTC: RTC connects i2c-gpio. */ 989/* RTC: RTC connects i2c-gpio. */
866static struct i2c_gpio_platform_data i2c_gpio_data = { 990static struct i2c_gpio_platform_data i2c_gpio_data = {
867 .sda_pin = GPIO_PORT208, 991 .sda_pin = 208,
868 .scl_pin = GPIO_PORT91, 992 .scl_pin = 91,
869 .udelay = 5, /* 100 kHz */ 993 .udelay = 5, /* 100 kHz */
870}; 994};
871 995
@@ -878,10 +1002,15 @@ static struct platform_device i2c_gpio_device = {
878}; 1002};
879 1003
880/* I2C */ 1004/* I2C */
1005static struct st1232_pdata st1232_i2c0_pdata = {
1006 .reset_gpio = 166,
1007};
1008
881static struct i2c_board_info i2c0_devices[] = { 1009static struct i2c_board_info i2c0_devices[] = {
882 { 1010 {
883 I2C_BOARD_INFO("st1232-ts", 0x55), 1011 I2C_BOARD_INFO("st1232-ts", 0x55),
884 .irq = evt2irq(0x0340), 1012 .irq = evt2irq(0x0340),
1013 .platform_data = &st1232_i2c0_pdata,
885 }, 1014 },
886 { 1015 {
887 I2C_BOARD_INFO("wm8978", 0x1a), 1016 I2C_BOARD_INFO("wm8978", 0x1a),
@@ -902,6 +1031,8 @@ static struct platform_device *eva_devices[] __initdata = {
902 &lcdc0_device, 1031 &lcdc0_device,
903 &gpio_keys_device, 1032 &gpio_keys_device,
904 &sh_eth_device, 1033 &sh_eth_device,
1034 &vcc_sdhi0,
1035 &vccq_sdhi0,
905 &sdhi0_device, 1036 &sdhi0_device,
906 &sh_mmcif_device, 1037 &sh_mmcif_device,
907 &hdmi_device, 1038 &hdmi_device,
@@ -914,6 +1045,28 @@ static struct platform_device *eva_devices[] __initdata = {
914 &i2c_gpio_device, 1045 &i2c_gpio_device,
915}; 1046};
916 1047
1048static const struct pinctrl_map eva_pinctrl_map[] = {
1049 /* LCD0 */
1050 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1051 "lcd0_data24_0", "lcd0"),
1052 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1053 "lcd0_lclk_1", "lcd0"),
1054 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1055 "lcd0_sync", "lcd0"),
1056 /* MMCIF */
1057 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1058 "mmc0_data8_1", "mmc0"),
1059 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1060 "mmc0_ctrl_1", "mmc0"),
1061 /* SDHI0 */
1062 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1063 "sdhi0_data4", "sdhi0"),
1064 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1065 "sdhi0_ctrl", "sdhi0"),
1066 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1067 "sdhi0_wp", "sdhi0"),
1068};
1069
917static void __init eva_clock_init(void) 1070static void __init eva_clock_init(void)
918{ 1071{
919 struct clk *system = clk_get(NULL, "system_clk"); 1072 struct clk *system = clk_get(NULL, "system_clk");
@@ -961,6 +1114,8 @@ static void __init eva_init(void)
961 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 1114 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
962 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 1115 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
963 1116
1117 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
1118
964 r8a7740_pinmux_init(); 1119 r8a7740_pinmux_init();
965 r8a7740_meram_workaround(); 1120 r8a7740_meram_workaround();
966 1121
@@ -970,42 +1125,12 @@ static void __init eva_init(void)
970 1125
971 /* LCDC0 */ 1126 /* LCDC0 */
972 gpio_request(GPIO_FN_LCDC0_SELECT, NULL); 1127 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
973 gpio_request(GPIO_FN_LCD0_D0, NULL); 1128
974 gpio_request(GPIO_FN_LCD0_D1, NULL); 1129 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
975 gpio_request(GPIO_FN_LCD0_D2, NULL); 1130 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
976 gpio_request(GPIO_FN_LCD0_D3, NULL);
977 gpio_request(GPIO_FN_LCD0_D4, NULL);
978 gpio_request(GPIO_FN_LCD0_D5, NULL);
979 gpio_request(GPIO_FN_LCD0_D6, NULL);
980 gpio_request(GPIO_FN_LCD0_D7, NULL);
981 gpio_request(GPIO_FN_LCD0_D8, NULL);
982 gpio_request(GPIO_FN_LCD0_D9, NULL);
983 gpio_request(GPIO_FN_LCD0_D10, NULL);
984 gpio_request(GPIO_FN_LCD0_D11, NULL);
985 gpio_request(GPIO_FN_LCD0_D12, NULL);
986 gpio_request(GPIO_FN_LCD0_D13, NULL);
987 gpio_request(GPIO_FN_LCD0_D14, NULL);
988 gpio_request(GPIO_FN_LCD0_D15, NULL);
989 gpio_request(GPIO_FN_LCD0_D16, NULL);
990 gpio_request(GPIO_FN_LCD0_D17, NULL);
991 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
992 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
993 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
994 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
995 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
996 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
997 gpio_request(GPIO_FN_LCD0_DCK, NULL);
998 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
999 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
1000 gpio_request(GPIO_FN_LCD0_DISP, NULL);
1001 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
1002
1003 gpio_request_one(GPIO_PORT61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1004 gpio_request_one(GPIO_PORT202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
1005 1131
1006 /* Touchscreen */ 1132 /* Touchscreen */
1007 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */ 1133 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
1008 gpio_request_one(GPIO_PORT166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
1009 1134
1010 /* GETHER */ 1135 /* GETHER */
1011 gpio_request(GPIO_FN_ET_CRS, NULL); 1136 gpio_request(GPIO_FN_ET_CRS, NULL);
@@ -1028,12 +1153,12 @@ static void __init eva_init(void)
1028 gpio_request(GPIO_FN_ET_RX_DV, NULL); 1153 gpio_request(GPIO_FN_ET_RX_DV, NULL);
1029 gpio_request(GPIO_FN_ET_RX_CLK, NULL); 1154 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
1030 1155
1031 gpio_request_one(GPIO_PORT18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ 1156 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
1032 1157
1033 /* USB */ 1158 /* USB */
1034 gpio_request_one(GPIO_PORT159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */ 1159 gpio_request_one(159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */
1035 1160
1036 if (gpio_get_value(GPIO_PORT159)) { 1161 if (gpio_get_value(159)) {
1037 /* USB Host */ 1162 /* USB Host */
1038 } else { 1163 } else {
1039 /* USB Func */ 1164 /* USB Func */
@@ -1042,47 +1167,15 @@ static void __init eva_init(void)
1042 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide 1167 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide
1043 * USB connection/disconnection (usbhsf_get_vbus()). 1168 * USB connection/disconnection (usbhsf_get_vbus()).
1044 * This means we needs to select GPIO_FN_IRQ7_PORT209 first, 1169 * This means we needs to select GPIO_FN_IRQ7_PORT209 first,
1045 * and select GPIO_PORT209 here 1170 * and select GPIO 209 here
1046 */ 1171 */
1047 gpio_request(GPIO_FN_IRQ7_PORT209, NULL); 1172 gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
1048 gpio_request_one(GPIO_PORT209, GPIOF_IN, NULL); 1173 gpio_request_one(209, GPIOF_IN, NULL);
1049 1174
1050 platform_device_register(&usbhsf_device); 1175 platform_device_register(&usbhsf_device);
1051 usb = &usbhsf_device; 1176 usb = &usbhsf_device;
1052 } 1177 }
1053 1178
1054 /* SDHI0 */
1055 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
1056 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
1057 gpio_request(GPIO_FN_SDHI0_D0, NULL);
1058 gpio_request(GPIO_FN_SDHI0_D1, NULL);
1059 gpio_request(GPIO_FN_SDHI0_D2, NULL);
1060 gpio_request(GPIO_FN_SDHI0_D3, NULL);
1061 gpio_request(GPIO_FN_SDHI0_WP, NULL);
1062
1063 gpio_request_one(GPIO_PORT17, GPIOF_OUT_INIT_LOW, NULL); /* SDHI0_18/33_B */
1064 gpio_request_one(GPIO_PORT74, GPIOF_OUT_INIT_HIGH, NULL); /* SDHI0_PON */
1065 gpio_request_one(GPIO_PORT75, GPIOF_OUT_INIT_HIGH, NULL); /* SDSLOT1_PON */
1066
1067 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
1068
1069 /*
1070 * MMCIF
1071 *
1072 * Here doesn't care SW1.4 status,
1073 * since CON2 is not mounted.
1074 */
1075 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
1076 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
1077 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
1078 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
1079 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
1080 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
1081 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
1082 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
1083 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
1084 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
1085
1086 /* CEU0 */ 1179 /* CEU0 */
1087 gpio_request(GPIO_FN_VIO0_D7, NULL); 1180 gpio_request(GPIO_FN_VIO0_D7, NULL);
1088 gpio_request(GPIO_FN_VIO0_D6, NULL); 1181 gpio_request(GPIO_FN_VIO0_D6, NULL);
@@ -1099,10 +1192,10 @@ static void __init eva_init(void)
1099 gpio_request(GPIO_FN_VIO_CKO, NULL); 1192 gpio_request(GPIO_FN_VIO_CKO, NULL);
1100 1193
1101 /* CON1/CON15 Camera */ 1194 /* CON1/CON15 Camera */
1102 gpio_request_one(GPIO_PORT173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */ 1195 gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */
1103 gpio_request_one(GPIO_PORT172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */ 1196 gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
1104 /* see mt9t111_power() */ 1197 /* see mt9t111_power() */
1105 gpio_request_one(GPIO_PORT158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */ 1198 gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */
1106 1199
1107 /* FSI-WM8978 */ 1200 /* FSI-WM8978 */
1108 gpio_request(GPIO_FN_FSIAIBT, NULL); 1201 gpio_request(GPIO_FN_FSIAIBT, NULL);
@@ -1111,8 +1204,8 @@ static void __init eva_init(void)
1111 gpio_request(GPIO_FN_FSIAOSLD, NULL); 1204 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1112 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL); 1205 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
1113 1206
1114 gpio_request(GPIO_PORT7, NULL); 1207 gpio_request(7, NULL);
1115 gpio_request(GPIO_PORT8, NULL); 1208 gpio_request(8, NULL);
1116 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */ 1209 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1117 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */ 1210 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
1118 1211
@@ -1129,29 +1222,21 @@ static void __init eva_init(void)
1129 * DBGMD/LCDC0/FSIA MUX 1222 * DBGMD/LCDC0/FSIA MUX
1130 * DBGMD_SELECT_B should be set after setting PFC Function. 1223 * DBGMD_SELECT_B should be set after setting PFC Function.
1131 */ 1224 */
1132 gpio_request_one(GPIO_PORT176, GPIOF_OUT_INIT_HIGH, NULL); 1225 gpio_request_one(176, GPIOF_OUT_INIT_HIGH, NULL);
1133 1226
1134 /* 1227 /*
1135 * We can switch CON8/CON14 by SW1.5, 1228 * We can switch CON8/CON14 by SW1.5,
1136 * but it needs after DBGMD_SELECT_B 1229 * but it needs after DBGMD_SELECT_B
1137 */ 1230 */
1138 gpio_request_one(GPIO_PORT6, GPIOF_IN, NULL); 1231 gpio_request_one(6, GPIOF_IN, NULL);
1139 if (gpio_get_value(GPIO_PORT6)) { 1232 if (gpio_get_value(6)) {
1140 /* CON14 enable */ 1233 /* CON14 enable */
1141 } else { 1234 } else {
1142 /* CON8 (SDHI1) enable */ 1235 /* CON8 (SDHI1) enable */
1143 gpio_request(GPIO_FN_SDHI1_CLK, NULL); 1236 pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
1144 gpio_request(GPIO_FN_SDHI1_CMD, NULL); 1237 ARRAY_SIZE(eva_sdhi1_pinctrl_map));
1145 gpio_request(GPIO_FN_SDHI1_D0, NULL);
1146 gpio_request(GPIO_FN_SDHI1_D1, NULL);
1147 gpio_request(GPIO_FN_SDHI1_D2, NULL);
1148 gpio_request(GPIO_FN_SDHI1_D3, NULL);
1149 gpio_request(GPIO_FN_SDHI1_CD, NULL);
1150 gpio_request(GPIO_FN_SDHI1_WP, NULL);
1151
1152 /* SDSLOT2_PON */
1153 gpio_request_one(GPIO_PORT16, GPIOF_OUT_INIT_HIGH, NULL);
1154 1238
1239 platform_device_register(&vcc_sdhi1);
1155 platform_device_register(&sdhi1_device); 1240 platform_device_register(&sdhi1_device);
1156 } 1241 }
1157 1242
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index e50f86691539..70d992c540ae 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/pinctrl/machine.h>
27#include <linux/platform_device.h> 28#include <linux/platform_device.h>
28#include <linux/gpio.h> 29#include <linux/gpio.h>
29#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
@@ -288,6 +289,16 @@ static struct platform_device lcdc0_device = {
288 }, 289 },
289}; 290};
290 291
292static const struct pinctrl_map lcdc0_pinctrl_map[] = {
293 /* LCD0 */
294 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
295 "lcd0_data24_1", "lcd0"),
296 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
297 "lcd0_lclk_1", "lcd0"),
298 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
299 "lcd0_sync", "lcd0"),
300};
301
291/* 302/*
292 * SMSC 9221 303 * SMSC 9221
293 */ 304 */
@@ -392,8 +403,8 @@ static void __init bonito_init(void)
392 /* 403 /*
393 * base board settings 404 * base board settings
394 */ 405 */
395 gpio_request_one(GPIO_PORT176, GPIOF_IN, NULL); 406 gpio_request_one(176, GPIOF_IN, NULL);
396 if (!gpio_get_value(GPIO_PORT176)) { 407 if (!gpio_get_value(176)) {
397 u16 bsw2; 408 u16 bsw2;
398 u16 bsw3; 409 u16 bsw3;
399 u16 bsw4; 410 u16 bsw4;
@@ -430,38 +441,11 @@ static void __init bonito_init(void)
430 */ 441 */
431 if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */ 442 if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */
432 BIT_ON(bsw2, 2)) { /* S38.2 = OFF */ 443 BIT_ON(bsw2, 2)) { /* S38.2 = OFF */
433 gpio_request(GPIO_FN_LCDC0_SELECT, NULL); 444 pinctrl_register_mappings(lcdc0_pinctrl_map,
434 gpio_request(GPIO_FN_LCD0_D0, NULL); 445 ARRAY_SIZE(lcdc0_pinctrl_map));
435 gpio_request(GPIO_FN_LCD0_D1, NULL); 446 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
436 gpio_request(GPIO_FN_LCD0_D2, NULL); 447
437 gpio_request(GPIO_FN_LCD0_D3, NULL); 448 gpio_request_one(61, GPIOF_OUT_INIT_HIGH,
438 gpio_request(GPIO_FN_LCD0_D4, NULL);
439 gpio_request(GPIO_FN_LCD0_D5, NULL);
440 gpio_request(GPIO_FN_LCD0_D6, NULL);
441 gpio_request(GPIO_FN_LCD0_D7, NULL);
442 gpio_request(GPIO_FN_LCD0_D8, NULL);
443 gpio_request(GPIO_FN_LCD0_D9, NULL);
444 gpio_request(GPIO_FN_LCD0_D10, NULL);
445 gpio_request(GPIO_FN_LCD0_D11, NULL);
446 gpio_request(GPIO_FN_LCD0_D12, NULL);
447 gpio_request(GPIO_FN_LCD0_D13, NULL);
448 gpio_request(GPIO_FN_LCD0_D14, NULL);
449 gpio_request(GPIO_FN_LCD0_D15, NULL);
450 gpio_request(GPIO_FN_LCD0_D16, NULL);
451 gpio_request(GPIO_FN_LCD0_D17, NULL);
452 gpio_request(GPIO_FN_LCD0_D18_PORT163, NULL);
453 gpio_request(GPIO_FN_LCD0_D19_PORT162, NULL);
454 gpio_request(GPIO_FN_LCD0_D20_PORT161, NULL);
455 gpio_request(GPIO_FN_LCD0_D21_PORT158, NULL);
456 gpio_request(GPIO_FN_LCD0_D22_PORT160, NULL);
457 gpio_request(GPIO_FN_LCD0_D23_PORT159, NULL);
458 gpio_request(GPIO_FN_LCD0_DCK, NULL);
459 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
460 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
461 gpio_request(GPIO_FN_LCD0_DISP, NULL);
462 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
463
464 gpio_request_one(GPIO_PORT61, GPIOF_OUT_INIT_HIGH,
465 NULL); /* LCDDON */ 449 NULL); /* LCDDON */
466 450
467 /* backlight on */ 451 /* backlight on */
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index 2ccc860403ef..ef5ca0ef0cb5 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -24,6 +24,8 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/pinctrl/machine.h>
28#include <linux/pinctrl/pinconf-generic.h>
27#include <linux/platform_device.h> 29#include <linux/platform_device.h>
28#include <linux/delay.h> 30#include <linux/delay.h>
29#include <linux/io.h> 31#include <linux/io.h>
@@ -135,17 +137,17 @@ static struct platform_device keysc_device = {
135#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } 137#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
136 138
137static struct gpio_keys_button gpio_buttons[] = { 139static struct gpio_keys_button gpio_buttons[] = {
138 GPIO_KEY(KEY_VOLUMEUP, GPIO_PORT56, "+"), /* S2: VOL+ [IRQ9] */ 140 GPIO_KEY(KEY_VOLUMEUP, 56, "+"), /* S2: VOL+ [IRQ9] */
139 GPIO_KEY(KEY_VOLUMEDOWN, GPIO_PORT54, "-"), /* S3: VOL- [IRQ10] */ 141 GPIO_KEY(KEY_VOLUMEDOWN, 54, "-"), /* S3: VOL- [IRQ10] */
140 GPIO_KEY(KEY_MENU, GPIO_PORT27, "Menu"), /* S4: MENU [IRQ30] */ 142 GPIO_KEY(KEY_MENU, 27, "Menu"), /* S4: MENU [IRQ30] */
141 GPIO_KEY(KEY_HOMEPAGE, GPIO_PORT26, "Home"), /* S5: HOME [IRQ31] */ 143 GPIO_KEY(KEY_HOMEPAGE, 26, "Home"), /* S5: HOME [IRQ31] */
142 GPIO_KEY(KEY_BACK, GPIO_PORT11, "Back"), /* S6: BACK [IRQ0] */ 144 GPIO_KEY(KEY_BACK, 11, "Back"), /* S6: BACK [IRQ0] */
143 GPIO_KEY(KEY_PHONE, GPIO_PORT238, "Tel"), /* S7: TEL [IRQ11] */ 145 GPIO_KEY(KEY_PHONE, 238, "Tel"), /* S7: TEL [IRQ11] */
144 GPIO_KEY(KEY_POWER, GPIO_PORT239, "C1"), /* S8: CAM [IRQ13] */ 146 GPIO_KEY(KEY_POWER, 239, "C1"), /* S8: CAM [IRQ13] */
145 GPIO_KEY(KEY_MAIL, GPIO_PORT224, "Mail"), /* S9: MAIL [IRQ3] */ 147 GPIO_KEY(KEY_MAIL, 224, "Mail"), /* S9: MAIL [IRQ3] */
146 /* Omitted button "C3?": GPIO_PORT223 - S10: CUST [IRQ8] */ 148 /* Omitted button "C3?": 223 - S10: CUST [IRQ8] */
147 GPIO_KEY(KEY_CAMERA, GPIO_PORT164, "C2"), /* S11: CAM_HALF [IRQ25] */ 149 GPIO_KEY(KEY_CAMERA, 164, "C2"), /* S11: CAM_HALF [IRQ25] */
148 /* Omitted button "?": GPIO_PORT152 - S12: CAM_FULL [No IRQ] */ 150 /* Omitted button "?": 152 - S12: CAM_FULL [No IRQ] */
149}; 151};
150 152
151static struct gpio_keys_platform_data gpio_key_info = { 153static struct gpio_keys_platform_data gpio_key_info = {
@@ -165,9 +167,9 @@ static struct platform_device gpio_keys_device = {
165#define GPIO_LED(n, g) { .name = n, .gpio = g } 167#define GPIO_LED(n, g) { .name = n, .gpio = g }
166 168
167static struct gpio_led gpio_leds[] = { 169static struct gpio_led gpio_leds[] = {
168 GPIO_LED("G", GPIO_PORT20), /* PORT20 [GPO0] -> LED7 -> "G" */ 170 GPIO_LED("G", 20), /* PORT20 [GPO0] -> LED7 -> "G" */
169 GPIO_LED("H", GPIO_PORT21), /* PORT21 [GPO1] -> LED8 -> "H" */ 171 GPIO_LED("H", 21), /* PORT21 [GPO1] -> LED8 -> "H" */
170 GPIO_LED("J", GPIO_PORT22), /* PORT22 [GPO2] -> LED9 -> "J" */ 172 GPIO_LED("J", 22), /* PORT22 [GPO2] -> LED9 -> "J" */
171}; 173};
172 174
173static struct gpio_led_platform_data gpio_leds_info = { 175static struct gpio_led_platform_data gpio_leds_info = {
@@ -187,7 +189,7 @@ static struct platform_device gpio_leds_device = {
187static struct led_renesas_tpu_config led_renesas_tpu12_pdata = { 189static struct led_renesas_tpu_config led_renesas_tpu12_pdata = {
188 .name = "V2513", 190 .name = "V2513",
189 .pin_gpio_fn = GPIO_FN_TPU1TO2, 191 .pin_gpio_fn = GPIO_FN_TPU1TO2,
190 .pin_gpio = GPIO_PORT153, 192 .pin_gpio = 153,
191 .channel_offset = 0x90, 193 .channel_offset = 0x90,
192 .timer_bit = 2, 194 .timer_bit = 2,
193 .max_brightness = 1000, 195 .max_brightness = 1000,
@@ -215,7 +217,7 @@ static struct platform_device leds_tpu12_device = {
215static struct led_renesas_tpu_config led_renesas_tpu41_pdata = { 217static struct led_renesas_tpu_config led_renesas_tpu41_pdata = {
216 .name = "V2514", 218 .name = "V2514",
217 .pin_gpio_fn = GPIO_FN_TPU4TO1, 219 .pin_gpio_fn = GPIO_FN_TPU4TO1,
218 .pin_gpio = GPIO_PORT199, 220 .pin_gpio = 199,
219 .channel_offset = 0x50, 221 .channel_offset = 0x50,
220 .timer_bit = 1, 222 .timer_bit = 1,
221 .max_brightness = 1000, 223 .max_brightness = 1000,
@@ -243,7 +245,7 @@ static struct platform_device leds_tpu41_device = {
243static struct led_renesas_tpu_config led_renesas_tpu21_pdata = { 245static struct led_renesas_tpu_config led_renesas_tpu21_pdata = {
244 .name = "V2515", 246 .name = "V2515",
245 .pin_gpio_fn = GPIO_FN_TPU2TO1, 247 .pin_gpio_fn = GPIO_FN_TPU2TO1,
246 .pin_gpio = GPIO_PORT197, 248 .pin_gpio = 197,
247 .channel_offset = 0x50, 249 .channel_offset = 0x50,
248 .timer_bit = 1, 250 .timer_bit = 1,
249 .max_brightness = 1000, 251 .max_brightness = 1000,
@@ -271,7 +273,7 @@ static struct platform_device leds_tpu21_device = {
271static struct led_renesas_tpu_config led_renesas_tpu30_pdata = { 273static struct led_renesas_tpu_config led_renesas_tpu30_pdata = {
272 .name = "KEYLED", 274 .name = "KEYLED",
273 .pin_gpio_fn = GPIO_FN_TPU3TO0, 275 .pin_gpio_fn = GPIO_FN_TPU3TO0,
274 .pin_gpio = GPIO_PORT163, 276 .pin_gpio = 163,
275 .channel_offset = 0x10, 277 .channel_offset = 0x10,
276 .timer_bit = 0, 278 .timer_bit = 0,
277 .max_brightness = 1000, 279 .max_brightness = 1000,
@@ -433,6 +435,85 @@ static struct platform_device *kota2_devices[] __initdata = {
433 &sdhi1_device, 435 &sdhi1_device,
434}; 436};
435 437
438static unsigned long pin_pullup_conf[] = {
439 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
440};
441
442static const struct pinctrl_map kota2_pinctrl_map[] = {
443 /* KEYSC */
444 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
445 "keysc_in8", "keysc"),
446 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
447 "keysc_out04", "keysc"),
448 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
449 "keysc_out5", "keysc"),
450 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
451 "keysc_out6_0", "keysc"),
452 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
453 "keysc_out7_0", "keysc"),
454 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
455 "keysc_out8_0", "keysc"),
456 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
457 "keysc_in8", pin_pullup_conf),
458 /* MMCIF */
459 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
460 "mmc0_data8_0", "mmc0"),
461 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
462 "mmc0_ctrl_0", "mmc0"),
463 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
464 "PORT279", pin_pullup_conf),
465 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
466 "mmc0_data8_0", pin_pullup_conf),
467 /* SCIFA2 (UART2) */
468 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
469 "scifa2_data_0", "scifa2"),
470 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
471 "scifa2_ctrl_0", "scifa2"),
472 /* SCIFA4 (UART1) */
473 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
474 "scifa4_data", "scifa4"),
475 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
476 "scifa4_ctrl", "scifa4"),
477 /* SCIFB (BT) */
478 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
479 "scifb_data_0", "scifb"),
480 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
481 "scifb_clk_0", "scifb"),
482 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
483 "scifb_ctrl_0", "scifb"),
484 /* SDHI0 (microSD) */
485 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
486 "sdhi0_data4", "sdhi0"),
487 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
488 "sdhi0_ctrl", "sdhi0"),
489 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
490 "sdhi0_cd", "sdhi0"),
491 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
492 "sdhi0_data4", pin_pullup_conf),
493 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
494 "PORT256", pin_pullup_conf),
495 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
496 "PORT251", pin_pullup_conf),
497 /* SDHI1 (BCM4330) */
498 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
499 "sdhi1_data4", "sdhi1"),
500 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
501 "sdhi1_ctrl", "sdhi1"),
502 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
503 "sdhi1_data4", pin_pullup_conf),
504 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
505 "PORT263", pin_pullup_conf),
506 /* SMSC911X */
507 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
508 "bsc_data_0_7", "bsc"),
509 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
510 "bsc_data_8_15", "bsc"),
511 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
512 "bsc_cs5_a", "bsc"),
513 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
514 "bsc_we0", "bsc"),
515};
516
436static void __init kota2_init(void) 517static void __init kota2_init(void)
437{ 518{
438 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, 519 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
@@ -441,97 +522,16 @@ static void __init kota2_init(void)
441 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 522 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
442 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 523 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
443 524
525 pinctrl_register_mappings(kota2_pinctrl_map,
526 ARRAY_SIZE(kota2_pinctrl_map));
444 sh73a0_pinmux_init(); 527 sh73a0_pinmux_init();
445 528
446 /* SCIFA2 (UART2) */
447 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
448 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
449 gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
450 gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
451
452 /* SCIFA4 (UART1) */
453 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
454 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
455 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
456 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
457
458 /* SMSC911X */ 529 /* SMSC911X */
459 gpio_request(GPIO_FN_D0_NAF0, NULL); 530 gpio_request_one(144, GPIOF_IN, NULL); /* PINTA2 */
460 gpio_request(GPIO_FN_D1_NAF1, NULL); 531 gpio_request_one(145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
461 gpio_request(GPIO_FN_D2_NAF2, NULL);
462 gpio_request(GPIO_FN_D3_NAF3, NULL);
463 gpio_request(GPIO_FN_D4_NAF4, NULL);
464 gpio_request(GPIO_FN_D5_NAF5, NULL);
465 gpio_request(GPIO_FN_D6_NAF6, NULL);
466 gpio_request(GPIO_FN_D7_NAF7, NULL);
467 gpio_request(GPIO_FN_D8_NAF8, NULL);
468 gpio_request(GPIO_FN_D9_NAF9, NULL);
469 gpio_request(GPIO_FN_D10_NAF10, NULL);
470 gpio_request(GPIO_FN_D11_NAF11, NULL);
471 gpio_request(GPIO_FN_D12_NAF12, NULL);
472 gpio_request(GPIO_FN_D13_NAF13, NULL);
473 gpio_request(GPIO_FN_D14_NAF14, NULL);
474 gpio_request(GPIO_FN_D15_NAF15, NULL);
475 gpio_request(GPIO_FN_CS5A_, NULL);
476 gpio_request(GPIO_FN_WE0__FWE, NULL);
477 gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */
478 gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
479
480 /* KEYSC */
481 gpio_request(GPIO_FN_KEYIN0_PU, NULL);
482 gpio_request(GPIO_FN_KEYIN1_PU, NULL);
483 gpio_request(GPIO_FN_KEYIN2_PU, NULL);
484 gpio_request(GPIO_FN_KEYIN3_PU, NULL);
485 gpio_request(GPIO_FN_KEYIN4_PU, NULL);
486 gpio_request(GPIO_FN_KEYIN5_PU, NULL);
487 gpio_request(GPIO_FN_KEYIN6_PU, NULL);
488 gpio_request(GPIO_FN_KEYIN7_PU, NULL);
489 gpio_request(GPIO_FN_KEYOUT0, NULL);
490 gpio_request(GPIO_FN_KEYOUT1, NULL);
491 gpio_request(GPIO_FN_KEYOUT2, NULL);
492 gpio_request(GPIO_FN_KEYOUT3, NULL);
493 gpio_request(GPIO_FN_KEYOUT4, NULL);
494 gpio_request(GPIO_FN_KEYOUT5, NULL);
495 gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
496 gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
497 gpio_request(GPIO_FN_KEYOUT8, NULL);
498 532
499 /* MMCIF */ 533 /* MMCIF */
500 gpio_request(GPIO_FN_MMCCLK0, NULL); 534 gpio_request_one(208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
501 gpio_request(GPIO_FN_MMCD0_0, NULL);
502 gpio_request(GPIO_FN_MMCD0_1, NULL);
503 gpio_request(GPIO_FN_MMCD0_2, NULL);
504 gpio_request(GPIO_FN_MMCD0_3, NULL);
505 gpio_request(GPIO_FN_MMCD0_4, NULL);
506 gpio_request(GPIO_FN_MMCD0_5, NULL);
507 gpio_request(GPIO_FN_MMCD0_6, NULL);
508 gpio_request(GPIO_FN_MMCD0_7, NULL);
509 gpio_request(GPIO_FN_MMCCMD0, NULL);
510 gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
511
512 /* SDHI0 (microSD) */
513 gpio_request(GPIO_FN_SDHICD0_PU, NULL);
514 gpio_request(GPIO_FN_SDHICMD0_PU, NULL);
515 gpio_request(GPIO_FN_SDHICLK0, NULL);
516 gpio_request(GPIO_FN_SDHID0_3_PU, NULL);
517 gpio_request(GPIO_FN_SDHID0_2_PU, NULL);
518 gpio_request(GPIO_FN_SDHID0_1_PU, NULL);
519 gpio_request(GPIO_FN_SDHID0_0_PU, NULL);
520
521 /* SCIFB (BT) */
522 gpio_request(GPIO_FN_PORT159_SCIFB_SCK, NULL);
523 gpio_request(GPIO_FN_PORT160_SCIFB_TXD, NULL);
524 gpio_request(GPIO_FN_PORT161_SCIFB_CTS_, NULL);
525 gpio_request(GPIO_FN_PORT162_SCIFB_RXD, NULL);
526 gpio_request(GPIO_FN_PORT163_SCIFB_RTS_, NULL);
527
528 /* SDHI1 (BCM4330) */
529 gpio_request(GPIO_FN_SDHICLK1, NULL);
530 gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
531 gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
532 gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
533 gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
534 gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
535 535
536#ifdef CONFIG_CACHE_L2X0 536#ifdef CONFIG_CACHE_L2X0
537 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 537 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
new file mode 100644
index 000000000000..aefa50d385b7
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -0,0 +1,107 @@
1/*
2 * KZM-A9-GT board support - Reference Device Tree Implementation
3 *
4 * Copyright (C) 2012 Horms Solutions Ltd.
5 *
6 * Based on board-kzm9g.c
7 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#include <linux/delay.h>
24#include <linux/gpio.h>
25#include <linux/io.h>
26#include <linux/irq.h>
27#include <linux/irqchip.h>
28#include <linux/input.h>
29#include <linux/of_platform.h>
30#include <linux/pinctrl/machine.h>
31#include <linux/pinctrl/pinconf-generic.h>
32#include <mach/sh73a0.h>
33#include <mach/common.h>
34#include <asm/hardware/cache-l2x0.h>
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37
38static unsigned long pin_pullup_conf[] = {
39 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
40};
41
42static const struct pinctrl_map kzm_pinctrl_map[] = {
43 PIN_MAP_MUX_GROUP_DEFAULT("e6826000.i2c", "pfc-sh73a0",
44 "i2c3_1", "i2c3"),
45 /* MMCIF */
46 PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
47 "mmc0_data8_0", "mmc0"),
48 PIN_MAP_MUX_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
49 "mmc0_ctrl_0", "mmc0"),
50 PIN_MAP_CONFIGS_PIN_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
51 "PORT279", pin_pullup_conf),
52 PIN_MAP_CONFIGS_GROUP_DEFAULT("e6bd0000.mmcif", "pfc-sh73a0",
53 "mmc0_data8_0", pin_pullup_conf),
54 /* SCIFA4 */
55 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
56 "scifa4_data", "scifa4"),
57 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
58 "scifa4_ctrl", "scifa4"),
59 /* SDHI0 */
60 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
61 "sdhi0_data4", "sdhi0"),
62 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
63 "sdhi0_ctrl", "sdhi0"),
64 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
65 "sdhi0_cd", "sdhi0"),
66 PIN_MAP_MUX_GROUP_DEFAULT("ee100000.sdhi", "pfc-sh73a0",
67 "sdhi0_wp", "sdhi0"),
68 /* SDHI2 */
69 PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0",
70 "sdhi2_data4", "sdhi2"),
71 PIN_MAP_MUX_GROUP_DEFAULT("ee140000.sdhi", "pfc-sh73a0",
72 "sdhi2_ctrl", "sdhi2"),
73};
74
75static void __init kzm_init(void)
76{
77 sh73a0_add_standard_devices_dt();
78 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
79 sh73a0_pinmux_init();
80
81 /* enable SD */
82 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
83 gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */
84
85 gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */
86
87#ifdef CONFIG_CACHE_L2X0
88 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
89 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
90#endif
91}
92
93static const char *kzm9g_boards_compat_dt[] __initdata = {
94 "renesas,kzm9g-reference",
95 NULL,
96};
97
98DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
99 .smp = smp_ops(sh73a0_smp_ops),
100 .map_io = sh73a0_map_io,
101 .init_early = sh73a0_init_delay,
102 .nr_irqs = NR_IRQS_LEGACY,
103 .init_irq = irqchip_init,
104 .init_machine = kzm_init,
105 .init_time = shmobile_timer_init,
106 .dt_compat = kzm9g_boards_compat_dt,
107MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 7f3a6b7e7b7c..e6b775a10aad 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -30,6 +30,8 @@
30#include <linux/mmc/sh_mmcif.h> 30#include <linux/mmc/sh_mmcif.h>
31#include <linux/mmc/sh_mobile_sdhi.h> 31#include <linux/mmc/sh_mobile_sdhi.h>
32#include <linux/mfd/tmio.h> 32#include <linux/mfd/tmio.h>
33#include <linux/pinctrl/machine.h>
34#include <linux/pinctrl/pinconf-generic.h>
33#include <linux/platform_device.h> 35#include <linux/platform_device.h>
34#include <linux/regulator/fixed.h> 36#include <linux/regulator/fixed.h>
35#include <linux/regulator/machine.h> 37#include <linux/regulator/machine.h>
@@ -61,8 +63,8 @@
61 63
62/* Dummy supplies, where voltage doesn't matter */ 64/* Dummy supplies, where voltage doesn't matter */
63static struct regulator_consumer_supply dummy_supplies[] = { 65static struct regulator_consumer_supply dummy_supplies[] = {
64 REGULATOR_SUPPLY("vddvario", "smsc911x"), 66 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
65 REGULATOR_SUPPLY("vdd33a", "smsc911x"), 67 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
66}; 68};
67 69
68/* 70/*
@@ -81,7 +83,7 @@ static struct resource smsc9221_resources[] = {
81 .flags = IORESOURCE_MEM, 83 .flags = IORESOURCE_MEM,
82 }, 84 },
83 [1] = { 85 [1] = {
84 .start = intcs_evt2irq(0x260), /* IRQ3 */ 86 .start = irq_pin(3), /* IRQ3 */
85 .flags = IORESOURCE_IRQ, 87 .flags = IORESOURCE_IRQ,
86 }, 88 },
87}; 89};
@@ -115,7 +117,7 @@ static struct resource usb_resources[] = {
115 .flags = IORESOURCE_MEM, 117 .flags = IORESOURCE_MEM,
116 }, 118 },
117 [1] = { 119 [1] = {
118 .start = intcs_evt2irq(0x220), /* IRQ1 */ 120 .start = irq_pin(1), /* IRQ1 */
119 .flags = IORESOURCE_IRQ, 121 .flags = IORESOURCE_IRQ,
120 }, 122 },
121}; 123};
@@ -138,7 +140,7 @@ struct usbhs_private {
138 struct renesas_usbhs_platform_info info; 140 struct renesas_usbhs_platform_info info;
139}; 141};
140 142
141#define IRQ15 intcs_evt2irq(0x03e0) 143#define IRQ15 irq_pin(15)
142#define USB_PHY_MODE (1 << 4) 144#define USB_PHY_MODE (1 << 4)
143#define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) 145#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
144#define USB_PHY_ON (1 << 1) 146#define USB_PHY_ON (1 << 1)
@@ -155,12 +157,14 @@ static int usbhs_get_vbus(struct platform_device *pdev)
155 return !((1 << 7) & __raw_readw(priv->cr2)); 157 return !((1 << 7) & __raw_readw(priv->cr2));
156} 158}
157 159
158static void usbhs_phy_reset(struct platform_device *pdev) 160static int usbhs_phy_reset(struct platform_device *pdev)
159{ 161{
160 struct usbhs_private *priv = usbhs_get_priv(pdev); 162 struct usbhs_private *priv = usbhs_get_priv(pdev);
161 163
162 /* init phy */ 164 /* init phy */
163 __raw_writew(0x8a0a, priv->cr2); 165 __raw_writew(0x8a0a, priv->cr2);
166
167 return 0;
164} 168}
165 169
166static int usbhs_get_id(struct platform_device *pdev) 170static int usbhs_get_id(struct platform_device *pdev)
@@ -202,7 +206,7 @@ static int usbhs_hardware_init(struct platform_device *pdev)
202 return 0; 206 return 0;
203} 207}
204 208
205static void usbhs_hardware_exit(struct platform_device *pdev) 209static int usbhs_hardware_exit(struct platform_device *pdev)
206{ 210{
207 struct usbhs_private *priv = usbhs_get_priv(pdev); 211 struct usbhs_private *priv = usbhs_get_priv(pdev);
208 212
@@ -210,6 +214,8 @@ static void usbhs_hardware_exit(struct platform_device *pdev)
210 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy); 214 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
211 215
212 free_irq(IRQ15, pdev); 216 free_irq(IRQ15, pdev);
217
218 return 0;
213} 219}
214 220
215static u32 usbhs_pipe_cfg[] = { 221static u32 usbhs_pipe_cfg[] = {
@@ -373,13 +379,64 @@ static struct platform_device mmc_device = {
373 .resource = sh_mmcif_resources, 379 .resource = sh_mmcif_resources,
374}; 380};
375 381
376/* Fixed 2.8V regulators to be used by SDHI0 and SDHI2 */ 382/* Fixed 3.3V regulators to be used by SDHI0 */
377static struct regulator_consumer_supply fixed2v8_power_consumers[] = 383static struct regulator_consumer_supply vcc_sdhi0_consumers[] =
378{ 384{
379 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 385 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
380 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), 386};
387
388static struct regulator_init_data vcc_sdhi0_init_data = {
389 .constraints = {
390 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
391 },
392 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
393 .consumer_supplies = vcc_sdhi0_consumers,
394};
395
396static struct fixed_voltage_config vcc_sdhi0_info = {
397 .supply_name = "SDHI0 Vcc",
398 .microvolts = 3300000,
399 .gpio = 15,
400 .enable_high = 1,
401 .init_data = &vcc_sdhi0_init_data,
402};
403
404static struct platform_device vcc_sdhi0 = {
405 .name = "reg-fixed-voltage",
406 .id = 0,
407 .dev = {
408 .platform_data = &vcc_sdhi0_info,
409 },
410};
411
412/* Fixed 3.3V regulators to be used by SDHI2 */
413static struct regulator_consumer_supply vcc_sdhi2_consumers[] =
414{
381 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"), 415 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
382 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"), 416};
417
418static struct regulator_init_data vcc_sdhi2_init_data = {
419 .constraints = {
420 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
421 },
422 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers),
423 .consumer_supplies = vcc_sdhi2_consumers,
424};
425
426static struct fixed_voltage_config vcc_sdhi2_info = {
427 .supply_name = "SDHI2 Vcc",
428 .microvolts = 3300000,
429 .gpio = 14,
430 .enable_high = 1,
431 .init_data = &vcc_sdhi2_init_data,
432};
433
434static struct platform_device vcc_sdhi2 = {
435 .name = "reg-fixed-voltage",
436 .id = 1,
437 .dev = {
438 .platform_data = &vcc_sdhi2_info,
439 },
383}; 440};
384 441
385/* SDHI */ 442/* SDHI */
@@ -387,8 +444,8 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
387 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 444 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
388 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 445 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
389 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 446 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
390 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 447 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
391 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 448 MMC_CAP_POWER_OFF_CARD,
392}; 449};
393 450
394static struct resource sdhi0_resources[] = { 451static struct resource sdhi0_resources[] = {
@@ -431,9 +488,8 @@ static struct sh_mobile_sdhi_info sdhi2_info = {
431 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | 488 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
432 TMIO_MMC_USE_GPIO_CD | 489 TMIO_MMC_USE_GPIO_CD |
433 TMIO_MMC_WRPROTECT_DISABLE, 490 TMIO_MMC_WRPROTECT_DISABLE,
434 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 491 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD,
435 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 492 .cd_gpio = 13,
436 .cd_gpio = GPIO_PORT13,
437}; 493};
438 494
439static struct resource sdhi2_resources[] = { 495static struct resource sdhi2_resources[] = {
@@ -563,25 +619,25 @@ static struct i2c_board_info i2c0_devices[] = {
563 }, 619 },
564 { 620 {
565 I2C_BOARD_INFO("ak8975", 0x0c), 621 I2C_BOARD_INFO("ak8975", 0x0c),
566 .irq = intcs_evt2irq(0x3380), /* IRQ28 */ 622 .irq = irq_pin(28), /* IRQ28 */
567 }, 623 },
568 { 624 {
569 I2C_BOARD_INFO("adxl34x", 0x1d), 625 I2C_BOARD_INFO("adxl34x", 0x1d),
570 .irq = intcs_evt2irq(0x3340), /* IRQ26 */ 626 .irq = irq_pin(26), /* IRQ26 */
571 }, 627 },
572}; 628};
573 629
574static struct i2c_board_info i2c1_devices[] = { 630static struct i2c_board_info i2c1_devices[] = {
575 { 631 {
576 I2C_BOARD_INFO("st1232-ts", 0x55), 632 I2C_BOARD_INFO("st1232-ts", 0x55),
577 .irq = intcs_evt2irq(0x300), /* IRQ8 */ 633 .irq = irq_pin(8), /* IRQ8 */
578 }, 634 },
579}; 635};
580 636
581static struct i2c_board_info i2c3_devices[] = { 637static struct i2c_board_info i2c3_devices[] = {
582 { 638 {
583 I2C_BOARD_INFO("pcf8575", 0x20), 639 I2C_BOARD_INFO("pcf8575", 0x20),
584 .irq = intcs_evt2irq(0x3260), /* IRQ19 */ 640 .irq = irq_pin(19), /* IRQ19 */
585 .platform_data = &pcf8575_pdata, 641 .platform_data = &pcf8575_pdata,
586 }, 642 },
587}; 643};
@@ -592,6 +648,8 @@ static struct platform_device *kzm_devices[] __initdata = {
592 &usbhs_device, 648 &usbhs_device,
593 &lcdc_device, 649 &lcdc_device,
594 &mmc_device, 650 &mmc_device,
651 &vcc_sdhi0,
652 &vcc_sdhi2,
595 &sdhi0_device, 653 &sdhi0_device,
596 &sdhi2_device, 654 &sdhi2_device,
597 &gpio_keys_device, 655 &gpio_keys_device,
@@ -599,6 +657,64 @@ static struct platform_device *kzm_devices[] __initdata = {
599 &fsi_ak4648_device, 657 &fsi_ak4648_device,
600}; 658};
601 659
660static unsigned long pin_pullup_conf[] = {
661 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
662};
663
664static const struct pinctrl_map kzm_pinctrl_map[] = {
665 /* FSIA (AK4648) */
666 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
667 "fsia_mclk_in", "fsia"),
668 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
669 "fsia_sclk_in", "fsia"),
670 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
671 "fsia_data_in", "fsia"),
672 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
673 "fsia_data_out", "fsia"),
674 /* I2C3 */
675 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
676 "i2c3_1", "i2c3"),
677 /* LCD */
678 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
679 "lcd_data24", "lcd"),
680 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
681 "lcd_sync", "lcd"),
682 /* MMCIF */
683 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
684 "mmc0_data8_0", "mmc0"),
685 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
686 "mmc0_ctrl_0", "mmc0"),
687 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
688 "PORT279", pin_pullup_conf),
689 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
690 "mmc0_data8_0", pin_pullup_conf),
691 /* SCIFA4 */
692 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
693 "scifa4_data", "scifa4"),
694 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
695 "scifa4_ctrl", "scifa4"),
696 /* SDHI0 */
697 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
698 "sdhi0_data4", "sdhi0"),
699 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
700 "sdhi0_ctrl", "sdhi0"),
701 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
702 "sdhi0_cd", "sdhi0"),
703 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
704 "sdhi0_wp", "sdhi0"),
705 /* SDHI2 */
706 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
707 "sdhi2_data4", "sdhi2"),
708 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
709 "sdhi2_ctrl", "sdhi2"),
710 /* SMSC */
711 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
712 "bsc_cs4", "bsc"),
713 /* USB */
714 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0",
715 "usb_vbus", "usb"),
716};
717
602/* 718/*
603 * FIXME 719 * FIXME
604 * 720 *
@@ -654,106 +770,26 @@ device_initcall(as3711_enable_lcdc_backlight);
654 770
655static void __init kzm_init(void) 771static void __init kzm_init(void)
656{ 772{
657 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers, 773 regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
658 ARRAY_SIZE(fixed1v8_power_consumers), 1800000); 774 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
659 regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers, 775 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
660 ARRAY_SIZE(fixed2v8_power_consumers), 2800000);
661 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
662 776
663 sh73a0_pinmux_init(); 777 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
664
665 /* enable SCIFA4 */
666 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
667 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
668 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
669 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
670 778
671 /* CS4 for SMSC/USB */ 779 sh73a0_pinmux_init();
672 gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
673 780
674 /* SMSC */ 781 /* SMSC */
675 gpio_request_one(GPIO_PORT224, GPIOF_IN, NULL); /* IRQ3 */ 782 gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */
676 783
677 /* LCDC */ 784 /* LCDC */
678 gpio_request(GPIO_FN_LCDD23, NULL); 785 gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
679 gpio_request(GPIO_FN_LCDD22, NULL); 786 gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
680 gpio_request(GPIO_FN_LCDD21, NULL);
681 gpio_request(GPIO_FN_LCDD20, NULL);
682 gpio_request(GPIO_FN_LCDD19, NULL);
683 gpio_request(GPIO_FN_LCDD18, NULL);
684 gpio_request(GPIO_FN_LCDD17, NULL);
685 gpio_request(GPIO_FN_LCDD16, NULL);
686 gpio_request(GPIO_FN_LCDD15, NULL);
687 gpio_request(GPIO_FN_LCDD14, NULL);
688 gpio_request(GPIO_FN_LCDD13, NULL);
689 gpio_request(GPIO_FN_LCDD12, NULL);
690 gpio_request(GPIO_FN_LCDD11, NULL);
691 gpio_request(GPIO_FN_LCDD10, NULL);
692 gpio_request(GPIO_FN_LCDD9, NULL);
693 gpio_request(GPIO_FN_LCDD8, NULL);
694 gpio_request(GPIO_FN_LCDD7, NULL);
695 gpio_request(GPIO_FN_LCDD6, NULL);
696 gpio_request(GPIO_FN_LCDD5, NULL);
697 gpio_request(GPIO_FN_LCDD4, NULL);
698 gpio_request(GPIO_FN_LCDD3, NULL);
699 gpio_request(GPIO_FN_LCDD2, NULL);
700 gpio_request(GPIO_FN_LCDD1, NULL);
701 gpio_request(GPIO_FN_LCDD0, NULL);
702 gpio_request(GPIO_FN_LCDDISP, NULL);
703 gpio_request(GPIO_FN_LCDDCK, NULL);
704
705 gpio_request_one(GPIO_PORT222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
706 gpio_request_one(GPIO_PORT226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
707 787
708 /* Touchscreen */ 788 /* Touchscreen */
709 gpio_request_one(GPIO_PORT223, GPIOF_IN, NULL); /* IRQ8 */ 789 gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */
710
711 /* enable MMCIF */
712 gpio_request(GPIO_FN_MMCCLK0, NULL);
713 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
714 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
715 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
716 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
717 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
718 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
719 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
720 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
721 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
722 790
723 /* enable SD */ 791 /* enable SD */
724 gpio_request(GPIO_FN_SDHIWP0, NULL);
725 gpio_request(GPIO_FN_SDHICD0, NULL);
726 gpio_request(GPIO_FN_SDHICMD0, NULL);
727 gpio_request(GPIO_FN_SDHICLK0, NULL);
728 gpio_request(GPIO_FN_SDHID0_3, NULL);
729 gpio_request(GPIO_FN_SDHID0_2, NULL);
730 gpio_request(GPIO_FN_SDHID0_1, NULL);
731 gpio_request(GPIO_FN_SDHID0_0, NULL);
732 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL); 792 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
733 gpio_request_one(GPIO_PORT15, GPIOF_OUT_INIT_HIGH, NULL); /* power */
734
735 /* enable Micro SD */
736 gpio_request(GPIO_FN_SDHID2_0, NULL);
737 gpio_request(GPIO_FN_SDHID2_1, NULL);
738 gpio_request(GPIO_FN_SDHID2_2, NULL);
739 gpio_request(GPIO_FN_SDHID2_3, NULL);
740 gpio_request(GPIO_FN_SDHICMD2, NULL);
741 gpio_request(GPIO_FN_SDHICLK2, NULL);
742 gpio_request_one(GPIO_PORT14, GPIOF_OUT_INIT_HIGH, NULL); /* power */
743
744 /* I2C 3 */
745 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
746 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
747
748 /* enable FSI2 port A (ak4648) */
749 gpio_request(GPIO_FN_FSIACK, NULL);
750 gpio_request(GPIO_FN_FSIAILR, NULL);
751 gpio_request(GPIO_FN_FSIAIBT, NULL);
752 gpio_request(GPIO_FN_FSIAISLD, NULL);
753 gpio_request(GPIO_FN_FSIAOSLD, NULL);
754
755 /* enable USB */
756 gpio_request(GPIO_FN_VBUS_0, NULL);
757 793
758#ifdef CONFIG_CACHE_L2X0 794#ifdef CONFIG_CACHE_L2X0
759 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 795 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index db968a585ff0..2b60f2bf1fbb 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -40,6 +40,7 @@
40#include <linux/mtd/partitions.h> 40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/mtd/sh_flctl.h> 42#include <linux/mtd/sh_flctl.h>
43#include <linux/pinctrl/machine.h>
43#include <linux/pm_clock.h> 44#include <linux/pm_clock.h>
44#include <linux/regulator/fixed.h> 45#include <linux/regulator/fixed.h>
45#include <linux/regulator/machine.h> 46#include <linux/regulator/machine.h>
@@ -363,7 +364,7 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
363 364
364static int mackerel_set_brightness(int brightness) 365static int mackerel_set_brightness(int brightness)
365{ 366{
366 gpio_set_value(GPIO_PORT31, brightness); 367 gpio_set_value(31, brightness);
367 368
368 return 0; 369 return 0;
369} 370}
@@ -596,12 +597,14 @@ static int usbhs_get_vbus(struct platform_device *pdev)
596 return usbhs_is_connected(usbhs_get_priv(pdev)); 597 return usbhs_is_connected(usbhs_get_priv(pdev));
597} 598}
598 599
599static void usbhs_phy_reset(struct platform_device *pdev) 600static int usbhs_phy_reset(struct platform_device *pdev)
600{ 601{
601 struct usbhs_private *priv = usbhs_get_priv(pdev); 602 struct usbhs_private *priv = usbhs_get_priv(pdev);
602 603
603 /* init phy */ 604 /* init phy */
604 __raw_writew(0x8a0a, priv->usbcrcaddr); 605 __raw_writew(0x8a0a, priv->usbcrcaddr);
606
607 return 0;
605} 608}
606 609
607static int usbhs0_get_id(struct platform_device *pdev) 610static int usbhs0_get_id(struct platform_device *pdev)
@@ -628,11 +631,13 @@ static int usbhs0_hardware_init(struct platform_device *pdev)
628 return 0; 631 return 0;
629} 632}
630 633
631static void usbhs0_hardware_exit(struct platform_device *pdev) 634static int usbhs0_hardware_exit(struct platform_device *pdev)
632{ 635{
633 struct usbhs_private *priv = usbhs_get_priv(pdev); 636 struct usbhs_private *priv = usbhs_get_priv(pdev);
634 637
635 cancel_delayed_work_sync(&priv->work); 638 cancel_delayed_work_sync(&priv->work);
639
640 return 0;
636} 641}
637 642
638static struct usbhs_private usbhs0_private = { 643static struct usbhs_private usbhs0_private = {
@@ -735,7 +740,7 @@ static int usbhs1_hardware_init(struct platform_device *pdev)
735 return 0; 740 return 0;
736} 741}
737 742
738static void usbhs1_hardware_exit(struct platform_device *pdev) 743static int usbhs1_hardware_exit(struct platform_device *pdev)
739{ 744{
740 struct usbhs_private *priv = usbhs_get_priv(pdev); 745 struct usbhs_private *priv = usbhs_get_priv(pdev);
741 746
@@ -743,6 +748,8 @@ static void usbhs1_hardware_exit(struct platform_device *pdev)
743 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr); 748 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr);
744 749
745 free_irq(IRQ8, pdev); 750 free_irq(IRQ8, pdev);
751
752 return 0;
746} 753}
747 754
748static int usbhs1_get_id(struct platform_device *pdev) 755static int usbhs1_get_id(struct platform_device *pdev)
@@ -819,22 +826,22 @@ static struct platform_device usbhs1_device = {
819static struct gpio_led mackerel_leds[] = { 826static struct gpio_led mackerel_leds[] = {
820 { 827 {
821 .name = "led0", 828 .name = "led0",
822 .gpio = GPIO_PORT0, 829 .gpio = 0,
823 .default_state = LEDS_GPIO_DEFSTATE_ON, 830 .default_state = LEDS_GPIO_DEFSTATE_ON,
824 }, 831 },
825 { 832 {
826 .name = "led1", 833 .name = "led1",
827 .gpio = GPIO_PORT1, 834 .gpio = 1,
828 .default_state = LEDS_GPIO_DEFSTATE_ON, 835 .default_state = LEDS_GPIO_DEFSTATE_ON,
829 }, 836 },
830 { 837 {
831 .name = "led2", 838 .name = "led2",
832 .gpio = GPIO_PORT2, 839 .gpio = 2,
833 .default_state = LEDS_GPIO_DEFSTATE_ON, 840 .default_state = LEDS_GPIO_DEFSTATE_ON,
834 }, 841 },
835 { 842 {
836 .name = "led3", 843 .name = "led3",
837 .gpio = GPIO_PORT159, 844 .gpio = 159,
838 .default_state = LEDS_GPIO_DEFSTATE_ON, 845 .default_state = LEDS_GPIO_DEFSTATE_ON,
839 } 846 }
840}; 847};
@@ -964,11 +971,11 @@ static struct platform_device nand_flash_device = {
964 971
965/* 972/*
966 * The card detect pin of the top SD/MMC slot (CN7) is active low and is 973 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
967 * connected to GPIO A22 of SH7372 (GPIO_PORT41). 974 * connected to GPIO A22 of SH7372 (GPIO 41).
968 */ 975 */
969static int slot_cn7_get_cd(struct platform_device *pdev) 976static int slot_cn7_get_cd(struct platform_device *pdev)
970{ 977{
971 return !gpio_get_value(GPIO_PORT41); 978 return !gpio_get_value(41);
972} 979}
973 980
974/* SDHI0 */ 981/* SDHI0 */
@@ -977,7 +984,7 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
977 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 984 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
978 .tmio_flags = TMIO_MMC_USE_GPIO_CD, 985 .tmio_flags = TMIO_MMC_USE_GPIO_CD,
979 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 986 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
980 .cd_gpio = GPIO_PORT172, 987 .cd_gpio = 172,
981}; 988};
982 989
983static struct resource sdhi0_resources[] = { 990static struct resource sdhi0_resources[] = {
@@ -1060,11 +1067,11 @@ static struct platform_device sdhi1_device = {
1060 1067
1061/* 1068/*
1062 * The card detect pin of the top SD/MMC slot (CN23) is active low and is 1069 * The card detect pin of the top SD/MMC slot (CN23) is active low and is
1063 * connected to GPIO SCIFB_SCK of SH7372 (GPIO_PORT162). 1070 * connected to GPIO SCIFB_SCK of SH7372 (162).
1064 */ 1071 */
1065static int slot_cn23_get_cd(struct platform_device *pdev) 1072static int slot_cn23_get_cd(struct platform_device *pdev)
1066{ 1073{
1067 return !gpio_get_value(GPIO_PORT162); 1074 return !gpio_get_value(162);
1068} 1075}
1069 1076
1070/* SDHI2 */ 1077/* SDHI2 */
@@ -1142,7 +1149,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
1142 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, 1149 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
1143}; 1150};
1144 1151
1145static struct platform_device sh_mmcif_device = { 1152static struct platform_device sh_mmcif_device __maybe_unused = {
1146 .name = "sh_mmcif", 1153 .name = "sh_mmcif",
1147 .id = 0, 1154 .id = 0,
1148 .dev = { 1155 .dev = {
@@ -1328,6 +1335,33 @@ static struct i2c_board_info i2c1_devices[] = {
1328 }, 1335 },
1329}; 1336};
1330 1337
1338static const struct pinctrl_map mackerel_pinctrl_map[] = {
1339 /* MMCIF */
1340 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1341 "mmc0_data8_0", "mmc0"),
1342 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1343 "mmc0_ctrl_0", "mmc0"),
1344 /* SDHI0 */
1345 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1346 "sdhi0_data4", "sdhi0"),
1347 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1348 "sdhi0_ctrl", "sdhi0"),
1349 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1350 "sdhi0_wp", "sdhi0"),
1351 /* SDHI1 */
1352#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1353 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1354 "sdhi1_data4", "sdhi1"),
1355 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1356 "sdhi1_ctrl", "sdhi1"),
1357#endif
1358 /* SDHI2 */
1359 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh7372",
1360 "sdhi2_data4", "sdhi2"),
1361 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh7372",
1362 "sdhi2_ctrl", "sdhi2"),
1363};
1364
1331#define GPIO_PORT9CR IOMEM(0xE6051009) 1365#define GPIO_PORT9CR IOMEM(0xE6051009)
1332#define GPIO_PORT10CR IOMEM(0xE605100A) 1366#define GPIO_PORT10CR IOMEM(0xE605100A)
1333#define GPIO_PORT167CR IOMEM(0xE60520A7) 1367#define GPIO_PORT167CR IOMEM(0xE60520A7)
@@ -1364,6 +1398,8 @@ static void __init mackerel_init(void)
1364 /* External clock source */ 1398 /* External clock source */
1365 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1399 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1366 1400
1401 pinctrl_register_mappings(mackerel_pinctrl_map,
1402 ARRAY_SIZE(mackerel_pinctrl_map));
1367 sh7372_pinmux_init(); 1403 sh7372_pinmux_init();
1368 1404
1369 /* enable SCIFA0 */ 1405 /* enable SCIFA0 */
@@ -1403,9 +1439,9 @@ static void __init mackerel_init(void)
1403 gpio_request(GPIO_FN_LCDDCK, NULL); 1439 gpio_request(GPIO_FN_LCDDCK, NULL);
1404 1440
1405 /* backlight, off by default */ 1441 /* backlight, off by default */
1406 gpio_request_one(GPIO_PORT31, GPIOF_OUT_INIT_LOW, NULL); 1442 gpio_request_one(31, GPIOF_OUT_INIT_LOW, NULL);
1407 1443
1408 gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1444 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1409 1445
1410 /* USBHS0 */ 1446 /* USBHS0 */
1411 gpio_request(GPIO_FN_VBUS0_0, NULL); 1447 gpio_request(GPIO_FN_VBUS0_0, NULL);
@@ -1421,10 +1457,10 @@ static void __init mackerel_init(void)
1421 gpio_request(GPIO_FN_FSIAILR, NULL); 1457 gpio_request(GPIO_FN_FSIAILR, NULL);
1422 gpio_request(GPIO_FN_FSIAISLD, NULL); 1458 gpio_request(GPIO_FN_FSIAISLD, NULL);
1423 gpio_request(GPIO_FN_FSIAOSLD, NULL); 1459 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1424 gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ 1460 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1425 1461
1426 gpio_request(GPIO_PORT9, NULL); 1462 gpio_request(9, NULL);
1427 gpio_request(GPIO_PORT10, NULL); 1463 gpio_request(10, NULL);
1428 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1464 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1429 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1465 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1430 1466
@@ -1453,52 +1489,14 @@ static void __init mackerel_init(void)
1453 gpio_request(GPIO_FN_IRQ21, NULL); 1489 gpio_request(GPIO_FN_IRQ21, NULL);
1454 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); 1490 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
1455 1491
1456 /* enable SDHI0 */
1457 gpio_request(GPIO_FN_SDHIWP0, NULL);
1458 gpio_request(GPIO_FN_SDHICMD0, NULL);
1459 gpio_request(GPIO_FN_SDHICLK0, NULL);
1460 gpio_request(GPIO_FN_SDHID0_3, NULL);
1461 gpio_request(GPIO_FN_SDHID0_2, NULL);
1462 gpio_request(GPIO_FN_SDHID0_1, NULL);
1463 gpio_request(GPIO_FN_SDHID0_0, NULL);
1464
1465 /* SDHI0 PORT172 card-detect IRQ26 */ 1492 /* SDHI0 PORT172 card-detect IRQ26 */
1466 gpio_request(GPIO_FN_IRQ26_172, NULL); 1493 gpio_request(GPIO_FN_IRQ26_172, NULL);
1467 1494
1468#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1469 /* enable SDHI1 */
1470 gpio_request(GPIO_FN_SDHICMD1, NULL);
1471 gpio_request(GPIO_FN_SDHICLK1, NULL);
1472 gpio_request(GPIO_FN_SDHID1_3, NULL);
1473 gpio_request(GPIO_FN_SDHID1_2, NULL);
1474 gpio_request(GPIO_FN_SDHID1_1, NULL);
1475 gpio_request(GPIO_FN_SDHID1_0, NULL);
1476#endif
1477 /* card detect pin for MMC slot (CN7) */ 1495 /* card detect pin for MMC slot (CN7) */
1478 gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL); 1496 gpio_request_one(41, GPIOF_IN, NULL);
1479
1480 /* enable SDHI2 */
1481 gpio_request(GPIO_FN_SDHICMD2, NULL);
1482 gpio_request(GPIO_FN_SDHICLK2, NULL);
1483 gpio_request(GPIO_FN_SDHID2_3, NULL);
1484 gpio_request(GPIO_FN_SDHID2_2, NULL);
1485 gpio_request(GPIO_FN_SDHID2_1, NULL);
1486 gpio_request(GPIO_FN_SDHID2_0, NULL);
1487 1497
1488 /* card detect pin for microSD slot (CN23) */ 1498 /* card detect pin for microSD slot (CN23) */
1489 gpio_request_one(GPIO_PORT162, GPIOF_IN, NULL); 1499 gpio_request_one(162, GPIOF_IN, NULL);
1490
1491 /* MMCIF */
1492 gpio_request(GPIO_FN_MMCD0_0, NULL);
1493 gpio_request(GPIO_FN_MMCD0_1, NULL);
1494 gpio_request(GPIO_FN_MMCD0_2, NULL);
1495 gpio_request(GPIO_FN_MMCD0_3, NULL);
1496 gpio_request(GPIO_FN_MMCD0_4, NULL);
1497 gpio_request(GPIO_FN_MMCD0_5, NULL);
1498 gpio_request(GPIO_FN_MMCD0_6, NULL);
1499 gpio_request(GPIO_FN_MMCD0_7, NULL);
1500 gpio_request(GPIO_FN_MMCCMD0, NULL);
1501 gpio_request(GPIO_FN_MMCCLK0, NULL);
1502 1500
1503 /* FLCTL */ 1501 /* FLCTL */
1504 gpio_request(GPIO_FN_D0_NAF0, NULL); 1502 gpio_request(GPIO_FN_D0_NAF0, NULL);
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
new file mode 100644
index 000000000000..480d882e42c7
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -0,0 +1,75 @@
1/*
2 * marzen board support - Reference DT implementation
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Simon Horman
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; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include <linux/pinctrl/machine.h>
23#include <mach/r8a7779.h>
24#include <mach/common.h>
25#include <mach/irqs.h>
26#include <asm/irq.h>
27#include <asm/mach/arch.h>
28
29static const struct pinctrl_map marzen_pinctrl_map[] = {
30 /* SCIF2 (CN18: DEBUG0) */
31 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
32 "scif2_data_c", "scif2"),
33 /* SCIF4 (CN19: DEBUG1) */
34 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
35 "scif4_data", "scif4"),
36 /* SDHI0 */
37 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
38 "sdhi0_data4", "sdhi0"),
39 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
40 "sdhi0_ctrl", "sdhi0"),
41 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
42 "sdhi0_cd", "sdhi0"),
43 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
44 "sdhi0_wp", "sdhi0"),
45 /* SMSC */
46 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
47 "intc_irq1_b", "intc"),
48 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
49 "lbsc_ex_cs0", "lbsc"),
50};
51
52static void __init marzen_init(void)
53{
54 pinctrl_register_mappings(marzen_pinctrl_map,
55 ARRAY_SIZE(marzen_pinctrl_map));
56 r8a7779_pinmux_init();
57
58 r8a7779_add_standard_devices_dt();
59}
60
61static const char *marzen_boards_compat_dt[] __initdata = {
62 "renesas,marzen-reference",
63 NULL,
64};
65
66DT_MACHINE_START(MARZEN, "marzen")
67 .smp = smp_ops(r8a7779_smp_ops),
68 .map_io = r8a7779_map_io,
69 .init_early = r8a7779_init_delay,
70 .nr_irqs = NR_IRQS_LEGACY,
71 .init_irq = r8a7779_init_irq_dt,
72 .init_machine = marzen_init,
73 .init_time = shmobile_timer_init,
74 .dt_compat = marzen_boards_compat_dt,
75MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index fec49ebc359a..2333a2d7c937 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -25,8 +25,8 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/gpio.h>
29#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/pinctrl/machine.h>
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
@@ -67,7 +67,7 @@ static struct resource smsc911x_resources[] = {
67 .flags = IORESOURCE_MEM, 67 .flags = IORESOURCE_MEM,
68 }, 68 },
69 [1] = { 69 [1] = {
70 .start = gic_spi(28), /* IRQ 1 */ 70 .start = gic_iid(0x3c), /* IRQ 1 */
71 .flags = IORESOURCE_IRQ, 71 .flags = IORESOURCE_IRQ,
72 }, 72 },
73}; 73};
@@ -97,7 +97,7 @@ static struct resource sdhi0_resources[] = {
97 .flags = IORESOURCE_MEM, 97 .flags = IORESOURCE_MEM,
98 }, 98 },
99 [1] = { 99 [1] = {
100 .start = gic_spi(104), 100 .start = gic_iid(0x88),
101 .flags = IORESOURCE_IRQ, 101 .flags = IORESOURCE_IRQ,
102 }, 102 },
103}; 103};
@@ -215,7 +215,7 @@ static struct resource ehci0_resources[] = {
215 .flags = IORESOURCE_MEM, 215 .flags = IORESOURCE_MEM,
216 }, 216 },
217 [1] = { 217 [1] = {
218 .start = gic_spi(44), 218 .start = gic_iid(0x4c),
219 .flags = IORESOURCE_IRQ, 219 .flags = IORESOURCE_IRQ,
220 }, 220 },
221}; 221};
@@ -239,7 +239,7 @@ static struct resource ehci1_resources[] = {
239 .flags = IORESOURCE_MEM, 239 .flags = IORESOURCE_MEM,
240 }, 240 },
241 [1] = { 241 [1] = {
242 .start = gic_spi(45), 242 .start = gic_iid(0x4d),
243 .flags = IORESOURCE_IRQ, 243 .flags = IORESOURCE_IRQ,
244 }, 244 },
245}; 245};
@@ -269,7 +269,7 @@ static struct resource ohci0_resources[] = {
269 .flags = IORESOURCE_MEM, 269 .flags = IORESOURCE_MEM,
270 }, 270 },
271 [1] = { 271 [1] = {
272 .start = gic_spi(44), 272 .start = gic_iid(0x4c),
273 .flags = IORESOURCE_IRQ, 273 .flags = IORESOURCE_IRQ,
274 }, 274 },
275}; 275};
@@ -293,7 +293,7 @@ static struct resource ohci1_resources[] = {
293 .flags = IORESOURCE_MEM, 293 .flags = IORESOURCE_MEM,
294 }, 294 },
295 [1] = { 295 [1] = {
296 .start = gic_spi(45), 296 .start = gic_iid(0x4d),
297 .flags = IORESOURCE_IRQ, 297 .flags = IORESOURCE_IRQ,
298 }, 298 },
299}; 299};
@@ -327,6 +327,41 @@ void __init marzen_init_late(void)
327 ARRAY_SIZE(marzen_late_devices)); 327 ARRAY_SIZE(marzen_late_devices));
328} 328}
329 329
330static const struct pinctrl_map marzen_pinctrl_map[] = {
331 /* HSPI0 */
332 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
333 "hspi0", "hspi0"),
334 /* SCIF2 (CN18: DEBUG0) */
335 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
336 "scif2_data_c", "scif2"),
337 /* SCIF4 (CN19: DEBUG1) */
338 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
339 "scif4_data", "scif4"),
340 /* SDHI0 */
341 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
342 "sdhi0_data4", "sdhi0"),
343 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
344 "sdhi0_ctrl", "sdhi0"),
345 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
346 "sdhi0_cd", "sdhi0"),
347 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
348 "sdhi0_wp", "sdhi0"),
349 /* SMSC */
350 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
351 "intc_irq1_b", "intc"),
352 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
353 "lbsc_ex_cs0", "lbsc"),
354 /* USB0 */
355 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
356 "usb0", "usb0"),
357 /* USB1 */
358 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
359 "usb1", "usb1"),
360 /* USB2 */
361 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.1", "pfc-r8a7779",
362 "usb2", "usb2"),
363};
364
330static void __init marzen_init(void) 365static void __init marzen_init(void)
331{ 366{
332 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 367 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
@@ -334,44 +369,10 @@ static void __init marzen_init(void)
334 regulator_register_fixed(1, dummy_supplies, 369 regulator_register_fixed(1, dummy_supplies,
335 ARRAY_SIZE(dummy_supplies)); 370 ARRAY_SIZE(dummy_supplies));
336 371
372 pinctrl_register_mappings(marzen_pinctrl_map,
373 ARRAY_SIZE(marzen_pinctrl_map));
337 r8a7779_pinmux_init(); 374 r8a7779_pinmux_init();
338 375
339 /* SCIF2 (CN18: DEBUG0) */
340 gpio_request(GPIO_FN_TX2_C, NULL);
341 gpio_request(GPIO_FN_RX2_C, NULL);
342
343 /* SCIF4 (CN19: DEBUG1) */
344 gpio_request(GPIO_FN_TX4, NULL);
345 gpio_request(GPIO_FN_RX4, NULL);
346
347 /* LAN89218 */
348 gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
349 gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
350
351 /* SD0 (CN20) */
352 gpio_request(GPIO_FN_SD0_CLK, NULL);
353 gpio_request(GPIO_FN_SD0_CMD, NULL);
354 gpio_request(GPIO_FN_SD0_DAT0, NULL);
355 gpio_request(GPIO_FN_SD0_DAT1, NULL);
356 gpio_request(GPIO_FN_SD0_DAT2, NULL);
357 gpio_request(GPIO_FN_SD0_DAT3, NULL);
358 gpio_request(GPIO_FN_SD0_CD, NULL);
359 gpio_request(GPIO_FN_SD0_WP, NULL);
360
361 /* HSPI 0 */
362 gpio_request(GPIO_FN_HSPI_CLK0, NULL);
363 gpio_request(GPIO_FN_HSPI_CS0, NULL);
364 gpio_request(GPIO_FN_HSPI_TX0, NULL);
365 gpio_request(GPIO_FN_HSPI_RX0, NULL);
366
367 /* USB (CN21) */
368 gpio_request(GPIO_FN_USB_OVC0, NULL);
369 gpio_request(GPIO_FN_USB_OVC1, NULL);
370 gpio_request(GPIO_FN_USB_OVC2, NULL);
371
372 /* USB (CN22) */
373 gpio_request(GPIO_FN_USB_PENC2, NULL);
374
375 r8a7779_add_standard_devices(); 376 r8a7779_add_standard_devices();
376 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 377 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
377} 378}
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 19ce885a3b43..1feb9a2286a8 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -593,29 +593,42 @@ static struct clk_lookup lookups[] = {
593 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]), 593 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
594 594
595 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), 595 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
596 CLKDEV_DEV_ID("e6c80000.sci", &mstp_clks[MSTP200]),
596 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), 597 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
598 CLKDEV_DEV_ID("e6c70000.sci", &mstp_clks[MSTP201]),
597 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), 599 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
600 CLKDEV_DEV_ID("e6c60000.sci", &mstp_clks[MSTP202]),
598 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 601 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
602 CLKDEV_DEV_ID("e6c50000.sci", &mstp_clks[MSTP203]),
599 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 603 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
604 CLKDEV_DEV_ID("e6c40000.sci", &mstp_clks[MSTP204]),
600 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), 605 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
606 CLKDEV_DEV_ID("e6c30000.sci", &mstp_clks[MSTP206]),
601 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), 607 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]),
608 CLKDEV_DEV_ID("e6cb0000.sci", &mstp_clks[MSTP207]),
602 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), 609 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]),
603 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), 610 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]),
604 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), 611 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]),
605 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), 612 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
606 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), 613 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
614 CLKDEV_DEV_ID("e6cd0000.sci", &mstp_clks[MSTP222]),
607 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 615 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
616 CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]),
608 617
609 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), 618 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
610 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), 619 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
611 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), 620 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
612 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]), 621 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
613 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 622 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
623 CLKDEV_DEV_ID("e6850000.sdhi", &mstp_clks[MSTP314]),
614 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 624 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
625 CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]),
615 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 626 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
627 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]),
616 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]), 628 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]),
617 629
618 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), 630 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
631 CLKDEV_DEV_ID("e6870000.sdhi", &mstp_clks[MSTP415]),
619 632
620 /* ICK */ 633 /* ICK */
621 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), 634 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 1db36537255c..d9edeaf66007 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -87,7 +87,8 @@ static struct clk div4_clks[DIV4_NR] = {
87}; 87};
88 88
89enum { MSTP323, MSTP322, MSTP321, MSTP320, 89enum { MSTP323, MSTP322, MSTP321, MSTP320,
90 MSTP101, MSTP100, 90 MSTP115,
91 MSTP103, MSTP101, MSTP100,
91 MSTP030, 92 MSTP030,
92 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 93 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
93 MSTP016, MSTP015, MSTP014, 94 MSTP016, MSTP015, MSTP014,
@@ -99,6 +100,8 @@ static struct clk mstp_clks[MSTP_NR] = {
99 [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ 100 [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */
100 [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ 101 [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */
101 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ 102 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */
103 [MSTP115] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 15, 0), /* SATA */
104 [MSTP103] = SH_CLK_MSTP32(&div4_clks[DIV4_S], MSTPCR1, 3, 0), /* DU */
102 [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */ 105 [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */
103 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */ 106 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */
104 [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ 107 [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */
@@ -156,6 +159,8 @@ static struct clk_lookup lookups[] = {
156 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), 159 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]),
157 160
158 /* MSTP32 clocks */ 161 /* MSTP32 clocks */
162 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
163 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
159 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ 164 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
160 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ 165 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
161 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 166 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
@@ -180,6 +185,7 @@ static struct clk_lookup lookups[] = {
180 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 185 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
181 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 186 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
182 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ 187 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
188 CLKDEV_DEV_ID("rcar-du.0", &mstp_clks[MSTP103]), /* DU */
183}; 189};
184 190
185void __init r8a7779_clock_init(void) 191void __init r8a7779_clock_init(void)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index afa5423a0f93..71843dd39e16 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -265,12 +265,12 @@ enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
265 265
266static struct clk div4_clks[DIV4_NR] = { 266static struct clk div4_clks[DIV4_NR] = {
267 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT), 267 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT),
268 [DIV4_ZG] = DIV4(FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT), 268 [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT),
269 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT), 269 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
270 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT), 270 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT),
271 [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0), 271 [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0),
272 [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0), 272 [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0),
273 [DIV4_Z] = DIV4(FRQCRB, 24, 0x97f, 0), 273 [DIV4_Z] = SH_CLK_DIV4(&pll0_clk, FRQCRB, 24, 0x97f, 0),
274 [DIV4_ZTR] = DIV4(FRQCRB, 20, 0xdff, 0), 274 [DIV4_ZTR] = DIV4(FRQCRB, 20, 0xdff, 0),
275 [DIV4_ZT] = DIV4(FRQCRB, 16, 0xdff, 0), 275 [DIV4_ZT] = DIV4(FRQCRB, 16, 0xdff, 0),
276 [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0), 276 [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0),
@@ -581,10 +581,13 @@ static struct clk_lookup lookups[] = {
581 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ 581 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
582 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ 582 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
583 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 583 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
584 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), /* SDHI0 */
584 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 585 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
586 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), /* SDHI1 */
585 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ 587 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
586 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */ 588 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */
587 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ 589 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
590 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */
588 CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */ 591 CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */
589 CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */ 592 CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */
590 CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ 593 CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
index 9e050268cde4..0afeb5c7061c 100644
--- a/arch/arm/mach-shmobile/cpuidle.c
+++ b/arch/arm/mach-shmobile/cpuidle.c
@@ -16,39 +16,22 @@
16#include <asm/cpuidle.h> 16#include <asm/cpuidle.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19int shmobile_enter_wfi(struct cpuidle_device *dev, struct cpuidle_driver *drv,
20 int index)
21{
22 cpu_do_idle();
23 return 0;
24}
25
26static struct cpuidle_device shmobile_cpuidle_dev;
27static struct cpuidle_driver shmobile_cpuidle_default_driver = { 19static struct cpuidle_driver shmobile_cpuidle_default_driver = {
28 .name = "shmobile_cpuidle", 20 .name = "shmobile_cpuidle",
29 .owner = THIS_MODULE, 21 .owner = THIS_MODULE,
30 .en_core_tk_irqen = 1,
31 .states[0] = ARM_CPUIDLE_WFI_STATE, 22 .states[0] = ARM_CPUIDLE_WFI_STATE,
32 .states[0].enter = shmobile_enter_wfi,
33 .safe_state_index = 0, /* C1 */ 23 .safe_state_index = 0, /* C1 */
34 .state_count = 1, 24 .state_count = 1,
35}; 25};
36 26
37static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver; 27static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
38 28
39void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv) 29void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
40{ 30{
41 cpuidle_drv = drv; 31 cpuidle_drv = drv;
42} 32}
43 33
44int shmobile_cpuidle_init(void) 34int __init shmobile_cpuidle_init(void)
45{ 35{
46 struct cpuidle_device *dev = &shmobile_cpuidle_dev; 36 return cpuidle_register(cpuidle_drv, NULL);
47
48 cpuidle_register_driver(cpuidle_drv);
49
50 dev->state_count = cpuidle_drv->state_count;
51 cpuidle_register_device(dev);
52
53 return 0;
54} 37}
diff --git a/arch/arm/mach-shmobile/headsmp-sh73a0.S b/arch/arm/mach-shmobile/headsmp-scu.S
index bec4c0d9b713..7d113f898e7f 100644
--- a/arch/arm/mach-shmobile/headsmp-sh73a0.S
+++ b/arch/arm/mach-shmobile/headsmp-scu.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * SMP support for SoC sh73a0 2 * Shared SCU setup for mach-shmobile
3 * 3 *
4 * Copyright (C) 2012 Bastian Hecht 4 * Copyright (C) 2012 Bastian Hecht
5 * 5 *
@@ -35,11 +35,12 @@
35 * the physical address as the MMU is still turned off. 35 * the physical address as the MMU is still turned off.
36 */ 36 */
37 .align 12 37 .align 12
38ENTRY(sh73a0_secondary_vector) 38ENTRY(shmobile_secondary_vector_scu)
39 mrc p15, 0, r0, c0, c0, 5 @ read MIPDR 39 mrc p15, 0, r0, c0, c0, 5 @ read MIPDR
40 and r0, r0, #3 @ mask out cpu ID 40 and r0, r0, #3 @ mask out cpu ID
41 lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits 41 lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits
42 mov r1, #0xf0000000 @ SCU base address 42 ldr r1, 2f
43 ldr r1, [r1] @ SCU base address
43 ldr r2, [r1, #8] @ SCU Power Status Register 44 ldr r2, [r1, #8] @ SCU Power Status Register
44 mov r3, #3 45 mov r3, #3
45 bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode) 46 bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode)
@@ -47,4 +48,10 @@ ENTRY(sh73a0_secondary_vector)
47 48
48 ldr pc, 1f 49 ldr pc, 1f
491: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET 501: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET
50ENDPROC(sh73a0_secondary_vector) 512: .long shmobile_scu_base - PAGE_OFFSET + PLAT_PHYS_OFFSET
52ENDPROC(shmobile_secondary_vector_scu)
53
54 .text
55 .globl shmobile_scu_base
56shmobile_scu_base:
57 .space 4
diff --git a/arch/arm/mach-shmobile/hotplug.c b/arch/arm/mach-shmobile/hotplug.c
deleted file mode 100644
index a1524e3367b0..000000000000
--- a/arch/arm/mach-shmobile/hotplug.c
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * SMP support for R-Mobile / SH-Mobile
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * Based on realview, Copyright (C) 2002 ARM Ltd, All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/smp.h>
15#include <linux/cpumask.h>
16#include <linux/delay.h>
17#include <linux/of.h>
18#include <mach/common.h>
19#include <mach/r8a7779.h>
20#include <mach/emev2.h>
21#include <asm/cacheflush.h>
22#include <asm/mach-types.h>
23
24static cpumask_t dead_cpus;
25
26void shmobile_cpu_die(unsigned int cpu)
27{
28 /* hardware shutdown code running on the CPU that is being offlined */
29 flush_cache_all();
30 dsb();
31
32 /* notify platform_cpu_kill() that hardware shutdown is finished */
33 cpumask_set_cpu(cpu, &dead_cpus);
34
35 /* wait for SoC code in platform_cpu_kill() to shut off CPU core
36 * power. CPU bring up starts from the reset vector.
37 */
38 while (1) {
39 /*
40 * here's the WFI
41 */
42 asm(".word 0xe320f003\n"
43 :
44 :
45 : "memory", "cc");
46 }
47}
48
49int shmobile_cpu_disable(unsigned int cpu)
50{
51 cpumask_clear_cpu(cpu, &dead_cpus);
52 /*
53 * we don't allow CPU 0 to be shutdown (it is still too special
54 * e.g. clock tick interrupts)
55 */
56 return cpu == 0 ? -EPERM : 0;
57}
58
59int shmobile_cpu_disable_any(unsigned int cpu)
60{
61 cpumask_clear_cpu(cpu, &dead_cpus);
62 return 0;
63}
64
65int shmobile_cpu_is_dead(unsigned int cpu)
66{
67 return cpumask_test_cpu(cpu, &dead_cpus);
68}
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index e48606d8a2be..1fef737a4c1a 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -8,14 +8,12 @@ extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
8struct twd_local_timer; 8struct twd_local_timer;
9extern void shmobile_setup_console(void); 9extern void shmobile_setup_console(void);
10extern void shmobile_secondary_vector(void); 10extern void shmobile_secondary_vector(void);
11extern void shmobile_secondary_vector_scu(void);
11struct clk; 12struct clk;
12extern int shmobile_clk_init(void); 13extern int shmobile_clk_init(void);
13extern void shmobile_handle_irq_intc(struct pt_regs *); 14extern void shmobile_handle_irq_intc(struct pt_regs *);
14extern struct platform_suspend_ops shmobile_suspend_ops; 15extern struct platform_suspend_ops shmobile_suspend_ops;
15struct cpuidle_driver; 16struct cpuidle_driver;
16struct cpuidle_device;
17extern int shmobile_enter_wfi(struct cpuidle_device *dev,
18 struct cpuidle_driver *drv, int index);
19extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv); 17extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);
20 18
21extern void sh7372_init_irq(void); 19extern void sh7372_init_irq(void);
@@ -33,23 +31,23 @@ extern int sh7372_do_idle_sysc(unsigned long sleep_mode);
33extern struct clk sh7372_extal1_clk; 31extern struct clk sh7372_extal1_clk;
34extern struct clk sh7372_extal2_clk; 32extern struct clk sh7372_extal2_clk;
35 33
34extern void sh73a0_init_delay(void);
36extern void sh73a0_init_irq(void); 35extern void sh73a0_init_irq(void);
37extern void sh73a0_init_irq_dt(void); 36extern void sh73a0_init_irq_dt(void);
38extern void sh73a0_map_io(void); 37extern void sh73a0_map_io(void);
39extern void sh73a0_earlytimer_init(void); 38extern void sh73a0_earlytimer_init(void);
40extern void sh73a0_add_early_devices(void); 39extern void sh73a0_add_early_devices(void);
41extern void sh73a0_add_early_devices_dt(void);
42extern void sh73a0_add_standard_devices(void); 40extern void sh73a0_add_standard_devices(void);
43extern void sh73a0_add_standard_devices_dt(void); 41extern void sh73a0_add_standard_devices_dt(void);
44extern void sh73a0_clock_init(void); 42extern void sh73a0_clock_init(void);
45extern void sh73a0_pinmux_init(void); 43extern void sh73a0_pinmux_init(void);
46extern void sh73a0_pm_init(void); 44extern void sh73a0_pm_init(void);
47extern void sh73a0_secondary_vector(void);
48extern struct clk sh73a0_extal1_clk; 45extern struct clk sh73a0_extal1_clk;
49extern struct clk sh73a0_extal2_clk; 46extern struct clk sh73a0_extal2_clk;
50extern struct clk sh73a0_extcki_clk; 47extern struct clk sh73a0_extcki_clk;
51extern struct clk sh73a0_extalr_clk; 48extern struct clk sh73a0_extalr_clk;
52 49
50extern void r8a7740_meram_workaround(void);
53extern void r8a7740_init_irq(void); 51extern void r8a7740_init_irq(void);
54extern void r8a7740_map_io(void); 52extern void r8a7740_map_io(void);
55extern void r8a7740_add_early_devices(void); 53extern void r8a7740_add_early_devices(void);
@@ -58,16 +56,18 @@ extern void r8a7740_clock_init(u8 md_ck);
58extern void r8a7740_pinmux_init(void); 56extern void r8a7740_pinmux_init(void);
59extern void r8a7740_pm_init(void); 57extern void r8a7740_pm_init(void);
60 58
59extern void r8a7779_init_delay(void);
61extern void r8a7779_init_irq(void); 60extern void r8a7779_init_irq(void);
61extern void r8a7779_init_irq_extpin(int irlm);
62extern void r8a7779_init_irq_dt(void);
62extern void r8a7779_map_io(void); 63extern void r8a7779_map_io(void);
63extern void r8a7779_earlytimer_init(void); 64extern void r8a7779_earlytimer_init(void);
64extern void r8a7779_add_early_devices(void); 65extern void r8a7779_add_early_devices(void);
65extern void r8a7779_add_standard_devices(void); 66extern void r8a7779_add_standard_devices(void);
67extern void r8a7779_add_standard_devices_dt(void);
66extern void r8a7779_clock_init(void); 68extern void r8a7779_clock_init(void);
67extern void r8a7779_pinmux_init(void); 69extern void r8a7779_pinmux_init(void);
68extern void r8a7779_pm_init(void); 70extern void r8a7779_pm_init(void);
69extern void r8a7740_meram_workaround(void);
70
71extern void r8a7779_register_twd(void); 71extern void r8a7779_register_twd(void);
72 72
73#ifdef CONFIG_SUSPEND 73#ifdef CONFIG_SUSPEND
@@ -82,16 +82,7 @@ int shmobile_cpuidle_init(void);
82static inline int shmobile_cpuidle_init(void) { return 0; } 82static inline int shmobile_cpuidle_init(void) { return 0; }
83#endif 83#endif
84 84
85extern void shmobile_cpu_die(unsigned int cpu); 85extern void __iomem *shmobile_scu_base;
86extern int shmobile_cpu_disable(unsigned int cpu);
87extern int shmobile_cpu_disable_any(unsigned int cpu);
88
89#ifdef CONFIG_HOTPLUG_CPU
90extern int shmobile_cpu_is_dead(unsigned int cpu);
91#else
92static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; }
93#endif
94
95extern void shmobile_smp_init_cpus(unsigned int ncores); 86extern void shmobile_smp_init_cpus(unsigned int ncores);
96 87
97static inline void __init shmobile_init_late(void) 88static inline void __init shmobile_init_late(void)
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index 06a5da3c3050..b2074e2acb15 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -5,10 +5,15 @@
5 5
6/* GIC */ 6/* GIC */
7#define gic_spi(nr) ((nr) + 32) 7#define gic_spi(nr) ((nr) + 32)
8#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
8 9
9/* INTCS */ 10/* INTCS */
10#define INTCS_VECT_BASE 0x3400 11#define INTCS_VECT_BASE 0x3400
11#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) 12#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
12#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) 13#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
13 14
15/* External IRQ pins */
16#define IRQPIN_BASE 2000
17#define irq_pin(nr) ((nr) + IRQPIN_BASE)
18
14#endif /* __ASM_MACH_IRQS_H */ 19#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
index 59d252f4cf97..c2583610ad36 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
@@ -241,48 +241,9 @@ enum {
241 241
242 /* LCD0 */ 242 /* LCD0 */
243 GPIO_FN_LCDC0_SELECT, 243 GPIO_FN_LCDC0_SELECT,
244 GPIO_FN_LCD0_D0, GPIO_FN_LCD0_D1, GPIO_FN_LCD0_D2,
245 GPIO_FN_LCD0_D3, GPIO_FN_LCD0_D4, GPIO_FN_LCD0_D5,
246 GPIO_FN_LCD0_D6, GPIO_FN_LCD0_D7, GPIO_FN_LCD0_D8,
247 GPIO_FN_LCD0_D9, GPIO_FN_LCD0_D10, GPIO_FN_LCD0_D11,
248 GPIO_FN_LCD0_D12, GPIO_FN_LCD0_D13, GPIO_FN_LCD0_D14,
249 GPIO_FN_LCD0_D15, GPIO_FN_LCD0_D16, GPIO_FN_LCD0_D17,
250 GPIO_FN_LCD0_DON, GPIO_FN_LCD0_VCPWC, GPIO_FN_LCD0_VEPWC,
251
252 GPIO_FN_LCD0_DCK, GPIO_FN_LCD0_VSYN, /* for RGB */
253 GPIO_FN_LCD0_HSYN, GPIO_FN_LCD0_DISP, /* for RGB */
254
255 GPIO_FN_LCD0_WR, GPIO_FN_LCD0_RD, /* for SYS */
256 GPIO_FN_LCD0_CS, GPIO_FN_LCD0_RS, /* for SYS */
257
258 GPIO_FN_LCD0_D18_PORT163, GPIO_FN_LCD0_D19_PORT162,
259 GPIO_FN_LCD0_D20_PORT161, GPIO_FN_LCD0_D21_PORT158,
260 GPIO_FN_LCD0_D22_PORT160, GPIO_FN_LCD0_D23_PORT159,
261 GPIO_FN_LCD0_LCLK_PORT165, /* MSEL5CR_6_1 */
262
263 GPIO_FN_LCD0_D18_PORT40, GPIO_FN_LCD0_D19_PORT4,
264 GPIO_FN_LCD0_D20_PORT3, GPIO_FN_LCD0_D21_PORT2,
265 GPIO_FN_LCD0_D22_PORT0, GPIO_FN_LCD0_D23_PORT1,
266 GPIO_FN_LCD0_LCLK_PORT102, /* MSEL5CR_6_0 */
267 244
268 /* LCD1 */ 245 /* LCD1 */
269 GPIO_FN_LCDC1_SELECT, 246 GPIO_FN_LCDC1_SELECT,
270 GPIO_FN_LCD1_D0, GPIO_FN_LCD1_D1, GPIO_FN_LCD1_D2,
271 GPIO_FN_LCD1_D3, GPIO_FN_LCD1_D4, GPIO_FN_LCD1_D5,
272 GPIO_FN_LCD1_D6, GPIO_FN_LCD1_D7, GPIO_FN_LCD1_D8,
273 GPIO_FN_LCD1_D9, GPIO_FN_LCD1_D10, GPIO_FN_LCD1_D11,
274 GPIO_FN_LCD1_D12, GPIO_FN_LCD1_D13, GPIO_FN_LCD1_D14,
275 GPIO_FN_LCD1_D15, GPIO_FN_LCD1_D16, GPIO_FN_LCD1_D17,
276 GPIO_FN_LCD1_D18, GPIO_FN_LCD1_D19, GPIO_FN_LCD1_D20,
277 GPIO_FN_LCD1_D21, GPIO_FN_LCD1_D22, GPIO_FN_LCD1_D23,
278 GPIO_FN_LCD1_DON, GPIO_FN_LCD1_VCPWC,
279 GPIO_FN_LCD1_LCLK, GPIO_FN_LCD1_VEPWC,
280
281 GPIO_FN_LCD1_DCK, GPIO_FN_LCD1_VSYN, /* for RGB */
282 GPIO_FN_LCD1_HSYN, GPIO_FN_LCD1_DISP, /* for RGB */
283
284 GPIO_FN_LCD1_WR, GPIO_FN_LCD1_RD, /* for SYS */
285 GPIO_FN_LCD1_CS, GPIO_FN_LCD1_RS, /* for SYS */
286 247
287 /* RSPI */ 248 /* RSPI */
288 GPIO_FN_RSPI_SSL0_A, GPIO_FN_RSPI_SSL1_A, 249 GPIO_FN_RSPI_SSL0_A, GPIO_FN_RSPI_SSL1_A,
@@ -346,26 +307,6 @@ enum {
346 GPIO_FN_SIM_D_PORT22, /* SIM_D Port 22/199 */ 307 GPIO_FN_SIM_D_PORT22, /* SIM_D Port 22/199 */
347 GPIO_FN_SIM_D_PORT199, 308 GPIO_FN_SIM_D_PORT199,
348 309
349 /* SDHI0 */
350 GPIO_FN_SDHI0_D0, GPIO_FN_SDHI0_D1, GPIO_FN_SDHI0_D2,
351 GPIO_FN_SDHI0_D3, GPIO_FN_SDHI0_CD, GPIO_FN_SDHI0_WP,
352 GPIO_FN_SDHI0_CMD, GPIO_FN_SDHI0_CLK,
353
354 /* SDHI1 */
355 GPIO_FN_SDHI1_D0, GPIO_FN_SDHI1_D1, GPIO_FN_SDHI1_D2,
356 GPIO_FN_SDHI1_D3, GPIO_FN_SDHI1_CD, GPIO_FN_SDHI1_WP,
357 GPIO_FN_SDHI1_CMD, GPIO_FN_SDHI1_CLK,
358
359 /* SDHI2 */
360 GPIO_FN_SDHI2_D0, GPIO_FN_SDHI2_D1, GPIO_FN_SDHI2_D2,
361 GPIO_FN_SDHI2_D3, GPIO_FN_SDHI2_CLK, GPIO_FN_SDHI2_CMD,
362
363 GPIO_FN_SDHI2_CD_PORT24, /* MSEL5CR_19_0 */
364 GPIO_FN_SDHI2_WP_PORT25,
365
366 GPIO_FN_SDHI2_WP_PORT177, /* MSEL5CR_19_1 */
367 GPIO_FN_SDHI2_CD_PORT202,
368
369 /* MSIOF2 */ 310 /* MSIOF2 */
370 GPIO_FN_MSIOF2_TXD, GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TSCK, 311 GPIO_FN_MSIOF2_TXD, GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TSCK,
371 GPIO_FN_MSIOF2_SS2, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_SS1, 312 GPIO_FN_MSIOF2_SS2, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_SS1,
@@ -417,21 +358,6 @@ enum {
417 GPIO_FN_MEMC_DREQ1, 358 GPIO_FN_MEMC_DREQ1,
418 GPIO_FN_MEMC_A0, 359 GPIO_FN_MEMC_A0,
419 360
420 /* MMC */
421 GPIO_FN_MMC0_D0_PORT68, GPIO_FN_MMC0_D1_PORT69,
422 GPIO_FN_MMC0_D2_PORT70, GPIO_FN_MMC0_D3_PORT71,
423 GPIO_FN_MMC0_D4_PORT72, GPIO_FN_MMC0_D5_PORT73,
424 GPIO_FN_MMC0_D6_PORT74, GPIO_FN_MMC0_D7_PORT75,
425 GPIO_FN_MMC0_CLK_PORT66,
426 GPIO_FN_MMC0_CMD_PORT67, /* MSEL4CR_15_0 */
427
428 GPIO_FN_MMC1_D0_PORT149, GPIO_FN_MMC1_D1_PORT148,
429 GPIO_FN_MMC1_D2_PORT147, GPIO_FN_MMC1_D3_PORT146,
430 GPIO_FN_MMC1_D4_PORT145, GPIO_FN_MMC1_D5_PORT144,
431 GPIO_FN_MMC1_D6_PORT143, GPIO_FN_MMC1_D7_PORT142,
432 GPIO_FN_MMC1_CLK_PORT103,
433 GPIO_FN_MMC1_CMD_PORT104, /* MSEL4CR_15_1 */
434
435 /* MSIOF0 */ 361 /* MSIOF0 */
436 GPIO_FN_MSIOF0_SS1, GPIO_FN_MSIOF0_SS2, 362 GPIO_FN_MSIOF0_SS1, GPIO_FN_MSIOF0_SS2,
437 GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_TXD, 363 GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_TXD,
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 8ab0cd6ad6b0..8ea0ad18cdff 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -71,128 +71,125 @@ enum {
71 GPIO_FN_A19, 71 GPIO_FN_A19,
72 72
73 /* IPSR0 */ 73 /* IPSR0 */
74 GPIO_FN_USB_PENC2, GPIO_FN_SCK0, GPIO_FN_PWM1, GPIO_FN_PWMFSW0, 74 GPIO_FN_PWM1, GPIO_FN_PWMFSW0,
75 GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS, GPIO_FN_SD1_DAT2, 75 GPIO_FN_SCIF_CLK, GPIO_FN_TCLK0_C, GPIO_FN_BS,
76 GPIO_FN_MMC0_D2, GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF, 76 GPIO_FN_FD2, GPIO_FN_ATADIR0, GPIO_FN_SDSELF,
77 GPIO_FN_HCTS1, GPIO_FN_TX4_C, GPIO_FN_A0, GPIO_FN_SD1_DAT3, 77 GPIO_FN_HCTS1, GPIO_FN_A0,
78 GPIO_FN_MMC0_D3, GPIO_FN_FD3, GPIO_FN_A20, GPIO_FN_TX5_D, 78 GPIO_FN_FD3, GPIO_FN_A20,
79 GPIO_FN_HSPI_TX2_B, GPIO_FN_A21, GPIO_FN_SCK5_D, GPIO_FN_HSPI_CLK2_B, 79 GPIO_FN_A21,
80 GPIO_FN_A22, GPIO_FN_RX5_D, GPIO_FN_HSPI_RX2_B, GPIO_FN_VI1_R0, 80 GPIO_FN_A22, GPIO_FN_VI1_R0,
81 GPIO_FN_A23, GPIO_FN_FCLE, GPIO_FN_HSPI_CLK2, GPIO_FN_VI1_R1, 81 GPIO_FN_A23, GPIO_FN_FCLE, GPIO_FN_VI1_R1,
82 GPIO_FN_A24, GPIO_FN_SD1_CD, GPIO_FN_MMC0_D4, GPIO_FN_FD4, 82 GPIO_FN_A24, GPIO_FN_FD4,
83 GPIO_FN_HSPI_CS2, GPIO_FN_VI1_R2, GPIO_FN_SSI_WS78_B, GPIO_FN_A25, 83 GPIO_FN_VI1_R2, GPIO_FN_SSI_WS78_B, GPIO_FN_A25,
84 GPIO_FN_SD1_WP, GPIO_FN_MMC0_D5, GPIO_FN_FD5, GPIO_FN_HSPI_RX2, 84 GPIO_FN_FD5,
85 GPIO_FN_VI1_R3, GPIO_FN_TX5_B, GPIO_FN_SSI_SDATA7_B, GPIO_FN_CTS0_B, 85 GPIO_FN_VI1_R3, GPIO_FN_SSI_SDATA7_B,
86 GPIO_FN_CLKOUT, GPIO_FN_TX3C_IRDA_TX_C, GPIO_FN_PWM0_B, GPIO_FN_CS0, 86 GPIO_FN_CLKOUT, GPIO_FN_PWM0_B,
87 GPIO_FN_HSPI_CS2_B, GPIO_FN_CS1_A26, GPIO_FN_HSPI_TX2,
88 GPIO_FN_SDSELF_B, GPIO_FN_RD_WR, GPIO_FN_FWE, GPIO_FN_ATAG0, 87 GPIO_FN_SDSELF_B, GPIO_FN_RD_WR, GPIO_FN_FWE, GPIO_FN_ATAG0,
89 GPIO_FN_VI1_R7, GPIO_FN_HRTS1, GPIO_FN_RX4_C, 88 GPIO_FN_VI1_R7, GPIO_FN_HRTS1,
90 89
91 /* IPSR1 */ 90 /* IPSR1 */
92 GPIO_FN_EX_CS0, GPIO_FN_RX3_C_IRDA_RX_C, GPIO_FN_MMC0_D6, 91 GPIO_FN_FD6, GPIO_FN_FD7,
93 GPIO_FN_FD6, GPIO_FN_EX_CS1, GPIO_FN_MMC0_D7, GPIO_FN_FD7, 92 GPIO_FN_FALE,
94 GPIO_FN_EX_CS2, GPIO_FN_SD1_CLK, GPIO_FN_MMC0_CLK, GPIO_FN_FALE, 93 GPIO_FN_ATACS00,
95 GPIO_FN_ATACS00, GPIO_FN_EX_CS3, GPIO_FN_SD1_CMD, GPIO_FN_MMC0_CMD, 94 GPIO_FN_FRE, GPIO_FN_ATACS10, GPIO_FN_VI1_R4,
96 GPIO_FN_FRE, GPIO_FN_ATACS10, GPIO_FN_VI1_R4, GPIO_FN_RX5_B, 95 GPIO_FN_HSCK1, GPIO_FN_SSI_SDATA8_B,
97 GPIO_FN_HSCK1, GPIO_FN_SSI_SDATA8_B, GPIO_FN_RTS0_B_TANS_B, 96 GPIO_FN_SSI_SDATA9,
98 GPIO_FN_SSI_SDATA9, GPIO_FN_EX_CS4, GPIO_FN_SD1_DAT0, GPIO_FN_MMC0_D0, 97 GPIO_FN_FD0, GPIO_FN_ATARD0, GPIO_FN_VI1_R5,
99 GPIO_FN_FD0, GPIO_FN_ATARD0, GPIO_FN_VI1_R5, GPIO_FN_SCK5_B, 98 GPIO_FN_HTX1, GPIO_FN_SSI_SCK9,
100 GPIO_FN_HTX1, GPIO_FN_TX2_E, GPIO_FN_TX0_B, GPIO_FN_SSI_SCK9, 99 GPIO_FN_FD1,
101 GPIO_FN_EX_CS5, GPIO_FN_SD1_DAT1, GPIO_FN_MMC0_D1, GPIO_FN_FD1, 100 GPIO_FN_ATAWR0, GPIO_FN_VI1_R6, GPIO_FN_HRX1,
102 GPIO_FN_ATAWR0, GPIO_FN_VI1_R6, GPIO_FN_HRX1, GPIO_FN_RX2_E, 101 GPIO_FN_SSI_WS9, GPIO_FN_MLB_CLK, GPIO_FN_PWM2,
103 GPIO_FN_RX0_B, GPIO_FN_SSI_WS9, GPIO_FN_MLB_CLK, GPIO_FN_PWM2, 102 GPIO_FN_MLB_SIG, GPIO_FN_PWM3,
104 GPIO_FN_SCK4, GPIO_FN_MLB_SIG, GPIO_FN_PWM3, GPIO_FN_TX4, 103 GPIO_FN_MLB_DAT, GPIO_FN_PWM4, GPIO_FN_HTX0,
105 GPIO_FN_MLB_DAT, GPIO_FN_PWM4, GPIO_FN_RX4, GPIO_FN_HTX0, 104 GPIO_FN_SDATA, GPIO_FN_SUB_TCK,
106 GPIO_FN_TX1, GPIO_FN_SDATA, GPIO_FN_CTS0_C, GPIO_FN_SUB_TCK,
107 GPIO_FN_CC5_STATE2, GPIO_FN_CC5_STATE10, GPIO_FN_CC5_STATE18, 105 GPIO_FN_CC5_STATE2, GPIO_FN_CC5_STATE10, GPIO_FN_CC5_STATE18,
108 GPIO_FN_CC5_STATE26, GPIO_FN_CC5_STATE34, 106 GPIO_FN_CC5_STATE26, GPIO_FN_CC5_STATE34,
109 107
110 /* IPSR2 */ 108 /* IPSR2 */
111 GPIO_FN_HRX0, GPIO_FN_RX1, GPIO_FN_SCKZ, GPIO_FN_RTS0_C_TANS_C, 109 GPIO_FN_HRX0, GPIO_FN_SCKZ,
112 GPIO_FN_SUB_TDI, GPIO_FN_CC5_STATE3, GPIO_FN_CC5_STATE11, 110 GPIO_FN_SUB_TDI, GPIO_FN_CC5_STATE3, GPIO_FN_CC5_STATE11,
113 GPIO_FN_CC5_STATE19, GPIO_FN_CC5_STATE27, GPIO_FN_CC5_STATE35, 111 GPIO_FN_CC5_STATE19, GPIO_FN_CC5_STATE27, GPIO_FN_CC5_STATE35,
114 GPIO_FN_HSCK0, GPIO_FN_SCK1, GPIO_FN_MTS, GPIO_FN_PWM5, 112 GPIO_FN_HSCK0, GPIO_FN_MTS, GPIO_FN_PWM5,
115 GPIO_FN_SCK0_C, GPIO_FN_SSI_SDATA9_B, GPIO_FN_SUB_TDO, 113 GPIO_FN_SSI_SDATA9_B, GPIO_FN_SUB_TDO,
116 GPIO_FN_CC5_STATE0, GPIO_FN_CC5_STATE8, GPIO_FN_CC5_STATE16, 114 GPIO_FN_CC5_STATE0, GPIO_FN_CC5_STATE8, GPIO_FN_CC5_STATE16,
117 GPIO_FN_CC5_STATE24, GPIO_FN_CC5_STATE32, GPIO_FN_HCTS0, GPIO_FN_CTS1, 115 GPIO_FN_CC5_STATE24, GPIO_FN_CC5_STATE32, GPIO_FN_HCTS0,
118 GPIO_FN_STM, GPIO_FN_PWM0_D, GPIO_FN_RX0_C, GPIO_FN_SCIF_CLK_C, 116 GPIO_FN_STM, GPIO_FN_PWM0_D, GPIO_FN_SCIF_CLK_C,
119 GPIO_FN_SUB_TRST, GPIO_FN_TCLK1_B, GPIO_FN_CC5_OSCOUT, GPIO_FN_HRTS0, 117 GPIO_FN_SUB_TRST, GPIO_FN_TCLK1_B, GPIO_FN_CC5_OSCOUT, GPIO_FN_HRTS0,
120 GPIO_FN_RTS1_TANS, GPIO_FN_MDATA, GPIO_FN_TX0_C, GPIO_FN_SUB_TMS, 118 GPIO_FN_MDATA, GPIO_FN_SUB_TMS,
121 GPIO_FN_CC5_STATE1, GPIO_FN_CC5_STATE9, GPIO_FN_CC5_STATE17, 119 GPIO_FN_CC5_STATE1, GPIO_FN_CC5_STATE9, GPIO_FN_CC5_STATE17,
122 GPIO_FN_CC5_STATE25, GPIO_FN_CC5_STATE33, GPIO_FN_DU0_DR0, 120 GPIO_FN_CC5_STATE25, GPIO_FN_CC5_STATE33,
123 GPIO_FN_LCDOUT0, GPIO_FN_DREQ0, GPIO_FN_GPS_CLK_B, GPIO_FN_AUDATA0, 121 GPIO_FN_LCDOUT0, GPIO_FN_DREQ0, GPIO_FN_GPS_CLK_B, GPIO_FN_AUDATA0,
124 GPIO_FN_TX5_C, GPIO_FN_DU0_DR1, GPIO_FN_LCDOUT1, GPIO_FN_DACK0, 122 GPIO_FN_LCDOUT1, GPIO_FN_DACK0,
125 GPIO_FN_DRACK0, GPIO_FN_GPS_SIGN_B, GPIO_FN_AUDATA1, GPIO_FN_RX5_C, 123 GPIO_FN_DRACK0, GPIO_FN_GPS_SIGN_B, GPIO_FN_AUDATA1,
126 GPIO_FN_DU0_DR2, GPIO_FN_LCDOUT2, GPIO_FN_DU0_DR3, GPIO_FN_LCDOUT3, 124 GPIO_FN_LCDOUT2, GPIO_FN_LCDOUT3,
127 GPIO_FN_DU0_DR4, GPIO_FN_LCDOUT4, GPIO_FN_DU0_DR5, GPIO_FN_LCDOUT5, 125 GPIO_FN_LCDOUT4, GPIO_FN_LCDOUT5,
128 GPIO_FN_DU0_DR6, GPIO_FN_LCDOUT6, GPIO_FN_DU0_DR7, GPIO_FN_LCDOUT7, 126 GPIO_FN_LCDOUT6, GPIO_FN_LCDOUT7,
129 GPIO_FN_DU0_DG0, GPIO_FN_LCDOUT8, GPIO_FN_DREQ1, GPIO_FN_SCL2, 127 GPIO_FN_LCDOUT8, GPIO_FN_DREQ1, GPIO_FN_SCL2,
130 GPIO_FN_AUDATA2, 128 GPIO_FN_AUDATA2,
131 129
132 /* IPSR3 */ 130 /* IPSR3 */
133 GPIO_FN_DU0_DG1, GPIO_FN_LCDOUT9, GPIO_FN_DACK1, GPIO_FN_SDA2, 131 GPIO_FN_LCDOUT9, GPIO_FN_DACK1, GPIO_FN_SDA2,
134 GPIO_FN_AUDATA3, GPIO_FN_DU0_DG2, GPIO_FN_LCDOUT10, GPIO_FN_DU0_DG3, 132 GPIO_FN_AUDATA3, GPIO_FN_LCDOUT10,
135 GPIO_FN_LCDOUT11, GPIO_FN_DU0_DG4, GPIO_FN_LCDOUT12, GPIO_FN_DU0_DG5, 133 GPIO_FN_LCDOUT11, GPIO_FN_LCDOUT12,
136 GPIO_FN_LCDOUT13, GPIO_FN_DU0_DG6, GPIO_FN_LCDOUT14, GPIO_FN_DU0_DG7, 134 GPIO_FN_LCDOUT13, GPIO_FN_LCDOUT14,
137 GPIO_FN_LCDOUT15, GPIO_FN_DU0_DB0, GPIO_FN_LCDOUT16, GPIO_FN_EX_WAIT1, 135 GPIO_FN_LCDOUT15, GPIO_FN_LCDOUT16, GPIO_FN_EX_WAIT1,
138 GPIO_FN_SCL1, GPIO_FN_TCLK1, GPIO_FN_AUDATA4, GPIO_FN_DU0_DB1, 136 GPIO_FN_SCL1, GPIO_FN_TCLK1, GPIO_FN_AUDATA4,
139 GPIO_FN_LCDOUT17, GPIO_FN_EX_WAIT2, GPIO_FN_SDA1, GPIO_FN_GPS_MAG_B, 137 GPIO_FN_LCDOUT17, GPIO_FN_EX_WAIT2, GPIO_FN_SDA1, GPIO_FN_GPS_MAG_B,
140 GPIO_FN_AUDATA5, GPIO_FN_SCK5_C, GPIO_FN_DU0_DB2, GPIO_FN_LCDOUT18, 138 GPIO_FN_AUDATA5, GPIO_FN_LCDOUT18,
141 GPIO_FN_DU0_DB3, GPIO_FN_LCDOUT19, GPIO_FN_DU0_DB4, GPIO_FN_LCDOUT20, 139 GPIO_FN_LCDOUT19, GPIO_FN_LCDOUT20,
142 GPIO_FN_DU0_DB5, GPIO_FN_LCDOUT21, GPIO_FN_DU0_DB6, GPIO_FN_LCDOUT22, 140 GPIO_FN_LCDOUT21, GPIO_FN_LCDOUT22,
143 GPIO_FN_DU0_DB7, GPIO_FN_LCDOUT23, GPIO_FN_DU0_DOTCLKIN, 141 GPIO_FN_LCDOUT23,
144 GPIO_FN_QSTVA_QVS, GPIO_FN_TX3_D_IRDA_TX_D, GPIO_FN_SCL3_B, 142 GPIO_FN_QSTVA_QVS, GPIO_FN_SCL3_B,
145 GPIO_FN_DU0_DOTCLKOUT0, GPIO_FN_QCLK, GPIO_FN_DU0_DOTCLKOUT1, 143 GPIO_FN_QCLK,
146 GPIO_FN_QSTVB_QVE, GPIO_FN_RX3_D_IRDA_RX_D, GPIO_FN_SDA3_B, 144 GPIO_FN_QSTVB_QVE, GPIO_FN_SDA3_B,
147 GPIO_FN_SDA2_C, GPIO_FN_DACK0_B, GPIO_FN_DRACK0_B, 145 GPIO_FN_SDA2_C, GPIO_FN_DACK0_B, GPIO_FN_DRACK0_B,
148 GPIO_FN_DU0_EXHSYNC_DU0_HSYNC, GPIO_FN_QSTH_QHS, 146 GPIO_FN_QSTH_QHS,
149 GPIO_FN_DU0_EXVSYNC_DU0_VSYNC, GPIO_FN_QSTB_QHE, 147 GPIO_FN_QSTB_QHE,
150 GPIO_FN_DU0_EXODDF_DU0_ODDF_DISP_CDE, GPIO_FN_QCPV_QDE, 148 GPIO_FN_QCPV_QDE,
151 GPIO_FN_CAN1_TX, GPIO_FN_TX2_C, GPIO_FN_SCL2_C, GPIO_FN_REMOCON, 149 GPIO_FN_CAN1_TX, GPIO_FN_SCL2_C, GPIO_FN_REMOCON,
152 150
153 /* IPSR4 */ 151 /* IPSR4 */
154 GPIO_FN_DU0_DISP, GPIO_FN_QPOLA, GPIO_FN_CAN_CLK_C, GPIO_FN_SCK2_C, 152 GPIO_FN_QPOLA, GPIO_FN_CAN_CLK_C,
155 GPIO_FN_DU0_CDE, GPIO_FN_QPOLB, GPIO_FN_CAN1_RX, GPIO_FN_RX2_C, 153 GPIO_FN_QPOLB, GPIO_FN_CAN1_RX,
156 GPIO_FN_DREQ0_B, GPIO_FN_SSI_SCK78_B, GPIO_FN_SCK0_B, GPIO_FN_DU1_DR0, 154 GPIO_FN_DREQ0_B, GPIO_FN_SSI_SCK78_B,
157 GPIO_FN_VI2_DATA0_VI2_B0, GPIO_FN_PWM6, GPIO_FN_SD3_CLK, 155 GPIO_FN_VI2_DATA0_VI2_B0, GPIO_FN_PWM6,
158 GPIO_FN_TX3_E_IRDA_TX_E, GPIO_FN_AUDCK, GPIO_FN_PWMFSW0_B, 156 GPIO_FN_AUDCK, GPIO_FN_PWMFSW0_B,
159 GPIO_FN_DU1_DR1, GPIO_FN_VI2_DATA1_VI2_B1, GPIO_FN_PWM0, 157 GPIO_FN_VI2_DATA1_VI2_B1, GPIO_FN_PWM0,
160 GPIO_FN_SD3_CMD, GPIO_FN_RX3_E_IRDA_RX_E, GPIO_FN_AUDSYNC, 158 GPIO_FN_AUDSYNC,
161 GPIO_FN_CTS0_D, GPIO_FN_DU1_DR2, GPIO_FN_VI2_G0, GPIO_FN_DU1_DR3, 159 GPIO_FN_VI2_G0,
162 GPIO_FN_VI2_G1, GPIO_FN_DU1_DR4, GPIO_FN_VI2_G2, GPIO_FN_DU1_DR5, 160 GPIO_FN_VI2_G1, GPIO_FN_VI2_G2,
163 GPIO_FN_VI2_G3, GPIO_FN_DU1_DR6, GPIO_FN_VI2_G4, GPIO_FN_DU1_DR7, 161 GPIO_FN_VI2_G3, GPIO_FN_VI2_G4,
164 GPIO_FN_VI2_G5, GPIO_FN_DU1_DG0, GPIO_FN_VI2_DATA2_VI2_B2, 162 GPIO_FN_VI2_G5, GPIO_FN_VI2_DATA2_VI2_B2,
165 GPIO_FN_SCL1_B, GPIO_FN_SD3_DAT2, GPIO_FN_SCK3_E, GPIO_FN_AUDATA6, 163 GPIO_FN_SCL1_B, GPIO_FN_AUDATA6,
166 GPIO_FN_TX0_D, GPIO_FN_DU1_DG1, GPIO_FN_VI2_DATA3_VI2_B3, 164 GPIO_FN_VI2_DATA3_VI2_B3,
167 GPIO_FN_SDA1_B, GPIO_FN_SD3_DAT3, GPIO_FN_SCK5, GPIO_FN_AUDATA7, 165 GPIO_FN_SDA1_B, GPIO_FN_AUDATA7,
168 GPIO_FN_RX0_D, GPIO_FN_DU1_DG2, GPIO_FN_VI2_G6, GPIO_FN_DU1_DG3, 166 GPIO_FN_VI2_G6,
169 GPIO_FN_VI2_G7, GPIO_FN_DU1_DG4, GPIO_FN_VI2_R0, GPIO_FN_DU1_DG5, 167 GPIO_FN_VI2_G7, GPIO_FN_VI2_R0,
170 GPIO_FN_VI2_R1, GPIO_FN_DU1_DG6, GPIO_FN_VI2_R2, GPIO_FN_DU1_DG7, 168 GPIO_FN_VI2_R1, GPIO_FN_VI2_R2,
171 GPIO_FN_VI2_R3, GPIO_FN_DU1_DB0, GPIO_FN_VI2_DATA4_VI2_B4, 169 GPIO_FN_VI2_R3, GPIO_FN_VI2_DATA4_VI2_B4,
172 GPIO_FN_SCL2_B, GPIO_FN_SD3_DAT0, GPIO_FN_TX5, GPIO_FN_SCK0_D, 170 GPIO_FN_SCL2_B,
173 171
174 /* IPSR5 */ 172 /* IPSR5 */
175 GPIO_FN_DU1_DB1, GPIO_FN_VI2_DATA5_VI2_B5, GPIO_FN_SDA2_B, 173 GPIO_FN_VI2_DATA5_VI2_B5, GPIO_FN_SDA2_B,
176 GPIO_FN_SD3_DAT1, GPIO_FN_RX5, GPIO_FN_RTS0_D_TANS_D, 174 GPIO_FN_VI2_R4, GPIO_FN_VI2_R5,
177 GPIO_FN_DU1_DB2, GPIO_FN_VI2_R4, GPIO_FN_DU1_DB3, GPIO_FN_VI2_R5, 175 GPIO_FN_VI2_R6, GPIO_FN_VI2_R7,
178 GPIO_FN_DU1_DB4, GPIO_FN_VI2_R6, GPIO_FN_DU1_DB5, GPIO_FN_VI2_R7, 176 GPIO_FN_SCL2_D, GPIO_FN_SDA2_D,
179 GPIO_FN_DU1_DB6, GPIO_FN_SCL2_D, GPIO_FN_DU1_DB7, GPIO_FN_SDA2_D, 177 GPIO_FN_VI2_CLKENB,
180 GPIO_FN_DU1_DOTCLKIN, GPIO_FN_VI2_CLKENB, GPIO_FN_HSPI_CS1, 178 GPIO_FN_SCL1_D, GPIO_FN_VI2_FIELD,
181 GPIO_FN_SCL1_D, GPIO_FN_DU1_DOTCLKOUT, GPIO_FN_VI2_FIELD, 179 GPIO_FN_SDA1_D, GPIO_FN_VI2_HSYNC,
182 GPIO_FN_SDA1_D, GPIO_FN_DU1_EXHSYNC_DU1_HSYNC, GPIO_FN_VI2_HSYNC, 180 GPIO_FN_VI3_HSYNC, GPIO_FN_VI2_VSYNC,
183 GPIO_FN_VI3_HSYNC, GPIO_FN_DU1_EXVSYNC_DU1_VSYNC, GPIO_FN_VI2_VSYNC, 181 GPIO_FN_VI3_VSYNC,
184 GPIO_FN_VI3_VSYNC, GPIO_FN_DU1_EXODDF_DU1_ODDF_DISP_CDE, 182 GPIO_FN_VI2_CLK,
185 GPIO_FN_VI2_CLK, GPIO_FN_TX3_B_IRDA_TX_B, GPIO_FN_SD3_CD, 183 GPIO_FN_VI1_CLKENB, GPIO_FN_VI3_CLKENB,
186 GPIO_FN_HSPI_TX1, GPIO_FN_VI1_CLKENB, GPIO_FN_VI3_CLKENB, 184 GPIO_FN_AUDIO_CLKC, GPIO_FN_SPEEDIN,
187 GPIO_FN_AUDIO_CLKC, GPIO_FN_TX2_D, GPIO_FN_SPEEDIN, 185 GPIO_FN_GPS_SIGN_D, GPIO_FN_VI2_DATA6_VI2_B6,
188 GPIO_FN_GPS_SIGN_D, GPIO_FN_DU1_DISP, GPIO_FN_VI2_DATA6_VI2_B6, 186 GPIO_FN_TCLK0, GPIO_FN_QSTVA_B_QVS_B,
189 GPIO_FN_TCLK0, GPIO_FN_QSTVA_B_QVS_B, GPIO_FN_HSPI_CLK1, 187 GPIO_FN_AUDIO_CLKOUT_B, GPIO_FN_GPS_MAG_D,
190 GPIO_FN_SCK2_D, GPIO_FN_AUDIO_CLKOUT_B, GPIO_FN_GPS_MAG_D, 188 GPIO_FN_VI2_DATA7_VI2_B7,
191 GPIO_FN_DU1_CDE, GPIO_FN_VI2_DATA7_VI2_B7, GPIO_FN_RX3_B_IRDA_RX_B, 189 GPIO_FN_VI1_FIELD, GPIO_FN_VI3_FIELD,
192 GPIO_FN_SD3_WP, GPIO_FN_HSPI_RX1, GPIO_FN_VI1_FIELD, GPIO_FN_VI3_FIELD, 190 GPIO_FN_AUDIO_CLKOUT, GPIO_FN_GPS_CLK_C,
193 GPIO_FN_AUDIO_CLKOUT, GPIO_FN_RX2_D, GPIO_FN_GPS_CLK_C,
194 GPIO_FN_GPS_CLK_D, GPIO_FN_AUDIO_CLKA, GPIO_FN_CAN_TXCLK, 191 GPIO_FN_GPS_CLK_D, GPIO_FN_AUDIO_CLKA, GPIO_FN_CAN_TXCLK,
195 GPIO_FN_AUDIO_CLKB, GPIO_FN_USB_OVC2, GPIO_FN_CAN_DEBUGOUT0, 192 GPIO_FN_AUDIO_CLKB, GPIO_FN_CAN_DEBUGOUT0,
196 GPIO_FN_MOUT0, 193 GPIO_FN_MOUT0,
197 194
198 /* IPSR6 */ 195 /* IPSR6 */
@@ -208,85 +205,84 @@ enum {
208 GPIO_FN_CAN_CLK_B, GPIO_FN_IECLK, GPIO_FN_SCIF_CLK_B, GPIO_FN_TCLK0_B, 205 GPIO_FN_CAN_CLK_B, GPIO_FN_IECLK, GPIO_FN_SCIF_CLK_B, GPIO_FN_TCLK0_B,
209 GPIO_FN_SSI_SDATA4, GPIO_FN_CAN_DEBUGOUT9, GPIO_FN_SSI_SDATA9_C, 206 GPIO_FN_SSI_SDATA4, GPIO_FN_CAN_DEBUGOUT9, GPIO_FN_SSI_SDATA9_C,
210 GPIO_FN_SSI_SCK5, GPIO_FN_ADICLK, GPIO_FN_CAN_DEBUGOUT10, 207 GPIO_FN_SSI_SCK5, GPIO_FN_ADICLK, GPIO_FN_CAN_DEBUGOUT10,
211 GPIO_FN_SCK3, GPIO_FN_TCLK0_D, GPIO_FN_SSI_WS5, GPIO_FN_ADICS_SAMP, 208 GPIO_FN_TCLK0_D, GPIO_FN_SSI_WS5, GPIO_FN_ADICS_SAMP,
212 GPIO_FN_CAN_DEBUGOUT11, GPIO_FN_TX3_IRDA_TX, GPIO_FN_SSI_SDATA5, 209 GPIO_FN_CAN_DEBUGOUT11, GPIO_FN_SSI_SDATA5,
213 GPIO_FN_ADIDATA, GPIO_FN_CAN_DEBUGOUT12, GPIO_FN_RX3_IRDA_RX, 210 GPIO_FN_ADIDATA, GPIO_FN_CAN_DEBUGOUT12,
214 GPIO_FN_SSI_SCK6, GPIO_FN_ADICHS0, GPIO_FN_CAN0_TX, GPIO_FN_IERX_B, 211 GPIO_FN_SSI_SCK6, GPIO_FN_ADICHS0, GPIO_FN_CAN0_TX, GPIO_FN_IERX_B,
215 212
216 /* IPSR7 */ 213 /* IPSR7 */
217 GPIO_FN_SSI_WS6, GPIO_FN_ADICHS1, GPIO_FN_CAN0_RX, GPIO_FN_IETX_B, 214 GPIO_FN_SSI_WS6, GPIO_FN_ADICHS1, GPIO_FN_CAN0_RX, GPIO_FN_IETX_B,
218 GPIO_FN_SSI_SDATA6, GPIO_FN_ADICHS2, GPIO_FN_CAN_CLK, GPIO_FN_IECLK_B, 215 GPIO_FN_SSI_SDATA6, GPIO_FN_ADICHS2, GPIO_FN_CAN_CLK, GPIO_FN_IECLK_B,
219 GPIO_FN_SSI_SCK78, GPIO_FN_CAN_DEBUGOUT13, GPIO_FN_IRQ0_B, 216 GPIO_FN_SSI_SCK78, GPIO_FN_CAN_DEBUGOUT13,
220 GPIO_FN_SSI_SCK9_B, GPIO_FN_HSPI_CLK1_C, GPIO_FN_SSI_WS78, 217 GPIO_FN_SSI_SCK9_B, GPIO_FN_SSI_WS78,
221 GPIO_FN_CAN_DEBUGOUT14, GPIO_FN_IRQ1_B, GPIO_FN_SSI_WS9_B, 218 GPIO_FN_CAN_DEBUGOUT14, GPIO_FN_SSI_WS9_B,
222 GPIO_FN_HSPI_CS1_C, GPIO_FN_SSI_SDATA7, GPIO_FN_CAN_DEBUGOUT15, 219 GPIO_FN_SSI_SDATA7, GPIO_FN_CAN_DEBUGOUT15,
223 GPIO_FN_IRQ2_B, GPIO_FN_TCLK1_C, GPIO_FN_HSPI_TX1_C, 220 GPIO_FN_TCLK1_C,
224 GPIO_FN_SSI_SDATA8, GPIO_FN_VSP, GPIO_FN_IRQ3_B, GPIO_FN_HSPI_RX1_C, 221 GPIO_FN_SSI_SDATA8, GPIO_FN_VSP,
225 GPIO_FN_SD0_CLK, GPIO_FN_ATACS01, GPIO_FN_SCK1_B, GPIO_FN_SD0_CMD, 222 GPIO_FN_ATACS01,
226 GPIO_FN_ATACS11, GPIO_FN_TX1_B, GPIO_FN_CC5_TDO, GPIO_FN_SD0_DAT0, 223 GPIO_FN_ATACS11, GPIO_FN_CC5_TDO,
227 GPIO_FN_ATADIR1, GPIO_FN_RX1_B, GPIO_FN_CC5_TRST, GPIO_FN_SD0_DAT1, 224 GPIO_FN_ATADIR1, GPIO_FN_CC5_TRST,
228 GPIO_FN_ATAG1, GPIO_FN_SCK2_B, GPIO_FN_CC5_TMS, GPIO_FN_SD0_DAT2, 225 GPIO_FN_ATAG1, GPIO_FN_CC5_TMS,
229 GPIO_FN_ATARD1, GPIO_FN_TX2_B, GPIO_FN_CC5_TCK, GPIO_FN_SD0_DAT3, 226 GPIO_FN_ATARD1, GPIO_FN_CC5_TCK,
230 GPIO_FN_ATAWR1, GPIO_FN_RX2_B, GPIO_FN_CC5_TDI, GPIO_FN_SD0_CD, 227 GPIO_FN_ATAWR1, GPIO_FN_CC5_TDI,
231 GPIO_FN_DREQ2, GPIO_FN_RTS1_B_TANS_B, GPIO_FN_SD0_WP, GPIO_FN_DACK2, 228 GPIO_FN_DREQ2, GPIO_FN_DACK2,
232 GPIO_FN_CTS1_B,
233 229
234 /* IPSR8 */ 230 /* IPSR8 */
235 GPIO_FN_HSPI_CLK0, GPIO_FN_CTS0, GPIO_FN_USB_OVC0, GPIO_FN_AD_CLK, 231 GPIO_FN_AD_CLK,
236 GPIO_FN_CC5_STATE4, GPIO_FN_CC5_STATE12, GPIO_FN_CC5_STATE20, 232 GPIO_FN_CC5_STATE4, GPIO_FN_CC5_STATE12, GPIO_FN_CC5_STATE20,
237 GPIO_FN_CC5_STATE28, GPIO_FN_CC5_STATE36, GPIO_FN_HSPI_CS0, 233 GPIO_FN_CC5_STATE28, GPIO_FN_CC5_STATE36,
238 GPIO_FN_RTS0_TANS, GPIO_FN_USB_OVC1, GPIO_FN_AD_DI, 234 GPIO_FN_AD_DI,
239 GPIO_FN_CC5_STATE5, GPIO_FN_CC5_STATE13, GPIO_FN_CC5_STATE21, 235 GPIO_FN_CC5_STATE5, GPIO_FN_CC5_STATE13, GPIO_FN_CC5_STATE21,
240 GPIO_FN_CC5_STATE29, GPIO_FN_CC5_STATE37, GPIO_FN_HSPI_TX0, 236 GPIO_FN_CC5_STATE29, GPIO_FN_CC5_STATE37,
241 GPIO_FN_TX0, GPIO_FN_CAN_DEBUG_HW_TRIGGER, GPIO_FN_AD_DO, 237 GPIO_FN_CAN_DEBUG_HW_TRIGGER, GPIO_FN_AD_DO,
242 GPIO_FN_CC5_STATE6, GPIO_FN_CC5_STATE14, GPIO_FN_CC5_STATE22, 238 GPIO_FN_CC5_STATE6, GPIO_FN_CC5_STATE14, GPIO_FN_CC5_STATE22,
243 GPIO_FN_CC5_STATE30, GPIO_FN_CC5_STATE38, GPIO_FN_HSPI_RX0, 239 GPIO_FN_CC5_STATE30, GPIO_FN_CC5_STATE38,
244 GPIO_FN_RX0, GPIO_FN_CAN_STEP0, GPIO_FN_AD_NCS, GPIO_FN_CC5_STATE7, 240 GPIO_FN_CAN_STEP0, GPIO_FN_AD_NCS, GPIO_FN_CC5_STATE7,
245 GPIO_FN_CC5_STATE15, GPIO_FN_CC5_STATE23, GPIO_FN_CC5_STATE31, 241 GPIO_FN_CC5_STATE15, GPIO_FN_CC5_STATE23, GPIO_FN_CC5_STATE31,
246 GPIO_FN_CC5_STATE39, GPIO_FN_FMCLK, GPIO_FN_RDS_CLK, GPIO_FN_PCMOE, 242 GPIO_FN_CC5_STATE39, GPIO_FN_FMCLK, GPIO_FN_RDS_CLK, GPIO_FN_PCMOE,
247 GPIO_FN_BPFCLK, GPIO_FN_PCMWE, GPIO_FN_FMIN, GPIO_FN_RDS_DATA, 243 GPIO_FN_BPFCLK, GPIO_FN_PCMWE, GPIO_FN_FMIN, GPIO_FN_RDS_DATA,
248 GPIO_FN_VI0_CLK, GPIO_FN_MMC1_CLK, GPIO_FN_VI0_CLKENB, GPIO_FN_TX1_C, 244 GPIO_FN_VI0_CLK, GPIO_FN_VI0_CLKENB,
249 GPIO_FN_HTX1_B, GPIO_FN_MT1_SYNC, GPIO_FN_VI0_FIELD, GPIO_FN_RX1_C, 245 GPIO_FN_HTX1_B, GPIO_FN_MT1_SYNC, GPIO_FN_VI0_FIELD,
250 GPIO_FN_HRX1_B, GPIO_FN_VI0_HSYNC, GPIO_FN_VI0_DATA0_B_VI0_B0_B, 246 GPIO_FN_HRX1_B, GPIO_FN_VI0_HSYNC, GPIO_FN_VI0_DATA0_B_VI0_B0_B,
251 GPIO_FN_CTS1_C, GPIO_FN_TX4_D, GPIO_FN_MMC1_CMD, GPIO_FN_HSCK1_B, 247 GPIO_FN_HSCK1_B,
252 GPIO_FN_VI0_VSYNC, GPIO_FN_VI0_DATA1_B_VI0_B1_B, 248 GPIO_FN_VI0_VSYNC, GPIO_FN_VI0_DATA1_B_VI0_B1_B,
253 GPIO_FN_RTS1_C_TANS_C, GPIO_FN_RX4_D, GPIO_FN_PWMFSW0_C, 249 GPIO_FN_PWMFSW0_C,
254 250
255 /* IPSR9 */ 251 /* IPSR9 */
256 GPIO_FN_VI0_DATA0_VI0_B0, GPIO_FN_HRTS1_B, GPIO_FN_MT1_VCXO, 252 GPIO_FN_VI0_DATA0_VI0_B0, GPIO_FN_HRTS1_B, GPIO_FN_MT1_VCXO,
257 GPIO_FN_VI0_DATA1_VI0_B1, GPIO_FN_HCTS1_B, GPIO_FN_MT1_PWM, 253 GPIO_FN_VI0_DATA1_VI0_B1, GPIO_FN_HCTS1_B, GPIO_FN_MT1_PWM,
258 GPIO_FN_VI0_DATA2_VI0_B2, GPIO_FN_MMC1_D0, GPIO_FN_VI0_DATA3_VI0_B3, 254 GPIO_FN_VI0_DATA2_VI0_B2, GPIO_FN_VI0_DATA3_VI0_B3,
259 GPIO_FN_MMC1_D1, GPIO_FN_VI0_DATA4_VI0_B4, GPIO_FN_MMC1_D2, 255 GPIO_FN_VI0_DATA4_VI0_B4,
260 GPIO_FN_VI0_DATA5_VI0_B5, GPIO_FN_MMC1_D3, GPIO_FN_VI0_DATA6_VI0_B6, 256 GPIO_FN_VI0_DATA5_VI0_B5, GPIO_FN_VI0_DATA6_VI0_B6,
261 GPIO_FN_MMC1_D4, GPIO_FN_ARM_TRACEDATA_0, GPIO_FN_VI0_DATA7_VI0_B7, 257 GPIO_FN_ARM_TRACEDATA_0, GPIO_FN_VI0_DATA7_VI0_B7,
262 GPIO_FN_MMC1_D5, GPIO_FN_ARM_TRACEDATA_1, GPIO_FN_VI0_G0, 258 GPIO_FN_ARM_TRACEDATA_1, GPIO_FN_VI0_G0,
263 GPIO_FN_SSI_SCK78_C, GPIO_FN_IRQ0, GPIO_FN_ARM_TRACEDATA_2, 259 GPIO_FN_SSI_SCK78_C, GPIO_FN_ARM_TRACEDATA_2,
264 GPIO_FN_VI0_G1, GPIO_FN_SSI_WS78_C, GPIO_FN_IRQ1, 260 GPIO_FN_VI0_G1, GPIO_FN_SSI_WS78_C,
265 GPIO_FN_ARM_TRACEDATA_3, GPIO_FN_VI0_G2, GPIO_FN_ETH_TXD1, 261 GPIO_FN_ARM_TRACEDATA_3, GPIO_FN_VI0_G2, GPIO_FN_ETH_TXD1,
266 GPIO_FN_MMC1_D6, GPIO_FN_ARM_TRACEDATA_4, GPIO_FN_TS_SPSYNC0, 262 GPIO_FN_ARM_TRACEDATA_4, GPIO_FN_TS_SPSYNC0,
267 GPIO_FN_VI0_G3, GPIO_FN_ETH_CRS_DV, GPIO_FN_MMC1_D7, 263 GPIO_FN_VI0_G3, GPIO_FN_ETH_CRS_DV,
268 GPIO_FN_ARM_TRACEDATA_5, GPIO_FN_TS_SDAT0, GPIO_FN_VI0_G4, 264 GPIO_FN_ARM_TRACEDATA_5, GPIO_FN_TS_SDAT0, GPIO_FN_VI0_G4,
269 GPIO_FN_ETH_TX_EN, GPIO_FN_SD2_DAT0_B, GPIO_FN_ARM_TRACEDATA_6, 265 GPIO_FN_ETH_TX_EN, GPIO_FN_ARM_TRACEDATA_6,
270 GPIO_FN_VI0_G5, GPIO_FN_ETH_RX_ER, GPIO_FN_SD2_DAT1_B, 266 GPIO_FN_VI0_G5, GPIO_FN_ETH_RX_ER,
271 GPIO_FN_ARM_TRACEDATA_7, GPIO_FN_VI0_G6, GPIO_FN_ETH_RXD0, 267 GPIO_FN_ARM_TRACEDATA_7, GPIO_FN_VI0_G6, GPIO_FN_ETH_RXD0,
272 GPIO_FN_SD2_DAT2_B, GPIO_FN_ARM_TRACEDATA_8, GPIO_FN_VI0_G7, 268 GPIO_FN_ARM_TRACEDATA_8, GPIO_FN_VI0_G7,
273 GPIO_FN_ETH_RXD1, GPIO_FN_SD2_DAT3_B, GPIO_FN_ARM_TRACEDATA_9, 269 GPIO_FN_ETH_RXD1, GPIO_FN_ARM_TRACEDATA_9,
274 270
275 /* IPSR10 */ 271 /* IPSR10 */
276 GPIO_FN_VI0_R0, GPIO_FN_SSI_SDATA7_C, GPIO_FN_SCK1_C, GPIO_FN_DREQ1_B, 272 GPIO_FN_VI0_R0, GPIO_FN_SSI_SDATA7_C, GPIO_FN_DREQ1_B,
277 GPIO_FN_ARM_TRACEDATA_10, GPIO_FN_DREQ0_C, GPIO_FN_VI0_R1, 273 GPIO_FN_ARM_TRACEDATA_10, GPIO_FN_DREQ0_C, GPIO_FN_VI0_R1,
278 GPIO_FN_SSI_SDATA8_C, GPIO_FN_DACK1_B, GPIO_FN_ARM_TRACEDATA_11, 274 GPIO_FN_SSI_SDATA8_C, GPIO_FN_DACK1_B, GPIO_FN_ARM_TRACEDATA_11,
279 GPIO_FN_DACK0_C, GPIO_FN_DRACK0_C, GPIO_FN_VI0_R2, GPIO_FN_ETH_LINK, 275 GPIO_FN_DACK0_C, GPIO_FN_DRACK0_C, GPIO_FN_VI0_R2, GPIO_FN_ETH_LINK,
280 GPIO_FN_SD2_CLK_B, GPIO_FN_IRQ2, GPIO_FN_ARM_TRACEDATA_12, 276 GPIO_FN_ARM_TRACEDATA_12,
281 GPIO_FN_VI0_R3, GPIO_FN_ETH_MAGIC, GPIO_FN_SD2_CMD_B, GPIO_FN_IRQ3, 277 GPIO_FN_VI0_R3, GPIO_FN_ETH_MAGIC,
282 GPIO_FN_ARM_TRACEDATA_13, GPIO_FN_VI0_R4, GPIO_FN_ETH_REFCLK, 278 GPIO_FN_ARM_TRACEDATA_13, GPIO_FN_VI0_R4, GPIO_FN_ETH_REFCLK,
283 GPIO_FN_SD2_CD_B, GPIO_FN_HSPI_CLK1_B, GPIO_FN_ARM_TRACEDATA_14, 279 GPIO_FN_ARM_TRACEDATA_14,
284 GPIO_FN_MT1_CLK, GPIO_FN_TS_SCK0, GPIO_FN_VI0_R5, GPIO_FN_ETH_TXD0, 280 GPIO_FN_MT1_CLK, GPIO_FN_TS_SCK0, GPIO_FN_VI0_R5, GPIO_FN_ETH_TXD0,
285 GPIO_FN_SD2_WP_B, GPIO_FN_HSPI_CS1_B, GPIO_FN_ARM_TRACEDATA_15, 281 GPIO_FN_ARM_TRACEDATA_15,
286 GPIO_FN_MT1_D, GPIO_FN_TS_SDEN0, GPIO_FN_VI0_R6, GPIO_FN_ETH_MDC, 282 GPIO_FN_MT1_D, GPIO_FN_TS_SDEN0, GPIO_FN_VI0_R6, GPIO_FN_ETH_MDC,
287 GPIO_FN_DREQ2_C, GPIO_FN_HSPI_TX1_B, GPIO_FN_TRACECLK, 283 GPIO_FN_DREQ2_C, GPIO_FN_TRACECLK,
288 GPIO_FN_MT1_BEN, GPIO_FN_PWMFSW0_D, GPIO_FN_VI0_R7, GPIO_FN_ETH_MDIO, 284 GPIO_FN_MT1_BEN, GPIO_FN_PWMFSW0_D, GPIO_FN_VI0_R7, GPIO_FN_ETH_MDIO,
289 GPIO_FN_DACK2_C, GPIO_FN_HSPI_RX1_B, GPIO_FN_SCIF_CLK_D, 285 GPIO_FN_DACK2_C, GPIO_FN_SCIF_CLK_D,
290 GPIO_FN_TRACECTL, GPIO_FN_MT1_PEN, GPIO_FN_VI1_CLK, GPIO_FN_SIM_D, 286 GPIO_FN_TRACECTL, GPIO_FN_MT1_PEN, GPIO_FN_VI1_CLK, GPIO_FN_SIM_D,
291 GPIO_FN_SDA3, GPIO_FN_VI1_HSYNC, GPIO_FN_VI3_CLK, GPIO_FN_SSI_SCK4, 287 GPIO_FN_SDA3, GPIO_FN_VI1_HSYNC, GPIO_FN_VI3_CLK, GPIO_FN_SSI_SCK4,
292 GPIO_FN_GPS_SIGN_C, GPIO_FN_PWMFSW0_E, GPIO_FN_VI1_VSYNC, 288 GPIO_FN_GPS_SIGN_C, GPIO_FN_PWMFSW0_E, GPIO_FN_VI1_VSYNC,
@@ -294,35 +290,35 @@ enum {
294 GPIO_FN_GPS_MAG_C, GPIO_FN_SPV_TRST, GPIO_FN_SCL3, 290 GPIO_FN_GPS_MAG_C, GPIO_FN_SPV_TRST, GPIO_FN_SCL3,
295 291
296 /* IPSR11 */ 292 /* IPSR11 */
297 GPIO_FN_VI1_DATA0_VI1_B0, GPIO_FN_SD2_DAT0, GPIO_FN_SIM_RST, 293 GPIO_FN_VI1_DATA0_VI1_B0, GPIO_FN_SIM_RST,
298 GPIO_FN_SPV_TCK, GPIO_FN_ADICLK_B, GPIO_FN_VI1_DATA1_VI1_B1, 294 GPIO_FN_SPV_TCK, GPIO_FN_ADICLK_B, GPIO_FN_VI1_DATA1_VI1_B1,
299 GPIO_FN_SD2_DAT1, GPIO_FN_MT0_CLK, GPIO_FN_SPV_TMS, 295 GPIO_FN_MT0_CLK, GPIO_FN_SPV_TMS,
300 GPIO_FN_ADICS_B_SAMP_B, GPIO_FN_VI1_DATA2_VI1_B2, GPIO_FN_SD2_DAT2, 296 GPIO_FN_ADICS_B_SAMP_B, GPIO_FN_VI1_DATA2_VI1_B2,
301 GPIO_FN_MT0_D, GPIO_FN_SPVTDI, GPIO_FN_ADIDATA_B, 297 GPIO_FN_MT0_D, GPIO_FN_SPVTDI, GPIO_FN_ADIDATA_B,
302 GPIO_FN_VI1_DATA3_VI1_B3, GPIO_FN_SD2_DAT3, GPIO_FN_MT0_BEN, 298 GPIO_FN_VI1_DATA3_VI1_B3, GPIO_FN_MT0_BEN,
303 GPIO_FN_SPV_TDO, GPIO_FN_ADICHS0_B, GPIO_FN_VI1_DATA4_VI1_B4, 299 GPIO_FN_SPV_TDO, GPIO_FN_ADICHS0_B, GPIO_FN_VI1_DATA4_VI1_B4,
304 GPIO_FN_SD2_CLK, GPIO_FN_MT0_PEN, GPIO_FN_SPA_TRST, 300 GPIO_FN_MT0_PEN, GPIO_FN_SPA_TRST,
305 GPIO_FN_HSPI_CLK1_D, GPIO_FN_ADICHS1_B, GPIO_FN_VI1_DATA5_VI1_B5, 301 GPIO_FN_ADICHS1_B, GPIO_FN_VI1_DATA5_VI1_B5,
306 GPIO_FN_SD2_CMD, GPIO_FN_MT0_SYNC, GPIO_FN_SPA_TCK, 302 GPIO_FN_MT0_SYNC, GPIO_FN_SPA_TCK,
307 GPIO_FN_HSPI_CS1_D, GPIO_FN_ADICHS2_B, GPIO_FN_VI1_DATA6_VI1_B6, 303 GPIO_FN_ADICHS2_B, GPIO_FN_VI1_DATA6_VI1_B6,
308 GPIO_FN_SD2_CD, GPIO_FN_MT0_VCXO, GPIO_FN_SPA_TMS, GPIO_FN_HSPI_TX1_D, 304 GPIO_FN_MT0_VCXO, GPIO_FN_SPA_TMS,
309 GPIO_FN_VI1_DATA7_VI1_B7, GPIO_FN_SD2_WP, GPIO_FN_MT0_PWM, 305 GPIO_FN_VI1_DATA7_VI1_B7, GPIO_FN_MT0_PWM,
310 GPIO_FN_SPA_TDI, GPIO_FN_HSPI_RX1_D, GPIO_FN_VI1_G0, GPIO_FN_VI3_DATA0, 306 GPIO_FN_SPA_TDI, GPIO_FN_VI1_G0, GPIO_FN_VI3_DATA0,
311 GPIO_FN_DU1_DOTCLKOUT1, GPIO_FN_TS_SCK1, GPIO_FN_DREQ2_B, GPIO_FN_TX2, 307 GPIO_FN_TS_SCK1, GPIO_FN_DREQ2_B,
312 GPIO_FN_SPA_TDO, GPIO_FN_HCTS0_B, GPIO_FN_VI1_G1, GPIO_FN_VI3_DATA1, 308 GPIO_FN_SPA_TDO, GPIO_FN_HCTS0_B, GPIO_FN_VI1_G1, GPIO_FN_VI3_DATA1,
313 GPIO_FN_SSI_SCK1, GPIO_FN_TS_SDEN1, GPIO_FN_DACK2_B, GPIO_FN_RX2, 309 GPIO_FN_SSI_SCK1, GPIO_FN_TS_SDEN1, GPIO_FN_DACK2_B,
314 GPIO_FN_HRTS0_B, 310 GPIO_FN_HRTS0_B,
315 311
316 /* IPSR12 */ 312 /* IPSR12 */
317 GPIO_FN_VI1_G2, GPIO_FN_VI3_DATA2, GPIO_FN_SSI_WS1, GPIO_FN_TS_SPSYNC1, 313 GPIO_FN_VI1_G2, GPIO_FN_VI3_DATA2, GPIO_FN_SSI_WS1, GPIO_FN_TS_SPSYNC1,
318 GPIO_FN_SCK2, GPIO_FN_HSCK0_B, GPIO_FN_VI1_G3, GPIO_FN_VI3_DATA3, 314 GPIO_FN_HSCK0_B, GPIO_FN_VI1_G3, GPIO_FN_VI3_DATA3,
319 GPIO_FN_SSI_SCK2, GPIO_FN_TS_SDAT1, GPIO_FN_SCL1_C, GPIO_FN_HTX0_B, 315 GPIO_FN_SSI_SCK2, GPIO_FN_TS_SDAT1, GPIO_FN_SCL1_C, GPIO_FN_HTX0_B,
320 GPIO_FN_VI1_G4, GPIO_FN_VI3_DATA4, GPIO_FN_SSI_WS2, GPIO_FN_SDA1_C, 316 GPIO_FN_VI1_G4, GPIO_FN_VI3_DATA4, GPIO_FN_SSI_WS2, GPIO_FN_SDA1_C,
321 GPIO_FN_SIM_RST_B, GPIO_FN_HRX0_B, GPIO_FN_VI1_G5, GPIO_FN_VI3_DATA5, 317 GPIO_FN_SIM_RST_B, GPIO_FN_HRX0_B, GPIO_FN_VI1_G5, GPIO_FN_VI3_DATA5,
322 GPIO_FN_GPS_CLK, GPIO_FN_FSE, GPIO_FN_TX4_B, GPIO_FN_SIM_D_B, 318 GPIO_FN_GPS_CLK, GPIO_FN_FSE, GPIO_FN_SIM_D_B,
323 GPIO_FN_VI1_G6, GPIO_FN_VI3_DATA6, GPIO_FN_GPS_SIGN, GPIO_FN_FRB, 319 GPIO_FN_VI1_G6, GPIO_FN_VI3_DATA6, GPIO_FN_GPS_SIGN, GPIO_FN_FRB,
324 GPIO_FN_RX4_B, GPIO_FN_SIM_CLK_B, GPIO_FN_VI1_G7, GPIO_FN_VI3_DATA7, 320 GPIO_FN_SIM_CLK_B, GPIO_FN_VI1_G7, GPIO_FN_VI3_DATA7,
325 GPIO_FN_GPS_MAG, GPIO_FN_FCE, GPIO_FN_SCK4_B, 321 GPIO_FN_GPS_MAG, GPIO_FN_FCE,
326}; 322};
327 323
328struct platform_device; 324struct platform_device;
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index b582facc1cf6..7ded4ebaf5cc 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -294,21 +294,6 @@ enum {
294 GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, GPIO_FN_D14_NAF14, 294 GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, GPIO_FN_D14_NAF14,
295 GPIO_FN_D15_NAF15, 295 GPIO_FN_D15_NAF15,
296 296
297 /*
298 * MMCIF(1) (PORT 84, 85, 86, 87, 88, 89,
299 * 90, 91, 92, 99)
300 */
301 GPIO_FN_MMCD0_0, GPIO_FN_MMCD0_1, GPIO_FN_MMCD0_2,
302 GPIO_FN_MMCD0_3, GPIO_FN_MMCD0_4, GPIO_FN_MMCD0_5,
303 GPIO_FN_MMCD0_6, GPIO_FN_MMCD0_7,
304 GPIO_FN_MMCCMD0, GPIO_FN_MMCCLK0,
305
306 /* MMCIF(2) (PORT 54, 55, 56, 57, 58, 59, 60, 61, 66, 67) */
307 GPIO_FN_MMCD1_0, GPIO_FN_MMCD1_1, GPIO_FN_MMCD1_2,
308 GPIO_FN_MMCD1_3, GPIO_FN_MMCD1_4, GPIO_FN_MMCD1_5,
309 GPIO_FN_MMCD1_6, GPIO_FN_MMCD1_7,
310 GPIO_FN_MMCCLK1, GPIO_FN_MMCCMD1,
311
312 /* SPU2 (PORT 65) */ 297 /* SPU2 (PORT 65) */
313 GPIO_FN_VINT_I, 298 GPIO_FN_VINT_I,
314 299
@@ -416,20 +401,6 @@ enum {
416 /* HDMI (PORT 169, 170) */ 401 /* HDMI (PORT 169, 170) */
417 GPIO_FN_HDMI_HPD, GPIO_FN_HDMI_CEC, 402 GPIO_FN_HDMI_HPD, GPIO_FN_HDMI_CEC,
418 403
419 /* SDHI0 (PORT 171, 172, 173, 174, 175, 176, 177, 178) */
420 GPIO_FN_SDHICLK0, GPIO_FN_SDHICD0,
421 GPIO_FN_SDHICMD0, GPIO_FN_SDHIWP0,
422 GPIO_FN_SDHID0_0, GPIO_FN_SDHID0_1,
423 GPIO_FN_SDHID0_2, GPIO_FN_SDHID0_3,
424
425 /* SDHI1 (PORT 179, 180, 181, 182, 183, 184) */
426 GPIO_FN_SDHICLK1, GPIO_FN_SDHICMD1, GPIO_FN_SDHID1_0,
427 GPIO_FN_SDHID1_1, GPIO_FN_SDHID1_2, GPIO_FN_SDHID1_3,
428
429 /* SDHI2 (PORT 185, 186, 187, 188, 189, 190) */
430 GPIO_FN_SDHICLK2, GPIO_FN_SDHICMD2, GPIO_FN_SDHID2_0,
431 GPIO_FN_SDHID2_1, GPIO_FN_SDHID2_2, GPIO_FN_SDHID2_3,
432
433 /* SDENC see MSEL4CR 19 */ 404 /* SDENC see MSEL4CR 19 */
434 GPIO_FN_SDENC_CPG, 405 GPIO_FN_SDENC_CPG,
435 GPIO_FN_SDENC_DV_CLKI, 406 GPIO_FN_SDENC_DV_CLKI,
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index 606d31d02a4e..fbc1584d6712 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -94,8 +94,7 @@ enum {
94 GPIO_PORT305, GPIO_PORT306, GPIO_PORT307, GPIO_PORT308, GPIO_PORT309, 94 GPIO_PORT305, GPIO_PORT306, GPIO_PORT307, GPIO_PORT308, GPIO_PORT309,
95 95
96 /* Table 25-1 (Function 0-7) */ 96 /* Table 25-1 (Function 0-7) */
97 GPIO_FN_VBUS_0, 97 GPIO_FN_GPI0 = 310,
98 GPIO_FN_GPI0,
99 GPIO_FN_GPI1, 98 GPIO_FN_GPI1,
100 GPIO_FN_GPI2, 99 GPIO_FN_GPI2,
101 GPIO_FN_GPI3, 100 GPIO_FN_GPI3,
@@ -103,15 +102,11 @@ enum {
103 GPIO_FN_GPI5, 102 GPIO_FN_GPI5,
104 GPIO_FN_GPI6, 103 GPIO_FN_GPI6,
105 GPIO_FN_GPI7, 104 GPIO_FN_GPI7,
106 GPIO_FN_SCIFA7_RXD,
107 GPIO_FN_SCIFA7_CTS_,
108 GPIO_FN_GPO7, GPIO_FN_MFG0_OUT2, 105 GPIO_FN_GPO7, GPIO_FN_MFG0_OUT2,
109 GPIO_FN_GPO6, GPIO_FN_MFG1_OUT2, 106 GPIO_FN_GPO6, GPIO_FN_MFG1_OUT2,
110 GPIO_FN_GPO5, GPIO_FN_SCIFA0_SCK, GPIO_FN_FSICOSLDT3, \ 107 GPIO_FN_GPO5,
111 GPIO_FN_PORT16_VIO_CKOR, 108 GPIO_FN_PORT16_VIO_CKOR,
112 GPIO_FN_SCIFA0_TXD, 109 GPIO_FN_PORT19_VIO_CKO2,
113 GPIO_FN_SCIFA7_TXD,
114 GPIO_FN_SCIFA7_RTS_, GPIO_FN_PORT19_VIO_CKO2,
115 GPIO_FN_GPO0, 110 GPIO_FN_GPO0,
116 GPIO_FN_GPO1, 111 GPIO_FN_GPO1,
117 GPIO_FN_GPO2, GPIO_FN_STATUS0, 112 GPIO_FN_GPO2, GPIO_FN_STATUS0,
@@ -119,83 +114,44 @@ enum {
119 GPIO_FN_GPO4, GPIO_FN_STATUS2, 114 GPIO_FN_GPO4, GPIO_FN_STATUS2,
120 GPIO_FN_VINT, 115 GPIO_FN_VINT,
121 GPIO_FN_TCKON, 116 GPIO_FN_TCKON,
122 GPIO_FN_XDVFS1, GPIO_FN_PORT27_I2C_SCL2, GPIO_FN_PORT27_I2C_SCL3, \ 117 GPIO_FN_XDVFS1,
123 GPIO_FN_MFG0_OUT1, GPIO_FN_PORT27_IROUT, 118 GPIO_FN_MFG0_OUT1, GPIO_FN_PORT27_IROUT,
124 GPIO_FN_XDVFS2, GPIO_FN_PORT28_I2C_SDA2, GPIO_FN_PORT28_I2C_SDA3, \ 119 GPIO_FN_XDVFS2,
125 GPIO_FN_PORT28_TPU1TO1, 120 GPIO_FN_PORT28_TPU1TO1,
126 GPIO_FN_SIM_RST, GPIO_FN_PORT29_TPU1TO1, 121 GPIO_FN_SIM_RST, GPIO_FN_PORT29_TPU1TO1,
127 GPIO_FN_SIM_CLK, GPIO_FN_PORT30_VIO_CKOR, 122 GPIO_FN_SIM_CLK, GPIO_FN_PORT30_VIO_CKOR,
128 GPIO_FN_SIM_D, GPIO_FN_PORT31_IROUT, 123 GPIO_FN_SIM_D, GPIO_FN_PORT31_IROUT,
129 GPIO_FN_SCIFA4_TXD, 124 GPIO_FN_XWUP,
130 GPIO_FN_SCIFA4_RXD, GPIO_FN_XWUP,
131 GPIO_FN_SCIFA4_RTS_,
132 GPIO_FN_SCIFA4_CTS_,
133 GPIO_FN_FSIBOBT, GPIO_FN_FSIBIBT,
134 GPIO_FN_FSIBOLR, GPIO_FN_FSIBILR,
135 GPIO_FN_FSIBOSLD,
136 GPIO_FN_FSIBISLD,
137 GPIO_FN_VACK, 125 GPIO_FN_VACK,
138 GPIO_FN_XTAL1L, 126 GPIO_FN_XTAL1L,
139 GPIO_FN_SCIFA0_RTS_, GPIO_FN_FSICOSLDT2, 127 GPIO_FN_PORT49_IROUT,
140 GPIO_FN_SCIFA0_RXD, 128 GPIO_FN_BBIF2_TSYNC2, GPIO_FN_TPU2TO2,
141 GPIO_FN_SCIFA0_CTS_, GPIO_FN_FSICOSLDT1, 129
142 GPIO_FN_FSICOBT, GPIO_FN_FSICIBT, GPIO_FN_FSIDOBT, GPIO_FN_FSIDIBT, 130 GPIO_FN_BBIF2_TSCK2, GPIO_FN_TPU2TO3,
143 GPIO_FN_FSICOLR, GPIO_FN_FSICILR, GPIO_FN_FSIDOLR, GPIO_FN_FSIDILR, 131 GPIO_FN_BBIF2_TXD2,
144 GPIO_FN_FSICOSLD, GPIO_FN_PORT47_FSICSPDIF, 132 GPIO_FN_TPU3TO3,
145 GPIO_FN_FSICISLD, GPIO_FN_FSIDISLD, 133 GPIO_FN_TPU3TO2,
146 GPIO_FN_FSIACK, GPIO_FN_PORT49_IRDA_OUT, GPIO_FN_PORT49_IROUT, \ 134 GPIO_FN_TPU0TO0,
147 GPIO_FN_FSIAOMC,
148 GPIO_FN_FSIAOLR, GPIO_FN_BBIF2_TSYNC2, GPIO_FN_TPU2TO2, GPIO_FN_FSIAILR,
149
150 GPIO_FN_FSIAOBT, GPIO_FN_BBIF2_TSCK2, GPIO_FN_TPU2TO3, GPIO_FN_FSIAIBT,
151 GPIO_FN_FSIAOSLD, GPIO_FN_BBIF2_TXD2,
152 GPIO_FN_FSIASPDIF, GPIO_FN_PORT53_IRDA_IN, GPIO_FN_TPU3TO3, \
153 GPIO_FN_FSIBSPDIF, GPIO_FN_PORT53_FSICSPDIF,
154 GPIO_FN_FSIBCK, GPIO_FN_PORT54_IRDA_FIRSEL, GPIO_FN_TPU3TO2, \
155 GPIO_FN_FSIBOMC, GPIO_FN_FSICCK, GPIO_FN_FSICOMC,
156 GPIO_FN_FSIAISLD, GPIO_FN_TPU0TO0,
157 GPIO_FN_A0, GPIO_FN_BS_, 135 GPIO_FN_A0, GPIO_FN_BS_,
158 GPIO_FN_A12, GPIO_FN_PORT58_KEYOUT7, GPIO_FN_TPU4TO2, 136 GPIO_FN_A12, GPIO_FN_TPU4TO2,
159 GPIO_FN_A13, GPIO_FN_PORT59_KEYOUT6, GPIO_FN_TPU0TO1, 137 GPIO_FN_A13, GPIO_FN_TPU0TO1,
160 GPIO_FN_A14, GPIO_FN_KEYOUT5, 138 GPIO_FN_A14,
161 GPIO_FN_A15, GPIO_FN_KEYOUT4, 139 GPIO_FN_A15,
162 GPIO_FN_A16, GPIO_FN_KEYOUT3, GPIO_FN_MSIOF0_SS1, 140 GPIO_FN_A16, GPIO_FN_MSIOF0_SS1,
163 GPIO_FN_A17, GPIO_FN_KEYOUT2, GPIO_FN_MSIOF0_TSYNC, 141 GPIO_FN_A17, GPIO_FN_MSIOF0_TSYNC,
164 GPIO_FN_A18, GPIO_FN_KEYOUT1, GPIO_FN_MSIOF0_TSCK, 142 GPIO_FN_A18, GPIO_FN_MSIOF0_TSCK,
165 GPIO_FN_A19, GPIO_FN_KEYOUT0, GPIO_FN_MSIOF0_TXD, 143 GPIO_FN_A19, GPIO_FN_MSIOF0_TXD,
166 GPIO_FN_A20, GPIO_FN_KEYIN0, GPIO_FN_MSIOF0_RSCK, 144 GPIO_FN_A20, GPIO_FN_MSIOF0_RSCK,
167 GPIO_FN_A21, GPIO_FN_KEYIN1, GPIO_FN_MSIOF0_RSYNC, 145 GPIO_FN_A21, GPIO_FN_MSIOF0_RSYNC,
168 GPIO_FN_A22, GPIO_FN_KEYIN2, GPIO_FN_MSIOF0_MCK0, 146 GPIO_FN_A22, GPIO_FN_MSIOF0_MCK0,
169 GPIO_FN_A23, GPIO_FN_KEYIN3, GPIO_FN_MSIOF0_MCK1, 147 GPIO_FN_A23, GPIO_FN_MSIOF0_MCK1,
170 GPIO_FN_A24, GPIO_FN_KEYIN4, GPIO_FN_MSIOF0_RXD, 148 GPIO_FN_A24, GPIO_FN_MSIOF0_RXD,
171 GPIO_FN_A25, GPIO_FN_KEYIN5, GPIO_FN_MSIOF0_SS2, 149 GPIO_FN_A25, GPIO_FN_MSIOF0_SS2,
172 GPIO_FN_A26, GPIO_FN_KEYIN6, 150 GPIO_FN_A26,
173 GPIO_FN_KEYIN7, 151 GPIO_FN_FCE1_,
174 GPIO_FN_D0_NAF0, 152 GPIO_FN_DACK0,
175 GPIO_FN_D1_NAF1, 153 GPIO_FN_FCE0_,
176 GPIO_FN_D2_NAF2,
177 GPIO_FN_D3_NAF3,
178 GPIO_FN_D4_NAF4,
179 GPIO_FN_D5_NAF5,
180 GPIO_FN_D6_NAF6,
181 GPIO_FN_D7_NAF7,
182 GPIO_FN_D8_NAF8,
183 GPIO_FN_D9_NAF9,
184 GPIO_FN_D10_NAF10,
185 GPIO_FN_D11_NAF11,
186 GPIO_FN_D12_NAF12,
187 GPIO_FN_D13_NAF13,
188 GPIO_FN_D14_NAF14,
189 GPIO_FN_D15_NAF15,
190 GPIO_FN_CS4_,
191 GPIO_FN_CS5A_, GPIO_FN_PORT91_RDWR,
192 GPIO_FN_CS5B_, GPIO_FN_FCE1_,
193 GPIO_FN_CS6B_, GPIO_FN_DACK0,
194 GPIO_FN_FCE0_, GPIO_FN_CS6A_,
195 GPIO_FN_WAIT_, GPIO_FN_DREQ0, 154 GPIO_FN_WAIT_, GPIO_FN_DREQ0,
196 GPIO_FN_RD__FSC,
197 GPIO_FN_WE0__FWE, GPIO_FN_RDWR_FWE,
198 GPIO_FN_WE1_,
199 GPIO_FN_FRB, 155 GPIO_FN_FRB,
200 GPIO_FN_CKO, 156 GPIO_FN_CKO,
201 GPIO_FN_NBRSTOUT_, 157 GPIO_FN_NBRSTOUT_,
@@ -204,145 +160,118 @@ enum {
204 GPIO_FN_BBIF2_RXD, 160 GPIO_FN_BBIF2_RXD,
205 GPIO_FN_BBIF2_SYNC, 161 GPIO_FN_BBIF2_SYNC,
206 GPIO_FN_BBIF2_SCK, 162 GPIO_FN_BBIF2_SCK,
207 GPIO_FN_SCIFA3_CTS_, GPIO_FN_MFG3_IN2, 163 GPIO_FN_MFG3_IN2,
208 GPIO_FN_SCIFA3_RXD, GPIO_FN_MFG3_IN1, 164 GPIO_FN_MFG3_IN1,
209 GPIO_FN_BBIF1_SS2, GPIO_FN_SCIFA3_RTS_, GPIO_FN_MFG3_OUT1, 165 GPIO_FN_BBIF1_SS2, GPIO_FN_MFG3_OUT1,
210 GPIO_FN_SCIFA3_TXD,
211 GPIO_FN_HSI_RX_DATA, GPIO_FN_BBIF1_RXD, 166 GPIO_FN_HSI_RX_DATA, GPIO_FN_BBIF1_RXD,
212 GPIO_FN_HSI_TX_WAKE, GPIO_FN_BBIF1_TSCK, 167 GPIO_FN_HSI_TX_WAKE, GPIO_FN_BBIF1_TSCK,
213 GPIO_FN_HSI_TX_DATA, GPIO_FN_BBIF1_TSYNC, 168 GPIO_FN_HSI_TX_DATA, GPIO_FN_BBIF1_TSYNC,
214 GPIO_FN_HSI_TX_READY, GPIO_FN_BBIF1_TXD, 169 GPIO_FN_HSI_TX_READY, GPIO_FN_BBIF1_TXD,
215 GPIO_FN_HSI_RX_READY, GPIO_FN_BBIF1_RSCK, GPIO_FN_PORT115_I2C_SCL2, \ 170 GPIO_FN_HSI_RX_READY, GPIO_FN_BBIF1_RSCK,
216 GPIO_FN_PORT115_I2C_SCL3, 171 GPIO_FN_HSI_RX_WAKE, GPIO_FN_BBIF1_RSYNC,
217 GPIO_FN_HSI_RX_WAKE, GPIO_FN_BBIF1_RSYNC, GPIO_FN_PORT116_I2C_SDA2, \
218 GPIO_FN_PORT116_I2C_SDA3,
219 GPIO_FN_HSI_RX_FLAG, GPIO_FN_BBIF1_SS1, GPIO_FN_BBIF1_FLOW, 172 GPIO_FN_HSI_RX_FLAG, GPIO_FN_BBIF1_SS1, GPIO_FN_BBIF1_FLOW,
220 GPIO_FN_HSI_TX_FLAG, 173 GPIO_FN_HSI_TX_FLAG,
221 GPIO_FN_VIO_VD, GPIO_FN_PORT128_LCD2VSYN, GPIO_FN_VIO2_VD, \ 174 GPIO_FN_VIO_VD, GPIO_FN_VIO2_VD,
222 GPIO_FN_LCD2D0, 175
223 176 GPIO_FN_VIO_HD,
224 GPIO_FN_VIO_HD, GPIO_FN_PORT129_LCD2HSYN, GPIO_FN_PORT129_LCD2CS_, \ 177 GPIO_FN_VIO2_HD,
225 GPIO_FN_VIO2_HD, GPIO_FN_LCD2D1, 178 GPIO_FN_VIO_D0, GPIO_FN_PORT130_MSIOF2_RXD,
226 GPIO_FN_VIO_D0, GPIO_FN_PORT130_MSIOF2_RXD, GPIO_FN_LCD2D10, 179 GPIO_FN_VIO_D1, GPIO_FN_PORT131_MSIOF2_SS1,
227 GPIO_FN_VIO_D1, GPIO_FN_PORT131_KEYOUT6, GPIO_FN_PORT131_MSIOF2_SS1, \ 180 GPIO_FN_VIO_D2, GPIO_FN_PORT132_MSIOF2_SS2,
228 GPIO_FN_PORT131_KEYOUT11, GPIO_FN_LCD2D11, 181 GPIO_FN_VIO_D3, GPIO_FN_MSIOF2_TSYNC,
229 GPIO_FN_VIO_D2, GPIO_FN_PORT132_KEYOUT7, GPIO_FN_PORT132_MSIOF2_SS2, \ 182 GPIO_FN_VIO_D4, GPIO_FN_MSIOF2_TXD,
230 GPIO_FN_PORT132_KEYOUT10, GPIO_FN_LCD2D12, 183 GPIO_FN_VIO_D5, GPIO_FN_MSIOF2_TSCK,
231 GPIO_FN_VIO_D3, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_LCD2D13, 184 GPIO_FN_VIO_D6,
232 GPIO_FN_VIO_D4, GPIO_FN_MSIOF2_TXD, GPIO_FN_LCD2D14, 185 GPIO_FN_VIO_D7,
233 GPIO_FN_VIO_D5, GPIO_FN_MSIOF2_TSCK, GPIO_FN_LCD2D15, 186 GPIO_FN_VIO_D8, GPIO_FN_VIO2_D0,
234 GPIO_FN_VIO_D6, GPIO_FN_PORT136_KEYOUT8, GPIO_FN_LCD2D16, 187 GPIO_FN_VIO_D9, GPIO_FN_VIO2_D1,
235 GPIO_FN_VIO_D7, GPIO_FN_PORT137_KEYOUT9, GPIO_FN_LCD2D17, 188 GPIO_FN_VIO_D10, GPIO_FN_TPU0TO2, GPIO_FN_VIO2_D2,
236 GPIO_FN_VIO_D8, GPIO_FN_PORT138_KEYOUT8, GPIO_FN_VIO2_D0, \ 189 GPIO_FN_VIO_D11, GPIO_FN_TPU0TO3, GPIO_FN_VIO2_D3,
237 GPIO_FN_LCD2D6, 190 GPIO_FN_VIO_D12, GPIO_FN_VIO2_D4,
238 GPIO_FN_VIO_D9, GPIO_FN_PORT139_KEYOUT9, GPIO_FN_VIO2_D1, \ 191 GPIO_FN_VIO_D13,
239 GPIO_FN_LCD2D7, 192 GPIO_FN_VIO2_D5,
240 GPIO_FN_VIO_D10, GPIO_FN_TPU0TO2, GPIO_FN_VIO2_D2, GPIO_FN_LCD2D8, 193 GPIO_FN_VIO_D14, GPIO_FN_VIO2_D6,
241 GPIO_FN_VIO_D11, GPIO_FN_TPU0TO3, GPIO_FN_VIO2_D3, GPIO_FN_LCD2D9, 194 GPIO_FN_VIO_D15, GPIO_FN_TPU1TO3,
242 GPIO_FN_VIO_D12, GPIO_FN_PORT142_KEYOUT10, GPIO_FN_VIO2_D4, \ 195 GPIO_FN_VIO2_D7,
243 GPIO_FN_LCD2D2, 196 GPIO_FN_VIO_CLK,
244 GPIO_FN_VIO_D13, GPIO_FN_PORT143_KEYOUT11, GPIO_FN_PORT143_KEYOUT6, \ 197 GPIO_FN_VIO2_CLK,
245 GPIO_FN_VIO2_D5, GPIO_FN_LCD2D3, 198 GPIO_FN_VIO_FIELD, GPIO_FN_VIO2_FIELD,
246 GPIO_FN_VIO_D14, GPIO_FN_PORT144_KEYOUT7, GPIO_FN_VIO2_D6, \
247 GPIO_FN_LCD2D4,
248 GPIO_FN_VIO_D15, GPIO_FN_TPU1TO3, GPIO_FN_PORT145_LCD2DISP, \
249 GPIO_FN_PORT145_LCD2RS, GPIO_FN_VIO2_D7, GPIO_FN_LCD2D5,
250 GPIO_FN_VIO_CLK, GPIO_FN_LCD2DCK, GPIO_FN_PORT146_LCD2WR_, \
251 GPIO_FN_VIO2_CLK, GPIO_FN_LCD2D18,
252 GPIO_FN_VIO_FIELD, GPIO_FN_LCD2RD_, GPIO_FN_VIO2_FIELD, GPIO_FN_LCD2D19,
253 GPIO_FN_VIO_CKO, 199 GPIO_FN_VIO_CKO,
254 GPIO_FN_A27, GPIO_FN_PORT149_RDWR, GPIO_FN_MFG0_IN1, \ 200 GPIO_FN_A27, GPIO_FN_MFG0_IN1,
255 GPIO_FN_PORT149_KEYOUT9,
256 GPIO_FN_MFG0_IN2, 201 GPIO_FN_MFG0_IN2,
257 GPIO_FN_TS_SPSYNC3, GPIO_FN_MSIOF2_RSCK, 202 GPIO_FN_TS_SPSYNC3, GPIO_FN_MSIOF2_RSCK,
258 GPIO_FN_TS_SDAT3, GPIO_FN_MSIOF2_RSYNC, 203 GPIO_FN_TS_SDAT3, GPIO_FN_MSIOF2_RSYNC,
259 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT153_MSIOF2_SS1, 204 GPIO_FN_TPU1TO2, GPIO_FN_TS_SDEN3, GPIO_FN_PORT153_MSIOF2_SS1,
260 GPIO_FN_SCIFA2_TXD1, GPIO_FN_MSIOF2_MCK0, 205 GPIO_FN_MSIOF2_MCK0,
261 GPIO_FN_SCIFA2_RXD1, GPIO_FN_MSIOF2_MCK1, 206 GPIO_FN_MSIOF2_MCK1,
262 GPIO_FN_SCIFA2_RTS1_, GPIO_FN_PORT156_MSIOF2_SS2, 207 GPIO_FN_PORT156_MSIOF2_SS2,
263 GPIO_FN_SCIFA2_CTS1_, GPIO_FN_PORT157_MSIOF2_RXD, 208 GPIO_FN_PORT157_MSIOF2_RXD,
264 GPIO_FN_DINT_, GPIO_FN_SCIFA2_SCK1, GPIO_FN_TS_SCK3, 209 GPIO_FN_DINT_, GPIO_FN_TS_SCK3,
265 GPIO_FN_PORT159_SCIFB_SCK, GPIO_FN_PORT159_SCIFA5_SCK, GPIO_FN_NMI, 210 GPIO_FN_NMI,
266 GPIO_FN_PORT160_SCIFB_TXD, GPIO_FN_PORT160_SCIFA5_TXD,
267 GPIO_FN_PORT161_SCIFB_CTS_, GPIO_FN_PORT161_SCIFA5_CTS_,
268 GPIO_FN_PORT162_SCIFB_RXD, GPIO_FN_PORT162_SCIFA5_RXD,
269 GPIO_FN_PORT163_SCIFB_RTS_, GPIO_FN_PORT163_SCIFA5_RTS_, \
270 GPIO_FN_TPU3TO0, 211 GPIO_FN_TPU3TO0,
271 GPIO_FN_LCDD0, 212 GPIO_FN_BBIF2_TSYNC1,
272 GPIO_FN_LCDD1, GPIO_FN_PORT193_SCIFA5_CTS_, GPIO_FN_BBIF2_TSYNC1, 213 GPIO_FN_BBIF2_TSCK1,
273 GPIO_FN_LCDD2, GPIO_FN_PORT194_SCIFA5_RTS_, GPIO_FN_BBIF2_TSCK1, 214 GPIO_FN_BBIF2_TXD1,
274 GPIO_FN_LCDD3, GPIO_FN_PORT195_SCIFA5_RXD, GPIO_FN_BBIF2_TXD1, 215 GPIO_FN_MFG2_OUT2,
275 GPIO_FN_LCDD4, GPIO_FN_PORT196_SCIFA5_TXD,
276 GPIO_FN_LCDD5, GPIO_FN_PORT197_SCIFA5_SCK, GPIO_FN_MFG2_OUT2, \
277 GPIO_FN_TPU2TO1, 216 GPIO_FN_TPU2TO1,
278 GPIO_FN_LCDD6, 217 GPIO_FN_TPU4TO1, GPIO_FN_MFG4_OUT2,
279 GPIO_FN_LCDD7, GPIO_FN_TPU4TO1, GPIO_FN_MFG4_OUT2, 218 GPIO_FN_D16,
280 GPIO_FN_LCDD8, GPIO_FN_D16, 219 GPIO_FN_D17,
281 GPIO_FN_LCDD9, GPIO_FN_D17, 220 GPIO_FN_D18,
282 GPIO_FN_LCDD10, GPIO_FN_D18, 221 GPIO_FN_D19,
283 GPIO_FN_LCDD11, GPIO_FN_D19, 222 GPIO_FN_D20,
284 GPIO_FN_LCDD12, GPIO_FN_D20, 223 GPIO_FN_D21,
285 GPIO_FN_LCDD13, GPIO_FN_D21, 224 GPIO_FN_D22,
286 GPIO_FN_LCDD14, GPIO_FN_D22, 225 GPIO_FN_PORT207_MSIOF0L_SS1, GPIO_FN_D23,
287 GPIO_FN_LCDD15, GPIO_FN_PORT207_MSIOF0L_SS1, GPIO_FN_D23, 226 GPIO_FN_PORT208_MSIOF0L_SS2, GPIO_FN_D24,
288 GPIO_FN_LCDD16, GPIO_FN_PORT208_MSIOF0L_SS2, GPIO_FN_D24, 227 GPIO_FN_D25,
289 GPIO_FN_LCDD17, GPIO_FN_D25, 228 GPIO_FN_DREQ2, GPIO_FN_PORT210_MSIOF0L_SS1, GPIO_FN_D26,
290 GPIO_FN_LCDD18, GPIO_FN_DREQ2, GPIO_FN_PORT210_MSIOF0L_SS1, GPIO_FN_D26, 229 GPIO_FN_PORT211_MSIOF0L_SS2, GPIO_FN_D27,
291 GPIO_FN_LCDD19, GPIO_FN_PORT211_MSIOF0L_SS2, GPIO_FN_D27, 230 GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0, GPIO_FN_D28,
292 GPIO_FN_LCDD20, GPIO_FN_TS_SPSYNC1, GPIO_FN_MSIOF0L_MCK0, GPIO_FN_D28, 231 GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1, GPIO_FN_D29,
293 GPIO_FN_LCDD21, GPIO_FN_TS_SDAT1, GPIO_FN_MSIOF0L_MCK1, GPIO_FN_D29, 232 GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_RSCK, GPIO_FN_D30,
294 GPIO_FN_LCDD22, GPIO_FN_TS_SDEN1, GPIO_FN_MSIOF0L_RSCK, GPIO_FN_D30, 233 GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_RSYNC, GPIO_FN_D31,
295 GPIO_FN_LCDD23, GPIO_FN_TS_SCK1, GPIO_FN_MSIOF0L_RSYNC, GPIO_FN_D31, 234 GPIO_FN_DACK2,
296 GPIO_FN_LCDDCK, GPIO_FN_LCDWR_, 235 GPIO_FN_MSIOF0L_TSYNC, GPIO_FN_VIO2_FIELD3,
297 GPIO_FN_LCDRD_, GPIO_FN_DACK2, GPIO_FN_PORT217_LCD2RS, \ 236 GPIO_FN_DACK3,
298 GPIO_FN_MSIOF0L_TSYNC, GPIO_FN_VIO2_FIELD3, GPIO_FN_PORT217_LCD2DISP,
299 GPIO_FN_LCDHSYN, GPIO_FN_LCDCS_, GPIO_FN_LCDCS2_, GPIO_FN_DACK3, \
300 GPIO_FN_PORT218_VIO_CKOR, 237 GPIO_FN_PORT218_VIO_CKOR,
301 GPIO_FN_LCDDISP, GPIO_FN_LCDRS, GPIO_FN_PORT219_LCD2WR_, \
302 GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_TSCK, GPIO_FN_VIO2_CLK3, \ 238 GPIO_FN_DREQ3, GPIO_FN_MSIOF0L_TSCK, GPIO_FN_VIO2_CLK3, \
303 GPIO_FN_LCD2DCK_2, 239 GPIO_FN_DREQ1,
304 GPIO_FN_LCDVSYN, GPIO_FN_LCDVSYN2,
305 GPIO_FN_LCDLCLK, GPIO_FN_DREQ1, GPIO_FN_PORT221_LCD2CS_, \
306 GPIO_FN_PWEN, GPIO_FN_MSIOF0L_RXD, GPIO_FN_VIO2_HD3, \ 240 GPIO_FN_PWEN, GPIO_FN_MSIOF0L_RXD, GPIO_FN_VIO2_HD3, \
307 GPIO_FN_PORT221_LCD2HSYN, 241 GPIO_FN_DACK1, GPIO_FN_OVCN,
308 GPIO_FN_LCDDON, GPIO_FN_LCDDON2, GPIO_FN_DACK1, GPIO_FN_OVCN, \ 242 GPIO_FN_MSIOF0L_TXD, GPIO_FN_VIO2_VD3,
309 GPIO_FN_MSIOF0L_TXD, GPIO_FN_VIO2_VD3, GPIO_FN_PORT222_LCD2VSYN, 243
310 244 GPIO_FN_OVCN2,
311 GPIO_FN_SCIFA1_TXD, GPIO_FN_OVCN2, 245 GPIO_FN_EXTLP, GPIO_FN_PORT226_VIO_CKO2,
312 GPIO_FN_EXTLP, GPIO_FN_SCIFA1_SCK, GPIO_FN_PORT226_VIO_CKO2, 246 GPIO_FN_IDIN,
313 GPIO_FN_SCIFA1_RTS_, GPIO_FN_IDIN, 247 GPIO_FN_MFG1_IN1,
314 GPIO_FN_SCIFA1_RXD, 248 GPIO_FN_MSIOF1_TXD,
315 GPIO_FN_SCIFA1_CTS_, GPIO_FN_MFG1_IN1, 249 GPIO_FN_MSIOF1_TSYNC,
316 GPIO_FN_MSIOF1_TXD, GPIO_FN_SCIFA2_TXD2, 250 GPIO_FN_MSIOF1_TSCK,
317 GPIO_FN_MSIOF1_TSYNC, GPIO_FN_SCIFA2_CTS2_, 251 GPIO_FN_MSIOF1_RXD,
318 GPIO_FN_MSIOF1_TSCK, GPIO_FN_SCIFA2_SCK2, 252 GPIO_FN_MSIOF1_RSCK, GPIO_FN_VIO2_CLK2,
319 GPIO_FN_MSIOF1_RXD, GPIO_FN_SCIFA2_RXD2,
320 GPIO_FN_MSIOF1_RSCK, GPIO_FN_SCIFA2_RTS2_, GPIO_FN_VIO2_CLK2, \
321 GPIO_FN_LCD2D20,
322 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_MFG1_IN2, GPIO_FN_VIO2_VD2, \ 253 GPIO_FN_MSIOF1_RSYNC, GPIO_FN_MFG1_IN2, GPIO_FN_VIO2_VD2, \
323 GPIO_FN_LCD2D21, 254 GPIO_FN_MSIOF1_MCK0,
324 GPIO_FN_MSIOF1_MCK0, GPIO_FN_PORT236_I2C_SDA2, 255 GPIO_FN_MSIOF1_MCK1,
325 GPIO_FN_MSIOF1_MCK1, GPIO_FN_PORT237_I2C_SCL2, 256 GPIO_FN_MSIOF1_SS1, GPIO_FN_VIO2_FIELD2,
326 GPIO_FN_MSIOF1_SS1, GPIO_FN_VIO2_FIELD2, GPIO_FN_LCD2D22, 257 GPIO_FN_MSIOF1_SS2, GPIO_FN_VIO2_HD2,
327 GPIO_FN_MSIOF1_SS2, GPIO_FN_VIO2_HD2, GPIO_FN_LCD2D23, 258 GPIO_FN_PORT241_IROUT, GPIO_FN_MFG4_OUT1, \
328 GPIO_FN_SCIFA6_TXD,
329 GPIO_FN_PORT241_IRDA_OUT, GPIO_FN_PORT241_IROUT, GPIO_FN_MFG4_OUT1, \
330 GPIO_FN_TPU4TO0, 259 GPIO_FN_TPU4TO0,
331 GPIO_FN_PORT242_IRDA_IN, GPIO_FN_MFG4_IN2, 260 GPIO_FN_MFG4_IN2,
332 GPIO_FN_PORT243_IRDA_FIRSEL, GPIO_FN_PORT243_VIO_CKO2, 261 GPIO_FN_PORT243_VIO_CKO2,
333 GPIO_FN_PORT244_SCIFA5_CTS_, GPIO_FN_MFG2_IN1, \ 262 GPIO_FN_MFG2_IN1,
334 GPIO_FN_PORT244_SCIFB_CTS_, GPIO_FN_MSIOF2R_RXD, 263 GPIO_FN_MSIOF2R_RXD,
335 GPIO_FN_PORT245_SCIFA5_RTS_, GPIO_FN_MFG2_IN2, \ 264 GPIO_FN_MFG2_IN2,
336 GPIO_FN_PORT245_SCIFB_RTS_, GPIO_FN_MSIOF2R_TXD, 265 GPIO_FN_MSIOF2R_TXD,
337 GPIO_FN_PORT246_SCIFA5_RXD, GPIO_FN_MFG1_OUT1, \ 266 GPIO_FN_MFG1_OUT1,
338 GPIO_FN_PORT246_SCIFB_RXD, GPIO_FN_TPU1TO0, 267 GPIO_FN_TPU1TO0,
339 GPIO_FN_PORT247_SCIFA5_TXD, GPIO_FN_MFG3_OUT2, \ 268 GPIO_FN_MFG3_OUT2,
340 GPIO_FN_PORT247_SCIFB_TXD, GPIO_FN_TPU3TO1, 269 GPIO_FN_TPU3TO1,
341 GPIO_FN_PORT248_SCIFA5_SCK, GPIO_FN_MFG2_OUT1, \ 270 GPIO_FN_MFG2_OUT1,
342 GPIO_FN_PORT248_SCIFB_SCK, GPIO_FN_TPU2TO0, \ 271 GPIO_FN_TPU2TO0,
343 GPIO_FN_PORT248_I2C_SCL3, GPIO_FN_MSIOF2R_TSCK, 272 GPIO_FN_MSIOF2R_TSCK,
344 GPIO_FN_PORT249_IROUT, GPIO_FN_MFG4_IN1, \ 273 GPIO_FN_PORT249_IROUT, GPIO_FN_MFG4_IN1, \
345 GPIO_FN_PORT249_I2C_SDA3, GPIO_FN_MSIOF2R_TSYNC, 274 GPIO_FN_MSIOF2R_TSYNC,
346 GPIO_FN_SDHICLK0, 275 GPIO_FN_SDHICLK0,
347 GPIO_FN_SDHICD0, 276 GPIO_FN_SDHICD0,
348 GPIO_FN_SDHID0_0, 277 GPIO_FN_SDHID0_0,
@@ -435,54 +364,12 @@ enum {
435 GPIO_FN_IRQ9_MEM_INT, 364 GPIO_FN_IRQ9_MEM_INT,
436 GPIO_FN_IRQ9_MCP_INT, 365 GPIO_FN_IRQ9_MCP_INT,
437 GPIO_FN_A11, 366 GPIO_FN_A11,
438 GPIO_FN_KEYOUT8,
439 GPIO_FN_TPU4TO3, 367 GPIO_FN_TPU4TO3,
440 GPIO_FN_RESETA_N_PU_ON, 368 GPIO_FN_RESETA_N_PU_ON,
441 GPIO_FN_RESETA_N_PU_OFF, 369 GPIO_FN_RESETA_N_PU_OFF,
442 GPIO_FN_EDBGREQ_PD, 370 GPIO_FN_EDBGREQ_PD,
443 GPIO_FN_EDBGREQ_PU, 371 GPIO_FN_EDBGREQ_PU,
444 372
445 /* Functions with pull-ups */
446 GPIO_FN_KEYIN0_PU,
447 GPIO_FN_KEYIN1_PU,
448 GPIO_FN_KEYIN2_PU,
449 GPIO_FN_KEYIN3_PU,
450 GPIO_FN_KEYIN4_PU,
451 GPIO_FN_KEYIN5_PU,
452 GPIO_FN_KEYIN6_PU,
453 GPIO_FN_KEYIN7_PU,
454 GPIO_FN_SDHICD0_PU,
455 GPIO_FN_SDHID0_0_PU,
456 GPIO_FN_SDHID0_1_PU,
457 GPIO_FN_SDHID0_2_PU,
458 GPIO_FN_SDHID0_3_PU,
459 GPIO_FN_SDHICMD0_PU,
460 GPIO_FN_SDHIWP0_PU,
461 GPIO_FN_SDHID1_0_PU,
462 GPIO_FN_SDHID1_1_PU,
463 GPIO_FN_SDHID1_2_PU,
464 GPIO_FN_SDHID1_3_PU,
465 GPIO_FN_SDHICMD1_PU,
466 GPIO_FN_SDHID2_0_PU,
467 GPIO_FN_SDHID2_1_PU,
468 GPIO_FN_SDHID2_2_PU,
469 GPIO_FN_SDHID2_3_PU,
470 GPIO_FN_SDHICMD2_PU,
471 GPIO_FN_MMCCMD0_PU,
472 GPIO_FN_MMCCMD1_PU,
473 GPIO_FN_MMCD0_0_PU,
474 GPIO_FN_MMCD0_1_PU,
475 GPIO_FN_MMCD0_2_PU,
476 GPIO_FN_MMCD0_3_PU,
477 GPIO_FN_MMCD0_4_PU,
478 GPIO_FN_MMCD0_5_PU,
479 GPIO_FN_MMCD0_6_PU,
480 GPIO_FN_MMCD0_7_PU,
481 GPIO_FN_FSIACK_PU,
482 GPIO_FN_FSIAILR_PU,
483 GPIO_FN_FSIAIBT_PU,
484 GPIO_FN_FSIAISLD_PU,
485
486 /* end of GPIO */ 373 /* end of GPIO */
487 GPIO_NR, 374 GPIO_NR,
488}; 375};
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 8807c27f71f9..b86dc8908724 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -19,12 +19,16 @@
19 */ 19 */
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h>
22#include <linux/interrupt.h> 23#include <linux/interrupt.h>
23#include <linux/irq.h> 24#include <linux/irq.h>
24#include <linux/io.h> 25#include <linux/io.h>
25#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
27#include <linux/platform_data/irq-renesas-intc-irqpin.h>
28#include <linux/irqchip.h>
26#include <mach/common.h> 29#include <mach/common.h>
27#include <mach/intc.h> 30#include <mach/intc.h>
31#include <mach/irqs.h>
28#include <mach/r8a7779.h> 32#include <mach/r8a7779.h>
29#include <asm/mach-types.h> 33#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
@@ -38,18 +42,61 @@
38#define INT2NTSR0 IOMEM(0xfe700060) 42#define INT2NTSR0 IOMEM(0xfe700060)
39#define INT2NTSR1 IOMEM(0xfe700064) 43#define INT2NTSR1 IOMEM(0xfe700064)
40 44
45static struct renesas_intc_irqpin_config irqpin0_platform_data = {
46 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
47 .sense_bitfield_width = 2,
48};
49
50static struct resource irqpin0_resources[] = {
51 DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
52 DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
53 DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
54 DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
55 DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */
56 DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */
57 DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */
58 DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */
59 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
60};
61
62static struct platform_device irqpin0_device = {
63 .name = "renesas_intc_irqpin",
64 .id = 0,
65 .resource = irqpin0_resources,
66 .num_resources = ARRAY_SIZE(irqpin0_resources),
67 .dev = {
68 .platform_data = &irqpin0_platform_data,
69 },
70};
71
72void __init r8a7779_init_irq_extpin(int irlm)
73{
74 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
75 unsigned long tmp;
76
77 if (icr0) {
78 tmp = ioread32(icr0);
79 if (irlm)
80 tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */
81 else
82 tmp &= ~(1 << 23); /* IRL mode - not supported */
83 tmp |= (1 << 21); /* LVLMODE = 1 */
84 iowrite32(tmp, icr0);
85 iounmap(icr0);
86
87 if (irlm)
88 platform_device_register(&irqpin0_device);
89 } else
90 pr_warn("r8a7779: unable to setup external irq pin mode\n");
91}
92
41static int r8a7779_set_wake(struct irq_data *data, unsigned int on) 93static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
42{ 94{
43 return 0; /* always allow wakeup */ 95 return 0; /* always allow wakeup */
44} 96}
45 97
46void __init r8a7779_init_irq(void) 98static void __init r8a7779_init_irq_common(void)
47{ 99{
48 void __iomem *gic_dist_base = IOMEM(0xf0001000);
49 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
50
51 /* use GIC to handle interrupts */
52 gic_init(0, 29, gic_dist_base, gic_cpu_base);
53 gic_arch_extn.irq_set_wake = r8a7779_set_wake; 100 gic_arch_extn.irq_set_wake = r8a7779_set_wake;
54 101
55 /* route all interrupts to ARM */ 102 /* route all interrupts to ARM */
@@ -63,3 +110,22 @@ void __init r8a7779_init_irq(void)
63 __raw_writel(0xbffffffc, INT2SMSKCR3); 110 __raw_writel(0xbffffffc, INT2SMSKCR3);
64 __raw_writel(0x003fee3f, INT2SMSKCR4); 111 __raw_writel(0x003fee3f, INT2SMSKCR4);
65} 112}
113
114void __init r8a7779_init_irq(void)
115{
116 void __iomem *gic_dist_base = IOMEM(0xf0001000);
117 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
118
119 /* use GIC to handle interrupts */
120 gic_init(0, 29, gic_dist_base, gic_cpu_base);
121
122 r8a7779_init_irq_common();
123}
124
125#ifdef CONFIG_OF
126void __init r8a7779_init_irq_dt(void)
127{
128 irqchip_init();
129 r8a7779_init_irq_common();
130}
131#endif
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 91faba666d46..19a26f4579b3 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -260,108 +260,6 @@ static int sh73a0_set_wake(struct irq_data *data, unsigned int on)
260 return 0; /* always allow wakeup */ 260 return 0; /* always allow wakeup */
261} 261}
262 262
263#define RELOC_BASE 0x1200
264
265/* INTCA IRQ pins at INTCS + RELOC_BASE to make space for GIC+INTC handling */
266#define INTCS_VECT_RELOC(n, vect) INTCS_VECT((n), (vect) + RELOC_BASE)
267
268INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000,
269 INTCS_VECT_RELOC, "sh73a0-intca-irq-pins");
270
271static int to_gic_irq(struct irq_data *data)
272{
273 unsigned int vect = irq2evt(data->irq) - INTCS_VECT_BASE;
274
275 if (vect >= 0x3200)
276 vect -= 0x3000;
277 else
278 vect -= 0x0200;
279
280 return gic_spi((vect >> 5) + 1);
281}
282
283static int to_intca_reloc_irq(struct irq_data *data)
284{
285 return data->irq + (RELOC_BASE >> 5);
286}
287
288#define irq_cb(cb, irq) irq_get_chip(irq)->cb(irq_get_irq_data(irq))
289#define irq_cbp(cb, irq, p...) irq_get_chip(irq)->cb(irq_get_irq_data(irq), p)
290
291static void intca_gic_enable(struct irq_data *data)
292{
293 irq_cb(irq_unmask, to_intca_reloc_irq(data));
294 irq_cb(irq_unmask, to_gic_irq(data));
295}
296
297static void intca_gic_disable(struct irq_data *data)
298{
299 irq_cb(irq_mask, to_gic_irq(data));
300 irq_cb(irq_mask, to_intca_reloc_irq(data));
301}
302
303static void intca_gic_mask_ack(struct irq_data *data)
304{
305 irq_cb(irq_mask, to_gic_irq(data));
306 irq_cb(irq_mask_ack, to_intca_reloc_irq(data));
307}
308
309static void intca_gic_eoi(struct irq_data *data)
310{
311 irq_cb(irq_eoi, to_gic_irq(data));
312}
313
314static int intca_gic_set_type(struct irq_data *data, unsigned int type)
315{
316 return irq_cbp(irq_set_type, to_intca_reloc_irq(data), type);
317}
318
319#ifdef CONFIG_SMP
320static int intca_gic_set_affinity(struct irq_data *data,
321 const struct cpumask *cpumask,
322 bool force)
323{
324 return irq_cbp(irq_set_affinity, to_gic_irq(data), cpumask, force);
325}
326#endif
327
328struct irq_chip intca_gic_irq_chip = {
329 .name = "INTCA-GIC",
330 .irq_mask = intca_gic_disable,
331 .irq_unmask = intca_gic_enable,
332 .irq_mask_ack = intca_gic_mask_ack,
333 .irq_eoi = intca_gic_eoi,
334 .irq_enable = intca_gic_enable,
335 .irq_disable = intca_gic_disable,
336 .irq_shutdown = intca_gic_disable,
337 .irq_set_type = intca_gic_set_type,
338 .irq_set_wake = sh73a0_set_wake,
339#ifdef CONFIG_SMP
340 .irq_set_affinity = intca_gic_set_affinity,
341#endif
342};
343
344static int to_intc_vect(int irq)
345{
346 unsigned int irq_pin = irq - gic_spi(1);
347 unsigned int offs;
348
349 if (irq_pin < 16)
350 offs = 0x0200;
351 else
352 offs = 0x3000;
353
354 return offs + (irq_pin << 5);
355}
356
357static irqreturn_t sh73a0_irq_pin_demux(int irq, void *dev_id)
358{
359 generic_handle_irq(intcs_evt2irq(to_intc_vect(irq)));
360 return IRQ_HANDLED;
361}
362
363static struct irqaction sh73a0_irq_pin_cascade[32];
364
365#define PINTER0_PHYS 0xe69000a0 263#define PINTER0_PHYS 0xe69000a0
366#define PINTER1_PHYS 0xe69000a4 264#define PINTER1_PHYS 0xe69000a4
367#define PINTER0_VIRT IOMEM(0xe69000a0) 265#define PINTER0_VIRT IOMEM(0xe69000a0)
@@ -422,13 +320,11 @@ void __init sh73a0_init_irq(void)
422 void __iomem *gic_dist_base = IOMEM(0xf0001000); 320 void __iomem *gic_dist_base = IOMEM(0xf0001000);
423 void __iomem *gic_cpu_base = IOMEM(0xf0000100); 321 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
424 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); 322 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
425 int k, n;
426 323
427 gic_init(0, 29, gic_dist_base, gic_cpu_base); 324 gic_init(0, 29, gic_dist_base, gic_cpu_base);
428 gic_arch_extn.irq_set_wake = sh73a0_set_wake; 325 gic_arch_extn.irq_set_wake = sh73a0_set_wake;
429 326
430 register_intc_controller(&intcs_desc); 327 register_intc_controller(&intcs_desc);
431 register_intc_controller(&intca_irq_pins_desc);
432 register_intc_controller(&intc_pint0_desc); 328 register_intc_controller(&intc_pint0_desc);
433 register_intc_controller(&intc_pint1_desc); 329 register_intc_controller(&intc_pint1_desc);
434 330
@@ -438,19 +334,6 @@ void __init sh73a0_init_irq(void)
438 sh73a0_intcs_cascade.dev_id = intevtsa; 334 sh73a0_intcs_cascade.dev_id = intevtsa;
439 setup_irq(gic_spi(50), &sh73a0_intcs_cascade); 335 setup_irq(gic_spi(50), &sh73a0_intcs_cascade);
440 336
441 /* IRQ pins require special handling through INTCA and GIC */
442 for (k = 0; k < 32; k++) {
443 sh73a0_irq_pin_cascade[k].name = "INTCA-GIC cascade";
444 sh73a0_irq_pin_cascade[k].handler = sh73a0_irq_pin_demux;
445 setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]);
446
447 n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k)));
448 WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n);
449 irq_set_chip_and_handler_name(n, &intca_gic_irq_chip,
450 handle_level_irq, "level");
451 set_irq_flags(n, IRQF_VALID); /* yuck */
452 }
453
454 /* PINT pins are sanely tied to the GIC as SPI */ 337 /* PINT pins are sanely tied to the GIC as SPI */
455 sh73a0_pint0_cascade.name = "PINT0 cascade"; 338 sh73a0_pint0_cascade.name = "PINT0 cascade";
456 sh73a0_pint0_cascade.handler = sh73a0_pint0_demux; 339 sh73a0_pint0_cascade.handler = sh73a0_pint0_demux;
@@ -460,11 +343,3 @@ void __init sh73a0_init_irq(void)
460 sh73a0_pint1_cascade.handler = sh73a0_pint1_demux; 343 sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;
461 setup_irq(gic_spi(34), &sh73a0_pint1_cascade); 344 setup_irq(gic_spi(34), &sh73a0_pint1_cascade);
462} 345}
463
464#ifdef CONFIG_OF
465void __init sh73a0_init_irq_dt(void)
466{
467 irqchip_init();
468 gic_arch_extn.irq_set_wake = sh73a0_set_wake;
469}
470#endif
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index a0826a48dd08..dec9293bb90d 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -410,11 +410,9 @@ static int sh7372_enter_a4s(struct cpuidle_device *dev,
410static struct cpuidle_driver sh7372_cpuidle_driver = { 410static struct cpuidle_driver sh7372_cpuidle_driver = {
411 .name = "sh7372_cpuidle", 411 .name = "sh7372_cpuidle",
412 .owner = THIS_MODULE, 412 .owner = THIS_MODULE,
413 .en_core_tk_irqen = 1,
414 .state_count = 5, 413 .state_count = 5,
415 .safe_state_index = 0, /* C1 */ 414 .safe_state_index = 0, /* C1 */
416 .states[0] = ARM_CPUIDLE_WFI_STATE, 415 .states[0] = ARM_CPUIDLE_WFI_STATE,
417 .states[0].enter = shmobile_enter_wfi,
418 .states[1] = { 416 .states[1] = {
419 .name = "C2", 417 .name = "C2",
420 .desc = "Core Standby Mode", 418 .desc = "Core Standby Mode",
@@ -450,12 +448,12 @@ static struct cpuidle_driver sh7372_cpuidle_driver = {
450 }, 448 },
451}; 449};
452 450
453static void sh7372_cpuidle_init(void) 451static void __init sh7372_cpuidle_init(void)
454{ 452{
455 shmobile_cpuidle_set_driver(&sh7372_cpuidle_driver); 453 shmobile_cpuidle_set_driver(&sh7372_cpuidle_driver);
456} 454}
457#else 455#else
458static void sh7372_cpuidle_init(void) {} 456static void __init sh7372_cpuidle_init(void) {}
459#endif 457#endif
460 458
461#ifdef CONFIG_SUSPEND 459#ifdef CONFIG_SUSPEND
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 47662a581c0a..e4545c152722 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -404,7 +404,7 @@ void __init emev2_add_standard_devices(void)
404 ARRAY_SIZE(emev2_late_devices)); 404 ARRAY_SIZE(emev2_late_devices));
405} 405}
406 406
407void __init emev2_init_delay(void) 407static void __init emev2_init_delay(void)
408{ 408{
409 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ 409 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
410} 410}
@@ -439,7 +439,7 @@ static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
439 { } 439 { }
440}; 440};
441 441
442void __init emev2_add_standard_devices_dt(void) 442static void __init emev2_add_standard_devices_dt(void)
443{ 443{
444 of_platform_populate(NULL, of_default_bus_match_table, 444 of_platform_populate(NULL, of_default_bus_match_table,
445 emev2_auxdata_lookup, NULL); 445 emev2_auxdata_lookup, NULL);
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index c54ff9b29fe5..042df35e71a0 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/of_platform.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/delay.h> 26#include <linux/delay.h>
26#include <linux/input.h> 27#include <linux/input.h>
@@ -28,6 +29,7 @@
28#include <linux/serial_sci.h> 29#include <linux/serial_sci.h>
29#include <linux/sh_intc.h> 30#include <linux/sh_intc.h>
30#include <linux/sh_timer.h> 31#include <linux/sh_timer.h>
32#include <linux/dma-mapping.h>
31#include <mach/hardware.h> 33#include <mach/hardware.h>
32#include <mach/irqs.h> 34#include <mach/irqs.h>
33#include <mach/r8a7779.h> 35#include <mach/r8a7779.h>
@@ -91,7 +93,7 @@ static struct plat_sci_port scif0_platform_data = {
91 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 93 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
92 .scbrr_algo_id = SCBRR_ALGO_2, 94 .scbrr_algo_id = SCBRR_ALGO_2,
93 .type = PORT_SCIF, 95 .type = PORT_SCIF,
94 .irqs = SCIx_IRQ_MUXED(gic_spi(88)), 96 .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)),
95}; 97};
96 98
97static struct platform_device scif0_device = { 99static struct platform_device scif0_device = {
@@ -108,7 +110,7 @@ static struct plat_sci_port scif1_platform_data = {
108 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 110 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
109 .scbrr_algo_id = SCBRR_ALGO_2, 111 .scbrr_algo_id = SCBRR_ALGO_2,
110 .type = PORT_SCIF, 112 .type = PORT_SCIF,
111 .irqs = SCIx_IRQ_MUXED(gic_spi(89)), 113 .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)),
112}; 114};
113 115
114static struct platform_device scif1_device = { 116static struct platform_device scif1_device = {
@@ -125,7 +127,7 @@ static struct plat_sci_port scif2_platform_data = {
125 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 127 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
126 .scbrr_algo_id = SCBRR_ALGO_2, 128 .scbrr_algo_id = SCBRR_ALGO_2,
127 .type = PORT_SCIF, 129 .type = PORT_SCIF,
128 .irqs = SCIx_IRQ_MUXED(gic_spi(90)), 130 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)),
129}; 131};
130 132
131static struct platform_device scif2_device = { 133static struct platform_device scif2_device = {
@@ -142,7 +144,7 @@ static struct plat_sci_port scif3_platform_data = {
142 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 144 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
143 .scbrr_algo_id = SCBRR_ALGO_2, 145 .scbrr_algo_id = SCBRR_ALGO_2,
144 .type = PORT_SCIF, 146 .type = PORT_SCIF,
145 .irqs = SCIx_IRQ_MUXED(gic_spi(91)), 147 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)),
146}; 148};
147 149
148static struct platform_device scif3_device = { 150static struct platform_device scif3_device = {
@@ -159,7 +161,7 @@ static struct plat_sci_port scif4_platform_data = {
159 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 161 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
160 .scbrr_algo_id = SCBRR_ALGO_2, 162 .scbrr_algo_id = SCBRR_ALGO_2,
161 .type = PORT_SCIF, 163 .type = PORT_SCIF,
162 .irqs = SCIx_IRQ_MUXED(gic_spi(92)), 164 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)),
163}; 165};
164 166
165static struct platform_device scif4_device = { 167static struct platform_device scif4_device = {
@@ -176,7 +178,7 @@ static struct plat_sci_port scif5_platform_data = {
176 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, 178 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
177 .scbrr_algo_id = SCBRR_ALGO_2, 179 .scbrr_algo_id = SCBRR_ALGO_2,
178 .type = PORT_SCIF, 180 .type = PORT_SCIF,
179 .irqs = SCIx_IRQ_MUXED(gic_spi(93)), 181 .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)),
180}; 182};
181 183
182static struct platform_device scif5_device = { 184static struct platform_device scif5_device = {
@@ -203,7 +205,7 @@ static struct resource tmu00_resources[] = {
203 .flags = IORESOURCE_MEM, 205 .flags = IORESOURCE_MEM,
204 }, 206 },
205 [1] = { 207 [1] = {
206 .start = gic_spi(32), 208 .start = gic_iid(0x40),
207 .flags = IORESOURCE_IRQ, 209 .flags = IORESOURCE_IRQ,
208 }, 210 },
209}; 211};
@@ -233,7 +235,7 @@ static struct resource tmu01_resources[] = {
233 .flags = IORESOURCE_MEM, 235 .flags = IORESOURCE_MEM,
234 }, 236 },
235 [1] = { 237 [1] = {
236 .start = gic_spi(33), 238 .start = gic_iid(0x41),
237 .flags = IORESOURCE_IRQ, 239 .flags = IORESOURCE_IRQ,
238 }, 240 },
239}; 241};
@@ -255,7 +257,7 @@ static struct resource rcar_i2c0_res[] = {
255 .end = 0xffc70fff, 257 .end = 0xffc70fff,
256 .flags = IORESOURCE_MEM, 258 .flags = IORESOURCE_MEM,
257 }, { 259 }, {
258 .start = gic_spi(79), 260 .start = gic_iid(0x6f),
259 .flags = IORESOURCE_IRQ, 261 .flags = IORESOURCE_IRQ,
260 }, 262 },
261}; 263};
@@ -273,7 +275,7 @@ static struct resource rcar_i2c1_res[] = {
273 .end = 0xffc71fff, 275 .end = 0xffc71fff,
274 .flags = IORESOURCE_MEM, 276 .flags = IORESOURCE_MEM,
275 }, { 277 }, {
276 .start = gic_spi(82), 278 .start = gic_iid(0x72),
277 .flags = IORESOURCE_IRQ, 279 .flags = IORESOURCE_IRQ,
278 }, 280 },
279}; 281};
@@ -291,7 +293,7 @@ static struct resource rcar_i2c2_res[] = {
291 .end = 0xffc72fff, 293 .end = 0xffc72fff,
292 .flags = IORESOURCE_MEM, 294 .flags = IORESOURCE_MEM,
293 }, { 295 }, {
294 .start = gic_spi(80), 296 .start = gic_iid(0x70),
295 .flags = IORESOURCE_IRQ, 297 .flags = IORESOURCE_IRQ,
296 }, 298 },
297}; 299};
@@ -309,7 +311,7 @@ static struct resource rcar_i2c3_res[] = {
309 .end = 0xffc73fff, 311 .end = 0xffc73fff,
310 .flags = IORESOURCE_MEM, 312 .flags = IORESOURCE_MEM,
311 }, { 313 }, {
312 .start = gic_spi(81), 314 .start = gic_iid(0x71),
313 .flags = IORESOURCE_IRQ, 315 .flags = IORESOURCE_IRQ,
314 }, 316 },
315}; 317};
@@ -321,7 +323,31 @@ static struct platform_device i2c3_device = {
321 .num_resources = ARRAY_SIZE(rcar_i2c3_res), 323 .num_resources = ARRAY_SIZE(rcar_i2c3_res),
322}; 324};
323 325
324static struct platform_device *r8a7779_early_devices[] __initdata = { 326static struct resource sata_resources[] = {
327 [0] = {
328 .name = "rcar-sata",
329 .start = 0xfc600000,
330 .end = 0xfc601fff,
331 .flags = IORESOURCE_MEM,
332 },
333 [1] = {
334 .start = gic_iid(0x84),
335 .flags = IORESOURCE_IRQ,
336 },
337};
338
339static struct platform_device sata_device = {
340 .name = "sata_rcar",
341 .id = -1,
342 .resource = sata_resources,
343 .num_resources = ARRAY_SIZE(sata_resources),
344 .dev = {
345 .dma_mask = &sata_device.dev.coherent_dma_mask,
346 .coherent_dma_mask = DMA_BIT_MASK(32),
347 },
348};
349
350static struct platform_device *r8a7779_devices_dt[] __initdata = {
325 &scif0_device, 351 &scif0_device,
326 &scif1_device, 352 &scif1_device,
327 &scif2_device, 353 &scif2_device,
@@ -330,13 +356,14 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
330 &scif5_device, 356 &scif5_device,
331 &tmu00_device, 357 &tmu00_device,
332 &tmu01_device, 358 &tmu01_device,
359};
360
361static struct platform_device *r8a7779_late_devices[] __initdata = {
333 &i2c0_device, 362 &i2c0_device,
334 &i2c1_device, 363 &i2c1_device,
335 &i2c2_device, 364 &i2c2_device,
336 &i2c3_device, 365 &i2c3_device,
337}; 366 &sata_device,
338
339static struct platform_device *r8a7779_late_devices[] __initdata = {
340}; 367};
341 368
342void __init r8a7779_add_standard_devices(void) 369void __init r8a7779_add_standard_devices(void)
@@ -349,8 +376,8 @@ void __init r8a7779_add_standard_devices(void)
349 376
350 r8a7779_init_pm_domains(); 377 r8a7779_init_pm_domains();
351 378
352 platform_add_devices(r8a7779_early_devices, 379 platform_add_devices(r8a7779_devices_dt,
353 ARRAY_SIZE(r8a7779_early_devices)); 380 ARRAY_SIZE(r8a7779_devices_dt));
354 platform_add_devices(r8a7779_late_devices, 381 platform_add_devices(r8a7779_late_devices,
355 ARRAY_SIZE(r8a7779_late_devices)); 382 ARRAY_SIZE(r8a7779_late_devices));
356} 383}
@@ -367,8 +394,8 @@ void __init r8a7779_earlytimer_init(void)
367 394
368void __init r8a7779_add_early_devices(void) 395void __init r8a7779_add_early_devices(void)
369{ 396{
370 early_platform_add_devices(r8a7779_early_devices, 397 early_platform_add_devices(r8a7779_devices_dt,
371 ARRAY_SIZE(r8a7779_early_devices)); 398 ARRAY_SIZE(r8a7779_devices_dt));
372 399
373 /* Early serial console setup is not included here due to 400 /* Early serial console setup is not included here due to
374 * memory map collisions. The SCIF serial ports in r8a7779 401 * memory map collisions. The SCIF serial ports in r8a7779
@@ -386,3 +413,40 @@ void __init r8a7779_add_early_devices(void)
386 * command line in case of the marzen board. 413 * command line in case of the marzen board.
387 */ 414 */
388} 415}
416
417#ifdef CONFIG_USE_OF
418void __init r8a7779_init_delay(void)
419{
420 shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
421}
422
423static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
424 {},
425};
426
427void __init r8a7779_add_standard_devices_dt(void)
428{
429 /* clocks are setup late during boot in the case of DT */
430 r8a7779_clock_init();
431
432 platform_add_devices(r8a7779_devices_dt,
433 ARRAY_SIZE(r8a7779_devices_dt));
434 of_platform_populate(NULL, of_default_bus_match_table,
435 r8a7779_auxdata_lookup, NULL);
436}
437
438static const char *r8a7779_compat_dt[] __initdata = {
439 "renesas,r8a7779",
440 NULL,
441};
442
443DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
444 .map_io = r8a7779_map_io,
445 .init_early = r8a7779_init_delay,
446 .nr_irqs = NR_IRQS_LEGACY,
447 .init_irq = r8a7779_init_irq_dt,
448 .init_machine = r8a7779_add_standard_devices_dt,
449 .init_time = shmobile_timer_init,
450 .dt_compat = r8a7779_compat_dt,
451MACHINE_END
452#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index bdab575f88bc..e8cd93a5c550 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/irqchip.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/of_platform.h> 27#include <linux/of_platform.h>
27#include <linux/delay.h> 28#include <linux/delay.h>
@@ -32,6 +33,7 @@
32#include <linux/sh_intc.h> 33#include <linux/sh_intc.h>
33#include <linux/sh_timer.h> 34#include <linux/sh_timer.h>
34#include <linux/platform_data/sh_ipmmu.h> 35#include <linux/platform_data/sh_ipmmu.h>
36#include <linux/platform_data/irq-renesas-intc-irqpin.h>
35#include <mach/dma-register.h> 37#include <mach/dma-register.h>
36#include <mach/hardware.h> 38#include <mach/hardware.h>
37#include <mach/irqs.h> 39#include <mach/irqs.h>
@@ -810,7 +812,128 @@ static struct platform_device ipmmu_device = {
810 .num_resources = ARRAY_SIZE(ipmmu_resources), 812 .num_resources = ARRAY_SIZE(ipmmu_resources),
811}; 813};
812 814
813static struct platform_device *sh73a0_early_devices_dt[] __initdata = { 815static struct renesas_intc_irqpin_config irqpin0_platform_data = {
816 .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
817};
818
819static struct resource irqpin0_resources[] = {
820 DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */
821 DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */
822 DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */
823 DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */
824 DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */
825 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */
826 DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */
827 DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */
828 DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */
829 DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */
830 DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */
831 DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */
832 DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */
833};
834
835static struct platform_device irqpin0_device = {
836 .name = "renesas_intc_irqpin",
837 .id = 0,
838 .resource = irqpin0_resources,
839 .num_resources = ARRAY_SIZE(irqpin0_resources),
840 .dev = {
841 .platform_data = &irqpin0_platform_data,
842 },
843};
844
845static struct renesas_intc_irqpin_config irqpin1_platform_data = {
846 .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */
847 .control_parent = true, /* Disable spurious IRQ10 */
848};
849
850static struct resource irqpin1_resources[] = {
851 DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */
852 DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */
853 DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */
854 DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */
855 DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */
856 DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */
857 DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */
858 DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */
859 DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */
860 DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */
861 DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */
862 DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */
863 DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */
864};
865
866static struct platform_device irqpin1_device = {
867 .name = "renesas_intc_irqpin",
868 .id = 1,
869 .resource = irqpin1_resources,
870 .num_resources = ARRAY_SIZE(irqpin1_resources),
871 .dev = {
872 .platform_data = &irqpin1_platform_data,
873 },
874};
875
876static struct renesas_intc_irqpin_config irqpin2_platform_data = {
877 .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
878};
879
880static struct resource irqpin2_resources[] = {
881 DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */
882 DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */
883 DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */
884 DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */
885 DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */
886 DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */
887 DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */
888 DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */
889 DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */
890 DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */
891 DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */
892 DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */
893 DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */
894};
895
896static struct platform_device irqpin2_device = {
897 .name = "renesas_intc_irqpin",
898 .id = 2,
899 .resource = irqpin2_resources,
900 .num_resources = ARRAY_SIZE(irqpin2_resources),
901 .dev = {
902 .platform_data = &irqpin2_platform_data,
903 },
904};
905
906static struct renesas_intc_irqpin_config irqpin3_platform_data = {
907 .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
908};
909
910static struct resource irqpin3_resources[] = {
911 DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */
912 DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */
913 DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */
914 DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */
915 DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */
916 DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */
917 DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */
918 DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */
919 DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */
920 DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */
921 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */
922 DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */
923 DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */
924};
925
926static struct platform_device irqpin3_device = {
927 .name = "renesas_intc_irqpin",
928 .id = 3,
929 .resource = irqpin3_resources,
930 .num_resources = ARRAY_SIZE(irqpin3_resources),
931 .dev = {
932 .platform_data = &irqpin3_platform_data,
933 },
934};
935
936static struct platform_device *sh73a0_devices_dt[] __initdata = {
814 &scif0_device, 937 &scif0_device,
815 &scif1_device, 938 &scif1_device,
816 &scif2_device, 939 &scif2_device,
@@ -838,6 +961,10 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
838 &dma0_device, 961 &dma0_device,
839 &mpdma0_device, 962 &mpdma0_device,
840 &pmu_device, 963 &pmu_device,
964 &irqpin0_device,
965 &irqpin1_device,
966 &irqpin2_device,
967 &irqpin3_device,
841}; 968};
842 969
843#define SRCR2 IOMEM(0xe61580b0) 970#define SRCR2 IOMEM(0xe61580b0)
@@ -847,8 +974,8 @@ void __init sh73a0_add_standard_devices(void)
847 /* Clear software reset bit on SY-DMAC module */ 974 /* Clear software reset bit on SY-DMAC module */
848 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); 975 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
849 976
850 platform_add_devices(sh73a0_early_devices_dt, 977 platform_add_devices(sh73a0_devices_dt,
851 ARRAY_SIZE(sh73a0_early_devices_dt)); 978 ARRAY_SIZE(sh73a0_devices_dt));
852 platform_add_devices(sh73a0_early_devices, 979 platform_add_devices(sh73a0_early_devices,
853 ARRAY_SIZE(sh73a0_early_devices)); 980 ARRAY_SIZE(sh73a0_early_devices));
854 platform_add_devices(sh73a0_late_devices, 981 platform_add_devices(sh73a0_late_devices,
@@ -867,8 +994,8 @@ void __init sh73a0_earlytimer_init(void)
867 994
868void __init sh73a0_add_early_devices(void) 995void __init sh73a0_add_early_devices(void)
869{ 996{
870 early_platform_add_devices(sh73a0_early_devices_dt, 997 early_platform_add_devices(sh73a0_devices_dt,
871 ARRAY_SIZE(sh73a0_early_devices_dt)); 998 ARRAY_SIZE(sh73a0_devices_dt));
872 early_platform_add_devices(sh73a0_early_devices, 999 early_platform_add_devices(sh73a0_early_devices,
873 ARRAY_SIZE(sh73a0_early_devices)); 1000 ARRAY_SIZE(sh73a0_early_devices));
874 1001
@@ -878,23 +1005,9 @@ void __init sh73a0_add_early_devices(void)
878 1005
879#ifdef CONFIG_USE_OF 1006#ifdef CONFIG_USE_OF
880 1007
881/* Please note that the clock initialisation shcheme used in 1008void __init sh73a0_init_delay(void)
882 * sh73a0_add_early_devices_dt() and sh73a0_add_standard_devices_dt()
883 * does not work with SMP as there is a yet to be resolved lock-up in
884 * workqueue initialisation.
885 *
886 * CONFIG_SMP should be disabled when using this code.
887 */
888
889void __init sh73a0_add_early_devices_dt(void)
890{ 1009{
891 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */ 1010 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
892
893 early_platform_add_devices(sh73a0_early_devices_dt,
894 ARRAY_SIZE(sh73a0_early_devices_dt));
895
896 /* setup early console here as well */
897 shmobile_setup_console();
898} 1011}
899 1012
900static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = { 1013static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = {
@@ -906,8 +1019,8 @@ void __init sh73a0_add_standard_devices_dt(void)
906 /* clocks are setup late during boot in the case of DT */ 1019 /* clocks are setup late during boot in the case of DT */
907 sh73a0_clock_init(); 1020 sh73a0_clock_init();
908 1021
909 platform_add_devices(sh73a0_early_devices_dt, 1022 platform_add_devices(sh73a0_devices_dt,
910 ARRAY_SIZE(sh73a0_early_devices_dt)); 1023 ARRAY_SIZE(sh73a0_devices_dt));
911 of_platform_populate(NULL, of_default_bus_match_table, 1024 of_platform_populate(NULL, of_default_bus_match_table,
912 sh73a0_auxdata_lookup, NULL); 1025 sh73a0_auxdata_lookup, NULL);
913} 1026}
@@ -918,10 +1031,11 @@ static const char *sh73a0_boards_compat_dt[] __initdata = {
918}; 1031};
919 1032
920DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") 1033DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
1034 .smp = smp_ops(sh73a0_smp_ops),
921 .map_io = sh73a0_map_io, 1035 .map_io = sh73a0_map_io,
922 .init_early = sh73a0_add_early_devices_dt, 1036 .init_early = sh73a0_init_delay,
923 .nr_irqs = NR_IRQS_LEGACY, 1037 .nr_irqs = NR_IRQS_LEGACY,
924 .init_irq = sh73a0_init_irq_dt, 1038 .init_irq = irqchip_init,
925 .init_machine = sh73a0_add_standard_devices_dt, 1039 .init_machine = sh73a0_add_standard_devices_dt,
926 .init_time = shmobile_timer_init, 1040 .init_time = shmobile_timer_init,
927 .dt_compat = sh73a0_boards_compat_dt, 1041 .dt_compat = sh73a0_boards_compat_dt,
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 953eb1f9388d..e38691b4d0dd 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -23,100 +23,39 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/irqchip/arm-gic.h>
27#include <mach/common.h> 26#include <mach/common.h>
28#include <mach/emev2.h> 27#include <mach/emev2.h>
29#include <asm/smp_plat.h> 28#include <asm/smp_plat.h>
30#include <asm/smp_scu.h> 29#include <asm/smp_scu.h>
31#include <asm/cacheflush.h>
32 30
33#define EMEV2_SCU_BASE 0x1e000000 31#define EMEV2_SCU_BASE 0x1e000000
34 32
35static DEFINE_SPINLOCK(scu_lock);
36static void __iomem *scu_base;
37
38static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
39{
40 unsigned long tmp;
41
42 /* we assume this code is running on a different cpu
43 * than the one that is changing coherency setting */
44 spin_lock(&scu_lock);
45 tmp = readl(scu_base + 8);
46 tmp &= ~clr;
47 tmp |= set;
48 writel(tmp, scu_base + 8);
49 spin_unlock(&scu_lock);
50
51}
52
53static unsigned int __init emev2_get_core_count(void)
54{
55 if (!scu_base) {
56 scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
57 emev2_clock_init(); /* need ioremapped SMU */
58 }
59
60 WARN_ON_ONCE(!scu_base);
61
62 return scu_base ? scu_get_core_count(scu_base) : 1;
63}
64
65static int emev2_platform_cpu_kill(unsigned int cpu)
66{
67 return 0; /* not supported yet */
68}
69
70static int __maybe_unused emev2_cpu_kill(unsigned int cpu)
71{
72 int k;
73
74 /* this function is running on another CPU than the offline target,
75 * here we need wait for shutdown code in platform_cpu_die() to
76 * finish before asking SoC-specific code to power off the CPU core.
77 */
78 for (k = 0; k < 1000; k++) {
79 if (shmobile_cpu_is_dead(cpu))
80 return emev2_platform_cpu_kill(cpu);
81 mdelay(1);
82 }
83
84 return 0;
85}
86
87
88static void __cpuinit emev2_secondary_init(unsigned int cpu)
89{
90 gic_secondary_init(0);
91}
92
93static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle) 33static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
94{ 34{
95 cpu = cpu_logical_map(cpu); 35 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu)));
96
97 /* enable cache coherency */
98 modify_scu_cpu_psr(0, 3 << (cpu * 8));
99
100 /* Tell ROM loader about our vector (in headsmp.S) */
101 emev2_set_boot_vector(__pa(shmobile_secondary_vector));
102
103 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
104 return 0; 36 return 0;
105} 37}
106 38
107static void __init emev2_smp_prepare_cpus(unsigned int max_cpus) 39static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
108{ 40{
109 int cpu = cpu_logical_map(0); 41 scu_enable(shmobile_scu_base);
110 42
111 scu_enable(scu_base); 43 /* Tell ROM loader about our vector (in headsmp-scu.S) */
44 emev2_set_boot_vector(__pa(shmobile_secondary_vector_scu));
112 45
113 /* enable cache coherency on CPU0 */ 46 /* enable cache coherency on booting CPU */
114 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 47 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
115} 48}
116 49
117static void __init emev2_smp_init_cpus(void) 50static void __init emev2_smp_init_cpus(void)
118{ 51{
119 unsigned int ncores = emev2_get_core_count(); 52 unsigned int ncores;
53
54 /* setup EMEV2 specific SCU base */
55 shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
56 emev2_clock_init(); /* need ioremapped SMU */
57
58 ncores = shmobile_scu_base ? scu_get_core_count(shmobile_scu_base) : 1;
120 59
121 shmobile_smp_init_cpus(ncores); 60 shmobile_smp_init_cpus(ncores);
122} 61}
@@ -124,11 +63,5 @@ static void __init emev2_smp_init_cpus(void)
124struct smp_operations emev2_smp_ops __initdata = { 63struct smp_operations emev2_smp_ops __initdata = {
125 .smp_init_cpus = emev2_smp_init_cpus, 64 .smp_init_cpus = emev2_smp_init_cpus,
126 .smp_prepare_cpus = emev2_smp_prepare_cpus, 65 .smp_prepare_cpus = emev2_smp_prepare_cpus,
127 .smp_secondary_init = emev2_secondary_init,
128 .smp_boot_secondary = emev2_boot_secondary, 66 .smp_boot_secondary = emev2_boot_secondary,
129#ifdef CONFIG_HOTPLUG_CPU
130 .cpu_kill = emev2_cpu_kill,
131 .cpu_die = shmobile_cpu_die,
132 .cpu_disable = shmobile_cpu_disable,
133#endif
134}; 67};
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 3a4acf23edcf..a853bf182ed5 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -23,14 +23,15 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/irqchip/arm-gic.h>
27#include <mach/common.h> 26#include <mach/common.h>
28#include <mach/r8a7779.h> 27#include <mach/r8a7779.h>
28#include <asm/cacheflush.h>
29#include <asm/smp_plat.h> 29#include <asm/smp_plat.h>
30#include <asm/smp_scu.h> 30#include <asm/smp_scu.h>
31#include <asm/smp_twd.h> 31#include <asm/smp_twd.h>
32 32
33#define AVECR IOMEM(0xfe700040) 33#define AVECR IOMEM(0xfe700040)
34#define R8A7779_SCU_BASE 0xf0000000
34 35
35static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { 36static struct r8a7779_pm_ch r8a7779_ch_cpu1 = {
36 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 37 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
@@ -56,44 +57,14 @@ static struct r8a7779_pm_ch *r8a7779_ch_cpu[4] = {
56 [3] = &r8a7779_ch_cpu3, 57 [3] = &r8a7779_ch_cpu3,
57}; 58};
58 59
59static void __iomem *scu_base_addr(void)
60{
61 return (void __iomem *)0xf0000000;
62}
63
64static DEFINE_SPINLOCK(scu_lock);
65static unsigned long tmp;
66
67#ifdef CONFIG_HAVE_ARM_TWD 60#ifdef CONFIG_HAVE_ARM_TWD
68static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 61static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, R8A7779_SCU_BASE + 0x600, 29);
69
70void __init r8a7779_register_twd(void) 62void __init r8a7779_register_twd(void)
71{ 63{
72 twd_local_timer_register(&twd_local_timer); 64 twd_local_timer_register(&twd_local_timer);
73} 65}
74#endif 66#endif
75 67
76static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
77{
78 void __iomem *scu_base = scu_base_addr();
79
80 spin_lock(&scu_lock);
81 tmp = __raw_readl(scu_base + 8);
82 tmp &= ~clr;
83 tmp |= set;
84 spin_unlock(&scu_lock);
85
86 /* disable cache coherency after releasing the lock */
87 __raw_writel(tmp, scu_base + 8);
88}
89
90static unsigned int __init r8a7779_get_core_count(void)
91{
92 void __iomem *scu_base = scu_base_addr();
93
94 return scu_get_core_count(scu_base);
95}
96
97static int r8a7779_platform_cpu_kill(unsigned int cpu) 68static int r8a7779_platform_cpu_kill(unsigned int cpu)
98{ 69{
99 struct r8a7779_pm_ch *ch = NULL; 70 struct r8a7779_pm_ch *ch = NULL;
@@ -101,9 +72,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
101 72
102 cpu = cpu_logical_map(cpu); 73 cpu = cpu_logical_map(cpu);
103 74
104 /* disable cache coherency */
105 modify_scu_cpu_psr(3 << (cpu * 8), 0);
106
107 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 75 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
108 ch = r8a7779_ch_cpu[cpu]; 76 ch = r8a7779_ch_cpu[cpu];
109 77
@@ -113,30 +81,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
113 return ret ? ret : 1; 81 return ret ? ret : 1;
114} 82}
115 83
116static int __maybe_unused r8a7779_cpu_kill(unsigned int cpu)
117{
118 int k;
119
120 /* this function is running on another CPU than the offline target,
121 * here we need wait for shutdown code in platform_cpu_die() to
122 * finish before asking SoC-specific code to power off the CPU core.
123 */
124 for (k = 0; k < 1000; k++) {
125 if (shmobile_cpu_is_dead(cpu))
126 return r8a7779_platform_cpu_kill(cpu);
127
128 mdelay(1);
129 }
130
131 return 0;
132}
133
134
135static void __cpuinit r8a7779_secondary_init(unsigned int cpu)
136{
137 gic_secondary_init(0);
138}
139
140static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle) 84static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
141{ 85{
142 struct r8a7779_pm_ch *ch = NULL; 86 struct r8a7779_pm_ch *ch = NULL;
@@ -144,9 +88,6 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
144 88
145 cpu = cpu_logical_map(cpu); 89 cpu = cpu_logical_map(cpu);
146 90
147 /* enable cache coherency */
148 modify_scu_cpu_psr(0, 3 << (cpu * 8));
149
150 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 91 if (cpu < ARRAY_SIZE(r8a7779_ch_cpu))
151 ch = r8a7779_ch_cpu[cpu]; 92 ch = r8a7779_ch_cpu[cpu];
152 93
@@ -158,15 +99,13 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct
158 99
159static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) 100static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
160{ 101{
161 int cpu = cpu_logical_map(0); 102 scu_enable(shmobile_scu_base);
162
163 scu_enable(scu_base_addr());
164 103
165 /* Map the reset vector (in headsmp.S) */ 104 /* Map the reset vector (in headsmp-scu.S) */
166 __raw_writel(__pa(shmobile_secondary_vector), AVECR); 105 __raw_writel(__pa(shmobile_secondary_vector_scu), AVECR);
167 106
168 /* enable cache coherency on CPU0 */ 107 /* enable cache coherency on booting CPU */
169 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 108 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
170 109
171 r8a7779_pm_init(); 110 r8a7779_pm_init();
172 111
@@ -178,19 +117,68 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
178 117
179static void __init r8a7779_smp_init_cpus(void) 118static void __init r8a7779_smp_init_cpus(void)
180{ 119{
181 unsigned int ncores = r8a7779_get_core_count(); 120 /* setup r8a7779 specific SCU base */
121 shmobile_scu_base = IOMEM(R8A7779_SCU_BASE);
122
123 shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base));
124}
125
126#ifdef CONFIG_HOTPLUG_CPU
127static int r8a7779_scu_psr_core_disabled(int cpu)
128{
129 unsigned long mask = 3 << (cpu * 8);
130
131 if ((__raw_readl(shmobile_scu_base + 8) & mask) == mask)
132 return 1;
133
134 return 0;
135}
136
137static int r8a7779_cpu_kill(unsigned int cpu)
138{
139 int k;
182 140
183 shmobile_smp_init_cpus(ncores); 141 /* this function is running on another CPU than the offline target,
142 * here we need wait for shutdown code in platform_cpu_die() to
143 * finish before asking SoC-specific code to power off the CPU core.
144 */
145 for (k = 0; k < 1000; k++) {
146 if (r8a7779_scu_psr_core_disabled(cpu))
147 return r8a7779_platform_cpu_kill(cpu);
148
149 mdelay(1);
150 }
151
152 return 0;
153}
154
155static void r8a7779_cpu_die(unsigned int cpu)
156{
157 dsb();
158 flush_cache_all();
159
160 /* disable cache coherency */
161 scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
162
163 /* Endless loop until power off from r8a7779_cpu_kill() */
164 while (1)
165 cpu_do_idle();
166}
167
168static int r8a7779_cpu_disable(unsigned int cpu)
169{
170 /* only CPU1->3 have power domains, do not allow hotplug of CPU0 */
171 return cpu == 0 ? -EPERM : 0;
184} 172}
173#endif /* CONFIG_HOTPLUG_CPU */
185 174
186struct smp_operations r8a7779_smp_ops __initdata = { 175struct smp_operations r8a7779_smp_ops __initdata = {
187 .smp_init_cpus = r8a7779_smp_init_cpus, 176 .smp_init_cpus = r8a7779_smp_init_cpus,
188 .smp_prepare_cpus = r8a7779_smp_prepare_cpus, 177 .smp_prepare_cpus = r8a7779_smp_prepare_cpus,
189 .smp_secondary_init = r8a7779_secondary_init,
190 .smp_boot_secondary = r8a7779_boot_secondary, 178 .smp_boot_secondary = r8a7779_boot_secondary,
191#ifdef CONFIG_HOTPLUG_CPU 179#ifdef CONFIG_HOTPLUG_CPU
192 .cpu_kill = r8a7779_cpu_kill, 180 .cpu_kill = r8a7779_cpu_kill,
193 .cpu_die = shmobile_cpu_die, 181 .cpu_die = r8a7779_cpu_die,
194 .cpu_disable = shmobile_cpu_disable, 182 .cpu_disable = r8a7779_cpu_disable,
195#endif 183#endif
196}; 184};
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index acb46a94ccdf..496592b6c763 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -23,7 +23,6 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/irqchip/arm-gic.h>
27#include <mach/common.h> 26#include <mach/common.h>
28#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
29#include <asm/smp_plat.h> 28#include <asm/smp_plat.h>
@@ -39,31 +38,16 @@
39 38
40#define PSTR_SHUTDOWN_MODE 3 39#define PSTR_SHUTDOWN_MODE 3
41 40
42static void __iomem *scu_base_addr(void) 41#define SH73A0_SCU_BASE 0xf0000000
43{
44 return (void __iomem *)0xf0000000;
45}
46 42
47#ifdef CONFIG_HAVE_ARM_TWD 43#ifdef CONFIG_HAVE_ARM_TWD
48static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 44static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, SH73A0_SCU_BASE + 0x600, 29);
49void __init sh73a0_register_twd(void) 45void __init sh73a0_register_twd(void)
50{ 46{
51 twd_local_timer_register(&twd_local_timer); 47 twd_local_timer_register(&twd_local_timer);
52} 48}
53#endif 49#endif
54 50
55static unsigned int __init sh73a0_get_core_count(void)
56{
57 void __iomem *scu_base = scu_base_addr();
58
59 return scu_get_core_count(scu_base);
60}
61
62static void __cpuinit sh73a0_secondary_init(unsigned int cpu)
63{
64 gic_secondary_init(0);
65}
66
67static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle) 51static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
68{ 52{
69 cpu = cpu_logical_map(cpu); 53 cpu = cpu_logical_map(cpu);
@@ -78,21 +62,22 @@ static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct
78 62
79static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus) 63static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
80{ 64{
81 scu_enable(scu_base_addr()); 65 scu_enable(shmobile_scu_base);
82 66
83 /* Map the reset vector (in headsmp-sh73a0.S) */ 67 /* Map the reset vector (in headsmp-scu.S) */
84 __raw_writel(0, APARMBAREA); /* 4k */ 68 __raw_writel(0, APARMBAREA); /* 4k */
85 __raw_writel(__pa(sh73a0_secondary_vector), SBAR); 69 __raw_writel(__pa(shmobile_secondary_vector_scu), SBAR);
86 70
87 /* enable cache coherency on booting CPU */ 71 /* enable cache coherency on booting CPU */
88 scu_power_mode(scu_base_addr(), SCU_PM_NORMAL); 72 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
89} 73}
90 74
91static void __init sh73a0_smp_init_cpus(void) 75static void __init sh73a0_smp_init_cpus(void)
92{ 76{
93 unsigned int ncores = sh73a0_get_core_count(); 77 /* setup sh73a0 specific SCU base */
78 shmobile_scu_base = IOMEM(SH73A0_SCU_BASE);
94 79
95 shmobile_smp_init_cpus(ncores); 80 shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base));
96} 81}
97 82
98#ifdef CONFIG_HOTPLUG_CPU 83#ifdef CONFIG_HOTPLUG_CPU
@@ -119,30 +104,26 @@ static int sh73a0_cpu_kill(unsigned int cpu)
119 104
120static void sh73a0_cpu_die(unsigned int cpu) 105static void sh73a0_cpu_die(unsigned int cpu)
121{ 106{
122 /*
123 * The ARM MPcore does not issue a cache coherency request for the L1
124 * cache when powering off single CPUs. We must take care of this and
125 * further caches.
126 */
127 dsb();
128 flush_cache_all();
129
130 /* Set power off mode. This takes the CPU out of the MP cluster */ 107 /* Set power off mode. This takes the CPU out of the MP cluster */
131 scu_power_mode(scu_base_addr(), SCU_PM_POWEROFF); 108 scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF);
132 109
133 /* Enter shutdown mode */ 110 /* Enter shutdown mode */
134 cpu_do_idle(); 111 cpu_do_idle();
135} 112}
113
114static int sh73a0_cpu_disable(unsigned int cpu)
115{
116 return 0; /* CPU0 and CPU1 supported */
117}
136#endif /* CONFIG_HOTPLUG_CPU */ 118#endif /* CONFIG_HOTPLUG_CPU */
137 119
138struct smp_operations sh73a0_smp_ops __initdata = { 120struct smp_operations sh73a0_smp_ops __initdata = {
139 .smp_init_cpus = sh73a0_smp_init_cpus, 121 .smp_init_cpus = sh73a0_smp_init_cpus,
140 .smp_prepare_cpus = sh73a0_smp_prepare_cpus, 122 .smp_prepare_cpus = sh73a0_smp_prepare_cpus,
141 .smp_secondary_init = sh73a0_secondary_init,
142 .smp_boot_secondary = sh73a0_boot_secondary, 123 .smp_boot_secondary = sh73a0_boot_secondary,
143#ifdef CONFIG_HOTPLUG_CPU 124#ifdef CONFIG_HOTPLUG_CPU
144 .cpu_kill = sh73a0_cpu_kill, 125 .cpu_kill = sh73a0_cpu_kill,
145 .cpu_die = sh73a0_cpu_die, 126 .cpu_die = sh73a0_cpu_die,
146 .cpu_disable = shmobile_cpu_disable_any, 127 .cpu_disable = sh73a0_cpu_disable,
147#endif 128#endif
148}; 129};
diff --git a/arch/arm/mach-shmobile/suspend.c b/arch/arm/mach-shmobile/suspend.c
index 47d83f7a70b6..5d92b5dd486b 100644
--- a/arch/arm/mach-shmobile/suspend.c
+++ b/arch/arm/mach-shmobile/suspend.c
@@ -12,6 +12,8 @@
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/cpu.h>
16
15#include <asm/io.h> 17#include <asm/io.h>
16#include <asm/system_misc.h> 18#include <asm/system_misc.h>
17 19
@@ -23,13 +25,13 @@ static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
23 25
24static int shmobile_suspend_begin(suspend_state_t state) 26static int shmobile_suspend_begin(suspend_state_t state)
25{ 27{
26 disable_hlt(); 28 cpu_idle_poll_ctrl(true);
27 return 0; 29 return 0;
28} 30}
29 31
30static void shmobile_suspend_end(void) 32static void shmobile_suspend_end(void)
31{ 33{
32 enable_hlt(); 34 cpu_idle_poll_ctrl(false);
33} 35}
34 36
35struct platform_suspend_ops shmobile_suspend_ops = { 37struct platform_suspend_ops shmobile_suspend_ops = {
diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h
index 315edff610f2..572b8f719ffb 100644
--- a/arch/arm/mach-socfpga/core.h
+++ b/arch/arm/mach-socfpga/core.h
@@ -20,12 +20,23 @@
20#ifndef __MACH_CORE_H 20#ifndef __MACH_CORE_H
21#define __MACH_CORE_H 21#define __MACH_CORE_H
22 22
23#define SOCFPGA_RSTMGR_CTRL 0x04
24#define SOCFPGA_RSTMGR_MODPERRST 0x14
25#define SOCFPGA_RSTMGR_BRGMODRST 0x1c
26
27/* System Manager bits */
28#define RSTMGR_CTRL_SWCOLDRSTREQ 0x1 /* Cold Reset */
29#define RSTMGR_CTRL_SWWARMRSTREQ 0x2 /* Warm Reset */
30
23extern void socfpga_secondary_startup(void); 31extern void socfpga_secondary_startup(void);
24extern void __iomem *socfpga_scu_base_addr; 32extern void __iomem *socfpga_scu_base_addr;
25 33
26extern void socfpga_init_clocks(void); 34extern void socfpga_init_clocks(void);
27extern void socfpga_sysmgr_init(void); 35extern void socfpga_sysmgr_init(void);
28 36
37extern void __iomem *sys_manager_base_addr;
38extern void __iomem *rst_manager_base_addr;
39
29extern struct smp_operations socfpga_smp_ops; 40extern struct smp_operations socfpga_smp_ops;
30extern char secondary_trampoline, secondary_trampoline_end; 41extern char secondary_trampoline, secondary_trampoline_end;
31 42
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index 84c60fa8daa0..b51ce8c7929d 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -22,7 +22,6 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25#include <linux/irqchip/arm-gic.h>
26 25
27#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
28#include <asm/smp_scu.h> 27#include <asm/smp_scu.h>
@@ -30,19 +29,6 @@
30 29
31#include "core.h" 30#include "core.h"
32 31
33extern void __iomem *sys_manager_base_addr;
34extern void __iomem *rst_manager_base_addr;
35
36static void __cpuinit socfpga_secondary_init(unsigned int cpu)
37{
38 /*
39 * if any interrupts are already enabled for the primary
40 * core (e.g. timer irq), then they will not have been enabled
41 * for us: do so
42 */
43 gic_secondary_init(0);
44}
45
46static int __cpuinit socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle) 32static int __cpuinit socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
47{ 33{
48 int trampoline_size = &secondary_trampoline_end - &secondary_trampoline; 34 int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
@@ -109,7 +95,6 @@ static void socfpga_cpu_die(unsigned int cpu)
109struct smp_operations socfpga_smp_ops __initdata = { 95struct smp_operations socfpga_smp_ops __initdata = {
110 .smp_init_cpus = socfpga_smp_init_cpus, 96 .smp_init_cpus = socfpga_smp_init_cpus,
111 .smp_prepare_cpus = socfpga_smp_prepare_cpus, 97 .smp_prepare_cpus = socfpga_smp_prepare_cpus,
112 .smp_secondary_init = socfpga_secondary_init,
113 .smp_boot_secondary = socfpga_boot_secondary, 98 .smp_boot_secondary = socfpga_boot_secondary,
114#ifdef CONFIG_HOTPLUG_CPU 99#ifdef CONFIG_HOTPLUG_CPU
115 .cpu_die = socfpga_cpu_die, 100 .cpu_die = socfpga_cpu_die,
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 1042c023cf24..46a051359f02 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -15,6 +15,7 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include <linux/dw_apb_timer.h> 17#include <linux/dw_apb_timer.h>
18#include <linux/clk-provider.h>
18#include <linux/irqchip.h> 19#include <linux/irqchip.h>
19#include <linux/of_address.h> 20#include <linux/of_address.h>
20#include <linux/of_irq.h> 21#include <linux/of_irq.h>
@@ -29,6 +30,7 @@
29void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE)); 30void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
30void __iomem *sys_manager_base_addr; 31void __iomem *sys_manager_base_addr;
31void __iomem *rst_manager_base_addr; 32void __iomem *rst_manager_base_addr;
33void __iomem *clk_mgr_base_addr;
32unsigned long cpu1start_addr; 34unsigned long cpu1start_addr;
33 35
34static struct map_desc scu_io_desc __initdata = { 36static struct map_desc scu_io_desc __initdata = {
@@ -77,6 +79,9 @@ void __init socfpga_sysmgr_init(void)
77 79
78 np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr"); 80 np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr");
79 rst_manager_base_addr = of_iomap(np, 0); 81 rst_manager_base_addr = of_iomap(np, 0);
82
83 np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
84 clk_mgr_base_addr = of_iomap(np, 0);
80} 85}
81 86
82static void __init socfpga_init_irq(void) 87static void __init socfpga_init_irq(void)
@@ -87,13 +92,22 @@ static void __init socfpga_init_irq(void)
87 92
88static void socfpga_cyclone5_restart(char mode, const char *cmd) 93static void socfpga_cyclone5_restart(char mode, const char *cmd)
89{ 94{
90 /* TODO: */ 95 u32 temp;
96
97 temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
98
99 if (mode == 'h')
100 temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
101 else
102 temp |= RSTMGR_CTRL_SWWARMRSTREQ;
103 writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
91} 104}
92 105
93static void __init socfpga_cyclone5_init(void) 106static void __init socfpga_cyclone5_init(void)
94{ 107{
95 l2x0_of_init(0, ~0UL); 108 l2x0_of_init(0, ~0UL);
96 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 109 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
110 of_clk_init(NULL);
97 socfpga_init_clocks(); 111 socfpga_init_clocks();
98} 112}
99 113
diff --git a/arch/arm/mach-spear/Kconfig b/arch/arm/mach-spear/Kconfig
new file mode 100644
index 000000000000..442917eedff3
--- /dev/null
+++ b/arch/arm/mach-spear/Kconfig
@@ -0,0 +1,105 @@
1#
2# SPEAr Platform configuration file
3#
4
5menuconfig PLAT_SPEAR
6 bool "ST SPEAr Family" if ARCH_MULTI_V7 || ARCH_MULTI_V5
7 default PLAT_SPEAR_SINGLE
8 select ARCH_REQUIRE_GPIOLIB
9 select ARM_AMBA
10 select CLKDEV_LOOKUP
11 select CLKSRC_MMIO
12 select COMMON_CLK
13 select GENERIC_CLOCKEVENTS
14 select HAVE_CLK
15
16if PLAT_SPEAR
17
18config ARCH_SPEAR13XX
19 bool "ST SPEAr13xx"
20 depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE
21 select ARCH_HAS_CPUFREQ
22 select ARM_GIC
23 select CPU_V7
24 select GPIO_SPEAR_SPICS
25 select HAVE_ARM_SCU if SMP
26 select HAVE_ARM_TWD if LOCAL_TIMERS
27 select HAVE_SMP
28 select MIGHT_HAVE_CACHE_L2X0
29 select PINCTRL
30 select USE_OF
31 help
32 Supports for ARM's SPEAR13XX family
33
34if ARCH_SPEAR13XX
35
36config MACH_SPEAR1310
37 bool "SPEAr1310 Machine support with Device Tree"
38 select PINCTRL_SPEAR1310
39 help
40 Supports ST SPEAr1310 machine configured via the device-tree
41
42config MACH_SPEAR1340
43 bool "SPEAr1340 Machine support with Device Tree"
44 select PINCTRL_SPEAR1340
45 help
46 Supports ST SPEAr1340 machine configured via the device-tree
47
48endif #ARCH_SPEAR13XX
49
50config ARCH_SPEAR3XX
51 bool "ST SPEAr3xx"
52 depends on ARCH_MULTI_V5 || PLAT_SPEAR_SINGLE
53 depends on !ARCH_SPEAR13XX
54 select ARM_VIC
55 select CPU_ARM926T
56 select PINCTRL
57 select USE_OF
58 help
59 Supports for ARM's SPEAR3XX family
60
61if ARCH_SPEAR3XX
62
63config MACH_SPEAR300
64 bool "SPEAr300 Machine support with Device Tree"
65 select PINCTRL_SPEAR300
66 help
67 Supports ST SPEAr300 machine configured via the device-tree
68
69config MACH_SPEAR310
70 bool "SPEAr310 Machine support with Device Tree"
71 select PINCTRL_SPEAR310
72 help
73 Supports ST SPEAr310 machine configured via the device-tree
74
75config MACH_SPEAR320
76 bool "SPEAr320 Machine support with Device Tree"
77 select PINCTRL_SPEAR320
78 help
79 Supports ST SPEAr320 machine configured via the device-tree
80
81endif
82
83config ARCH_SPEAR6XX
84 bool "ST SPEAr6XX"
85 depends on ARCH_MULTI_V5 || PLAT_SPEAR_SINGLE
86 depends on !ARCH_SPEAR13XX
87 select ARM_VIC
88 select CPU_ARM926T
89 help
90 Supports for ARM's SPEAR6XX family
91
92config MACH_SPEAR600
93 def_bool y
94 depends on ARCH_SPEAR6XX
95 select USE_OF
96 help
97 Supports ST SPEAr600 boards configured via the device-treesource "arch/arm/mach-spear6xx/Kconfig"
98
99config ARCH_SPEAR_AUTO
100 def_bool PLAT_SPEAR_SINGLE
101 depends on !ARCH_SPEAR13XX && !ARCH_SPEAR6XX
102 select ARCH_SPEAR3XX
103
104endif
105
diff --git a/arch/arm/mach-spear/Makefile b/arch/arm/mach-spear/Makefile
new file mode 100644
index 000000000000..af9bffb94f1c
--- /dev/null
+++ b/arch/arm/mach-spear/Makefile
@@ -0,0 +1,26 @@
1#
2# SPEAr Platform specific Makefile
3#
4
5ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
6
7# Common support
8obj-y := restart.o time.o
9
10obj-$(CONFIG_SMP) += headsmp.o platsmp.o
11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
12
13obj-$(CONFIG_ARCH_SPEAR13XX) += spear13xx.o
14obj-$(CONFIG_MACH_SPEAR1310) += spear1310.o
15obj-$(CONFIG_MACH_SPEAR1340) += spear1340.o
16
17obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o
18obj-$(CONFIG_ARCH_SPEAR3XX) += pl080.o
19obj-$(CONFIG_MACH_SPEAR300) += spear300.o
20obj-$(CONFIG_MACH_SPEAR310) += spear310.o
21obj-$(CONFIG_MACH_SPEAR320) += spear320.o
22
23obj-$(CONFIG_ARCH_SPEAR6XX) += spear6xx.o
24obj-$(CONFIG_ARCH_SPEAR6XX) += pl080.o
25
26CFLAGS_hotplug.o += -march=armv7-a
diff --git a/arch/arm/mach-spear13xx/Makefile.boot b/arch/arm/mach-spear/Makefile.boot
index 4674a4c221db..4674a4c221db 100644
--- a/arch/arm/mach-spear13xx/Makefile.boot
+++ b/arch/arm/mach-spear/Makefile.boot
diff --git a/arch/arm/mach-spear13xx/include/mach/generic.h b/arch/arm/mach-spear/generic.h
index 633e678e01a3..8ba7e75b648d 100644
--- a/arch/arm/mach-spear13xx/include/mach/generic.h
+++ b/arch/arm/mach-spear/generic.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * arch/arm/mach-spear13xx/include/mach/generic.h 2 * spear machine family generic header file
3 * 3 *
4 * spear13xx machine family generic header file 4 * Copyright (C) 2009-2012 ST Microelectronics
5 * 5 * Rajeev Kumar <rajeev-dlh.kumar@st.com>
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 6 * Viresh Kumar <viresh.linux@gmail.com>
8 * 7 *
9 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
@@ -15,37 +14,46 @@
15#define __MACH_GENERIC_H 14#define __MACH_GENERIC_H
16 15
17#include <linux/dmaengine.h> 16#include <linux/dmaengine.h>
17#include <linux/amba/pl08x.h>
18#include <linux/init.h>
18#include <asm/mach/time.h> 19#include <asm/mach/time.h>
19 20
20/* Add spear13xx structure declarations here */
21extern void spear13xx_timer_init(void); 21extern void spear13xx_timer_init(void);
22extern void spear3xx_timer_init(void);
22extern struct pl022_ssp_controller pl022_plat_data; 23extern struct pl022_ssp_controller pl022_plat_data;
24extern struct pl08x_platform_data pl080_plat_data;
23extern struct dw_dma_platform_data dmac_plat_data; 25extern struct dw_dma_platform_data dmac_plat_data;
24extern struct dw_dma_slave cf_dma_priv; 26extern struct dw_dma_slave cf_dma_priv;
25extern struct dw_dma_slave nand_read_dma_priv; 27extern struct dw_dma_slave nand_read_dma_priv;
26extern struct dw_dma_slave nand_write_dma_priv; 28extern struct dw_dma_slave nand_write_dma_priv;
29bool dw_dma_filter(struct dma_chan *chan, void *slave);
27 30
28/* Add spear13xx family function declarations here */
29void __init spear_setup_of_timer(void); 31void __init spear_setup_of_timer(void);
32void __init spear3xx_clk_init(void __iomem *misc_base,
33 void __iomem *soc_config_base);
34void __init spear3xx_map_io(void);
35void __init spear3xx_dt_init_irq(void);
36void __init spear6xx_clk_init(void __iomem *misc_base);
30void __init spear13xx_map_io(void); 37void __init spear13xx_map_io(void);
31void __init spear13xx_l2x0_init(void); 38void __init spear13xx_l2x0_init(void);
32bool dw_dma_filter(struct dma_chan *chan, void *slave); 39
33void spear_restart(char, const char *); 40void spear_restart(char, const char *);
41
34void spear13xx_secondary_startup(void); 42void spear13xx_secondary_startup(void);
35void __cpuinit spear13xx_cpu_die(unsigned int cpu); 43void __cpuinit spear13xx_cpu_die(unsigned int cpu);
36 44
37extern struct smp_operations spear13xx_smp_ops; 45extern struct smp_operations spear13xx_smp_ops;
38 46
39#ifdef CONFIG_MACH_SPEAR1310 47#ifdef CONFIG_MACH_SPEAR1310
40void __init spear1310_clk_init(void); 48void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base);
41#else 49#else
42static inline void spear1310_clk_init(void) {} 50static inline void spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base) {}
43#endif 51#endif
44 52
45#ifdef CONFIG_MACH_SPEAR1340 53#ifdef CONFIG_MACH_SPEAR1340
46void __init spear1340_clk_init(void); 54void __init spear1340_clk_init(void __iomem *misc_base);
47#else 55#else
48static inline void spear1340_clk_init(void) {} 56static inline void spear1340_clk_init(void __iomem *misc_base) {}
49#endif 57#endif
50 58
51#endif /* __MACH_GENERIC_H */ 59#endif /* __MACH_GENERIC_H */
diff --git a/arch/arm/mach-spear13xx/headsmp.S b/arch/arm/mach-spear/headsmp.S
index ed85473a047f..ed85473a047f 100644
--- a/arch/arm/mach-spear13xx/headsmp.S
+++ b/arch/arm/mach-spear/headsmp.S
diff --git a/arch/arm/mach-spear13xx/hotplug.c b/arch/arm/mach-spear/hotplug.c
index a7d2dd11a4f2..d97749c642ce 100644
--- a/arch/arm/mach-spear13xx/hotplug.c
+++ b/arch/arm/mach-spear/hotplug.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <asm/cacheflush.h>
17#include <asm/cp15.h> 16#include <asm/cp15.h>
18#include <asm/smp_plat.h> 17#include <asm/smp_plat.h>
19 18
@@ -21,7 +20,6 @@ static inline void cpu_enter_lowpower(void)
21{ 20{
22 unsigned int v; 21 unsigned int v;
23 22
24 flush_cache_all();
25 asm volatile( 23 asm volatile(
26 " mcr p15, 0, %1, c7, c5, 0\n" 24 " mcr p15, 0, %1, c7, c5, 0\n"
27 " dsb\n" 25 " dsb\n"
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/mach-spear/include/mach/debug-macro.S
index 75b05ad0fbad..75b05ad0fbad 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/mach-spear/include/mach/debug-macro.S
diff --git a/arch/arm/mach-spear6xx/include/mach/irqs.h b/arch/arm/mach-spear/include/mach/irqs.h
index 37a5c411a866..92da0a8c6bce 100644
--- a/arch/arm/mach-spear6xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear/include/mach/irqs.h
@@ -1,10 +1,9 @@
1/* 1/*
2 * arch/arm/mach-spear6xx/include/mach/irqs.h 2 * IRQ helper macros for spear machine family
3 * 3 *
4 * IRQ helper macros for SPEAr6xx machine family 4 * Copyright (C) 2009-2012 ST Microelectronics
5 * 5 * Rajeev Kumar <rajeev-dlh.kumar@st.com>
6 * Copyright (C) 2009 ST Microelectronics 6 * Viresh Kumar <viresh.linux@gmail.com>
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 * 7 *
9 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
@@ -14,6 +13,11 @@
14#ifndef __MACH_IRQS_H 13#ifndef __MACH_IRQS_H
15#define __MACH_IRQS_H 14#define __MACH_IRQS_H
16 15
16#ifdef CONFIG_ARCH_SPEAR3XX
17#define NR_IRQS 256
18#endif
19
20#ifdef CONFIG_ARCH_SPEAR6XX
17/* IRQ definitions */ 21/* IRQ definitions */
18/* VIC 1 */ 22/* VIC 1 */
19#define IRQ_VIC_END 64 23#define IRQ_VIC_END 64
@@ -21,5 +25,11 @@
21/* GPIO pins virtual irqs */ 25/* GPIO pins virtual irqs */
22#define VIRTUAL_IRQS 24 26#define VIRTUAL_IRQS 24
23#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS) 27#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS)
28#endif
29
30#ifdef CONFIG_ARCH_SPEAR13XX
31#define IRQ_GIC_END 160
32#define NR_IRQS IRQ_GIC_END
33#endif
24 34
25#endif /* __MACH_IRQS_H */ 35#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear/include/mach/misc_regs.h
index 6309bf68d6f8..935639ce59ba 100644
--- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear/include/mach/misc_regs.h
@@ -16,7 +16,7 @@
16 16
17#include <mach/spear.h> 17#include <mach/spear.h>
18 18
19#define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE) 19#define MISC_BASE (VA_SPEAR_ICM3_MISC_REG_BASE)
20#define DMA_CHN_CFG (MISC_BASE + 0x0A0) 20#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
21 21
22#endif /* __MACH_MISC_REGS_H */ 22#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear/include/mach/spear.h b/arch/arm/mach-spear/include/mach/spear.h
new file mode 100644
index 000000000000..374ddc393df1
--- /dev/null
+++ b/arch/arm/mach-spear/include/mach/spear.h
@@ -0,0 +1,95 @@
1/*
2 * SPEAr3xx/6xx Machine family specific definition
3 *
4 * Copyright (C) 2009,2012 ST Microelectronics
5 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
6 * Viresh Kumar <viresh.linux@gmail.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 __MACH_SPEAR_H
14#define __MACH_SPEAR_H
15
16#include <asm/memory.h>
17
18#if defined(CONFIG_ARCH_SPEAR3XX) || defined (CONFIG_ARCH_SPEAR6XX)
19
20/* ICM1 - Low speed connection */
21#define SPEAR_ICM1_2_BASE UL(0xD0000000)
22#define VA_SPEAR_ICM1_2_BASE IOMEM(0xFD000000)
23#define SPEAR_ICM1_UART_BASE UL(0xD0000000)
24#define VA_SPEAR_ICM1_UART_BASE (VA_SPEAR_ICM1_2_BASE - SPEAR_ICM1_2_BASE + SPEAR_ICM1_UART_BASE)
25#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000)
26
27/* ML-1, 2 - Multi Layer CPU Subsystem */
28#define SPEAR_ICM3_ML1_2_BASE UL(0xF0000000)
29#define VA_SPEAR6XX_ML_CPU_BASE IOMEM(0xF0000000)
30
31/* ICM3 - Basic Subsystem */
32#define SPEAR_ICM3_SMI_CTRL_BASE UL(0xFC000000)
33#define VA_SPEAR_ICM3_SMI_CTRL_BASE IOMEM(0xFC000000)
34#define SPEAR_ICM3_DMA_BASE UL(0xFC400000)
35#define SPEAR_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
36#define VA_SPEAR_ICM3_SYS_CTRL_BASE (VA_SPEAR_ICM3_SMI_CTRL_BASE - SPEAR_ICM3_SMI_CTRL_BASE + SPEAR_ICM3_SYS_CTRL_BASE)
37#define SPEAR_ICM3_MISC_REG_BASE UL(0xFCA80000)
38#define VA_SPEAR_ICM3_MISC_REG_BASE (VA_SPEAR_ICM3_SMI_CTRL_BASE - SPEAR_ICM3_SMI_CTRL_BASE + SPEAR_ICM3_MISC_REG_BASE)
39
40/* Debug uart for linux, will be used for debug and uncompress messages */
41#define SPEAR_DBG_UART_BASE SPEAR_ICM1_UART_BASE
42#define VA_SPEAR_DBG_UART_BASE VA_SPEAR_ICM1_UART_BASE
43
44/* Sysctl base for spear platform */
45#define SPEAR_SYS_CTRL_BASE SPEAR_ICM3_SYS_CTRL_BASE
46#define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR_ICM3_SYS_CTRL_BASE
47#endif /* SPEAR3xx || SPEAR6XX */
48
49/* SPEAr320 Macros */
50#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
51#define VA_SPEAR320_SOC_CONFIG_BASE IOMEM(0xFE000000)
52
53#ifdef CONFIG_ARCH_SPEAR13XX
54
55#define PERIP_GRP2_BASE UL(0xB3000000)
56#define VA_PERIP_GRP2_BASE IOMEM(0xFE000000)
57#define MCIF_SDHCI_BASE UL(0xB3000000)
58#define SYSRAM0_BASE UL(0xB3800000)
59#define VA_SYSRAM0_BASE IOMEM(0xFE800000)
60#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600)
61
62#define PERIP_GRP1_BASE UL(0xE0000000)
63#define VA_PERIP_GRP1_BASE IOMEM(0xFD000000)
64#define UART_BASE UL(0xE0000000)
65#define VA_UART_BASE IOMEM(0xFD000000)
66#define SSP_BASE UL(0xE0100000)
67#define MISC_BASE UL(0xE0700000)
68#define VA_MISC_BASE IOMEM(0xFD700000)
69
70#define A9SM_AND_MPMC_BASE UL(0xEC000000)
71#define VA_A9SM_AND_MPMC_BASE IOMEM(0xFC000000)
72
73#define SPEAR1310_RAS_BASE UL(0xD8400000)
74#define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000))
75
76/* A9SM peripheral offsets */
77#define A9SM_PERIP_BASE UL(0xEC800000)
78#define VA_A9SM_PERIP_BASE IOMEM(0xFC800000)
79#define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00)
80
81#define L2CC_BASE UL(0xED000000)
82#define VA_L2CC_BASE IOMEM(UL(0xFB000000))
83
84/* others */
85#define DMAC0_BASE UL(0xEA800000)
86#define DMAC1_BASE UL(0xEB000000)
87#define MCIF_CF_BASE UL(0xB2800000)
88
89/* Debug uart for linux, will be used for debug and uncompress messages */
90#define SPEAR_DBG_UART_BASE UART_BASE
91#define VA_SPEAR_DBG_UART_BASE VA_UART_BASE
92
93#endif /* SPEAR13XX */
94
95#endif /* __MACH_SPEAR_H */
diff --git a/arch/arm/plat-spear/include/plat/timex.h b/arch/arm/mach-spear/include/mach/timex.h
index ef95e5b780bd..ef95e5b780bd 100644
--- a/arch/arm/plat-spear/include/plat/timex.h
+++ b/arch/arm/mach-spear/include/mach/timex.h
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/mach-spear/include/mach/uncompress.h
index 51b2dc93e4da..51b2dc93e4da 100644
--- a/arch/arm/plat-spear/include/plat/uncompress.h
+++ b/arch/arm/mach-spear/include/mach/uncompress.h
diff --git a/arch/arm/plat-spear/pl080.c b/arch/arm/mach-spear/pl080.c
index cfa1199d0f4a..cfa1199d0f4a 100644
--- a/arch/arm/plat-spear/pl080.c
+++ b/arch/arm/mach-spear/pl080.c
diff --git a/arch/arm/plat-spear/include/plat/pl080.h b/arch/arm/mach-spear/pl080.h
index eb6590ded40d..eb6590ded40d 100644
--- a/arch/arm/plat-spear/include/plat/pl080.h
+++ b/arch/arm/mach-spear/pl080.h
diff --git a/arch/arm/mach-spear13xx/platsmp.c b/arch/arm/mach-spear/platsmp.c
index af4ade61cd95..9c4c722c954e 100644
--- a/arch/arm/mach-spear13xx/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -15,11 +15,10 @@
15#include <linux/jiffies.h> 15#include <linux/jiffies.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/irqchip/arm-gic.h>
19#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
20#include <asm/smp_scu.h> 19#include <asm/smp_scu.h>
21#include <mach/spear.h> 20#include <mach/spear.h>
22#include <mach/generic.h> 21#include "generic.h"
23 22
24static DEFINE_SPINLOCK(boot_lock); 23static DEFINE_SPINLOCK(boot_lock);
25 24
@@ -28,13 +27,6 @@ static void __iomem *scu_base = IOMEM(VA_SCU_BASE);
28static void __cpuinit spear13xx_secondary_init(unsigned int cpu) 27static void __cpuinit spear13xx_secondary_init(unsigned int cpu)
29{ 28{
30 /* 29 /*
31 * if any interrupts are already enabled for the primary
32 * core (e.g. timer irq), then they will not have been enabled
33 * for us: do so
34 */
35 gic_secondary_init(0);
36
37 /*
38 * let the primary processor know we're out of the 30 * let the primary processor know we're out of the
39 * pen, then head off into the C entry point 31 * pen, then head off into the C entry point
40 */ 32 */
diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/mach-spear/restart.c
index 7d4616d5df11..2b44500bb718 100644
--- a/arch/arm/plat-spear/restart.c
+++ b/arch/arm/mach-spear/restart.c
@@ -14,7 +14,7 @@
14#include <linux/amba/sp810.h> 14#include <linux/amba/sp810.h>
15#include <asm/system_misc.h> 15#include <asm/system_misc.h>
16#include <mach/spear.h> 16#include <mach/spear.h>
17#include <mach/generic.h> 17#include "generic.h"
18 18
19#define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204) 19#define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204)
20void spear_restart(char mode, const char *cmd) 20void spear_restart(char mode, const char *cmd)
@@ -26,7 +26,8 @@ void spear_restart(char mode, const char *cmd)
26 /* hardware reset, Use on-chip reset capability */ 26 /* hardware reset, Use on-chip reset capability */
27#ifdef CONFIG_ARCH_SPEAR13XX 27#ifdef CONFIG_ARCH_SPEAR13XX
28 writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES); 28 writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES);
29#else 29#endif
30#if defined(CONFIG_ARCH_SPEAR3XX) || defined(CONFIG_ARCH_SPEAR6XX)
30 sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE); 31 sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
31#endif 32#endif
32 } 33 }
diff --git a/arch/arm/mach-spear13xx/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 56214d1076ef..ed3b5c287a7b 100644
--- a/arch/arm/mach-spear13xx/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -19,7 +19,7 @@
19#include <linux/pata_arasan_cf_data.h> 19#include <linux/pata_arasan_cf_data.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/map.h> 21#include <asm/mach/map.h>
22#include <mach/generic.h> 22#include "generic.h"
23#include <mach/spear.h> 23#include <mach/spear.h>
24 24
25/* Base addresses */ 25/* Base addresses */
@@ -30,8 +30,6 @@
30 30
31#define SPEAR1310_RAS_GRP1_BASE UL(0xD8000000) 31#define SPEAR1310_RAS_GRP1_BASE UL(0xD8000000)
32#define VA_SPEAR1310_RAS_GRP1_BASE UL(0xFA000000) 32#define VA_SPEAR1310_RAS_GRP1_BASE UL(0xFA000000)
33#define SPEAR1310_RAS_BASE UL(0xD8400000)
34#define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000))
35 33
36static struct arasan_cf_pdata cf_pdata = { 34static struct arasan_cf_pdata cf_pdata = {
37 .cf_if_clk = CF_IF_CLK_166M, 35 .cf_if_clk = CF_IF_CLK_166M,
diff --git a/arch/arm/mach-spear13xx/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 9a28beb2a113..75e38644bbfb 100644
--- a/arch/arm/mach-spear13xx/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -20,10 +20,11 @@
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <mach/dma.h> 23#include "generic.h"
24#include <mach/generic.h>
25#include <mach/spear.h> 24#include <mach/spear.h>
26 25
26#include "spear13xx-dma.h"
27
27/* Base addresses */ 28/* Base addresses */
28#define SPEAR1340_SATA_BASE UL(0xB1000000) 29#define SPEAR1340_SATA_BASE UL(0xB1000000)
29#define SPEAR1340_UART1_BASE UL(0xB4100000) 30#define SPEAR1340_UART1_BASE UL(0xB4100000)
diff --git a/arch/arm/mach-spear13xx/include/mach/dma.h b/arch/arm/mach-spear/spear13xx-dma.h
index d50bdb605925..d50bdb605925 100644
--- a/arch/arm/mach-spear13xx/include/mach/dma.h
+++ b/arch/arm/mach-spear/spear13xx-dma.h
diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear/spear13xx.c
index c7d2b4a8d8cc..6dd208997176 100644
--- a/arch/arm/mach-spear13xx/spear13xx.c
+++ b/arch/arm/mach-spear/spear13xx.c
@@ -15,16 +15,17 @@
15 15
16#include <linux/amba/pl022.h> 16#include <linux/amba/pl022.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/clocksource.h>
18#include <linux/dw_dmac.h> 19#include <linux/dw_dmac.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/of.h> 21#include <linux/of.h>
21#include <asm/hardware/cache-l2x0.h> 22#include <asm/hardware/cache-l2x0.h>
22#include <asm/mach/map.h> 23#include <asm/mach/map.h>
23#include <asm/smp_twd.h> 24#include "generic.h"
24#include <mach/dma.h>
25#include <mach/generic.h>
26#include <mach/spear.h> 25#include <mach/spear.h>
27 26
27#include "spear13xx-dma.h"
28
28/* common dw_dma filter routine to be used by peripherals */ 29/* common dw_dma filter routine to be used by peripherals */
29bool dw_dma_filter(struct dma_chan *chan, void *slave) 30bool dw_dma_filter(struct dma_chan *chan, void *slave)
30{ 31{
@@ -145,9 +146,9 @@ void __init spear13xx_map_io(void)
145static void __init spear13xx_clk_init(void) 146static void __init spear13xx_clk_init(void)
146{ 147{
147 if (of_machine_is_compatible("st,spear1310")) 148 if (of_machine_is_compatible("st,spear1310"))
148 spear1310_clk_init(); 149 spear1310_clk_init(VA_MISC_BASE, VA_SPEAR1310_RAS_BASE);
149 else if (of_machine_is_compatible("st,spear1340")) 150 else if (of_machine_is_compatible("st,spear1340"))
150 spear1340_clk_init(); 151 spear1340_clk_init(VA_MISC_BASE);
151 else 152 else
152 pr_err("%s: Unknown machine\n", __func__); 153 pr_err("%s: Unknown machine\n", __func__);
153} 154}
@@ -179,5 +180,5 @@ void __init spear13xx_timer_init(void)
179 clk_put(pclk); 180 clk_put(pclk);
180 181
181 spear_setup_of_timer(); 182 spear_setup_of_timer();
182 twd_local_timer_of_register(); 183 clocksource_of_init();
183} 184}
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear/spear300.c
index bbc9b7e9c62c..bac56e845f7a 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear/spear300.c
@@ -17,7 +17,7 @@
17#include <linux/irqchip.h> 17#include <linux/irqchip.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
20#include <mach/generic.h> 20#include "generic.h"
21#include <mach/spear.h> 21#include <mach/spear.h>
22 22
23/* DMAC platform data's slave info */ 23/* DMAC platform data's slave info */
@@ -185,7 +185,7 @@ struct pl08x_channel_data spear300_dma_info[] = {
185static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = { 185static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
186 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, 186 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
187 &pl022_plat_data), 187 &pl022_plat_data),
188 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, 188 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
189 &pl080_plat_data), 189 &pl080_plat_data),
190 {} 190 {}
191}; 191};
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear/spear310.c
index c13a434a8195..6ffbc63d516d 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear/spear310.c
@@ -18,7 +18,7 @@
18#include <linux/irqchip.h> 18#include <linux/irqchip.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <mach/generic.h> 21#include "generic.h"
22#include <mach/spear.h> 22#include <mach/spear.h>
23 23
24#define SPEAR310_UART1_BASE UL(0xB2000000) 24#define SPEAR310_UART1_BASE UL(0xB2000000)
@@ -217,7 +217,7 @@ static struct amba_pl011_data spear310_uart_data[] = {
217static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = { 217static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
218 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, 218 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
219 &pl022_plat_data), 219 &pl022_plat_data),
220 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, 220 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
221 &pl080_plat_data), 221 &pl080_plat_data),
222 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL, 222 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
223 &spear310_uart_data[0]), 223 &spear310_uart_data[0]),
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear/spear320.c
index e1c77079a3e5..6eb3eec65f96 100644
--- a/arch/arm/mach-spear3xx/spear320.c
+++ b/arch/arm/mach-spear/spear320.c
@@ -19,7 +19,8 @@
19#include <linux/irqchip.h> 19#include <linux/irqchip.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
22#include <mach/generic.h> 22#include <asm/mach/map.h>
23#include "generic.h"
23#include <mach/spear.h> 24#include <mach/spear.h>
24 25
25#define SPEAR320_UART1_BASE UL(0xA3000000) 26#define SPEAR320_UART1_BASE UL(0xA3000000)
@@ -222,7 +223,7 @@ static struct amba_pl011_data spear320_uart_data[] = {
222static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = { 223static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = {
223 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, 224 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
224 &pl022_plat_data), 225 &pl022_plat_data),
225 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, 226 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
226 &pl080_plat_data), 227 &pl080_plat_data),
227 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL, 228 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL,
228 &spear320_ssp_data[0]), 229 &spear320_ssp_data[0]),
@@ -253,7 +254,7 @@ static const char * const spear320_dt_board_compat[] = {
253 254
254struct map_desc spear320_io_desc[] __initdata = { 255struct map_desc spear320_io_desc[] __initdata = {
255 { 256 {
256 .virtual = VA_SPEAR320_SOC_CONFIG_BASE, 257 .virtual = (unsigned long)VA_SPEAR320_SOC_CONFIG_BASE,
257 .pfn = __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE), 258 .pfn = __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE),
258 .length = SZ_16M, 259 .length = SZ_16M,
259 .type = MT_DEVICE 260 .type = MT_DEVICE
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear/spear3xx.c
index d2b3937c4014..0227c97797cd 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear/spear3xx.c
@@ -15,10 +15,13 @@
15 15
16#include <linux/amba/pl022.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl080.h> 17#include <linux/amba/pl080.h>
18#include <linux/clk.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <plat/pl080.h> 20#include <asm/mach/map.h>
20#include <mach/generic.h> 21#include "pl080.h"
22#include "generic.h"
21#include <mach/spear.h> 23#include <mach/spear.h>
24#include <mach/misc_regs.h>
22 25
23/* ssp device registration */ 26/* ssp device registration */
24struct pl022_ssp_controller pl022_plat_data = { 27struct pl022_ssp_controller pl022_plat_data = {
@@ -65,13 +68,13 @@ struct pl08x_platform_data pl080_plat_data = {
65 */ 68 */
66struct map_desc spear3xx_io_desc[] __initdata = { 69struct map_desc spear3xx_io_desc[] __initdata = {
67 { 70 {
68 .virtual = VA_SPEAR3XX_ICM1_2_BASE, 71 .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE,
69 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE), 72 .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE),
70 .length = SZ_16M, 73 .length = SZ_16M,
71 .type = MT_DEVICE 74 .type = MT_DEVICE
72 }, { 75 }, {
73 .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE, 76 .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE,
74 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE), 77 .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE),
75 .length = SZ_16M, 78 .length = SZ_16M,
76 .type = MT_DEVICE 79 .type = MT_DEVICE
77 }, 80 },
@@ -88,7 +91,7 @@ void __init spear3xx_timer_init(void)
88 char pclk_name[] = "pll3_clk"; 91 char pclk_name[] = "pll3_clk";
89 struct clk *gpt_clk, *pclk; 92 struct clk *gpt_clk, *pclk;
90 93
91 spear3xx_clk_init(); 94 spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE);
92 95
93 /* get the system timer clock */ 96 /* get the system timer clock */
94 gpt_clk = clk_get_sys("gpt0", NULL); 97 gpt_clk = clk_get_sys("gpt0", NULL);
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear/spear6xx.c
index 8904d8a52d84..ec8eefbbdfad 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear/spear6xx.c
@@ -24,9 +24,10 @@
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/mach/time.h> 25#include <asm/mach/time.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <plat/pl080.h> 27#include "pl080.h"
28#include <mach/generic.h> 28#include "generic.h"
29#include <mach/spear.h> 29#include <mach/spear.h>
30#include <mach/misc_regs.h>
30 31
31/* dmac device registration */ 32/* dmac device registration */
32static struct pl08x_channel_data spear600_dma_info[] = { 33static struct pl08x_channel_data spear600_dma_info[] = {
@@ -321,7 +322,7 @@ static struct pl08x_channel_data spear600_dma_info[] = {
321 }, 322 },
322}; 323};
323 324
324struct pl08x_platform_data pl080_plat_data = { 325static struct pl08x_platform_data spear6xx_pl080_plat_data = {
325 .memcpy_channel = { 326 .memcpy_channel = {
326 .bus_id = "memcpy", 327 .bus_id = "memcpy",
327 .cctl_memcpy = 328 .cctl_memcpy =
@@ -350,18 +351,18 @@ struct pl08x_platform_data pl080_plat_data = {
350 */ 351 */
351struct map_desc spear6xx_io_desc[] __initdata = { 352struct map_desc spear6xx_io_desc[] __initdata = {
352 { 353 {
353 .virtual = VA_SPEAR6XX_ML_CPU_BASE, 354 .virtual = (unsigned long)VA_SPEAR6XX_ML_CPU_BASE,
354 .pfn = __phys_to_pfn(SPEAR6XX_ML_CPU_BASE), 355 .pfn = __phys_to_pfn(SPEAR_ICM3_ML1_2_BASE),
355 .length = 2 * SZ_16M, 356 .length = 2 * SZ_16M,
356 .type = MT_DEVICE 357 .type = MT_DEVICE
357 }, { 358 }, {
358 .virtual = VA_SPEAR6XX_ICM1_BASE, 359 .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE,
359 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_BASE), 360 .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE),
360 .length = SZ_16M, 361 .length = SZ_16M,
361 .type = MT_DEVICE 362 .type = MT_DEVICE
362 }, { 363 }, {
363 .virtual = VA_SPEAR6XX_ICM3_SMI_CTRL_BASE, 364 .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE,
364 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SMI_CTRL_BASE), 365 .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE),
365 .length = SZ_16M, 366 .length = SZ_16M,
366 .type = MT_DEVICE 367 .type = MT_DEVICE
367 }, 368 },
@@ -378,7 +379,7 @@ void __init spear6xx_timer_init(void)
378 char pclk_name[] = "pll3_clk"; 379 char pclk_name[] = "pll3_clk";
379 struct clk *gpt_clk, *pclk; 380 struct clk *gpt_clk, *pclk;
380 381
381 spear6xx_clk_init(); 382 spear6xx_clk_init(MISC_BASE);
382 383
383 /* get the system timer clock */ 384 /* get the system timer clock */
384 gpt_clk = clk_get_sys("gpt0", NULL); 385 gpt_clk = clk_get_sys("gpt0", NULL);
@@ -404,8 +405,8 @@ void __init spear6xx_timer_init(void)
404 405
405/* Add auxdata to pass platform data */ 406/* Add auxdata to pass platform data */
406struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = { 407struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = {
407 OF_DEV_AUXDATA("arm,pl080", SPEAR6XX_ICM3_DMA_BASE, NULL, 408 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
408 &pl080_plat_data), 409 &spear6xx_pl080_plat_data),
409 {} 410 {}
410}; 411};
411 412
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/mach-spear/time.c
index bd5c53cd6962..d449673e40f7 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/mach-spear/time.c
@@ -23,7 +23,7 @@
23#include <linux/time.h> 23#include <linux/time.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <asm/mach/time.h> 25#include <asm/mach/time.h>
26#include <mach/generic.h> 26#include "generic.h"
27 27
28/* 28/*
29 * We would use TIMER0 and TIMER1 as clockevent and clocksource. 29 * We would use TIMER0 and TIMER1 as clockevent and clocksource.
diff --git a/arch/arm/mach-spear13xx/Kconfig b/arch/arm/mach-spear13xx/Kconfig
deleted file mode 100644
index eaadc66d96b3..000000000000
--- a/arch/arm/mach-spear13xx/Kconfig
+++ /dev/null
@@ -1,20 +0,0 @@
1#
2# SPEAr13XX Machine configuration file
3#
4
5if ARCH_SPEAR13XX
6
7menu "SPEAr13xx Implementations"
8config MACH_SPEAR1310
9 bool "SPEAr1310 Machine support with Device Tree"
10 select PINCTRL_SPEAR1310
11 help
12 Supports ST SPEAr1310 machine configured via the device-tree
13
14config MACH_SPEAR1340
15 bool "SPEAr1340 Machine support with Device Tree"
16 select PINCTRL_SPEAR1340
17 help
18 Supports ST SPEAr1340 machine configured via the device-tree
19endmenu
20endif #ARCH_SPEAR13XX
diff --git a/arch/arm/mach-spear13xx/Makefile b/arch/arm/mach-spear13xx/Makefile
deleted file mode 100644
index 3435ea78c15d..000000000000
--- a/arch/arm/mach-spear13xx/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Makefile for SPEAr13XX machine series
3#
4
5obj-$(CONFIG_SMP) += headsmp.o platsmp.o
6obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
7
8obj-$(CONFIG_ARCH_SPEAR13XX) += spear13xx.o
9obj-$(CONFIG_MACH_SPEAR1310) += spear1310.o
10obj-$(CONFIG_MACH_SPEAR1340) += spear1340.o
diff --git a/arch/arm/mach-spear13xx/include/mach/debug-macro.S b/arch/arm/mach-spear13xx/include/mach/debug-macro.S
deleted file mode 100644
index 9e3ae6bfe50d..000000000000
--- a/arch/arm/mach-spear13xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-spear13xx/include/mach/debug-macro.S
3 *
4 * Debugging macro include header spear13xx machine family
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-spear13xx/include/mach/hardware.h b/arch/arm/mach-spear13xx/include/mach/hardware.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-spear13xx/include/mach/hardware.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-spear13xx/include/mach/irqs.h b/arch/arm/mach-spear13xx/include/mach/irqs.h
deleted file mode 100644
index 271a62b4cd31..000000000000
--- a/arch/arm/mach-spear13xx/include/mach/irqs.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/mach-spear13xx/include/mach/irqs.h
3 *
4 * IRQ helper macros for spear13xx machine family
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_IRQS_H
15#define __MACH_IRQS_H
16
17#define IRQ_GIC_END 160
18#define NR_IRQS IRQ_GIC_END
19
20#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear13xx/include/mach/spear.h b/arch/arm/mach-spear13xx/include/mach/spear.h
deleted file mode 100644
index 7cfa6818865a..000000000000
--- a/arch/arm/mach-spear13xx/include/mach/spear.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * arch/arm/mach-spear13xx/include/mach/spear.h
3 *
4 * spear13xx Machine family specific definition
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_SPEAR13XX_H
15#define __MACH_SPEAR13XX_H
16
17#include <asm/memory.h>
18
19#define PERIP_GRP2_BASE UL(0xB3000000)
20#define VA_PERIP_GRP2_BASE IOMEM(0xFE000000)
21#define MCIF_SDHCI_BASE UL(0xB3000000)
22#define SYSRAM0_BASE UL(0xB3800000)
23#define VA_SYSRAM0_BASE IOMEM(0xFE800000)
24#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600)
25
26#define PERIP_GRP1_BASE UL(0xE0000000)
27#define VA_PERIP_GRP1_BASE IOMEM(0xFD000000)
28#define UART_BASE UL(0xE0000000)
29#define VA_UART_BASE IOMEM(0xFD000000)
30#define SSP_BASE UL(0xE0100000)
31#define MISC_BASE UL(0xE0700000)
32#define VA_MISC_BASE IOMEM(0xFD700000)
33
34#define A9SM_AND_MPMC_BASE UL(0xEC000000)
35#define VA_A9SM_AND_MPMC_BASE IOMEM(0xFC000000)
36
37/* A9SM peripheral offsets */
38#define A9SM_PERIP_BASE UL(0xEC800000)
39#define VA_A9SM_PERIP_BASE IOMEM(0xFC800000)
40#define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00)
41
42#define L2CC_BASE UL(0xED000000)
43#define VA_L2CC_BASE IOMEM(UL(0xFB000000))
44
45/* others */
46#define DMAC0_BASE UL(0xEA800000)
47#define DMAC1_BASE UL(0xEB000000)
48#define MCIF_CF_BASE UL(0xB2800000)
49
50/* Debug uart for linux, will be used for debug and uncompress messages */
51#define SPEAR_DBG_UART_BASE UART_BASE
52#define VA_SPEAR_DBG_UART_BASE VA_UART_BASE
53
54#endif /* __MACH_SPEAR13XX_H */
diff --git a/arch/arm/mach-spear13xx/include/mach/timex.h b/arch/arm/mach-spear13xx/include/mach/timex.h
deleted file mode 100644
index 3a58b8284a6a..000000000000
--- a/arch/arm/mach-spear13xx/include/mach/timex.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/timex.h
3 *
4 * SPEAr3XX machine family specific timex definitions
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_TIMEX_H
15#define __MACH_TIMEX_H
16
17#include <plat/timex.h>
18
19#endif /* __MACH_TIMEX_H */
diff --git a/arch/arm/mach-spear13xx/include/mach/uncompress.h b/arch/arm/mach-spear13xx/include/mach/uncompress.h
deleted file mode 100644
index 70fe72f05dea..000000000000
--- a/arch/arm/mach-spear13xx/include/mach/uncompress.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear13xx/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_UNCOMPRESS_H
15#define __MACH_UNCOMPRESS_H
16
17#include <plat/uncompress.h>
18
19#endif /* __MACH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-spear3xx/Kconfig b/arch/arm/mach-spear3xx/Kconfig
deleted file mode 100644
index 8bd37291fa4f..000000000000
--- a/arch/arm/mach-spear3xx/Kconfig
+++ /dev/null
@@ -1,26 +0,0 @@
1#
2# SPEAr3XX Machine configuration file
3#
4
5if ARCH_SPEAR3XX
6
7menu "SPEAr3xx Implementations"
8config MACH_SPEAR300
9 bool "SPEAr300 Machine support with Device Tree"
10 select PINCTRL_SPEAR300
11 help
12 Supports ST SPEAr300 machine configured via the device-tree
13
14config MACH_SPEAR310
15 bool "SPEAr310 Machine support with Device Tree"
16 select PINCTRL_SPEAR310
17 help
18 Supports ST SPEAr310 machine configured via the device-tree
19
20config MACH_SPEAR320
21 bool "SPEAr320 Machine support with Device Tree"
22 select PINCTRL_SPEAR320
23 help
24 Supports ST SPEAr320 machine configured via the device-tree
25endmenu
26endif #ARCH_SPEAR3XX
diff --git a/arch/arm/mach-spear3xx/Makefile b/arch/arm/mach-spear3xx/Makefile
deleted file mode 100644
index 8d12faa178fd..000000000000
--- a/arch/arm/mach-spear3xx/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
1#
2# Makefile for SPEAr3XX machine series
3#
4
5# common files
6obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o
7
8# spear300 specific files
9obj-$(CONFIG_MACH_SPEAR300) += spear300.o
10
11# spear310 specific files
12obj-$(CONFIG_MACH_SPEAR310) += spear310.o
13
14# spear320 specific files
15obj-$(CONFIG_MACH_SPEAR320) += spear320.o
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot
deleted file mode 100644
index 4674a4c221db..000000000000
--- a/arch/arm/mach-spear3xx/Makefile.boot
+++ /dev/null
@@ -1,3 +0,0 @@
1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-spear3xx/include/mach/debug-macro.S b/arch/arm/mach-spear3xx/include/mach/debug-macro.S
deleted file mode 100644
index 0a6381fad5d9..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/debug-macro.S
3 *
4 * Debugging macro include header spear3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
deleted file mode 100644
index df310799e416..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/generic.h
3 *
4 * SPEAr3XX machine family generic header file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_GENERIC_H
15#define __MACH_GENERIC_H
16
17#include <linux/amba/pl08x.h>
18#include <linux/init.h>
19#include <linux/platform_device.h>
20#include <linux/amba/bus.h>
21#include <asm/mach/time.h>
22#include <asm/mach/map.h>
23
24/* Add spear3xx family device structure declarations here */
25extern void spear3xx_timer_init(void);
26extern struct pl022_ssp_controller pl022_plat_data;
27extern struct pl08x_platform_data pl080_plat_data;
28
29/* Add spear3xx family function declarations here */
30void __init spear_setup_of_timer(void);
31void __init spear3xx_clk_init(void);
32void __init spear3xx_map_io(void);
33
34void spear_restart(char, const char *);
35
36#endif /* __MACH_GENERIC_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/hardware.h b/arch/arm/mach-spear3xx/include/mach/hardware.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/hardware.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h
deleted file mode 100644
index f95e5b2b6686..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/irqs.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/irqs.h
3 *
4 * IRQ helper macros for SPEAr3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_IRQS_H
15#define __MACH_IRQS_H
16
17#define NR_IRQS 256
18
19#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h
deleted file mode 100644
index 8cca95193d4d..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear.h
3 *
4 * SPEAr3xx Machine family specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_SPEAR3XX_H
15#define __MACH_SPEAR3XX_H
16
17#include <asm/memory.h>
18
19/* ICM1 - Low speed connection */
20#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000)
21#define VA_SPEAR3XX_ICM1_2_BASE UL(0xFD000000)
22#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000)
23#define VA_SPEAR3XX_ICM1_UART_BASE (VA_SPEAR3XX_ICM1_2_BASE | SPEAR3XX_ICM1_UART_BASE)
24#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000)
25
26/* ML1 - Multi Layer CPU Subsystem */
27#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000)
28#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
29
30/* ICM3 - Basic Subsystem */
31#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
32#define VA_SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
33#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000)
34#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
35#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_SYS_CTRL_BASE)
36#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
37#define VA_SPEAR3XX_ICM3_MISC_REG_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_MISC_REG_BASE)
38
39/* Debug uart for linux, will be used for debug and uncompress messages */
40#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE
41#define VA_SPEAR_DBG_UART_BASE VA_SPEAR3XX_ICM1_UART_BASE
42
43/* Sysctl base for spear platform */
44#define SPEAR_SYS_CTRL_BASE SPEAR3XX_ICM3_SYS_CTRL_BASE
45#define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR3XX_ICM3_SYS_CTRL_BASE
46
47/* SPEAr320 Macros */
48#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
49#define VA_SPEAR320_SOC_CONFIG_BASE UL(0xFE000000)
50#define SPEAR320_CONTROL_REG IOMEM(VA_SPEAR320_SOC_CONFIG_BASE)
51#define SPEAR320_EXT_CTRL_REG IOMEM(VA_SPEAR320_SOC_CONFIG_BASE + 0x0018)
52 #define SPEAR320_UARTX_PCLK_MASK 0x1
53 #define SPEAR320_UART2_PCLK_SHIFT 8
54 #define SPEAR320_UART3_PCLK_SHIFT 9
55 #define SPEAR320_UART4_PCLK_SHIFT 10
56 #define SPEAR320_UART5_PCLK_SHIFT 11
57 #define SPEAR320_UART6_PCLK_SHIFT 12
58 #define SPEAR320_RS485_PCLK_SHIFT 13
59
60#endif /* __MACH_SPEAR3XX_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/timex.h b/arch/arm/mach-spear3xx/include/mach/timex.h
deleted file mode 100644
index 9f5d08bd0c44..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/timex.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/timex.h
3 *
4 * SPEAr3XX machine family specific timex definitions
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_TIMEX_H
15#define __MACH_TIMEX_H
16
17#include <plat/timex.h>
18
19#endif /* __MACH_TIMEX_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/uncompress.h b/arch/arm/mach-spear3xx/include/mach/uncompress.h
deleted file mode 100644
index b909b011f7c8..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/uncompress.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_UNCOMPRESS_H
15#define __MACH_UNCOMPRESS_H
16
17#include <plat/uncompress.h>
18
19#endif /* __MACH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-spear6xx/Kconfig b/arch/arm/mach-spear6xx/Kconfig
deleted file mode 100644
index 339f397dea70..000000000000
--- a/arch/arm/mach-spear6xx/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# SPEAr6XX Machine configuration file
3#
4
5config MACH_SPEAR600
6 def_bool y
7 depends on ARCH_SPEAR6XX
8 select USE_OF
9 help
10 Supports ST SPEAr600 boards configured via the device-tree
diff --git a/arch/arm/mach-spear6xx/Makefile b/arch/arm/mach-spear6xx/Makefile
deleted file mode 100644
index 898831d93f37..000000000000
--- a/arch/arm/mach-spear6xx/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# Makefile for SPEAr6XX machine series
3#
4
5# common files
6obj-y += spear6xx.o
diff --git a/arch/arm/mach-spear6xx/Makefile.boot b/arch/arm/mach-spear6xx/Makefile.boot
deleted file mode 100644
index 4674a4c221db..000000000000
--- a/arch/arm/mach-spear6xx/Makefile.boot
+++ /dev/null
@@ -1,3 +0,0 @@
1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-spear6xx/include/mach/debug-macro.S b/arch/arm/mach-spear6xx/include/mach/debug-macro.S
deleted file mode 100644
index 0f3ea39edd96..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/debug-macro.S
3 *
4 * Debugging macro include header for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h
deleted file mode 100644
index 65514b159370..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/generic.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/generic.h
3 *
4 * SPEAr6XX machine family specific generic header file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_GENERIC_H
15#define __MACH_GENERIC_H
16
17#include <linux/init.h>
18
19void __init spear_setup_of_timer(void);
20void spear_restart(char, const char *);
21void __init spear6xx_clk_init(void);
22
23#endif /* __MACH_GENERIC_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/hardware.h b/arch/arm/mach-spear6xx/include/mach/hardware.h
deleted file mode 100644
index 40a8c178f10d..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/hardware.h
+++ /dev/null
@@ -1 +0,0 @@
1/* empty */
diff --git a/arch/arm/mach-spear6xx/include/mach/misc_regs.h b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
deleted file mode 100644
index c34acc201d34..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/misc_regs.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/misc_regs.h
3 *
4 * Miscellaneous registers definitions for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H
16
17#include <mach/spear.h>
18
19#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE)
20#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
21
22#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/spear.h b/arch/arm/mach-spear6xx/include/mach/spear.h
deleted file mode 100644
index cb8ed2f4dc85..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/spear.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/spear.h
3 *
4 * SPEAr6xx Machine family specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_SPEAR6XX_H
15#define __MACH_SPEAR6XX_H
16
17#include <asm/memory.h>
18
19/* ICM1 - Low speed connection */
20#define SPEAR6XX_ICM1_BASE UL(0xD0000000)
21#define VA_SPEAR6XX_ICM1_BASE UL(0xFD000000)
22#define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000)
23#define VA_SPEAR6XX_ICM1_UART0_BASE (VA_SPEAR6XX_ICM1_2_BASE | SPEAR6XX_ICM1_UART0_BASE)
24
25/* ML-1, 2 - Multi Layer CPU Subsystem */
26#define SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
27#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
28
29/* ICM3 - Basic Subsystem */
30#define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
31#define VA_SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
32#define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000)
33#define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
34#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_SYS_CTRL_BASE)
35#define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
36#define VA_SPEAR6XX_ICM3_MISC_REG_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_MISC_REG_BASE)
37
38/* Debug uart for linux, will be used for debug and uncompress messages */
39#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE
40#define VA_SPEAR_DBG_UART_BASE VA_SPEAR6XX_ICM1_UART0_BASE
41
42/* Sysctl base for spear platform */
43#define SPEAR_SYS_CTRL_BASE SPEAR6XX_ICM3_SYS_CTRL_BASE
44#define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR6XX_ICM3_SYS_CTRL_BASE
45
46#endif /* __MACH_SPEAR6XX_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/timex.h b/arch/arm/mach-spear6xx/include/mach/timex.h
deleted file mode 100644
index ac1c5b005695..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/timex.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/timex.h
3 *
4 * SPEAr6XX machine family specific timex definitions
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_TIMEX_H
15#define __MACH_TIMEX_H
16
17#include <plat/timex.h>
18
19#endif /* __MACH_TIMEX_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/uncompress.h b/arch/arm/mach-spear6xx/include/mach/uncompress.h
deleted file mode 100644
index 77f0765e21e1..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/uncompress.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/uncompress.h
3 *
4 * Serial port stubs for kernel decompress status messages
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_UNCOMPRESS_H
15#define __MACH_UNCOMPRESS_H
16
17#include <plat/uncompress.h>
18
19#endif /* __MACH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 8709a39bd34c..d259c782d742 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,10 +1,11 @@
1config ARCH_SUNXI 1config ARCH_SUNXI
2 bool "Allwinner A1X SOCs" if ARCH_MULTI_V7 2 bool "Allwinner A1X SOCs" if ARCH_MULTI_V7
3 select CLKSRC_MMIO 3 select CLKSRC_MMIO
4 select CLKSRC_OF
4 select COMMON_CLK 5 select COMMON_CLK
5 select GENERIC_CLOCKEVENTS 6 select GENERIC_CLOCKEVENTS
6 select GENERIC_IRQ_CHIP 7 select GENERIC_IRQ_CHIP
7 select PINCTRL 8 select PINCTRL
8 select SPARSE_IRQ 9 select SPARSE_IRQ
9 select SUNXI_TIMER 10 select SUN4I_TIMER
10 select PINCTRL_SUNXI \ No newline at end of file 11 select PINCTRL_SUNXI
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 23afb732cb40..706ce35396b8 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -10,63 +10,77 @@
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12
13#include <linux/clocksource.h>
13#include <linux/delay.h> 14#include <linux/delay.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/irqchip.h>
16#include <linux/of_address.h> 18#include <linux/of_address.h>
17#include <linux/of_irq.h> 19#include <linux/of_irq.h>
18#include <linux/of_platform.h> 20#include <linux/of_platform.h>
19#include <linux/io.h> 21#include <linux/io.h>
20#include <linux/sunxi_timer.h>
21 22
22#include <linux/irqchip/sunxi.h> 23#include <linux/clk/sunxi.h>
23 24
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/system_misc.h>
26 28
27#include "sunxi.h" 29#include "sunxi.h"
28 30
29#define WATCHDOG_CTRL_REG 0x00 31#define SUN4I_WATCHDOG_CTRL_REG 0x00
30#define WATCHDOG_CTRL_RESTART (1 << 0) 32#define SUN4I_WATCHDOG_CTRL_RESTART (1 << 0)
31#define WATCHDOG_MODE_REG 0x04 33#define SUN4I_WATCHDOG_MODE_REG 0x04
32#define WATCHDOG_MODE_ENABLE (1 << 0) 34#define SUN4I_WATCHDOG_MODE_ENABLE (1 << 0)
33#define WATCHDOG_MODE_RESET_ENABLE (1 << 1) 35#define SUN4I_WATCHDOG_MODE_RESET_ENABLE (1 << 1)
34 36
35static void __iomem *wdt_base; 37static void __iomem *wdt_base;
36 38
37static void sunxi_setup_restart(void) 39static void sun4i_restart(char mode, const char *cmd)
38{
39 struct device_node *np = of_find_compatible_node(NULL, NULL,
40 "allwinner,sunxi-wdt");
41 if (WARN(!np, "unable to setup watchdog restart"))
42 return;
43
44 wdt_base = of_iomap(np, 0);
45 WARN(!wdt_base, "failed to map watchdog base address");
46}
47
48static void sunxi_restart(char mode, const char *cmd)
49{ 40{
50 if (!wdt_base) 41 if (!wdt_base)
51 return; 42 return;
52 43
53 /* Enable timer and set reset bit in the watchdog */ 44 /* Enable timer and set reset bit in the watchdog */
54 writel(WATCHDOG_MODE_ENABLE | WATCHDOG_MODE_RESET_ENABLE, 45 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
55 wdt_base + WATCHDOG_MODE_REG); 46 wdt_base + SUN4I_WATCHDOG_MODE_REG);
56 47
57 /* 48 /*
58 * Restart the watchdog. The default (and lowest) interval 49 * Restart the watchdog. The default (and lowest) interval
59 * value for the watchdog is 0.5s. 50 * value for the watchdog is 0.5s.
60 */ 51 */
61 writel(WATCHDOG_CTRL_RESTART, wdt_base + WATCHDOG_CTRL_REG); 52 writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG);
62 53
63 while (1) { 54 while (1) {
64 mdelay(5); 55 mdelay(5);
65 writel(WATCHDOG_MODE_ENABLE | WATCHDOG_MODE_RESET_ENABLE, 56 writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE,
66 wdt_base + WATCHDOG_MODE_REG); 57 wdt_base + SUN4I_WATCHDOG_MODE_REG);
67 } 58 }
68} 59}
69 60
61static struct of_device_id sunxi_restart_ids[] = {
62 { .compatible = "allwinner,sun4i-wdt", .data = sun4i_restart },
63 { /*sentinel*/ }
64};
65
66static void sunxi_setup_restart(void)
67{
68 const struct of_device_id *of_id;
69 struct device_node *np;
70
71 np = of_find_matching_node(NULL, sunxi_restart_ids);
72 if (WARN(!np, "unable to setup watchdog restart"))
73 return;
74
75 wdt_base = of_iomap(np, 0);
76 WARN(!wdt_base, "failed to map watchdog base address");
77
78 of_id = of_match_node(sunxi_restart_ids, np);
79 WARN(!of_id, "restart function not available");
80
81 arm_pm_restart = of_id->data;
82}
83
70static struct map_desc sunxi_io_desc[] __initdata = { 84static struct map_desc sunxi_io_desc[] __initdata = {
71 { 85 {
72 .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE, 86 .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE,
@@ -81,6 +95,12 @@ void __init sunxi_map_io(void)
81 iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc)); 95 iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc));
82} 96}
83 97
98static void __init sunxi_timer_init(void)
99{
100 sunxi_init_clocks();
101 clocksource_of_init();
102}
103
84static void __init sunxi_dt_init(void) 104static void __init sunxi_dt_init(void)
85{ 105{
86 sunxi_setup_restart(); 106 sunxi_setup_restart();
@@ -97,9 +117,7 @@ static const char * const sunxi_board_dt_compat[] = {
97DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 117DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
98 .init_machine = sunxi_dt_init, 118 .init_machine = sunxi_dt_init,
99 .map_io = sunxi_map_io, 119 .map_io = sunxi_map_io,
100 .init_irq = sunxi_init_irq, 120 .init_irq = irqchip_init,
101 .handle_irq = sunxi_handle_irq, 121 .init_time = sunxi_timer_init,
102 .restart = sunxi_restart,
103 .init_time = &sunxi_timer_init,
104 .dt_compat = sunxi_board_dt_compat, 122 .dt_compat = sunxi_board_dt_compat,
105MACHINE_END 123MACHINE_END
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index d1c4893894ce..20c3b372cdf5 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -1,13 +1,30 @@
1if ARCH_TEGRA 1config ARCH_TEGRA
2 bool "NVIDIA Tegra" if ARCH_MULTI_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_REQUIRE_GPIOLIB
5 select CLKDEV_LOOKUP
6 select CLKSRC_MMIO
7 select CLKSRC_OF
8 select COMMON_CLK
9 select GENERIC_CLOCKEVENTS
10 select HAVE_ARM_SCU if SMP
11 select HAVE_ARM_TWD if LOCAL_TIMERS
12 select HAVE_CLK
13 select HAVE_SMP
14 select MIGHT_HAVE_CACHE_L2X0
15 select SOC_BUS
16 select SPARSE_IRQ
17 select USE_OF
18 help
19 This enables support for NVIDIA Tegra based systems.
2 20
3comment "NVIDIA Tegra options" 21menu "NVIDIA Tegra options"
22 depends on ARCH_TEGRA
4 23
5config ARCH_TEGRA_2x_SOC 24config ARCH_TEGRA_2x_SOC
6 bool "Enable support for Tegra20 family" 25 bool "Enable support for Tegra20 family"
7 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP 26 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
8 select ARM_ERRATA_720789 27 select ARM_ERRATA_720789
9 select ARM_ERRATA_742230 if SMP
10 select ARM_ERRATA_751472
11 select ARM_ERRATA_754327 if SMP 28 select ARM_ERRATA_754327 if SMP
12 select ARM_ERRATA_764369 if SMP 29 select ARM_ERRATA_764369 if SMP
13 select ARM_GIC 30 select ARM_GIC
@@ -18,16 +35,14 @@ config ARCH_TEGRA_2x_SOC
18 select PL310_ERRATA_727915 if CACHE_L2X0 35 select PL310_ERRATA_727915 if CACHE_L2X0
19 select PL310_ERRATA_769419 if CACHE_L2X0 36 select PL310_ERRATA_769419 if CACHE_L2X0
20 select USB_ARCH_HAS_EHCI if USB_SUPPORT 37 select USB_ARCH_HAS_EHCI if USB_SUPPORT
21 select USB_ULPI if USB 38 select USB_ULPI if USB_PHY
22 select USB_ULPI_VIEWPORT if USB_SUPPORT 39 select USB_ULPI_VIEWPORT if USB_PHY
23 help 40 help
24 Support for NVIDIA Tegra AP20 and T20 processors, based on the 41 Support for NVIDIA Tegra AP20 and T20 processors, based on the
25 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller 42 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
26 43
27config ARCH_TEGRA_3x_SOC 44config ARCH_TEGRA_3x_SOC
28 bool "Enable support for Tegra30 family" 45 bool "Enable support for Tegra30 family"
29 select ARM_ERRATA_743622
30 select ARM_ERRATA_751472
31 select ARM_ERRATA_754322 46 select ARM_ERRATA_754322
32 select ARM_ERRATA_764369 if SMP 47 select ARM_ERRATA_764369 if SMP
33 select ARM_GIC 48 select ARM_GIC
@@ -37,8 +52,8 @@ config ARCH_TEGRA_3x_SOC
37 select PINCTRL_TEGRA30 52 select PINCTRL_TEGRA30
38 select PL310_ERRATA_769419 if CACHE_L2X0 53 select PL310_ERRATA_769419 if CACHE_L2X0
39 select USB_ARCH_HAS_EHCI if USB_SUPPORT 54 select USB_ARCH_HAS_EHCI if USB_SUPPORT
40 select USB_ULPI if USB 55 select USB_ULPI if USB_PHY
41 select USB_ULPI_VIEWPORT if USB_SUPPORT 56 select USB_ULPI_VIEWPORT if USB_PHY
42 help 57 help
43 Support for NVIDIA Tegra T30 processor family, based on the 58 Support for NVIDIA Tegra T30 processor family, based on the
44 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller 59 ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
@@ -71,4 +86,4 @@ config TEGRA_AHB
71config TEGRA_EMC_SCALING_ENABLE 86config TEGRA_EMC_SCALING_ENABLE
72 bool "Enable scaling the memory frequency" 87 bool "Enable scaling the memory frequency"
73 88
74endif 89endmenu
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index f6b46ae2b7f8..d011f0ad49c4 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -1,3 +1,5 @@
1asflags-y += -march=armv7-a
2
1obj-y += common.o 3obj-y += common.o
2obj-y += io.o 4obj-y += io.o
3obj-y += irq.o 5obj-y += irq.o
@@ -10,6 +12,7 @@ obj-y += pm.o
10obj-y += reset.o 12obj-y += reset.o
11obj-y += reset-handler.o 13obj-y += reset-handler.o
12obj-y += sleep.o 14obj-y += sleep.o
15obj-y += tegra.o
13obj-$(CONFIG_CPU_IDLE) += cpuidle.o 16obj-$(CONFIG_CPU_IDLE) += cpuidle.o
14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o 17obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o
15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o 18obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o
@@ -24,12 +27,9 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += cpuidle-tegra30.o
24endif 27endif
25obj-$(CONFIG_SMP) += platsmp.o headsmp.o 28obj-$(CONFIG_SMP) += platsmp.o headsmp.o
26obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 29obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
27obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
28obj-$(CONFIG_TEGRA_PCI) += pcie.o 30obj-$(CONFIG_TEGRA_PCI) += pcie.o
29 31
30obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o 32obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o
31obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o
32obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra114.o
33ifeq ($(CONFIG_CPU_IDLE),y) 33ifeq ($(CONFIG_CPU_IDLE),y)
34obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o 34obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o
35endif 35endif
diff --git a/arch/arm/mach-tegra/Makefile.boot b/arch/arm/mach-tegra/Makefile.boot
deleted file mode 100644
index 29433816233c..000000000000
--- a/arch/arm/mach-tegra/Makefile.boot
+++ /dev/null
@@ -1,3 +0,0 @@
1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) += 0x00008000
2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100
3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000
diff --git a/arch/arm/mach-tegra/board-dt-tegra114.c b/arch/arm/mach-tegra/board-dt-tegra114.c
deleted file mode 100644
index 085d63637b62..000000000000
--- a/arch/arm/mach-tegra/board-dt-tegra114.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * NVIDIA Tegra114 device tree board support
3 *
4 * Copyright (C) 2013 NVIDIA Corporation
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/of.h>
18#include <linux/of_platform.h>
19#include <linux/clocksource.h>
20
21#include <asm/mach/arch.h>
22
23#include "board.h"
24#include "common.h"
25
26static void __init tegra114_dt_init(void)
27{
28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
29}
30
31static const char * const tegra114_dt_board_compat[] = {
32 "nvidia,tegra114",
33 NULL,
34};
35
36DT_MACHINE_START(TEGRA114_DT, "NVIDIA Tegra114 (Flattened Device Tree)")
37 .smp = smp_ops(tegra_smp_ops),
38 .map_io = tegra_map_common_io,
39 .init_early = tegra114_init_early,
40 .init_irq = tegra_dt_init_irq,
41 .init_time = clocksource_of_init,
42 .init_machine = tegra114_dt_init,
43 .init_late = tegra_init_late,
44 .restart = tegra_assert_system_reset,
45 .dt_compat = tegra114_dt_board_compat,
46MACHINE_END
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
deleted file mode 100644
index bf68567e549d..000000000000
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * arch/arm/mach-tegra/board-dt-tegra30.c
3 *
4 * NVIDIA Tegra30 device tree board support
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
7 *
8 * Derived from:
9 *
10 * arch/arm/mach-tegra/board-dt-tegra20.c
11 *
12 * Copyright (C) 2010 Secret Lab Technologies, Ltd.
13 * Copyright (C) 2010 Google, Inc.
14 *
15 * This software is licensed under the terms of the GNU General Public
16 * License version 2, as published by the Free Software Foundation, and
17 * may be copied, distributed, and modified under those terms.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 */
25
26#include <linux/clocksource.h>
27#include <linux/kernel.h>
28#include <linux/of.h>
29#include <linux/of_address.h>
30#include <linux/of_fdt.h>
31#include <linux/of_irq.h>
32#include <linux/of_platform.h>
33
34#include <asm/mach/arch.h>
35
36#include "board.h"
37#include "common.h"
38#include "iomap.h"
39
40static void __init tegra30_dt_init(void)
41{
42 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
43}
44
45static const char *tegra30_dt_board_compat[] = {
46 "nvidia,tegra30",
47 NULL
48};
49
50DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
51 .smp = smp_ops(tegra_smp_ops),
52 .map_io = tegra_map_common_io,
53 .init_early = tegra30_init_early,
54 .init_irq = tegra_dt_init_irq,
55 .init_time = clocksource_of_init,
56 .init_machine = tegra30_dt_init,
57 .init_late = tegra_init_late,
58 .restart = tegra_assert_system_reset,
59 .dt_compat = tegra30_dt_board_compat,
60MACHINE_END
diff --git a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c
index 3cdc1bb8254c..035b240b9e15 100644
--- a/arch/arm/mach-tegra/board-harmony-pcie.c
+++ b/arch/arm/mach-tegra/board-harmony-pcie.c
@@ -56,13 +56,17 @@ int __init harmony_pcie_init(void)
56 gpio_direction_output(en_vdd_1v05, 1); 56 gpio_direction_output(en_vdd_1v05, 1);
57 57
58 regulator = regulator_get(NULL, "vdd_ldo0,vddio_pex_clk"); 58 regulator = regulator_get(NULL, "vdd_ldo0,vddio_pex_clk");
59 if (IS_ERR_OR_NULL(regulator)) { 59 if (IS_ERR(regulator)) {
60 pr_err("%s: regulator_get failed: %d\n", __func__, 60 err = PTR_ERR(regulator);
61 (int)PTR_ERR(regulator)); 61 pr_err("%s: regulator_get failed: %d\n", __func__, err);
62 goto err_reg; 62 goto err_reg;
63 } 63 }
64 64
65 regulator_enable(regulator); 65 err = regulator_enable(regulator);
66 if (err) {
67 pr_err("%s: regulator_enable failed: %d\n", __func__, err);
68 goto err_en;
69 }
66 70
67 err = tegra_pcie_init(true, true); 71 err = tegra_pcie_init(true, true);
68 if (err) { 72 if (err) {
@@ -74,6 +78,7 @@ int __init harmony_pcie_init(void)
74 78
75err_pcie: 79err_pcie:
76 regulator_disable(regulator); 80 regulator_disable(regulator);
81err_en:
77 regulator_put(regulator); 82 regulator_put(regulator);
78err_reg: 83err_reg:
79 gpio_free(en_vdd_1v05); 84 gpio_free(en_vdd_1v05);
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 86851c81a350..1787327fae3a 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -26,9 +26,7 @@
26 26
27void tegra_assert_system_reset(char mode, const char *cmd); 27void tegra_assert_system_reset(char mode, const char *cmd);
28 28
29void __init tegra20_init_early(void); 29void __init tegra_init_early(void);
30void __init tegra30_init_early(void);
31void __init tegra114_init_early(void);
32void __init tegra_map_common_io(void); 30void __init tegra_map_common_io(void);
33void __init tegra_init_irq(void); 31void __init tegra_init_irq(void);
34void __init tegra_dt_init_irq(void); 32void __init tegra_dt_init_irq(void);
@@ -42,6 +40,7 @@ int tegra_clk_debugfs_init(void);
42static inline int tegra_clk_debugfs_init(void) { return 0; } 40static inline int tegra_clk_debugfs_init(void) { return 0; }
43#endif 41#endif
44 42
43int __init tegra_powergate_init(void);
45#if defined(CONFIG_ARCH_TEGRA_2x_SOC) && defined(CONFIG_DEBUG_FS) 44#if defined(CONFIG_ARCH_TEGRA_2x_SOC) && defined(CONFIG_DEBUG_FS)
46int __init tegra_powergate_debugfs_init(void); 45int __init tegra_powergate_debugfs_init(void);
47#else 46#else
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 5449a3f2977b..9f852c6fe5b9 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -27,12 +27,11 @@
27 27
28#include <asm/hardware/cache-l2x0.h> 28#include <asm/hardware/cache-l2x0.h>
29 29
30#include <mach/powergate.h>
31
32#include "board.h" 30#include "board.h"
33#include "common.h" 31#include "common.h"
34#include "fuse.h" 32#include "fuse.h"
35#include "iomap.h" 33#include "iomap.h"
34#include "irq.h"
36#include "pmc.h" 35#include "pmc.h"
37#include "apbio.h" 36#include "apbio.h"
38#include "sleep.h" 37#include "sleep.h"
@@ -61,8 +60,10 @@ u32 tegra_uart_config[4] = {
61void __init tegra_dt_init_irq(void) 60void __init tegra_dt_init_irq(void)
62{ 61{
63 tegra_clocks_init(); 62 tegra_clocks_init();
63 tegra_pmc_init();
64 tegra_init_irq(); 64 tegra_init_irq();
65 irqchip_init(); 65 irqchip_init();
66 tegra_legacy_irq_syscore_init();
66} 67}
67#endif 68#endif
68 69
@@ -94,40 +95,18 @@ static void __init tegra_init_cache(void)
94 95
95} 96}
96 97
97static void __init tegra_init_early(void) 98void __init tegra_init_early(void)
98{ 99{
99 tegra_cpu_reset_handler_init(); 100 tegra_cpu_reset_handler_init();
100 tegra_apb_io_init(); 101 tegra_apb_io_init();
101 tegra_init_fuse(); 102 tegra_init_fuse();
102 tegra_init_cache(); 103 tegra_init_cache();
103 tegra_pmc_init();
104 tegra_powergate_init(); 104 tegra_powergate_init();
105 tegra_hotplug_init();
105} 106}
106 107
107#ifdef CONFIG_ARCH_TEGRA_2x_SOC
108void __init tegra20_init_early(void)
109{
110 tegra_init_early();
111 tegra20_hotplug_init();
112}
113#endif
114
115#ifdef CONFIG_ARCH_TEGRA_3x_SOC
116void __init tegra30_init_early(void)
117{
118 tegra_init_early();
119 tegra30_hotplug_init();
120}
121#endif
122
123#ifdef CONFIG_ARCH_TEGRA_114_SOC
124void __init tegra114_init_early(void)
125{
126 tegra_init_early();
127}
128#endif
129
130void __init tegra_init_late(void) 108void __init tegra_init_late(void)
131{ 109{
110 tegra_init_suspend();
132 tegra_powergate_debugfs_init(); 111 tegra_powergate_debugfs_init();
133} 112}
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
index 32f8eb3fe344..5900cc44f780 100644
--- a/arch/arm/mach-tegra/common.h
+++ b/arch/arm/mach-tegra/common.h
@@ -2,4 +2,3 @@ extern struct smp_operations tegra_smp_ops;
2 2
3extern int tegra_cpu_kill(unsigned int cpu); 3extern int tegra_cpu_kill(unsigned int cpu);
4extern void tegra_cpu_die(unsigned int cpu); 4extern void tegra_cpu_die(unsigned int cpu);
5extern int tegra_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
deleted file mode 100644
index e3d6e15ff188..000000000000
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ /dev/null
@@ -1,293 +0,0 @@
1/*
2 * arch/arm/mach-tegra/cpu-tegra.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 * Based on arch/arm/plat-omap/cpu-omap.c, (C) 2005 Nokia Corporation
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
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 */
20
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/types.h>
24#include <linux/sched.h>
25#include <linux/cpufreq.h>
26#include <linux/delay.h>
27#include <linux/init.h>
28#include <linux/err.h>
29#include <linux/clk.h>
30#include <linux/io.h>
31#include <linux/suspend.h>
32
33/* Frequency table index must be sequential starting at 0 */
34static struct cpufreq_frequency_table freq_table[] = {
35 { 0, 216000 },
36 { 1, 312000 },
37 { 2, 456000 },
38 { 3, 608000 },
39 { 4, 760000 },
40 { 5, 816000 },
41 { 6, 912000 },
42 { 7, 1000000 },
43 { 8, CPUFREQ_TABLE_END },
44};
45
46#define NUM_CPUS 2
47
48static struct clk *cpu_clk;
49static struct clk *pll_x_clk;
50static struct clk *pll_p_clk;
51static struct clk *emc_clk;
52
53static unsigned long target_cpu_speed[NUM_CPUS];
54static DEFINE_MUTEX(tegra_cpu_lock);
55static bool is_suspended;
56
57static int tegra_verify_speed(struct cpufreq_policy *policy)
58{
59 return cpufreq_frequency_table_verify(policy, freq_table);
60}
61
62static unsigned int tegra_getspeed(unsigned int cpu)
63{
64 unsigned long rate;
65
66 if (cpu >= NUM_CPUS)
67 return 0;
68
69 rate = clk_get_rate(cpu_clk) / 1000;
70 return rate;
71}
72
73static int tegra_cpu_clk_set_rate(unsigned long rate)
74{
75 int ret;
76
77 /*
78 * Take an extra reference to the main pll so it doesn't turn
79 * off when we move the cpu off of it
80 */
81 clk_prepare_enable(pll_x_clk);
82
83 ret = clk_set_parent(cpu_clk, pll_p_clk);
84 if (ret) {
85 pr_err("Failed to switch cpu to clock pll_p\n");
86 goto out;
87 }
88
89 if (rate == clk_get_rate(pll_p_clk))
90 goto out;
91
92 ret = clk_set_rate(pll_x_clk, rate);
93 if (ret) {
94 pr_err("Failed to change pll_x to %lu\n", rate);
95 goto out;
96 }
97
98 ret = clk_set_parent(cpu_clk, pll_x_clk);
99 if (ret) {
100 pr_err("Failed to switch cpu to clock pll_x\n");
101 goto out;
102 }
103
104out:
105 clk_disable_unprepare(pll_x_clk);
106 return ret;
107}
108
109static int tegra_update_cpu_speed(unsigned long rate)
110{
111 int ret = 0;
112 struct cpufreq_freqs freqs;
113
114 freqs.old = tegra_getspeed(0);
115 freqs.new = rate;
116
117 if (freqs.old == freqs.new)
118 return ret;
119
120 /*
121 * Vote on memory bus frequency based on cpu frequency
122 * This sets the minimum frequency, display or avp may request higher
123 */
124 if (rate >= 816000)
125 clk_set_rate(emc_clk, 600000000); /* cpu 816 MHz, emc max */
126 else if (rate >= 456000)
127 clk_set_rate(emc_clk, 300000000); /* cpu 456 MHz, emc 150Mhz */
128 else
129 clk_set_rate(emc_clk, 100000000); /* emc 50Mhz */
130
131 for_each_online_cpu(freqs.cpu)
132 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
133
134#ifdef CONFIG_CPU_FREQ_DEBUG
135 printk(KERN_DEBUG "cpufreq-tegra: transition: %u --> %u\n",
136 freqs.old, freqs.new);
137#endif
138
139 ret = tegra_cpu_clk_set_rate(freqs.new * 1000);
140 if (ret) {
141 pr_err("cpu-tegra: Failed to set cpu frequency to %d kHz\n",
142 freqs.new);
143 return ret;
144 }
145
146 for_each_online_cpu(freqs.cpu)
147 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
148
149 return 0;
150}
151
152static unsigned long tegra_cpu_highest_speed(void)
153{
154 unsigned long rate = 0;
155 int i;
156
157 for_each_online_cpu(i)
158 rate = max(rate, target_cpu_speed[i]);
159 return rate;
160}
161
162static int tegra_target(struct cpufreq_policy *policy,
163 unsigned int target_freq,
164 unsigned int relation)
165{
166 unsigned int idx;
167 unsigned int freq;
168 int ret = 0;
169
170 mutex_lock(&tegra_cpu_lock);
171
172 if (is_suspended) {
173 ret = -EBUSY;
174 goto out;
175 }
176
177 cpufreq_frequency_table_target(policy, freq_table, target_freq,
178 relation, &idx);
179
180 freq = freq_table[idx].frequency;
181
182 target_cpu_speed[policy->cpu] = freq;
183
184 ret = tegra_update_cpu_speed(tegra_cpu_highest_speed());
185
186out:
187 mutex_unlock(&tegra_cpu_lock);
188 return ret;
189}
190
191static int tegra_pm_notify(struct notifier_block *nb, unsigned long event,
192 void *dummy)
193{
194 mutex_lock(&tegra_cpu_lock);
195 if (event == PM_SUSPEND_PREPARE) {
196 is_suspended = true;
197 pr_info("Tegra cpufreq suspend: setting frequency to %d kHz\n",
198 freq_table[0].frequency);
199 tegra_update_cpu_speed(freq_table[0].frequency);
200 } else if (event == PM_POST_SUSPEND) {
201 is_suspended = false;
202 }
203 mutex_unlock(&tegra_cpu_lock);
204
205 return NOTIFY_OK;
206}
207
208static struct notifier_block tegra_cpu_pm_notifier = {
209 .notifier_call = tegra_pm_notify,
210};
211
212static int tegra_cpu_init(struct cpufreq_policy *policy)
213{
214 if (policy->cpu >= NUM_CPUS)
215 return -EINVAL;
216
217 clk_prepare_enable(emc_clk);
218 clk_prepare_enable(cpu_clk);
219
220 cpufreq_frequency_table_cpuinfo(policy, freq_table);
221 cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
222 policy->cur = tegra_getspeed(policy->cpu);
223 target_cpu_speed[policy->cpu] = policy->cur;
224
225 /* FIXME: what's the actual transition time? */
226 policy->cpuinfo.transition_latency = 300 * 1000;
227
228 cpumask_copy(policy->cpus, cpu_possible_mask);
229
230 if (policy->cpu == 0)
231 register_pm_notifier(&tegra_cpu_pm_notifier);
232
233 return 0;
234}
235
236static int tegra_cpu_exit(struct cpufreq_policy *policy)
237{
238 cpufreq_frequency_table_cpuinfo(policy, freq_table);
239 clk_disable_unprepare(emc_clk);
240 return 0;
241}
242
243static struct freq_attr *tegra_cpufreq_attr[] = {
244 &cpufreq_freq_attr_scaling_available_freqs,
245 NULL,
246};
247
248static struct cpufreq_driver tegra_cpufreq_driver = {
249 .verify = tegra_verify_speed,
250 .target = tegra_target,
251 .get = tegra_getspeed,
252 .init = tegra_cpu_init,
253 .exit = tegra_cpu_exit,
254 .name = "tegra",
255 .attr = tegra_cpufreq_attr,
256};
257
258static int __init tegra_cpufreq_init(void)
259{
260 cpu_clk = clk_get_sys(NULL, "cpu");
261 if (IS_ERR(cpu_clk))
262 return PTR_ERR(cpu_clk);
263
264 pll_x_clk = clk_get_sys(NULL, "pll_x");
265 if (IS_ERR(pll_x_clk))
266 return PTR_ERR(pll_x_clk);
267
268 pll_p_clk = clk_get_sys(NULL, "pll_p_cclk");
269 if (IS_ERR(pll_p_clk))
270 return PTR_ERR(pll_p_clk);
271
272 emc_clk = clk_get_sys("cpu", "emc");
273 if (IS_ERR(emc_clk)) {
274 clk_put(cpu_clk);
275 return PTR_ERR(emc_clk);
276 }
277
278 return cpufreq_register_driver(&tegra_cpufreq_driver);
279}
280
281static void __exit tegra_cpufreq_exit(void)
282{
283 cpufreq_unregister_driver(&tegra_cpufreq_driver);
284 clk_put(emc_clk);
285 clk_put(cpu_clk);
286}
287
288
289MODULE_AUTHOR("Colin Cross <ccross@android.com>");
290MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2");
291MODULE_LICENSE("GPL");
292module_init(tegra_cpufreq_init);
293module_exit(tegra_cpufreq_exit);
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c
index 0f4e8c483b34..1d1c6023f4a2 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra114.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra114.c
@@ -23,39 +23,13 @@
23static struct cpuidle_driver tegra_idle_driver = { 23static struct cpuidle_driver tegra_idle_driver = {
24 .name = "tegra_idle", 24 .name = "tegra_idle",
25 .owner = THIS_MODULE, 25 .owner = THIS_MODULE,
26 .en_core_tk_irqen = 1,
27 .state_count = 1, 26 .state_count = 1,
28 .states = { 27 .states = {
29 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600), 28 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
30 }, 29 },
31}; 30};
32 31
33static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
34
35int __init tegra114_cpuidle_init(void) 32int __init tegra114_cpuidle_init(void)
36{ 33{
37 int ret; 34 return cpuidle_register(&tegra_idle_driver, NULL);
38 unsigned int cpu;
39 struct cpuidle_device *dev;
40 struct cpuidle_driver *drv = &tegra_idle_driver;
41
42 ret = cpuidle_register_driver(&tegra_idle_driver);
43 if (ret) {
44 pr_err("CPUidle driver registration failed\n");
45 return ret;
46 }
47
48 for_each_possible_cpu(cpu) {
49 dev = &per_cpu(tegra_idle_device, cpu);
50 dev->cpu = cpu;
51
52 dev->state_count = drv->state_count;
53 ret = cpuidle_register_device(dev);
54 if (ret) {
55 pr_err("CPU%u: CPUidle device registration failed\n",
56 cpu);
57 return ret;
58 }
59 }
60 return 0;
61} 35}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index 825ced4f7a40..0cdba8de8c77 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -43,32 +43,33 @@ static atomic_t abort_barrier;
43static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev, 43static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
44 struct cpuidle_driver *drv, 44 struct cpuidle_driver *drv,
45 int index); 45 int index);
46#define TEGRA20_MAX_STATES 2
47#else
48#define TEGRA20_MAX_STATES 1
46#endif 49#endif
47 50
48static struct cpuidle_state tegra_idle_states[] = {
49 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
50#ifdef CONFIG_PM_SLEEP
51 [1] = {
52 .enter = tegra20_idle_lp2_coupled,
53 .exit_latency = 5000,
54 .target_residency = 10000,
55 .power_usage = 0,
56 .flags = CPUIDLE_FLAG_TIME_VALID |
57 CPUIDLE_FLAG_COUPLED,
58 .name = "powered-down",
59 .desc = "CPU power gated",
60 },
61#endif
62};
63
64static struct cpuidle_driver tegra_idle_driver = { 51static struct cpuidle_driver tegra_idle_driver = {
65 .name = "tegra_idle", 52 .name = "tegra_idle",
66 .owner = THIS_MODULE, 53 .owner = THIS_MODULE,
67 .en_core_tk_irqen = 1, 54 .states = {
55 ARM_CPUIDLE_WFI_STATE_PWR(600),
56#ifdef CONFIG_PM_SLEEP
57 {
58 .enter = tegra20_idle_lp2_coupled,
59 .exit_latency = 5000,
60 .target_residency = 10000,
61 .power_usage = 0,
62 .flags = CPUIDLE_FLAG_TIME_VALID |
63 CPUIDLE_FLAG_COUPLED,
64 .name = "powered-down",
65 .desc = "CPU power gated",
66 },
67#endif
68 },
69 .state_count = TEGRA20_MAX_STATES,
70 .safe_state_index = 0,
68}; 71};
69 72
70static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
71
72#ifdef CONFIG_PM_SLEEP 73#ifdef CONFIG_PM_SLEEP
73#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
74static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 75static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -130,10 +131,6 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
130 struct cpuidle_driver *drv, 131 struct cpuidle_driver *drv,
131 int index) 132 int index)
132{ 133{
133 struct cpuidle_state *state = &drv->states[index];
134 u32 cpu_on_time = state->exit_latency;
135 u32 cpu_off_time = state->target_residency - state->exit_latency;
136
137 while (tegra20_cpu_is_resettable_soon()) 134 while (tegra20_cpu_is_resettable_soon())
138 cpu_relax(); 135 cpu_relax();
139 136
@@ -142,7 +139,7 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
142 139
143 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); 140 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
144 141
145 tegra_idle_lp2_last(cpu_on_time, cpu_off_time); 142 tegra_idle_lp2_last();
146 143
147 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 144 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
148 145
@@ -217,39 +214,8 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
217 214
218int __init tegra20_cpuidle_init(void) 215int __init tegra20_cpuidle_init(void)
219{ 216{
220 int ret;
221 unsigned int cpu;
222 struct cpuidle_device *dev;
223 struct cpuidle_driver *drv = &tegra_idle_driver;
224
225#ifdef CONFIG_PM_SLEEP 217#ifdef CONFIG_PM_SLEEP
226 tegra_tear_down_cpu = tegra20_tear_down_cpu; 218 tegra_tear_down_cpu = tegra20_tear_down_cpu;
227#endif 219#endif
228 220 return cpuidle_register(&tegra_idle_driver, cpu_possible_mask);
229 drv->state_count = ARRAY_SIZE(tegra_idle_states);
230 memcpy(drv->states, tegra_idle_states,
231 drv->state_count * sizeof(drv->states[0]));
232
233 ret = cpuidle_register_driver(&tegra_idle_driver);
234 if (ret) {
235 pr_err("CPUidle driver registration failed\n");
236 return ret;
237 }
238
239 for_each_possible_cpu(cpu) {
240 dev = &per_cpu(tegra_idle_device, cpu);
241 dev->cpu = cpu;
242#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
243 dev->coupled_cpus = *cpu_possible_mask;
244#endif
245
246 dev->state_count = drv->state_count;
247 ret = cpuidle_register_device(dev);
248 if (ret) {
249 pr_err("CPU%u: CPUidle device registration failed\n",
250 cpu);
251 return ret;
252 }
253 }
254 return 0;
255} 221}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
index 8b50cf4ddd6f..3cf9aca5f3ea 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra30.c
@@ -43,7 +43,6 @@ static int tegra30_idle_lp2(struct cpuidle_device *dev,
43static struct cpuidle_driver tegra_idle_driver = { 43static struct cpuidle_driver tegra_idle_driver = {
44 .name = "tegra_idle", 44 .name = "tegra_idle",
45 .owner = THIS_MODULE, 45 .owner = THIS_MODULE,
46 .en_core_tk_irqen = 1,
47#ifdef CONFIG_PM_SLEEP 46#ifdef CONFIG_PM_SLEEP
48 .state_count = 2, 47 .state_count = 2,
49#else 48#else
@@ -65,17 +64,11 @@ static struct cpuidle_driver tegra_idle_driver = {
65 }, 64 },
66}; 65};
67 66
68static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device);
69
70#ifdef CONFIG_PM_SLEEP 67#ifdef CONFIG_PM_SLEEP
71static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev, 68static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
72 struct cpuidle_driver *drv, 69 struct cpuidle_driver *drv,
73 int index) 70 int index)
74{ 71{
75 struct cpuidle_state *state = &drv->states[index];
76 u32 cpu_on_time = state->exit_latency;
77 u32 cpu_off_time = state->target_residency - state->exit_latency;
78
79 /* All CPUs entering LP2 is not working. 72 /* All CPUs entering LP2 is not working.
80 * Don't let CPU0 enter LP2 when any secondary CPU is online. 73 * Don't let CPU0 enter LP2 when any secondary CPU is online.
81 */ 74 */
@@ -86,7 +79,7 @@ static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
86 79
87 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); 80 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
88 81
89 tegra_idle_lp2_last(cpu_on_time, cpu_off_time); 82 tegra_idle_lp2_last();
90 83
91 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 84 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
92 85
@@ -102,12 +95,8 @@ static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
102 95
103 smp_wmb(); 96 smp_wmb();
104 97
105 save_cpu_arch_register();
106
107 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); 98 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
108 99
109 restore_cpu_arch_register();
110
111 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 100 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
112 101
113 return true; 102 return true;
@@ -157,32 +146,8 @@ static int tegra30_idle_lp2(struct cpuidle_device *dev,
157 146
158int __init tegra30_cpuidle_init(void) 147int __init tegra30_cpuidle_init(void)
159{ 148{
160 int ret;
161 unsigned int cpu;
162 struct cpuidle_device *dev;
163 struct cpuidle_driver *drv = &tegra_idle_driver;
164
165#ifdef CONFIG_PM_SLEEP 149#ifdef CONFIG_PM_SLEEP
166 tegra_tear_down_cpu = tegra30_tear_down_cpu; 150 tegra_tear_down_cpu = tegra30_tear_down_cpu;
167#endif 151#endif
168 152 return cpuidle_register(&tegra_idle_driver, NULL);
169 ret = cpuidle_register_driver(&tegra_idle_driver);
170 if (ret) {
171 pr_err("CPUidle driver registration failed\n");
172 return ret;
173 }
174
175 for_each_possible_cpu(cpu) {
176 dev = &per_cpu(tegra_idle_device, cpu);
177 dev->cpu = cpu;
178
179 dev->state_count = drv->state_count;
180 ret = cpuidle_register_device(dev);
181 if (ret) {
182 pr_err("CPU%u: CPUidle device registration failed\n",
183 cpu);
184 return ret;
185 }
186 }
187 return 0;
188} 153}
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index f7db0782a6b6..e035cd284a6e 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -2,6 +2,7 @@
2 * arch/arm/mach-tegra/fuse.c 2 * arch/arm/mach-tegra/fuse.c
3 * 3 *
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
5 * 6 *
6 * Author: 7 * Author:
7 * Colin Cross <ccross@android.com> 8 * Colin Cross <ccross@android.com>
@@ -137,6 +138,9 @@ void tegra_init_fuse(void)
137 tegra_fuse_spare_bit = TEGRA30_FUSE_SPARE_BIT; 138 tegra_fuse_spare_bit = TEGRA30_FUSE_SPARE_BIT;
138 tegra_init_speedo_data = &tegra30_init_speedo_data; 139 tegra_init_speedo_data = &tegra30_init_speedo_data;
139 break; 140 break;
141 case TEGRA114:
142 tegra_init_speedo_data = &tegra114_init_speedo_data;
143 break;
140 default: 144 default:
141 pr_warn("Tegra: unknown chip id %d\n", tegra_chip_id); 145 pr_warn("Tegra: unknown chip id %d\n", tegra_chip_id);
142 tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT; 146 tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT;
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index da78434678c7..aacc00d05980 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2010 Google, Inc. 2 * Copyright (C) 2010 Google, Inc.
3 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
3 * 4 *
4 * Author: 5 * Author:
5 * Colin Cross <ccross@android.com> 6 * Colin Cross <ccross@android.com>
@@ -66,4 +67,10 @@ void tegra30_init_speedo_data(void);
66static inline void tegra30_init_speedo_data(void) {} 67static inline void tegra30_init_speedo_data(void) {}
67#endif 68#endif
68 69
70#ifdef CONFIG_ARCH_TEGRA_114_SOC
71void tegra114_init_speedo_data(void);
72#else
73static inline void tegra114_init_speedo_data(void) {}
74#endif
75
69#endif 76#endif
diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
index fd473f2b4c3d..045c16f2dd51 100644
--- a/arch/arm/mach-tegra/headsmp.S
+++ b/arch/arm/mach-tegra/headsmp.S
@@ -7,8 +7,5 @@
7 7
8ENTRY(tegra_secondary_startup) 8ENTRY(tegra_secondary_startup)
9 bl v7_invalidate_l1 9 bl v7_invalidate_l1
10 /* Enable coresight */
11 mov32 r0, 0xC5ACCE55
12 mcr p14, 0, r0, c7, c12, 6
13 b secondary_startup 10 b secondary_startup
14ENDPROC(tegra_secondary_startup) 11ENDPROC(tegra_secondary_startup)
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index a599f6e36dea..184914a68d73 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -1,8 +1,7 @@
1/* 1/*
2 *
3 * Copyright (C) 2002 ARM Ltd. 2 * Copyright (C) 2002 ARM Ltd.
4 * All Rights Reserved 3 * All Rights Reserved
5 * Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
@@ -12,9 +11,9 @@
12#include <linux/smp.h> 11#include <linux/smp.h>
13#include <linux/clk/tegra.h> 12#include <linux/clk/tegra.h>
14 13
15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 14#include <asm/smp_plat.h>
17 15
16#include "fuse.h"
18#include "sleep.h" 17#include "sleep.h"
19 18
20static void (*tegra_hotplug_shutdown)(void); 19static void (*tegra_hotplug_shutdown)(void);
@@ -47,27 +46,13 @@ void __ref tegra_cpu_die(unsigned int cpu)
47 BUG(); 46 BUG();
48} 47}
49 48
50int tegra_cpu_disable(unsigned int cpu) 49void __init tegra_hotplug_init(void)
51{
52 /*
53 * we don't allow CPU 0 to be shutdown (it is still too special
54 * e.g. clock tick interrupts)
55 */
56 return cpu == 0 ? -EPERM : 0;
57}
58
59#ifdef CONFIG_ARCH_TEGRA_2x_SOC
60extern void tegra20_hotplug_shutdown(void);
61void __init tegra20_hotplug_init(void)
62{ 50{
63 tegra_hotplug_shutdown = tegra20_hotplug_shutdown; 51 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
64} 52 return;
65#endif
66 53
67#ifdef CONFIG_ARCH_TEGRA_3x_SOC 54 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
68extern void tegra30_hotplug_shutdown(void); 55 tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
69void __init tegra30_hotplug_init(void) 56 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30)
70{ 57 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
71 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
72} 58}
73#endif
diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
deleted file mode 100644
index 06763fe7529d..000000000000
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * drivers/regulator/tegra-regulator.c
3 *
4 * Copyright (c) 2010 Google, Inc
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef _MACH_TEGRA_POWERGATE_H_
21#define _MACH_TEGRA_POWERGATE_H_
22
23struct clk;
24
25#define TEGRA_POWERGATE_CPU 0
26#define TEGRA_POWERGATE_3D 1
27#define TEGRA_POWERGATE_VENC 2
28#define TEGRA_POWERGATE_PCIE 3
29#define TEGRA_POWERGATE_VDEC 4
30#define TEGRA_POWERGATE_L2 5
31#define TEGRA_POWERGATE_MPE 6
32#define TEGRA_POWERGATE_HEG 7
33#define TEGRA_POWERGATE_SATA 8
34#define TEGRA_POWERGATE_CPU1 9
35#define TEGRA_POWERGATE_CPU2 10
36#define TEGRA_POWERGATE_CPU3 11
37#define TEGRA_POWERGATE_CELP 12
38#define TEGRA_POWERGATE_3D1 13
39
40#define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU
41#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
42
43int __init tegra_powergate_init(void);
44
45int tegra_cpu_powergate_id(int cpuid);
46int tegra_powergate_is_powered(int id);
47int tegra_powergate_power_on(int id);
48int tegra_powergate_power_off(int id);
49int tegra_powergate_remove_clamping(int id);
50
51/* Must be called with clk disabled, and returns with clk enabled */
52int tegra_powergate_sequence_power_up(int id, struct clk *clk);
53
54#endif /* _MACH_TEGRA_POWERGATE_H_ */
diff --git a/arch/arm/mach-tegra/include/mach/timex.h b/arch/arm/mach-tegra/include/mach/timex.h
deleted file mode 100644
index a44ccbdb7dbf..000000000000
--- a/arch/arm/mach-tegra/include/mach/timex.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/timex.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Colin Cross <ccross@google.com>
8 * Erik Gilling <konkers@google.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
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 */
20
21#ifndef __MACH_TEGRA_TIMEX_H
22#define __MACH_TEGRA_TIMEX_H
23
24#define CLOCK_TICK_RATE 1000000
25
26#endif
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
deleted file mode 100644
index 08386418196f..000000000000
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ /dev/null
@@ -1,175 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/uncompress.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2011 Google, Inc.
6 * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved.
7 *
8 * Author:
9 * Colin Cross <ccross@google.com>
10 * Erik Gilling <konkers@google.com>
11 * Doug Anderson <dianders@chromium.org>
12 * Stephen Warren <swarren@nvidia.com>
13 *
14 * This software is licensed under the terms of the GNU General Public
15 * License version 2, as published by the Free Software Foundation, and
16 * may be copied, distributed, and modified under those terms.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 */
24
25#ifndef __MACH_TEGRA_UNCOMPRESS_H
26#define __MACH_TEGRA_UNCOMPRESS_H
27
28#include <linux/types.h>
29#include <linux/serial_reg.h>
30
31#include "../../iomap.h"
32
33#define BIT(x) (1 << (x))
34#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
35
36#define DEBUG_UART_SHIFT 2
37
38volatile u8 *uart;
39
40static void putc(int c)
41{
42 if (uart == NULL)
43 return;
44
45 while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE))
46 barrier();
47 uart[UART_TX << DEBUG_UART_SHIFT] = c;
48}
49
50static inline void flush(void)
51{
52}
53
54static const struct {
55 u32 base;
56 u32 reset_reg;
57 u32 clock_reg;
58 u32 bit;
59} uarts[] = {
60 {
61 TEGRA_UARTA_BASE,
62 TEGRA_CLK_RESET_BASE + 0x04,
63 TEGRA_CLK_RESET_BASE + 0x10,
64 6,
65 },
66 {
67 TEGRA_UARTB_BASE,
68 TEGRA_CLK_RESET_BASE + 0x04,
69 TEGRA_CLK_RESET_BASE + 0x10,
70 7,
71 },
72 {
73 TEGRA_UARTC_BASE,
74 TEGRA_CLK_RESET_BASE + 0x08,
75 TEGRA_CLK_RESET_BASE + 0x14,
76 23,
77 },
78 {
79 TEGRA_UARTD_BASE,
80 TEGRA_CLK_RESET_BASE + 0x0c,
81 TEGRA_CLK_RESET_BASE + 0x18,
82 1,
83 },
84 {
85 TEGRA_UARTE_BASE,
86 TEGRA_CLK_RESET_BASE + 0x0c,
87 TEGRA_CLK_RESET_BASE + 0x18,
88 2,
89 },
90};
91
92static inline bool uart_clocked(int i)
93{
94 if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit))
95 return false;
96
97 if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit)))
98 return false;
99
100 return true;
101}
102
103#ifdef CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA
104int auto_odmdata(void)
105{
106 volatile u32 *pmc = (volatile u32 *)TEGRA_PMC_BASE;
107 u32 odmdata = pmc[0xa0 / 4];
108
109 /*
110 * Bits 19:18 are the console type: 0=default, 1=none, 2==DCC, 3==UART
111 * Some boards apparently swap the last two values, but we don't have
112 * any way of catering for that here, so we just accept either. If this
113 * doesn't make sense for your board, just don't enable this feature.
114 *
115 * Bits 17:15 indicate the UART to use, 0/1/2/3/4 are UART A/B/C/D/E.
116 */
117
118 switch ((odmdata >> 18) & 3) {
119 case 2:
120 case 3:
121 break;
122 default:
123 return -1;
124 }
125
126 return (odmdata >> 15) & 7;
127}
128#endif
129
130/*
131 * Setup before decompression. This is where we do UART selection for
132 * earlyprintk and init the uart_base register.
133 */
134static inline void arch_decomp_setup(void)
135{
136 int uart_id;
137 volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
138 u32 chip, div;
139
140#if defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA)
141 uart_id = auto_odmdata();
142#elif defined(CONFIG_TEGRA_DEBUG_UARTA)
143 uart_id = 0;
144#elif defined(CONFIG_TEGRA_DEBUG_UARTB)
145 uart_id = 1;
146#elif defined(CONFIG_TEGRA_DEBUG_UARTC)
147 uart_id = 2;
148#elif defined(CONFIG_TEGRA_DEBUG_UARTD)
149 uart_id = 3;
150#elif defined(CONFIG_TEGRA_DEBUG_UARTE)
151 uart_id = 4;
152#endif
153
154 if (uart_id < 0 || uart_id >= ARRAY_SIZE(uarts) ||
155 !uart_clocked(uart_id))
156 uart = NULL;
157 else
158 uart = (volatile u8 *)uarts[uart_id].base;
159
160 if (uart == NULL)
161 return;
162
163 chip = (apb_misc[0x804 / 4] >> 8) & 0xff;
164 if (chip == 0x20)
165 div = 0x0075;
166 else
167 div = 0x00dd;
168
169 uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB;
170 uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff;
171 uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8;
172 uart[UART_LCR << DEBUG_UART_SHIFT] = 3;
173}
174
175#endif
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 1952e82797cc..0de4eed1493d 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -4,7 +4,7 @@
4 * Author: 4 * Author:
5 * Colin Cross <ccross@android.com> 5 * Colin Cross <ccross@android.com>
6 * 6 *
7 * Copyright (C) 2010, NVIDIA Corporation 7 * Copyright (C) 2010,2013, NVIDIA Corporation
8 * 8 *
9 * This software is licensed under the terms of the GNU General Public 9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and 10 * License version 2, as published by the Free Software Foundation, and
@@ -23,6 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/irqchip/arm-gic.h> 25#include <linux/irqchip/arm-gic.h>
26#include <linux/syscore_ops.h>
26 27
27#include "board.h" 28#include "board.h"
28#include "iomap.h" 29#include "iomap.h"
@@ -43,6 +44,7 @@
43#define ICTLR_COP_IEP_CLASS 0x3c 44#define ICTLR_COP_IEP_CLASS 0x3c
44 45
45#define FIRST_LEGACY_IRQ 32 46#define FIRST_LEGACY_IRQ 32
47#define TEGRA_MAX_NUM_ICTLRS 5
46 48
47#define SGI_MASK 0xFFFF 49#define SGI_MASK 0xFFFF
48 50
@@ -56,6 +58,15 @@ static void __iomem *ictlr_reg_base[] = {
56 IO_ADDRESS(TEGRA_QUINARY_ICTLR_BASE), 58 IO_ADDRESS(TEGRA_QUINARY_ICTLR_BASE),
57}; 59};
58 60
61#ifdef CONFIG_PM_SLEEP
62static u32 cop_ier[TEGRA_MAX_NUM_ICTLRS];
63static u32 cop_iep[TEGRA_MAX_NUM_ICTLRS];
64static u32 cpu_ier[TEGRA_MAX_NUM_ICTLRS];
65static u32 cpu_iep[TEGRA_MAX_NUM_ICTLRS];
66
67static u32 ictlr_wake_mask[TEGRA_MAX_NUM_ICTLRS];
68#endif
69
59bool tegra_pending_sgi(void) 70bool tegra_pending_sgi(void)
60{ 71{
61 u32 pending_set; 72 u32 pending_set;
@@ -125,6 +136,87 @@ static int tegra_retrigger(struct irq_data *d)
125 return 1; 136 return 1;
126} 137}
127 138
139#ifdef CONFIG_PM_SLEEP
140static int tegra_set_wake(struct irq_data *d, unsigned int enable)
141{
142 u32 irq = d->irq;
143 u32 index, mask;
144
145 if (irq < FIRST_LEGACY_IRQ ||
146 irq >= FIRST_LEGACY_IRQ + num_ictlrs * 32)
147 return -EINVAL;
148
149 index = ((irq - FIRST_LEGACY_IRQ) / 32);
150 mask = BIT((irq - FIRST_LEGACY_IRQ) % 32);
151 if (enable)
152 ictlr_wake_mask[index] |= mask;
153 else
154 ictlr_wake_mask[index] &= ~mask;
155
156 return 0;
157}
158
159static int tegra_legacy_irq_suspend(void)
160{
161 unsigned long flags;
162 int i;
163
164 local_irq_save(flags);
165 for (i = 0; i < num_ictlrs; i++) {
166 void __iomem *ictlr = ictlr_reg_base[i];
167 /* Save interrupt state */
168 cpu_ier[i] = readl_relaxed(ictlr + ICTLR_CPU_IER);
169 cpu_iep[i] = readl_relaxed(ictlr + ICTLR_CPU_IEP_CLASS);
170 cop_ier[i] = readl_relaxed(ictlr + ICTLR_COP_IER);
171 cop_iep[i] = readl_relaxed(ictlr + ICTLR_COP_IEP_CLASS);
172
173 /* Disable COP interrupts */
174 writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);
175
176 /* Disable CPU interrupts */
177 writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR);
178
179 /* Enable the wakeup sources of ictlr */
180 writel_relaxed(ictlr_wake_mask[i], ictlr + ICTLR_CPU_IER_SET);
181 }
182 local_irq_restore(flags);
183
184 return 0;
185}
186
187static void tegra_legacy_irq_resume(void)
188{
189 unsigned long flags;
190 int i;
191
192 local_irq_save(flags);
193 for (i = 0; i < num_ictlrs; i++) {
194 void __iomem *ictlr = ictlr_reg_base[i];
195 writel_relaxed(cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS);
196 writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR);
197 writel_relaxed(cpu_ier[i], ictlr + ICTLR_CPU_IER_SET);
198 writel_relaxed(cop_iep[i], ictlr + ICTLR_COP_IEP_CLASS);
199 writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);
200 writel_relaxed(cop_ier[i], ictlr + ICTLR_COP_IER_SET);
201 }
202 local_irq_restore(flags);
203}
204
205static struct syscore_ops tegra_legacy_irq_syscore_ops = {
206 .suspend = tegra_legacy_irq_suspend,
207 .resume = tegra_legacy_irq_resume,
208};
209
210int tegra_legacy_irq_syscore_init(void)
211{
212 register_syscore_ops(&tegra_legacy_irq_syscore_ops);
213
214 return 0;
215}
216#else
217#define tegra_set_wake NULL
218#endif
219
128void __init tegra_init_irq(void) 220void __init tegra_init_irq(void)
129{ 221{
130 int i; 222 int i;
@@ -150,6 +242,8 @@ void __init tegra_init_irq(void)
150 gic_arch_extn.irq_mask = tegra_mask; 242 gic_arch_extn.irq_mask = tegra_mask;
151 gic_arch_extn.irq_unmask = tegra_unmask; 243 gic_arch_extn.irq_unmask = tegra_unmask;
152 gic_arch_extn.irq_retrigger = tegra_retrigger; 244 gic_arch_extn.irq_retrigger = tegra_retrigger;
245 gic_arch_extn.irq_set_wake = tegra_set_wake;
246 gic_arch_extn.flags = IRQCHIP_MASK_ON_SUSPEND;
153 247
154 /* 248 /*
155 * Check if there is a devicetree present, since the GIC will be 249 * Check if there is a devicetree present, since the GIC will be
diff --git a/arch/arm/mach-tegra/irq.h b/arch/arm/mach-tegra/irq.h
index 5142649bba05..bc05ce5613fb 100644
--- a/arch/arm/mach-tegra/irq.h
+++ b/arch/arm/mach-tegra/irq.h
@@ -19,4 +19,10 @@
19 19
20bool tegra_pending_sgi(void); 20bool tegra_pending_sgi(void);
21 21
22#ifdef CONFIG_PM_SLEEP
23int tegra_legacy_irq_syscore_init(void);
24#else
25static inline int tegra_legacy_irq_syscore_init(void) { return 0; }
26#endif
27
22#endif 28#endif
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index b60165f1ca02..46144a19a7e7 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -34,12 +34,11 @@
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/export.h> 35#include <linux/export.h>
36#include <linux/clk/tegra.h> 36#include <linux/clk/tegra.h>
37#include <linux/tegra-powergate.h>
37 38
38#include <asm/sizes.h> 39#include <asm/sizes.h>
39#include <asm/mach/pci.h> 40#include <asm/mach/pci.h>
40 41
41#include <mach/powergate.h>
42
43#include "board.h" 42#include "board.h"
44#include "iomap.h" 43#include "iomap.h"
45 44
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 2c6b3d55213b..fad4226ef710 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -18,7 +18,6 @@
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/irqchip/arm-gic.h>
22#include <linux/clk/tegra.h> 21#include <linux/clk/tegra.h>
23 22
24#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
@@ -26,53 +25,58 @@
26#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
27#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
28 27
29#include <mach/powergate.h>
30
31#include "fuse.h" 28#include "fuse.h"
32#include "flowctrl.h" 29#include "flowctrl.h"
33#include "reset.h" 30#include "reset.h"
31#include "pmc.h"
34 32
35#include "common.h" 33#include "common.h"
36#include "iomap.h" 34#include "iomap.h"
37 35
38extern void tegra_secondary_startup(void);
39
40static cpumask_t tegra_cpu_init_mask; 36static cpumask_t tegra_cpu_init_mask;
41 37
42#define EVP_CPU_RESET_VECTOR \
43 (IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x100)
44
45static void __cpuinit tegra_secondary_init(unsigned int cpu) 38static void __cpuinit tegra_secondary_init(unsigned int cpu)
46{ 39{
47 /*
48 * if any interrupts are already enabled for the primary
49 * core (e.g. timer irq), then they will not have been enabled
50 * for us: do so
51 */
52 gic_secondary_init(0);
53
54 cpumask_set_cpu(cpu, &tegra_cpu_init_mask); 40 cpumask_set_cpu(cpu, &tegra_cpu_init_mask);
55} 41}
56 42
57static int tegra20_power_up_cpu(unsigned int cpu) 43
44static int tegra20_boot_secondary(unsigned int cpu, struct task_struct *idle)
58{ 45{
59 /* Enable the CPU clock. */ 46 cpu = cpu_logical_map(cpu);
60 tegra_enable_cpu_clock(cpu); 47
48 /*
49 * Force the CPU into reset. The CPU must remain in reset when
50 * the flow controller state is cleared (which will cause the
51 * flow controller to stop driving reset if the CPU has been
52 * power-gated via the flow controller). This will have no
53 * effect on first boot of the CPU since it should already be
54 * in reset.
55 */
56 tegra_put_cpu_in_reset(cpu);
61 57
62 /* Clear flow controller CSR. */ 58 /*
63 flowctrl_write_cpu_csr(cpu, 0); 59 * Unhalt the CPU. If the flow controller was used to
60 * power-gate the CPU this will cause the flow controller to
61 * stop driving reset. The CPU will remain in reset because the
62 * clock and reset block is now driving reset.
63 */
64 flowctrl_write_cpu_halt(cpu, 0);
64 65
66 tegra_enable_cpu_clock(cpu);
67 flowctrl_write_cpu_csr(cpu, 0); /* Clear flow controller CSR. */
68 tegra_cpu_out_of_reset(cpu);
65 return 0; 69 return 0;
66} 70}
67 71
68static int tegra30_power_up_cpu(unsigned int cpu) 72static int tegra30_boot_secondary(unsigned int cpu, struct task_struct *idle)
69{ 73{
70 int ret, pwrgateid; 74 int ret;
71 unsigned long timeout; 75 unsigned long timeout;
72 76
73 pwrgateid = tegra_cpu_powergate_id(cpu); 77 cpu = cpu_logical_map(cpu);
74 if (pwrgateid < 0) 78 tegra_put_cpu_in_reset(cpu);
75 return pwrgateid; 79 flowctrl_write_cpu_halt(cpu, 0);
76 80
77 /* 81 /*
78 * The power up sequence of cold boot CPU and warm boot CPU 82 * The power up sequence of cold boot CPU and warm boot CPU
@@ -85,13 +89,13 @@ static int tegra30_power_up_cpu(unsigned int cpu)
85 * the IO clamps. 89 * the IO clamps.
86 * For cold boot CPU, do not wait. After the cold boot CPU be 90 * For cold boot CPU, do not wait. After the cold boot CPU be
87 * booted, it will run to tegra_secondary_init() and set 91 * booted, it will run to tegra_secondary_init() and set
88 * tegra_cpu_init_mask which influences what tegra30_power_up_cpu() 92 * tegra_cpu_init_mask which influences what tegra30_boot_secondary()
89 * next time around. 93 * next time around.
90 */ 94 */
91 if (cpumask_test_cpu(cpu, &tegra_cpu_init_mask)) { 95 if (cpumask_test_cpu(cpu, &tegra_cpu_init_mask)) {
92 timeout = jiffies + msecs_to_jiffies(50); 96 timeout = jiffies + msecs_to_jiffies(50);
93 do { 97 do {
94 if (!tegra_powergate_is_powered(pwrgateid)) 98 if (tegra_pmc_cpu_is_powered(cpu))
95 goto remove_clamps; 99 goto remove_clamps;
96 udelay(10); 100 udelay(10);
97 } while (time_before(jiffies, timeout)); 101 } while (time_before(jiffies, timeout));
@@ -103,14 +107,14 @@ static int tegra30_power_up_cpu(unsigned int cpu)
103 * be un-gated by un-toggling the power gate register 107 * be un-gated by un-toggling the power gate register
104 * manually. 108 * manually.
105 */ 109 */
106 if (!tegra_powergate_is_powered(pwrgateid)) { 110 if (!tegra_pmc_cpu_is_powered(cpu)) {
107 ret = tegra_powergate_power_on(pwrgateid); 111 ret = tegra_pmc_cpu_power_on(cpu);
108 if (ret) 112 if (ret)
109 return ret; 113 return ret;
110 114
111 /* Wait for the power to come up. */ 115 /* Wait for the power to come up. */
112 timeout = jiffies + msecs_to_jiffies(100); 116 timeout = jiffies + msecs_to_jiffies(100);
113 while (tegra_powergate_is_powered(pwrgateid)) { 117 while (tegra_pmc_cpu_is_powered(cpu)) {
114 if (time_after(jiffies, timeout)) 118 if (time_after(jiffies, timeout))
115 return -ETIMEDOUT; 119 return -ETIMEDOUT;
116 udelay(10); 120 udelay(10);
@@ -123,57 +127,34 @@ remove_clamps:
123 udelay(10); 127 udelay(10);
124 128
125 /* Remove I/O clamps. */ 129 /* Remove I/O clamps. */
126 ret = tegra_powergate_remove_clamping(pwrgateid); 130 ret = tegra_pmc_cpu_remove_clamping(cpu);
127 udelay(10); 131 if (ret)
132 return ret;
128 133
129 /* Clear flow controller CSR. */ 134 udelay(10);
130 flowctrl_write_cpu_csr(cpu, 0);
131 135
136 flowctrl_write_cpu_csr(cpu, 0); /* Clear flow controller CSR. */
137 tegra_cpu_out_of_reset(cpu);
132 return 0; 138 return 0;
133} 139}
134 140
135static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *idle) 141static int tegra114_boot_secondary(unsigned int cpu, struct task_struct *idle)
136{ 142{
137 int status;
138
139 cpu = cpu_logical_map(cpu); 143 cpu = cpu_logical_map(cpu);
144 return tegra_pmc_cpu_power_on(cpu);
145}
140 146
141 /* 147static int __cpuinit tegra_boot_secondary(unsigned int cpu,
142 * Force the CPU into reset. The CPU must remain in reset when the 148 struct task_struct *idle)
143 * flow controller state is cleared (which will cause the flow 149{
144 * controller to stop driving reset if the CPU has been power-gated 150 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
145 * via the flow controller). This will have no effect on first boot 151 return tegra20_boot_secondary(cpu, idle);
146 * of the CPU since it should already be in reset. 152 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30)
147 */ 153 return tegra30_boot_secondary(cpu, idle);
148 tegra_put_cpu_in_reset(cpu); 154 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114)
149 155 return tegra114_boot_secondary(cpu, idle);
150 /* 156
151 * Unhalt the CPU. If the flow controller was used to power-gate the 157 return -EINVAL;
152 * CPU this will cause the flow controller to stop driving reset.
153 * The CPU will remain in reset because the clock and reset block
154 * is now driving reset.
155 */
156 flowctrl_write_cpu_halt(cpu, 0);
157
158 switch (tegra_chip_id) {
159 case TEGRA20:
160 status = tegra20_power_up_cpu(cpu);
161 break;
162 case TEGRA30:
163 status = tegra30_power_up_cpu(cpu);
164 break;
165 default:
166 status = -EINVAL;
167 break;
168 }
169
170 if (status)
171 goto done;
172
173 /* Take the CPU out of reset. */
174 tegra_cpu_out_of_reset(cpu);
175done:
176 return status;
177} 158}
178 159
179static void __init tegra_smp_prepare_cpus(unsigned int max_cpus) 160static void __init tegra_smp_prepare_cpus(unsigned int max_cpus)
@@ -192,6 +173,5 @@ struct smp_operations tegra_smp_ops __initdata = {
192#ifdef CONFIG_HOTPLUG_CPU 173#ifdef CONFIG_HOTPLUG_CPU
193 .cpu_kill = tegra_cpu_kill, 174 .cpu_kill = tegra_cpu_kill,
194 .cpu_die = tegra_cpu_die, 175 .cpu_die = tegra_cpu_die,
195 .cpu_disable = tegra_cpu_disable,
196#endif 176#endif
197}; 177};
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 523604de666f..45cf52c7e528 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -22,7 +22,7 @@
22#include <linux/cpumask.h> 22#include <linux/cpumask.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/cpu_pm.h> 24#include <linux/cpu_pm.h>
25#include <linux/clk.h> 25#include <linux/suspend.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/clk/tegra.h> 27#include <linux/clk/tegra.h>
28 28
@@ -37,67 +37,13 @@
37#include "reset.h" 37#include "reset.h"
38#include "flowctrl.h" 38#include "flowctrl.h"
39#include "fuse.h" 39#include "fuse.h"
40#include "pmc.h"
40#include "sleep.h" 41#include "sleep.h"
41 42
42#define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */
43
44#define PMC_CTRL 0x0
45#define PMC_CPUPWRGOOD_TIMER 0xc8
46#define PMC_CPUPWROFF_TIMER 0xcc
47
48#ifdef CONFIG_PM_SLEEP 43#ifdef CONFIG_PM_SLEEP
49static unsigned int g_diag_reg;
50static DEFINE_SPINLOCK(tegra_lp2_lock); 44static DEFINE_SPINLOCK(tegra_lp2_lock);
51static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
52static struct clk *tegra_pclk;
53void (*tegra_tear_down_cpu)(void); 45void (*tegra_tear_down_cpu)(void);
54 46
55void save_cpu_arch_register(void)
56{
57 /* read diagnostic register */
58 asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc");
59 return;
60}
61
62void restore_cpu_arch_register(void)
63{
64 /* write diagnostic register */
65 asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc");
66 return;
67}
68
69static void set_power_timers(unsigned long us_on, unsigned long us_off)
70{
71 unsigned long long ticks;
72 unsigned long long pclk;
73 unsigned long rate;
74 static unsigned long tegra_last_pclk;
75
76 if (tegra_pclk == NULL) {
77 tegra_pclk = clk_get_sys(NULL, "pclk");
78 WARN_ON(IS_ERR(tegra_pclk));
79 }
80
81 rate = clk_get_rate(tegra_pclk);
82
83 if (WARN_ON_ONCE(rate <= 0))
84 pclk = 100000000;
85 else
86 pclk = rate;
87
88 if ((rate != tegra_last_pclk)) {
89 ticks = (us_on * pclk) + 999999ull;
90 do_div(ticks, 1000000);
91 writel((unsigned long)ticks, pmc + PMC_CPUPWRGOOD_TIMER);
92
93 ticks = (us_off * pclk) + 999999ull;
94 do_div(ticks, 1000000);
95 writel((unsigned long)ticks, pmc + PMC_CPUPWROFF_TIMER);
96 wmb();
97 }
98 tegra_last_pclk = pclk;
99}
100
101/* 47/*
102 * restore_cpu_complex 48 * restore_cpu_complex
103 * 49 *
@@ -119,8 +65,6 @@ static void restore_cpu_complex(void)
119 tegra_cpu_clock_resume(); 65 tegra_cpu_clock_resume();
120 66
121 flowctrl_cpu_suspend_exit(cpu); 67 flowctrl_cpu_suspend_exit(cpu);
122
123 restore_cpu_arch_register();
124} 68}
125 69
126/* 70/*
@@ -145,8 +89,6 @@ static void suspend_cpu_complex(void)
145 tegra_cpu_clock_suspend(); 89 tegra_cpu_clock_suspend();
146 90
147 flowctrl_cpu_suspend_enter(cpu); 91 flowctrl_cpu_suspend_enter(cpu);
148
149 save_cpu_arch_register();
150} 92}
151 93
152void tegra_clear_cpu_in_lp2(int phy_cpu_id) 94void tegra_clear_cpu_in_lp2(int phy_cpu_id)
@@ -181,14 +123,14 @@ bool tegra_set_cpu_in_lp2(int phy_cpu_id)
181 return last_cpu; 123 return last_cpu;
182} 124}
183 125
184static int tegra_sleep_cpu(unsigned long v2p) 126int tegra_cpu_do_idle(void)
185{ 127{
186 /* Switch to the identity mapping. */ 128 return cpu_do_idle();
187 cpu_switch_mm(idmap_pgd, &init_mm); 129}
188
189 /* Flush the TLB. */
190 local_flush_tlb_all();
191 130
131static int tegra_sleep_cpu(unsigned long v2p)
132{
133 setup_mm_for_reboot();
192 tegra_sleep_cpu_finish(v2p); 134 tegra_sleep_cpu_finish(v2p);
193 135
194 /* should never here */ 136 /* should never here */
@@ -197,16 +139,9 @@ static int tegra_sleep_cpu(unsigned long v2p)
197 return 0; 139 return 0;
198} 140}
199 141
200void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time) 142void tegra_idle_lp2_last(void)
201{ 143{
202 u32 mode; 144 tegra_pmc_pm_set(TEGRA_SUSPEND_LP2);
203
204 /* Only the last cpu down does the final suspend steps */
205 mode = readl(pmc + PMC_CTRL);
206 mode |= TEGRA_POWER_CPU_PWRREQ_OE;
207 writel(mode, pmc + PMC_CTRL);
208
209 set_power_timers(cpu_on_time, cpu_off_time);
210 145
211 cpu_cluster_pm_enter(); 146 cpu_cluster_pm_enter();
212 suspend_cpu_complex(); 147 suspend_cpu_complex();
@@ -216,4 +151,81 @@ void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time)
216 restore_cpu_complex(); 151 restore_cpu_complex();
217 cpu_cluster_pm_exit(); 152 cpu_cluster_pm_exit();
218} 153}
154
155enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
156 enum tegra_suspend_mode mode)
157{
158 /* Tegra114 didn't support any suspending mode yet. */
159 if (tegra_chip_id == TEGRA114)
160 return TEGRA_SUSPEND_NONE;
161
162 /*
163 * The Tegra devices only support suspending to LP2 currently.
164 */
165 if (mode > TEGRA_SUSPEND_LP2)
166 return TEGRA_SUSPEND_LP2;
167
168 return mode;
169}
170
171static const char *lp_state[TEGRA_MAX_SUSPEND_MODE] = {
172 [TEGRA_SUSPEND_NONE] = "none",
173 [TEGRA_SUSPEND_LP2] = "LP2",
174 [TEGRA_SUSPEND_LP1] = "LP1",
175 [TEGRA_SUSPEND_LP0] = "LP0",
176};
177
178static int __cpuinit tegra_suspend_enter(suspend_state_t state)
179{
180 enum tegra_suspend_mode mode = tegra_pmc_get_suspend_mode();
181
182 if (WARN_ON(mode < TEGRA_SUSPEND_NONE ||
183 mode >= TEGRA_MAX_SUSPEND_MODE))
184 return -EINVAL;
185
186 pr_info("Entering suspend state %s\n", lp_state[mode]);
187
188 tegra_pmc_pm_set(mode);
189
190 local_fiq_disable();
191
192 suspend_cpu_complex();
193 switch (mode) {
194 case TEGRA_SUSPEND_LP2:
195 tegra_set_cpu_in_lp2(0);
196 break;
197 default:
198 break;
199 }
200
201 cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
202
203 switch (mode) {
204 case TEGRA_SUSPEND_LP2:
205 tegra_clear_cpu_in_lp2(0);
206 break;
207 default:
208 break;
209 }
210 restore_cpu_complex();
211
212 local_fiq_enable();
213
214 return 0;
215}
216
217static const struct platform_suspend_ops tegra_suspend_ops = {
218 .valid = suspend_valid_only_mem,
219 .enter = tegra_suspend_enter,
220};
221
222void __init tegra_init_suspend(void)
223{
224 if (tegra_pmc_get_suspend_mode() == TEGRA_SUSPEND_NONE)
225 return;
226
227 tegra_pmc_suspend_init();
228
229 suspend_set_ops(&tegra_suspend_ops);
230}
219#endif 231#endif
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h
index 787335cc964c..778a4aa7c3fa 100644
--- a/arch/arm/mach-tegra/pm.h
+++ b/arch/arm/mach-tegra/pm.h
@@ -21,6 +21,8 @@
21#ifndef _MACH_TEGRA_PM_H_ 21#ifndef _MACH_TEGRA_PM_H_
22#define _MACH_TEGRA_PM_H_ 22#define _MACH_TEGRA_PM_H_
23 23
24#include "pmc.h"
25
24extern unsigned long l2x0_saved_regs_addr; 26extern unsigned long l2x0_saved_regs_addr;
25 27
26void save_cpu_arch_register(void); 28void save_cpu_arch_register(void);
@@ -29,7 +31,20 @@ void restore_cpu_arch_register(void);
29void tegra_clear_cpu_in_lp2(int phy_cpu_id); 31void tegra_clear_cpu_in_lp2(int phy_cpu_id);
30bool tegra_set_cpu_in_lp2(int phy_cpu_id); 32bool tegra_set_cpu_in_lp2(int phy_cpu_id);
31 33
32void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time); 34void tegra_idle_lp2_last(void);
33extern void (*tegra_tear_down_cpu)(void); 35extern void (*tegra_tear_down_cpu)(void);
34 36
37#ifdef CONFIG_PM_SLEEP
38enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
39 enum tegra_suspend_mode mode);
40void tegra_init_suspend(void);
41#else
42static inline enum tegra_suspend_mode tegra_pm_validate_suspend_mode(
43 enum tegra_suspend_mode mode)
44{
45 return TEGRA_SUSPEND_NONE;
46}
47static inline void tegra_init_suspend(void) {}
48#endif
49
35#endif /* _MACH_TEGRA_PM_H_ */ 50#endif /* _MACH_TEGRA_PM_H_ */
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index d4fdb5fcec20..32360e540ce6 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. 2 * Copyright (C) 2012,2013 NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -16,59 +16,313 @@
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/clk.h>
19#include <linux/io.h> 20#include <linux/io.h>
20#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
21 23
22#include "iomap.h" 24#include "fuse.h"
25#include "pm.h"
26#include "pmc.h"
27#include "sleep.h"
23 28
24#define PMC_CTRL 0x0 29#define TEGRA_POWER_EFFECT_LP0 (1 << 14) /* LP0 when CPU pwr gated */
25#define PMC_CTRL_INTR_LOW (1 << 17) 30#define TEGRA_POWER_CPU_PWRREQ_POLARITY (1 << 15) /* CPU pwr req polarity */
31#define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */
32
33#define PMC_CTRL 0x0
34#define PMC_CTRL_INTR_LOW (1 << 17)
35#define PMC_PWRGATE_TOGGLE 0x30
36#define PMC_PWRGATE_TOGGLE_START (1 << 8)
37#define PMC_REMOVE_CLAMPING 0x34
38#define PMC_PWRGATE_STATUS 0x38
39
40#define PMC_CPUPWRGOOD_TIMER 0xc8
41#define PMC_CPUPWROFF_TIMER 0xcc
42
43#define TEGRA_POWERGATE_PCIE 3
44#define TEGRA_POWERGATE_VDEC 4
45#define TEGRA_POWERGATE_CPU1 9
46#define TEGRA_POWERGATE_CPU2 10
47#define TEGRA_POWERGATE_CPU3 11
48
49static u8 tegra_cpu_domains[] = {
50 0xFF, /* not available for CPU0 */
51 TEGRA_POWERGATE_CPU1,
52 TEGRA_POWERGATE_CPU2,
53 TEGRA_POWERGATE_CPU3,
54};
55static DEFINE_SPINLOCK(tegra_powergate_lock);
56
57static void __iomem *tegra_pmc_base;
58static bool tegra_pmc_invert_interrupt;
59static struct clk *tegra_pclk;
60
61struct pmc_pm_data {
62 u32 cpu_good_time; /* CPU power good time in uS */
63 u32 cpu_off_time; /* CPU power off time in uS */
64 u32 core_osc_time; /* Core power good osc time in uS */
65 u32 core_pmu_time; /* Core power good pmu time in uS */
66 u32 core_off_time; /* Core power off time in uS */
67 bool corereq_high; /* Core power request active-high */
68 bool sysclkreq_high; /* System clock request active-high */
69 bool combined_req; /* Combined pwr req for CPU & Core */
70 bool cpu_pwr_good_en; /* CPU power good signal is enabled */
71 u32 lp0_vec_phy_addr; /* The phy addr of LP0 warm boot code */
72 u32 lp0_vec_size; /* The size of LP0 warm boot code */
73 enum tegra_suspend_mode suspend_mode;
74};
75static struct pmc_pm_data pmc_pm_data;
26 76
27static inline u32 tegra_pmc_readl(u32 reg) 77static inline u32 tegra_pmc_readl(u32 reg)
28{ 78{
29 return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg)); 79 return readl(tegra_pmc_base + reg);
30} 80}
31 81
32static inline void tegra_pmc_writel(u32 val, u32 reg) 82static inline void tegra_pmc_writel(u32 val, u32 reg)
33{ 83{
34 writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg)); 84 writel(val, tegra_pmc_base + reg);
85}
86
87static int tegra_pmc_get_cpu_powerdomain_id(int cpuid)
88{
89 if (cpuid <= 0 || cpuid >= num_possible_cpus())
90 return -EINVAL;
91 return tegra_cpu_domains[cpuid];
92}
93
94static bool tegra_pmc_powergate_is_powered(int id)
95{
96 return (tegra_pmc_readl(PMC_PWRGATE_STATUS) >> id) & 1;
97}
98
99static int tegra_pmc_powergate_set(int id, bool new_state)
100{
101 bool old_state;
102 unsigned long flags;
103
104 spin_lock_irqsave(&tegra_powergate_lock, flags);
105
106 old_state = tegra_pmc_powergate_is_powered(id);
107 WARN_ON(old_state == new_state);
108
109 tegra_pmc_writel(PMC_PWRGATE_TOGGLE_START | id, PMC_PWRGATE_TOGGLE);
110
111 spin_unlock_irqrestore(&tegra_powergate_lock, flags);
112
113 return 0;
114}
115
116static int tegra_pmc_powergate_remove_clamping(int id)
117{
118 u32 mask;
119
120 /*
121 * Tegra has a bug where PCIE and VDE clamping masks are
122 * swapped relatively to the partition ids.
123 */
124 if (id == TEGRA_POWERGATE_VDEC)
125 mask = (1 << TEGRA_POWERGATE_PCIE);
126 else if (id == TEGRA_POWERGATE_PCIE)
127 mask = (1 << TEGRA_POWERGATE_VDEC);
128 else
129 mask = (1 << id);
130
131 tegra_pmc_writel(mask, PMC_REMOVE_CLAMPING);
132
133 return 0;
134}
135
136bool tegra_pmc_cpu_is_powered(int cpuid)
137{
138 int id;
139
140 id = tegra_pmc_get_cpu_powerdomain_id(cpuid);
141 if (id < 0)
142 return false;
143 return tegra_pmc_powergate_is_powered(id);
35} 144}
36 145
37#ifdef CONFIG_OF 146int tegra_pmc_cpu_power_on(int cpuid)
147{
148 int id;
149
150 id = tegra_pmc_get_cpu_powerdomain_id(cpuid);
151 if (id < 0)
152 return id;
153 return tegra_pmc_powergate_set(id, true);
154}
155
156int tegra_pmc_cpu_remove_clamping(int cpuid)
157{
158 int id;
159
160 id = tegra_pmc_get_cpu_powerdomain_id(cpuid);
161 if (id < 0)
162 return id;
163 return tegra_pmc_powergate_remove_clamping(id);
164}
165
166#ifdef CONFIG_PM_SLEEP
167static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate)
168{
169 unsigned long long ticks;
170 unsigned long long pclk;
171 static unsigned long tegra_last_pclk;
172
173 if (WARN_ON_ONCE(rate <= 0))
174 pclk = 100000000;
175 else
176 pclk = rate;
177
178 if ((rate != tegra_last_pclk)) {
179 ticks = (us_on * pclk) + 999999ull;
180 do_div(ticks, 1000000);
181 tegra_pmc_writel((unsigned long)ticks, PMC_CPUPWRGOOD_TIMER);
182
183 ticks = (us_off * pclk) + 999999ull;
184 do_div(ticks, 1000000);
185 tegra_pmc_writel((unsigned long)ticks, PMC_CPUPWROFF_TIMER);
186 wmb();
187 }
188 tegra_last_pclk = pclk;
189}
190
191enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
192{
193 return pmc_pm_data.suspend_mode;
194}
195
196void tegra_pmc_pm_set(enum tegra_suspend_mode mode)
197{
198 u32 reg;
199 unsigned long rate = 0;
200
201 reg = tegra_pmc_readl(PMC_CTRL);
202 reg |= TEGRA_POWER_CPU_PWRREQ_OE;
203 reg &= ~TEGRA_POWER_EFFECT_LP0;
204
205 switch (mode) {
206 case TEGRA_SUSPEND_LP2:
207 rate = clk_get_rate(tegra_pclk);
208 break;
209 default:
210 break;
211 }
212
213 set_power_timers(pmc_pm_data.cpu_good_time, pmc_pm_data.cpu_off_time,
214 rate);
215
216 tegra_pmc_writel(reg, PMC_CTRL);
217}
218
219void tegra_pmc_suspend_init(void)
220{
221 u32 reg;
222
223 /* Always enable CPU power request */
224 reg = tegra_pmc_readl(PMC_CTRL);
225 reg |= TEGRA_POWER_CPU_PWRREQ_OE;
226 tegra_pmc_writel(reg, PMC_CTRL);
227}
228#endif
229
38static const struct of_device_id matches[] __initconst = { 230static const struct of_device_id matches[] __initconst = {
231 { .compatible = "nvidia,tegra114-pmc" },
232 { .compatible = "nvidia,tegra30-pmc" },
39 { .compatible = "nvidia,tegra20-pmc" }, 233 { .compatible = "nvidia,tegra20-pmc" },
40 { } 234 { }
41}; 235};
42#endif
43 236
44void __init tegra_pmc_init(void) 237static void tegra_pmc_parse_dt(void)
45{ 238{
46 /* 239 struct device_node *np;
47 * For now, Harmony is the only board that uses the PMC, and it wants 240 u32 prop;
48 * the signal inverted. Seaboard would too if it used the PMC. 241 enum tegra_suspend_mode suspend_mode;
49 * Hopefully by the time other boards want to use the PMC, everything 242 u32 core_good_time[2] = {0, 0};
50 * will be device-tree, or they also want it inverted. 243 u32 lp0_vec[2] = {0, 0};
51 */
52 bool invert_interrupt = true;
53 u32 val;
54 244
55#ifdef CONFIG_OF 245 np = of_find_matching_node(NULL, matches);
56 if (of_have_populated_dt()) { 246 BUG_ON(!np);
57 struct device_node *np;
58 247
59 invert_interrupt = false; 248 tegra_pmc_base = of_iomap(np, 0);
60 249
61 np = of_find_matching_node(NULL, matches); 250 tegra_pmc_invert_interrupt = of_property_read_bool(np,
62 if (np) { 251 "nvidia,invert-interrupt");
63 if (of_find_property(np, "nvidia,invert-interrupt", 252 tegra_pclk = of_clk_get_by_name(np, "pclk");
64 NULL)) 253 WARN_ON(IS_ERR(tegra_pclk));
65 invert_interrupt = true; 254
255 /* Grabbing the power management configurations */
256 if (of_property_read_u32(np, "nvidia,suspend-mode", &prop)) {
257 suspend_mode = TEGRA_SUSPEND_NONE;
258 } else {
259 switch (prop) {
260 case 0:
261 suspend_mode = TEGRA_SUSPEND_LP0;
262 break;
263 case 1:
264 suspend_mode = TEGRA_SUSPEND_LP1;
265 break;
266 case 2:
267 suspend_mode = TEGRA_SUSPEND_LP2;
268 break;
269 default:
270 suspend_mode = TEGRA_SUSPEND_NONE;
271 break;
66 } 272 }
67 } 273 }
68#endif 274 suspend_mode = tegra_pm_validate_suspend_mode(suspend_mode);
275
276 if (of_property_read_u32(np, "nvidia,cpu-pwr-good-time", &prop))
277 suspend_mode = TEGRA_SUSPEND_NONE;
278 pmc_pm_data.cpu_good_time = prop;
279
280 if (of_property_read_u32(np, "nvidia,cpu-pwr-off-time", &prop))
281 suspend_mode = TEGRA_SUSPEND_NONE;
282 pmc_pm_data.cpu_off_time = prop;
283
284 if (of_property_read_u32_array(np, "nvidia,core-pwr-good-time",
285 core_good_time, ARRAY_SIZE(core_good_time)))
286 suspend_mode = TEGRA_SUSPEND_NONE;
287 pmc_pm_data.core_osc_time = core_good_time[0];
288 pmc_pm_data.core_pmu_time = core_good_time[1];
289
290 if (of_property_read_u32(np, "nvidia,core-pwr-off-time",
291 &prop))
292 suspend_mode = TEGRA_SUSPEND_NONE;
293 pmc_pm_data.core_off_time = prop;
294
295 pmc_pm_data.corereq_high = of_property_read_bool(np,
296 "nvidia,core-power-req-active-high");
297
298 pmc_pm_data.sysclkreq_high = of_property_read_bool(np,
299 "nvidia,sys-clock-req-active-high");
300
301 pmc_pm_data.combined_req = of_property_read_bool(np,
302 "nvidia,combined-power-req");
303
304 pmc_pm_data.cpu_pwr_good_en = of_property_read_bool(np,
305 "nvidia,cpu-pwr-good-en");
306
307 if (of_property_read_u32_array(np, "nvidia,lp0-vec", lp0_vec,
308 ARRAY_SIZE(lp0_vec)))
309 if (suspend_mode == TEGRA_SUSPEND_LP0)
310 suspend_mode = TEGRA_SUSPEND_LP1;
311
312 pmc_pm_data.lp0_vec_phy_addr = lp0_vec[0];
313 pmc_pm_data.lp0_vec_size = lp0_vec[1];
314
315 pmc_pm_data.suspend_mode = suspend_mode;
316}
317
318void __init tegra_pmc_init(void)
319{
320 u32 val;
321
322 tegra_pmc_parse_dt();
69 323
70 val = tegra_pmc_readl(PMC_CTRL); 324 val = tegra_pmc_readl(PMC_CTRL);
71 if (invert_interrupt) 325 if (tegra_pmc_invert_interrupt)
72 val |= PMC_CTRL_INTR_LOW; 326 val |= PMC_CTRL_INTR_LOW;
73 else 327 else
74 val &= ~PMC_CTRL_INTR_LOW; 328 val &= ~PMC_CTRL_INTR_LOW;
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h
index 8995ee4a8768..e1c2df272f7d 100644
--- a/arch/arm/mach-tegra/pmc.h
+++ b/arch/arm/mach-tegra/pmc.h
@@ -18,6 +18,24 @@
18#ifndef __MACH_TEGRA_PMC_H 18#ifndef __MACH_TEGRA_PMC_H
19#define __MACH_TEGRA_PMC_H 19#define __MACH_TEGRA_PMC_H
20 20
21enum tegra_suspend_mode {
22 TEGRA_SUSPEND_NONE = 0,
23 TEGRA_SUSPEND_LP2, /* CPU voltage off */
24 TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
25 TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
26 TEGRA_MAX_SUSPEND_MODE,
27};
28
29#ifdef CONFIG_PM_SLEEP
30enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
31void tegra_pmc_pm_set(enum tegra_suspend_mode mode);
32void tegra_pmc_suspend_init(void);
33#endif
34
35bool tegra_pmc_cpu_is_powered(int cpuid);
36int tegra_pmc_cpu_power_on(int cpuid);
37int tegra_pmc_cpu_remove_clamping(int cpuid);
38
21void tegra_pmc_init(void); 39void tegra_pmc_init(void);
22 40
23#endif 41#endif
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index c6bc8f85759c..f076f0f80fcd 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -22,13 +22,13 @@
22#include <linux/debugfs.h> 22#include <linux/debugfs.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/export.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/io.h> 27#include <linux/io.h>
27#include <linux/seq_file.h> 28#include <linux/seq_file.h>
28#include <linux/spinlock.h> 29#include <linux/spinlock.h>
29#include <linux/clk/tegra.h> 30#include <linux/clk/tegra.h>
30 31#include <linux/tegra-powergate.h>
31#include <mach/powergate.h>
32 32
33#include "fuse.h" 33#include "fuse.h"
34#include "iomap.h" 34#include "iomap.h"
@@ -75,7 +75,7 @@ static int tegra_powergate_set(int id, bool new_state)
75 75
76 if (status == new_state) { 76 if (status == new_state) {
77 spin_unlock_irqrestore(&tegra_powergate_lock, flags); 77 spin_unlock_irqrestore(&tegra_powergate_lock, flags);
78 return -EINVAL; 78 return 0;
79 } 79 }
80 80
81 pmc_write(PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE); 81 pmc_write(PWRGATE_TOGGLE_START | id, PWRGATE_TOGGLE);
@@ -168,6 +168,7 @@ err_clk:
168err_power: 168err_power:
169 return ret; 169 return ret;
170} 170}
171EXPORT_SYMBOL(tegra_powergate_sequence_power_up);
171 172
172int tegra_cpu_powergate_id(int cpuid) 173int tegra_cpu_powergate_id(int cpuid)
173{ 174{
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index 54382ceade4a..e6de88a2ea06 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -41,12 +41,10 @@
41 */ 41 */
42ENTRY(tegra_resume) 42ENTRY(tegra_resume)
43 bl v7_invalidate_l1 43 bl v7_invalidate_l1
44 /* Enable coresight */
45 mov32 r0, 0xC5ACCE55
46 mcr p14, 0, r0, c7, c12, 6
47 44
48 cpu_id r0 45 cpu_id r0
49 cmp r0, #0 @ CPU0? 46 cmp r0, #0 @ CPU0?
47 THUMB( it ne )
50 bne cpu_resume @ no 48 bne cpu_resume @ no
51 49
52#ifdef CONFIG_ARCH_TEGRA_3x_SOC 50#ifdef CONFIG_ARCH_TEGRA_3x_SOC
@@ -99,6 +97,8 @@ ENTRY(__tegra_cpu_reset_handler_start)
99 * 97 *
100 * Register usage within the reset handler: 98 * Register usage within the reset handler:
101 * 99 *
100 * Others: scratch
101 * R6 = SoC ID << 8
102 * R7 = CPU present (to the OS) mask 102 * R7 = CPU present (to the OS) mask
103 * R8 = CPU in LP1 state mask 103 * R8 = CPU in LP1 state mask
104 * R9 = CPU in LP2 state mask 104 * R9 = CPU in LP2 state mask
@@ -114,6 +114,40 @@ ENTRY(__tegra_cpu_reset_handler_start)
114ENTRY(__tegra_cpu_reset_handler) 114ENTRY(__tegra_cpu_reset_handler)
115 115
116 cpsid aif, 0x13 @ SVC mode, interrupts disabled 116 cpsid aif, 0x13 @ SVC mode, interrupts disabled
117
118 mov32 r6, TEGRA_APB_MISC_BASE
119 ldr r6, [r6, #APB_MISC_GP_HIDREV]
120 and r6, r6, #0xff00
121#ifdef CONFIG_ARCH_TEGRA_2x_SOC
122t20_check:
123 cmp r6, #(0x20 << 8)
124 bne after_t20_check
125t20_errata:
126 # Tegra20 is a Cortex-A9 r1p1
127 mrc p15, 0, r0, c1, c0, 0 @ read system control register
128 orr r0, r0, #1 << 14 @ erratum 716044
129 mcr p15, 0, r0, c1, c0, 0 @ write system control register
130 mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register
131 orr r0, r0, #1 << 4 @ erratum 742230
132 orr r0, r0, #1 << 11 @ erratum 751472
133 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register
134 b after_errata
135after_t20_check:
136#endif
137#ifdef CONFIG_ARCH_TEGRA_3x_SOC
138t30_check:
139 cmp r6, #(0x30 << 8)
140 bne after_t30_check
141t30_errata:
142 # Tegra30 is a Cortex-A9 r2p9
143 mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register
144 orr r0, r0, #1 << 6 @ erratum 743622
145 orr r0, r0, #1 << 11 @ erratum 751472
146 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register
147 b after_errata
148after_t30_check:
149#endif
150after_errata:
117 mrc p15, 0, r10, c0, c0, 5 @ MPIDR 151 mrc p15, 0, r10, c0, c0, 5 @ MPIDR
118 and r10, r10, #0x3 @ R10 = CPU number 152 and r10, r10, #0x3 @ R10 = CPU number
119 mov r11, #1 153 mov r11, #1
@@ -129,16 +163,13 @@ ENTRY(__tegra_cpu_reset_handler)
129 163
130#ifdef CONFIG_ARCH_TEGRA_2x_SOC 164#ifdef CONFIG_ARCH_TEGRA_2x_SOC
131 /* Are we on Tegra20? */ 165 /* Are we on Tegra20? */
132 mov32 r6, TEGRA_APB_MISC_BASE 166 cmp r6, #(0x20 << 8)
133 ldr r0, [r6, #APB_MISC_GP_HIDREV]
134 and r0, r0, #0xff00
135 cmp r0, #(0x20 << 8)
136 bne 1f 167 bne 1f
137 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */ 168 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
138 mov32 r6, TEGRA_PMC_BASE 169 mov32 r5, TEGRA_PMC_BASE
139 mov r0, #0 170 mov r0, #0
140 cmp r10, #0 171 cmp r10, #0
141 strne r0, [r6, #PMC_SCRATCH41] 172 strne r0, [r5, #PMC_SCRATCH41]
1421: 1731:
143#endif 174#endif
144 175
diff --git a/arch/arm/mach-tegra/sleep-tegra20.S b/arch/arm/mach-tegra/sleep-tegra20.S
index 9f6bfafdd512..e3f2417c420e 100644
--- a/arch/arm/mach-tegra/sleep-tegra20.S
+++ b/arch/arm/mach-tegra/sleep-tegra20.S
@@ -197,7 +197,7 @@ ENTRY(tegra20_sleep_cpu_secondary_finish)
197 mov r3, #CPU_RESETTABLE 197 mov r3, #CPU_RESETTABLE
198 str r3, [r0] 198 str r3, [r0]
199 199
200 bl cpu_do_idle 200 bl tegra_cpu_do_idle
201 201
202 /* 202 /*
203 * cpu may be reset while in wfi, which will return through 203 * cpu may be reset while in wfi, which will return through
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S
index 63a15bd9b653..d29dfcce948d 100644
--- a/arch/arm/mach-tegra/sleep-tegra30.S
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -66,7 +66,9 @@ ENTRY(tegra30_cpu_shutdown)
66 FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \ 66 FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \
67 FLOW_CTRL_CSR_ENABLE 67 FLOW_CTRL_CSR_ENABLE
68 mov r4, #(1 << 4) 68 mov r4, #(1 << 4)
69 orr r12, r12, r4, lsl r3 69 ARM( orr r12, r12, r4, lsl r3 )
70 THUMB( lsl r4, r4, r3 )
71 THUMB( orr r12, r12, r4 )
70 str r12, [r1] 72 str r12, [r1]
71 73
72 /* Halt this CPU. */ 74 /* Halt this CPU. */
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h
index 4ffae541726e..2080fb12ce26 100644
--- a/arch/arm/mach-tegra/sleep.h
+++ b/arch/arm/mach-tegra/sleep.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. 2 * Copyright (c) 2010-2013, NVIDIA Corporation. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -92,7 +92,7 @@
92 92
93#ifdef CONFIG_CACHE_L2X0 93#ifdef CONFIG_CACHE_L2X0
94.macro l2_cache_resume, tmp1, tmp2, tmp3, phys_l2x0_saved_regs 94.macro l2_cache_resume, tmp1, tmp2, tmp3, phys_l2x0_saved_regs
95 adr \tmp1, \phys_l2x0_saved_regs 95 W(adr) \tmp1, \phys_l2x0_saved_regs
96 ldr \tmp1, [\tmp1] 96 ldr \tmp1, [\tmp1]
97 ldr \tmp2, [\tmp1, #L2X0_R_PHY_BASE] 97 ldr \tmp2, [\tmp1, #L2X0_R_PHY_BASE]
98 ldr \tmp3, [\tmp2, #L2X0_CTRL] 98 ldr \tmp3, [\tmp2, #L2X0_CTRL]
@@ -124,11 +124,11 @@ int tegra_sleep_cpu_finish(unsigned long);
124void tegra_disable_clean_inv_dcache(void); 124void tegra_disable_clean_inv_dcache(void);
125 125
126#ifdef CONFIG_HOTPLUG_CPU 126#ifdef CONFIG_HOTPLUG_CPU
127void tegra20_hotplug_init(void); 127void tegra20_hotplug_shutdown(void);
128void tegra30_hotplug_init(void); 128void tegra30_hotplug_shutdown(void);
129void tegra_hotplug_init(void);
129#else 130#else
130static inline void tegra20_hotplug_init(void) {} 131static inline void tegra_hotplug_init(void) {}
131static inline void tegra30_hotplug_init(void) {}
132#endif 132#endif
133 133
134void tegra20_cpu_shutdown(int cpu); 134void tegra20_cpu_shutdown(int cpu);
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/tegra.c
index a0edf2510280..0d1e4128d460 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * nVidia Tegra device tree board support 2 * NVIDIA Tegra SoC device tree board support
3 * 3 *
4 * Copyright (C) 2011, 2013, NVIDIA Corporation
4 * Copyright (C) 2010 Secret Lab Technologies, Ltd. 5 * Copyright (C) 2010 Secret Lab Technologies, Ltd.
5 * Copyright (C) 2010 Google, Inc. 6 * Copyright (C) 2010 Google, Inc.
6 * 7 *
@@ -30,9 +31,10 @@
30#include <linux/pda_power.h> 31#include <linux/pda_power.h>
31#include <linux/platform_data/tegra_usb.h> 32#include <linux/platform_data/tegra_usb.h>
32#include <linux/io.h> 33#include <linux/io.h>
33#include <linux/i2c.h> 34#include <linux/slab.h>
34#include <linux/i2c-tegra.h> 35#include <linux/sys_soc.h>
35#include <linux/usb/tegra_usb_phy.h> 36#include <linux/usb/tegra_usb_phy.h>
37#include <linux/clk/tegra.h>
36 38
37#include <asm/mach-types.h> 39#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
@@ -41,6 +43,7 @@
41 43
42#include "board.h" 44#include "board.h"
43#include "common.h" 45#include "common.h"
46#include "fuse.h"
44#include "iomap.h" 47#include "iomap.h"
45 48
46static struct tegra_ehci_platform_data tegra_ehci1_pdata = { 49static struct tegra_ehci_platform_data tegra_ehci1_pdata = {
@@ -79,12 +82,38 @@ static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
79 82
80static void __init tegra_dt_init(void) 83static void __init tegra_dt_init(void)
81{ 84{
85 struct soc_device_attribute *soc_dev_attr;
86 struct soc_device *soc_dev;
87 struct device *parent = NULL;
88
89 tegra_clocks_apply_init_table();
90
91 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
92 if (!soc_dev_attr)
93 goto out;
94
95 soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
96 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_revision);
97 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%d", tegra_chip_id);
98
99 soc_dev = soc_device_register(soc_dev_attr);
100 if (IS_ERR(soc_dev)) {
101 kfree(soc_dev_attr->family);
102 kfree(soc_dev_attr->revision);
103 kfree(soc_dev_attr->soc_id);
104 kfree(soc_dev_attr);
105 goto out;
106 }
107
108 parent = soc_device_to_device(soc_dev);
109
82 /* 110 /*
83 * Finished with the static registrations now; fill in the missing 111 * Finished with the static registrations now; fill in the missing
84 * devices 112 * devices
85 */ 113 */
114out:
86 of_platform_populate(NULL, of_default_bus_match_table, 115 of_platform_populate(NULL, of_default_bus_match_table,
87 tegra20_auxdata_lookup, NULL); 116 tegra20_auxdata_lookup, parent);
88} 117}
89 118
90static void __init trimslice_init(void) 119static void __init trimslice_init(void)
@@ -111,7 +140,8 @@ static void __init harmony_init(void)
111 140
112static void __init paz00_init(void) 141static void __init paz00_init(void)
113{ 142{
114 tegra_paz00_wifikill_init(); 143 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
144 tegra_paz00_wifikill_init();
115} 145}
116 146
117static struct { 147static struct {
@@ -137,19 +167,21 @@ static void __init tegra_dt_init_late(void)
137 } 167 }
138} 168}
139 169
140static const char *tegra20_dt_board_compat[] = { 170static const char * const tegra_dt_board_compat[] = {
171 "nvidia,tegra114",
172 "nvidia,tegra30",
141 "nvidia,tegra20", 173 "nvidia,tegra20",
142 NULL 174 NULL
143}; 175};
144 176
145DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)") 177DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)")
146 .map_io = tegra_map_common_io, 178 .map_io = tegra_map_common_io,
147 .smp = smp_ops(tegra_smp_ops), 179 .smp = smp_ops(tegra_smp_ops),
148 .init_early = tegra20_init_early, 180 .init_early = tegra_init_early,
149 .init_irq = tegra_dt_init_irq, 181 .init_irq = tegra_dt_init_irq,
150 .init_time = clocksource_of_init, 182 .init_time = clocksource_of_init,
151 .init_machine = tegra_dt_init, 183 .init_machine = tegra_dt_init,
152 .init_late = tegra_dt_init_late, 184 .init_late = tegra_dt_init_late,
153 .restart = tegra_assert_system_reset, 185 .restart = tegra_assert_system_reset,
154 .dt_compat = tegra20_dt_board_compat, 186 .dt_compat = tegra_dt_board_compat,
155MACHINE_END 187MACHINE_END
diff --git a/arch/arm/mach-tegra/tegra114_speedo.c b/arch/arm/mach-tegra/tegra114_speedo.c
new file mode 100644
index 000000000000..5218d4853cd3
--- /dev/null
+++ b/arch/arm/mach-tegra/tegra114_speedo.c
@@ -0,0 +1,104 @@
1/*
2 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kernel.h>
18#include <linux/bug.h>
19
20#include "fuse.h"
21
22#define CORE_PROCESS_CORNERS_NUM 2
23#define CPU_PROCESS_CORNERS_NUM 2
24
25enum {
26 THRESHOLD_INDEX_0,
27 THRESHOLD_INDEX_1,
28 THRESHOLD_INDEX_COUNT,
29};
30
31static const u32 core_process_speedos[][CORE_PROCESS_CORNERS_NUM] = {
32 {1123, UINT_MAX},
33 {0, UINT_MAX},
34};
35
36static const u32 cpu_process_speedos[][CPU_PROCESS_CORNERS_NUM] = {
37 {1695, UINT_MAX},
38 {0, UINT_MAX},
39};
40
41static void rev_sku_to_speedo_ids(int rev, int sku, int *threshold)
42{
43 u32 tmp;
44
45 switch (sku) {
46 case 0x00:
47 case 0x10:
48 case 0x05:
49 case 0x06:
50 tegra_cpu_speedo_id = 1;
51 tegra_soc_speedo_id = 0;
52 *threshold = THRESHOLD_INDEX_0;
53 break;
54
55 case 0x03:
56 case 0x04:
57 tegra_cpu_speedo_id = 2;
58 tegra_soc_speedo_id = 1;
59 *threshold = THRESHOLD_INDEX_1;
60 break;
61
62 default:
63 pr_err("Tegra114 Unknown SKU %d\n", sku);
64 tegra_cpu_speedo_id = 0;
65 tegra_soc_speedo_id = 0;
66 *threshold = THRESHOLD_INDEX_0;
67 break;
68 }
69
70 if (rev == TEGRA_REVISION_A01) {
71 tmp = tegra_fuse_readl(0x270) << 1;
72 tmp |= tegra_fuse_readl(0x26c);
73 if (!tmp)
74 tegra_cpu_speedo_id = 0;
75 }
76}
77
78void tegra114_init_speedo_data(void)
79{
80 u32 cpu_speedo_val;
81 u32 core_speedo_val;
82 int threshold;
83 int i;
84
85 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) !=
86 THRESHOLD_INDEX_COUNT);
87 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) !=
88 THRESHOLD_INDEX_COUNT);
89
90 rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id, &threshold);
91
92 cpu_speedo_val = tegra_fuse_readl(0x12c) + 1024;
93 core_speedo_val = tegra_fuse_readl(0x134);
94
95 for (i = 0; i < CPU_PROCESS_CORNERS_NUM; i++)
96 if (cpu_speedo_val < cpu_process_speedos[threshold][i])
97 break;
98 tegra_cpu_process_id = i;
99
100 for (i = 0; i < CORE_PROCESS_CORNERS_NUM; i++)
101 if (core_speedo_val < core_process_speedos[threshold][i])
102 break;
103 tegra_core_process_id = i;
104}
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index ce7ce42a1ac9..9e8bdfa2b369 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -276,7 +276,7 @@ static struct tegra_emc_pdata *tegra_emc_fill_pdata(struct platform_device *pdev
276 int i; 276 int i;
277 277
278 WARN_ON(pdev->dev.platform_data); 278 WARN_ON(pdev->dev.platform_data);
279 BUG_ON(IS_ERR_OR_NULL(c)); 279 BUG_ON(IS_ERR(c));
280 280
281 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 281 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
282 pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables), 282 pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables),
diff --git a/arch/arm/mach-u300/include/mach/u300-regs.h b/arch/arm/mach-u300/include/mach/u300-regs.h
index 1e49d901f2c9..0320495efc4d 100644
--- a/arch/arm/mach-u300/include/mach/u300-regs.h
+++ b/arch/arm/mach-u300/include/mach/u300-regs.h
@@ -95,7 +95,7 @@
95#define U300_SPI_BASE (U300_FAST_PER_PHYS_BASE+0x6000) 95#define U300_SPI_BASE (U300_FAST_PER_PHYS_BASE+0x6000)
96 96
97/* Fast UART1 on U335 only */ 97/* Fast UART1 on U335 only */
98#define U300_UART1_BASE (U300_SLOW_PER_PHYS_BASE+0x7000) 98#define U300_UART1_BASE (U300_FAST_PER_PHYS_BASE+0x7000)
99 99
100/* 100/*
101 * SLOW peripherals 101 * SLOW peripherals
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 3e5bbd0e5b23..f66d7deae46d 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -1,3 +1,19 @@
1config ARCH_U8500
2 bool "ST-Ericsson U8500 Series" if ARCH_MULTI_V7
3 depends on MMU
4 select ARCH_HAS_CPUFREQ
5 select ARCH_REQUIRE_GPIOLIB
6 select ARM_AMBA
7 select CLKDEV_LOOKUP
8 select CPU_V7
9 select GENERIC_CLOCKEVENTS
10 select HAVE_ARM_SCU if SMP
11 select HAVE_ARM_TWD if LOCAL_TIMERS
12 select HAVE_SMP
13 select MIGHT_HAVE_CACHE_L2X0
14 help
15 Support for ST-Ericsson's Ux500 architecture
16
1if ARCH_U8500 17if ARCH_U8500
2 18
3config UX500_SOC_COMMON 19config UX500_SOC_COMMON
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index f24710dfc395..bf9b6be5b180 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-y := cpu.o devices.o devices-common.o \ 5obj-y := cpu.o devices.o devices-common.o \
6 id.o usb.o timer.o 6 id.o usb.o timer.o pm.o
7obj-$(CONFIG_CPU_IDLE) += cpuidle.o 7obj-$(CONFIG_CPU_IDLE) += cpuidle.o
8obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 8obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o 9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
@@ -15,3 +15,5 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \
15 board-mop500-audio.o 15 board-mop500-audio.o
16obj-$(CONFIG_SMP) += platsmp.o headsmp.o 16obj-$(CONFIG_SMP) += platsmp.o headsmp.o
17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
18
19CFLAGS_hotplug.o += -march=armv7-a
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c
index 7209db7cdc72..aba9e5692958 100644
--- a/arch/arm/mach-ux500/board-mop500-audio.c
+++ b/arch/arm/mach-ux500/board-mop500-audio.c
@@ -10,10 +10,9 @@
10#include <linux/platform_data/pinctrl-nomadik.h> 10#include <linux/platform_data/pinctrl-nomadik.h>
11#include <linux/platform_data/dma-ste-dma40.h> 11#include <linux/platform_data/dma-ste-dma40.h>
12 12
13#include <mach/devices.h> 13#include "devices.h"
14#include <mach/hardware.h> 14#include "irqs.h"
15#include <mach/irqs.h> 15#include <linux/platform_data/asoc-ux500-msp.h>
16#include <mach/msp.h>
17 16
18#include "ste-dma40-db8500.h" 17#include "ste-dma40-db8500.h"
19#include "board-mop500.h" 18#include "board-mop500.h"
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index 0a3f30df1eb8..947bd9eca079 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -13,8 +13,6 @@
13 13
14#include <asm/mach-types.h> 14#include <asm/mach-types.h>
15 15
16#include <mach/hardware.h>
17
18#include "pins-db8500.h" 16#include "pins-db8500.h"
19#include "board-mop500.h" 17#include "board-mop500.h"
20 18
@@ -48,8 +46,12 @@ BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|
48 PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); 46 PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE);
49BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| 47BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|
50 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 48 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
49BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
50 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
51BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED| 51BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|
52 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 52 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
53BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
54 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
53BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| 55BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED|
54 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); 56 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED);
55BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED| 57BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|
@@ -78,9 +80,6 @@ BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|
78 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) 80 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func)
79#define DB8500_PIN_HOG(pin,conf) \ 81#define DB8500_PIN_HOG(pin,conf) \
80 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) 82 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf)
81#define DB8500_PIN_SLEEP(pin, conf, dev) \
82 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
83 pin, conf)
84 83
85/* These are default states associated with device and changed runtime */ 84/* These are default states associated with device and changed runtime */
86#define DB8500_MUX(group,func,dev) \ 85#define DB8500_MUX(group,func,dev) \
@@ -309,8 +308,23 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
309 DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */ 308 DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */
310 309
311 /* Mux in USB pins, drive STP high */ 310 /* Mux in USB pins, drive STP high */
312 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), 311 /* USB default state */
313 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ 312 DB8500_MUX("usb_a_1", "usb", "ab8500-usb.0"),
313 DB8500_PIN("GPIO257_AE29", out_hi, "ab8500-usb.0"), /* STP */
314 /* USB sleep state */
315 DB8500_PIN_SLEEP("GPIO256_AF28", slpm_wkup_pdis_en, "ab8500-usb.0"), /* NXT */
316 DB8500_PIN_SLEEP("GPIO257_AE29", slpm_out_hi_wkup_pdis, "ab8500-usb.0"), /* STP */
317 DB8500_PIN_SLEEP("GPIO258_AD29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* XCLK */
318 DB8500_PIN_SLEEP("GPIO259_AC29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* DIR */
319 DB8500_PIN_SLEEP("GPIO260_AD28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT7 */
320 DB8500_PIN_SLEEP("GPIO261_AD26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT6 */
321 DB8500_PIN_SLEEP("GPIO262_AE26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT5 */
322 DB8500_PIN_SLEEP("GPIO263_AG29", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT4 */
323 DB8500_PIN_SLEEP("GPIO264_AE27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT3 */
324 DB8500_PIN_SLEEP("GPIO265_AD27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT2 */
325 DB8500_PIN_SLEEP("GPIO266_AC28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT1 */
326 DB8500_PIN_SLEEP("GPIO267_AC27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT0 */
327
314 /* Mux in SPI2 pins on the "other C1" altfunction */ 328 /* Mux in SPI2 pins on the "other C1" altfunction */
315 DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), 329 DB8500_MUX("spi2_oc1_2", "spi2", "spi2"),
316 DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ 330 DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */
@@ -318,9 +332,9 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
318 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ 332 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
319 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ 333 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
320 /* SPI2 idle state */ 334 /* SPI2 idle state */
321 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ 335 DB8500_PIN_IDLE("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
322 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ 336 DB8500_PIN_IDLE("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
323 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ 337 DB8500_PIN_IDLE("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
324 /* SPI2 sleep state */ 338 /* SPI2 sleep state */
325 DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */ 339 DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */
326 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ 340 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
@@ -747,6 +761,8 @@ static struct pinctrl_map __initdata snowball_pinmap[] = {
747 DB8500_PIN_HOG("GPIO21_AB3", out_hi), 761 DB8500_PIN_HOG("GPIO21_AB3", out_hi),
748 /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */ 762 /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */
749 DB8500_MUX_HOG("sm_b_1", "sm"), 763 DB8500_MUX_HOG("sm_b_1", "sm"),
764 /* User LED */
765 DB8500_PIN_HOG("GPIO142_C11", gpio_out_hi),
750 /* Drive RSTn_LAN high */ 766 /* Drive RSTn_LAN high */
751 DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi), 767 DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi),
752 /* Accelerometer/Magnetometer */ 768 /* Accelerometer/Magnetometer */
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 2a17bc506cff..33c353bc1c4a 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com> 6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com>
7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com> 7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com>
8 * Daniel Willerud <daniel.willerud@stericsson.com>
8 * 9 *
9 * MOP500 board specific initialization for regulators 10 * MOP500 board specific initialization for regulators
10 */ 11 */
@@ -12,6 +13,7 @@
12#include <linux/regulator/machine.h> 13#include <linux/regulator/machine.h>
13#include <linux/regulator/ab8500.h> 14#include <linux/regulator/ab8500.h>
14#include "board-mop500-regulators.h" 15#include "board-mop500-regulators.h"
16#include "id.h"
15 17
16static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { 18static struct regulator_consumer_supply gpio_en_3v3_consumers[] = {
17 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), 19 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
@@ -28,6 +30,20 @@ struct regulator_init_data gpio_en_3v3_regulator = {
28 .consumer_supplies = gpio_en_3v3_consumers, 30 .consumer_supplies = gpio_en_3v3_consumers,
29}; 31};
30 32
33static struct regulator_consumer_supply sdi0_reg_consumers[] = {
34 REGULATOR_SUPPLY("vqmmc", "sdi0"),
35};
36
37struct regulator_init_data sdi0_reg_init_data = {
38 .constraints = {
39 .min_uV = 1800000,
40 .max_uV = 2900000,
41 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS,
42 },
43 .num_consumer_supplies = ARRAY_SIZE(sdi0_reg_consumers),
44 .consumer_supplies = sdi0_reg_consumers,
45};
46
31/* 47/*
32 * TPS61052 regulator 48 * TPS61052 regulator
33 */ 49 */
@@ -53,21 +69,37 @@ struct regulator_init_data tps61052_regulator = {
53}; 69};
54 70
55static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { 71static struct regulator_consumer_supply ab8500_vaux1_consumers[] = {
56 /* External displays, connector on board 2v5 power supply */ 72 /* Main display, u8500 R3 uib */
57 REGULATOR_SUPPLY("vaux12v5", "mcde.0"), 73 REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"),
74 /* Main display, u8500 uib and ST uib */
75 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"),
76 /* Secondary display, ST uib */
77 REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"),
58 /* SFH7741 proximity sensor */ 78 /* SFH7741 proximity sensor */
59 REGULATOR_SUPPLY("vcc", "gpio-keys.0"), 79 REGULATOR_SUPPLY("vcc", "gpio-keys.0"),
60 /* BH1780GLS ambient light sensor */ 80 /* BH1780GLS ambient light sensor */
61 REGULATOR_SUPPLY("vcc", "2-0029"), 81 REGULATOR_SUPPLY("vcc", "2-0029"),
62 /* lsm303dlh accelerometer */ 82 /* lsm303dlh accelerometer */
63 REGULATOR_SUPPLY("vdd", "3-0018"), 83 REGULATOR_SUPPLY("vdd", "2-0018"),
84 /* lsm303dlhc accelerometer */
85 REGULATOR_SUPPLY("vdd", "2-0019"),
64 /* lsm303dlh magnetometer */ 86 /* lsm303dlh magnetometer */
65 REGULATOR_SUPPLY("vdd", "3-001e"), 87 REGULATOR_SUPPLY("vdd", "2-001e"),
66 /* Rohm BU21013 Touchscreen devices */ 88 /* Rohm BU21013 Touchscreen devices */
67 REGULATOR_SUPPLY("avdd", "3-005c"), 89 REGULATOR_SUPPLY("avdd", "3-005c"),
68 REGULATOR_SUPPLY("avdd", "3-005d"), 90 REGULATOR_SUPPLY("avdd", "3-005d"),
69 /* Synaptics RMI4 Touchscreen device */ 91 /* Synaptics RMI4 Touchscreen device */
70 REGULATOR_SUPPLY("vdd", "3-004b"), 92 REGULATOR_SUPPLY("vdd", "3-004b"),
93 /* L3G4200D Gyroscope device */
94 REGULATOR_SUPPLY("vdd", "2-0068"),
95 /* Ambient light sensor device */
96 REGULATOR_SUPPLY("vdd", "3-0029"),
97 /* Pressure sensor device */
98 REGULATOR_SUPPLY("vdd", "2-005c"),
99 /* Cypress TrueTouch Touchscreen device */
100 REGULATOR_SUPPLY("vcpin", "spi8.0"),
101 /* Camera device */
102 REGULATOR_SUPPLY("vaux12v5", "mmio_camera"),
71}; 103};
72 104
73static struct regulator_consumer_supply ab8500_vaux2_consumers[] = { 105static struct regulator_consumer_supply ab8500_vaux2_consumers[] = {
@@ -75,18 +107,50 @@ static struct regulator_consumer_supply ab8500_vaux2_consumers[] = {
75 REGULATOR_SUPPLY("vmmc", "sdi4"), 107 REGULATOR_SUPPLY("vmmc", "sdi4"),
76 /* AB8500 audio codec */ 108 /* AB8500 audio codec */
77 REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"), 109 REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"),
110 /* AB8500 accessory detect 1 */
111 REGULATOR_SUPPLY("vcc-N2158", "ab8500-acc-det.0"),
112 /* AB8500 Tv-out device */
113 REGULATOR_SUPPLY("vcc-N2158", "mcde_tv_ab8500.4"),
114 /* AV8100 HDMI device */
115 REGULATOR_SUPPLY("vcc-N2158", "av8100_hdmi.3"),
78}; 116};
79 117
80static struct regulator_consumer_supply ab8500_vaux3_consumers[] = { 118static struct regulator_consumer_supply ab8500_vaux3_consumers[] = {
119 REGULATOR_SUPPLY("v-SD-STM", "stm"),
81 /* External MMC slot power */ 120 /* External MMC slot power */
82 REGULATOR_SUPPLY("vmmc", "sdi0"), 121 REGULATOR_SUPPLY("vmmc", "sdi0"),
83}; 122};
84 123
124static struct regulator_consumer_supply ab8505_vaux4_consumers[] = {
125};
126
127static struct regulator_consumer_supply ab8505_vaux5_consumers[] = {
128};
129
130static struct regulator_consumer_supply ab8505_vaux6_consumers[] = {
131};
132
133static struct regulator_consumer_supply ab8505_vaux8_consumers[] = {
134 /* AB8500 audio codec device */
135 REGULATOR_SUPPLY("v-aux8", NULL),
136};
137
138static struct regulator_consumer_supply ab8505_vadc_consumers[] = {
139 /* Internal general-purpose ADC */
140 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
141 /* ADC for charger */
142 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
143};
144
85static struct regulator_consumer_supply ab8500_vtvout_consumers[] = { 145static struct regulator_consumer_supply ab8500_vtvout_consumers[] = {
86 /* TV-out DENC supply */ 146 /* TV-out DENC supply */
87 REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"), 147 REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"),
88 /* Internal general-purpose ADC */ 148 /* Internal general-purpose ADC */
89 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), 149 REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"),
150 /* ADC for charger */
151 REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"),
152 /* AB8500 Tv-out device */
153 REGULATOR_SUPPLY("vtvout", "mcde_tv_ab8500.4"),
90}; 154};
91 155
92static struct regulator_consumer_supply ab8500_vaud_consumers[] = { 156static struct regulator_consumer_supply ab8500_vaud_consumers[] = {
@@ -114,77 +178,90 @@ static struct regulator_consumer_supply ab8500_vintcore_consumers[] = {
114 REGULATOR_SUPPLY("v-intcore", NULL), 178 REGULATOR_SUPPLY("v-intcore", NULL),
115 /* USB Transceiver */ 179 /* USB Transceiver */
116 REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"), 180 REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"),
181 /* Handled by abx500 clk driver */
182 REGULATOR_SUPPLY("v-intcore", "abx500-clk.0"),
183};
184
185static struct regulator_consumer_supply ab8505_usb_consumers[] = {
186 /* HS USB OTG physical interface */
187 REGULATOR_SUPPLY("v-ape", NULL),
117}; 188};
118 189
119static struct regulator_consumer_supply ab8500_vana_consumers[] = { 190static struct regulator_consumer_supply ab8500_vana_consumers[] = {
120 /* External displays, connector on board, 1v8 power supply */ 191 /* DB8500 DSI */
121 REGULATOR_SUPPLY("vsmps2", "mcde.0"), 192 REGULATOR_SUPPLY("vdddsi1v2", "mcde"),
193 REGULATOR_SUPPLY("vdddsi1v2", "b2r2_core"),
194 REGULATOR_SUPPLY("vdddsi1v2", "b2r2_1_core"),
195 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.0"),
196 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.1"),
197 REGULATOR_SUPPLY("vdddsi1v2", "dsilink.2"),
198 /* DB8500 CSI */
199 REGULATOR_SUPPLY("vddcsi1v2", "mmio_camera"),
122}; 200};
123 201
124/* ab8500 regulator register initialization */ 202/* ab8500 regulator register initialization */
125struct ab8500_regulator_reg_init 203static struct ab8500_regulator_reg_init ab8500_reg_init[] = {
126ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
127 /* 204 /*
128 * VanaRequestCtrl = HP/LP depending on VxRequest 205 * VanaRequestCtrl = HP/LP depending on VxRequest
129 * VextSupply1RequestCtrl = HP/LP depending on VxRequest 206 * VextSupply1RequestCtrl = HP/LP depending on VxRequest
130 */ 207 */
131 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0x00), 208 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00),
132 /* 209 /*
133 * VextSupply2RequestCtrl = HP/LP depending on VxRequest 210 * VextSupply2RequestCtrl = HP/LP depending on VxRequest
134 * VextSupply3RequestCtrl = HP/LP depending on VxRequest 211 * VextSupply3RequestCtrl = HP/LP depending on VxRequest
135 * Vaux1RequestCtrl = HP/LP depending on VxRequest 212 * Vaux1RequestCtrl = HP/LP depending on VxRequest
136 * Vaux2RequestCtrl = HP/LP depending on VxRequest 213 * Vaux2RequestCtrl = HP/LP depending on VxRequest
137 */ 214 */
138 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0x00), 215 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00),
139 /* 216 /*
140 * Vaux3RequestCtrl = HP/LP depending on VxRequest 217 * Vaux3RequestCtrl = HP/LP depending on VxRequest
141 * SwHPReq = Control through SWValid disabled 218 * SwHPReq = Control through SWValid disabled
142 */ 219 */
143 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x00), 220 INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00),
144 /* 221 /*
145 * VanaSysClkReq1HPValid = disabled 222 * VanaSysClkReq1HPValid = disabled
146 * Vaux1SysClkReq1HPValid = disabled 223 * Vaux1SysClkReq1HPValid = disabled
147 * Vaux2SysClkReq1HPValid = disabled 224 * Vaux2SysClkReq1HPValid = disabled
148 * Vaux3SysClkReq1HPValid = disabled 225 * Vaux3SysClkReq1HPValid = disabled
149 */ 226 */
150 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0x00), 227 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00),
151 /* 228 /*
152 * VextSupply1SysClkReq1HPValid = disabled 229 * VextSupply1SysClkReq1HPValid = disabled
153 * VextSupply2SysClkReq1HPValid = disabled 230 * VextSupply2SysClkReq1HPValid = disabled
154 * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled 231 * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled
155 */ 232 */
156 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x40), 233 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40),
157 /* 234 /*
158 * VanaHwHPReq1Valid = disabled 235 * VanaHwHPReq1Valid = disabled
159 * Vaux1HwHPreq1Valid = disabled 236 * Vaux1HwHPreq1Valid = disabled
160 * Vaux2HwHPReq1Valid = disabled 237 * Vaux2HwHPReq1Valid = disabled
161 * Vaux3HwHPReqValid = disabled 238 * Vaux3HwHPReqValid = disabled
162 */ 239 */
163 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0x00), 240 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00),
164 /* 241 /*
165 * VextSupply1HwHPReq1Valid = disabled 242 * VextSupply1HwHPReq1Valid = disabled
166 * VextSupply2HwHPReq1Valid = disabled 243 * VextSupply2HwHPReq1Valid = disabled
167 * VextSupply3HwHPReq1Valid = disabled 244 * VextSupply3HwHPReq1Valid = disabled
168 */ 245 */
169 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x00), 246 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00),
170 /* 247 /*
171 * VanaHwHPReq2Valid = disabled 248 * VanaHwHPReq2Valid = disabled
172 * Vaux1HwHPReq2Valid = disabled 249 * Vaux1HwHPReq2Valid = disabled
173 * Vaux2HwHPReq2Valid = disabled 250 * Vaux2HwHPReq2Valid = disabled
174 * Vaux3HwHPReq2Valid = disabled 251 * Vaux3HwHPReq2Valid = disabled
175 */ 252 */
176 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0x00), 253 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00),
177 /* 254 /*
178 * VextSupply1HwHPReq2Valid = disabled 255 * VextSupply1HwHPReq2Valid = disabled
179 * VextSupply2HwHPReq2Valid = disabled 256 * VextSupply2HwHPReq2Valid = disabled
180 * VextSupply3HwHPReq2Valid = HWReq2 controlled 257 * VextSupply3HwHPReq2Valid = HWReq2 controlled
181 */ 258 */
182 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x04), 259 INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04),
183 /* 260 /*
184 * VanaSwHPReqValid = disabled 261 * VanaSwHPReqValid = disabled
185 * Vaux1SwHPReqValid = disabled 262 * Vaux1SwHPReqValid = disabled
186 */ 263 */
187 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0x00), 264 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00),
188 /* 265 /*
189 * Vaux2SwHPReqValid = disabled 266 * Vaux2SwHPReqValid = disabled
190 * Vaux3SwHPReqValid = disabled 267 * Vaux3SwHPReqValid = disabled
@@ -192,7 +269,7 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
192 * VextSupply2SwHPReqValid = disabled 269 * VextSupply2SwHPReqValid = disabled
193 * VextSupply3SwHPReqValid = disabled 270 * VextSupply3SwHPReqValid = disabled
194 */ 271 */
195 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x00), 272 INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00),
196 /* 273 /*
197 * SysClkReq2Valid1 = SysClkReq2 controlled 274 * SysClkReq2Valid1 = SysClkReq2 controlled
198 * SysClkReq3Valid1 = disabled 275 * SysClkReq3Valid1 = disabled
@@ -202,7 +279,7 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
202 * SysClkReq7Valid1 = disabled 279 * SysClkReq7Valid1 = disabled
203 * SysClkReq8Valid1 = disabled 280 * SysClkReq8Valid1 = disabled
204 */ 281 */
205 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0x2a), 282 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a),
206 /* 283 /*
207 * SysClkReq2Valid2 = disabled 284 * SysClkReq2Valid2 = disabled
208 * SysClkReq3Valid2 = disabled 285 * SysClkReq3Valid2 = disabled
@@ -212,7 +289,7 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
212 * SysClkReq7Valid2 = disabled 289 * SysClkReq7Valid2 = disabled
213 * SysClkReq8Valid2 = disabled 290 * SysClkReq8Valid2 = disabled
214 */ 291 */
215 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0x20), 292 INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20),
216 /* 293 /*
217 * VTVoutEna = disabled 294 * VTVoutEna = disabled
218 * Vintcore12Ena = disabled 295 * Vintcore12Ena = disabled
@@ -220,66 +297,62 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
220 * Vintcore12LP = inactive (HP) 297 * Vintcore12LP = inactive (HP)
221 * VTVoutLP = inactive (HP) 298 * VTVoutLP = inactive (HP)
222 */ 299 */
223 INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0x10), 300 INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10),
224 /* 301 /*
225 * VaudioEna = disabled 302 * VaudioEna = disabled
226 * VdmicEna = disabled 303 * VdmicEna = disabled
227 * Vamic1Ena = disabled 304 * Vamic1Ena = disabled
228 * Vamic2Ena = disabled 305 * Vamic2Ena = disabled
229 */ 306 */
230 INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x00), 307 INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00),
231 /* 308 /*
232 * Vamic1_dzout = high-Z when Vamic1 is disabled 309 * Vamic1_dzout = high-Z when Vamic1 is disabled
233 * Vamic2_dzout = high-Z when Vamic2 is disabled 310 * Vamic2_dzout = high-Z when Vamic2 is disabled
234 */ 311 */
235 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x00), 312 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00),
236 /* 313 /*
237 * VPll = Hw controlled 314 * VPll = Hw controlled (NOTE! PRCMU bits)
238 * VanaRegu = force off 315 * VanaRegu = force off
239 */ 316 */
240 INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x02), 317 INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02),
241 /* 318 /*
242 * VrefDDREna = disabled 319 * VrefDDREna = disabled
243 * VrefDDRSleepMode = inactive (no pulldown) 320 * VrefDDRSleepMode = inactive (no pulldown)
244 */ 321 */
245 INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x00), 322 INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00),
246 /* 323 /*
247 * VextSupply1Regu = HW control 324 * VextSupply1Regu = force LP
248 * VextSupply2Regu = HW control 325 * VextSupply2Regu = force OFF
249 * VextSupply3Regu = HW control 326 * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP)
250 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 327 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
251 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 328 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
252 */ 329 */
253 INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0x2a), 330 INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13),
254 /* 331 /*
255 * Vaux1Regu = force HP 332 * Vaux1Regu = force HP
256 * Vaux2Regu = force off 333 * Vaux2Regu = force off
257 */ 334 */
258 INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x01), 335 INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01),
259 /*
260 * Vaux3regu = force off
261 */
262 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x00),
263 /* 336 /*
264 * Vsmps1 = 1.15V 337 * Vaux3Regu = force off
265 */ 338 */
266 INIT_REGULATOR_REGISTER(AB8500_VSMPS1SEL1, 0x24), 339 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00),
267 /* 340 /*
268 * Vaux1Sel = 2.5 V 341 * Vaux1Sel = 2.8 V
269 */ 342 */
270 INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x08), 343 INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x0C),
271 /* 344 /*
272 * Vaux2Sel = 2.9 V 345 * Vaux2Sel = 2.9 V
273 */ 346 */
274 INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0d), 347 INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d),
275 /* 348 /*
276 * Vaux3Sel = 2.91 V 349 * Vaux3Sel = 2.91 V
277 */ 350 */
278 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07), 351 INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07),
279 /* 352 /*
280 * VextSupply12LP = disabled (no LP) 353 * VextSupply12LP = disabled (no LP)
281 */ 354 */
282 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x00), 355 INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00),
283 /* 356 /*
284 * Vaux1Disch = short discharge time 357 * Vaux1Disch = short discharge time
285 * Vaux2Disch = short discharge time 358 * Vaux2Disch = short discharge time
@@ -288,33 +361,26 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = {
288 * VTVoutDisch = short discharge time 361 * VTVoutDisch = short discharge time
289 * VaudioDisch = short discharge time 362 * VaudioDisch = short discharge time
290 */ 363 */
291 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0x00), 364 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00),
292 /* 365 /*
293 * VanaDisch = short discharge time 366 * VanaDisch = short discharge time
294 * VdmicPullDownEna = pulldown disabled when Vdmic is disabled 367 * VdmicPullDownEna = pulldown disabled when Vdmic is disabled
295 * VdmicDisch = short discharge time 368 * VdmicDisch = short discharge time
296 */ 369 */
297 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x00), 370 INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00),
298}; 371};
299 372
300/* AB8500 regulators */ 373/* AB8500 regulators */
301struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { 374static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
302 /* supplies to the display/camera */ 375 /* supplies to the display/camera */
303 [AB8500_LDO_AUX1] = { 376 [AB8500_LDO_AUX1] = {
304 .constraints = { 377 .constraints = {
305 .name = "V-DISPLAY", 378 .name = "V-DISPLAY",
306 .min_uV = 2500000, 379 .min_uV = 2800000,
307 .max_uV = 2900000, 380 .max_uV = 3300000,
308 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 381 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
309 REGULATOR_CHANGE_STATUS, 382 REGULATOR_CHANGE_STATUS,
310 .boot_on = 1, /* display is on at boot */ 383 .boot_on = 1, /* display is on at boot */
311 /*
312 * This voltage cannot be disabled right now because
313 * it is somehow affecting the external MMC
314 * functionality, though that typically will use
315 * AUX3.
316 */
317 .always_on = 1,
318 }, 384 },
319 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 385 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
320 .consumer_supplies = ab8500_vaux1_consumers, 386 .consumer_supplies = ab8500_vaux1_consumers,
@@ -326,7 +392,10 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
326 .min_uV = 1100000, 392 .min_uV = 1100000,
327 .max_uV = 3300000, 393 .max_uV = 3300000,
328 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 394 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
329 REGULATOR_CHANGE_STATUS, 395 REGULATOR_CHANGE_STATUS |
396 REGULATOR_CHANGE_MODE,
397 .valid_modes_mask = REGULATOR_MODE_NORMAL |
398 REGULATOR_MODE_IDLE,
330 }, 399 },
331 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), 400 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers),
332 .consumer_supplies = ab8500_vaux2_consumers, 401 .consumer_supplies = ab8500_vaux2_consumers,
@@ -338,7 +407,10 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
338 .min_uV = 1100000, 407 .min_uV = 1100000,
339 .max_uV = 3300000, 408 .max_uV = 3300000,
340 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 409 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
341 REGULATOR_CHANGE_STATUS, 410 REGULATOR_CHANGE_STATUS |
411 REGULATOR_CHANGE_MODE,
412 .valid_modes_mask = REGULATOR_MODE_NORMAL |
413 REGULATOR_MODE_IDLE,
342 }, 414 },
343 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), 415 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers),
344 .consumer_supplies = ab8500_vaux3_consumers, 416 .consumer_supplies = ab8500_vaux3_consumers,
@@ -392,18 +464,614 @@ struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = {
392 [AB8500_LDO_INTCORE] = { 464 [AB8500_LDO_INTCORE] = {
393 .constraints = { 465 .constraints = {
394 .name = "V-INTCORE", 466 .name = "V-INTCORE",
395 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 467 .min_uV = 1250000,
468 .max_uV = 1350000,
469 .input_uV = 1800000,
470 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
471 REGULATOR_CHANGE_STATUS |
472 REGULATOR_CHANGE_MODE |
473 REGULATOR_CHANGE_DRMS,
474 .valid_modes_mask = REGULATOR_MODE_NORMAL |
475 REGULATOR_MODE_IDLE,
396 }, 476 },
397 .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), 477 .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers),
398 .consumer_supplies = ab8500_vintcore_consumers, 478 .consumer_supplies = ab8500_vintcore_consumers,
399 }, 479 },
400 /* supply for U8500 CSI/DSI, VANA LDO */ 480 /* supply for U8500 CSI-DSI, VANA LDO */
401 [AB8500_LDO_ANA] = { 481 [AB8500_LDO_ANA] = {
402 .constraints = { 482 .constraints = {
403 .name = "V-CSI/DSI", 483 .name = "V-CSI-DSI",
404 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 484 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
405 }, 485 },
406 .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), 486 .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers),
407 .consumer_supplies = ab8500_vana_consumers, 487 .consumer_supplies = ab8500_vana_consumers,
408 }, 488 },
409}; 489};
490
491/* supply for VextSupply3 */
492static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = {
493 /* SIM supply for 3 V SIM cards */
494 REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
495};
496
497/* extended configuration for VextSupply2, only used for HREFP_V20 boards */
498static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = {
499 .hwreq = true,
500};
501
502/*
503 * AB8500 external regulators
504 */
505static struct regulator_init_data ab8500_ext_regulators[] = {
506 /* fixed Vbat supplies VSMPS1_EXT_1V8 */
507 [AB8500_EXT_SUPPLY1] = {
508 .constraints = {
509 .name = "ab8500-ext-supply1",
510 .min_uV = 1800000,
511 .max_uV = 1800000,
512 .initial_mode = REGULATOR_MODE_IDLE,
513 .boot_on = 1,
514 .always_on = 1,
515 },
516 },
517 /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */
518 [AB8500_EXT_SUPPLY2] = {
519 .constraints = {
520 .name = "ab8500-ext-supply2",
521 .min_uV = 1360000,
522 .max_uV = 1360000,
523 },
524 },
525 /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */
526 [AB8500_EXT_SUPPLY3] = {
527 .constraints = {
528 .name = "ab8500-ext-supply3",
529 .min_uV = 3400000,
530 .max_uV = 3400000,
531 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
532 .boot_on = 1,
533 },
534 .num_consumer_supplies =
535 ARRAY_SIZE(ab8500_ext_supply3_consumers),
536 .consumer_supplies = ab8500_ext_supply3_consumers,
537 },
538};
539
540/* ab8505 regulator register initialization */
541static struct ab8500_regulator_reg_init ab8505_reg_init[] = {
542 /*
543 * VarmRequestCtrl
544 * VsmpsCRequestCtrl
545 * VsmpsARequestCtrl
546 * VsmpsBRequestCtrl
547 */
548 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL1, 0x00, 0x00),
549 /*
550 * VsafeRequestCtrl
551 * VpllRequestCtrl
552 * VanaRequestCtrl = HP/LP depending on VxRequest
553 */
554 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL2, 0x30, 0x00),
555 /*
556 * Vaux1RequestCtrl = HP/LP depending on VxRequest
557 * Vaux2RequestCtrl = HP/LP depending on VxRequest
558 */
559 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL3, 0xf0, 0x00),
560 /*
561 * Vaux3RequestCtrl = HP/LP depending on VxRequest
562 * SwHPReq = Control through SWValid disabled
563 */
564 INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL4, 0x07, 0x00),
565 /*
566 * VsmpsASysClkReq1HPValid
567 * VsmpsBSysClkReq1HPValid
568 * VsafeSysClkReq1HPValid
569 * VanaSysClkReq1HPValid = disabled
570 * VpllSysClkReq1HPValid
571 * Vaux1SysClkReq1HPValid = disabled
572 * Vaux2SysClkReq1HPValid = disabled
573 * Vaux3SysClkReq1HPValid = disabled
574 */
575 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00),
576 /*
577 * VsmpsCSysClkReq1HPValid
578 * VarmSysClkReq1HPValid
579 * VbbSysClkReq1HPValid
580 * VsmpsMSysClkReq1HPValid
581 */
582 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID2, 0x00, 0x00),
583 /*
584 * VsmpsAHwHPReq1Valid
585 * VsmpsBHwHPReq1Valid
586 * VsafeHwHPReq1Valid
587 * VanaHwHPReq1Valid = disabled
588 * VpllHwHPReq1Valid
589 * Vaux1HwHPreq1Valid = disabled
590 * Vaux2HwHPReq1Valid = disabled
591 * Vaux3HwHPReqValid = disabled
592 */
593 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID1, 0xe8, 0x00),
594 /*
595 * VsmpsMHwHPReq1Valid
596 */
597 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID2, 0x00, 0x00),
598 /*
599 * VsmpsAHwHPReq2Valid
600 * VsmpsBHwHPReq2Valid
601 * VsafeHwHPReq2Valid
602 * VanaHwHPReq2Valid = disabled
603 * VpllHwHPReq2Valid
604 * Vaux1HwHPReq2Valid = disabled
605 * Vaux2HwHPReq2Valid = disabled
606 * Vaux3HwHPReq2Valid = disabled
607 */
608 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID1, 0xe8, 0x00),
609 /*
610 * VsmpsMHwHPReq2Valid
611 */
612 INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID2, 0x00, 0x00),
613 /**
614 * VsmpsCSwHPReqValid
615 * VarmSwHPReqValid
616 * VsmpsASwHPReqValid
617 * VsmpsBSwHPReqValid
618 * VsafeSwHPReqValid
619 * VanaSwHPReqValid
620 * VanaSwHPReqValid = disabled
621 * VpllSwHPReqValid
622 * Vaux1SwHPReqValid = disabled
623 */
624 INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID1, 0xa0, 0x00),
625 /*
626 * Vaux2SwHPReqValid = disabled
627 * Vaux3SwHPReqValid = disabled
628 * VsmpsMSwHPReqValid
629 */
630 INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID2, 0x03, 0x00),
631 /*
632 * SysClkReq2Valid1 = SysClkReq2 controlled
633 * SysClkReq3Valid1 = disabled
634 * SysClkReq4Valid1 = SysClkReq4 controlled
635 */
636 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID1, 0x0e, 0x0a),
637 /*
638 * SysClkReq2Valid2 = disabled
639 * SysClkReq3Valid2 = disabled
640 * SysClkReq4Valid2 = disabled
641 */
642 INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID2, 0x0e, 0x00),
643 /*
644 * Vaux4SwHPReqValid
645 * Vaux4HwHPReq2Valid
646 * Vaux4HwHPReq1Valid
647 * Vaux4SysClkReq1HPValid
648 */
649 INIT_REGULATOR_REGISTER(AB8505_REGUVAUX4REQVALID, 0x00, 0x00),
650 /*
651 * VadcEna = disabled
652 * VintCore12Ena = disabled
653 * VintCore12Sel = 1.25 V
654 * VintCore12LP = inactive (HP)
655 * VadcLP = inactive (HP)
656 */
657 INIT_REGULATOR_REGISTER(AB8505_REGUMISC1, 0xfe, 0x10),
658 /*
659 * VaudioEna = disabled
660 * Vaux8Ena = disabled
661 * Vamic1Ena = disabled
662 * Vamic2Ena = disabled
663 */
664 INIT_REGULATOR_REGISTER(AB8505_VAUDIOSUPPLY, 0x1e, 0x00),
665 /*
666 * Vamic1_dzout = high-Z when Vamic1 is disabled
667 * Vamic2_dzout = high-Z when Vamic2 is disabled
668 */
669 INIT_REGULATOR_REGISTER(AB8505_REGUCTRL1VAMIC, 0x03, 0x00),
670 /*
671 * VsmpsARegu
672 * VsmpsASelCtrl
673 * VsmpsAAutoMode
674 * VsmpsAPWMMode
675 */
676 INIT_REGULATOR_REGISTER(AB8505_VSMPSAREGU, 0x00, 0x00),
677 /*
678 * VsmpsBRegu
679 * VsmpsBSelCtrl
680 * VsmpsBAutoMode
681 * VsmpsBPWMMode
682 */
683 INIT_REGULATOR_REGISTER(AB8505_VSMPSBREGU, 0x00, 0x00),
684 /*
685 * VsafeRegu
686 * VsafeSelCtrl
687 * VsafeAutoMode
688 * VsafePWMMode
689 */
690 INIT_REGULATOR_REGISTER(AB8505_VSAFEREGU, 0x00, 0x00),
691 /*
692 * VPll = Hw controlled (NOTE! PRCMU bits)
693 * VanaRegu = force off
694 */
695 INIT_REGULATOR_REGISTER(AB8505_VPLLVANAREGU, 0x0f, 0x02),
696 /*
697 * VextSupply1Regu = force OFF (OTP_ExtSupply12LPnPolarity 1)
698 * VextSupply2Regu = force OFF (OTP_ExtSupply12LPnPolarity 1)
699 * VextSupply3Regu = force OFF (OTP_ExtSupply3LPnPolarity 0)
700 * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0
701 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0
702 */
703 INIT_REGULATOR_REGISTER(AB8505_EXTSUPPLYREGU, 0xff, 0x30),
704 /*
705 * Vaux1Regu = force HP
706 * Vaux2Regu = force off
707 */
708 INIT_REGULATOR_REGISTER(AB8505_VAUX12REGU, 0x0f, 0x01),
709 /*
710 * Vaux3Regu = force off
711 */
712 INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3REGU, 0x03, 0x00),
713 /*
714 * VsmpsASel1
715 */
716 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL1, 0x00, 0x00),
717 /*
718 * VsmpsASel2
719 */
720 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL2, 0x00, 0x00),
721 /*
722 * VsmpsASel3
723 */
724 INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL3, 0x00, 0x00),
725 /*
726 * VsmpsBSel1
727 */
728 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL1, 0x00, 0x00),
729 /*
730 * VsmpsBSel2
731 */
732 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL2, 0x00, 0x00),
733 /*
734 * VsmpsBSel3
735 */
736 INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL3, 0x00, 0x00),
737 /*
738 * VsafeSel1
739 */
740 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL1, 0x00, 0x00),
741 /*
742 * VsafeSel2
743 */
744 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL2, 0x00, 0x00),
745 /*
746 * VsafeSel3
747 */
748 INIT_REGULATOR_REGISTER(AB8505_VSAFESEL3, 0x00, 0x00),
749 /*
750 * Vaux1Sel = 2.8 V
751 */
752 INIT_REGULATOR_REGISTER(AB8505_VAUX1SEL, 0x0f, 0x0C),
753 /*
754 * Vaux2Sel = 2.9 V
755 */
756 INIT_REGULATOR_REGISTER(AB8505_VAUX2SEL, 0x0f, 0x0d),
757 /*
758 * Vaux3Sel = 2.91 V
759 */
760 INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3SEL, 0x07, 0x07),
761 /*
762 * Vaux4RequestCtrl
763 */
764 INIT_REGULATOR_REGISTER(AB8505_VAUX4REQCTRL, 0x00, 0x00),
765 /*
766 * Vaux4Regu
767 */
768 INIT_REGULATOR_REGISTER(AB8505_VAUX4REGU, 0x00, 0x00),
769 /*
770 * Vaux4Sel
771 */
772 INIT_REGULATOR_REGISTER(AB8505_VAUX4SEL, 0x00, 0x00),
773 /*
774 * Vaux1Disch = short discharge time
775 * Vaux2Disch = short discharge time
776 * Vaux3Disch = short discharge time
777 * Vintcore12Disch = short discharge time
778 * VTVoutDisch = short discharge time
779 * VaudioDisch = short discharge time
780 */
781 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH, 0xfc, 0x00),
782 /*
783 * VanaDisch = short discharge time
784 * Vaux8PullDownEna = pulldown disabled when Vaux8 is disabled
785 * Vaux8Disch = short discharge time
786 */
787 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH2, 0x16, 0x00),
788 /*
789 * Vaux4Disch = short discharge time
790 */
791 INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH3, 0x01, 0x00),
792 /*
793 * Vaux5Sel
794 * Vaux5LP
795 * Vaux5Ena
796 * Vaux5Disch
797 * Vaux5DisSfst
798 * Vaux5DisPulld
799 */
800 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX5, 0x00, 0x00),
801 /*
802 * Vaux6Sel
803 * Vaux6LP
804 * Vaux6Ena
805 * Vaux6DisPulld
806 */
807 INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00),
808};
809
810struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = {
811 /* supplies to the display/camera */
812 [AB8505_LDO_AUX1] = {
813 .constraints = {
814 .name = "V-DISPLAY",
815 .min_uV = 2800000,
816 .max_uV = 3300000,
817 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
818 REGULATOR_CHANGE_STATUS,
819 .boot_on = 1, /* display is on at boot */
820 },
821 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers),
822 .consumer_supplies = ab8500_vaux1_consumers,
823 },
824 /* supplies to the on-board eMMC */
825 [AB8505_LDO_AUX2] = {
826 .constraints = {
827 .name = "V-eMMC1",
828 .min_uV = 1100000,
829 .max_uV = 3300000,
830 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
831 REGULATOR_CHANGE_STATUS |
832 REGULATOR_CHANGE_MODE,
833 .valid_modes_mask = REGULATOR_MODE_NORMAL |
834 REGULATOR_MODE_IDLE,
835 },
836 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers),
837 .consumer_supplies = ab8500_vaux2_consumers,
838 },
839 /* supply for VAUX3, supplies to SDcard slots */
840 [AB8505_LDO_AUX3] = {
841 .constraints = {
842 .name = "V-MMC-SD",
843 .min_uV = 1100000,
844 .max_uV = 3300000,
845 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
846 REGULATOR_CHANGE_STATUS |
847 REGULATOR_CHANGE_MODE,
848 .valid_modes_mask = REGULATOR_MODE_NORMAL |
849 REGULATOR_MODE_IDLE,
850 },
851 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers),
852 .consumer_supplies = ab8500_vaux3_consumers,
853 },
854 /* supply for VAUX4, supplies to NFC and standalone secure element */
855 [AB8505_LDO_AUX4] = {
856 .constraints = {
857 .name = "V-NFC-SE",
858 .min_uV = 1100000,
859 .max_uV = 3300000,
860 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
861 REGULATOR_CHANGE_STATUS |
862 REGULATOR_CHANGE_MODE,
863 .valid_modes_mask = REGULATOR_MODE_NORMAL |
864 REGULATOR_MODE_IDLE,
865 },
866 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux4_consumers),
867 .consumer_supplies = ab8505_vaux4_consumers,
868 },
869 /* supply for VAUX5, supplies to TBD */
870 [AB8505_LDO_AUX5] = {
871 .constraints = {
872 .name = "V-AUX5",
873 .min_uV = 1050000,
874 .max_uV = 2790000,
875 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
876 REGULATOR_CHANGE_STATUS |
877 REGULATOR_CHANGE_MODE,
878 .valid_modes_mask = REGULATOR_MODE_NORMAL |
879 REGULATOR_MODE_IDLE,
880 },
881 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux5_consumers),
882 .consumer_supplies = ab8505_vaux5_consumers,
883 },
884 /* supply for VAUX6, supplies to TBD */
885 [AB8505_LDO_AUX6] = {
886 .constraints = {
887 .name = "V-AUX6",
888 .min_uV = 1050000,
889 .max_uV = 2790000,
890 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
891 REGULATOR_CHANGE_STATUS |
892 REGULATOR_CHANGE_MODE,
893 .valid_modes_mask = REGULATOR_MODE_NORMAL |
894 REGULATOR_MODE_IDLE,
895 },
896 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux6_consumers),
897 .consumer_supplies = ab8505_vaux6_consumers,
898 },
899 /* supply for gpadc, ADC LDO */
900 [AB8505_LDO_ADC] = {
901 .constraints = {
902 .name = "V-ADC",
903 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
904 },
905 .num_consumer_supplies = ARRAY_SIZE(ab8505_vadc_consumers),
906 .consumer_supplies = ab8505_vadc_consumers,
907 },
908 /* supply for ab8500-vaudio, VAUDIO LDO */
909 [AB8505_LDO_AUDIO] = {
910 .constraints = {
911 .name = "V-AUD",
912 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
913 },
914 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers),
915 .consumer_supplies = ab8500_vaud_consumers,
916 },
917 /* supply for v-anamic1 VAMic1-LDO */
918 [AB8505_LDO_ANAMIC1] = {
919 .constraints = {
920 .name = "V-AMIC1",
921 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
922 REGULATOR_CHANGE_MODE,
923 .valid_modes_mask = REGULATOR_MODE_NORMAL |
924 REGULATOR_MODE_IDLE,
925 },
926 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers),
927 .consumer_supplies = ab8500_vamic1_consumers,
928 },
929 /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */
930 [AB8505_LDO_ANAMIC2] = {
931 .constraints = {
932 .name = "V-AMIC2",
933 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
934 REGULATOR_CHANGE_MODE,
935 .valid_modes_mask = REGULATOR_MODE_NORMAL |
936 REGULATOR_MODE_IDLE,
937 },
938 .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers),
939 .consumer_supplies = ab8500_vamic2_consumers,
940 },
941 /* supply for v-aux8, VAUX8 LDO */
942 [AB8505_LDO_AUX8] = {
943 .constraints = {
944 .name = "V-AUX8",
945 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
946 },
947 .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux8_consumers),
948 .consumer_supplies = ab8505_vaux8_consumers,
949 },
950 /* supply for v-intcore12, VINTCORE12 LDO */
951 [AB8505_LDO_INTCORE] = {
952 .constraints = {
953 .name = "V-INTCORE",
954 .min_uV = 1250000,
955 .max_uV = 1350000,
956 .input_uV = 1800000,
957 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
958 REGULATOR_CHANGE_STATUS |
959 REGULATOR_CHANGE_MODE |
960 REGULATOR_CHANGE_DRMS,
961 .valid_modes_mask = REGULATOR_MODE_NORMAL |
962 REGULATOR_MODE_IDLE,
963 },
964 .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers),
965 .consumer_supplies = ab8500_vintcore_consumers,
966 },
967 /* supply for LDO USB */
968 [AB8505_LDO_USB] = {
969 .constraints = {
970 .name = "V-USB",
971 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
972 REGULATOR_CHANGE_MODE,
973 .valid_modes_mask = REGULATOR_MODE_NORMAL |
974 REGULATOR_MODE_IDLE,
975 },
976 .num_consumer_supplies = ARRAY_SIZE(ab8505_usb_consumers),
977 .consumer_supplies = ab8505_usb_consumers,
978 },
979 /* supply for U8500 CSI-DSI, VANA LDO */
980 [AB8505_LDO_ANA] = {
981 .constraints = {
982 .name = "V-CSI-DSI",
983 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
984 },
985 .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers),
986 .consumer_supplies = ab8500_vana_consumers,
987 },
988};
989
990struct ab8500_regulator_platform_data ab8500_regulator_plat_data = {
991 .reg_init = ab8500_reg_init,
992 .num_reg_init = ARRAY_SIZE(ab8500_reg_init),
993 .regulator = ab8500_regulators,
994 .num_regulator = ARRAY_SIZE(ab8500_regulators),
995 .ext_regulator = ab8500_ext_regulators,
996 .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators),
997};
998
999/* Use the AB8500 init settings for AB8505 as they are the same right now */
1000struct ab8500_regulator_platform_data ab8505_regulator_plat_data = {
1001 .reg_init = ab8505_reg_init,
1002 .num_reg_init = ARRAY_SIZE(ab8505_reg_init),
1003 .regulator = ab8505_regulators,
1004 .num_regulator = ARRAY_SIZE(ab8505_regulators),
1005};
1006
1007static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
1008{
1009 int i;
1010
1011 if (cpu_is_u8520()) {
1012 for (i = ARRAY_SIZE(ab8505_reg_init) - 1; i >= 0; i--) {
1013 if (ab8505_reg_init[i].id == id) {
1014 u8 initval = ab8505_reg_init[i].value;
1015 initval = (initval & ~mask) | (value & mask);
1016 ab8505_reg_init[i].value = initval;
1017
1018 BUG_ON(mask & ~ab8505_reg_init[i].mask);
1019 return;
1020 }
1021 }
1022 } else {
1023 for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) {
1024 if (ab8500_reg_init[i].id == id) {
1025 u8 initval = ab8500_reg_init[i].value;
1026 initval = (initval & ~mask) | (value & mask);
1027 ab8500_reg_init[i].value = initval;
1028
1029 BUG_ON(mask & ~ab8500_reg_init[i].mask);
1030 return;
1031 }
1032 }
1033 }
1034
1035 BUG_ON(1);
1036}
1037
1038void mop500_regulator_init(void)
1039{
1040 struct regulator_init_data *regulator;
1041
1042 /*
1043 * Temporarily turn on Vaux2 on 8520 machine
1044 */
1045 if (cpu_is_u8520()) {
1046 /* Vaux2 initialized to be on */
1047 ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05);
1048 }
1049
1050 /*
1051 * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
1052 * all HREFP_V20 boards)
1053 */
1054 if (cpu_is_u8500v20()) {
1055 /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */
1056 ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
1057
1058 /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
1059 ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2,
1060 0x20, 0x20);
1061
1062 /* VextSupply2 = force HP at initialization */
1063 ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04);
1064
1065 /* enable VextSupply2 during platform active */
1066 regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
1067 regulator->constraints.always_on = 1;
1068
1069 /* disable VextSupply2 in suspend */
1070 regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
1071 regulator->constraints.state_mem.disabled = 1;
1072 regulator->constraints.state_standby.disabled = 1;
1073
1074 /* enable VextSupply2 HW control (used in suspend) */
1075 regulator->driver_data = (void *)&ab8500_ext_supply2;
1076 }
1077}
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
index 78a0642a2206..039f5132c370 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.h
+++ b/arch/arm/mach-ux500/board-mop500-regulators.h
@@ -14,10 +14,12 @@
14#include <linux/regulator/machine.h> 14#include <linux/regulator/machine.h>
15#include <linux/regulator/ab8500.h> 15#include <linux/regulator/ab8500.h>
16 16
17extern struct ab8500_regulator_reg_init 17extern struct ab8500_regulator_platform_data ab8500_regulator_plat_data;
18ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; 18extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data;
19extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS];
20extern struct regulator_init_data tps61052_regulator; 19extern struct regulator_init_data tps61052_regulator;
21extern struct regulator_init_data gpio_en_3v3_regulator; 20extern struct regulator_init_data gpio_en_3v3_regulator;
21extern struct regulator_init_data sdi0_reg_init_data;
22
23void mop500_regulator_init(void);
22 24
23#endif 25#endif
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 7f2cb6c5e2c1..0ef38775a0c1 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -14,9 +14,9 @@
14#include <linux/platform_data/dma-ste-dma40.h> 14#include <linux/platform_data/dma-ste-dma40.h>
15 15
16#include <asm/mach-types.h> 16#include <asm/mach-types.h>
17#include <mach/devices.h> 17#include "devices.h"
18#include <mach/hardware.h>
19 18
19#include "db8500-regs.h"
20#include "devices-db8500.h" 20#include "devices-db8500.h"
21#include "board-mop500.h" 21#include "board-mop500.h"
22#include "ste-dma40-db8500.h" 22#include "ste-dma40-db8500.h"
@@ -31,35 +31,6 @@
31 * SDI 0 (MicroSD slot) 31 * SDI 0 (MicroSD slot)
32 */ 32 */
33 33
34/* GPIO pins used by the sdi0 level shifter */
35static int sdi0_en = -1;
36static int sdi0_vsel = -1;
37
38static int mop500_sdi0_ios_handler(struct device *dev, struct mmc_ios *ios)
39{
40 switch (ios->power_mode) {
41 case MMC_POWER_UP:
42 case MMC_POWER_ON:
43 /*
44 * Level shifter voltage should depend on vdd to when deciding
45 * on either 1.8V or 2.9V. Once the decision has been made the
46 * level shifter must be disabled and re-enabled with a changed
47 * select signal in order to switch the voltage. Since there is
48 * no framework support yet for indicating 1.8V in vdd, use the
49 * default 2.9V.
50 */
51 gpio_direction_output(sdi0_vsel, 0);
52 gpio_direction_output(sdi0_en, 1);
53 break;
54 case MMC_POWER_OFF:
55 gpio_direction_output(sdi0_vsel, 0);
56 gpio_direction_output(sdi0_en, 0);
57 break;
58 }
59
60 return 0;
61}
62
63#ifdef CONFIG_STE_DMA40 34#ifdef CONFIG_STE_DMA40
64struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = { 35struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
65 .mode = STEDMA40_MODE_LOGICAL, 36 .mode = STEDMA40_MODE_LOGICAL,
@@ -100,22 +71,6 @@ struct mmci_platform_data mop500_sdi0_data = {
100 71
101static void sdi0_configure(struct device *parent) 72static void sdi0_configure(struct device *parent)
102{ 73{
103 int ret;
104
105 ret = gpio_request(sdi0_en, "level shifter enable");
106 if (!ret)
107 ret = gpio_request(sdi0_vsel,
108 "level shifter 1v8-3v select");
109
110 if (ret) {
111 pr_warning("unable to config sdi0 gpios for level shifter.\n");
112 return;
113 }
114
115 /* Select the default 2.9V and enable level shifter */
116 gpio_direction_output(sdi0_vsel, 0);
117 gpio_direction_output(sdi0_en, 1);
118
119 /* Add the device, force v2 to subrevision 1 */ 74 /* Add the device, force v2 to subrevision 1 */
120 db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID); 75 db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
121} 76}
@@ -123,8 +78,6 @@ static void sdi0_configure(struct device *parent)
123void mop500_sdi_tc35892_init(struct device *parent) 78void mop500_sdi_tc35892_init(struct device *parent)
124{ 79{
125 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD; 80 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
126 sdi0_en = GPIO_SDMMC_EN;
127 sdi0_vsel = GPIO_SDMMC_1V8_3V_SEL;
128 sdi0_configure(parent); 81 sdi0_configure(parent);
129} 82}
130 83
@@ -263,8 +216,6 @@ void __init snowball_sdi_init(struct device *parent)
263 /* External Micro SD slot */ 216 /* External Micro SD slot */
264 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO; 217 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
265 mop500_sdi0_data.cd_invert = true; 218 mop500_sdi0_data.cd_invert = true;
266 sdi0_en = SNOWBALL_SDMMC_EN_GPIO;
267 sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO;
268 sdi0_configure(parent); 219 sdi0_configure(parent);
269} 220}
270 221
@@ -276,8 +227,6 @@ void __init hrefv60_sdi_init(struct device *parent)
276 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 227 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
277 /* External Micro SD slot */ 228 /* External Micro SD slot */
278 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO; 229 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
279 sdi0_en = HREFV60_SDMMC_EN_GPIO;
280 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO;
281 sdi0_configure(parent); 230 sdi0_configure(parent);
282 /* WLAN SDIO channel */ 231 /* WLAN SDIO channel */
283 db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID); 232 db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);
diff --git a/arch/arm/mach-ux500/board-mop500-u8500uib.c b/arch/arm/mach-ux500/board-mop500-u8500uib.c
index ead91c968ff4..d397c19570af 100644
--- a/arch/arm/mach-ux500/board-mop500-u8500uib.c
+++ b/arch/arm/mach-ux500/board-mop500-u8500uib.c
@@ -12,12 +12,15 @@
12#include <linux/mfd/tc3589x.h> 12#include <linux/mfd/tc3589x.h>
13#include <linux/input/matrix_keypad.h> 13#include <linux/input/matrix_keypad.h>
14 14
15#include <mach/irqs.h> 15#include "irqs.h"
16 16
17#include "board-mop500.h" 17#include "board-mop500.h"
18 18
19/* Dummy data that can be overridden by staging driver */ 19static struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = {
20struct i2c_board_info __initdata __weak mop500_i2c3_devices_u8500[] = { 20 {
21 I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B),
22 .irq = NOMADIK_GPIO_TO_IRQ(84),
23 },
21}; 24};
22 25
23/* 26/*
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c
index 7037d3687e9f..bdaa422da028 100644
--- a/arch/arm/mach-ux500/board-mop500-uib.c
+++ b/arch/arm/mach-ux500/board-mop500-uib.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/i2c.h> 12#include <linux/i2c.h>
13 13
14#include <mach/hardware.h>
15#include "board-mop500.h" 14#include "board-mop500.h"
16#include "id.h" 15#include "id.h"
17 16
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 87d2d7b38ce9..a15dd6b63a8f 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -25,6 +25,8 @@
25#include <linux/mfd/abx500/ab8500.h> 25#include <linux/mfd/abx500/ab8500.h>
26#include <linux/regulator/ab8500.h> 26#include <linux/regulator/ab8500.h>
27#include <linux/regulator/fixed.h> 27#include <linux/regulator/fixed.h>
28#include <linux/regulator/driver.h>
29#include <linux/regulator/gpio-regulator.h>
28#include <linux/mfd/tc3589x.h> 30#include <linux/mfd/tc3589x.h>
29#include <linux/mfd/tps6105x.h> 31#include <linux/mfd/tps6105x.h>
30#include <linux/mfd/abx500/ab8500-gpio.h> 32#include <linux/mfd/abx500/ab8500-gpio.h>
@@ -42,13 +44,13 @@
42#include <asm/mach-types.h> 44#include <asm/mach-types.h>
43#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
44 46
45#include <mach/hardware.h> 47#include "setup.h"
46#include <mach/setup.h> 48#include "devices.h"
47#include <mach/devices.h> 49#include "irqs.h"
48#include <mach/irqs.h>
49#include <linux/platform_data/crypto-ux500.h> 50#include <linux/platform_data/crypto-ux500.h>
50 51
51#include "ste-dma40-db8500.h" 52#include "ste-dma40-db8500.h"
53#include "db8500-regs.h"
52#include "devices-db8500.h" 54#include "devices-db8500.h"
53#include "board-mop500.h" 55#include "board-mop500.h"
54#include "board-mop500-regulators.h" 56#include "board-mop500-regulators.h"
@@ -90,6 +92,37 @@ static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
90 }, 92 },
91}; 93};
92 94
95/* Dynamically populated. */
96static struct gpio sdi0_reg_gpios[] = {
97 { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" },
98};
99
100static struct gpio_regulator_state sdi0_reg_states[] = {
101 { .value = 2900000, .gpios = (0 << 0) },
102 { .value = 1800000, .gpios = (1 << 0) },
103};
104
105static struct gpio_regulator_config sdi0_reg_info = {
106 .supply_name = "ext-mmc-level-shifter",
107 .gpios = sdi0_reg_gpios,
108 .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios),
109 .states = sdi0_reg_states,
110 .nr_states = ARRAY_SIZE(sdi0_reg_states),
111 .type = REGULATOR_VOLTAGE,
112 .enable_high = 1,
113 .enabled_at_boot = 0,
114 .init_data = &sdi0_reg_init_data,
115 .startup_delay = 100,
116};
117
118static struct platform_device sdi0_regulator = {
119 .name = "gpio-regulator",
120 .id = -1,
121 .dev = {
122 .platform_data = &sdi0_reg_info,
123 },
124};
125
93static struct abx500_gpio_platform_data ab8500_gpio_pdata = { 126static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
94 .gpio_base = MOP500_AB8500_PIN_GPIO(1), 127 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
95}; 128};
@@ -199,71 +232,11 @@ static struct platform_device snowball_sbnet_dev = {
199 232
200struct ab8500_platform_data ab8500_platdata = { 233struct ab8500_platform_data ab8500_platdata = {
201 .irq_base = MOP500_AB8500_IRQ_BASE, 234 .irq_base = MOP500_AB8500_IRQ_BASE,
202 .regulator_reg_init = ab8500_regulator_reg_init, 235 .regulator = &ab8500_regulator_plat_data,
203 .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
204 .regulator = ab8500_regulators,
205 .num_regulator = ARRAY_SIZE(ab8500_regulators),
206 .gpio = &ab8500_gpio_pdata, 236 .gpio = &ab8500_gpio_pdata,
207 .codec = &ab8500_codec_pdata, 237 .codec = &ab8500_codec_pdata,
208}; 238};
209 239
210/*
211 * Thermal Sensor
212 */
213
214static struct resource db8500_thsens_resources[] = {
215 {
216 .name = "IRQ_HOTMON_LOW",
217 .start = IRQ_PRCMU_HOTMON_LOW,
218 .end = IRQ_PRCMU_HOTMON_LOW,
219 .flags = IORESOURCE_IRQ,
220 },
221 {
222 .name = "IRQ_HOTMON_HIGH",
223 .start = IRQ_PRCMU_HOTMON_HIGH,
224 .end = IRQ_PRCMU_HOTMON_HIGH,
225 .flags = IORESOURCE_IRQ,
226 },
227};
228
229static struct db8500_thsens_platform_data db8500_thsens_data = {
230 .trip_points[0] = {
231 .temp = 70000,
232 .type = THERMAL_TRIP_ACTIVE,
233 .cdev_name = {
234 [0] = "thermal-cpufreq-0",
235 },
236 },
237 .trip_points[1] = {
238 .temp = 75000,
239 .type = THERMAL_TRIP_ACTIVE,
240 .cdev_name = {
241 [0] = "thermal-cpufreq-0",
242 },
243 },
244 .trip_points[2] = {
245 .temp = 80000,
246 .type = THERMAL_TRIP_ACTIVE,
247 .cdev_name = {
248 [0] = "thermal-cpufreq-0",
249 },
250 },
251 .trip_points[3] = {
252 .temp = 85000,
253 .type = THERMAL_TRIP_CRITICAL,
254 },
255 .num_trips = 4,
256};
257
258static struct platform_device u8500_thsens_device = {
259 .name = "db8500-thermal",
260 .resource = db8500_thsens_resources,
261 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
262 .dev = {
263 .platform_data = &db8500_thsens_data,
264 },
265};
266
267static struct platform_device u8500_cpufreq_cooling_device = { 240static struct platform_device u8500_cpufreq_cooling_device = {
268 .name = "db8500-cpufreq-cooling", 241 .name = "db8500-cpufreq-cooling",
269}; 242};
@@ -491,6 +464,7 @@ static struct hash_platform_data u8500_hash1_platform_data = {
491/* add any platform devices here - TODO */ 464/* add any platform devices here - TODO */
492static struct platform_device *mop500_platform_devs[] __initdata = { 465static struct platform_device *mop500_platform_devs[] __initdata = {
493 &mop500_gpio_keys_device, 466 &mop500_gpio_keys_device,
467 &sdi0_regulator,
494}; 468};
495 469
496#ifdef CONFIG_STE_DMA40 470#ifdef CONFIG_STE_DMA40
@@ -632,8 +606,8 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
632 &snowball_key_dev, 606 &snowball_key_dev,
633 &snowball_sbnet_dev, 607 &snowball_sbnet_dev,
634 &snowball_gpio_en_3v3_regulator_dev, 608 &snowball_gpio_en_3v3_regulator_dev,
635 &u8500_thsens_device,
636 &u8500_cpufreq_cooling_device, 609 &u8500_cpufreq_cooling_device,
610 &sdi0_regulator,
637}; 611};
638 612
639static void __init mop500_init_machine(void) 613static void __init mop500_init_machine(void)
@@ -645,6 +619,9 @@ static void __init mop500_init_machine(void)
645 platform_device_register(&db8500_prcmu_device); 619 platform_device_register(&db8500_prcmu_device);
646 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 620 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
647 621
622 sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN;
623 sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL;
624
648 mop500_pinmaps_init(); 625 mop500_pinmaps_init();
649 parent = u8500_init_devices(&ab8500_platdata); 626 parent = u8500_init_devices(&ab8500_platdata);
650 627
@@ -678,6 +655,10 @@ static void __init snowball_init_machine(void)
678 int i; 655 int i;
679 656
680 platform_device_register(&db8500_prcmu_device); 657 platform_device_register(&db8500_prcmu_device);
658
659 sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO;
660 sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO;
661
681 snowball_pinmaps_init(); 662 snowball_pinmaps_init();
682 parent = u8500_init_devices(&ab8500_platdata); 663 parent = u8500_init_devices(&ab8500_platdata);
683 664
@@ -713,6 +694,9 @@ static void __init hrefv60_init_machine(void)
713 */ 694 */
714 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 695 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
715 696
697 sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO;
698 sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO;
699
716 hrefv60_pinmaps_init(); 700 hrefv60_pinmaps_init();
717 parent = u8500_init_devices(&ab8500_platdata); 701 parent = u8500_init_devices(&ab8500_platdata);
718 702
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index d38951be70df..49514b825034 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -8,8 +8,8 @@
8#define __BOARD_MOP500_H 8#define __BOARD_MOP500_H
9 9
10/* For NOMADIK_NR_GPIO */ 10/* For NOMADIK_NR_GPIO */
11#include <mach/irqs.h> 11#include "irqs.h"
12#include <mach/msp.h> 12#include <linux/platform_data/asoc-ux500-msp.h>
13#include <linux/amba/mmci.h> 13#include <linux/amba/mmci.h>
14 14
15/* Snowball specific GPIO assignments, this board has no GPIO expander */ 15/* Snowball specific GPIO assignments, this board has no GPIO expander */
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index 1c1609da76ce..f58615b5c601 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -9,8 +9,8 @@
9 9
10#include <asm/cacheflush.h> 10#include <asm/cacheflush.h>
11#include <asm/hardware/cache-l2x0.h> 11#include <asm/hardware/cache-l2x0.h>
12#include <mach/hardware.h>
13 12
13#include "db8500-regs.h"
14#include "id.h" 14#include "id.h"
15 15
16static void __iomem *l2x0_base; 16static void __iomem *l2x0_base;
@@ -47,8 +47,8 @@ static int __init ux500_l2x0_init(void)
47 /* Unlock before init */ 47 /* Unlock before init */
48 ux500_l2x0_unlock(); 48 ux500_l2x0_unlock();
49 49
50 /* DB9540's L2 has 128KB way size */ 50 /* DBx540's L2 has 128KB way size */
51 if (cpu_is_u9540()) 51 if (cpu_is_ux540_family())
52 /* 128KB way size */ 52 /* 128KB way size */
53 aux_val |= (0x4 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT); 53 aux_val |= (0x4 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT);
54 else 54 else
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index f1a581844372..995928ba22fd 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -28,15 +28,13 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30 30
31#include <mach/hardware.h> 31#include "setup.h"
32#include <mach/setup.h> 32#include "devices.h"
33#include <mach/devices.h> 33#include "irqs.h"
34#include <mach/db8500-regs.h>
35#include <mach/irqs.h>
36 34
37#include "devices-db8500.h" 35#include "devices-db8500.h"
38#include "ste-dma40-db8500.h" 36#include "ste-dma40-db8500.h"
39 37#include "db8500-regs.h"
40#include "board-mop500.h" 38#include "board-mop500.h"
41#include "id.h" 39#include "id.h"
42 40
@@ -94,8 +92,6 @@ void __init u8500_map_io(void)
94 iotable_init(u9540_io_desc, ARRAY_SIZE(u9540_io_desc)); 92 iotable_init(u9540_io_desc, ARRAY_SIZE(u9540_io_desc));
95 else 93 else
96 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc)); 94 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc));
97
98 _PRCMU_BASE = __io_address(U8500_PRCMU_BASE);
99} 95}
100 96
101static struct resource db8500_pmu_resources[] = { 97static struct resource db8500_pmu_resources[] = {
@@ -282,6 +278,7 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
282 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), 278 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
283 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", 279 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
284 &db8500_prcmu_pdata), 280 &db8500_prcmu_pdata),
281 OF_DEV_AUXDATA("smsc,lan9115", 0x50000000, "smsc911x", NULL),
285 /* Requires device name bindings. */ 282 /* Requires device name bindings. */
286 OF_DEV_AUXDATA("stericsson,nmk-pinctrl", U8500_PRCMU_BASE, 283 OF_DEV_AUXDATA("stericsson,nmk-pinctrl", U8500_PRCMU_BASE,
287 "pinctrl-db8500", NULL), 284 "pinctrl-db8500", NULL),
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index 537870d3fea8..b6145ea51641 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -8,7 +8,7 @@
8 8
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/io.h> 10#include <linux/io.h>
11#include <linux/mfd/db8500-prcmu.h> 11#include <linux/mfd/dbx500-prcmu.h>
12#include <linux/clksrc-dbx500-prcmu.h> 12#include <linux/clksrc-dbx500-prcmu.h>
13#include <linux/sys_soc.h> 13#include <linux/sys_soc.h>
14#include <linux/err.h> 14#include <linux/err.h>
@@ -20,18 +20,17 @@
20#include <linux/irqchip.h> 20#include <linux/irqchip.h>
21#include <linux/irqchip/arm-gic.h> 21#include <linux/irqchip/arm-gic.h>
22#include <linux/platform_data/clk-ux500.h> 22#include <linux/platform_data/clk-ux500.h>
23#include <linux/platform_data/arm-ux500-pm.h>
23 24
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25 26
26#include <mach/hardware.h> 27#include "setup.h"
27#include <mach/setup.h> 28#include "devices.h"
28#include <mach/devices.h>
29 29
30#include "board-mop500.h" 30#include "board-mop500.h"
31#include "db8500-regs.h"
31#include "id.h" 32#include "id.h"
32 33
33void __iomem *_PRCMU_BASE;
34
35/* 34/*
36 * FIXME: Should we set up the GPIO domain here? 35 * FIXME: Should we set up the GPIO domain here?
37 * 36 *
@@ -68,13 +67,23 @@ void __init ux500_init_irq(void)
68 * Init clocks here so that they are available for system timer 67 * Init clocks here so that they are available for system timer
69 * initialization. 68 * initialization.
70 */ 69 */
71 if (cpu_is_u8500_family() || cpu_is_u9540()) 70 if (cpu_is_u8500_family()) {
72 db8500_prcmu_early_init(); 71 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
73 72 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
74 if (cpu_is_u8500_family() || cpu_is_u9540()) 73 u8500_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
75 u8500_clk_init(); 74 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
76 else if (cpu_is_u8540()) 75 U8500_CLKRST6_BASE);
76 } else if (cpu_is_u9540()) {
77 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
78 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
79 u8500_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
80 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
81 U8500_CLKRST6_BASE);
82 } else if (cpu_is_u8540()) {
83 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
84 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
77 u8540_clk_init(); 85 u8540_clk_init();
86 }
78} 87}
79 88
80void __init ux500_init_late(void) 89void __init ux500_init_late(void)
@@ -140,14 +149,13 @@ struct device * __init ux500_soc_device_init(const char *soc_id)
140 soc_info_populate(soc_dev_attr, soc_id); 149 soc_info_populate(soc_dev_attr, soc_id);
141 150
142 soc_dev = soc_device_register(soc_dev_attr); 151 soc_dev = soc_device_register(soc_dev_attr);
143 if (IS_ERR_OR_NULL(soc_dev)) { 152 if (IS_ERR(soc_dev)) {
144 kfree(soc_dev_attr); 153 kfree(soc_dev_attr);
145 return NULL; 154 return NULL;
146 } 155 }
147 156
148 parent = soc_device_to_device(soc_dev); 157 parent = soc_device_to_device(soc_dev);
149 if (!IS_ERR_OR_NULL(parent)) 158 device_create_file(parent, &ux500_soc_attr);
150 device_create_file(parent, &ux500_soc_attr);
151 159
152 return parent; 160 return parent;
153} 161}
diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c
index ce9149302cc3..317a2be129fb 100644
--- a/arch/arm/mach-ux500/cpuidle.c
+++ b/arch/arm/mach-ux500/cpuidle.c
@@ -11,18 +11,19 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/cpuidle.h> 13#include <linux/cpuidle.h>
14#include <linux/clockchips.h>
15#include <linux/spinlock.h> 14#include <linux/spinlock.h>
16#include <linux/atomic.h> 15#include <linux/atomic.h>
17#include <linux/smp.h> 16#include <linux/smp.h>
18#include <linux/mfd/dbx500-prcmu.h> 17#include <linux/mfd/dbx500-prcmu.h>
18#include <linux/platform_data/arm-ux500-pm.h>
19 19
20#include <asm/cpuidle.h> 20#include <asm/cpuidle.h>
21#include <asm/proc-fns.h> 21#include <asm/proc-fns.h>
22 22
23#include "db8500-regs.h"
24
23static atomic_t master = ATOMIC_INIT(0); 25static atomic_t master = ATOMIC_INIT(0);
24static DEFINE_SPINLOCK(master_lock); 26static DEFINE_SPINLOCK(master_lock);
25static DEFINE_PER_CPU(struct cpuidle_device, ux500_cpuidle_device);
26 27
27static inline int ux500_enter_idle(struct cpuidle_device *dev, 28static inline int ux500_enter_idle(struct cpuidle_device *dev,
28 struct cpuidle_driver *drv, int index) 29 struct cpuidle_driver *drv, int index)
@@ -30,8 +31,6 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,
30 int this_cpu = smp_processor_id(); 31 int this_cpu = smp_processor_id();
31 bool recouple = false; 32 bool recouple = false;
32 33
33 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu);
34
35 if (atomic_inc_return(&master) == num_online_cpus()) { 34 if (atomic_inc_return(&master) == num_online_cpus()) {
36 35
37 /* With this lock, we prevent the other cpu to exit and enter 36 /* With this lock, we prevent the other cpu to exit and enter
@@ -91,22 +90,20 @@ out:
91 spin_unlock(&master_lock); 90 spin_unlock(&master_lock);
92 } 91 }
93 92
94 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu);
95
96 return index; 93 return index;
97} 94}
98 95
99static struct cpuidle_driver ux500_idle_driver = { 96static struct cpuidle_driver ux500_idle_driver = {
100 .name = "ux500_idle", 97 .name = "ux500_idle",
101 .owner = THIS_MODULE, 98 .owner = THIS_MODULE,
102 .en_core_tk_irqen = 1,
103 .states = { 99 .states = {
104 ARM_CPUIDLE_WFI_STATE, 100 ARM_CPUIDLE_WFI_STATE,
105 { 101 {
106 .enter = ux500_enter_idle, 102 .enter = ux500_enter_idle,
107 .exit_latency = 70, 103 .exit_latency = 70,
108 .target_residency = 260, 104 .target_residency = 260,
109 .flags = CPUIDLE_FLAG_TIME_VALID, 105 .flags = CPUIDLE_FLAG_TIME_VALID |
106 CPUIDLE_FLAG_TIMER_STOP,
110 .name = "ApIdle", 107 .name = "ApIdle",
111 .desc = "ARM Retention", 108 .desc = "ARM Retention",
112 }, 109 },
@@ -115,59 +112,13 @@ static struct cpuidle_driver ux500_idle_driver = {
115 .state_count = 2, 112 .state_count = 2,
116}; 113};
117 114
118/*
119 * For each cpu, setup the broadcast timer because we will
120 * need to migrate the timers for the states >= ApIdle.
121 */
122static void ux500_setup_broadcast_timer(void *arg)
123{
124 int cpu = smp_processor_id();
125 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
126}
127
128int __init ux500_idle_init(void) 115int __init ux500_idle_init(void)
129{ 116{
130 int ret, cpu; 117 /* Configure wake up reasons */
131 struct cpuidle_device *device;
132
133 /* Configure wake up reasons */
134 prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) | 118 prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
135 PRCMU_WAKEUP(ABB)); 119 PRCMU_WAKEUP(ABB));
136 120
137 /* 121 return cpuidle_register(&ux500_idle_driver, NULL);
138 * Configure the timer broadcast for each cpu, that must
139 * be done from the cpu context, so we use a smp cross
140 * call with 'on_each_cpu'.
141 */
142 on_each_cpu(ux500_setup_broadcast_timer, NULL, 1);
143
144 ret = cpuidle_register_driver(&ux500_idle_driver);
145 if (ret) {
146 printk(KERN_ERR "failed to register ux500 idle driver\n");
147 return ret;
148 }
149
150 for_each_online_cpu(cpu) {
151 device = &per_cpu(ux500_cpuidle_device, cpu);
152 device->cpu = cpu;
153 ret = cpuidle_register_device(device);
154 if (ret) {
155 printk(KERN_ERR "Failed to register cpuidle "
156 "device for cpu%d\n", cpu);
157 goto out_unregister;
158 }
159 }
160out:
161 return ret;
162
163out_unregister:
164 for_each_online_cpu(cpu) {
165 device = &per_cpu(ux500_cpuidle_device, cpu);
166 cpuidle_unregister_device(device);
167 }
168
169 cpuidle_unregister_driver(&ux500_idle_driver);
170 goto out;
171} 122}
172 123
173device_initcall(ux500_idle_init); 124device_initcall(ux500_idle_init);
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/db8500-regs.h
index 1530d493879d..b2d7a0b98629 100644
--- a/arch/arm/mach-ux500/include/mach/db8500-regs.h
+++ b/arch/arm/mach-ux500/db8500-regs.h
@@ -170,4 +170,32 @@
170/* SoC identification number information */ 170/* SoC identification number information */
171#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0) 171#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0)
172 172
173/* Offsets to specific addresses in some IP blocks for DMA */
174#define MSP_TX_RX_REG_OFFSET 0
175#define CRYP1_RX_REG_OFFSET 0x10
176#define CRYP1_TX_REG_OFFSET 0x8
177#define HASH1_TX_REG_OFFSET 0x4
178
179/*
180 * Macros to get at IO space when running virtually
181 * We dont map all the peripherals, let ioremap do
182 * this for us. We map only very basic peripherals here.
183 */
184#define U8500_IO_VIRTUAL 0xf0000000
185#define U8500_IO_PHYSICAL 0xa0000000
186/* This is where we map in the ROM to check ASIC IDs */
187#define UX500_VIRT_ROM 0xf0000000
188
189/* This macro is used in assembly, so no cast */
190#define IO_ADDRESS(x) \
191 (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL)
192
193/* typesafe io address */
194#define __io_address(n) IOMEM(IO_ADDRESS(n))
195
196/* Used by some plat-nomadik code */
197#define io_p2v(n) __io_address(n)
198
199#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
200
173#endif 201#endif
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 16b5f71e6974..f71b3d7bd4fb 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -13,8 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/platform_data/pinctrl-nomadik.h> 14#include <linux/platform_data/pinctrl-nomadik.h>
15 15
16#include <mach/hardware.h> 16#include "irqs.h"
17#include <mach/irqs.h>
18 17
19#include "devices-common.h" 18#include "devices-common.h"
20 19
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index f3d9419f75d3..1cf94ce0feec 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -15,10 +15,10 @@
15#include <linux/platform_data/dma-ste-dma40.h> 15#include <linux/platform_data/dma-ste-dma40.h>
16#include <linux/mfd/dbx500-prcmu.h> 16#include <linux/mfd/dbx500-prcmu.h>
17 17
18#include <mach/hardware.h> 18#include "setup.h"
19#include <mach/setup.h> 19#include "irqs.h"
20#include <mach/irqs.h>
21 20
21#include "db8500-regs.h"
22#include "devices-db8500.h" 22#include "devices-db8500.h"
23#include "ste-dma40-db8500.h" 23#include "ste-dma40-db8500.h"
24 24
@@ -199,6 +199,8 @@ struct platform_device u8500_ske_keypad_device = {
199 199
200struct prcmu_pdata db8500_prcmu_pdata = { 200struct prcmu_pdata db8500_prcmu_pdata = {
201 .ab_platdata = &ab8500_platdata, 201 .ab_platdata = &ab8500_platdata,
202 .ab_irq = IRQ_DB8500_AB8500,
203 .irq_base = IRQ_PRCMU_BASE,
202 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 204 .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET,
203 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 205 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET,
204}; 206};
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index dbcb35c48f06..321998320f98 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -9,7 +9,8 @@
9#define __DEVICES_DB8500_H 9#define __DEVICES_DB8500_H
10 10
11#include <linux/platform_data/usb-musb-ux500.h> 11#include <linux/platform_data/usb-musb-ux500.h>
12#include <mach/irqs.h> 12#include "irqs.h"
13#include "db8500-regs.h"
13#include "devices-common.h" 14#include "devices-common.h"
14 15
15struct ske_keypad_platform_data; 16struct ske_keypad_platform_data;
diff --git a/arch/arm/mach-ux500/devices.c b/arch/arm/mach-ux500/devices.c
index ea0a2f92ca70..0f9e52b95935 100644
--- a/arch/arm/mach-ux500/devices.c
+++ b/arch/arm/mach-ux500/devices.c
@@ -11,8 +11,9 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/amba/bus.h> 12#include <linux/amba/bus.h>
13 13
14#include <mach/hardware.h> 14#include "setup.h"
15#include <mach/setup.h> 15
16#include "db8500-regs.h"
16 17
17void __init amba_add_devices(struct amba_device *devs[], int num) 18void __init amba_add_devices(struct amba_device *devs[], int num)
18{ 19{
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/devices.h
index cbc6f1e4104d..cbc6f1e4104d 100644
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/devices.h
diff --git a/arch/arm/mach-ux500/hotplug.c b/arch/arm/mach-ux500/hotplug.c
index 2f6af259015d..2bc00b085e38 100644
--- a/arch/arm/mach-ux500/hotplug.c
+++ b/arch/arm/mach-ux500/hotplug.c
@@ -12,10 +12,9 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 15#include <asm/smp_plat.h>
17 16
18#include <mach/setup.h> 17#include "setup.h"
19 18
20/* 19/*
21 * platform-specific code to shutdown a CPU 20 * platform-specific code to shutdown a CPU
@@ -24,8 +23,6 @@
24 */ 23 */
25void __ref ux500_cpu_die(unsigned int cpu) 24void __ref ux500_cpu_die(unsigned int cpu)
26{ 25{
27 flush_cache_all();
28
29 /* directly enter low power state, skipping secure registers */ 26 /* directly enter low power state, skipping secure registers */
30 for (;;) { 27 for (;;) {
31 __asm__ __volatile__("dsb\n\t" "wfi\n\t" 28 __asm__ __volatile__("dsb\n\t" "wfi\n\t"
diff --git a/arch/arm/mach-ux500/id.c b/arch/arm/mach-ux500/id.c
index 9f951842e1e5..0d33d1a06955 100644
--- a/arch/arm/mach-ux500/id.c
+++ b/arch/arm/mach-ux500/id.c
@@ -14,9 +14,9 @@
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/mach/map.h> 15#include <asm/mach/map.h>
16 16
17#include <mach/hardware.h> 17#include "setup.h"
18#include <mach/setup.h>
19 18
19#include "db8500-regs.h"
20#include "id.h" 20#include "id.h"
21 21
22struct dbx500_asic_id dbx500_id; 22struct dbx500_asic_id dbx500_id;
diff --git a/arch/arm/mach-ux500/include/mach/debug-macro.S b/arch/arm/mach-ux500/include/mach/debug-macro.S
deleted file mode 100644
index 67035223334a..000000000000
--- a/arch/arm/mach-ux500/include/mach/debug-macro.S
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Debugging macro include header
3 *
4 * Copyright (C) 2009 ST-Ericsson
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 <mach/hardware.h>
12
13#if CONFIG_UX500_DEBUG_UART > 2
14#error Invalid Ux500 debug UART
15#endif
16
17/*
18 * DEBUG_LL only works if only one SOC is built in. We don't use #else below
19 * in order to get "__UX500_UART redefined" warnings if more than one SOC is
20 * built, so that there's some hint during the build that something is wrong.
21 */
22
23#ifdef CONFIG_UX500_SOC_DB8500
24#define __UX500_UART(n) U8500_UART##n##_BASE
25#endif
26
27#ifndef __UX500_UART
28#error Unknown SOC
29#endif
30
31#define UX500_UART(n) __UX500_UART(n)
32#define UART_BASE UX500_UART(CONFIG_UX500_DEBUG_UART)
33
34 .macro addruart, rp, rv, tmp
35 ldr \rp, =UART_BASE @ no, physical address
36 ldr \rv, =IO_ADDRESS(UART_BASE) @ yes, virtual address
37 .endm
38
39#include <asm/hardware/debug-pl01x.S>
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h
deleted file mode 100644
index 5201ddace503..000000000000
--- a/arch/arm/mach-ux500/include/mach/hardware.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Copyright (C) 2009 ST-Ericsson.
3 *
4 * U8500 hardware definitions
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#ifndef __MACH_HARDWARE_H
11#define __MACH_HARDWARE_H
12
13/*
14 * Macros to get at IO space when running virtually
15 * We dont map all the peripherals, let ioremap do
16 * this for us. We map only very basic peripherals here.
17 */
18#define U8500_IO_VIRTUAL 0xf0000000
19#define U8500_IO_PHYSICAL 0xa0000000
20/* This is where we map in the ROM to check ASIC IDs */
21#define UX500_VIRT_ROM 0xf0000000
22
23/* This macro is used in assembly, so no cast */
24#define IO_ADDRESS(x) \
25 (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL)
26
27/* typesafe io address */
28#define __io_address(n) IOMEM(IO_ADDRESS(n))
29
30/* Used by some plat-nomadik code */
31#define io_p2v(n) __io_address(n)
32
33#include <mach/db8500-regs.h>
34
35#define MSP_TX_RX_REG_OFFSET 0
36#define CRYP1_RX_REG_OFFSET 0x10
37#define CRYP1_TX_REG_OFFSET 0x8
38#define HASH1_TX_REG_OFFSET 0x4
39
40#ifndef __ASSEMBLY__
41
42extern void __iomem *_PRCMU_BASE;
43
44#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
45
46#endif /* __ASSEMBLY__ */
47#endif /* __MACH_HARDWARE_H */
diff --git a/arch/arm/mach-ux500/include/mach/msp.h b/arch/arm/mach-ux500/include/mach/msp.h
deleted file mode 100644
index 9991aea3d577..000000000000
--- a/arch/arm/mach-ux500/include/mach/msp.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __MSP_H
9#define __MSP_H
10
11#include <linux/platform_data/dma-ste-dma40.h>
12
13enum msp_i2s_id {
14 MSP_I2S_0 = 0,
15 MSP_I2S_1,
16 MSP_I2S_2,
17 MSP_I2S_3,
18};
19
20/* Platform data structure for a MSP I2S-device */
21struct msp_i2s_platform_data {
22 enum msp_i2s_id id;
23 struct stedma40_chan_cfg *msp_i2s_dma_rx;
24 struct stedma40_chan_cfg *msp_i2s_dma_tx;
25};
26
27#endif
diff --git a/arch/arm/mach-ux500/include/mach/timex.h b/arch/arm/mach-ux500/include/mach/timex.h
deleted file mode 100644
index d0942c174018..000000000000
--- a/arch/arm/mach-ux500/include/mach/timex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARCH_TIMEX_H
2#define __ASM_ARCH_TIMEX_H
3
4#define CLOCK_TICK_RATE 110000000
5
6#endif
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h
deleted file mode 100644
index 36969d52e53a..000000000000
--- a/arch/arm/mach-ux500/include/mach/uncompress.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * Copyright (C) 2009 ST-Ericsson
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef __ASM_ARCH_UNCOMPRESS_H
19#define __ASM_ARCH_UNCOMPRESS_H
20
21#include <asm/setup.h>
22#include <asm/mach-types.h>
23#include <linux/io.h>
24#include <linux/amba/serial.h>
25#include <mach/hardware.h>
26
27void __iomem *ux500_uart_base;
28
29static void putc(const char c)
30{
31 /* Do nothing if the UART is not enabled. */
32 if (!(__raw_readb(ux500_uart_base + UART011_CR) & 0x1))
33 return;
34
35 if (c == '\n')
36 putc('\r');
37
38 while (__raw_readb(ux500_uart_base + UART01x_FR) & (1 << 5))
39 barrier();
40 __raw_writeb(c, ux500_uart_base + UART01x_DR);
41}
42
43static void flush(void)
44{
45 if (!(__raw_readb(ux500_uart_base + UART011_CR) & 0x1))
46 return;
47 while (__raw_readb(ux500_uart_base + UART01x_FR) & (1 << 3))
48 barrier();
49}
50
51static inline void arch_decomp_setup(void)
52{
53 /* Use machine_is_foo() macro if you need to switch base someday */
54 ux500_uart_base = (void __iomem *)U8500_UART2_BASE;
55}
56
57#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/irqs-board-mop500.h
index d526dd8e87d3..d526dd8e87d3 100644
--- a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
+++ b/arch/arm/mach-ux500/irqs-board-mop500.h
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db8500.h b/arch/arm/mach-ux500/irqs-db8500.h
index 68bc14974608..f3a9d5947ef3 100644
--- a/arch/arm/mach-ux500/include/mach/irqs-db8500.h
+++ b/arch/arm/mach-ux500/irqs-db8500.h
@@ -109,31 +109,6 @@
109 109
110/* Virtual interrupts corresponding to the PRCMU wakeups. */ 110/* Virtual interrupts corresponding to the PRCMU wakeups. */
111#define IRQ_PRCMU_BASE IRQ_SOC_START 111#define IRQ_PRCMU_BASE IRQ_SOC_START
112#define NUM_PRCMU_WAKEUPS (IRQ_PRCMU_END - IRQ_PRCMU_BASE)
113
114#define IRQ_PRCMU_RTC (IRQ_PRCMU_BASE)
115#define IRQ_PRCMU_RTT0 (IRQ_PRCMU_BASE + 1)
116#define IRQ_PRCMU_RTT1 (IRQ_PRCMU_BASE + 2)
117#define IRQ_PRCMU_HSI0 (IRQ_PRCMU_BASE + 3)
118#define IRQ_PRCMU_HSI1 (IRQ_PRCMU_BASE + 4)
119#define IRQ_PRCMU_CA_WAKE (IRQ_PRCMU_BASE + 5)
120#define IRQ_PRCMU_USB (IRQ_PRCMU_BASE + 6)
121#define IRQ_PRCMU_ABB (IRQ_PRCMU_BASE + 7)
122#define IRQ_PRCMU_ABB_FIFO (IRQ_PRCMU_BASE + 8)
123#define IRQ_PRCMU_ARM (IRQ_PRCMU_BASE + 9)
124#define IRQ_PRCMU_MODEM_SW_RESET_REQ (IRQ_PRCMU_BASE + 10)
125#define IRQ_PRCMU_GPIO0 (IRQ_PRCMU_BASE + 11)
126#define IRQ_PRCMU_GPIO1 (IRQ_PRCMU_BASE + 12)
127#define IRQ_PRCMU_GPIO2 (IRQ_PRCMU_BASE + 13)
128#define IRQ_PRCMU_GPIO3 (IRQ_PRCMU_BASE + 14)
129#define IRQ_PRCMU_GPIO4 (IRQ_PRCMU_BASE + 15)
130#define IRQ_PRCMU_GPIO5 (IRQ_PRCMU_BASE + 16)
131#define IRQ_PRCMU_GPIO6 (IRQ_PRCMU_BASE + 17)
132#define IRQ_PRCMU_GPIO7 (IRQ_PRCMU_BASE + 18)
133#define IRQ_PRCMU_GPIO8 (IRQ_PRCMU_BASE + 19)
134#define IRQ_PRCMU_CA_SLEEP (IRQ_PRCMU_BASE + 20)
135#define IRQ_PRCMU_HOTMON_LOW (IRQ_PRCMU_BASE + 21)
136#define IRQ_PRCMU_HOTMON_HIGH (IRQ_PRCMU_BASE + 22)
137#define IRQ_PRCMU_END (IRQ_PRCMU_BASE + 23) 112#define IRQ_PRCMU_END (IRQ_PRCMU_BASE + 23)
138 113
139/* 114/*
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/irqs.h
index fc77b4274c8d..15b2af698ed7 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/irqs.h
@@ -10,8 +10,6 @@
10#ifndef ASM_ARCH_IRQS_H 10#ifndef ASM_ARCH_IRQS_H
11#define ASM_ARCH_IRQS_H 11#define ASM_ARCH_IRQS_H
12 12
13#include <mach/hardware.h>
14
15#define IRQ_LOCALTIMER 29 13#define IRQ_LOCALTIMER 29
16#define IRQ_LOCALWDOG 30 14#define IRQ_LOCALWDOG 30
17 15
@@ -36,14 +34,14 @@
36/* This will be overridden by SoC-specific irq headers */ 34/* This will be overridden by SoC-specific irq headers */
37#define IRQ_SOC_END IRQ_SOC_START 35#define IRQ_SOC_END IRQ_SOC_START
38 36
39#include <mach/irqs-db8500.h> 37#include "irqs-db8500.h"
40 38
41#define IRQ_BOARD_START IRQ_SOC_END 39#define IRQ_BOARD_START IRQ_SOC_END
42/* This will be overridden by board-specific irq headers */ 40/* This will be overridden by board-specific irq headers */
43#define IRQ_BOARD_END IRQ_BOARD_START 41#define IRQ_BOARD_END IRQ_BOARD_START
44 42
45#ifdef CONFIG_MACH_MOP500 43#ifdef CONFIG_MACH_MOP500
46#include <mach/irqs-board-mop500.h> 44#include "irqs-board-mop500.h"
47#endif 45#endif
48 46
49#define UX500_NR_IRQS IRQ_BOARD_END 47#define UX500_NR_IRQS IRQ_BOARD_END
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index 18f7af339dc9..14d90469392f 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -16,15 +16,14 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irqchip/arm-gic.h>
20 19
21#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
22#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
23#include <asm/smp_scu.h> 22#include <asm/smp_scu.h>
24 23
25#include <mach/hardware.h> 24#include "setup.h"
26#include <mach/setup.h>
27 25
26#include "db8500-regs.h"
28#include "id.h" 27#include "id.h"
29 28
30/* This is called from headsmp.S to wakeup the secondary core */ 29/* This is called from headsmp.S to wakeup the secondary core */
@@ -58,13 +57,6 @@ static DEFINE_SPINLOCK(boot_lock);
58static void __cpuinit ux500_secondary_init(unsigned int cpu) 57static void __cpuinit ux500_secondary_init(unsigned int cpu)
59{ 58{
60 /* 59 /*
61 * if any interrupts are already enabled for the primary
62 * core (e.g. timer irq), then they will not have been enabled
63 * for us: do so
64 */
65 gic_secondary_init(0);
66
67 /*
68 * let the primary processor know we're out of the 60 * let the primary processor know we're out of the
69 * pen, then head off into the C entry point 61 * pen, then head off into the C entry point
70 */ 62 */
diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
new file mode 100644
index 000000000000..1a468f0fd22e
--- /dev/null
+++ b/arch/arm/mach-ux500/pm.c
@@ -0,0 +1,167 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010-2013
3 * Author: Rickard Andersson <rickard.andersson@stericsson.com> for
4 * ST-Ericsson.
5 * Author: Daniel Lezcano <daniel.lezcano@linaro.org> for Linaro.
6 * License terms: GNU General Public License (GPL) version 2
7 *
8 */
9
10#include <linux/kernel.h>
11#include <linux/irqchip/arm-gic.h>
12#include <linux/delay.h>
13#include <linux/io.h>
14#include <linux/platform_data/arm-ux500-pm.h>
15
16#include "db8500-regs.h"
17
18/* ARM WFI Standby signal register */
19#define PRCM_ARM_WFI_STANDBY (prcmu_base + 0x130)
20#define PRCM_ARM_WFI_STANDBY_WFI0 0x08
21#define PRCM_ARM_WFI_STANDBY_WFI1 0x10
22#define PRCM_IOCR (prcmu_base + 0x310)
23#define PRCM_IOCR_IOFORCE 0x1
24
25/* Dual A9 core interrupt management unit registers */
26#define PRCM_A9_MASK_REQ (prcmu_base + 0x328)
27#define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ 0x1
28
29#define PRCM_A9_MASK_ACK (prcmu_base + 0x32c)
30#define PRCM_ARMITMSK31TO0 (prcmu_base + 0x11c)
31#define PRCM_ARMITMSK63TO32 (prcmu_base + 0x120)
32#define PRCM_ARMITMSK95TO64 (prcmu_base + 0x124)
33#define PRCM_ARMITMSK127TO96 (prcmu_base + 0x128)
34#define PRCM_POWER_STATE_VAL (prcmu_base + 0x25C)
35#define PRCM_ARMITVAL31TO0 (prcmu_base + 0x260)
36#define PRCM_ARMITVAL63TO32 (prcmu_base + 0x264)
37#define PRCM_ARMITVAL95TO64 (prcmu_base + 0x268)
38#define PRCM_ARMITVAL127TO96 (prcmu_base + 0x26C)
39
40static void __iomem *prcmu_base;
41
42/* This function decouple the gic from the prcmu */
43int prcmu_gic_decouple(void)
44{
45 u32 val = readl(PRCM_A9_MASK_REQ);
46
47 /* Set bit 0 register value to 1 */
48 writel(val | PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ,
49 PRCM_A9_MASK_REQ);
50
51 /* Make sure the register is updated */
52 readl(PRCM_A9_MASK_REQ);
53
54 /* Wait a few cycles for the gic mask completion */
55 udelay(1);
56
57 return 0;
58}
59
60/* This function recouple the gic with the prcmu */
61int prcmu_gic_recouple(void)
62{
63 u32 val = readl(PRCM_A9_MASK_REQ);
64
65 /* Set bit 0 register value to 0 */
66 writel(val & ~PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ, PRCM_A9_MASK_REQ);
67
68 return 0;
69}
70
71#define PRCMU_GIC_NUMBER_REGS 5
72
73/*
74 * This function checks if there are pending irq on the gic. It only
75 * makes sense if the gic has been decoupled before with the
76 * db8500_prcmu_gic_decouple function. Disabling an interrupt only
77 * disables the forwarding of the interrupt to any CPU interface. It
78 * does not prevent the interrupt from changing state, for example
79 * becoming pending, or active and pending if it is already
80 * active. Hence, we have to check the interrupt is pending *and* is
81 * active.
82 */
83bool prcmu_gic_pending_irq(void)
84{
85 u32 pr; /* Pending register */
86 u32 er; /* Enable register */
87 void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE);
88 int i;
89
90 /* 5 registers. STI & PPI not skipped */
91 for (i = 0; i < PRCMU_GIC_NUMBER_REGS; i++) {
92
93 pr = readl_relaxed(dist_base + GIC_DIST_PENDING_SET + i * 4);
94 er = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
95
96 if (pr & er)
97 return true; /* There is a pending interrupt */
98 }
99
100 return false;
101}
102
103/*
104 * This function checks if there are pending interrupt on the
105 * prcmu which has been delegated to monitor the irqs with the
106 * db8500_prcmu_copy_gic_settings function.
107 */
108bool prcmu_pending_irq(void)
109{
110 u32 it, im;
111 int i;
112
113 for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) {
114 it = readl(PRCM_ARMITVAL31TO0 + i * 4);
115 im = readl(PRCM_ARMITMSK31TO0 + i * 4);
116 if (it & im)
117 return true; /* There is a pending interrupt */
118 }
119
120 return false;
121}
122
123/*
124 * This function checks if the specified cpu is in in WFI. It's usage
125 * makes sense only if the gic is decoupled with the db8500_prcmu_gic_decouple
126 * function. Of course passing smp_processor_id() to this function will
127 * always return false...
128 */
129bool prcmu_is_cpu_in_wfi(int cpu)
130{
131 return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 :
132 PRCM_ARM_WFI_STANDBY_WFI0;
133}
134
135/*
136 * This function copies the gic SPI settings to the prcmu in order to
137 * monitor them and abort/finish the retention/off sequence or state.
138 */
139int prcmu_copy_gic_settings(void)
140{
141 u32 er; /* Enable register */
142 void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE);
143 int i;
144
145 /* We skip the STI and PPI */
146 for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) {
147 er = readl_relaxed(dist_base +
148 GIC_DIST_ENABLE_SET + (i + 1) * 4);
149 writel(er, PRCM_ARMITMSK31TO0 + i * 4);
150 }
151
152 return 0;
153}
154
155void __init ux500_pm_init(u32 phy_base, u32 size)
156{
157 prcmu_base = ioremap(phy_base, size);
158 if (!prcmu_base) {
159 pr_err("could not remap PRCMU for PM functions\n");
160 return;
161 }
162 /*
163 * On watchdog reboot the GIC is in some cases decoupled.
164 * This will make sure that the GIC is correctly configured.
165 */
166 prcmu_gic_recouple();
167}
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/setup.h
index bddce2b49372..bddce2b49372 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/setup.h
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index a6af0b8732ba..b6bd0efcbe64 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -7,16 +7,17 @@
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/clksrc-dbx500-prcmu.h> 9#include <linux/clksrc-dbx500-prcmu.h>
10#include <linux/clocksource.h>
10#include <linux/of.h> 11#include <linux/of.h>
11#include <linux/of_address.h> 12#include <linux/of_address.h>
12#include <linux/platform_data/clocksource-nomadik-mtu.h> 13#include <linux/platform_data/clocksource-nomadik-mtu.h>
13 14
14#include <asm/smp_twd.h> 15#include <asm/smp_twd.h>
15 16
16#include <mach/setup.h> 17#include "setup.h"
17#include <mach/hardware.h> 18#include "irqs.h"
18#include <mach/irqs.h>
19 19
20#include "db8500-regs.h"
20#include "id.h" 21#include "id.h"
21 22
22#ifdef CONFIG_HAVE_ARM_TWD 23#ifdef CONFIG_HAVE_ARM_TWD
@@ -32,7 +33,7 @@ static void __init ux500_twd_init(void)
32 twd_local_timer = &u8500_twd_local_timer; 33 twd_local_timer = &u8500_twd_local_timer;
33 34
34 if (of_have_populated_dt()) 35 if (of_have_populated_dt())
35 twd_local_timer_of_register(); 36 clocksource_of_init();
36 else { 37 else {
37 err = twd_local_timer_register(twd_local_timer); 38 err = twd_local_timer_register(twd_local_timer);
38 if (err) 39 if (err)
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 78ac65f62e87..2dfc72f7cd8a 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -10,7 +10,7 @@
10#include <linux/platform_data/usb-musb-ux500.h> 10#include <linux/platform_data/usb-musb-ux500.h>
11#include <linux/platform_data/dma-ste-dma40.h> 11#include <linux/platform_data/dma-ste-dma40.h>
12 12
13#include <mach/hardware.h> 13#include "db8500-regs.h"
14 14
15#define MUSB_DMA40_RX_CH { \ 15#define MUSB_DMA40_RX_CH { \
16 .mode = STEDMA40_MODE_LOGICAL, \ 16 .mode = STEDMA40_MODE_LOGICAL, \
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 52d315b792c8..5907e10c37fd 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -9,6 +9,8 @@ config ARCH_VEXPRESS
9 select COMMON_CLK_VERSATILE 9 select COMMON_CLK_VERSATILE
10 select CPU_V7 10 select CPU_V7
11 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
12 select HAVE_ARM_SCU if SMP
13 select HAVE_ARM_TWD if LOCAL_TIMERS
12 select HAVE_CLK 14 select HAVE_CLK
13 select HAVE_PATA_PLATFORM 15 select HAVE_PATA_PLATFORM
14 select HAVE_SMP 16 select HAVE_SMP
@@ -17,6 +19,9 @@ config ARCH_VEXPRESS
17 select NO_IOPORT 19 select NO_IOPORT
18 select PLAT_VERSATILE 20 select PLAT_VERSATILE
19 select PLAT_VERSATILE_CLCD 21 select PLAT_VERSATILE_CLCD
22 select POWER_RESET
23 select POWER_RESET_VEXPRESS
24 select POWER_SUPPLY
20 select REGULATOR_FIXED_VOLTAGE if REGULATOR 25 select REGULATOR_FIXED_VOLTAGE if REGULATOR
21 select VEXPRESS_CONFIG 26 select VEXPRESS_CONFIG
22 help 27 help
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
index 80b64971fbdd..42703e8b4d3b 100644
--- a/arch/arm/mach-vexpress/Makefile
+++ b/arch/arm/mach-vexpress/Makefile
@@ -4,7 +4,7 @@
4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ 4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
5 -I$(srctree)/arch/arm/plat-versatile/include 5 -I$(srctree)/arch/arm/plat-versatile/include
6 6
7obj-y := v2m.o reset.o 7obj-y := v2m.o
8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o 8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o
9obj-$(CONFIG_SMP) += platsmp.o 9obj-$(CONFIG_SMP) += platsmp.o
10obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 10obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index a141b98d84fe..f0ce6b8f5e71 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -12,7 +12,6 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 15#include <asm/smp_plat.h>
17#include <asm/cp15.h> 16#include <asm/cp15.h>
18 17
@@ -20,7 +19,6 @@ static inline void cpu_enter_lowpower(void)
20{ 19{
21 unsigned int v; 20 unsigned int v;
22 21
23 flush_cache_all();
24 asm volatile( 22 asm volatile(
25 "mcr p15, 0, %1, c7, c5, 0\n" 23 "mcr p15, 0, %1, c7, c5, 0\n"
26 " mcr p15, 0, %1, c7, c10, 4\n" 24 " mcr p15, 0, %1, c7, c10, 4\n"
diff --git a/arch/arm/mach-vexpress/reset.c b/arch/arm/mach-vexpress/reset.c
deleted file mode 100644
index 465923aa3819..000000000000
--- a/arch/arm/mach-vexpress/reset.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#include <linux/jiffies.h>
15#include <linux/of.h>
16#include <linux/of_device.h>
17#include <linux/platform_device.h>
18#include <linux/stat.h>
19#include <linux/vexpress.h>
20
21static void vexpress_reset_do(struct device *dev, const char *what)
22{
23 int err = -ENOENT;
24 struct vexpress_config_func *func =
25 vexpress_config_func_get_by_dev(dev);
26
27 if (func) {
28 unsigned long timeout;
29
30 err = vexpress_config_write(func, 0, 0);
31
32 timeout = jiffies + HZ;
33 while (time_before(jiffies, timeout))
34 cpu_relax();
35 }
36
37 dev_emerg(dev, "Unable to %s (%d)\n", what, err);
38}
39
40static struct device *vexpress_power_off_device;
41
42void vexpress_power_off(void)
43{
44 vexpress_reset_do(vexpress_power_off_device, "power off");
45}
46
47static struct device *vexpress_restart_device;
48
49void vexpress_restart(char str, const char *cmd)
50{
51 vexpress_reset_do(vexpress_restart_device, "restart");
52}
53
54static ssize_t vexpress_reset_active_show(struct device *dev,
55 struct device_attribute *attr, char *buf)
56{
57 return sprintf(buf, "%d\n", vexpress_restart_device == dev);
58}
59
60static ssize_t vexpress_reset_active_store(struct device *dev,
61 struct device_attribute *attr, const char *buf, size_t count)
62{
63 long value;
64 int err = kstrtol(buf, 0, &value);
65
66 if (!err && value)
67 vexpress_restart_device = dev;
68
69 return err ? err : count;
70}
71
72DEVICE_ATTR(active, S_IRUGO | S_IWUSR, vexpress_reset_active_show,
73 vexpress_reset_active_store);
74
75
76enum vexpress_reset_func { FUNC_RESET, FUNC_SHUTDOWN, FUNC_REBOOT };
77
78static struct of_device_id vexpress_reset_of_match[] = {
79 {
80 .compatible = "arm,vexpress-reset",
81 .data = (void *)FUNC_RESET,
82 }, {
83 .compatible = "arm,vexpress-shutdown",
84 .data = (void *)FUNC_SHUTDOWN
85 }, {
86 .compatible = "arm,vexpress-reboot",
87 .data = (void *)FUNC_REBOOT
88 },
89 {}
90};
91
92static int vexpress_reset_probe(struct platform_device *pdev)
93{
94 enum vexpress_reset_func func;
95 const struct of_device_id *match =
96 of_match_device(vexpress_reset_of_match, &pdev->dev);
97
98 if (match)
99 func = (enum vexpress_reset_func)match->data;
100 else
101 func = pdev->id_entry->driver_data;
102
103 switch (func) {
104 case FUNC_SHUTDOWN:
105 vexpress_power_off_device = &pdev->dev;
106 break;
107 case FUNC_RESET:
108 if (!vexpress_restart_device)
109 vexpress_restart_device = &pdev->dev;
110 device_create_file(&pdev->dev, &dev_attr_active);
111 break;
112 case FUNC_REBOOT:
113 vexpress_restart_device = &pdev->dev;
114 device_create_file(&pdev->dev, &dev_attr_active);
115 break;
116 };
117
118 return 0;
119}
120
121static const struct platform_device_id vexpress_reset_id_table[] = {
122 { .name = "vexpress-reset", .driver_data = FUNC_RESET, },
123 { .name = "vexpress-shutdown", .driver_data = FUNC_SHUTDOWN, },
124 { .name = "vexpress-reboot", .driver_data = FUNC_REBOOT, },
125 {}
126};
127
128static struct platform_driver vexpress_reset_driver = {
129 .probe = vexpress_reset_probe,
130 .driver = {
131 .name = "vexpress-reset",
132 .of_match_table = vexpress_reset_of_match,
133 },
134 .id_table = vexpress_reset_id_table,
135};
136
137static int __init vexpress_reset_init(void)
138{
139 return platform_driver_register(&vexpress_reset_driver);
140}
141device_initcall(vexpress_reset_init);
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 915683cb67d6..9366f37902d9 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -5,6 +5,7 @@
5#include <linux/amba/bus.h> 5#include <linux/amba/bus.h>
6#include <linux/amba/mmci.h> 6#include <linux/amba/mmci.h>
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/clocksource.h>
8#include <linux/smp.h> 9#include <linux/smp.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/irqchip.h> 11#include <linux/irqchip.h>
@@ -21,11 +22,12 @@
21#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
22#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
23#include <linux/vexpress.h> 24#include <linux/vexpress.h>
25#include <linux/clk-provider.h>
26#include <linux/clkdev.h>
24 27
25#include <asm/arch_timer.h> 28#include <asm/arch_timer.h>
26#include <asm/mach-types.h> 29#include <asm/mach-types.h>
27#include <asm/sizes.h> 30#include <asm/sizes.h>
28#include <asm/smp_twd.h>
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 32#include <asm/mach/map.h>
31#include <asm/mach/time.h> 33#include <asm/mach/time.h>
@@ -361,8 +363,6 @@ static void __init v2m_init(void)
361 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++) 363 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
362 amba_device_register(v2m_amba_devs[i], &iomem_resource); 364 amba_device_register(v2m_amba_devs[i], &iomem_resource);
363 365
364 pm_power_off = vexpress_power_off;
365
366 ct_desc->init_tile(); 366 ct_desc->init_tile();
367} 367}
368 368
@@ -374,7 +374,6 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
374 .init_irq = v2m_init_irq, 374 .init_irq = v2m_init_irq,
375 .init_time = v2m_timer_init, 375 .init_time = v2m_timer_init,
376 .init_machine = v2m_init, 376 .init_machine = v2m_init,
377 .restart = vexpress_restart,
378MACHINE_END 377MACHINE_END
379 378
380static struct map_desc v2m_rs1_io_desc __initdata = { 379static struct map_desc v2m_rs1_io_desc __initdata = {
@@ -433,20 +432,24 @@ static void __init v2m_dt_timer_init(void)
433{ 432{
434 struct device_node *node = NULL; 433 struct device_node *node = NULL;
435 434
436 vexpress_clk_of_init(); 435 of_clk_init(NULL);
437 436
437 clocksource_of_init();
438 do { 438 do {
439 node = of_find_compatible_node(node, NULL, "arm,sp804"); 439 node = of_find_compatible_node(node, NULL, "arm,sp804");
440 } while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB); 440 } while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB);
441 if (node) { 441 if (node) {
442 pr_info("Using SP804 '%s' as a clock & events source\n", 442 pr_info("Using SP804 '%s' as a clock & events source\n",
443 node->full_name); 443 node->full_name);
444 WARN_ON(clk_register_clkdev(of_clk_get_by_name(node,
445 "timclken1"), "v2m-timer0", "sp804"));
446 WARN_ON(clk_register_clkdev(of_clk_get_by_name(node,
447 "timclken2"), "v2m-timer1", "sp804"));
444 v2m_sp804_init(of_iomap(node, 0), 448 v2m_sp804_init(of_iomap(node, 0),
445 irq_of_parse_and_map(node, 0)); 449 irq_of_parse_and_map(node, 0));
446 } 450 }
447 451
448 if (arch_timer_of_register() != 0) 452 arch_timer_of_register();
449 twd_local_timer_of_register();
450 453
451 if (arch_timer_sched_clock_init() != 0) 454 if (arch_timer_sched_clock_init() != 0)
452 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 455 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(),
@@ -464,7 +467,6 @@ static void __init v2m_dt_init(void)
464{ 467{
465 l2x0_of_init(0x00400000, 0xfe0fffff); 468 l2x0_of_init(0x00400000, 0xfe0fffff);
466 of_platform_populate(NULL, v2m_dt_bus_match, NULL, NULL); 469 of_platform_populate(NULL, v2m_dt_bus_match, NULL, NULL);
467 pm_power_off = vexpress_power_off;
468} 470}
469 471
470static const char * const v2m_dt_match[] __initconst = { 472static const char * const v2m_dt_match[] __initconst = {
@@ -481,5 +483,4 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
481 .init_irq = irqchip_init, 483 .init_irq = irqchip_init,
482 .init_time = v2m_dt_timer_init, 484 .init_time = v2m_dt_timer_init,
483 .init_machine = v2m_dt_init, 485 .init_machine = v2m_dt_init,
484 .restart = vexpress_restart,
485MACHINE_END 486MACHINE_END
diff --git a/arch/arm/mach-virt/platsmp.c b/arch/arm/mach-virt/platsmp.c
index 8badaabe70a1..f4143f5bfa5b 100644
--- a/arch/arm/mach-virt/platsmp.c
+++ b/arch/arm/mach-virt/platsmp.c
@@ -21,8 +21,6 @@
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/of.h> 22#include <linux/of.h>
23 23
24#include <linux/irqchip/arm-gic.h>
25
26#include <asm/psci.h> 24#include <asm/psci.h>
27#include <asm/smp_plat.h> 25#include <asm/smp_plat.h>
28 26
@@ -45,14 +43,8 @@ static int __cpuinit virt_boot_secondary(unsigned int cpu,
45 return -ENODEV; 43 return -ENODEV;
46} 44}
47 45
48static void __cpuinit virt_secondary_init(unsigned int cpu)
49{
50 gic_secondary_init(0);
51}
52
53struct smp_operations __initdata virt_smp_ops = { 46struct smp_operations __initdata virt_smp_ops = {
54 .smp_init_cpus = virt_smp_init_cpus, 47 .smp_init_cpus = virt_smp_init_cpus,
55 .smp_prepare_cpus = virt_smp_prepare_cpus, 48 .smp_prepare_cpus = virt_smp_prepare_cpus,
56 .smp_secondary_init = virt_secondary_init,
57 .smp_boot_secondary = virt_boot_secondary, 49 .smp_boot_secondary = virt_boot_secondary,
58}; 50};
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
index e3e94b2fa145..9b252934b206 100644
--- a/arch/arm/mach-vt8500/Kconfig
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -7,6 +7,7 @@ config ARCH_VT8500
7 select GENERIC_CLOCKEVENTS 7 select GENERIC_CLOCKEVENTS
8 select HAVE_CLK 8 select HAVE_CLK
9 select VT8500_TIMER 9 select VT8500_TIMER
10 select PINCTRL
10 help 11 help
11 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. 12 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
12 13
diff --git a/arch/arm/mach-vt8500/Makefile b/arch/arm/mach-vt8500/Makefile
index 92ceb2436b60..4c8a84637594 100644
--- a/arch/arm/mach-vt8500/Makefile
+++ b/arch/arm/mach-vt8500/Makefile
@@ -1 +1 @@
obj-$(CONFIG_ARCH_VT8500) += irq.o vt8500.o obj-$(CONFIG_ARCH_VT8500) += vt8500.o
diff --git a/arch/arm/mach-vt8500/common.h b/arch/arm/mach-vt8500/common.h
index 77611a6968d6..087787af62f1 100644
--- a/arch/arm/mach-vt8500/common.h
+++ b/arch/arm/mach-vt8500/common.h
@@ -18,13 +18,7 @@
18 18
19#include <linux/of.h> 19#include <linux/of.h>
20 20
21int __init vt8500_irq_init(struct device_node *node,
22 struct device_node *parent);
23
24/* defined in drivers/clk/clk-vt8500.c */ 21/* defined in drivers/clk/clk-vt8500.c */
25void __init vtwm_clk_init(void __iomem *pmc_base); 22void __init vtwm_clk_init(void __iomem *pmc_base);
26 23
27/* defined in irq.c */
28asmlinkage void vt8500_handle_irq(struct pt_regs *regs);
29
30#endif 24#endif
diff --git a/arch/arm/mach-vt8500/irq.c b/arch/arm/mach-vt8500/irq.c
deleted file mode 100644
index b9cf5ce9efbb..000000000000
--- a/arch/arm/mach-vt8500/irq.c
+++ /dev/null
@@ -1,253 +0,0 @@
1/*
2 * arch/arm/mach-vt8500/irq.c
3 *
4 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
5 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 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/*
23 * This file is copied and modified from the original irq.c provided by
24 * Alexey Charkov. Minor changes have been made for Device Tree Support.
25 */
26
27#include <linux/slab.h>
28#include <linux/io.h>
29#include <linux/irq.h>
30#include <linux/irqdomain.h>
31#include <linux/interrupt.h>
32#include <linux/bitops.h>
33
34#include <linux/of.h>
35#include <linux/of_irq.h>
36#include <linux/of_address.h>
37
38#include <asm/irq.h>
39#include <asm/exception.h>
40
41#define VT8500_ICPC_IRQ 0x20
42#define VT8500_ICPC_FIQ 0x24
43#define VT8500_ICDC 0x40 /* Destination Control 64*u32 */
44#define VT8500_ICIS 0x80 /* Interrupt status, 16*u32 */
45
46/* ICPC */
47#define ICPC_MASK 0x3F
48#define ICPC_ROTATE BIT(6)
49
50/* IC_DCTR */
51#define ICDC_IRQ 0x00
52#define ICDC_FIQ 0x01
53#define ICDC_DSS0 0x02
54#define ICDC_DSS1 0x03
55#define ICDC_DSS2 0x04
56#define ICDC_DSS3 0x05
57#define ICDC_DSS4 0x06
58#define ICDC_DSS5 0x07
59
60#define VT8500_INT_DISABLE 0
61#define VT8500_INT_ENABLE BIT(3)
62
63#define VT8500_TRIGGER_HIGH 0
64#define VT8500_TRIGGER_RISING BIT(5)
65#define VT8500_TRIGGER_FALLING BIT(6)
66#define VT8500_EDGE ( VT8500_TRIGGER_RISING \
67 | VT8500_TRIGGER_FALLING)
68
69/* vt8500 has 1 intc, wm8505 and wm8650 have 2 */
70#define VT8500_INTC_MAX 2
71
72struct vt8500_irq_data {
73 void __iomem *base; /* IO Memory base address */
74 struct irq_domain *domain; /* Domain for this controller */
75};
76
77/* Global variable for accessing io-mem addresses */
78static struct vt8500_irq_data intc[VT8500_INTC_MAX];
79static u32 active_cnt = 0;
80
81static void vt8500_irq_mask(struct irq_data *d)
82{
83 struct vt8500_irq_data *priv = d->domain->host_data;
84 void __iomem *base = priv->base;
85 void __iomem *stat_reg = base + VT8500_ICIS + (d->hwirq < 32 ? 0 : 4);
86 u8 edge, dctr;
87 u32 status;
88
89 edge = readb(base + VT8500_ICDC + d->hwirq) & VT8500_EDGE;
90 if (edge) {
91 status = readl(stat_reg);
92
93 status |= (1 << (d->hwirq & 0x1f));
94 writel(status, stat_reg);
95 } else {
96 dctr = readb(base + VT8500_ICDC + d->hwirq);
97 dctr &= ~VT8500_INT_ENABLE;
98 writeb(dctr, base + VT8500_ICDC + d->hwirq);
99 }
100}
101
102static void vt8500_irq_unmask(struct irq_data *d)
103{
104 struct vt8500_irq_data *priv = d->domain->host_data;
105 void __iomem *base = priv->base;
106 u8 dctr;
107
108 dctr = readb(base + VT8500_ICDC + d->hwirq);
109 dctr |= VT8500_INT_ENABLE;
110 writeb(dctr, base + VT8500_ICDC + d->hwirq);
111}
112
113static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type)
114{
115 struct vt8500_irq_data *priv = d->domain->host_data;
116 void __iomem *base = priv->base;
117 u8 dctr;
118
119 dctr = readb(base + VT8500_ICDC + d->hwirq);
120 dctr &= ~VT8500_EDGE;
121
122 switch (flow_type) {
123 case IRQF_TRIGGER_LOW:
124 return -EINVAL;
125 case IRQF_TRIGGER_HIGH:
126 dctr |= VT8500_TRIGGER_HIGH;
127 __irq_set_handler_locked(d->irq, handle_level_irq);
128 break;
129 case IRQF_TRIGGER_FALLING:
130 dctr |= VT8500_TRIGGER_FALLING;
131 __irq_set_handler_locked(d->irq, handle_edge_irq);
132 break;
133 case IRQF_TRIGGER_RISING:
134 dctr |= VT8500_TRIGGER_RISING;
135 __irq_set_handler_locked(d->irq, handle_edge_irq);
136 break;
137 }
138 writeb(dctr, base + VT8500_ICDC + d->hwirq);
139
140 return 0;
141}
142
143static struct irq_chip vt8500_irq_chip = {
144 .name = "vt8500",
145 .irq_ack = vt8500_irq_mask,
146 .irq_mask = vt8500_irq_mask,
147 .irq_unmask = vt8500_irq_unmask,
148 .irq_set_type = vt8500_irq_set_type,
149};
150
151static void __init vt8500_init_irq_hw(void __iomem *base)
152{
153 u32 i;
154
155 /* Enable rotating priority for IRQ */
156 writel(ICPC_ROTATE, base + VT8500_ICPC_IRQ);
157 writel(0x00, base + VT8500_ICPC_FIQ);
158
159 /* Disable all interrupts and route them to IRQ */
160 for (i = 0; i < 64; i++)
161 writeb(VT8500_INT_DISABLE | ICDC_IRQ, base + VT8500_ICDC + i);
162}
163
164static int vt8500_irq_map(struct irq_domain *h, unsigned int virq,
165 irq_hw_number_t hw)
166{
167 irq_set_chip_and_handler(virq, &vt8500_irq_chip, handle_level_irq);
168 set_irq_flags(virq, IRQF_VALID);
169
170 return 0;
171}
172
173static struct irq_domain_ops vt8500_irq_domain_ops = {
174 .map = vt8500_irq_map,
175 .xlate = irq_domain_xlate_onecell,
176};
177
178asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs)
179{
180 u32 stat, i;
181 int irqnr, virq;
182 void __iomem *base;
183
184 /* Loop through each active controller */
185 for (i=0; i<active_cnt; i++) {
186 base = intc[i].base;
187 irqnr = readl_relaxed(base) & 0x3F;
188 /*
189 Highest Priority register default = 63, so check that this
190 is a real interrupt by checking the status register
191 */
192 if (irqnr == 63) {
193 stat = readl_relaxed(base + VT8500_ICIS + 4);
194 if (!(stat & BIT(31)))
195 continue;
196 }
197
198 virq = irq_find_mapping(intc[i].domain, irqnr);
199 handle_IRQ(virq, regs);
200 }
201}
202
203int __init vt8500_irq_init(struct device_node *node, struct device_node *parent)
204{
205 int irq, i;
206 struct device_node *np = node;
207
208 if (active_cnt == VT8500_INTC_MAX) {
209 pr_err("%s: Interrupt controllers > VT8500_INTC_MAX\n",
210 __func__);
211 goto out;
212 }
213
214 intc[active_cnt].base = of_iomap(np, 0);
215 intc[active_cnt].domain = irq_domain_add_linear(node, 64,
216 &vt8500_irq_domain_ops, &intc[active_cnt]);
217
218 if (!intc[active_cnt].base) {
219 pr_err("%s: Unable to map IO memory\n", __func__);
220 goto out;
221 }
222
223 if (!intc[active_cnt].domain) {
224 pr_err("%s: Unable to add irq domain!\n", __func__);
225 goto out;
226 }
227
228 vt8500_init_irq_hw(intc[active_cnt].base);
229
230 pr_info("vt8500-irq: Added interrupt controller\n");
231
232 active_cnt++;
233
234 /* check if this is a slaved controller */
235 if (of_irq_count(np) != 0) {
236 /* check that we have the correct number of interrupts */
237 if (of_irq_count(np) != 8) {
238 pr_err("%s: Incorrect IRQ map for slaved controller\n",
239 __func__);
240 return -EINVAL;
241 }
242
243 for (i = 0; i < 8; i++) {
244 irq = irq_of_parse_and_map(np, i);
245 enable_irq(irq);
246 }
247
248 pr_info("vt8500-irq: Enabled slave->parent interrupts\n");
249 }
250out:
251 return 0;
252}
253
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 49e80053d828..1dd281efc020 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/clocksource.h> 21#include <linux/clocksource.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irqchip.h>
23#include <linux/pm.h> 24#include <linux/pm.h>
24 25
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
@@ -166,16 +167,6 @@ void __init vt8500_init(void)
166 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 167 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
167} 168}
168 169
169static const struct of_device_id vt8500_irq_match[] __initconst = {
170 { .compatible = "via,vt8500-intc", .data = vt8500_irq_init, },
171 { /* sentinel */ },
172};
173
174static void __init vt8500_init_irq(void)
175{
176 of_irq_init(vt8500_irq_match);
177};
178
179static const char * const vt8500_dt_compat[] = { 170static const char * const vt8500_dt_compat[] = {
180 "via,vt8500", 171 "via,vt8500",
181 "wm,wm8650", 172 "wm,wm8650",
@@ -187,10 +178,9 @@ static const char * const vt8500_dt_compat[] = {
187DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") 178DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
188 .dt_compat = vt8500_dt_compat, 179 .dt_compat = vt8500_dt_compat,
189 .map_io = vt8500_map_io, 180 .map_io = vt8500_map_io,
190 .init_irq = vt8500_init_irq, 181 .init_irq = irqchip_init,
191 .init_machine = vt8500_init, 182 .init_machine = vt8500_init,
192 .init_time = clocksource_of_init, 183 .init_time = clocksource_of_init,
193 .restart = vt8500_restart, 184 .restart = vt8500_restart,
194 .handle_irq = vt8500_handle_irq,
195MACHINE_END 185MACHINE_END
196 186
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index 7abdb9645c5b..e65a80a1ac75 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/cpu.h>
22 23
23#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
24#include <linux/mtd/mtd.h> 25#include <linux/mtd/mtd.h>
@@ -531,7 +532,7 @@ static struct platform_device *nuc900_public_dev[] __initdata = {
531 532
532void __init nuc900_board_init(struct platform_device **device, int size) 533void __init nuc900_board_init(struct platform_device **device, int size)
533{ 534{
534 disable_hlt(); 535 cpu_idle_poll_ctrl(true);
535 platform_add_devices(device, size); 536 platform_add_devices(device, size);
536 platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev)); 537 platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev));
537 spi_register_board_info(nuc900_spi_board_info, 538 spi_register_board_info(nuc900_spi_board_info,
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index adb6c0ea0e53..cf3226b041f5 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -5,9 +5,12 @@ config ARCH_ZYNQ
5 select COMMON_CLK 5 select COMMON_CLK
6 select CPU_V7 6 select CPU_V7
7 select GENERIC_CLOCKEVENTS 7 select GENERIC_CLOCKEVENTS
8 select HAVE_ARM_SCU if SMP
9 select HAVE_ARM_TWD if LOCAL_TIMERS
8 select ICST 10 select ICST
9 select MIGHT_HAVE_CACHE_L2X0 11 select MIGHT_HAVE_CACHE_L2X0
10 select USE_OF 12 select USE_OF
11 select SPARSE_IRQ 13 select SPARSE_IRQ
14 select CADENCE_TTC_TIMER
12 help 15 help
13 Support for Xilinx Zynq ARM Cortex A9 Platform 16 Support for Xilinx Zynq ARM Cortex A9 Platform
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
index 397268c1b250..320faedeb484 100644
--- a/arch/arm/mach-zynq/Makefile
+++ b/arch/arm/mach-zynq/Makefile
@@ -3,4 +3,4 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o timer.o 6obj-y := common.o
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 5c8983218183..68e0907de5d0 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -20,6 +20,7 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/clk/zynq.h> 22#include <linux/clk/zynq.h>
23#include <linux/clocksource.h>
23#include <linux/of_address.h> 24#include <linux/of_address.h>
24#include <linux/of_irq.h> 25#include <linux/of_irq.h>
25#include <linux/of_platform.h> 26#include <linux/of_platform.h>
@@ -77,7 +78,7 @@ static void __init xilinx_zynq_timer_init(void)
77 78
78 xilinx_zynq_clocks_init(slcr); 79 xilinx_zynq_clocks_init(slcr);
79 80
80 xttcps_timer_init(); 81 clocksource_of_init();
81} 82}
82 83
83/** 84/**
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index 8b4dbbaa01cf..5050bb10bb12 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -17,6 +17,4 @@
17#ifndef __MACH_ZYNQ_COMMON_H__ 17#ifndef __MACH_ZYNQ_COMMON_H__
18#define __MACH_ZYNQ_COMMON_H__ 18#define __MACH_ZYNQ_COMMON_H__
19 19
20void __init xttcps_timer_init(void);
21
22#endif 20#endif
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
deleted file mode 100644
index f9fbc9c1e7a6..000000000000
--- a/arch/arm/mach-zynq/timer.c
+++ /dev/null
@@ -1,324 +0,0 @@
1/*
2 * This file contains driver for the Xilinx PS Timer Counter IP.
3 *
4 * Copyright (C) 2011 Xilinx
5 *
6 * based on arch/mips/kernel/time.c timer driver
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/interrupt.h>
19#include <linux/clockchips.h>
20#include <linux/of_address.h>
21#include <linux/of_irq.h>
22#include <linux/slab.h>
23#include <linux/clk-provider.h>
24#include "common.h"
25
26/*
27 * Timer Register Offset Definitions of Timer 1, Increment base address by 4
28 * and use same offsets for Timer 2
29 */
30#define XTTCPS_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */
31#define XTTCPS_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */
32#define XTTCPS_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */
33#define XTTCPS_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */
34#define XTTCPS_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */
35#define XTTCPS_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */
36
37#define XTTCPS_CNT_CNTRL_DISABLE_MASK 0x1
38
39/*
40 * Setup the timers to use pre-scaling, using a fixed value for now that will
41 * work across most input frequency, but it may need to be more dynamic
42 */
43#define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */
44#define PRESCALE 2048 /* The exponent must match this */
45#define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1)
46#define CLK_CNTRL_PRESCALE_EN 1
47#define CNT_CNTRL_RESET (1<<4)
48
49/**
50 * struct xttcps_timer - This definition defines local timer structure
51 *
52 * @base_addr: Base address of timer
53 **/
54struct xttcps_timer {
55 void __iomem *base_addr;
56};
57
58struct xttcps_timer_clocksource {
59 struct xttcps_timer xttc;
60 struct clocksource cs;
61};
62
63#define to_xttcps_timer_clksrc(x) \
64 container_of(x, struct xttcps_timer_clocksource, cs)
65
66struct xttcps_timer_clockevent {
67 struct xttcps_timer xttc;
68 struct clock_event_device ce;
69 struct clk *clk;
70};
71
72#define to_xttcps_timer_clkevent(x) \
73 container_of(x, struct xttcps_timer_clockevent, ce)
74
75/**
76 * xttcps_set_interval - Set the timer interval value
77 *
78 * @timer: Pointer to the timer instance
79 * @cycles: Timer interval ticks
80 **/
81static void xttcps_set_interval(struct xttcps_timer *timer,
82 unsigned long cycles)
83{
84 u32 ctrl_reg;
85
86 /* Disable the counter, set the counter value and re-enable counter */
87 ctrl_reg = __raw_readl(timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET);
88 ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK;
89 __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET);
90
91 __raw_writel(cycles, timer->base_addr + XTTCPS_INTR_VAL_OFFSET);
92
93 /*
94 * Reset the counter (0x10) so that it starts from 0, one-shot
95 * mode makes this needed for timing to be right.
96 */
97 ctrl_reg |= CNT_CNTRL_RESET;
98 ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK;
99 __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET);
100}
101
102/**
103 * xttcps_clock_event_interrupt - Clock event timer interrupt handler
104 *
105 * @irq: IRQ number of the Timer
106 * @dev_id: void pointer to the xttcps_timer instance
107 *
108 * returns: Always IRQ_HANDLED - success
109 **/
110static irqreturn_t xttcps_clock_event_interrupt(int irq, void *dev_id)
111{
112 struct xttcps_timer_clockevent *xttce = dev_id;
113 struct xttcps_timer *timer = &xttce->xttc;
114
115 /* Acknowledge the interrupt and call event handler */
116 __raw_readl(timer->base_addr + XTTCPS_ISR_OFFSET);
117
118 xttce->ce.event_handler(&xttce->ce);
119
120 return IRQ_HANDLED;
121}
122
123/**
124 * __xttc_clocksource_read - Reads the timer counter register
125 *
126 * returns: Current timer counter register value
127 **/
128static cycle_t __xttc_clocksource_read(struct clocksource *cs)
129{
130 struct xttcps_timer *timer = &to_xttcps_timer_clksrc(cs)->xttc;
131
132 return (cycle_t)__raw_readl(timer->base_addr +
133 XTTCPS_COUNT_VAL_OFFSET);
134}
135
136/**
137 * xttcps_set_next_event - Sets the time interval for next event
138 *
139 * @cycles: Timer interval ticks
140 * @evt: Address of clock event instance
141 *
142 * returns: Always 0 - success
143 **/
144static int xttcps_set_next_event(unsigned long cycles,
145 struct clock_event_device *evt)
146{
147 struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt);
148 struct xttcps_timer *timer = &xttce->xttc;
149
150 xttcps_set_interval(timer, cycles);
151 return 0;
152}
153
154/**
155 * xttcps_set_mode - Sets the mode of timer
156 *
157 * @mode: Mode to be set
158 * @evt: Address of clock event instance
159 **/
160static void xttcps_set_mode(enum clock_event_mode mode,
161 struct clock_event_device *evt)
162{
163 struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt);
164 struct xttcps_timer *timer = &xttce->xttc;
165 u32 ctrl_reg;
166
167 switch (mode) {
168 case CLOCK_EVT_MODE_PERIODIC:
169 xttcps_set_interval(timer,
170 DIV_ROUND_CLOSEST(clk_get_rate(xttce->clk),
171 PRESCALE * HZ));
172 break;
173 case CLOCK_EVT_MODE_ONESHOT:
174 case CLOCK_EVT_MODE_UNUSED:
175 case CLOCK_EVT_MODE_SHUTDOWN:
176 ctrl_reg = __raw_readl(timer->base_addr +
177 XTTCPS_CNT_CNTRL_OFFSET);
178 ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK;
179 __raw_writel(ctrl_reg,
180 timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET);
181 break;
182 case CLOCK_EVT_MODE_RESUME:
183 ctrl_reg = __raw_readl(timer->base_addr +
184 XTTCPS_CNT_CNTRL_OFFSET);
185 ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK;
186 __raw_writel(ctrl_reg,
187 timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET);
188 break;
189 }
190}
191
192static void __init zynq_ttc_setup_clocksource(struct device_node *np,
193 void __iomem *base)
194{
195 struct xttcps_timer_clocksource *ttccs;
196 struct clk *clk;
197 int err;
198 u32 reg;
199
200 ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL);
201 if (WARN_ON(!ttccs))
202 return;
203
204 err = of_property_read_u32(np, "reg", &reg);
205 if (WARN_ON(err))
206 return;
207
208 clk = of_clk_get_by_name(np, "cpu_1x");
209 if (WARN_ON(IS_ERR(clk)))
210 return;
211
212 err = clk_prepare_enable(clk);
213 if (WARN_ON(err))
214 return;
215
216 ttccs->xttc.base_addr = base + reg * 4;
217
218 ttccs->cs.name = np->name;
219 ttccs->cs.rating = 200;
220 ttccs->cs.read = __xttc_clocksource_read;
221 ttccs->cs.mask = CLOCKSOURCE_MASK(16);
222 ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS;
223
224 __raw_writel(0x0, ttccs->xttc.base_addr + XTTCPS_IER_OFFSET);
225 __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN,
226 ttccs->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET);
227 __raw_writel(CNT_CNTRL_RESET,
228 ttccs->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET);
229
230 err = clocksource_register_hz(&ttccs->cs, clk_get_rate(clk) / PRESCALE);
231 if (WARN_ON(err))
232 return;
233}
234
235static void __init zynq_ttc_setup_clockevent(struct device_node *np,
236 void __iomem *base)
237{
238 struct xttcps_timer_clockevent *ttcce;
239 int err, irq;
240 u32 reg;
241
242 ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL);
243 if (WARN_ON(!ttcce))
244 return;
245
246 err = of_property_read_u32(np, "reg", &reg);
247 if (WARN_ON(err))
248 return;
249
250 ttcce->xttc.base_addr = base + reg * 4;
251
252 ttcce->clk = of_clk_get_by_name(np, "cpu_1x");
253 if (WARN_ON(IS_ERR(ttcce->clk)))
254 return;
255
256 err = clk_prepare_enable(ttcce->clk);
257 if (WARN_ON(err))
258 return;
259
260 irq = irq_of_parse_and_map(np, 0);
261 if (WARN_ON(!irq))
262 return;
263
264 ttcce->ce.name = np->name;
265 ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
266 ttcce->ce.set_next_event = xttcps_set_next_event;
267 ttcce->ce.set_mode = xttcps_set_mode;
268 ttcce->ce.rating = 200;
269 ttcce->ce.irq = irq;
270 ttcce->ce.cpumask = cpu_possible_mask;
271
272 __raw_writel(0x23, ttcce->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET);
273 __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN,
274 ttcce->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET);
275 __raw_writel(0x1, ttcce->xttc.base_addr + XTTCPS_IER_OFFSET);
276
277 err = request_irq(irq, xttcps_clock_event_interrupt, IRQF_TIMER,
278 np->name, ttcce);
279 if (WARN_ON(err))
280 return;
281
282 clockevents_config_and_register(&ttcce->ce,
283 clk_get_rate(ttcce->clk) / PRESCALE,
284 1, 0xfffe);
285}
286
287static const __initconst struct of_device_id zynq_ttc_match[] = {
288 { .compatible = "xlnx,ttc-counter-clocksource",
289 .data = zynq_ttc_setup_clocksource, },
290 { .compatible = "xlnx,ttc-counter-clockevent",
291 .data = zynq_ttc_setup_clockevent, },
292 {}
293};
294
295/**
296 * xttcps_timer_init - Initialize the timer
297 *
298 * Initializes the timer hardware and register the clock source and clock event
299 * timers with Linux kernal timer framework
300 **/
301void __init xttcps_timer_init(void)
302{
303 struct device_node *np;
304
305 for_each_compatible_node(np, NULL, "xlnx,ttc") {
306 struct device_node *np_chld;
307 void __iomem *base;
308
309 base = of_iomap(np, 0);
310 if (WARN_ON(!base))
311 return;
312
313 for_each_available_child_of_node(np, np_chld) {
314 int (*cb)(struct device_node *np, void __iomem *base);
315 const struct of_device_id *match;
316
317 match = of_match_node(zynq_ttc_match, np_chld);
318 if (match) {
319 cb = match->data;
320 cb(np_chld, base);
321 }
322 }
323 }
324}
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 4045c4931a30..35955b54944c 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -397,6 +397,13 @@ config CPU_V7
397 select CPU_PABRT_V7 397 select CPU_PABRT_V7
398 select CPU_TLB_V7 if MMU 398 select CPU_TLB_V7 if MMU
399 399
400config CPU_THUMBONLY
401 bool
402 # There are no CPUs available with MMU that don't implement an ARM ISA:
403 depends on !MMU
404 help
405 Select this if your CPU doesn't support the 32 bit ARM instructions.
406
400# Figure out what processor architecture version we should be using. 407# Figure out what processor architecture version we should be using.
401# This defines the compiler instruction set which depends on the machine type. 408# This defines the compiler instruction set which depends on the machine type.
402config CPU_32v3 409config CPU_32v3
@@ -605,7 +612,7 @@ config ARCH_DMA_ADDR_T_64BIT
605 bool 612 bool
606 613
607config ARM_THUMB 614config ARM_THUMB
608 bool "Support Thumb user binaries" 615 bool "Support Thumb user binaries" if !CPU_THUMBONLY
609 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || CPU_V7 || CPU_FEROCEON 616 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || CPU_V7 || CPU_FEROCEON
610 default y 617 default y
611 help 618 help
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index db26e2e543f4..6f4585b89078 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -961,12 +961,14 @@ static int __init alignment_init(void)
961 return -ENOMEM; 961 return -ENOMEM;
962#endif 962#endif
963 963
964#ifdef CONFIG_CPU_CP15
964 if (cpu_is_v6_unaligned()) { 965 if (cpu_is_v6_unaligned()) {
965 cr_alignment &= ~CR_A; 966 cr_alignment &= ~CR_A;
966 cr_no_alignment &= ~CR_A; 967 cr_no_alignment &= ~CR_A;
967 set_cr(cr_alignment); 968 set_cr(cr_alignment);
968 ai_usermode = safe_usermode(ai_usermode, false); 969 ai_usermode = safe_usermode(ai_usermode, false);
969 } 970 }
971#endif
970 972
971 hook_fault_code(FAULT_CODE_ALIGNMENT, do_alignment, SIGBUS, BUS_ADRALN, 973 hook_fault_code(FAULT_CODE_ALIGNMENT, do_alignment, SIGBUS, BUS_ADRALN,
972 "alignment exception"); 974 "alignment exception");
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e9db6b4bf65a..ef3e0f3aac96 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -823,16 +823,17 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
823 if (PageHighMem(page)) { 823 if (PageHighMem(page)) {
824 if (len + offset > PAGE_SIZE) 824 if (len + offset > PAGE_SIZE)
825 len = PAGE_SIZE - offset; 825 len = PAGE_SIZE - offset;
826 vaddr = kmap_high_get(page); 826
827 if (vaddr) { 827 if (cache_is_vipt_nonaliasing()) {
828 vaddr += offset;
829 op(vaddr, len, dir);
830 kunmap_high(page);
831 } else if (cache_is_vipt()) {
832 /* unmapped pages might still be cached */
833 vaddr = kmap_atomic(page); 828 vaddr = kmap_atomic(page);
834 op(vaddr + offset, len, dir); 829 op(vaddr + offset, len, dir);
835 kunmap_atomic(vaddr); 830 kunmap_atomic(vaddr);
831 } else {
832 vaddr = kmap_high_get(page);
833 if (vaddr) {
834 op(vaddr + offset, len, dir);
835 kunmap_high(page);
836 }
836 } 837 }
837 } else { 838 } else {
838 vaddr = page_address(page) + offset; 839 vaddr = page_address(page) + offset;
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 1c8f7f564175..0d473cce501c 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -170,15 +170,18 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page)
170 if (!PageHighMem(page)) { 170 if (!PageHighMem(page)) {
171 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); 171 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
172 } else { 172 } else {
173 void *addr = kmap_high_get(page); 173 void *addr;
174 if (addr) { 174
175 __cpuc_flush_dcache_area(addr, PAGE_SIZE); 175 if (cache_is_vipt_nonaliasing()) {
176 kunmap_high(page);
177 } else if (cache_is_vipt()) {
178 /* unmapped pages might still be cached */
179 addr = kmap_atomic(page); 176 addr = kmap_atomic(page);
180 __cpuc_flush_dcache_area(addr, PAGE_SIZE); 177 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
181 kunmap_atomic(addr); 178 kunmap_atomic(addr);
179 } else {
180 addr = kmap_high_get(page);
181 if (addr) {
182 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
183 kunmap_high(page);
184 }
182 } 185 }
183 } 186 }
184 187
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 5ee505c937d1..83cb3ac27095 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -8,7 +8,6 @@
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9#include <asm/sections.h> 9#include <asm/sections.h>
10#include <asm/system_info.h> 10#include <asm/system_info.h>
11#include <asm/virt.h>
12 11
13pgd_t *idmap_pgd; 12pgd_t *idmap_pgd;
14 13
@@ -83,37 +82,10 @@ static void identity_mapping_add(pgd_t *pgd, const char *text_start,
83 } while (pgd++, addr = next, addr != end); 82 } while (pgd++, addr = next, addr != end);
84} 83}
85 84
86#if defined(CONFIG_ARM_VIRT_EXT) && defined(CONFIG_ARM_LPAE)
87pgd_t *hyp_pgd;
88
89extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[];
90
91static int __init init_static_idmap_hyp(void)
92{
93 hyp_pgd = kzalloc(PTRS_PER_PGD * sizeof(pgd_t), GFP_KERNEL);
94 if (!hyp_pgd)
95 return -ENOMEM;
96
97 pr_info("Setting up static HYP identity map for 0x%p - 0x%p\n",
98 __hyp_idmap_text_start, __hyp_idmap_text_end);
99 identity_mapping_add(hyp_pgd, __hyp_idmap_text_start,
100 __hyp_idmap_text_end, PMD_SECT_AP1);
101
102 return 0;
103}
104#else
105static int __init init_static_idmap_hyp(void)
106{
107 return 0;
108}
109#endif
110
111extern char __idmap_text_start[], __idmap_text_end[]; 85extern char __idmap_text_start[], __idmap_text_end[];
112 86
113static int __init init_static_idmap(void) 87static int __init init_static_idmap(void)
114{ 88{
115 int ret;
116
117 idmap_pgd = pgd_alloc(&init_mm); 89 idmap_pgd = pgd_alloc(&init_mm);
118 if (!idmap_pgd) 90 if (!idmap_pgd)
119 return -ENOMEM; 91 return -ENOMEM;
@@ -123,12 +95,10 @@ static int __init init_static_idmap(void)
123 identity_mapping_add(idmap_pgd, __idmap_text_start, 95 identity_mapping_add(idmap_pgd, __idmap_text_start,
124 __idmap_text_end, 0); 96 __idmap_text_end, 0);
125 97
126 ret = init_static_idmap_hyp();
127
128 /* Flush L1 for the hardware to see this page table content */ 98 /* Flush L1 for the hardware to see this page table content */
129 flush_cache_louis(); 99 flush_cache_louis();
130 100
131 return ret; 101 return 0;
132} 102}
133early_initcall(init_static_idmap); 103early_initcall(init_static_idmap);
134 104
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index ad722f1208a5..9a5cdc01fcdf 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -99,6 +99,9 @@ void show_mem(unsigned int filter)
99 printk("Mem-info:\n"); 99 printk("Mem-info:\n");
100 show_free_areas(filter); 100 show_free_areas(filter);
101 101
102 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
103 return;
104
102 for_each_bank (i, mi) { 105 for_each_bank (i, mi) {
103 struct membank *bank = &mi->bank[i]; 106 struct membank *bank = &mi->bank[i];
104 unsigned int pfn1, pfn2; 107 unsigned int pfn1, pfn2;
@@ -424,24 +427,6 @@ void __init bootmem_init(void)
424 max_pfn = max_high - PHYS_PFN_OFFSET; 427 max_pfn = max_high - PHYS_PFN_OFFSET;
425} 428}
426 429
427static inline int free_area(unsigned long pfn, unsigned long end, char *s)
428{
429 unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
430
431 for (; pfn < end; pfn++) {
432 struct page *page = pfn_to_page(pfn);
433 ClearPageReserved(page);
434 init_page_count(page);
435 __free_page(page);
436 pages++;
437 }
438
439 if (size && s)
440 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
441
442 return pages;
443}
444
445/* 430/*
446 * Poison init memory with an undefined instruction (ARM) or a branch to an 431 * Poison init memory with an undefined instruction (ARM) or a branch to an
447 * undefined instruction (Thumb). 432 * undefined instruction (Thumb).
@@ -534,6 +519,14 @@ static void __init free_unused_memmap(struct meminfo *mi)
534#endif 519#endif
535} 520}
536 521
522#ifdef CONFIG_HIGHMEM
523static inline void free_area_high(unsigned long pfn, unsigned long end)
524{
525 for (; pfn < end; pfn++)
526 free_highmem_page(pfn_to_page(pfn));
527}
528#endif
529
537static void __init free_highpages(void) 530static void __init free_highpages(void)
538{ 531{
539#ifdef CONFIG_HIGHMEM 532#ifdef CONFIG_HIGHMEM
@@ -569,8 +562,7 @@ static void __init free_highpages(void)
569 if (res_end > end) 562 if (res_end > end)
570 res_end = end; 563 res_end = end;
571 if (res_start != start) 564 if (res_start != start)
572 totalhigh_pages += free_area(start, res_start, 565 free_area_high(start, res_start);
573 NULL);
574 start = res_end; 566 start = res_end;
575 if (start == end) 567 if (start == end)
576 break; 568 break;
@@ -578,9 +570,8 @@ static void __init free_highpages(void)
578 570
579 /* And now free anything which remains */ 571 /* And now free anything which remains */
580 if (start < end) 572 if (start < end)
581 totalhigh_pages += free_area(start, end, NULL); 573 free_area_high(start, end);
582 } 574 }
583 totalram_pages += totalhigh_pages;
584#endif 575#endif
585} 576}
586 577
@@ -609,8 +600,7 @@ void __init mem_init(void)
609 600
610#ifdef CONFIG_SA1111 601#ifdef CONFIG_SA1111
611 /* now that our DMA memory is actually so designated, we can free it */ 602 /* now that our DMA memory is actually so designated, we can free it */
612 totalram_pages += free_area(PHYS_PFN_OFFSET, 603 free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL);
613 __phys_to_pfn(__pa(swapper_pg_dir)), NULL);
614#endif 604#endif
615 605
616 free_highpages(); 606 free_highpages();
@@ -738,16 +728,12 @@ void free_initmem(void)
738 extern char __tcm_start, __tcm_end; 728 extern char __tcm_start, __tcm_end;
739 729
740 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); 730 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
741 totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)), 731 free_reserved_area(&__tcm_start, &__tcm_end, 0, "TCM link");
742 __phys_to_pfn(__pa(&__tcm_end)),
743 "TCM link");
744#endif 732#endif
745 733
746 poison_init_mem(__init_begin, __init_end - __init_begin); 734 poison_init_mem(__init_begin, __init_end - __init_begin);
747 if (!machine_is_integrator() && !machine_is_cintegrator()) 735 if (!machine_is_integrator() && !machine_is_cintegrator())
748 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), 736 free_initmem_default(0);
749 __phys_to_pfn(__pa(__init_end)),
750 "init");
751} 737}
752 738
753#ifdef CONFIG_BLK_DEV_INITRD 739#ifdef CONFIG_BLK_DEV_INITRD
@@ -758,9 +744,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
758{ 744{
759 if (!keep_initrd) { 745 if (!keep_initrd) {
760 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 746 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
761 totalram_pages += free_area(__phys_to_pfn(__pa(start)), 747 free_reserved_area(start, end, 0, "initrd");
762 __phys_to_pfn(__pa(end)),
763 "initrd");
764 } 748 }
765} 749}
766 750
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index a84ff763ac39..e0d8565671a6 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -113,6 +113,7 @@ static struct cachepolicy cache_policies[] __initdata = {
113 } 113 }
114}; 114};
115 115
116#ifdef CONFIG_CPU_CP15
116/* 117/*
117 * These are useful for identifying cache coherency 118 * These are useful for identifying cache coherency
118 * problems by allowing the cache or the cache and 119 * problems by allowing the cache or the cache and
@@ -211,6 +212,22 @@ void adjust_cr(unsigned long mask, unsigned long set)
211} 212}
212#endif 213#endif
213 214
215#else /* ifdef CONFIG_CPU_CP15 */
216
217static int __init early_cachepolicy(char *p)
218{
219 pr_warning("cachepolicy kernel parameter not supported without cp15\n");
220}
221early_param("cachepolicy", early_cachepolicy);
222
223static int __init noalign_setup(char *__unused)
224{
225 pr_warning("noalign kernel parameter not supported without cp15\n");
226}
227__setup("noalign", noalign_setup);
228
229#endif /* ifdef CONFIG_CPU_CP15 / else */
230
214#define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY|L_PTE_XN 231#define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY|L_PTE_XN
215#define PROT_SECT_DEVICE PMD_TYPE_SECT|PMD_SECT_AP_WRITE 232#define PROT_SECT_DEVICE PMD_TYPE_SECT|PMD_SECT_AP_WRITE
216 233
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 5c07ee4fe3eb..919405e20b80 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -80,12 +80,10 @@ ENTRY(cpu_v6_do_idle)
80 mov pc, lr 80 mov pc, lr
81 81
82ENTRY(cpu_v6_dcache_clean_area) 82ENTRY(cpu_v6_dcache_clean_area)
83#ifndef TLB_CAN_READ_FROM_L1_CACHE
841: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 831: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
85 add r0, r0, #D_CACHE_LINE_SIZE 84 add r0, r0, #D_CACHE_LINE_SIZE
86 subs r1, r1, #D_CACHE_LINE_SIZE 85 subs r1, r1, #D_CACHE_LINE_SIZE
87 bhi 1b 86 bhi 1b
88#endif
89 mov pc, lr 87 mov pc, lr
90 88
91/* 89/*
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 78f520bc0e99..9704097c450e 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -110,7 +110,8 @@ ENTRY(cpu_v7_set_pte_ext)
110 ARM( str r3, [r0, #2048]! ) 110 ARM( str r3, [r0, #2048]! )
111 THUMB( add r0, r0, #2048 ) 111 THUMB( add r0, r0, #2048 )
112 THUMB( str r3, [r0] ) 112 THUMB( str r3, [r0] )
113 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 113 ALT_SMP(mov pc,lr)
114 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
114#endif 115#endif
115 mov pc, lr 116 mov pc, lr
116ENDPROC(cpu_v7_set_pte_ext) 117ENDPROC(cpu_v7_set_pte_ext)
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 6ffd78c0f9ab..363027e811d6 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -73,7 +73,8 @@ ENTRY(cpu_v7_set_pte_ext)
73 tst r3, #1 << (55 - 32) @ L_PTE_DIRTY 73 tst r3, #1 << (55 - 32) @ L_PTE_DIRTY
74 orreq r2, #L_PTE_RDONLY 74 orreq r2, #L_PTE_RDONLY
751: strd r2, r3, [r0] 751: strd r2, r3, [r0]
76 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 76 ALT_SMP(mov pc, lr)
77 ALT_UP (mcr p15, 0, r0, c7, c10, 1) @ flush_pte
77#endif 78#endif
78 mov pc, lr 79 mov pc, lr
79ENDPROC(cpu_v7_set_pte_ext) 80ENDPROC(cpu_v7_set_pte_ext)
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index f584d3f5b37c..2c73a7301ff7 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -75,14 +75,14 @@ ENTRY(cpu_v7_do_idle)
75ENDPROC(cpu_v7_do_idle) 75ENDPROC(cpu_v7_do_idle)
76 76
77ENTRY(cpu_v7_dcache_clean_area) 77ENTRY(cpu_v7_dcache_clean_area)
78#ifndef TLB_CAN_READ_FROM_L1_CACHE 78 ALT_SMP(mov pc, lr) @ MP extensions imply L1 PTW
79 ALT_UP(W(nop))
79 dcache_line_size r2, r3 80 dcache_line_size r2, r3
801: mcr p15, 0, r0, c7, c10, 1 @ clean D entry 811: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
81 add r0, r0, r2 82 add r0, r0, r2
82 subs r1, r1, r2 83 subs r1, r1, r2
83 bhi 1b 84 bhi 1b
84 dsb 85 dsb
85#endif
86 mov pc, lr 86 mov pc, lr
87ENDPROC(cpu_v7_dcache_clean_area) 87ENDPROC(cpu_v7_dcache_clean_area)
88 88
@@ -402,6 +402,8 @@ __v7_ca9mp_proc_info:
402 __v7_proc __v7_ca9mp_setup 402 __v7_proc __v7_ca9mp_setup
403 .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info 403 .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info
404 404
405#endif /* CONFIG_ARM_LPAE */
406
405 /* 407 /*
406 * Marvell PJ4B processor. 408 * Marvell PJ4B processor.
407 */ 409 */
@@ -411,7 +413,6 @@ __v7_pj4b_proc_info:
411 .long 0xfffffff0 413 .long 0xfffffff0
412 __v7_proc __v7_pj4b_setup 414 __v7_proc __v7_pj4b_setup
413 .size __v7_pj4b_proc_info, . - __v7_pj4b_proc_info 415 .size __v7_pj4b_proc_info, . - __v7_pj4b_proc_info
414#endif /* CONFIG_ARM_LPAE */
415 416
416 /* 417 /*
417 * ARM Ltd. Cortex A7 processor. 418 * ARM Ltd. Cortex A7 processor.
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index a0daa2fb5de6..e6dbc8dbe6a6 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -140,8 +140,7 @@ static int omap_dm_timer_prepare(struct omap_dm_timer *timer)
140 */ 140 */
141 if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) { 141 if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
142 timer->fclk = clk_get(&timer->pdev->dev, "fck"); 142 timer->fclk = clk_get(&timer->pdev->dev, "fck");
143 if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) { 143 if (WARN_ON_ONCE(IS_ERR(timer->fclk))) {
144 timer->fclk = NULL;
145 dev_err(&timer->pdev->dev, ": No fclk handle.\n"); 144 dev_err(&timer->pdev->dev, ": No fclk handle.\n");
146 return -EINVAL; 145 return -EINVAL;
147 } 146 }
@@ -373,7 +372,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
373 372
374struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) 373struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
375{ 374{
376 if (timer) 375 if (timer && !IS_ERR(timer->fclk))
377 return timer->fclk; 376 return timer->fclk;
378 return NULL; 377 return NULL;
379} 378}
@@ -482,7 +481,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
482 if (pdata && pdata->set_timer_src) 481 if (pdata && pdata->set_timer_src)
483 return pdata->set_timer_src(timer->pdev, source); 482 return pdata->set_timer_src(timer->pdev, source);
484 483
485 if (!timer->fclk) 484 if (IS_ERR(timer->fclk))
486 return -EINVAL; 485 return -EINVAL;
487 486
488 switch (source) { 487 switch (source) {
@@ -500,13 +499,13 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
500 } 499 }
501 500
502 parent = clk_get(&timer->pdev->dev, parent_name); 501 parent = clk_get(&timer->pdev->dev, parent_name);
503 if (IS_ERR_OR_NULL(parent)) { 502 if (IS_ERR(parent)) {
504 pr_err("%s: %s not found\n", __func__, parent_name); 503 pr_err("%s: %s not found\n", __func__, parent_name);
505 return -EINVAL; 504 return -EINVAL;
506 } 505 }
507 506
508 ret = clk_set_parent(timer->fclk, parent); 507 ret = clk_set_parent(timer->fclk, parent);
509 if (IS_ERR_VALUE(ret)) 508 if (ret < 0)
510 pr_err("%s: failed to set %s as parent\n", __func__, 509 pr_err("%s: failed to set %s as parent\n", __func__,
511 parent_name); 510 parent_name);
512 511
@@ -808,6 +807,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
808 return -ENOMEM; 807 return -ENOMEM;
809 } 808 }
810 809
810 timer->fclk = ERR_PTR(-ENODEV);
811 timer->io_base = devm_ioremap_resource(dev, mem); 811 timer->io_base = devm_ioremap_resource(dev, mem);
812 if (IS_ERR(timer->io_base)) 812 if (IS_ERR(timer->io_base))
813 return PTR_ERR(timer->io_base); 813 return PTR_ERR(timer->io_base);
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index a82cecb84948..ad97400ba3ad 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -3,7 +3,11 @@
3# 3#
4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include 4ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
5 5
6obj-y += addr-map.o 6obj-$(CONFIG_ARCH_MVEBU) += addr-map.o
7obj-$(CONFIG_ARCH_KIRKWOOD) += addr-map.o
8obj-$(CONFIG_ARCH_DOVE) += addr-map.o
9obj-$(CONFIG_ARCH_ORION5X) += addr-map.o
10obj-$(CONFIG_ARCH_MV78XX0) += addr-map.o
7 11
8orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o 12orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o
9obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o 13obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c
index f20a321088a2..8b8c06d2e9c4 100644
--- a/arch/arm/plat-orion/pcie.c
+++ b/arch/arm/plat-orion/pcie.c
@@ -120,12 +120,14 @@ void __init orion_pcie_reset(void __iomem *base)
120 * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks 120 * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks
121 * WIN[0-3] -> DRAM bank[0-3] 121 * WIN[0-3] -> DRAM bank[0-3]
122 */ 122 */
123static void __init orion_pcie_setup_wins(void __iomem *base, 123static void __init orion_pcie_setup_wins(void __iomem *base)
124 struct mbus_dram_target_info *dram)
125{ 124{
125 const struct mbus_dram_target_info *dram;
126 u32 size; 126 u32 size;
127 int i; 127 int i;
128 128
129 dram = mv_mbus_dram_info();
130
129 /* 131 /*
130 * First, disable and clear BARs and windows. 132 * First, disable and clear BARs and windows.
131 */ 133 */
@@ -150,7 +152,7 @@ static void __init orion_pcie_setup_wins(void __iomem *base,
150 */ 152 */
151 size = 0; 153 size = 0;
152 for (i = 0; i < dram->num_cs; i++) { 154 for (i = 0; i < dram->num_cs; i++) {
153 struct mbus_dram_window *cs = dram->cs + i; 155 const struct mbus_dram_window *cs = dram->cs + i;
154 156
155 writel(cs->base & 0xffff0000, base + PCIE_WIN04_BASE_OFF(i)); 157 writel(cs->base & 0xffff0000, base + PCIE_WIN04_BASE_OFF(i));
156 writel(0, base + PCIE_WIN04_REMAP_OFF(i)); 158 writel(0, base + PCIE_WIN04_REMAP_OFF(i));
@@ -184,7 +186,7 @@ void __init orion_pcie_setup(void __iomem *base)
184 /* 186 /*
185 * Point PCIe unit MBUS decode windows to DRAM space. 187 * Point PCIe unit MBUS decode windows to DRAM space.
186 */ 188 */
187 orion_pcie_setup_wins(base, &orion_mbus_dram_info); 189 orion_pcie_setup_wins(base);
188 190
189 /* 191 /*
190 * Master + slave enable. 192 * Master + slave enable.
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index a9d52167e16e..54d186106f9f 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -25,7 +25,7 @@ config PLAT_S5P
25 select PLAT_SAMSUNG 25 select PLAT_SAMSUNG
26 select S3C_GPIO_TRACK 26 select S3C_GPIO_TRACK
27 select S5P_GPIO_DRVSTR 27 select S5P_GPIO_DRVSTR
28 select SAMSUNG_CLKSRC 28 select SAMSUNG_CLKSRC if !COMMON_CLK
29 select SAMSUNG_GPIOLIB_4BIT 29 select SAMSUNG_GPIOLIB_4BIT
30 select SAMSUNG_IRQ_VIC_TIMER 30 select SAMSUNG_IRQ_VIC_TIMER
31 help 31 help
@@ -37,14 +37,6 @@ if PLAT_SAMSUNG
37 37
38comment "Boot options" 38comment "Boot options"
39 39
40config S3C_BOOT_WATCHDOG
41 bool "S3C Initialisation watchdog"
42 depends on S3C2410_WATCHDOG
43 help
44 Say y to enable the watchdog during the kernel decompression
45 stage. If the kernel fails to uncompress, then the watchdog
46 will trigger a reset and the system should restart.
47
48config S3C_BOOT_ERROR_RESET 40config S3C_BOOT_ERROR_RESET
49 bool "S3C Reboot on decompression error" 41 bool "S3C Reboot on decompression error"
50 help 42 help
@@ -70,7 +62,7 @@ config S3C_LOWLEVEL_UART_PORT
70 62
71# timer options 63# timer options
72 64
73config S5P_HRT 65config SAMSUNG_HRT
74 bool 66 bool
75 select SAMSUNG_DEV_PWM 67 select SAMSUNG_DEV_PWM
76 help 68 help
@@ -89,7 +81,7 @@ config SAMSUNG_CLKSRC
89 used by newer systems such as the S3C64XX. 81 used by newer systems such as the S3C64XX.
90 82
91config S5P_CLOCK 83config S5P_CLOCK
92 def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) 84 def_bool (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
93 help 85 help
94 Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs 86 Support common clock part for ARCH_S5P and ARCH_EXYNOS SoCs
95 87
@@ -125,12 +117,6 @@ config SAMSUNG_GPIOLIB_4BIT
125 configuration. GPIOlib shall be compiled only for S3C64XX and S5P 117 configuration. GPIOlib shall be compiled only for S3C64XX and S5P
126 series of processors. 118 series of processors.
127 119
128config S3C_GPIO_CFG_S3C64XX
129 bool
130 help
131 Internal configuration to enable S3C64XX style GPIO configuration
132 functions.
133
134config S5P_GPIO_DRVSTR 120config S5P_GPIO_DRVSTR
135 bool 121 bool
136 help 122 help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 3a7c64d1814a..a23c460299a1 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -12,8 +12,7 @@ obj- :=
12# Objects we always build independent of SoC choice 12# Objects we always build independent of SoC choice
13 13
14obj-y += init.o cpu.o 14obj-y += init.o cpu.o
15obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o 15obj-$(CONFIG_SAMSUNG_HRT) += samsung-time.o
16obj-$(CONFIG_S5P_HRT) += s5p-time.o
17 16
18obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o 17obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o
19obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o 18obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 51afedda9ab6..30c2fe243f76 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13#include <linux/amba/pl330.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/types.h> 15#include <linux/types.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -62,7 +63,6 @@
62#include <linux/platform_data/usb-s3c2410_udc.h> 63#include <linux/platform_data/usb-s3c2410_udc.h>
63#include <linux/platform_data/usb-ohci-s3c2410.h> 64#include <linux/platform_data/usb-ohci-s3c2410.h>
64#include <plat/usb-phy.h> 65#include <plat/usb-phy.h>
65#include <plat/regs-iic.h>
66#include <plat/regs-serial.h> 66#include <plat/regs-serial.h>
67#include <plat/regs-spi.h> 67#include <plat/regs-spi.h>
68#include <linux/platform_data/spi-s3c64xx.h> 68#include <linux/platform_data/spi-s3c64xx.h>
@@ -146,14 +146,20 @@ struct platform_device s3c_device_camif = {
146 146
147/* ASOC DMA */ 147/* ASOC DMA */
148 148
149#ifdef CONFIG_PLAT_S5P
150static struct resource samsung_asoc_idma_resource = DEFINE_RES_IRQ(IRQ_I2S0);
151
149struct platform_device samsung_asoc_idma = { 152struct platform_device samsung_asoc_idma = {
150 .name = "samsung-idma", 153 .name = "samsung-idma",
151 .id = -1, 154 .id = -1,
155 .num_resources = 1,
156 .resource = &samsung_asoc_idma_resource,
152 .dev = { 157 .dev = {
153 .dma_mask = &samsung_device_dma_mask, 158 .dma_mask = &samsung_device_dma_mask,
154 .coherent_dma_mask = DMA_BIT_MASK(32), 159 .coherent_dma_mask = DMA_BIT_MASK(32),
155 } 160 }
156}; 161};
162#endif
157 163
158/* FB */ 164/* FB */
159 165
@@ -878,51 +884,6 @@ void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
878} 884}
879#endif /* CONFIG_PLAT_S3C24XX */ 885#endif /* CONFIG_PLAT_S3C24XX */
880 886
881/* MFC */
882
883#ifdef CONFIG_S5P_DEV_MFC
884static struct resource s5p_mfc_resource[] = {
885 [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K),
886 [1] = DEFINE_RES_IRQ(IRQ_MFC),
887};
888
889struct platform_device s5p_device_mfc = {
890 .name = "s5p-mfc",
891 .id = -1,
892 .num_resources = ARRAY_SIZE(s5p_mfc_resource),
893 .resource = s5p_mfc_resource,
894};
895
896/*
897 * MFC hardware has 2 memory interfaces which are modelled as two separate
898 * platform devices to let dma-mapping distinguish between them.
899 *
900 * MFC parent device (s5p_device_mfc) must be registered before memory
901 * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r).
902 */
903
904struct platform_device s5p_device_mfc_l = {
905 .name = "s5p-mfc-l",
906 .id = -1,
907 .dev = {
908 .parent = &s5p_device_mfc.dev,
909 .dma_mask = &samsung_device_dma_mask,
910 .coherent_dma_mask = DMA_BIT_MASK(32),
911 },
912};
913
914struct platform_device s5p_device_mfc_r = {
915 .name = "s5p-mfc-r",
916 .id = -1,
917 .dev = {
918 .parent = &s5p_device_mfc.dev,
919 .dma_mask = &samsung_device_dma_mask,
920 .coherent_dma_mask = DMA_BIT_MASK(32),
921 },
922};
923
924#endif /* CONFIG_S5P_DEV_MFC */
925
926/* MIPI CSIS */ 887/* MIPI CSIS */
927 888
928#ifdef CONFIG_S5P_DEV_CSIS0 889#ifdef CONFIG_S5P_DEV_CSIS0
@@ -1113,7 +1074,7 @@ struct platform_device s5p_device_onenand = {
1113 1074
1114/* PMU */ 1075/* PMU */
1115 1076
1116#ifdef CONFIG_PLAT_S5P 1077#if defined(CONFIG_PLAT_S5P) && !defined(CONFIG_ARCH_EXYNOS)
1117static struct resource s5p_pmu_resource[] = { 1078static struct resource s5p_pmu_resource[] = {
1118 DEFINE_RES_IRQ(IRQ_PMU) 1079 DEFINE_RES_IRQ(IRQ_PMU)
1119}; 1080};
@@ -1552,6 +1513,9 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1552 pd.num_cs = num_cs; 1513 pd.num_cs = num_cs;
1553 pd.src_clk_nr = src_clk_nr; 1514 pd.src_clk_nr = src_clk_nr;
1554 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; 1515 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
1516#ifdef CONFIG_PL330_DMA
1517 pd.filter = pl330_filter;
1518#endif
1555 1519
1556 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0); 1520 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
1557} 1521}
@@ -1590,6 +1554,9 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1590 pd.num_cs = num_cs; 1554 pd.num_cs = num_cs;
1591 pd.src_clk_nr = src_clk_nr; 1555 pd.src_clk_nr = src_clk_nr;
1592 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; 1556 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
1557#ifdef CONFIG_PL330_DMA
1558 pd.filter = pl330_filter;
1559#endif
1593 1560
1594 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); 1561 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
1595} 1562}
@@ -1628,6 +1595,9 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1628 pd.num_cs = num_cs; 1595 pd.num_cs = num_cs;
1629 pd.src_clk_nr = src_clk_nr; 1596 pd.src_clk_nr = src_clk_nr;
1630 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; 1597 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
1598#ifdef CONFIG_PL330_DMA
1599 pd.filter = pl330_filter;
1600#endif
1631 1601
1632 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2); 1602 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
1633} 1603}
diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c
index 71d58ddea9c1..ec0d731b0e7b 100644
--- a/arch/arm/plat-samsung/dma-ops.c
+++ b/arch/arm/plat-samsung/dma-ops.c
@@ -23,23 +23,15 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
23 struct device *dev, char *ch_name) 23 struct device *dev, char *ch_name)
24{ 24{
25 dma_cap_mask_t mask; 25 dma_cap_mask_t mask;
26 void *filter_param;
27 26
28 dma_cap_zero(mask); 27 dma_cap_zero(mask);
29 dma_cap_set(param->cap, mask); 28 dma_cap_set(param->cap, mask);
30 29
31 /*
32 * If a dma channel property of a device node from device tree is
33 * specified, use that as the fliter parameter.
34 */
35 filter_param = (dma_ch == DMACH_DT_PROP) ?
36 (void *)param->dt_dmach_prop : (void *)dma_ch;
37
38 if (dev->of_node) 30 if (dev->of_node)
39 return (unsigned)dma_request_slave_channel(dev, ch_name); 31 return (unsigned)dma_request_slave_channel(dev, ch_name);
40 else 32 else
41 return (unsigned)dma_request_channel(mask, pl330_filter, 33 return (unsigned)dma_request_channel(mask, pl330_filter,
42 filter_param); 34 (void *)dma_ch);
43} 35}
44 36
45static int samsung_dmadev_release(unsigned ch, void *param) 37static int samsung_dmadev_release(unsigned ch, void *param)
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 37703ef6dfc7..989fefe18be6 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -23,6 +23,9 @@ extern unsigned long samsung_cpu_id;
23#define S3C24XX_CPU_ID 0x32400000 23#define S3C24XX_CPU_ID 0x32400000
24#define S3C24XX_CPU_MASK 0xFFF00000 24#define S3C24XX_CPU_MASK 0xFFF00000
25 25
26#define S3C2412_CPU_ID 0x32412000
27#define S3C2412_CPU_MASK 0xFFFFF000
28
26#define S3C6400_CPU_ID 0x36400000 29#define S3C6400_CPU_ID 0x36400000
27#define S3C6410_CPU_ID 0x36410000 30#define S3C6410_CPU_ID 0x36410000
28#define S3C64XX_CPU_MASK 0xFFFFF000 31#define S3C64XX_CPU_MASK 0xFFFFF000
@@ -53,6 +56,7 @@ static inline int is_samsung_##name(void) \
53} 56}
54 57
55IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) 58IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
59IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
56IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 60IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
57IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 61IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
58IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) 62IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
@@ -74,6 +78,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
74# define soc_is_s3c24xx() 0 78# define soc_is_s3c24xx() 0
75#endif 79#endif
76 80
81#if defined(CONFIG_CPU_S3C2412)
82# define soc_is_s3c2412() is_samsung_s3c2412()
83#else
84# define soc_is_s3c2412() 0
85#endif
86
77#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) 87#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
78# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) 88# define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
79#else 89#else
@@ -173,7 +183,6 @@ extern void s3c_init_cpu(unsigned long idcode,
173 183
174/* core initialisation functions */ 184/* core initialisation functions */
175 185
176extern void s3c24xx_init_irq(void);
177extern void s5p_init_irq(u32 *vic, u32 num_vic); 186extern void s5p_init_irq(u32 *vic, u32 num_vic);
178 187
179extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); 188extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
@@ -192,10 +201,6 @@ extern void s3c24xx_init_uartdevs(char *name,
192 struct s3c24xx_uart_resources *res, 201 struct s3c24xx_uart_resources *res,
193 struct s3c2410_uartcfg *cfg, int no); 202 struct s3c2410_uartcfg *cfg, int no);
194 203
195/* timer for 2410/2440 */
196
197extern void s3c24xx_timer_init(void);
198
199extern struct syscore_ops s3c2410_pm_syscore_ops; 204extern struct syscore_ops s3c2410_pm_syscore_ops;
200extern struct syscore_ops s3c2412_pm_syscore_ops; 205extern struct syscore_ops s3c2412_pm_syscore_ops;
201extern struct syscore_ops s3c2416_pm_syscore_ops; 206extern struct syscore_ops s3c2416_pm_syscore_ops;
diff --git a/arch/arm/plat-samsung/include/plat/dma-ops.h b/arch/arm/plat-samsung/include/plat/dma-ops.h
index 114178268b75..ce6d7634b6cb 100644
--- a/arch/arm/plat-samsung/include/plat/dma-ops.h
+++ b/arch/arm/plat-samsung/include/plat/dma-ops.h
@@ -18,7 +18,6 @@
18 18
19struct samsung_dma_req { 19struct samsung_dma_req {
20 enum dma_transaction_type cap; 20 enum dma_transaction_type cap;
21 struct property *dt_dmach_prop;
22 struct s3c2410_dma_client *client; 21 struct s3c2410_dma_client *client;
23}; 22};
24 23
diff --git a/arch/arm/plat-samsung/include/plat/dma-pl330.h b/arch/arm/plat-samsung/include/plat/dma-pl330.h
index d384a8016b47..abe07fae71db 100644
--- a/arch/arm/plat-samsung/include/plat/dma-pl330.h
+++ b/arch/arm/plat-samsung/include/plat/dma-pl330.h
@@ -21,7 +21,6 @@
21 * use these just as IDs. 21 * use these just as IDs.
22 */ 22 */
23enum dma_ch { 23enum dma_ch {
24 DMACH_DT_PROP = -1,
25 DMACH_UART0_RX = 0, 24 DMACH_UART0_RX = 0,
26 DMACH_UART0_TX, 25 DMACH_UART0_TX,
27 DMACH_UART1_RX, 26 DMACH_UART1_RX,
diff --git a/arch/arm/plat-samsung/include/plat/fb.h b/arch/arm/plat-samsung/include/plat/fb.h
index b885322717a1..9ae507270785 100644
--- a/arch/arm/plat-samsung/include/plat/fb.h
+++ b/arch/arm/plat-samsung/include/plat/fb.h
@@ -15,55 +15,7 @@
15#ifndef __PLAT_S3C_FB_H 15#ifndef __PLAT_S3C_FB_H
16#define __PLAT_S3C_FB_H __FILE__ 16#define __PLAT_S3C_FB_H __FILE__
17 17
18/* S3C_FB_MAX_WIN 18#include <linux/platform_data/video_s3c.h>
19 * Set to the maximum number of windows that any of the supported hardware
20 * can use. Since the platform data uses this for an array size, having it
21 * set to the maximum of any version of the hardware can do is safe.
22 */
23#define S3C_FB_MAX_WIN (5)
24
25/**
26 * struct s3c_fb_pd_win - per window setup data
27 * @xres : The window X size.
28 * @yres : The window Y size.
29 * @virtual_x: The virtual X size.
30 * @virtual_y: The virtual Y size.
31 */
32struct s3c_fb_pd_win {
33 unsigned short default_bpp;
34 unsigned short max_bpp;
35 unsigned short xres;
36 unsigned short yres;
37 unsigned short virtual_x;
38 unsigned short virtual_y;
39};
40
41/**
42 * struct s3c_fb_platdata - S3C driver platform specific information
43 * @setup_gpio: Setup the external GPIO pins to the right state to transfer
44 * the data from the display system to the connected display
45 * device.
46 * @vidcon0: The base vidcon0 values to control the panel data format.
47 * @vidcon1: The base vidcon1 values to control the panel data output.
48 * @vtiming: Video timing when connected to a RGB type panel.
49 * @win: The setup data for each hardware window, or NULL for unused.
50 * @display_mode: The LCD output display mode.
51 *
52 * The platform data supplies the video driver with all the information
53 * it requires to work with the display(s) attached to the machine. It
54 * controls the initial mode, the number of display windows (0 is always
55 * the base framebuffer) that are initialised etc.
56 *
57 */
58struct s3c_fb_platdata {
59 void (*setup_gpio)(void);
60
61 struct s3c_fb_pd_win *win[S3C_FB_MAX_WIN];
62 struct fb_videomode *vtiming;
63
64 u32 vidcon0;
65 u32 vidcon1;
66};
67 19
68/** 20/**
69 * s3c_fb_set_platdata() - Setup the FB device with platform data. 21 * s3c_fb_set_platdata() - Setup the FB device with platform data.
diff --git a/arch/arm/plat-samsung/include/plat/irq.h b/arch/arm/plat-samsung/include/plat/irq.h
deleted file mode 100644
index e21a89bc26c9..000000000000
--- a/arch/arm/plat-samsung/include/plat/irq.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/irq.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU IRQ support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/io.h>
14
15#include <mach/hardware.h>
16#include <mach/regs-irq.h>
17#include <mach/regs-gpio.h>
18
19#define irqdbf(x...)
20#define irqdbf2(x...)
21
22#define EXTINT_OFF (IRQ_EINT4 - 4)
23
24/* these are exported for arch/arm/mach-* usage */
25extern struct irq_chip s3c_irq_level_chip;
26extern struct irq_chip s3c_irq_chip;
27
28static inline void s3c_irqsub_mask(unsigned int irqno,
29 unsigned int parentbit,
30 int subcheck)
31{
32 unsigned long mask;
33 unsigned long submask;
34
35 submask = __raw_readl(S3C2410_INTSUBMSK);
36 mask = __raw_readl(S3C2410_INTMSK);
37
38 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
39
40 /* check to see if we need to mask the parent IRQ */
41
42 if ((submask & subcheck) == subcheck)
43 __raw_writel(mask | parentbit, S3C2410_INTMSK);
44
45 /* write back masks */
46 __raw_writel(submask, S3C2410_INTSUBMSK);
47
48}
49
50static inline void s3c_irqsub_unmask(unsigned int irqno,
51 unsigned int parentbit)
52{
53 unsigned long mask;
54 unsigned long submask;
55
56 submask = __raw_readl(S3C2410_INTSUBMSK);
57 mask = __raw_readl(S3C2410_INTMSK);
58
59 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
60 mask &= ~parentbit;
61
62 /* write back masks */
63 __raw_writel(submask, S3C2410_INTSUBMSK);
64 __raw_writel(mask, S3C2410_INTMSK);
65}
66
67
68static inline void s3c_irqsub_maskack(unsigned int irqno,
69 unsigned int parentmask,
70 unsigned int group)
71{
72 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
73
74 s3c_irqsub_mask(irqno, parentmask, group);
75
76 __raw_writel(bit, S3C2410_SUBSRCPND);
77
78 /* only ack parent if we've got all the irqs (seems we must
79 * ack, all and hope that the irq system retriggers ok when
80 * the interrupt goes off again)
81 */
82
83 if (1) {
84 __raw_writel(parentmask, S3C2410_SRCPND);
85 __raw_writel(parentmask, S3C2410_INTPND);
86 }
87}
88
89static inline void s3c_irqsub_ack(unsigned int irqno,
90 unsigned int parentmask,
91 unsigned int group)
92{
93 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
94
95 __raw_writel(bit, S3C2410_SUBSRCPND);
96
97 /* only ack parent if we've got all the irqs (seems we must
98 * ack, all and hope that the irq system retriggers ok when
99 * the interrupt goes off again)
100 */
101
102 if (1) {
103 __raw_writel(parentmask, S3C2410_SRCPND);
104 __raw_writel(parentmask, S3C2410_INTPND);
105 }
106}
107
108/* exported for use in arch/arm/mach-s3c2410 */
109
110#ifdef CONFIG_PM
111extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
112#else
113#define s3c_irq_wake NULL
114#endif
115
116extern int s3c_irqext_type(struct irq_data *d, unsigned int type);
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h
index c2d7bdae5891..c18678610bc0 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -22,6 +22,7 @@
22#define S5P_VA_GPIO3 S3C_ADDR(0x02280000) 22#define S5P_VA_GPIO3 S3C_ADDR(0x02280000)
23 23
24#define S5P_VA_SYSRAM S3C_ADDR(0x02400000) 24#define S5P_VA_SYSRAM S3C_ADDR(0x02400000)
25#define S5P_VA_SYSRAM_NS S3C_ADDR(0x02410000)
25#define S5P_VA_DMC0 S3C_ADDR(0x02440000) 26#define S5P_VA_DMC0 S3C_ADDR(0x02440000)
26#define S5P_VA_DMC1 S3C_ADDR(0x02480000) 27#define S5P_VA_DMC1 S3C_ADDR(0x02480000)
27#define S5P_VA_SROMC S3C_ADDR(0x024C0000) 28#define S5P_VA_SROMC S3C_ADDR(0x024C0000)
diff --git a/arch/arm/plat-samsung/include/plat/regs-ac97.h b/arch/arm/plat-samsung/include/plat/regs-ac97.h
deleted file mode 100644
index c3878f7acb83..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-ac97.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-ac97.h
2 *
3 * Copyright (c) 2006 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2440 AC97 Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_AC97_H
14#define __ASM_ARCH_REGS_AC97_H __FILE__
15
16#define S3C_AC97_GLBCTRL (0x00)
17
18#define S3C_AC97_GLBCTRL_CODECREADYIE (1<<22)
19#define S3C_AC97_GLBCTRL_PCMOUTURIE (1<<21)
20#define S3C_AC97_GLBCTRL_PCMINORIE (1<<20)
21#define S3C_AC97_GLBCTRL_MICINORIE (1<<19)
22#define S3C_AC97_GLBCTRL_PCMOUTTIE (1<<18)
23#define S3C_AC97_GLBCTRL_PCMINTIE (1<<17)
24#define S3C_AC97_GLBCTRL_MICINTIE (1<<16)
25#define S3C_AC97_GLBCTRL_PCMOUTTM_OFF (0<<12)
26#define S3C_AC97_GLBCTRL_PCMOUTTM_PIO (1<<12)
27#define S3C_AC97_GLBCTRL_PCMOUTTM_DMA (2<<12)
28#define S3C_AC97_GLBCTRL_PCMOUTTM_MASK (3<<12)
29#define S3C_AC97_GLBCTRL_PCMINTM_OFF (0<<10)
30#define S3C_AC97_GLBCTRL_PCMINTM_PIO (1<<10)
31#define S3C_AC97_GLBCTRL_PCMINTM_DMA (2<<10)
32#define S3C_AC97_GLBCTRL_PCMINTM_MASK (3<<10)
33#define S3C_AC97_GLBCTRL_MICINTM_OFF (0<<8)
34#define S3C_AC97_GLBCTRL_MICINTM_PIO (1<<8)
35#define S3C_AC97_GLBCTRL_MICINTM_DMA (2<<8)
36#define S3C_AC97_GLBCTRL_MICINTM_MASK (3<<8)
37#define S3C_AC97_GLBCTRL_TRANSFERDATAENABLE (1<<3)
38#define S3C_AC97_GLBCTRL_ACLINKON (1<<2)
39#define S3C_AC97_GLBCTRL_WARMRESET (1<<1)
40#define S3C_AC97_GLBCTRL_COLDRESET (1<<0)
41
42#define S3C_AC97_GLBSTAT (0x04)
43
44#define S3C_AC97_GLBSTAT_CODECREADY (1<<22)
45#define S3C_AC97_GLBSTAT_PCMOUTUR (1<<21)
46#define S3C_AC97_GLBSTAT_PCMINORI (1<<20)
47#define S3C_AC97_GLBSTAT_MICINORI (1<<19)
48#define S3C_AC97_GLBSTAT_PCMOUTTI (1<<18)
49#define S3C_AC97_GLBSTAT_PCMINTI (1<<17)
50#define S3C_AC97_GLBSTAT_MICINTI (1<<16)
51#define S3C_AC97_GLBSTAT_MAINSTATE_IDLE (0<<0)
52#define S3C_AC97_GLBSTAT_MAINSTATE_INIT (1<<0)
53#define S3C_AC97_GLBSTAT_MAINSTATE_READY (2<<0)
54#define S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE (3<<0)
55#define S3C_AC97_GLBSTAT_MAINSTATE_LP (4<<0)
56#define S3C_AC97_GLBSTAT_MAINSTATE_WARM (5<<0)
57
58#define S3C_AC97_CODEC_CMD (0x08)
59
60#define S3C_AC97_CODEC_CMD_READ (1<<23)
61
62#define S3C_AC97_STAT (0x0c)
63#define S3C_AC97_PCM_ADDR (0x10)
64#define S3C_AC97_PCM_DATA (0x18)
65#define S3C_AC97_MIC_DATA (0x1C)
66
67#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-iic.h b/arch/arm/plat-samsung/include/plat/regs-iic.h
deleted file mode 100644
index 2f7c17de8ac8..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-iic.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-iic.h
2 *
3 * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 I2C Controller
11*/
12
13#ifndef __ASM_ARCH_REGS_IIC_H
14#define __ASM_ARCH_REGS_IIC_H __FILE__
15
16/* see s3c2410x user guide, v1.1, section 9 (p447) for more info */
17
18#define S3C2410_IICREG(x) (x)
19
20#define S3C2410_IICCON S3C2410_IICREG(0x00)
21#define S3C2410_IICSTAT S3C2410_IICREG(0x04)
22#define S3C2410_IICADD S3C2410_IICREG(0x08)
23#define S3C2410_IICDS S3C2410_IICREG(0x0C)
24#define S3C2440_IICLC S3C2410_IICREG(0x10)
25
26#define S3C2410_IICCON_ACKEN (1<<7)
27#define S3C2410_IICCON_TXDIV_16 (0<<6)
28#define S3C2410_IICCON_TXDIV_512 (1<<6)
29#define S3C2410_IICCON_IRQEN (1<<5)
30#define S3C2410_IICCON_IRQPEND (1<<4)
31#define S3C2410_IICCON_SCALE(x) ((x)&15)
32#define S3C2410_IICCON_SCALEMASK (0xf)
33
34#define S3C2410_IICSTAT_MASTER_RX (2<<6)
35#define S3C2410_IICSTAT_MASTER_TX (3<<6)
36#define S3C2410_IICSTAT_SLAVE_RX (0<<6)
37#define S3C2410_IICSTAT_SLAVE_TX (1<<6)
38#define S3C2410_IICSTAT_MODEMASK (3<<6)
39
40#define S3C2410_IICSTAT_START (1<<5)
41#define S3C2410_IICSTAT_BUSBUSY (1<<5)
42#define S3C2410_IICSTAT_TXRXEN (1<<4)
43#define S3C2410_IICSTAT_ARBITR (1<<3)
44#define S3C2410_IICSTAT_ASSLAVE (1<<2)
45#define S3C2410_IICSTAT_ADDR0 (1<<1)
46#define S3C2410_IICSTAT_LASTBIT (1<<0)
47
48#define S3C2410_IICLC_SDA_DELAY0 (0 << 0)
49#define S3C2410_IICLC_SDA_DELAY5 (1 << 0)
50#define S3C2410_IICLC_SDA_DELAY10 (2 << 0)
51#define S3C2410_IICLC_SDA_DELAY15 (3 << 0)
52#define S3C2410_IICLC_SDA_DELAY_MASK (3 << 0)
53
54#define S3C2410_IICLC_FILTER_ON (1<<2)
55
56#endif /* __ASM_ARCH_REGS_IIC_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-iis.h b/arch/arm/plat-samsung/include/plat/regs-iis.h
deleted file mode 100644
index a18d35e7a735..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-iis.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/* arch/arm/plat-samsung/include/plat/regs-iis.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 IIS register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_IIS_H
14#define __ASM_ARCH_REGS_IIS_H
15
16#define S3C2410_IISCON (0x00)
17
18#define S3C2410_IISCON_LRINDEX (1 << 8)
19#define S3C2410_IISCON_TXFIFORDY (1 << 7)
20#define S3C2410_IISCON_RXFIFORDY (1 << 6)
21#define S3C2410_IISCON_TXDMAEN (1 << 5)
22#define S3C2410_IISCON_RXDMAEN (1 << 4)
23#define S3C2410_IISCON_TXIDLE (1 << 3)
24#define S3C2410_IISCON_RXIDLE (1 << 2)
25#define S3C2410_IISCON_PSCEN (1 << 1)
26#define S3C2410_IISCON_IISEN (1 << 0)
27
28#define S3C2410_IISMOD (0x04)
29
30#define S3C2440_IISMOD_MPLL (1 << 9)
31#define S3C2410_IISMOD_SLAVE (1 << 8)
32#define S3C2410_IISMOD_NOXFER (0 << 6)
33#define S3C2410_IISMOD_RXMODE (1 << 6)
34#define S3C2410_IISMOD_TXMODE (2 << 6)
35#define S3C2410_IISMOD_TXRXMODE (3 << 6)
36#define S3C2410_IISMOD_LR_LLOW (0 << 5)
37#define S3C2410_IISMOD_LR_RLOW (1 << 5)
38#define S3C2410_IISMOD_IIS (0 << 4)
39#define S3C2410_IISMOD_MSB (1 << 4)
40#define S3C2410_IISMOD_8BIT (0 << 3)
41#define S3C2410_IISMOD_16BIT (1 << 3)
42#define S3C2410_IISMOD_BITMASK (1 << 3)
43#define S3C2410_IISMOD_256FS (0 << 2)
44#define S3C2410_IISMOD_384FS (1 << 2)
45#define S3C2410_IISMOD_16FS (0 << 0)
46#define S3C2410_IISMOD_32FS (1 << 0)
47#define S3C2410_IISMOD_48FS (2 << 0)
48#define S3C2410_IISMOD_FS_MASK (3 << 0)
49
50#define S3C2410_IISPSR (0x08)
51
52#define S3C2410_IISPSR_INTMASK (31 << 5)
53#define S3C2410_IISPSR_INTSHIFT (5)
54#define S3C2410_IISPSR_EXTMASK (31 << 0)
55#define S3C2410_IISPSR_EXTSHFIT (0)
56
57#define S3C2410_IISFCON (0x0c)
58
59#define S3C2410_IISFCON_TXDMA (1 << 15)
60#define S3C2410_IISFCON_RXDMA (1 << 14)
61#define S3C2410_IISFCON_TXENABLE (1 << 13)
62#define S3C2410_IISFCON_RXENABLE (1 << 12)
63#define S3C2410_IISFCON_TXMASK (0x3f << 6)
64#define S3C2410_IISFCON_TXSHIFT (6)
65#define S3C2410_IISFCON_RXMASK (0x3f)
66#define S3C2410_IISFCON_RXSHIFT (0)
67
68#define S3C2410_IISFIFO (0x10)
69
70#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-onenand.h b/arch/arm/plat-samsung/include/plat/regs-onenand.h
deleted file mode 100644
index 930ea8b88ed3..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-onenand.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * linux/arch/arm/plat-s3c/include/plat/regs-onenand.h
3 *
4 * Copyright (C) 2008-2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __SAMSUNG_ONENAND_H__
12#define __SAMSUNG_ONENAND_H__
13
14#include <mach/hardware.h>
15
16/*
17 * OneNAND Controller
18 */
19#define MEM_CFG_OFFSET 0x0000
20#define BURST_LEN_OFFSET 0x0010
21#define MEM_RESET_OFFSET 0x0020
22#define INT_ERR_STAT_OFFSET 0x0030
23#define INT_ERR_MASK_OFFSET 0x0040
24#define INT_ERR_ACK_OFFSET 0x0050
25#define ECC_ERR_STAT_OFFSET 0x0060
26#define MANUFACT_ID_OFFSET 0x0070
27#define DEVICE_ID_OFFSET 0x0080
28#define DATA_BUF_SIZE_OFFSET 0x0090
29#define BOOT_BUF_SIZE_OFFSET 0x00A0
30#define BUF_AMOUNT_OFFSET 0x00B0
31#define TECH_OFFSET 0x00C0
32#define FBA_WIDTH_OFFSET 0x00D0
33#define FPA_WIDTH_OFFSET 0x00E0
34#define FSA_WIDTH_OFFSET 0x00F0
35#define TRANS_SPARE_OFFSET 0x0140
36#define DBS_DFS_WIDTH_OFFSET 0x0160
37#define INT_PIN_ENABLE_OFFSET 0x01A0
38#define ACC_CLOCK_OFFSET 0x01C0
39#define FLASH_VER_ID_OFFSET 0x01F0
40#define FLASH_AUX_CNTRL_OFFSET 0x0300 /* s3c64xx only */
41
42#define ONENAND_MEM_RESET_HOT 0x3
43#define ONENAND_MEM_RESET_COLD 0x2
44#define ONENAND_MEM_RESET_WARM 0x1
45
46#define CACHE_OP_ERR (1 << 13)
47#define RST_CMP (1 << 12)
48#define RDY_ACT (1 << 11)
49#define INT_ACT (1 << 10)
50#define UNSUP_CMD (1 << 9)
51#define LOCKED_BLK (1 << 8)
52#define BLK_RW_CMP (1 << 7)
53#define ERS_CMP (1 << 6)
54#define PGM_CMP (1 << 5)
55#define LOAD_CMP (1 << 4)
56#define ERS_FAIL (1 << 3)
57#define PGM_FAIL (1 << 2)
58#define INT_TO (1 << 1)
59#define LD_FAIL_ECC_ERR (1 << 0)
60
61#define TSRF (1 << 0)
62
63#endif
diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
deleted file mode 100644
index 0f8263e93eea..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-rtc.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 Internal RTC register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_RTC_H
14#define __ASM_ARCH_REGS_RTC_H __FILE__
15
16#define S3C2410_RTCREG(x) (x)
17#define S3C2410_INTP S3C2410_RTCREG(0x30)
18#define S3C2410_INTP_ALM (1 << 1)
19#define S3C2410_INTP_TIC (1 << 0)
20
21#define S3C2410_RTCCON S3C2410_RTCREG(0x40)
22#define S3C2410_RTCCON_RTCEN (1 << 0)
23#define S3C2410_RTCCON_CNTSEL (1 << 2)
24#define S3C2410_RTCCON_CLKRST (1 << 3)
25#define S3C2443_RTCCON_TICSEL (1 << 4)
26#define S3C64XX_RTCCON_TICEN (1 << 8)
27
28#define S3C2410_TICNT S3C2410_RTCREG(0x44)
29#define S3C2410_TICNT_ENABLE (1 << 7)
30
31/* S3C2443: tick count is 15 bit wide
32 * TICNT[6:0] contains upper 7 bits
33 * TICNT1[7:0] contains lower 8 bits
34 */
35#define S3C2443_TICNT_PART(x) ((x & 0x7f00) >> 8)
36#define S3C2443_TICNT1 S3C2410_RTCREG(0x4C)
37#define S3C2443_TICNT1_PART(x) (x & 0xff)
38
39/* S3C2416: tick count is 32 bit wide
40 * TICNT[6:0] contains bits [14:8]
41 * TICNT1[7:0] contains lower 8 bits
42 * TICNT2[16:0] contains upper 17 bits
43 */
44#define S3C2416_TICNT2 S3C2410_RTCREG(0x48)
45#define S3C2416_TICNT2_PART(x) ((x & 0xffff8000) >> 15)
46
47#define S3C2410_RTCALM S3C2410_RTCREG(0x50)
48#define S3C2410_RTCALM_ALMEN (1 << 6)
49#define S3C2410_RTCALM_YEAREN (1 << 5)
50#define S3C2410_RTCALM_MONEN (1 << 4)
51#define S3C2410_RTCALM_DAYEN (1 << 3)
52#define S3C2410_RTCALM_HOUREN (1 << 2)
53#define S3C2410_RTCALM_MINEN (1 << 1)
54#define S3C2410_RTCALM_SECEN (1 << 0)
55
56#define S3C2410_ALMSEC S3C2410_RTCREG(0x54)
57#define S3C2410_ALMMIN S3C2410_RTCREG(0x58)
58#define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c)
59
60#define S3C2410_ALMDATE S3C2410_RTCREG(0x60)
61#define S3C2410_ALMMON S3C2410_RTCREG(0x64)
62#define S3C2410_ALMYEAR S3C2410_RTCREG(0x68)
63
64#define S3C2410_RTCSEC S3C2410_RTCREG(0x70)
65#define S3C2410_RTCMIN S3C2410_RTCREG(0x74)
66#define S3C2410_RTCHOUR S3C2410_RTCREG(0x78)
67#define S3C2410_RTCDATE S3C2410_RTCREG(0x7c)
68#define S3C2410_RTCMON S3C2410_RTCREG(0x84)
69#define S3C2410_RTCYEAR S3C2410_RTCREG(0x88)
70
71#endif /* __ASM_ARCH_REGS_RTC_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-sdhci.h b/arch/arm/plat-samsung/include/plat/regs-sdhci.h
deleted file mode 100644
index e34049ad44cc..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-sdhci.h
+++ /dev/null
@@ -1,87 +0,0 @@
1/* linux/arch/arm/plat-s3c/include/plat/regs-sdhci.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - SDHCI (HSMMC) register definitions
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __PLAT_S3C_SDHCI_REGS_H
16#define __PLAT_S3C_SDHCI_REGS_H __FILE__
17
18#define S3C_SDHCI_CONTROL2 (0x80)
19#define S3C_SDHCI_CONTROL3 (0x84)
20#define S3C64XX_SDHCI_CONTROL4 (0x8C)
21
22#define S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR (1 << 31)
23#define S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK (1 << 30)
24#define S3C_SDHCI_CTRL2_CDINVRXD3 (1 << 29)
25#define S3C_SDHCI_CTRL2_SLCARDOUT (1 << 28)
26
27#define S3C_SDHCI_CTRL2_FLTCLKSEL_MASK (0xf << 24)
28#define S3C_SDHCI_CTRL2_FLTCLKSEL_SHIFT (24)
29#define S3C_SDHCI_CTRL2_FLTCLKSEL(_x) ((_x) << 24)
30
31#define S3C_SDHCI_CTRL2_LVLDAT_MASK (0xff << 16)
32#define S3C_SDHCI_CTRL2_LVLDAT_SHIFT (16)
33#define S3C_SDHCI_CTRL2_LVLDAT(_x) ((_x) << 16)
34
35#define S3C_SDHCI_CTRL2_ENFBCLKTX (1 << 15)
36#define S3C_SDHCI_CTRL2_ENFBCLKRX (1 << 14)
37#define S3C_SDHCI_CTRL2_SDCDSEL (1 << 13)
38#define S3C_SDHCI_CTRL2_SDSIGPC (1 << 12)
39#define S3C_SDHCI_CTRL2_ENBUSYCHKTXSTART (1 << 11)
40
41#define S3C_SDHCI_CTRL2_DFCNT_MASK (0x3 << 9)
42#define S3C_SDHCI_CTRL2_DFCNT_SHIFT (9)
43#define S3C_SDHCI_CTRL2_DFCNT_NONE (0x0 << 9)
44#define S3C_SDHCI_CTRL2_DFCNT_4SDCLK (0x1 << 9)
45#define S3C_SDHCI_CTRL2_DFCNT_16SDCLK (0x2 << 9)
46#define S3C_SDHCI_CTRL2_DFCNT_64SDCLK (0x3 << 9)
47
48#define S3C_SDHCI_CTRL2_ENCLKOUTHOLD (1 << 8)
49#define S3C_SDHCI_CTRL2_RWAITMODE (1 << 7)
50#define S3C_SDHCI_CTRL2_DISBUFRD (1 << 6)
51#define S3C_SDHCI_CTRL2_SELBASECLK_MASK (0x3 << 4)
52#define S3C_SDHCI_CTRL2_SELBASECLK_SHIFT (4)
53#define S3C_SDHCI_CTRL2_PWRSYNC (1 << 3)
54#define S3C_SDHCI_CTRL2_ENCLKOUTMSKCON (1 << 1)
55#define S3C_SDHCI_CTRL2_HWINITFIN (1 << 0)
56
57#define S3C_SDHCI_CTRL3_FCSEL3 (1 << 31)
58#define S3C_SDHCI_CTRL3_FCSEL2 (1 << 23)
59#define S3C_SDHCI_CTRL3_FCSEL1 (1 << 15)
60#define S3C_SDHCI_CTRL3_FCSEL0 (1 << 7)
61
62#define S3C_SDHCI_CTRL3_FIA3_MASK (0x7f << 24)
63#define S3C_SDHCI_CTRL3_FIA3_SHIFT (24)
64#define S3C_SDHCI_CTRL3_FIA3(_x) ((_x) << 24)
65
66#define S3C_SDHCI_CTRL3_FIA2_MASK (0x7f << 16)
67#define S3C_SDHCI_CTRL3_FIA2_SHIFT (16)
68#define S3C_SDHCI_CTRL3_FIA2(_x) ((_x) << 16)
69
70#define S3C_SDHCI_CTRL3_FIA1_MASK (0x7f << 8)
71#define S3C_SDHCI_CTRL3_FIA1_SHIFT (8)
72#define S3C_SDHCI_CTRL3_FIA1(_x) ((_x) << 8)
73
74#define S3C_SDHCI_CTRL3_FIA0_MASK (0x7f << 0)
75#define S3C_SDHCI_CTRL3_FIA0_SHIFT (0)
76#define S3C_SDHCI_CTRL3_FIA0(_x) ((_x) << 0)
77
78#define S3C64XX_SDHCI_CONTROL4_DRIVE_MASK (0x3 << 16)
79#define S3C64XX_SDHCI_CONTROL4_DRIVE_SHIFT (16)
80#define S3C64XX_SDHCI_CONTROL4_DRIVE_2mA (0x0 << 16)
81#define S3C64XX_SDHCI_CONTROL4_DRIVE_4mA (0x1 << 16)
82#define S3C64XX_SDHCI_CONTROL4_DRIVE_7mA (0x2 << 16)
83#define S3C64XX_SDHCI_CONTROL4_DRIVE_9mA (0x3 << 16)
84
85#define S3C64XX_SDHCI_CONTROL4_BUSY (1)
86
87#endif /* __PLAT_S3C_SDHCI_REGS_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h
index 29c26a818842..f05f2afa440d 100644
--- a/arch/arm/plat-samsung/include/plat/regs-serial.h
+++ b/arch/arm/plat-samsung/include/plat/regs-serial.h
@@ -1,281 +1 @@
1/* arch/arm/plat-samsung/include/plat/regs-serial.h #include <linux/serial_s3c.h>
2 *
3 * From linux/include/asm-arm/hardware/serial_s3c2410.h
4 *
5 * Internal header file for Samsung S3C2410 serial ports (UART0-2)
6 *
7 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
8 *
9 * Additional defines, Copyright 2003 Simtec Electronics (linux@simtec.co.uk)
10 *
11 * Adapted from:
12 *
13 * Internal header file for MX1ADS serial ports (UART1 & 2)
14 *
15 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30*/
31
32#ifndef __ASM_ARM_REGS_SERIAL_H
33#define __ASM_ARM_REGS_SERIAL_H
34
35#define S3C24XX_VA_UART0 (S3C_VA_UART)
36#define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
37#define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
38#define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
39
40#define S3C2410_PA_UART0 (S3C24XX_PA_UART)
41#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
42#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
43#define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
44
45#define S3C2410_URXH (0x24)
46#define S3C2410_UTXH (0x20)
47#define S3C2410_ULCON (0x00)
48#define S3C2410_UCON (0x04)
49#define S3C2410_UFCON (0x08)
50#define S3C2410_UMCON (0x0C)
51#define S3C2410_UBRDIV (0x28)
52#define S3C2410_UTRSTAT (0x10)
53#define S3C2410_UERSTAT (0x14)
54#define S3C2410_UFSTAT (0x18)
55#define S3C2410_UMSTAT (0x1C)
56
57#define S3C2410_LCON_CFGMASK ((0xF<<3)|(0x3))
58
59#define S3C2410_LCON_CS5 (0x0)
60#define S3C2410_LCON_CS6 (0x1)
61#define S3C2410_LCON_CS7 (0x2)
62#define S3C2410_LCON_CS8 (0x3)
63#define S3C2410_LCON_CSMASK (0x3)
64
65#define S3C2410_LCON_PNONE (0x0)
66#define S3C2410_LCON_PEVEN (0x5 << 3)
67#define S3C2410_LCON_PODD (0x4 << 3)
68#define S3C2410_LCON_PMASK (0x7 << 3)
69
70#define S3C2410_LCON_STOPB (1<<2)
71#define S3C2410_LCON_IRM (1<<6)
72
73#define S3C2440_UCON_CLKMASK (3<<10)
74#define S3C2440_UCON_CLKSHIFT (10)
75#define S3C2440_UCON_PCLK (0<<10)
76#define S3C2440_UCON_UCLK (1<<10)
77#define S3C2440_UCON_PCLK2 (2<<10)
78#define S3C2440_UCON_FCLK (3<<10)
79#define S3C2443_UCON_EPLL (3<<10)
80
81#define S3C6400_UCON_CLKMASK (3<<10)
82#define S3C6400_UCON_CLKSHIFT (10)
83#define S3C6400_UCON_PCLK (0<<10)
84#define S3C6400_UCON_PCLK2 (2<<10)
85#define S3C6400_UCON_UCLK0 (1<<10)
86#define S3C6400_UCON_UCLK1 (3<<10)
87
88#define S3C2440_UCON2_FCLK_EN (1<<15)
89#define S3C2440_UCON0_DIVMASK (15 << 12)
90#define S3C2440_UCON1_DIVMASK (15 << 12)
91#define S3C2440_UCON2_DIVMASK (7 << 12)
92#define S3C2440_UCON_DIVSHIFT (12)
93
94#define S3C2412_UCON_CLKMASK (3<<10)
95#define S3C2412_UCON_CLKSHIFT (10)
96#define S3C2412_UCON_UCLK (1<<10)
97#define S3C2412_UCON_USYSCLK (3<<10)
98#define S3C2412_UCON_PCLK (0<<10)
99#define S3C2412_UCON_PCLK2 (2<<10)
100
101#define S3C2410_UCON_CLKMASK (1 << 10)
102#define S3C2410_UCON_CLKSHIFT (10)
103#define S3C2410_UCON_UCLK (1<<10)
104#define S3C2410_UCON_SBREAK (1<<4)
105
106#define S3C2410_UCON_TXILEVEL (1<<9)
107#define S3C2410_UCON_RXILEVEL (1<<8)
108#define S3C2410_UCON_TXIRQMODE (1<<2)
109#define S3C2410_UCON_RXIRQMODE (1<<0)
110#define S3C2410_UCON_RXFIFO_TOI (1<<7)
111#define S3C2443_UCON_RXERR_IRQEN (1<<6)
112#define S3C2443_UCON_LOOPBACK (1<<5)
113
114#define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
115 S3C2410_UCON_RXILEVEL | \
116 S3C2410_UCON_TXIRQMODE | \
117 S3C2410_UCON_RXIRQMODE | \
118 S3C2410_UCON_RXFIFO_TOI)
119
120#define S3C2410_UFCON_FIFOMODE (1<<0)
121#define S3C2410_UFCON_TXTRIG0 (0<<6)
122#define S3C2410_UFCON_RXTRIG8 (1<<4)
123#define S3C2410_UFCON_RXTRIG12 (2<<4)
124
125/* S3C2440 FIFO trigger levels */
126#define S3C2440_UFCON_RXTRIG1 (0<<4)
127#define S3C2440_UFCON_RXTRIG8 (1<<4)
128#define S3C2440_UFCON_RXTRIG16 (2<<4)
129#define S3C2440_UFCON_RXTRIG32 (3<<4)
130
131#define S3C2440_UFCON_TXTRIG0 (0<<6)
132#define S3C2440_UFCON_TXTRIG16 (1<<6)
133#define S3C2440_UFCON_TXTRIG32 (2<<6)
134#define S3C2440_UFCON_TXTRIG48 (3<<6)
135
136#define S3C2410_UFCON_RESETBOTH (3<<1)
137#define S3C2410_UFCON_RESETTX (1<<2)
138#define S3C2410_UFCON_RESETRX (1<<1)
139
140#define S3C2410_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
141 S3C2410_UFCON_TXTRIG0 | \
142 S3C2410_UFCON_RXTRIG8 )
143
144#define S3C2410_UMCOM_AFC (1<<4)
145#define S3C2410_UMCOM_RTS_LOW (1<<0)
146
147#define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */
148#define S3C2412_UMCON_AFC_56 (1<<5)
149#define S3C2412_UMCON_AFC_48 (2<<5)
150#define S3C2412_UMCON_AFC_40 (3<<5)
151#define S3C2412_UMCON_AFC_32 (4<<5)
152#define S3C2412_UMCON_AFC_24 (5<<5)
153#define S3C2412_UMCON_AFC_16 (6<<5)
154#define S3C2412_UMCON_AFC_8 (7<<5)
155
156#define S3C2410_UFSTAT_TXFULL (1<<9)
157#define S3C2410_UFSTAT_RXFULL (1<<8)
158#define S3C2410_UFSTAT_TXMASK (15<<4)
159#define S3C2410_UFSTAT_TXSHIFT (4)
160#define S3C2410_UFSTAT_RXMASK (15<<0)
161#define S3C2410_UFSTAT_RXSHIFT (0)
162
163/* UFSTAT S3C2443 same as S3C2440 */
164#define S3C2440_UFSTAT_TXFULL (1<<14)
165#define S3C2440_UFSTAT_RXFULL (1<<6)
166#define S3C2440_UFSTAT_TXSHIFT (8)
167#define S3C2440_UFSTAT_RXSHIFT (0)
168#define S3C2440_UFSTAT_TXMASK (63<<8)
169#define S3C2440_UFSTAT_RXMASK (63)
170
171#define S3C2410_UTRSTAT_TXE (1<<2)
172#define S3C2410_UTRSTAT_TXFE (1<<1)
173#define S3C2410_UTRSTAT_RXDR (1<<0)
174
175#define S3C2410_UERSTAT_OVERRUN (1<<0)
176#define S3C2410_UERSTAT_FRAME (1<<2)
177#define S3C2410_UERSTAT_BREAK (1<<3)
178#define S3C2443_UERSTAT_PARITY (1<<1)
179
180#define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \
181 S3C2410_UERSTAT_FRAME | \
182 S3C2410_UERSTAT_BREAK)
183
184#define S3C2410_UMSTAT_CTS (1<<0)
185#define S3C2410_UMSTAT_DeltaCTS (1<<2)
186
187#define S3C2443_DIVSLOT (0x2C)
188
189/* S3C64XX interrupt registers. */
190#define S3C64XX_UINTP 0x30
191#define S3C64XX_UINTSP 0x34
192#define S3C64XX_UINTM 0x38
193
194#define S3C64XX_UINTM_RXD (0)
195#define S3C64XX_UINTM_TXD (2)
196#define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD)
197#define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD)
198
199/* Following are specific to S5PV210 */
200#define S5PV210_UCON_CLKMASK (1<<10)
201#define S5PV210_UCON_CLKSHIFT (10)
202#define S5PV210_UCON_PCLK (0<<10)
203#define S5PV210_UCON_UCLK (1<<10)
204
205#define S5PV210_UFCON_TXTRIG0 (0<<8)
206#define S5PV210_UFCON_TXTRIG4 (1<<8)
207#define S5PV210_UFCON_TXTRIG8 (2<<8)
208#define S5PV210_UFCON_TXTRIG16 (3<<8)
209#define S5PV210_UFCON_TXTRIG32 (4<<8)
210#define S5PV210_UFCON_TXTRIG64 (5<<8)
211#define S5PV210_UFCON_TXTRIG128 (6<<8)
212#define S5PV210_UFCON_TXTRIG256 (7<<8)
213
214#define S5PV210_UFCON_RXTRIG1 (0<<4)
215#define S5PV210_UFCON_RXTRIG4 (1<<4)
216#define S5PV210_UFCON_RXTRIG8 (2<<4)
217#define S5PV210_UFCON_RXTRIG16 (3<<4)
218#define S5PV210_UFCON_RXTRIG32 (4<<4)
219#define S5PV210_UFCON_RXTRIG64 (5<<4)
220#define S5PV210_UFCON_RXTRIG128 (6<<4)
221#define S5PV210_UFCON_RXTRIG256 (7<<4)
222
223#define S5PV210_UFSTAT_TXFULL (1<<24)
224#define S5PV210_UFSTAT_RXFULL (1<<8)
225#define S5PV210_UFSTAT_TXMASK (255<<16)
226#define S5PV210_UFSTAT_TXSHIFT (16)
227#define S5PV210_UFSTAT_RXMASK (255<<0)
228#define S5PV210_UFSTAT_RXSHIFT (0)
229
230#define S3C2410_UCON_CLKSEL0 (1 << 0)
231#define S3C2410_UCON_CLKSEL1 (1 << 1)
232#define S3C2410_UCON_CLKSEL2 (1 << 2)
233#define S3C2410_UCON_CLKSEL3 (1 << 3)
234
235/* Default values for s5pv210 UCON and UFCON uart registers */
236#define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
237 S3C2410_UCON_RXILEVEL | \
238 S3C2410_UCON_TXIRQMODE | \
239 S3C2410_UCON_RXIRQMODE | \
240 S3C2410_UCON_RXFIFO_TOI | \
241 S3C2443_UCON_RXERR_IRQEN)
242
243#define S5PV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
244 S5PV210_UFCON_TXTRIG4 | \
245 S5PV210_UFCON_RXTRIG4)
246
247#ifndef __ASSEMBLY__
248
249/* configuration structure for per-machine configurations for the
250 * serial port
251 *
252 * the pointer is setup by the machine specific initialisation from the
253 * arch/arm/mach-s3c2410/ directory.
254*/
255
256struct s3c2410_uartcfg {
257 unsigned char hwport; /* hardware port number */
258 unsigned char unused;
259 unsigned short flags;
260 upf_t uart_flags; /* default uart flags */
261 unsigned int clk_sel;
262
263 unsigned int has_fracval;
264
265 unsigned long ucon; /* value of ucon for port */
266 unsigned long ulcon; /* value of ulcon for port */
267 unsigned long ufcon; /* value of ufcon for port */
268};
269
270/* s3c24xx_uart_devs
271 *
272 * this is exported from the core as we cannot use driver_register(),
273 * or platform_add_device() before the console_initcall()
274*/
275
276extern struct platform_device *s3c24xx_uart_devs[4];
277
278#endif /* __ASSEMBLY__ */
279
280#endif /* __ASM_ARM_REGS_SERIAL_H */
281
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h
index 21d8594d37ca..7b542f7b7938 100644
--- a/arch/arm/plat-samsung/include/plat/rtc-core.h
+++ b/arch/arm/plat-samsung/include/plat/rtc-core.h
@@ -19,7 +19,7 @@
19/* re-define device name depending on support. */ 19/* re-define device name depending on support. */
20static inline void s3c_rtc_setname(char *name) 20static inline void s3c_rtc_setname(char *name)
21{ 21{
22#if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX) 22#if defined(CONFIG_S3C_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX)
23 s3c_device_rtc.name = name; 23 s3c_device_rtc.name = name;
24#endif 24#endif
25} 25}
diff --git a/arch/arm/plat-samsung/include/plat/s3c2410.h b/arch/arm/plat-samsung/include/plat/s3c2410.h
deleted file mode 100644
index 55b0e5f51e97..000000000000
--- a/arch/arm/plat-samsung/include/plat/s3c2410.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c2410.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2410 machine directory
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14#ifdef CONFIG_CPU_S3C2410
15
16extern int s3c2410_init(void);
17extern int s3c2410a_init(void);
18
19extern void s3c2410_map_io(void);
20
21extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22
23extern void s3c2410_init_clocks(int xtal);
24
25#else
26#define s3c2410_init_clocks NULL
27#define s3c2410_init_uarts NULL
28#define s3c2410_map_io NULL
29#define s3c2410_init NULL
30#define s3c2410a_init NULL
31#endif
diff --git a/arch/arm/plat-samsung/include/plat/s3c2412.h b/arch/arm/plat-samsung/include/plat/s3c2412.h
deleted file mode 100644
index cbae50ddacc8..000000000000
--- a/arch/arm/plat-samsung/include/plat/s3c2412.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c2412.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2412 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifdef CONFIG_CPU_S3C2412
14
15extern int s3c2412_init(void);
16
17extern void s3c2412_map_io(void);
18
19extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
20
21extern void s3c2412_init_clocks(int xtal);
22
23extern int s3c2412_baseclk_add(void);
24
25extern void s3c2412_restart(char mode, const char *cmd);
26#else
27#define s3c2412_init_clocks NULL
28#define s3c2412_init_uarts NULL
29#define s3c2412_map_io NULL
30#define s3c2412_init NULL
31#define s3c2412_restart NULL
32#endif
diff --git a/arch/arm/plat-samsung/include/plat/s3c2416.h b/arch/arm/plat-samsung/include/plat/s3c2416.h
deleted file mode 100644
index f27399a3c68d..000000000000
--- a/arch/arm/plat-samsung/include/plat/s3c2416.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c2416.h
2 *
3 * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>
4 *
5 * Header file for s3c2416 cpu support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifdef CONFIG_CPU_S3C2416
13
14struct s3c2410_uartcfg;
15
16extern int s3c2416_init(void);
17
18extern void s3c2416_map_io(void);
19
20extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no);
21
22extern void s3c2416_init_clocks(int xtal);
23
24extern int s3c2416_baseclk_add(void);
25
26extern void s3c2416_restart(char mode, const char *cmd);
27
28extern void s3c2416_init_irq(void);
29extern struct syscore_ops s3c2416_irq_syscore_ops;
30
31#else
32#define s3c2416_init_clocks NULL
33#define s3c2416_init_uarts NULL
34#define s3c2416_map_io NULL
35#define s3c2416_init NULL
36#define s3c2416_restart NULL
37#endif
diff --git a/arch/arm/plat-samsung/include/plat/s3c2443.h b/arch/arm/plat-samsung/include/plat/s3c2443.h
deleted file mode 100644
index 71b88ec48956..000000000000
--- a/arch/arm/plat-samsung/include/plat/s3c2443.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c2443.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2443 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifdef CONFIG_CPU_S3C2443
14
15struct s3c2410_uartcfg;
16
17extern int s3c2443_init(void);
18
19extern void s3c2443_map_io(void);
20
21extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22
23extern void s3c2443_init_clocks(int xtal);
24
25extern int s3c2443_baseclk_add(void);
26
27extern void s3c2443_restart(char mode, const char *cmd);
28
29extern void s3c2443_init_irq(void);
30#else
31#define s3c2443_init_clocks NULL
32#define s3c2443_init_uarts NULL
33#define s3c2443_map_io NULL
34#define s3c2443_init NULL
35#define s3c2443_restart NULL
36#endif
diff --git a/arch/arm/plat-samsung/include/plat/s3c244x.h b/arch/arm/plat-samsung/include/plat/s3c244x.h
deleted file mode 100644
index ea0c961b7603..000000000000
--- a/arch/arm/plat-samsung/include/plat/s3c244x.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c244x.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C2440 and S3C2442 cpu support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
14
15extern void s3c244x_map_io(void);
16
17extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
18
19extern void s3c244x_init_clocks(int xtal);
20
21#else
22#define s3c244x_init_clocks NULL
23#define s3c244x_init_uarts NULL
24#endif
25
26#ifdef CONFIG_CPU_S3C2440
27extern int s3c2440_init(void);
28
29extern void s3c2440_map_io(void);
30#else
31#define s3c2440_init NULL
32#define s3c2440_map_io NULL
33#endif
34
35#ifdef CONFIG_CPU_S3C2442
36extern int s3c2442_init(void);
37
38extern void s3c2442_map_io(void);
39#else
40#define s3c2442_init NULL
41#define s3c2442_map_io NULL
42#endif
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h
deleted file mode 100644
index 9c96f3586ce0..000000000000
--- a/arch/arm/plat-samsung/include/plat/s5p-time.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s5p-time.h
2 *
3 * Copyright 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Header file for s5p time support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_S5P_TIME_H
14#define __ASM_PLAT_S5P_TIME_H __FILE__
15
16/* S5P HR-Timer Clock mode */
17enum s5p_timer_mode {
18 S5P_PWM0,
19 S5P_PWM1,
20 S5P_PWM2,
21 S5P_PWM3,
22 S5P_PWM4,
23};
24
25struct s5p_timer_source {
26 unsigned int event_id;
27 unsigned int source_id;
28};
29
30/* Be able to sleep for atleast 4 seconds (usually more) */
31#define S5PTIMER_MIN_RANGE 4
32
33#define TCNT_MAX 0xffffffff
34#define NON_PERIODIC 0
35#define PERIODIC 1
36
37extern void __init s5p_set_timer_source(enum s5p_timer_mode event,
38 enum s5p_timer_mode source);
39extern void s5p_timer_init(void);
40#endif /* __ASM_PLAT_S5P_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h
new file mode 100644
index 000000000000..4cc99bb1f176
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/samsung-time.h
@@ -0,0 +1,53 @@
1/* linux/arch/arm/plat-samsung/include/plat/samsung-time.h
2 *
3 * Copyright 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Header file for samsung s3c and s5p time support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_SAMSUNG_TIME_H
14#define __ASM_PLAT_SAMSUNG_TIME_H __FILE__
15
16/* SAMSUNG HR-Timer Clock mode */
17enum samsung_timer_mode {
18 SAMSUNG_PWM0,
19 SAMSUNG_PWM1,
20 SAMSUNG_PWM2,
21 SAMSUNG_PWM3,
22 SAMSUNG_PWM4,
23};
24
25struct samsung_timer_source {
26 unsigned int event_id;
27 unsigned int source_id;
28};
29
30/* Be able to sleep for atleast 4 seconds (usually more) */
31#define SAMSUNG_TIMER_MIN_RANGE 4
32
33#if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100)
34#define TCNT_MAX 0xffff
35#define TSCALER_DIV 25
36#define TDIV 50
37#define TSIZE 16
38#else
39#define TCNT_MAX 0xffffffff
40#define TSCALER_DIV 2
41#define TDIV 2
42#define TSIZE 32
43#endif
44
45#define NON_PERIODIC 0
46#define PERIODIC 1
47
48extern void __init samsung_set_timer_source(enum samsung_timer_mode event,
49 enum samsung_timer_mode source);
50
51extern void __init samsung_timer_init(void);
52
53#endif /* __ASM_PLAT_SAMSUNG_TIME_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 9b87f38fc4f4..ce1d0f785efd 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -18,62 +18,9 @@
18#ifndef __PLAT_S3C_SDHCI_H 18#ifndef __PLAT_S3C_SDHCI_H
19#define __PLAT_S3C_SDHCI_H __FILE__ 19#define __PLAT_S3C_SDHCI_H __FILE__
20 20
21#include <linux/platform_data/mmc-sdhci-s3c.h>
21#include <plat/devs.h> 22#include <plat/devs.h>
22 23
23struct platform_device;
24struct mmc_host;
25struct mmc_card;
26struct mmc_ios;
27
28enum cd_types {
29 S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */
30 S3C_SDHCI_CD_EXTERNAL, /* use external callback */
31 S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */
32 S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */
33 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
34};
35
36/**
37 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
38 * @max_width: The maximum number of data bits supported.
39 * @host_caps: Standard MMC host capabilities bit field.
40 * @host_caps2: The second standard MMC host capabilities bit field.
41 * @cd_type: Type of Card Detection method (see cd_types enum above)
42 * @ext_cd_init: Initialize external card detect subsystem. Called on
43 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
44 * notify_func argument is a callback to the sdhci-s3c driver
45 * that triggers the card detection event. Callback arguments:
46 * dev is pointer to platform device of the host controller,
47 * state is new state of the card (0 - removed, 1 - inserted).
48 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
49 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
50 * notify_func argument is the same callback as for ext_cd_init.
51 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
52 * cd_type == S3C_SDHCI_CD_GPIO
53 * @ext_cd_gpio_invert: invert values for external CD gpio line
54 * @cfg_gpio: Configure the GPIO for a specific card bit-width
55 *
56 * Initialisation data specific to either the machine or the platform
57 * for the device driver to use or call-back when configuring gpio or
58 * card speed information.
59*/
60struct s3c_sdhci_platdata {
61 unsigned int max_width;
62 unsigned int host_caps;
63 unsigned int host_caps2;
64 unsigned int pm_caps;
65 enum cd_types cd_type;
66
67 int ext_cd_gpio;
68 bool ext_cd_gpio_invert;
69 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
70 int state));
71 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
72 int state));
73
74 void (*cfg_gpio)(struct platform_device *dev, int width);
75};
76
77/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data 24/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
78 * @pd: The default platform data for this device. 25 * @pd: The default platform data for this device.
79 * @set: Pointer to the platform data to fill in. 26 * @set: Pointer to the platform data to fill in.
@@ -206,7 +153,7 @@ static inline void s3c6400_default_sdhci2(void) { }
206 153
207/* S5P64X0 SDHCI setup */ 154/* S5P64X0 SDHCI setup */
208 155
209#ifdef CONFIG_S5P64X0_SETUP_SDHCI 156#ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
210static inline void s5p64x0_default_sdhci0(void) 157static inline void s5p64x0_default_sdhci0(void)
211{ 158{
212#ifdef CONFIG_S3C_DEV_HSMMC 159#ifdef CONFIG_S3C_DEV_HSMMC
@@ -241,7 +188,7 @@ static inline void s5p64x0_default_sdhci1(void) { }
241static inline void s5p6440_default_sdhci2(void) { } 188static inline void s5p6440_default_sdhci2(void) { }
242static inline void s5p6450_default_sdhci2(void) { } 189static inline void s5p6450_default_sdhci2(void) { }
243 190
244#endif /* CONFIG_S5P64X0_SETUP_SDHCI */ 191#endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
245 192
246/* S5PC100 SDHCI setup */ 193/* S5PC100 SDHCI setup */
247 194
@@ -378,5 +325,4 @@ static inline void s3c_sdhci_setname(int id, char *name)
378 break; 325 break;
379 } 326 }
380} 327}
381
382#endif /* __PLAT_S3C_SDHCI_H */ 328#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h b/arch/arm/plat-samsung/include/plat/usb-phy.h
index 959bcdb03a25..ab34dfadb7f9 100644
--- a/arch/arm/plat-samsung/include/plat/usb-phy.h
+++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
@@ -11,10 +11,7 @@
11#ifndef __PLAT_SAMSUNG_USB_PHY_H 11#ifndef __PLAT_SAMSUNG_USB_PHY_H
12#define __PLAT_SAMSUNG_USB_PHY_H __FILE__ 12#define __PLAT_SAMSUNG_USB_PHY_H __FILE__
13 13
14enum s5p_usb_phy_type { 14#include <linux/usb/samsung_usb_phy.h>
15 S5P_USB_PHY_DEVICE,
16 S5P_USB_PHY_HOST,
17};
18 15
19extern int s5p_usb_phy_init(struct platform_device *pdev, int type); 16extern int s5p_usb_phy_init(struct platform_device *pdev, int type);
20extern int s5p_usb_phy_exit(struct platform_device *pdev, int type); 17extern int s5p_usb_phy_exit(struct platform_device *pdev, int type);
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index f980cf3d2baa..0fceb4273824 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -16,15 +16,15 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/irqchip/chained_irq.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
21#include <mach/map.h> 22#include <mach/map.h>
23#include <mach/irqs.h>
22#include <plat/cpu.h> 24#include <plat/cpu.h>
23#include <plat/irq-vic-timer.h> 25#include <plat/irq-vic-timer.h>
24#include <plat/regs-timer.h> 26#include <plat/regs-timer.h>
25 27
26#include <asm/mach/irq.h>
27
28static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc) 28static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
29{ 29{
30 struct irq_chip *chip = irq_get_chip(irq); 30 struct irq_chip *chip = irq_get_chip(irq);
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 002b1472293b..53210ec4e8ec 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -27,6 +27,7 @@
27#include <plat/regs-serial.h> 27#include <plat/regs-serial.h>
28#include <mach/regs-clock.h> 28#include <mach/regs-clock.h>
29#include <mach/regs-irq.h> 29#include <mach/regs-irq.h>
30#include <mach/irqs.h>
30#include <asm/irq.h> 31#include <asm/irq.h>
31 32
32#include <plat/pm.h> 33#include <plat/pm.h>
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index 5ec104b5408b..a93fb6fb6606 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -18,10 +18,50 @@
18#include <linux/of.h> 18#include <linux/of.h>
19 19
20#include <mach/map.h> 20#include <mach/map.h>
21#include <mach/irqs.h>
21#include <plat/devs.h> 22#include <plat/devs.h>
22#include <plat/irqs.h>
23#include <plat/mfc.h> 23#include <plat/mfc.h>
24 24
25static struct resource s5p_mfc_resource[] = {
26 [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K),
27 [1] = DEFINE_RES_IRQ(IRQ_MFC),
28};
29
30struct platform_device s5p_device_mfc = {
31 .name = "s5p-mfc",
32 .id = -1,
33 .num_resources = ARRAY_SIZE(s5p_mfc_resource),
34 .resource = s5p_mfc_resource,
35};
36
37/*
38 * MFC hardware has 2 memory interfaces which are modelled as two separate
39 * platform devices to let dma-mapping distinguish between them.
40 *
41 * MFC parent device (s5p_device_mfc) must be registered before memory
42 * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r).
43 */
44
45struct platform_device s5p_device_mfc_l = {
46 .name = "s5p-mfc-l",
47 .id = -1,
48 .dev = {
49 .parent = &s5p_device_mfc.dev,
50 .dma_mask = &s5p_device_mfc_l.dev.coherent_dma_mask,
51 .coherent_dma_mask = DMA_BIT_MASK(32),
52 },
53};
54
55struct platform_device s5p_device_mfc_r = {
56 .name = "s5p-mfc-r",
57 .id = -1,
58 .dev = {
59 .parent = &s5p_device_mfc.dev,
60 .dma_mask = &s5p_device_mfc_r.dev.coherent_dma_mask,
61 .coherent_dma_mask = DMA_BIT_MASK(32),
62 },
63};
64
25struct s5p_mfc_reserved_mem { 65struct s5p_mfc_reserved_mem {
26 phys_addr_t base; 66 phys_addr_t base;
27 unsigned long size; 67 unsigned long size;
diff --git a/arch/arm/plat-samsung/s5p-irq-gpioint.c b/arch/arm/plat-samsung/s5p-irq-gpioint.c
index bae56131a50a..fafdb059043a 100644
--- a/arch/arm/plat-samsung/s5p-irq-gpioint.c
+++ b/arch/arm/plat-samsung/s5p-irq-gpioint.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/irqchip/chained_irq.h>
17#include <linux/io.h> 18#include <linux/io.h>
18#include <linux/gpio.h> 19#include <linux/gpio.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
@@ -22,8 +23,6 @@
22#include <plat/gpio-core.h> 23#include <plat/gpio-core.h>
23#include <plat/gpio-cfg.h> 24#include <plat/gpio-cfg.h>
24 25
25#include <asm/mach/irq.h>
26
27#define GPIO_BASE(chip) ((void __iomem *)((unsigned long)((chip)->base) & 0xFFFFF000u)) 26#define GPIO_BASE(chip) ((void __iomem *)((unsigned long)((chip)->base) & 0xFFFFF000u))
28 27
29#define CON_OFFSET 0x700 28#define CON_OFFSET 0x700
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
index 103e371f5e35..ff1a76011b1e 100644
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ b/arch/arm/plat-samsung/s5p-irq.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/irqchip/arm-vic.h> 16#include <linux/irqchip/arm-vic.h>
17 17
18#include <mach/irqs.h>
18#include <mach/map.h> 19#include <mach/map.h>
19#include <plat/regs-timer.h> 20#include <plat/regs-timer.h>
20#include <plat/cpu.h> 21#include <plat/cpu.h>
diff --git a/arch/arm/plat-samsung/s5p-sleep.S b/arch/arm/plat-samsung/s5p-sleep.S
index bdf6dadf8790..a030e7301da8 100644
--- a/arch/arm/plat-samsung/s5p-sleep.S
+++ b/arch/arm/plat-samsung/s5p-sleep.S
@@ -25,6 +25,9 @@
25#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
26#include <asm/hardware/cache-l2x0.h> 26#include <asm/hardware/cache-l2x0.h>
27 27
28#define CPU_MASK 0xff0ffff0
29#define CPU_CORTEX_A9 0x410fc090
30
28/* 31/*
29 * The following code is located into the .data section. This is to 32 * The following code is located into the .data section. This is to
30 * allow l2x0_regs_phys to be accessed with a relative load while we 33 * allow l2x0_regs_phys to be accessed with a relative load while we
@@ -51,6 +54,12 @@
51 54
52ENTRY(s3c_cpu_resume) 55ENTRY(s3c_cpu_resume)
53#ifdef CONFIG_CACHE_L2X0 56#ifdef CONFIG_CACHE_L2X0
57 mrc p15, 0, r0, c0, c0, 0
58 ldr r1, =CPU_MASK
59 and r0, r0, r1
60 ldr r1, =CPU_CORTEX_A9
61 cmp r0, r1
62 bne resume_l2on
54 adr r0, l2x0_regs_phys 63 adr r0, l2x0_regs_phys
55 ldr r0, [r0] 64 ldr r0, [r0]
56 ldr r1, [r0, #L2X0_R_PHY_BASE] 65 ldr r1, [r0, #L2X0_R_PHY_BASE]
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/samsung-time.c
index e92510cf82ee..f899cbc9b288 100644
--- a/arch/arm/plat-samsung/s5p-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -2,7 +2,7 @@
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/ 3 * http://www.samsung.com/
4 * 4 *
5 * S5P - Common hr-timer support 5 * samsung - Common hr-timer support (s3c and s5p)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -25,41 +25,41 @@
25#include <mach/map.h> 25#include <mach/map.h>
26#include <plat/devs.h> 26#include <plat/devs.h>
27#include <plat/regs-timer.h> 27#include <plat/regs-timer.h>
28#include <plat/s5p-time.h> 28#include <plat/samsung-time.h>
29 29
30static struct clk *tin_event; 30static struct clk *tin_event;
31static struct clk *tin_source; 31static struct clk *tin_source;
32static struct clk *tdiv_event; 32static struct clk *tdiv_event;
33static struct clk *tdiv_source; 33static struct clk *tdiv_source;
34static struct clk *timerclk; 34static struct clk *timerclk;
35static struct s5p_timer_source timer_source; 35static struct samsung_timer_source timer_source;
36static unsigned long clock_count_per_tick; 36static unsigned long clock_count_per_tick;
37static void s5p_timer_resume(void); 37static void samsung_timer_resume(void);
38 38
39static void s5p_time_stop(enum s5p_timer_mode mode) 39static void samsung_time_stop(enum samsung_timer_mode mode)
40{ 40{
41 unsigned long tcon; 41 unsigned long tcon;
42 42
43 tcon = __raw_readl(S3C2410_TCON); 43 tcon = __raw_readl(S3C2410_TCON);
44 44
45 switch (mode) { 45 switch (mode) {
46 case S5P_PWM0: 46 case SAMSUNG_PWM0:
47 tcon &= ~S3C2410_TCON_T0START; 47 tcon &= ~S3C2410_TCON_T0START;
48 break; 48 break;
49 49
50 case S5P_PWM1: 50 case SAMSUNG_PWM1:
51 tcon &= ~S3C2410_TCON_T1START; 51 tcon &= ~S3C2410_TCON_T1START;
52 break; 52 break;
53 53
54 case S5P_PWM2: 54 case SAMSUNG_PWM2:
55 tcon &= ~S3C2410_TCON_T2START; 55 tcon &= ~S3C2410_TCON_T2START;
56 break; 56 break;
57 57
58 case S5P_PWM3: 58 case SAMSUNG_PWM3:
59 tcon &= ~S3C2410_TCON_T3START; 59 tcon &= ~S3C2410_TCON_T3START;
60 break; 60 break;
61 61
62 case S5P_PWM4: 62 case SAMSUNG_PWM4:
63 tcon &= ~S3C2410_TCON_T4START; 63 tcon &= ~S3C2410_TCON_T4START;
64 break; 64 break;
65 65
@@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode)
70 __raw_writel(tcon, S3C2410_TCON); 70 __raw_writel(tcon, S3C2410_TCON);
71} 71}
72 72
73static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) 73static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt)
74{ 74{
75 unsigned long tcon; 75 unsigned long tcon;
76 76
@@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
79 tcnt--; 79 tcnt--;
80 80
81 switch (mode) { 81 switch (mode) {
82 case S5P_PWM0: 82 case SAMSUNG_PWM0:
83 tcon &= ~(0x0f << 0); 83 tcon &= ~(0x0f << 0);
84 tcon |= S3C2410_TCON_T0MANUALUPD; 84 tcon |= S3C2410_TCON_T0MANUALUPD;
85 break; 85 break;
86 86
87 case S5P_PWM1: 87 case SAMSUNG_PWM1:
88 tcon &= ~(0x0f << 8); 88 tcon &= ~(0x0f << 8);
89 tcon |= S3C2410_TCON_T1MANUALUPD; 89 tcon |= S3C2410_TCON_T1MANUALUPD;
90 break; 90 break;
91 91
92 case S5P_PWM2: 92 case SAMSUNG_PWM2:
93 tcon &= ~(0x0f << 12); 93 tcon &= ~(0x0f << 12);
94 tcon |= S3C2410_TCON_T2MANUALUPD; 94 tcon |= S3C2410_TCON_T2MANUALUPD;
95 break; 95 break;
96 96
97 case S5P_PWM3: 97 case SAMSUNG_PWM3:
98 tcon &= ~(0x0f << 16); 98 tcon &= ~(0x0f << 16);
99 tcon |= S3C2410_TCON_T3MANUALUPD; 99 tcon |= S3C2410_TCON_T3MANUALUPD;
100 break; 100 break;
101 101
102 case S5P_PWM4: 102 case SAMSUNG_PWM4:
103 tcon &= ~(0x07 << 20); 103 tcon &= ~(0x07 << 20);
104 tcon |= S3C2410_TCON_T4MANUALUPD; 104 tcon |= S3C2410_TCON_T4MANUALUPD;
105 break; 105 break;
@@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt)
114 __raw_writel(tcon, S3C2410_TCON); 114 __raw_writel(tcon, S3C2410_TCON);
115} 115}
116 116
117static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) 117static void samsung_time_start(enum samsung_timer_mode mode, bool periodic)
118{ 118{
119 unsigned long tcon; 119 unsigned long tcon;
120 120
121 tcon = __raw_readl(S3C2410_TCON); 121 tcon = __raw_readl(S3C2410_TCON);
122 122
123 switch (mode) { 123 switch (mode) {
124 case S5P_PWM0: 124 case SAMSUNG_PWM0:
125 tcon |= S3C2410_TCON_T0START; 125 tcon |= S3C2410_TCON_T0START;
126 tcon &= ~S3C2410_TCON_T0MANUALUPD; 126 tcon &= ~S3C2410_TCON_T0MANUALUPD;
127 127
@@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
131 tcon &= ~S3C2410_TCON_T0RELOAD; 131 tcon &= ~S3C2410_TCON_T0RELOAD;
132 break; 132 break;
133 133
134 case S5P_PWM1: 134 case SAMSUNG_PWM1:
135 tcon |= S3C2410_TCON_T1START; 135 tcon |= S3C2410_TCON_T1START;
136 tcon &= ~S3C2410_TCON_T1MANUALUPD; 136 tcon &= ~S3C2410_TCON_T1MANUALUPD;
137 137
@@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
141 tcon &= ~S3C2410_TCON_T1RELOAD; 141 tcon &= ~S3C2410_TCON_T1RELOAD;
142 break; 142 break;
143 143
144 case S5P_PWM2: 144 case SAMSUNG_PWM2:
145 tcon |= S3C2410_TCON_T2START; 145 tcon |= S3C2410_TCON_T2START;
146 tcon &= ~S3C2410_TCON_T2MANUALUPD; 146 tcon &= ~S3C2410_TCON_T2MANUALUPD;
147 147
@@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
151 tcon &= ~S3C2410_TCON_T2RELOAD; 151 tcon &= ~S3C2410_TCON_T2RELOAD;
152 break; 152 break;
153 153
154 case S5P_PWM3: 154 case SAMSUNG_PWM3:
155 tcon |= S3C2410_TCON_T3START; 155 tcon |= S3C2410_TCON_T3START;
156 tcon &= ~S3C2410_TCON_T3MANUALUPD; 156 tcon &= ~S3C2410_TCON_T3MANUALUPD;
157 157
@@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
161 tcon &= ~S3C2410_TCON_T3RELOAD; 161 tcon &= ~S3C2410_TCON_T3RELOAD;
162 break; 162 break;
163 163
164 case S5P_PWM4: 164 case SAMSUNG_PWM4:
165 tcon |= S3C2410_TCON_T4START; 165 tcon |= S3C2410_TCON_T4START;
166 tcon &= ~S3C2410_TCON_T4MANUALUPD; 166 tcon &= ~S3C2410_TCON_T4MANUALUPD;
167 167
@@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic)
178 __raw_writel(tcon, S3C2410_TCON); 178 __raw_writel(tcon, S3C2410_TCON);
179} 179}
180 180
181static int s5p_set_next_event(unsigned long cycles, 181static int samsung_set_next_event(unsigned long cycles,
182 struct clock_event_device *evt) 182 struct clock_event_device *evt)
183{ 183{
184 s5p_time_setup(timer_source.event_id, cycles); 184 samsung_time_setup(timer_source.event_id, cycles);
185 s5p_time_start(timer_source.event_id, NON_PERIODIC); 185 samsung_time_start(timer_source.event_id, NON_PERIODIC);
186 186
187 return 0; 187 return 0;
188} 188}
189 189
190static void s5p_set_mode(enum clock_event_mode mode, 190static void samsung_set_mode(enum clock_event_mode mode,
191 struct clock_event_device *evt) 191 struct clock_event_device *evt)
192{ 192{
193 s5p_time_stop(timer_source.event_id); 193 samsung_time_stop(timer_source.event_id);
194 194
195 switch (mode) { 195 switch (mode) {
196 case CLOCK_EVT_MODE_PERIODIC: 196 case CLOCK_EVT_MODE_PERIODIC:
197 s5p_time_setup(timer_source.event_id, clock_count_per_tick); 197 samsung_time_setup(timer_source.event_id, clock_count_per_tick);
198 s5p_time_start(timer_source.event_id, PERIODIC); 198 samsung_time_start(timer_source.event_id, PERIODIC);
199 break; 199 break;
200 200
201 case CLOCK_EVT_MODE_ONESHOT: 201 case CLOCK_EVT_MODE_ONESHOT:
@@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode,
206 break; 206 break;
207 207
208 case CLOCK_EVT_MODE_RESUME: 208 case CLOCK_EVT_MODE_RESUME:
209 s5p_timer_resume(); 209 samsung_timer_resume();
210 break; 210 break;
211 } 211 }
212} 212}
213 213
214static void s5p_timer_resume(void) 214static void samsung_timer_resume(void)
215{ 215{
216 /* event timer restart */ 216 /* event timer restart */
217 s5p_time_setup(timer_source.event_id, clock_count_per_tick); 217 samsung_time_setup(timer_source.event_id, clock_count_per_tick);
218 s5p_time_start(timer_source.event_id, PERIODIC); 218 samsung_time_start(timer_source.event_id, PERIODIC);
219 219
220 /* source timer restart */ 220 /* source timer restart */
221 s5p_time_setup(timer_source.source_id, TCNT_MAX); 221 samsung_time_setup(timer_source.source_id, TCNT_MAX);
222 s5p_time_start(timer_source.source_id, PERIODIC); 222 samsung_time_start(timer_source.source_id, PERIODIC);
223} 223}
224 224
225void __init s5p_set_timer_source(enum s5p_timer_mode event, 225void __init samsung_set_timer_source(enum samsung_timer_mode event,
226 enum s5p_timer_mode source) 226 enum samsung_timer_mode source)
227{ 227{
228 s3c_device_timer[event].dev.bus = &platform_bus_type; 228 s3c_device_timer[event].dev.bus = &platform_bus_type;
229 s3c_device_timer[source].dev.bus = &platform_bus_type; 229 s3c_device_timer[source].dev.bus = &platform_bus_type;
@@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode event,
233} 233}
234 234
235static struct clock_event_device time_event_device = { 235static struct clock_event_device time_event_device = {
236 .name = "s5p_event_timer", 236 .name = "samsung_event_timer",
237 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 237 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
238 .rating = 200, 238 .rating = 200,
239 .set_next_event = s5p_set_next_event, 239 .set_next_event = samsung_set_next_event,
240 .set_mode = s5p_set_mode, 240 .set_mode = samsung_set_mode,
241}; 241};
242 242
243static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id) 243static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id)
244{ 244{
245 struct clock_event_device *evt = dev_id; 245 struct clock_event_device *evt = dev_id;
246 246
@@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id)
249 return IRQ_HANDLED; 249 return IRQ_HANDLED;
250} 250}
251 251
252static struct irqaction s5p_clock_event_irq = { 252static struct irqaction samsung_clock_event_irq = {
253 .name = "s5p_time_irq", 253 .name = "samsung_time_irq",
254 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 254 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
255 .handler = s5p_clock_event_isr, 255 .handler = samsung_clock_event_isr,
256 .dev_id = &time_event_device, 256 .dev_id = &time_event_device,
257}; 257};
258 258
259static void __init s5p_clockevent_init(void) 259static void __init samsung_clockevent_init(void)
260{ 260{
261 unsigned long pclk; 261 unsigned long pclk;
262 unsigned long clock_rate; 262 unsigned long clock_rate;
@@ -267,8 +267,8 @@ static void __init s5p_clockevent_init(void)
267 267
268 tscaler = clk_get_parent(tdiv_event); 268 tscaler = clk_get_parent(tdiv_event);
269 269
270 clk_set_rate(tscaler, pclk / 2); 270 clk_set_rate(tscaler, pclk / TSCALER_DIV);
271 clk_set_rate(tdiv_event, pclk / 2); 271 clk_set_rate(tdiv_event, pclk / TDIV);
272 clk_set_parent(tin_event, tdiv_event); 272 clk_set_parent(tin_event, tdiv_event);
273 273
274 clock_rate = clk_get_rate(tin_event); 274 clock_rate = clk_get_rate(tin_event);
@@ -278,22 +278,22 @@ static void __init s5p_clockevent_init(void)
278 clockevents_config_and_register(&time_event_device, clock_rate, 1, -1); 278 clockevents_config_and_register(&time_event_device, clock_rate, 1, -1);
279 279
280 irq_number = timer_source.event_id + IRQ_TIMER0; 280 irq_number = timer_source.event_id + IRQ_TIMER0;
281 setup_irq(irq_number, &s5p_clock_event_irq); 281 setup_irq(irq_number, &samsung_clock_event_irq);
282} 282}
283 283
284static void __iomem *s5p_timer_reg(void) 284static void __iomem *samsung_timer_reg(void)
285{ 285{
286 unsigned long offset = 0; 286 unsigned long offset = 0;
287 287
288 switch (timer_source.source_id) { 288 switch (timer_source.source_id) {
289 case S5P_PWM0: 289 case SAMSUNG_PWM0:
290 case S5P_PWM1: 290 case SAMSUNG_PWM1:
291 case S5P_PWM2: 291 case SAMSUNG_PWM2:
292 case S5P_PWM3: 292 case SAMSUNG_PWM3:
293 offset = (timer_source.source_id * 0x0c) + 0x14; 293 offset = (timer_source.source_id * 0x0c) + 0x14;
294 break; 294 break;
295 295
296 case S5P_PWM4: 296 case SAMSUNG_PWM4:
297 offset = 0x40; 297 offset = 0x40;
298 break; 298 break;
299 299
@@ -312,9 +312,9 @@ static void __iomem *s5p_timer_reg(void)
312 * this wraps around for now, since it is just a relative time 312 * this wraps around for now, since it is just a relative time
313 * stamp. (Inspired by U300 implementation.) 313 * stamp. (Inspired by U300 implementation.)
314 */ 314 */
315static u32 notrace s5p_read_sched_clock(void) 315static u32 notrace samsung_read_sched_clock(void)
316{ 316{
317 void __iomem *reg = s5p_timer_reg(); 317 void __iomem *reg = samsung_timer_reg();
318 318
319 if (!reg) 319 if (!reg)
320 return 0; 320 return 0;
@@ -322,29 +322,29 @@ static u32 notrace s5p_read_sched_clock(void)
322 return ~__raw_readl(reg); 322 return ~__raw_readl(reg);
323} 323}
324 324
325static void __init s5p_clocksource_init(void) 325static void __init samsung_clocksource_init(void)
326{ 326{
327 unsigned long pclk; 327 unsigned long pclk;
328 unsigned long clock_rate; 328 unsigned long clock_rate;
329 329
330 pclk = clk_get_rate(timerclk); 330 pclk = clk_get_rate(timerclk);
331 331
332 clk_set_rate(tdiv_source, pclk / 2); 332 clk_set_rate(tdiv_source, pclk / TDIV);
333 clk_set_parent(tin_source, tdiv_source); 333 clk_set_parent(tin_source, tdiv_source);
334 334
335 clock_rate = clk_get_rate(tin_source); 335 clock_rate = clk_get_rate(tin_source);
336 336
337 s5p_time_setup(timer_source.source_id, TCNT_MAX); 337 samsung_time_setup(timer_source.source_id, TCNT_MAX);
338 s5p_time_start(timer_source.source_id, PERIODIC); 338 samsung_time_start(timer_source.source_id, PERIODIC);
339 339
340 setup_sched_clock(s5p_read_sched_clock, 32, clock_rate); 340 setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate);
341 341
342 if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer", 342 if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer",
343 clock_rate, 250, 32, clocksource_mmio_readl_down)) 343 clock_rate, 250, TSIZE, clocksource_mmio_readl_down))
344 panic("s5p_clocksource_timer: can't register clocksource\n"); 344 panic("samsung_clocksource_timer: can't register clocksource\n");
345} 345}
346 346
347static void __init s5p_timer_resources(void) 347static void __init samsung_timer_resources(void)
348{ 348{
349 349
350 unsigned long event_id = timer_source.event_id; 350 unsigned long event_id = timer_source.event_id;
@@ -386,9 +386,9 @@ static void __init s5p_timer_resources(void)
386 clk_enable(tin_source); 386 clk_enable(tin_source);
387} 387}
388 388
389void __init s5p_timer_init(void) 389void __init samsung_timer_init(void)
390{ 390{
391 s5p_timer_resources(); 391 samsung_timer_resources();
392 s5p_clockevent_init(); 392 samsung_clockevent_init();
393 s5p_clocksource_init(); 393 samsung_clocksource_init();
394} 394}
diff --git a/arch/arm/plat-samsung/setup-mipiphy.c b/arch/arm/plat-samsung/setup-mipiphy.c
index 147459327601..66df315990a7 100644
--- a/arch/arm/plat-samsung/setup-mipiphy.c
+++ b/arch/arm/plat-samsung/setup-mipiphy.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/export.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
13#include <linux/io.h> 14#include <linux/io.h>
@@ -50,8 +51,10 @@ int s5p_csis_phy_enable(int id, bool on)
50{ 51{
51 return __s5p_mipi_phy_control(id, on, S5P_MIPI_DPHY_SRESETN); 52 return __s5p_mipi_phy_control(id, on, S5P_MIPI_DPHY_SRESETN);
52} 53}
54EXPORT_SYMBOL(s5p_csis_phy_enable);
53 55
54int s5p_dsim_phy_enable(struct platform_device *pdev, bool on) 56int s5p_dsim_phy_enable(struct platform_device *pdev, bool on)
55{ 57{
56 return __s5p_mipi_phy_control(pdev->id, on, S5P_MIPI_DPHY_MRESETN); 58 return __s5p_mipi_phy_control(pdev->id, on, S5P_MIPI_DPHY_MRESETN);
57} 59}
60EXPORT_SYMBOL(s5p_dsim_phy_enable);
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
deleted file mode 100644
index 73defd00c3e4..000000000000
--- a/arch/arm/plat-samsung/time.c
+++ /dev/null
@@ -1,287 +0,0 @@
1/* linux/arch/arm/plat-samsung/time.c
2 *
3 * Copyright (C) 2003-2005 Simtec Electronics
4 * Ben Dooks, <ben@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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/sched.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/irq.h>
26#include <linux/err.h>
27#include <linux/clk.h>
28#include <linux/io.h>
29#include <linux/platform_device.h>
30#include <linux/syscore_ops.h>
31
32#include <asm/mach-types.h>
33
34#include <asm/irq.h>
35#include <mach/map.h>
36#include <plat/regs-timer.h>
37#include <mach/regs-irq.h>
38#include <asm/mach/time.h>
39#include <mach/tick.h>
40
41#include <plat/clock.h>
42#include <plat/cpu.h>
43
44static unsigned long timer_startval;
45static unsigned long timer_usec_ticks;
46
47#ifndef TICK_MAX
48#define TICK_MAX (0xffff)
49#endif
50
51#define TIMER_USEC_SHIFT 16
52
53/* we use the shifted arithmetic to work out the ratio of timer ticks
54 * to usecs, as often the peripheral clock is not a nice even multiple
55 * of 1MHz.
56 *
57 * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok
58 * for the current HZ value of 200 without producing overflows.
59 *
60 * Original patch by Dimitry Andric, updated by Ben Dooks
61*/
62
63
64/* timer_mask_usec_ticks
65 *
66 * given a clock and divisor, make the value to pass into timer_ticks_to_usec
67 * to scale the ticks into usecs
68*/
69
70static inline unsigned long
71timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
72{
73 unsigned long den = pclk / 1000;
74
75 return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
76}
77
78/* timer_ticks_to_usec
79 *
80 * convert timer ticks to usec.
81*/
82
83static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
84{
85 unsigned long res;
86
87 res = ticks * timer_usec_ticks;
88 res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */
89
90 return res >> TIMER_USEC_SHIFT;
91}
92
93/***
94 * Returns microsecond since last clock interrupt. Note that interrupts
95 * will have been disabled by do_gettimeoffset()
96 * IRQs are disabled before entering here from do_gettimeofday()
97 */
98
99static u32 s3c2410_gettimeoffset(void)
100{
101 unsigned long tdone;
102 unsigned long tval;
103
104 /* work out how many ticks have gone since last timer interrupt */
105
106 tval = __raw_readl(S3C2410_TCNTO(4));
107 tdone = timer_startval - tval;
108
109 /* check to see if there is an interrupt pending */
110
111 if (s3c24xx_ostimer_pending()) {
112 /* re-read the timer, and try and fix up for the missed
113 * interrupt. Note, the interrupt may go off before the
114 * timer has re-loaded from wrapping.
115 */
116
117 tval = __raw_readl(S3C2410_TCNTO(4));
118 tdone = timer_startval - tval;
119
120 if (tval != 0)
121 tdone += timer_startval;
122 }
123
124 return timer_ticks_to_usec(tdone) * 1000;
125}
126
127
128/*
129 * IRQ handler for the timer
130 */
131static irqreturn_t
132s3c2410_timer_interrupt(int irq, void *dev_id)
133{
134 timer_tick();
135 return IRQ_HANDLED;
136}
137
138static struct irqaction s3c2410_timer_irq = {
139 .name = "S3C2410 Timer Tick",
140 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
141 .handler = s3c2410_timer_interrupt,
142};
143
144#define use_tclk1_12() ( \
145 machine_is_bast() || \
146 machine_is_vr1000() || \
147 machine_is_anubis() || \
148 machine_is_osiris())
149
150static struct clk *tin;
151static struct clk *tdiv;
152static struct clk *timerclk;
153
154/*
155 * Set up timer interrupt, and return the current time in seconds.
156 *
157 * Currently we only use timer4, as it is the only timer which has no
158 * other function that can be exploited externally
159 */
160static void s3c2410_timer_setup (void)
161{
162 unsigned long tcon;
163 unsigned long tcnt;
164 unsigned long tcfg1;
165 unsigned long tcfg0;
166
167 tcnt = TICK_MAX; /* default value for tcnt */
168
169 /* configure the system for whichever machine is in use */
170
171 if (use_tclk1_12()) {
172 /* timer is at 12MHz, scaler is 1 */
173 timer_usec_ticks = timer_mask_usec_ticks(1, 12000000);
174 tcnt = 12000000 / HZ;
175
176 tcfg1 = __raw_readl(S3C2410_TCFG1);
177 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
178 tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
179 __raw_writel(tcfg1, S3C2410_TCFG1);
180 } else {
181 unsigned long pclk;
182 struct clk *tscaler;
183
184 /* for the h1940 (and others), we use the pclk from the core
185 * to generate the timer values. since values around 50 to
186 * 70MHz are not values we can directly generate the timer
187 * value from, we need to pre-scale and divide before using it.
188 *
189 * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz
190 * (8.45 ticks per usec)
191 */
192
193 pclk = clk_get_rate(timerclk);
194
195 /* configure clock tick */
196
197 timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
198
199 tscaler = clk_get_parent(tdiv);
200
201 clk_set_rate(tscaler, pclk / 3);
202 clk_set_rate(tdiv, pclk / 6);
203 clk_set_parent(tin, tdiv);
204
205 tcnt = clk_get_rate(tin) / HZ;
206 }
207
208 tcon = __raw_readl(S3C2410_TCON);
209 tcfg0 = __raw_readl(S3C2410_TCFG0);
210 tcfg1 = __raw_readl(S3C2410_TCFG1);
211
212 /* timers reload after counting zero, so reduce the count by 1 */
213
214 tcnt--;
215
216 printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
217 tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
218
219 /* check to see if timer is within 16bit range... */
220 if (tcnt > TICK_MAX) {
221 panic("setup_timer: HZ is too small, cannot configure timer!");
222 return;
223 }
224
225 __raw_writel(tcfg1, S3C2410_TCFG1);
226 __raw_writel(tcfg0, S3C2410_TCFG0);
227
228 timer_startval = tcnt;
229 __raw_writel(tcnt, S3C2410_TCNTB(4));
230
231 /* ensure timer is stopped... */
232
233 tcon &= ~(7<<20);
234 tcon |= S3C2410_TCON_T4RELOAD;
235 tcon |= S3C2410_TCON_T4MANUALUPD;
236
237 __raw_writel(tcon, S3C2410_TCON);
238 __raw_writel(tcnt, S3C2410_TCNTB(4));
239 __raw_writel(tcnt, S3C2410_TCMPB(4));
240
241 /* start the timer running */
242 tcon |= S3C2410_TCON_T4START;
243 tcon &= ~S3C2410_TCON_T4MANUALUPD;
244 __raw_writel(tcon, S3C2410_TCON);
245}
246
247static void __init s3c2410_timer_resources(void)
248{
249 struct platform_device tmpdev;
250
251 tmpdev.dev.bus = &platform_bus_type;
252 tmpdev.id = 4;
253
254 timerclk = clk_get(NULL, "timers");
255 if (IS_ERR(timerclk))
256 panic("failed to get clock for system timer");
257
258 clk_enable(timerclk);
259
260 if (!use_tclk1_12()) {
261 tmpdev.id = 4;
262 tmpdev.dev.init_name = "s3c24xx-pwm.4";
263 tin = clk_get(&tmpdev.dev, "pwm-tin");
264 if (IS_ERR(tin))
265 panic("failed to get pwm-tin clock for system timer");
266
267 tdiv = clk_get(&tmpdev.dev, "pwm-tdiv");
268 if (IS_ERR(tdiv))
269 panic("failed to get pwm-tdiv clock for system timer");
270 }
271
272 clk_enable(tin);
273}
274
275static struct syscore_ops s3c24xx_syscore_ops = {
276 .resume = s3c2410_timer_setup,
277};
278
279void __init s3c24xx_timer_init(void)
280{
281 arch_gettimeoffset = s3c2410_gettimeoffset;
282
283 s3c2410_timer_resources();
284 s3c2410_timer_setup();
285 setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
286 register_syscore_ops(&s3c24xx_syscore_ops);
287}
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig
deleted file mode 100644
index 8a08c31b5e20..000000000000
--- a/arch/arm/plat-spear/Kconfig
+++ /dev/null
@@ -1,47 +0,0 @@
1#
2# SPEAr Platform configuration file
3#
4
5if PLAT_SPEAR
6
7choice
8 prompt "ST SPEAr Family"
9 default ARCH_SPEAR3XX
10
11config ARCH_SPEAR13XX
12 bool "ST SPEAr13xx with Device Tree"
13 select ARCH_HAS_CPUFREQ
14 select ARM_GIC
15 select CPU_V7
16 select GPIO_SPEAR_SPICS
17 select HAVE_SMP
18 select MIGHT_HAVE_CACHE_L2X0
19 select PINCTRL
20 select USE_OF
21 help
22 Supports for ARM's SPEAR13XX family
23
24config ARCH_SPEAR3XX
25 bool "ST SPEAr3xx with Device Tree"
26 select ARM_VIC
27 select CPU_ARM926T
28 select PINCTRL
29 select USE_OF
30 help
31 Supports for ARM's SPEAR3XX family
32
33config ARCH_SPEAR6XX
34 bool "SPEAr6XX"
35 select ARM_VIC
36 select CPU_ARM926T
37 help
38 Supports for ARM's SPEAR6XX family
39
40endchoice
41
42# Adding SPEAr machine specific configuration files
43source "arch/arm/mach-spear13xx/Kconfig"
44source "arch/arm/mach-spear3xx/Kconfig"
45source "arch/arm/mach-spear6xx/Kconfig"
46
47endif
diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile
deleted file mode 100644
index 01e88532a5db..000000000000
--- a/arch/arm/plat-spear/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1#
2# SPEAr Platform specific Makefile
3#
4
5# Common support
6obj-y := restart.o time.o
7
8obj-$(CONFIG_ARCH_SPEAR3XX) += pl080.o
9obj-$(CONFIG_ARCH_SPEAR6XX) += pl080.o
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index f2ac15561778..1e1b2d769748 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -14,7 +14,6 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/jiffies.h> 15#include <linux/jiffies.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/irqchip/arm-gic.h>
18 17
19#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
20#include <asm/smp_plat.h> 19#include <asm/smp_plat.h>
@@ -37,13 +36,6 @@ static DEFINE_SPINLOCK(boot_lock);
37void __cpuinit versatile_secondary_init(unsigned int cpu) 36void __cpuinit versatile_secondary_init(unsigned int cpu)
38{ 37{
39 /* 38 /*
40 * if any interrupts are already enabled for the primary
41 * core (e.g. timer irq), then they will not have been enabled
42 * for us: do so
43 */
44 gic_secondary_init(0);
45
46 /*
47 * let the primary processor know we're out of the 39 * let the primary processor know we're out of the
48 * pen, then head off into the C entry point 40 * pen, then head off into the C entry point
49 */ 41 */
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 831e1fdfdb2f..a10297da122b 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -16,7 +16,7 @@
16# are merged into mainline or have been edited in the machine database 16# are merged into mainline or have been edited in the machine database
17# within the last 12 months. References to machine_is_NAME() do not count! 17# within the last 12 months. References to machine_is_NAME() do not count!
18# 18#
19# Last update: Thu Apr 26 08:44:23 2012 19# Last update: Fri Mar 22 17:24:50 2013
20# 20#
21# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 21# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
22# 22#
@@ -64,8 +64,8 @@ h7201 ARCH_H7201 H7201 161
64h7202 ARCH_H7202 H7202 162 64h7202 ARCH_H7202 H7202 162
65iq80321 ARCH_IQ80321 IQ80321 169 65iq80321 ARCH_IQ80321 IQ80321 169
66ks8695 ARCH_KS8695 KS8695 180 66ks8695 ARCH_KS8695 KS8695 180
67karo ARCH_KARO KARO 190
68smdk2410 ARCH_SMDK2410 SMDK2410 193 67smdk2410 ARCH_SMDK2410 SMDK2410 193
68ceiva ARCH_CEIVA CEIVA 200
69voiceblue MACH_VOICEBLUE VOICEBLUE 218 69voiceblue MACH_VOICEBLUE VOICEBLUE 218
70h5400 ARCH_H5400 H5400 220 70h5400 ARCH_H5400 H5400 220
71omap_innovator MACH_OMAP_INNOVATOR OMAP_INNOVATOR 234 71omap_innovator MACH_OMAP_INNOVATOR OMAP_INNOVATOR 234
@@ -95,6 +95,7 @@ lpd7a400 MACH_LPD7A400 LPD7A400 389
95lpd7a404 MACH_LPD7A404 LPD7A404 390 95lpd7a404 MACH_LPD7A404 LPD7A404 390
96csb337 MACH_CSB337 CSB337 399 96csb337 MACH_CSB337 CSB337 399
97mainstone MACH_MAINSTONE MAINSTONE 406 97mainstone MACH_MAINSTONE MAINSTONE 406
98lite300 MACH_LITE300 LITE300 408
98xcep MACH_XCEP XCEP 413 99xcep MACH_XCEP XCEP 413
99arcom_vulcan MACH_ARCOM_VULCAN ARCOM_VULCAN 414 100arcom_vulcan MACH_ARCOM_VULCAN ARCOM_VULCAN 414
100nomadik MACH_NOMADIK NOMADIK 420 101nomadik MACH_NOMADIK NOMADIK 420
@@ -131,12 +132,14 @@ kb9200 MACH_KB9200 KB9200 612
131sx1 MACH_SX1 SX1 613 132sx1 MACH_SX1 SX1 613
132ixdp465 MACH_IXDP465 IXDP465 618 133ixdp465 MACH_IXDP465 IXDP465 618
133ixdp2351 MACH_IXDP2351 IXDP2351 619 134ixdp2351 MACH_IXDP2351 IXDP2351 619
135cm4008 MACH_CM4008 CM4008 624
134iq80332 MACH_IQ80332 IQ80332 629 136iq80332 MACH_IQ80332 IQ80332 629
135gtwx5715 MACH_GTWX5715 GTWX5715 641 137gtwx5715 MACH_GTWX5715 GTWX5715 641
136csb637 MACH_CSB637 CSB637 648 138csb637 MACH_CSB637 CSB637 648
137n30 MACH_N30 N30 656 139n30 MACH_N30 N30 656
138nec_mp900 MACH_NEC_MP900 NEC_MP900 659 140nec_mp900 MACH_NEC_MP900 NEC_MP900 659
139kafa MACH_KAFA KAFA 662 141kafa MACH_KAFA KAFA 662
142cm41xx MACH_CM41XX CM41XX 672
140ts72xx MACH_TS72XX TS72XX 673 143ts72xx MACH_TS72XX TS72XX 673
141otom MACH_OTOM OTOM 680 144otom MACH_OTOM OTOM 680
142nexcoder_2440 MACH_NEXCODER_2440 NEXCODER_2440 681 145nexcoder_2440 MACH_NEXCODER_2440 NEXCODER_2440 681
@@ -149,6 +152,7 @@ colibri MACH_COLIBRI COLIBRI 729
149gateway7001 MACH_GATEWAY7001 GATEWAY7001 731 152gateway7001 MACH_GATEWAY7001 GATEWAY7001 731
150pcm027 MACH_PCM027 PCM027 732 153pcm027 MACH_PCM027 PCM027 732
151anubis MACH_ANUBIS ANUBIS 734 154anubis MACH_ANUBIS ANUBIS 734
155xboardgp8 MACH_XBOARDGP8 XBOARDGP8 742
152akita MACH_AKITA AKITA 744 156akita MACH_AKITA AKITA 744
153e330 MACH_E330 E330 753 157e330 MACH_E330 E330 753
154nokia770 MACH_NOKIA770 NOKIA770 755 158nokia770 MACH_NOKIA770 NOKIA770 755
@@ -157,9 +161,11 @@ edb9315a MACH_EDB9315A EDB9315A 772
157stargate2 MACH_STARGATE2 STARGATE2 774 161stargate2 MACH_STARGATE2 STARGATE2 774
158intelmote2 MACH_INTELMOTE2 INTELMOTE2 775 162intelmote2 MACH_INTELMOTE2 INTELMOTE2 775
159trizeps4 MACH_TRIZEPS4 TRIZEPS4 776 163trizeps4 MACH_TRIZEPS4 TRIZEPS4 776
164pnx4008 MACH_PNX4008 PNX4008 782
160cpuat91 MACH_CPUAT91 CPUAT91 787 165cpuat91 MACH_CPUAT91 CPUAT91 787
161iq81340sc MACH_IQ81340SC IQ81340SC 799 166iq81340sc MACH_IQ81340SC IQ81340SC 799
162iq81340mc MACH_IQ81340MC IQ81340MC 801 167iq81340mc MACH_IQ81340MC IQ81340MC 801
168se4200 MACH_SE4200 SE4200 809
163micro9 MACH_MICRO9 MICRO9 811 169micro9 MACH_MICRO9 MICRO9 811
164micro9l MACH_MICRO9L MICRO9L 812 170micro9l MACH_MICRO9L MICRO9L 812
165omap_palmte MACH_OMAP_PALMTE OMAP_PALMTE 817 171omap_palmte MACH_OMAP_PALMTE OMAP_PALMTE 817
@@ -178,6 +184,7 @@ mx21ads MACH_MX21ADS MX21ADS 851
178ams_delta MACH_AMS_DELTA AMS_DELTA 862 184ams_delta MACH_AMS_DELTA AMS_DELTA 862
179nas100d MACH_NAS100D NAS100D 865 185nas100d MACH_NAS100D NAS100D 865
180magician MACH_MAGICIAN MAGICIAN 875 186magician MACH_MAGICIAN MAGICIAN 875
187cm4002 MACH_CM4002 CM4002 876
181nxdkn MACH_NXDKN NXDKN 880 188nxdkn MACH_NXDKN NXDKN 880
182palmtx MACH_PALMTX PALMTX 885 189palmtx MACH_PALMTX PALMTX 885
183s3c2413 MACH_S3C2413 S3C2413 887 190s3c2413 MACH_S3C2413 S3C2413 887
@@ -203,7 +210,6 @@ omap_fsample MACH_OMAP_FSAMPLE OMAP_FSAMPLE 970
203snapper_cl15 MACH_SNAPPER_CL15 SNAPPER_CL15 986 210snapper_cl15 MACH_SNAPPER_CL15 SNAPPER_CL15 986
204omap_palmz71 MACH_OMAP_PALMZ71 OMAP_PALMZ71 993 211omap_palmz71 MACH_OMAP_PALMZ71 OMAP_PALMZ71 993
205smdk2412 MACH_SMDK2412 SMDK2412 1009 212smdk2412 MACH_SMDK2412 SMDK2412 1009
206bkde303 MACH_BKDE303 BKDE303 1021
207smdk2413 MACH_SMDK2413 SMDK2413 1022 213smdk2413 MACH_SMDK2413 SMDK2413 1022
208aml_m5900 MACH_AML_M5900 AML_M5900 1024 214aml_m5900 MACH_AML_M5900 AML_M5900 1024
209balloon3 MACH_BALLOON3 BALLOON3 1029 215balloon3 MACH_BALLOON3 BALLOON3 1029
@@ -214,6 +220,7 @@ fsg MACH_FSG FSG 1091
214at91sam9260ek MACH_AT91SAM9260EK AT91SAM9260EK 1099 220at91sam9260ek MACH_AT91SAM9260EK AT91SAM9260EK 1099
215glantank MACH_GLANTANK GLANTANK 1100 221glantank MACH_GLANTANK GLANTANK 1100
216n2100 MACH_N2100 N2100 1101 222n2100 MACH_N2100 N2100 1101
223im42xx MACH_IM42XX IM42XX 1105
217qt2410 MACH_QT2410 QT2410 1108 224qt2410 MACH_QT2410 QT2410 1108
218kixrp435 MACH_KIXRP435 KIXRP435 1109 225kixrp435 MACH_KIXRP435 KIXRP435 1109
219cc9p9360dev MACH_CC9P9360DEV CC9P9360DEV 1114 226cc9p9360dev MACH_CC9P9360DEV CC9P9360DEV 1114
@@ -247,6 +254,7 @@ csb726 MACH_CSB726 CSB726 1359
247davinci_dm6467_evm MACH_DAVINCI_DM6467_EVM DAVINCI_DM6467_EVM 1380 254davinci_dm6467_evm MACH_DAVINCI_DM6467_EVM DAVINCI_DM6467_EVM 1380
248davinci_dm355_evm MACH_DAVINCI_DM355_EVM DAVINCI_DM355_EVM 1381 255davinci_dm355_evm MACH_DAVINCI_DM355_EVM DAVINCI_DM355_EVM 1381
249littleton MACH_LITTLETON LITTLETON 1388 256littleton MACH_LITTLETON LITTLETON 1388
257im4004 MACH_IM4004 IM4004 1400
250realview_pb11mp MACH_REALVIEW_PB11MP REALVIEW_PB11MP 1407 258realview_pb11mp MACH_REALVIEW_PB11MP REALVIEW_PB11MP 1407
251mx27_3ds MACH_MX27_3DS MX27_3DS 1430 259mx27_3ds MACH_MX27_3DS MX27_3DS 1430
252halibut MACH_HALIBUT HALIBUT 1439 260halibut MACH_HALIBUT HALIBUT 1439
@@ -268,6 +276,7 @@ dns323 MACH_DNS323 DNS323 1542
268omap3_beagle MACH_OMAP3_BEAGLE OMAP3_BEAGLE 1546 276omap3_beagle MACH_OMAP3_BEAGLE OMAP3_BEAGLE 1546
269nokia_n810 MACH_NOKIA_N810 NOKIA_N810 1548 277nokia_n810 MACH_NOKIA_N810 NOKIA_N810 1548
270pcm038 MACH_PCM038 PCM038 1551 278pcm038 MACH_PCM038 PCM038 1551
279sg310 MACH_SG310 SG310 1564
271ts209 MACH_TS209 TS209 1565 280ts209 MACH_TS209 TS209 1565
272at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566 281at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
273mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574 282mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
@@ -371,7 +380,6 @@ pcm043 MACH_PCM043 PCM043 2072
371sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097 380sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097
372avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104 381avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104
373mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125 382mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125
374tx37 MACH_TX37 TX37 2127
375rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135 383rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135
376dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138 384dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138
377ts219 MACH_TS219 TS219 2139 385ts219 MACH_TS219 TS219 2139
@@ -380,12 +388,12 @@ davinci_da850_evm MACH_DAVINCI_DA850_EVM DAVINCI_DA850_EVM 2157
380at91sam9g10ek MACH_AT91SAM9G10EK AT91SAM9G10EK 2159 388at91sam9g10ek MACH_AT91SAM9G10EK AT91SAM9G10EK 2159
381omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160 389omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160
382magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162 390magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162
383tx25 MACH_TX25 TX25 2177
384omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178 391omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178
385anw6410 MACH_ANW6410 ANW6410 2183 392anw6410 MACH_ANW6410 ANW6410 2183
386imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187 393imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187
387portuxg20 MACH_PORTUXG20 PORTUXG20 2191 394portuxg20 MACH_PORTUXG20 PORTUXG20 2191
388smdkc110 MACH_SMDKC110 SMDKC110 2193 395smdkc110 MACH_SMDKC110 SMDKC110 2193
396cabespresso MACH_CABESPRESSO CABESPRESSO 2194
389omap3517evm MACH_OMAP3517EVM OMAP3517EVM 2200 397omap3517evm MACH_OMAP3517EVM OMAP3517EVM 2200
390netspace_v2 MACH_NETSPACE_V2 NETSPACE_V2 2201 398netspace_v2 MACH_NETSPACE_V2 NETSPACE_V2 2201
391netspace_max_v2 MACH_NETSPACE_MAX_V2 NETSPACE_MAX_V2 2202 399netspace_max_v2 MACH_NETSPACE_MAX_V2 NETSPACE_MAX_V2 2202
@@ -404,6 +412,7 @@ bigdisk MACH_BIGDISK BIGDISK 2283
404at91sam9g20ek_2mmc MACH_AT91SAM9G20EK_2MMC AT91SAM9G20EK_2MMC 2288 412at91sam9g20ek_2mmc MACH_AT91SAM9G20EK_2MMC AT91SAM9G20EK_2MMC 2288
405bcmring MACH_BCMRING BCMRING 2289 413bcmring MACH_BCMRING BCMRING 2289
406mahimahi MACH_MAHIMAHI MAHIMAHI 2304 414mahimahi MACH_MAHIMAHI MAHIMAHI 2304
415cerebric MACH_CEREBRIC CEREBRIC 2311
407smdk6442 MACH_SMDK6442 SMDK6442 2324 416smdk6442 MACH_SMDK6442 SMDK6442 2324
408openrd_base MACH_OPENRD_BASE OPENRD_BASE 2325 417openrd_base MACH_OPENRD_BASE OPENRD_BASE 2325
409devkit8000 MACH_DEVKIT8000 DEVKIT8000 2330 418devkit8000 MACH_DEVKIT8000 DEVKIT8000 2330
@@ -423,10 +432,10 @@ raumfeld_rc MACH_RAUMFELD_RC RAUMFELD_RC 2413
423raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414 432raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414
424raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415 433raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415
425tnetv107x MACH_TNETV107X TNETV107X 2418 434tnetv107x MACH_TNETV107X TNETV107X 2418
426mx51_m2id MACH_MX51_M2ID MX51_M2ID 2428
427smdkv210 MACH_SMDKV210 SMDKV210 2456 435smdkv210 MACH_SMDKV210 SMDKV210 2456
428omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464 436omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464
429omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465 437omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465
438cybook2440 MACH_CYBOOK2440 CYBOOK2440 2466
430smartq7 MACH_SMARTQ7 SMARTQ7 2479 439smartq7 MACH_SMARTQ7 SMARTQ7 2479
431watson_efm_plugin MACH_WATSON_EFM_PLUGIN WATSON_EFM_PLUGIN 2491 440watson_efm_plugin MACH_WATSON_EFM_PLUGIN WATSON_EFM_PLUGIN 2491
432g4evm MACH_G4EVM G4EVM 2493 441g4evm MACH_G4EVM G4EVM 2493
@@ -434,12 +443,10 @@ omapl138_hawkboard MACH_OMAPL138_HAWKBOARD OMAPL138_HAWKBOARD 2495
434ts41x MACH_TS41X TS41X 2502 443ts41x MACH_TS41X TS41X 2502
435phy3250 MACH_PHY3250 PHY3250 2511 444phy3250 MACH_PHY3250 PHY3250 2511
436mini6410 MACH_MINI6410 MINI6410 2520 445mini6410 MACH_MINI6410 MINI6410 2520
437tx51 MACH_TX51 TX51 2529
438mx28evk MACH_MX28EVK MX28EVK 2531 446mx28evk MACH_MX28EVK MX28EVK 2531
439smartq5 MACH_SMARTQ5 SMARTQ5 2534 447smartq5 MACH_SMARTQ5 SMARTQ5 2534
440davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548 448davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548
441mxt_td60 MACH_MXT_TD60 MXT_TD60 2550 449mxt_td60 MACH_MXT_TD60 MXT_TD60 2550
442pca101 MACH_PCA101 PCA101 2595
443capc7117 MACH_CAPC7117 CAPC7117 2612 450capc7117 MACH_CAPC7117 CAPC7117 2612
444icontrol MACH_ICONTROL ICONTROL 2624 451icontrol MACH_ICONTROL ICONTROL 2624
445gplugd MACH_GPLUGD GPLUGD 2625 452gplugd MACH_GPLUGD GPLUGD 2625
@@ -465,6 +472,7 @@ igep0030 MACH_IGEP0030 IGEP0030 2717
465sbc3530 MACH_SBC3530 SBC3530 2722 472sbc3530 MACH_SBC3530 SBC3530 2722
466saarb MACH_SAARB SAARB 2727 473saarb MACH_SAARB SAARB 2727
467harmony MACH_HARMONY HARMONY 2731 474harmony MACH_HARMONY HARMONY 2731
475cybook_orizon MACH_CYBOOK_ORIZON CYBOOK_ORIZON 2733
468msm7x30_fluid MACH_MSM7X30_FLUID MSM7X30_FLUID 2741 476msm7x30_fluid MACH_MSM7X30_FLUID MSM7X30_FLUID 2741
469cm_t3517 MACH_CM_T3517 CM_T3517 2750 477cm_t3517 MACH_CM_T3517 CM_T3517 2750
470wbd222 MACH_WBD222 WBD222 2753 478wbd222 MACH_WBD222 WBD222 2753
@@ -480,10 +488,8 @@ eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35SD EUKREA_CPUIMX35SD 2821
480eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822 488eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822
481eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823 489eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823
482smdkc210 MACH_SMDKC210 SMDKC210 2838 490smdkc210 MACH_SMDKC210 SMDKC210 2838
483pcaal1 MACH_PCAAL1 PCAAL1 2843
484t5325 MACH_T5325 T5325 2846 491t5325 MACH_T5325 T5325 2846
485income MACH_INCOME INCOME 2849 492income MACH_INCOME INCOME 2849
486mx257sx MACH_MX257SX MX257SX 2861
487goni MACH_GONI GONI 2862 493goni MACH_GONI GONI 2862
488bv07 MACH_BV07 BV07 2882 494bv07 MACH_BV07 BV07 2882
489openrd_ultimate MACH_OPENRD_ULTIMATE OPENRD_ULTIMATE 2884 495openrd_ultimate MACH_OPENRD_ULTIMATE OPENRD_ULTIMATE 2884
@@ -491,7 +497,6 @@ devixp MACH_DEVIXP DEVIXP 2885
491miccpt MACH_MICCPT MICCPT 2886 497miccpt MACH_MICCPT MICCPT 2886
492mic256 MACH_MIC256 MIC256 2887 498mic256 MACH_MIC256 MIC256 2887
493u5500 MACH_U5500 U5500 2890 499u5500 MACH_U5500 U5500 2890
494pov15hd MACH_POV15HD POV15HD 2910
495linkstation_lschl MACH_LINKSTATION_LSCHL LINKSTATION_LSCHL 2913 500linkstation_lschl MACH_LINKSTATION_LSCHL LINKSTATION_LSCHL 2913
496smdkv310 MACH_SMDKV310 SMDKV310 2925 501smdkv310 MACH_SMDKV310 SMDKV310 2925
497wm8505_7in_netbook MACH_WM8505_7IN_NETBOOK WM8505_7IN_NETBOOK 2928 502wm8505_7in_netbook MACH_WM8505_7IN_NETBOOK WM8505_7IN_NETBOOK 2928
@@ -518,7 +523,6 @@ prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103
518paz00 MACH_PAZ00 PAZ00 3128 523paz00 MACH_PAZ00 PAZ00 3128
519acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129 524acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129
520ag5evm MACH_AG5EVM AG5EVM 3189 525ag5evm MACH_AG5EVM AG5EVM 3189
521tsunagi MACH_TSUNAGI TSUNAGI 3197
522ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 526ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206
523wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 527wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207
524trimslice MACH_TRIMSLICE TRIMSLICE 3209 528trimslice MACH_TRIMSLICE TRIMSLICE 3209
@@ -529,8 +533,6 @@ msm8960_sim MACH_MSM8960_SIM MSM8960_SIM 3230
529msm8960_rumi3 MACH_MSM8960_RUMI3 MSM8960_RUMI3 3231 533msm8960_rumi3 MACH_MSM8960_RUMI3 MSM8960_RUMI3 3231
530gsia18s MACH_GSIA18S GSIA18S 3234 534gsia18s MACH_GSIA18S GSIA18S 3234
531mx53_loco MACH_MX53_LOCO MX53_LOCO 3273 535mx53_loco MACH_MX53_LOCO MX53_LOCO 3273
532tx53 MACH_TX53 TX53 3279
533encore MACH_ENCORE ENCORE 3284
534wario MACH_WARIO WARIO 3288 536wario MACH_WARIO WARIO 3288
535cm_t3730 MACH_CM_T3730 CM_T3730 3290 537cm_t3730 MACH_CM_T3730 CM_T3730 3290
536hrefv60 MACH_HREFV60 HREFV60 3293 538hrefv60 MACH_HREFV60 HREFV60 3293
@@ -538,603 +540,24 @@ armlex4210 MACH_ARMLEX4210 ARMLEX4210 3361
538snowball MACH_SNOWBALL SNOWBALL 3363 540snowball MACH_SNOWBALL SNOWBALL 3363
539xilinx_ep107 MACH_XILINX_EP107 XILINX_EP107 3378 541xilinx_ep107 MACH_XILINX_EP107 XILINX_EP107 3378
540nuri MACH_NURI NURI 3379 542nuri MACH_NURI NURI 3379
541wtplug MACH_WTPLUG WTPLUG 3412
542veridis_a300 MACH_VERIDIS_A300 VERIDIS_A300 3448
543origen MACH_ORIGEN ORIGEN 3455 543origen MACH_ORIGEN ORIGEN 3455
544wm8650refboard MACH_WM8650REFBOARD WM8650REFBOARD 3472
545xarina MACH_XARINA XARINA 3476
546sdvr MACH_SDVR SDVR 3478
547acer_maya MACH_ACER_MAYA ACER_MAYA 3479
548pico MACH_PICO PICO 3480
549cwmx233 MACH_CWMX233 CWMX233 3481
550cwam1808 MACH_CWAM1808 CWAM1808 3482
551cwdm365 MACH_CWDM365 CWDM365 3483
552mx51_moray MACH_MX51_MORAY MX51_MORAY 3484
553thales_cbc MACH_THALES_CBC THALES_CBC 3485
554bluepoint MACH_BLUEPOINT BLUEPOINT 3486
555dir665 MACH_DIR665 DIR665 3487
556acmerover1 MACH_ACMEROVER1 ACMEROVER1 3488
557shooter_ct MACH_SHOOTER_CT SHOOTER_CT 3489
558bliss MACH_BLISS BLISS 3490
559blissc MACH_BLISSC BLISSC 3491
560thales_adc MACH_THALES_ADC THALES_ADC 3492
561ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493
562atdgp318 MACH_ATDGP318 ATDGP318 3494
563dma210u MACH_DMA210U DMA210U 3495
564em_t3 MACH_EM_T3 EM_T3 3496
565htx3250 MACH_HTX3250 HTX3250 3497
566g50 MACH_G50 G50 3498
567eco5 MACH_ECO5 ECO5 3499
568wintergrasp MACH_WINTERGRASP WINTERGRASP 3500
569puro MACH_PURO PURO 3501
570shooter_k MACH_SHOOTER_K SHOOTER_K 3502
571nspire MACH_NSPIRE NSPIRE 3503 544nspire MACH_NSPIRE NSPIRE 3503
572mickxx MACH_MICKXX MICKXX 3504
573lxmb MACH_LXMB LXMB 3505
574adam MACH_ADAM ADAM 3507
575b1004 MACH_B1004 B1004 3508
576oboea MACH_OBOEA OBOEA 3509
577a1015 MACH_A1015 A1015 3510
578robin_vbdt30 MACH_ROBIN_VBDT30 ROBIN_VBDT30 3511
579tegra_enterprise MACH_TEGRA_ENTERPRISE TEGRA_ENTERPRISE 3512
580rfl108200_mk10 MACH_RFL108200_MK10 RFL108200_MK10 3513
581rfl108300_mk16 MACH_RFL108300_MK16 RFL108300_MK16 3514
582rover_v7 MACH_ROVER_V7 ROVER_V7 3515
583miphone MACH_MIPHONE MIPHONE 3516
584femtobts MACH_FEMTOBTS FEMTOBTS 3517
585monopoli MACH_MONOPOLI MONOPOLI 3518
586boss MACH_BOSS BOSS 3519
587davinci_dm368_vtam MACH_DAVINCI_DM368_VTAM DAVINCI_DM368_VTAM 3520
588clcon MACH_CLCON CLCON 3521
589nokia_rm696 MACH_NOKIA_RM696 NOKIA_RM696 3522 545nokia_rm696 MACH_NOKIA_RM696 NOKIA_RM696 3522
590tahiti MACH_TAHITI TAHITI 3523
591fighter MACH_FIGHTER FIGHTER 3524
592sgh_i710 MACH_SGH_I710 SGH_I710 3525
593integreproscb MACH_INTEGREPROSCB INTEGREPROSCB 3526
594monza MACH_MONZA MONZA 3527
595calimain MACH_CALIMAIN CALIMAIN 3528
596mx6q_sabreauto MACH_MX6Q_SABREAUTO MX6Q_SABREAUTO 3529
597gma01x MACH_GMA01X GMA01X 3530
598sbc51 MACH_SBC51 SBC51 3531
599fit MACH_FIT FIT 3532
600steelhead MACH_STEELHEAD STEELHEAD 3533
601panther MACH_PANTHER PANTHER 3534
602msm8960_liquid MACH_MSM8960_LIQUID MSM8960_LIQUID 3535
603lexikonct MACH_LEXIKONCT LEXIKONCT 3536
604ns2816_stb MACH_NS2816_STB NS2816_STB 3537
605sei_mm2_lpc3250 MACH_SEI_MM2_LPC3250 SEI_MM2_LPC3250 3538
606cmimx53 MACH_CMIMX53 CMIMX53 3539
607sandwich MACH_SANDWICH SANDWICH 3540
608chief MACH_CHIEF CHIEF 3541
609pogo_e02 MACH_POGO_E02 POGO_E02 3542
610mikrap_x168 MACH_MIKRAP_X168 MIKRAP_X168 3543 546mikrap_x168 MACH_MIKRAP_X168 MIKRAP_X168 3543
611htcmozart MACH_HTCMOZART HTCMOZART 3544
612htcgold MACH_HTCGOLD HTCGOLD 3545
613mt72xx MACH_MT72XX MT72XX 3546
614mx51_ivy MACH_MX51_IVY MX51_IVY 3547
615mx51_lvd MACH_MX51_LVD MX51_LVD 3548
616omap3_wiser2 MACH_OMAP3_WISER2 OMAP3_WISER2 3549
617dreamplug MACH_DREAMPLUG DREAMPLUG 3550
618cobas_c_111 MACH_COBAS_C_111 COBAS_C_111 3551
619cobas_u_411 MACH_COBAS_U_411 COBAS_U_411 3552
620hssd MACH_HSSD HSSD 3553
621iom35x MACH_IOM35X IOM35X 3554
622psom_omap MACH_PSOM_OMAP PSOM_OMAP 3555
623iphone_2g MACH_IPHONE_2G IPHONE_2G 3556
624iphone_3g MACH_IPHONE_3G IPHONE_3G 3557
625ipod_touch_1g MACH_IPOD_TOUCH_1G IPOD_TOUCH_1G 3558
626pharos_tpc MACH_PHAROS_TPC PHAROS_TPC 3559
627mx53_hydra MACH_MX53_HYDRA MX53_HYDRA 3560
628ns2816_dev_board MACH_NS2816_DEV_BOARD NS2816_DEV_BOARD 3561
629iphone_3gs MACH_IPHONE_3GS IPHONE_3GS 3562
630iphone_4 MACH_IPHONE_4 IPHONE_4 3563
631ipod_touch_4g MACH_IPOD_TOUCH_4G IPOD_TOUCH_4G 3564
632dragon_e1100 MACH_DRAGON_E1100 DRAGON_E1100 3565
633topside MACH_TOPSIDE TOPSIDE 3566
634irisiii MACH_IRISIII IRISIII 3567
635deto_macarm9 MACH_DETO_MACARM9 DETO_MACARM9 3568 547deto_macarm9 MACH_DETO_MACARM9 DETO_MACARM9 3568
636eti_d1 MACH_ETI_D1 ETI_D1 3569
637som3530sdk MACH_SOM3530SDK SOM3530SDK 3570
638oc_engine MACH_OC_ENGINE OC_ENGINE 3571
639apq8064_sim MACH_APQ8064_SIM APQ8064_SIM 3572
640alps MACH_ALPS ALPS 3575
641tny_t3730 MACH_TNY_T3730 TNY_T3730 3576
642geryon_nfe MACH_GERYON_NFE GERYON_NFE 3577
643ns2816_ref_board MACH_NS2816_REF_BOARD NS2816_REF_BOARD 3578
644silverstone MACH_SILVERSTONE SILVERSTONE 3579
645mtt2440 MACH_MTT2440 MTT2440 3580
646ynicdb MACH_YNICDB YNICDB 3581
647bct MACH_BCT BCT 3582
648tuscan MACH_TUSCAN TUSCAN 3583
649xbt_sam9g45 MACH_XBT_SAM9G45 XBT_SAM9G45 3584
650enbw_cmc MACH_ENBW_CMC ENBW_CMC 3585
651ch104mx257 MACH_CH104MX257 CH104MX257 3587
652openpri MACH_OPENPRI OPENPRI 3588
653am335xevm MACH_AM335XEVM AM335XEVM 3589
654picodmb MACH_PICODMB PICODMB 3590
655waluigi MACH_WALUIGI WALUIGI 3591
656punicag7 MACH_PUNICAG7 PUNICAG7 3592
657ipad_1g MACH_IPAD_1G IPAD_1G 3593
658appletv_2g MACH_APPLETV_2G APPLETV_2G 3594
659mach_ecog45 MACH_MACH_ECOG45 MACH_ECOG45 3595
660ait_cam_enc_4xx MACH_AIT_CAM_ENC_4XX AIT_CAM_ENC_4XX 3596
661runnymede MACH_RUNNYMEDE RUNNYMEDE 3597
662play MACH_PLAY PLAY 3598
663hw90260 MACH_HW90260 HW90260 3599
664tagh MACH_TAGH TAGH 3600
665filbert MACH_FILBERT FILBERT 3601
666getinge_netcomv3 MACH_GETINGE_NETCOMV3 GETINGE_NETCOMV3 3602
667cw20 MACH_CW20 CW20 3603
668cinema MACH_CINEMA CINEMA 3604
669cinema_tea MACH_CINEMA_TEA CINEMA_TEA 3605
670cinema_coffee MACH_CINEMA_COFFEE CINEMA_COFFEE 3606
671cinema_juice MACH_CINEMA_JUICE CINEMA_JUICE 3607
672mx53_mirage2 MACH_MX53_MIRAGE2 MX53_MIRAGE2 3609
673mx53_efikasb MACH_MX53_EFIKASB MX53_EFIKASB 3610
674stm_b2000 MACH_STM_B2000 STM_B2000 3612
675m28evk MACH_M28EVK M28EVK 3613 548m28evk MACH_M28EVK M28EVK 3613
676pda MACH_PDA PDA 3614
677meraki_mr58 MACH_MERAKI_MR58 MERAKI_MR58 3615
678kota2 MACH_KOTA2 KOTA2 3616 549kota2 MACH_KOTA2 KOTA2 3616
679letcool MACH_LETCOOL LETCOOL 3617
680mx27iat MACH_MX27IAT MX27IAT 3618
681apollo_td MACH_APOLLO_TD APOLLO_TD 3619
682arena MACH_ARENA ARENA 3620
683gsngateway MACH_GSNGATEWAY GSNGATEWAY 3621
684lf2000 MACH_LF2000 LF2000 3622
685bonito MACH_BONITO BONITO 3623 550bonito MACH_BONITO BONITO 3623
686asymptote MACH_ASYMPTOTE ASYMPTOTE 3624
687bst2brd MACH_BST2BRD BST2BRD 3625
688tx335s MACH_TX335S TX335S 3626
689pelco_tesla MACH_PELCO_TESLA PELCO_TESLA 3627
690rrhtestplat MACH_RRHTESTPLAT RRHTESTPLAT 3628
691vidtonic_pro MACH_VIDTONIC_PRO VIDTONIC_PRO 3629
692pl_apollo MACH_PL_APOLLO PL_APOLLO 3630
693pl_phoenix MACH_PL_PHOENIX PL_PHOENIX 3631
694m28cu3 MACH_M28CU3 M28CU3 3632
695vvbox_hd MACH_VVBOX_HD VVBOX_HD 3633
696coreware_sam9260_ MACH_COREWARE_SAM9260_ COREWARE_SAM9260_ 3634
697marmaduke MACH_MARMADUKE MARMADUKE 3635
698amg_xlcore_camera MACH_AMG_XLCORE_CAMERA AMG_XLCORE_CAMERA 3636
699omap3_egf MACH_OMAP3_EGF OMAP3_EGF 3637 551omap3_egf MACH_OMAP3_EGF OMAP3_EGF 3637
700smdk4212 MACH_SMDK4212 SMDK4212 3638 552smdk4212 MACH_SMDK4212 SMDK4212 3638
701dnp9200 MACH_DNP9200 DNP9200 3639
702tf101 MACH_TF101 TF101 3640
703omap3silvio MACH_OMAP3SILVIO OMAP3SILVIO 3641
704picasso2 MACH_PICASSO2 PICASSO2 3642
705vangogh2 MACH_VANGOGH2 VANGOGH2 3643
706olpc_xo_1_75 MACH_OLPC_XO_1_75 OLPC_XO_1_75 3644
707gx400 MACH_GX400 GX400 3645
708gs300 MACH_GS300 GS300 3646
709acer_a9 MACH_ACER_A9 ACER_A9 3647
710vivow_evm MACH_VIVOW_EVM VIVOW_EVM 3648
711veloce_cxq MACH_VELOCE_CXQ VELOCE_CXQ 3649
712veloce_cxm MACH_VELOCE_CXM VELOCE_CXM 3650
713p1852 MACH_P1852 P1852 3651
714naxy100 MACH_NAXY100 NAXY100 3652
715taishan MACH_TAISHAN TAISHAN 3653
716touchlink MACH_TOUCHLINK TOUCHLINK 3654
717stm32f103ze MACH_STM32F103ZE STM32F103ZE 3655
718mcx MACH_MCX MCX 3656
719stm_nmhdk_fli7610 MACH_STM_NMHDK_FLI7610 STM_NMHDK_FLI7610 3657
720top28x MACH_TOP28X TOP28X 3658
721okl4vp_microvisor MACH_OKL4VP_MICROVISOR OKL4VP_MICROVISOR 3659
722pop MACH_POP POP 3660
723layer MACH_LAYER LAYER 3661
724trondheim MACH_TRONDHEIM TRONDHEIM 3662
725eva MACH_EVA EVA 3663
726trust_taurus MACH_TRUST_TAURUS TRUST_TAURUS 3664
727ns2816_huashan MACH_NS2816_HUASHAN NS2816_HUASHAN 3665
728ns2816_yangcheng MACH_NS2816_YANGCHENG NS2816_YANGCHENG 3666
729p852 MACH_P852 P852 3667
730flea3 MACH_FLEA3 FLEA3 3668
731bowfin MACH_BOWFIN BOWFIN 3669
732mv88de3100 MACH_MV88DE3100 MV88DE3100 3670
733pia_am35x MACH_PIA_AM35X PIA_AM35X 3671
734cedar MACH_CEDAR CEDAR 3672
735picasso_e MACH_PICASSO_E PICASSO_E 3673
736samsung_e60 MACH_SAMSUNG_E60 SAMSUNG_E60 3674
737sdvr_mini MACH_SDVR_MINI SDVR_MINI 3676
738omap3_ij3k MACH_OMAP3_IJ3K OMAP3_IJ3K 3677
739modasmc1 MACH_MODASMC1 MODASMC1 3678
740apq8064_rumi3 MACH_APQ8064_RUMI3 APQ8064_RUMI3 3679
741matrix506 MACH_MATRIX506 MATRIX506 3680
742msm9615_mtp MACH_MSM9615_MTP MSM9615_MTP 3681
743dm36x_spawndc MACH_DM36X_SPAWNDC DM36X_SPAWNDC 3682
744sff792 MACH_SFF792 SFF792 3683
745am335xiaevm MACH_AM335XIAEVM AM335XIAEVM 3684
746g3c2440 MACH_G3C2440 G3C2440 3685
747tion270 MACH_TION270 TION270 3686
748w22q7arm02 MACH_W22Q7ARM02 W22Q7ARM02 3687
749omap_cat MACH_OMAP_CAT OMAP_CAT 3688
750at91sam9n12ek MACH_AT91SAM9N12EK AT91SAM9N12EK 3689
751morrison MACH_MORRISON MORRISON 3690
752svdu MACH_SVDU SVDU 3691
753lpp01 MACH_LPP01 LPP01 3692
754ubc283 MACH_UBC283 UBC283 3693
755zeppelin MACH_ZEPPELIN ZEPPELIN 3694
756motus MACH_MOTUS MOTUS 3695
757neomainboard MACH_NEOMAINBOARD NEOMAINBOARD 3696
758devkit3250 MACH_DEVKIT3250 DEVKIT3250 3697
759devkit7000 MACH_DEVKIT7000 DEVKIT7000 3698
760fmc_uic MACH_FMC_UIC FMC_UIC 3699
761fmc_dcm MACH_FMC_DCM FMC_DCM 3700
762batwm MACH_BATWM BATWM 3701
763atlas6cb MACH_ATLAS6CB ATLAS6CB 3702
764blue MACH_BLUE BLUE 3705
765colorado MACH_COLORADO COLORADO 3706
766popc MACH_POPC POPC 3707
767promwad_jade MACH_PROMWAD_JADE PROMWAD_JADE 3708
768amp MACH_AMP AMP 3709
769gnet_amp MACH_GNET_AMP GNET_AMP 3710
770toques MACH_TOQUES TOQUES 3711
771apx4devkit MACH_APX4DEVKIT APX4DEVKIT 3712 553apx4devkit MACH_APX4DEVKIT APX4DEVKIT 3712
772dct_storm MACH_DCT_STORM DCT_STORM 3713
773owl MACH_OWL OWL 3715
774cogent_csb1741 MACH_COGENT_CSB1741 COGENT_CSB1741 3716
775adillustra610 MACH_ADILLUSTRA610 ADILLUSTRA610 3718
776ecafe_na04 MACH_ECAFE_NA04 ECAFE_NA04 3719
777popct MACH_POPCT POPCT 3720
778omap3_helena MACH_OMAP3_HELENA OMAP3_HELENA 3721
779ach MACH_ACH ACH 3722
780module_dtb MACH_MODULE_DTB MODULE_DTB 3723
781oslo_elisabeth MACH_OSLO_ELISABETH OSLO_ELISABETH 3725
782tt01 MACH_TT01 TT01 3726
783msm8930_cdp MACH_MSM8930_CDP MSM8930_CDP 3727
784msm8930_mtp MACH_MSM8930_MTP MSM8930_MTP 3728
785msm8930_fluid MACH_MSM8930_FLUID MSM8930_FLUID 3729
786ltu11 MACH_LTU11 LTU11 3730
787am1808_spawnco MACH_AM1808_SPAWNCO AM1808_SPAWNCO 3731
788flx6410 MACH_FLX6410 FLX6410 3732
789mx6q_qsb MACH_MX6Q_QSB MX6Q_QSB 3733
790mx53_plt424 MACH_MX53_PLT424 MX53_PLT424 3734
791jasmine MACH_JASMINE JASMINE 3735
792l138_owlboard_plus MACH_L138_OWLBOARD_PLUS L138_OWLBOARD_PLUS 3736
793wr21 MACH_WR21 WR21 3737
794peaboy MACH_PEABOY PEABOY 3739
795mx28_plato MACH_MX28_PLATO MX28_PLATO 3740
796kacom2 MACH_KACOM2 KACOM2 3741
797slco MACH_SLCO SLCO 3742
798imx51pico MACH_IMX51PICO IMX51PICO 3743
799glink1 MACH_GLINK1 GLINK1 3744
800diamond MACH_DIAMOND DIAMOND 3745
801d9000 MACH_D9000 D9000 3746
802w5300e01 MACH_W5300E01 W5300E01 3747
803im6000 MACH_IM6000 IM6000 3748
804mx51_fred51 MACH_MX51_FRED51 MX51_FRED51 3749
805stm32f2 MACH_STM32F2 STM32F2 3750
806ville MACH_VILLE VILLE 3751
807ptip_murnau MACH_PTIP_MURNAU PTIP_MURNAU 3752
808ptip_classic MACH_PTIP_CLASSIC PTIP_CLASSIC 3753
809mx53grb MACH_MX53GRB MX53GRB 3754
810gagarin MACH_GAGARIN GAGARIN 3755
811nas2big MACH_NAS2BIG NAS2BIG 3757
812superfemto MACH_SUPERFEMTO SUPERFEMTO 3758
813teufel MACH_TEUFEL TEUFEL 3759
814dinara MACH_DINARA DINARA 3760
815vanquish MACH_VANQUISH VANQUISH 3761
816zipabox1 MACH_ZIPABOX1 ZIPABOX1 3762
817u9540 MACH_U9540 U9540 3763
818jet MACH_JET JET 3764
819smdk4412 MACH_SMDK4412 SMDK4412 3765 554smdk4412 MACH_SMDK4412 SMDK4412 3765
820elite MACH_ELITE ELITE 3766
821spear320_hmi MACH_SPEAR320_HMI SPEAR320_HMI 3767
822ontario MACH_ONTARIO ONTARIO 3768
823mx6q_sabrelite MACH_MX6Q_SABRELITE MX6Q_SABRELITE 3769
824vc200 MACH_VC200 VC200 3770
825msm7625a_ffa MACH_MSM7625A_FFA MSM7625A_FFA 3771
826msm7625a_surf MACH_MSM7625A_SURF MSM7625A_SURF 3772
827benthossbp MACH_BENTHOSSBP BENTHOSSBP 3773
828smdk5210 MACH_SMDK5210 SMDK5210 3774
829empq2300 MACH_EMPQ2300 EMPQ2300 3775
830minipos MACH_MINIPOS MINIPOS 3776
831omap5_sevm MACH_OMAP5_SEVM OMAP5_SEVM 3777
832shelter MACH_SHELTER SHELTER 3778
833omap3_devkit8500 MACH_OMAP3_DEVKIT8500 OMAP3_DEVKIT8500 3779
834edgetd MACH_EDGETD EDGETD 3780
835copperyard MACH_COPPERYARD COPPERYARD 3781
836edge_u MACH_EDGE_U EDGE_U 3783
837edge_td MACH_EDGE_TD EDGE_TD 3784
838wdss MACH_WDSS WDSS 3785
839dl_pb25 MACH_DL_PB25 DL_PB25 3786
840dss11 MACH_DSS11 DSS11 3787
841cpa MACH_CPA CPA 3788
842aptp2000 MACH_APTP2000 APTP2000 3789
843marzen MACH_MARZEN MARZEN 3790 555marzen MACH_MARZEN MARZEN 3790
844st_turbine MACH_ST_TURBINE ST_TURBINE 3791
845gtl_it3300 MACH_GTL_IT3300 GTL_IT3300 3792
846mx6_mule MACH_MX6_MULE MX6_MULE 3793
847v7pxa_dt MACH_V7PXA_DT V7PXA_DT 3794
848v7mmp_dt MACH_V7MMP_DT V7MMP_DT 3795
849dragon7 MACH_DRAGON7 DRAGON7 3796
850krome MACH_KROME KROME 3797 556krome MACH_KROME KROME 3797
851oratisdante MACH_ORATISDANTE ORATISDANTE 3798
852fathom MACH_FATHOM FATHOM 3799
853dns325 MACH_DNS325 DNS325 3800
854sarnen MACH_SARNEN SARNEN 3801
855ubisys_g1 MACH_UBISYS_G1 UBISYS_G1 3802
856mx53_pf1 MACH_MX53_PF1 MX53_PF1 3803
857asanti MACH_ASANTI ASANTI 3804
858volta MACH_VOLTA VOLTA 3805
859knight MACH_KNIGHT KNIGHT 3807
860beaglebone MACH_BEAGLEBONE BEAGLEBONE 3808
861becker MACH_BECKER BECKER 3809
862fc360 MACH_FC360 FC360 3810
863pmi2_xls MACH_PMI2_XLS PMI2_XLS 3811
864taranto MACH_TARANTO TARANTO 3812
865plutux MACH_PLUTUX PLUTUX 3813
866ipmp_medcom MACH_IPMP_MEDCOM IPMP_MEDCOM 3814
867absolut MACH_ABSOLUT ABSOLUT 3815
868awpb3 MACH_AWPB3 AWPB3 3816
869nfp32xx_dt MACH_NFP32XX_DT NFP32XX_DT 3817
870dl_pb53 MACH_DL_PB53 DL_PB53 3818
871acu_ii MACH_ACU_II ACU_II 3819
872avalon MACH_AVALON AVALON 3820
873sphinx MACH_SPHINX SPHINX 3821
874titan_t MACH_TITAN_T TITAN_T 3822
875harvest_boris MACH_HARVEST_BORIS HARVEST_BORIS 3823
876mach_msm7x30_m3s MACH_MACH_MSM7X30_M3S MACH_MSM7X30_M3S 3824
877smdk5250 MACH_SMDK5250 SMDK5250 3825
878imxt_lite MACH_IMXT_LITE IMXT_LITE 3826
879imxt_std MACH_IMXT_STD IMXT_STD 3827
880imxt_log MACH_IMXT_LOG IMXT_LOG 3828
881imxt_nav MACH_IMXT_NAV IMXT_NAV 3829
882imxt_full MACH_IMXT_FULL IMXT_FULL 3830
883ag09015 MACH_AG09015 AG09015 3831
884am3517_mt_ventoux MACH_AM3517_MT_VENTOUX AM3517_MT_VENTOUX 3832
885dp1arm9 MACH_DP1ARM9 DP1ARM9 3833
886picasso_m MACH_PICASSO_M PICASSO_M 3834
887video_gadget MACH_VIDEO_GADGET VIDEO_GADGET 3835
888mtt_om3x MACH_MTT_OM3X MTT_OM3X 3836
889mx6q_arm2 MACH_MX6Q_ARM2 MX6Q_ARM2 3837
890picosam9g45 MACH_PICOSAM9G45 PICOSAM9G45 3838
891vpm_dm365 MACH_VPM_DM365 VPM_DM365 3839
892bonfire MACH_BONFIRE BONFIRE 3840
893mt2p2d MACH_MT2P2D MT2P2D 3841
894sigpda01 MACH_SIGPDA01 SIGPDA01 3842
895cn27 MACH_CN27 CN27 3843
896mx25_cwtap MACH_MX25_CWTAP MX25_CWTAP 3844
897apf28 MACH_APF28 APF28 3845
898pelco_maxwell MACH_PELCO_MAXWELL PELCO_MAXWELL 3846
899ge_phoenix MACH_GE_PHOENIX GE_PHOENIX 3847
900empc_a500 MACH_EMPC_A500 EMPC_A500 3848
901ims_arm9 MACH_IMS_ARM9 IMS_ARM9 3849
902mini2416 MACH_MINI2416 MINI2416 3850
903mini2450 MACH_MINI2450 MINI2450 3851
904mini310 MACH_MINI310 MINI310 3852
905spear_hurricane MACH_SPEAR_HURRICANE SPEAR_HURRICANE 3853
906mt7208 MACH_MT7208 MT7208 3854
907lpc178x MACH_LPC178X LPC178X 3855
908farleys MACH_FARLEYS FARLEYS 3856
909efm32gg_dk3750 MACH_EFM32GG_DK3750 EFM32GG_DK3750 3857
910zeus_board MACH_ZEUS_BOARD ZEUS_BOARD 3858
911cc51 MACH_CC51 CC51 3859
912fxi_c210 MACH_FXI_C210 FXI_C210 3860
913msm8627_cdp MACH_MSM8627_CDP MSM8627_CDP 3861
914msm8627_mtp MACH_MSM8627_MTP MSM8627_MTP 3862
915armadillo800eva MACH_ARMADILLO800EVA ARMADILLO800EVA 3863 557armadillo800eva MACH_ARMADILLO800EVA ARMADILLO800EVA 3863
916primou MACH_PRIMOU PRIMOU 3864
917primoc MACH_PRIMOC PRIMOC 3865
918primoct MACH_PRIMOCT PRIMOCT 3866
919a9500 MACH_A9500 A9500 3867
920pluto MACH_PLUTO PLUTO 3869
921acfx100 MACH_ACFX100 ACFX100 3870
922msm8625_rumi3 MACH_MSM8625_RUMI3 MSM8625_RUMI3 3871
923valente MACH_VALENTE VALENTE 3872
924crfs_rfeye MACH_CRFS_RFEYE CRFS_RFEYE 3873
925rfeye MACH_RFEYE RFEYE 3874
926phidget_sbc3 MACH_PHIDGET_SBC3 PHIDGET_SBC3 3875
927tcw_mika MACH_TCW_MIKA TCW_MIKA 3876
928imx28_egf MACH_IMX28_EGF IMX28_EGF 3877
929valente_wx MACH_VALENTE_WX VALENTE_WX 3878
930huangshans MACH_HUANGSHANS HUANGSHANS 3879
931bosphorus1 MACH_BOSPHORUS1 BOSPHORUS1 3880
932prima MACH_PRIMA PRIMA 3881
933evita_ulk MACH_EVITA_ULK EVITA_ULK 3884
934merisc600 MACH_MERISC600 MERISC600 3885
935dolak MACH_DOLAK DOLAK 3886
936sbc53 MACH_SBC53 SBC53 3887
937elite_ulk MACH_ELITE_ULK ELITE_ULK 3888
938pov2 MACH_POV2 POV2 3889
939ipod_touch_2g MACH_IPOD_TOUCH_2G IPOD_TOUCH_2G 3890
940da850_pqab MACH_DA850_PQAB DA850_PQAB 3891
941fermi MACH_FERMI FERMI 3892
942ccardwmx28 MACH_CCARDWMX28 CCARDWMX28 3893
943ccardmx28 MACH_CCARDMX28 CCARDMX28 3894
944fs20_fcm2050 MACH_FS20_FCM2050 FS20_FCM2050 3895
945kinetis MACH_KINETIS KINETIS 3896
946kai MACH_KAI KAI 3897
947bcthb2 MACH_BCTHB2 BCTHB2 3898
948inels3_cu MACH_INELS3_CU INELS3_CU 3899
949da850_apollo MACH_DA850_APOLLO DA850_APOLLO 3901
950tracnas MACH_TRACNAS TRACNAS 3902
951mityarm335x MACH_MITYARM335X MITYARM335X 3903
952xcgz7x MACH_XCGZ7X XCGZ7X 3904
953cubox MACH_CUBOX CUBOX 3905
954terminator MACH_TERMINATOR TERMINATOR 3906
955eye03 MACH_EYE03 EYE03 3907
956kota3 MACH_KOTA3 KOTA3 3908
957pscpe MACH_PSCPE PSCPE 3910
958akt1100 MACH_AKT1100 AKT1100 3911
959pcaaxl2 MACH_PCAAXL2 PCAAXL2 3912
960primodd_ct MACH_PRIMODD_CT PRIMODD_CT 3913
961nsbc MACH_NSBC NSBC 3914
962meson2_skt MACH_MESON2_SKT MESON2_SKT 3915
963meson2_ref MACH_MESON2_REF MESON2_REF 3916
964ccardwmx28js MACH_CCARDWMX28JS CCARDWMX28JS 3917
965ccardmx28js MACH_CCARDMX28JS CCARDMX28JS 3918
966indico MACH_INDICO INDICO 3919
967msm8960dt MACH_MSM8960DT MSM8960DT 3920
968primods MACH_PRIMODS PRIMODS 3921
969beluga_m1388 MACH_BELUGA_M1388 BELUGA_M1388 3922
970primotd MACH_PRIMOTD PRIMOTD 3923
971varan_master MACH_VARAN_MASTER VARAN_MASTER 3924
972primodd MACH_PRIMODD PRIMODD 3925
973jetduo MACH_JETDUO JETDUO 3926
974mx53_umobo MACH_MX53_UMOBO MX53_UMOBO 3927 558mx53_umobo MACH_MX53_UMOBO MX53_UMOBO 3927
975trats MACH_TRATS TRATS 3928
976starcraft MACH_STARCRAFT STARCRAFT 3929
977qseven_tegra2 MACH_QSEVEN_TEGRA2 QSEVEN_TEGRA2 3930
978lichee_sun4i_devbd MACH_LICHEE_SUN4I_DEVBD LICHEE_SUN4I_DEVBD 3931
979movenow MACH_MOVENOW MOVENOW 3932
980golf_u MACH_GOLF_U GOLF_U 3933
981msm7627a_evb MACH_MSM7627A_EVB MSM7627A_EVB 3934
982rambo MACH_RAMBO RAMBO 3935
983golfu MACH_GOLFU GOLFU 3936
984mango310 MACH_MANGO310 MANGO310 3937
985dns343 MACH_DNS343 DNS343 3938
986var_som_om44 MACH_VAR_SOM_OM44 VAR_SOM_OM44 3939
987naon MACH_NAON NAON 3940
988vp4000 MACH_VP4000 VP4000 3941
989impcard MACH_IMPCARD IMPCARD 3942
990smoovcam MACH_SMOOVCAM SMOOVCAM 3943
991cobham3725 MACH_COBHAM3725 COBHAM3725 3944
992cobham3730 MACH_COBHAM3730 COBHAM3730 3945
993cobham3703 MACH_COBHAM3703 COBHAM3703 3946
994quetzal MACH_QUETZAL QUETZAL 3947
995apq8064_cdp MACH_APQ8064_CDP APQ8064_CDP 3948
996apq8064_mtp MACH_APQ8064_MTP APQ8064_MTP 3949
997apq8064_fluid MACH_APQ8064_FLUID APQ8064_FLUID 3950
998apq8064_liquid MACH_APQ8064_LIQUID APQ8064_LIQUID 3951
999mango210 MACH_MANGO210 MANGO210 3952
1000mango100 MACH_MANGO100 MANGO100 3953
1001mango24 MACH_MANGO24 MANGO24 3954
1002mango64 MACH_MANGO64 MANGO64 3955
1003nsa320 MACH_NSA320 NSA320 3956
1004elv_ccu2 MACH_ELV_CCU2 ELV_CCU2 3957
1005triton_x00 MACH_TRITON_X00 TRITON_X00 3958
1006triton_1500_2000 MACH_TRITON_1500_2000 TRITON_1500_2000 3959
1007pogoplugv4 MACH_POGOPLUGV4 POGOPLUGV4 3960
1008venus_cl MACH_VENUS_CL VENUS_CL 3961
1009vulcano_g20 MACH_VULCANO_G20 VULCANO_G20 3962
1010sgs_i9100 MACH_SGS_I9100 SGS_I9100 3963
1011stsv2 MACH_STSV2 STSV2 3964
1012csb1724 MACH_CSB1724 CSB1724 3965
1013omapl138_lcdk MACH_OMAPL138_LCDK OMAPL138_LCDK 3966
1014pvd_mx25 MACH_PVD_MX25 PVD_MX25 3968
1015meson6_skt MACH_MESON6_SKT MESON6_SKT 3969
1016meson6_ref MACH_MESON6_REF MESON6_REF 3970
1017pxm MACH_PXM PXM 3971
1018pogoplugv3 MACH_POGOPLUGV3 POGOPLUGV3 3973
1019mlp89626 MACH_MLP89626 MLP89626 3974
1020iomegahmndce MACH_IOMEGAHMNDCE IOMEGAHMNDCE 3975
1021pogoplugv3pci MACH_POGOPLUGV3PCI POGOPLUGV3PCI 3976
1022bntv250 MACH_BNTV250 BNTV250 3977
1023mx53_qseven MACH_MX53_QSEVEN MX53_QSEVEN 3978
1024gtl_it1100 MACH_GTL_IT1100 GTL_IT1100 3979
1025mx6q_sabresd MACH_MX6Q_SABRESD MX6Q_SABRESD 3980
1026mt4 MACH_MT4 MT4 3981 559mt4 MACH_MT4 MT4 3981
1027jumbo_d MACH_JUMBO_D JUMBO_D 3982
1028jumbo_i MACH_JUMBO_I JUMBO_I 3983
1029fs20_dmp MACH_FS20_DMP FS20_DMP 3984
1030dns320 MACH_DNS320 DNS320 3985
1031mx28bacos MACH_MX28BACOS MX28BACOS 3986
1032tl80 MACH_TL80 TL80 3987
1033polatis_nic_1001 MACH_POLATIS_NIC_1001 POLATIS_NIC_1001 3988
1034tely MACH_TELY TELY 3989
1035u8520 MACH_U8520 U8520 3990 560u8520 MACH_U8520 U8520 3990
1036manta MACH_MANTA MANTA 3991
1037mpq8064_cdp MACH_MPQ8064_CDP MPQ8064_CDP 3993
1038mpq8064_dtv MACH_MPQ8064_DTV MPQ8064_DTV 3995
1039dm368som MACH_DM368SOM DM368SOM 3996
1040gprisb2 MACH_GPRISB2 GPRISB2 3997
1041chammid MACH_CHAMMID CHAMMID 3998
1042seoul2 MACH_SEOUL2 SEOUL2 3999
1043omap4_nooktablet MACH_OMAP4_NOOKTABLET OMAP4_NOOKTABLET 4000
1044aalto MACH_AALTO AALTO 4001
1045metro MACH_METRO METRO 4002
1046cydm3730 MACH_CYDM3730 CYDM3730 4003
1047tqma53 MACH_TQMA53 TQMA53 4004
1048msm7627a_qrd3 MACH_MSM7627A_QRD3 MSM7627A_QRD3 4005
1049mx28_canby MACH_MX28_CANBY MX28_CANBY 4006
1050tiger MACH_TIGER TIGER 4007
1051pcats_9307_type_a MACH_PCATS_9307_TYPE_A PCATS_9307_TYPE_A 4008
1052pcats_9307_type_o MACH_PCATS_9307_TYPE_O PCATS_9307_TYPE_O 4009
1053pcats_9307_type_r MACH_PCATS_9307_TYPE_R PCATS_9307_TYPE_R 4010
1054streamplug MACH_STREAMPLUG STREAMPLUG 4011
1055icechicken_dev MACH_ICECHICKEN_DEV ICECHICKEN_DEV 4012
1056hedgehog MACH_HEDGEHOG HEDGEHOG 4013
1057yusend_obc MACH_YUSEND_OBC YUSEND_OBC 4014
1058imxninja MACH_IMXNINJA IMXNINJA 4015
1059omap4_jarod MACH_OMAP4_JAROD OMAP4_JAROD 4016
1060eco5_pk MACH_ECO5_PK ECO5_PK 4017
1061qj2440 MACH_QJ2440 QJ2440 4018
1062mx6q_mercury MACH_MX6Q_MERCURY MX6Q_MERCURY 4019
1063cm6810 MACH_CM6810 CM6810 4020
1064omap4_torpedo MACH_OMAP4_TORPEDO OMAP4_TORPEDO 4021
1065nsa310 MACH_NSA310 NSA310 4022
1066tmx536 MACH_TMX536 TMX536 4023
1067ktt20 MACH_KTT20 KTT20 4024
1068dragonix MACH_DRAGONIX DRAGONIX 4025
1069lungching MACH_LUNGCHING LUNGCHING 4026
1070bulogics MACH_BULOGICS BULOGICS 4027
1071mx535_sx MACH_MX535_SX MX535_SX 4028
1072ngui3250 MACH_NGUI3250 NGUI3250 4029
1073salutec_dac MACH_SALUTEC_DAC SALUTEC_DAC 4030
1074loco MACH_LOCO LOCO 4031
1075ctera_plug_usi MACH_CTERA_PLUG_USI CTERA_PLUG_USI 4032
1076scepter MACH_SCEPTER SCEPTER 4033
1077sga MACH_SGA SGA 4034
1078p_81_j5 MACH_P_81_J5 P_81_J5 4035
1079p_81_o4 MACH_P_81_O4 P_81_O4 4036
1080msm8625_surf MACH_MSM8625_SURF MSM8625_SURF 4037
1081carallon_shark MACH_CARALLON_SHARK CARALLON_SHARK 4038
1082ordog MACH_ORDOG ORDOG 4040
1083puente_io MACH_PUENTE_IO PUENTE_IO 4041
1084msm8625_evb MACH_MSM8625_EVB MSM8625_EVB 4042
1085ev_am1707 MACH_EV_AM1707 EV_AM1707 4043
1086ev_am1707e2 MACH_EV_AM1707E2 EV_AM1707E2 4044
1087ev_am3517e2 MACH_EV_AM3517E2 EV_AM3517E2 4045
1088calabria MACH_CALABRIA CALABRIA 4046
1089ev_imx287 MACH_EV_IMX287 EV_IMX287 4047
1090erau MACH_ERAU ERAU 4048
1091sichuan MACH_SICHUAN SICHUAN 4049
1092davinci_da850 MACH_DAVINCI_DA850 DAVINCI_DA850 4051
1093omap138_trunarc MACH_OMAP138_TRUNARC OMAP138_TRUNARC 4052
1094bcm4761 MACH_BCM4761 BCM4761 4053
1095picasso_e2 MACH_PICASSO_E2 PICASSO_E2 4054
1096picasso_mf MACH_PICASSO_MF PICASSO_MF 4055
1097miro MACH_MIRO MIRO 4056
1098at91sam9g20ewon3 MACH_AT91SAM9G20EWON3 AT91SAM9G20EWON3 4057
1099yoyo MACH_YOYO YOYO 4058
1100windjkl MACH_WINDJKL WINDJKL 4059
1101monarudo MACH_MONARUDO MONARUDO 4060
1102batan MACH_BATAN BATAN 4061
1103tadao MACH_TADAO TADAO 4062
1104baso MACH_BASO BASO 4063
1105mahon MACH_MAHON MAHON 4064
1106villec2 MACH_VILLEC2 VILLEC2 4065
1107asi1230 MACH_ASI1230 ASI1230 4066
1108alaska MACH_ALASKA ALASKA 4067
1109swarco_shdsl2 MACH_SWARCO_SHDSL2 SWARCO_SHDSL2 4068
1110oxrtu MACH_OXRTU OXRTU 4069
1111omap5_panda MACH_OMAP5_PANDA OMAP5_PANDA 4070
1112c8000 MACH_C8000 C8000 4072
1113bje_display3_5 MACH_BJE_DISPLAY3_5 BJE_DISPLAY3_5 4073
1114picomod7 MACH_PICOMOD7 PICOMOD7 4074
1115picocom5 MACH_PICOCOM5 PICOCOM5 4075
1116qblissa8 MACH_QBLISSA8 QBLISSA8 4076
1117armstonea8 MACH_ARMSTONEA8 ARMSTONEA8 4077
1118netdcu14 MACH_NETDCU14 NETDCU14 4078
1119at91sam9x5_epiphan MACH_AT91SAM9X5_EPIPHAN AT91SAM9X5_EPIPHAN 4079
1120p2u MACH_P2U P2U 4080
1121doris MACH_DORIS DORIS 4081
1122j49 MACH_J49 J49 4082
1123vdss2e MACH_VDSS2E VDSS2E 4083
1124vc300 MACH_VC300 VC300 4084
1125ns115_pad_test MACH_NS115_PAD_TEST NS115_PAD_TEST 4085
1126ns115_pad_ref MACH_NS115_PAD_REF NS115_PAD_REF 4086
1127ns115_phone_test MACH_NS115_PHONE_TEST NS115_PHONE_TEST 4087
1128ns115_phone_ref MACH_NS115_PHONE_REF NS115_PHONE_REF 4088
1129golfc MACH_GOLFC GOLFC 4089
1130xerox_olympus MACH_XEROX_OLYMPUS XEROX_OLYMPUS 4090
1131mx6sl_arm2 MACH_MX6SL_ARM2 MX6SL_ARM2 4091
1132csb1701_csb1726 MACH_CSB1701_CSB1726 CSB1701_CSB1726 4092
1133at91sam9xeek MACH_AT91SAM9XEEK AT91SAM9XEEK 4093
1134ebv210 MACH_EBV210 EBV210 4094
1135msm7627a_qrd7 MACH_MSM7627A_QRD7 MSM7627A_QRD7 4095
1136svthin MACH_SVTHIN SVTHIN 4096
1137duovero MACH_DUOVERO DUOVERO 4097
1138chupacabra MACH_CHUPACABRA CHUPACABRA 4098 561chupacabra MACH_CHUPACABRA CHUPACABRA 4098
1139scorpion MACH_SCORPION SCORPION 4099 562scorpion MACH_SCORPION SCORPION 4099
1140davinci_he_hmi10 MACH_DAVINCI_HE_HMI10 DAVINCI_HE_HMI10 4100 563davinci_he_hmi10 MACH_DAVINCI_HE_HMI10 DAVINCI_HE_HMI10 4100
@@ -1157,7 +580,6 @@ tam335x MACH_TAM335X TAM335X 4116
1157grouper MACH_GROUPER GROUPER 4117 580grouper MACH_GROUPER GROUPER 4117
1158mpcsa21_9g20 MACH_MPCSA21_9G20 MPCSA21_9G20 4118 581mpcsa21_9g20 MACH_MPCSA21_9G20 MPCSA21_9G20 4118
1159m6u_cpu MACH_M6U_CPU M6U_CPU 4119 582m6u_cpu MACH_M6U_CPU M6U_CPU 4119
1160davinci_dp10 MACH_DAVINCI_DP10 DAVINCI_DP10 4120
1161ginkgo MACH_GINKGO GINKGO 4121 583ginkgo MACH_GINKGO GINKGO 4121
1162cgt_qmx6 MACH_CGT_QMX6 CGT_QMX6 4122 584cgt_qmx6 MACH_CGT_QMX6 CGT_QMX6 4122
1163profpga MACH_PROFPGA PROFPGA 4123 585profpga MACH_PROFPGA PROFPGA 4123
@@ -1204,3 +626,384 @@ baileys MACH_BAILEYS BAILEYS 4169
1204familybox MACH_FAMILYBOX FAMILYBOX 4170 626familybox MACH_FAMILYBOX FAMILYBOX 4170
1205ensemble_mx35 MACH_ENSEMBLE_MX35 ENSEMBLE_MX35 4171 627ensemble_mx35 MACH_ENSEMBLE_MX35 ENSEMBLE_MX35 4171
1206sc_sps_1 MACH_SC_SPS_1 SC_SPS_1 4172 628sc_sps_1 MACH_SC_SPS_1 SC_SPS_1 4172
629ucsimply_sam9260 MACH_UCSIMPLY_SAM9260 UCSIMPLY_SAM9260 4173
630unicorn MACH_UNICORN UNICORN 4174
631m9g45a MACH_M9G45A M9G45A 4175
632mtwebif MACH_MTWEBIF MTWEBIF 4176
633playstone MACH_PLAYSTONE PLAYSTONE 4177
634chelsea MACH_CHELSEA CHELSEA 4178
635bayern MACH_BAYERN BAYERN 4179
636mitwo MACH_MITWO MITWO 4180
637mx25_noah MACH_MX25_NOAH MX25_NOAH 4181
638stm_b2020 MACH_STM_B2020 STM_B2020 4182
639annax_src MACH_ANNAX_SRC ANNAX_SRC 4183
640ionics_stratus MACH_IONICS_STRATUS IONICS_STRATUS 4184
641hugo MACH_HUGO HUGO 4185
642em300 MACH_EM300 EM300 4186
643mmp3_qseven MACH_MMP3_QSEVEN MMP3_QSEVEN 4187
644bosphorus2 MACH_BOSPHORUS2 BOSPHORUS2 4188
645tt2200 MACH_TT2200 TT2200 4189
646ocelot3 MACH_OCELOT3 OCELOT3 4190
647tek_cobra MACH_TEK_COBRA TEK_COBRA 4191
648protou MACH_PROTOU PROTOU 4192
649msm8625_evt MACH_MSM8625_EVT MSM8625_EVT 4193
650mx53_sellwood MACH_MX53_SELLWOOD MX53_SELLWOOD 4194
651somiq_am35 MACH_SOMIQ_AM35 SOMIQ_AM35 4195
652somiq_am37 MACH_SOMIQ_AM37 SOMIQ_AM37 4196
653k2_plc_cl MACH_K2_PLC_CL K2_PLC_CL 4197
654tc2 MACH_TC2 TC2 4198
655dulex_j MACH_DULEX_J DULEX_J 4199
656stm_b2044 MACH_STM_B2044 STM_B2044 4200
657deluxe_j MACH_DELUXE_J DELUXE_J 4201
658mango2443 MACH_MANGO2443 MANGO2443 4202
659cp2dcg MACH_CP2DCG CP2DCG 4203
660cp2dtg MACH_CP2DTG CP2DTG 4204
661cp2dug MACH_CP2DUG CP2DUG 4205
662var_som_am33 MACH_VAR_SOM_AM33 VAR_SOM_AM33 4206
663pepper MACH_PEPPER PEPPER 4207
664mango2450 MACH_MANGO2450 MANGO2450 4208
665valente_wx_c9 MACH_VALENTE_WX_C9 VALENTE_WX_C9 4209
666minitv MACH_MINITV MINITV 4210
667u8540 MACH_U8540 U8540 4211
668iv_atlas_i_z7e MACH_IV_ATLAS_I_Z7E IV_ATLAS_I_Z7E 4212
669mach_type_sky MACH_MACH_TYPE_SKY MACH_TYPE_SKY 4214
670bluesky MACH_BLUESKY BLUESKY 4215
671ngrouter MACH_NGROUTER NGROUTER 4216
672mx53_denetim MACH_MX53_DENETIM MX53_DENETIM 4217
673opal MACH_OPAL OPAL 4218
674gnet_us3gref MACH_GNET_US3GREF GNET_US3GREF 4219
675gnet_nc3g MACH_GNET_NC3G GNET_NC3G 4220
676gnet_ge3g MACH_GNET_GE3G GNET_GE3G 4221
677adp2 MACH_ADP2 ADP2 4222
678tqma28 MACH_TQMA28 TQMA28 4223
679kacom3 MACH_KACOM3 KACOM3 4224
680rrhdemo MACH_RRHDEMO RRHDEMO 4225
681protodug MACH_PROTODUG PROTODUG 4226
682lago MACH_LAGO LAGO 4227
683ktt30 MACH_KTT30 KTT30 4228
684ts43xx MACH_TS43XX TS43XX 4229
685mx6q_denso MACH_MX6Q_DENSO MX6Q_DENSO 4230
686comsat_gsmumts8 MACH_COMSAT_GSMUMTS8 COMSAT_GSMUMTS8 4231
687dreamx MACH_DREAMX DREAMX 4232
688thunderstonem MACH_THUNDERSTONEM THUNDERSTONEM 4233
689yoyopad MACH_YOYOPAD YOYOPAD 4234
690yoyopatient MACH_YOYOPATIENT YOYOPATIENT 4235
691a10l MACH_A10L A10L 4236
692mq60 MACH_MQ60 MQ60 4237
693linkstation_lsql MACH_LINKSTATION_LSQL LINKSTATION_LSQL 4238
694am3703gateway MACH_AM3703GATEWAY AM3703GATEWAY 4239
695accipiter MACH_ACCIPITER ACCIPITER 4240
696magnidug MACH_MAGNIDUG MAGNIDUG 4242
697hydra MACH_HYDRA HYDRA 4243
698sun3i MACH_SUN3I SUN3I 4244
699stm_b2078 MACH_STM_B2078 STM_B2078 4245
700at91sam9263deskv2 MACH_AT91SAM9263DESKV2 AT91SAM9263DESKV2 4246
701deluxe_r MACH_DELUXE_R DELUXE_R 4247
702p_98_v MACH_P_98_V P_98_V 4248
703p_98_c MACH_P_98_C P_98_C 4249
704davinci_am18xx_omn MACH_DAVINCI_AM18XX_OMN DAVINCI_AM18XX_OMN 4250
705socfpga_cyclone5 MACH_SOCFPGA_CYCLONE5 SOCFPGA_CYCLONE5 4251
706cabatuin MACH_CABATUIN CABATUIN 4252
707yoyopad_ft MACH_YOYOPAD_FT YOYOPAD_FT 4253
708dan2400evb MACH_DAN2400EVB DAN2400EVB 4254
709dan3400evb MACH_DAN3400EVB DAN3400EVB 4255
710edm_sf_imx6 MACH_EDM_SF_IMX6 EDM_SF_IMX6 4256
711edm_cf_imx6 MACH_EDM_CF_IMX6 EDM_CF_IMX6 4257
712vpos3xx MACH_VPOS3XX VPOS3XX 4258
713vulcano_9x5 MACH_VULCANO_9X5 VULCANO_9X5 4259
714spmp8000 MACH_SPMP8000 SPMP8000 4260
715catalina MACH_CATALINA CATALINA 4261
716rd88f5181l_fe MACH_RD88F5181L_FE RD88F5181L_FE 4262
717mx535_mx MACH_MX535_MX MX535_MX 4263
718armadillo840 MACH_ARMADILLO840 ARMADILLO840 4264
719spc9000baseboard MACH_SPC9000BASEBOARD SPC9000BASEBOARD 4265
720iris MACH_IRIS IRIS 4266
721protodcg MACH_PROTODCG PROTODCG 4267
722palmtree MACH_PALMTREE PALMTREE 4268
723novena MACH_NOVENA NOVENA 4269
724ma_um MACH_MA_UM MA_UM 4270
725ma_am MACH_MA_AM MA_AM 4271
726ems348 MACH_EMS348 EMS348 4272
727cm_fx6 MACH_CM_FX6 CM_FX6 4273
728arndale MACH_ARNDALE ARNDALE 4274
729q5xr5 MACH_Q5XR5 Q5XR5 4275
730willow MACH_WILLOW WILLOW 4276
731omap3621_odyv3 MACH_OMAP3621_ODYV3 OMAP3621_ODYV3 4277
732omapl138_presonus MACH_OMAPL138_PRESONUS OMAPL138_PRESONUS 4278
733dvf99 MACH_DVF99 DVF99 4279
734impression_j MACH_IMPRESSION_J IMPRESSION_J 4280
735qblissa9 MACH_QBLISSA9 QBLISSA9 4281
736robin_heliview10 MACH_ROBIN_HELIVIEW10 ROBIN_HELIVIEW10 4282
737sun7i MACH_SUN7I SUN7I 4283
738mx6q_hdmidongle MACH_MX6Q_HDMIDONGLE MX6Q_HDMIDONGLE 4284
739mx6_sid2 MACH_MX6_SID2 MX6_SID2 4285
740helios_v3 MACH_HELIOS_V3 HELIOS_V3 4286
741helios_v4 MACH_HELIOS_V4 HELIOS_V4 4287
742q7_imx6 MACH_Q7_IMX6 Q7_IMX6 4288
743odroidx MACH_ODROIDX ODROIDX 4289
744robpro MACH_ROBPRO ROBPRO 4290
745research59if_mk1 MACH_RESEARCH59IF_MK1 RESEARCH59IF_MK1 4291
746bobsleigh MACH_BOBSLEIGH BOBSLEIGH 4292
747dcshgwt3 MACH_DCSHGWT3 DCSHGWT3 4293
748gld1018 MACH_GLD1018 GLD1018 4294
749ev10 MACH_EV10 EV10 4295
750nitrogen6x MACH_NITROGEN6X NITROGEN6X 4296
751p_107_bb MACH_P_107_BB P_107_BB 4297
752evita_utl MACH_EVITA_UTL EVITA_UTL 4298
753falconwing MACH_FALCONWING FALCONWING 4299
754dct3 MACH_DCT3 DCT3 4300
755cpx2e_cell MACH_CPX2E_CELL CPX2E_CELL 4301
756amiro MACH_AMIRO AMIRO 4302
757mx6q_brassboard MACH_MX6Q_BRASSBOARD MX6Q_BRASSBOARD 4303
758dalmore MACH_DALMORE DALMORE 4304
759omap3_portal7cp MACH_OMAP3_PORTAL7CP OMAP3_PORTAL7CP 4305
760tegra_pluto MACH_TEGRA_PLUTO TEGRA_PLUTO 4306
761mx6sl_evk MACH_MX6SL_EVK MX6SL_EVK 4307
762m7 MACH_M7 M7 4308
763pxm2 MACH_PXM2 PXM2 4309
764haba_knx_lite MACH_HABA_KNX_LITE HABA_KNX_LITE 4310
765tai MACH_TAI TAI 4311
766prototd MACH_PROTOTD PROTOTD 4312
767dst_tonto MACH_DST_TONTO DST_TONTO 4313
768draco MACH_DRACO DRACO 4314
769dxr2 MACH_DXR2 DXR2 4315
770rut MACH_RUT RUT 4316
771am180x_wsc MACH_AM180X_WSC AM180X_WSC 4317
772deluxe_u MACH_DELUXE_U DELUXE_U 4318
773deluxe_ul MACH_DELUXE_UL DELUXE_UL 4319
774at91sam9260medths MACH_AT91SAM9260MEDTHS AT91SAM9260MEDTHS 4320
775matrix516 MACH_MATRIX516 MATRIX516 4321
776vid401x MACH_VID401X VID401X 4322
777helios_v5 MACH_HELIOS_V5 HELIOS_V5 4323
778playpaq2 MACH_PLAYPAQ2 PLAYPAQ2 4324
779igam MACH_IGAM IGAM 4325
780amico_i MACH_AMICO_I AMICO_I 4326
781amico_e MACH_AMICO_E AMICO_E 4327
782sentient_mm3_ck MACH_SENTIENT_MM3_CK SENTIENT_MM3_CK 4328
783smx6 MACH_SMX6 SMX6 4329
784pango MACH_PANGO PANGO 4330
785ns115_stick MACH_NS115_STICK NS115_STICK 4331
786bctrm3 MACH_BCTRM3 BCTRM3 4332
787doctorws MACH_DOCTORWS DOCTORWS 4333
788m2601 MACH_M2601 M2601 4334
789vgg1111 MACH_VGG1111 VGG1111 4337
790countach MACH_COUNTACH COUNTACH 4338
791visstrim_sm20 MACH_VISSTRIM_SM20 VISSTRIM_SM20 4339
792a639 MACH_A639 A639 4340
793spacemonkey MACH_SPACEMONKEY SPACEMONKEY 4341
794zpdu_stamp MACH_ZPDU_STAMP ZPDU_STAMP 4342
795htc_g7_clone MACH_HTC_G7_CLONE HTC_G7_CLONE 4343
796ft2080_corvus MACH_FT2080_CORVUS FT2080_CORVUS 4344
797fisland MACH_FISLAND FISLAND 4345
798zpdu MACH_ZPDU ZPDU 4346
799urt MACH_URT URT 4347
800conti_ovip MACH_CONTI_OVIP CONTI_OVIP 4348
801omapl138_nagra MACH_OMAPL138_NAGRA OMAPL138_NAGRA 4349
802da850_at3kp1 MACH_DA850_AT3KP1 DA850_AT3KP1 4350
803da850_at3kp2 MACH_DA850_AT3KP2 DA850_AT3KP2 4351
804surma MACH_SURMA SURMA 4352
805stm_b2092 MACH_STM_B2092 STM_B2092 4353
806mx535_ycr MACH_MX535_YCR MX535_YCR 4354
807m7_wl MACH_M7_WL M7_WL 4355
808m7_u MACH_M7_U M7_U 4356
809omap3_stndt_evm MACH_OMAP3_STNDT_EVM OMAP3_STNDT_EVM 4357
810m7_wlv MACH_M7_WLV M7_WLV 4358
811xam3517 MACH_XAM3517 XAM3517 4359
812a220 MACH_A220 A220 4360
813aclima_odie MACH_ACLIMA_ODIE ACLIMA_ODIE 4361
814vibble MACH_VIBBLE VIBBLE 4362
815k2_u MACH_K2_U K2_U 4363
816mx53_egf MACH_MX53_EGF MX53_EGF 4364
817novpek_imx53 MACH_NOVPEK_IMX53 NOVPEK_IMX53 4365
818novpek_imx6x MACH_NOVPEK_IMX6X NOVPEK_IMX6X 4366
819mx25_smartbox MACH_MX25_SMARTBOX MX25_SMARTBOX 4367
820eicg6410 MACH_EICG6410 EICG6410 4368
821picasso_e3 MACH_PICASSO_E3 PICASSO_E3 4369
822motonavigator MACH_MOTONAVIGATOR MOTONAVIGATOR 4370
823varioconnect2 MACH_VARIOCONNECT2 VARIOCONNECT2 4371
824deluxe_tw MACH_DELUXE_TW DELUXE_TW 4372
825kore3 MACH_KORE3 KORE3 4374
826mx6s_drs MACH_MX6S_DRS MX6S_DRS 4375
827cmimx6 MACH_CMIMX6 CMIMX6 4376
828roth MACH_ROTH ROTH 4377
829eq4ux MACH_EQ4UX EQ4UX 4378
830x1plus MACH_X1PLUS X1PLUS 4379
831modimx27 MACH_MODIMX27 MODIMX27 4380
832videon_hduac MACH_VIDEON_HDUAC VIDEON_HDUAC 4381
833blackbird MACH_BLACKBIRD BLACKBIRD 4382
834runmaster MACH_RUNMASTER RUNMASTER 4383
835ceres MACH_CERES CERES 4384
836nad435 MACH_NAD435 NAD435 4385
837ns115_proto_type MACH_NS115_PROTO_TYPE NS115_PROTO_TYPE 4386
838fs20_vcc MACH_FS20_VCC FS20_VCC 4387
839meson6tv_skt MACH_MESON6TV_SKT MESON6TV_SKT 4389
840keystone MACH_KEYSTONE KEYSTONE 4390
841pcm052 MACH_PCM052 PCM052 4391
842qrd_skud_prime MACH_QRD_SKUD_PRIME QRD_SKUD_PRIME 4393
843guf_santaro MACH_GUF_SANTARO GUF_SANTARO 4395
844sheepshead MACH_SHEEPSHEAD SHEEPSHEAD 4396
845mx6_iwg15m_mxm MACH_MX6_IWG15M_MXM MX6_IWG15M_MXM 4397
846mx6_iwg15m_q7 MACH_MX6_IWG15M_Q7 MX6_IWG15M_Q7 4398
847at91sam9263if8mic MACH_AT91SAM9263IF8MIC AT91SAM9263IF8MIC 4399
848marcopolo MACH_MARCOPOLO MARCOPOLO 4401
849mx535_sdcr MACH_MX535_SDCR MX535_SDCR 4402
850mx53_csb2733 MACH_MX53_CSB2733 MX53_CSB2733 4403
851diva MACH_DIVA DIVA 4404
852ncr_7744 MACH_NCR_7744 NCR_7744 4405
853macallan MACH_MACALLAN MACALLAN 4406
854wnr3500 MACH_WNR3500 WNR3500 4407
855pgavrf MACH_PGAVRF PGAVRF 4408
856helios_v6 MACH_HELIOS_V6 HELIOS_V6 4409
857lcct MACH_LCCT LCCT 4410
858csndug MACH_CSNDUG CSNDUG 4411
859wandboard_imx6 MACH_WANDBOARD_IMX6 WANDBOARD_IMX6 4412
860omap4_jet MACH_OMAP4_JET OMAP4_JET 4413
861tegra_roth MACH_TEGRA_ROTH TEGRA_ROTH 4414
862m7dcg MACH_M7DCG M7DCG 4415
863m7dug MACH_M7DUG M7DUG 4416
864m7dtg MACH_M7DTG M7DTG 4417
865ap42x MACH_AP42X AP42X 4418
866var_som_mx6 MACH_VAR_SOM_MX6 VAR_SOM_MX6 4419
867pdlu MACH_PDLU PDLU 4420
868hydrogen MACH_HYDROGEN HYDROGEN 4421
869npa211e MACH_NPA211E NPA211E 4422
870arcadia MACH_ARCADIA ARCADIA 4423
871arcadia_l MACH_ARCADIA_L ARCADIA_L 4424
872msm8930dt MACH_MSM8930DT MSM8930DT 4425
873ktam3874 MACH_KTAM3874 KTAM3874 4426
874cec4 MACH_CEC4 CEC4 4427
875ape6evm MACH_APE6EVM APE6EVM 4428
876tx6 MACH_TX6 TX6 4429
877cfa10037 MACH_CFA10037 CFA10037 4431
878ezp1000 MACH_EZP1000 EZP1000 4433
879wgr826v MACH_WGR826V WGR826V 4434
880exuma MACH_EXUMA EXUMA 4435
881fregate MACH_FREGATE FREGATE 4436
882osirisimx508 MACH_OSIRISIMX508 OSIRISIMX508 4437
883st_exigo MACH_ST_EXIGO ST_EXIGO 4438
884pismo MACH_PISMO PISMO 4439
885atc7 MACH_ATC7 ATC7 4440
886nspireclp MACH_NSPIRECLP NSPIRECLP 4441
887nspiretp MACH_NSPIRETP NSPIRETP 4442
888nspirecx MACH_NSPIRECX NSPIRECX 4443
889maya MACH_MAYA MAYA 4444
890wecct MACH_WECCT WECCT 4445
891m2s MACH_M2S M2S 4446
892msm8625q_evbd MACH_MSM8625Q_EVBD MSM8625Q_EVBD 4447
893tiny210 MACH_TINY210 TINY210 4448
894g3 MACH_G3 G3 4449
895hurricane MACH_HURRICANE HURRICANE 4450
896mx6_pod MACH_MX6_POD MX6_POD 4451
897elondcn MACH_ELONDCN ELONDCN 4452
898cwmx535 MACH_CWMX535 CWMX535 4453
899m7_wlj MACH_M7_WLJ M7_WLJ 4454
900qsp_arm MACH_QSP_ARM QSP_ARM 4455
901msm8625q_skud MACH_MSM8625Q_SKUD MSM8625Q_SKUD 4456
902htcmondrian MACH_HTCMONDRIAN HTCMONDRIAN 4457
903watson_ead MACH_WATSON_EAD WATSON_EAD 4458
904mitwoa MACH_MITWOA MITWOA 4459
905omap3_wolverine MACH_OMAP3_WOLVERINE OMAP3_WOLVERINE 4460
906mapletree MACH_MAPLETREE MAPLETREE 4461
907msm8625_fih_sae MACH_MSM8625_FIH_SAE MSM8625_FIH_SAE 4462
908epc35 MACH_EPC35 EPC35 4463
909smartrtu MACH_SMARTRTU SMARTRTU 4464
910rcm101 MACH_RCM101 RCM101 4465
911amx_imx53_mxx MACH_AMX_IMX53_MXX AMX_IMX53_MXX 4466
912acer_a12 MACH_ACER_A12 ACER_A12 4470
913sbc6x MACH_SBC6X SBC6X 4471
914u2 MACH_U2 U2 4472
915smdk4270 MACH_SMDK4270 SMDK4270 4473
916priscillag MACH_PRISCILLAG PRISCILLAG 4474
917priscillac MACH_PRISCILLAC PRISCILLAC 4475
918priscilla MACH_PRISCILLA PRISCILLA 4476
919innova_shpu_v2 MACH_INNOVA_SHPU_V2 INNOVA_SHPU_V2 4477
920mach_type_dep2410 MACH_MACH_TYPE_DEP2410 MACH_TYPE_DEP2410 4479
921bctre3 MACH_BCTRE3 BCTRE3 4480
922omap_m100 MACH_OMAP_M100 OMAP_M100 4481
923flo MACH_FLO FLO 4482
924nanobone MACH_NANOBONE NANOBONE 4483
925stm_b2105 MACH_STM_B2105 STM_B2105 4484
926omap4_bsc_bap_v3 MACH_OMAP4_BSC_BAP_V3 OMAP4_BSC_BAP_V3 4485
927ss1pam MACH_SS1PAM SS1PAM 4486
928primominiu MACH_PRIMOMINIU PRIMOMINIU 4488
929mrt_35hd_dualnas_e MACH_MRT_35HD_DUALNAS_E MRT_35HD_DUALNAS_E 4489
930kiwi MACH_KIWI KIWI 4490
931hw90496 MACH_HW90496 HW90496 4491
932mep2440 MACH_MEP2440 MEP2440 4492
933colibri_t30 MACH_COLIBRI_T30 COLIBRI_T30 4493
934cwv1 MACH_CWV1 CWV1 4494
935nsa325 MACH_NSA325 NSA325 4495
936dpxmtc MACH_DPXMTC DPXMTC 4497
937tt_stuttgart MACH_TT_STUTTGART TT_STUTTGART 4498
938miranda_apcii MACH_MIRANDA_APCII MIRANDA_APCII 4499
939mx6q_moderox MACH_MX6Q_MODEROX MX6Q_MODEROX 4500
940mudskipper MACH_MUDSKIPPER MUDSKIPPER 4501
941urania MACH_URANIA URANIA 4502
942stm_b2112 MACH_STM_B2112 STM_B2112 4503
943mx6q_ats_phoenix MACH_MX6Q_ATS_PHOENIX MX6Q_ATS_PHOENIX 4505
944stm_b2116 MACH_STM_B2116 STM_B2116 4506
945mythology MACH_MYTHOLOGY MYTHOLOGY 4507
946fc360v1 MACH_FC360V1 FC360V1 4508
947gps_sensor MACH_GPS_SENSOR GPS_SENSOR 4509
948gazelle MACH_GAZELLE GAZELLE 4510
949mpq8064_dma MACH_MPQ8064_DMA MPQ8064_DMA 4511
950wems_asd01 MACH_WEMS_ASD01 WEMS_ASD01 4512
951apalis_t30 MACH_APALIS_T30 APALIS_T30 4513
952armstonea9 MACH_ARMSTONEA9 ARMSTONEA9 4515
953omap_blazetablet MACH_OMAP_BLAZETABLET OMAP_BLAZETABLET 4516
954ar6mxq MACH_AR6MXQ AR6MXQ 4517
955ar6mxs MACH_AR6MXS AR6MXS 4518
956gwventana MACH_GWVENTANA GWVENTANA 4520
957igep0033 MACH_IGEP0033 IGEP0033 4521
958h52c1_concerto MACH_H52C1_CONCERTO H52C1_CONCERTO 4524
959fcmbrd MACH_FCMBRD FCMBRD 4525
960pcaaxs1 MACH_PCAAXS1 PCAAXS1 4526
961ls_orca MACH_LS_ORCA LS_ORCA 4527
962pcm051lb MACH_PCM051LB PCM051LB 4528
963mx6s_lp507_gvci MACH_MX6S_LP507_GVCI MX6S_LP507_GVCI 4529
964dido MACH_DIDO DIDO 4530
965swarco_itc3_9g20 MACH_SWARCO_ITC3_9G20 SWARCO_ITC3_9G20 4531
966robo_roady MACH_ROBO_ROADY ROBO_ROADY 4532
967rskrza1 MACH_RSKRZA1 RSKRZA1 4533
968swarco_sid MACH_SWARCO_SID SWARCO_SID 4534
969mx6_iwg15s_sbc MACH_MX6_IWG15S_SBC MX6_IWG15S_SBC 4535
970mx6q_camaro MACH_MX6Q_CAMARO MX6Q_CAMARO 4536
971hb6mxs MACH_HB6MXS HB6MXS 4537
972lager MACH_LAGER LAGER 4538
973lp8x4x MACH_LP8X4X LP8X4X 4539
974tegratab7 MACH_TEGRATAB7 TEGRATAB7 4540
975andromeda MACH_ANDROMEDA ANDROMEDA 4541
976bootes MACH_BOOTES BOOTES 4542
977nethmi MACH_NETHMI NETHMI 4543
978tegratab MACH_TEGRATAB TEGRATAB 4544
979som5_evb MACH_SOM5_EVB SOM5_EVB 4545
980venaticorum MACH_VENATICORUM VENATICORUM 4546
981stm_b2110 MACH_STM_B2110 STM_B2110 4547
982elux_hathor MACH_ELUX_HATHOR ELUX_HATHOR 4548
983helios_v7 MACH_HELIOS_V7 HELIOS_V7 4549
984xc10v1 MACH_XC10V1 XC10V1 4550
985cp2u MACH_CP2U CP2U 4551
986iap_f MACH_IAP_F IAP_F 4552
987iap_g MACH_IAP_G IAP_G 4553
988aae MACH_AAE AAE 4554
989pegasus MACH_PEGASUS PEGASUS 4555
990cygnus MACH_CYGNUS CYGNUS 4556
991centaurus MACH_CENTAURUS CENTAURUS 4557
992msm8930_qrd8930 MACH_MSM8930_QRD8930 MSM8930_QRD8930 4558
993quby_tim MACH_QUBY_TIM QUBY_TIM 4559
994zedi3250a MACH_ZEDI3250A ZEDI3250A 4560
995grus MACH_GRUS GRUS 4561
996apollo3 MACH_APOLLO3 APOLLO3 4562
997cowon_r7 MACH_COWON_R7 COWON_R7 4563
998tonga3 MACH_TONGA3 TONGA3 4564
999p535 MACH_P535 P535 4565
1000sa3874i MACH_SA3874I SA3874I 4566
1001mx6_navico_com MACH_MX6_NAVICO_COM MX6_NAVICO_COM 4567
1002proxmobil2 MACH_PROXMOBIL2 PROXMOBIL2 4568
1003ubinux1 MACH_UBINUX1 UBINUX1 4569
1004istos MACH_ISTOS ISTOS 4570
1005benvolio4 MACH_BENVOLIO4 BENVOLIO4 4571
1006eco5_bx2 MACH_ECO5_BX2 ECO5_BX2 4572
1007eukrea_cpuimx28sd MACH_EUKREA_CPUIMX28SD EUKREA_CPUIMX28SD 4573
1008domotab MACH_DOMOTAB DOMOTAB 4574
1009pfla03 MACH_PFLA03 PFLA03 4575
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 9b6d19f74078..73b6e764034c 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -99,7 +99,16 @@ source "init/Kconfig"
99 99
100source "kernel/Kconfig.freezer" 100source "kernel/Kconfig.freezer"
101 101
102menu "System Type" 102menu "Platform selection"
103
104config ARCH_VEXPRESS
105 bool "ARMv8 software model (Versatile Express)"
106 select ARCH_REQUIRE_GPIOLIB
107 select COMMON_CLK_VERSATILE
108 select VEXPRESS_CONFIG
109 help
110 This enables support for the ARMv8 software model (Versatile
111 Express).
103 112
104endmenu 113endmenu
105 114
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 32ac0aef0068..68457e9e0975 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,3 +1,5 @@
1dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb
2
1targets += dtbs 3targets += dtbs
2targets += $(dtb-y) 4targets += $(dtb-y)
3 5
diff --git a/arch/arm64/boot/dts/foundation-v8.dts b/arch/arm64/boot/dts/foundation-v8.dts
new file mode 100644
index 000000000000..198682b6de31
--- /dev/null
+++ b/arch/arm64/boot/dts/foundation-v8.dts
@@ -0,0 +1,230 @@
1/*
2 * ARM Ltd.
3 *
4 * ARMv8 Foundation model DTS
5 */
6
7/dts-v1/;
8
9/ {
10 model = "Foundation-v8A";
11 compatible = "arm,foundation-aarch64", "arm,vexpress";
12 interrupt-parent = <&gic>;
13 #address-cells = <2>;
14 #size-cells = <2>;
15
16 chosen { };
17
18 aliases {
19 serial0 = &v2m_serial0;
20 serial1 = &v2m_serial1;
21 serial2 = &v2m_serial2;
22 serial3 = &v2m_serial3;
23 };
24
25 cpus {
26 #address-cells = <1>;
27 #size-cells = <0>;
28
29 cpu@0 {
30 device_type = "cpu";
31 compatible = "arm,armv8";
32 reg = <0x0 0x0>;
33 enable-method = "spin-table";
34 cpu-release-addr = <0x0 0x8000fff8>;
35 };
36 cpu@1 {
37 device_type = "cpu";
38 compatible = "arm,armv8";
39 reg = <0x0 0x1>;
40 enable-method = "spin-table";
41 cpu-release-addr = <0x0 0x8000fff8>;
42 };
43 cpu@2 {
44 device_type = "cpu";
45 compatible = "arm,armv8";
46 reg = <0x0 0x2>;
47 enable-method = "spin-table";
48 cpu-release-addr = <0x0 0x8000fff8>;
49 };
50 cpu@3 {
51 device_type = "cpu";
52 compatible = "arm,armv8";
53 reg = <0x0 0x3>;
54 enable-method = "spin-table";
55 cpu-release-addr = <0x0 0x8000fff8>;
56 };
57 };
58
59 memory@80000000 {
60 device_type = "memory";
61 reg = <0x00000000 0x80000000 0 0x80000000>,
62 <0x00000008 0x80000000 0 0x80000000>;
63 };
64
65 gic: interrupt-controller@2c001000 {
66 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
67 #interrupt-cells = <3>;
68 #address-cells = <0>;
69 interrupt-controller;
70 reg = <0x0 0x2c001000 0 0x1000>,
71 <0x0 0x2c002000 0 0x1000>,
72 <0x0 0x2c004000 0 0x2000>,
73 <0x0 0x2c006000 0 0x2000>;
74 interrupts = <1 9 0xf04>;
75 };
76
77 timer {
78 compatible = "arm,armv8-timer";
79 interrupts = <1 13 0xff01>,
80 <1 14 0xff01>,
81 <1 11 0xff01>,
82 <1 10 0xff01>;
83 clock-frequency = <100000000>;
84 };
85
86 pmu {
87 compatible = "arm,armv8-pmuv3";
88 interrupts = <0 60 4>,
89 <0 61 4>,
90 <0 62 4>,
91 <0 63 4>;
92 };
93
94 smb {
95 compatible = "arm,vexpress,v2m-p1", "simple-bus";
96 arm,v2m-memory-map = "rs1";
97 #address-cells = <2>; /* SMB chipselect number and offset */
98 #size-cells = <1>;
99
100 ranges = <0 0 0 0x08000000 0x04000000>,
101 <1 0 0 0x14000000 0x04000000>,
102 <2 0 0 0x18000000 0x04000000>,
103 <3 0 0 0x1c000000 0x04000000>,
104 <4 0 0 0x0c000000 0x04000000>,
105 <5 0 0 0x10000000 0x04000000>;
106
107 #interrupt-cells = <1>;
108 interrupt-map-mask = <0 0 63>;
109 interrupt-map = <0 0 0 &gic 0 0 4>,
110 <0 0 1 &gic 0 1 4>,
111 <0 0 2 &gic 0 2 4>,
112 <0 0 3 &gic 0 3 4>,
113 <0 0 4 &gic 0 4 4>,
114 <0 0 5 &gic 0 5 4>,
115 <0 0 6 &gic 0 6 4>,
116 <0 0 7 &gic 0 7 4>,
117 <0 0 8 &gic 0 8 4>,
118 <0 0 9 &gic 0 9 4>,
119 <0 0 10 &gic 0 10 4>,
120 <0 0 11 &gic 0 11 4>,
121 <0 0 12 &gic 0 12 4>,
122 <0 0 13 &gic 0 13 4>,
123 <0 0 14 &gic 0 14 4>,
124 <0 0 15 &gic 0 15 4>,
125 <0 0 16 &gic 0 16 4>,
126 <0 0 17 &gic 0 17 4>,
127 <0 0 18 &gic 0 18 4>,
128 <0 0 19 &gic 0 19 4>,
129 <0 0 20 &gic 0 20 4>,
130 <0 0 21 &gic 0 21 4>,
131 <0 0 22 &gic 0 22 4>,
132 <0 0 23 &gic 0 23 4>,
133 <0 0 24 &gic 0 24 4>,
134 <0 0 25 &gic 0 25 4>,
135 <0 0 26 &gic 0 26 4>,
136 <0 0 27 &gic 0 27 4>,
137 <0 0 28 &gic 0 28 4>,
138 <0 0 29 &gic 0 29 4>,
139 <0 0 30 &gic 0 30 4>,
140 <0 0 31 &gic 0 31 4>,
141 <0 0 32 &gic 0 32 4>,
142 <0 0 33 &gic 0 33 4>,
143 <0 0 34 &gic 0 34 4>,
144 <0 0 35 &gic 0 35 4>,
145 <0 0 36 &gic 0 36 4>,
146 <0 0 37 &gic 0 37 4>,
147 <0 0 38 &gic 0 38 4>,
148 <0 0 39 &gic 0 39 4>,
149 <0 0 40 &gic 0 40 4>,
150 <0 0 41 &gic 0 41 4>,
151 <0 0 42 &gic 0 42 4>;
152
153 ethernet@2,02000000 {
154 compatible = "smsc,lan91c111";
155 reg = <2 0x02000000 0x10000>;
156 interrupts = <15>;
157 };
158
159 v2m_clk24mhz: clk24mhz {
160 compatible = "fixed-clock";
161 #clock-cells = <0>;
162 clock-frequency = <24000000>;
163 clock-output-names = "v2m:clk24mhz";
164 };
165
166 v2m_refclk1mhz: refclk1mhz {
167 compatible = "fixed-clock";
168 #clock-cells = <0>;
169 clock-frequency = <1000000>;
170 clock-output-names = "v2m:refclk1mhz";
171 };
172
173 v2m_refclk32khz: refclk32khz {
174 compatible = "fixed-clock";
175 #clock-cells = <0>;
176 clock-frequency = <32768>;
177 clock-output-names = "v2m:refclk32khz";
178 };
179
180 iofpga@3,00000000 {
181 compatible = "arm,amba-bus", "simple-bus";
182 #address-cells = <1>;
183 #size-cells = <1>;
184 ranges = <0 3 0 0x200000>;
185
186 v2m_sysreg: sysreg@010000 {
187 compatible = "arm,vexpress-sysreg";
188 reg = <0x010000 0x1000>;
189 };
190
191 v2m_serial0: uart@090000 {
192 compatible = "arm,pl011", "arm,primecell";
193 reg = <0x090000 0x1000>;
194 interrupts = <5>;
195 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
196 clock-names = "uartclk", "apb_pclk";
197 };
198
199 v2m_serial1: uart@0a0000 {
200 compatible = "arm,pl011", "arm,primecell";
201 reg = <0x0a0000 0x1000>;
202 interrupts = <6>;
203 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
204 clock-names = "uartclk", "apb_pclk";
205 };
206
207 v2m_serial2: uart@0b0000 {
208 compatible = "arm,pl011", "arm,primecell";
209 reg = <0x0b0000 0x1000>;
210 interrupts = <7>;
211 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
212 clock-names = "uartclk", "apb_pclk";
213 };
214
215 v2m_serial3: uart@0c0000 {
216 compatible = "arm,pl011", "arm,primecell";
217 reg = <0x0c0000 0x1000>;
218 interrupts = <8>;
219 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
220 clock-names = "uartclk", "apb_pclk";
221 };
222
223 virtio_block@0130000 {
224 compatible = "virtio,mmio";
225 reg = <0x130000 0x1000>;
226 interrupts = <42>;
227 };
228 };
229 };
230};
diff --git a/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts b/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
new file mode 100644
index 000000000000..572005ea2217
--- /dev/null
+++ b/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
@@ -0,0 +1,159 @@
1/*
2 * ARM Ltd. Fast Models
3 *
4 * Architecture Envelope Model (AEM) ARMv8-A
5 * ARMAEMv8AMPCT
6 *
7 * RTSM_VE_AEMv8A.lisa
8 */
9
10/dts-v1/;
11
12/memreserve/ 0x80000000 0x00010000;
13
14/ {
15 model = "RTSM_VE_AEMv8A";
16 compatible = "arm,rtsm_ve,aemv8a", "arm,vexpress";
17 interrupt-parent = <&gic>;
18 #address-cells = <2>;
19 #size-cells = <2>;
20
21 chosen { };
22
23 aliases {
24 serial0 = &v2m_serial0;
25 serial1 = &v2m_serial1;
26 serial2 = &v2m_serial2;
27 serial3 = &v2m_serial3;
28 };
29
30 cpus {
31 #address-cells = <2>;
32 #size-cells = <0>;
33
34 cpu@0 {
35 device_type = "cpu";
36 compatible = "arm,armv8";
37 reg = <0x0 0x0>;
38 enable-method = "spin-table";
39 cpu-release-addr = <0x0 0x8000fff8>;
40 };
41 cpu@1 {
42 device_type = "cpu";
43 compatible = "arm,armv8";
44 reg = <0x0 0x1>;
45 enable-method = "spin-table";
46 cpu-release-addr = <0x0 0x8000fff8>;
47 };
48 cpu@2 {
49 device_type = "cpu";
50 compatible = "arm,armv8";
51 reg = <0x0 0x2>;
52 enable-method = "spin-table";
53 cpu-release-addr = <0x0 0x8000fff8>;
54 };
55 cpu@3 {
56 device_type = "cpu";
57 compatible = "arm,armv8";
58 reg = <0x0 0x3>;
59 enable-method = "spin-table";
60 cpu-release-addr = <0x0 0x8000fff8>;
61 };
62 };
63
64 memory@80000000 {
65 device_type = "memory";
66 reg = <0x00000000 0x80000000 0 0x80000000>,
67 <0x00000008 0x80000000 0 0x80000000>;
68 };
69
70 gic: interrupt-controller@2c001000 {
71 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
72 #interrupt-cells = <3>;
73 #address-cells = <0>;
74 interrupt-controller;
75 reg = <0x0 0x2c001000 0 0x1000>,
76 <0x0 0x2c002000 0 0x1000>,
77 <0x0 0x2c004000 0 0x2000>,
78 <0x0 0x2c006000 0 0x2000>;
79 interrupts = <1 9 0xf04>;
80 };
81
82 timer {
83 compatible = "arm,armv8-timer";
84 interrupts = <1 13 0xff01>,
85 <1 14 0xff01>,
86 <1 11 0xff01>,
87 <1 10 0xff01>;
88 clock-frequency = <100000000>;
89 };
90
91 pmu {
92 compatible = "arm,armv8-pmuv3";
93 interrupts = <0 60 4>,
94 <0 61 4>,
95 <0 62 4>,
96 <0 63 4>;
97 };
98
99 smb {
100 compatible = "simple-bus";
101
102 #address-cells = <2>;
103 #size-cells = <1>;
104 ranges = <0 0 0 0x08000000 0x04000000>,
105 <1 0 0 0x14000000 0x04000000>,
106 <2 0 0 0x18000000 0x04000000>,
107 <3 0 0 0x1c000000 0x04000000>,
108 <4 0 0 0x0c000000 0x04000000>,
109 <5 0 0 0x10000000 0x04000000>;
110
111 #interrupt-cells = <1>;
112 interrupt-map-mask = <0 0 63>;
113 interrupt-map = <0 0 0 &gic 0 0 4>,
114 <0 0 1 &gic 0 1 4>,
115 <0 0 2 &gic 0 2 4>,
116 <0 0 3 &gic 0 3 4>,
117 <0 0 4 &gic 0 4 4>,
118 <0 0 5 &gic 0 5 4>,
119 <0 0 6 &gic 0 6 4>,
120 <0 0 7 &gic 0 7 4>,
121 <0 0 8 &gic 0 8 4>,
122 <0 0 9 &gic 0 9 4>,
123 <0 0 10 &gic 0 10 4>,
124 <0 0 11 &gic 0 11 4>,
125 <0 0 12 &gic 0 12 4>,
126 <0 0 13 &gic 0 13 4>,
127 <0 0 14 &gic 0 14 4>,
128 <0 0 15 &gic 0 15 4>,
129 <0 0 16 &gic 0 16 4>,
130 <0 0 17 &gic 0 17 4>,
131 <0 0 18 &gic 0 18 4>,
132 <0 0 19 &gic 0 19 4>,
133 <0 0 20 &gic 0 20 4>,
134 <0 0 21 &gic 0 21 4>,
135 <0 0 22 &gic 0 22 4>,
136 <0 0 23 &gic 0 23 4>,
137 <0 0 24 &gic 0 24 4>,
138 <0 0 25 &gic 0 25 4>,
139 <0 0 26 &gic 0 26 4>,
140 <0 0 27 &gic 0 27 4>,
141 <0 0 28 &gic 0 28 4>,
142 <0 0 29 &gic 0 29 4>,
143 <0 0 30 &gic 0 30 4>,
144 <0 0 31 &gic 0 31 4>,
145 <0 0 32 &gic 0 32 4>,
146 <0 0 33 &gic 0 33 4>,
147 <0 0 34 &gic 0 34 4>,
148 <0 0 35 &gic 0 35 4>,
149 <0 0 36 &gic 0 36 4>,
150 <0 0 37 &gic 0 37 4>,
151 <0 0 38 &gic 0 38 4>,
152 <0 0 39 &gic 0 39 4>,
153 <0 0 40 &gic 0 40 4>,
154 <0 0 41 &gic 0 41 4>,
155 <0 0 42 &gic 0 42 4>;
156
157 /include/ "rtsm_ve-motherboard.dtsi"
158 };
159};
diff --git a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
new file mode 100644
index 000000000000..b45e5f39f577
--- /dev/null
+++ b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
@@ -0,0 +1,234 @@
1/*
2 * ARM Ltd. Fast Models
3 *
4 * Versatile Express (VE) system model
5 * Motherboard component
6 *
7 * VEMotherBoard.lisa
8 */
9
10 motherboard {
11 arm,v2m-memory-map = "rs1";
12 compatible = "arm,vexpress,v2m-p1", "simple-bus";
13 #address-cells = <2>; /* SMB chipselect number and offset */
14 #size-cells = <1>;
15 #interrupt-cells = <1>;
16 ranges;
17
18 flash@0,00000000 {
19 compatible = "arm,vexpress-flash", "cfi-flash";
20 reg = <0 0x00000000 0x04000000>,
21 <4 0x00000000 0x04000000>;
22 bank-width = <4>;
23 };
24
25 vram@2,00000000 {
26 compatible = "arm,vexpress-vram";
27 reg = <2 0x00000000 0x00800000>;
28 };
29
30 ethernet@2,02000000 {
31 compatible = "smsc,lan91c111";
32 reg = <2 0x02000000 0x10000>;
33 interrupts = <15>;
34 };
35
36 v2m_clk24mhz: clk24mhz {
37 compatible = "fixed-clock";
38 #clock-cells = <0>;
39 clock-frequency = <24000000>;
40 clock-output-names = "v2m:clk24mhz";
41 };
42
43 v2m_refclk1mhz: refclk1mhz {
44 compatible = "fixed-clock";
45 #clock-cells = <0>;
46 clock-frequency = <1000000>;
47 clock-output-names = "v2m:refclk1mhz";
48 };
49
50 v2m_refclk32khz: refclk32khz {
51 compatible = "fixed-clock";
52 #clock-cells = <0>;
53 clock-frequency = <32768>;
54 clock-output-names = "v2m:refclk32khz";
55 };
56
57 iofpga@3,00000000 {
58 compatible = "arm,amba-bus", "simple-bus";
59 #address-cells = <1>;
60 #size-cells = <1>;
61 ranges = <0 3 0 0x200000>;
62
63 v2m_sysreg: sysreg@010000 {
64 compatible = "arm,vexpress-sysreg";
65 reg = <0x010000 0x1000>;
66 gpio-controller;
67 #gpio-cells = <2>;
68 };
69
70 v2m_sysctl: sysctl@020000 {
71 compatible = "arm,sp810", "arm,primecell";
72 reg = <0x020000 0x1000>;
73 clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_clk24mhz>;
74 clock-names = "refclk", "timclk", "apb_pclk";
75 #clock-cells = <1>;
76 clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3";
77 };
78
79 aaci@040000 {
80 compatible = "arm,pl041", "arm,primecell";
81 reg = <0x040000 0x1000>;
82 interrupts = <11>;
83 clocks = <&v2m_clk24mhz>;
84 clock-names = "apb_pclk";
85 };
86
87 mmci@050000 {
88 compatible = "arm,pl180", "arm,primecell";
89 reg = <0x050000 0x1000>;
90 interrupts = <9 10>;
91 cd-gpios = <&v2m_sysreg 0 0>;
92 wp-gpios = <&v2m_sysreg 1 0>;
93 max-frequency = <12000000>;
94 vmmc-supply = <&v2m_fixed_3v3>;
95 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
96 clock-names = "mclk", "apb_pclk";
97 };
98
99 kmi@060000 {
100 compatible = "arm,pl050", "arm,primecell";
101 reg = <0x060000 0x1000>;
102 interrupts = <12>;
103 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
104 clock-names = "KMIREFCLK", "apb_pclk";
105 };
106
107 kmi@070000 {
108 compatible = "arm,pl050", "arm,primecell";
109 reg = <0x070000 0x1000>;
110 interrupts = <13>;
111 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
112 clock-names = "KMIREFCLK", "apb_pclk";
113 };
114
115 v2m_serial0: uart@090000 {
116 compatible = "arm,pl011", "arm,primecell";
117 reg = <0x090000 0x1000>;
118 interrupts = <5>;
119 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
120 clock-names = "uartclk", "apb_pclk";
121 };
122
123 v2m_serial1: uart@0a0000 {
124 compatible = "arm,pl011", "arm,primecell";
125 reg = <0x0a0000 0x1000>;
126 interrupts = <6>;
127 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
128 clock-names = "uartclk", "apb_pclk";
129 };
130
131 v2m_serial2: uart@0b0000 {
132 compatible = "arm,pl011", "arm,primecell";
133 reg = <0x0b0000 0x1000>;
134 interrupts = <7>;
135 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
136 clock-names = "uartclk", "apb_pclk";
137 };
138
139 v2m_serial3: uart@0c0000 {
140 compatible = "arm,pl011", "arm,primecell";
141 reg = <0x0c0000 0x1000>;
142 interrupts = <8>;
143 clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>;
144 clock-names = "uartclk", "apb_pclk";
145 };
146
147 wdt@0f0000 {
148 compatible = "arm,sp805", "arm,primecell";
149 reg = <0x0f0000 0x1000>;
150 interrupts = <0>;
151 clocks = <&v2m_refclk32khz>, <&v2m_clk24mhz>;
152 clock-names = "wdogclk", "apb_pclk";
153 };
154
155 v2m_timer01: timer@110000 {
156 compatible = "arm,sp804", "arm,primecell";
157 reg = <0x110000 0x1000>;
158 interrupts = <2>;
159 clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&v2m_clk24mhz>;
160 clock-names = "timclken1", "timclken2", "apb_pclk";
161 };
162
163 v2m_timer23: timer@120000 {
164 compatible = "arm,sp804", "arm,primecell";
165 reg = <0x120000 0x1000>;
166 interrupts = <3>;
167 clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&v2m_clk24mhz>;
168 clock-names = "timclken1", "timclken2", "apb_pclk";
169 };
170
171 rtc@170000 {
172 compatible = "arm,pl031", "arm,primecell";
173 reg = <0x170000 0x1000>;
174 interrupts = <4>;
175 clocks = <&v2m_clk24mhz>;
176 clock-names = "apb_pclk";
177 };
178
179 clcd@1f0000 {
180 compatible = "arm,pl111", "arm,primecell";
181 reg = <0x1f0000 0x1000>;
182 interrupts = <14>;
183 clocks = <&v2m_oscclk1>, <&v2m_clk24mhz>;
184 clock-names = "clcdclk", "apb_pclk";
185 };
186 };
187
188 v2m_fixed_3v3: fixedregulator@0 {
189 compatible = "regulator-fixed";
190 regulator-name = "3V3";
191 regulator-min-microvolt = <3300000>;
192 regulator-max-microvolt = <3300000>;
193 regulator-always-on;
194 };
195
196 mcc {
197 compatible = "arm,vexpress,config-bus", "simple-bus";
198 arm,vexpress,config-bridge = <&v2m_sysreg>;
199
200 v2m_oscclk1: osc@1 {
201 /* CLCD clock */
202 compatible = "arm,vexpress-osc";
203 arm,vexpress-sysreg,func = <1 1>;
204 freq-range = <23750000 63500000>;
205 #clock-cells = <0>;
206 clock-output-names = "v2m:oscclk1";
207 };
208
209 reset@0 {
210 compatible = "arm,vexpress-reset";
211 arm,vexpress-sysreg,func = <5 0>;
212 };
213
214 muxfpga@0 {
215 compatible = "arm,vexpress-muxfpga";
216 arm,vexpress-sysreg,func = <7 0>;
217 };
218
219 shutdown@0 {
220 compatible = "arm,vexpress-shutdown";
221 arm,vexpress-sysreg,func = <8 0>;
222 };
223
224 reboot@0 {
225 compatible = "arm,vexpress-reboot";
226 arm,vexpress-sysreg,func = <9 0>;
227 };
228
229 dvimode@0 {
230 compatible = "arm,vexpress-dvimode";
231 arm,vexpress-sysreg,func = <11 0>;
232 };
233 };
234 };
diff --git a/arch/arm64/boot/dts/skeleton.dtsi b/arch/arm64/boot/dts/skeleton.dtsi
new file mode 100644
index 000000000000..38ead821bb42
--- /dev/null
+++ b/arch/arm64/boot/dts/skeleton.dtsi
@@ -0,0 +1,13 @@
1/*
2 * Skeleton device tree; the bare minimum needed to boot; just include and
3 * add a compatible value. The bootloader will typically populate the memory
4 * node.
5 */
6
7/ {
8 #address-cells = <2>;
9 #size-cells = <1>;
10 chosen { };
11 aliases { };
12 memory { device_type = "memory"; reg = <0 0 0>; };
13};
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 09bef29f3a09..8d9696adb440 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -23,6 +23,7 @@ CONFIG_MODULES=y
23CONFIG_MODULE_UNLOAD=y 23CONFIG_MODULE_UNLOAD=y
24# CONFIG_BLK_DEV_BSG is not set 24# CONFIG_BLK_DEV_BSG is not set
25# CONFIG_IOSCHED_DEADLINE is not set 25# CONFIG_IOSCHED_DEADLINE is not set
26CONFIG_ARCH_VEXPRESS=y
26CONFIG_SMP=y 27CONFIG_SMP=y
27CONFIG_PREEMPT_VOLUNTARY=y 28CONFIG_PREEMPT_VOLUNTARY=y
28CONFIG_CMDLINE="console=ttyAMA0" 29CONFIG_CMDLINE="console=ttyAMA0"
@@ -47,11 +48,14 @@ CONFIG_BLK_DEV_SD=y
47# CONFIG_SCSI_LOWLEVEL is not set 48# CONFIG_SCSI_LOWLEVEL is not set
48CONFIG_NETDEVICES=y 49CONFIG_NETDEVICES=y
49CONFIG_MII=y 50CONFIG_MII=y
51CONFIG_SMC91X=y
50# CONFIG_WLAN is not set 52# CONFIG_WLAN is not set
51CONFIG_INPUT_EVDEV=y 53CONFIG_INPUT_EVDEV=y
52# CONFIG_SERIO_I8042 is not set 54# CONFIG_SERIO_I8042 is not set
53# CONFIG_SERIO_SERPORT is not set 55# CONFIG_SERIO_SERPORT is not set
54CONFIG_LEGACY_PTY_COUNT=16 56CONFIG_LEGACY_PTY_COUNT=16
57CONFIG_SERIAL_AMBA_PL011=y
58CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
55# CONFIG_HW_RANDOM is not set 59# CONFIG_HW_RANDOM is not set
56# CONFIG_HWMON is not set 60# CONFIG_HWMON is not set
57CONFIG_FB=y 61CONFIG_FB=y
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index e5fe4f99fe10..79a642d199f2 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -39,7 +39,6 @@ generic-y += shmbuf.h
39generic-y += sizes.h 39generic-y += sizes.h
40generic-y += socket.h 40generic-y += socket.h
41generic-y += sockios.h 41generic-y += sockios.h
42generic-y += string.h
43generic-y += switch_to.h 42generic-y += switch_to.h
44generic-y += swab.h 43generic-y += swab.h
45generic-y += termbits.h 44generic-y += termbits.h
@@ -49,4 +48,5 @@ generic-y += trace_clock.h
49generic-y += types.h 48generic-y += types.h
50generic-y += unaligned.h 49generic-y += unaligned.h
51generic-y += user.h 50generic-y += user.h
51generic-y += vga.h
52generic-y += xor.h 52generic-y += xor.h
diff --git a/arch/arm64/include/asm/bitops.h b/arch/arm64/include/asm/bitops.h
index 5e693073b030..aa5b59d6ba43 100644
--- a/arch/arm64/include/asm/bitops.h
+++ b/arch/arm64/include/asm/bitops.h
@@ -32,6 +32,16 @@
32#error only <linux/bitops.h> can be included directly 32#error only <linux/bitops.h> can be included directly
33#endif 33#endif
34 34
35/*
36 * Little endian assembly atomic bitops.
37 */
38extern void set_bit(int nr, volatile unsigned long *p);
39extern void clear_bit(int nr, volatile unsigned long *p);
40extern void change_bit(int nr, volatile unsigned long *p);
41extern int test_and_set_bit(int nr, volatile unsigned long *p);
42extern int test_and_clear_bit(int nr, volatile unsigned long *p);
43extern int test_and_change_bit(int nr, volatile unsigned long *p);
44
35#include <asm-generic/bitops/builtin-__ffs.h> 45#include <asm-generic/bitops/builtin-__ffs.h>
36#include <asm-generic/bitops/builtin-ffs.h> 46#include <asm-generic/bitops/builtin-ffs.h>
37#include <asm-generic/bitops/builtin-__fls.h> 47#include <asm-generic/bitops/builtin-__fls.h>
@@ -45,9 +55,13 @@
45#include <asm-generic/bitops/hweight.h> 55#include <asm-generic/bitops/hweight.h>
46#include <asm-generic/bitops/lock.h> 56#include <asm-generic/bitops/lock.h>
47 57
48#include <asm-generic/bitops/atomic.h>
49#include <asm-generic/bitops/non-atomic.h> 58#include <asm-generic/bitops/non-atomic.h>
50#include <asm-generic/bitops/le.h> 59#include <asm-generic/bitops/le.h>
51#include <asm-generic/bitops/ext2-atomic.h> 60
61/*
62 * Ext2 is defined to use little-endian byte ordering.
63 */
64#define ext2_set_bit_atomic(lock, nr, p) test_and_set_bit_le(nr, p)
65#define ext2_clear_bit_atomic(lock, nr, p) test_and_clear_bit_le(nr, p)
52 66
53#endif /* __ASM_BITOPS_H */ 67#endif /* __ASM_BITOPS_H */
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 968b5cbfc260..8a8ce0e73a38 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -170,4 +170,7 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
170 (unsigned long)(n), \ 170 (unsigned long)(n), \
171 sizeof(*(ptr)))) 171 sizeof(*(ptr))))
172 172
173#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
174#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n))
175
173#endif /* __ASM_CMPXCHG_H */ 176#endif /* __ASM_CMPXCHG_H */
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index 618b450e5a1d..899af807ef0f 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -35,14 +35,16 @@ typedef s32 compat_clock_t;
35typedef s32 compat_pid_t; 35typedef s32 compat_pid_t;
36typedef u32 __compat_uid_t; 36typedef u32 __compat_uid_t;
37typedef u32 __compat_gid_t; 37typedef u32 __compat_gid_t;
38typedef u16 __compat_uid16_t;
39typedef u16 __compat_gid16_t;
38typedef u32 __compat_uid32_t; 40typedef u32 __compat_uid32_t;
39typedef u32 __compat_gid32_t; 41typedef u32 __compat_gid32_t;
40typedef u32 compat_mode_t; 42typedef u16 compat_mode_t;
41typedef u32 compat_ino_t; 43typedef u32 compat_ino_t;
42typedef u32 compat_dev_t; 44typedef u32 compat_dev_t;
43typedef s32 compat_off_t; 45typedef s32 compat_off_t;
44typedef s64 compat_loff_t; 46typedef s64 compat_loff_t;
45typedef s16 compat_nlink_t; 47typedef s32 compat_nlink_t;
46typedef u16 compat_ipc_pid_t; 48typedef u16 compat_ipc_pid_t;
47typedef s32 compat_daddr_t; 49typedef s32 compat_daddr_t;
48typedef u32 compat_caddr_t; 50typedef u32 compat_caddr_t;
@@ -50,9 +52,11 @@ typedef __kernel_fsid_t compat_fsid_t;
50typedef s32 compat_key_t; 52typedef s32 compat_key_t;
51typedef s32 compat_timer_t; 53typedef s32 compat_timer_t;
52 54
55typedef s16 compat_short_t;
53typedef s32 compat_int_t; 56typedef s32 compat_int_t;
54typedef s32 compat_long_t; 57typedef s32 compat_long_t;
55typedef s64 compat_s64; 58typedef s64 compat_s64;
59typedef u16 compat_ushort_t;
56typedef u32 compat_uint_t; 60typedef u32 compat_uint_t;
57typedef u32 compat_ulong_t; 61typedef u32 compat_ulong_t;
58typedef u64 compat_u64; 62typedef u64 compat_u64;
@@ -72,20 +76,20 @@ struct compat_stat {
72 compat_dev_t st_dev; 76 compat_dev_t st_dev;
73 compat_ino_t st_ino; 77 compat_ino_t st_ino;
74 compat_mode_t st_mode; 78 compat_mode_t st_mode;
75 compat_nlink_t st_nlink; 79 compat_ushort_t st_nlink;
76 __compat_uid32_t st_uid; 80 __compat_uid16_t st_uid;
77 __compat_gid32_t st_gid; 81 __compat_gid16_t st_gid;
78 compat_dev_t st_rdev; 82 compat_dev_t st_rdev;
79 compat_off_t st_size; 83 compat_off_t st_size;
80 compat_off_t st_blksize; 84 compat_off_t st_blksize;
81 compat_off_t st_blocks; 85 compat_off_t st_blocks;
82 compat_time_t st_atime; 86 compat_time_t st_atime;
83 u32 st_atime_nsec; 87 compat_ulong_t st_atime_nsec;
84 compat_time_t st_mtime; 88 compat_time_t st_mtime;
85 u32 st_mtime_nsec; 89 compat_ulong_t st_mtime_nsec;
86 compat_time_t st_ctime; 90 compat_time_t st_ctime;
87 u32 st_ctime_nsec; 91 compat_ulong_t st_ctime_nsec;
88 u32 __unused4[2]; 92 compat_ulong_t __unused4[2];
89}; 93};
90 94
91struct compat_flock { 95struct compat_flock {
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index ef54125e6c1e..cf2749488cd4 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -17,6 +17,7 @@
17#define __ASM_CPUTYPE_H 17#define __ASM_CPUTYPE_H
18 18
19#define ID_MIDR_EL1 "midr_el1" 19#define ID_MIDR_EL1 "midr_el1"
20#define ID_MPIDR_EL1 "mpidr_el1"
20#define ID_CTR_EL0 "ctr_el0" 21#define ID_CTR_EL0 "ctr_el0"
21 22
22#define ID_AA64PFR0_EL1 "id_aa64pfr0_el1" 23#define ID_AA64PFR0_EL1 "id_aa64pfr0_el1"
@@ -25,12 +26,24 @@
25#define ID_AA64ISAR0_EL1 "id_aa64isar0_el1" 26#define ID_AA64ISAR0_EL1 "id_aa64isar0_el1"
26#define ID_AA64MMFR0_EL1 "id_aa64mmfr0_el1" 27#define ID_AA64MMFR0_EL1 "id_aa64mmfr0_el1"
27 28
29#define INVALID_HWID ULONG_MAX
30
31#define MPIDR_HWID_BITMASK 0xff00ffffff
32
28#define read_cpuid(reg) ({ \ 33#define read_cpuid(reg) ({ \
29 u64 __val; \ 34 u64 __val; \
30 asm("mrs %0, " reg : "=r" (__val)); \ 35 asm("mrs %0, " reg : "=r" (__val)); \
31 __val; \ 36 __val; \
32}) 37})
33 38
39#define ARM_CPU_IMP_ARM 0x41
40
41#define ARM_CPU_PART_AEM_V8 0xD0F0
42#define ARM_CPU_PART_FOUNDATION 0xD000
43#define ARM_CPU_PART_CORTEX_A57 0xD070
44
45#ifndef __ASSEMBLY__
46
34/* 47/*
35 * The CPU ID never changes at run time, so we might as well tell the 48 * The CPU ID never changes at run time, so we might as well tell the
36 * compiler that it's constant. Use this function to read the CPU ID 49 * compiler that it's constant. Use this function to read the CPU ID
@@ -41,9 +54,26 @@ static inline u32 __attribute_const__ read_cpuid_id(void)
41 return read_cpuid(ID_MIDR_EL1); 54 return read_cpuid(ID_MIDR_EL1);
42} 55}
43 56
57static inline u64 __attribute_const__ read_cpuid_mpidr(void)
58{
59 return read_cpuid(ID_MPIDR_EL1);
60}
61
62static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
63{
64 return (read_cpuid_id() & 0xFF000000) >> 24;
65}
66
67static inline unsigned int __attribute_const__ read_cpuid_part_number(void)
68{
69 return (read_cpuid_id() & 0xFFF0);
70}
71
44static inline u32 __attribute_const__ read_cpuid_cachetype(void) 72static inline u32 __attribute_const__ read_cpuid_cachetype(void)
45{ 73{
46 return read_cpuid(ID_CTR_EL0); 74 return read_cpuid(ID_CTR_EL0);
47} 75}
48 76
77#endif /* __ASSEMBLY__ */
78
49#endif 79#endif
diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h
new file mode 100644
index 000000000000..78834123a32e
--- /dev/null
+++ b/arch/arm64/include/asm/esr.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.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 version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __ASM_ESR_H
19#define __ASM_ESR_H
20
21#define ESR_EL1_EC_SHIFT (26)
22#define ESR_EL1_IL (1U << 25)
23
24#define ESR_EL1_EC_UNKNOWN (0x00)
25#define ESR_EL1_EC_WFI (0x01)
26#define ESR_EL1_EC_CP15_32 (0x03)
27#define ESR_EL1_EC_CP15_64 (0x04)
28#define ESR_EL1_EC_CP14_MR (0x05)
29#define ESR_EL1_EC_CP14_LS (0x06)
30#define ESR_EL1_EC_FP_ASIMD (0x07)
31#define ESR_EL1_EC_CP10_ID (0x08)
32#define ESR_EL1_EC_CP14_64 (0x0C)
33#define ESR_EL1_EC_ILL_ISS (0x0E)
34#define ESR_EL1_EC_SVC32 (0x11)
35#define ESR_EL1_EC_SVC64 (0x15)
36#define ESR_EL1_EC_SYS64 (0x18)
37#define ESR_EL1_EC_IABT_EL0 (0x20)
38#define ESR_EL1_EC_IABT_EL1 (0x21)
39#define ESR_EL1_EC_PC_ALIGN (0x22)
40#define ESR_EL1_EC_DABT_EL0 (0x24)
41#define ESR_EL1_EC_DABT_EL1 (0x25)
42#define ESR_EL1_EC_SP_ALIGN (0x26)
43#define ESR_EL1_EC_FP_EXC32 (0x28)
44#define ESR_EL1_EC_FP_EXC64 (0x2C)
45#define ESR_EL1_EC_SERRROR (0x2F)
46#define ESR_EL1_EC_BREAKPT_EL0 (0x30)
47#define ESR_EL1_EC_BREAKPT_EL1 (0x31)
48#define ESR_EL1_EC_SOFTSTP_EL0 (0x32)
49#define ESR_EL1_EC_SOFTSTP_EL1 (0x33)
50#define ESR_EL1_EC_WATCHPT_EL0 (0x34)
51#define ESR_EL1_EC_WATCHPT_EL1 (0x35)
52#define ESR_EL1_EC_BKPT32 (0x38)
53#define ESR_EL1_EC_BRK64 (0x3C)
54
55#endif /* __ASM_ESR_H */
diff --git a/arch/arm64/include/asm/exception.h b/arch/arm64/include/asm/exception.h
index ac63519b7b90..0303705fcad6 100644
--- a/arch/arm64/include/asm/exception.h
+++ b/arch/arm64/include/asm/exception.h
@@ -19,5 +19,6 @@
19#define __ASM_EXCEPTION_H 19#define __ASM_EXCEPTION_H
20 20
21#define __exception __attribute__((section(".exception.text"))) 21#define __exception __attribute__((section(".exception.text")))
22#define __exception_irq_entry __exception
22 23
23#endif /* __ASM_EXCEPTION_H */ 24#endif /* __ASM_EXCEPTION_H */
diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h
index 507546353d62..990c051e7829 100644
--- a/arch/arm64/include/asm/hardirq.h
+++ b/arch/arm64/include/asm/hardirq.h
@@ -49,4 +49,9 @@ static inline void ack_bad_irq(unsigned int irq)
49 49
50extern void handle_IRQ(unsigned int, struct pt_regs *); 50extern void handle_IRQ(unsigned int, struct pt_regs *);
51 51
52/*
53 * No arch-specific IRQ flags.
54 */
55#define set_irq_flags(irq, flags)
56
52#endif /* __ASM_HARDIRQ_H */ 57#endif /* __ASM_HARDIRQ_H */
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 57f12c991de2..2e12258aa7e4 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -92,10 +92,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
92#define readb_relaxed(c) ({ u8 __v = __raw_readb(c); __v; }) 92#define readb_relaxed(c) ({ u8 __v = __raw_readb(c); __v; })
93#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16)__raw_readw(c)); __v; }) 93#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16)__raw_readw(c)); __v; })
94#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32)__raw_readl(c)); __v; }) 94#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32)__raw_readl(c)); __v; })
95#define readq_relaxed(c) ({ u64 __v = le64_to_cpu((__force __le64)__raw_readq(c)); __v; })
95 96
96#define writeb_relaxed(v,c) ((void)__raw_writeb((v),(c))) 97#define writeb_relaxed(v,c) ((void)__raw_writeb((v),(c)))
97#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c))) 98#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c)))
98#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c))) 99#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c)))
100#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)cpu_to_le64(v),(c)))
99 101
100/* 102/*
101 * I/O memory access primitives. Reads are ordered relative to any 103 * I/O memory access primitives. Reads are ordered relative to any
@@ -105,10 +107,12 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
105#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) 107#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
106#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) 108#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
107#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) 109#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
110#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(); __v; })
108 111
109#define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); }) 112#define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); })
110#define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) 113#define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); })
111#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); }) 114#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); })
115#define writeq(v,c) ({ __iowmb(); writeq_relaxed((v),(c)); })
112 116
113/* 117/*
114 * I/O port access primitives. 118 * I/O port access primitives.
diff --git a/arch/arm64/include/asm/irq.h b/arch/arm64/include/asm/irq.h
index a4e1cad3202a..0332fc077f6e 100644
--- a/arch/arm64/include/asm/irq.h
+++ b/arch/arm64/include/asm/irq.h
@@ -4,5 +4,6 @@
4#include <asm-generic/irq.h> 4#include <asm-generic/irq.h>
5 5
6extern void (*handle_arch_irq)(struct pt_regs *); 6extern void (*handle_arch_irq)(struct pt_regs *);
7extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
7 8
8#endif 9#endif
diff --git a/arch/arm64/lib/bitops.c b/arch/arm64/include/asm/smp_plat.h
index aa4965e60acc..ed43a0d2b1b2 100644
--- a/arch/arm64/lib/bitops.c
+++ b/arch/arm64/include/asm/smp_plat.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * Copyright (C) 2012 ARM Limited 2 * Definitions specific to SMP platforms.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * Copyright (C) 2013 ARM Ltd.
5 *
6 * 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 7 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
7 * 9 *
@@ -14,12 +16,15 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 17 */
16 18
17#include <linux/kernel.h> 19#ifndef __ASM_SMP_PLAT_H
18#include <linux/spinlock.h> 20#define __ASM_SMP_PLAT_H
19#include <linux/atomic.h> 21
22#include <asm/types.h>
23
24/*
25 * Logical CPU mapping.
26 */
27extern u64 __cpu_logical_map[NR_CPUS];
28#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
20 29
21#ifdef CONFIG_SMP 30#endif /* __ASM_SMP_PLAT_H */
22arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = {
23 [0 ... (ATOMIC_HASH_SIZE-1)] = __ARCH_SPIN_LOCK_UNLOCKED
24};
25#endif
diff --git a/arch/arm64/include/asm/string.h b/arch/arm64/include/asm/string.h
new file mode 100644
index 000000000000..3ee8b303d9a9
--- /dev/null
+++ b/arch/arm64/include/asm/string.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2013 ARM Ltd.
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 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __ASM_STRING_H
17#define __ASM_STRING_H
18
19#define __HAVE_ARCH_STRRCHR
20extern char *strrchr(const char *, int c);
21
22#define __HAVE_ARCH_STRCHR
23extern char *strchr(const char *, int c);
24
25#define __HAVE_ARCH_MEMCPY
26extern void *memcpy(void *, const void *, __kernel_size_t);
27
28#define __HAVE_ARCH_MEMMOVE
29extern void *memmove(void *, const void *, __kernel_size_t);
30
31#define __HAVE_ARCH_MEMCHR
32extern void *memchr(const void *, int, __kernel_size_t);
33
34#define __HAVE_ARCH_MEMSET
35extern void *memset(void *, int, __kernel_size_t);
36
37#endif
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c
index aa3e948f7885..7df1aad29b67 100644
--- a/arch/arm64/kernel/arm64ksyms.c
+++ b/arch/arm64/kernel/arm64ksyms.c
@@ -39,10 +39,21 @@ EXPORT_SYMBOL(__copy_from_user);
39EXPORT_SYMBOL(__copy_to_user); 39EXPORT_SYMBOL(__copy_to_user);
40EXPORT_SYMBOL(__clear_user); 40EXPORT_SYMBOL(__clear_user);
41 41
42 /* bitops */
43#ifdef CONFIG_SMP
44EXPORT_SYMBOL(__atomic_hash);
45#endif
46
47 /* physical memory */ 42 /* physical memory */
48EXPORT_SYMBOL(memstart_addr); 43EXPORT_SYMBOL(memstart_addr);
44
45 /* string / mem functions */
46EXPORT_SYMBOL(strchr);
47EXPORT_SYMBOL(strrchr);
48EXPORT_SYMBOL(memset);
49EXPORT_SYMBOL(memcpy);
50EXPORT_SYMBOL(memmove);
51EXPORT_SYMBOL(memchr);
52
53 /* atomic bitops */
54EXPORT_SYMBOL(set_bit);
55EXPORT_SYMBOL(test_and_set_bit);
56EXPORT_SYMBOL(clear_bit);
57EXPORT_SYMBOL(test_and_clear_bit);
58EXPORT_SYMBOL(change_bit);
59EXPORT_SYMBOL(test_and_change_bit);
diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c
index 7e320a2edb9b..ac974f48a7a2 100644
--- a/arch/arm64/kernel/early_printk.c
+++ b/arch/arm64/kernel/early_printk.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <linux/amba/serial.h> 26#include <linux/amba/serial.h>
27#include <linux/serial_reg.h>
27 28
28static void __iomem *early_base; 29static void __iomem *early_base;
29static void (*printch)(char ch); 30static void (*printch)(char ch);
@@ -40,6 +41,37 @@ static void pl011_printch(char ch)
40 ; 41 ;
41} 42}
42 43
44/*
45 * Semihosting-based debug console
46 */
47static void smh_printch(char ch)
48{
49 asm volatile("mov x1, %0\n"
50 "mov x0, #3\n"
51 "hlt 0xf000\n"
52 : : "r" (&ch) : "x0", "x1", "memory");
53}
54
55/*
56 * 8250/16550 (8-bit aligned registers) single character TX.
57 */
58static void uart8250_8bit_printch(char ch)
59{
60 while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE))
61 ;
62 writeb_relaxed(ch, early_base + UART_TX);
63}
64
65/*
66 * 8250/16550 (32-bit aligned registers) single character TX.
67 */
68static void uart8250_32bit_printch(char ch)
69{
70 while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE))
71 ;
72 writel_relaxed(ch, early_base + (UART_TX << 2));
73}
74
43struct earlycon_match { 75struct earlycon_match {
44 const char *name; 76 const char *name;
45 void (*printch)(char ch); 77 void (*printch)(char ch);
@@ -47,6 +79,9 @@ struct earlycon_match {
47 79
48static const struct earlycon_match earlycon_match[] __initconst = { 80static const struct earlycon_match earlycon_match[] __initconst = {
49 { .name = "pl011", .printch = pl011_printch, }, 81 { .name = "pl011", .printch = pl011_printch, },
82 { .name = "smh", .printch = smh_printch, },
83 { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, },
84 { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, },
50 {} 85 {}
51}; 86};
52 87
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 514d6098dbee..c7e047049f2c 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -24,6 +24,7 @@
24#include <asm/assembler.h> 24#include <asm/assembler.h>
25#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
26#include <asm/errno.h> 26#include <asm/errno.h>
27#include <asm/esr.h>
27#include <asm/thread_info.h> 28#include <asm/thread_info.h>
28#include <asm/unistd.h> 29#include <asm/unistd.h>
29#include <asm/unistd32.h> 30#include <asm/unistd32.h>
@@ -239,18 +240,18 @@ ENDPROC(el1_error_invalid)
239el1_sync: 240el1_sync:
240 kernel_entry 1 241 kernel_entry 1
241 mrs x1, esr_el1 // read the syndrome register 242 mrs x1, esr_el1 // read the syndrome register
242 lsr x24, x1, #26 // exception class 243 lsr x24, x1, #ESR_EL1_EC_SHIFT // exception class
243 cmp x24, #0x25 // data abort in EL1 244 cmp x24, #ESR_EL1_EC_DABT_EL1 // data abort in EL1
244 b.eq el1_da 245 b.eq el1_da
245 cmp x24, #0x18 // configurable trap 246 cmp x24, #ESR_EL1_EC_SYS64 // configurable trap
246 b.eq el1_undef 247 b.eq el1_undef
247 cmp x24, #0x26 // stack alignment exception 248 cmp x24, #ESR_EL1_EC_SP_ALIGN // stack alignment exception
248 b.eq el1_sp_pc 249 b.eq el1_sp_pc
249 cmp x24, #0x22 // pc alignment exception 250 cmp x24, #ESR_EL1_EC_PC_ALIGN // pc alignment exception
250 b.eq el1_sp_pc 251 b.eq el1_sp_pc
251 cmp x24, #0x00 // unknown exception in EL1 252 cmp x24, #ESR_EL1_EC_UNKNOWN // unknown exception in EL1
252 b.eq el1_undef 253 b.eq el1_undef
253 cmp x24, #0x30 // debug exception in EL1 254 cmp x24, #ESR_EL1_EC_BREAKPT_EL1 // debug exception in EL1
254 b.ge el1_dbg 255 b.ge el1_dbg
255 b el1_inv 256 b el1_inv
256el1_da: 257el1_da:
@@ -346,27 +347,27 @@ el1_preempt:
346el0_sync: 347el0_sync:
347 kernel_entry 0 348 kernel_entry 0
348 mrs x25, esr_el1 // read the syndrome register 349 mrs x25, esr_el1 // read the syndrome register
349 lsr x24, x25, #26 // exception class 350 lsr x24, x25, #ESR_EL1_EC_SHIFT // exception class
350 cmp x24, #0x15 // SVC in 64-bit state 351 cmp x24, #ESR_EL1_EC_SVC64 // SVC in 64-bit state
351 b.eq el0_svc 352 b.eq el0_svc
352 adr lr, ret_from_exception 353 adr lr, ret_from_exception
353 cmp x24, #0x24 // data abort in EL0 354 cmp x24, #ESR_EL1_EC_DABT_EL0 // data abort in EL0
354 b.eq el0_da 355 b.eq el0_da
355 cmp x24, #0x20 // instruction abort in EL0 356 cmp x24, #ESR_EL1_EC_IABT_EL0 // instruction abort in EL0
356 b.eq el0_ia 357 b.eq el0_ia
357 cmp x24, #0x07 // FP/ASIMD access 358 cmp x24, #ESR_EL1_EC_FP_ASIMD // FP/ASIMD access
358 b.eq el0_fpsimd_acc 359 b.eq el0_fpsimd_acc
359 cmp x24, #0x2c // FP/ASIMD exception 360 cmp x24, #ESR_EL1_EC_FP_EXC64 // FP/ASIMD exception
360 b.eq el0_fpsimd_exc 361 b.eq el0_fpsimd_exc
361 cmp x24, #0x18 // configurable trap 362 cmp x24, #ESR_EL1_EC_SYS64 // configurable trap
362 b.eq el0_undef 363 b.eq el0_undef
363 cmp x24, #0x26 // stack alignment exception 364 cmp x24, #ESR_EL1_EC_SP_ALIGN // stack alignment exception
364 b.eq el0_sp_pc 365 b.eq el0_sp_pc
365 cmp x24, #0x22 // pc alignment exception 366 cmp x24, #ESR_EL1_EC_PC_ALIGN // pc alignment exception
366 b.eq el0_sp_pc 367 b.eq el0_sp_pc
367 cmp x24, #0x00 // unknown exception in EL0 368 cmp x24, #ESR_EL1_EC_UNKNOWN // unknown exception in EL0
368 b.eq el0_undef 369 b.eq el0_undef
369 cmp x24, #0x30 // debug exception in EL0 370 cmp x24, #ESR_EL1_EC_BREAKPT_EL0 // debug exception in EL0
370 b.ge el0_dbg 371 b.ge el0_dbg
371 b el0_inv 372 b el0_inv
372 373
@@ -375,21 +376,21 @@ el0_sync:
375el0_sync_compat: 376el0_sync_compat:
376 kernel_entry 0, 32 377 kernel_entry 0, 32
377 mrs x25, esr_el1 // read the syndrome register 378 mrs x25, esr_el1 // read the syndrome register
378 lsr x24, x25, #26 // exception class 379 lsr x24, x25, #ESR_EL1_EC_SHIFT // exception class
379 cmp x24, #0x11 // SVC in 32-bit state 380 cmp x24, #ESR_EL1_EC_SVC32 // SVC in 32-bit state
380 b.eq el0_svc_compat 381 b.eq el0_svc_compat
381 adr lr, ret_from_exception 382 adr lr, ret_from_exception
382 cmp x24, #0x24 // data abort in EL0 383 cmp x24, #ESR_EL1_EC_DABT_EL0 // data abort in EL0
383 b.eq el0_da 384 b.eq el0_da
384 cmp x24, #0x20 // instruction abort in EL0 385 cmp x24, #ESR_EL1_EC_IABT_EL0 // instruction abort in EL0
385 b.eq el0_ia 386 b.eq el0_ia
386 cmp x24, #0x07 // FP/ASIMD access 387 cmp x24, #ESR_EL1_EC_FP_ASIMD // FP/ASIMD access
387 b.eq el0_fpsimd_acc 388 b.eq el0_fpsimd_acc
388 cmp x24, #0x28 // FP/ASIMD exception 389 cmp x24, #ESR_EL1_EC_FP_EXC32 // FP/ASIMD exception
389 b.eq el0_fpsimd_exc 390 b.eq el0_fpsimd_exc
390 cmp x24, #0x00 // unknown exception in EL0 391 cmp x24, #ESR_EL1_EC_UNKNOWN // unknown exception in EL0
391 b.eq el0_undef 392 b.eq el0_undef
392 cmp x24, #0x30 // debug exception in EL0 393 cmp x24, #ESR_EL1_EC_BREAKPT_EL0 // debug exception in EL0
393 b.ge el0_dbg 394 b.ge el0_dbg
394 b el0_inv 395 b el0_inv
395el0_svc_compat: 396el0_svc_compat:
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 0a0a49756826..53dcae49e729 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -26,6 +26,7 @@
26#include <asm/assembler.h> 26#include <asm/assembler.h>
27#include <asm/ptrace.h> 27#include <asm/ptrace.h>
28#include <asm/asm-offsets.h> 28#include <asm/asm-offsets.h>
29#include <asm/cputype.h>
29#include <asm/memory.h> 30#include <asm/memory.h>
30#include <asm/thread_info.h> 31#include <asm/thread_info.h>
31#include <asm/pgtable-hwdef.h> 32#include <asm/pgtable-hwdef.h>
@@ -229,7 +230,8 @@ ENTRY(secondary_holding_pen)
229 bl __calc_phys_offset // x24=phys offset 230 bl __calc_phys_offset // x24=phys offset
230 bl el2_setup // Drop to EL1 231 bl el2_setup // Drop to EL1
231 mrs x0, mpidr_el1 232 mrs x0, mpidr_el1
232 and x0, x0, #15 // CPU number 233 ldr x1, =MPIDR_HWID_BITMASK
234 and x0, x0, x1
233 adr x1, 1b 235 adr x1, 1b
234 ldp x2, x3, [x1] 236 ldp x2, x3, [x1]
235 sub x1, x1, x2 237 sub x1, x1, x2
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c
index 0373c6609eaf..ecb3354292ed 100644
--- a/arch/arm64/kernel/irq.c
+++ b/arch/arm64/kernel/irq.c
@@ -25,7 +25,7 @@
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/smp.h> 26#include <linux/smp.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/of_irq.h> 28#include <linux/irqchip.h>
29#include <linux/seq_file.h> 29#include <linux/seq_file.h>
30#include <linux/ratelimit.h> 30#include <linux/ratelimit.h>
31 31
@@ -67,18 +67,17 @@ void handle_IRQ(unsigned int irq, struct pt_regs *regs)
67 set_irq_regs(old_regs); 67 set_irq_regs(old_regs);
68} 68}
69 69
70/* 70void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
71 * Interrupt controllers supported by the kernel. 71{
72 */ 72 if (handle_arch_irq)
73static const struct of_device_id intctrl_of_match[] __initconst = { 73 return;
74 /* IRQ controllers { .compatible, .data } info to go here */ 74
75 {} 75 handle_arch_irq = handle_irq;
76}; 76}
77 77
78void __init init_IRQ(void) 78void __init init_IRQ(void)
79{ 79{
80 of_irq_init(intctrl_of_match); 80 irqchip_init();
81
82 if (!handle_arch_irq) 81 if (!handle_arch_irq)
83 panic("No interrupt controller found."); 82 panic("No interrupt controller found.");
84} 83}
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 0337cdb0667b..f4919721f7dd 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -84,11 +84,15 @@ EXPORT_SYMBOL_GPL(pm_power_off);
84void (*pm_restart)(const char *cmd); 84void (*pm_restart)(const char *cmd);
85EXPORT_SYMBOL_GPL(pm_restart); 85EXPORT_SYMBOL_GPL(pm_restart);
86 86
87void arch_cpu_idle_prepare(void)
88{
89 local_fiq_enable();
90}
87 91
88/* 92/*
89 * This is our default idle handler. 93 * This is our default idle handler.
90 */ 94 */
91static void default_idle(void) 95void arch_cpu_idle(void)
92{ 96{
93 /* 97 /*
94 * This should do all the clock switching and wait for interrupt 98 * This should do all the clock switching and wait for interrupt
@@ -98,43 +102,6 @@ static void default_idle(void)
98 local_irq_enable(); 102 local_irq_enable();
99} 103}
100 104
101/*
102 * The idle thread.
103 * We always respect 'hlt_counter' to prevent low power idle.
104 */
105void cpu_idle(void)
106{
107 local_fiq_enable();
108
109 /* endless idle loop with no priority at all */
110 while (1) {
111 tick_nohz_idle_enter();
112 rcu_idle_enter();
113 while (!need_resched()) {
114 /*
115 * We need to disable interrupts here to ensure
116 * we don't miss a wakeup call.
117 */
118 local_irq_disable();
119 if (!need_resched()) {
120 stop_critical_timings();
121 default_idle();
122 start_critical_timings();
123 /*
124 * default_idle functions should always return
125 * with IRQs enabled.
126 */
127 WARN_ON(irqs_disabled());
128 } else {
129 local_irq_enable();
130 }
131 }
132 rcu_idle_exit();
133 tick_nohz_idle_exit();
134 schedule_preempt_disabled();
135 }
136}
137
138void machine_shutdown(void) 105void machine_shutdown(void)
139{ 106{
140#ifdef CONFIG_SMP 107#ifdef CONFIG_SMP
@@ -178,11 +145,7 @@ void __show_regs(struct pt_regs *regs)
178{ 145{
179 int i; 146 int i;
180 147
181 printk("CPU: %d %s (%s %.*s)\n", 148 show_regs_print_info(KERN_DEFAULT);
182 raw_smp_processor_id(), print_tainted(),
183 init_utsname()->release,
184 (int)strcspn(init_utsname()->version, " "),
185 init_utsname()->version);
186 print_symbol("PC is at %s\n", instruction_pointer(regs)); 149 print_symbol("PC is at %s\n", instruction_pointer(regs));
187 print_symbol("LR is at %s\n", regs->regs[30]); 150 print_symbol("LR is at %s\n", regs->regs[30]);
188 printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", 151 printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n",
@@ -199,7 +162,6 @@ void __show_regs(struct pt_regs *regs)
199void show_regs(struct pt_regs * regs) 162void show_regs(struct pt_regs * regs)
200{ 163{
201 printk("\n"); 164 printk("\n");
202 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
203 __show_regs(regs); 165 __show_regs(regs);
204} 166}
205 167
@@ -311,11 +273,17 @@ struct task_struct *__switch_to(struct task_struct *prev,
311 fpsimd_thread_switch(next); 273 fpsimd_thread_switch(next);
312 tls_thread_switch(next); 274 tls_thread_switch(next);
313 hw_breakpoint_thread_switch(next); 275 hw_breakpoint_thread_switch(next);
276 contextidr_thread_switch(next);
277
278 /*
279 * Complete any pending TLB or cache maintenance on this CPU in case
280 * the thread migrates to a different CPU.
281 */
282 dsb();
314 283
315 /* the actual thread switch */ 284 /* the actual thread switch */
316 last = cpu_switch_to(prev, next); 285 last = cpu_switch_to(prev, next);
317 286
318 contextidr_thread_switch(next);
319 return last; 287 return last;
320} 288}
321 289
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 113db863f832..6a9a53292590 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -32,6 +32,7 @@
32#include <linux/kexec.h> 32#include <linux/kexec.h>
33#include <linux/crash_dump.h> 33#include <linux/crash_dump.h>
34#include <linux/root_dev.h> 34#include <linux/root_dev.h>
35#include <linux/clk-provider.h>
35#include <linux/cpu.h> 36#include <linux/cpu.h>
36#include <linux/interrupt.h> 37#include <linux/interrupt.h>
37#include <linux/smp.h> 38#include <linux/smp.h>
@@ -46,6 +47,7 @@
46#include <asm/cputable.h> 47#include <asm/cputable.h>
47#include <asm/sections.h> 48#include <asm/sections.h>
48#include <asm/setup.h> 49#include <asm/setup.h>
50#include <asm/smp_plat.h>
49#include <asm/cacheflush.h> 51#include <asm/cacheflush.h>
50#include <asm/tlbflush.h> 52#include <asm/tlbflush.h>
51#include <asm/traps.h> 53#include <asm/traps.h>
@@ -240,6 +242,8 @@ static void __init request_standard_resources(void)
240 } 242 }
241} 243}
242 244
245u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
246
243void __init setup_arch(char **cmdline_p) 247void __init setup_arch(char **cmdline_p)
244{ 248{
245 setup_processor(); 249 setup_processor();
@@ -264,6 +268,7 @@ void __init setup_arch(char **cmdline_p)
264 268
265 psci_init(); 269 psci_init();
266 270
271 cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
267#ifdef CONFIG_SMP 272#ifdef CONFIG_SMP
268 smp_init_cpus(); 273 smp_init_cpus();
269#endif 274#endif
@@ -277,6 +282,13 @@ void __init setup_arch(char **cmdline_p)
277#endif 282#endif
278} 283}
279 284
285static int __init arm64_of_clk_init(void)
286{
287 of_clk_init(NULL);
288 return 0;
289}
290arch_initcall(arm64_of_clk_init);
291
280static DEFINE_PER_CPU(struct cpu, cpu_data); 292static DEFINE_PER_CPU(struct cpu, cpu_data);
281 293
282static int __init topology_init(void) 294static int __init topology_init(void)
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index bdd34597254b..5d54e3717bf8 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -43,6 +43,7 @@
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/pgalloc.h> 44#include <asm/pgalloc.h>
45#include <asm/processor.h> 45#include <asm/processor.h>
46#include <asm/smp_plat.h>
46#include <asm/sections.h> 47#include <asm/sections.h>
47#include <asm/tlbflush.h> 48#include <asm/tlbflush.h>
48#include <asm/ptrace.h> 49#include <asm/ptrace.h>
@@ -53,7 +54,7 @@
53 * where to place its SVC stack 54 * where to place its SVC stack
54 */ 55 */
55struct secondary_data secondary_data; 56struct secondary_data secondary_data;
56volatile unsigned long secondary_holding_pen_release = -1; 57volatile unsigned long secondary_holding_pen_release = INVALID_HWID;
57 58
58enum ipi_msg_type { 59enum ipi_msg_type {
59 IPI_RESCHEDULE, 60 IPI_RESCHEDULE,
@@ -70,7 +71,7 @@ static DEFINE_RAW_SPINLOCK(boot_lock);
70 * in coherency or not. This is necessary for the hotplug code to work 71 * in coherency or not. This is necessary for the hotplug code to work
71 * reliably. 72 * reliably.
72 */ 73 */
73static void __cpuinit write_pen_release(int val) 74static void __cpuinit write_pen_release(u64 val)
74{ 75{
75 void *start = (void *)&secondary_holding_pen_release; 76 void *start = (void *)&secondary_holding_pen_release;
76 unsigned long size = sizeof(secondary_holding_pen_release); 77 unsigned long size = sizeof(secondary_holding_pen_release);
@@ -96,7 +97,7 @@ static int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
96 /* 97 /*
97 * Update the pen release flag. 98 * Update the pen release flag.
98 */ 99 */
99 write_pen_release(cpu); 100 write_pen_release(cpu_logical_map(cpu));
100 101
101 /* 102 /*
102 * Send an event, causing the secondaries to read pen_release. 103 * Send an event, causing the secondaries to read pen_release.
@@ -105,7 +106,7 @@ static int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
105 106
106 timeout = jiffies + (1 * HZ); 107 timeout = jiffies + (1 * HZ);
107 while (time_before(jiffies, timeout)) { 108 while (time_before(jiffies, timeout)) {
108 if (secondary_holding_pen_release == -1UL) 109 if (secondary_holding_pen_release == INVALID_HWID)
109 break; 110 break;
110 udelay(10); 111 udelay(10);
111 } 112 }
@@ -116,7 +117,7 @@ static int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
116 */ 117 */
117 raw_spin_unlock(&boot_lock); 118 raw_spin_unlock(&boot_lock);
118 119
119 return secondary_holding_pen_release != -1 ? -ENOSYS : 0; 120 return secondary_holding_pen_release != INVALID_HWID ? -ENOSYS : 0;
120} 121}
121 122
122static DECLARE_COMPLETION(cpu_running); 123static DECLARE_COMPLETION(cpu_running);
@@ -190,7 +191,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
190 * Let the primary processor know we're out of the 191 * Let the primary processor know we're out of the
191 * pen, then head off into the C entry point 192 * pen, then head off into the C entry point
192 */ 193 */
193 write_pen_release(-1); 194 write_pen_release(INVALID_HWID);
194 195
195 /* 196 /*
196 * Synchronise with the boot thread. 197 * Synchronise with the boot thread.
@@ -216,7 +217,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
216 /* 217 /*
217 * OK, it's off to the idle thread for us 218 * OK, it's off to the idle thread for us
218 */ 219 */
219 cpu_idle(); 220 cpu_startup_entry(CPUHP_ONLINE);
220} 221}
221 222
222void __init smp_cpus_done(unsigned int max_cpus) 223void __init smp_cpus_done(unsigned int max_cpus)
@@ -244,11 +245,11 @@ static const struct smp_enable_ops *smp_enable_ops[NR_CPUS];
244 245
245static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name) 246static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name)
246{ 247{
247 const struct smp_enable_ops *ops = enable_ops[0]; 248 const struct smp_enable_ops **ops = enable_ops;
248 249
249 while (ops) { 250 while (*ops) {
250 if (!strcmp(name, ops->name)) 251 if (!strcmp(name, (*ops)->name))
251 return ops; 252 return *ops;
252 253
253 ops++; 254 ops++;
254 } 255 }
@@ -257,15 +258,80 @@ static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name)
257} 258}
258 259
259/* 260/*
260 * Enumerate the possible CPU set from the device tree. 261 * Enumerate the possible CPU set from the device tree and build the
262 * cpu logical map array containing MPIDR values related to logical
263 * cpus. Assumes that cpu_logical_map(0) has already been initialized.
261 */ 264 */
262void __init smp_init_cpus(void) 265void __init smp_init_cpus(void)
263{ 266{
264 const char *enable_method; 267 const char *enable_method;
265 struct device_node *dn = NULL; 268 struct device_node *dn = NULL;
266 int cpu = 0; 269 int i, cpu = 1;
270 bool bootcpu_valid = false;
267 271
268 while ((dn = of_find_node_by_type(dn, "cpu"))) { 272 while ((dn = of_find_node_by_type(dn, "cpu"))) {
273 const u32 *cell;
274 u64 hwid;
275
276 /*
277 * A cpu node with missing "reg" property is
278 * considered invalid to build a cpu_logical_map
279 * entry.
280 */
281 cell = of_get_property(dn, "reg", NULL);
282 if (!cell) {
283 pr_err("%s: missing reg property\n", dn->full_name);
284 goto next;
285 }
286 hwid = of_read_number(cell, of_n_addr_cells(dn));
287
288 /*
289 * Non affinity bits must be set to 0 in the DT
290 */
291 if (hwid & ~MPIDR_HWID_BITMASK) {
292 pr_err("%s: invalid reg property\n", dn->full_name);
293 goto next;
294 }
295
296 /*
297 * Duplicate MPIDRs are a recipe for disaster. Scan
298 * all initialized entries and check for
299 * duplicates. If any is found just ignore the cpu.
300 * cpu_logical_map was initialized to INVALID_HWID to
301 * avoid matching valid MPIDR values.
302 */
303 for (i = 1; (i < cpu) && (i < NR_CPUS); i++) {
304 if (cpu_logical_map(i) == hwid) {
305 pr_err("%s: duplicate cpu reg properties in the DT\n",
306 dn->full_name);
307 goto next;
308 }
309 }
310
311 /*
312 * The numbering scheme requires that the boot CPU
313 * must be assigned logical id 0. Record it so that
314 * the logical map built from DT is validated and can
315 * be used.
316 */
317 if (hwid == cpu_logical_map(0)) {
318 if (bootcpu_valid) {
319 pr_err("%s: duplicate boot cpu reg property in DT\n",
320 dn->full_name);
321 goto next;
322 }
323
324 bootcpu_valid = true;
325
326 /*
327 * cpu_logical_map has already been
328 * initialized and the boot cpu doesn't need
329 * the enable-method so continue without
330 * incrementing cpu.
331 */
332 continue;
333 }
334
269 if (cpu >= NR_CPUS) 335 if (cpu >= NR_CPUS)
270 goto next; 336 goto next;
271 337
@@ -274,22 +340,24 @@ void __init smp_init_cpus(void)
274 */ 340 */
275 enable_method = of_get_property(dn, "enable-method", NULL); 341 enable_method = of_get_property(dn, "enable-method", NULL);
276 if (!enable_method) { 342 if (!enable_method) {
277 pr_err("CPU %d: missing enable-method property\n", cpu); 343 pr_err("%s: missing enable-method property\n",
344 dn->full_name);
278 goto next; 345 goto next;
279 } 346 }
280 347
281 smp_enable_ops[cpu] = smp_get_enable_ops(enable_method); 348 smp_enable_ops[cpu] = smp_get_enable_ops(enable_method);
282 349
283 if (!smp_enable_ops[cpu]) { 350 if (!smp_enable_ops[cpu]) {
284 pr_err("CPU %d: invalid enable-method property: %s\n", 351 pr_err("%s: invalid enable-method property: %s\n",
285 cpu, enable_method); 352 dn->full_name, enable_method);
286 goto next; 353 goto next;
287 } 354 }
288 355
289 if (smp_enable_ops[cpu]->init_cpu(dn, cpu)) 356 if (smp_enable_ops[cpu]->init_cpu(dn, cpu))
290 goto next; 357 goto next;
291 358
292 set_cpu_possible(cpu, true); 359 pr_debug("cpu logical map 0x%llx\n", hwid);
360 cpu_logical_map(cpu) = hwid;
293next: 361next:
294 cpu++; 362 cpu++;
295 } 363 }
@@ -298,6 +366,19 @@ next:
298 if (cpu > NR_CPUS) 366 if (cpu > NR_CPUS)
299 pr_warning("no. of cores (%d) greater than configured maximum of %d - clipping\n", 367 pr_warning("no. of cores (%d) greater than configured maximum of %d - clipping\n",
300 cpu, NR_CPUS); 368 cpu, NR_CPUS);
369
370 if (!bootcpu_valid) {
371 pr_err("DT missing boot CPU MPIDR, not enabling secondaries\n");
372 return;
373 }
374
375 /*
376 * All the cpus that made it to the cpu_logical_map have been
377 * validated so set them as possible cpus.
378 */
379 for (i = 0; i < NR_CPUS; i++)
380 if (cpu_logical_map(i) != INVALID_HWID)
381 set_cpu_possible(i, true);
301} 382}
302 383
303void __init smp_prepare_cpus(unsigned int max_cpus) 384void __init smp_prepare_cpus(unsigned int max_cpus)
diff --git a/arch/arm64/kernel/smp_psci.c b/arch/arm64/kernel/smp_psci.c
index 112091684c22..0c533301be77 100644
--- a/arch/arm64/kernel/smp_psci.c
+++ b/arch/arm64/kernel/smp_psci.c
@@ -21,6 +21,7 @@
21#include <linux/smp.h> 21#include <linux/smp.h>
22 22
23#include <asm/psci.h> 23#include <asm/psci.h>
24#include <asm/smp_plat.h>
24 25
25static int __init smp_psci_init_cpu(struct device_node *dn, int cpu) 26static int __init smp_psci_init_cpu(struct device_node *dn, int cpu)
26{ 27{
@@ -36,7 +37,7 @@ static int __init smp_psci_prepare_cpu(int cpu)
36 return -ENODEV; 37 return -ENODEV;
37 } 38 }
38 39
39 err = psci_ops.cpu_on(cpu, __pa(secondary_holding_pen)); 40 err = psci_ops.cpu_on(cpu_logical_map(cpu), __pa(secondary_holding_pen));
40 if (err) { 41 if (err) {
41 pr_err("psci: failed to boot CPU%d (%d)\n", cpu, err); 42 pr_err("psci: failed to boot CPU%d (%d)\n", cpu, err);
42 return err; 43 return err;
@@ -47,6 +48,6 @@ static int __init smp_psci_prepare_cpu(int cpu)
47 48
48const struct smp_enable_ops smp_psci_ops __initconst = { 49const struct smp_enable_ops smp_psci_ops __initconst = {
49 .name = "psci", 50 .name = "psci",
50 .init_cpu = smp_psci_init_cpu, 51 .init_cpu = smp_psci_init_cpu,
51 .prepare_cpu = smp_psci_prepare_cpu, 52 .prepare_cpu = smp_psci_prepare_cpu,
52}; 53};
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S
index 9416d045a687..db01aa978c41 100644
--- a/arch/arm64/kernel/sys32.S
+++ b/arch/arm64/kernel/sys32.S
@@ -84,13 +84,6 @@ compat_sys_readahead_wrapper:
84 b sys_readahead 84 b sys_readahead
85ENDPROC(compat_sys_readahead_wrapper) 85ENDPROC(compat_sys_readahead_wrapper)
86 86
87compat_sys_lookup_dcookie:
88 orr x0, x0, x1, lsl #32
89 mov w1, w2
90 mov w2, w3
91 b sys_lookup_dcookie
92ENDPROC(compat_sys_lookup_dcookie)
93
94compat_sys_fadvise64_64_wrapper: 87compat_sys_fadvise64_64_wrapper:
95 mov w6, w1 88 mov w6, w1
96 orr x1, x2, x3, lsl #32 89 orr x1, x2, x3, lsl #32
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index b3c5f628bdb4..61d7dd29f756 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -167,13 +167,6 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
167 } 167 }
168} 168}
169 169
170void dump_stack(void)
171{
172 dump_backtrace(NULL, NULL);
173}
174
175EXPORT_SYMBOL(dump_stack);
176
177void show_stack(struct task_struct *tsk, unsigned long *sp) 170void show_stack(struct task_struct *tsk, unsigned long *sp)
178{ 171{
179 dump_backtrace(NULL, tsk); 172 dump_backtrace(NULL, tsk);
diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile
index 2fb7f6092aae..59acc0ef0462 100644
--- a/arch/arm64/lib/Makefile
+++ b/arch/arm64/lib/Makefile
@@ -1,4 +1,6 @@
1lib-y := bitops.o delay.o \ 1lib-y := bitops.o delay.o \
2 strncpy_from_user.o strnlen_user.o clear_user.o \ 2 strncpy_from_user.o strnlen_user.o clear_user.o \
3 copy_from_user.o copy_to_user.o copy_in_user.o \ 3 copy_from_user.o copy_to_user.o copy_in_user.o \
4 copy_page.o clear_page.o 4 copy_page.o clear_page.o \
5 memchr.o memcpy.o memmove.o memset.o \
6 strchr.o strrchr.o
diff --git a/arch/arm64/lib/bitops.S b/arch/arm64/lib/bitops.S
new file mode 100644
index 000000000000..36216d30cb9a
--- /dev/null
+++ b/arch/arm64/lib/bitops.S
@@ -0,0 +1,68 @@
1/*
2 * Based on arch/arm/lib/bitops.h
3 *
4 * Copyright (C) 2013 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/linkage.h>
20#include <asm/assembler.h>
21
22/*
23 * x0: bits 5:0 bit offset
24 * bits 63:6 word offset
25 * x1: address
26 */
27 .macro bitop, name, instr
28ENTRY( \name )
29 and x3, x0, #63 // Get bit offset
30 eor x0, x0, x3 // Clear low bits
31 mov x2, #1
32 add x1, x1, x0, lsr #3 // Get word offset
33 lsl x3, x2, x3 // Create mask
341: ldxr x2, [x1]
35 \instr x2, x2, x3
36 stxr w0, x2, [x1]
37 cbnz w0, 1b
38 ret
39ENDPROC(\name )
40 .endm
41
42 .macro testop, name, instr
43ENTRY( \name )
44 and x3, x0, #63 // Get bit offset
45 eor x0, x0, x3 // Clear low bits
46 mov x2, #1
47 add x1, x1, x0, lsr #3 // Get word offset
48 lsl x4, x2, x3 // Create mask
491: ldaxr x2, [x1]
50 lsr x0, x2, x3 // Save old value of bit
51 \instr x2, x2, x4 // toggle bit
52 stlxr w5, x2, [x1]
53 cbnz w5, 1b
54 and x0, x0, #1
553: ret
56ENDPROC(\name )
57 .endm
58
59/*
60 * Atomic bit operations.
61 */
62 bitop change_bit, eor
63 bitop clear_bit, bic
64 bitop set_bit, orr
65
66 testop test_and_change_bit, eor
67 testop test_and_clear_bit, bic
68 testop test_and_set_bit, orr
diff --git a/arch/arm64/lib/memchr.S b/arch/arm64/lib/memchr.S
new file mode 100644
index 000000000000..8636b7549163
--- /dev/null
+++ b/arch/arm64/lib/memchr.S
@@ -0,0 +1,44 @@
1/*
2 * Based on arch/arm/lib/memchr.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 * Copyright (C) 2013 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/linkage.h>
21#include <asm/assembler.h>
22
23/*
24 * Find a character in an area of memory.
25 *
26 * Parameters:
27 * x0 - buf
28 * x1 - c
29 * x2 - n
30 * Returns:
31 * x0 - address of first occurrence of 'c' or 0
32 */
33ENTRY(memchr)
34 and w1, w1, #0xff
351: subs x2, x2, #1
36 b.mi 2f
37 ldrb w3, [x0], #1
38 cmp w3, w1
39 b.ne 1b
40 sub x0, x0, #1
41 ret
422: mov x0, #0
43 ret
44ENDPROC(memchr)
diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S
new file mode 100644
index 000000000000..27b5003609b6
--- /dev/null
+++ b/arch/arm64/lib/memcpy.S
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2013 ARM Ltd.
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 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/linkage.h>
18#include <asm/assembler.h>
19
20/*
21 * Copy a buffer from src to dest (alignment handled by the hardware)
22 *
23 * Parameters:
24 * x0 - dest
25 * x1 - src
26 * x2 - n
27 * Returns:
28 * x0 - dest
29 */
30ENTRY(memcpy)
31 mov x4, x0
32 subs x2, x2, #8
33 b.mi 2f
341: ldr x3, [x1], #8
35 subs x2, x2, #8
36 str x3, [x4], #8
37 b.pl 1b
382: adds x2, x2, #4
39 b.mi 3f
40 ldr w3, [x1], #4
41 sub x2, x2, #4
42 str w3, [x4], #4
433: adds x2, x2, #2
44 b.mi 4f
45 ldrh w3, [x1], #2
46 sub x2, x2, #2
47 strh w3, [x4], #2
484: adds x2, x2, #1
49 b.mi 5f
50 ldrb w3, [x1]
51 strb w3, [x4]
525: ret
53ENDPROC(memcpy)
diff --git a/arch/arm64/lib/memmove.S b/arch/arm64/lib/memmove.S
new file mode 100644
index 000000000000..b79fdfa42d39
--- /dev/null
+++ b/arch/arm64/lib/memmove.S
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2013 ARM Ltd.
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 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/linkage.h>
18#include <asm/assembler.h>
19
20/*
21 * Move a buffer from src to test (alignment handled by the hardware).
22 * If dest <= src, call memcpy, otherwise copy in reverse order.
23 *
24 * Parameters:
25 * x0 - dest
26 * x1 - src
27 * x2 - n
28 * Returns:
29 * x0 - dest
30 */
31ENTRY(memmove)
32 cmp x0, x1
33 b.ls memcpy
34 add x4, x0, x2
35 add x1, x1, x2
36 subs x2, x2, #8
37 b.mi 2f
381: ldr x3, [x1, #-8]!
39 subs x2, x2, #8
40 str x3, [x4, #-8]!
41 b.pl 1b
422: adds x2, x2, #4
43 b.mi 3f
44 ldr w3, [x1, #-4]!
45 sub x2, x2, #4
46 str w3, [x4, #-4]!
473: adds x2, x2, #2
48 b.mi 4f
49 ldrh w3, [x1, #-2]!
50 sub x2, x2, #2
51 strh w3, [x4, #-2]!
524: adds x2, x2, #1
53 b.mi 5f
54 ldrb w3, [x1, #-1]
55 strb w3, [x4, #-1]
565: ret
57ENDPROC(memmove)
diff --git a/arch/arm64/lib/memset.S b/arch/arm64/lib/memset.S
new file mode 100644
index 000000000000..87e4a68fbbbc
--- /dev/null
+++ b/arch/arm64/lib/memset.S
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2013 ARM Ltd.
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 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/linkage.h>
18#include <asm/assembler.h>
19
20/*
21 * Fill in the buffer with character c (alignment handled by the hardware)
22 *
23 * Parameters:
24 * x0 - buf
25 * x1 - c
26 * x2 - n
27 * Returns:
28 * x0 - buf
29 */
30ENTRY(memset)
31 mov x4, x0
32 and w1, w1, #0xff
33 orr w1, w1, w1, lsl #8
34 orr w1, w1, w1, lsl #16
35 orr x1, x1, x1, lsl #32
36 subs x2, x2, #8
37 b.mi 2f
381: str x1, [x4], #8
39 subs x2, x2, #8
40 b.pl 1b
412: adds x2, x2, #4
42 b.mi 3f
43 sub x2, x2, #4
44 str w1, [x4], #4
453: adds x2, x2, #2
46 b.mi 4f
47 sub x2, x2, #2
48 strh w1, [x4], #2
494: adds x2, x2, #1
50 b.mi 5f
51 strb w1, [x4]
525: ret
53ENDPROC(memset)
diff --git a/arch/arm64/lib/strchr.S b/arch/arm64/lib/strchr.S
new file mode 100644
index 000000000000..dae0cf5591f9
--- /dev/null
+++ b/arch/arm64/lib/strchr.S
@@ -0,0 +1,42 @@
1/*
2 * Based on arch/arm/lib/strchr.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 * Copyright (C) 2013 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/linkage.h>
21#include <asm/assembler.h>
22
23/*
24 * Find the first occurrence of a character in a string.
25 *
26 * Parameters:
27 * x0 - str
28 * x1 - c
29 * Returns:
30 * x0 - address of first occurrence of 'c' or 0
31 */
32ENTRY(strchr)
33 and w1, w1, #0xff
341: ldrb w2, [x0], #1
35 cmp w2, w1
36 ccmp w2, wzr, #4, ne
37 b.ne 1b
38 sub x0, x0, #1
39 cmp w2, w1
40 csel x0, x0, xzr, eq
41 ret
42ENDPROC(strchr)
diff --git a/arch/arm64/lib/strrchr.S b/arch/arm64/lib/strrchr.S
new file mode 100644
index 000000000000..61eabd9a289a
--- /dev/null
+++ b/arch/arm64/lib/strrchr.S
@@ -0,0 +1,43 @@
1/*
2 * Based on arch/arm/lib/strrchr.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 * Copyright (C) 2013 ARM Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/linkage.h>
21#include <asm/assembler.h>
22
23/*
24 * Find the last occurrence of a character in a string.
25 *
26 * Parameters:
27 * x0 - str
28 * x1 - c
29 * Returns:
30 * x0 - address of last occurrence of 'c' or 0
31 */
32ENTRY(strrchr)
33 mov x3, #0
34 and w1, w1, #0xff
351: ldrb w2, [x0], #1
36 cbz w2, 2f
37 cmp w2, w1
38 b.ne 1b
39 sub x3, x0, #1
40 b 1b
412: mov x0, x3
42 ret
43ENDPROC(strrchr)
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index afadae6682ed..52638171d6fd 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -57,16 +57,16 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
57 pmd_t *pmd; 57 pmd_t *pmd;
58 pte_t *pte; 58 pte_t *pte;
59 59
60 if (pgd_none_or_clear_bad(pgd)) 60 if (pgd_none(*pgd) || pgd_bad(*pgd))
61 break; 61 break;
62 62
63 pud = pud_offset(pgd, addr); 63 pud = pud_offset(pgd, addr);
64 if (pud_none_or_clear_bad(pud)) 64 if (pud_none(*pud) || pud_bad(*pud))
65 break; 65 break;
66 66
67 pmd = pmd_offset(pud, addr); 67 pmd = pmd_offset(pud, addr);
68 printk(", *pmd=%016llx", pmd_val(*pmd)); 68 printk(", *pmd=%016llx", pmd_val(*pmd));
69 if (pmd_none_or_clear_bad(pmd)) 69 if (pmd_none(*pmd) || pmd_bad(*pmd))
70 break; 70 break;
71 71
72 pte = pte_offset_map(pmd, addr); 72 pte = pte_offset_map(pmd, addr);
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 800aac306a08..f497ca77925a 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -197,24 +197,6 @@ void __init bootmem_init(void)
197 max_pfn = max_low_pfn = max; 197 max_pfn = max_low_pfn = max;
198} 198}
199 199
200static inline int free_area(unsigned long pfn, unsigned long end, char *s)
201{
202 unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
203
204 for (; pfn < end; pfn++) {
205 struct page *page = pfn_to_page(pfn);
206 ClearPageReserved(page);
207 init_page_count(page);
208 __free_page(page);
209 pages++;
210 }
211
212 if (size && s)
213 pr_info("Freeing %s memory: %dK\n", s, size);
214
215 return pages;
216}
217
218/* 200/*
219 * Poison init memory with an undefined instruction (0x0). 201 * Poison init memory with an undefined instruction (0x0).
220 */ 202 */
@@ -405,9 +387,7 @@ void __init mem_init(void)
405void free_initmem(void) 387void free_initmem(void)
406{ 388{
407 poison_init_mem(__init_begin, __init_end - __init_begin); 389 poison_init_mem(__init_begin, __init_end - __init_begin);
408 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), 390 free_initmem_default(0);
409 __phys_to_pfn(__pa(__init_end)),
410 "init");
411} 391}
412 392
413#ifdef CONFIG_BLK_DEV_INITRD 393#ifdef CONFIG_BLK_DEV_INITRD
@@ -418,9 +398,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
418{ 398{
419 if (!keep_initrd) { 399 if (!keep_initrd) {
420 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 400 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
421 totalram_pages += free_area(__phys_to_pfn(__pa(start)), 401 free_reserved_area(start, end, 0, "initrd");
422 __phys_to_pfn(__pa(end)),
423 "initrd");
424 } 402 }
425} 403}
426 404
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 70b8cd4021c4..eeecc9c8ed68 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -391,17 +391,14 @@ int kern_addr_valid(unsigned long addr)
391} 391}
392#ifdef CONFIG_SPARSEMEM_VMEMMAP 392#ifdef CONFIG_SPARSEMEM_VMEMMAP
393#ifdef CONFIG_ARM64_64K_PAGES 393#ifdef CONFIG_ARM64_64K_PAGES
394int __meminit vmemmap_populate(struct page *start_page, 394int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
395 unsigned long size, int node)
396{ 395{
397 return vmemmap_populate_basepages(start_page, size, node); 396 return vmemmap_populate_basepages(start, end, node);
398} 397}
399#else /* !CONFIG_ARM64_64K_PAGES */ 398#else /* !CONFIG_ARM64_64K_PAGES */
400int __meminit vmemmap_populate(struct page *start_page, 399int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
401 unsigned long size, int node)
402{ 400{
403 unsigned long addr = (unsigned long)start_page; 401 unsigned long addr = start;
404 unsigned long end = (unsigned long)(start_page + size);
405 unsigned long next; 402 unsigned long next;
406 pgd_t *pgd; 403 pgd_t *pgd;
407 pud_t *pud; 404 pud_t *pud;
@@ -434,7 +431,7 @@ int __meminit vmemmap_populate(struct page *start_page,
434 return 0; 431 return 0;
435} 432}
436#endif /* CONFIG_ARM64_64K_PAGES */ 433#endif /* CONFIG_ARM64_64K_PAGES */
437void vmemmap_free(struct page *memmap, unsigned long nr_pages) 434void vmemmap_free(unsigned long start, unsigned long end)
438{ 435{
439} 436}
440#endif /* CONFIG_SPARSEMEM_VMEMMAP */ 437#endif /* CONFIG_SPARSEMEM_VMEMMAP */
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index c1a868d398bd..22c40308360b 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -250,20 +250,7 @@ config ARCH_SUSPEND_POSSIBLE
250 def_bool y 250 def_bool y
251 251
252menu "CPU Frequency scaling" 252menu "CPU Frequency scaling"
253
254source "drivers/cpufreq/Kconfig" 253source "drivers/cpufreq/Kconfig"
255
256config CPU_FREQ_AT32AP
257 bool "CPU frequency driver for AT32AP"
258 depends on CPU_FREQ && PLATFORM_AT32AP
259 default n
260 help
261 This enables the CPU frequency driver for AT32AP processors.
262
263 For details, take a look in <file:Documentation/cpu-freq>.
264
265 If in doubt, say N.
266
267endmenu 254endmenu
268 255
269endmenu 256endmenu
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig
index f4025db184ff..d5aff36ade92 100644
--- a/arch/avr32/configs/atngw100_defconfig
+++ b/arch/avr32/configs/atngw100_defconfig
@@ -26,7 +26,7 @@ CONFIG_CPU_FREQ=y
26# CONFIG_CPU_FREQ_STAT is not set 26# CONFIG_CPU_FREQ_STAT is not set
27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
28CONFIG_CPU_FREQ_GOV_USERSPACE=y 28CONFIG_CPU_FREQ_GOV_USERSPACE=y
29CONFIG_CPU_FREQ_AT32AP=y 29CONFIG_AVR32_AT32AP_CPUFREQ=y
30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
31CONFIG_NET=y 31CONFIG_NET=y
32CONFIG_PACKET=y 32CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atngw100_evklcd100_defconfig b/arch/avr32/configs/atngw100_evklcd100_defconfig
index c76a49b9e9d0..4abcf435d599 100644
--- a/arch/avr32/configs/atngw100_evklcd100_defconfig
+++ b/arch/avr32/configs/atngw100_evklcd100_defconfig
@@ -28,7 +28,7 @@ CONFIG_CPU_FREQ=y
28# CONFIG_CPU_FREQ_STAT is not set 28# CONFIG_CPU_FREQ_STAT is not set
29CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 29CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
30CONFIG_CPU_FREQ_GOV_USERSPACE=y 30CONFIG_CPU_FREQ_GOV_USERSPACE=y
31CONFIG_CPU_FREQ_AT32AP=y 31CONFIG_AVR32_AT32AP_CPUFREQ=y
32CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 32CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
33CONFIG_NET=y 33CONFIG_NET=y
34CONFIG_PACKET=y 34CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atngw100_evklcd101_defconfig b/arch/avr32/configs/atngw100_evklcd101_defconfig
index 2d8ab089a64e..18f3fa0470ff 100644
--- a/arch/avr32/configs/atngw100_evklcd101_defconfig
+++ b/arch/avr32/configs/atngw100_evklcd101_defconfig
@@ -27,7 +27,7 @@ CONFIG_CPU_FREQ=y
27# CONFIG_CPU_FREQ_STAT is not set 27# CONFIG_CPU_FREQ_STAT is not set
28CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 28CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
29CONFIG_CPU_FREQ_GOV_USERSPACE=y 29CONFIG_CPU_FREQ_GOV_USERSPACE=y
30CONFIG_CPU_FREQ_AT32AP=y 30CONFIG_AVR32_AT32AP_CPUFREQ=y
31CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 31CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
32CONFIG_NET=y 32CONFIG_NET=y
33CONFIG_PACKET=y 33CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atngw100_mrmt_defconfig b/arch/avr32/configs/atngw100_mrmt_defconfig
index b189e0cab04b..06e389cfcd12 100644
--- a/arch/avr32/configs/atngw100_mrmt_defconfig
+++ b/arch/avr32/configs/atngw100_mrmt_defconfig
@@ -23,7 +23,7 @@ CONFIG_CPU_FREQ=y
23CONFIG_CPU_FREQ_GOV_POWERSAVE=y 23CONFIG_CPU_FREQ_GOV_POWERSAVE=y
24CONFIG_CPU_FREQ_GOV_USERSPACE=y 24CONFIG_CPU_FREQ_GOV_USERSPACE=y
25CONFIG_CPU_FREQ_GOV_ONDEMAND=y 25CONFIG_CPU_FREQ_GOV_ONDEMAND=y
26CONFIG_CPU_FREQ_AT32AP=y 26CONFIG_AVR32_AT32AP_CPUFREQ=y
27CONFIG_NET=y 27CONFIG_NET=y
28CONFIG_PACKET=y 28CONFIG_PACKET=y
29CONFIG_UNIX=y 29CONFIG_UNIX=y
diff --git a/arch/avr32/configs/atngw100mkii_defconfig b/arch/avr32/configs/atngw100mkii_defconfig
index 2e4de42a53c4..2518a1368d7c 100644
--- a/arch/avr32/configs/atngw100mkii_defconfig
+++ b/arch/avr32/configs/atngw100mkii_defconfig
@@ -26,7 +26,7 @@ CONFIG_CPU_FREQ=y
26# CONFIG_CPU_FREQ_STAT is not set 26# CONFIG_CPU_FREQ_STAT is not set
27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
28CONFIG_CPU_FREQ_GOV_USERSPACE=y 28CONFIG_CPU_FREQ_GOV_USERSPACE=y
29CONFIG_CPU_FREQ_AT32AP=y 29CONFIG_AVR32_AT32AP_CPUFREQ=y
30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
31CONFIG_NET=y 31CONFIG_NET=y
32CONFIG_PACKET=y 32CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atngw100mkii_evklcd100_defconfig b/arch/avr32/configs/atngw100mkii_evklcd100_defconfig
index fad3cd22dfd3..245ef6bd0fa6 100644
--- a/arch/avr32/configs/atngw100mkii_evklcd100_defconfig
+++ b/arch/avr32/configs/atngw100mkii_evklcd100_defconfig
@@ -29,7 +29,7 @@ CONFIG_CPU_FREQ=y
29# CONFIG_CPU_FREQ_STAT is not set 29# CONFIG_CPU_FREQ_STAT is not set
30CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 30CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
31CONFIG_CPU_FREQ_GOV_USERSPACE=y 31CONFIG_CPU_FREQ_GOV_USERSPACE=y
32CONFIG_CPU_FREQ_AT32AP=y 32CONFIG_AVR32_AT32AP_CPUFREQ=y
33CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 33CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
34CONFIG_NET=y 34CONFIG_NET=y
35CONFIG_PACKET=y 35CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atngw100mkii_evklcd101_defconfig b/arch/avr32/configs/atngw100mkii_evklcd101_defconfig
index 29986230aaa5..fa6cbac6e418 100644
--- a/arch/avr32/configs/atngw100mkii_evklcd101_defconfig
+++ b/arch/avr32/configs/atngw100mkii_evklcd101_defconfig
@@ -28,7 +28,7 @@ CONFIG_CPU_FREQ=y
28# CONFIG_CPU_FREQ_STAT is not set 28# CONFIG_CPU_FREQ_STAT is not set
29CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 29CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
30CONFIG_CPU_FREQ_GOV_USERSPACE=y 30CONFIG_CPU_FREQ_GOV_USERSPACE=y
31CONFIG_CPU_FREQ_AT32AP=y 31CONFIG_AVR32_AT32AP_CPUFREQ=y
32CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 32CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
33CONFIG_NET=y 33CONFIG_NET=y
34CONFIG_PACKET=y 34CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index a582465e1cef..bbd5131021a5 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -25,7 +25,7 @@ CONFIG_CPU_FREQ=y
25# CONFIG_CPU_FREQ_STAT is not set 25# CONFIG_CPU_FREQ_STAT is not set
26CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 26CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
27CONFIG_CPU_FREQ_GOV_USERSPACE=y 27CONFIG_CPU_FREQ_GOV_USERSPACE=y
28CONFIG_CPU_FREQ_AT32AP=y 28CONFIG_AVR32_AT32AP_CPUFREQ=y
29CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 29CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
30CONFIG_NET=y 30CONFIG_NET=y
31CONFIG_PACKET=y 31CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig
index 57a79df2ce5d..c1cd726f9012 100644
--- a/arch/avr32/configs/atstk1003_defconfig
+++ b/arch/avr32/configs/atstk1003_defconfig
@@ -26,7 +26,7 @@ CONFIG_CPU_FREQ=y
26# CONFIG_CPU_FREQ_STAT is not set 26# CONFIG_CPU_FREQ_STAT is not set
27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
28CONFIG_CPU_FREQ_GOV_USERSPACE=y 28CONFIG_CPU_FREQ_GOV_USERSPACE=y
29CONFIG_CPU_FREQ_AT32AP=y 29CONFIG_AVR32_AT32AP_CPUFREQ=y
30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
31CONFIG_NET=y 31CONFIG_NET=y
32CONFIG_PACKET=y 32CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atstk1004_defconfig b/arch/avr32/configs/atstk1004_defconfig
index 1a49bd8c6340..754ae56b2767 100644
--- a/arch/avr32/configs/atstk1004_defconfig
+++ b/arch/avr32/configs/atstk1004_defconfig
@@ -26,7 +26,7 @@ CONFIG_CPU_FREQ=y
26# CONFIG_CPU_FREQ_STAT is not set 26# CONFIG_CPU_FREQ_STAT is not set
27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
28CONFIG_CPU_FREQ_GOV_USERSPACE=y 28CONFIG_CPU_FREQ_GOV_USERSPACE=y
29CONFIG_CPU_FREQ_AT32AP=y 29CONFIG_AVR32_AT32AP_CPUFREQ=y
30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
31CONFIG_NET=y 31CONFIG_NET=y
32CONFIG_PACKET=y 32CONFIG_PACKET=y
diff --git a/arch/avr32/configs/atstk1006_defconfig b/arch/avr32/configs/atstk1006_defconfig
index 206a1b67f763..58589d8cc0ac 100644
--- a/arch/avr32/configs/atstk1006_defconfig
+++ b/arch/avr32/configs/atstk1006_defconfig
@@ -26,7 +26,7 @@ CONFIG_CPU_FREQ=y
26# CONFIG_CPU_FREQ_STAT is not set 26# CONFIG_CPU_FREQ_STAT is not set
27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 27CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
28CONFIG_CPU_FREQ_GOV_USERSPACE=y 28CONFIG_CPU_FREQ_GOV_USERSPACE=y
29CONFIG_CPU_FREQ_AT32AP=y 29CONFIG_AVR32_AT32AP_CPUFREQ=y
30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y 30CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
31CONFIG_NET=y 31CONFIG_NET=y
32CONFIG_PACKET=y 32CONFIG_PACKET=y
diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
index 0421498d666b..c90fbf6d35bc 100644
--- a/arch/avr32/configs/favr-32_defconfig
+++ b/arch/avr32/configs/favr-32_defconfig
@@ -27,7 +27,7 @@ CONFIG_CPU_FREQ=y
27# CONFIG_CPU_FREQ_STAT is not set 27# CONFIG_CPU_FREQ_STAT is not set
28CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 28CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
29CONFIG_CPU_FREQ_GOV_USERSPACE=y 29CONFIG_CPU_FREQ_GOV_USERSPACE=y
30CONFIG_CPU_FREQ_AT32AP=y 30CONFIG_AVR32_AT32AP_CPUFREQ=y
31CONFIG_NET=y 31CONFIG_NET=y
32CONFIG_PACKET=y 32CONFIG_PACKET=y
33CONFIG_UNIX=y 33CONFIG_UNIX=y
@@ -122,7 +122,6 @@ CONFIG_USB_G_SERIAL=m
122CONFIG_USB_CDC_COMPOSITE=m 122CONFIG_USB_CDC_COMPOSITE=m
123CONFIG_MMC=y 123CONFIG_MMC=y
124CONFIG_MMC_ATMELMCI=y 124CONFIG_MMC_ATMELMCI=y
125CONFIG_MMC_ATMELMCI_DMA=y
126CONFIG_NEW_LEDS=y 125CONFIG_NEW_LEDS=y
127CONFIG_LEDS_CLASS=y 126CONFIG_LEDS_CLASS=y
128CONFIG_LEDS_ATMEL_PWM=m 127CONFIG_LEDS_ATMEL_PWM=m
diff --git a/arch/avr32/configs/hammerhead_defconfig b/arch/avr32/configs/hammerhead_defconfig
index 82f24eb251bd..ba7c31e269cb 100644
--- a/arch/avr32/configs/hammerhead_defconfig
+++ b/arch/avr32/configs/hammerhead_defconfig
@@ -31,7 +31,7 @@ CONFIG_CPU_FREQ=y
31# CONFIG_CPU_FREQ_STAT is not set 31# CONFIG_CPU_FREQ_STAT is not set
32CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 32CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
33CONFIG_CPU_FREQ_GOV_USERSPACE=y 33CONFIG_CPU_FREQ_GOV_USERSPACE=y
34CONFIG_CPU_FREQ_AT32AP=y 34CONFIG_AVR32_AT32AP_CPUFREQ=y
35CONFIG_NET=y 35CONFIG_NET=y
36CONFIG_PACKET=y 36CONFIG_PACKET=y
37CONFIG_UNIX=y 37CONFIG_UNIX=y
diff --git a/arch/avr32/configs/merisc_defconfig b/arch/avr32/configs/merisc_defconfig
index 3befab966827..65de4431108c 100644
--- a/arch/avr32/configs/merisc_defconfig
+++ b/arch/avr32/configs/merisc_defconfig
@@ -102,7 +102,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
102CONFIG_LOGO=y 102CONFIG_LOGO=y
103CONFIG_MMC=y 103CONFIG_MMC=y
104CONFIG_MMC_ATMELMCI=y 104CONFIG_MMC_ATMELMCI=y
105CONFIG_MMC_ATMELMCI_DMA=y
106CONFIG_NEW_LEDS=y 105CONFIG_NEW_LEDS=y
107CONFIG_LEDS_CLASS=y 106CONFIG_LEDS_CLASS=y
108CONFIG_LEDS_ATMEL_PWM=y 107CONFIG_LEDS_ATMEL_PWM=y
diff --git a/arch/avr32/configs/mimc200_defconfig b/arch/avr32/configs/mimc200_defconfig
index 1bee51f22154..0a8bfdc420e0 100644
--- a/arch/avr32/configs/mimc200_defconfig
+++ b/arch/avr32/configs/mimc200_defconfig
@@ -24,7 +24,7 @@ CONFIG_CPU_FREQ=y
24# CONFIG_CPU_FREQ_STAT is not set 24# CONFIG_CPU_FREQ_STAT is not set
25CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 25CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
26CONFIG_CPU_FREQ_GOV_USERSPACE=y 26CONFIG_CPU_FREQ_GOV_USERSPACE=y
27CONFIG_CPU_FREQ_AT32AP=y 27CONFIG_AVR32_AT32AP_CPUFREQ=y
28CONFIG_NET=y 28CONFIG_NET=y
29CONFIG_PACKET=y 29CONFIG_PACKET=y
30CONFIG_UNIX=y 30CONFIG_UNIX=y
diff --git a/arch/avr32/include/asm/unistd.h b/arch/avr32/include/asm/unistd.h
index dc4d5a931112..c1eb080e45fe 100644
--- a/arch/avr32/include/asm/unistd.h
+++ b/arch/avr32/include/asm/unistd.h
@@ -41,12 +41,4 @@
41#define __ARCH_WANT_SYS_VFORK 41#define __ARCH_WANT_SYS_VFORK
42#define __ARCH_WANT_SYS_CLONE 42#define __ARCH_WANT_SYS_CLONE
43 43
44/*
45 * "Conditional" syscalls
46 *
47 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
48 * but it doesn't work on all toolchains, so we just do it by hand
49 */
50#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
51
52#endif /* __ASM_AVR32_UNISTD_H */ 44#endif /* __ASM_AVR32_UNISTD_H */
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index fd78f58ea79a..e7b61494c312 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -30,18 +30,9 @@ EXPORT_SYMBOL(pm_power_off);
30 * This file handles the architecture-dependent parts of process handling.. 30 * This file handles the architecture-dependent parts of process handling..
31 */ 31 */
32 32
33void cpu_idle(void) 33void arch_cpu_idle(void)
34{ 34{
35 /* endless idle loop with no priority at all */ 35 cpu_enter_idle();
36 while (1) {
37 tick_nohz_idle_enter();
38 rcu_idle_enter();
39 while (!need_resched())
40 cpu_idle_sleep();
41 rcu_idle_exit();
42 tick_nohz_idle_exit();
43 schedule_preempt_disabled();
44 }
45} 36}
46 37
47void machine_halt(void) 38void machine_halt(void)
@@ -213,14 +204,6 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
213 show_stack_log_lvl(tsk, (unsigned long)stack, NULL, ""); 204 show_stack_log_lvl(tsk, (unsigned long)stack, NULL, "");
214} 205}
215 206
216void dump_stack(void)
217{
218 unsigned long stack;
219
220 show_trace_log_lvl(current, &stack, NULL, "");
221}
222EXPORT_SYMBOL(dump_stack);
223
224static const char *cpu_modes[] = { 207static const char *cpu_modes[] = {
225 "Application", "Supervisor", "Interrupt level 0", "Interrupt level 1", 208 "Application", "Supervisor", "Interrupt level 0", "Interrupt level 1",
226 "Interrupt level 2", "Interrupt level 3", "Exception", "NMI" 209 "Interrupt level 2", "Interrupt level 3", "Exception", "NMI"
@@ -232,6 +215,8 @@ void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl)
232 unsigned long lr = regs->lr; 215 unsigned long lr = regs->lr;
233 unsigned long mode = (regs->sr & MODE_MASK) >> MODE_SHIFT; 216 unsigned long mode = (regs->sr & MODE_MASK) >> MODE_SHIFT;
234 217
218 show_regs_print_info(log_lvl);
219
235 if (!user_mode(regs)) { 220 if (!user_mode(regs)) {
236 sp = (unsigned long)regs + FRAME_SIZE_FULL; 221 sp = (unsigned long)regs + FRAME_SIZE_FULL;
237 222
@@ -269,9 +254,6 @@ void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl)
269 regs->sr & SR_I0M ? '0' : '.', 254 regs->sr & SR_I0M ? '0' : '.',
270 regs->sr & SR_GM ? 'G' : 'g'); 255 regs->sr & SR_GM ? 'G' : 'g');
271 printk("%sCPU Mode: %s\n", log_lvl, cpu_modes[mode]); 256 printk("%sCPU Mode: %s\n", log_lvl, cpu_modes[mode]);
272 printk("%sProcess: %s [%d] (task: %p thread: %p)\n",
273 log_lvl, current->comm, current->pid, current,
274 task_thread_info(current));
275} 257}
276 258
277void show_regs(struct pt_regs *regs) 259void show_regs(struct pt_regs *regs)
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 05ad29112ff4..869a1c6ffeee 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -12,6 +12,7 @@
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/time.h> 14#include <linux/time.h>
15#include <linux/cpu.h>
15 16
16#include <asm/sysreg.h> 17#include <asm/sysreg.h>
17 18
@@ -87,13 +88,17 @@ static void comparator_mode(enum clock_event_mode mode,
87 pr_debug("%s: start\n", evdev->name); 88 pr_debug("%s: start\n", evdev->name);
88 /* FALLTHROUGH */ 89 /* FALLTHROUGH */
89 case CLOCK_EVT_MODE_RESUME: 90 case CLOCK_EVT_MODE_RESUME:
90 cpu_disable_idle_sleep(); 91 /*
92 * If we're using the COUNT and COMPARE registers we
93 * need to force idle poll.
94 */
95 cpu_idle_poll_ctrl(true);
91 break; 96 break;
92 case CLOCK_EVT_MODE_UNUSED: 97 case CLOCK_EVT_MODE_UNUSED:
93 case CLOCK_EVT_MODE_SHUTDOWN: 98 case CLOCK_EVT_MODE_SHUTDOWN:
94 sysreg_write(COMPARE, 0); 99 sysreg_write(COMPARE, 0);
95 pr_debug("%s: stop\n", evdev->name); 100 pr_debug("%s: stop\n", evdev->name);
96 cpu_enable_idle_sleep(); 101 cpu_idle_poll_ctrl(false);
97 break; 102 break;
98 default: 103 default:
99 BUG(); 104 BUG();
diff --git a/arch/avr32/mach-at32ap/Makefile b/arch/avr32/mach-at32ap/Makefile
index 514c9a9b009a..fc09ec4bc725 100644
--- a/arch/avr32/mach-at32ap/Makefile
+++ b/arch/avr32/mach-at32ap/Makefile
@@ -1,7 +1,6 @@
1obj-y += pdc.o clock.o intc.o extint.o pio.o hsmc.o 1obj-y += pdc.o clock.o intc.o extint.o pio.o hsmc.o
2obj-y += hmatrix.o 2obj-y += hmatrix.o
3obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o pm-at32ap700x.o 3obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o pm-at32ap700x.o
4obj-$(CONFIG_CPU_FREQ_AT32AP) += cpufreq.o
5obj-$(CONFIG_PM) += pm.o 4obj-$(CONFIG_PM) += pm.o
6 5
7ifeq ($(CONFIG_PM_DEBUG),y) 6ifeq ($(CONFIG_PM_DEBUG),y)
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index b323d8d3185b..7c2f6685bf43 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1453,7 +1453,7 @@ static struct resource atmel_lcdfb0_resource[] = {
1453 }, 1453 },
1454}; 1454};
1455DEFINE_DEV_DATA(atmel_lcdfb, 0); 1455DEFINE_DEV_DATA(atmel_lcdfb, 0);
1456DEV_CLK(hck1, atmel_lcdfb0, hsb, 7); 1456DEV_CLK(hclk, atmel_lcdfb0, hsb, 7);
1457static struct clk atmel_lcdfb0_pixclk = { 1457static struct clk atmel_lcdfb0_pixclk = {
1458 .name = "lcdc_clk", 1458 .name = "lcdc_clk",
1459 .dev = &atmel_lcdfb0_device.dev, 1459 .dev = &atmel_lcdfb0_device.dev,
@@ -1530,6 +1530,8 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
1530 memcpy(info, data, sizeof(struct atmel_lcdfb_info)); 1530 memcpy(info, data, sizeof(struct atmel_lcdfb_info));
1531 info->default_monspecs = monspecs; 1531 info->default_monspecs = monspecs;
1532 1532
1533 pdev->name = "at32ap-lcdfb";
1534
1533 platform_device_register(pdev); 1535 platform_device_register(pdev);
1534 return pdev; 1536 return pdev;
1535 1537
@@ -2246,7 +2248,7 @@ static __initdata struct clk *init_clocks[] = {
2246 &atmel_twi0_pclk, 2248 &atmel_twi0_pclk,
2247 &atmel_mci0_pclk, 2249 &atmel_mci0_pclk,
2248#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) 2250#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
2249 &atmel_lcdfb0_hck1, 2251 &atmel_lcdfb0_hclk,
2250 &atmel_lcdfb0_pixclk, 2252 &atmel_lcdfb0_pixclk,
2251#endif 2253#endif
2252 &ssc0_pclk, 2254 &ssc0_pclk,
diff --git a/arch/avr32/mach-at32ap/cpufreq.c b/arch/avr32/mach-at32ap/cpufreq.c
deleted file mode 100644
index 18b765629a0c..000000000000
--- a/arch/avr32/mach-at32ap/cpufreq.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Copyright (C) 2004-2007 Atmel Corporation
3 *
4 * Based on MIPS implementation arch/mips/kernel/time.c
5 * Copyright 2001 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12/*#define DEBUG*/
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/init.h>
17#include <linux/cpufreq.h>
18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/err.h>
21#include <linux/export.h>
22
23static struct clk *cpuclk;
24
25static int at32_verify_speed(struct cpufreq_policy *policy)
26{
27 if (policy->cpu != 0)
28 return -EINVAL;
29
30 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
31 policy->cpuinfo.max_freq);
32 return 0;
33}
34
35static unsigned int at32_get_speed(unsigned int cpu)
36{
37 /* No SMP support */
38 if (cpu)
39 return 0;
40 return (unsigned int)((clk_get_rate(cpuclk) + 500) / 1000);
41}
42
43static unsigned int ref_freq;
44static unsigned long loops_per_jiffy_ref;
45
46static int at32_set_target(struct cpufreq_policy *policy,
47 unsigned int target_freq,
48 unsigned int relation)
49{
50 struct cpufreq_freqs freqs;
51 long freq;
52
53 /* Convert target_freq from kHz to Hz */
54 freq = clk_round_rate(cpuclk, target_freq * 1000);
55
56 /* Check if policy->min <= new_freq <= policy->max */
57 if(freq < (policy->min * 1000) || freq > (policy->max * 1000))
58 return -EINVAL;
59
60 pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000);
61
62 freqs.old = at32_get_speed(0);
63 freqs.new = (freq + 500) / 1000;
64 freqs.cpu = 0;
65 freqs.flags = 0;
66
67 if (!ref_freq) {
68 ref_freq = freqs.old;
69 loops_per_jiffy_ref = boot_cpu_data.loops_per_jiffy;
70 }
71
72 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
73 if (freqs.old < freqs.new)
74 boot_cpu_data.loops_per_jiffy = cpufreq_scale(
75 loops_per_jiffy_ref, ref_freq, freqs.new);
76 clk_set_rate(cpuclk, freq);
77 if (freqs.new < freqs.old)
78 boot_cpu_data.loops_per_jiffy = cpufreq_scale(
79 loops_per_jiffy_ref, ref_freq, freqs.new);
80 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
81
82 pr_debug("cpufreq: set frequency %lu Hz\n", freq);
83
84 return 0;
85}
86
87static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy)
88{
89 if (policy->cpu != 0)
90 return -EINVAL;
91
92 cpuclk = clk_get(NULL, "cpu");
93 if (IS_ERR(cpuclk)) {
94 pr_debug("cpufreq: could not get CPU clk\n");
95 return PTR_ERR(cpuclk);
96 }
97
98 policy->cpuinfo.min_freq = (clk_round_rate(cpuclk, 1) + 500) / 1000;
99 policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
100 policy->cpuinfo.transition_latency = 0;
101 policy->cur = at32_get_speed(0);
102 policy->min = policy->cpuinfo.min_freq;
103 policy->max = policy->cpuinfo.max_freq;
104
105 printk("cpufreq: AT32AP CPU frequency driver\n");
106
107 return 0;
108}
109
110static struct cpufreq_driver at32_driver = {
111 .name = "at32ap",
112 .owner = THIS_MODULE,
113 .init = at32_cpufreq_driver_init,
114 .verify = at32_verify_speed,
115 .target = at32_set_target,
116 .get = at32_get_speed,
117 .flags = CPUFREQ_STICKY,
118};
119
120static int __init at32_cpufreq_init(void)
121{
122 return cpufreq_register_driver(&at32_driver);
123}
124late_initcall(at32_cpufreq_init);
diff --git a/arch/avr32/mach-at32ap/include/mach/pm.h b/arch/avr32/mach-at32ap/include/mach/pm.h
index 979b355b77b6..f29ff2cd23d3 100644
--- a/arch/avr32/mach-at32ap/include/mach/pm.h
+++ b/arch/avr32/mach-at32ap/include/mach/pm.h
@@ -21,30 +21,6 @@
21extern void cpu_enter_idle(void); 21extern void cpu_enter_idle(void);
22extern void cpu_enter_standby(unsigned long sdramc_base); 22extern void cpu_enter_standby(unsigned long sdramc_base);
23 23
24extern bool disable_idle_sleep;
25
26static inline void cpu_disable_idle_sleep(void)
27{
28 disable_idle_sleep = true;
29}
30
31static inline void cpu_enable_idle_sleep(void)
32{
33 disable_idle_sleep = false;
34}
35
36static inline void cpu_idle_sleep(void)
37{
38 /*
39 * If we're using the COUNT and COMPARE registers for
40 * timekeeping, we can't use the IDLE state.
41 */
42 if (disable_idle_sleep)
43 cpu_relax();
44 else
45 cpu_enter_idle();
46}
47
48void intc_set_suspend_handler(unsigned long offset); 24void intc_set_suspend_handler(unsigned long offset);
49#endif 25#endif
50 26
diff --git a/arch/avr32/mach-at32ap/pm-at32ap700x.S b/arch/avr32/mach-at32ap/pm-at32ap700x.S
index f868f4ce761b..1c8e4e6bff03 100644
--- a/arch/avr32/mach-at32ap/pm-at32ap700x.S
+++ b/arch/avr32/mach-at32ap/pm-at32ap700x.S
@@ -18,13 +18,6 @@
18/* Same as 0xfff00000 but fits in a 21 bit signed immediate */ 18/* Same as 0xfff00000 but fits in a 21 bit signed immediate */
19#define PM_BASE -0x100000 19#define PM_BASE -0x100000
20 20
21 .section .bss, "wa", @nobits
22 .global disable_idle_sleep
23 .type disable_idle_sleep, @object
24disable_idle_sleep:
25 .int 4
26 .size disable_idle_sleep, . - disable_idle_sleep
27
28 /* Keep this close to the irq handlers */ 21 /* Keep this close to the irq handlers */
29 .section .irq.text, "ax", @progbits 22 .section .irq.text, "ax", @progbits
30 23
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 2798c2d4a1cf..e66e8406f992 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -146,34 +146,14 @@ void __init mem_init(void)
146 initsize >> 10); 146 initsize >> 10);
147} 147}
148 148
149static inline void free_area(unsigned long addr, unsigned long end, char *s)
150{
151 unsigned int size = (end - addr) >> 10;
152
153 for (; addr < end; addr += PAGE_SIZE) {
154 struct page *page = virt_to_page(addr);
155 ClearPageReserved(page);
156 init_page_count(page);
157 free_page(addr);
158 totalram_pages++;
159 }
160
161 if (size && s)
162 printk(KERN_INFO "Freeing %s memory: %dK (%lx - %lx)\n",
163 s, size, end - (size << 10), end);
164}
165
166void free_initmem(void) 149void free_initmem(void)
167{ 150{
168 free_area((unsigned long)__init_begin, (unsigned long)__init_end, 151 free_initmem_default(0);
169 "init");
170} 152}
171 153
172#ifdef CONFIG_BLK_DEV_INITRD 154#ifdef CONFIG_BLK_DEV_INITRD
173
174void free_initrd_mem(unsigned long start, unsigned long end) 155void free_initrd_mem(unsigned long start, unsigned long end)
175{ 156{
176 free_area(start, end, "initrd"); 157 free_reserved_area(start, end, 0, "initrd");
177} 158}
178
179#endif 159#endif
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index c3f2e0bc644a..453ebe46b065 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -1,7 +1,3 @@
1config SYMBOL_PREFIX
2 string
3 default "_"
4
5config MMU 1config MMU
6 def_bool n 2 def_bool n
7 3
@@ -33,6 +29,7 @@ config BLACKFIN
33 select ARCH_HAVE_CUSTOM_GPIO_H 29 select ARCH_HAVE_CUSTOM_GPIO_H
34 select ARCH_WANT_OPTIONAL_GPIOLIB 30 select ARCH_WANT_OPTIONAL_GPIOLIB
35 select HAVE_UID16 31 select HAVE_UID16
32 select HAVE_UNDERSCORE_SYMBOL_PREFIX
36 select VIRT_TO_BUS 33 select VIRT_TO_BUS
37 select ARCH_WANT_IPC_PARSE_VERSION 34 select ARCH_WANT_IPC_PARSE_VERSION
38 select HAVE_GENERIC_HARDIRQS 35 select HAVE_GENERIC_HARDIRQS
diff --git a/arch/blackfin/include/asm/bfin_sport3.h b/arch/blackfin/include/asm/bfin_sport3.h
index 03c00220d69b..d82f5fa0ad9f 100644
--- a/arch/blackfin/include/asm/bfin_sport3.h
+++ b/arch/blackfin/include/asm/bfin_sport3.h
@@ -41,7 +41,7 @@
41#define SPORT_CTL_LAFS 0x00020000 /* Late Transmit frame select */ 41#define SPORT_CTL_LAFS 0x00020000 /* Late Transmit frame select */
42#define SPORT_CTL_RJUST 0x00040000 /* Right Justified mode select */ 42#define SPORT_CTL_RJUST 0x00040000 /* Right Justified mode select */
43#define SPORT_CTL_FSED 0x00080000 /* External frame sync edge select */ 43#define SPORT_CTL_FSED 0x00080000 /* External frame sync edge select */
44#define SPORT_CTL_TFIEN 0x00100000 /* Transmit finish interrrupt enable select */ 44#define SPORT_CTL_TFIEN 0x00100000 /* Transmit finish interrupt enable select */
45#define SPORT_CTL_GCLKEN 0x00200000 /* Gated clock mode select */ 45#define SPORT_CTL_GCLKEN 0x00200000 /* Gated clock mode select */
46#define SPORT_CTL_SPENSEC 0x01000000 /* Enable secondary channel */ 46#define SPORT_CTL_SPENSEC 0x01000000 /* Enable secondary channel */
47#define SPORT_CTL_SPTRAN 0x02000000 /* Data direction control */ 47#define SPORT_CTL_SPTRAN 0x02000000 /* Data direction control */
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index 04e83ea8d5cc..c35414bdf7bd 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -20,12 +20,4 @@
20#define __ARCH_WANT_SYS_NICE 20#define __ARCH_WANT_SYS_NICE
21#define __ARCH_WANT_SYS_VFORK 21#define __ARCH_WANT_SYS_VFORK
22 22
23/*
24 * "Conditional" syscalls
25 *
26 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
27 * but it doesn't work on all toolchains, so we just do it by hand
28 */
29#define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall");
30
31#endif /* __ASM_BFIN_UNISTD_H */ 23#endif /* __ASM_BFIN_UNISTD_H */
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c
index e1d0b24c6070..404045dcc5e4 100644
--- a/arch/blackfin/kernel/cplbinfo.c
+++ b/arch/blackfin/kernel/cplbinfo.c
@@ -116,14 +116,12 @@ static const struct seq_operations cplbinfo_sops = {
116 116
117static int cplbinfo_open(struct inode *inode, struct file *file) 117static int cplbinfo_open(struct inode *inode, struct file *file)
118{ 118{
119 struct proc_dir_entry *pde = PDE(file_inode(file));
120 char cplb_type; 119 char cplb_type;
121 unsigned int cpu; 120 unsigned int cpu = (unsigned long)PDE_DATA(file_inode(file));
122 int ret; 121 int ret;
123 struct seq_file *m; 122 struct seq_file *m;
124 struct cplbinfo_data *cdata; 123 struct cplbinfo_data *cdata;
125 124
126 cpu = (unsigned int)pde->data;
127 cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I'; 125 cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I';
128 cpu &= ~CPLBINFO_DCPLB_FLAG; 126 cpu &= ~CPLBINFO_DCPLB_FLAG;
129 127
diff --git a/arch/blackfin/kernel/dumpstack.c b/arch/blackfin/kernel/dumpstack.c
index 5cfbaa298211..95ba6d9e9a3d 100644
--- a/arch/blackfin/kernel/dumpstack.c
+++ b/arch/blackfin/kernel/dumpstack.c
@@ -168,6 +168,7 @@ void dump_stack(void)
168#endif 168#endif
169 trace_buffer_save(tflags); 169 trace_buffer_save(tflags);
170 dump_bfin_trace_buffer(); 170 dump_bfin_trace_buffer();
171 dump_stack_print_info(KERN_DEFAULT);
171 show_stack(current, &stack); 172 show_stack(current, &stack);
172 trace_buffer_restore(tflags); 173 trace_buffer_restore(tflags);
173} 174}
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c
index 84ed8375113c..61fbd2de993d 100644
--- a/arch/blackfin/kernel/early_printk.c
+++ b/arch/blackfin/kernel/early_printk.c
@@ -25,8 +25,6 @@ extern struct console *bfin_earlyserial_init(unsigned int port,
25extern struct console *bfin_jc_early_init(void); 25extern struct console *bfin_jc_early_init(void);
26#endif 26#endif
27 27
28static struct console *early_console;
29
30/* Default console */ 28/* Default console */
31#define DEFAULT_PORT 0 29#define DEFAULT_PORT 0
32#define DEFAULT_CFLAG CS8|B57600 30#define DEFAULT_CFLAG CS8|B57600
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 9782c0329c14..4aa5545c4fde 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -46,15 +46,14 @@ EXPORT_SYMBOL(pm_power_off);
46 * The idle loop on BFIN 46 * The idle loop on BFIN
47 */ 47 */
48#ifdef CONFIG_IDLE_L1 48#ifdef CONFIG_IDLE_L1
49static void default_idle(void)__attribute__((l1_text)); 49void arch_cpu_idle(void)__attribute__((l1_text));
50void cpu_idle(void)__attribute__((l1_text));
51#endif 50#endif
52 51
53/* 52/*
54 * This is our default idle handler. We need to disable 53 * This is our default idle handler. We need to disable
55 * interrupts here to ensure we don't miss a wakeup call. 54 * interrupts here to ensure we don't miss a wakeup call.
56 */ 55 */
57static void default_idle(void) 56void arch_cpu_idle(void)
58{ 57{
59#ifdef CONFIG_IPIPE 58#ifdef CONFIG_IPIPE
60 ipipe_suspend_domain(); 59 ipipe_suspend_domain();
@@ -66,31 +65,12 @@ static void default_idle(void)
66 hard_local_irq_enable(); 65 hard_local_irq_enable();
67} 66}
68 67
69/*
70 * The idle thread. We try to conserve power, while trying to keep
71 * overall latency low. The architecture specific idle is passed
72 * a value to indicate the level of "idleness" of the system.
73 */
74void cpu_idle(void)
75{
76 /* endless idle loop with no priority at all */
77 while (1) {
78
79#ifdef CONFIG_HOTPLUG_CPU 68#ifdef CONFIG_HOTPLUG_CPU
80 if (cpu_is_offline(smp_processor_id())) 69void arch_cpu_idle_dead(void)
81 cpu_die(); 70{
82#endif 71 cpu_die();
83 tick_nohz_idle_enter();
84 rcu_idle_enter();
85 while (!need_resched())
86 default_idle();
87 rcu_idle_exit();
88 tick_nohz_idle_exit();
89 preempt_enable_no_resched();
90 schedule();
91 preempt_disable();
92 }
93} 72}
73#endif
94 74
95/* 75/*
96 * Do necessary setup to start up a newly executed thread. 76 * Do necessary setup to start up a newly executed thread.
diff --git a/arch/blackfin/kernel/trace.c b/arch/blackfin/kernel/trace.c
index f7f7a18abca9..c36efa0c7163 100644
--- a/arch/blackfin/kernel/trace.c
+++ b/arch/blackfin/kernel/trace.c
@@ -853,6 +853,8 @@ void show_regs(struct pt_regs *fp)
853 unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic(); 853 unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
854 854
855 pr_notice("\n"); 855 pr_notice("\n");
856 show_regs_print_info(KERN_NOTICE);
857
856 if (CPUID != bfin_cpuid()) 858 if (CPUID != bfin_cpuid())
857 pr_notice("Compiled for cpu family 0x%04x (Rev %d), " 859 pr_notice("Compiled for cpu family 0x%04x (Rev %d), "
858 "but running on:0x%04x (Rev %d)\n", 860 "but running on:0x%04x (Rev %d)\n",
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
index 61c1f47a4bf2..97d701639585 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -936,19 +936,19 @@ static struct v4l2_input adv7842_inputs[] = {
936 .index = 2, 936 .index = 2,
937 .name = "Component", 937 .name = "Component",
938 .type = V4L2_INPUT_TYPE_CAMERA, 938 .type = V4L2_INPUT_TYPE_CAMERA,
939 .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS, 939 .capabilities = V4L2_IN_CAP_DV_TIMINGS,
940 }, 940 },
941 { 941 {
942 .index = 3, 942 .index = 3,
943 .name = "VGA", 943 .name = "VGA",
944 .type = V4L2_INPUT_TYPE_CAMERA, 944 .type = V4L2_INPUT_TYPE_CAMERA,
945 .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS, 945 .capabilities = V4L2_IN_CAP_DV_TIMINGS,
946 }, 946 },
947 { 947 {
948 .index = 4, 948 .index = 4,
949 .name = "HDMI", 949 .name = "HDMI",
950 .type = V4L2_INPUT_TYPE_CAMERA, 950 .type = V4L2_INPUT_TYPE_CAMERA,
951 .capabilities = V4L2_IN_CAP_CUSTOM_TIMINGS, 951 .capabilities = V4L2_IN_CAP_DV_TIMINGS,
952 }, 952 },
953}; 953};
954 954
@@ -1074,7 +1074,7 @@ static struct v4l2_output adv7511_outputs[] = {
1074 .index = 0, 1074 .index = 0,
1075 .name = "HDMI", 1075 .name = "HDMI",
1076 .type = V4L2_INPUT_TYPE_CAMERA, 1076 .type = V4L2_INPUT_TYPE_CAMERA,
1077 .capabilities = V4L2_OUT_CAP_CUSTOM_TIMINGS, 1077 .capabilities = V4L2_OUT_CAP_DV_TIMINGS,
1078 }, 1078 },
1079}; 1079};
1080 1080
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile
index 75f0ba29ebb9..675466d490d4 100644
--- a/arch/blackfin/mach-common/Makefile
+++ b/arch/blackfin/mach-common/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_PM) += pm.o
10ifneq ($(CONFIG_BF60x),y) 10ifneq ($(CONFIG_BF60x),y)
11obj-$(CONFIG_PM) += dpmc_modes.o 11obj-$(CONFIG_PM) += dpmc_modes.o
12endif 12endif
13obj-$(CONFIG_CPU_FREQ) += cpufreq.o
14obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o 13obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o
15obj-$(CONFIG_SMP) += smp.o 14obj-$(CONFIG_SMP) += smp.o
16obj-$(CONFIG_BFIN_KERNEL_CLOCK) += clocks-init.o 15obj-$(CONFIG_BFIN_KERNEL_CLOCK) += clocks-init.o
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c
deleted file mode 100644
index d88bd31319e6..000000000000
--- a/arch/blackfin/mach-common/cpufreq.c
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2 * Blackfin core clock scaling
3 *
4 * Copyright 2008-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/clk.h>
14#include <linux/cpufreq.h>
15#include <linux/fs.h>
16#include <linux/delay.h>
17#include <asm/blackfin.h>
18#include <asm/time.h>
19#include <asm/dpmc.h>
20
21
22/* this is the table of CCLK frequencies, in Hz */
23/* .index is the entry in the auxiliary dpm_state_table[] */
24static struct cpufreq_frequency_table bfin_freq_table[] = {
25 {
26 .frequency = CPUFREQ_TABLE_END,
27 .index = 0,
28 },
29 {
30 .frequency = CPUFREQ_TABLE_END,
31 .index = 1,
32 },
33 {
34 .frequency = CPUFREQ_TABLE_END,
35 .index = 2,
36 },
37 {
38 .frequency = CPUFREQ_TABLE_END,
39 .index = 0,
40 },
41};
42
43static struct bfin_dpm_state {
44 unsigned int csel; /* system clock divider */
45 unsigned int tscale; /* change the divider on the core timer interrupt */
46} dpm_state_table[3];
47
48#if defined(CONFIG_CYCLES_CLOCKSOURCE)
49/*
50 * normalized to maximum frequency offset for CYCLES,
51 * used in time-ts cycles clock source, but could be used
52 * somewhere also.
53 */
54unsigned long long __bfin_cycles_off;
55unsigned int __bfin_cycles_mod;
56#endif
57
58/**************************************************************************/
59static void __init bfin_init_tables(unsigned long cclk, unsigned long sclk)
60{
61
62 unsigned long csel, min_cclk;
63 int index;
64
65 /* Anomaly 273 seems to still exist on non-BF54x w/dcache turned on */
66#if ANOMALY_05000273 || ANOMALY_05000274 || \
67 (!(defined(CONFIG_BF54x) || defined(CONFIG_BF60x)) \
68 && defined(CONFIG_BFIN_EXTMEM_DCACHEABLE))
69 min_cclk = sclk * 2;
70#else
71 min_cclk = sclk;
72#endif
73
74#ifndef CONFIG_BF60x
75 csel = ((bfin_read_PLL_DIV() & CSEL) >> 4);
76#else
77 csel = bfin_read32(CGU0_DIV) & 0x1F;
78#endif
79
80 for (index = 0; (cclk >> index) >= min_cclk && csel <= 3 && index < 3; index++, csel++) {
81 bfin_freq_table[index].frequency = cclk >> index;
82#ifndef CONFIG_BF60x
83 dpm_state_table[index].csel = csel << 4; /* Shift now into PLL_DIV bitpos */
84#else
85 dpm_state_table[index].csel = csel;
86#endif
87 dpm_state_table[index].tscale = (TIME_SCALE >> index) - 1;
88
89 pr_debug("cpufreq: freq:%d csel:0x%x tscale:%d\n",
90 bfin_freq_table[index].frequency,
91 dpm_state_table[index].csel,
92 dpm_state_table[index].tscale);
93 }
94 return;
95}
96
97static void bfin_adjust_core_timer(void *info)
98{
99 unsigned int tscale;
100 unsigned int index = *(unsigned int *)info;
101
102 /* we have to adjust the core timer, because it is using cclk */
103 tscale = dpm_state_table[index].tscale;
104 bfin_write_TSCALE(tscale);
105 return;
106}
107
108static unsigned int bfin_getfreq_khz(unsigned int cpu)
109{
110 /* Both CoreA/B have the same core clock */
111 return get_cclk() / 1000;
112}
113
114#ifdef CONFIG_BF60x
115unsigned long cpu_set_cclk(int cpu, unsigned long new)
116{
117 struct clk *clk;
118 int ret;
119
120 clk = clk_get(NULL, "CCLK");
121 if (IS_ERR(clk))
122 return -ENODEV;
123
124 ret = clk_set_rate(clk, new);
125 clk_put(clk);
126 return ret;
127}
128#endif
129
130static int bfin_target(struct cpufreq_policy *poli,
131 unsigned int target_freq, unsigned int relation)
132{
133#ifndef CONFIG_BF60x
134 unsigned int plldiv;
135#endif
136 unsigned int index, cpu;
137 unsigned long cclk_hz;
138 struct cpufreq_freqs freqs;
139 static unsigned long lpj_ref;
140 static unsigned int lpj_ref_freq;
141 int ret = 0;
142
143#if defined(CONFIG_CYCLES_CLOCKSOURCE)
144 cycles_t cycles;
145#endif
146
147 for_each_online_cpu(cpu) {
148 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
149
150 if (!policy)
151 continue;
152
153 if (cpufreq_frequency_table_target(policy, bfin_freq_table,
154 target_freq, relation, &index))
155 return -EINVAL;
156
157 cclk_hz = bfin_freq_table[index].frequency;
158
159 freqs.old = bfin_getfreq_khz(0);
160 freqs.new = cclk_hz;
161 freqs.cpu = cpu;
162
163 pr_debug("cpufreq: changing cclk to %lu; target = %u, oldfreq = %u\n",
164 cclk_hz, target_freq, freqs.old);
165
166 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
167 if (cpu == CPUFREQ_CPU) {
168#ifndef CONFIG_BF60x
169 plldiv = (bfin_read_PLL_DIV() & SSEL) |
170 dpm_state_table[index].csel;
171 bfin_write_PLL_DIV(plldiv);
172#else
173 ret = cpu_set_cclk(cpu, freqs.new * 1000);
174 if (ret != 0) {
175 WARN_ONCE(ret, "cpufreq set freq failed %d\n", ret);
176 break;
177 }
178#endif
179 on_each_cpu(bfin_adjust_core_timer, &index, 1);
180#if defined(CONFIG_CYCLES_CLOCKSOURCE)
181 cycles = get_cycles();
182 SSYNC();
183 cycles += 10; /* ~10 cycles we lose after get_cycles() */
184 __bfin_cycles_off +=
185 (cycles << __bfin_cycles_mod) - (cycles << index);
186 __bfin_cycles_mod = index;
187#endif
188 if (!lpj_ref_freq) {
189 lpj_ref = loops_per_jiffy;
190 lpj_ref_freq = freqs.old;
191 }
192 if (freqs.new != freqs.old) {
193 loops_per_jiffy = cpufreq_scale(lpj_ref,
194 lpj_ref_freq, freqs.new);
195 }
196 }
197 /* TODO: just test case for cycles clock source, remove later */
198 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
199 }
200
201 pr_debug("cpufreq: done\n");
202 return ret;
203}
204
205static int bfin_verify_speed(struct cpufreq_policy *policy)
206{
207 return cpufreq_frequency_table_verify(policy, bfin_freq_table);
208}
209
210static int __bfin_cpu_init(struct cpufreq_policy *policy)
211{
212
213 unsigned long cclk, sclk;
214
215 cclk = get_cclk() / 1000;
216 sclk = get_sclk() / 1000;
217
218 if (policy->cpu == CPUFREQ_CPU)
219 bfin_init_tables(cclk, sclk);
220
221 policy->cpuinfo.transition_latency = 50000; /* 50us assumed */
222
223 policy->cur = cclk;
224 cpufreq_frequency_table_get_attr(bfin_freq_table, policy->cpu);
225 return cpufreq_frequency_table_cpuinfo(policy, bfin_freq_table);
226}
227
228static struct freq_attr *bfin_freq_attr[] = {
229 &cpufreq_freq_attr_scaling_available_freqs,
230 NULL,
231};
232
233static struct cpufreq_driver bfin_driver = {
234 .verify = bfin_verify_speed,
235 .target = bfin_target,
236 .get = bfin_getfreq_khz,
237 .init = __bfin_cpu_init,
238 .name = "bfin cpufreq",
239 .owner = THIS_MODULE,
240 .attr = bfin_freq_attr,
241};
242
243static int __init bfin_cpu_init(void)
244{
245 return cpufreq_register_driver(&bfin_driver);
246}
247
248static void __exit bfin_cpu_exit(void)
249{
250 cpufreq_unregister_driver(&bfin_driver);
251}
252
253MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
254MODULE_DESCRIPTION("cpufreq driver for Blackfin");
255MODULE_LICENSE("GPL");
256
257module_init(bfin_cpu_init);
258module_exit(bfin_cpu_exit);
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index bb61ae4986e4..1bc2ce6f3c94 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -335,7 +335,7 @@ void __cpuinit secondary_start_kernel(void)
335 */ 335 */
336 calibrate_delay(); 336 calibrate_delay();
337 337
338 cpu_idle(); 338 cpu_startup_entry(CPUHP_ONLINE);
339} 339}
340 340
341void __init smp_prepare_boot_cpu(void) 341void __init smp_prepare_boot_cpu(void)
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 9cb85537bd2b..82d01a71207f 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -103,7 +103,7 @@ void __init mem_init(void)
103 max_mapnr = num_physpages = MAP_NR(high_memory); 103 max_mapnr = num_physpages = MAP_NR(high_memory);
104 printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages); 104 printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages);
105 105
106 /* This will put all memory onto the freelists. */ 106 /* This will put all low memory onto the freelists. */
107 totalram_pages = free_all_bootmem(); 107 totalram_pages = free_all_bootmem();
108 108
109 reservedpages = 0; 109 reservedpages = 0;
@@ -129,24 +129,11 @@ void __init mem_init(void)
129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10))); 129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
130} 130}
131 131
132static void __init free_init_pages(const char *what, unsigned long begin, unsigned long end)
133{
134 unsigned long addr;
135 /* next to check that the page we free is not a partial page */
136 for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) {
137 ClearPageReserved(virt_to_page(addr));
138 init_page_count(virt_to_page(addr));
139 free_page(addr);
140 totalram_pages++;
141 }
142 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
143}
144
145#ifdef CONFIG_BLK_DEV_INITRD 132#ifdef CONFIG_BLK_DEV_INITRD
146void __init free_initrd_mem(unsigned long start, unsigned long end) 133void __init free_initrd_mem(unsigned long start, unsigned long end)
147{ 134{
148#ifndef CONFIG_MPU 135#ifndef CONFIG_MPU
149 free_init_pages("initrd memory", start, end); 136 free_reserved_area(start, end, 0, "initrd");
150#endif 137#endif
151} 138}
152#endif 139#endif
@@ -154,10 +141,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
154void __init_refok free_initmem(void) 141void __init_refok free_initmem(void)
155{ 142{
156#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU 143#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
157 free_init_pages("unused kernel memory", 144 free_initmem_default(0);
158 (unsigned long)(&__init_begin),
159 (unsigned long)(&__init_end));
160
161 if (memory_start == (unsigned long)(&__init_end)) 145 if (memory_start == (unsigned long)(&__init_end))
162 memory_start = (unsigned long)(&__init_begin); 146 memory_start = (unsigned long)(&__init_begin);
163#endif 147#endif
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 6434df476f77..57d2ea8d1977 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -33,7 +33,7 @@ extern asmlinkage void ret_from_kernel_thread(void);
33void (*pm_power_off)(void); 33void (*pm_power_off)(void);
34EXPORT_SYMBOL(pm_power_off); 34EXPORT_SYMBOL(pm_power_off);
35 35
36static void c6x_idle(void) 36void arch_cpu_idle(void)
37{ 37{
38 unsigned long tmp; 38 unsigned long tmp;
39 39
@@ -49,32 +49,6 @@ static void c6x_idle(void)
49 : "=b"(tmp)); 49 : "=b"(tmp));
50} 50}
51 51
52/*
53 * The idle loop for C64x
54 */
55void cpu_idle(void)
56{
57 /* endless idle loop with no priority at all */
58 while (1) {
59 tick_nohz_idle_enter();
60 rcu_idle_enter();
61 while (1) {
62 local_irq_disable();
63 if (need_resched()) {
64 local_irq_enable();
65 break;
66 }
67 c6x_idle(); /* enables local irqs */
68 }
69 rcu_idle_exit();
70 tick_nohz_idle_exit();
71
72 preempt_enable_no_resched();
73 schedule();
74 preempt_disable();
75 }
76}
77
78static void halt_loop(void) 52static void halt_loop(void)
79{ 53{
80 printk(KERN_EMERG "System Halted, OK to turn off power\n"); 54 printk(KERN_EMERG "System Halted, OK to turn off power\n");
diff --git a/arch/c6x/kernel/traps.c b/arch/c6x/kernel/traps.c
index 1be74e5b4788..dcc2c2f6d67c 100644
--- a/arch/c6x/kernel/traps.c
+++ b/arch/c6x/kernel/traps.c
@@ -31,6 +31,7 @@ void __init trap_init(void)
31void show_regs(struct pt_regs *regs) 31void show_regs(struct pt_regs *regs)
32{ 32{
33 pr_err("\n"); 33 pr_err("\n");
34 show_regs_print_info(KERN_ERR);
34 pr_err("PC: %08lx SP: %08lx\n", regs->pc, regs->sp); 35 pr_err("PC: %08lx SP: %08lx\n", regs->pc, regs->sp);
35 pr_err("Status: %08lx ORIG_A4: %08lx\n", regs->csr, regs->orig_a4); 36 pr_err("Status: %08lx ORIG_A4: %08lx\n", regs->csr, regs->orig_a4);
36 pr_err("A0: %08lx B0: %08lx\n", regs->a0, regs->b0); 37 pr_err("A0: %08lx B0: %08lx\n", regs->a0, regs->b0);
@@ -67,15 +68,6 @@ void show_regs(struct pt_regs *regs)
67 pr_err("A31: %08lx B31: %08lx\n", regs->a31, regs->b31); 68 pr_err("A31: %08lx B31: %08lx\n", regs->a31, regs->b31);
68} 69}
69 70
70void dump_stack(void)
71{
72 unsigned long stack;
73
74 show_stack(current, &stack);
75}
76EXPORT_SYMBOL(dump_stack);
77
78
79void die(char *str, struct pt_regs *fp, int nr) 71void die(char *str, struct pt_regs *fp, int nr)
80{ 72{
81 console_verbose(); 73 console_verbose();
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
index 89395f09648a..a9fcd89b251b 100644
--- a/arch/c6x/mm/init.c
+++ b/arch/c6x/mm/init.c
@@ -77,37 +77,11 @@ void __init mem_init(void)
77#ifdef CONFIG_BLK_DEV_INITRD 77#ifdef CONFIG_BLK_DEV_INITRD
78void __init free_initrd_mem(unsigned long start, unsigned long end) 78void __init free_initrd_mem(unsigned long start, unsigned long end)
79{ 79{
80 int pages = 0; 80 free_reserved_area(start, end, 0, "initrd");
81 for (; start < end; start += PAGE_SIZE) {
82 ClearPageReserved(virt_to_page(start));
83 init_page_count(virt_to_page(start));
84 free_page(start);
85 totalram_pages++;
86 pages++;
87 }
88 printk(KERN_INFO "Freeing initrd memory: %luk freed\n",
89 (pages * PAGE_SIZE) >> 10);
90} 81}
91#endif 82#endif
92 83
93void __init free_initmem(void) 84void __init free_initmem(void)
94{ 85{
95 unsigned long addr; 86 free_initmem_default(0);
96
97 /*
98 * The following code should be cool even if these sections
99 * are not page aligned.
100 */
101 addr = PAGE_ALIGN((unsigned long)(__init_begin));
102
103 /* next to check that the page we free is not a partial page */
104 for (; addr + PAGE_SIZE < (unsigned long)(__init_end);
105 addr += PAGE_SIZE) {
106 ClearPageReserved(virt_to_page(addr));
107 init_page_count(virt_to_page(addr));
108 free_page(addr);
109 totalram_pages++;
110 }
111 printk(KERN_INFO "Freeing unused kernel memory: %dK freed\n",
112 (int) ((addr - PAGE_ALIGN((long) &__init_begin)) >> 10));
113} 87}
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index 082f1890bacb..48a59afbeeb1 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -25,6 +25,7 @@
25#include <arch/svinto.h> 25#include <arch/svinto.h>
26#include <asm/fasttimer.h> 26#include <asm/fasttimer.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/seq_file.h>
28 29
29 30
30#define DEBUG_LOG_INCLUDED 31#define DEBUG_LOG_INCLUDED
@@ -489,197 +490,162 @@ void schedule_usleep(unsigned long us)
489} 490}
490 491
491#ifdef CONFIG_PROC_FS 492#ifdef CONFIG_PROC_FS
492static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
493 ,int *eof, void *data_unused);
494static struct proc_dir_entry *fasttimer_proc_entry;
495#endif /* CONFIG_PROC_FS */
496
497#ifdef CONFIG_PROC_FS
498
499/* This value is very much based on testing */ 493/* This value is very much based on testing */
500#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) 494#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
501 495
502static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len 496static int proc_fasttimer_show(struct seq_file *m, void *v)
503 ,int *eof, void *data_unused)
504{ 497{
505 unsigned long flags; 498 unsigned long flags;
506 int i = 0; 499 int i = 0;
507 int num_to_show; 500 int num_to_show;
508 struct fasttime_t tv; 501 struct fasttime_t tv;
509 struct fast_timer *t, *nextt; 502 struct fast_timer *t, *nextt;
510 static char *bigbuf = NULL; 503
511 static unsigned long used; 504 do_gettimeofday_fast(&tv);
512 505
513 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) 506 seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
514 { 507 seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
515 used = 0; 508 seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
516 if (buf) 509 seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
517 buf[0] = '\0'; 510 seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
518 return 0; 511 seq_printf(m, "Fast timer running: %s\n",
519 } 512 fast_timer_running ? "yes" : "no");
520 513 seq_printf(m, "Current time: %lu.%06lu\n",
521 if (!offset || !used) 514 (unsigned long)tv.tv_jiff,
522 { 515 (unsigned long)tv.tv_usec);
523 do_gettimeofday_fast(&tv);
524
525 used = 0;
526 used += sprintf(bigbuf + used, "Fast timers added: %i\n",
527 fast_timers_added);
528 used += sprintf(bigbuf + used, "Fast timers started: %i\n",
529 fast_timers_started);
530 used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
531 fast_timer_ints);
532 used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
533 fast_timers_expired);
534 used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
535 fast_timers_deleted);
536 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
537 fast_timer_running ? "yes" : "no");
538 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
539 (unsigned long)tv.tv_jiff,
540 (unsigned long)tv.tv_usec);
541#ifdef FAST_TIMER_SANITY_CHECKS 516#ifdef FAST_TIMER_SANITY_CHECKS
542 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 517 seq_printf(m, "Sanity failed: %i\n", sanity_failed);
543 sanity_failed);
544#endif 518#endif
545 used += sprintf(bigbuf + used, "\n"); 519 seq_putc(m, '\n');
546 520
547#ifdef DEBUG_LOG_INCLUDED 521#ifdef DEBUG_LOG_INCLUDED
548 { 522 {
549 int end_i = debug_log_cnt; 523 int end_i = debug_log_cnt;
550 i = 0; 524 i = 0;
551 525
552 if (debug_log_cnt_wrapped) 526 if (debug_log_cnt_wrapped)
553 { 527 i = debug_log_cnt;
554 i = debug_log_cnt; 528
555 } 529 while (i != end_i || debug_log_cnt_wrapped) {
556 530 if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
557 while ((i != end_i || (debug_log_cnt_wrapped && !used)) && 531 return 0;
558 used+100 < BIG_BUF_SIZE) 532 i = (i+1) % DEBUG_LOG_MAX;
559 { 533 }
560 used += sprintf(bigbuf + used, debug_log_string[i], 534 }
561 debug_log_value[i]); 535 seq_putc(m, '\n');
562 i = (i+1) % DEBUG_LOG_MAX;
563 }
564 }
565 used += sprintf(bigbuf + used, "\n");
566#endif 536#endif
567 537
568 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: 538 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
569 NUM_TIMER_STATS); 539 NUM_TIMER_STATS);
570 used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); 540 seq_printf(m, "Timers started: %i\n", fast_timers_started);
571 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) 541 for (i = 0; i < num_to_show; i++) {
572 { 542 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
573 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
574 543
575#if 1 //ndef FAST_TIMER_LOG 544#if 1 //ndef FAST_TIMER_LOG
576 used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i" 545 seq_printf(m, "div: %i freq: %i delay: %i"
577 "\n", 546 "\n",
578 timer_div_settings[cur], 547 timer_div_settings[cur],
579 timer_freq_settings[cur], 548 timer_freq_settings[cur],
580 timer_delay_settings[cur] 549 timer_delay_settings[cur]);
581 );
582#endif 550#endif
583#ifdef FAST_TIMER_LOG 551#ifdef FAST_TIMER_LOG
584 t = &timer_started_log[cur]; 552 t = &timer_started_log[cur];
585 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 553 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
586 "d: %6li us data: 0x%08lX" 554 "d: %6li us data: 0x%08lX"
587 "\n", 555 "\n",
588 t->name, 556 t->name,
589 (unsigned long)t->tv_set.tv_jiff, 557 (unsigned long)t->tv_set.tv_jiff,
590 (unsigned long)t->tv_set.tv_usec, 558 (unsigned long)t->tv_set.tv_usec,
591 (unsigned long)t->tv_expires.tv_jiff, 559 (unsigned long)t->tv_expires.tv_jiff,
592 (unsigned long)t->tv_expires.tv_usec, 560 (unsigned long)t->tv_expires.tv_usec,
593 t->delay_us, 561 t->delay_us,
594 t->data 562 t->data) < 0)
595 ); 563 return 0;
596#endif 564#endif
597 } 565 }
598 used += sprintf(bigbuf + used, "\n"); 566 seq_putc(m, '\n');
599 567
600#ifdef FAST_TIMER_LOG 568#ifdef FAST_TIMER_LOG
601 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: 569 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
602 NUM_TIMER_STATS); 570 NUM_TIMER_STATS);
603 used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); 571 seq_printf(m, "Timers added: %i\n", fast_timers_added);
604 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 572 for (i = 0; i < num_to_show; i++) {
605 { 573 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
606 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; 574 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
607 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 575 "d: %6li us data: 0x%08lX"
608 "d: %6li us data: 0x%08lX" 576 "\n",
609 "\n", 577 t->name,
610 t->name, 578 (unsigned long)t->tv_set.tv_jiff,
611 (unsigned long)t->tv_set.tv_jiff, 579 (unsigned long)t->tv_set.tv_usec,
612 (unsigned long)t->tv_set.tv_usec, 580 (unsigned long)t->tv_expires.tv_jiff,
613 (unsigned long)t->tv_expires.tv_jiff, 581 (unsigned long)t->tv_expires.tv_usec,
614 (unsigned long)t->tv_expires.tv_usec, 582 t->delay_us,
615 t->delay_us, 583 t->data) < 0)
616 t->data 584 return 0;
617 ); 585 }
618 } 586 seq_putc(m, '\n');
619 used += sprintf(bigbuf + used, "\n"); 587
620 588 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
621 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: 589 NUM_TIMER_STATS);
622 NUM_TIMER_STATS); 590 seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
623 used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); 591 for (i = 0; i < num_to_show; i++) {
624 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 592 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
625 { 593 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
626 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; 594 "d: %6li us data: 0x%08lX"
627 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 595 "\n",
628 "d: %6li us data: 0x%08lX" 596 t->name,
629 "\n", 597 (unsigned long)t->tv_set.tv_jiff,
630 t->name, 598 (unsigned long)t->tv_set.tv_usec,
631 (unsigned long)t->tv_set.tv_jiff, 599 (unsigned long)t->tv_expires.tv_jiff,
632 (unsigned long)t->tv_set.tv_usec, 600 (unsigned long)t->tv_expires.tv_usec,
633 (unsigned long)t->tv_expires.tv_jiff, 601 t->delay_us,
634 (unsigned long)t->tv_expires.tv_usec, 602 t->data) < 0)
635 t->delay_us, 603 return 0;
636 t->data 604 }
637 ); 605 seq_putc(m, '\n');
638 }
639 used += sprintf(bigbuf + used, "\n");
640#endif 606#endif
641 607
642 used += sprintf(bigbuf + used, "Active timers:\n"); 608 seq_puts(m, "Active timers:\n");
643 local_irq_save(flags); 609 local_irq_save(flags);
644 t = fast_timer_list; 610 t = fast_timer_list;
645 while (t != NULL && (used+100 < BIG_BUF_SIZE)) 611 while (t) {
646 { 612 nextt = t->next;
647 nextt = t->next; 613 local_irq_restore(flags);
648 local_irq_restore(flags); 614 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
649 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 615 "d: %6li us data: 0x%08lX"
650 "d: %6li us data: 0x%08lX"
651/* " func: 0x%08lX" */ 616/* " func: 0x%08lX" */
652 "\n", 617 "\n",
653 t->name, 618 t->name,
654 (unsigned long)t->tv_set.tv_jiff, 619 (unsigned long)t->tv_set.tv_jiff,
655 (unsigned long)t->tv_set.tv_usec, 620 (unsigned long)t->tv_set.tv_usec,
656 (unsigned long)t->tv_expires.tv_jiff, 621 (unsigned long)t->tv_expires.tv_jiff,
657 (unsigned long)t->tv_expires.tv_usec, 622 (unsigned long)t->tv_expires.tv_usec,
658 t->delay_us, 623 t->delay_us,
659 t->data 624 t->data
660/* , t->function */ 625/* , t->function */
661 ); 626 ) < 0)
662 local_irq_save(flags); 627 return 0;
663 if (t->next != nextt) 628 local_irq_save(flags);
664 { 629 if (t->next != nextt)
665 printk(KERN_WARNING "timer removed!\n"); 630 printk(KERN_WARNING "timer removed!\n");
666 } 631 t = nextt;
667 t = nextt; 632 }
668 } 633 local_irq_restore(flags);
669 local_irq_restore(flags);
670 }
671
672 if (used - offset < len)
673 {
674 len = used - offset;
675 }
676 634
677 memcpy(buf, bigbuf + offset, len); 635 return 0;
678 *start = buf; 636}
679 *eof = 1;
680 637
681 return len; 638static int proc_fasttimer_open(struct inode *inode, struct file *file)
639{
640 return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
682} 641}
642
643static const struct file_operations proc_fasttimer_fops = {
644 .open = proc_fasttimer_open,
645 .read = seq_read,
646 .llseek = seq_lseek,
647 .release = single_release,
648};
683#endif /* PROC_FS */ 649#endif /* PROC_FS */
684 650
685#ifdef FAST_TIMER_TEST 651#ifdef FAST_TIMER_TEST
@@ -857,8 +823,7 @@ int fast_timer_init(void)
857 } 823 }
858#endif 824#endif
859#ifdef CONFIG_PROC_FS 825#ifdef CONFIG_PROC_FS
860 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) 826 proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
861 fasttimer_proc_entry->read_proc = proc_fasttimer_read;
862#endif /* PROC_FS */ 827#endif /* PROC_FS */
863 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, 828 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
864 "fast timer int", NULL)) 829 "fast timer int", NULL))
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index b1018750cffb..753e9a03cf87 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -30,8 +30,9 @@ void etrax_gpio_wake_up_check(void); /* drivers/gpio.c */
30void default_idle(void) 30void default_idle(void)
31{ 31{
32#ifdef CONFIG_ETRAX_GPIO 32#ifdef CONFIG_ETRAX_GPIO
33 etrax_gpio_wake_up_check(); 33 etrax_gpio_wake_up_check();
34#endif 34#endif
35 local_irq_enable();
35} 36}
36 37
37/* 38/*
@@ -175,6 +176,9 @@ unsigned long get_wchan(struct task_struct *p)
175void show_regs(struct pt_regs * regs) 176void show_regs(struct pt_regs * regs)
176{ 177{
177 unsigned long usp = rdusp(); 178 unsigned long usp = rdusp();
179
180 show_regs_print_info(KERN_DEFAULT);
181
178 printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", 182 printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
179 regs->irp, regs->srp, regs->dccr, usp, regs->mof ); 183 regs->irp, regs->srp, regs->dccr, usp, regs->mof );
180 printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", 184 printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
index ab1551ee43c5..f6644535b17e 100644
--- a/arch/cris/arch-v32/kernel/fasttimer.c
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -23,6 +23,7 @@
23#include <hwregs/timer_defs.h> 23#include <hwregs/timer_defs.h>
24#include <asm/fasttimer.h> 24#include <asm/fasttimer.h>
25#include <linux/proc_fs.h> 25#include <linux/proc_fs.h>
26#include <linux/seq_file.h>
26 27
27/* 28/*
28 * timer0 is running at 100MHz and generating jiffies timer ticks 29 * timer0 is running at 100MHz and generating jiffies timer ticks
@@ -463,195 +464,161 @@ void schedule_usleep(unsigned long us)
463} 464}
464 465
465#ifdef CONFIG_PROC_FS 466#ifdef CONFIG_PROC_FS
466static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
467 ,int *eof, void *data_unused);
468static struct proc_dir_entry *fasttimer_proc_entry;
469#endif /* CONFIG_PROC_FS */
470
471#ifdef CONFIG_PROC_FS
472
473/* This value is very much based on testing */ 467/* This value is very much based on testing */
474#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) 468#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
475 469
476static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len 470static int proc_fasttimer_show(struct seq_file *m, void *v)
477 ,int *eof, void *data_unused)
478{ 471{
479 unsigned long flags; 472 unsigned long flags;
480 int i = 0; 473 int i = 0;
481 int num_to_show; 474 int num_to_show;
482 struct fasttime_t tv; 475 struct fasttime_t tv;
483 struct fast_timer *t, *nextt; 476 struct fast_timer *t, *nextt;
484 static char *bigbuf = NULL; 477
485 static unsigned long used; 478 do_gettimeofday_fast(&tv);
486 479
487 if (!bigbuf) { 480 seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
488 bigbuf = vmalloc(BIG_BUF_SIZE); 481 seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
489 if (!bigbuf) { 482 seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
490 used = 0; 483 seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
491 if (buf) 484 seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
492 buf[0] = '\0'; 485 seq_printf(m, "Fast timer running: %s\n",
493 return 0; 486 fast_timer_running ? "yes" : "no");
494 } 487 seq_printf(m, "Current time: %lu.%06lu\n",
495 } 488 (unsigned long)tv.tv_jiff,
496 489 (unsigned long)tv.tv_usec);
497 if (!offset || !used) {
498 do_gettimeofday_fast(&tv);
499
500 used = 0;
501 used += sprintf(bigbuf + used, "Fast timers added: %i\n",
502 fast_timers_added);
503 used += sprintf(bigbuf + used, "Fast timers started: %i\n",
504 fast_timers_started);
505 used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
506 fast_timer_ints);
507 used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
508 fast_timers_expired);
509 used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
510 fast_timers_deleted);
511 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
512 fast_timer_running ? "yes" : "no");
513 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
514 (unsigned long)tv.tv_jiff,
515 (unsigned long)tv.tv_usec);
516#ifdef FAST_TIMER_SANITY_CHECKS 490#ifdef FAST_TIMER_SANITY_CHECKS
517 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 491 seq_printf(m, "Sanity failed: %i\n", sanity_failed);
518 sanity_failed);
519#endif 492#endif
520 used += sprintf(bigbuf + used, "\n"); 493 seq_putc(m, '\n');
521 494
522#ifdef DEBUG_LOG_INCLUDED 495#ifdef DEBUG_LOG_INCLUDED
523 { 496 {
524 int end_i = debug_log_cnt; 497 int end_i = debug_log_cnt;
525 i = 0; 498 i = 0;
526 499
527 if (debug_log_cnt_wrapped) 500 if (debug_log_cnt_wrapped)
528 i = debug_log_cnt; 501 i = debug_log_cnt;
529 502
530 while ((i != end_i || (debug_log_cnt_wrapped && !used)) && 503 while ((i != end_i || debug_log_cnt_wrapped)) {
531 used+100 < BIG_BUF_SIZE) 504 if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
532 { 505 return 0;
533 used += sprintf(bigbuf + used, debug_log_string[i], 506 i = (i+1) % DEBUG_LOG_MAX;
534 debug_log_value[i]); 507 }
535 i = (i+1) % DEBUG_LOG_MAX; 508 }
536 } 509 seq_putc(m, '\n');
537 }
538 used += sprintf(bigbuf + used, "\n");
539#endif 510#endif
540 511
541 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: 512 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
542 NUM_TIMER_STATS); 513 NUM_TIMER_STATS);
543 used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); 514 seq_printf(m, "Timers started: %i\n", fast_timers_started);
544 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) 515 for (i = 0; i < num_to_show; i++) {
545 { 516 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
546 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
547 517
548#if 1 //ndef FAST_TIMER_LOG 518#if 1 //ndef FAST_TIMER_LOG
549 used += sprintf(bigbuf + used, "div: %i delay: %i" 519 seq_printf(m, "div: %i delay: %i"
550 "\n", 520 "\n",
551 timer_div_settings[cur], 521 timer_div_settings[cur],
552 timer_delay_settings[cur] 522 timer_delay_settings[cur]);
553 );
554#endif 523#endif
555#ifdef FAST_TIMER_LOG 524#ifdef FAST_TIMER_LOG
556 t = &timer_started_log[cur]; 525 t = &timer_started_log[cur];
557 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 526 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
558 "d: %6li us data: 0x%08lX" 527 "d: %6li us data: 0x%08lX"
559 "\n", 528 "\n",
560 t->name, 529 t->name,
561 (unsigned long)t->tv_set.tv_jiff, 530 (unsigned long)t->tv_set.tv_jiff,
562 (unsigned long)t->tv_set.tv_usec, 531 (unsigned long)t->tv_set.tv_usec,
563 (unsigned long)t->tv_expires.tv_jiff, 532 (unsigned long)t->tv_expires.tv_jiff,
564 (unsigned long)t->tv_expires.tv_usec, 533 (unsigned long)t->tv_expires.tv_usec,
565 t->delay_us, 534 t->delay_us,
566 t->data 535 t->data) < 0)
567 ); 536 return 0;
568#endif 537#endif
569 } 538 }
570 used += sprintf(bigbuf + used, "\n"); 539 seq_putc(m, '\n');
571 540
572#ifdef FAST_TIMER_LOG 541#ifdef FAST_TIMER_LOG
573 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: 542 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
574 NUM_TIMER_STATS); 543 NUM_TIMER_STATS);
575 used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); 544 seq_printf(m, "Timers added: %i\n", fast_timers_added);
576 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 545 for (i = 0; i < num_to_show; i++) {
577 { 546 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
578 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; 547 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
579 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 548 "d: %6li us data: 0x%08lX"
580 "d: %6li us data: 0x%08lX" 549 "\n",
581 "\n", 550 t->name,
582 t->name, 551 (unsigned long)t->tv_set.tv_jiff,
583 (unsigned long)t->tv_set.tv_jiff, 552 (unsigned long)t->tv_set.tv_usec,
584 (unsigned long)t->tv_set.tv_usec, 553 (unsigned long)t->tv_expires.tv_jiff,
585 (unsigned long)t->tv_expires.tv_jiff, 554 (unsigned long)t->tv_expires.tv_usec,
586 (unsigned long)t->tv_expires.tv_usec, 555 t->delay_us,
587 t->delay_us, 556 t->data) < 0)
588 t->data 557 return 0;
589 ); 558 }
590 } 559 seq_putc(m, '\n');
591 used += sprintf(bigbuf + used, "\n"); 560
592 561 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
593 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: 562 NUM_TIMER_STATS);
594 NUM_TIMER_STATS); 563 seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
595 used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); 564 for (i = 0; i < num_to_show; i++){
596 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 565 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
597 { 566 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
598 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; 567 "d: %6li us data: 0x%08lX"
599 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 568 "\n",
600 "d: %6li us data: 0x%08lX" 569 t->name,
601 "\n", 570 (unsigned long)t->tv_set.tv_jiff,
602 t->name, 571 (unsigned long)t->tv_set.tv_usec,
603 (unsigned long)t->tv_set.tv_jiff, 572 (unsigned long)t->tv_expires.tv_jiff,
604 (unsigned long)t->tv_set.tv_usec, 573 (unsigned long)t->tv_expires.tv_usec,
605 (unsigned long)t->tv_expires.tv_jiff, 574 t->delay_us,
606 (unsigned long)t->tv_expires.tv_usec, 575 t->data) < 0)
607 t->delay_us, 576 return 0;
608 t->data 577 }
609 ); 578 seq_putc(m, '\n');
610 }
611 used += sprintf(bigbuf + used, "\n");
612#endif 579#endif
613 580
614 used += sprintf(bigbuf + used, "Active timers:\n"); 581 seq_puts(m, "Active timers:\n");
615 local_irq_save(flags); 582 local_irq_save(flags);
616 t = fast_timer_list; 583 t = fast_timer_list;
617 while (t != NULL && (used+100 < BIG_BUF_SIZE)) 584 while (t != NULL){
618 { 585 nextt = t->next;
619 nextt = t->next; 586 local_irq_restore(flags);
620 local_irq_restore(flags); 587 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
621 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 588 "d: %6li us data: 0x%08lX"
622 "d: %6li us data: 0x%08lX"
623/* " func: 0x%08lX" */ 589/* " func: 0x%08lX" */
624 "\n", 590 "\n",
625 t->name, 591 t->name,
626 (unsigned long)t->tv_set.tv_jiff, 592 (unsigned long)t->tv_set.tv_jiff,
627 (unsigned long)t->tv_set.tv_usec, 593 (unsigned long)t->tv_set.tv_usec,
628 (unsigned long)t->tv_expires.tv_jiff, 594 (unsigned long)t->tv_expires.tv_jiff,
629 (unsigned long)t->tv_expires.tv_usec, 595 (unsigned long)t->tv_expires.tv_usec,
630 t->delay_us, 596 t->delay_us,
631 t->data 597 t->data
632/* , t->function */ 598/* , t->function */
633 ); 599 ) < 0)
634 local_irq_save(flags); 600 return 0;
635 if (t->next != nextt) 601 local_irq_save(flags);
636 { 602 if (t->next != nextt)
637 printk("timer removed!\n"); 603 printk("timer removed!\n");
638 } 604 t = nextt;
639 t = nextt; 605 }
640 } 606 local_irq_restore(flags);
641 local_irq_restore(flags); 607 return 0;
642 } 608}
643 609
644 if (used - offset < len) 610static int proc_fasttimer_open(struct inode *inode, struct file *file)
645 { 611{
646 len = used - offset; 612 return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
647 } 613}
648 614
649 memcpy(buf, bigbuf + offset, len); 615static const struct file_operations proc_fasttimer_fops = {
650 *start = buf; 616 .open = proc_fasttimer_open,
651 *eof = 1; 617 .read = seq_read,
618 .llseek = seq_lseek,
619 .release = single_release,
620};
652 621
653 return len;
654}
655#endif /* PROC_FS */ 622#endif /* PROC_FS */
656 623
657#ifdef FAST_TIMER_TEST 624#ifdef FAST_TIMER_TEST
@@ -816,9 +783,7 @@ int fast_timer_init(void)
816 printk("fast_timer_init()\n"); 783 printk("fast_timer_init()\n");
817 784
818#ifdef CONFIG_PROC_FS 785#ifdef CONFIG_PROC_FS
819 fasttimer_proc_entry = create_proc_entry("fasttimer", 0, 0); 786 proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
820 if (fasttimer_proc_entry)
821 fasttimer_proc_entry->read_proc = proc_fasttimer_read;
822#endif /* PROC_FS */ 787#endif /* PROC_FS */
823 if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, 788 if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt,
824 IRQF_SHARED | IRQF_DISABLED, 789 IRQF_SHARED | IRQF_DISABLED,
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
index 2b23ef0e4452..cebd32e2a8fb 100644
--- a/arch/cris/arch-v32/kernel/process.c
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -20,18 +20,12 @@
20 20
21extern void stop_watchdog(void); 21extern void stop_watchdog(void);
22 22
23extern int cris_hlt_counter;
24
25/* We use this if we don't have any better idle routine. */ 23/* We use this if we don't have any better idle routine. */
26void default_idle(void) 24void default_idle(void)
27{ 25{
28 local_irq_disable(); 26 /* Halt until exception. */
29 if (!need_resched() && !cris_hlt_counter) { 27 __asm__ volatile("ei \n\t"
30 /* Halt until exception. */ 28 "halt ");
31 __asm__ volatile("ei \n\t"
32 "halt ");
33 }
34 local_irq_enable();
35} 29}
36 30
37/* 31/*
@@ -170,6 +164,9 @@ get_wchan(struct task_struct *p)
170void show_regs(struct pt_regs * regs) 164void show_regs(struct pt_regs * regs)
171{ 165{
172 unsigned long usp = rdusp(); 166 unsigned long usp = rdusp();
167
168 show_regs_print_info(KERN_DEFAULT);
169
173 printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n", 170 printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n",
174 regs->erp, regs->srp, regs->ccs, usp, regs->mof); 171 regs->erp, regs->srp, regs->ccs, usp, regs->mof);
175 172
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 04a16edd5401..cdd12028de0c 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -145,8 +145,6 @@ smp_boot_one_cpu(int cpuid, struct task_struct idle)
145 * specific stuff such as the local timer and the MMU. */ 145 * specific stuff such as the local timer and the MMU. */
146void __init smp_callin(void) 146void __init smp_callin(void)
147{ 147{
148 extern void cpu_idle(void);
149
150 int cpu = cpu_now_booting; 148 int cpu = cpu_now_booting;
151 reg_intr_vect_rw_mask vect_mask = {0}; 149 reg_intr_vect_rw_mask vect_mask = {0};
152 150
@@ -170,7 +168,7 @@ void __init smp_callin(void)
170 local_irq_enable(); 168 local_irq_enable();
171 169
172 set_cpu_online(cpu, true); 170 set_cpu_online(cpu, true);
173 cpu_idle(); 171 cpu_startup_entry(CPUHP_ONLINE);
174} 172}
175 173
176/* Stop execution on this CPU.*/ 174/* Stop execution on this CPU.*/
diff --git a/arch/cris/arch-v32/mach-a3/Makefile b/arch/cris/arch-v32/mach-a3/Makefile
index d366e0891988..18a227196a41 100644
--- a/arch/cris/arch-v32/mach-a3/Makefile
+++ b/arch/cris/arch-v32/mach-a3/Makefile
@@ -3,7 +3,6 @@
3# 3#
4 4
5obj-y := dma.o pinmux.o io.o arbiter.o 5obj-y := dma.o pinmux.o io.o arbiter.o
6obj-$(CONFIG_CPU_FREQ) += cpufreq.o
7 6
8clean: 7clean:
9 8
diff --git a/arch/cris/arch-v32/mach-a3/cpufreq.c b/arch/cris/arch-v32/mach-a3/cpufreq.c
deleted file mode 100644
index ee391ecb5bc9..000000000000
--- a/arch/cris/arch-v32/mach-a3/cpufreq.c
+++ /dev/null
@@ -1,152 +0,0 @@
1#include <linux/init.h>
2#include <linux/module.h>
3#include <linux/cpufreq.h>
4#include <hwregs/reg_map.h>
5#include <hwregs/reg_rdwr.h>
6#include <hwregs/clkgen_defs.h>
7#include <hwregs/ddr2_defs.h>
8
9static int
10cris_sdram_freq_notifier(struct notifier_block *nb, unsigned long val,
11 void *data);
12
13static struct notifier_block cris_sdram_freq_notifier_block = {
14 .notifier_call = cris_sdram_freq_notifier
15};
16
17static struct cpufreq_frequency_table cris_freq_table[] = {
18 {0x01, 6000},
19 {0x02, 200000},
20 {0, CPUFREQ_TABLE_END},
21};
22
23static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu)
24{
25 reg_clkgen_rw_clk_ctrl clk_ctrl;
26 clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl);
27 return clk_ctrl.pll ? 200000 : 6000;
28}
29
30static void cris_freq_set_cpu_state(unsigned int state)
31{
32 int i = 0;
33 struct cpufreq_freqs freqs;
34 reg_clkgen_rw_clk_ctrl clk_ctrl;
35 clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl);
36
37#ifdef CONFIG_SMP
38 for_each_present_cpu(i)
39#endif
40 {
41 freqs.old = cris_freq_get_cpu_frequency(i);
42 freqs.new = cris_freq_table[state].frequency;
43 freqs.cpu = i;
44 }
45
46 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
47
48 local_irq_disable();
49
50 /* Even though we may be SMP they will share the same clock
51 * so all settings are made on CPU0. */
52 if (cris_freq_table[state].frequency == 200000)
53 clk_ctrl.pll = 1;
54 else
55 clk_ctrl.pll = 0;
56 REG_WR(clkgen, regi_clkgen, rw_clk_ctrl, clk_ctrl);
57
58 local_irq_enable();
59
60 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
61};
62
63static int cris_freq_verify(struct cpufreq_policy *policy)
64{
65 return cpufreq_frequency_table_verify(policy, &cris_freq_table[0]);
66}
67
68static int cris_freq_target(struct cpufreq_policy *policy,
69 unsigned int target_freq,
70 unsigned int relation)
71{
72 unsigned int newstate = 0;
73
74 if (cpufreq_frequency_table_target(policy, cris_freq_table,
75 target_freq, relation, &newstate))
76 return -EINVAL;
77
78 cris_freq_set_cpu_state(newstate);
79
80 return 0;
81}
82
83static int cris_freq_cpu_init(struct cpufreq_policy *policy)
84{
85 int result;
86
87 /* cpuinfo and default policy values */
88 policy->cpuinfo.transition_latency = 1000000; /* 1ms */
89 policy->cur = cris_freq_get_cpu_frequency(0);
90
91 result = cpufreq_frequency_table_cpuinfo(policy, cris_freq_table);
92 if (result)
93 return (result);
94
95 cpufreq_frequency_table_get_attr(cris_freq_table, policy->cpu);
96
97 return 0;
98}
99
100
101static int cris_freq_cpu_exit(struct cpufreq_policy *policy)
102{
103 cpufreq_frequency_table_put_attr(policy->cpu);
104 return 0;
105}
106
107
108static struct freq_attr *cris_freq_attr[] = {
109 &cpufreq_freq_attr_scaling_available_freqs,
110 NULL,
111};
112
113static struct cpufreq_driver cris_freq_driver = {
114 .get = cris_freq_get_cpu_frequency,
115 .verify = cris_freq_verify,
116 .target = cris_freq_target,
117 .init = cris_freq_cpu_init,
118 .exit = cris_freq_cpu_exit,
119 .name = "cris_freq",
120 .owner = THIS_MODULE,
121 .attr = cris_freq_attr,
122};
123
124static int __init cris_freq_init(void)
125{
126 int ret;
127 ret = cpufreq_register_driver(&cris_freq_driver);
128 cpufreq_register_notifier(&cris_sdram_freq_notifier_block,
129 CPUFREQ_TRANSITION_NOTIFIER);
130 return ret;
131}
132
133static int
134cris_sdram_freq_notifier(struct notifier_block *nb, unsigned long val,
135 void *data)
136{
137 int i;
138 struct cpufreq_freqs *freqs = data;
139 if (val == CPUFREQ_PRECHANGE) {
140 reg_ddr2_rw_cfg cfg =
141 REG_RD(ddr2, regi_ddr2_ctrl, rw_cfg);
142 cfg.ref_interval = (freqs->new == 200000 ? 1560 : 46);
143
144 if (freqs->new == 200000)
145 for (i = 0; i < 50000; i++);
146 REG_WR(bif_core, regi_bif_core, rw_sdram_timing, timing);
147 }
148 return 0;
149}
150
151
152module_init(cris_freq_init);
diff --git a/arch/cris/arch-v32/mach-fs/Makefile b/arch/cris/arch-v32/mach-fs/Makefile
index d366e0891988..18a227196a41 100644
--- a/arch/cris/arch-v32/mach-fs/Makefile
+++ b/arch/cris/arch-v32/mach-fs/Makefile
@@ -3,7 +3,6 @@
3# 3#
4 4
5obj-y := dma.o pinmux.o io.o arbiter.o 5obj-y := dma.o pinmux.o io.o arbiter.o
6obj-$(CONFIG_CPU_FREQ) += cpufreq.o
7 6
8clean: 7clean:
9 8
diff --git a/arch/cris/arch-v32/mach-fs/cpufreq.c b/arch/cris/arch-v32/mach-fs/cpufreq.c
deleted file mode 100644
index d92cf70d1cbe..000000000000
--- a/arch/cris/arch-v32/mach-fs/cpufreq.c
+++ /dev/null
@@ -1,145 +0,0 @@
1#include <linux/init.h>
2#include <linux/module.h>
3#include <linux/cpufreq.h>
4#include <hwregs/reg_map.h>
5#include <arch/hwregs/reg_rdwr.h>
6#include <arch/hwregs/config_defs.h>
7#include <arch/hwregs/bif_core_defs.h>
8
9static int
10cris_sdram_freq_notifier(struct notifier_block *nb, unsigned long val,
11 void *data);
12
13static struct notifier_block cris_sdram_freq_notifier_block = {
14 .notifier_call = cris_sdram_freq_notifier
15};
16
17static struct cpufreq_frequency_table cris_freq_table[] = {
18 {0x01, 6000},
19 {0x02, 200000},
20 {0, CPUFREQ_TABLE_END},
21};
22
23static unsigned int cris_freq_get_cpu_frequency(unsigned int cpu)
24{
25 reg_config_rw_clk_ctrl clk_ctrl;
26 clk_ctrl = REG_RD(config, regi_config, rw_clk_ctrl);
27 return clk_ctrl.pll ? 200000 : 6000;
28}
29
30static void cris_freq_set_cpu_state(unsigned int state)
31{
32 int i;
33 struct cpufreq_freqs freqs;
34 reg_config_rw_clk_ctrl clk_ctrl;
35 clk_ctrl = REG_RD(config, regi_config, rw_clk_ctrl);
36
37 for_each_possible_cpu(i) {
38 freqs.old = cris_freq_get_cpu_frequency(i);
39 freqs.new = cris_freq_table[state].frequency;
40 freqs.cpu = i;
41 }
42
43 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
44
45 local_irq_disable();
46
47 /* Even though we may be SMP they will share the same clock
48 * so all settings are made on CPU0. */
49 if (cris_freq_table[state].frequency == 200000)
50 clk_ctrl.pll = 1;
51 else
52 clk_ctrl.pll = 0;
53 REG_WR(config, regi_config, rw_clk_ctrl, clk_ctrl);
54
55 local_irq_enable();
56
57 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
58};
59
60static int cris_freq_verify(struct cpufreq_policy *policy)
61{
62 return cpufreq_frequency_table_verify(policy, &cris_freq_table[0]);
63}
64
65static int cris_freq_target(struct cpufreq_policy *policy,
66 unsigned int target_freq, unsigned int relation)
67{
68 unsigned int newstate = 0;
69
70 if (cpufreq_frequency_table_target
71 (policy, cris_freq_table, target_freq, relation, &newstate))
72 return -EINVAL;
73
74 cris_freq_set_cpu_state(newstate);
75
76 return 0;
77}
78
79static int cris_freq_cpu_init(struct cpufreq_policy *policy)
80{
81 int result;
82
83 /* cpuinfo and default policy values */
84 policy->cpuinfo.transition_latency = 1000000; /* 1ms */
85 policy->cur = cris_freq_get_cpu_frequency(0);
86
87 result = cpufreq_frequency_table_cpuinfo(policy, cris_freq_table);
88 if (result)
89 return (result);
90
91 cpufreq_frequency_table_get_attr(cris_freq_table, policy->cpu);
92
93 return 0;
94}
95
96static int cris_freq_cpu_exit(struct cpufreq_policy *policy)
97{
98 cpufreq_frequency_table_put_attr(policy->cpu);
99 return 0;
100}
101
102static struct freq_attr *cris_freq_attr[] = {
103 &cpufreq_freq_attr_scaling_available_freqs,
104 NULL,
105};
106
107static struct cpufreq_driver cris_freq_driver = {
108 .get = cris_freq_get_cpu_frequency,
109 .verify = cris_freq_verify,
110 .target = cris_freq_target,
111 .init = cris_freq_cpu_init,
112 .exit = cris_freq_cpu_exit,
113 .name = "cris_freq",
114 .owner = THIS_MODULE,
115 .attr = cris_freq_attr,
116};
117
118static int __init cris_freq_init(void)
119{
120 int ret;
121 ret = cpufreq_register_driver(&cris_freq_driver);
122 cpufreq_register_notifier(&cris_sdram_freq_notifier_block,
123 CPUFREQ_TRANSITION_NOTIFIER);
124 return ret;
125}
126
127static int
128cris_sdram_freq_notifier(struct notifier_block *nb, unsigned long val,
129 void *data)
130{
131 int i;
132 struct cpufreq_freqs *freqs = data;
133 if (val == CPUFREQ_PRECHANGE) {
134 reg_bif_core_rw_sdram_timing timing =
135 REG_RD(bif_core, regi_bif_core, rw_sdram_timing);
136 timing.cpd = (freqs->new == 200000 ? 0 : 1);
137
138 if (freqs->new == 200000)
139 for (i = 0; i < 50000; i++) ;
140 REG_WR(bif_core, regi_bif_core, rw_sdram_timing, timing);
141 }
142 return 0;
143}
144
145module_init(cris_freq_init);
diff --git a/arch/cris/include/asm/processor.h b/arch/cris/include/asm/processor.h
index 675823f70c0f..c0a29b96b92b 100644
--- a/arch/cris/include/asm/processor.h
+++ b/arch/cris/include/asm/processor.h
@@ -65,13 +65,6 @@ static inline void release_thread(struct task_struct *dead_task)
65 65
66#define cpu_relax() barrier() 66#define cpu_relax() barrier()
67 67
68/*
69 * disable hlt during certain critical i/o operations
70 */
71#define HAVE_DISABLE_HLT
72void disable_hlt(void);
73void enable_hlt(void);
74
75void default_idle(void); 68void default_idle(void);
76 69
77#endif /* __ASM_CRIS_PROCESSOR_H */ 70#endif /* __ASM_CRIS_PROCESSOR_H */
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index be57a988bfb9..0ff3f6889842 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -34,12 +34,4 @@
34#define __ARCH_WANT_SYS_VFORK 34#define __ARCH_WANT_SYS_VFORK
35#define __ARCH_WANT_SYS_CLONE 35#define __ARCH_WANT_SYS_CLONE
36 36
37/*
38 * "Conditional" syscalls
39 *
40 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
41 * but it doesn't work on all toolchains, so we just do it by hand
42 */
43#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
44
45#endif /* _ASM_CRIS_UNISTD_H_ */ 37#endif /* _ASM_CRIS_UNISTD_H_ */
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 104ff4dd9b98..b78498eb079b 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -29,59 +29,14 @@
29 29
30//#define DEBUG 30//#define DEBUG
31 31
32/*
33 * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if
34 * there would ever be a halt sequence (for power save when idle) with
35 * some largish delay when halting or resuming *and* a driver that can't
36 * afford that delay. The hlt_counter would then be checked before
37 * executing the halt sequence, and the driver marks the unhaltable
38 * region by enable_hlt/disable_hlt.
39 */
40
41int cris_hlt_counter=0;
42
43void disable_hlt(void)
44{
45 cris_hlt_counter++;
46}
47
48EXPORT_SYMBOL(disable_hlt);
49
50void enable_hlt(void)
51{
52 cris_hlt_counter--;
53}
54
55EXPORT_SYMBOL(enable_hlt);
56
57extern void default_idle(void); 32extern void default_idle(void);
58 33
59void (*pm_power_off)(void); 34void (*pm_power_off)(void);
60EXPORT_SYMBOL(pm_power_off); 35EXPORT_SYMBOL(pm_power_off);
61 36
62/* 37void arch_cpu_idle(void)
63 * The idle thread. There's no useful work to be
64 * done, so just try to conserve power and have a
65 * low exit latency (ie sit in a loop waiting for
66 * somebody to say that they'd like to reschedule)
67 */
68
69void cpu_idle (void)
70{ 38{
71 /* endless idle loop with no priority at all */ 39 default_idle();
72 while (1) {
73 rcu_idle_enter();
74 while (!need_resched()) {
75 /*
76 * Mark this as an RCU critical section so that
77 * synchronize_kernel() in the unload path waits
78 * for our completion.
79 */
80 default_idle();
81 }
82 rcu_idle_exit();
83 schedule_preempt_disabled();
84 }
85} 40}
86 41
87void hard_reset_now (void); 42void hard_reset_now (void);
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index a11ad3229f8c..0ffda73734f5 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -147,13 +147,6 @@ show_stack(void)
147#endif 147#endif
148 148
149void 149void
150dump_stack(void)
151{
152 show_stack(NULL, NULL);
153}
154EXPORT_SYMBOL(dump_stack);
155
156void
157set_nmi_handler(void (*handler)(struct pt_regs *)) 150set_nmi_handler(void (*handler)(struct pt_regs *))
158{ 151{
159 nmi_handler = handler; 152 nmi_handler = handler;
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index d72ab58fd83e..9ac80946dada 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -12,12 +12,10 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <asm/tlb.h> 14#include <asm/tlb.h>
15#include <asm/sections.h>
15 16
16unsigned long empty_zero_page; 17unsigned long empty_zero_page;
17 18
18extern char _stext, _edata, _etext; /* From linkerscript */
19extern char __init_begin, __init_end;
20
21void __init 19void __init
22mem_init(void) 20mem_init(void)
23{ 21{
@@ -67,15 +65,5 @@ mem_init(void)
67void 65void
68free_initmem(void) 66free_initmem(void)
69{ 67{
70 unsigned long addr; 68 free_initmem_default(0);
71
72 addr = (unsigned long)(&__init_begin);
73 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
74 ClearPageReserved(virt_to_page(addr));
75 init_page_count(virt_to_page(addr));
76 free_page(addr);
77 totalram_pages++;
78 }
79 printk (KERN_INFO "Freeing unused kernel memory: %luk freed\n",
80 (unsigned long)((&__init_end - &__init_begin) >> 10));
81} 69}
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h
index 4cfcc7bba25a..70ec7293dce7 100644
--- a/arch/frv/include/asm/unistd.h
+++ b/arch/frv/include/asm/unistd.h
@@ -31,14 +31,4 @@
31#define __ARCH_WANT_SYS_VFORK 31#define __ARCH_WANT_SYS_VFORK
32#define __ARCH_WANT_SYS_CLONE 32#define __ARCH_WANT_SYS_CLONE
33 33
34/*
35 * "Conditional" syscalls
36 *
37 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
38 * but it doesn't work on all toolchains, so we just do it by hand
39 */
40#ifndef cond_syscall
41#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
42#endif
43
44#endif /* _ASM_UNISTD_H_ */ 34#endif /* _ASM_UNISTD_H_ */
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 23916b2a12a2..5d40aeb7712e 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -59,29 +59,12 @@ static void core_sleep_idle(void)
59 mb(); 59 mb();
60} 60}
61 61
62void (*idle)(void) = core_sleep_idle; 62void arch_cpu_idle(void)
63
64/*
65 * The idle thread. There's no useful work to be
66 * done, so just try to conserve power and have a
67 * low exit latency (ie sit in a loop waiting for
68 * somebody to say that they'd like to reschedule)
69 */
70void cpu_idle(void)
71{ 63{
72 /* endless idle loop with no priority at all */ 64 if (!frv_dma_inprogress)
73 while (1) { 65 core_sleep_idle();
74 rcu_idle_enter(); 66 else
75 while (!need_resched()) { 67 local_irq_enable();
76 check_pgt_cache();
77
78 if (!frv_dma_inprogress && idle)
79 idle();
80 }
81 rcu_idle_exit();
82
83 schedule_preempt_disabled();
84 }
85} 68}
86 69
87void machine_restart(char * __unused) 70void machine_restart(char * __unused)
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 5cfd1420b091..4bff48c19d29 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -466,17 +466,6 @@ asmlinkage void compound_exception(unsigned long esfr1,
466 BUG(); 466 BUG();
467} /* end compound_exception() */ 467} /* end compound_exception() */
468 468
469/*****************************************************************************/
470/*
471 * The architecture-independent backtrace generator
472 */
473void dump_stack(void)
474{
475 show_stack(NULL, NULL);
476}
477
478EXPORT_SYMBOL(dump_stack);
479
480void show_stack(struct task_struct *task, unsigned long *sp) 469void show_stack(struct task_struct *task, unsigned long *sp)
481{ 470{
482} 471}
@@ -508,6 +497,7 @@ void show_regs(struct pt_regs *regs)
508 int loop; 497 int loop;
509 498
510 printk("\n"); 499 printk("\n");
500 show_regs_print_info(KERN_DEFAULT);
511 501
512 printk("Frame: @%08lx [%s]\n", 502 printk("Frame: @%08lx [%s]\n",
513 (unsigned long) regs, 503 (unsigned long) regs,
@@ -522,8 +512,6 @@ void show_regs(struct pt_regs *regs)
522 else 512 else
523 printk(" | "); 513 printk(" | ");
524 } 514 }
525
526 printk("Process %s (pid: %d)\n", current->comm, current->pid);
527} 515}
528 516
529void die_if_kernel(const char *str, ...) 517void die_if_kernel(const char *str, ...)
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 92e97b0894a6..dee354fa6b64 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -122,7 +122,7 @@ void __init mem_init(void)
122#endif 122#endif
123 int codek = 0, datak = 0; 123 int codek = 0, datak = 0;
124 124
125 /* this will put all memory onto the freelists */ 125 /* this will put all low memory onto the freelists */
126 totalram_pages = free_all_bootmem(); 126 totalram_pages = free_all_bootmem();
127 127
128#ifdef CONFIG_MMU 128#ifdef CONFIG_MMU
@@ -131,14 +131,8 @@ void __init mem_init(void)
131 datapages++; 131 datapages++;
132 132
133#ifdef CONFIG_HIGHMEM 133#ifdef CONFIG_HIGHMEM
134 for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) { 134 for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--)
135 struct page *page = &mem_map[pfn]; 135 free_highmem_page(&mem_map[pfn]);
136
137 ClearPageReserved(page);
138 init_page_count(page);
139 __free_page(page);
140 totalram_pages++;
141 }
142#endif 136#endif
143 137
144 codek = ((unsigned long) &_etext - (unsigned long) &_stext) >> 10; 138 codek = ((unsigned long) &_etext - (unsigned long) &_stext) >> 10;
@@ -168,21 +162,7 @@ void __init mem_init(void)
168void free_initmem(void) 162void free_initmem(void)
169{ 163{
170#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) 164#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
171 unsigned long start, end, addr; 165 free_initmem_default(0);
172
173 start = PAGE_ALIGN((unsigned long) &__init_begin); /* round up */
174 end = ((unsigned long) &__init_end) & PAGE_MASK; /* round down */
175
176 /* next to check that the page we free is not a partial page */
177 for (addr = start; addr < end; addr += PAGE_SIZE) {
178 ClearPageReserved(virt_to_page(addr));
179 init_page_count(virt_to_page(addr));
180 free_page(addr);
181 totalram_pages++;
182 }
183
184 printk("Freeing unused kernel memory: %ldKiB freed (0x%lx - 0x%lx)\n",
185 (end - start) >> 10, start, end);
186#endif 166#endif
187} /* end free_initmem() */ 167} /* end free_initmem() */
188 168
@@ -193,14 +173,6 @@ void free_initmem(void)
193#ifdef CONFIG_BLK_DEV_INITRD 173#ifdef CONFIG_BLK_DEV_INITRD
194void __init free_initrd_mem(unsigned long start, unsigned long end) 174void __init free_initrd_mem(unsigned long start, unsigned long end)
195{ 175{
196 int pages = 0; 176 free_reserved_area(start, end, 0, "initrd");
197 for (; start < end; start += PAGE_SIZE) {
198 ClearPageReserved(virt_to_page(start));
199 init_page_count(virt_to_page(start));
200 free_page(start);
201 totalram_pages++;
202 pages++;
203 }
204 printk("Freeing initrd memory: %dKiB freed\n", (pages * PAGE_SIZE) >> 10);
205} /* end free_initrd_mem() */ 177} /* end free_initrd_mem() */
206#endif 178#endif
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 79250de1b12a..303e4f9a79d1 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -12,10 +12,7 @@ config H8300
12 select MODULES_USE_ELF_RELA 12 select MODULES_USE_ELF_RELA
13 select OLD_SIGSUSPEND3 13 select OLD_SIGSUSPEND3
14 select OLD_SIGACTION 14 select OLD_SIGACTION
15 15 select HAVE_UNDERSCORE_SYMBOL_PREFIX
16config SYMBOL_PREFIX
17 string
18 default "_"
19 16
20config MMU 17config MMU
21 bool 18 bool
diff --git a/arch/h8300/include/asm/linkage.h b/arch/h8300/include/asm/linkage.h
index 6f4df7d46180..1d81604fb0ad 100644
--- a/arch/h8300/include/asm/linkage.h
+++ b/arch/h8300/include/asm/linkage.h
@@ -2,7 +2,5 @@
2#define _H8300_LINKAGE_H 2#define _H8300_LINKAGE_H
3 3
4#undef SYMBOL_NAME_LABEL 4#undef SYMBOL_NAME_LABEL
5#undef SYMBOL_NAME
6#define SYMBOL_NAME_LABEL(_name_) _##_name_##: 5#define SYMBOL_NAME_LABEL(_name_) _##_name_##:
7#define SYMBOL_NAME(_name_) _##_name_
8#endif 6#endif
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h
index 6721856d841b..ab671ecf5196 100644
--- a/arch/h8300/include/asm/unistd.h
+++ b/arch/h8300/include/asm/unistd.h
@@ -33,11 +33,4 @@
33#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
34#define __ARCH_WANT_SYS_CLONE 34#define __ARCH_WANT_SYS_CLONE
35 35
36/*
37 * "Conditional" syscalls
38 */
39#define cond_syscall(name) \
40 asm (".weak\t_" #name "\n" \
41 ".set\t_" #name ",_sys_ni_syscall");
42
43#endif /* _ASM_H8300_UNISTD_H_ */ 36#endif /* _ASM_H8300_UNISTD_H_ */
diff --git a/arch/h8300/kernel/gpio.c b/arch/h8300/kernel/gpio.c
index 6a25dd5530e7..084bfd0c107e 100644
--- a/arch/h8300/kernel/gpio.c
+++ b/arch/h8300/kernel/gpio.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/stddef.h> 12#include <linux/stddef.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/seq_file.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/fs.h> 17#include <linux/fs.h>
@@ -138,30 +139,34 @@ static char *port_status(int portno)
138 return result; 139 return result;
139} 140}
140 141
141static int gpio_proc_read(char *buf, char **start, off_t offset, 142static int gpio_proc_show(struct seq_file *m, void *v)
142 int len, int *unused_i, void *unused_v)
143{ 143{
144 int c,outlen;
145 static const char port_name[]="123456789ABCDEFGH"; 144 static const char port_name[]="123456789ABCDEFGH";
146 outlen = 0; 145 int c;
146
147 for (c = 0; c < MAX_PORT; c++) { 147 for (c = 0; c < MAX_PORT; c++) {
148 if (ddrs[c] == NULL) 148 if (ddrs[c] == NULL)
149 continue ; 149 continue;
150 len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c)); 150 seq_printf(m, "P%c: %s\n", port_name[c], port_status(c));
151 buf += len;
152 outlen += len;
153 } 151 }
154 return outlen; 152 return 0;
155} 153}
156 154
157static __init int register_proc(void) 155static int gpio_proc_open(struct inode *inode, struct file *file)
158{ 156{
159 struct proc_dir_entry *proc_gpio; 157 return single_open(file, gpio_proc_show, PDE_DATA(inode));
158}
160 159
161 proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL); 160static const struct file_operations gpio_proc_fops = {
162 if (proc_gpio) 161 .open = gpio_proc_open,
163 proc_gpio->read_proc = gpio_proc_read; 162 .read = seq_read,
164 return proc_gpio != NULL; 163 .llseek = seq_lseek,
164 .release = single_release,
165};
166
167static __init int register_proc(void)
168{
169 return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL;
165} 170}
166 171
167__initcall(register_proc); 172__initcall(register_proc);
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index b609f63f1590..1a744ab7e7e5 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -53,40 +53,13 @@ asmlinkage void ret_from_kernel_thread(void);
53 * The idle loop on an H8/300.. 53 * The idle loop on an H8/300..
54 */ 54 */
55#if !defined(CONFIG_H8300H_SIM) && !defined(CONFIG_H8S_SIM) 55#if !defined(CONFIG_H8300H_SIM) && !defined(CONFIG_H8S_SIM)
56static void default_idle(void) 56void arch_cpu_idle(void)
57{ 57{
58 local_irq_disable(); 58 local_irq_enable();
59 if (!need_resched()) { 59 /* XXX: race here! What if need_resched() gets set now? */
60 local_irq_enable(); 60 __asm__("sleep");
61 /* XXX: race here! What if need_resched() gets set now? */
62 __asm__("sleep");
63 } else
64 local_irq_enable();
65}
66#else
67static void default_idle(void)
68{
69 cpu_relax();
70} 61}
71#endif 62#endif
72void (*idle)(void) = default_idle;
73
74/*
75 * The idle thread. There's no useful work to be
76 * done, so just try to conserve power and have a
77 * low exit latency (ie sit in a loop waiting for
78 * somebody to say that they'd like to reschedule)
79 */
80void cpu_idle(void)
81{
82 while (1) {
83 rcu_idle_enter();
84 while (!need_resched())
85 idle();
86 rcu_idle_exit();
87 schedule_preempt_disabled();
88 }
89}
90 63
91void machine_restart(char * __unused) 64void machine_restart(char * __unused)
92{ 65{
@@ -110,6 +83,8 @@ void machine_power_off(void)
110 83
111void show_regs(struct pt_regs * regs) 84void show_regs(struct pt_regs * regs)
112{ 85{
86 show_regs_print_info(KERN_DEFAULT);
87
113 printk("\nPC: %08lx Status: %02x", 88 printk("\nPC: %08lx Status: %02x",
114 regs->pc, regs->ccr); 89 regs->pc, regs->ccr);
115 printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx", 90 printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx",
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
index 7833aa3e7c7d..cfe494dbe3da 100644
--- a/arch/h8300/kernel/traps.c
+++ b/arch/h8300/kernel/traps.c
@@ -164,10 +164,3 @@ void show_trace_task(struct task_struct *tsk)
164{ 164{
165 show_stack(tsk,(unsigned long *)tsk->thread.esp0); 165 show_stack(tsk,(unsigned long *)tsk->thread.esp0);
166} 166}
167
168void dump_stack(void)
169{
170 show_stack(NULL,NULL);
171}
172
173EXPORT_SYMBOL(dump_stack);
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index 981e25094b1a..ff349d70a29b 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -139,7 +139,7 @@ void __init mem_init(void)
139 start_mem = PAGE_ALIGN(start_mem); 139 start_mem = PAGE_ALIGN(start_mem);
140 max_mapnr = num_physpages = MAP_NR(high_memory); 140 max_mapnr = num_physpages = MAP_NR(high_memory);
141 141
142 /* this will put all memory onto the freelists */ 142 /* this will put all low memory onto the freelists */
143 totalram_pages = free_all_bootmem(); 143 totalram_pages = free_all_bootmem();
144 144
145 codek = (_etext - _stext) >> 10; 145 codek = (_etext - _stext) >> 10;
@@ -161,15 +161,7 @@ void __init mem_init(void)
161#ifdef CONFIG_BLK_DEV_INITRD 161#ifdef CONFIG_BLK_DEV_INITRD
162void free_initrd_mem(unsigned long start, unsigned long end) 162void free_initrd_mem(unsigned long start, unsigned long end)
163{ 163{
164 int pages = 0; 164 free_reserved_area(start, end, 0, "initrd");
165 for (; start < end; start += PAGE_SIZE) {
166 ClearPageReserved(virt_to_page(start));
167 init_page_count(virt_to_page(start));
168 free_page(start);
169 totalram_pages++;
170 pages++;
171 }
172 printk ("Freeing initrd memory: %dk freed\n", pages);
173} 165}
174#endif 166#endif
175 167
@@ -177,23 +169,7 @@ void
177free_initmem(void) 169free_initmem(void)
178{ 170{
179#ifdef CONFIG_RAMKERNEL 171#ifdef CONFIG_RAMKERNEL
180 unsigned long addr; 172 free_initmem_default(0);
181/*
182 * the following code should be cool even if these sections
183 * are not page aligned.
184 */
185 addr = PAGE_ALIGN((unsigned long)(__init_begin));
186 /* next to check that the page we free is not a partial page */
187 for (; addr + PAGE_SIZE < (unsigned long)__init_end; addr +=PAGE_SIZE) {
188 ClearPageReserved(virt_to_page(addr));
189 init_page_count(virt_to_page(addr));
190 free_page(addr);
191 totalram_pages++;
192 }
193 printk(KERN_INFO "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n",
194 (addr - PAGE_ALIGN((long) __init_begin)) >> 10,
195 (int)(PAGE_ALIGN((unsigned long)__init_begin)),
196 (int)(addr - PAGE_SIZE));
197#endif 173#endif
198} 174}
199 175
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index e4decc6b8947..04dff5bdcbf7 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -29,21 +29,17 @@ config HEXAGON
29 select GENERIC_CLOCKEVENTS 29 select GENERIC_CLOCKEVENTS
30 select GENERIC_CLOCKEVENTS_BROADCAST 30 select GENERIC_CLOCKEVENTS_BROADCAST
31 select MODULES_USE_ELF_RELA 31 select MODULES_USE_ELF_RELA
32 select GENERIC_CPU_DEVICES
33 select GENERIC_KERNEL_THREAD
34 select GENERIC_KERNEL_EXECVE
32 ---help--- 35 ---help---
33 Qualcomm Hexagon is a processor architecture designed for high 36 Qualcomm Hexagon is a processor architecture designed for high
34 performance and low power across a wide variety of applications. 37 performance and low power across a wide variety of applications.
35 38
36config HEXAGON_ARCH_V1 39config HEXAGON_PHYS_OFFSET
37 bool 40 def_bool y
38 41 ---help---
39config HEXAGON_ARCH_V2 42 Platforms that don't load the kernel at zero set this.
40 bool
41
42config HEXAGON_ARCH_V3
43 bool
44
45config HEXAGON_ARCH_V4
46 bool
47 43
48config FRAME_POINTER 44config FRAME_POINTER
49 def_bool y 45 def_bool y
@@ -81,9 +77,6 @@ config RWSEM_GENERIC_SPINLOCK
81config RWSEM_XCHGADD_ALGORITHM 77config RWSEM_XCHGADD_ALGORITHM
82 def_bool y 78 def_bool y
83 79
84config GENERIC_FIND_NEXT_BIT
85 def_bool y
86
87config GENERIC_HWEIGHT 80config GENERIC_HWEIGHT
88 def_bool y 81 def_bool y
89 82
@@ -103,14 +96,14 @@ choice
103 96
104config HEXAGON_COMET 97config HEXAGON_COMET
105 bool "Comet Board" 98 bool "Comet Board"
106 select HEXAGON_ARCH_V2
107 ---help--- 99 ---help---
108 Support for the Comet platform. 100 Support for the Comet platform.
109 101
110endchoice 102endchoice
111 103
112config HEXAGON_VM 104config HEXAGON_ARCH_VERSION
113 def_bool y 105 int "Architecture version"
106 default 2
114 107
115config CMDLINE 108config CMDLINE
116 string "Default kernel command string" 109 string "Default kernel command string"
@@ -122,12 +115,6 @@ config CMDLINE
122 minimum, you should specify the memory size and the root device 115 minimum, you should specify the memory size and the root device
123 (e.g., mem=64M root=/dev/nfs). 116 (e.g., mem=64M root=/dev/nfs).
124 117
125config HEXAGON_ANGEL_TRAPS
126 bool "Use Angel Traps"
127 default n
128 ---help---
129 Enable angel debug traps (for printk's).
130
131config SMP 118config SMP
132 bool "Multi-Processing support" 119 bool "Multi-Processing support"
133 ---help--- 120 ---help---
diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
index d00d900b2566..207711a0fd0c 100644
--- a/arch/hexagon/Makefile
+++ b/arch/hexagon/Makefile
@@ -15,20 +15,9 @@ KBUILD_CFLAGS += -fno-short-enums
15# LDFLAGS_MODULE += -shared 15# LDFLAGS_MODULE += -shared
16CFLAGS_MODULE += -mlong-calls 16CFLAGS_MODULE += -mlong-calls
17 17
18cflags-$(CONFIG_HEXAGON_ARCH_V1) += $(call cc-option,-mv1) 18cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
19cflags-$(CONFIG_HEXAGON_ARCH_V2) += $(call cc-option,-mv2) 19aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
20cflags-$(CONFIG_HEXAGON_ARCH_V3) += $(call cc-option,-mv3) 20ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
21cflags-$(CONFIG_HEXAGON_ARCH_V4) += $(call cc-option,-mv4)
22
23aflags-$(CONFIG_HEXAGON_ARCH_V1) += $(call cc-option,-mv1)
24aflags-$(CONFIG_HEXAGON_ARCH_V2) += $(call cc-option,-mv2)
25aflags-$(CONFIG_HEXAGON_ARCH_V3) += $(call cc-option,-mv3)
26aflags-$(CONFIG_HEXAGON_ARCH_V4) += $(call cc-option,-mv4)
27
28ldflags-$(CONFIG_HEXAGON_ARCH_V1) += $(call cc-option,-mv1)
29ldflags-$(CONFIG_HEXAGON_ARCH_V2) += $(call cc-option,-mv2)
30ldflags-$(CONFIG_HEXAGON_ARCH_V3) += $(call cc-option,-mv3)
31ldflags-$(CONFIG_HEXAGON_ARCH_V4) += $(call cc-option,-mv4)
32 21
33KBUILD_CFLAGS += $(cflags-y) 22KBUILD_CFLAGS += $(cflags-y)
34KBUILD_AFLAGS += $(aflags-y) 23KBUILD_AFLAGS += $(aflags-y)
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index bdb54ceb53bc..1da17caac23c 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -25,7 +25,6 @@ generic-y += kdebug.h
25generic-y += kmap_types.h 25generic-y += kmap_types.h
26generic-y += local64.h 26generic-y += local64.h
27generic-y += local.h 27generic-y += local.h
28generic-y += local.h
29generic-y += mman.h 28generic-y += mman.h
30generic-y += msgbuf.h 29generic-y += msgbuf.h
31generic-y += pci.h 30generic-y += pci.h
@@ -41,6 +40,7 @@ generic-y += sembuf.h
41generic-y += shmbuf.h 40generic-y += shmbuf.h
42generic-y += shmparam.h 41generic-y += shmparam.h
43generic-y += siginfo.h 42generic-y += siginfo.h
43generic-y += sizes.h
44generic-y += socket.h 44generic-y += socket.h
45generic-y += sockios.h 45generic-y += sockios.h
46generic-y += statfs.h 46generic-y += statfs.h
diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h
index 468fbb0781cd..8a64ff2337f6 100644
--- a/arch/hexagon/include/asm/atomic.h
+++ b/arch/hexagon/include/asm/atomic.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Atomic operations for the Hexagon architecture 2 * Atomic operations for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -117,35 +117,37 @@ static inline int atomic_sub_return(int i, atomic_t *v)
117#define atomic_sub(i, v) atomic_sub_return(i, (v)) 117#define atomic_sub(i, v) atomic_sub_return(i, (v))
118 118
119/** 119/**
120 * atomic_add_unless - add unless the number is a given value 120 * __atomic_add_unless - add unless the number is a given value
121 * @v: pointer to value 121 * @v: pointer to value
122 * @a: amount to add 122 * @a: amount to add
123 * @u: unless value is equal to u 123 * @u: unless value is equal to u
124 * 124 *
125 * Returns 1 if the add happened, 0 if it didn't. 125 * Returns old value.
126 *
126 */ 127 */
128
127static inline int __atomic_add_unless(atomic_t *v, int a, int u) 129static inline int __atomic_add_unless(atomic_t *v, int a, int u)
128{ 130{
129 int output, __oldval; 131 int __oldval;
132 register int tmp;
133
130 asm volatile( 134 asm volatile(
131 "1: %0 = memw_locked(%2);" 135 "1: %0 = memw_locked(%2);"
132 " {" 136 " {"
133 " p3 = cmp.eq(%0, %4);" 137 " p3 = cmp.eq(%0, %4);"
134 " if (p3.new) jump:nt 2f;" 138 " if (p3.new) jump:nt 2f;"
135 " %0 = add(%0, %3);" 139 " %1 = add(%0, %3);"
136 " %1 = #0;"
137 " }" 140 " }"
138 " memw_locked(%2, p3) = %0;" 141 " memw_locked(%2, p3) = %1;"
139 " {" 142 " {"
140 " if !p3 jump 1b;" 143 " if !p3 jump 1b;"
141 " %1 = #1;"
142 " }" 144 " }"
143 "2:" 145 "2:"
144 : "=&r" (__oldval), "=&r" (output) 146 : "=&r" (__oldval), "=&r" (tmp)
145 : "r" (v), "r" (a), "r" (u) 147 : "r" (v), "r" (a), "r" (u)
146 : "memory", "p3" 148 : "memory", "p3"
147 ); 149 );
148 return output; 150 return __oldval;
149} 151}
150 152
151#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 153#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h
index 1f14e082588e..e1b933a0e121 100644
--- a/arch/hexagon/include/asm/elf.h
+++ b/arch/hexagon/include/asm/elf.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * ELF definitions for the Hexagon architecture 2 * ELF definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -104,6 +104,16 @@ typedef unsigned long elf_fpregset_t;
104 * Bypass the whole "regsets" thing for now and use the define. 104 * Bypass the whole "regsets" thing for now and use the define.
105 */ 105 */
106 106
107#if CONFIG_HEXAGON_ARCH_VERSION >= 4
108#define CS_COPYREGS(DEST,REGS) \
109do {\
110 DEST.cs0 = REGS->cs0;\
111 DEST.cs1 = REGS->cs1;\
112} while (0)
113#else
114#define CS_COPYREGS(DEST,REGS)
115#endif
116
107#define ELF_CORE_COPY_REGS(DEST, REGS) \ 117#define ELF_CORE_COPY_REGS(DEST, REGS) \
108do { \ 118do { \
109 DEST.r0 = REGS->r00; \ 119 DEST.r0 = REGS->r00; \
@@ -148,13 +158,12 @@ do { \
148 DEST.p3_0 = REGS->preds; \ 158 DEST.p3_0 = REGS->preds; \
149 DEST.gp = REGS->gp; \ 159 DEST.gp = REGS->gp; \
150 DEST.ugp = REGS->ugp; \ 160 DEST.ugp = REGS->ugp; \
151 DEST.pc = pt_elr(REGS); \ 161 CS_COPYREGS(DEST,REGS); \
162 DEST.pc = pt_elr(REGS); \
152 DEST.cause = pt_cause(REGS); \ 163 DEST.cause = pt_cause(REGS); \
153 DEST.badva = pt_badva(REGS); \ 164 DEST.badva = pt_badva(REGS); \
154} while (0); 165} while (0);
155 166
156
157
158/* 167/*
159 * This is used to ensure we don't load something for the wrong architecture. 168 * This is used to ensure we don't load something for the wrong architecture.
160 * Checks the machine and ABI type. 169 * Checks the machine and ABI type.
@@ -168,15 +177,15 @@ do { \
168#define ELF_DATA ELFDATA2LSB 177#define ELF_DATA ELFDATA2LSB
169#define ELF_ARCH EM_HEXAGON 178#define ELF_ARCH EM_HEXAGON
170 179
171#ifdef CONFIG_HEXAGON_ARCH_V2 180#if CONFIG_HEXAGON_ARCH_VERSION == 2
172#define ELF_CORE_EFLAGS 0x1 181#define ELF_CORE_EFLAGS 0x1
173#endif 182#endif
174 183
175#ifdef CONFIG_HEXAGON_ARCH_V3 184#if CONFIG_HEXAGON_ARCH_VERSION == 3
176#define ELF_CORE_EFLAGS 0x2 185#define ELF_CORE_EFLAGS 0x2
177#endif 186#endif
178 187
179#ifdef CONFIG_HEXAGON_ARCH_V4 188#if CONFIG_HEXAGON_ARCH_VERSION == 4
180#define ELF_CORE_EFLAGS 0x3 189#define ELF_CORE_EFLAGS 0x3
181#endif 190#endif
182 191
diff --git a/arch/hexagon/include/asm/hexagon_vm.h b/arch/hexagon/include/asm/hexagon_vm.h
index c144bee6cabe..67bb6d6f3337 100644
--- a/arch/hexagon/include/asm/hexagon_vm.h
+++ b/arch/hexagon/include/asm/hexagon_vm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Declarations for to Hexagon Virtal Machine. 2 * Declarations for to Hexagon Virtal Machine.
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -31,10 +31,26 @@
31 * for tracing/debugging. 31 * for tracing/debugging.
32 */ 32 */
33 33
34/* 34#define HVM_TRAP1_VMVERSION 0
35 * Lets make this stuff visible only if configured, 35#define HVM_TRAP1_VMRTE 1
36 * so we can unconditionally include the file. 36#define HVM_TRAP1_VMSETVEC 2
37 */ 37#define HVM_TRAP1_VMSETIE 3
38#define HVM_TRAP1_VMGETIE 4
39#define HVM_TRAP1_VMINTOP 5
40#define HVM_TRAP1_VMCLRMAP 10
41#define HVM_TRAP1_VMNEWMAP 11
42#define HVM_TRAP1_FORMERLY_VMWIRE 12
43#define HVM_TRAP1_VMCACHE 13
44#define HVM_TRAP1_VMGETTIME 14
45#define HVM_TRAP1_VMSETTIME 15
46#define HVM_TRAP1_VMWAIT 16
47#define HVM_TRAP1_VMYIELD 17
48#define HVM_TRAP1_VMSTART 18
49#define HVM_TRAP1_VMSTOP 19
50#define HVM_TRAP1_VMVPID 20
51#define HVM_TRAP1_VMSETREGS 21
52#define HVM_TRAP1_VMGETREGS 22
53#define HVM_TRAP1_VMTIMEROP 24
38 54
39#ifndef __ASSEMBLY__ 55#ifndef __ASSEMBLY__
40 56
@@ -175,31 +191,19 @@ static inline long __vmintop_clear(long i)
175 191
176#else /* Only assembly code should reference these */ 192#else /* Only assembly code should reference these */
177 193
178#define HVM_TRAP1_VMRTE 1
179#define HVM_TRAP1_VMSETVEC 2
180#define HVM_TRAP1_VMSETIE 3
181#define HVM_TRAP1_VMGETIE 4
182#define HVM_TRAP1_VMINTOP 5
183#define HVM_TRAP1_VMCLRMAP 10
184#define HVM_TRAP1_VMNEWMAP 11
185#define HVM_TRAP1_FORMERLY_VMWIRE 12
186#define HVM_TRAP1_VMCACHE 13
187#define HVM_TRAP1_VMGETTIME 14
188#define HVM_TRAP1_VMSETTIME 15
189#define HVM_TRAP1_VMWAIT 16
190#define HVM_TRAP1_VMYIELD 17
191#define HVM_TRAP1_VMSTART 18
192#define HVM_TRAP1_VMSTOP 19
193#define HVM_TRAP1_VMVPID 20
194#define HVM_TRAP1_VMSETREGS 21
195#define HVM_TRAP1_VMGETREGS 22
196
197#endif /* __ASSEMBLY__ */ 194#endif /* __ASSEMBLY__ */
198 195
199/* 196/*
200 * Constants for virtual instruction parameters and return values 197 * Constants for virtual instruction parameters and return values
201 */ 198 */
202 199
200/* vmnewmap arguments */
201
202#define VM_TRANS_TYPE_LINEAR 0
203#define VM_TRANS_TYPE_TABLE 1
204#define VM_TLB_INVALIDATE_FALSE 0
205#define VM_TLB_INVALIDATE_TRUE 1
206
203/* vmsetie arguments */ 207/* vmsetie arguments */
204 208
205#define VM_INT_DISABLE 0 209#define VM_INT_DISABLE 0
@@ -224,6 +228,8 @@ static inline long __vmintop_clear(long i)
224#define HVM_VMEST_UM_MSK 1 228#define HVM_VMEST_UM_MSK 1
225#define HVM_VMEST_IE_SFT 30 229#define HVM_VMEST_IE_SFT 30
226#define HVM_VMEST_IE_MSK 1 230#define HVM_VMEST_IE_MSK 1
231#define HVM_VMEST_SS_SFT 29
232#define HVM_VMEST_SS_MSK 1
227#define HVM_VMEST_EVENTNUM_SFT 16 233#define HVM_VMEST_EVENTNUM_SFT 16
228#define HVM_VMEST_EVENTNUM_MSK 0xff 234#define HVM_VMEST_EVENTNUM_MSK 0xff
229#define HVM_VMEST_CAUSE_SFT 0 235#define HVM_VMEST_CAUSE_SFT 0
@@ -260,6 +266,8 @@ static inline long __vmintop_clear(long i)
260#define HVM_GE_C_INVI 0x15 266#define HVM_GE_C_INVI 0x15
261#define HVM_GE_C_PRIVI 0x1B 267#define HVM_GE_C_PRIVI 0x1B
262#define HVM_GE_C_XMAL 0x1C 268#define HVM_GE_C_XMAL 0x1C
269#define HVM_GE_C_WREG 0x1D
270#define HVM_GE_C_PCAL 0x1E
263#define HVM_GE_C_RMAL 0x20 271#define HVM_GE_C_RMAL 0x20
264#define HVM_GE_C_WMAL 0x21 272#define HVM_GE_C_WMAL 0x21
265#define HVM_GE_C_RPROT 0x22 273#define HVM_GE_C_RPROT 0x22
diff --git a/arch/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
index e527cfeff5ba..1b7698e19139 100644
--- a/arch/hexagon/include/asm/io.h
+++ b/arch/hexagon/include/asm/io.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * IO definitions for the Hexagon architecture 2 * IO definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -40,6 +40,8 @@
40#define IO_SPACE_LIMIT 0xffff 40#define IO_SPACE_LIMIT 0xffff
41#define _IO_BASE ((void __iomem *)0xfe000000) 41#define _IO_BASE ((void __iomem *)0xfe000000)
42 42
43#define IOMEM(x) ((void __force __iomem *)(x))
44
43extern int remap_area_pages(unsigned long start, unsigned long phys_addr, 45extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
44 unsigned long end, unsigned long flags); 46 unsigned long end, unsigned long flags);
45 47
@@ -176,6 +178,18 @@ static inline void writel(u32 data, volatile void __iomem *addr)
176#define __raw_readl readl 178#define __raw_readl readl
177 179
178/* 180/*
181 * http://comments.gmane.org/gmane.linux.ports.arm.kernel/117626
182 */
183
184#define readb_relaxed __raw_readb
185#define readw_relaxed __raw_readw
186#define readl_relaxed __raw_readl
187
188#define writeb_relaxed __raw_writeb
189#define writew_relaxed __raw_writew
190#define writel_relaxed __raw_writel
191
192/*
179 * Need an mtype somewhere in here, for cache type deals? 193 * Need an mtype somewhere in here, for cache type deals?
180 * This is probably too long for an inline. 194 * This is probably too long for an inline.
181 */ 195 */
diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h
index af16e977c55e..60556f8c45d8 100644
--- a/arch/hexagon/include/asm/mem-layout.h
+++ b/arch/hexagon/include/asm/mem-layout.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Memory layout definitions for the Hexagon architecture 2 * Memory layout definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -32,16 +32,25 @@
32#define PAGE_OFFSET _AC(0xc0000000, UL) 32#define PAGE_OFFSET _AC(0xc0000000, UL)
33 33
34/* 34/*
35 * LOAD_ADDRESS is the physical/linear address of where in memory 35 * Compiling for a platform that needs a crazy physical offset
36 * the kernel gets loaded. The 12 least significant bits must be zero (0) 36 * (like if the memory starts at 1GB and up) means we need
37 * due to limitations on setting the EVB 37 * an actual PHYS_OFFSET. Should be set up in head.S.
38 *
39 */ 38 */
40 39
41#ifndef LOAD_ADDRESS 40#ifdef CONFIG_HEXAGON_PHYS_OFFSET
42#define LOAD_ADDRESS 0x00000000 41#ifndef __ASSEMBLY__
42extern unsigned long __phys_offset;
43#endif
44#define PHYS_OFFSET __phys_offset
45#endif
46
47#ifndef PHYS_OFFSET
48#define PHYS_OFFSET 0
43#endif 49#endif
44 50
51#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
52#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
53
45#define TASK_SIZE (PAGE_OFFSET) 54#define TASK_SIZE (PAGE_OFFSET)
46 55
47/* not sure how these are used yet */ 56/* not sure how these are used yet */
@@ -55,7 +64,7 @@ enum fixed_addresses {
55 __end_of_fixed_addresses 64 __end_of_fixed_addresses
56}; 65};
57 66
58#define MIN_KERNEL_SEG 0x300 /* From 0xc0000000 */ 67#define MIN_KERNEL_SEG (PAGE_OFFSET >> PGDIR_SHIFT) /* L1 shift is 22 bits */
59extern int max_kernel_seg; 68extern int max_kernel_seg;
60 69
61/* 70/*
@@ -63,8 +72,7 @@ extern int max_kernel_seg;
63 * supposed to be based on the amount of physical memory available 72 * supposed to be based on the amount of physical memory available
64 */ 73 */
65 74
66#define VMALLOC_START (PAGE_OFFSET + VMALLOC_OFFSET + \ 75#define VMALLOC_START ((unsigned long) __va(high_memory + VMALLOC_OFFSET))
67 (unsigned long)high_memory)
68 76
69/* Gap between physical ram and vmalloc space for guard purposes. */ 77/* Gap between physical ram and vmalloc space for guard purposes. */
70#define VMALLOC_OFFSET PAGE_SIZE 78#define VMALLOC_OFFSET PAGE_SIZE
diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h
index 692adc213429..93f5669b4aa1 100644
--- a/arch/hexagon/include/asm/page.h
+++ b/arch/hexagon/include/asm/page.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Page management definitions for the Hexagon architecture 2 * Page management definitions for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -96,8 +96,8 @@ typedef struct page *pgtable_t;
96 * MIPS says they're only used during mem_init. 96 * MIPS says they're only used during mem_init.
97 * also, check if we need a PHYS_OFFSET. 97 * also, check if we need a PHYS_OFFSET.
98 */ 98 */
99#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) 99#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
100#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) 100#define __va(x) ((void *)((unsigned long)(x) - PHYS_OFFSET + PAGE_OFFSET))
101 101
102/* The "page frame" descriptor is defined in linux/mm.h */ 102/* The "page frame" descriptor is defined in linux/mm.h */
103struct page; 103struct page;
@@ -140,6 +140,11 @@ static inline void clear_page(void *page)
140 */ 140 */
141#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 141#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
142 142
143#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
144#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
145
146#define page_to_virt(page) __va(page_to_phys(page))
147
143/* 148/*
144 * For port to Hexagon Virtual Machine, MAYBE we check for attempts 149 * For port to Hexagon Virtual Machine, MAYBE we check for attempts
145 * to reference reserved HVM space, but in any case, the VM will be 150 * to reference reserved HVM space, but in any case, the VM will be
@@ -147,6 +152,7 @@ static inline void clear_page(void *page)
147 */ 152 */
148#define kern_addr_valid(addr) (1) 153#define kern_addr_valid(addr) (1)
149 154
155#include <asm/mem-layout.h>
150#include <asm-generic/memory_model.h> 156#include <asm-generic/memory_model.h>
151/* XXX Todo: implement assembly-optimized version of getorder. */ 157/* XXX Todo: implement assembly-optimized version of getorder. */
152#include <asm-generic/getorder.h> 158#include <asm-generic/getorder.h>
diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h
index 6dd5d3706869..45a825402f63 100644
--- a/arch/hexagon/include/asm/processor.h
+++ b/arch/hexagon/include/asm/processor.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Process/processor support for the Hexagon architecture 2 * Process/processor support for the Hexagon architecture
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -100,12 +100,49 @@ extern unsigned long get_wchan(struct task_struct *p);
100 */ 100 */
101 101
102struct hexagon_switch_stack { 102struct hexagon_switch_stack {
103 unsigned long long r1716; 103 union {
104 unsigned long long r1918; 104 struct {
105 unsigned long long r2120; 105 unsigned long r16;
106 unsigned long long r2322; 106 unsigned long r17;
107 unsigned long long r2524; 107 };
108 unsigned long long r2726; 108 unsigned long long r1716;
109 };
110 union {
111 struct {
112 unsigned long r18;
113 unsigned long r19;
114 };
115 unsigned long long r1918;
116 };
117 union {
118 struct {
119 unsigned long r20;
120 unsigned long r21;
121 };
122 unsigned long long r2120;
123 };
124 union {
125 struct {
126 unsigned long r22;
127 unsigned long r23;
128 };
129 unsigned long long r2322;
130 };
131 union {
132 struct {
133 unsigned long r24;
134 unsigned long r25;
135 };
136 unsigned long long r2524;
137 };
138 union {
139 struct {
140 unsigned long r26;
141 unsigned long r27;
142 };
143 unsigned long long r2726;
144 };
145
109 unsigned long fp; 146 unsigned long fp;
110 unsigned long lr; 147 unsigned long lr;
111}; 148};
diff --git a/arch/hexagon/include/asm/vm_mmu.h b/arch/hexagon/include/asm/vm_mmu.h
index 9a94de7969bb..096537d8f4c5 100644
--- a/arch/hexagon/include/asm/vm_mmu.h
+++ b/arch/hexagon/include/asm/vm_mmu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hexagon VM page table entry definitions 2 * Hexagon VM page table entry definitions
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2011,2013 The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -68,14 +68,13 @@
68 68
69#define __HEXAGON_C_WB 0x0 /* Write-back, no L2 */ 69#define __HEXAGON_C_WB 0x0 /* Write-back, no L2 */
70#define __HEXAGON_C_WT 0x1 /* Write-through, no L2 */ 70#define __HEXAGON_C_WT 0x1 /* Write-through, no L2 */
71#define __HEXAGON_C_UNC 0x6 /* Uncached memory */
72#if CONFIG_HEXAGON_ARCH_VERSION >= 2
71#define __HEXAGON_C_DEV 0x4 /* Device register space */ 73#define __HEXAGON_C_DEV 0x4 /* Device register space */
72#define __HEXAGON_C_WT_L2 0x5 /* Write-through, with L2 */
73/* this really should be #if CONFIG_HEXAGON_ARCH = 2 but that's not defined */
74#if defined(CONFIG_HEXAGON_COMET) || defined(CONFIG_QDSP6_ST1)
75#define __HEXAGON_C_UNC __HEXAGON_C_DEV
76#else 74#else
77#define __HEXAGON_C_UNC 0x6 /* Uncached memory */ 75#define __HEXAGON_C_DEV __HEXAGON_C_UNC
78#endif 76#endif
77#define __HEXAGON_C_WT_L2 0x5 /* Write-through, with L2 */
79#define __HEXAGON_C_WB_L2 0x7 /* Write-back, with L2 */ 78#define __HEXAGON_C_WB_L2 0x7 /* Write-back, with L2 */
80 79
81/* 80/*
diff --git a/arch/hexagon/include/uapi/asm/ptrace.h b/arch/hexagon/include/uapi/asm/ptrace.h
index 1ffce0c6ee07..065e5b32313f 100644
--- a/arch/hexagon/include/uapi/asm/ptrace.h
+++ b/arch/hexagon/include/uapi/asm/ptrace.h
@@ -36,4 +36,9 @@ extern const char *regs_query_register_name(unsigned int offset);
36 ((struct pt_regs *) \ 36 ((struct pt_regs *) \
37 ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) 37 ((unsigned long)current_thread_info() + THREAD_SIZE) - 1)
38 38
39#if CONFIG_HEXAGON_ARCH_VERSION >= 4
40#define arch_has_single_step() (1)
41#endif
42
43
39#endif 44#endif
diff --git a/arch/hexagon/include/uapi/asm/registers.h b/arch/hexagon/include/uapi/asm/registers.h
index c20406f63b5c..487d6ceca5e7 100644
--- a/arch/hexagon/include/uapi/asm/registers.h
+++ b/arch/hexagon/include/uapi/asm/registers.h
@@ -57,10 +57,17 @@ struct pt_regs {
57 }; 57 };
58 union { 58 union {
59 struct { 59 struct {
60 unsigned long gp;
61 unsigned long ugp; 60 unsigned long ugp;
61 unsigned long gp;
62 }; 62 };
63 long long int ugpgp; 63 long long int gpugp;
64 };
65 union {
66 struct {
67 unsigned long cs0;
68 unsigned long cs1;
69 };
70 long long int cs1cs0;
64 }; 71 };
65 /* 72 /*
66 * Be extremely careful with rearranging these, if at all. Some code 73 * Be extremely careful with rearranging these, if at all. Some code
@@ -204,9 +211,11 @@ struct pt_regs {
204#define pt_psp(regs) ((regs)->hvmer.vmpsp) 211#define pt_psp(regs) ((regs)->hvmer.vmpsp)
205#define pt_badva(regs) ((regs)->hvmer.vmbadva) 212#define pt_badva(regs) ((regs)->hvmer.vmbadva)
206 213
214#define pt_set_singlestep(regs) ((regs)->hvmer.vmest |= (1<<HVM_VMEST_SS_SFT))
215#define pt_clr_singlestep(regs) ((regs)->hvmer.vmest &= ~(1<<HVM_VMEST_SS_SFT))
216
207#define pt_set_rte_sp(regs, sp) do {\ 217#define pt_set_rte_sp(regs, sp) do {\
208 pt_psp(regs) = (sp);\ 218 pt_psp(regs) = (regs)->SP = (sp);\
209 (regs)->SP = (unsigned long) &((regs)->hvmer);\
210 } while (0) 219 } while (0)
211 220
212#define pt_set_kmode(regs) \ 221#define pt_set_kmode(regs) \
diff --git a/arch/hexagon/include/uapi/asm/signal.h b/arch/hexagon/include/uapi/asm/signal.h
index 939556817d34..98106e55ad4f 100644
--- a/arch/hexagon/include/uapi/asm/signal.h
+++ b/arch/hexagon/include/uapi/asm/signal.h
@@ -19,8 +19,12 @@
19#ifndef _ASM_SIGNAL_H 19#ifndef _ASM_SIGNAL_H
20#define _ASM_SIGNAL_H 20#define _ASM_SIGNAL_H
21 21
22#include <uapi/asm/registers.h>
23
22extern unsigned long __rt_sigtramp_template[2]; 24extern unsigned long __rt_sigtramp_template[2];
23 25
26void do_signal(struct pt_regs *regs);
27
24#include <asm-generic/signal.h> 28#include <asm-generic/signal.h>
25 29
26#endif 30#endif
diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
index 4a87cc47075c..ffee405d6803 100644
--- a/arch/hexagon/include/uapi/asm/unistd.h
+++ b/arch/hexagon/include/uapi/asm/unistd.h
@@ -27,6 +27,9 @@
27 */ 27 */
28 28
29#define sys_mmap2 sys_mmap_pgoff 29#define sys_mmap2 sys_mmap_pgoff
30#define __ARCH_WANT_SYS_EXECVE
30#define __ARCH_WANT_SYS_CLONE 31#define __ARCH_WANT_SYS_CLONE
32#define __ARCH_WANT_SYS_VFORK
33#define __ARCH_WANT_SYS_FORK
31 34
32#include <asm-generic/unistd.h> 35#include <asm-generic/unistd.h>
diff --git a/arch/hexagon/include/uapi/asm/user.h b/arch/hexagon/include/uapi/asm/user.h
index cef13ee1413f..3dae94d9ced7 100644
--- a/arch/hexagon/include/uapi/asm/user.h
+++ b/arch/hexagon/include/uapi/asm/user.h
@@ -55,9 +55,15 @@ struct user_regs_struct {
55 unsigned long pc; 55 unsigned long pc;
56 unsigned long cause; 56 unsigned long cause;
57 unsigned long badva; 57 unsigned long badva;
58#if CONFIG_HEXAGON_ARCH_VERSION < 4
58 unsigned long pad1; /* pad out to 48 words total */ 59 unsigned long pad1; /* pad out to 48 words total */
59 unsigned long pad2; /* pad out to 48 words total */ 60 unsigned long pad2; /* pad out to 48 words total */
60 unsigned long pad3; /* pad out to 48 words total */ 61 unsigned long pad3; /* pad out to 48 words total */
62#else
63 unsigned long cs0;
64 unsigned long cs1;
65 unsigned long pad1; /* pad out to 48 words total */
66#endif
61}; 67};
62 68
63#endif 69#endif
diff --git a/arch/hexagon/kernel/Makefile b/arch/hexagon/kernel/Makefile
index 6c19501b487c..29fc933a7722 100644
--- a/arch/hexagon/kernel/Makefile
+++ b/arch/hexagon/kernel/Makefile
@@ -1,6 +1,6 @@
1extra-y := head.o vmlinux.lds 1extra-y := head.o vmlinux.lds
2 2
3obj-$(CONFIG_SMP) += smp.o topology.o 3obj-$(CONFIG_SMP) += smp.o
4 4
5obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o 5obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o
6obj-y += process.o trampoline.o reset.o ptrace.o vdso.o 6obj-y += process.o trampoline.o reset.o ptrace.o vdso.o
diff --git a/arch/hexagon/kernel/asm-offsets.c b/arch/hexagon/kernel/asm-offsets.c
index 2d5e84d3b00d..308be68d4fb3 100644
--- a/arch/hexagon/kernel/asm-offsets.c
+++ b/arch/hexagon/kernel/asm-offsets.c
@@ -5,7 +5,7 @@
5 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com 5 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
6 * Copyright (C) 2000 MIPS Technologies, Inc. 6 * Copyright (C) 2000 MIPS Technologies, Inc.
7 * 7 *
8 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 8 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 and 11 * it under the terms of the GNU General Public License version 2 and
@@ -44,7 +44,8 @@ int main(void)
44 44
45 COMMENT("Hexagon pt_regs definitions"); 45 COMMENT("Hexagon pt_regs definitions");
46 OFFSET(_PT_SYSCALL_NR, pt_regs, syscall_nr); 46 OFFSET(_PT_SYSCALL_NR, pt_regs, syscall_nr);
47 OFFSET(_PT_UGPGP, pt_regs, ugpgp); 47 OFFSET(_PT_GPUGP, pt_regs, gpugp);
48 OFFSET(_PT_CS1CS0, pt_regs, cs1cs0);
48 OFFSET(_PT_R3130, pt_regs, r3130); 49 OFFSET(_PT_R3130, pt_regs, r3130);
49 OFFSET(_PT_R2928, pt_regs, r2928); 50 OFFSET(_PT_R2928, pt_regs, r2928);
50 OFFSET(_PT_R2726, pt_regs, r2726); 51 OFFSET(_PT_R2726, pt_regs, r2726);
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 65c7bdcf565e..b74f9bae31a3 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * DMA implementation for Hexagon 2 * DMA implementation for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -23,12 +23,18 @@
23#include <linux/genalloc.h> 23#include <linux/genalloc.h>
24#include <asm/dma-mapping.h> 24#include <asm/dma-mapping.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <asm/page.h>
26 27
27struct dma_map_ops *dma_ops; 28struct dma_map_ops *dma_ops;
28EXPORT_SYMBOL(dma_ops); 29EXPORT_SYMBOL(dma_ops);
29 30
30int bad_dma_address; /* globals are automatically initialized to zero */ 31int bad_dma_address; /* globals are automatically initialized to zero */
31 32
33static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
34{
35 return phys_to_virt((unsigned long) dma_addr);
36}
37
32int dma_supported(struct device *dev, u64 mask) 38int dma_supported(struct device *dev, u64 mask)
33{ 39{
34 if (mask == DMA_BIT_MASK(32)) 40 if (mask == DMA_BIT_MASK(32))
@@ -60,6 +66,12 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
60{ 66{
61 void *ret; 67 void *ret;
62 68
69 /*
70 * Our max_low_pfn should have been backed off by 16MB in
71 * mm/init.c to create DMA coherent space. Use that as the VA
72 * for the pool.
73 */
74
63 if (coherent_pool == NULL) { 75 if (coherent_pool == NULL) {
64 coherent_pool = gen_pool_create(PAGE_SHIFT, -1); 76 coherent_pool = gen_pool_create(PAGE_SHIFT, -1);
65 77
@@ -67,7 +79,7 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
67 panic("Can't create %s() memory pool!", __func__); 79 panic("Can't create %s() memory pool!", __func__);
68 else 80 else
69 gen_pool_add(coherent_pool, 81 gen_pool_add(coherent_pool,
70 (PAGE_OFFSET + (max_low_pfn << PAGE_SHIFT)), 82 pfn_to_virt(max_low_pfn),
71 hexagon_coherent_pool_size, -1); 83 hexagon_coherent_pool_size, -1);
72 } 84 }
73 85
@@ -75,7 +87,7 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
75 87
76 if (ret) { 88 if (ret) {
77 memset(ret, 0, size); 89 memset(ret, 0, size);
78 *dma_addr = (dma_addr_t) (ret - PAGE_OFFSET); 90 *dma_addr = (dma_addr_t) virt_to_phys(ret);
79 } else 91 } else
80 *dma_addr = ~0; 92 *dma_addr = ~0;
81 93
@@ -118,8 +130,8 @@ static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
118 130
119 s->dma_length = s->length; 131 s->dma_length = s->length;
120 132
121 flush_dcache_range(PAGE_OFFSET + s->dma_address, 133 flush_dcache_range(dma_addr_to_virt(s->dma_address),
122 PAGE_OFFSET + s->dma_address + s->length); 134 dma_addr_to_virt(s->dma_address + s->length));
123 } 135 }
124 136
125 return nents; 137 return nents;
@@ -149,11 +161,6 @@ static inline void dma_sync(void *addr, size_t size,
149 } 161 }
150} 162}
151 163
152static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
153{
154 return phys_to_virt((unsigned long) dma_addr);
155}
156
157/** 164/**
158 * hexagon_map_page() - maps an address for device DMA 165 * hexagon_map_page() - maps an address for device DMA
159 * @dev: pointer to DMA device 166 * @dev: pointer to DMA device
diff --git a/arch/hexagon/kernel/head.S b/arch/hexagon/kernel/head.S
index d859402c73ba..b9b63d085db2 100644
--- a/arch/hexagon/kernel/head.S
+++ b/arch/hexagon/kernel/head.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Early kernel startup code for Hexagon 2 * Early kernel startup code for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,9 @@
25#include <asm/mem-layout.h> 25#include <asm/mem-layout.h>
26#include <asm/vm_mmu.h> 26#include <asm/vm_mmu.h>
27#include <asm/page.h> 27#include <asm/page.h>
28#include <asm/hexagon_vm.h>
29
30#define SEGTABLE_ENTRIES #0x0e0
28 31
29 __INIT 32 __INIT
30ENTRY(stext) 33ENTRY(stext)
@@ -43,40 +46,93 @@ ENTRY(stext)
43 * Symbol is kernel segment address, but we need 46 * Symbol is kernel segment address, but we need
44 * the logical/physical address. 47 * the logical/physical address.
45 */ 48 */
46 r24 = asl(r24, #2) 49 r25 = pc;
47 r24 = lsr(r24, #2) 50 r2.h = #0xffc0;
51 r2.l = #0x0000;
52 r25 = and(r2,r25); /* R25 holds PHYS_OFFSET now */
53 r1.h = #HI(PAGE_OFFSET);
54 r1.l = #LO(PAGE_OFFSET);
55 r24 = sub(r24,r1); /* swapper_pg_dir - PAGE_OFFSET */
56 r24 = add(r24,r25); /* + PHYS_OFFSET */
48 57
49 r0 = r24 58 r0 = r24; /* aka __pa(swapper_pg_dir) */
50 59
51 /* 60 /*
52 * Initialize a 16MB PTE to make the virtual and physical 61 * Initialize page dir to make the virtual and physical
53 * addresses where the kernel was loaded be identical. 62 * addresses where the kernel was loaded be identical.
63 * Done in 4MB chunks.
54 */ 64 */
55#define PTE_BITS ( __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X \ 65#define PTE_BITS ( __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X \
56 | __HEXAGON_C_WB_L2 << 6 \ 66 | __HEXAGON_C_WB_L2 << 6 \
57 | __HVM_PDE_S_4MB) 67 | __HVM_PDE_S_4MB)
58 68
59 r1 = pc 69 /*
60 r2.H = #0xffc0 70 * Get number of VA=PA entries; only really needed for jump
61 r2.L = #0x0000 71 * to hyperspace; gets blown away immediately after
62 r1 = and(r1,r2) /* round PC to 4MB boundary */ 72 */
73
74 {
75 r1.l = #LO(_end);
76 r2.l = #LO(stext);
77 r3 = #1;
78 }
79 {
80 r1.h = #HI(_end);
81 r2.h = #HI(stext);
82 r3 = asl(r3, #22);
83 }
84 {
85 r1 = sub(r1, r2);
86 r3 = add(r3, #-1);
87 } /* r1 = _end - stext */
88 r1 = add(r1, r3); /* + (4M-1) */
89 r26 = lsr(r1, #22); /* / 4M = # of entries */
90
91 r1 = r25;
92 r2.h = #0xffc0;
93 r2.l = #0x0000; /* round back down to 4MB boundary */
94 r1 = and(r1,r2);
63 r2 = lsr(r1, #22) /* 4MB page number */ 95 r2 = lsr(r1, #22) /* 4MB page number */
64 r2 = asl(r2, #2) /* times sizeof(PTE) (4bytes) */ 96 r2 = asl(r2, #2) /* times sizeof(PTE) (4bytes) */
65 r0 = add(r0,r2) /* r0 = address of correct PTE */ 97 r0 = add(r0,r2) /* r0 = address of correct PTE */
66 r2 = #PTE_BITS 98 r2 = #PTE_BITS
67 r1 = add(r1,r2) /* r1 = 4MB PTE for the first entry */ 99 r1 = add(r1,r2) /* r1 = 4MB PTE for the first entry */
68 r2.h = #0x0040 100 r2.h = #0x0040
69 r2.l = #0x0000 /* 4MB */ 101 r2.l = #0x0000 /* 4MB increments */
70 memw(r0 ++ #4) = r1 102 loop0(1f,r26);
71 r1 = add(r1, r2) 1031:
72 memw(r0 ++ #4) = r1 104 memw(r0 ++ #4) = r1
105 { r1 = add(r1, r2); } :endloop0
106
107 /* Also need to overwrite the initial 0xc0000000 entries */
108 /* PAGE_OFFSET >> (4MB shift - 4 bytes per entry shift) */
109 R1.H = #HI(PAGE_OFFSET >> (22 - 2))
110 R1.L = #LO(PAGE_OFFSET >> (22 - 2))
111
112 r0 = add(r1, r24); /* advance to 0xc0000000 entry */
113 r1 = r25;
114 r2.h = #0xffc0;
115 r2.l = #0x0000; /* round back down to 4MB boundary */
116 r1 = and(r1,r2); /* for huge page */
117 r2 = #PTE_BITS
118 r1 = add(r1,r2);
119 r2.h = #0x0040
120 r2.l = #0x0000 /* 4MB increments */
73 121
74 r0 = r24 122 loop0(1f,SEGTABLE_ENTRIES);
1231:
124 memw(r0 ++ #4) = r1;
125 { r1 = add(r1,r2); } :endloop0
126
127 r0 = r24;
75 128
76 /* 129 /*
77 * The subroutine wrapper around the virtual instruction touches 130 * The subroutine wrapper around the virtual instruction touches
78 * no memory, so we should be able to use it even here. 131 * no memory, so we should be able to use it even here.
132 * Note that in this version, R1 and R2 get "clobbered"; see
133 * vm_ops.S
79 */ 134 */
135 r1 = #VM_TRANS_TYPE_TABLE
80 call __vmnewmap; 136 call __vmnewmap;
81 137
82 /* Jump into virtual address range. */ 138 /* Jump into virtual address range. */
@@ -90,17 +146,29 @@ ENTRY(stext)
90__head_s_vaddr_target: 146__head_s_vaddr_target:
91 /* 147 /*
92 * Tear down VA=PA translation now that we are running 148 * Tear down VA=PA translation now that we are running
93 * in the desgnated kernel segments. 149 * in kernel virtual space.
94 */ 150 */
95 r0 = #__HVM_PDE_S_INVALID 151 r0 = #__HVM_PDE_S_INVALID
96 r1 = r24 152
97 loop0(1f,#0x100) 153 r1.h = #0xffc0;
154 r1.l = #0x0000;
155 r2 = r25; /* phys_offset */
156 r2 = and(r1,r2);
157
158 r1.l = #lo(swapper_pg_dir)
159 r1.h = #hi(swapper_pg_dir)
160 r2 = lsr(r2, #22) /* 4MB page number */
161 r2 = asl(r2, #2) /* times sizeof(PTE) (4bytes) */
162 r1 = add(r1,r2);
163 loop0(1f,r26)
164
981: 1651:
99 { 166 {
100 memw(R1 ++ #4) = R0 167 memw(R1 ++ #4) = R0
101 }:endloop0 168 }:endloop0
102 169
103 r0 = r24 170 r0 = r24
171 r1 = #VM_TRANS_TYPE_TABLE
104 call __vmnewmap 172 call __vmnewmap
105 173
106 /* Go ahead and install the trap0 return so angel calls work */ 174 /* Go ahead and install the trap0 return so angel calls work */
@@ -143,6 +211,13 @@ __head_s_vaddr_target:
143 r2 = sub(r2,r0); 211 r2 = sub(r2,r0);
144 call memset; 212 call memset;
145 213
214 /* Set PHYS_OFFSET; should be in R25 */
215#ifdef CONFIG_HEXAGON_PHYS_OFFSET
216 r0.l = #LO(__phys_offset);
217 r0.h = #HI(__phys_offset);
218 memw(r0) = r25;
219#endif
220
146 /* Time to make the doughnuts. */ 221 /* Time to make the doughnuts. */
147 call start_kernel 222 call start_kernel
148 223
diff --git a/arch/hexagon/kernel/kgdb.c b/arch/hexagon/kernel/kgdb.c
index 344645370646..82d5c2593323 100644
--- a/arch/hexagon/kernel/kgdb.c
+++ b/arch/hexagon/kernel/kgdb.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support 2 * arch/hexagon/kernel/kgdb.c - Hexagon KGDB Support
3 * 3 *
4 * Copyright (c) 2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -70,6 +70,8 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
70 { "lc1", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc1)}, 70 { "lc1", GDB_SIZEOF_REG, offsetof(struct pt_regs, lc1)},
71 { " gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, gp)}, 71 { " gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, gp)},
72 { "ugp", GDB_SIZEOF_REG, offsetof(struct pt_regs, ugp)}, 72 { "ugp", GDB_SIZEOF_REG, offsetof(struct pt_regs, ugp)},
73 { "cs0", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs0)},
74 { "cs1", GDB_SIZEOF_REG, offsetof(struct pt_regs, cs1)},
73 { "psp", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmpsp)}, 75 { "psp", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmpsp)},
74 { "elr", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmel)}, 76 { "elr", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmel)},
75 { "est", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmest)}, 77 { "est", GDB_SIZEOF_REG, offsetof(struct pt_regs, hvmer.vmest)},
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index 06ae9ffcabd5..0a0dd5c05b46 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -24,6 +24,7 @@
24#include <linux/tick.h> 24#include <linux/tick.h>
25#include <linux/uaccess.h> 25#include <linux/uaccess.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/tracehook.h>
27 28
28/* 29/*
29 * Program thread launch. Often defined as a macro in processor.h, 30 * Program thread launch. Often defined as a macro in processor.h,
@@ -51,28 +52,11 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
51 * If hardware or VM offer wait termination even though interrupts 52 * If hardware or VM offer wait termination even though interrupts
52 * are disabled. 53 * are disabled.
53 */ 54 */
54static void default_idle(void) 55void arch_cpu_idle(void)
55{ 56{
56 __vmwait(); 57 __vmwait();
57} 58 /* interrupts wake us up, but irqs are still disabled */
58 59 local_irq_enable();
59void (*idle_sleep)(void) = default_idle;
60
61void cpu_idle(void)
62{
63 while (1) {
64 tick_nohz_idle_enter();
65 local_irq_disable();
66 while (!need_resched()) {
67 idle_sleep();
68 /* interrupts wake us up, but aren't serviced */
69 local_irq_enable(); /* service interrupt */
70 local_irq_disable();
71 }
72 local_irq_enable();
73 tick_nohz_idle_exit();
74 schedule();
75 }
76} 60}
77 61
78/* 62/*
@@ -112,7 +96,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
112 if (unlikely(p->flags & PF_KTHREAD)) { 96 if (unlikely(p->flags & PF_KTHREAD)) {
113 memset(childregs, 0, sizeof(struct pt_regs)); 97 memset(childregs, 0, sizeof(struct pt_regs));
114 /* r24 <- fn, r25 <- arg */ 98 /* r24 <- fn, r25 <- arg */
115 ss->r2524 = usp | ((u64)arg << 32); 99 ss->r24 = usp;
100 ss->r25 = arg;
116 pt_set_kmode(childregs); 101 pt_set_kmode(childregs);
117 return 0; 102 return 0;
118 } 103 }
@@ -202,3 +187,41 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
202{ 187{
203 return 0; 188 return 0;
204} 189}
190
191
192/*
193 * Called on the exit path of event entry; see vm_entry.S
194 *
195 * Interrupts will already be disabled.
196 *
197 * Returns 0 if there's no need to re-check for more work.
198 */
199
200int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
201{
202 if (!(thread_info_flags & _TIF_WORK_MASK)) {
203 return 0;
204 } /* shortcut -- no work to be done */
205
206 local_irq_enable();
207
208 if (thread_info_flags & _TIF_NEED_RESCHED) {
209 schedule();
210 return 1;
211 }
212
213 if (thread_info_flags & _TIF_SIGPENDING) {
214 do_signal(regs);
215 return 1;
216 }
217
218 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
219 clear_thread_flag(TIF_NOTIFY_RESUME);
220 tracehook_notify_resume(regs);
221 return 1;
222 }
223
224 /* Should not even reach here */
225 panic("%s: bad thread_info flags 0x%08x\n", __func__,
226 thread_info_flags);
227}
diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c
index 670b1b0bee63..de829eb7f185 100644
--- a/arch/hexagon/kernel/ptrace.c
+++ b/arch/hexagon/kernel/ptrace.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Ptrace support for Hexagon 2 * Ptrace support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -32,6 +32,21 @@
32 32
33#include <asm/user.h> 33#include <asm/user.h>
34 34
35#if arch_has_single_step()
36/* Both called from ptrace_resume */
37void user_enable_single_step(struct task_struct *child)
38{
39 pt_set_singlestep(task_pt_regs(child));
40 set_tsk_thread_flag(child, TIF_SINGLESTEP);
41}
42
43void user_disable_single_step(struct task_struct *child)
44{
45 pt_clr_singlestep(task_pt_regs(child));
46 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
47}
48#endif
49
35static int genregs_get(struct task_struct *target, 50static int genregs_get(struct task_struct *target,
36 const struct user_regset *regset, 51 const struct user_regset *regset,
37 unsigned int pos, unsigned int count, 52 unsigned int pos, unsigned int count,
@@ -76,6 +91,10 @@ static int genregs_get(struct task_struct *target,
76 dummy = pt_cause(regs); 91 dummy = pt_cause(regs);
77 ONEXT(&dummy, cause); 92 ONEXT(&dummy, cause);
78 ONEXT(&pt_badva(regs), badva); 93 ONEXT(&pt_badva(regs), badva);
94#if CONFIG_HEXAGON_ARCH_VERSION >=4
95 ONEXT(&regs->cs0, cs0);
96 ONEXT(&regs->cs1, cs1);
97#endif
79 98
80 /* Pad the rest with zeros, if needed */ 99 /* Pad the rest with zeros, if needed */
81 if (!ret) 100 if (!ret)
@@ -123,6 +142,11 @@ static int genregs_set(struct task_struct *target,
123 INEXT(&bucket, cause); 142 INEXT(&bucket, cause);
124 INEXT(&bucket, badva); 143 INEXT(&bucket, badva);
125 144
145#if CONFIG_HEXAGON_ARCH_VERSION >=4
146 INEXT(&regs->cs0, cs0);
147 INEXT(&regs->cs1, cs1);
148#endif
149
126 /* Ignore the rest, if needed */ 150 /* Ignore the rest, if needed */
127 if (!ret) 151 if (!ret)
128 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 152 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index 94a387835008..bfe13311d70d 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Arch related setup for Hexagon 2 * Arch related setup for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -68,6 +68,8 @@ void __init setup_arch(char **cmdline_p)
68 */ 68 */
69 __vmsetvec(_K_VM_event_vector); 69 __vmsetvec(_K_VM_event_vector);
70 70
71 printk(KERN_INFO "PHYS_OFFSET=0x%08x\n", PHYS_OFFSET);
72
71 /* 73 /*
72 * Simulator has a few differences from the hardware. 74 * Simulator has a few differences from the hardware.
73 * For now, check uninitialized-but-mapped memory 75 * For now, check uninitialized-but-mapped memory
@@ -128,6 +130,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
128{ 130{
129 int cpu = (unsigned long) v - 1; 131 int cpu = (unsigned long) v - 1;
130 132
133#ifdef CONFIG_SMP
134 if (!cpu_online(cpu))
135 return 0;
136#endif
137
131 seq_printf(m, "processor\t: %d\n", cpu); 138 seq_printf(m, "processor\t: %d\n", cpu);
132 seq_printf(m, "model name\t: Hexagon Virtual Machine\n"); 139 seq_printf(m, "model name\t: Hexagon Virtual Machine\n");
133 seq_printf(m, "BogoMips\t: %lu.%02lu\n", 140 seq_printf(m, "BogoMips\t: %lu.%02lu\n",
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c
index 60fa2ca3202b..d7c73874b515 100644
--- a/arch/hexagon/kernel/signal.c
+++ b/arch/hexagon/kernel/signal.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Signal support for Hexagon processor 2 * Signal support for Hexagon processor
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -41,6 +41,10 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
41{ 41{
42 unsigned long sp = regs->r29; 42 unsigned long sp = regs->r29;
43 43
44 /* check if we would overflow the alt stack */
45 if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size)))
46 return (void __user __force *)-1UL;
47
44 /* Switch to signal stack if appropriate */ 48 /* Switch to signal stack if appropriate */
45 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0)) 49 if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags(sp) == 0))
46 sp = current->sas_ss_sp + current->sas_ss_size; 50 sp = current->sas_ss_sp + current->sas_ss_size;
@@ -66,7 +70,10 @@ static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
66 err |= __put_user(regs->preds, &sc->sc_regs.p3_0); 70 err |= __put_user(regs->preds, &sc->sc_regs.p3_0);
67 err |= __put_user(regs->gp, &sc->sc_regs.gp); 71 err |= __put_user(regs->gp, &sc->sc_regs.gp);
68 err |= __put_user(regs->ugp, &sc->sc_regs.ugp); 72 err |= __put_user(regs->ugp, &sc->sc_regs.ugp);
69 73#if CONFIG_HEXAGON_ARCH_VERSION >= 4
74 err |= __put_user(regs->cs0, &sc->sc_regs.cs0);
75 err |= __put_user(regs->cs1, &sc->sc_regs.cs1);
76#endif
70 tmp = pt_elr(regs); err |= __put_user(tmp, &sc->sc_regs.pc); 77 tmp = pt_elr(regs); err |= __put_user(tmp, &sc->sc_regs.pc);
71 tmp = pt_cause(regs); err |= __put_user(tmp, &sc->sc_regs.cause); 78 tmp = pt_cause(regs); err |= __put_user(tmp, &sc->sc_regs.cause);
72 tmp = pt_badva(regs); err |= __put_user(tmp, &sc->sc_regs.badva); 79 tmp = pt_badva(regs); err |= __put_user(tmp, &sc->sc_regs.badva);
@@ -93,7 +100,10 @@ static int restore_sigcontext(struct pt_regs *regs,
93 err |= __get_user(regs->preds, &sc->sc_regs.p3_0); 100 err |= __get_user(regs->preds, &sc->sc_regs.p3_0);
94 err |= __get_user(regs->gp, &sc->sc_regs.gp); 101 err |= __get_user(regs->gp, &sc->sc_regs.gp);
95 err |= __get_user(regs->ugp, &sc->sc_regs.ugp); 102 err |= __get_user(regs->ugp, &sc->sc_regs.ugp);
96 103#if CONFIG_HEXAGON_ARCH_VERSION >= 4
104 err |= __get_user(regs->cs0, &sc->sc_regs.cs0);
105 err |= __get_user(regs->cs1, &sc->sc_regs.cs1);
106#endif
97 err |= __get_user(tmp, &sc->sc_regs.pc); pt_set_elr(regs, tmp); 107 err |= __get_user(tmp, &sc->sc_regs.pc); pt_set_elr(regs, tmp);
98 108
99 return err; 109 return err;
@@ -193,7 +203,7 @@ static void handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
193/* 203/*
194 * Called from return-from-event code. 204 * Called from return-from-event code.
195 */ 205 */
196static void do_signal(struct pt_regs *regs) 206void do_signal(struct pt_regs *regs)
197{ 207{
198 struct k_sigaction sigact; 208 struct k_sigaction sigact;
199 siginfo_t info; 209 siginfo_t info;
@@ -210,8 +220,9 @@ static void do_signal(struct pt_regs *regs)
210 } 220 }
211 221
212 /* 222 /*
213 * If we came from a system call, handle the restart. 223 * No (more) signals; if we came from a system call, handle the restart.
214 */ 224 */
225
215 if (regs->syscall_nr >= 0) { 226 if (regs->syscall_nr >= 0) {
216 switch (regs->r00) { 227 switch (regs->r00) {
217 case -ERESTARTNOHAND: 228 case -ERESTARTNOHAND:
@@ -234,17 +245,6 @@ no_restart:
234 restore_saved_sigmask(); 245 restore_saved_sigmask();
235} 246}
236 247
237void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
238{
239 if (thread_info_flags & _TIF_SIGPENDING)
240 do_signal(regs);
241
242 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
243 clear_thread_flag(TIF_NOTIFY_RESUME);
244 tracehook_notify_resume(regs);
245 }
246}
247
248/* 248/*
249 * Architecture-specific wrappers for signal-related system calls 249 * Architecture-specific wrappers for signal-related system calls
250 */ 250 */
@@ -272,21 +272,12 @@ asmlinkage int sys_rt_sigreturn(void)
272 /* Restore the user's stack as well */ 272 /* Restore the user's stack as well */
273 pt_psp(regs) = regs->r29; 273 pt_psp(regs) = regs->r29;
274 274
275 /* 275 regs->syscall_nr = -1;
276 * Leave a trace in the stack frame that this was a sigreturn.
277 * If the system call is to replay, we've already restored the
278 * number in the GPR slot and it will be regenerated on the
279 * new system call trap entry. Note that if restore_sigcontext()
280 * did something other than a bulk copy of the pt_regs struct,
281 * we could avoid this assignment by simply not overwriting
282 * regs->syscall_nr.
283 */
284 regs->syscall_nr = __NR_rt_sigreturn;
285 276
286 if (restore_altstack(&frame->uc.uc_stack)) 277 if (restore_altstack(&frame->uc.uc_stack))
287 goto badframe; 278 goto badframe;
288 279
289 return 0; 280 return regs->r00;
290 281
291badframe: 282badframe:
292 force_sig(SIGSEGV, current); 283 force_sig(SIGSEGV, current);
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c
index 8e095dffd070..0e364ca43198 100644
--- a/arch/hexagon/kernel/smp.c
+++ b/arch/hexagon/kernel/smp.c
@@ -184,7 +184,7 @@ void __cpuinit start_secondary(void)
184 184
185 local_irq_enable(); 185 local_irq_enable();
186 186
187 cpu_idle(); 187 cpu_startup_entry(CPUHP_ONLINE);
188} 188}
189 189
190 190
diff --git a/arch/hexagon/kernel/topology.c b/arch/hexagon/kernel/topology.c
deleted file mode 100644
index 352f27e809fd..000000000000
--- a/arch/hexagon/kernel/topology.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * CPU topology for Hexagon
3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
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 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#include <linux/cpu.h>
22#include <linux/cpumask.h>
23#include <linux/init.h>
24#include <linux/node.h>
25#include <linux/nodemask.h>
26#include <linux/percpu.h>
27
28/* Swiped from MIPS. */
29
30static DEFINE_PER_CPU(struct cpu, cpu_devices);
31
32static int __init topology_init(void)
33{
34 int i, ret;
35
36 for_each_present_cpu(i) {
37
38 /*
39 * register_cpu takes a per_cpu pointer and
40 * just points it at another per_cpu struct...
41 */
42
43 ret = register_cpu(&per_cpu(cpu_devices, i), i);
44 if (ret)
45 printk(KERN_WARNING "topology_init: register_cpu %d "
46 "failed (%d)\n", i, ret);
47 }
48
49 return 0;
50}
51
52subsys_initcall(topology_init);
diff --git a/arch/hexagon/kernel/traps.c b/arch/hexagon/kernel/traps.c
index be5e2dd9c9d3..7858663352b9 100644
--- a/arch/hexagon/kernel/traps.c
+++ b/arch/hexagon/kernel/traps.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Kernel traps/events for Hexagon processor 2 * Kernel traps/events for Hexagon processor
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -65,6 +65,10 @@ static const char *ex_name(int ex)
65 return "Write protection fault"; 65 return "Write protection fault";
66 case HVM_GE_C_XMAL: 66 case HVM_GE_C_XMAL:
67 return "Misaligned instruction"; 67 return "Misaligned instruction";
68 case HVM_GE_C_WREG:
69 return "Multiple writes to same register in packet";
70 case HVM_GE_C_PCAL:
71 return "Program counter values that are not properly aligned";
68 case HVM_GE_C_RMAL: 72 case HVM_GE_C_RMAL:
69 return "Misaligned data load"; 73 return "Misaligned data load";
70 case HVM_GE_C_WMAL: 74 case HVM_GE_C_WMAL:
@@ -191,14 +195,6 @@ void show_stack(struct task_struct *task, unsigned long *fp)
191 do_show_stack(task, fp, 0); 195 do_show_stack(task, fp, 0);
192} 196}
193 197
194void dump_stack(void)
195{
196 unsigned long *fp;
197 asm("%0 = r30" : "=r" (fp));
198 show_stack(current, fp);
199}
200EXPORT_SYMBOL(dump_stack);
201
202int die(const char *str, struct pt_regs *regs, long err) 198int die(const char *str, struct pt_regs *regs, long err)
203{ 199{
204 static struct { 200 static struct {
@@ -324,6 +320,12 @@ void do_genex(struct pt_regs *regs)
324 case HVM_GE_C_XMAL: 320 case HVM_GE_C_XMAL:
325 misaligned_instruction(regs); 321 misaligned_instruction(regs);
326 break; 322 break;
323 case HVM_GE_C_WREG:
324 illegal_instruction(regs);
325 break;
326 case HVM_GE_C_PCAL:
327 misaligned_instruction(regs);
328 break;
327 case HVM_GE_C_RMAL: 329 case HVM_GE_C_RMAL:
328 misaligned_data_load(regs); 330 misaligned_data_load(regs);
329 break; 331 break;
@@ -356,7 +358,6 @@ long sys_syscall(void)
356 358
357void do_trap0(struct pt_regs *regs) 359void do_trap0(struct pt_regs *regs)
358{ 360{
359 unsigned long syscallret = 0;
360 syscall_fn syscall; 361 syscall_fn syscall;
361 362
362 switch (pt_cause(regs)) { 363 switch (pt_cause(regs)) {
@@ -396,21 +397,11 @@ void do_trap0(struct pt_regs *regs)
396 } else { 397 } else {
397 syscall = (syscall_fn) 398 syscall = (syscall_fn)
398 (sys_call_table[regs->syscall_nr]); 399 (sys_call_table[regs->syscall_nr]);
399 syscallret = syscall(regs->r00, regs->r01, 400 regs->r00 = syscall(regs->r00, regs->r01,
400 regs->r02, regs->r03, 401 regs->r02, regs->r03,
401 regs->r04, regs->r05); 402 regs->r04, regs->r05);
402 } 403 }
403 404
404 /*
405 * If it was a sigreturn system call, don't overwrite
406 * r0 value in stack frame with return value.
407 *
408 * __NR_sigreturn doesn't seem to exist in new unistd.h
409 */
410
411 if (regs->syscall_nr != __NR_rt_sigreturn)
412 regs->r00 = syscallret;
413
414 /* allow strace to get the syscall return state */ 405 /* allow strace to get the syscall return state */
415 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACE))) 406 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACE)))
416 tracehook_report_syscall_exit(regs, 0); 407 tracehook_report_syscall_exit(regs, 0);
@@ -452,3 +443,14 @@ void do_machcheck(struct pt_regs *regs)
452 /* Halt and catch fire */ 443 /* Halt and catch fire */
453 __vmstop(); 444 __vmstop();
454} 445}
446
447/*
448 * Treat this like the old 0xdb trap.
449 */
450
451void do_debug_exception(struct pt_regs *regs)
452{
453 regs->hvmer.vmest &= ~HVM_VMEST_CAUSE_MSK;
454 regs->hvmer.vmest |= (TRAP_DEBUG << HVM_VMEST_CAUSE_SFT);
455 do_trap0(regs);
456}
diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S
index 425e50c694f7..e3086185fc9f 100644
--- a/arch/hexagon/kernel/vm_entry.S
+++ b/arch/hexagon/kernel/vm_entry.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Event entry/exit for Hexagon 2 * Event entry/exit for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -45,48 +45,88 @@
45 * number in the case where we decode a system call (trap0(#1)). 45 * number in the case where we decode a system call (trap0(#1)).
46 */ 46 */
47 47
48#if CONFIG_HEXAGON_ARCH_VERSION < 4
48#define save_pt_regs()\ 49#define save_pt_regs()\
49 memd(R0 + #_PT_R3130) = R31:30; \ 50 memd(R0 + #_PT_R3130) = R31:30; \
51 { memw(R0 + #_PT_R2928) = R28; \
52 R31 = memw(R0 + #_PT_ER_VMPSP); }\
53 { memw(R0 + #(_PT_R2928 + 4)) = R31; \
54 R31 = ugp; } \
55 { memd(R0 + #_PT_R2726) = R27:26; \
56 R30 = gp ; } \
57 memd(R0 + #_PT_R2524) = R25:24; \
58 memd(R0 + #_PT_R2322) = R23:22; \
59 memd(R0 + #_PT_R2120) = R21:20; \
60 memd(R0 + #_PT_R1918) = R19:18; \
61 memd(R0 + #_PT_R1716) = R17:16; \
62 memd(R0 + #_PT_R1514) = R15:14; \
63 memd(R0 + #_PT_R1312) = R13:12; \
64 { memd(R0 + #_PT_R1110) = R11:10; \
65 R15 = lc0; } \
66 { memd(R0 + #_PT_R0908) = R9:8; \
67 R14 = sa0; } \
68 { memd(R0 + #_PT_R0706) = R7:6; \
69 R13 = lc1; } \
70 { memd(R0 + #_PT_R0504) = R5:4; \
71 R12 = sa1; } \
72 { memd(R0 + #_PT_GPUGP) = R31:30; \
73 R11 = m1; \
74 R2.H = #HI(_THREAD_SIZE); } \
75 { memd(R0 + #_PT_LC0SA0) = R15:14; \
76 R10 = m0; \
77 R2.L = #LO(_THREAD_SIZE); } \
78 { memd(R0 + #_PT_LC1SA1) = R13:12; \
79 R15 = p3:0; \
80 R2 = neg(R2); } \
81 { memd(R0 + #_PT_M1M0) = R11:10; \
82 R14 = usr; \
83 R2 = and(R0,R2); } \
84 { memd(R0 + #_PT_PREDSUSR) = R15:14; \
85 THREADINFO_REG = R2; } \
86 { r24 = memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS); \
87 memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R0; \
88 R2 = #-1; } \
89 { memw(R0 + #_PT_SYSCALL_NR) = R2; \
90 R30 = #0; }
91#else
92/* V4+ */
93/* the # ## # syntax inserts a literal ## */
94#define save_pt_regs()\
95 { memd(R0 + #_PT_R3130) = R31:30; \
96 R30 = memw(R0 + #_PT_ER_VMPSP); }\
50 { memw(R0 + #_PT_R2928) = R28; \ 97 { memw(R0 + #_PT_R2928) = R28; \
51 R31 = memw(R0 + #_PT_ER_VMPSP); }\ 98 memw(R0 + #(_PT_R2928 + 4)) = R30; }\
52 { memw(R0 + #(_PT_R2928 + 4)) = R31; \ 99 { R31:30 = C11:10; \
53 R31 = ugp; } \ 100 memd(R0 + #_PT_R2726) = R27:26; \
54 { memd(R0 + #_PT_R2726) = R27:26; \ 101 memd(R0 + #_PT_R2524) = R25:24; }\
55 R30 = gp ; } \ 102 { memd(R0 + #_PT_R2322) = R23:22; \
56 memd(R0 + #_PT_R2524) = R25:24; \ 103 memd(R0 + #_PT_R2120) = R21:20; }\
57 memd(R0 + #_PT_R2322) = R23:22; \ 104 { memd(R0 + #_PT_R1918) = R19:18; \
58 memd(R0 + #_PT_R2120) = R21:20; \ 105 memd(R0 + #_PT_R1716) = R17:16; }\
59 memd(R0 + #_PT_R1918) = R19:18; \ 106 { memd(R0 + #_PT_R1514) = R15:14; \
60 memd(R0 + #_PT_R1716) = R17:16; \ 107 memd(R0 + #_PT_R1312) = R13:12; \
61 memd(R0 + #_PT_R1514) = R15:14; \ 108 R17:16 = C13:12; }\
62 memd(R0 + #_PT_R1312) = R13:12; \
63 { memd(R0 + #_PT_R1110) = R11:10; \ 109 { memd(R0 + #_PT_R1110) = R11:10; \
64 R15 = lc0; } \ 110 memd(R0 + #_PT_R0908) = R9:8; \
65 { memd(R0 + #_PT_R0908) = R9:8; \ 111 R15:14 = C1:0; } \
66 R14 = sa0; } \
67 { memd(R0 + #_PT_R0706) = R7:6; \ 112 { memd(R0 + #_PT_R0706) = R7:6; \
68 R13 = lc1; } \ 113 memd(R0 + #_PT_R0504) = R5:4; \
69 { memd(R0 + #_PT_R0504) = R5:4; \ 114 R13:12 = C3:2; } \
70 R12 = sa1; } \ 115 { memd(R0 + #_PT_GPUGP) = R31:30; \
71 { memd(R0 + #_PT_UGPGP) = R31:30; \ 116 memd(R0 + #_PT_LC0SA0) = R15:14; \
72 R11 = m1; \ 117 R11:10 = C7:6; }\
73 R2.H = #HI(_THREAD_SIZE); } \ 118 { THREADINFO_REG = and(R0, # ## #-_THREAD_SIZE); \
74 { memd(R0 + #_PT_LC0SA0) = R15:14; \ 119 memd(R0 + #_PT_LC1SA1) = R13:12; \
75 R10 = m0; \ 120 R15 = p3:0; }\
76 R2.L = #LO(_THREAD_SIZE); } \
77 { memd(R0 + #_PT_LC1SA1) = R13:12; \
78 R15 = p3:0; \
79 R2 = neg(R2); } \
80 { memd(R0 + #_PT_M1M0) = R11:10; \ 121 { memd(R0 + #_PT_M1M0) = R11:10; \
81 R14 = usr; \ 122 memw(R0 + #_PT_PREDSUSR + 4) = R15; }\
82 R2 = and(R0,R2); } \
83 { memd(R0 + #_PT_PREDSUSR) = R15:14; \
84 THREADINFO_REG = R2; } \
85 { r24 = memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS); \ 123 { r24 = memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS); \
86 memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R0; \ 124 memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R0; \
87 R2 = #-1; } \ 125 R2 = #-1; } \
88 { memw(R0 + #_PT_SYSCALL_NR) = R2; \ 126 { memw(R0 + #_PT_SYSCALL_NR) = R2; \
127 memd(R0 + #_PT_CS1CS0) = R17:16; \
89 R30 = #0; } 128 R30 = #0; }
129#endif
90 130
91/* 131/*
92 * Restore registers and thread_info.regs state. THREADINFO_REG 132 * Restore registers and thread_info.regs state. THREADINFO_REG
@@ -94,6 +134,7 @@
94 * preserved. Don't restore R29 (SP) until later. 134 * preserved. Don't restore R29 (SP) until later.
95 */ 135 */
96 136
137#if CONFIG_HEXAGON_ARCH_VERSION < 4
97#define restore_pt_regs() \ 138#define restore_pt_regs() \
98 { memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R24; \ 139 { memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R24; \
99 R15:14 = memd(R0 + #_PT_PREDSUSR); } \ 140 R15:14 = memd(R0 + #_PT_PREDSUSR); } \
@@ -121,11 +162,44 @@
121 R23:22 = memd(R0 + #_PT_R2322); } \ 162 R23:22 = memd(R0 + #_PT_R2322); } \
122 { R25:24 = memd(R0 + #_PT_R2524); \ 163 { R25:24 = memd(R0 + #_PT_R2524); \
123 R27:26 = memd(R0 + #_PT_R2726); } \ 164 R27:26 = memd(R0 + #_PT_R2726); } \
124 R31:30 = memd(R0 + #_PT_UGPGP); \ 165 R31:30 = memd(R0 + #_PT_GPUGP); \
125 { R28 = memw(R0 + #_PT_R2928); \ 166 { R28 = memw(R0 + #_PT_R2928); \
126 ugp = R31; } \ 167 ugp = R31; } \
127 { R31:30 = memd(R0 + #_PT_R3130); \ 168 { R31:30 = memd(R0 + #_PT_R3130); \
128 gp = R30; } 169 gp = R30; }
170#else
171/* V4+ */
172#define restore_pt_regs() \
173 { memw(THREADINFO_REG + #_THREAD_INFO_PT_REGS) = R24; \
174 R15:14 = memd(R0 + #_PT_PREDSUSR); } \
175 { R11:10 = memd(R0 + #_PT_M1M0); \
176 R13:12 = memd(R0 + #_PT_LC1SA1); \
177 p3:0 = R15; } \
178 { R15:14 = memd(R0 + #_PT_LC0SA0); \
179 R3:2 = memd(R0 + #_PT_R0302); \
180 usr = R14; } \
181 { R5:4 = memd(R0 + #_PT_R0504); \
182 R7:6 = memd(R0 + #_PT_R0706); \
183 C7:6 = R11:10; }\
184 { R9:8 = memd(R0 + #_PT_R0908); \
185 R11:10 = memd(R0 + #_PT_R1110); \
186 C3:2 = R13:12; }\
187 { R13:12 = memd(R0 + #_PT_R1312); \
188 R15:14 = memd(R0 + #_PT_R1514); \
189 C1:0 = R15:14; }\
190 { R17:16 = memd(R0 + #_PT_R1716); \
191 R19:18 = memd(R0 + #_PT_R1918); } \
192 { R21:20 = memd(R0 + #_PT_R2120); \
193 R23:22 = memd(R0 + #_PT_R2322); } \
194 { R25:24 = memd(R0 + #_PT_R2524); \
195 R27:26 = memd(R0 + #_PT_R2726); } \
196 R31:30 = memd(R0 + #_PT_CS1CS0); \
197 { C13:12 = R31:30; \
198 R31:30 = memd(R0 + #_PT_GPUGP) ; \
199 R28 = memw(R0 + #_PT_R2928); }\
200 { C11:10 = R31:30; \
201 R31:30 = memd(R0 + #_PT_R3130); }
202#endif
129 203
130 /* 204 /*
131 * Clears off enough space for the rest of pt_regs; evrec is a part 205 * Clears off enough space for the rest of pt_regs; evrec is a part
@@ -139,6 +213,7 @@
139 * Need to save off R0, R1, R2, R3 immediately. 213 * Need to save off R0, R1, R2, R3 immediately.
140 */ 214 */
141 215
216#if CONFIG_HEXAGON_ARCH_VERSION < 4
142#define vm_event_entry(CHandler) \ 217#define vm_event_entry(CHandler) \
143 { \ 218 { \
144 R29 = add(R29, #-(_PT_REGS_SIZE)); \ 219 R29 = add(R29, #-(_PT_REGS_SIZE)); \
@@ -158,6 +233,34 @@
158 R1.H = #HI(CHandler); \ 233 R1.H = #HI(CHandler); \
159 jump event_dispatch; \ 234 jump event_dispatch; \
160 } 235 }
236#else
237/* V4+ */
238/* turn on I$ prefetch early */
239/* the # ## # syntax inserts a literal ## */
240#define vm_event_entry(CHandler) \
241 { \
242 R29 = add(R29, #-(_PT_REGS_SIZE)); \
243 memd(R29 + #(_PT_R0100 + -_PT_REGS_SIZE)) = R1:0; \
244 memd(R29 + #(_PT_R0302 + -_PT_REGS_SIZE)) = R3:2; \
245 R0 = usr; \
246 } \
247 { \
248 memw(R29 + #_PT_PREDSUSR) = R0; \
249 R0 = setbit(R0, #16); \
250 } \
251 usr = R0; \
252 R1:0 = G1:0; \
253 { \
254 memd(R29 + #_PT_ER_VMEL) = R1:0; \
255 R1 = # ## #(CHandler); \
256 R3:2 = G3:2; \
257 } \
258 { \
259 R0 = R29; \
260 memd(R29 + #_PT_ER_VMPSP) = R3:2; \
261 jump event_dispatch; \
262 }
263#endif
161 264
162.text 265.text
163 /* 266 /*
@@ -171,6 +274,9 @@ event_dispatch:
171 callr r1 274 callr r1
172 275
173 /* 276 /*
277 * Coming back from the C-world, our thread info pointer
278 * should be in the designated register (usually R19)
279 *
174 * If we were in kernel mode, we don't need to check scheduler 280 * If we were in kernel mode, we don't need to check scheduler
175 * or signals if CONFIG_PREEMPT is not set. If set, then it has 281 * or signals if CONFIG_PREEMPT is not set. If set, then it has
176 * to jump to a need_resched kind of block. 282 * to jump to a need_resched kind of block.
@@ -183,69 +289,68 @@ event_dispatch:
183#endif 289#endif
184 290
185 /* "Nested control path" -- if the previous mode was kernel */ 291 /* "Nested control path" -- if the previous mode was kernel */
186 R0 = memw(R29 + #_PT_ER_VMEST);
187 P0 = tstbit(R0, #HVM_VMEST_UM_SFT);
188 if !P0 jump restore_all;
189 /*
190 * Returning from system call, normally coming back from user mode
191 */
192return_from_syscall:
193 /* Disable interrupts while checking TIF */
194 R0 = #VM_INT_DISABLE
195 trap1(#HVM_TRAP1_VMSETIE)
196
197 /*
198 * Coming back from the C-world, our thread info pointer
199 * should be in the designated register (usually R19)
200 */
201 R1.L = #LO(_TIF_ALLWORK_MASK)
202 { 292 {
203 R1.H = #HI(_TIF_ALLWORK_MASK); 293 R0 = memw(R29 + #_PT_ER_VMEST);
204 R0 = memw(THREADINFO_REG + #_THREAD_INFO_FLAGS); 294 R16.L = #LO(do_work_pending);
295 }
296 {
297 P0 = tstbit(R0, #HVM_VMEST_UM_SFT);
298 if (!P0.new) jump:nt restore_all;
299 R16.H = #HI(do_work_pending);
300 R0 = #VM_INT_DISABLE;
205 } 301 }
206 302
207 /* 303 /*
208 * Compare against the "return to userspace" _TIF_WORK_MASK 304 * Check also the return from fork/system call, normally coming back from
305 * user mode
306 *
307 * R16 needs to have do_work_pending, and R0 should have VM_INT_DISABLE
209 */ 308 */
210 R1 = and(R1,R0);
211 { P0 = cmp.eq(R1,#0); if (!P0.new) jump:t work_pending;}
212 jump restore_all; /* we're outta here! */
213 309
214work_pending: 310check_work_pending:
311 /* Disable interrupts while checking TIF */
312 trap1(#HVM_TRAP1_VMSETIE)
215 { 313 {
216 P0 = tstbit(R1, #TIF_NEED_RESCHED); 314 R0 = R29; /* regs should still be at top of stack */
217 if (!P0.new) jump:nt work_notifysig; 315 R1 = memw(THREADINFO_REG + #_THREAD_INFO_FLAGS);
316 callr R16;
218 } 317 }
219 call schedule
220 jump return_from_syscall; /* check for more work */
221 318
222work_notifysig: 319 {
223 /* this is the part that's kind of fuzzy. */ 320 P0 = cmp.eq(R0, #0); if (!P0.new) jump:nt check_work_pending;
224 R1 = and(R0, #(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME)); 321 R0 = #VM_INT_DISABLE;
225 P0 = cmp.eq(R1, #0); 322 }
226 if P0 jump restore_all
227 R1 = R0; /* unsigned long thread_info_flags */
228 R0 = R29; /* regs should still be at top of stack */
229 call do_notify_resume
230 323
231restore_all: 324restore_all:
232 /* Disable interrupts, if they weren't already, before reg restore. */ 325 /*
233 R0 = #VM_INT_DISABLE 326 * Disable interrupts, if they weren't already, before reg restore.
327 * R0 gets preloaded with #VM_INT_DISABLE before we get here.
328 */
234 trap1(#HVM_TRAP1_VMSETIE) 329 trap1(#HVM_TRAP1_VMSETIE)
235 330
236 /* do the setregs here for VM 0.5 */ 331 /* do the setregs here for VM 0.5 */
237 /* R29 here should already be pointing at pt_regs */ 332 /* R29 here should already be pointing at pt_regs */
238 R1:0 = memd(R29 + #_PT_ER_VMEL); 333 {
239 R3:2 = memd(R29 + #_PT_ER_VMPSP); 334 R1:0 = memd(R29 + #_PT_ER_VMEL);
335 R3:2 = memd(R29 + #_PT_ER_VMPSP);
336 }
337#if CONFIG_HEXAGON_ARCH_VERSION < 4
240 trap1(#HVM_TRAP1_VMSETREGS); 338 trap1(#HVM_TRAP1_VMSETREGS);
339#else
340 G1:0 = R1:0;
341 G3:2 = R3:2;
342#endif
241 343
242 R0 = R29 344 R0 = R29
243 restore_pt_regs() 345 restore_pt_regs()
244 R1:0 = memd(R29 + #_PT_R0100); 346 {
245 R29 = add(R29, #_PT_REGS_SIZE); 347 R1:0 = memd(R29 + #_PT_R0100);
348 R29 = add(R29, #_PT_REGS_SIZE);
349 }
246 trap1(#HVM_TRAP1_VMRTE) 350 trap1(#HVM_TRAP1_VMRTE)
247 /* Notreached */ 351 /* Notreached */
248 352
353
249 .globl _K_enter_genex 354 .globl _K_enter_genex
250_K_enter_genex: 355_K_enter_genex:
251 vm_event_entry(do_genex) 356 vm_event_entry(do_genex)
@@ -262,12 +367,27 @@ _K_enter_trap0:
262_K_enter_machcheck: 367_K_enter_machcheck:
263 vm_event_entry(do_machcheck) 368 vm_event_entry(do_machcheck)
264 369
370 .globl _K_enter_debug
371_K_enter_debug:
372 vm_event_entry(do_debug_exception)
265 373
266 .globl ret_from_fork 374 .globl ret_from_fork
267ret_from_fork: 375ret_from_fork:
268 call schedule_tail 376 {
269 P0 = cmp.eq(R24, #0); 377 call schedule_tail
270 if P0 jump return_from_syscall 378 R16.H = #HI(do_work_pending);
271 R0 = R25; 379 }
272 callr R24 380 {
273 jump return_from_syscall 381 P0 = cmp.eq(R24, #0);
382 R16.L = #LO(do_work_pending);
383 R0 = #VM_INT_DISABLE;
384 }
385 if P0 jump check_work_pending
386 {
387 R0 = R25;
388 callr R24
389 }
390 {
391 jump check_work_pending
392 R0 = #VM_INT_DISABLE;
393 }
diff --git a/arch/hexagon/kernel/vm_events.c b/arch/hexagon/kernel/vm_events.c
index 9b5a4a295a68..741aaa917cda 100644
--- a/arch/hexagon/kernel/vm_events.c
+++ b/arch/hexagon/kernel/vm_events.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Mostly IRQ support for Hexagon 2 * Mostly IRQ support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -33,6 +33,8 @@
33 */ 33 */
34void show_regs(struct pt_regs *regs) 34void show_regs(struct pt_regs *regs)
35{ 35{
36 show_regs_print_info(KERN_EMERG);
37
36 printk(KERN_EMERG "restart_r0: \t0x%08lx syscall_nr: %ld\n", 38 printk(KERN_EMERG "restart_r0: \t0x%08lx syscall_nr: %ld\n",
37 regs->restart_r0, regs->syscall_nr); 39 regs->restart_r0, regs->syscall_nr);
38 printk(KERN_EMERG "preds: \t\t0x%08lx\n", regs->preds); 40 printk(KERN_EMERG "preds: \t\t0x%08lx\n", regs->preds);
@@ -42,6 +44,8 @@ void show_regs(struct pt_regs *regs)
42 regs->lc1, regs->sa1, regs->m1); 44 regs->lc1, regs->sa1, regs->m1);
43 printk(KERN_EMERG "gp: \t0x%08lx ugp: 0x%08lx usr: 0x%08lx\n", 45 printk(KERN_EMERG "gp: \t0x%08lx ugp: 0x%08lx usr: 0x%08lx\n",
44 regs->gp, regs->ugp, regs->usr); 46 regs->gp, regs->ugp, regs->usr);
47 printk(KERN_EMERG "cs0: \t0x%08lx cs1: 0x%08lx\n",
48 regs->cs0, regs->cs1);
45 printk(KERN_EMERG "r0: \t0x%08lx %08lx %08lx %08lx\n", regs->r00, 49 printk(KERN_EMERG "r0: \t0x%08lx %08lx %08lx %08lx\n", regs->r00,
46 regs->r01, 50 regs->r01,
47 regs->r02, 51 regs->r02,
diff --git a/arch/hexagon/kernel/vm_vectors.S b/arch/hexagon/kernel/vm_vectors.S
index 620f42cc582a..791a7422dde4 100644
--- a/arch/hexagon/kernel/vm_vectors.S
+++ b/arch/hexagon/kernel/vm_vectors.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Event jump tables 2 * Event jump tables
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2012,2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -41,7 +41,7 @@ _K_VM_event_vector:
41 jump 1b; /* Reset */ 41 jump 1b; /* Reset */
42 jump _K_enter_machcheck; 42 jump _K_enter_machcheck;
43 jump _K_enter_genex; 43 jump _K_enter_genex;
44 jump 1b; /* 3 Rsvd */ 44 jump _K_enter_debug;
45 jump 1b; /* 4 Rsvd */ 45 jump 1b; /* 4 Rsvd */
46 jump _K_enter_trap0; 46 jump _K_enter_trap0;
47 jump 1b; /* 6 Rsvd */ 47 jump 1b; /* 6 Rsvd */
diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S
index 14e793f6abbf..44d8c47bae2f 100644
--- a/arch/hexagon/kernel/vmlinux.lds.S
+++ b/arch/hexagon/kernel/vmlinux.lds.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Linker script for Hexagon kernel 2 * Linker script for Hexagon kernel
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -18,8 +18,6 @@
18 * 02110-1301, USA. 18 * 02110-1301, USA.
19 */ 19 */
20 20
21#define LOAD_OFFSET PAGE_OFFSET
22
23#include <asm-generic/vmlinux.lds.h> 21#include <asm-generic/vmlinux.lds.h>
24#include <asm/asm-offsets.h> /* Most of the kernel defines are here */ 22#include <asm/asm-offsets.h> /* Most of the kernel defines are here */
25#include <asm/mem-layout.h> /* except for page_offset */ 23#include <asm/mem-layout.h> /* except for page_offset */
@@ -36,13 +34,9 @@ See asm-generic/sections.h for seemingly required labels.
36 34
37#define PAGE_SIZE _PAGE_SIZE 35#define PAGE_SIZE _PAGE_SIZE
38 36
39/* This LOAD_OFFSET is temporary for debugging on the simulator; it may change
40 for hypervisor pseudo-physical memory. */
41
42
43SECTIONS 37SECTIONS
44{ 38{
45 . = PAGE_OFFSET + LOAD_ADDRESS; 39 . = PAGE_OFFSET;
46 40
47 __init_begin = .; 41 __init_begin = .;
48 HEAD_TEXT_SECTION 42 HEAD_TEXT_SECTION
@@ -52,7 +46,7 @@ SECTIONS
52 46
53 . = ALIGN(_PAGE_SIZE); 47 . = ALIGN(_PAGE_SIZE);
54 _stext = .; 48 _stext = .;
55 .text : AT(ADDR(.text) - LOAD_OFFSET) { 49 .text : AT(ADDR(.text)) {
56 _text = .; 50 _text = .;
57 TEXT_TEXT 51 TEXT_TEXT
58 SCHED_TEXT 52 SCHED_TEXT
diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c
index 69ffcfd28794..2561d259a296 100644
--- a/arch/hexagon/mm/init.c
+++ b/arch/hexagon/mm/init.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Memory subsystem initialization for Hexagon 2 * Memory subsystem initialization for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -31,9 +31,10 @@
31 * Define a startpg just past the end of the kernel image and a lastpg 31 * Define a startpg just past the end of the kernel image and a lastpg
32 * that corresponds to the end of real or simulated platform memory. 32 * that corresponds to the end of real or simulated platform memory.
33 */ 33 */
34#define bootmem_startpg (PFN_UP(((unsigned long) _end) - PAGE_OFFSET)) 34#define bootmem_startpg (PFN_UP(((unsigned long) _end) - PAGE_OFFSET + PHYS_OFFSET))
35 35
36unsigned long bootmem_lastpg; /* Should be set by platform code */ 36unsigned long bootmem_lastpg; /* Should be set by platform code */
37unsigned long __phys_offset; /* physical kernel offset >> 12 */
37 38
38/* Set as variable to limit PMD copies */ 39/* Set as variable to limit PMD copies */
39int max_kernel_seg = 0x303; 40int max_kernel_seg = 0x303;
@@ -44,7 +45,6 @@ unsigned long zero_page_mask;
44/* indicate pfn's of high memory */ 45/* indicate pfn's of high memory */
45unsigned long highstart_pfn, highend_pfn; 46unsigned long highstart_pfn, highend_pfn;
46 47
47/* struct mmu_gather defined in asm-generic.h; */
48DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 48DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
49 49
50/* Default cache attribute for newly created page tables */ 50/* Default cache attribute for newly created page tables */
@@ -71,7 +71,7 @@ void __init mem_init(void)
71{ 71{
72 /* No idea where this is actually declared. Seems to evade LXR. */ 72 /* No idea where this is actually declared. Seems to evade LXR. */
73 totalram_pages += free_all_bootmem(); 73 totalram_pages += free_all_bootmem();
74 num_physpages = bootmem_lastpg; /* seriously, what? */ 74 num_physpages = bootmem_lastpg-ARCH_PFN_OFFSET;
75 75
76 printk(KERN_INFO "totalram_pages = %ld\n", totalram_pages); 76 printk(KERN_INFO "totalram_pages = %ld\n", totalram_pages);
77 77
@@ -193,6 +193,9 @@ void __init setup_arch_memory(void)
193 * This needs to change for highmem setups. 193 * This needs to change for highmem setups.
194 */ 194 */
195 195
196 /* Prior to this, bootmem_lastpg is actually mem size */
197 bootmem_lastpg += ARCH_PFN_OFFSET;
198
196 /* Memory size needs to be a multiple of 16M */ 199 /* Memory size needs to be a multiple of 16M */
197 bootmem_lastpg = PFN_DOWN((bootmem_lastpg << PAGE_SHIFT) & 200 bootmem_lastpg = PFN_DOWN((bootmem_lastpg << PAGE_SHIFT) &
198 ~((BIG_KERNEL_PAGE_SIZE) - 1)); 201 ~((BIG_KERNEL_PAGE_SIZE) - 1));
@@ -201,12 +204,15 @@ void __init setup_arch_memory(void)
201 * Reserve the top DMA_RESERVE bytes of RAM for DMA (uncached) 204 * Reserve the top DMA_RESERVE bytes of RAM for DMA (uncached)
202 * memory allocation 205 * memory allocation
203 */ 206 */
204 bootmap_size = init_bootmem(bootmem_startpg, bootmem_lastpg - 207
205 PFN_DOWN(DMA_RESERVED_BYTES)); 208 max_low_pfn = bootmem_lastpg - PFN_DOWN(DMA_RESERVED_BYTES);
209 min_low_pfn = ARCH_PFN_OFFSET;
210 bootmap_size = init_bootmem_node(NODE_DATA(0), bootmem_startpg, min_low_pfn, max_low_pfn);
206 211
207 printk(KERN_INFO "bootmem_startpg: 0x%08lx\n", bootmem_startpg); 212 printk(KERN_INFO "bootmem_startpg: 0x%08lx\n", bootmem_startpg);
208 printk(KERN_INFO "bootmem_lastpg: 0x%08lx\n", bootmem_lastpg); 213 printk(KERN_INFO "bootmem_lastpg: 0x%08lx\n", bootmem_lastpg);
209 printk(KERN_INFO "bootmap_size: %d\n", bootmap_size); 214 printk(KERN_INFO "bootmap_size: %d\n", bootmap_size);
215 printk(KERN_INFO "min_low_pfn: 0x%08lx\n", min_low_pfn);
210 printk(KERN_INFO "max_low_pfn: 0x%08lx\n", max_low_pfn); 216 printk(KERN_INFO "max_low_pfn: 0x%08lx\n", max_low_pfn);
211 217
212 /* 218 /*
@@ -221,14 +227,17 @@ void __init setup_arch_memory(void)
221 /* this actually only goes to the end of the first gig */ 227 /* this actually only goes to the end of the first gig */
222 segtable_end = segtable + (1<<(30-22)); 228 segtable_end = segtable + (1<<(30-22));
223 229
224 /* Move forward to the start of empty pages */ 230 /*
225 segtable += bootmem_lastpg >> (22-PAGE_SHIFT); 231 * Move forward to the start of empty pages; take into account
232 * phys_offset shift.
233 */
226 234
235 segtable += (bootmem_lastpg-ARCH_PFN_OFFSET)>>(22-PAGE_SHIFT);
227 { 236 {
228 int i; 237 int i;
229 238
230 for (i = 1 ; i <= DMA_RESERVE ; i++) 239 for (i = 1 ; i <= DMA_RESERVE ; i++)
231 segtable[-i] = ((segtable[-i] & __HVM_PTE_PGMASK_4MB) 240 segtable[-i] = ((segtable[-i] & __HVM_PTE_PGMASK_4MB)
232 | __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X 241 | __HVM_PTE_R | __HVM_PTE_W | __HVM_PTE_X
233 | __HEXAGON_C_UNC << 6 242 | __HEXAGON_C_UNC << 6
234 | __HVM_PDE_S_4MB); 243 | __HVM_PDE_S_4MB);
@@ -256,7 +265,7 @@ void __init setup_arch_memory(void)
256 * Free all the memory that wasn't taken up by the bootmap, the DMA 265 * Free all the memory that wasn't taken up by the bootmap, the DMA
257 * reserve, or kernel itself. 266 * reserve, or kernel itself.
258 */ 267 */
259 free_bootmem(PFN_PHYS(bootmem_startpg)+bootmap_size, 268 free_bootmem(PFN_PHYS(bootmem_startpg) + bootmap_size,
260 PFN_PHYS(bootmem_lastpg - bootmem_startpg) - bootmap_size - 269 PFN_PHYS(bootmem_lastpg - bootmem_startpg) - bootmap_size -
261 DMA_RESERVED_BYTES); 270 DMA_RESERVED_BYTES);
262 271
diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c
index 308ef0ce648b..1bd276dbec7d 100644
--- a/arch/hexagon/mm/vm_fault.c
+++ b/arch/hexagon/mm/vm_fault.c
@@ -147,7 +147,7 @@ good_area:
147 } 147 }
148 info.si_errno = 0; 148 info.si_errno = 0;
149 info.si_addr = (void __user *)address; 149 info.si_addr = (void __user *)address;
150 force_sig_info(info.si_code, &info, current); 150 force_sig_info(info.si_signo, &info, current);
151 return; 151 return;
152 152
153bad_area: 153bad_area:
@@ -158,7 +158,7 @@ bad_area:
158 info.si_errno = 0; 158 info.si_errno = 0;
159 info.si_code = si_code; 159 info.si_code = si_code;
160 info.si_addr = (void *)address; 160 info.si_addr = (void *)address;
161 force_sig_info(SIGSEGV, &info, current); 161 force_sig_info(info.si_signo, &info, current);
162 return; 162 return;
163 } 163 }
164 /* Kernel-mode fault falls through */ 164 /* Kernel-mode fault falls through */
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 9a02f71c6b1f..d393f841ff5a 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -110,6 +110,7 @@ config DMI
110 110
111config EFI 111config EFI
112 bool 112 bool
113 select UCS2_STRING
113 default y 114 default y
114 115
115config SCHED_OMIT_FRAME_POINTER 116config SCHED_OMIT_FRAME_POINTER
@@ -187,7 +188,7 @@ config IA64_DIG
187 188
188config IA64_DIG_VTD 189config IA64_DIG_VTD
189 bool "DIG+Intel+IOMMU" 190 bool "DIG+Intel+IOMMU"
190 select DMAR 191 select INTEL_IOMMU
191 select PCI_MSI 192 select PCI_MSI
192 193
193config IA64_HP_ZX1 194config IA64_HP_ZX1
@@ -591,9 +592,9 @@ source "kernel/power/Kconfig"
591source "drivers/acpi/Kconfig" 592source "drivers/acpi/Kconfig"
592 593
593if PM 594if PM
594 595menu "CPU Frequency scaling"
595source "arch/ia64/kernel/cpufreq/Kconfig" 596source "drivers/cpufreq/Kconfig"
596 597endmenu
597endif 598endif
598 599
599endmenu 600endmenu
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index da2f319fb71d..e70cadec7ce6 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -142,8 +142,7 @@ static void transmit_chars(struct tty_struct *tty, struct serial_state *info,
142 goto out; 142 goto out;
143 } 143 }
144 144
145 if (info->xmit.head == info->xmit.tail || tty->stopped || 145 if (info->xmit.head == info->xmit.tail || tty->stopped) {
146 tty->hw_stopped) {
147#ifdef SIMSERIAL_DEBUG 146#ifdef SIMSERIAL_DEBUG
148 printk("transmit_chars: head=%d, tail=%d, stopped=%d\n", 147 printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
149 info->xmit.head, info->xmit.tail, tty->stopped); 148 info->xmit.head, info->xmit.tail, tty->stopped);
@@ -181,7 +180,7 @@ static void rs_flush_chars(struct tty_struct *tty)
181 struct serial_state *info = tty->driver_data; 180 struct serial_state *info = tty->driver_data;
182 181
183 if (info->xmit.head == info->xmit.tail || tty->stopped || 182 if (info->xmit.head == info->xmit.tail || tty->stopped ||
184 tty->hw_stopped || !info->xmit.buf) 183 !info->xmit.buf)
185 return; 184 return;
186 185
187 transmit_chars(tty, info, NULL); 186 transmit_chars(tty, info, NULL);
@@ -217,7 +216,7 @@ static int rs_write(struct tty_struct * tty,
217 * Hey, we transmit directly from here in our case 216 * Hey, we transmit directly from here in our case
218 */ 217 */
219 if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) && 218 if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) &&
220 !tty->stopped && !tty->hw_stopped) 219 !tty->stopped)
221 transmit_chars(tty, info, NULL); 220 transmit_chars(tty, info, NULL);
222 221
223 return ret; 222 return ret;
@@ -325,14 +324,6 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
325 324
326#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 325#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
327 326
328static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
329{
330 /* Handle turning off CRTSCTS */
331 if ((old_termios->c_cflag & CRTSCTS) &&
332 !(tty->termios.c_cflag & CRTSCTS)) {
333 tty->hw_stopped = 0;
334 }
335}
336/* 327/*
337 * This routine will shutdown a serial port; interrupts are disabled, and 328 * This routine will shutdown a serial port; interrupts are disabled, and
338 * DTR is dropped if the hangup on close termio flag is on. 329 * DTR is dropped if the hangup on close termio flag is on.
@@ -481,7 +472,6 @@ static const struct tty_operations hp_ops = {
481 .throttle = rs_throttle, 472 .throttle = rs_throttle,
482 .unthrottle = rs_unthrottle, 473 .unthrottle = rs_unthrottle,
483 .send_xchar = rs_send_xchar, 474 .send_xchar = rs_send_xchar,
484 .set_termios = rs_set_termios,
485 .hangup = rs_hangup, 475 .hangup = rs_hangup,
486 .proc_fops = &rs_proc_fops, 476 .proc_fops = &rs_proc_fops,
487}; 477};
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
index d2bf1fd5e44f..76acbcd5c060 100644
--- a/arch/ia64/include/asm/futex.h
+++ b/arch/ia64/include/asm/futex.h
@@ -106,16 +106,15 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
106 return -EFAULT; 106 return -EFAULT;
107 107
108 { 108 {
109 register unsigned long r8 __asm ("r8"); 109 register unsigned long r8 __asm ("r8") = 0;
110 unsigned long prev; 110 unsigned long prev;
111 __asm__ __volatile__( 111 __asm__ __volatile__(
112 " mf;; \n" 112 " mf;; \n"
113 " mov %0=r0 \n"
114 " mov ar.ccv=%4;; \n" 113 " mov ar.ccv=%4;; \n"
115 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n" 114 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
116 " .xdata4 \"__ex_table\", 1b-., 2f-. \n" 115 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
117 "[2:]" 116 "[2:]"
118 : "=r" (r8), "=r" (prev) 117 : "+r" (r8), "=&r" (prev)
119 : "r" (uaddr), "r" (newval), 118 : "r" (uaddr), "r" (newval),
120 "rO" ((long) (unsigned) oldval) 119 "rO" ((long) (unsigned) oldval)
121 : "memory"); 120 : "memory");
diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h
index 94eaa5bd5d0c..aa910054b8e7 100644
--- a/arch/ia64/include/asm/hugetlb.h
+++ b/arch/ia64/include/asm/hugetlb.h
@@ -2,6 +2,7 @@
2#define _ASM_IA64_HUGETLB_H 2#define _ASM_IA64_HUGETLB_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm-generic/hugetlb.h>
5 6
6 7
7void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr, 8void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
diff --git a/arch/ia64/include/asm/irqflags.h b/arch/ia64/include/asm/irqflags.h
index 2b68d856dc78..1bf2cf2f4ab4 100644
--- a/arch/ia64/include/asm/irqflags.h
+++ b/arch/ia64/include/asm/irqflags.h
@@ -89,6 +89,7 @@ static inline bool arch_irqs_disabled(void)
89 89
90static inline void arch_safe_halt(void) 90static inline void arch_safe_halt(void)
91{ 91{
92 arch_local_irq_enable();
92 ia64_pal_halt_light(); /* PAL_HALT_LIGHT */ 93 ia64_pal_halt_light(); /* PAL_HALT_LIGHT */
93} 94}
94 95
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index cfa74983c675..989dd3fe8de1 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -26,6 +26,7 @@
26#define KVM_USER_MEM_SLOTS 32 26#define KVM_USER_MEM_SLOTS 32
27 27
28#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 28#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
29#define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS
29 30
30/* define exit reasons from vmm to kvm*/ 31/* define exit reasons from vmm to kvm*/
31#define EXIT_REASON_VM_PANIC 0 32#define EXIT_REASON_VM_PANIC 0
diff --git a/arch/ia64/include/asm/linkage.h b/arch/ia64/include/asm/linkage.h
index ef22a45c1890..787575701f1c 100644
--- a/arch/ia64/include/asm/linkage.h
+++ b/arch/ia64/include/asm/linkage.h
@@ -11,4 +11,8 @@
11 11
12#endif 12#endif
13 13
14#define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#")
15#define SYSCALL_ALIAS(alias, name) \
16 asm ( #alias "# = " #name "#\n\t.globl " #alias "#")
17
14#endif 18#endif
diff --git a/arch/ia64/include/asm/mca.h b/arch/ia64/include/asm/mca.h
index 43f96ab18fa0..8c7096168716 100644
--- a/arch/ia64/include/asm/mca.h
+++ b/arch/ia64/include/asm/mca.h
@@ -143,6 +143,7 @@ extern unsigned long __per_cpu_mca[NR_CPUS];
143extern int cpe_vector; 143extern int cpe_vector;
144extern int ia64_cpe_irq; 144extern int ia64_cpe_irq;
145extern void ia64_mca_init(void); 145extern void ia64_mca_init(void);
146extern void ia64_mca_irq_init(void);
146extern void ia64_mca_cpu_init(void *); 147extern void ia64_mca_cpu_init(void *);
147extern void ia64_os_mca_dispatch(void); 148extern void ia64_os_mca_dispatch(void);
148extern void ia64_os_mca_dispatch_end(void); 149extern void ia64_os_mca_dispatch_end(void);
diff --git a/arch/ia64/include/asm/numa.h b/arch/ia64/include/asm/numa.h
index 2e27ef175652..2db0a6c6daa5 100644
--- a/arch/ia64/include/asm/numa.h
+++ b/arch/ia64/include/asm/numa.h
@@ -67,14 +67,13 @@ extern int paddr_to_nid(unsigned long paddr);
67 67
68extern void map_cpu_to_node(int cpu, int nid); 68extern void map_cpu_to_node(int cpu, int nid);
69extern void unmap_cpu_from_node(int cpu, int nid); 69extern void unmap_cpu_from_node(int cpu, int nid);
70 70extern void numa_clear_node(int cpu);
71 71
72#else /* !CONFIG_NUMA */ 72#else /* !CONFIG_NUMA */
73#define map_cpu_to_node(cpu, nid) do{}while(0) 73#define map_cpu_to_node(cpu, nid) do{}while(0)
74#define unmap_cpu_from_node(cpu, nid) do{}while(0) 74#define unmap_cpu_from_node(cpu, nid) do{}while(0)
75
76#define paddr_to_nid(addr) 0 75#define paddr_to_nid(addr) 0
77 76#define numa_clear_node(cpu) do { } while (0)
78#endif /* CONFIG_NUMA */ 77#endif /* CONFIG_NUMA */
79 78
80#endif /* _ASM_IA64_NUMA_H */ 79#endif /* _ASM_IA64_NUMA_H */
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index 020d655ed082..cade13dd0299 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -131,8 +131,6 @@ struct thread_info {
131#define TS_POLLING 1 /* true if in idle loop and not sleeping */ 131#define TS_POLLING 1 /* true if in idle loop and not sleeping */
132#define TS_RESTORE_SIGMASK 2 /* restore signal mask in do_signal() */ 132#define TS_RESTORE_SIGMASK 2 /* restore signal mask in do_signal() */
133 133
134#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
135
136#ifndef __ASSEMBLY__ 134#ifndef __ASSEMBLY__
137#define HAVE_SET_RESTORE_SIGMASK 1 135#define HAVE_SET_RESTORE_SIGMASK 1
138static inline void set_restore_sigmask(void) 136static inline void set_restore_sigmask(void)
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 096373800f73..afd45e0d552e 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -46,15 +46,5 @@ asmlinkage unsigned long sys_mmap2(
46struct pt_regs; 46struct pt_regs;
47asmlinkage long sys_ia64_pipe(void); 47asmlinkage long sys_ia64_pipe(void);
48 48
49/*
50 * "Conditional" syscalls
51 *
52 * Note, this macro can only be used in the file which defines sys_ni_syscall, i.e., in
53 * kernel/sys_ni.c. This version causes warnings because the declaration isn't a
54 * proper prototype, but we can't use __typeof__ either, because not all cond_syscall()
55 * declarations have prototypes at the moment.
56 */
57#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
58
59#endif /* !__ASSEMBLY__ */ 49#endif /* !__ASSEMBLY__ */
60#endif /* _ASM_IA64_UNISTD_H */ 50#endif /* _ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/include/uapi/asm/kvm.h b/arch/ia64/include/uapi/asm/kvm.h
index ec6c6b301238..99503c284400 100644
--- a/arch/ia64/include/uapi/asm/kvm.h
+++ b/arch/ia64/include/uapi/asm/kvm.h
@@ -27,7 +27,6 @@
27/* Select x86 specific features in <linux/kvm.h> */ 27/* Select x86 specific features in <linux/kvm.h> */
28#define __KVM_HAVE_IOAPIC 28#define __KVM_HAVE_IOAPIC
29#define __KVM_HAVE_IRQ_LINE 29#define __KVM_HAVE_IRQ_LINE
30#define __KVM_HAVE_DEVICE_ASSIGNMENT
31 30
32/* Architectural interrupt line count. */ 31/* Architectural interrupt line count. */
33#define KVM_NR_INTERRUPTS 256 32#define KVM_NR_INTERRUPTS 256
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index d959c84904be..20678a9ed11a 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_SMP) += smp.o smpboot.o
23obj-$(CONFIG_NUMA) += numa.o 23obj-$(CONFIG_NUMA) += numa.o
24obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o 24obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o
25obj-$(CONFIG_IA64_CYCLONE) += cyclone.o 25obj-$(CONFIG_IA64_CYCLONE) += cyclone.o
26obj-$(CONFIG_CPU_FREQ) += cpufreq/
27obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o 26obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o
28obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o 27obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o
29obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 28obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
diff --git a/arch/ia64/kernel/cpufreq/Kconfig b/arch/ia64/kernel/cpufreq/Kconfig
deleted file mode 100644
index 2d9d5279b981..000000000000
--- a/arch/ia64/kernel/cpufreq/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
1
2#
3# CPU Frequency scaling
4#
5
6menu "CPU Frequency scaling"
7
8source "drivers/cpufreq/Kconfig"
9
10if CPU_FREQ
11
12comment "CPUFreq processor drivers"
13
14config IA64_ACPI_CPUFREQ
15 tristate "ACPI Processor P-States driver"
16 select CPU_FREQ_TABLE
17 depends on ACPI_PROCESSOR
18 help
19 This driver adds a CPUFreq driver which utilizes the ACPI
20 Processor Performance States.
21
22 For details, take a look at <file:Documentation/cpu-freq/>.
23
24 If in doubt, say N.
25
26endif # CPU_FREQ
27
28endmenu
29
diff --git a/arch/ia64/kernel/cpufreq/Makefile b/arch/ia64/kernel/cpufreq/Makefile
deleted file mode 100644
index 4838f2a57c7a..000000000000
--- a/arch/ia64/kernel/cpufreq/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
1obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o
2
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
deleted file mode 100644
index f09b174244d5..000000000000
--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ /dev/null
@@ -1,437 +0,0 @@
1/*
2 * arch/ia64/kernel/cpufreq/acpi-cpufreq.c
3 * This file provides the ACPI based P-state support. This
4 * module works with generic cpufreq infrastructure. Most of
5 * the code is based on i386 version
6 * (arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c)
7 *
8 * Copyright (C) 2005 Intel Corp
9 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
10 */
11
12#include <linux/kernel.h>
13#include <linux/slab.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/cpufreq.h>
17#include <linux/proc_fs.h>
18#include <linux/seq_file.h>
19#include <asm/io.h>
20#include <asm/uaccess.h>
21#include <asm/pal.h>
22
23#include <linux/acpi.h>
24#include <acpi/processor.h>
25
26MODULE_AUTHOR("Venkatesh Pallipadi");
27MODULE_DESCRIPTION("ACPI Processor P-States Driver");
28MODULE_LICENSE("GPL");
29
30
31struct cpufreq_acpi_io {
32 struct acpi_processor_performance acpi_data;
33 struct cpufreq_frequency_table *freq_table;
34 unsigned int resume;
35};
36
37static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
38
39static struct cpufreq_driver acpi_cpufreq_driver;
40
41
42static int
43processor_set_pstate (
44 u32 value)
45{
46 s64 retval;
47
48 pr_debug("processor_set_pstate\n");
49
50 retval = ia64_pal_set_pstate((u64)value);
51
52 if (retval) {
53 pr_debug("Failed to set freq to 0x%x, with error 0x%lx\n",
54 value, retval);
55 return -ENODEV;
56 }
57 return (int)retval;
58}
59
60
61static int
62processor_get_pstate (
63 u32 *value)
64{
65 u64 pstate_index = 0;
66 s64 retval;
67
68 pr_debug("processor_get_pstate\n");
69
70 retval = ia64_pal_get_pstate(&pstate_index,
71 PAL_GET_PSTATE_TYPE_INSTANT);
72 *value = (u32) pstate_index;
73
74 if (retval)
75 pr_debug("Failed to get current freq with "
76 "error 0x%lx, idx 0x%x\n", retval, *value);
77
78 return (int)retval;
79}
80
81
82/* To be used only after data->acpi_data is initialized */
83static unsigned
84extract_clock (
85 struct cpufreq_acpi_io *data,
86 unsigned value,
87 unsigned int cpu)
88{
89 unsigned long i;
90
91 pr_debug("extract_clock\n");
92
93 for (i = 0; i < data->acpi_data.state_count; i++) {
94 if (value == data->acpi_data.states[i].status)
95 return data->acpi_data.states[i].core_frequency;
96 }
97 return data->acpi_data.states[i-1].core_frequency;
98}
99
100
101static unsigned int
102processor_get_freq (
103 struct cpufreq_acpi_io *data,
104 unsigned int cpu)
105{
106 int ret = 0;
107 u32 value = 0;
108 cpumask_t saved_mask;
109 unsigned long clock_freq;
110
111 pr_debug("processor_get_freq\n");
112
113 saved_mask = current->cpus_allowed;
114 set_cpus_allowed_ptr(current, cpumask_of(cpu));
115 if (smp_processor_id() != cpu)
116 goto migrate_end;
117
118 /* processor_get_pstate gets the instantaneous frequency */
119 ret = processor_get_pstate(&value);
120
121 if (ret) {
122 set_cpus_allowed_ptr(current, &saved_mask);
123 printk(KERN_WARNING "get performance failed with error %d\n",
124 ret);
125 ret = 0;
126 goto migrate_end;
127 }
128 clock_freq = extract_clock(data, value, cpu);
129 ret = (clock_freq*1000);
130
131migrate_end:
132 set_cpus_allowed_ptr(current, &saved_mask);
133 return ret;
134}
135
136
137static int
138processor_set_freq (
139 struct cpufreq_acpi_io *data,
140 unsigned int cpu,
141 int state)
142{
143 int ret = 0;
144 u32 value = 0;
145 struct cpufreq_freqs cpufreq_freqs;
146 cpumask_t saved_mask;
147 int retval;
148
149 pr_debug("processor_set_freq\n");
150
151 saved_mask = current->cpus_allowed;
152 set_cpus_allowed_ptr(current, cpumask_of(cpu));
153 if (smp_processor_id() != cpu) {
154 retval = -EAGAIN;
155 goto migrate_end;
156 }
157
158 if (state == data->acpi_data.state) {
159 if (unlikely(data->resume)) {
160 pr_debug("Called after resume, resetting to P%d\n", state);
161 data->resume = 0;
162 } else {
163 pr_debug("Already at target state (P%d)\n", state);
164 retval = 0;
165 goto migrate_end;
166 }
167 }
168
169 pr_debug("Transitioning from P%d to P%d\n",
170 data->acpi_data.state, state);
171
172 /* cpufreq frequency struct */
173 cpufreq_freqs.cpu = cpu;
174 cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency;
175 cpufreq_freqs.new = data->freq_table[state].frequency;
176
177 /* notify cpufreq */
178 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
179
180 /*
181 * First we write the target state's 'control' value to the
182 * control_register.
183 */
184
185 value = (u32) data->acpi_data.states[state].control;
186
187 pr_debug("Transitioning to state: 0x%08x\n", value);
188
189 ret = processor_set_pstate(value);
190 if (ret) {
191 unsigned int tmp = cpufreq_freqs.new;
192 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
193 cpufreq_freqs.new = cpufreq_freqs.old;
194 cpufreq_freqs.old = tmp;
195 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
196 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
197 printk(KERN_WARNING "Transition failed with error %d\n", ret);
198 retval = -ENODEV;
199 goto migrate_end;
200 }
201
202 cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
203
204 data->acpi_data.state = state;
205
206 retval = 0;
207
208migrate_end:
209 set_cpus_allowed_ptr(current, &saved_mask);
210 return (retval);
211}
212
213
214static unsigned int
215acpi_cpufreq_get (
216 unsigned int cpu)
217{
218 struct cpufreq_acpi_io *data = acpi_io_data[cpu];
219
220 pr_debug("acpi_cpufreq_get\n");
221
222 return processor_get_freq(data, cpu);
223}
224
225
226static int
227acpi_cpufreq_target (
228 struct cpufreq_policy *policy,
229 unsigned int target_freq,
230 unsigned int relation)
231{
232 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu];
233 unsigned int next_state = 0;
234 unsigned int result = 0;
235
236 pr_debug("acpi_cpufreq_setpolicy\n");
237
238 result = cpufreq_frequency_table_target(policy,
239 data->freq_table, target_freq, relation, &next_state);
240 if (result)
241 return (result);
242
243 result = processor_set_freq(data, policy->cpu, next_state);
244
245 return (result);
246}
247
248
249static int
250acpi_cpufreq_verify (
251 struct cpufreq_policy *policy)
252{
253 unsigned int result = 0;
254 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu];
255
256 pr_debug("acpi_cpufreq_verify\n");
257
258 result = cpufreq_frequency_table_verify(policy,
259 data->freq_table);
260
261 return (result);
262}
263
264
265static int
266acpi_cpufreq_cpu_init (
267 struct cpufreq_policy *policy)
268{
269 unsigned int i;
270 unsigned int cpu = policy->cpu;
271 struct cpufreq_acpi_io *data;
272 unsigned int result = 0;
273
274 pr_debug("acpi_cpufreq_cpu_init\n");
275
276 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
277 if (!data)
278 return (-ENOMEM);
279
280 acpi_io_data[cpu] = data;
281
282 result = acpi_processor_register_performance(&data->acpi_data, cpu);
283
284 if (result)
285 goto err_free;
286
287 /* capability check */
288 if (data->acpi_data.state_count <= 1) {
289 pr_debug("No P-States\n");
290 result = -ENODEV;
291 goto err_unreg;
292 }
293
294 if ((data->acpi_data.control_register.space_id !=
295 ACPI_ADR_SPACE_FIXED_HARDWARE) ||
296 (data->acpi_data.status_register.space_id !=
297 ACPI_ADR_SPACE_FIXED_HARDWARE)) {
298 pr_debug("Unsupported address space [%d, %d]\n",
299 (u32) (data->acpi_data.control_register.space_id),
300 (u32) (data->acpi_data.status_register.space_id));
301 result = -ENODEV;
302 goto err_unreg;
303 }
304
305 /* alloc freq_table */
306 data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) *
307 (data->acpi_data.state_count + 1),
308 GFP_KERNEL);
309 if (!data->freq_table) {
310 result = -ENOMEM;
311 goto err_unreg;
312 }
313
314 /* detect transition latency */
315 policy->cpuinfo.transition_latency = 0;
316 for (i=0; i<data->acpi_data.state_count; i++) {
317 if ((data->acpi_data.states[i].transition_latency * 1000) >
318 policy->cpuinfo.transition_latency) {
319 policy->cpuinfo.transition_latency =
320 data->acpi_data.states[i].transition_latency * 1000;
321 }
322 }
323 policy->cur = processor_get_freq(data, policy->cpu);
324
325 /* table init */
326 for (i = 0; i <= data->acpi_data.state_count; i++)
327 {
328 data->freq_table[i].index = i;
329 if (i < data->acpi_data.state_count) {
330 data->freq_table[i].frequency =
331 data->acpi_data.states[i].core_frequency * 1000;
332 } else {
333 data->freq_table[i].frequency = CPUFREQ_TABLE_END;
334 }
335 }
336
337 result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
338 if (result) {
339 goto err_freqfree;
340 }
341
342 /* notify BIOS that we exist */
343 acpi_processor_notify_smm(THIS_MODULE);
344
345 printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management "
346 "activated.\n", cpu);
347
348 for (i = 0; i < data->acpi_data.state_count; i++)
349 pr_debug(" %cP%d: %d MHz, %d mW, %d uS, %d uS, 0x%x 0x%x\n",
350 (i == data->acpi_data.state?'*':' '), i,
351 (u32) data->acpi_data.states[i].core_frequency,
352 (u32) data->acpi_data.states[i].power,
353 (u32) data->acpi_data.states[i].transition_latency,
354 (u32) data->acpi_data.states[i].bus_master_latency,
355 (u32) data->acpi_data.states[i].status,
356 (u32) data->acpi_data.states[i].control);
357
358 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);
359
360 /* the first call to ->target() should result in us actually
361 * writing something to the appropriate registers. */
362 data->resume = 1;
363
364 return (result);
365
366 err_freqfree:
367 kfree(data->freq_table);
368 err_unreg:
369 acpi_processor_unregister_performance(&data->acpi_data, cpu);
370 err_free:
371 kfree(data);
372 acpi_io_data[cpu] = NULL;
373
374 return (result);
375}
376
377
378static int
379acpi_cpufreq_cpu_exit (
380 struct cpufreq_policy *policy)
381{
382 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu];
383
384 pr_debug("acpi_cpufreq_cpu_exit\n");
385
386 if (data) {
387 cpufreq_frequency_table_put_attr(policy->cpu);
388 acpi_io_data[policy->cpu] = NULL;
389 acpi_processor_unregister_performance(&data->acpi_data,
390 policy->cpu);
391 kfree(data);
392 }
393
394 return (0);
395}
396
397
398static struct freq_attr* acpi_cpufreq_attr[] = {
399 &cpufreq_freq_attr_scaling_available_freqs,
400 NULL,
401};
402
403
404static struct cpufreq_driver acpi_cpufreq_driver = {
405 .verify = acpi_cpufreq_verify,
406 .target = acpi_cpufreq_target,
407 .get = acpi_cpufreq_get,
408 .init = acpi_cpufreq_cpu_init,
409 .exit = acpi_cpufreq_cpu_exit,
410 .name = "acpi-cpufreq",
411 .owner = THIS_MODULE,
412 .attr = acpi_cpufreq_attr,
413};
414
415
416static int __init
417acpi_cpufreq_init (void)
418{
419 pr_debug("acpi_cpufreq_init\n");
420
421 return cpufreq_register_driver(&acpi_cpufreq_driver);
422}
423
424
425static void __exit
426acpi_cpufreq_exit (void)
427{
428 pr_debug("acpi_cpufreq_exit\n");
429
430 cpufreq_unregister_driver(&acpi_cpufreq_driver);
431 return;
432}
433
434
435late_initcall(acpi_cpufreq_init);
436module_exit(acpi_cpufreq_exit);
437
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index c4cd45d97749..abc6dee3799c 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -90,53 +90,6 @@ ENTRY(fsys_getpid)
90 FSYS_RETURN 90 FSYS_RETURN
91END(fsys_getpid) 91END(fsys_getpid)
92 92
93ENTRY(fsys_getppid)
94 .prologue
95 .altrp b6
96 .body
97 add r17=IA64_TASK_GROUP_LEADER_OFFSET,r16
98 ;;
99 ld8 r17=[r17] // r17 = current->group_leader
100 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
101 ;;
102
103 ld4 r9=[r9]
104 add r17=IA64_TASK_REAL_PARENT_OFFSET,r17 // r17 = &current->group_leader->real_parent
105 ;;
106 and r9=TIF_ALLWORK_MASK,r9
107
1081: ld8 r18=[r17] // r18 = current->group_leader->real_parent
109 ;;
110 cmp.ne p8,p0=0,r9
111 add r8=IA64_TASK_TGID_OFFSET,r18 // r8 = &current->group_leader->real_parent->tgid
112 ;;
113
114 /*
115 * The .acq is needed to ensure that the read of tgid has returned its data before
116 * we re-check "real_parent".
117 */
118 ld4.acq r8=[r8] // r8 = current->group_leader->real_parent->tgid
119#ifdef CONFIG_SMP
120 /*
121 * Re-read current->group_leader->real_parent.
122 */
123 ld8 r19=[r17] // r19 = current->group_leader->real_parent
124(p8) br.spnt.many fsys_fallback_syscall
125 ;;
126 cmp.ne p6,p0=r18,r19 // did real_parent change?
127 mov r19=0 // i must not leak kernel bits...
128(p6) br.cond.spnt.few 1b // yes -> redo the read of tgid and the check
129 ;;
130 mov r17=0 // i must not leak kernel bits...
131 mov r18=0 // i must not leak kernel bits...
132#else
133 mov r17=0 // i must not leak kernel bits...
134 mov r18=0 // i must not leak kernel bits...
135 mov r19=0 // i must not leak kernel bits...
136#endif
137 FSYS_RETURN
138END(fsys_getppid)
139
140ENTRY(fsys_set_tid_address) 93ENTRY(fsys_set_tid_address)
141 .prologue 94 .prologue
142 .altrp b6 95 .altrp b6
@@ -614,7 +567,7 @@ paravirt_fsyscall_table:
614 data8 0 // chown 567 data8 0 // chown
615 data8 0 // lseek // 1040 568 data8 0 // lseek // 1040
616 data8 fsys_getpid // getpid 569 data8 fsys_getpid // getpid
617 data8 fsys_getppid // getppid 570 data8 0 // getppid
618 data8 0 // mount 571 data8 0 // mount
619 data8 0 // umount 572 data8 0 // umount
620 data8 0 // setuid // 1045 573 data8 0 // setuid // 1045
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index ee33c3aaa2fc..19f107be734e 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -76,7 +76,7 @@
76 * PCI pin -> global system interrupt (GSI) -> IA-64 vector <-> IRQ 76 * PCI pin -> global system interrupt (GSI) -> IA-64 vector <-> IRQ
77 * 77 *
78 * Note: The term "IRQ" is loosely used everywhere in Linux kernel to 78 * Note: The term "IRQ" is loosely used everywhere in Linux kernel to
79 * describeinterrupts. Now we use "IRQ" only for Linux IRQ's. ISA IRQ 79 * describe interrupts. Now we use "IRQ" only for Linux IRQ's. ISA IRQ
80 * (isa_irq) is the only exception in this source code. 80 * (isa_irq) is the only exception in this source code.
81 */ 81 */
82 82
@@ -1010,6 +1010,26 @@ iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver)
1010 return 0; 1010 return 0;
1011} 1011}
1012 1012
1013static int
1014iosapic_delete_rte(unsigned int irq, unsigned int gsi)
1015{
1016 struct iosapic_rte_info *rte, *temp;
1017
1018 list_for_each_entry_safe(rte, temp, &iosapic_intr_info[irq].rtes,
1019 rte_list) {
1020 if (rte->iosapic->gsi_base + rte->rte_index == gsi) {
1021 if (rte->refcnt)
1022 return -EBUSY;
1023
1024 list_del(&rte->rte_list);
1025 kfree(rte);
1026 return 0;
1027 }
1028 }
1029
1030 return -EINVAL;
1031}
1032
1013int iosapic_init(unsigned long phys_addr, unsigned int gsi_base) 1033int iosapic_init(unsigned long phys_addr, unsigned int gsi_base)
1014{ 1034{
1015 int num_rte, err, index; 1035 int num_rte, err, index;
@@ -1069,7 +1089,7 @@ int iosapic_init(unsigned long phys_addr, unsigned int gsi_base)
1069 1089
1070int iosapic_remove(unsigned int gsi_base) 1090int iosapic_remove(unsigned int gsi_base)
1071{ 1091{
1072 int index, err = 0; 1092 int i, irq, index, err = 0;
1073 unsigned long flags; 1093 unsigned long flags;
1074 1094
1075 spin_lock_irqsave(&iosapic_lock, flags); 1095 spin_lock_irqsave(&iosapic_lock, flags);
@@ -1087,6 +1107,16 @@ int iosapic_remove(unsigned int gsi_base)
1087 goto out; 1107 goto out;
1088 } 1108 }
1089 1109
1110 for (i = gsi_base; i < gsi_base + iosapic_lists[index].num_rte; i++) {
1111 irq = __gsi_to_irq(i);
1112 if (irq < 0)
1113 continue;
1114
1115 err = iosapic_delete_rte(irq, i);
1116 if (err)
1117 goto out;
1118 }
1119
1090 iounmap(iosapic_lists[index].addr); 1120 iounmap(iosapic_lists[index].addr);
1091 iosapic_free(index); 1121 iosapic_free(index);
1092 out: 1122 out:
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index ad69606613eb..f2c418281130 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -23,6 +23,8 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/kernel_stat.h> 24#include <linux/kernel_stat.h>
25 25
26#include <asm/mca.h>
27
26/* 28/*
27 * 'what should we do if we get a hw irq event on an illegal vector'. 29 * 'what should we do if we get a hw irq event on an illegal vector'.
28 * each architecture has to answer this themselves. 30 * each architecture has to answer this themselves.
@@ -83,6 +85,12 @@ bool is_affinity_mask_valid(const struct cpumask *cpumask)
83 85
84#endif /* CONFIG_SMP */ 86#endif /* CONFIG_SMP */
85 87
88int __init arch_early_irq_init(void)
89{
90 ia64_mca_irq_init();
91 return 0;
92}
93
86#ifdef CONFIG_HOTPLUG_CPU 94#ifdef CONFIG_HOTPLUG_CPU
87unsigned int vectors_in_migration[NR_IRQS]; 95unsigned int vectors_in_migration[NR_IRQS];
88 96
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 65bf9cd39044..d7396dbb07bb 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -2074,22 +2074,16 @@ ia64_mca_init(void)
2074 printk(KERN_INFO "MCA related initialization done\n"); 2074 printk(KERN_INFO "MCA related initialization done\n");
2075} 2075}
2076 2076
2077
2077/* 2078/*
2078 * ia64_mca_late_init 2079 * These pieces cannot be done in ia64_mca_init() because it is called before
2079 * 2080 * early_irq_init() which would wipe out our percpu irq registrations. But we
2080 * Opportunity to setup things that require initialization later 2081 * cannot leave them until ia64_mca_late_init() because by then all the other
2081 * than ia64_mca_init. Setup a timer to poll for CPEs if the 2082 * processors have been brought online and have set their own CMC vectors to
2082 * platform doesn't support an interrupt driven mechanism. 2083 * point at a non-existant action. Called from arch_early_irq_init().
2083 *
2084 * Inputs : None
2085 * Outputs : Status
2086 */ 2084 */
2087static int __init 2085void __init ia64_mca_irq_init(void)
2088ia64_mca_late_init(void)
2089{ 2086{
2090 if (!mca_init)
2091 return 0;
2092
2093 /* 2087 /*
2094 * Configure the CMCI/P vector and handler. Interrupts for CMC are 2088 * Configure the CMCI/P vector and handler. Interrupts for CMC are
2095 * per-processor, so AP CMC interrupts are setup in smp_callin() (smpboot.c). 2089 * per-processor, so AP CMC interrupts are setup in smp_callin() (smpboot.c).
@@ -2108,6 +2102,23 @@ ia64_mca_late_init(void)
2108 /* Setup the CPEI/P handler */ 2102 /* Setup the CPEI/P handler */
2109 register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction); 2103 register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);
2110#endif 2104#endif
2105}
2106
2107/*
2108 * ia64_mca_late_init
2109 *
2110 * Opportunity to setup things that require initialization later
2111 * than ia64_mca_init. Setup a timer to poll for CPEs if the
2112 * platform doesn't support an interrupt driven mechanism.
2113 *
2114 * Inputs : None
2115 * Outputs : Status
2116 */
2117static int __init
2118ia64_mca_late_init(void)
2119{
2120 if (!mca_init)
2121 return 0;
2111 2122
2112 register_hotcpu_notifier(&mca_cpu_notifier); 2123 register_hotcpu_notifier(&mca_cpu_notifier);
2113 2124
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index 9392e021c93b..94f8bf777afa 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -349,7 +349,7 @@ init_record_index_pools(void)
349 349
350 /* - 3 - */ 350 /* - 3 - */
351 slidx_pool.max_idx = (rec_max_size/sect_min_size) * 2 + 1; 351 slidx_pool.max_idx = (rec_max_size/sect_min_size) * 2 + 1;
352 slidx_pool.buffer = (slidx_list_t *) 352 slidx_pool.buffer =
353 kmalloc(slidx_pool.max_idx * sizeof(slidx_list_t), GFP_KERNEL); 353 kmalloc(slidx_pool.max_idx * sizeof(slidx_list_t), GFP_KERNEL);
354 354
355 return slidx_pool.buffer ? 0 : -ENOMEM; 355 return slidx_pool.buffer ? 0 : -ENOMEM;
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 79521d5499f9..2b3c2d79256f 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -22,6 +22,7 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
25#include <linux/seq_file.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
27#include <linux/efi.h> 28#include <linux/efi.h>
@@ -41,7 +42,7 @@ MODULE_LICENSE("GPL");
41 42
42#define PALINFO_VERSION "0.5" 43#define PALINFO_VERSION "0.5"
43 44
44typedef int (*palinfo_func_t)(char*); 45typedef int (*palinfo_func_t)(struct seq_file *);
45 46
46typedef struct { 47typedef struct {
47 const char *name; /* name of the proc entry */ 48 const char *name; /* name of the proc entry */
@@ -54,7 +55,7 @@ typedef struct {
54 * A bunch of string array to get pretty printing 55 * A bunch of string array to get pretty printing
55 */ 56 */
56 57
57static char *cache_types[] = { 58static const char *cache_types[] = {
58 "", /* not used */ 59 "", /* not used */
59 "Instruction", 60 "Instruction",
60 "Data", 61 "Data",
@@ -122,19 +123,16 @@ static const char *mem_attrib[]={
122 * - a pointer to the end of the buffer 123 * - a pointer to the end of the buffer
123 * 124 *
124 */ 125 */
125static char * 126static void bitvector_process(struct seq_file *m, u64 vector)
126bitvector_process(char *p, u64 vector)
127{ 127{
128 int i,j; 128 int i,j;
129 const char *units[]={ "", "K", "M", "G", "T" }; 129 static const char *units[]={ "", "K", "M", "G", "T" };
130 130
131 for (i=0, j=0; i < 64; i++ , j=i/10) { 131 for (i=0, j=0; i < 64; i++ , j=i/10) {
132 if (vector & 0x1) { 132 if (vector & 0x1)
133 p += sprintf(p, "%d%s ", 1 << (i-j*10), units[j]); 133 seq_printf(m, "%d%s ", 1 << (i-j*10), units[j]);
134 }
135 vector >>= 1; 134 vector >>= 1;
136 } 135 }
137 return p;
138} 136}
139 137
140/* 138/*
@@ -149,8 +147,7 @@ bitvector_process(char *p, u64 vector)
149 * - a pointer to the end of the buffer 147 * - a pointer to the end of the buffer
150 * 148 *
151 */ 149 */
152static char * 150static void bitregister_process(struct seq_file *m, u64 *reg_info, int max)
153bitregister_process(char *p, u64 *reg_info, int max)
154{ 151{
155 int i, begin, skip = 0; 152 int i, begin, skip = 0;
156 u64 value = reg_info[0]; 153 u64 value = reg_info[0];
@@ -163,9 +160,9 @@ bitregister_process(char *p, u64 *reg_info, int max)
163 160
164 if ((value & 0x1) == 0 && skip == 0) { 161 if ((value & 0x1) == 0 && skip == 0) {
165 if (begin <= i - 2) 162 if (begin <= i - 2)
166 p += sprintf(p, "%d-%d ", begin, i-1); 163 seq_printf(m, "%d-%d ", begin, i-1);
167 else 164 else
168 p += sprintf(p, "%d ", i-1); 165 seq_printf(m, "%d ", i-1);
169 skip = 1; 166 skip = 1;
170 begin = -1; 167 begin = -1;
171 } else if ((value & 0x1) && skip == 1) { 168 } else if ((value & 0x1) && skip == 1) {
@@ -176,19 +173,15 @@ bitregister_process(char *p, u64 *reg_info, int max)
176 } 173 }
177 if (begin > -1) { 174 if (begin > -1) {
178 if (begin < 127) 175 if (begin < 127)
179 p += sprintf(p, "%d-127", begin); 176 seq_printf(m, "%d-127", begin);
180 else 177 else
181 p += sprintf(p, "127"); 178 seq_puts(m, "127");
182 } 179 }
183
184 return p;
185} 180}
186 181
187static int 182static int power_info(struct seq_file *m)
188power_info(char *page)
189{ 183{
190 s64 status; 184 s64 status;
191 char *p = page;
192 u64 halt_info_buffer[8]; 185 u64 halt_info_buffer[8];
193 pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer; 186 pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer;
194 int i; 187 int i;
@@ -198,26 +191,25 @@ power_info(char *page)
198 191
199 for (i=0; i < 8 ; i++ ) { 192 for (i=0; i < 8 ; i++ ) {
200 if (halt_info[i].pal_power_mgmt_info_s.im == 1) { 193 if (halt_info[i].pal_power_mgmt_info_s.im == 1) {
201 p += sprintf(p, "Power level %d:\n" 194 seq_printf(m,
202 "\tentry_latency : %d cycles\n" 195 "Power level %d:\n"
203 "\texit_latency : %d cycles\n" 196 "\tentry_latency : %d cycles\n"
204 "\tpower consumption : %d mW\n" 197 "\texit_latency : %d cycles\n"
205 "\tCache+TLB coherency : %s\n", i, 198 "\tpower consumption : %d mW\n"
206 halt_info[i].pal_power_mgmt_info_s.entry_latency, 199 "\tCache+TLB coherency : %s\n", i,
207 halt_info[i].pal_power_mgmt_info_s.exit_latency, 200 halt_info[i].pal_power_mgmt_info_s.entry_latency,
208 halt_info[i].pal_power_mgmt_info_s.power_consumption, 201 halt_info[i].pal_power_mgmt_info_s.exit_latency,
209 halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No"); 202 halt_info[i].pal_power_mgmt_info_s.power_consumption,
203 halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No");
210 } else { 204 } else {
211 p += sprintf(p,"Power level %d: not implemented\n",i); 205 seq_printf(m,"Power level %d: not implemented\n", i);
212 } 206 }
213 } 207 }
214 return p - page; 208 return 0;
215} 209}
216 210
217static int 211static int cache_info(struct seq_file *m)
218cache_info(char *page)
219{ 212{
220 char *p = page;
221 unsigned long i, levels, unique_caches; 213 unsigned long i, levels, unique_caches;
222 pal_cache_config_info_t cci; 214 pal_cache_config_info_t cci;
223 int j, k; 215 int j, k;
@@ -228,73 +220,74 @@ cache_info(char *page)
228 return 0; 220 return 0;
229 } 221 }
230 222
231 p += sprintf(p, "Cache levels : %ld\nUnique caches : %ld\n\n", levels, unique_caches); 223 seq_printf(m, "Cache levels : %ld\nUnique caches : %ld\n\n",
224 levels, unique_caches);
232 225
233 for (i=0; i < levels; i++) { 226 for (i=0; i < levels; i++) {
234
235 for (j=2; j >0 ; j--) { 227 for (j=2; j >0 ; j--) {
236
237 /* even without unification some level may not be present */ 228 /* even without unification some level may not be present */
238 if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0) { 229 if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0)
239 continue; 230 continue;
240 } 231
241 p += sprintf(p, 232 seq_printf(m,
242 "%s Cache level %lu:\n" 233 "%s Cache level %lu:\n"
243 "\tSize : %u bytes\n" 234 "\tSize : %u bytes\n"
244 "\tAttributes : ", 235 "\tAttributes : ",
245 cache_types[j+cci.pcci_unified], i+1, 236 cache_types[j+cci.pcci_unified], i+1,
246 cci.pcci_cache_size); 237 cci.pcci_cache_size);
247 238
248 if (cci.pcci_unified) p += sprintf(p, "Unified "); 239 if (cci.pcci_unified)
249 240 seq_puts(m, "Unified ");
250 p += sprintf(p, "%s\n", cache_mattrib[cci.pcci_cache_attr]); 241
251 242 seq_printf(m, "%s\n", cache_mattrib[cci.pcci_cache_attr]);
252 p += sprintf(p, 243
253 "\tAssociativity : %d\n" 244 seq_printf(m,
254 "\tLine size : %d bytes\n" 245 "\tAssociativity : %d\n"
255 "\tStride : %d bytes\n", 246 "\tLine size : %d bytes\n"
256 cci.pcci_assoc, 1<<cci.pcci_line_size, 1<<cci.pcci_stride); 247 "\tStride : %d bytes\n",
248 cci.pcci_assoc,
249 1<<cci.pcci_line_size,
250 1<<cci.pcci_stride);
257 if (j == 1) 251 if (j == 1)
258 p += sprintf(p, "\tStore latency : N/A\n"); 252 seq_puts(m, "\tStore latency : N/A\n");
259 else 253 else
260 p += sprintf(p, "\tStore latency : %d cycle(s)\n", 254 seq_printf(m, "\tStore latency : %d cycle(s)\n",
261 cci.pcci_st_latency); 255 cci.pcci_st_latency);
262 256
263 p += sprintf(p, 257 seq_printf(m,
264 "\tLoad latency : %d cycle(s)\n" 258 "\tLoad latency : %d cycle(s)\n"
265 "\tStore hints : ", cci.pcci_ld_latency); 259 "\tStore hints : ", cci.pcci_ld_latency);
266 260
267 for(k=0; k < 8; k++ ) { 261 for(k=0; k < 8; k++ ) {
268 if ( cci.pcci_st_hints & 0x1) 262 if ( cci.pcci_st_hints & 0x1)
269 p += sprintf(p, "[%s]", cache_st_hints[k]); 263 seq_printf(m, "[%s]", cache_st_hints[k]);
270 cci.pcci_st_hints >>=1; 264 cci.pcci_st_hints >>=1;
271 } 265 }
272 p += sprintf(p, "\n\tLoad hints : "); 266 seq_puts(m, "\n\tLoad hints : ");
273 267
274 for(k=0; k < 8; k++ ) { 268 for(k=0; k < 8; k++ ) {
275 if (cci.pcci_ld_hints & 0x1) 269 if (cci.pcci_ld_hints & 0x1)
276 p += sprintf(p, "[%s]", cache_ld_hints[k]); 270 seq_printf(m, "[%s]", cache_ld_hints[k]);
277 cci.pcci_ld_hints >>=1; 271 cci.pcci_ld_hints >>=1;
278 } 272 }
279 p += sprintf(p, 273 seq_printf(m,
280 "\n\tAlias boundary : %d byte(s)\n" 274 "\n\tAlias boundary : %d byte(s)\n"
281 "\tTag LSB : %d\n" 275 "\tTag LSB : %d\n"
282 "\tTag MSB : %d\n", 276 "\tTag MSB : %d\n",
283 1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb, 277 1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb,
284 cci.pcci_tag_msb); 278 cci.pcci_tag_msb);
285 279
286 /* when unified, data(j=2) is enough */ 280 /* when unified, data(j=2) is enough */
287 if (cci.pcci_unified) break; 281 if (cci.pcci_unified)
282 break;
288 } 283 }
289 } 284 }
290 return p - page; 285 return 0;
291} 286}
292 287
293 288
294static int 289static int vm_info(struct seq_file *m)
295vm_info(char *page)
296{ 290{
297 char *p = page;
298 u64 tr_pages =0, vw_pages=0, tc_pages; 291 u64 tr_pages =0, vw_pages=0, tc_pages;
299 u64 attrib; 292 u64 attrib;
300 pal_vm_info_1_u_t vm_info_1; 293 pal_vm_info_1_u_t vm_info_1;
@@ -309,7 +302,7 @@ vm_info(char *page)
309 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status); 302 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);
310 } else { 303 } else {
311 304
312 p += sprintf(p, 305 seq_printf(m,
313 "Physical Address Space : %d bits\n" 306 "Physical Address Space : %d bits\n"
314 "Virtual Address Space : %d bits\n" 307 "Virtual Address Space : %d bits\n"
315 "Protection Key Registers(PKR) : %d\n" 308 "Protection Key Registers(PKR) : %d\n"
@@ -324,49 +317,49 @@ vm_info(char *page)
324 vm_info_1.pal_vm_info_1_s.hash_tag_id, 317 vm_info_1.pal_vm_info_1_s.hash_tag_id,
325 vm_info_2.pal_vm_info_2_s.rid_size); 318 vm_info_2.pal_vm_info_2_s.rid_size);
326 if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES) 319 if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES)
327 p += sprintf(p, "unlimited\n"); 320 seq_puts(m, "unlimited\n");
328 else 321 else
329 p += sprintf(p, "%d\n", 322 seq_printf(m, "%d\n",
330 vm_info_2.pal_vm_info_2_s.max_purges ? 323 vm_info_2.pal_vm_info_2_s.max_purges ?
331 vm_info_2.pal_vm_info_2_s.max_purges : 1); 324 vm_info_2.pal_vm_info_2_s.max_purges : 1);
332 } 325 }
333 326
334 if (ia64_pal_mem_attrib(&attrib) == 0) { 327 if (ia64_pal_mem_attrib(&attrib) == 0) {
335 p += sprintf(p, "Supported memory attributes : "); 328 seq_puts(m, "Supported memory attributes : ");
336 sep = ""; 329 sep = "";
337 for (i = 0; i < 8; i++) { 330 for (i = 0; i < 8; i++) {
338 if (attrib & (1 << i)) { 331 if (attrib & (1 << i)) {
339 p += sprintf(p, "%s%s", sep, mem_attrib[i]); 332 seq_printf(m, "%s%s", sep, mem_attrib[i]);
340 sep = ", "; 333 sep = ", ";
341 } 334 }
342 } 335 }
343 p += sprintf(p, "\n"); 336 seq_putc(m, '\n');
344 } 337 }
345 338
346 if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) { 339 if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) {
347 printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status); 340 printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status);
348 } else { 341 } else {
349 342
350 p += sprintf(p, 343 seq_printf(m,
351 "\nTLB walker : %simplemented\n" 344 "\nTLB walker : %simplemented\n"
352 "Number of DTR : %d\n" 345 "Number of DTR : %d\n"
353 "Number of ITR : %d\n" 346 "Number of ITR : %d\n"
354 "TLB insertable page sizes : ", 347 "TLB insertable page sizes : ",
355 vm_info_1.pal_vm_info_1_s.vw ? "" : "not ", 348 vm_info_1.pal_vm_info_1_s.vw ? "" : "not ",
356 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1, 349 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1,
357 vm_info_1.pal_vm_info_1_s.max_itr_entry+1); 350 vm_info_1.pal_vm_info_1_s.max_itr_entry+1);
358
359 351
360 p = bitvector_process(p, tr_pages); 352 bitvector_process(m, tr_pages);
361 353
362 p += sprintf(p, "\nTLB purgeable page sizes : "); 354 seq_puts(m, "\nTLB purgeable page sizes : ");
363 355
364 p = bitvector_process(p, vw_pages); 356 bitvector_process(m, vw_pages);
365 } 357 }
366 if ((status=ia64_get_ptce(&ptce)) != 0) { 358
359 if ((status = ia64_get_ptce(&ptce)) != 0) {
367 printk(KERN_ERR "ia64_get_ptce=%ld\n", status); 360 printk(KERN_ERR "ia64_get_ptce=%ld\n", status);
368 } else { 361 } else {
369 p += sprintf(p, 362 seq_printf(m,
370 "\nPurge base address : 0x%016lx\n" 363 "\nPurge base address : 0x%016lx\n"
371 "Purge outer loop count : %d\n" 364 "Purge outer loop count : %d\n"
372 "Purge inner loop count : %d\n" 365 "Purge inner loop count : %d\n"
@@ -375,7 +368,7 @@ vm_info(char *page)
375 ptce.base, ptce.count[0], ptce.count[1], 368 ptce.base, ptce.count[0], ptce.count[1],
376 ptce.stride[0], ptce.stride[1]); 369 ptce.stride[0], ptce.stride[1]);
377 370
378 p += sprintf(p, 371 seq_printf(m,
379 "TC Levels : %d\n" 372 "TC Levels : %d\n"
380 "Unique TC(s) : %d\n", 373 "Unique TC(s) : %d\n",
381 vm_info_1.pal_vm_info_1_s.num_tc_levels, 374 vm_info_1.pal_vm_info_1_s.num_tc_levels,
@@ -385,13 +378,11 @@ vm_info(char *page)
385 for (j=2; j>0 ; j--) { 378 for (j=2; j>0 ; j--) {
386 tc_pages = 0; /* just in case */ 379 tc_pages = 0; /* just in case */
387 380
388
389 /* even without unification, some levels may not be present */ 381 /* even without unification, some levels may not be present */
390 if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) { 382 if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0)
391 continue; 383 continue;
392 }
393 384
394 p += sprintf(p, 385 seq_printf(m,
395 "\n%s Translation Cache Level %d:\n" 386 "\n%s Translation Cache Level %d:\n"
396 "\tHash sets : %d\n" 387 "\tHash sets : %d\n"
397 "\tAssociativity : %d\n" 388 "\tAssociativity : %d\n"
@@ -403,15 +394,15 @@ vm_info(char *page)
403 tc_info.tc_num_entries); 394 tc_info.tc_num_entries);
404 395
405 if (tc_info.tc_pf) 396 if (tc_info.tc_pf)
406 p += sprintf(p, "PreferredPageSizeOptimized "); 397 seq_puts(m, "PreferredPageSizeOptimized ");
407 if (tc_info.tc_unified) 398 if (tc_info.tc_unified)
408 p += sprintf(p, "Unified "); 399 seq_puts(m, "Unified ");
409 if (tc_info.tc_reduce_tr) 400 if (tc_info.tc_reduce_tr)
410 p += sprintf(p, "TCReduction"); 401 seq_puts(m, "TCReduction");
411 402
412 p += sprintf(p, "\n\tSupported page sizes: "); 403 seq_puts(m, "\n\tSupported page sizes: ");
413 404
414 p = bitvector_process(p, tc_pages); 405 bitvector_process(m, tc_pages);
415 406
416 /* when unified date (j=2) is enough */ 407 /* when unified date (j=2) is enough */
417 if (tc_info.tc_unified) 408 if (tc_info.tc_unified)
@@ -419,16 +410,14 @@ vm_info(char *page)
419 } 410 }
420 } 411 }
421 } 412 }
422 p += sprintf(p, "\n");
423 413
424 return p - page; 414 seq_putc(m, '\n');
415 return 0;
425} 416}
426 417
427 418
428static int 419static int register_info(struct seq_file *m)
429register_info(char *page)
430{ 420{
431 char *p = page;
432 u64 reg_info[2]; 421 u64 reg_info[2];
433 u64 info; 422 u64 info;
434 unsigned long phys_stacked; 423 unsigned long phys_stacked;
@@ -442,35 +431,31 @@ register_info(char *page)
442 }; 431 };
443 432
444 for(info=0; info < 4; info++) { 433 for(info=0; info < 4; info++) {
445 434 if (ia64_pal_register_info(info, &reg_info[0], &reg_info[1]) != 0)
446 if (ia64_pal_register_info(info, &reg_info[0], &reg_info[1]) != 0) return 0; 435 return 0;
447 436 seq_printf(m, "%-32s : ", info_type[info]);
448 p += sprintf(p, "%-32s : ", info_type[info]); 437 bitregister_process(m, reg_info, 128);
449 438 seq_putc(m, '\n');
450 p = bitregister_process(p, reg_info, 128);
451
452 p += sprintf(p, "\n");
453 } 439 }
454 440
455 if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) { 441 if (ia64_pal_rse_info(&phys_stacked, &hints) == 0)
442 seq_printf(m,
443 "RSE stacked physical registers : %ld\n"
444 "RSE load/store hints : %ld (%s)\n",
445 phys_stacked, hints.ph_data,
446 hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)");
456 447
457 p += sprintf(p,
458 "RSE stacked physical registers : %ld\n"
459 "RSE load/store hints : %ld (%s)\n",
460 phys_stacked, hints.ph_data,
461 hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)");
462 }
463 if (ia64_pal_debug_info(&iregs, &dregs)) 448 if (ia64_pal_debug_info(&iregs, &dregs))
464 return 0; 449 return 0;
465 450
466 p += sprintf(p, 451 seq_printf(m,
467 "Instruction debug register pairs : %ld\n" 452 "Instruction debug register pairs : %ld\n"
468 "Data debug register pairs : %ld\n", iregs, dregs); 453 "Data debug register pairs : %ld\n", iregs, dregs);
469 454
470 return p - page; 455 return 0;
471} 456}
472 457
473static char *proc_features_0[]={ /* Feature set 0 */ 458static const char *const proc_features_0[]={ /* Feature set 0 */
474 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 459 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
475 NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, 460 NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
476 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 461 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
@@ -502,7 +487,7 @@ static char *proc_features_0[]={ /* Feature set 0 */
502 "Enable BERR promotion" 487 "Enable BERR promotion"
503}; 488};
504 489
505static char *proc_features_16[]={ /* Feature set 16 */ 490static const char *const proc_features_16[]={ /* Feature set 16 */
506 "Disable ETM", 491 "Disable ETM",
507 "Enable ETM", 492 "Enable ETM",
508 "Enable MCA on half-way timer", 493 "Enable MCA on half-way timer",
@@ -522,7 +507,7 @@ static char *proc_features_16[]={ /* Feature set 16 */
522 NULL, NULL, NULL, NULL, NULL 507 NULL, NULL, NULL, NULL, NULL
523}; 508};
524 509
525static char **proc_features[]={ 510static const char *const *const proc_features[]={
526 proc_features_0, 511 proc_features_0,
527 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 512 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
528 NULL, NULL, NULL, NULL, 513 NULL, NULL, NULL, NULL,
@@ -530,11 +515,10 @@ static char **proc_features[]={
530 NULL, NULL, NULL, NULL, 515 NULL, NULL, NULL, NULL,
531}; 516};
532 517
533static char * feature_set_info(char *page, u64 avail, u64 status, u64 control, 518static void feature_set_info(struct seq_file *m, u64 avail, u64 status, u64 control,
534 unsigned long set) 519 unsigned long set)
535{ 520{
536 char *p = page; 521 const char *const *vf, *const *v;
537 char **vf, **v;
538 int i; 522 int i;
539 523
540 vf = v = proc_features[set]; 524 vf = v = proc_features[set];
@@ -547,13 +531,13 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,
547 if (vf) 531 if (vf)
548 v = vf + i; 532 v = vf + i;
549 if ( v && *v ) { 533 if ( v && *v ) {
550 p += sprintf(p, "%-40s : %s %s\n", *v, 534 seq_printf(m, "%-40s : %s %s\n", *v,
551 avail & 0x1 ? (status & 0x1 ? 535 avail & 0x1 ? (status & 0x1 ?
552 "On " : "Off"): "", 536 "On " : "Off"): "",
553 avail & 0x1 ? (control & 0x1 ? 537 avail & 0x1 ? (control & 0x1 ?
554 "Ctrl" : "NoCtrl"): ""); 538 "Ctrl" : "NoCtrl"): "");
555 } else { 539 } else {
556 p += sprintf(p, "Feature set %2ld bit %2d\t\t\t" 540 seq_printf(m, "Feature set %2ld bit %2d\t\t\t"
557 " : %s %s\n", 541 " : %s %s\n",
558 set, i, 542 set, i,
559 avail & 0x1 ? (status & 0x1 ? 543 avail & 0x1 ? (status & 0x1 ?
@@ -562,36 +546,32 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,
562 "Ctrl" : "NoCtrl"): ""); 546 "Ctrl" : "NoCtrl"): "");
563 } 547 }
564 } 548 }
565 return p;
566} 549}
567 550
568static int 551static int processor_info(struct seq_file *m)
569processor_info(char *page)
570{ 552{
571 char *p = page;
572 u64 avail=1, status=1, control=1, feature_set=0; 553 u64 avail=1, status=1, control=1, feature_set=0;
573 s64 ret; 554 s64 ret;
574 555
575 do { 556 do {
576 ret = ia64_pal_proc_get_features(&avail, &status, &control, 557 ret = ia64_pal_proc_get_features(&avail, &status, &control,
577 feature_set); 558 feature_set);
578 if (ret < 0) { 559 if (ret < 0)
579 return p - page; 560 return 0;
580 } 561
581 if (ret == 1) { 562 if (ret == 1) {
582 feature_set++; 563 feature_set++;
583 continue; 564 continue;
584 } 565 }
585 566
586 p = feature_set_info(p, avail, status, control, feature_set); 567 feature_set_info(m, avail, status, control, feature_set);
587
588 feature_set++; 568 feature_set++;
589 } while(1); 569 } while(1);
590 570
591 return p - page; 571 return 0;
592} 572}
593 573
594static const char *bus_features[]={ 574static const char *const bus_features[]={
595 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 575 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
596 NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, 576 NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
597 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, 577 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
@@ -617,125 +597,118 @@ static const char *bus_features[]={
617}; 597};
618 598
619 599
620static int 600static int bus_info(struct seq_file *m)
621bus_info(char *page)
622{ 601{
623 char *p = page; 602 const char *const *v = bus_features;
624 const char **v = bus_features;
625 pal_bus_features_u_t av, st, ct; 603 pal_bus_features_u_t av, st, ct;
626 u64 avail, status, control; 604 u64 avail, status, control;
627 int i; 605 int i;
628 s64 ret; 606 s64 ret;
629 607
630 if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0) return 0; 608 if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0)
609 return 0;
631 610
632 avail = av.pal_bus_features_val; 611 avail = av.pal_bus_features_val;
633 status = st.pal_bus_features_val; 612 status = st.pal_bus_features_val;
634 control = ct.pal_bus_features_val; 613 control = ct.pal_bus_features_val;
635 614
636 for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) { 615 for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) {
637 if ( ! *v ) continue; 616 if ( ! *v )
638 p += sprintf(p, "%-48s : %s%s %s\n", *v, 617 continue;
639 avail & 0x1 ? "" : "NotImpl", 618 seq_printf(m, "%-48s : %s%s %s\n", *v,
640 avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "", 619 avail & 0x1 ? "" : "NotImpl",
641 avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): ""); 620 avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "",
621 avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): "");
642 } 622 }
643 return p - page; 623 return 0;
644} 624}
645 625
646static int 626static int version_info(struct seq_file *m)
647version_info(char *page)
648{ 627{
649 pal_version_u_t min_ver, cur_ver; 628 pal_version_u_t min_ver, cur_ver;
650 char *p = page;
651 629
652 if (ia64_pal_version(&min_ver, &cur_ver) != 0) 630 if (ia64_pal_version(&min_ver, &cur_ver) != 0)
653 return 0; 631 return 0;
654 632
655 p += sprintf(p, 633 seq_printf(m,
656 "PAL_vendor : 0x%02x (min=0x%02x)\n" 634 "PAL_vendor : 0x%02x (min=0x%02x)\n"
657 "PAL_A : %02x.%02x (min=%02x.%02x)\n" 635 "PAL_A : %02x.%02x (min=%02x.%02x)\n"
658 "PAL_B : %02x.%02x (min=%02x.%02x)\n", 636 "PAL_B : %02x.%02x (min=%02x.%02x)\n",
659 cur_ver.pal_version_s.pv_pal_vendor, 637 cur_ver.pal_version_s.pv_pal_vendor,
660 min_ver.pal_version_s.pv_pal_vendor, 638 min_ver.pal_version_s.pv_pal_vendor,
661 cur_ver.pal_version_s.pv_pal_a_model, 639 cur_ver.pal_version_s.pv_pal_a_model,
662 cur_ver.pal_version_s.pv_pal_a_rev, 640 cur_ver.pal_version_s.pv_pal_a_rev,
663 min_ver.pal_version_s.pv_pal_a_model, 641 min_ver.pal_version_s.pv_pal_a_model,
664 min_ver.pal_version_s.pv_pal_a_rev, 642 min_ver.pal_version_s.pv_pal_a_rev,
665 cur_ver.pal_version_s.pv_pal_b_model, 643 cur_ver.pal_version_s.pv_pal_b_model,
666 cur_ver.pal_version_s.pv_pal_b_rev, 644 cur_ver.pal_version_s.pv_pal_b_rev,
667 min_ver.pal_version_s.pv_pal_b_model, 645 min_ver.pal_version_s.pv_pal_b_model,
668 min_ver.pal_version_s.pv_pal_b_rev); 646 min_ver.pal_version_s.pv_pal_b_rev);
669 return p - page; 647 return 0;
670} 648}
671 649
672static int 650static int perfmon_info(struct seq_file *m)
673perfmon_info(char *page)
674{ 651{
675 char *p = page;
676 u64 pm_buffer[16]; 652 u64 pm_buffer[16];
677 pal_perf_mon_info_u_t pm_info; 653 pal_perf_mon_info_u_t pm_info;
678 654
679 if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0) return 0; 655 if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0)
680 656 return 0;
681 p += sprintf(p,
682 "PMC/PMD pairs : %d\n"
683 "Counter width : %d bits\n"
684 "Cycle event number : %d\n"
685 "Retired event number : %d\n"
686 "Implemented PMC : ",
687 pm_info.pal_perf_mon_info_s.generic, pm_info.pal_perf_mon_info_s.width,
688 pm_info.pal_perf_mon_info_s.cycles, pm_info.pal_perf_mon_info_s.retired);
689 657
690 p = bitregister_process(p, pm_buffer, 256); 658 seq_printf(m,
691 p += sprintf(p, "\nImplemented PMD : "); 659 "PMC/PMD pairs : %d\n"
692 p = bitregister_process(p, pm_buffer+4, 256); 660 "Counter width : %d bits\n"
693 p += sprintf(p, "\nCycles count capable : "); 661 "Cycle event number : %d\n"
694 p = bitregister_process(p, pm_buffer+8, 256); 662 "Retired event number : %d\n"
695 p += sprintf(p, "\nRetired bundles count capable : "); 663 "Implemented PMC : ",
664 pm_info.pal_perf_mon_info_s.generic,
665 pm_info.pal_perf_mon_info_s.width,
666 pm_info.pal_perf_mon_info_s.cycles,
667 pm_info.pal_perf_mon_info_s.retired);
668
669 bitregister_process(m, pm_buffer, 256);
670 seq_puts(m, "\nImplemented PMD : ");
671 bitregister_process(m, pm_buffer+4, 256);
672 seq_puts(m, "\nCycles count capable : ");
673 bitregister_process(m, pm_buffer+8, 256);
674 seq_puts(m, "\nRetired bundles count capable : ");
696 675
697#ifdef CONFIG_ITANIUM 676#ifdef CONFIG_ITANIUM
698 /* 677 /*
699 * PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES 678 * PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES
700 * which is wrong, both PMC4 and PMD5 support it. 679 * which is wrong, both PMC4 and PMD5 support it.
701 */ 680 */
702 if (pm_buffer[12] == 0x10) pm_buffer[12]=0x30; 681 if (pm_buffer[12] == 0x10)
682 pm_buffer[12]=0x30;
703#endif 683#endif
704 684
705 p = bitregister_process(p, pm_buffer+12, 256); 685 bitregister_process(m, pm_buffer+12, 256);
706 686 seq_putc(m, '\n');
707 p += sprintf(p, "\n"); 687 return 0;
708
709 return p - page;
710} 688}
711 689
712static int 690static int frequency_info(struct seq_file *m)
713frequency_info(char *page)
714{ 691{
715 char *p = page;
716 struct pal_freq_ratio proc, itc, bus; 692 struct pal_freq_ratio proc, itc, bus;
717 unsigned long base; 693 unsigned long base;
718 694
719 if (ia64_pal_freq_base(&base) == -1) 695 if (ia64_pal_freq_base(&base) == -1)
720 p += sprintf(p, "Output clock : not implemented\n"); 696 seq_puts(m, "Output clock : not implemented\n");
721 else 697 else
722 p += sprintf(p, "Output clock : %ld ticks/s\n", base); 698 seq_printf(m, "Output clock : %ld ticks/s\n", base);
723 699
724 if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0; 700 if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0;
725 701
726 p += sprintf(p, 702 seq_printf(m,
727 "Processor/Clock ratio : %d/%d\n" 703 "Processor/Clock ratio : %d/%d\n"
728 "Bus/Clock ratio : %d/%d\n" 704 "Bus/Clock ratio : %d/%d\n"
729 "ITC/Clock ratio : %d/%d\n", 705 "ITC/Clock ratio : %d/%d\n",
730 proc.num, proc.den, bus.num, bus.den, itc.num, itc.den); 706 proc.num, proc.den, bus.num, bus.den, itc.num, itc.den);
731 707 return 0;
732 return p - page;
733} 708}
734 709
735static int 710static int tr_info(struct seq_file *m)
736tr_info(char *page)
737{ 711{
738 char *p = page;
739 long status; 712 long status;
740 pal_tr_valid_u_t tr_valid; 713 pal_tr_valid_u_t tr_valid;
741 u64 tr_buffer[4]; 714 u64 tr_buffer[4];
@@ -794,39 +767,40 @@ tr_info(char *page)
794 767
795 ifa_reg = (struct ifa_reg *)&tr_buffer[2]; 768 ifa_reg = (struct ifa_reg *)&tr_buffer[2];
796 769
797 if (ifa_reg->valid == 0) continue; 770 if (ifa_reg->valid == 0)
771 continue;
798 772
799 gr_reg = (struct gr_reg *)tr_buffer; 773 gr_reg = (struct gr_reg *)tr_buffer;
800 itir_reg = (struct itir_reg *)&tr_buffer[1]; 774 itir_reg = (struct itir_reg *)&tr_buffer[1];
801 rid_reg = (struct rid_reg *)&tr_buffer[3]; 775 rid_reg = (struct rid_reg *)&tr_buffer[3];
802 776
803 pgm = -1 << (itir_reg->ps - 12); 777 pgm = -1 << (itir_reg->ps - 12);
804 p += sprintf(p, 778 seq_printf(m,
805 "%cTR%lu: av=%d pv=%d dv=%d mv=%d\n" 779 "%cTR%lu: av=%d pv=%d dv=%d mv=%d\n"
806 "\tppn : 0x%lx\n" 780 "\tppn : 0x%lx\n"
807 "\tvpn : 0x%lx\n" 781 "\tvpn : 0x%lx\n"
808 "\tps : ", 782 "\tps : ",
809 "ID"[i], j, 783 "ID"[i], j,
810 tr_valid.pal_tr_valid_s.access_rights_valid, 784 tr_valid.pal_tr_valid_s.access_rights_valid,
811 tr_valid.pal_tr_valid_s.priv_level_valid, 785 tr_valid.pal_tr_valid_s.priv_level_valid,
812 tr_valid.pal_tr_valid_s.dirty_bit_valid, 786 tr_valid.pal_tr_valid_s.dirty_bit_valid,
813 tr_valid.pal_tr_valid_s.mem_attr_valid, 787 tr_valid.pal_tr_valid_s.mem_attr_valid,
814 (gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12); 788 (gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12);
815 789
816 p = bitvector_process(p, 1<< itir_reg->ps); 790 bitvector_process(m, 1<< itir_reg->ps);
817 791
818 p += sprintf(p, 792 seq_printf(m,
819 "\n\tpl : %d\n" 793 "\n\tpl : %d\n"
820 "\tar : %d\n" 794 "\tar : %d\n"
821 "\trid : %x\n" 795 "\trid : %x\n"
822 "\tp : %d\n" 796 "\tp : %d\n"
823 "\tma : %d\n" 797 "\tma : %d\n"
824 "\td : %d\n", 798 "\td : %d\n",
825 gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma, 799 gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma,
826 gr_reg->d); 800 gr_reg->d);
827 } 801 }
828 } 802 }
829 return p - page; 803 return 0;
830} 804}
831 805
832 806
@@ -834,7 +808,7 @@ tr_info(char *page)
834/* 808/*
835 * List {name,function} pairs for every entry in /proc/palinfo/cpu* 809 * List {name,function} pairs for every entry in /proc/palinfo/cpu*
836 */ 810 */
837static palinfo_entry_t palinfo_entries[]={ 811static const palinfo_entry_t palinfo_entries[]={
838 { "version_info", version_info, }, 812 { "version_info", version_info, },
839 { "vm_info", vm_info, }, 813 { "vm_info", vm_info, },
840 { "cache_info", cache_info, }, 814 { "cache_info", cache_info, },
@@ -876,7 +850,7 @@ typedef union {
876 */ 850 */
877typedef struct { 851typedef struct {
878 palinfo_func_t func; /* pointer to function to call */ 852 palinfo_func_t func; /* pointer to function to call */
879 char *page; /* buffer to store results */ 853 struct seq_file *m; /* buffer to store results */
880 int ret; /* return value from call */ 854 int ret; /* return value from call */
881} palinfo_smp_data_t; 855} palinfo_smp_data_t;
882 856
@@ -889,7 +863,7 @@ static void
889palinfo_smp_call(void *info) 863palinfo_smp_call(void *info)
890{ 864{
891 palinfo_smp_data_t *data = (palinfo_smp_data_t *)info; 865 palinfo_smp_data_t *data = (palinfo_smp_data_t *)info;
892 data->ret = (*data->func)(data->page); 866 data->ret = (*data->func)(data->m);
893} 867}
894 868
895/* 869/*
@@ -899,13 +873,13 @@ palinfo_smp_call(void *info)
899 * otherwise how many bytes in the "page" buffer were written 873 * otherwise how many bytes in the "page" buffer were written
900 */ 874 */
901static 875static
902int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) 876int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f)
903{ 877{
904 palinfo_smp_data_t ptr; 878 palinfo_smp_data_t ptr;
905 int ret; 879 int ret;
906 880
907 ptr.func = palinfo_entries[f->func_id].proc_read; 881 ptr.func = palinfo_entries[f->func_id].proc_read;
908 ptr.page = page; 882 ptr.m = m;
909 ptr.ret = 0; /* just in case */ 883 ptr.ret = 0; /* just in case */
910 884
911 885
@@ -919,7 +893,7 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)
919} 893}
920#else /* ! CONFIG_SMP */ 894#else /* ! CONFIG_SMP */
921static 895static
922int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) 896int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f)
923{ 897{
924 printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n"); 898 printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n");
925 return 0; 899 return 0;
@@ -929,34 +903,35 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)
929/* 903/*
930 * Entry point routine: all calls go through this function 904 * Entry point routine: all calls go through this function
931 */ 905 */
932static int 906static int proc_palinfo_show(struct seq_file *m, void *v)
933palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data)
934{ 907{
935 int len=0; 908 pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&m->private;
936 pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&data;
937 909
938 /* 910 /*
939 * in SMP mode, we may need to call another CPU to get correct 911 * in SMP mode, we may need to call another CPU to get correct
940 * information. PAL, by definition, is processor specific 912 * information. PAL, by definition, is processor specific
941 */ 913 */
942 if (f->req_cpu == get_cpu()) 914 if (f->req_cpu == get_cpu())
943 len = (*palinfo_entries[f->func_id].proc_read)(page); 915 (*palinfo_entries[f->func_id].proc_read)(m);
944 else 916 else
945 len = palinfo_handle_smp(f, page); 917 palinfo_handle_smp(m, f);
946 918
947 put_cpu(); 919 put_cpu();
920 return 0;
921}
948 922
949 if (len <= off+count) *eof = 1; 923static int proc_palinfo_open(struct inode *inode, struct file *file)
950 924{
951 *start = page + off; 925 return single_open(file, proc_palinfo_show, PDE_DATA(inode));
952 len -= off;
953
954 if (len>count) len = count;
955 if (len<0) len = 0;
956
957 return len;
958} 926}
959 927
928static const struct file_operations proc_palinfo_fops = {
929 .open = proc_palinfo_open,
930 .read = seq_read,
931 .llseek = seq_lseek,
932 .release = single_release,
933};
934
960static void __cpuinit 935static void __cpuinit
961create_palinfo_proc_entries(unsigned int cpu) 936create_palinfo_proc_entries(unsigned int cpu)
962{ 937{
@@ -974,9 +949,8 @@ create_palinfo_proc_entries(unsigned int cpu)
974 949
975 for (j=0; j < NR_PALINFO_ENTRIES; j++) { 950 for (j=0; j < NR_PALINFO_ENTRIES; j++) {
976 f.func_id = j; 951 f.func_id = j;
977 create_proc_read_entry( 952 proc_create_data(palinfo_entries[j].name, 0, cpu_dir,
978 palinfo_entries[j].name, 0, cpu_dir, 953 &proc_palinfo_fops, (void *)f.value);
979 palinfo_read_entry, (void *)f.value);
980 } 954 }
981} 955}
982 956
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 2eda28414abb..9ea25fce06d5 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -42,6 +42,7 @@
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/tracehook.h> 43#include <linux/tracehook.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/cpu.h>
45 46
46#include <asm/errno.h> 47#include <asm/errno.h>
47#include <asm/intrinsics.h> 48#include <asm/intrinsics.h>
@@ -1322,8 +1323,6 @@ out:
1322} 1323}
1323EXPORT_SYMBOL(pfm_unregister_buffer_fmt); 1324EXPORT_SYMBOL(pfm_unregister_buffer_fmt);
1324 1325
1325extern void update_pal_halt_status(int);
1326
1327static int 1326static int
1328pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu) 1327pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
1329{ 1328{
@@ -1371,9 +1370,9 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
1371 cpu)); 1370 cpu));
1372 1371
1373 /* 1372 /*
1374 * disable default_idle() to go to PAL_HALT 1373 * Force idle() into poll mode
1375 */ 1374 */
1376 update_pal_halt_status(0); 1375 cpu_idle_poll_ctrl(true);
1377 1376
1378 UNLOCK_PFS(flags); 1377 UNLOCK_PFS(flags);
1379 1378
@@ -1430,11 +1429,8 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
1430 is_syswide, 1429 is_syswide,
1431 cpu)); 1430 cpu));
1432 1431
1433 /* 1432 /* Undo forced polling. Last session reenables pal_halt */
1434 * if possible, enable default_idle() to go into PAL_HALT 1433 cpu_idle_poll_ctrl(false);
1435 */
1436 if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0)
1437 update_pal_halt_status(1);
1438 1434
1439 UNLOCK_PFS(flags); 1435 UNLOCK_PFS(flags);
1440 1436
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 6f7dc8b7b35c..55d4ba47a907 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -96,21 +96,13 @@ show_stack (struct task_struct *task, unsigned long *sp)
96} 96}
97 97
98void 98void
99dump_stack (void)
100{
101 show_stack(NULL, NULL);
102}
103
104EXPORT_SYMBOL(dump_stack);
105
106void
107show_regs (struct pt_regs *regs) 99show_regs (struct pt_regs *regs)
108{ 100{
109 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; 101 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
110 102
111 print_modules(); 103 print_modules();
112 printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current), 104 printk("\n");
113 smp_processor_id(), current->comm); 105 show_regs_print_info(KERN_DEFAULT);
114 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n", 106 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
115 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(), 107 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
116 init_utsname()->release); 108 init_utsname()->release);
@@ -209,41 +201,13 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
209 local_irq_disable(); /* force interrupt disable */ 201 local_irq_disable(); /* force interrupt disable */
210} 202}
211 203
212static int pal_halt = 1;
213static int can_do_pal_halt = 1;
214
215static int __init nohalt_setup(char * str) 204static int __init nohalt_setup(char * str)
216{ 205{
217 pal_halt = can_do_pal_halt = 0; 206 cpu_idle_poll_ctrl(true);
218 return 1; 207 return 1;
219} 208}
220__setup("nohalt", nohalt_setup); 209__setup("nohalt", nohalt_setup);
221 210
222void
223update_pal_halt_status(int status)
224{
225 can_do_pal_halt = pal_halt && status;
226}
227
228/*
229 * We use this if we don't have any better idle routine..
230 */
231void
232default_idle (void)
233{
234 local_irq_enable();
235 while (!need_resched()) {
236 if (can_do_pal_halt) {
237 local_irq_disable();
238 if (!need_resched()) {
239 safe_halt();
240 }
241 local_irq_enable();
242 } else
243 cpu_relax();
244 }
245}
246
247#ifdef CONFIG_HOTPLUG_CPU 211#ifdef CONFIG_HOTPLUG_CPU
248/* We don't actually take CPU down, just spin without interrupts. */ 212/* We don't actually take CPU down, just spin without interrupts. */
249static inline void play_dead(void) 213static inline void play_dead(void)
@@ -270,47 +234,29 @@ static inline void play_dead(void)
270} 234}
271#endif /* CONFIG_HOTPLUG_CPU */ 235#endif /* CONFIG_HOTPLUG_CPU */
272 236
273void __attribute__((noreturn)) 237void arch_cpu_idle_dead(void)
274cpu_idle (void) 238{
239 play_dead();
240}
241
242void arch_cpu_idle(void)
275{ 243{
276 void (*mark_idle)(int) = ia64_mark_idle; 244 void (*mark_idle)(int) = ia64_mark_idle;
277 int cpu = smp_processor_id();
278
279 /* endless idle loop with no priority at all */
280 while (1) {
281 rcu_idle_enter();
282 if (can_do_pal_halt) {
283 current_thread_info()->status &= ~TS_POLLING;
284 /*
285 * TS_POLLING-cleared state must be visible before we
286 * test NEED_RESCHED:
287 */
288 smp_mb();
289 } else {
290 current_thread_info()->status |= TS_POLLING;
291 }
292 245
293 if (!need_resched()) {
294#ifdef CONFIG_SMP 246#ifdef CONFIG_SMP
295 min_xtp(); 247 min_xtp();
296#endif 248#endif
297 rmb(); 249 rmb();
298 if (mark_idle) 250 if (mark_idle)
299 (*mark_idle)(1); 251 (*mark_idle)(1);
300 252
301 default_idle(); 253 safe_halt();
302 if (mark_idle) 254
303 (*mark_idle)(0); 255 if (mark_idle)
256 (*mark_idle)(0);
304#ifdef CONFIG_SMP 257#ifdef CONFIG_SMP
305 normal_xtp(); 258 normal_xtp();
306#endif 259#endif
307 }
308 rcu_idle_exit();
309 schedule_preempt_disabled();
310 check_pgt_cache();
311 if (cpu_is_offline(cpu))
312 play_dead();
313 }
314} 260}
315 261
316void 262void
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index aa527d7e91f2..4bc580af67b3 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -40,6 +40,7 @@
40#include <linux/cpu.h> 40#include <linux/cpu.h>
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
43#include <linux/seq_file.h>
43#include <linux/module.h> 44#include <linux/module.h>
44#include <linux/smp.h> 45#include <linux/smp.h>
45#include <linux/timer.h> 46#include <linux/timer.h>
@@ -53,7 +54,7 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>");
53MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); 54MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");
54MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
55 56
56static int salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data); 57static const struct file_operations proc_salinfo_fops;
57 58
58typedef struct { 59typedef struct {
59 const char *name; /* name of the proc entry */ 60 const char *name; /* name of the proc entry */
@@ -65,7 +66,7 @@ typedef struct {
65 * List {name,feature} pairs for every entry in /proc/sal/<feature> 66 * List {name,feature} pairs for every entry in /proc/sal/<feature>
66 * that this module exports 67 * that this module exports
67 */ 68 */
68static salinfo_entry_t salinfo_entries[]={ 69static const salinfo_entry_t salinfo_entries[]={
69 { "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, }, 70 { "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, },
70 { "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, }, 71 { "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, },
71 { "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, }, 72 { "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, },
@@ -301,9 +302,7 @@ salinfo_event_open(struct inode *inode, struct file *file)
301static ssize_t 302static ssize_t
302salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) 303salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
303{ 304{
304 struct inode *inode = file_inode(file); 305 struct salinfo_data *data = PDE_DATA(file_inode(file));
305 struct proc_dir_entry *entry = PDE(inode);
306 struct salinfo_data *data = entry->data;
307 char cmd[32]; 306 char cmd[32];
308 size_t size; 307 size_t size;
309 int i, n, cpu = -1; 308 int i, n, cpu = -1;
@@ -360,8 +359,7 @@ static const struct file_operations salinfo_event_fops = {
360static int 359static int
361salinfo_log_open(struct inode *inode, struct file *file) 360salinfo_log_open(struct inode *inode, struct file *file)
362{ 361{
363 struct proc_dir_entry *entry = PDE(inode); 362 struct salinfo_data *data = PDE_DATA(inode);
364 struct salinfo_data *data = entry->data;
365 363
366 if (!capable(CAP_SYS_ADMIN)) 364 if (!capable(CAP_SYS_ADMIN))
367 return -EPERM; 365 return -EPERM;
@@ -386,8 +384,7 @@ salinfo_log_open(struct inode *inode, struct file *file)
386static int 384static int
387salinfo_log_release(struct inode *inode, struct file *file) 385salinfo_log_release(struct inode *inode, struct file *file)
388{ 386{
389 struct proc_dir_entry *entry = PDE(inode); 387 struct salinfo_data *data = PDE_DATA(inode);
390 struct salinfo_data *data = entry->data;
391 388
392 if (data->state == STATE_NO_DATA) { 389 if (data->state == STATE_NO_DATA) {
393 vfree(data->log_buffer); 390 vfree(data->log_buffer);
@@ -463,9 +460,7 @@ retry:
463static ssize_t 460static ssize_t
464salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) 461salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
465{ 462{
466 struct inode *inode = file_inode(file); 463 struct salinfo_data *data = PDE_DATA(file_inode(file));
467 struct proc_dir_entry *entry = PDE(inode);
468 struct salinfo_data *data = entry->data;
469 u8 *buf; 464 u8 *buf;
470 u64 bufsize; 465 u64 bufsize;
471 466
@@ -524,9 +519,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
524static ssize_t 519static ssize_t
525salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) 520salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
526{ 521{
527 struct inode *inode = file_inode(file); 522 struct salinfo_data *data = PDE_DATA(file_inode(file));
528 struct proc_dir_entry *entry = PDE(inode);
529 struct salinfo_data *data = entry->data;
530 char cmd[32]; 523 char cmd[32];
531 size_t size; 524 size_t size;
532 u32 offset; 525 u32 offset;
@@ -637,8 +630,9 @@ salinfo_init(void)
637 630
638 for (i=0; i < NR_SALINFO_ENTRIES; i++) { 631 for (i=0; i < NR_SALINFO_ENTRIES; i++) {
639 /* pass the feature bit in question as misc data */ 632 /* pass the feature bit in question as misc data */
640 *sdir++ = create_proc_read_entry (salinfo_entries[i].name, 0, salinfo_dir, 633 *sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir,
641 salinfo_read, (void *)salinfo_entries[i].feature); 634 &proc_salinfo_fops,
635 (void *)salinfo_entries[i].feature);
642 } 636 }
643 637
644 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { 638 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
@@ -684,22 +678,23 @@ salinfo_init(void)
684 * 'data' contains an integer that corresponds to the feature we're 678 * 'data' contains an integer that corresponds to the feature we're
685 * testing 679 * testing
686 */ 680 */
687static int 681static int proc_salinfo_show(struct seq_file *m, void *v)
688salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data)
689{ 682{
690 int len = 0; 683 unsigned long data = (unsigned long)v;
691 684 seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n");
692 len = sprintf(page, (sal_platform_features & (unsigned long)data) ? "1\n" : "0\n"); 685 return 0;
693 686}
694 if (len <= off+count) *eof = 1;
695
696 *start = page + off;
697 len -= off;
698
699 if (len>count) len = count;
700 if (len<0) len = 0;
701 687
702 return len; 688static int proc_salinfo_open(struct inode *inode, struct file *file)
689{
690 return single_open(file, proc_salinfo_show, PDE_DATA(inode));
703} 691}
704 692
693static const struct file_operations proc_salinfo_fops = {
694 .open = proc_salinfo_open,
695 .read = seq_read,
696 .llseek = seq_lseek,
697 .release = single_release,
698};
699
705module_init(salinfo_init); 700module_init(salinfo_init);
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 2029cc0d2fc6..13bfdd22afc8 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -1063,6 +1063,7 @@ check_bugs (void)
1063static int __init run_dmi_scan(void) 1063static int __init run_dmi_scan(void)
1064{ 1064{
1065 dmi_scan_machine(); 1065 dmi_scan_machine();
1066 dmi_set_dump_stack_arch_desc();
1066 return 0; 1067 return 0;
1067} 1068}
1068core_initcall(run_dmi_scan); 1069core_initcall(run_dmi_scan);
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 500f1e4d9f9d..8d87168d218d 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -455,7 +455,7 @@ start_secondary (void *unused)
455 preempt_disable(); 455 preempt_disable();
456 smp_callin(); 456 smp_callin();
457 457
458 cpu_idle(); 458 cpu_startup_entry(CPUHP_ONLINE);
459 return 0; 459 return 0;
460} 460}
461 461
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig
index 2cd225f8c68d..990b86420cc6 100644
--- a/arch/ia64/kvm/Kconfig
+++ b/arch/ia64/kvm/Kconfig
@@ -21,12 +21,11 @@ config KVM
21 tristate "Kernel-based Virtual Machine (KVM) support" 21 tristate "Kernel-based Virtual Machine (KVM) support"
22 depends on BROKEN 22 depends on BROKEN
23 depends on HAVE_KVM && MODULES 23 depends on HAVE_KVM && MODULES
24 # for device assignment:
25 depends on PCI
26 depends on BROKEN 24 depends on BROKEN
27 select PREEMPT_NOTIFIERS 25 select PREEMPT_NOTIFIERS
28 select ANON_INODES 26 select ANON_INODES
29 select HAVE_KVM_IRQCHIP 27 select HAVE_KVM_IRQCHIP
28 select HAVE_KVM_IRQ_ROUTING
30 select KVM_APIC_ARCHITECTURE 29 select KVM_APIC_ARCHITECTURE
31 select KVM_MMIO 30 select KVM_MMIO
32 ---help--- 31 ---help---
@@ -50,6 +49,17 @@ config KVM_INTEL
50 Provides support for KVM on Itanium 2 processors equipped with the VT 49 Provides support for KVM on Itanium 2 processors equipped with the VT
51 extensions. 50 extensions.
52 51
52config KVM_DEVICE_ASSIGNMENT
53 bool "KVM legacy PCI device assignment support"
54 depends on KVM && PCI && IOMMU_API
55 default y
56 ---help---
57 Provide support for legacy PCI device assignment through KVM. The
58 kernel now also supports a full featured userspace device driver
59 framework through VFIO, which supersedes much of this support.
60
61 If unsure, say Y.
62
53source drivers/vhost/Kconfig 63source drivers/vhost/Kconfig
54 64
55endif # VIRTUALIZATION 65endif # VIRTUALIZATION
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile
index db3d7c5d1071..1a4053789d01 100644
--- a/arch/ia64/kvm/Makefile
+++ b/arch/ia64/kvm/Makefile
@@ -49,10 +49,10 @@ ccflags-y := -Ivirt/kvm -Iarch/ia64/kvm/
49asflags-y := -Ivirt/kvm -Iarch/ia64/kvm/ 49asflags-y := -Ivirt/kvm -Iarch/ia64/kvm/
50 50
51common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 51common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
52 coalesced_mmio.o irq_comm.o assigned-dev.o) 52 coalesced_mmio.o irq_comm.o)
53 53
54ifeq ($(CONFIG_IOMMU_API),y) 54ifeq ($(CONFIG_KVM_DEVICE_ASSIGNMENT),y)
55common-objs += $(addprefix ../../../virt/kvm/, iommu.o) 55common-objs += $(addprefix ../../../virt/kvm/, assigned-dev.o iommu.o)
56endif 56endif
57 57
58kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o 58kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index ad3126a58644..5b2dc0d10c8f 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -204,9 +204,11 @@ int kvm_dev_ioctl_check_extension(long ext)
204 case KVM_CAP_COALESCED_MMIO: 204 case KVM_CAP_COALESCED_MMIO:
205 r = KVM_COALESCED_MMIO_PAGE_OFFSET; 205 r = KVM_COALESCED_MMIO_PAGE_OFFSET;
206 break; 206 break;
207#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
207 case KVM_CAP_IOMMU: 208 case KVM_CAP_IOMMU:
208 r = iommu_present(&pci_bus_type); 209 r = iommu_present(&pci_bus_type);
209 break; 210 break;
211#endif
210 default: 212 default:
211 r = 0; 213 r = 0;
212 } 214 }
@@ -924,13 +926,15 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
924 return 0; 926 return 0;
925} 927}
926 928
927int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event) 929int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event,
930 bool line_status)
928{ 931{
929 if (!irqchip_in_kernel(kvm)) 932 if (!irqchip_in_kernel(kvm))
930 return -ENXIO; 933 return -ENXIO;
931 934
932 irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 935 irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
933 irq_event->irq, irq_event->level); 936 irq_event->irq, irq_event->level,
937 line_status);
934 return 0; 938 return 0;
935} 939}
936 940
@@ -942,24 +946,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
942 int r = -ENOTTY; 946 int r = -ENOTTY;
943 947
944 switch (ioctl) { 948 switch (ioctl) {
945 case KVM_SET_MEMORY_REGION: {
946 struct kvm_memory_region kvm_mem;
947 struct kvm_userspace_memory_region kvm_userspace_mem;
948
949 r = -EFAULT;
950 if (copy_from_user(&kvm_mem, argp, sizeof kvm_mem))
951 goto out;
952 kvm_userspace_mem.slot = kvm_mem.slot;
953 kvm_userspace_mem.flags = kvm_mem.flags;
954 kvm_userspace_mem.guest_phys_addr =
955 kvm_mem.guest_phys_addr;
956 kvm_userspace_mem.memory_size = kvm_mem.memory_size;
957 r = kvm_vm_ioctl_set_memory_region(kvm,
958 &kvm_userspace_mem, false);
959 if (r)
960 goto out;
961 break;
962 }
963 case KVM_CREATE_IRQCHIP: 949 case KVM_CREATE_IRQCHIP:
964 r = -EFAULT; 950 r = -EFAULT;
965 r = kvm_ioapic_init(kvm); 951 r = kvm_ioapic_init(kvm);
@@ -1384,9 +1370,7 @@ void kvm_arch_sync_events(struct kvm *kvm)
1384void kvm_arch_destroy_vm(struct kvm *kvm) 1370void kvm_arch_destroy_vm(struct kvm *kvm)
1385{ 1371{
1386 kvm_iommu_unmap_guest(kvm); 1372 kvm_iommu_unmap_guest(kvm);
1387#ifdef KVM_CAP_DEVICE_ASSIGNMENT
1388 kvm_free_all_assigned_devices(kvm); 1373 kvm_free_all_assigned_devices(kvm);
1389#endif
1390 kfree(kvm->arch.vioapic); 1374 kfree(kvm->arch.vioapic);
1391 kvm_release_vm_pages(kvm); 1375 kvm_release_vm_pages(kvm);
1392} 1376}
@@ -1578,9 +1562,8 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
1578 1562
1579int kvm_arch_prepare_memory_region(struct kvm *kvm, 1563int kvm_arch_prepare_memory_region(struct kvm *kvm,
1580 struct kvm_memory_slot *memslot, 1564 struct kvm_memory_slot *memslot,
1581 struct kvm_memory_slot old,
1582 struct kvm_userspace_memory_region *mem, 1565 struct kvm_userspace_memory_region *mem,
1583 bool user_alloc) 1566 enum kvm_mr_change change)
1584{ 1567{
1585 unsigned long i; 1568 unsigned long i;
1586 unsigned long pfn; 1569 unsigned long pfn;
@@ -1610,8 +1593,8 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1610 1593
1611void kvm_arch_commit_memory_region(struct kvm *kvm, 1594void kvm_arch_commit_memory_region(struct kvm *kvm,
1612 struct kvm_userspace_memory_region *mem, 1595 struct kvm_userspace_memory_region *mem,
1613 struct kvm_memory_slot old, 1596 const struct kvm_memory_slot *old,
1614 bool user_alloc) 1597 enum kvm_mr_change change)
1615{ 1598{
1616 return; 1599 return;
1617} 1600}
diff --git a/arch/ia64/kvm/lapic.h b/arch/ia64/kvm/lapic.h
index c3e2935b6db4..c5f92a926a9a 100644
--- a/arch/ia64/kvm/lapic.h
+++ b/arch/ia64/kvm/lapic.h
@@ -27,10 +27,4 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq);
27#define kvm_apic_present(x) (true) 27#define kvm_apic_present(x) (true)
28#define kvm_lapic_enabled(x) (true) 28#define kvm_lapic_enabled(x) (true)
29 29
30static inline bool kvm_apic_vid_enabled(void)
31{
32 /* IA64 has no apicv supporting, do nothing here */
33 return false;
34}
35
36#endif 30#endif
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index 4332f7ee5203..a7869f8f49a6 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -256,7 +256,7 @@ u64 guest_vhpt_lookup(u64 iha, u64 *pte)
256 "srlz.d;;" 256 "srlz.d;;"
257 "ssm psr.i;;" 257 "ssm psr.i;;"
258 "srlz.d;;" 258 "srlz.d;;"
259 : "=r"(ret) : "r"(iha), "r"(pte):"memory"); 259 : "=&r"(ret) : "r"(iha), "r"(pte) : "memory");
260 260
261 return ret; 261 return ret;
262} 262}
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 80dab509dfb0..67c59ebec899 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -47,6 +47,8 @@ void show_mem(unsigned int filter)
47 printk(KERN_INFO "Mem-info:\n"); 47 printk(KERN_INFO "Mem-info:\n");
48 show_free_areas(filter); 48 show_free_areas(filter);
49 printk(KERN_INFO "Node memory in pages:\n"); 49 printk(KERN_INFO "Node memory in pages:\n");
50 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
51 return;
50 for_each_online_pgdat(pgdat) { 52 for_each_online_pgdat(pgdat) {
51 unsigned long present; 53 unsigned long present;
52 unsigned long flags; 54 unsigned long flags;
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index c2e955ee79a8..ae4db4bd6d97 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -623,6 +623,8 @@ void show_mem(unsigned int filter)
623 623
624 printk(KERN_INFO "Mem-info:\n"); 624 printk(KERN_INFO "Mem-info:\n");
625 show_free_areas(filter); 625 show_free_areas(filter);
626 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
627 return;
626 printk(KERN_INFO "Node memory in pages:\n"); 628 printk(KERN_INFO "Node memory in pages:\n");
627 for_each_online_pgdat(pgdat) { 629 for_each_online_pgdat(pgdat) {
628 unsigned long present; 630 unsigned long present;
@@ -817,13 +819,12 @@ void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat)
817#endif 819#endif
818 820
819#ifdef CONFIG_SPARSEMEM_VMEMMAP 821#ifdef CONFIG_SPARSEMEM_VMEMMAP
820int __meminit vmemmap_populate(struct page *start_page, 822int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
821 unsigned long size, int node)
822{ 823{
823 return vmemmap_populate_basepages(start_page, size, node); 824 return vmemmap_populate_basepages(start, end, node);
824} 825}
825 826
826void vmemmap_free(struct page *memmap, unsigned long nr_pages) 827void vmemmap_free(unsigned long start, unsigned long end)
827{ 828{
828} 829}
829#endif 830#endif
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 20bc967c7209..d1fe4b402601 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -154,25 +154,14 @@ ia64_init_addr_space (void)
154void 154void
155free_initmem (void) 155free_initmem (void)
156{ 156{
157 unsigned long addr, eaddr; 157 free_reserved_area((unsigned long)ia64_imva(__init_begin),
158 158 (unsigned long)ia64_imva(__init_end),
159 addr = (unsigned long) ia64_imva(__init_begin); 159 0, "unused kernel");
160 eaddr = (unsigned long) ia64_imva(__init_end);
161 while (addr < eaddr) {
162 ClearPageReserved(virt_to_page(addr));
163 init_page_count(virt_to_page(addr));
164 free_page(addr);
165 ++totalram_pages;
166 addr += PAGE_SIZE;
167 }
168 printk(KERN_INFO "Freeing unused kernel memory: %ldkB freed\n",
169 (__init_end - __init_begin) >> 10);
170} 160}
171 161
172void __init 162void __init
173free_initrd_mem (unsigned long start, unsigned long end) 163free_initrd_mem (unsigned long start, unsigned long end)
174{ 164{
175 struct page *page;
176 /* 165 /*
177 * EFI uses 4KB pages while the kernel can use 4KB or bigger. 166 * EFI uses 4KB pages while the kernel can use 4KB or bigger.
178 * Thus EFI and the kernel may have different page sizes. It is 167 * Thus EFI and the kernel may have different page sizes. It is
@@ -213,11 +202,7 @@ free_initrd_mem (unsigned long start, unsigned long end)
213 for (; start < end; start += PAGE_SIZE) { 202 for (; start < end; start += PAGE_SIZE) {
214 if (!virt_addr_valid(start)) 203 if (!virt_addr_valid(start))
215 continue; 204 continue;
216 page = virt_to_page(start); 205 free_reserved_page(virt_to_page(start));
217 ClearPageReserved(page);
218 init_page_count(page);
219 free_page(start);
220 ++totalram_pages;
221 } 206 }
222} 207}
223 208
diff --git a/arch/ia64/mm/ioremap.c b/arch/ia64/mm/ioremap.c
index 3dccdd8eb275..43964cde6214 100644
--- a/arch/ia64/mm/ioremap.c
+++ b/arch/ia64/mm/ioremap.c
@@ -16,7 +16,7 @@
16#include <asm/meminit.h> 16#include <asm/meminit.h>
17 17
18static inline void __iomem * 18static inline void __iomem *
19__ioremap (unsigned long phys_addr) 19__ioremap_uc(unsigned long phys_addr)
20{ 20{
21 return (void __iomem *) (__IA64_UNCACHED_OFFSET | phys_addr); 21 return (void __iomem *) (__IA64_UNCACHED_OFFSET | phys_addr);
22} 22}
@@ -24,7 +24,11 @@ __ioremap (unsigned long phys_addr)
24void __iomem * 24void __iomem *
25early_ioremap (unsigned long phys_addr, unsigned long size) 25early_ioremap (unsigned long phys_addr, unsigned long size)
26{ 26{
27 return __ioremap(phys_addr); 27 u64 attr;
28 attr = kern_mem_attribute(phys_addr, size);
29 if (attr & EFI_MEMORY_WB)
30 return (void __iomem *) phys_to_virt(phys_addr);
31 return __ioremap_uc(phys_addr);
28} 32}
29 33
30void __iomem * 34void __iomem *
@@ -47,7 +51,7 @@ ioremap (unsigned long phys_addr, unsigned long size)
47 if (attr & EFI_MEMORY_WB) 51 if (attr & EFI_MEMORY_WB)
48 return (void __iomem *) phys_to_virt(phys_addr); 52 return (void __iomem *) phys_to_virt(phys_addr);
49 else if (attr & EFI_MEMORY_UC) 53 else if (attr & EFI_MEMORY_UC)
50 return __ioremap(phys_addr); 54 return __ioremap_uc(phys_addr);
51 55
52 /* 56 /*
53 * Some chipsets don't support UC access to memory. If 57 * Some chipsets don't support UC access to memory. If
@@ -93,7 +97,7 @@ ioremap (unsigned long phys_addr, unsigned long size)
93 return (void __iomem *) (offset + (char __iomem *)addr); 97 return (void __iomem *) (offset + (char __iomem *)addr);
94 } 98 }
95 99
96 return __ioremap(phys_addr); 100 return __ioremap_uc(phys_addr);
97} 101}
98EXPORT_SYMBOL(ioremap); 102EXPORT_SYMBOL(ioremap);
99 103
@@ -103,7 +107,7 @@ ioremap_nocache (unsigned long phys_addr, unsigned long size)
103 if (kern_mem_attribute(phys_addr, size) & EFI_MEMORY_WB) 107 if (kern_mem_attribute(phys_addr, size) & EFI_MEMORY_WB)
104 return NULL; 108 return NULL;
105 109
106 return __ioremap(phys_addr); 110 return __ioremap_uc(phys_addr);
107} 111}
108EXPORT_SYMBOL(ioremap_nocache); 112EXPORT_SYMBOL(ioremap_nocache);
109 113
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 3efea7d0a351..4248492b9321 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -61,18 +61,36 @@ paddr_to_nid(unsigned long paddr)
61int __meminit __early_pfn_to_nid(unsigned long pfn) 61int __meminit __early_pfn_to_nid(unsigned long pfn)
62{ 62{
63 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; 63 int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
64 /*
65 * NOTE: The following SMP-unsafe globals are only used early in boot
66 * when the kernel is running single-threaded.
67 */
68 static int __meminitdata last_ssec, last_esec;
69 static int __meminitdata last_nid;
70
71 if (section >= last_ssec && section < last_esec)
72 return last_nid;
64 73
65 for (i = 0; i < num_node_memblks; i++) { 74 for (i = 0; i < num_node_memblks; i++) {
66 ssec = node_memblk[i].start_paddr >> PA_SECTION_SHIFT; 75 ssec = node_memblk[i].start_paddr >> PA_SECTION_SHIFT;
67 esec = (node_memblk[i].start_paddr + node_memblk[i].size + 76 esec = (node_memblk[i].start_paddr + node_memblk[i].size +
68 ((1L << PA_SECTION_SHIFT) - 1)) >> PA_SECTION_SHIFT; 77 ((1L << PA_SECTION_SHIFT) - 1)) >> PA_SECTION_SHIFT;
69 if (section >= ssec && section < esec) 78 if (section >= ssec && section < esec) {
79 last_ssec = ssec;
80 last_esec = esec;
81 last_nid = node_memblk[i].nid;
70 return node_memblk[i].nid; 82 return node_memblk[i].nid;
83 }
71 } 84 }
72 85
73 return -1; 86 return -1;
74} 87}
75 88
89void __cpuinit numa_clear_node(int cpu)
90{
91 unmap_cpu_from_node(cpu, NUMA_NO_NODE);
92}
93
76#ifdef CONFIG_MEMORY_HOTPLUG 94#ifdef CONFIG_MEMORY_HOTPLUG
77/* 95/*
78 * SRAT information is stored in node_memblk[], then we can use SRAT 96 * SRAT information is stored in node_memblk[], then we can use SRAT
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 60532ab27346..de1474ff0bc5 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/pci-acpi.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/ioport.h> 20#include <linux/ioport.h>
20#include <linux/slab.h> 21#include <linux/slab.h>
@@ -458,6 +459,16 @@ void pcibios_fixup_bus(struct pci_bus *b)
458 platform_pci_fixup_bus(b); 459 platform_pci_fixup_bus(b);
459} 460}
460 461
462void pcibios_add_bus(struct pci_bus *bus)
463{
464 acpi_pci_add_bus(bus);
465}
466
467void pcibios_remove_bus(struct pci_bus *bus)
468{
469 acpi_pci_remove_bus(bus);
470}
471
461void pcibios_set_master (struct pci_dev *dev) 472void pcibios_set_master (struct pci_dev *dev)
462{ 473{
463 /* No special bus mastering setup handling */ 474 /* No special bus mastering setup handling */
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index 20b88cb1881a..ec4de2b09653 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/seq_file.h>
14#include <linux/nodemask.h> 15#include <linux/nodemask.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/sn/sn_sal.h> 17#include <asm/sn/sn_sal.h>
@@ -101,18 +102,18 @@ get_fit_entry(unsigned long nasid, int index, unsigned long *fentry,
101/* 102/*
102 * These two routines display the FIT table for each node. 103 * These two routines display the FIT table for each node.
103 */ 104 */
104static int dump_fit_entry(char *page, unsigned long *fentry) 105static void dump_fit_entry(struct seq_file *m, unsigned long *fentry)
105{ 106{
106 unsigned type; 107 unsigned type;
107 108
108 type = FIT_TYPE(fentry[1]); 109 type = FIT_TYPE(fentry[1]);
109 return sprintf(page, "%02x %-25s %x.%02x %016lx %u\n", 110 seq_printf(m, "%02x %-25s %x.%02x %016lx %u\n",
110 type, 111 type,
111 fit_type_name(type), 112 fit_type_name(type),
112 FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]), 113 FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]),
113 fentry[0], 114 fentry[0],
114 /* mult by sixteen to get size in bytes */ 115 /* mult by sixteen to get size in bytes */
115 (unsigned)(fentry[1] & 0xffffff) * 16); 116 (unsigned)(fentry[1] & 0xffffff) * 16);
116} 117}
117 118
118 119
@@ -124,31 +125,39 @@ static int dump_fit_entry(char *page, unsigned long *fentry)
124 * OK except for 4kB pages (and no one is going to do that on SN 125 * OK except for 4kB pages (and no one is going to do that on SN
125 * anyway). 126 * anyway).
126 */ 127 */
127static int 128static int proc_fit_show(struct seq_file *m, void *v)
128dump_fit(char *page, unsigned long nasid)
129{ 129{
130 unsigned long nasid = (unsigned long)m->private;
130 unsigned long fentry[2]; 131 unsigned long fentry[2];
131 int index; 132 int index;
132 char *p;
133 133
134 p = page;
135 for (index=0;;index++) { 134 for (index=0;;index++) {
136 BUG_ON(index * 60 > PAGE_SIZE); 135 BUG_ON(index * 60 > PAGE_SIZE);
137 if (get_fit_entry(nasid, index, fentry, NULL, 0)) 136 if (get_fit_entry(nasid, index, fentry, NULL, 0))
138 break; 137 break;
139 p += dump_fit_entry(p, fentry); 138 dump_fit_entry(m, fentry);
140 } 139 }
140 return 0;
141}
141 142
142 return p - page; 143static int proc_fit_open(struct inode *inode, struct file *file)
144{
145 return single_open(file, proc_fit_show, PDE_DATA(inode));
143} 146}
144 147
145static int 148static const struct file_operations proc_fit_fops = {
146dump_version(char *page, unsigned long nasid) 149 .open = proc_fit_open,
150 .read = seq_read,
151 .llseek = seq_lseek,
152 .release = single_release,
153};
154
155static int proc_version_show(struct seq_file *m, void *v)
147{ 156{
157 unsigned long nasid = (unsigned long)m->private;
148 unsigned long fentry[2]; 158 unsigned long fentry[2];
149 char banner[128]; 159 char banner[128];
150 int index; 160 int index;
151 int len;
152 161
153 for (index = 0; ; index++) { 162 for (index = 0; ; index++) {
154 if (get_fit_entry(nasid, index, fentry, banner, 163 if (get_fit_entry(nasid, index, fentry, banner,
@@ -158,56 +167,24 @@ dump_version(char *page, unsigned long nasid)
158 break; 167 break;
159 } 168 }
160 169
161 len = sprintf(page, "%x.%02x\n", FIT_MAJOR(fentry[1]), 170 seq_printf(m, "%x.%02x\n", FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]));
162 FIT_MINOR(fentry[1]));
163 page += len;
164 171
165 if (banner[0]) 172 if (banner[0])
166 len += snprintf(page, PAGE_SIZE-len, "%s\n", banner); 173 seq_printf(m, "%s\n", banner);
167 174 return 0;
168 return len;
169}
170
171/* same as in proc_misc.c */
172static int
173proc_calc_metrics(char *page, char **start, off_t off, int count, int *eof,
174 int len)
175{
176 if (len <= off + count)
177 *eof = 1;
178 *start = page + off;
179 len -= off;
180 if (len > count)
181 len = count;
182 if (len < 0)
183 len = 0;
184 return len;
185} 175}
186 176
187static int 177static int proc_version_open(struct inode *inode, struct file *file)
188read_version_entry(char *page, char **start, off_t off, int count, int *eof,
189 void *data)
190{ 178{
191 int len; 179 return single_open(file, proc_version_show, PDE_DATA(inode));
192
193 /* data holds the NASID of the node */
194 len = dump_version(page, (unsigned long)data);
195 len = proc_calc_metrics(page, start, off, count, eof, len);
196 return len;
197} 180}
198 181
199static int 182static const struct file_operations proc_version_fops = {
200read_fit_entry(char *page, char **start, off_t off, int count, int *eof, 183 .open = proc_version_open,
201 void *data) 184 .read = seq_read,
202{ 185 .llseek = seq_lseek,
203 int len; 186 .release = single_release,
204 187};
205 /* data holds the NASID of the node */
206 len = dump_fit(page, (unsigned long)data);
207 len = proc_calc_metrics(page, start, off, count, eof, len);
208
209 return len;
210}
211 188
212/* module entry points */ 189/* module entry points */
213int __init prominfo_init(void); 190int __init prominfo_init(void);
@@ -216,58 +193,39 @@ void __exit prominfo_exit(void);
216module_init(prominfo_init); 193module_init(prominfo_init);
217module_exit(prominfo_exit); 194module_exit(prominfo_exit);
218 195
219static struct proc_dir_entry **proc_entries;
220static struct proc_dir_entry *sgi_prominfo_entry;
221
222#define NODE_NAME_LEN 11 196#define NODE_NAME_LEN 11
223 197
224int __init prominfo_init(void) 198int __init prominfo_init(void)
225{ 199{
226 struct proc_dir_entry **entp; 200 struct proc_dir_entry *sgi_prominfo_entry;
227 cnodeid_t cnodeid; 201 cnodeid_t cnodeid;
228 unsigned long nasid;
229 int size;
230 char name[NODE_NAME_LEN];
231 202
232 if (!ia64_platform_is("sn2")) 203 if (!ia64_platform_is("sn2"))
233 return 0; 204 return 0;
234 205
235 size = num_online_nodes() * sizeof(struct proc_dir_entry *);
236 proc_entries = kzalloc(size, GFP_KERNEL);
237 if (!proc_entries)
238 return -ENOMEM;
239
240 sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL); 206 sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
207 if (!sgi_prominfo_entry)
208 return -ENOMEM;
241 209
242 entp = proc_entries;
243 for_each_online_node(cnodeid) { 210 for_each_online_node(cnodeid) {
211 struct proc_dir_entry *dir;
212 unsigned long nasid;
213 char name[NODE_NAME_LEN];
214
244 sprintf(name, "node%d", cnodeid); 215 sprintf(name, "node%d", cnodeid);
245 *entp = proc_mkdir(name, sgi_prominfo_entry); 216 dir = proc_mkdir(name, sgi_prominfo_entry);
217 if (!dir)
218 continue;
246 nasid = cnodeid_to_nasid(cnodeid); 219 nasid = cnodeid_to_nasid(cnodeid);
247 create_proc_read_entry("fit", 0, *entp, read_fit_entry, 220 proc_create_data("fit", 0, dir,
248 (void *)nasid); 221 &proc_fit_fops, (void *)nasid);
249 create_proc_read_entry("version", 0, *entp, 222 proc_create_data("version", 0, dir,
250 read_version_entry, (void *)nasid); 223 &proc_version_fops, (void *)nasid);
251 entp++;
252 } 224 }
253
254 return 0; 225 return 0;
255} 226}
256 227
257void __exit prominfo_exit(void) 228void __exit prominfo_exit(void)
258{ 229{
259 struct proc_dir_entry **entp; 230 remove_proc_subtree("sgi_prominfo", NULL);
260 unsigned int cnodeid;
261 char name[NODE_NAME_LEN];
262
263 entp = proc_entries;
264 for_each_online_node(cnodeid) {
265 remove_proc_entry("fit", *entp);
266 remove_proc_entry("version", *entp);
267 sprintf(name, "node%d", cnodeid);
268 remove_proc_entry(name, sgi_prominfo_entry);
269 entp++;
270 }
271 remove_proc_entry("sgi_prominfo", NULL);
272 kfree(proc_entries);
273} 231}
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 14c1711238c0..e35f6485c1fd 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -490,11 +490,14 @@ static int __init tiocx_init(void)
490{ 490{
491 cnodeid_t cnodeid; 491 cnodeid_t cnodeid;
492 int found_tiocx_device = 0; 492 int found_tiocx_device = 0;
493 int err;
493 494
494 if (!ia64_platform_is("sn2")) 495 if (!ia64_platform_is("sn2"))
495 return 0; 496 return 0;
496 497
497 bus_register(&tiocx_bus_type); 498 err = bus_register(&tiocx_bus_type);
499 if (err)
500 return err;
498 501
499 for (cnodeid = 0; cnodeid < num_cnodes; cnodeid++) { 502 for (cnodeid = 0; cnodeid < num_cnodes; cnodeid++) {
500 nasid_t nasid; 503 nasid_t nasid;
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h
index 555629b05267..59db80193454 100644
--- a/arch/m32r/include/asm/unistd.h
+++ b/arch/m32r/include/asm/unistd.h
@@ -48,14 +48,4 @@
48#define __IGNORE_getresgid 48#define __IGNORE_getresgid
49#define __IGNORE_chown 49#define __IGNORE_chown
50 50
51/*
52 * "Conditional" syscalls
53 *
54 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
55 * but it doesn't work on all toolchains, so we just do it by hand
56 */
57#ifndef cond_syscall
58#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
59#endif
60
61#endif /* _ASM_M32R_UNISTD_H */ 51#endif /* _ASM_M32R_UNISTD_H */
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index bde899e155d3..e69221d581d5 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -47,24 +47,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
47void (*pm_power_off)(void) = NULL; 47void (*pm_power_off)(void) = NULL;
48EXPORT_SYMBOL(pm_power_off); 48EXPORT_SYMBOL(pm_power_off);
49 49
50/*
51 * The idle thread. There's no useful work to be
52 * done, so just try to conserve power and have a
53 * low exit latency (ie sit in a loop waiting for
54 * somebody to say that they'd like to reschedule)
55 */
56void cpu_idle (void)
57{
58 /* endless idle loop with no priority at all */
59 while (1) {
60 rcu_idle_enter();
61 while (!need_resched())
62 cpu_relax();
63 rcu_idle_exit();
64 schedule_preempt_disabled();
65 }
66}
67
68void machine_restart(char *__unused) 50void machine_restart(char *__unused)
69{ 51{
70#if defined(CONFIG_PLAT_MAPPI3) 52#if defined(CONFIG_PLAT_MAPPI3)
@@ -91,6 +73,8 @@ void machine_power_off(void)
91void show_regs(struct pt_regs * regs) 73void show_regs(struct pt_regs * regs)
92{ 74{
93 printk("\n"); 75 printk("\n");
76 show_regs_print_info(KERN_DEFAULT);
77
94 printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \ 78 printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \
95 regs->bpc, regs->psw, regs->lr, regs->fp); 79 regs->bpc, regs->psw, regs->lr, regs->fp);
96 printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \ 80 printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 13168a769f8f..0ac558adc605 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -432,7 +432,7 @@ int __init start_secondary(void *unused)
432 */ 432 */
433 local_flush_tlb_all(); 433 local_flush_tlb_all();
434 434
435 cpu_idle(); 435 cpu_startup_entry(CPUHP_ONLINE);
436 return 0; 436 return 0;
437} 437}
438 438
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index 3bcb207e5b6d..a7a424f852e4 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -132,10 +132,8 @@ static void show_trace(struct task_struct *task, unsigned long *stack)
132 printk("Call Trace: "); 132 printk("Call Trace: ");
133 while (!kstack_end(stack)) { 133 while (!kstack_end(stack)) {
134 addr = *stack++; 134 addr = *stack++;
135 if (__kernel_text_address(addr)) { 135 if (__kernel_text_address(addr))
136 printk("[<%08lx>] ", addr); 136 printk("[<%08lx>] %pSR\n", addr, (void *)addr);
137 print_symbol("%s\n", addr);
138 }
139 } 137 }
140 printk("\n"); 138 printk("\n");
141} 139}
@@ -169,15 +167,6 @@ void show_stack(struct task_struct *task, unsigned long *sp)
169 show_trace(task, sp); 167 show_trace(task, sp);
170} 168}
171 169
172void dump_stack(void)
173{
174 unsigned long stack;
175
176 show_trace(current, &stack);
177}
178
179EXPORT_SYMBOL(dump_stack);
180
181static void show_registers(struct pt_regs *regs) 170static void show_registers(struct pt_regs *regs)
182{ 171{
183 int i = 0; 172 int i = 0;
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index 78b660e903da..ab4cbce91a9b 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -28,10 +28,7 @@
28#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
29#include <asm/setup.h> 29#include <asm/setup.h>
30#include <asm/tlb.h> 30#include <asm/tlb.h>
31 31#include <asm/sections.h>
32/* References to section boundaries */
33extern char _text, _etext, _edata;
34extern char __init_begin, __init_end;
35 32
36pgd_t swapper_pg_dir[1024]; 33pgd_t swapper_pg_dir[1024];
37 34
@@ -184,17 +181,7 @@ void __init mem_init(void)
184 *======================================================================*/ 181 *======================================================================*/
185void free_initmem(void) 182void free_initmem(void)
186{ 183{
187 unsigned long addr; 184 free_initmem_default(0);
188
189 addr = (unsigned long)(&__init_begin);
190 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
191 ClearPageReserved(virt_to_page(addr));
192 init_page_count(virt_to_page(addr));
193 free_page(addr);
194 totalram_pages++;
195 }
196 printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", \
197 (int)(&__init_end - &__init_begin) >> 10);
198} 185}
199 186
200#ifdef CONFIG_BLK_DEV_INITRD 187#ifdef CONFIG_BLK_DEV_INITRD
@@ -204,13 +191,6 @@ void free_initmem(void)
204 *======================================================================*/ 191 *======================================================================*/
205void free_initrd_mem(unsigned long start, unsigned long end) 192void free_initrd_mem(unsigned long start, unsigned long end)
206{ 193{
207 unsigned long p; 194 free_reserved_area(start, end, 0, "initrd");
208 for (p = start; p < end; p += PAGE_SIZE) {
209 ClearPageReserved(virt_to_page(p));
210 init_page_count(virt_to_page(p));
211 free_page(p);
212 totalram_pages++;
213 }
214 printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
215} 195}
216#endif 196#endif
diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus
index 93ef0346b209..675b087198f6 100644
--- a/arch/m68k/Kconfig.bus
+++ b/arch/m68k/Kconfig.bus
@@ -45,6 +45,16 @@ config ISA
45 (MCA) or VESA. ISA is an older system, now being displaced by PCI; 45 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
46 newer boards don't support it. If you have ISA, say Y, otherwise N. 46 newer boards don't support it. If you have ISA, say Y, otherwise N.
47 47
48config ATARI_ROM_ISA
49 bool "Atari ROM port ISA adapter support"
50 depends on ATARI
51 help
52 This option enables support for the ROM port ISA adapter used to
53 operate ISA cards on Atari. Only 8 bit cards are supported, and
54 no interrupt lines are connected.
55 The only driver currently using this adapter is the EtherNEC
56 driver for RTL8019AS based NE2000 compatible network cards.
57
48config GENERIC_ISA_DMA 58config GENERIC_ISA_DMA
49 def_bool ISA 59 def_bool ISA
50 60
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
index 4bc945dfe467..d163991c5717 100644
--- a/arch/m68k/Kconfig.devices
+++ b/arch/m68k/Kconfig.devices
@@ -55,6 +55,30 @@ config NFETH
55 which will emulate a regular ethernet device while presenting an 55 which will emulate a regular ethernet device while presenting an
56 ethertap device to the host system. 56 ethertap device to the host system.
57 57
58config ATARI_ETHERNAT
59 bool "Atari EtherNAT Ethernet support"
60 depends on ATARI
61 ---help---
62 Say Y to include support for the EtherNAT network adapter for the
63 CT/60 extension port.
64
65 To compile the actual ethernet driver, choose Y or M for the SMC91X
66 option in the network device section; the module will be called smc91x.
67
68config ATARI_ETHERNEC
69 bool "Atari EtherNEC Ethernet support"
70 depends on ATARI_ROM_ISA
71 ---help---
72 Say Y to include support for the EtherNEC network adapter for the
73 ROM port. The driver works by polling instead of interrupts, so it
74 is quite slow.
75
76 This driver also suppports the ethernet part of the NetUSBee ROM
77 port combined Ethernet/USB adapter.
78
79 To compile the actual ethernet driver, choose Y or M in for the NE2000
80 option in the network device section; the module will be called ne.
81
58endmenu 82endmenu
59 83
60menu "Character devices" 84menu "Character devices"
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 3f41092d1b70..20cde4e9fc77 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -49,6 +49,7 @@
49#include <asm/atari_stdma.h> 49#include <asm/atari_stdma.h>
50#include <asm/irq.h> 50#include <asm/irq.h>
51#include <asm/entry.h> 51#include <asm/entry.h>
52#include <asm/io.h>
52 53
53 54
54/* 55/*
@@ -122,6 +123,136 @@ static struct irq_chip atari_irq_chip = {
122}; 123};
123 124
124/* 125/*
126 * ST-MFP timer D chained interrupts - each driver gets its own timer
127 * interrupt instance.
128 */
129
130struct mfptimerbase {
131 volatile struct MFP *mfp;
132 unsigned char mfp_mask, mfp_data;
133 unsigned short int_mask;
134 int handler_irq, mfptimer_irq, server_irq;
135 char *name;
136} stmfp_base = {
137 .mfp = &st_mfp,
138 .int_mask = 0x0,
139 .handler_irq = IRQ_MFP_TIMD,
140 .mfptimer_irq = IRQ_MFP_TIMER1,
141 .name = "MFP Timer D"
142};
143
144static irqreturn_t mfptimer_handler(int irq, void *dev_id)
145{
146 struct mfptimerbase *base = dev_id;
147 int mach_irq;
148 unsigned char ints;
149
150 mach_irq = base->mfptimer_irq;
151 ints = base->int_mask;
152 for (; ints; mach_irq++, ints >>= 1) {
153 if (ints & 1)
154 generic_handle_irq(mach_irq);
155 }
156 return IRQ_HANDLED;
157}
158
159
160static void atari_mfptimer_enable(struct irq_data *data)
161{
162 int mfp_num = data->irq - IRQ_MFP_TIMER1;
163 stmfp_base.int_mask |= 1 << mfp_num;
164 atari_enable_irq(IRQ_MFP_TIMD);
165}
166
167static void atari_mfptimer_disable(struct irq_data *data)
168{
169 int mfp_num = data->irq - IRQ_MFP_TIMER1;
170 stmfp_base.int_mask &= ~(1 << mfp_num);
171 if (!stmfp_base.int_mask)
172 atari_disable_irq(IRQ_MFP_TIMD);
173}
174
175static struct irq_chip atari_mfptimer_chip = {
176 .name = "timer_d",
177 .irq_enable = atari_mfptimer_enable,
178 .irq_disable = atari_mfptimer_disable,
179};
180
181
182/*
183 * EtherNAT CPLD interrupt handling
184 * CPLD interrupt register is at phys. 0x80000023
185 * Need this mapped in at interrupt startup time
186 * Possibly need this mapped on demand anyway -
187 * EtherNAT USB driver needs to disable IRQ before
188 * startup!
189 */
190
191static unsigned char *enat_cpld;
192
193static unsigned int atari_ethernat_startup(struct irq_data *data)
194{
195 int enat_num = 140 - data->irq + 1;
196
197 m68k_irq_startup(data);
198 /*
199 * map CPLD interrupt register
200 */
201 if (!enat_cpld)
202 enat_cpld = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0x2);
203 /*
204 * do _not_ enable the USB chip interrupt here - causes interrupt storm
205 * and triggers dead interrupt watchdog
206 * Need to reset the USB chip to a sane state in early startup before
207 * removing this hack
208 */
209 if (enat_num == 1)
210 *enat_cpld |= 1 << enat_num;
211
212 return 0;
213}
214
215static void atari_ethernat_enable(struct irq_data *data)
216{
217 int enat_num = 140 - data->irq + 1;
218 /*
219 * map CPLD interrupt register
220 */
221 if (!enat_cpld)
222 enat_cpld = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0x2);
223 *enat_cpld |= 1 << enat_num;
224}
225
226static void atari_ethernat_disable(struct irq_data *data)
227{
228 int enat_num = 140 - data->irq + 1;
229 /*
230 * map CPLD interrupt register
231 */
232 if (!enat_cpld)
233 enat_cpld = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0x2);
234 *enat_cpld &= ~(1 << enat_num);
235}
236
237static void atari_ethernat_shutdown(struct irq_data *data)
238{
239 int enat_num = 140 - data->irq + 1;
240 if (enat_cpld) {
241 *enat_cpld &= ~(1 << enat_num);
242 iounmap(enat_cpld);
243 enat_cpld = NULL;
244 }
245}
246
247static struct irq_chip atari_ethernat_chip = {
248 .name = "ethernat",
249 .irq_startup = atari_ethernat_startup,
250 .irq_shutdown = atari_ethernat_shutdown,
251 .irq_enable = atari_ethernat_enable,
252 .irq_disable = atari_ethernat_disable,
253};
254
255/*
125 * void atari_init_IRQ (void) 256 * void atari_init_IRQ (void)
126 * 257 *
127 * Parameters: None 258 * Parameters: None
@@ -198,6 +329,27 @@ void __init atari_init_IRQ(void)
198 /* Initialize the PSG: all sounds off, both ports output */ 329 /* Initialize the PSG: all sounds off, both ports output */
199 sound_ym.rd_data_reg_sel = 7; 330 sound_ym.rd_data_reg_sel = 7;
200 sound_ym.wd_data = 0xff; 331 sound_ym.wd_data = 0xff;
332
333 m68k_setup_irq_controller(&atari_mfptimer_chip, handle_simple_irq,
334 IRQ_MFP_TIMER1, 8);
335
336 /* prepare timer D data for use as poll interrupt */
337 /* set Timer D data Register - needs to be > 0 */
338 st_mfp.tim_dt_d = 254; /* < 100 Hz */
339 /* start timer D, div = 1:100 */
340 st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 0xf0) | 0x6;
341
342 /* request timer D dispatch handler */
343 if (request_irq(IRQ_MFP_TIMD, mfptimer_handler, IRQF_SHARED,
344 stmfp_base.name, &stmfp_base))
345 pr_err("Couldn't register %s interrupt\n", stmfp_base.name);
346
347 /*
348 * EtherNAT ethernet / USB interrupt handlers
349 */
350
351 m68k_setup_irq_controller(&atari_ethernat_chip, handle_simple_irq,
352 139, 2);
201} 353}
202 354
203 355
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 037c11c99331..fb2d0bd9b3ad 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -31,6 +31,8 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/platform_device.h>
35#include <linux/usb/isp116x.h>
34#include <linux/vt_kern.h> 36#include <linux/vt_kern.h>
35#include <linux/module.h> 37#include <linux/module.h>
36 38
@@ -655,3 +657,240 @@ static void atari_get_hardware_list(struct seq_file *m)
655 ATARIHW_ANNOUNCE(VME, "VME Bus"); 657 ATARIHW_ANNOUNCE(VME, "VME Bus");
656 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); 658 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
657} 659}
660
661/*
662 * MSch: initial platform device support for Atari,
663 * required for EtherNAT/EtherNEC/NetUSBee drivers
664 */
665
666#if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC)
667static void isp1160_delay(struct device *dev, int delay)
668{
669 ndelay(delay);
670}
671#endif
672
673#ifdef CONFIG_ATARI_ETHERNAT
674/*
675 * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver
676 */
677
678#define ATARI_ETHERNAT_IRQ 140
679
680static struct resource smc91x_resources[] = {
681 [0] = {
682 .name = "smc91x-regs",
683 .start = ATARI_ETHERNAT_PHYS_ADDR,
684 .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff,
685 .flags = IORESOURCE_MEM,
686 },
687 [1] = {
688 .name = "smc91x-irq",
689 .start = ATARI_ETHERNAT_IRQ,
690 .end = ATARI_ETHERNAT_IRQ,
691 .flags = IORESOURCE_IRQ,
692 },
693};
694
695static struct platform_device smc91x_device = {
696 .name = "smc91x",
697 .id = -1,
698 .num_resources = ARRAY_SIZE(smc91x_resources),
699 .resource = smc91x_resources,
700};
701
702/*
703 * ISP 1160 - using the isp116x-hcd module
704 */
705
706#define ATARI_USB_PHYS_ADDR 0x80000012
707#define ATARI_USB_IRQ 139
708
709static struct resource isp1160_resources[] = {
710 [0] = {
711 .name = "isp1160-data",
712 .start = ATARI_USB_PHYS_ADDR,
713 .end = ATARI_USB_PHYS_ADDR + 0x1,
714 .flags = IORESOURCE_MEM,
715 },
716 [1] = {
717 .name = "isp1160-regs",
718 .start = ATARI_USB_PHYS_ADDR + 0x4,
719 .end = ATARI_USB_PHYS_ADDR + 0x5,
720 .flags = IORESOURCE_MEM,
721 },
722 [2] = {
723 .name = "isp1160-irq",
724 .start = ATARI_USB_IRQ,
725 .end = ATARI_USB_IRQ,
726 .flags = IORESOURCE_IRQ,
727 },
728};
729
730/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */
731static struct isp116x_platform_data isp1160_platform_data = {
732 /* Enable internal resistors on downstream ports */
733 .sel15Kres = 1,
734 /* On-chip overcurrent protection */
735 .oc_enable = 1,
736 /* INT output polarity */
737 .int_act_high = 1,
738 /* INT edge or level triggered */
739 .int_edge_triggered = 0,
740
741 /* WAKEUP pin connected - NOT SUPPORTED */
742 /* .remote_wakeup_connected = 0, */
743 /* Wakeup by devices on usb bus enabled */
744 .remote_wakeup_enable = 0,
745 .delay = isp1160_delay,
746};
747
748static struct platform_device isp1160_device = {
749 .name = "isp116x-hcd",
750 .id = 0,
751 .num_resources = ARRAY_SIZE(isp1160_resources),
752 .resource = isp1160_resources,
753 .dev = {
754 .platform_data = &isp1160_platform_data,
755 },
756};
757
758static struct platform_device *atari_ethernat_devices[] __initdata = {
759 &smc91x_device,
760 &isp1160_device
761};
762#endif /* CONFIG_ATARI_ETHERNAT */
763
764#ifdef CONFIG_ATARI_ETHERNEC
765/*
766 * EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset,
767 * handled by ne.c driver
768 */
769
770#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000
771#define ATARI_ETHERNEC_BASE 0x300
772#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1
773
774static struct resource rtl8019_resources[] = {
775 [0] = {
776 .name = "rtl8019-regs",
777 .start = ATARI_ETHERNEC_BASE,
778 .end = ATARI_ETHERNEC_BASE + 0x20 - 1,
779 .flags = IORESOURCE_IO,
780 },
781 [1] = {
782 .name = "rtl8019-irq",
783 .start = ATARI_ETHERNEC_IRQ,
784 .end = ATARI_ETHERNEC_IRQ,
785 .flags = IORESOURCE_IRQ,
786 },
787};
788
789static struct platform_device rtl8019_device = {
790 .name = "ne",
791 .id = -1,
792 .num_resources = ARRAY_SIZE(rtl8019_resources),
793 .resource = rtl8019_resources,
794};
795
796/*
797 * NetUSBee: ISP1160 USB host adapter via ROM-port adapter
798 */
799
800#define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000
801#define ATARI_NETUSBEE_BASE 0x340
802#define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2
803
804static struct resource netusbee_resources[] = {
805 [0] = {
806 .name = "isp1160-data",
807 .start = ATARI_NETUSBEE_BASE,
808 .end = ATARI_NETUSBEE_BASE + 0x1,
809 .flags = IORESOURCE_MEM,
810 },
811 [1] = {
812 .name = "isp1160-regs",
813 .start = ATARI_NETUSBEE_BASE + 0x20,
814 .end = ATARI_NETUSBEE_BASE + 0x21,
815 .flags = IORESOURCE_MEM,
816 },
817 [2] = {
818 .name = "isp1160-irq",
819 .start = ATARI_NETUSBEE_IRQ,
820 .end = ATARI_NETUSBEE_IRQ,
821 .flags = IORESOURCE_IRQ,
822 },
823};
824
825/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */
826static struct isp116x_platform_data netusbee_platform_data = {
827 /* Enable internal resistors on downstream ports */
828 .sel15Kres = 1,
829 /* On-chip overcurrent protection */
830 .oc_enable = 1,
831 /* INT output polarity */
832 .int_act_high = 1,
833 /* INT edge or level triggered */
834 .int_edge_triggered = 0,
835
836 /* WAKEUP pin connected - NOT SUPPORTED */
837 /* .remote_wakeup_connected = 0, */
838 /* Wakeup by devices on usb bus enabled */
839 .remote_wakeup_enable = 0,
840 .delay = isp1160_delay,
841};
842
843static struct platform_device netusbee_device = {
844 .name = "isp116x-hcd",
845 .id = 1,
846 .num_resources = ARRAY_SIZE(netusbee_resources),
847 .resource = netusbee_resources,
848 .dev = {
849 .platform_data = &netusbee_platform_data,
850 },
851};
852
853static struct platform_device *atari_netusbee_devices[] __initdata = {
854 &rtl8019_device,
855 &netusbee_device
856};
857#endif /* CONFIG_ATARI_ETHERNEC */
858
859int __init atari_platform_init(void)
860{
861 int rv = 0;
862
863 if (!MACH_IS_ATARI)
864 return -ENODEV;
865
866#ifdef CONFIG_ATARI_ETHERNAT
867 {
868 unsigned char *enatc_virt;
869 enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
870 if (hwreg_present(enatc_virt)) {
871 rv = platform_add_devices(atari_ethernat_devices,
872 ARRAY_SIZE(atari_ethernat_devices));
873 }
874 iounmap(enatc_virt);
875 }
876#endif
877
878#ifdef CONFIG_ATARI_ETHERNEC
879 {
880 int error;
881 unsigned char *enec_virt;
882 enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
883 if (hwreg_present(enec_virt)) {
884 error = platform_add_devices(atari_netusbee_devices,
885 ARRAY_SIZE(atari_netusbee_devices));
886 if (error && !rv)
887 rv = error;
888 }
889 iounmap(enec_virt);
890 }
891#endif
892
893 return rv;
894}
895
896arch_initcall(atari_platform_init);
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h
index c0cb36350775..d887050e6da6 100644
--- a/arch/m68k/include/asm/atarihw.h
+++ b/arch/m68k/include/asm/atarihw.h
@@ -805,5 +805,11 @@ struct MSTE_RTC {
805 805
806#define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS)) 806#define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))
807 807
808/*
809** EtherNAT add-on card for Falcon - combined ethernet and USB adapter
810*/
811
812#define ATARI_ETHERNAT_PHYS_ADDR 0x80000000
813
808#endif /* linux/atarihw.h */ 814#endif /* linux/atarihw.h */
809 815
diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h
index 5fc13bdf9044..953e0ac6855e 100644
--- a/arch/m68k/include/asm/atariints.h
+++ b/arch/m68k/include/asm/atariints.h
@@ -32,7 +32,7 @@
32#define VME_SOURCE_BASE 56 32#define VME_SOURCE_BASE 56
33#define VME_MAX_SOURCES 16 33#define VME_MAX_SOURCES 16
34 34
35#define NUM_ATARI_SOURCES (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE) 35#define NUM_ATARI_SOURCES 141
36 36
37/* convert vector number to int source number */ 37/* convert vector number to int source number */
38#define IRQ_VECTOR_TO_SOURCE(v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8))) 38#define IRQ_VECTOR_TO_SOURCE(v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8)))
@@ -94,6 +94,15 @@
94#define IRQ_SCCA_RX (52) 94#define IRQ_SCCA_RX (52)
95#define IRQ_SCCA_SPCOND (54) 95#define IRQ_SCCA_SPCOND (54)
96 96
97/* shared MFP timer D interrupts - hires timer for EtherNEC et al. */
98#define IRQ_MFP_TIMER1 (64)
99#define IRQ_MFP_TIMER2 (65)
100#define IRQ_MFP_TIMER3 (66)
101#define IRQ_MFP_TIMER4 (67)
102#define IRQ_MFP_TIMER5 (68)
103#define IRQ_MFP_TIMER6 (69)
104#define IRQ_MFP_TIMER7 (70)
105#define IRQ_MFP_TIMER8 (71)
97 106
98#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */ 107#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */
99#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */ 108#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */
diff --git a/arch/m68k/include/asm/cmpxchg.h b/arch/m68k/include/asm/cmpxchg.h
index 5c81d0eae5cf..bc755bc620ad 100644
--- a/arch/m68k/include/asm/cmpxchg.h
+++ b/arch/m68k/include/asm/cmpxchg.h
@@ -124,6 +124,9 @@ static inline unsigned long __cmpxchg(volatile void *p, unsigned long old,
124#define cmpxchg_local(ptr, o, n) \ 124#define cmpxchg_local(ptr, o, n) \
125 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ 125 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
126 (unsigned long)(n), sizeof(*(ptr)))) 126 (unsigned long)(n), sizeof(*(ptr))))
127
128#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
129
127#else 130#else
128 131
129/* 132/*
diff --git a/arch/m68k/include/asm/delay.h b/arch/m68k/include/asm/delay.h
index 12d8fe4f1d30..d28fa8fe26fe 100644
--- a/arch/m68k/include/asm/delay.h
+++ b/arch/m68k/include/asm/delay.h
@@ -92,5 +92,28 @@ static inline void __udelay(unsigned long usecs)
92#define udelay(n) (__builtin_constant_p(n) ? \ 92#define udelay(n) (__builtin_constant_p(n) ? \
93 ((n) > 20000 ? __bad_udelay() : __const_udelay(n)) : __udelay(n)) 93 ((n) > 20000 ? __bad_udelay() : __const_udelay(n)) : __udelay(n))
94 94
95/*
96 * nanosecond delay:
97 *
98 * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6) is the number of loops
99 * per microsecond
100 *
101 * 1000 / ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6) is the number of
102 * nanoseconds per loop
103 *
104 * So n / ( 1000 / ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6) ) would
105 * be the number of loops for n nanoseconds
106 */
107
108/*
109 * The simpler m68k and ColdFire processors do not have a 32*32->64
110 * multiply instruction. So we need to handle them a little differently.
111 * We use a bit of shifting and a single 32*32->32 multiply to get close.
112 * This is a macro so that the const version can factor out the first
113 * multiply and shift.
114 */
115#define HZSCALE (268435456 / (1000000 / HZ))
116
117#define ndelay(n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000));
95 118
96#endif /* defined(_M68K_DELAY_H) */ 119#endif /* defined(_M68K_DELAY_H) */
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index a6686d26fe17..ffdf54f44bc6 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -63,6 +63,23 @@
63#endif 63#endif
64#endif /* AMIGA_PCMCIA */ 64#endif /* AMIGA_PCMCIA */
65 65
66#ifdef CONFIG_ATARI_ROM_ISA
67
68#define enec_isa_read_base 0xfffa0000
69#define enec_isa_write_base 0xfffb0000
70
71#define ENEC_ISA_IO_B(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9))
72#define ENEC_ISA_IO_W(ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9))
73#define ENEC_ISA_MEM_B(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))
74#define ENEC_ISA_MEM_W(madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))
75
76#ifndef MULTI_ISA
77#define MULTI_ISA 0
78#else
79#undef MULTI_ISA
80#define MULTI_ISA 1
81#endif
82#endif /* ATARI_ROM_ISA */
66 83
67 84
68#if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE) 85#if defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE)
@@ -111,14 +128,15 @@ void mcf_pci_outsl(u32 addr, const u32 *buf, u32 len);
111#define readw(addr) in_le16(addr) 128#define readw(addr) in_le16(addr)
112#define writew(v, addr) out_le16((addr), (v)) 129#define writew(v, addr) out_le16((addr), (v))
113 130
114#elif defined(CONFIG_ISA) 131#elif defined(CONFIG_ISA) || defined(CONFIG_ATARI_ROM_ISA)
115 132
116#if MULTI_ISA == 0 133#if MULTI_ISA == 0
117#undef MULTI_ISA 134#undef MULTI_ISA
118#endif 135#endif
119 136
120#define ISA_TYPE_Q40 (1) 137#define ISA_TYPE_Q40 (1)
121#define ISA_TYPE_AG (2) 138#define ISA_TYPE_AG (2)
139#define ISA_TYPE_ENEC (3)
122 140
123#if defined(CONFIG_Q40) && !defined(MULTI_ISA) 141#if defined(CONFIG_Q40) && !defined(MULTI_ISA)
124#define ISA_TYPE ISA_TYPE_Q40 142#define ISA_TYPE ISA_TYPE_Q40
@@ -128,6 +146,10 @@ void mcf_pci_outsl(u32 addr, const u32 *buf, u32 len);
128#define ISA_TYPE ISA_TYPE_AG 146#define ISA_TYPE ISA_TYPE_AG
129#define ISA_SEX 1 147#define ISA_SEX 1
130#endif 148#endif
149#if defined(CONFIG_ATARI_ROM_ISA) && !defined(MULTI_ISA)
150#define ISA_TYPE ISA_TYPE_ENEC
151#define ISA_SEX 0
152#endif
131 153
132#ifdef MULTI_ISA 154#ifdef MULTI_ISA
133extern int isa_type; 155extern int isa_type;
@@ -152,6 +174,9 @@ static inline u8 __iomem *isa_itb(unsigned long addr)
152#ifdef CONFIG_AMIGA_PCMCIA 174#ifdef CONFIG_AMIGA_PCMCIA
153 case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr); 175 case ISA_TYPE_AG: return (u8 __iomem *)AG_ISA_IO_B(addr);
154#endif 176#endif
177#ifdef CONFIG_ATARI_ROM_ISA
178 case ISA_TYPE_ENEC: return (u8 __iomem *)ENEC_ISA_IO_B(addr);
179#endif
155 default: return NULL; /* avoid warnings, just in case */ 180 default: return NULL; /* avoid warnings, just in case */
156 } 181 }
157} 182}
@@ -165,6 +190,9 @@ static inline u16 __iomem *isa_itw(unsigned long addr)
165#ifdef CONFIG_AMIGA_PCMCIA 190#ifdef CONFIG_AMIGA_PCMCIA
166 case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr); 191 case ISA_TYPE_AG: return (u16 __iomem *)AG_ISA_IO_W(addr);
167#endif 192#endif
193#ifdef CONFIG_ATARI_ROM_ISA
194 case ISA_TYPE_ENEC: return (u16 __iomem *)ENEC_ISA_IO_W(addr);
195#endif
168 default: return NULL; /* avoid warnings, just in case */ 196 default: return NULL; /* avoid warnings, just in case */
169 } 197 }
170} 198}
@@ -188,6 +216,9 @@ static inline u8 __iomem *isa_mtb(unsigned long addr)
188#ifdef CONFIG_AMIGA_PCMCIA 216#ifdef CONFIG_AMIGA_PCMCIA
189 case ISA_TYPE_AG: return (u8 __iomem *)addr; 217 case ISA_TYPE_AG: return (u8 __iomem *)addr;
190#endif 218#endif
219#ifdef CONFIG_ATARI_ROM_ISA
220 case ISA_TYPE_ENEC: return (u8 __iomem *)ENEC_ISA_MEM_B(addr);
221#endif
191 default: return NULL; /* avoid warnings, just in case */ 222 default: return NULL; /* avoid warnings, just in case */
192 } 223 }
193} 224}
@@ -201,6 +232,9 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
201#ifdef CONFIG_AMIGA_PCMCIA 232#ifdef CONFIG_AMIGA_PCMCIA
202 case ISA_TYPE_AG: return (u16 __iomem *)addr; 233 case ISA_TYPE_AG: return (u16 __iomem *)addr;
203#endif 234#endif
235#ifdef CONFIG_ATARI_ROM_ISA
236 case ISA_TYPE_ENEC: return (u16 __iomem *)ENEC_ISA_MEM_W(addr);
237#endif
204 default: return NULL; /* avoid warnings, just in case */ 238 default: return NULL; /* avoid warnings, just in case */
205 } 239 }
206} 240}
@@ -222,6 +256,36 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)
222 (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \ 256 (ISA_SEX ? out_be16(isa_mtw((unsigned long)(p)),(val)) \
223 : out_le16(isa_mtw((unsigned long)(p)),(val))) 257 : out_le16(isa_mtw((unsigned long)(p)),(val)))
224 258
259#ifdef CONFIG_ATARI_ROM_ISA
260#define isa_rom_inb(port) rom_in_8(isa_itb(port))
261#define isa_rom_inw(port) \
262 (ISA_SEX ? rom_in_be16(isa_itw(port)) \
263 : rom_in_le16(isa_itw(port)))
264
265#define isa_rom_outb(val, port) rom_out_8(isa_itb(port), (val))
266#define isa_rom_outw(val, port) \
267 (ISA_SEX ? rom_out_be16(isa_itw(port), (val)) \
268 : rom_out_le16(isa_itw(port), (val)))
269
270#define isa_rom_readb(p) rom_in_8(isa_mtb((unsigned long)(p)))
271#define isa_rom_readw(p) \
272 (ISA_SEX ? rom_in_be16(isa_mtw((unsigned long)(p))) \
273 : rom_in_le16(isa_mtw((unsigned long)(p))))
274#define isa_rom_readw_swap(p) \
275 (ISA_SEX ? rom_in_le16(isa_mtw((unsigned long)(p))) \
276 : rom_in_be16(isa_mtw((unsigned long)(p))))
277#define isa_rom_readw_raw(p) rom_in_be16(isa_mtw((unsigned long)(p)))
278
279#define isa_rom_writeb(val, p) rom_out_8(isa_mtb((unsigned long)(p)), (val))
280#define isa_rom_writew(val, p) \
281 (ISA_SEX ? rom_out_be16(isa_mtw((unsigned long)(p)), (val)) \
282 : rom_out_le16(isa_mtw((unsigned long)(p)), (val)))
283#define isa_rom_writew_swap(val, p) \
284 (ISA_SEX ? rom_out_le16(isa_mtw((unsigned long)(p)), (val)) \
285 : rom_out_be16(isa_mtw((unsigned long)(p)), (val)))
286#define isa_rom_writew_raw(val, p) rom_out_be16(isa_mtw((unsigned long)(p)), (val))
287#endif /* CONFIG_ATARI_ROM_ISA */
288
225static inline void isa_delay(void) 289static inline void isa_delay(void)
226{ 290{
227 switch(ISA_TYPE) 291 switch(ISA_TYPE)
@@ -232,6 +296,9 @@ static inline void isa_delay(void)
232#ifdef CONFIG_AMIGA_PCMCIA 296#ifdef CONFIG_AMIGA_PCMCIA
233 case ISA_TYPE_AG: break; 297 case ISA_TYPE_AG: break;
234#endif 298#endif
299#ifdef CONFIG_ATARI_ROM_ISA
300 case ISA_TYPE_ENEC: break;
301#endif
235 default: break; /* avoid warnings */ 302 default: break; /* avoid warnings */
236 } 303 }
237} 304}
@@ -263,6 +330,29 @@ static inline void isa_delay(void)
263 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) 330 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
264 331
265 332
333#ifdef CONFIG_ATARI_ROM_ISA
334#define isa_rom_inb_p(p) ({ u8 _v = isa_rom_inb(p); isa_delay(); _v; })
335#define isa_rom_inw_p(p) ({ u16 _v = isa_rom_inw(p); isa_delay(); _v; })
336#define isa_rom_outb_p(v, p) ({ isa_rom_outb((v), (p)); isa_delay(); })
337#define isa_rom_outw_p(v, p) ({ isa_rom_outw((v), (p)); isa_delay(); })
338
339#define isa_rom_insb(port, buf, nr) raw_rom_insb(isa_itb(port), (u8 *)(buf), (nr))
340
341#define isa_rom_insw(port, buf, nr) \
342 (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) : \
343 raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
344
345#define isa_rom_outsb(port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr))
346
347#define isa_rom_outsw(port, buf, nr) \
348 (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \
349 raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)))
350#endif /* CONFIG_ATARI_ROM_ISA */
351
352#endif /* CONFIG_ISA || CONFIG_ATARI_ROM_ISA */
353
354
355#if defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
266#define inb isa_inb 356#define inb isa_inb
267#define inb_p isa_inb_p 357#define inb_p isa_inb_p
268#define outb isa_outb 358#define outb isa_outb
@@ -285,9 +375,43 @@ static inline void isa_delay(void)
285#define readw isa_readw 375#define readw isa_readw
286#define writeb isa_writeb 376#define writeb isa_writeb
287#define writew isa_writew 377#define writew isa_writew
378#endif /* CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
288 379
289#else /* CONFIG_ISA */ 380#ifdef CONFIG_ATARI_ROM_ISA
290 381/*
382 * kernel with both ROM port ISA and IDE compiled in, those have
383 * conflicting defs for in/out. Simply consider port < 1024
384 * ROM port ISA and everything else regular ISA for IDE. read,write defined
385 * below.
386 */
387#define inb(port) ((port) < 1024 ? isa_rom_inb(port) : in_8(port))
388#define inb_p(port) ((port) < 1024 ? isa_rom_inb_p(port) : in_8(port))
389#define inw(port) ((port) < 1024 ? isa_rom_inw(port) : in_le16(port))
390#define inw_p(port) ((port) < 1024 ? isa_rom_inw_p(port) : in_le16(port))
391#define inl isa_inl
392#define inl_p isa_inl_p
393
394#define outb(val, port) ((port) < 1024 ? isa_rom_outb((val), (port)) : out_8((port), (val)))
395#define outb_p(val, port) ((port) < 1024 ? isa_rom_outb_p((val), (port)) : out_8((port), (val)))
396#define outw(val, port) ((port) < 1024 ? isa_rom_outw((val), (port)) : out_le16((port), (val)))
397#define outw_p(val, port) ((port) < 1024 ? isa_rom_outw_p((val), (port)) : out_le16((port), (val)))
398#define outl isa_outl
399#define outl_p isa_outl_p
400
401#define insb(port, buf, nr) ((port) < 1024 ? isa_rom_insb((port), (buf), (nr)) : isa_insb((port), (buf), (nr)))
402#define insw(port, buf, nr) ((port) < 1024 ? isa_rom_insw((port), (buf), (nr)) : isa_insw((port), (buf), (nr)))
403#define insl isa_insl
404#define outsb(port, buf, nr) ((port) < 1024 ? isa_rom_outsb((port), (buf), (nr)) : isa_outsb((port), (buf), (nr)))
405#define outsw(port, buf, nr) ((port) < 1024 ? isa_rom_outsw((port), (buf), (nr)) : isa_outsw((port), (buf), (nr)))
406#define outsl isa_outsl
407
408#define readb(addr) in_8(addr)
409#define writeb(val, addr) out_8((addr), (val))
410#define readw(addr) in_le16(addr)
411#define writew(val, addr) out_le16((addr), (val))
412#endif /* CONFIG_ATARI_ROM_ISA */
413
414#if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
291/* 415/*
292 * We need to define dummy functions for GENERIC_IOMAP support. 416 * We need to define dummy functions for GENERIC_IOMAP support.
293 */ 417 */
@@ -319,7 +443,7 @@ static inline void isa_delay(void)
319#define readw(addr) in_le16(addr) 443#define readw(addr) in_le16(addr)
320#define writew(val,addr) out_le16((addr),(val)) 444#define writew(val,addr) out_le16((addr),(val))
321 445
322#endif /* CONFIG_ISA */ 446#endif /* !CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
323 447
324#define readl(addr) in_le32(addr) 448#define readl(addr) in_le32(addr)
325#define writel(val,addr) out_le32((addr),(val)) 449#define writel(val,addr) out_le32((addr),(val))
diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h
index c1155f0e22cc..81ca118d58af 100644
--- a/arch/m68k/include/asm/irq.h
+++ b/arch/m68k/include/asm/irq.h
@@ -6,12 +6,16 @@
6 * different m68k hosts compiled into the kernel. 6 * different m68k hosts compiled into the kernel.
7 * Currently the Atari has 72 and the Amiga 24, but if both are 7 * Currently the Atari has 72 and the Amiga 24, but if both are
8 * supported in the kernel it is better to make room for 72. 8 * supported in the kernel it is better to make room for 72.
9 * With EtherNAT add-on card on Atari, the highest interrupt
10 * number is 140 so NR_IRQS needs to be 141.
9 */ 11 */
10#if defined(CONFIG_COLDFIRE) 12#if defined(CONFIG_COLDFIRE)
11#define NR_IRQS 256 13#define NR_IRQS 256
12#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) 14#elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
13#define NR_IRQS 200 15#define NR_IRQS 200
14#elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) 16#elif defined(CONFIG_ATARI)
17#define NR_IRQS 141
18#elif defined(CONFIG_MAC)
15#define NR_IRQS 72 19#define NR_IRQS 72
16#elif defined(CONFIG_Q40) 20#elif defined(CONFIG_Q40)
17#define NR_IRQS 43 21#define NR_IRQS 43
diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h
index d9eb9834ccc8..932faa35655b 100644
--- a/arch/m68k/include/asm/raw_io.h
+++ b/arch/m68k/include/asm/raw_io.h
@@ -10,7 +10,7 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#include <asm/types.h> 13#include <asm/byteorder.h>
14 14
15 15
16/* Values for nocacheflag and cmode */ 16/* Values for nocacheflag and cmode */
@@ -60,6 +60,57 @@ extern void __iounmap(void *addr, unsigned long size);
60#define __raw_writew(val,addr) out_be16((addr),(val)) 60#define __raw_writew(val,addr) out_be16((addr),(val))
61#define __raw_writel(val,addr) out_be32((addr),(val)) 61#define __raw_writel(val,addr) out_be32((addr),(val))
62 62
63/*
64 * Atari ROM port (cartridge port) ISA adapter, used for the EtherNEC NE2000
65 * network card driver.
66 * The ISA adapter connects address lines A9-A13 to ISA address lines A0-A4,
67 * and hardwires the rest of the ISA addresses for a base address of 0x300.
68 *
69 * Data lines D8-D15 are connected to ISA data lines D0-D7 for reading.
70 * For writes, address lines A1-A8 are latched to ISA data lines D0-D7
71 * (meaning the bit pattern on A1-A8 can be read back as byte).
72 *
73 * Read and write operations are distinguished by the base address used:
74 * reads are from the ROM A side range, writes are through the B side range
75 * addresses (A side base + 0x10000).
76 *
77 * Reads and writes are byte only.
78 *
79 * 16 bit reads and writes are necessary for the NetUSBee adapter's USB
80 * chipset - 16 bit words are read straight off the ROM port while 16 bit
81 * reads are split into two byte writes. The low byte is latched to the
82 * NetUSBee buffer by a read from the _read_ window (with the data pattern
83 * asserted as A1-A8 address pattern). The high byte is then written to the
84 * write range as usual, completing the write cycle.
85 */
86
87#if defined(CONFIG_ATARI_ROM_ISA)
88#define rom_in_8(addr) \
89 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v >>= 8; __v; })
90#define rom_in_be16(addr) \
91 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
92#define rom_in_le16(addr) \
93 ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })
94
95#define rom_out_8(addr, b) \
96 ({u8 __w, __v = (b); u32 _addr = ((u32) (addr)); \
97 __w = ((*(__force volatile u8 *) ((_addr | 0x10000) + (__v<<1)))); })
98#define rom_out_be16(addr, w) \
99 ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
100 __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v & 0xFF)<<1)))); \
101 __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v >> 8)<<1)))); })
102#define rom_out_le16(addr, w) \
103 ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
104 __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v >> 8)<<1)))); \
105 __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v & 0xFF)<<1)))); })
106
107#define raw_rom_inb rom_in_8
108#define raw_rom_inw rom_in_be16
109
110#define raw_rom_outb(val, port) rom_out_8((port), (val))
111#define raw_rom_outw(val, port) rom_out_be16((port), (val))
112#endif /* CONFIG_ATARI_ROM_ISA */
113
63static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) 114static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
64{ 115{
65 unsigned int i; 116 unsigned int i;
@@ -342,6 +393,62 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
342 : "d0", "a0", "a1", "d6"); 393 : "d0", "a0", "a1", "d6");
343} 394}
344 395
396
397#if defined(CONFIG_ATARI_ROM_ISA)
398static inline void raw_rom_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
399{
400 unsigned int i;
401
402 for (i = 0; i < len; i++)
403 *buf++ = rom_in_8(port);
404}
405
406static inline void raw_rom_outsb(volatile u8 __iomem *port, const u8 *buf,
407 unsigned int len)
408{
409 unsigned int i;
410
411 for (i = 0; i < len; i++)
412 rom_out_8(port, *buf++);
413}
414
415static inline void raw_rom_insw(volatile u16 __iomem *port, u16 *buf,
416 unsigned int nr)
417{
418 unsigned int i;
419
420 for (i = 0; i < nr; i++)
421 *buf++ = rom_in_be16(port);
422}
423
424static inline void raw_rom_outsw(volatile u16 __iomem *port, const u16 *buf,
425 unsigned int nr)
426{
427 unsigned int i;
428
429 for (i = 0; i < nr; i++)
430 rom_out_be16(port, *buf++);
431}
432
433static inline void raw_rom_insw_swapw(volatile u16 __iomem *port, u16 *buf,
434 unsigned int nr)
435{
436 unsigned int i;
437
438 for (i = 0; i < nr; i++)
439 *buf++ = rom_in_le16(port);
440}
441
442static inline void raw_rom_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
443 unsigned int nr)
444{
445 unsigned int i;
446
447 for (i = 0; i < nr; i++)
448 rom_out_le16(port, *buf++);
449}
450#endif /* CONFIG_ATARI_ROM_ISA */
451
345#endif /* __KERNEL__ */ 452#endif /* __KERNEL__ */
346 453
347#endif /* _RAW_IO_H */ 454#endif /* _RAW_IO_H */
diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
index 32198454da70..9aea9f11fa25 100644
--- a/arch/m68k/include/asm/string.h
+++ b/arch/m68k/include/asm/string.h
@@ -4,15 +4,6 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7static inline size_t __kernel_strlen(const char *s)
8{
9 const char *sc;
10
11 for (sc = s; *sc++; )
12 ;
13 return sc - s - 1;
14}
15
16static inline char *__kernel_strcpy(char *dest, const char *src) 7static inline char *__kernel_strcpy(char *dest, const char *src)
17{ 8{
18 char *xdest = dest; 9 char *xdest = dest;
@@ -27,11 +18,6 @@ static inline char *__kernel_strcpy(char *dest, const char *src)
27 18
28#ifndef __IN_STRING_C 19#ifndef __IN_STRING_C
29 20
30#define __HAVE_ARCH_STRLEN
31#define strlen(s) (__builtin_constant_p(s) ? \
32 __builtin_strlen(s) : \
33 __kernel_strlen(s))
34
35#define __HAVE_ARCH_STRNLEN 21#define __HAVE_ARCH_STRNLEN
36static inline size_t strnlen(const char *s, size_t count) 22static inline size_t strnlen(const char *s, size_t count)
37{ 23{
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 6cd92671ca5e..014f288fc813 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -32,12 +32,4 @@
32#define __ARCH_WANT_SYS_FORK 32#define __ARCH_WANT_SYS_FORK
33#define __ARCH_WANT_SYS_VFORK 33#define __ARCH_WANT_SYS_VFORK
34 34
35/*
36 * "Conditional" syscalls
37 *
38 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
39 * but it doesn't work on all toolchains, so we just do it by hand
40 */
41#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
42
43#endif /* _ASM_M68K_UNISTD_H_ */ 35#endif /* _ASM_M68K_UNISTD_H_ */
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index d538694ad208..c55ff719fa72 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -51,40 +51,16 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
51 return sw->retpc; 51 return sw->retpc;
52} 52}
53 53
54/* 54void arch_cpu_idle(void)
55 * The idle loop on an m68k..
56 */
57static void default_idle(void)
58{ 55{
59 if (!need_resched())
60#if defined(MACH_ATARI_ONLY) 56#if defined(MACH_ATARI_ONLY)
61 /* block out HSYNC on the atari (falcon) */ 57 /* block out HSYNC on the atari (falcon) */
62 __asm__("stop #0x2200" : : : "cc"); 58 __asm__("stop #0x2200" : : : "cc");
63#else 59#else
64 __asm__("stop #0x2000" : : : "cc"); 60 __asm__("stop #0x2000" : : : "cc");
65#endif 61#endif
66} 62}
67 63
68void (*idle)(void) = default_idle;
69
70/*
71 * The idle thread. There's no useful work to be
72 * done, so just try to conserve power and have a
73 * low exit latency (ie sit in a loop waiting for
74 * somebody to say that they'd like to reschedule)
75 */
76void cpu_idle(void)
77{
78 /* endless idle loop with no priority at all */
79 while (1) {
80 rcu_idle_enter();
81 while (!need_resched())
82 idle();
83 rcu_idle_exit();
84 schedule_preempt_disabled();
85 }
86}
87
88void machine_restart(char * __unused) 64void machine_restart(char * __unused)
89{ 65{
90 if (mach_reset) 66 if (mach_reset)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 80cfbe56ea32..e67e53159573 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -381,6 +381,12 @@ void __init setup_arch(char **cmdline_p)
381 isa_sex = 1; 381 isa_sex = 1;
382 } 382 }
383#endif 383#endif
384#ifdef CONFIG_ATARI_ROM_ISA
385 if (MACH_IS_ATARI) {
386 isa_type = ISA_TYPE_ENEC;
387 isa_sex = 0;
388 }
389#endif
384#endif 390#endif
385} 391}
386 392
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index f32ab22e7ed3..88fcd8c70e7b 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -992,18 +992,6 @@ void show_stack(struct task_struct *task, unsigned long *stack)
992} 992}
993 993
994/* 994/*
995 * The architecture-independent backtrace generator
996 */
997void dump_stack(void)
998{
999 unsigned long stack;
1000
1001 show_trace(&stack);
1002}
1003
1004EXPORT_SYMBOL(dump_stack);
1005
1006/*
1007 * The vector number returned in the frame pointer may also contain 995 * The vector number returned in the frame pointer may also contain
1008 * the "fs" (Fault Status) bits on ColdFire. These are in the bottom 996 * the "fs" (Fault Status) bits on ColdFire. These are in the bottom
1009 * 2 bits, and upper 2 bits. So we need to mask out the real vector 997 * 2 bits, and upper 2 bits. So we need to mask out the real vector
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index b9a57abfad08..4d61fa8a112c 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -17,6 +17,6 @@ EXPORT_SYMBOL(strcpy);
17 17
18char *strcat(char *dest, const char *src) 18char *strcat(char *dest, const char *src)
19{ 19{
20 return __kernel_strcpy(dest + __kernel_strlen(dest), src); 20 return __kernel_strcpy(dest + strlen(dest), src);
21} 21}
22EXPORT_SYMBOL(strcat); 22EXPORT_SYMBOL(strcat);
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 519aad8fa812..1af2ca3411f6 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -110,18 +110,7 @@ void __init paging_init(void)
110void free_initmem(void) 110void free_initmem(void)
111{ 111{
112#ifndef CONFIG_MMU_SUN3 112#ifndef CONFIG_MMU_SUN3
113 unsigned long addr; 113 free_initmem_default(0);
114
115 addr = (unsigned long) __init_begin;
116 for (; addr < ((unsigned long) __init_end); addr += PAGE_SIZE) {
117 ClearPageReserved(virt_to_page(addr));
118 init_page_count(virt_to_page(addr));
119 free_page(addr);
120 totalram_pages++;
121 }
122 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
123 (addr - (unsigned long) __init_begin) >> 10,
124 (unsigned int) __init_begin, (unsigned int) __init_end);
125#endif /* CONFIG_MMU_SUN3 */ 114#endif /* CONFIG_MMU_SUN3 */
126} 115}
127 116
@@ -213,15 +202,6 @@ void __init mem_init(void)
213#ifdef CONFIG_BLK_DEV_INITRD 202#ifdef CONFIG_BLK_DEV_INITRD
214void free_initrd_mem(unsigned long start, unsigned long end) 203void free_initrd_mem(unsigned long start, unsigned long end)
215{ 204{
216 int pages = 0; 205 free_reserved_area(start, end, 0, "initrd");
217 for (; start < end; start += PAGE_SIZE) {
218 ClearPageReserved(virt_to_page(start));
219 init_page_count(virt_to_page(start));
220 free_page(start);
221 totalram_pages++;
222 pages++;
223 }
224 pr_notice("Freeing initrd memory: %dk freed\n",
225 pages << (PAGE_SHIFT - 10));
226} 206}
227#endif 207#endif
diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig
index afc8973d1488..6f16c1469327 100644
--- a/arch/metag/Kconfig
+++ b/arch/metag/Kconfig
@@ -1,7 +1,3 @@
1config SYMBOL_PREFIX
2 string
3 default "_"
4
5config METAG 1config METAG
6 def_bool y 2 def_bool y
7 select EMBEDDED 3 select EMBEDDED
@@ -25,8 +21,10 @@ config METAG
25 select HAVE_MEMBLOCK 21 select HAVE_MEMBLOCK
26 select HAVE_MEMBLOCK_NODE_MAP 22 select HAVE_MEMBLOCK_NODE_MAP
27 select HAVE_MOD_ARCH_SPECIFIC 23 select HAVE_MOD_ARCH_SPECIFIC
24 select HAVE_OPROFILE
28 select HAVE_PERF_EVENTS 25 select HAVE_PERF_EVENTS
29 select HAVE_SYSCALL_TRACEPOINTS 26 select HAVE_SYSCALL_TRACEPOINTS
27 select HAVE_UNDERSCORE_SYMBOL_PREFIX
30 select IRQ_DOMAIN 28 select IRQ_DOMAIN
31 select MODULES_USE_ELF_RELA 29 select MODULES_USE_ELF_RELA
32 select OF 30 select OF
@@ -209,6 +207,9 @@ config METAG_PERFCOUNTER_IRQS
209 When disabled, Performance Counters information will be collected 207 When disabled, Performance Counters information will be collected
210 based on Timer Interrupt. 208 based on Timer Interrupt.
211 209
210config HW_PERF_EVENTS
211 def_bool METAG_PERFCOUNTER_IRQS && PERF_EVENTS
212
212config METAG_DA 213config METAG_DA
213 bool "DA support" 214 bool "DA support"
214 help 215 help
diff --git a/arch/metag/Makefile b/arch/metag/Makefile
index 81bd6a1c7483..b566116b171b 100644
--- a/arch/metag/Makefile
+++ b/arch/metag/Makefile
@@ -49,6 +49,8 @@ core-y += arch/metag/mm/
49libs-y += arch/metag/lib/ 49libs-y += arch/metag/lib/
50libs-y += arch/metag/tbx/ 50libs-y += arch/metag/tbx/
51 51
52drivers-$(CONFIG_OPROFILE) += arch/metag/oprofile/
53
52boot := arch/metag/boot 54boot := arch/metag/boot
53 55
54boot_targets += uImage 56boot_targets += uImage
diff --git a/arch/metag/boot/dts/Makefile b/arch/metag/boot/dts/Makefile
index e0b5afd8bde8..dbd95217733a 100644
--- a/arch/metag/boot/dts/Makefile
+++ b/arch/metag/boot/dts/Makefile
@@ -4,13 +4,17 @@ dtb-y += skeleton.dtb
4builtindtb-y := skeleton 4builtindtb-y := skeleton
5 5
6ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"") 6ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"")
7 builtindtb-y := $(CONFIG_METAG_BUILTIN_DTB_NAME) 7 builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME))
8endif 8endif
9obj-$(CONFIG_METAG_BUILTIN_DTB) += $(patsubst "%",%,$(builtindtb-y)).dtb.o 9
10dtb-$(CONFIG_METAG_BUILTIN_DTB) += $(builtindtb-y).dtb
11obj-$(CONFIG_METAG_BUILTIN_DTB) += $(builtindtb-y).dtb.o
10 12
11targets += dtbs 13targets += dtbs
12targets += $(dtb-y) 14targets += $(dtb-y)
13 15
16.SECONDARY: $(obj)/$(builtindtb-y).dtb.S
17
14dtbs: $(addprefix $(obj)/, $(dtb-y)) 18dtbs: $(addprefix $(obj)/, $(dtb-y))
15 19
16clean-files += *.dtb 20clean-files += *.dtb *.dtb.S
diff --git a/arch/metag/configs/meta1_defconfig b/arch/metag/configs/meta1_defconfig
index c35a75e8ecfe..01cd67e4403d 100644
--- a/arch/metag/configs/meta1_defconfig
+++ b/arch/metag/configs/meta1_defconfig
@@ -1,6 +1,5 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=13
4CONFIG_SYSFS_DEPRECATED=y 3CONFIG_SYSFS_DEPRECATED=y
5CONFIG_SYSFS_DEPRECATED_V2=y 4CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_KALLSYMS_ALL=y 5CONFIG_KALLSYMS_ALL=y
diff --git a/arch/metag/configs/meta2_defconfig b/arch/metag/configs/meta2_defconfig
index fb3148410183..643392ba7ed5 100644
--- a/arch/metag/configs/meta2_defconfig
+++ b/arch/metag/configs/meta2_defconfig
@@ -1,7 +1,6 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=13
5CONFIG_SYSFS_DEPRECATED=y 4CONFIG_SYSFS_DEPRECATED=y
6CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
diff --git a/arch/metag/configs/meta2_smp_defconfig b/arch/metag/configs/meta2_smp_defconfig
index 6c7b777ac276..f3306737da20 100644
--- a/arch/metag/configs/meta2_smp_defconfig
+++ b/arch/metag/configs/meta2_smp_defconfig
@@ -1,7 +1,6 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=13
5CONFIG_SYSFS_DEPRECATED=y 4CONFIG_SYSFS_DEPRECATED=y
6CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
diff --git a/arch/metag/include/asm/metag_mem.h b/arch/metag/include/asm/metag_mem.h
index 3f7b54d8ccac..aa5a076df439 100644
--- a/arch/metag/include/asm/metag_mem.h
+++ b/arch/metag/include/asm/metag_mem.h
@@ -700,6 +700,9 @@
700#define SYSC_xCPARTG_AND_S 8 700#define SYSC_xCPARTG_AND_S 8
701#define SYSC_xCPARTL_OR_BITS 0x000F0000 /* Ors into top 4 bits */ 701#define SYSC_xCPARTL_OR_BITS 0x000F0000 /* Ors into top 4 bits */
702#define SYSC_xCPARTL_OR_S 16 702#define SYSC_xCPARTL_OR_S 16
703#ifdef METAC_2_1
704#define SYSC_DCPART_GCON_BIT 0x00100000 /* Coherent shared local */
705#endif /* METAC_2_1 */
703#define SYSC_xCPARTG_OR_BITS 0x0F000000 /* Ors into top 4 bits */ 706#define SYSC_xCPARTG_OR_BITS 0x0F000000 /* Ors into top 4 bits */
704#define SYSC_xCPARTG_OR_S 24 707#define SYSC_xCPARTG_OR_S 24
705#define SYSC_CWRMODE_BIT 0x80000000 /* Write cache mode bit */ 708#define SYSC_CWRMODE_BIT 0x80000000 /* Write cache mode bit */
diff --git a/arch/metag/include/asm/thread_info.h b/arch/metag/include/asm/thread_info.h
index 0ecd34d8b5f6..7c4a33006142 100644
--- a/arch/metag/include/asm/thread_info.h
+++ b/arch/metag/include/asm/thread_info.h
@@ -150,6 +150,4 @@ static inline int kstack_end(void *addr)
150#define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \ 150#define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
151 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)) 151 _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
152 152
153#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
154
155#endif /* _ASM_THREAD_INFO_H */ 153#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild
index 876c71f866de..84e09feb4d54 100644
--- a/arch/metag/include/uapi/asm/Kbuild
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += byteorder.h 4header-y += byteorder.h
5header-y += ech.h
5header-y += ptrace.h 6header-y += ptrace.h
6header-y += resource.h 7header-y += resource.h
7header-y += sigcontext.h 8header-y += sigcontext.h
diff --git a/arch/metag/include/uapi/asm/ech.h b/arch/metag/include/uapi/asm/ech.h
new file mode 100644
index 000000000000..ac94d1cf9be4
--- /dev/null
+++ b/arch/metag/include/uapi/asm/ech.h
@@ -0,0 +1,15 @@
1#ifndef _UAPI_METAG_ECH_H
2#define _UAPI_METAG_ECH_H
3
4/*
5 * These bits can be set in the top half of the D0.8 register when DSP context
6 * switching is enabled, in order to support partial DSP context save/restore.
7 */
8
9#define TBICTX_XEXT_BIT 0x1000 /* Enable extended context save */
10#define TBICTX_XTDP_BIT 0x0800 /* DSP accumulators/RAM/templates */
11#define TBICTX_XHL2_BIT 0x0400 /* Hardware loops */
12#define TBICTX_XAXX_BIT 0x0200 /* Extended AX registers (A*.4-7) */
13#define TBICTX_XDX8_BIT 0x0100 /* Extended DX registers (D*.8-15) */
14
15#endif /* _UAPI_METAG_ECH_H */
diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c
index 3a589dfb966b..954548b1bea8 100644
--- a/arch/metag/kernel/cachepart.c
+++ b/arch/metag/kernel/cachepart.c
@@ -24,15 +24,21 @@
24unsigned int get_dcache_size(void) 24unsigned int get_dcache_size(void)
25{ 25{
26 unsigned int config2 = metag_in32(METAC_CORE_CONFIG2); 26 unsigned int config2 = metag_in32(METAC_CORE_CONFIG2);
27 return 0x1000 << ((config2 & METAC_CORECFG2_DCSZ_BITS) 27 unsigned int sz = 0x1000 << ((config2 & METAC_CORECFG2_DCSZ_BITS)
28 >> METAC_CORECFG2_DCSZ_S); 28 >> METAC_CORECFG2_DCSZ_S);
29 if (config2 & METAC_CORECFG2_DCSMALL_BIT)
30 sz >>= 6;
31 return sz;
29} 32}
30 33
31unsigned int get_icache_size(void) 34unsigned int get_icache_size(void)
32{ 35{
33 unsigned int config2 = metag_in32(METAC_CORE_CONFIG2); 36 unsigned int config2 = metag_in32(METAC_CORE_CONFIG2);
34 return 0x1000 << ((config2 & METAC_CORE_C2ICSZ_BITS) 37 unsigned int sz = 0x1000 << ((config2 & METAC_CORE_C2ICSZ_BITS)
35 >> METAC_CORE_C2ICSZ_S); 38 >> METAC_CORE_C2ICSZ_S);
39 if (config2 & METAC_CORECFG2_ICSMALL_BIT)
40 sz >>= 6;
41 return sz;
36} 42}
37 43
38unsigned int get_global_dcache_size(void) 44unsigned int get_global_dcache_size(void)
@@ -61,7 +67,7 @@ static unsigned int get_thread_cache_size(unsigned int cache, int thread_id)
61 return 0; 67 return 0;
62#if PAGE_OFFSET >= LINGLOBAL_BASE 68#if PAGE_OFFSET >= LINGLOBAL_BASE
63 /* Checking for global cache */ 69 /* Checking for global cache */
64 cache_size = (cache == DCACHE ? get_global_dache_size() : 70 cache_size = (cache == DCACHE ? get_global_dcache_size() :
65 get_global_icache_size()); 71 get_global_icache_size());
66 offset = 8; 72 offset = 8;
67#else 73#else
diff --git a/arch/metag/kernel/da.c b/arch/metag/kernel/da.c
index 52aabb658fde..a35dbed6fffa 100644
--- a/arch/metag/kernel/da.c
+++ b/arch/metag/kernel/da.c
@@ -5,12 +5,14 @@
5 */ 5 */
6 6
7 7
8#include <linux/export.h>
8#include <linux/io.h> 9#include <linux/io.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
10#include <asm/da.h> 11#include <asm/da.h>
11#include <asm/metag_mem.h> 12#include <asm/metag_mem.h>
12 13
13bool _metag_da_present; 14bool _metag_da_present;
15EXPORT_SYMBOL_GPL(_metag_da_present);
14 16
15int __init metag_da_probe(void) 17int __init metag_da_probe(void)
16{ 18{
diff --git a/arch/metag/kernel/head.S b/arch/metag/kernel/head.S
index 969dffabc03a..713f71d1bdfe 100644
--- a/arch/metag/kernel/head.S
+++ b/arch/metag/kernel/head.S
@@ -1,6 +1,7 @@
1 ! Copyright 2005,2006,2007,2009 Imagination Technologies 1 ! Copyright 2005,2006,2007,2009 Imagination Technologies
2 2
3#include <linux/init.h> 3#include <linux/init.h>
4#include <asm/metag_mem.h>
4#include <generated/asm-offsets.h> 5#include <generated/asm-offsets.h>
5#undef __exit 6#undef __exit
6 7
@@ -48,6 +49,13 @@ __exit:
48 .global _secondary_startup 49 .global _secondary_startup
49 .type _secondary_startup,function 50 .type _secondary_startup,function
50_secondary_startup: 51_secondary_startup:
52#if CONFIG_PAGE_OFFSET < LINGLOBAL_BASE
53 ! In case GCOn has just been turned on we need to fence any writes that
54 ! the boot thread might have performed prior to coherency taking effect.
55 MOVT D0Re0,#HI(LINSYSEVENT_WR_ATOMIC_UNLOCK)
56 MOV D1Re0,#0
57 SETD [D0Re0], D1Re0
58#endif
51 MOVT A0StP,#HI(_secondary_data_stack) 59 MOVT A0StP,#HI(_secondary_data_stack)
52 ADD A0StP,A0StP,#LO(_secondary_data_stack) 60 ADD A0StP,A0StP,#LO(_secondary_data_stack)
53 GETD A0StP,[A0StP] 61 GETD A0StP,[A0StP]
diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index a876d5ff3897..366569425c52 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -22,9 +22,9 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23 23
24#include <asm/core_reg.h> 24#include <asm/core_reg.h>
25#include <asm/hwthread.h>
26#include <asm/io.h> 25#include <asm/io.h>
27#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/processor.h>
28 28
29#include "perf_event.h" 29#include "perf_event.h"
30 30
@@ -40,10 +40,10 @@ static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
40/* PMU admin */ 40/* PMU admin */
41const char *perf_pmu_name(void) 41const char *perf_pmu_name(void)
42{ 42{
43 if (metag_pmu) 43 if (!metag_pmu)
44 return metag_pmu->pmu.name; 44 return NULL;
45 45
46 return NULL; 46 return metag_pmu->name;
47} 47}
48EXPORT_SYMBOL_GPL(perf_pmu_name); 48EXPORT_SYMBOL_GPL(perf_pmu_name);
49 49
@@ -171,6 +171,7 @@ static int metag_pmu_event_init(struct perf_event *event)
171 switch (event->attr.type) { 171 switch (event->attr.type) {
172 case PERF_TYPE_HARDWARE: 172 case PERF_TYPE_HARDWARE:
173 case PERF_TYPE_HW_CACHE: 173 case PERF_TYPE_HW_CACHE:
174 case PERF_TYPE_RAW:
174 err = _hw_perf_event_init(event); 175 err = _hw_perf_event_init(event);
175 break; 176 break;
176 177
@@ -211,9 +212,10 @@ again:
211 /* 212 /*
212 * Calculate the delta and add it to the counter. 213 * Calculate the delta and add it to the counter.
213 */ 214 */
214 delta = new_raw_count - prev_raw_count; 215 delta = (new_raw_count - prev_raw_count) & MAX_PERIOD;
215 216
216 local64_add(delta, &event->count); 217 local64_add(delta, &event->count);
218 local64_sub(delta, &hwc->period_left);
217} 219}
218 220
219int metag_pmu_event_set_period(struct perf_event *event, 221int metag_pmu_event_set_period(struct perf_event *event,
@@ -223,6 +225,10 @@ int metag_pmu_event_set_period(struct perf_event *event,
223 s64 period = hwc->sample_period; 225 s64 period = hwc->sample_period;
224 int ret = 0; 226 int ret = 0;
225 227
228 /* The period may have been changed */
229 if (unlikely(period != hwc->last_period))
230 left += period - hwc->last_period;
231
226 if (unlikely(left <= -period)) { 232 if (unlikely(left <= -period)) {
227 left = period; 233 left = period;
228 local64_set(&hwc->period_left, left); 234 local64_set(&hwc->period_left, left);
@@ -240,8 +246,10 @@ int metag_pmu_event_set_period(struct perf_event *event,
240 if (left > (s64)metag_pmu->max_period) 246 if (left > (s64)metag_pmu->max_period)
241 left = metag_pmu->max_period; 247 left = metag_pmu->max_period;
242 248
243 if (metag_pmu->write) 249 if (metag_pmu->write) {
244 metag_pmu->write(idx, (u64)(-left) & MAX_PERIOD); 250 local64_set(&hwc->prev_count, -(s32)left);
251 metag_pmu->write(idx, -left & MAX_PERIOD);
252 }
245 253
246 perf_event_update_userpage(event); 254 perf_event_update_userpage(event);
247 255
@@ -549,6 +557,10 @@ static int _hw_perf_event_init(struct perf_event *event)
549 if (err) 557 if (err)
550 return err; 558 return err;
551 break; 559 break;
560
561 case PERF_TYPE_RAW:
562 mapping = attr->config;
563 break;
552 } 564 }
553 565
554 /* Return early if the event is unsupported */ 566 /* Return early if the event is unsupported */
@@ -610,15 +622,13 @@ static void metag_pmu_enable_counter(struct hw_perf_event *event, int idx)
610 WARN_ONCE((config != 0x100), 622 WARN_ONCE((config != 0x100),
611 "invalid configuration (%d) for counter (%d)\n", 623 "invalid configuration (%d) for counter (%d)\n",
612 config, idx); 624 config, idx);
613 625 local64_set(&event->prev_count, __core_reg_get(TXTACTCYC));
614 /* Reset the cycle count */
615 __core_reg_set(TXTACTCYC, 0);
616 goto unlock; 626 goto unlock;
617 } 627 }
618 628
619 /* Check for a core internal or performance channel event. */ 629 /* Check for a core internal or performance channel event. */
620 if (tmp) { 630 if (tmp) {
621 void *perf_addr = (void *)PERF_COUNT(idx); 631 void *perf_addr;
622 632
623 /* 633 /*
624 * Anything other than a cycle count will write the low- 634 * Anything other than a cycle count will write the low-
@@ -632,9 +642,14 @@ static void metag_pmu_enable_counter(struct hw_perf_event *event, int idx)
632 case 0xf0: 642 case 0xf0:
633 perf_addr = (void *)PERF_CHAN(idx); 643 perf_addr = (void *)PERF_CHAN(idx);
634 break; 644 break;
645
646 default:
647 perf_addr = NULL;
648 break;
635 } 649 }
636 650
637 metag_out32((tmp & 0x0f), perf_addr); 651 if (perf_addr)
652 metag_out32((config & 0x0f), perf_addr);
638 653
639 /* 654 /*
640 * Now we use the high nibble as the performance event to 655 * Now we use the high nibble as the performance event to
@@ -643,13 +658,21 @@ static void metag_pmu_enable_counter(struct hw_perf_event *event, int idx)
643 config = tmp >> 4; 658 config = tmp >> 4;
644 } 659 }
645 660
646 /*
647 * Enabled counters start from 0. Early cores clear the count on
648 * write but newer cores don't, so we make sure that the count is
649 * set to 0.
650 */
651 tmp = ((config & 0xf) << 28) | 661 tmp = ((config & 0xf) << 28) |
652 ((1 << 24) << cpu_2_hwthread_id[get_cpu()]); 662 ((1 << 24) << hard_processor_id());
663 if (metag_pmu->max_period)
664 /*
665 * Cores supporting overflow interrupts may have had the counter
666 * set to a specific value that needs preserving.
667 */
668 tmp |= metag_in32(PERF_COUNT(idx)) & 0x00ffffff;
669 else
670 /*
671 * Older cores reset the counter on write, so prev_count needs
672 * resetting too so we can calculate a correct delta.
673 */
674 local64_set(&event->prev_count, 0);
675
653 metag_out32(tmp, PERF_COUNT(idx)); 676 metag_out32(tmp, PERF_COUNT(idx));
654unlock: 677unlock:
655 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 678 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
@@ -693,9 +716,8 @@ static u64 metag_pmu_read_counter(int idx)
693{ 716{
694 u32 tmp = 0; 717 u32 tmp = 0;
695 718
696 /* The act of reading the cycle counter also clears it */
697 if (METAG_INST_COUNTER == idx) { 719 if (METAG_INST_COUNTER == idx) {
698 __core_reg_swap(TXTACTCYC, tmp); 720 tmp = __core_reg_get(TXTACTCYC);
699 goto out; 721 goto out;
700 } 722 }
701 723
@@ -764,10 +786,16 @@ static irqreturn_t metag_pmu_counter_overflow(int irq, void *dev)
764 786
765 /* 787 /*
766 * Enable the counter again once core overflow processing has 788 * Enable the counter again once core overflow processing has
767 * completed. 789 * completed. Note the counter value may have been modified while it was
790 * inactive to set it up ready for the next interrupt.
768 */ 791 */
769 if (!perf_event_overflow(event, &sampledata, regs)) 792 if (!perf_event_overflow(event, &sampledata, regs)) {
793 __global_lock2(flags);
794 counter = (counter & 0xff000000) |
795 (metag_in32(PERF_COUNT(idx)) & 0x00ffffff);
770 metag_out32(counter, PERF_COUNT(idx)); 796 metag_out32(counter, PERF_COUNT(idx));
797 __global_unlock2(flags);
798 }
771 799
772 return IRQ_HANDLED; 800 return IRQ_HANDLED;
773} 801}
@@ -830,7 +858,7 @@ static int __init init_hw_perf_events(void)
830 metag_pmu->max_period = 0; 858 metag_pmu->max_period = 0;
831 } 859 }
832 860
833 metag_pmu->name = "Meta 2"; 861 metag_pmu->name = "meta2";
834 metag_pmu->version = version; 862 metag_pmu->version = version;
835 metag_pmu->pmu = pmu; 863 metag_pmu->pmu = pmu;
836 } 864 }
diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c
index c6efe62e5b76..483dff986a23 100644
--- a/arch/metag/kernel/process.c
+++ b/arch/metag/kernel/process.c
@@ -22,6 +22,7 @@
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/syscalls.h> 23#include <linux/syscalls.h>
24#include <linux/uaccess.h> 24#include <linux/uaccess.h>
25#include <linux/smp.h>
25#include <asm/core_reg.h> 26#include <asm/core_reg.h>
26#include <asm/user_gateway.h> 27#include <asm/user_gateway.h>
27#include <asm/tcm.h> 28#include <asm/tcm.h>
@@ -31,7 +32,7 @@
31/* 32/*
32 * Wait for the next interrupt and enable local interrupts 33 * Wait for the next interrupt and enable local interrupts
33 */ 34 */
34static inline void arch_idle(void) 35void arch_cpu_idle(void)
35{ 36{
36 int tmp; 37 int tmp;
37 38
@@ -59,36 +60,12 @@ static inline void arch_idle(void)
59 : "r" (get_trigger_mask())); 60 : "r" (get_trigger_mask()));
60} 61}
61 62
62void cpu_idle(void)
63{
64 set_thread_flag(TIF_POLLING_NRFLAG);
65
66 while (1) {
67 tick_nohz_idle_enter();
68 rcu_idle_enter();
69
70 while (!need_resched()) {
71 /*
72 * We need to disable interrupts here to ensure we don't
73 * miss a wakeup call.
74 */
75 local_irq_disable();
76 if (!need_resched()) {
77#ifdef CONFIG_HOTPLUG_CPU 63#ifdef CONFIG_HOTPLUG_CPU
78 if (cpu_is_offline(smp_processor_id())) 64void arch_cpu_idle_dead(void)
79 cpu_die(); 65{
80#endif 66 cpu_die();
81 arch_idle();
82 } else {
83 local_irq_enable();
84 }
85 }
86
87 rcu_idle_exit();
88 tick_nohz_idle_exit();
89 schedule_preempt_disabled();
90 }
91} 67}
68#endif
92 69
93void (*pm_power_off)(void); 70void (*pm_power_off)(void);
94EXPORT_SYMBOL(pm_power_off); 71EXPORT_SYMBOL(pm_power_off);
@@ -152,6 +129,8 @@ void show_regs(struct pt_regs *regs)
152 "D1.7 " 129 "D1.7 "
153 }; 130 };
154 131
132 show_regs_print_info(KERN_INFO);
133
155 pr_info(" pt_regs @ %p\n", regs); 134 pr_info(" pt_regs @ %p\n", regs);
156 pr_info(" SaveMask = 0x%04hx\n", regs->ctx.SaveMask); 135 pr_info(" SaveMask = 0x%04hx\n", regs->ctx.SaveMask);
157 pr_info(" Flags = 0x%04hx (%c%c%c%c)\n", regs->ctx.Flags, 136 pr_info(" Flags = 0x%04hx (%c%c%c%c)\n", regs->ctx.Flags,
diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c
index 47a8828615a5..7563628822bd 100644
--- a/arch/metag/kernel/ptrace.c
+++ b/arch/metag/kernel/ptrace.c
@@ -288,10 +288,36 @@ static int metag_rp_state_set(struct task_struct *target,
288 return metag_rp_state_copyin(regs, pos, count, kbuf, ubuf); 288 return metag_rp_state_copyin(regs, pos, count, kbuf, ubuf);
289} 289}
290 290
291static int metag_tls_get(struct task_struct *target,
292 const struct user_regset *regset,
293 unsigned int pos, unsigned int count,
294 void *kbuf, void __user *ubuf)
295{
296 void __user *tls = target->thread.tls_ptr;
297 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
298}
299
300static int metag_tls_set(struct task_struct *target,
301 const struct user_regset *regset,
302 unsigned int pos, unsigned int count,
303 const void *kbuf, const void __user *ubuf)
304{
305 int ret;
306 void __user *tls;
307
308 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
309 if (ret)
310 return ret;
311
312 target->thread.tls_ptr = tls;
313 return ret;
314}
315
291enum metag_regset { 316enum metag_regset {
292 REGSET_GENERAL, 317 REGSET_GENERAL,
293 REGSET_CBUF, 318 REGSET_CBUF,
294 REGSET_READPIPE, 319 REGSET_READPIPE,
320 REGSET_TLS,
295}; 321};
296 322
297static const struct user_regset metag_regsets[] = { 323static const struct user_regset metag_regsets[] = {
@@ -319,6 +345,14 @@ static const struct user_regset metag_regsets[] = {
319 .get = metag_rp_state_get, 345 .get = metag_rp_state_get,
320 .set = metag_rp_state_set, 346 .set = metag_rp_state_set,
321 }, 347 },
348 [REGSET_TLS] = {
349 .core_note_type = NT_METAG_TLS,
350 .n = 1,
351 .size = sizeof(void *),
352 .align = sizeof(void *),
353 .get = metag_tls_get,
354 .set = metag_tls_set,
355 },
322}; 356};
323 357
324static const struct user_regset_view user_metag_view = { 358static const struct user_regset_view user_metag_view = {
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 879246170aec..4f5726f1a55b 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -124,6 +124,7 @@ struct machine_desc *machine_desc __initdata;
124u8 cpu_2_hwthread_id[NR_CPUS] __read_mostly = { 124u8 cpu_2_hwthread_id[NR_CPUS] __read_mostly = {
125 [0 ... NR_CPUS-1] = BAD_HWTHREAD_ID 125 [0 ... NR_CPUS-1] = BAD_HWTHREAD_ID
126}; 126};
127EXPORT_SYMBOL_GPL(cpu_2_hwthread_id);
127 128
128/* 129/*
129 * Map a hardware thread ID to a Linux CPU number 130 * Map a hardware thread ID to a Linux CPU number
diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
index 4b6d1f14df32..f443ec9a7cbe 100644
--- a/arch/metag/kernel/smp.c
+++ b/arch/metag/kernel/smp.c
@@ -28,6 +28,8 @@
28#include <asm/cachepart.h> 28#include <asm/cachepart.h>
29#include <asm/core_reg.h> 29#include <asm/core_reg.h>
30#include <asm/cpu.h> 30#include <asm/cpu.h>
31#include <asm/global_lock.h>
32#include <asm/metag_mem.h>
31#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
32#include <asm/pgtable.h> 34#include <asm/pgtable.h>
33#include <asm/pgalloc.h> 35#include <asm/pgalloc.h>
@@ -37,6 +39,9 @@
37#include <asm/hwthread.h> 39#include <asm/hwthread.h>
38#include <asm/traps.h> 40#include <asm/traps.h>
39 41
42#define SYSC_DCPART(n) (SYSC_DCPART0 + SYSC_xCPARTn_STRIDE * (n))
43#define SYSC_ICPART(n) (SYSC_ICPART0 + SYSC_xCPARTn_STRIDE * (n))
44
40DECLARE_PER_CPU(PTBI, pTBI); 45DECLARE_PER_CPU(PTBI, pTBI);
41 46
42void *secondary_data_stack; 47void *secondary_data_stack;
@@ -99,6 +104,114 @@ int __cpuinit boot_secondary(unsigned int thread, struct task_struct *idle)
99 return 0; 104 return 0;
100} 105}
101 106
107/**
108 * describe_cachepart_change: describe a change to cache partitions.
109 * @thread: Hardware thread number.
110 * @label: Label of cache type, e.g. "dcache" or "icache".
111 * @sz: Total size of the cache.
112 * @old: Old cache partition configuration (*CPART* register).
113 * @new: New cache partition configuration (*CPART* register).
114 *
115 * If the cache partition has changed, prints a message to the log describing
116 * those changes.
117 */
118static __cpuinit void describe_cachepart_change(unsigned int thread,
119 const char *label,
120 unsigned int sz,
121 unsigned int old,
122 unsigned int new)
123{
124 unsigned int lor1, land1, gor1, gand1;
125 unsigned int lor2, land2, gor2, gand2;
126 unsigned int diff = old ^ new;
127
128 if (!diff)
129 return;
130
131 pr_info("Thread %d: %s partition changed:", thread, label);
132 if (diff & (SYSC_xCPARTL_OR_BITS | SYSC_xCPARTL_AND_BITS)) {
133 lor1 = (old & SYSC_xCPARTL_OR_BITS) >> SYSC_xCPARTL_OR_S;
134 lor2 = (new & SYSC_xCPARTL_OR_BITS) >> SYSC_xCPARTL_OR_S;
135 land1 = (old & SYSC_xCPARTL_AND_BITS) >> SYSC_xCPARTL_AND_S;
136 land2 = (new & SYSC_xCPARTL_AND_BITS) >> SYSC_xCPARTL_AND_S;
137 pr_cont(" L:%#x+%#x->%#x+%#x",
138 (lor1 * sz) >> 4,
139 ((land1 + 1) * sz) >> 4,
140 (lor2 * sz) >> 4,
141 ((land2 + 1) * sz) >> 4);
142 }
143 if (diff & (SYSC_xCPARTG_OR_BITS | SYSC_xCPARTG_AND_BITS)) {
144 gor1 = (old & SYSC_xCPARTG_OR_BITS) >> SYSC_xCPARTG_OR_S;
145 gor2 = (new & SYSC_xCPARTG_OR_BITS) >> SYSC_xCPARTG_OR_S;
146 gand1 = (old & SYSC_xCPARTG_AND_BITS) >> SYSC_xCPARTG_AND_S;
147 gand2 = (new & SYSC_xCPARTG_AND_BITS) >> SYSC_xCPARTG_AND_S;
148 pr_cont(" G:%#x+%#x->%#x+%#x",
149 (gor1 * sz) >> 4,
150 ((gand1 + 1) * sz) >> 4,
151 (gor2 * sz) >> 4,
152 ((gand2 + 1) * sz) >> 4);
153 }
154 if (diff & SYSC_CWRMODE_BIT)
155 pr_cont(" %sWR",
156 (new & SYSC_CWRMODE_BIT) ? "+" : "-");
157 if (diff & SYSC_DCPART_GCON_BIT)
158 pr_cont(" %sGCOn",
159 (new & SYSC_DCPART_GCON_BIT) ? "+" : "-");
160 pr_cont("\n");
161}
162
163/**
164 * setup_smp_cache: ensure cache coherency for new SMP thread.
165 * @thread: New hardware thread number.
166 *
167 * Ensures that coherency is enabled and that the threads share the same cache
168 * partitions.
169 */
170static __cpuinit void setup_smp_cache(unsigned int thread)
171{
172 unsigned int this_thread, lflags;
173 unsigned int dcsz, dcpart_this, dcpart_old, dcpart_new;
174 unsigned int icsz, icpart_old, icpart_new;
175
176 /*
177 * Copy over the current thread's cache partition configuration to the
178 * new thread so that they share cache partitions.
179 */
180 __global_lock2(lflags);
181 this_thread = hard_processor_id();
182 /* Share dcache partition */
183 dcpart_this = metag_in32(SYSC_DCPART(this_thread));
184 dcpart_old = metag_in32(SYSC_DCPART(thread));
185 dcpart_new = dcpart_this;
186#if PAGE_OFFSET < LINGLOBAL_BASE
187 /*
188 * For the local data cache to be coherent the threads must also have
189 * GCOn enabled.
190 */
191 dcpart_new |= SYSC_DCPART_GCON_BIT;
192 metag_out32(dcpart_new, SYSC_DCPART(this_thread));
193#endif
194 metag_out32(dcpart_new, SYSC_DCPART(thread));
195 /* Share icache partition too */
196 icpart_new = metag_in32(SYSC_ICPART(this_thread));
197 icpart_old = metag_in32(SYSC_ICPART(thread));
198 metag_out32(icpart_new, SYSC_ICPART(thread));
199 __global_unlock2(lflags);
200
201 /*
202 * Log if the cache partitions were altered so the user is aware of any
203 * potential unintentional cache wastage.
204 */
205 dcsz = get_dcache_size();
206 icsz = get_dcache_size();
207 describe_cachepart_change(this_thread, "dcache", dcsz,
208 dcpart_this, dcpart_new);
209 describe_cachepart_change(thread, "dcache", dcsz,
210 dcpart_old, dcpart_new);
211 describe_cachepart_change(thread, "icache", icsz,
212 icpart_old, icpart_new);
213}
214
102int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 215int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
103{ 216{
104 unsigned int thread = cpu_2_hwthread_id[cpu]; 217 unsigned int thread = cpu_2_hwthread_id[cpu];
@@ -108,6 +221,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
108 221
109 flush_tlb_all(); 222 flush_tlb_all();
110 223
224 setup_smp_cache(thread);
225
111 /* 226 /*
112 * Tell the secondary CPU where to find its idle thread's stack. 227 * Tell the secondary CPU where to find its idle thread's stack.
113 */ 228 */
@@ -297,7 +412,7 @@ asmlinkage void secondary_start_kernel(void)
297 /* 412 /*
298 * OK, it's off to the idle thread for us 413 * OK, it's off to the idle thread for us
299 */ 414 */
300 cpu_idle(); 415 cpu_startup_entry(CPUHP_ONLINE);
301} 416}
302 417
303void __init smp_cpus_done(unsigned int max_cpus) 418void __init smp_cpus_done(unsigned int max_cpus)
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 8961f247b500..2ceeaae5b199 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -987,9 +987,3 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
987 987
988 show_trace(tsk, sp, NULL); 988 show_trace(tsk, sp, NULL);
989} 989}
990
991void dump_stack(void)
992{
993 show_stack(NULL, NULL);
994}
995EXPORT_SYMBOL(dump_stack);
diff --git a/arch/metag/mm/Kconfig b/arch/metag/mm/Kconfig
index 975f2f4e3ecf..03fb8f1555a1 100644
--- a/arch/metag/mm/Kconfig
+++ b/arch/metag/mm/Kconfig
@@ -93,14 +93,6 @@ config ARCH_SPARSEMEM_ENABLE
93config ARCH_SPARSEMEM_DEFAULT 93config ARCH_SPARSEMEM_DEFAULT
94 def_bool y 94 def_bool y
95 95
96config MAX_ACTIVE_REGIONS
97 int
98 default "2" if SPARSEMEM
99 default "1"
100
101config ARCH_POPULATES_NODE_MAP
102 def_bool y
103
104config ARCH_SELECT_MEMORY_MODEL 96config ARCH_SELECT_MEMORY_MODEL
105 def_bool y 97 def_bool y
106 98
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 504a398d5f8b..d05b8455c44c 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -380,14 +380,8 @@ void __init mem_init(void)
380 380
381#ifdef CONFIG_HIGHMEM 381#ifdef CONFIG_HIGHMEM
382 unsigned long tmp; 382 unsigned long tmp;
383 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { 383 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++)
384 struct page *page = pfn_to_page(tmp); 384 free_highmem_page(pfn_to_page(tmp));
385 ClearPageReserved(page);
386 init_page_count(page);
387 __free_page(page);
388 totalhigh_pages++;
389 }
390 totalram_pages += totalhigh_pages;
391 num_physpages += totalhigh_pages; 385 num_physpages += totalhigh_pages;
392#endif /* CONFIG_HIGHMEM */ 386#endif /* CONFIG_HIGHMEM */
393 387
@@ -412,32 +406,15 @@ void __init mem_init(void)
412 return; 406 return;
413} 407}
414 408
415static void free_init_pages(char *what, unsigned long begin, unsigned long end)
416{
417 unsigned long addr;
418
419 for (addr = begin; addr < end; addr += PAGE_SIZE) {
420 ClearPageReserved(virt_to_page(addr));
421 init_page_count(virt_to_page(addr));
422 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
423 free_page(addr);
424 totalram_pages++;
425 }
426 pr_info("Freeing %s: %luk freed\n", what, (end - begin) >> 10);
427}
428
429void free_initmem(void) 409void free_initmem(void)
430{ 410{
431 free_init_pages("unused kernel memory", 411 free_initmem_default(POISON_FREE_INITMEM);
432 (unsigned long)(&__init_begin),
433 (unsigned long)(&__init_end));
434} 412}
435 413
436#ifdef CONFIG_BLK_DEV_INITRD 414#ifdef CONFIG_BLK_DEV_INITRD
437void free_initrd_mem(unsigned long start, unsigned long end) 415void free_initrd_mem(unsigned long start, unsigned long end)
438{ 416{
439 end = end & PAGE_MASK; 417 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
440 free_init_pages("initrd memory", start, end);
441} 418}
442#endif 419#endif
443 420
diff --git a/arch/metag/oprofile/Makefile b/arch/metag/oprofile/Makefile
new file mode 100644
index 000000000000..c9639d4734d6
--- /dev/null
+++ b/arch/metag/oprofile/Makefile
@@ -0,0 +1,17 @@
1obj-$(CONFIG_OPROFILE) += oprofile.o
2
3oprofile-core-y += buffer_sync.o
4oprofile-core-y += cpu_buffer.o
5oprofile-core-y += event_buffer.o
6oprofile-core-y += oprof.o
7oprofile-core-y += oprofile_files.o
8oprofile-core-y += oprofile_stats.o
9oprofile-core-y += oprofilefs.o
10oprofile-core-y += timer_int.o
11oprofile-core-$(CONFIG_HW_PERF_EVENTS) += oprofile_perf.o
12
13oprofile-y += backtrace.o
14oprofile-y += common.o
15oprofile-y += $(addprefix ../../../drivers/oprofile/,$(oprofile-core-y))
16
17ccflags-y += -Werror
diff --git a/arch/metag/oprofile/backtrace.c b/arch/metag/oprofile/backtrace.c
new file mode 100644
index 000000000000..7cc3f37cb40e
--- /dev/null
+++ b/arch/metag/oprofile/backtrace.c
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2010-2013 Imagination Technologies Ltd.
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
9#include <linux/oprofile.h>
10#include <linux/uaccess.h>
11#include <asm/processor.h>
12#include <asm/stacktrace.h>
13
14#include "backtrace.h"
15
16static void user_backtrace_fp(unsigned long __user *fp, unsigned int depth)
17{
18 while (depth-- && access_ok(VERIFY_READ, fp, 8)) {
19 unsigned long addr;
20 unsigned long __user *fpnew;
21 if (__copy_from_user_inatomic(&addr, fp + 1, sizeof(addr)))
22 break;
23 addr -= 4;
24
25 oprofile_add_trace(addr);
26
27 /* stack grows up, so frame pointers must decrease */
28 if (__copy_from_user_inatomic(&fpnew, fp + 0, sizeof(fpnew)))
29 break;
30 if (fpnew >= fp)
31 break;
32 fp = fpnew;
33 }
34}
35
36static int kernel_backtrace_frame(struct stackframe *frame, void *data)
37{
38 unsigned int *depth = data;
39
40 oprofile_add_trace(frame->pc);
41
42 /* decrement depth and stop if we reach 0 */
43 if ((*depth)-- == 0)
44 return 1;
45
46 /* otherwise onto the next frame */
47 return 0;
48}
49
50void metag_backtrace(struct pt_regs * const regs, unsigned int depth)
51{
52 if (user_mode(regs)) {
53 unsigned long *fp = (unsigned long *)regs->ctx.AX[1].U0;
54 user_backtrace_fp((unsigned long __user __force *)fp, depth);
55 } else {
56 struct stackframe frame;
57 frame.fp = regs->ctx.AX[1].U0; /* A0FrP */
58 frame.sp = user_stack_pointer(regs); /* A0StP */
59 frame.lr = 0; /* from stack */
60 frame.pc = regs->ctx.CurrPC; /* PC */
61 walk_stackframe(&frame, &kernel_backtrace_frame, &depth);
62 }
63}
diff --git a/arch/metag/oprofile/backtrace.h b/arch/metag/oprofile/backtrace.h
new file mode 100644
index 000000000000..c0fcc4265abb
--- /dev/null
+++ b/arch/metag/oprofile/backtrace.h
@@ -0,0 +1,6 @@
1#ifndef _METAG_OPROFILE_BACKTRACE_H
2#define _METAG_OPROFILE_BACKTRACE_H
3
4void metag_backtrace(struct pt_regs * const regs, unsigned int depth);
5
6#endif
diff --git a/arch/metag/oprofile/common.c b/arch/metag/oprofile/common.c
new file mode 100644
index 000000000000..ba26152b3c00
--- /dev/null
+++ b/arch/metag/oprofile/common.c
@@ -0,0 +1,66 @@
1/*
2 * arch/metag/oprofile/common.c
3 *
4 * Copyright (C) 2013 Imagination Technologies Ltd.
5 *
6 * Based on arch/sh/oprofile/common.c:
7 *
8 * Copyright (C) 2003 - 2010 Paul Mundt
9 *
10 * Based on arch/mips/oprofile/common.c:
11 *
12 * Copyright (C) 2004, 2005 Ralf Baechle
13 * Copyright (C) 2005 MIPS Technologies, Inc.
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/errno.h>
20#include <linux/init.h>
21#include <linux/oprofile.h>
22#include <linux/perf_event.h>
23#include <linux/slab.h>
24
25#include "backtrace.h"
26
27#ifdef CONFIG_HW_PERF_EVENTS
28/*
29 * This will need to be reworked when multiple PMUs are supported.
30 */
31static char *metag_pmu_op_name;
32
33char *op_name_from_perf_id(void)
34{
35 return metag_pmu_op_name;
36}
37
38int __init oprofile_arch_init(struct oprofile_operations *ops)
39{
40 ops->backtrace = metag_backtrace;
41
42 if (perf_num_counters() == 0)
43 return -ENODEV;
44
45 metag_pmu_op_name = kasprintf(GFP_KERNEL, "metag/%s",
46 perf_pmu_name());
47 if (unlikely(!metag_pmu_op_name))
48 return -ENOMEM;
49
50 return oprofile_perf_init(ops);
51}
52
53void oprofile_arch_exit(void)
54{
55 oprofile_perf_exit();
56 kfree(metag_pmu_op_name);
57}
58#else
59int __init oprofile_arch_init(struct oprofile_operations *ops)
60{
61 ops->backtrace = metag_backtrace;
62 /* fall back to timer interrupt PC sampling */
63 return -ENODEV;
64}
65void oprofile_arch_exit(void) {}
66#endif /* CONFIG_HW_PERF_EVENTS */
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 1323fa2530eb..54237af0b07c 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -26,6 +26,7 @@ config MICROBLAZE
26 select GENERIC_CPU_DEVICES 26 select GENERIC_CPU_DEVICES
27 select GENERIC_ATOMIC64 27 select GENERIC_ATOMIC64
28 select GENERIC_CLOCKEVENTS 28 select GENERIC_CLOCKEVENTS
29 select GENERIC_IDLE_POLL_SETUP
29 select MODULES_USE_ELF_RELA 30 select MODULES_USE_ELF_RELA
30 select CLONE_BACKWARDS 31 select CLONE_BACKWARDS
31 32
@@ -38,9 +39,6 @@ config RWSEM_GENERIC_SPINLOCK
38config ZONE_DMA 39config ZONE_DMA
39 def_bool y 40 def_bool y
40 41
41config ARCH_POPULATES_NODE_MAP
42 def_bool y
43
44config RWSEM_XCHGADD_ALGORITHM 42config RWSEM_XCHGADD_ALGORITHM
45 bool 43 bool
46 44
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h
index 0759153e8117..d6e0ffea28b6 100644
--- a/arch/microblaze/include/asm/processor.h
+++ b/arch/microblaze/include/asm/processor.h
@@ -22,7 +22,6 @@
22extern const struct seq_operations cpuinfo_op; 22extern const struct seq_operations cpuinfo_op;
23 23
24# define cpu_relax() barrier() 24# define cpu_relax() barrier()
25# define cpu_sleep() do {} while (0)
26 25
27#define task_pt_regs(tsk) \ 26#define task_pt_regs(tsk) \
28 (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1) 27 (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
@@ -160,10 +159,6 @@ unsigned long get_wchan(struct task_struct *p);
160# define STACK_TOP TASK_SIZE 159# define STACK_TOP TASK_SIZE
161# define STACK_TOP_MAX STACK_TOP 160# define STACK_TOP_MAX STACK_TOP
162 161
163void disable_hlt(void);
164void enable_hlt(void);
165void default_idle(void);
166
167#ifdef CONFIG_DEBUG_FS 162#ifdef CONFIG_DEBUG_FS
168extern struct dentry *of_debugfs_root; 163extern struct dentry *of_debugfs_root;
169#endif 164#endif
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index 0e0b0a5ec756..f05df5630c84 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -46,7 +46,6 @@ void machine_shutdown(void);
46void machine_halt(void); 46void machine_halt(void);
47void machine_power_off(void); 47void machine_power_off(void);
48 48
49void free_init_pages(char *what, unsigned long begin, unsigned long end);
50extern void *alloc_maybe_bootmem(size_t size, gfp_t mask); 49extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
51extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 50extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
52 51
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h
index 008f30433d22..de26ea6373de 100644
--- a/arch/microblaze/include/asm/thread_info.h
+++ b/arch/microblaze/include/asm/thread_info.h
@@ -182,7 +182,6 @@ static inline bool test_and_clear_restore_sigmask(void)
182 ti->status &= ~TS_RESTORE_SIGMASK; 182 ti->status &= ~TS_RESTORE_SIGMASK;
183 return true; 183 return true;
184} 184}
185#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
186#endif 185#endif
187 186
188#endif /* __KERNEL__ */ 187#endif /* __KERNEL__ */
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index b3778391d9cc..6dece2d002dc 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -37,13 +37,5 @@
37#define __ARCH_WANT_SYS_VFORK 37#define __ARCH_WANT_SYS_VFORK
38#define __ARCH_WANT_SYS_FORK 38#define __ARCH_WANT_SYS_FORK
39 39
40/*
41 * "Conditional" syscalls
42 *
43 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
44 * but it doesn't work on all toolchains, so we just do it by hand
45 */
46#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
47
48#endif /* __ASSEMBLY__ */ 40#endif /* __ASSEMBLY__ */
49#endif /* _ASM_MICROBLAZE_UNISTD_H */ 41#endif /* _ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
index 60dcacc68038..365f2d53f1b2 100644
--- a/arch/microblaze/kernel/early_printk.c
+++ b/arch/microblaze/kernel/early_printk.c
@@ -21,7 +21,6 @@
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/prom.h> 22#include <asm/prom.h>
23 23
24static u32 early_console_initialized;
25static u32 base_addr; 24static u32 base_addr;
26 25
27#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE 26#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
@@ -109,27 +108,11 @@ static struct console early_serial_uart16550_console = {
109}; 108};
110#endif /* CONFIG_SERIAL_8250_CONSOLE */ 109#endif /* CONFIG_SERIAL_8250_CONSOLE */
111 110
112static struct console *early_console;
113
114void early_printk(const char *fmt, ...)
115{
116 char buf[512];
117 int n;
118 va_list ap;
119
120 if (early_console_initialized) {
121 va_start(ap, fmt);
122 n = vscnprintf(buf, 512, fmt, ap);
123 early_console->write(early_console, buf, n);
124 va_end(ap);
125 }
126}
127
128int __init setup_early_printk(char *opt) 111int __init setup_early_printk(char *opt)
129{ 112{
130 int version = 0; 113 int version = 0;
131 114
132 if (early_console_initialized) 115 if (early_console)
133 return 1; 116 return 1;
134 117
135 base_addr = of_early_console(&version); 118 base_addr = of_early_console(&version);
@@ -159,7 +142,6 @@ int __init setup_early_printk(char *opt)
159 } 142 }
160 143
161 register_console(early_console); 144 register_console(early_console);
162 early_console_initialized = 1;
163 return 0; 145 return 0;
164 } 146 }
165 return 1; 147 return 1;
@@ -169,7 +151,7 @@ int __init setup_early_printk(char *opt)
169 * only for early console because of performance degression */ 151 * only for early console because of performance degression */
170void __init remap_early_printk(void) 152void __init remap_early_printk(void)
171{ 153{
172 if (!early_console_initialized || !early_console) 154 if (!early_console)
173 return; 155 return;
174 pr_info("early_printk_console remapping from 0x%x to ", base_addr); 156 pr_info("early_printk_console remapping from 0x%x to ", base_addr);
175 base_addr = (u32) ioremap(base_addr, PAGE_SIZE); 157 base_addr = (u32) ioremap(base_addr, PAGE_SIZE);
@@ -194,9 +176,9 @@ void __init remap_early_printk(void)
194 176
195void __init disable_early_printk(void) 177void __init disable_early_printk(void)
196{ 178{
197 if (!early_console_initialized || !early_console) 179 if (!early_console)
198 return; 180 return;
199 pr_warn("disabling early console\n"); 181 pr_warn("disabling early console\n");
200 unregister_console(early_console); 182 unregister_console(early_console);
201 early_console_initialized = 0; 183 early_console = NULL;
202} 184}
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index fa0ea609137c..a55893807274 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -20,6 +20,8 @@
20 20
21void show_regs(struct pt_regs *regs) 21void show_regs(struct pt_regs *regs)
22{ 22{
23 show_regs_print_info(KERN_INFO);
24
23 pr_info(" Registers dump: mode=%X\r\n", regs->pt_mode); 25 pr_info(" Registers dump: mode=%X\r\n", regs->pt_mode);
24 pr_info(" r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n", 26 pr_info(" r1=%08lX, r2=%08lX, r3=%08lX, r4=%08lX\n",
25 regs->r1, regs->r2, regs->r3, regs->r4); 27 regs->r1, regs->r2, regs->r3, regs->r4);
@@ -44,71 +46,6 @@ void show_regs(struct pt_regs *regs)
44void (*pm_power_off)(void) = NULL; 46void (*pm_power_off)(void) = NULL;
45EXPORT_SYMBOL(pm_power_off); 47EXPORT_SYMBOL(pm_power_off);
46 48
47static int hlt_counter = 1;
48
49void disable_hlt(void)
50{
51 hlt_counter++;
52}
53EXPORT_SYMBOL(disable_hlt);
54
55void enable_hlt(void)
56{
57 hlt_counter--;
58}
59EXPORT_SYMBOL(enable_hlt);
60
61static int __init nohlt_setup(char *__unused)
62{
63 hlt_counter = 1;
64 return 1;
65}
66__setup("nohlt", nohlt_setup);
67
68static int __init hlt_setup(char *__unused)
69{
70 hlt_counter = 0;
71 return 1;
72}
73__setup("hlt", hlt_setup);
74
75void default_idle(void)
76{
77 if (likely(hlt_counter)) {
78 local_irq_disable();
79 stop_critical_timings();
80 cpu_relax();
81 start_critical_timings();
82 local_irq_enable();
83 } else {
84 clear_thread_flag(TIF_POLLING_NRFLAG);
85 smp_mb__after_clear_bit();
86 local_irq_disable();
87 while (!need_resched())
88 cpu_sleep();
89 local_irq_enable();
90 set_thread_flag(TIF_POLLING_NRFLAG);
91 }
92}
93
94void cpu_idle(void)
95{
96 set_thread_flag(TIF_POLLING_NRFLAG);
97
98 /* endless idle loop with no priority at all */
99 while (1) {
100 tick_nohz_idle_enter();
101 rcu_idle_enter();
102 while (!need_resched())
103 default_idle();
104 rcu_idle_exit();
105 tick_nohz_idle_exit();
106
107 schedule_preempt_disabled();
108 check_pgt_cache();
109 }
110}
111
112void flush_thread(void) 49void flush_thread(void)
113{ 50{
114} 51}
diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
index 30e6b5004a6a..cb619533a192 100644
--- a/arch/microblaze/kernel/traps.c
+++ b/arch/microblaze/kernel/traps.c
@@ -75,9 +75,3 @@ void show_stack(struct task_struct *task, unsigned long *sp)
75 75
76 debug_show_held_locks(task); 76 debug_show_held_locks(task);
77} 77}
78
79void dump_stack(void)
80{
81 show_stack(NULL, NULL);
82}
83EXPORT_SYMBOL(dump_stack);
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 8f8b367c079e..4ec137d13ad7 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -82,13 +82,9 @@ static unsigned long highmem_setup(void)
82 /* FIXME not sure about */ 82 /* FIXME not sure about */
83 if (memblock_is_reserved(pfn << PAGE_SHIFT)) 83 if (memblock_is_reserved(pfn << PAGE_SHIFT))
84 continue; 84 continue;
85 ClearPageReserved(page); 85 free_highmem_page(page);
86 init_page_count(page);
87 __free_page(page);
88 totalhigh_pages++;
89 reservedpages++; 86 reservedpages++;
90 } 87 }
91 totalram_pages += totalhigh_pages;
92 pr_info("High memory: %luk\n", 88 pr_info("High memory: %luk\n",
93 totalhigh_pages << (PAGE_SHIFT-10)); 89 totalhigh_pages << (PAGE_SHIFT-10));
94 90
@@ -236,40 +232,16 @@ void __init setup_memory(void)
236 paging_init(); 232 paging_init();
237} 233}
238 234
239void free_init_pages(char *what, unsigned long begin, unsigned long end)
240{
241 unsigned long addr;
242
243 for (addr = begin; addr < end; addr += PAGE_SIZE) {
244 ClearPageReserved(virt_to_page(addr));
245 init_page_count(virt_to_page(addr));
246 free_page(addr);
247 totalram_pages++;
248 }
249 pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
250}
251
252#ifdef CONFIG_BLK_DEV_INITRD 235#ifdef CONFIG_BLK_DEV_INITRD
253void free_initrd_mem(unsigned long start, unsigned long end) 236void free_initrd_mem(unsigned long start, unsigned long end)
254{ 237{
255 int pages = 0; 238 free_reserved_area(start, end, 0, "initrd");
256 for (; start < end; start += PAGE_SIZE) {
257 ClearPageReserved(virt_to_page(start));
258 init_page_count(virt_to_page(start));
259 free_page(start);
260 totalram_pages++;
261 pages++;
262 }
263 pr_notice("Freeing initrd memory: %dk freed\n",
264 (int)(pages * (PAGE_SIZE / 1024)));
265} 239}
266#endif 240#endif
267 241
268void free_initmem(void) 242void free_initmem(void)
269{ 243{
270 free_init_pages("unused kernel memory", 244 free_initmem_default(0);
271 (unsigned long)(&__init_begin),
272 (unsigned long)(&__init_end));
273} 245}
274 246
275void __init mem_init(void) 247void __init mem_init(void)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 51244bf97271..e5f3794744f1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -404,6 +404,8 @@ config PMC_MSP
404 select IRQ_CPU 404 select IRQ_CPU
405 select SERIAL_8250 405 select SERIAL_8250
406 select SERIAL_8250_CONSOLE 406 select SERIAL_8250_CONSOLE
407 select USB_EHCI_BIG_ENDIAN_MMIO
408 select USB_EHCI_BIG_ENDIAN_DESC
407 help 409 help
408 This adds support for the PMC-Sierra family of Multi-Service 410 This adds support for the PMC-Sierra family of Multi-Service
409 Processor System-On-A-Chips. These parts include a number 411 Processor System-On-A-Chips. These parts include a number
@@ -1433,6 +1435,7 @@ config CPU_CAVIUM_OCTEON
1433 select CPU_SUPPORTS_HUGEPAGES 1435 select CPU_SUPPORTS_HUGEPAGES
1434 select LIBFDT 1436 select LIBFDT
1435 select USE_OF 1437 select USE_OF
1438 select USB_EHCI_BIG_ENDIAN_MMIO
1436 help 1439 help
1437 The Cavium Octeon processor is a highly integrated chip containing 1440 The Cavium Octeon processor is a highly integrated chip containing
1438 many ethernet hardware widgets for networking tasks. The processor 1441 many ethernet hardware widgets for networking tasks. The processor
@@ -1736,7 +1739,6 @@ config 32BIT
1736config 64BIT 1739config 64BIT
1737 bool "64-bit kernel" 1740 bool "64-bit kernel"
1738 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL 1741 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
1739 select HAVE_SYSCALL_WRAPPERS
1740 help 1742 help
1741 Select this option if you want to build a 64-bit kernel. 1743 Select this option if you want to build a 64-bit kernel.
1742 1744
@@ -2538,7 +2540,14 @@ source "kernel/power/Kconfig"
2538 2540
2539endmenu 2541endmenu
2540 2542
2541source "arch/mips/kernel/cpufreq/Kconfig" 2543config MIPS_EXTERNAL_TIMER
2544 bool
2545
2546if CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
2547menu "CPU Power Management"
2548source "drivers/cpufreq/Kconfig"
2549endmenu
2550endif
2542 2551
2543source "net/Kconfig" 2552source "net/Kconfig"
2544 2553
diff --git a/arch/mips/bcm63xx/dev-spi.c b/arch/mips/bcm63xx/dev-spi.c
index f1c9c3e2f678..e97fd60e92ef 100644
--- a/arch/mips/bcm63xx/dev-spi.c
+++ b/arch/mips/bcm63xx/dev-spi.c
@@ -85,20 +85,9 @@ static struct platform_device bcm63xx_spi_device = {
85 85
86int __init bcm63xx_spi_register(void) 86int __init bcm63xx_spi_register(void)
87{ 87{
88 struct clk *periph_clk;
89
90 if (BCMCPU_IS_6328() || BCMCPU_IS_6345()) 88 if (BCMCPU_IS_6328() || BCMCPU_IS_6345())
91 return -ENODEV; 89 return -ENODEV;
92 90
93 periph_clk = clk_get(NULL, "periph");
94 if (IS_ERR(periph_clk)) {
95 pr_err("unable to get periph clock\n");
96 return -ENODEV;
97 }
98
99 /* Set bus frequency */
100 spi_pdata.speed_hz = clk_get_rate(periph_clk);
101
102 spi_resources[0].start = bcm63xx_regset_address(RSET_SPI); 91 spi_resources[0].start = bcm63xx_regset_address(RSET_SPI);
103 spi_resources[0].end = spi_resources[0].start; 92 spi_resources[0].end = spi_resources[0].start;
104 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI); 93 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
diff --git a/arch/mips/include/asm/hugetlb.h b/arch/mips/include/asm/hugetlb.h
index ef99db994c2f..fe0d15d32660 100644
--- a/arch/mips/include/asm/hugetlb.h
+++ b/arch/mips/include/asm/hugetlb.h
@@ -10,6 +10,7 @@
10#define __ASM_HUGETLB_H 10#define __ASM_HUGETLB_H
11 11
12#include <asm/page.h> 12#include <asm/page.h>
13#include <asm-generic/hugetlb.h>
13 14
14 15
15static inline int is_hugepage_only_range(struct mm_struct *mm, 16static inline int is_hugepage_only_range(struct mm_struct *mm,
diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
index e9a940d1b0c6..2767dda9e309 100644
--- a/arch/mips/include/asm/linkage.h
+++ b/arch/mips/include/asm/linkage.h
@@ -6,5 +6,8 @@
6#endif 6#endif
7 7
8#define __weak __attribute__((weak)) 8#define __weak __attribute__((weak))
9#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
10#define SYSCALL_ALIAS(alias, name) \
11 asm ( #alias " = " #name "\n\t.globl " #alias)
9 12
10#endif 13#endif
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
index c9bae1362606..b0184cf02575 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
@@ -13,7 +13,6 @@ struct bcm63xx_spi_pdata {
13 unsigned int msg_ctl_width; 13 unsigned int msg_ctl_width;
14 int bus_num; 14 int bus_num;
15 int num_chipselect; 15 int num_chipselect;
16 u32 speed_hz;
17}; 16};
18 17
19enum bcm63xx_regs_spi { 18enum bcm63xx_regs_spi {
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 99fc547af9d3..eab99e536b5c 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -31,7 +31,7 @@
31#define PAGE_SHIFT 16 31#define PAGE_SHIFT 16
32#endif 32#endif
33#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 33#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
34#define PAGE_MASK (~(PAGE_SIZE - 1)) 34#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
35 35
36#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 36#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
37#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) 37#define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3)
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 64f661e32879..63c9c886173a 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -63,12 +63,4 @@
63 63
64#endif /* !__ASSEMBLY__ */ 64#endif /* !__ASSEMBLY__ */
65 65
66/*
67 * "Conditional" syscalls
68 *
69 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
70 * but it doesn't work on all toolchains, so we just do it by hand
71 */
72#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
73
74#endif /* _ASM_UNISTD_H */ 66#endif /* _ASM_UNISTD_H */
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index de75fb50562b..520a908d45d6 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -92,8 +92,6 @@ CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/n
92 92
93obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 93obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
94 94
95obj-$(CONFIG_MIPS_CPUFREQ) += cpufreq/
96
97obj-$(CONFIG_PERF_EVENTS) += perf_event.o 95obj-$(CONFIG_PERF_EVENTS) += perf_event.o
98obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_mipsxx.o 96obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_mipsxx.o
99 97
diff --git a/arch/mips/kernel/cpufreq/Kconfig b/arch/mips/kernel/cpufreq/Kconfig
deleted file mode 100644
index 58c601eee6fd..000000000000
--- a/arch/mips/kernel/cpufreq/Kconfig
+++ /dev/null
@@ -1,41 +0,0 @@
1#
2# CPU Frequency scaling
3#
4
5config MIPS_EXTERNAL_TIMER
6 bool
7
8config MIPS_CPUFREQ
9 bool
10 default y
11 depends on CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER
12
13if MIPS_CPUFREQ
14
15menu "CPU Frequency scaling"
16
17source "drivers/cpufreq/Kconfig"
18
19if CPU_FREQ
20
21comment "CPUFreq processor drivers"
22
23config LOONGSON2_CPUFREQ
24 tristate "Loongson2 CPUFreq Driver"
25 select CPU_FREQ_TABLE
26 depends on MIPS_CPUFREQ
27 help
28 This option adds a CPUFreq driver for loongson processors which
29 support software configurable cpu frequency.
30
31 Loongson2F and it's successors support this feature.
32
33 For details, take a look at <file:Documentation/cpu-freq/>.
34
35 If in doubt, say N.
36
37endif # CPU_FREQ
38
39endmenu
40
41endif # MIPS_CPUFREQ
diff --git a/arch/mips/kernel/cpufreq/Makefile b/arch/mips/kernel/cpufreq/Makefile
deleted file mode 100644
index 05a5715ee38c..000000000000
--- a/arch/mips/kernel/cpufreq/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the Linux/MIPS cpufreq.
3#
4
5obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o
diff --git a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c b/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
deleted file mode 100644
index 3237c5235f9c..000000000000
--- a/arch/mips/kernel/cpufreq/loongson2_cpufreq.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * Cpufreq driver for the loongson-2 processors
3 *
4 * The 2E revision of loongson processor not support this feature.
5 *
6 * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology
7 * Author: Yanhua, yanh@lemote.com
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/cpufreq.h>
14#include <linux/module.h>
15#include <linux/err.h>
16#include <linux/sched.h> /* set_cpus_allowed() */
17#include <linux/delay.h>
18#include <linux/platform_device.h>
19
20#include <asm/clock.h>
21
22#include <asm/mach-loongson/loongson.h>
23
24static uint nowait;
25
26static struct clk *cpuclk;
27
28static void (*saved_cpu_wait) (void);
29
30static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
31 unsigned long val, void *data);
32
33static struct notifier_block loongson2_cpufreq_notifier_block = {
34 .notifier_call = loongson2_cpu_freq_notifier
35};
36
37static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
38 unsigned long val, void *data)
39{
40 if (val == CPUFREQ_POSTCHANGE)
41 current_cpu_data.udelay_val = loops_per_jiffy;
42
43 return 0;
44}
45
46static unsigned int loongson2_cpufreq_get(unsigned int cpu)
47{
48 return clk_get_rate(cpuclk);
49}
50
51/*
52 * Here we notify other drivers of the proposed change and the final change.
53 */
54static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
55 unsigned int target_freq,
56 unsigned int relation)
57{
58 unsigned int cpu = policy->cpu;
59 unsigned int newstate = 0;
60 cpumask_t cpus_allowed;
61 struct cpufreq_freqs freqs;
62 unsigned int freq;
63
64 if (!cpu_online(cpu))
65 return -ENODEV;
66
67 cpus_allowed = current->cpus_allowed;
68 set_cpus_allowed_ptr(current, cpumask_of(cpu));
69
70 if (cpufreq_frequency_table_target
71 (policy, &loongson2_clockmod_table[0], target_freq, relation,
72 &newstate))
73 return -EINVAL;
74
75 freq =
76 ((cpu_clock_freq / 1000) *
77 loongson2_clockmod_table[newstate].index) / 8;
78 if (freq < policy->min || freq > policy->max)
79 return -EINVAL;
80
81 pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000);
82
83 freqs.cpu = cpu;
84 freqs.old = loongson2_cpufreq_get(cpu);
85 freqs.new = freq;
86 freqs.flags = 0;
87
88 if (freqs.new == freqs.old)
89 return 0;
90
91 /* notifiers */
92 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
93
94 set_cpus_allowed_ptr(current, &cpus_allowed);
95
96 /* setting the cpu frequency */
97 clk_set_rate(cpuclk, freq);
98
99 /* notifiers */
100 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
101
102 pr_debug("cpufreq: set frequency %u kHz\n", freq);
103
104 return 0;
105}
106
107static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
108{
109 int i;
110 unsigned long rate;
111 int ret;
112
113 if (!cpu_online(policy->cpu))
114 return -ENODEV;
115
116 cpuclk = clk_get(NULL, "cpu_clk");
117 if (IS_ERR(cpuclk)) {
118 printk(KERN_ERR "cpufreq: couldn't get CPU clk\n");
119 return PTR_ERR(cpuclk);
120 }
121
122 rate = cpu_clock_freq / 1000;
123 if (!rate) {
124 clk_put(cpuclk);
125 return -EINVAL;
126 }
127 ret = clk_set_rate(cpuclk, rate);
128 if (ret) {
129 clk_put(cpuclk);
130 return ret;
131 }
132
133 /* clock table init */
134 for (i = 2;
135 (loongson2_clockmod_table[i].frequency != CPUFREQ_TABLE_END);
136 i++)
137 loongson2_clockmod_table[i].frequency = (rate * i) / 8;
138
139 policy->cur = loongson2_cpufreq_get(policy->cpu);
140
141 cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0],
142 policy->cpu);
143
144 return cpufreq_frequency_table_cpuinfo(policy,
145 &loongson2_clockmod_table[0]);
146}
147
148static int loongson2_cpufreq_verify(struct cpufreq_policy *policy)
149{
150 return cpufreq_frequency_table_verify(policy,
151 &loongson2_clockmod_table[0]);
152}
153
154static int loongson2_cpufreq_exit(struct cpufreq_policy *policy)
155{
156 clk_put(cpuclk);
157 return 0;
158}
159
160static struct freq_attr *loongson2_table_attr[] = {
161 &cpufreq_freq_attr_scaling_available_freqs,
162 NULL,
163};
164
165static struct cpufreq_driver loongson2_cpufreq_driver = {
166 .owner = THIS_MODULE,
167 .name = "loongson2",
168 .init = loongson2_cpufreq_cpu_init,
169 .verify = loongson2_cpufreq_verify,
170 .target = loongson2_cpufreq_target,
171 .get = loongson2_cpufreq_get,
172 .exit = loongson2_cpufreq_exit,
173 .attr = loongson2_table_attr,
174};
175
176static struct platform_device_id platform_device_ids[] = {
177 {
178 .name = "loongson2_cpufreq",
179 },
180 {}
181};
182
183MODULE_DEVICE_TABLE(platform, platform_device_ids);
184
185static struct platform_driver platform_driver = {
186 .driver = {
187 .name = "loongson2_cpufreq",
188 .owner = THIS_MODULE,
189 },
190 .id_table = platform_device_ids,
191};
192
193/*
194 * This is the simple version of Loongson-2 wait, Maybe we need do this in
195 * interrupt disabled context.
196 */
197
198static DEFINE_SPINLOCK(loongson2_wait_lock);
199
200static void loongson2_cpu_wait(void)
201{
202 unsigned long flags;
203 u32 cpu_freq;
204
205 spin_lock_irqsave(&loongson2_wait_lock, flags);
206 cpu_freq = LOONGSON_CHIPCFG0;
207 LOONGSON_CHIPCFG0 &= ~0x7; /* Put CPU into wait mode */
208 LOONGSON_CHIPCFG0 = cpu_freq; /* Restore CPU state */
209 spin_unlock_irqrestore(&loongson2_wait_lock, flags);
210}
211
212static int __init cpufreq_init(void)
213{
214 int ret;
215
216 /* Register platform stuff */
217 ret = platform_driver_register(&platform_driver);
218 if (ret)
219 return ret;
220
221 pr_info("cpufreq: Loongson-2F CPU frequency driver.\n");
222
223 cpufreq_register_notifier(&loongson2_cpufreq_notifier_block,
224 CPUFREQ_TRANSITION_NOTIFIER);
225
226 ret = cpufreq_register_driver(&loongson2_cpufreq_driver);
227
228 if (!ret && !nowait) {
229 saved_cpu_wait = cpu_wait;
230 cpu_wait = loongson2_cpu_wait;
231 }
232
233 return ret;
234}
235
236static void __exit cpufreq_exit(void)
237{
238 if (!nowait && saved_cpu_wait)
239 cpu_wait = saved_cpu_wait;
240 cpufreq_unregister_driver(&loongson2_cpufreq_driver);
241 cpufreq_unregister_notifier(&loongson2_cpufreq_notifier_block,
242 CPUFREQ_TRANSITION_NOTIFIER);
243
244 platform_driver_unregister(&platform_driver);
245}
246
247module_init(cpufreq_init);
248module_exit(cpufreq_exit);
249
250module_param(nowait, uint, 0644);
251MODULE_PARM_DESC(nowait, "Disable Loongson-2F specific wait");
252
253MODULE_AUTHOR("Yanhua <yanh@lemote.com>");
254MODULE_DESCRIPTION("cpufreq driver for Loongson2F");
255MODULE_LICENSE("GPL");
diff --git a/arch/mips/kernel/early_printk.c b/arch/mips/kernel/early_printk.c
index 9e6440eaa455..505cb77d1280 100644
--- a/arch/mips/kernel/early_printk.c
+++ b/arch/mips/kernel/early_printk.c
@@ -7,7 +7,9 @@
7 * Copyright (C) 2007 MIPS Technologies, Inc. 7 * Copyright (C) 2007 MIPS Technologies, Inc.
8 * written by Ralf Baechle (ralf@linux-mips.org) 8 * written by Ralf Baechle (ralf@linux-mips.org)
9 */ 9 */
10#include <linux/kernel.h>
10#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/printk.h>
11#include <linux/init.h> 13#include <linux/init.h>
12 14
13#include <asm/setup.h> 15#include <asm/setup.h>
@@ -24,20 +26,18 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
24 } 26 }
25} 27}
26 28
27static struct console early_console = { 29static struct console early_console_prom = {
28 .name = "early", 30 .name = "early",
29 .write = early_console_write, 31 .write = early_console_write,
30 .flags = CON_PRINTBUFFER | CON_BOOT, 32 .flags = CON_PRINTBUFFER | CON_BOOT,
31 .index = -1 33 .index = -1
32}; 34};
33 35
34static int early_console_initialized __initdata;
35
36void __init setup_early_printk(void) 36void __init setup_early_printk(void)
37{ 37{
38 if (early_console_initialized) 38 if (early_console)
39 return; 39 return;
40 early_console_initialized = 1; 40 early_console = &early_console_prom;
41 41
42 register_console(&early_console); 42 register_console(&early_console_prom);
43} 43}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index db9655f08892..d1d576b765f5 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -119,99 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
119 return sys_pwrite64(fd, buf, count, merge_64(a4, a5)); 119 return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
120} 120}
121 121
122#ifdef CONFIG_SYSVIPC
123
124SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
125 unsigned long, ptr, unsigned long, fifth)
126{
127 int version, err;
128
129 version = call >> 16; /* hack for backward compatibility */
130 call &= 0xffff;
131
132 switch (call) {
133 case SEMOP:
134 /* struct sembuf is the same on 32 and 64bit :)) */
135 err = sys_semtimedop(first, compat_ptr(ptr), second, NULL);
136 break;
137 case SEMTIMEDOP:
138 err = compat_sys_semtimedop(first, compat_ptr(ptr), second,
139 compat_ptr(fifth));
140 break;
141 case SEMGET:
142 err = sys_semget(first, second, third);
143 break;
144 case SEMCTL:
145 err = compat_sys_semctl(first, second, third, compat_ptr(ptr));
146 break;
147 case MSGSND:
148 err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
149 break;
150 case MSGRCV:
151 err = compat_sys_msgrcv(first, second, fifth, third,
152 version, compat_ptr(ptr));
153 break;
154 case MSGGET:
155 err = sys_msgget((key_t) first, second);
156 break;
157 case MSGCTL:
158 err = compat_sys_msgctl(first, second, compat_ptr(ptr));
159 break;
160 case SHMAT:
161 err = compat_sys_shmat(first, second, third, version,
162 compat_ptr(ptr));
163 break;
164 case SHMDT:
165 err = sys_shmdt(compat_ptr(ptr));
166 break;
167 case SHMGET:
168 err = sys_shmget(first, (unsigned)second, third);
169 break;
170 case SHMCTL:
171 err = compat_sys_shmctl(first, second, compat_ptr(ptr));
172 break;
173 default:
174 err = -ENOSYS;
175 break;
176 }
177
178 return err;
179}
180
181#else
182
183SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third,
184 u32, ptr, u32, fifth)
185{
186 return -ENOSYS;
187}
188
189#endif /* CONFIG_SYSVIPC */
190
191#ifdef CONFIG_MIPS32_N32
192SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg)
193{
194 /* compat_sys_semctl expects a pointer to union semun */
195 u32 __user *uptr = compat_alloc_user_space(sizeof(u32));
196 if (put_user(arg, uptr))
197 return -EFAULT;
198 return compat_sys_semctl(semid, semnum, cmd, uptr);
199}
200
201SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz,
202 int, msgflg)
203{
204 return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp));
205}
206
207SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
208 int, msgtyp, int, msgflg)
209{
210 return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64,
211 compat_ptr(msgp));
212}
213#endif
214
215SYSCALL_DEFINE1(32_personality, unsigned long, personality) 122SYSCALL_DEFINE1(32_personality, unsigned long, personality)
216{ 123{
217 unsigned int p = personality & 0xffffffff; 124 unsigned int p = personality & 0xffffffff;
@@ -226,26 +133,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)
226 return ret; 133 return ret;
227} 134}
228 135
229SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd,
230 compat_off_t __user *, offset, s32, count)
231{
232 mm_segment_t old_fs = get_fs();
233 int ret;
234 off_t of;
235
236 if (offset && get_user(of, offset))
237 return -EFAULT;
238
239 set_fs(KERNEL_DS);
240 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
241 set_fs(old_fs);
242
243 if (offset && put_user(of, offset))
244 return -EFAULT;
245
246 return ret;
247}
248
249asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3, 136asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
250 size_t count) 137 size_t count)
251{ 138{
@@ -279,12 +166,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
279 merge_64(len_a4, len_a5)); 166 merge_64(len_a4, len_a5));
280} 167}
281 168
282asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
283 size_t len)
284{
285 return sys_lookup_dcookie(merge_64(a0, a1), buf, len);
286}
287
288SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags, 169SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
289 u64, a3, u64, a4, int, dfd, const char __user *, pathname) 170 u64, a3, u64, a4, int, dfd, const char __user *, pathname)
290{ 171{
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 3be4405c2d14..cfc742d75b7f 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -41,44 +41,26 @@
41#include <asm/inst.h> 41#include <asm/inst.h>
42#include <asm/stacktrace.h> 42#include <asm/stacktrace.h>
43 43
44/* 44#ifdef CONFIG_HOTPLUG_CPU
45 * The idle thread. There's no useful work to be done, so just try to conserve 45void arch_cpu_idle_dead(void)
46 * power and have a low exit latency (ie sit in a loop waiting for somebody to
47 * say that they'd like to reschedule)
48 */
49void __noreturn cpu_idle(void)
50{ 46{
51 int cpu; 47 /* What the heck is this check doing ? */
52 48 if (!cpu_isset(smp_processor_id(), cpu_callin_map))
53 /* CPU is going idle. */ 49 play_dead();
54 cpu = smp_processor_id(); 50}
51#endif
55 52
56 /* endless idle loop with no priority at all */ 53void arch_cpu_idle(void)
57 while (1) { 54{
58 tick_nohz_idle_enter();
59 rcu_idle_enter();
60 while (!need_resched() && cpu_online(cpu)) {
61#ifdef CONFIG_MIPS_MT_SMTC 55#ifdef CONFIG_MIPS_MT_SMTC
62 extern void smtc_idle_loop_hook(void); 56 extern void smtc_idle_loop_hook(void);
63 57
64 smtc_idle_loop_hook(); 58 smtc_idle_loop_hook();
65#endif 59#endif
66 60 if (cpu_wait)
67 if (cpu_wait) { 61 (*cpu_wait)();
68 /* Don't trace irqs off for idle */ 62 else
69 stop_critical_timings(); 63 local_irq_enable();
70 (*cpu_wait)();
71 start_critical_timings();
72 }
73 }
74#ifdef CONFIG_HOTPLUG_CPU
75 if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map))
76 play_dead();
77#endif
78 rcu_idle_exit();
79 tick_nohz_idle_exit();
80 schedule_preempt_disabled();
81 }
82} 64}
83 65
84asmlinkage void ret_from_fork(void); 66asmlinkage void ret_from_fork(void);
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 693d60b0855f..edcb6594e7b5 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -143,7 +143,7 @@ EXPORT(sysn32_call_table)
143 PTR compat_sys_setitimer 143 PTR compat_sys_setitimer
144 PTR sys_alarm 144 PTR sys_alarm
145 PTR sys_getpid 145 PTR sys_getpid
146 PTR sys_32_sendfile 146 PTR compat_sys_sendfile
147 PTR sys_socket /* 6040 */ 147 PTR sys_socket /* 6040 */
148 PTR sys_connect 148 PTR sys_connect
149 PTR sys_accept 149 PTR sys_accept
@@ -168,11 +168,11 @@ EXPORT(sysn32_call_table)
168 PTR sys_newuname 168 PTR sys_newuname
169 PTR sys_semget 169 PTR sys_semget
170 PTR sys_semop 170 PTR sys_semop
171 PTR sys_n32_semctl 171 PTR compat_sys_semctl
172 PTR sys_shmdt /* 6065 */ 172 PTR sys_shmdt /* 6065 */
173 PTR sys_msgget 173 PTR sys_msgget
174 PTR sys_n32_msgsnd 174 PTR compat_sys_msgsnd
175 PTR sys_n32_msgrcv 175 PTR compat_sys_msgrcv
176 PTR compat_sys_msgctl 176 PTR compat_sys_msgctl
177 PTR compat_sys_fcntl /* 6070 */ 177 PTR compat_sys_fcntl /* 6070 */
178 PTR sys_flock 178 PTR sys_flock
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index af8887f779f1..103bfe570fe8 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -309,7 +309,7 @@ sys_call_table:
309 PTR compat_sys_wait4 309 PTR compat_sys_wait4
310 PTR sys_swapoff /* 4115 */ 310 PTR sys_swapoff /* 4115 */
311 PTR compat_sys_sysinfo 311 PTR compat_sys_sysinfo
312 PTR sys_32_ipc 312 PTR compat_sys_ipc
313 PTR sys_fsync 313 PTR sys_fsync
314 PTR sys32_sigreturn 314 PTR sys32_sigreturn
315 PTR __sys_clone /* 4120 */ 315 PTR __sys_clone /* 4120 */
@@ -399,7 +399,7 @@ sys_call_table:
399 PTR sys_capget 399 PTR sys_capget
400 PTR sys_capset /* 4205 */ 400 PTR sys_capset /* 4205 */
401 PTR compat_sys_sigaltstack 401 PTR compat_sys_sigaltstack
402 PTR sys_32_sendfile 402 PTR compat_sys_sendfile
403 PTR sys_ni_syscall 403 PTR sys_ni_syscall
404 PTR sys_ni_syscall 404 PTR sys_ni_syscall
405 PTR sys_mips_mmap2 /* 4210 */ 405 PTR sys_mips_mmap2 /* 4210 */
@@ -439,7 +439,7 @@ sys_call_table:
439 PTR compat_sys_io_submit 439 PTR compat_sys_io_submit
440 PTR sys_io_cancel /* 4245 */ 440 PTR sys_io_cancel /* 4245 */
441 PTR sys_exit_group 441 PTR sys_exit_group
442 PTR sys32_lookup_dcookie 442 PTR compat_sys_lookup_dcookie
443 PTR sys_epoll_create 443 PTR sys_epoll_create
444 PTR sys_epoll_ctl 444 PTR sys_epoll_ctl
445 PTR sys_epoll_wait /* 4250 */ 445 PTR sys_epoll_wait /* 4250 */
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 66bf4e22d9b9..aee04af213c5 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -139,7 +139,7 @@ asmlinkage __cpuinit void start_secondary(void)
139 WARN_ON_ONCE(!irqs_disabled()); 139 WARN_ON_ONCE(!irqs_disabled());
140 mp_ops->smp_finish(); 140 mp_ops->smp_finish();
141 141
142 cpu_idle(); 142 cpu_startup_entry(CPUHP_ONLINE);
143} 143}
144 144
145/* 145/*
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c
index aee7c8177b5d..c10aa84c9fa9 100644
--- a/arch/mips/kernel/smtc-proc.c
+++ b/arch/mips/kernel/smtc-proc.c
@@ -16,6 +16,7 @@
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/seq_file.h>
19 20
20#include <asm/smtc_proc.h> 21#include <asm/smtc_proc.h>
21 22
@@ -30,51 +31,39 @@ unsigned long selfipis[NR_CPUS];
30 31
31struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; 32struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
32 33
33static struct proc_dir_entry *smtc_stats;
34
35atomic_t smtc_fpu_recoveries; 34atomic_t smtc_fpu_recoveries;
36 35
37static int proc_read_smtc(char *page, char **start, off_t off, 36static int smtc_proc_show(struct seq_file *m, void *v)
38 int count, int *eof, void *data)
39{ 37{
40 int totalen = 0;
41 int len;
42 int i; 38 int i;
43 extern unsigned long ebase; 39 extern unsigned long ebase;
44 40
45 len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status); 41 seq_printf(m, "SMTC Status Word: 0x%08x\n", smtc_status);
46 totalen += len; 42 seq_printf(m, "Config7: 0x%08x\n", read_c0_config7());
47 page += len; 43 seq_printf(m, "EBASE: 0x%08lx\n", ebase);
48 len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7()); 44 seq_printf(m, "Counter Interrupts taken per CPU (TC)\n");
49 totalen += len; 45 for (i=0; i < NR_CPUS; i++)
50 page += len; 46 seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
51 len = sprintf(page, "EBASE: 0x%08lx\n", ebase); 47 seq_printf(m, "Self-IPIs by CPU:\n");
52 totalen += len; 48 for(i = 0; i < NR_CPUS; i++)
53 page += len; 49 seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
54 len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n"); 50 seq_printf(m, "%d Recoveries of \"stolen\" FPU\n",
55 totalen += len; 51 atomic_read(&smtc_fpu_recoveries));
56 page += len; 52 return 0;
57 for (i=0; i < NR_CPUS; i++) { 53}
58 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
59 totalen += len;
60 page += len;
61 }
62 len = sprintf(page, "Self-IPIs by CPU:\n");
63 totalen += len;
64 page += len;
65 for(i = 0; i < NR_CPUS; i++) {
66 len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
67 totalen += len;
68 page += len;
69 }
70 len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n",
71 atomic_read(&smtc_fpu_recoveries));
72 totalen += len;
73 page += len;
74 54
75 return totalen; 55static int smtc_proc_open(struct inode *inode, struct file *file)
56{
57 return single_open(file, smtc_proc_show, NULL);
76} 58}
77 59
60static const struct file_operations smtc_proc_fops = {
61 .open = smtc_proc_open,
62 .read = seq_read,
63 .llseek = seq_lseek,
64 .release = single_release,
65};
66
78void init_smtc_stats(void) 67void init_smtc_stats(void)
79{ 68{
80 int i; 69 int i;
@@ -86,6 +75,5 @@ void init_smtc_stats(void)
86 75
87 atomic_set(&smtc_fpu_recoveries, 0); 76 atomic_set(&smtc_fpu_recoveries, 0);
88 77
89 smtc_stats = create_proc_read_entry("smtc", 0444, NULL, 78 proc_create("smtc", 0444, NULL, &smtc_proc_fops);
90 proc_read_smtc, NULL);
91} 79}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index c3abb88170fc..25225515451f 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -206,19 +206,6 @@ void show_stack(struct task_struct *task, unsigned long *sp)
206 show_stacktrace(task, &regs); 206 show_stacktrace(task, &regs);
207} 207}
208 208
209/*
210 * The architecture-independent dump_stack generator
211 */
212void dump_stack(void)
213{
214 struct pt_regs regs;
215
216 prepare_frametrace(&regs);
217 show_backtrace(current, &regs);
218}
219
220EXPORT_SYMBOL(dump_stack);
221
222static void show_code(unsigned int __user *pc) 209static void show_code(unsigned int __user *pc)
223{ 210{
224 long i; 211 long i;
@@ -244,7 +231,7 @@ static void __show_regs(const struct pt_regs *regs)
244 unsigned int cause = regs->cp0_cause; 231 unsigned int cause = regs->cp0_cause;
245 int i; 232 int i;
246 233
247 printk("Cpu %d\n", smp_processor_id()); 234 show_regs_print_info(KERN_DEFAULT);
248 235
249 /* 236 /*
250 * Saved main processor registers 237 * Saved main processor registers
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c
index c592bc8b8c99..638c5db122c9 100644
--- a/arch/mips/lasat/picvue_proc.c
+++ b/arch/mips/lasat/picvue_proc.c
@@ -58,13 +58,13 @@ static int pvc_line_proc_show(struct seq_file *m, void *v)
58 58
59static int pvc_line_proc_open(struct inode *inode, struct file *file) 59static int pvc_line_proc_open(struct inode *inode, struct file *file)
60{ 60{
61 return single_open(file, pvc_line_proc_show, PDE(inode)->data); 61 return single_open(file, pvc_line_proc_show, PDE_DATA(inode));
62} 62}
63 63
64static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, 64static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
65 size_t count, loff_t *pos) 65 size_t count, loff_t *pos)
66{ 66{
67 int lineno = *(int *)PDE(file_inode(file))->data; 67 int lineno = *(int *)PDE_DATA(file_inode(file));
68 char kbuf[PVC_LINELEN]; 68 char kbuf[PVC_LINELEN];
69 size_t len; 69 size_t len;
70 70
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 67929251286c..9b973e0af9cb 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -29,6 +29,7 @@
29#include <linux/pfn.h> 29#include <linux/pfn.h>
30#include <linux/hardirq.h> 30#include <linux/hardirq.h>
31#include <linux/gfp.h> 31#include <linux/gfp.h>
32#include <linux/kcore.h>
32 33
33#include <asm/asm-offsets.h> 34#include <asm/asm-offsets.h>
34#include <asm/bootinfo.h> 35#include <asm/bootinfo.h>
@@ -77,10 +78,9 @@ EXPORT_SYMBOL_GPL(empty_zero_page);
77/* 78/*
78 * Not static inline because used by IP27 special magic initialization code 79 * Not static inline because used by IP27 special magic initialization code
79 */ 80 */
80unsigned long setup_zero_pages(void) 81void setup_zero_pages(void)
81{ 82{
82 unsigned int order; 83 unsigned int order, i;
83 unsigned long size;
84 struct page *page; 84 struct page *page;
85 85
86 if (cpu_has_vce) 86 if (cpu_has_vce)
@@ -94,15 +94,10 @@ unsigned long setup_zero_pages(void)
94 94
95 page = virt_to_page((void *)empty_zero_page); 95 page = virt_to_page((void *)empty_zero_page);
96 split_page(page, order); 96 split_page(page, order);
97 while (page < virt_to_page((void *)(empty_zero_page + (PAGE_SIZE << order)))) { 97 for (i = 0; i < (1 << order); i++, page++)
98 SetPageReserved(page); 98 mark_page_reserved(page);
99 page++;
100 }
101
102 size = PAGE_SIZE << order;
103 zero_page_mask = (size - 1) & PAGE_MASK;
104 99
105 return 1UL << order; 100 zero_page_mask = ((PAGE_SIZE << order) - 1) & PAGE_MASK;
106} 101}
107 102
108#ifdef CONFIG_MIPS_MT_SMTC 103#ifdef CONFIG_MIPS_MT_SMTC
@@ -380,7 +375,7 @@ void __init mem_init(void)
380 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 375 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
381 376
382 totalram_pages += free_all_bootmem(); 377 totalram_pages += free_all_bootmem();
383 totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */ 378 setup_zero_pages(); /* Setup zeroed pages. */
384 379
385 reservedpages = ram = 0; 380 reservedpages = ram = 0;
386 for (tmp = 0; tmp < max_low_pfn; tmp++) 381 for (tmp = 0; tmp < max_low_pfn; tmp++)
@@ -399,12 +394,8 @@ void __init mem_init(void)
399 SetPageReserved(page); 394 SetPageReserved(page);
400 continue; 395 continue;
401 } 396 }
402 ClearPageReserved(page); 397 free_highmem_page(page);
403 init_page_count(page);
404 __free_page(page);
405 totalhigh_pages++;
406 } 398 }
407 totalram_pages += totalhigh_pages;
408 num_physpages += totalhigh_pages; 399 num_physpages += totalhigh_pages;
409#endif 400#endif
410 401
@@ -440,11 +431,8 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end)
440 struct page *page = pfn_to_page(pfn); 431 struct page *page = pfn_to_page(pfn);
441 void *addr = phys_to_virt(PFN_PHYS(pfn)); 432 void *addr = phys_to_virt(PFN_PHYS(pfn));
442 433
443 ClearPageReserved(page);
444 init_page_count(page);
445 memset(addr, POISON_FREE_INITMEM, PAGE_SIZE); 434 memset(addr, POISON_FREE_INITMEM, PAGE_SIZE);
446 __free_page(page); 435 free_reserved_page(page);
447 totalram_pages++;
448 } 436 }
449 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); 437 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
450} 438}
@@ -452,18 +440,14 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end)
452#ifdef CONFIG_BLK_DEV_INITRD 440#ifdef CONFIG_BLK_DEV_INITRD
453void free_initrd_mem(unsigned long start, unsigned long end) 441void free_initrd_mem(unsigned long start, unsigned long end)
454{ 442{
455 free_init_pages("initrd memory", 443 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
456 virt_to_phys((void *)start),
457 virt_to_phys((void *)end));
458} 444}
459#endif 445#endif
460 446
461void __init_refok free_initmem(void) 447void __init_refok free_initmem(void)
462{ 448{
463 prom_free_prom_memory(); 449 prom_free_prom_memory();
464 free_init_pages("unused kernel memory", 450 free_initmem_default(POISON_FREE_INITMEM);
465 __pa_symbol(&__init_begin),
466 __pa_symbol(&__init_end));
467} 451}
468 452
469#ifndef CONFIG_MIPS_PGD_C0_CONTEXT 453#ifndef CONFIG_MIPS_PGD_C0_CONTEXT
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index d0b6f8399b07..3d27800edba2 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -53,56 +53,51 @@ static void pci_proc_init(void);
53 53
54/***************************************************************************** 54/*****************************************************************************
55 * 55 *
56 * FUNCTION: read_msp_pci_counts 56 * FUNCTION: show_msp_pci_counts
57 * _________________________________________________________________________ 57 * _________________________________________________________________________
58 * 58 *
59 * DESCRIPTION: Prints the count of how many times each PCI 59 * DESCRIPTION: Prints the count of how many times each PCI
60 * interrupt has asserted. Can be invoked by the 60 * interrupt has asserted. Can be invoked by the
61 * /proc filesystem. 61 * /proc filesystem.
62 * 62 *
63 * INPUTS: page - part of STDOUT calculation 63 * INPUTS: m - synthetic file construction data
64 * off - part of STDOUT calculation 64 * v - iterator
65 * count - part of STDOUT calculation
66 * data - unused
67 * 65 *
68 * OUTPUTS: start - new start location 66 * RETURNS: 0 or error
69 * eof - end of file pointer
70 *
71 * RETURNS: len - STDOUT length
72 * 67 *
73 ****************************************************************************/ 68 ****************************************************************************/
74static int read_msp_pci_counts(char *page, char **start, off_t off, 69static int show_msp_pci_counts(struct seq_file *m, void *v)
75 int count, int *eof, void *data)
76{ 70{
77 int i; 71 int i;
78 int len = 0;
79 unsigned int intcount, total = 0; 72 unsigned int intcount, total = 0;
80 73
81 for (i = 0; i < 32; ++i) { 74 for (i = 0; i < 32; ++i) {
82 intcount = pci_int_count[i]; 75 intcount = pci_int_count[i];
83 if (intcount != 0) { 76 if (intcount != 0) {
84 len += sprintf(page + len, "[%d] = %u\n", i, intcount); 77 seq_printf(m, "[%d] = %u\n", i, intcount);
85 total += intcount; 78 total += intcount;
86 } 79 }
87 } 80 }
88 81
89 len += sprintf(page + len, "total = %u\n", total); 82 seq_printf(m, "total = %u\n", total);
90 if (len <= off+count) 83 return 0;
91 *eof = 1; 84}
92
93 *start = page + off;
94 len -= off;
95 if (len > count)
96 len = count;
97 if (len < 0)
98 len = 0;
99 85
100 return len; 86static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file)
87{
88 return single_open(file, show_msp_pci_counts, NULL);
101} 89}
102 90
91static const struct file_operations msp_pci_rd_cnt_fops = {
92 .open = msp_pci_rd_cnt_open,
93 .read = seq_read,
94 .llseek = seq_lseek,
95 .release = single_release,
96};
97
103/***************************************************************************** 98/*****************************************************************************
104 * 99 *
105 * FUNCTION: gen_pci_cfg_wr 100 * FUNCTION: gen_pci_cfg_wr_show
106 * _________________________________________________________________________ 101 * _________________________________________________________________________
107 * 102 *
108 * DESCRIPTION: Generates a configuration write cycle for debug purposes. 103 * DESCRIPTION: Generates a configuration write cycle for debug purposes.
@@ -112,37 +107,30 @@ static int read_msp_pci_counts(char *page, char **start, off_t off,
112 * PCI bus. Intent is that this function by invocable from 107 * PCI bus. Intent is that this function by invocable from
113 * the /proc filesystem. 108 * the /proc filesystem.
114 * 109 *
115 * INPUTS: page - part of STDOUT calculation 110 * INPUTS: m - synthetic file construction data
116 * off - part of STDOUT calculation 111 * v - iterator
117 * count - part of STDOUT calculation
118 * data - unused
119 * 112 *
120 * OUTPUTS: start - new start location 113 * RETURNS: 0 or error
121 * eof - end of file pointer
122 *
123 * RETURNS: len - STDOUT length
124 * 114 *
125 ****************************************************************************/ 115 ****************************************************************************/
126static int gen_pci_cfg_wr(char *page, char **start, off_t off, 116static int gen_pci_cfg_wr_show(struct seq_file *m, void *v)
127 int count, int *eof, void *data)
128{ 117{
129 unsigned char where = 0; /* Write to static Device/Vendor ID */ 118 unsigned char where = 0; /* Write to static Device/Vendor ID */
130 unsigned char bus_num = 0; /* Bus 0 */ 119 unsigned char bus_num = 0; /* Bus 0 */
131 unsigned char dev_fn = 0xF; /* Arbitrary device number */ 120 unsigned char dev_fn = 0xF; /* Arbitrary device number */
132 u32 wr_data = 0xFF00AA00; /* Arbitrary data */ 121 u32 wr_data = 0xFF00AA00; /* Arbitrary data */
133 struct msp_pci_regs *preg = (void *)PCI_BASE_REG; 122 struct msp_pci_regs *preg = (void *)PCI_BASE_REG;
134 int len = 0;
135 unsigned long value; 123 unsigned long value;
136 int intr; 124 int intr;
137 125
138 len += sprintf(page + len, "PMC MSP PCI: Beginning\n"); 126 seq_puts(m, "PMC MSP PCI: Beginning\n");
139 127
140 if (proc_init == 0) { 128 if (proc_init == 0) {
141 pci_proc_init(); 129 pci_proc_init();
142 proc_init = ~0; 130 proc_init = ~0;
143 } 131 }
144 132
145 len += sprintf(page + len, "PMC MSP PCI: Before Cfg Wr\n"); 133 seq_puts(m, "PMC MSP PCI: Before Cfg Wr\n");
146 134
147 /* 135 /*
148 * Generate PCI Configuration Write Cycle 136 * Generate PCI Configuration Write Cycle
@@ -168,21 +156,22 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
168 */ 156 */
169 intr = preg->if_status; 157 intr = preg->if_status;
170 158
171 len += sprintf(page + len, "PMC MSP PCI: After Cfg Wr\n"); 159 seq_puts(m, "PMC MSP PCI: After Cfg Wr\n");
172 160 return 0;
173 /* Handle STDOUT calculations */ 161}
174 if (len <= off+count)
175 *eof = 1;
176 *start = page + off;
177 len -= off;
178 if (len > count)
179 len = count;
180 if (len < 0)
181 len = 0;
182 162
183 return len; 163static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file)
164{
165 return single_open(file, gen_pci_cfg_wr_show, NULL);
184} 166}
185 167
168static const struct file_operations gen_pci_cfg_wr_fops = {
169 .open = gen_pci_cfg_wr_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = single_release,
173};
174
186/***************************************************************************** 175/*****************************************************************************
187 * 176 *
188 * FUNCTION: pci_proc_init 177 * FUNCTION: pci_proc_init
@@ -199,10 +188,8 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
199 ****************************************************************************/ 188 ****************************************************************************/
200static void pci_proc_init(void) 189static void pci_proc_init(void)
201{ 190{
202 create_proc_read_entry("pmc_msp_pci_rd_cnt", 0, NULL, 191 proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops);
203 read_msp_pci_counts, NULL); 192 proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops);
204 create_proc_read_entry("pmc_msp_pci_cfg_wr", 0, NULL,
205 gen_pci_cfg_wr, NULL);
206} 193}
207#endif /* CONFIG_PROC_FS && PCI_COUNTERS */ 194#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
208 195
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 0872f12f268d..594e60d6a43b 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -115,7 +115,6 @@ static void pcibios_scanbus(struct pci_controller *hose)
115 pci_bus_assign_resources(bus); 115 pci_bus_assign_resources(bus);
116 pci_enable_bridges(bus); 116 pci_enable_bridges(bus);
117 } 117 }
118 bus->dev.of_node = hose->of_node;
119 } 118 }
120} 119}
121 120
@@ -169,6 +168,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
169 } 168 }
170 } 169 }
171} 170}
171
172struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
173{
174 struct pci_controller *hose = bus->sysdata;
175
176 return of_node_get(hose->of_node);
177}
172#endif 178#endif
173 179
174static DEFINE_MUTEX(pci_scan_mutex); 180static DEFINE_MUTEX(pci_scan_mutex);
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index 3505d08ff2fd..5f2bddb1860e 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -457,7 +457,7 @@ void __init prom_free_prom_memory(void)
457 /* We got nothing to free here ... */ 457 /* We got nothing to free here ... */
458} 458}
459 459
460extern unsigned long setup_zero_pages(void); 460extern void setup_zero_pages(void);
461 461
462void __init paging_init(void) 462void __init paging_init(void)
463{ 463{
@@ -492,7 +492,7 @@ void __init mem_init(void)
492 totalram_pages += free_all_bootmem_node(NODE_DATA(node)); 492 totalram_pages += free_all_bootmem_node(NODE_DATA(node));
493 } 493 }
494 494
495 totalram_pages -= setup_zero_pages(); /* This comes from node 0 */ 495 setup_zero_pages(); /* This comes from node 0 */
496 496
497 codesize = (unsigned long) &_etext - (unsigned long) &_text; 497 codesize = (unsigned long) &_etext - (unsigned long) &_text;
498 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 498 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/sb1250/bus_watcher.c
index e651105b3f0b..8871e3345bff 100644
--- a/arch/mips/sibyte/sb1250/bus_watcher.c
+++ b/arch/mips/sibyte/sb1250/bus_watcher.c
@@ -30,6 +30,7 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/seq_file.h>
33#include <asm/io.h> 34#include <asm/io.h>
34 35
35#include <asm/sibyte/sb1250.h> 36#include <asm/sibyte/sb1250.h>
@@ -99,63 +100,60 @@ void check_bus_watcher(void)
99 printk("Bus watcher indicates no error\n"); 100 printk("Bus watcher indicates no error\n");
100} 101}
101 102
102static int bw_print_buffer(char *page, struct bw_stats_struct *stats) 103#ifdef CONFIG_PROC_FS
104
105/* For simplicity, I want to assume a single read is required each
106 time */
107static int bw_proc_show(struct seq_file *m, void *v)
103{ 108{
104 int len; 109 struct bw_stats_struct *stats = m->private;
105 110
106 len = sprintf(page, "SiByte Bus Watcher statistics\n"); 111 seq_puts(m, "SiByte Bus Watcher statistics\n");
107 len += sprintf(page+len, "-----------------------------\n"); 112 seq_puts(m, "-----------------------------\n");
108 len += sprintf(page+len, "L2-d-cor %8ld\nL2-d-bad %8ld\n", 113 seq_printf(m, "L2-d-cor %8ld\nL2-d-bad %8ld\n",
109 stats->l2_cor_d, stats->l2_bad_d); 114 stats->l2_cor_d, stats->l2_bad_d);
110 len += sprintf(page+len, "L2-t-cor %8ld\nL2-t-bad %8ld\n", 115 seq_printf(m, "L2-t-cor %8ld\nL2-t-bad %8ld\n",
111 stats->l2_cor_t, stats->l2_bad_t); 116 stats->l2_cor_t, stats->l2_bad_t);
112 len += sprintf(page+len, "MC-d-cor %8ld\nMC-d-bad %8ld\n", 117 seq_printf(m, "MC-d-cor %8ld\nMC-d-bad %8ld\n",
113 stats->mem_cor_d, stats->mem_bad_d); 118 stats->mem_cor_d, stats->mem_bad_d);
114 len += sprintf(page+len, "IO-err %8ld\n", stats->bus_error); 119 seq_printf(m, "IO-err %8ld\n", stats->bus_error);
115 len += sprintf(page+len, "\nLast recorded signature:\n"); 120 seq_puts(m, "\nLast recorded signature:\n");
116 len += sprintf(page+len, "Request %02x from %d, answered by %d with Dcode %d\n", 121 seq_printf(m, "Request %02x from %d, answered by %d with Dcode %d\n",
117 (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f), 122 (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f),
118 (int)(G_SCD_BERR_TID(stats->status) >> 6), 123 (int)(G_SCD_BERR_TID(stats->status) >> 6),
119 (int)G_SCD_BERR_RID(stats->status), 124 (int)G_SCD_BERR_RID(stats->status),
120 (int)G_SCD_BERR_DCODE(stats->status)); 125 (int)G_SCD_BERR_DCODE(stats->status));
121 /* XXXKW indicate multiple errors between printings, or stats 126 /* XXXKW indicate multiple errors between printings, or stats
122 collection (or both)? */ 127 collection (or both)? */
123 if (stats->status & M_SCD_BERR_MULTERRS) 128 if (stats->status & M_SCD_BERR_MULTERRS)
124 len += sprintf(page+len, "Multiple errors observed since last check.\n"); 129 seq_puts(m, "Multiple errors observed since last check.\n");
125 if (stats->status_printed) { 130 if (stats->status_printed) {
126 len += sprintf(page+len, "(no change since last printing)\n"); 131 seq_puts(m, "(no change since last printing)\n");
127 } else { 132 } else {
128 stats->status_printed = 1; 133 stats->status_printed = 1;
129 } 134 }
130 135
131 return len; 136 return 0;
132} 137}
133 138
134#ifdef CONFIG_PROC_FS 139static int bw_proc_open(struct inode *inode, struct file *file)
135
136/* For simplicity, I want to assume a single read is required each
137 time */
138static int bw_read_proc(char *page, char **start, off_t off,
139 int count, int *eof, void *data)
140{ 140{
141 int len; 141 return single_open(file, bw_proc_show, PDE_DATA(inode));
142
143 if (off == 0) {
144 len = bw_print_buffer(page, data);
145 *start = page;
146 } else {
147 len = 0;
148 *eof = 1;
149 }
150 return len;
151} 142}
152 143
144static const struct file_operations bw_proc_fops = {
145 .open = bw_proc_open,
146 .read = seq_read,
147 .llseek = seq_lseek,
148 .release = single_release,
149};
150
153static void create_proc_decoder(struct bw_stats_struct *stats) 151static void create_proc_decoder(struct bw_stats_struct *stats)
154{ 152{
155 struct proc_dir_entry *ent; 153 struct proc_dir_entry *ent;
156 154
157 ent = create_proc_read_entry("bus_watcher", S_IWUSR | S_IRUGO, NULL, 155 ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL,
158 bw_read_proc, stats); 156 &bw_proc_fops, stats);
159 if (!ent) { 157 if (!ent) {
160 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); 158 printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n");
161 return; 159 return;
@@ -210,11 +208,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)
210 stats->bus_error += G_SCD_MEM_BUSERR(cntr); 208 stats->bus_error += G_SCD_MEM_BUSERR(cntr);
211 csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS)); 209 csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS));
212 210
213#ifndef CONFIG_PROC_FS
214 bw_print_buffer(bw_buf, stats);
215 printk(bw_buf);
216#endif
217
218 return IRQ_HANDLED; 211 return IRQ_HANDLED;
219} 212}
220 213
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h
index f90062b0622d..224b4262486d 100644
--- a/arch/mn10300/include/asm/thread_info.h
+++ b/arch/mn10300/include/asm/thread_info.h
@@ -165,8 +165,6 @@ void arch_release_thread_info(struct thread_info *ti);
165#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 165#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
166#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 166#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
167 167
168#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
169
170#endif /* __KERNEL__ */ 168#endif /* __KERNEL__ */
171 169
172#endif /* _ASM_THREAD_INFO_H */ 170#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index 7f9d9adfa51e..9d4e2d1ef90e 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -45,14 +45,4 @@
45#define __ARCH_WANT_SYS_VFORK 45#define __ARCH_WANT_SYS_VFORK
46#define __ARCH_WANT_SYS_CLONE 46#define __ARCH_WANT_SYS_CLONE
47 47
48/*
49 * "Conditional" syscalls
50 *
51 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
52 * but it doesn't work on all toolchains, so we just do it by hand
53 */
54#ifndef cond_syscall
55#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
56#endif
57
58#endif /* _ASM_UNISTD_H */ 48#endif /* _ASM_UNISTD_H */
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c
index 84f4e97e3074..3707da583d05 100644
--- a/arch/mn10300/kernel/process.c
+++ b/arch/mn10300/kernel/process.c
@@ -50,77 +50,19 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
50void (*pm_power_off)(void); 50void (*pm_power_off)(void);
51EXPORT_SYMBOL(pm_power_off); 51EXPORT_SYMBOL(pm_power_off);
52 52
53#if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)
54/*
55 * we use this if we don't have any better idle routine
56 */
57static void default_idle(void)
58{
59 local_irq_disable();
60 if (!need_resched())
61 safe_halt();
62 else
63 local_irq_enable();
64}
65
66#else /* !CONFIG_SMP || CONFIG_HOTPLUG_CPU */
67/* 53/*
68 * On SMP it's slightly faster (but much more power-consuming!) 54 * On SMP it's slightly faster (but much more power-consuming!)
69 * to poll the ->work.need_resched flag instead of waiting for the 55 * to poll the ->work.need_resched flag instead of waiting for the
70 * cross-CPU IPI to arrive. Use this option with caution. 56 * cross-CPU IPI to arrive. Use this option with caution.
57 *
58 * tglx: No idea why this depends on HOTPLUG_CPU !?!
71 */ 59 */
72static inline void poll_idle(void) 60#if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU)
73{ 61void arch_cpu_idle(void)
74 int oldval;
75
76 local_irq_enable();
77
78 /*
79 * Deal with another CPU just having chosen a thread to
80 * run here:
81 */
82 oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
83
84 if (!oldval) {
85 set_thread_flag(TIF_POLLING_NRFLAG);
86 while (!need_resched())
87 cpu_relax();
88 clear_thread_flag(TIF_POLLING_NRFLAG);
89 } else {
90 set_need_resched();
91 }
92}
93#endif /* !CONFIG_SMP || CONFIG_HOTPLUG_CPU */
94
95/*
96 * the idle thread
97 * - there's no useful work to be done, so just try to conserve power and have
98 * a low exit latency (ie sit in a loop waiting for somebody to say that
99 * they'd like to reschedule)
100 */
101void cpu_idle(void)
102{ 62{
103 /* endless idle loop with no priority at all */ 63 safe_halt();
104 for (;;) {
105 rcu_idle_enter();
106 while (!need_resched()) {
107 void (*idle)(void);
108
109 smp_rmb();
110 if (!idle) {
111#if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU)
112 idle = poll_idle;
113#else /* CONFIG_SMP && !CONFIG_HOTPLUG_CPU */
114 idle = default_idle;
115#endif /* CONFIG_SMP && !CONFIG_HOTPLUG_CPU */
116 }
117 idle();
118 }
119 rcu_idle_exit();
120
121 schedule_preempt_disabled();
122 }
123} 64}
65#endif
124 66
125void release_segments(struct mm_struct *mm) 67void release_segments(struct mm_struct *mm)
126{ 68{
@@ -155,6 +97,7 @@ void machine_power_off(void)
155 97
156void show_regs(struct pt_regs *regs) 98void show_regs(struct pt_regs *regs)
157{ 99{
100 show_regs_print_info(KERN_DEFAULT);
158} 101}
159 102
160/* 103/*
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index 5d7e152a23b7..a17f9c9c14c9 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -675,7 +675,7 @@ int __init start_secondary(void *unused)
675#ifdef CONFIG_GENERIC_CLOCKEVENTS 675#ifdef CONFIG_GENERIC_CLOCKEVENTS
676 init_clockevents(); 676 init_clockevents();
677#endif 677#endif
678 cpu_idle(); 678 cpu_startup_entry(CPUHP_ONLINE);
679 return 0; 679 return 0;
680} 680}
681 681
@@ -935,8 +935,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
935 int timeout; 935 int timeout;
936 936
937#ifdef CONFIG_HOTPLUG_CPU 937#ifdef CONFIG_HOTPLUG_CPU
938 if (num_online_cpus() == 1)
939 disable_hlt();
940 if (sleep_mode[cpu]) 938 if (sleep_mode[cpu])
941 run_wakeup_cpu(cpu); 939 run_wakeup_cpu(cpu);
942#endif /* CONFIG_HOTPLUG_CPU */ 940#endif /* CONFIG_HOTPLUG_CPU */
@@ -1003,9 +1001,6 @@ int __cpu_disable(void)
1003void __cpu_die(unsigned int cpu) 1001void __cpu_die(unsigned int cpu)
1004{ 1002{
1005 run_sleep_cpu(cpu); 1003 run_sleep_cpu(cpu);
1006
1007 if (num_online_cpus() == 1)
1008 enable_hlt();
1009} 1004}
1010 1005
1011#ifdef CONFIG_MN10300_CACHE_ENABLED 1006#ifdef CONFIG_MN10300_CACHE_ENABLED
diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c
index b900e5afa0ae..a7a987c7954f 100644
--- a/arch/mn10300/kernel/traps.c
+++ b/arch/mn10300/kernel/traps.c
@@ -294,17 +294,6 @@ void show_stack(struct task_struct *task, unsigned long *sp)
294} 294}
295 295
296/* 296/*
297 * the architecture-independent dump_stack generator
298 */
299void dump_stack(void)
300{
301 unsigned long stack;
302
303 show_stack(current, &stack);
304}
305EXPORT_SYMBOL(dump_stack);
306
307/*
308 * dump the register file in the specified exception frame 297 * dump the register file in the specified exception frame
309 */ 298 */
310void show_registers_only(struct pt_regs *regs) 299void show_registers_only(struct pt_regs *regs)
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index e57e5bc23562..5a8ace63a6b4 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -139,30 +139,11 @@ void __init mem_init(void)
139} 139}
140 140
141/* 141/*
142 *
143 */
144void free_init_pages(char *what, unsigned long begin, unsigned long end)
145{
146 unsigned long addr;
147
148 for (addr = begin; addr < end; addr += PAGE_SIZE) {
149 ClearPageReserved(virt_to_page(addr));
150 init_page_count(virt_to_page(addr));
151 memset((void *) addr, 0xcc, PAGE_SIZE);
152 free_page(addr);
153 totalram_pages++;
154 }
155 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
156}
157
158/*
159 * recycle memory containing stuff only required for initialisation 142 * recycle memory containing stuff only required for initialisation
160 */ 143 */
161void free_initmem(void) 144void free_initmem(void)
162{ 145{
163 free_init_pages("unused kernel memory", 146 free_initmem_default(POISON_FREE_INITMEM);
164 (unsigned long) &__init_begin,
165 (unsigned long) &__init_end);
166} 147}
167 148
168/* 149/*
@@ -171,6 +152,6 @@ void free_initmem(void)
171#ifdef CONFIG_BLK_DEV_INITRD 152#ifdef CONFIG_BLK_DEV_INITRD
172void free_initrd_mem(unsigned long start, unsigned long end) 153void free_initrd_mem(unsigned long start, unsigned long end)
173{ 154{
174 free_init_pages("initrd memory", start, end); 155 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
175} 156}
176#endif 157#endif
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ab3bf2eca8d..81b9ddbc9166 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -55,9 +55,6 @@ config TRACE_IRQFLAGS_SUPPORT
55config GENERIC_CSUM 55config GENERIC_CSUM
56 def_bool y 56 def_bool y
57 57
58config GENERIC_FIND_NEXT_BIT
59 def_bool y
60
61source "init/Kconfig" 58source "init/Kconfig"
62 59
63 60
diff --git a/arch/openrisc/include/asm/thread_info.h b/arch/openrisc/include/asm/thread_info.h
index 07f3212422ad..d797acc901e4 100644
--- a/arch/openrisc/include/asm/thread_info.h
+++ b/arch/openrisc/include/asm/thread_info.h
@@ -128,8 +128,6 @@ register struct thread_info *current_thread_info_reg asm("r10");
128/* For OpenRISC, this is anything in the LSW other than syscall trace */ 128/* For OpenRISC, this is anything in the LSW other than syscall trace */
129#define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP)) 129#define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP))
130 130
131#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
132
133#endif /* __KERNEL__ */ 131#endif /* __KERNEL__ */
134 132
135#endif /* _ASM_THREAD_INFO_H */ 133#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/openrisc/kernel/Makefile b/arch/openrisc/kernel/Makefile
index 35f92ce51c24..ec6d9d37cefd 100644
--- a/arch/openrisc/kernel/Makefile
+++ b/arch/openrisc/kernel/Makefile
@@ -4,7 +4,7 @@
4 4
5extra-y := head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \ 7obj-y := setup.o or32_ksyms.o process.o dma.o \
8 traps.o time.o irq.o entry.o ptrace.o signal.o \ 8 traps.o time.o irq.o entry.o ptrace.o signal.o \
9 sys_call_table.o 9 sys_call_table.o
10 10
diff --git a/arch/openrisc/kernel/idle.c b/arch/openrisc/kernel/idle.c
deleted file mode 100644
index 5e8a3b6d6bc6..000000000000
--- a/arch/openrisc/kernel/idle.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * OpenRISC idle.c
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 *
17 * Idle daemon for or32. Idle daemon will handle any action
18 * that needs to be taken when the system becomes idle.
19 */
20
21#include <linux/errno.h>
22#include <linux/sched.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/smp.h>
26#include <linux/stddef.h>
27#include <linux/unistd.h>
28#include <linux/ptrace.h>
29#include <linux/slab.h>
30#include <linux/tick.h>
31
32#include <asm/pgtable.h>
33#include <asm/uaccess.h>
34#include <asm/io.h>
35#include <asm/processor.h>
36#include <asm/mmu.h>
37#include <asm/cache.h>
38#include <asm/pgalloc.h>
39
40void (*powersave) (void) = NULL;
41
42void cpu_idle(void)
43{
44 set_thread_flag(TIF_POLLING_NRFLAG);
45
46 /* endless idle loop with no priority at all */
47 while (1) {
48 tick_nohz_idle_enter();
49 rcu_idle_enter();
50
51 while (!need_resched()) {
52 check_pgt_cache();
53 rmb();
54
55 clear_thread_flag(TIF_POLLING_NRFLAG);
56
57 local_irq_disable();
58 /* Don't trace irqs off for idle */
59 stop_critical_timings();
60 if (!need_resched() && powersave != NULL)
61 powersave();
62 start_critical_timings();
63 local_irq_enable();
64 set_thread_flag(TIF_POLLING_NRFLAG);
65 }
66
67 rcu_idle_exit();
68 tick_nohz_idle_exit();
69 preempt_enable_no_resched();
70 schedule();
71 preempt_disable();
72 }
73}
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index 00c233bf0d06..386af258591d 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -90,6 +90,7 @@ void show_regs(struct pt_regs *regs)
90{ 90{
91 extern void show_registers(struct pt_regs *regs); 91 extern void show_registers(struct pt_regs *regs);
92 92
93 show_regs_print_info(KERN_DEFAULT);
93 /* __PHX__ cleanup this mess */ 94 /* __PHX__ cleanup this mess */
94 show_registers(regs); 95 show_registers(regs);
95} 96}
diff --git a/arch/openrisc/kernel/traps.c b/arch/openrisc/kernel/traps.c
index 5cce396016d0..3d3f6062f49c 100644
--- a/arch/openrisc/kernel/traps.c
+++ b/arch/openrisc/kernel/traps.c
@@ -105,17 +105,6 @@ void show_trace_task(struct task_struct *tsk)
105 */ 105 */
106} 106}
107 107
108/*
109 * The architecture-independent backtrace generator
110 */
111void dump_stack(void)
112{
113 unsigned long stack;
114
115 show_stack(current, &stack);
116}
117EXPORT_SYMBOL(dump_stack);
118
119void show_registers(struct pt_regs *regs) 108void show_registers(struct pt_regs *regs)
120{ 109{
121 int i; 110 int i;
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index e7fdc50c4bf0..b3cbc6703837 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -43,6 +43,7 @@
43#include <asm/kmap_types.h> 43#include <asm/kmap_types.h>
44#include <asm/fixmap.h> 44#include <asm/fixmap.h>
45#include <asm/tlbflush.h> 45#include <asm/tlbflush.h>
46#include <asm/sections.h>
46 47
47int mem_init_done; 48int mem_init_done;
48 49
@@ -201,9 +202,6 @@ void __init paging_init(void)
201 202
202/* References to section boundaries */ 203/* References to section boundaries */
203 204
204extern char _stext, _etext, _edata, __bss_start, _end;
205extern char __init_begin, __init_end;
206
207static int __init free_pages_init(void) 205static int __init free_pages_init(void)
208{ 206{
209 int reservedpages, pfn; 207 int reservedpages, pfn;
@@ -263,30 +261,11 @@ void __init mem_init(void)
263#ifdef CONFIG_BLK_DEV_INITRD 261#ifdef CONFIG_BLK_DEV_INITRD
264void free_initrd_mem(unsigned long start, unsigned long end) 262void free_initrd_mem(unsigned long start, unsigned long end)
265{ 263{
266 printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", 264 free_reserved_area(start, end, 0, "initrd");
267 (end - start) >> 10);
268
269 for (; start < end; start += PAGE_SIZE) {
270 ClearPageReserved(virt_to_page(start));
271 init_page_count(virt_to_page(start));
272 free_page(start);
273 totalram_pages++;
274 }
275} 265}
276#endif 266#endif
277 267
278void free_initmem(void) 268void free_initmem(void)
279{ 269{
280 unsigned long addr; 270 free_initmem_default(0);
281
282 addr = (unsigned long)(&__init_begin);
283 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
284 ClearPageReserved(virt_to_page(addr));
285 init_page_count(virt_to_page(addr));
286 free_page(addr);
287 totalram_pages++;
288 }
289 printk(KERN_INFO "Freeing unused kernel memory: %luk freed\n",
290 ((unsigned long)&__init_end -
291 (unsigned long)&__init_begin) >> 10);
292} 271}
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 0339181bf3ac..433e75a2ee9a 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -1,5 +1,6 @@
1config PARISC 1config PARISC
2 def_bool y 2 def_bool y
3 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
3 select HAVE_IDE 4 select HAVE_IDE
4 select HAVE_OPROFILE 5 select HAVE_OPROFILE
5 select HAVE_FUNCTION_TRACER if 64BIT 6 select HAVE_FUNCTION_TRACER if 64BIT
diff --git a/arch/parisc/Kconfig.debug b/arch/parisc/Kconfig.debug
index 7305ac8f7f5b..bc989e522a04 100644
--- a/arch/parisc/Kconfig.debug
+++ b/arch/parisc/Kconfig.debug
@@ -12,18 +12,4 @@ config DEBUG_RODATA
12 portion of the kernel code won't be covered by a TLB anymore. 12 portion of the kernel code won't be covered by a TLB anymore.
13 If in doubt, say "N". 13 If in doubt, say "N".
14 14
15config DEBUG_STRICT_USER_COPY_CHECKS
16 bool "Strict copy size checks"
17 depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
18 ---help---
19 Enabling this option turns a certain set of sanity checks for user
20 copy operations into compile time failures.
21
22 The copy_from_user() etc checks are there to help test if there
23 are sufficient security checks on the length argument of
24 the copy operation, by having gcc prove that the argument is
25 within bounds.
26
27 If unsure, or if you run an older (pre 4.4) gcc, say N.
28
29endmenu 15endmenu
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 01d95e2f0581..113e28206503 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -65,8 +65,10 @@ ifndef CONFIG_FUNCTION_TRACER
65endif 65endif
66 66
67# Use long jumps instead of long branches (needed if your linker fails to 67# Use long jumps instead of long branches (needed if your linker fails to
68# link a too big vmlinux executable) 68# link a too big vmlinux executable). Not enabled for building modules.
69cflags-$(CONFIG_MLONGCALLS) += -mlong-calls 69ifdef CONFIG_MLONGCALLS
70KBUILD_CFLAGS_KERNEL += -mlong-calls
71endif
70 72
71# select which processor to optimise for 73# select which processor to optimise for
72cflags-$(CONFIG_PA7100) += -march=1.1 -mschedule=7100 74cflags-$(CONFIG_PA7100) += -march=1.1 -mschedule=7100
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index 79f694f3ad9b..f0e2784e7cca 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -140,7 +140,10 @@ static inline void *kmap(struct page *page)
140 return page_address(page); 140 return page_address(page);
141} 141}
142 142
143#define kunmap(page) kunmap_parisc(page_address(page)) 143static inline void kunmap(struct page *page)
144{
145 kunmap_parisc(page_address(page));
146}
144 147
145static inline void *kmap_atomic(struct page *page) 148static inline void *kmap_atomic(struct page *page)
146{ 149{
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 7df49fad29f9..1e40d7f86be3 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -16,6 +16,8 @@
16#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/cache.h> 17#include <asm/cache.h>
18 18
19extern spinlock_t pa_dbit_lock;
20
19/* 21/*
20 * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel 22 * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
21 * memory. For the return value to be meaningful, ADDR must be >= 23 * memory. For the return value to be meaningful, ADDR must be >=
@@ -44,8 +46,11 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
44 46
45#define set_pte_at(mm, addr, ptep, pteval) \ 47#define set_pte_at(mm, addr, ptep, pteval) \
46 do { \ 48 do { \
49 unsigned long flags; \
50 spin_lock_irqsave(&pa_dbit_lock, flags); \
47 set_pte(ptep, pteval); \ 51 set_pte(ptep, pteval); \
48 purge_tlb_entries(mm, addr); \ 52 purge_tlb_entries(mm, addr); \
53 spin_unlock_irqrestore(&pa_dbit_lock, flags); \
49 } while (0) 54 } while (0)
50 55
51#endif /* !__ASSEMBLY__ */ 56#endif /* !__ASSEMBLY__ */
@@ -435,48 +440,46 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
435 440
436static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 441static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
437{ 442{
438#ifdef CONFIG_SMP 443 pte_t pte;
444 unsigned long flags;
445
439 if (!pte_young(*ptep)) 446 if (!pte_young(*ptep))
440 return 0; 447 return 0;
441 return test_and_clear_bit(xlate_pabit(_PAGE_ACCESSED_BIT), &pte_val(*ptep)); 448
442#else 449 spin_lock_irqsave(&pa_dbit_lock, flags);
443 pte_t pte = *ptep; 450 pte = *ptep;
444 if (!pte_young(pte)) 451 if (!pte_young(pte)) {
452 spin_unlock_irqrestore(&pa_dbit_lock, flags);
445 return 0; 453 return 0;
446 set_pte_at(vma->vm_mm, addr, ptep, pte_mkold(pte)); 454 }
455 set_pte(ptep, pte_mkold(pte));
456 purge_tlb_entries(vma->vm_mm, addr);
457 spin_unlock_irqrestore(&pa_dbit_lock, flags);
447 return 1; 458 return 1;
448#endif
449} 459}
450 460
451extern spinlock_t pa_dbit_lock;
452
453struct mm_struct; 461struct mm_struct;
454static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 462static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
455{ 463{
456 pte_t old_pte; 464 pte_t old_pte;
465 unsigned long flags;
457 466
458 spin_lock(&pa_dbit_lock); 467 spin_lock_irqsave(&pa_dbit_lock, flags);
459 old_pte = *ptep; 468 old_pte = *ptep;
460 pte_clear(mm,addr,ptep); 469 pte_clear(mm,addr,ptep);
461 spin_unlock(&pa_dbit_lock); 470 purge_tlb_entries(mm, addr);
471 spin_unlock_irqrestore(&pa_dbit_lock, flags);
462 472
463 return old_pte; 473 return old_pte;
464} 474}
465 475
466static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 476static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
467{ 477{
468#ifdef CONFIG_SMP 478 unsigned long flags;
469 unsigned long new, old; 479 spin_lock_irqsave(&pa_dbit_lock, flags);
470 480 set_pte(ptep, pte_wrprotect(*ptep));
471 do {
472 old = pte_val(*ptep);
473 new = pte_val(pte_wrprotect(__pte (old)));
474 } while (cmpxchg((unsigned long *) ptep, old, new) != old);
475 purge_tlb_entries(mm, addr); 481 purge_tlb_entries(mm, addr);
476#else 482 spin_unlock_irqrestore(&pa_dbit_lock, flags);
477 pte_t old_pte = *ptep;
478 set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
479#endif
480} 483}
481 484
482#define pte_same(A,B) (pte_val(A) == pte_val(B)) 485#define pte_same(A,B) (pte_val(A) == pte_val(B))
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index d1fb79a36f3d..6182832e5b6c 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -77,8 +77,6 @@ struct thread_info {
77#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 77#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
78 _TIF_BLOCKSTEP) 78 _TIF_BLOCKSTEP)
79 79
80#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
81
82#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
83 81
84#endif /* _ASM_PARISC_THREAD_INFO_H */ 82#endif /* _ASM_PARISC_THREAD_INFO_H */
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h
index 4ba2c93770f1..e0a82358517e 100644
--- a/arch/parisc/include/asm/uaccess.h
+++ b/arch/parisc/include/asm/uaccess.h
@@ -181,30 +181,24 @@ struct exception_data {
181#if !defined(CONFIG_64BIT) 181#if !defined(CONFIG_64BIT)
182 182
183#define __put_kernel_asm64(__val,ptr) do { \ 183#define __put_kernel_asm64(__val,ptr) do { \
184 u64 __val64 = (u64)(__val); \
185 u32 hi = (__val64) >> 32; \
186 u32 lo = (__val64) & 0xffffffff; \
187 __asm__ __volatile__ ( \ 184 __asm__ __volatile__ ( \
188 "\n1:\tstw %2,0(%1)" \ 185 "\n1:\tstw %2,0(%1)" \
189 "\n2:\tstw %3,4(%1)\n\t" \ 186 "\n2:\tstw %R2,4(%1)\n\t" \
190 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\ 187 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
191 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\ 188 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
192 : "=r"(__pu_err) \ 189 : "=r"(__pu_err) \
193 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \ 190 : "r"(ptr), "r"(__val), "0"(__pu_err) \
194 : "r1"); \ 191 : "r1"); \
195} while (0) 192} while (0)
196 193
197#define __put_user_asm64(__val,ptr) do { \ 194#define __put_user_asm64(__val,ptr) do { \
198 u64 __val64 = (u64)(__val); \
199 u32 hi = (__val64) >> 32; \
200 u32 lo = (__val64) & 0xffffffff; \
201 __asm__ __volatile__ ( \ 195 __asm__ __volatile__ ( \
202 "\n1:\tstw %2,0(%%sr3,%1)" \ 196 "\n1:\tstw %2,0(%%sr3,%1)" \
203 "\n2:\tstw %3,4(%%sr3,%1)\n\t" \ 197 "\n2:\tstw %R2,4(%%sr3,%1)\n\t" \
204 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\ 198 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
205 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\ 199 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
206 : "=r"(__pu_err) \ 200 : "=r"(__pu_err) \
207 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \ 201 : "r"(ptr), "r"(__val), "0"(__pu_err) \
208 : "r1"); \ 202 : "r1"); \
209} while (0) 203} while (0)
210 204
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index ae9a46cbfd92..74d835820ee7 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -170,12 +170,4 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
170 170
171#undef STR 171#undef STR
172 172
173/*
174 * "Conditional" syscalls
175 *
176 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
177 * but it doesn't work on all toolchains, so we just do it by hand
178 */
179#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
180
181#endif /* _ASM_PARISC_UNISTD_H_ */ 173#endif /* _ASM_PARISC_UNISTD_H_ */
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 4b12890642eb..83ded26cad06 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -421,14 +421,11 @@ void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
421 /* Note: purge_tlb_entries can be called at startup with 421 /* Note: purge_tlb_entries can be called at startup with
422 no context. */ 422 no context. */
423 423
424 /* Disable preemption while we play with %sr1. */
425 preempt_disable();
426 mtsp(mm->context, 1);
427 purge_tlb_start(flags); 424 purge_tlb_start(flags);
425 mtsp(mm->context, 1);
428 pdtlb(addr); 426 pdtlb(addr);
429 pitlb(addr); 427 pitlb(addr);
430 purge_tlb_end(flags); 428 purge_tlb_end(flags);
431 preempt_enable();
432} 429}
433EXPORT_SYMBOL(purge_tlb_entries); 430EXPORT_SYMBOL(purge_tlb_entries);
434 431
diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c
index 6795dc6c995f..568b2c61ea02 100644
--- a/arch/parisc/kernel/parisc_ksyms.c
+++ b/arch/parisc/kernel/parisc_ksyms.c
@@ -120,11 +120,13 @@ extern void __ashrdi3(void);
120extern void __ashldi3(void); 120extern void __ashldi3(void);
121extern void __lshrdi3(void); 121extern void __lshrdi3(void);
122extern void __muldi3(void); 122extern void __muldi3(void);
123extern void __ucmpdi2(void);
123 124
124EXPORT_SYMBOL(__ashrdi3); 125EXPORT_SYMBOL(__ashrdi3);
125EXPORT_SYMBOL(__ashldi3); 126EXPORT_SYMBOL(__ashldi3);
126EXPORT_SYMBOL(__lshrdi3); 127EXPORT_SYMBOL(__lshrdi3);
127EXPORT_SYMBOL(__muldi3); 128EXPORT_SYMBOL(__muldi3);
129EXPORT_SYMBOL(__ucmpdi2);
128 130
129asmlinkage void * __canonicalize_funcptr_for_compare(void *); 131asmlinkage void * __canonicalize_funcptr_for_compare(void *);
130EXPORT_SYMBOL(__canonicalize_funcptr_for_compare); 132EXPORT_SYMBOL(__canonicalize_funcptr_for_compare);
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index d47ba1aa8253..3e04242de5a7 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -30,11 +30,13 @@
30#endif 30#endif
31 31
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/module.h>
33#include <linux/kernel.h> 34#include <linux/kernel.h>
34#include <linux/reboot.h> 35#include <linux/reboot.h>
35#include <linux/notifier.h> 36#include <linux/notifier.h>
36#include <linux/cache.h> 37#include <linux/cache.h>
37#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/seq_file.h>
38 40
39#include <asm/pdc_chassis.h> 41#include <asm/pdc_chassis.h>
40#include <asm/processor.h> 42#include <asm/processor.h>
@@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message)
244 246
245#ifdef CONFIG_PDC_CHASSIS_WARN 247#ifdef CONFIG_PDC_CHASSIS_WARN
246#ifdef CONFIG_PROC_FS 248#ifdef CONFIG_PROC_FS
247static int pdc_chassis_warn_pread(char *page, char **start, off_t off, 249static int pdc_chassis_warn_show(struct seq_file *m, void *v)
248 int count, int *eof, void *data)
249{ 250{
250 char *out = page;
251 int len, ret;
252 unsigned long warn; 251 unsigned long warn;
253 u32 warnreg; 252 u32 warnreg;
254 253
255 ret = pdc_chassis_warn(&warn); 254 if (pdc_chassis_warn(&warn) != PDC_OK)
256 if (ret != PDC_OK)
257 return -EIO; 255 return -EIO;
258 256
259 warnreg = (warn & 0xFFFFFFFF); 257 warnreg = (warn & 0xFFFFFFFF);
260 258
261 if ((warnreg >> 24) & 0xFF) 259 if ((warnreg >> 24) & 0xFF)
262 out += sprintf(out, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", ((warnreg >> 24) & 0xFF)); 260 seq_printf(m, "Chassis component failure! (eg fan or PSU): 0x%.2x\n",
263 261 (warnreg >> 24) & 0xFF);
264 out += sprintf(out, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK"); 262
265 out += sprintf(out, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK"); 263 seq_printf(m, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
266 out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK"); 264 seq_printf(m, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
267 265 seq_printf(m, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
268 len = out - page - off; 266 return 0;
269 if (len < count) { 267}
270 *eof = 1; 268
271 if (len <= 0) return 0; 269static int pdc_chassis_warn_open(struct inode *inode, struct file *file)
272 } else { 270{
273 len = count; 271 return single_open(file, pdc_chassis_warn_show, NULL);
274 }
275 *start = page + off;
276 return len;
277} 272}
278 273
274static const struct file_operations pdc_chassis_warn_fops = {
275 .open = pdc_chassis_warn_open,
276 .read = seq_read,
277 .llseek = seq_lseek,
278 .release = single_release,
279};
280
279static int __init pdc_chassis_create_procfs(void) 281static int __init pdc_chassis_create_procfs(void)
280{ 282{
281 unsigned long test; 283 unsigned long test;
@@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void)
290 292
291 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", 293 printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
292 PDC_CHASSIS_VER); 294 PDC_CHASSIS_VER);
293 create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread, 295 proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops);
294 NULL);
295 return 0; 296 return 0;
296} 297}
297 298
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index d13507246c5d..55f92b614182 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -59,28 +59,6 @@
59#include <asm/unwind.h> 59#include <asm/unwind.h>
60#include <asm/sections.h> 60#include <asm/sections.h>
61 61
62/*
63 * The idle thread. There's no useful work to be
64 * done, so just try to conserve power and have a
65 * low exit latency (ie sit in a loop waiting for
66 * somebody to say that they'd like to reschedule)
67 */
68void cpu_idle(void)
69{
70 set_thread_flag(TIF_POLLING_NRFLAG);
71
72 /* endless idle loop with no priority at all */
73 while (1) {
74 rcu_idle_enter();
75 while (!need_resched())
76 barrier();
77 rcu_idle_exit();
78 schedule_preempt_disabled();
79 check_pgt_cache();
80 }
81}
82
83
84#define COMMAND_GLOBAL F_EXTEND(0xfffe0030) 62#define COMMAND_GLOBAL F_EXTEND(0xfffe0030)
85#define CMD_RESET 5 /* reset any module */ 63#define CMD_RESET 5 /* reset any module */
86 64
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 6266730efd61..fd1bb1519c2b 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -329,7 +329,7 @@ void __init smp_callin(void)
329 329
330 local_irq_enable(); /* Interrupts have been off until now */ 330 local_irq_enable(); /* Interrupts have been off until now */
331 331
332 cpu_idle(); /* Wait for timer to schedule some work */ 332 cpu_startup_entry(CPUHP_ONLINE);
333 333
334 /* NOTREACHED */ 334 /* NOTREACHED */
335 panic("smp_callin() AAAAaaaaahhhh....\n"); 335 panic("smp_callin() AAAAaaaaahhhh....\n");
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 051c8b90231f..f517e08e7f0d 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -60,47 +60,6 @@ asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
60 return -ENOSYS; 60 return -ENOSYS;
61} 61}
62 62
63/* Note: it is necessary to treat out_fd and in_fd as unsigned ints, with the
64 * corresponding cast to a signed int to insure that the proper conversion
65 * (sign extension) between the register representation of a signed int (msr in
66 * 32-bit mode) and the register representation of a signed int (msr in 64-bit
67 * mode) is performed.
68 */
69asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd,
70 compat_off_t __user *offset, compat_size_t count)
71{
72 return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
73}
74
75asmlinkage long sys32_sendfile64(u32 out_fd, u32 in_fd,
76 compat_loff_t __user *offset, compat_size_t count)
77{
78 return sys_sendfile64((int)out_fd, (int)in_fd,
79 (loff_t __user *)offset, count);
80}
81
82asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
83{
84 union semun u;
85
86 if (cmd == SETVAL) {
87 /* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
88 * The int should be in the first 4, but our argument
89 * frobbing has left it in the last 4.
90 */
91 u.val = *((int *)&arg + 1);
92 return sys_semctl (semid, semnum, cmd, u);
93 }
94 return sys_semctl (semid, semnum, cmd, arg);
95}
96
97long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
98 size_t len)
99{
100 return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
101 buf, len);
102}
103
104asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi, 63asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi,
105 u32 mask_lo, int fd, 64 u32 mask_lo, int fd,
106 const char __user *pathname) 65 const char __user *pathname)
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index f57dc137b8dd..0c9107285e66 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -198,7 +198,7 @@
198 ENTRY_SAME(madvise) 198 ENTRY_SAME(madvise)
199 ENTRY_SAME(clone_wrapper) /* 120 */ 199 ENTRY_SAME(clone_wrapper) /* 120 */
200 ENTRY_SAME(setdomainname) 200 ENTRY_SAME(setdomainname)
201 ENTRY_DIFF(sendfile) 201 ENTRY_COMP(sendfile)
202 /* struct sockaddr... */ 202 /* struct sockaddr... */
203 ENTRY_SAME(recvfrom) 203 ENTRY_SAME(recvfrom)
204 /* struct timex contains longs */ 204 /* struct timex contains longs */
@@ -282,7 +282,7 @@
282 ENTRY_COMP(recvmsg) 282 ENTRY_COMP(recvmsg)
283 ENTRY_SAME(semop) /* 185 */ 283 ENTRY_SAME(semop) /* 185 */
284 ENTRY_SAME(semget) 284 ENTRY_SAME(semget)
285 ENTRY_DIFF(semctl) 285 ENTRY_COMP(semctl)
286 ENTRY_COMP(msgsnd) 286 ENTRY_COMP(msgsnd)
287 ENTRY_COMP(msgrcv) 287 ENTRY_COMP(msgrcv)
288 ENTRY_SAME(msgget) /* 190 */ 288 ENTRY_SAME(msgget) /* 190 */
@@ -304,7 +304,7 @@
304 ENTRY_SAME(gettid) 304 ENTRY_SAME(gettid)
305 ENTRY_OURS(readahead) 305 ENTRY_OURS(readahead)
306 ENTRY_SAME(tkill) 306 ENTRY_SAME(tkill)
307 ENTRY_DIFF(sendfile64) 307 ENTRY_COMP(sendfile64)
308 ENTRY_COMP(futex) /* 210 */ 308 ENTRY_COMP(futex) /* 210 */
309 ENTRY_COMP(sched_setaffinity) 309 ENTRY_COMP(sched_setaffinity)
310 ENTRY_COMP(sched_getaffinity) 310 ENTRY_COMP(sched_getaffinity)
@@ -318,7 +318,7 @@
318 ENTRY_SAME(alloc_hugepages) /* 220 */ 318 ENTRY_SAME(alloc_hugepages) /* 220 */
319 ENTRY_SAME(free_hugepages) 319 ENTRY_SAME(free_hugepages)
320 ENTRY_SAME(exit_group) 320 ENTRY_SAME(exit_group)
321 ENTRY_DIFF(lookup_dcookie) 321 ENTRY_COMP(lookup_dcookie)
322 ENTRY_SAME(epoll_create) 322 ENTRY_SAME(epoll_create)
323 ENTRY_SAME(epoll_ctl) /* 225 */ 323 ENTRY_SAME(epoll_ctl) /* 225 */
324 ENTRY_SAME(epoll_wait) 324 ENTRY_SAME(epoll_wait)
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index aeb8f8f2c07a..f702bff0bed9 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -126,6 +126,8 @@ void show_regs(struct pt_regs *regs)
126 user = user_mode(regs); 126 user = user_mode(regs);
127 level = user ? KERN_DEBUG : KERN_CRIT; 127 level = user ? KERN_DEBUG : KERN_CRIT;
128 128
129 show_regs_print_info(level);
130
129 print_gr(level, regs); 131 print_gr(level, regs);
130 132
131 for (i = 0; i < 8; i += 4) 133 for (i = 0; i < 8; i += 4)
@@ -158,14 +160,6 @@ void show_regs(struct pt_regs *regs)
158 } 160 }
159} 161}
160 162
161
162void dump_stack(void)
163{
164 show_stack(NULL, NULL);
165}
166
167EXPORT_SYMBOL(dump_stack);
168
169static void do_show_stack(struct unwind_frame_info *info) 163static void do_show_stack(struct unwind_frame_info *info)
170{ 164{
171 int i = 1; 165 int i = 1;
diff --git a/arch/parisc/lib/Makefile b/arch/parisc/lib/Makefile
index 5f2e6904d14a..5651536ac733 100644
--- a/arch/parisc/lib/Makefile
+++ b/arch/parisc/lib/Makefile
@@ -2,6 +2,7 @@
2# Makefile for parisc-specific library files 2# Makefile for parisc-specific library files
3# 3#
4 4
5lib-y := lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o 5lib-y := lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o \
6 ucmpdi2.o
6 7
7obj-y := iomap.o 8obj-y := iomap.o
diff --git a/arch/parisc/lib/ucmpdi2.c b/arch/parisc/lib/ucmpdi2.c
new file mode 100644
index 000000000000..149c016f32c5
--- /dev/null
+++ b/arch/parisc/lib/ucmpdi2.c
@@ -0,0 +1,25 @@
1#include <linux/module.h>
2
3union ull_union {
4 unsigned long long ull;
5 struct {
6 unsigned int high;
7 unsigned int low;
8 } ui;
9};
10
11int __ucmpdi2(unsigned long long a, unsigned long long b)
12{
13 union ull_union au = {.ull = a};
14 union ull_union bu = {.ull = b};
15
16 if (au.ui.high < bu.ui.high)
17 return 0;
18 else if (au.ui.high > bu.ui.high)
19 return 2;
20 if (au.ui.low < bu.ui.low)
21 return 0;
22 else if (au.ui.low > bu.ui.low)
23 return 2;
24 return 1;
25}
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 3ac462de53a4..157b931e7b09 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -505,7 +505,6 @@ static void __init map_pages(unsigned long start_vaddr,
505 505
506void free_initmem(void) 506void free_initmem(void)
507{ 507{
508 unsigned long addr;
509 unsigned long init_begin = (unsigned long)__init_begin; 508 unsigned long init_begin = (unsigned long)__init_begin;
510 unsigned long init_end = (unsigned long)__init_end; 509 unsigned long init_end = (unsigned long)__init_end;
511 510
@@ -533,19 +532,10 @@ void free_initmem(void)
533 * pages are no-longer executable */ 532 * pages are no-longer executable */
534 flush_icache_range(init_begin, init_end); 533 flush_icache_range(init_begin, init_end);
535 534
536 for (addr = init_begin; addr < init_end; addr += PAGE_SIZE) { 535 num_physpages += free_initmem_default(0);
537 ClearPageReserved(virt_to_page(addr));
538 init_page_count(virt_to_page(addr));
539 free_page(addr);
540 num_physpages++;
541 totalram_pages++;
542 }
543 536
544 /* set up a new led state on systems shipped LED State panel */ 537 /* set up a new led state on systems shipped LED State panel */
545 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); 538 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);
546
547 printk(KERN_INFO "Freeing unused kernel memory: %luk freed\n",
548 (init_end - init_begin) >> 10);
549} 539}
550 540
551 541
@@ -697,6 +687,8 @@ void show_mem(unsigned int filter)
697 687
698 printk(KERN_INFO "Mem-info:\n"); 688 printk(KERN_INFO "Mem-info:\n");
699 show_free_areas(filter); 689 show_free_areas(filter);
690 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
691 return;
700#ifndef CONFIG_DISCONTIGMEM 692#ifndef CONFIG_DISCONTIGMEM
701 i = max_mapnr; 693 i = max_mapnr;
702 while (i-- > 0) { 694 while (i-- > 0) {
@@ -1107,15 +1099,6 @@ void flush_tlb_all(void)
1107#ifdef CONFIG_BLK_DEV_INITRD 1099#ifdef CONFIG_BLK_DEV_INITRD
1108void free_initrd_mem(unsigned long start, unsigned long end) 1100void free_initrd_mem(unsigned long start, unsigned long end)
1109{ 1101{
1110 if (start >= end) 1102 num_physpages += free_reserved_area(start, end, 0, "initrd");
1111 return;
1112 printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
1113 for (; start < end; start += PAGE_SIZE) {
1114 ClearPageReserved(virt_to_page(start));
1115 init_page_count(virt_to_page(start));
1116 free_page(start);
1117 num_physpages++;
1118 totalram_pages++;
1119 }
1120} 1103}
1121#endif 1104#endif
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ea5bb045983a..bbbe02197afb 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -114,7 +114,6 @@ config PPC
114 select USE_GENERIC_SMP_HELPERS if SMP 114 select USE_GENERIC_SMP_HELPERS if SMP
115 select HAVE_OPROFILE 115 select HAVE_OPROFILE
116 select HAVE_DEBUG_KMEMLEAK 116 select HAVE_DEBUG_KMEMLEAK
117 select HAVE_SYSCALL_WRAPPERS if PPC64
118 select GENERIC_ATOMIC64 if PPC32 117 select GENERIC_ATOMIC64 if PPC32
119 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 118 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
120 select HAVE_PERF_EVENTS 119 select HAVE_PERF_EVENTS
@@ -428,11 +427,6 @@ config NODES_SHIFT
428 default "4" 427 default "4"
429 depends on NEED_MULTIPLE_NODES 428 depends on NEED_MULTIPLE_NODES
430 429
431config MAX_ACTIVE_REGIONS
432 int
433 default "256" if PPC64
434 default "32"
435
436config ARCH_SELECT_MEMORY_MODEL 430config ARCH_SELECT_MEMORY_MODEL
437 def_bool y 431 def_bool y
438 depends on PPC64 432 depends on PPC64
@@ -647,14 +641,14 @@ menu "Bus options"
647 641
648config ISA 642config ISA
649 bool "Support for ISA-bus hardware" 643 bool "Support for ISA-bus hardware"
650 depends on PPC_PREP || PPC_CHRP 644 depends on PPC_CHRP
651 select PPC_I8259 645 select PPC_I8259
652 help 646 help
653 Find out whether you have ISA slots on your motherboard. ISA is the 647 Find out whether you have ISA slots on your motherboard. ISA is the
654 name of a bus system, i.e. the way the CPU talks to the other stuff 648 name of a bus system, i.e. the way the CPU talks to the other stuff
655 inside your box. If you have an Apple machine, say N here; if you 649 inside your box. If you have an Apple machine, say N here; if you
656 have an IBM RS/6000 or pSeries machine or a PReP machine, say Y. If 650 have an IBM RS/6000 or pSeries machine, say Y. If you have an
657 you have an embedded board, consult your board documentation. 651 embedded board, consult your board documentation.
658 652
659config ZONE_DMA 653config ZONE_DMA
660 bool 654 bool
@@ -686,7 +680,6 @@ config SBUS
686config FSL_SOC 680config FSL_SOC
687 bool 681 bool
688 select HAVE_CAN_FLEXCAN if NET && CAN 682 select HAVE_CAN_FLEXCAN if NET && CAN
689 select PPC_CLOCK
690 683
691config FSL_PCI 684config FSL_PCI
692 bool 685 bool
@@ -745,7 +738,6 @@ config PCI
745 bool "PCI support" if PPC_PCI_CHOICE 738 bool "PCI support" if PPC_PCI_CHOICE
746 default y if !40x && !CPM2 && !8xx && !PPC_83xx \ 739 default y if !40x && !CPM2 && !8xx && !PPC_83xx \
747 && !PPC_85xx && !PPC_86xx && !GAMECUBE_COMMON 740 && !PPC_85xx && !PPC_86xx && !GAMECUBE_COMMON
748 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
749 default PCI_QSPAN if !4xx && !CPM2 && 8xx 741 default PCI_QSPAN if !4xx && !CPM2 && 8xx
750 select ARCH_SUPPORTS_MSI 742 select ARCH_SUPPORTS_MSI
751 select GENERIC_PCI_IOMAP 743 select GENERIC_PCI_IOMAP
@@ -775,11 +767,6 @@ config PCI_8260
775 select PPC_INDIRECT_PCI 767 select PPC_INDIRECT_PCI
776 default y 768 default y
777 769
778config 8260_PCI9
779 bool "Enable workaround for MPC826x erratum PCI 9"
780 depends on PCI_8260 && !8272
781 default y
782
783source "drivers/pci/pcie/Kconfig" 770source "drivers/pci/pcie/Kconfig"
784 771
785source "drivers/pci/Kconfig" 772source "drivers/pci/Kconfig"
@@ -969,7 +956,7 @@ config TASK_SIZE_BOOL
969 956
970config TASK_SIZE 957config TASK_SIZE
971 hex "Size of user task space" if TASK_SIZE_BOOL 958 hex "Size of user task space" if TASK_SIZE_BOOL
972 default "0x80000000" if PPC_PREP || PPC_8xx 959 default "0x80000000" if PPC_8xx
973 default "0xc0000000" 960 default "0xc0000000"
974 961
975config CONSISTENT_SIZE_BOOL 962config CONSISTENT_SIZE_BOOL
diff --git a/arch/powerpc/boot/dts/ac14xx.dts b/arch/powerpc/boot/dts/ac14xx.dts
new file mode 100644
index 000000000000..a27a4609bb42
--- /dev/null
+++ b/arch/powerpc/boot/dts/ac14xx.dts
@@ -0,0 +1,392 @@
1/*
2 * Device Tree Source for the MPC5121e based ac14xx board
3 *
4 * Copyright 2012 Anatolij Gustschin <agust@denx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12
13/include/ "mpc5121.dtsi"
14
15/ {
16 model = "ac14xx";
17 compatible = "ifm,ac14xx", "fsl,mpc5121";
18 #address-cells = <1>;
19 #size-cells = <1>;
20
21 aliases {
22 serial0 = &serial0;
23 serial1 = &serial7;
24 spi4 = &spi4;
25 spi5 = &spi5;
26 };
27
28 cpus {
29 PowerPC,5121@0 {
30 timebase-frequency = <40000000>; /* 40 MHz (csb/4) */
31 bus-frequency = <160000000>; /* 160 MHz csb bus */
32 clock-frequency = <400000000>; /* 400 MHz ppc core */
33 };
34 };
35
36 memory {
37 reg = <0x00000000 0x10000000>; /* 256MB at 0 */
38 };
39
40 nfc@40000000 {
41 status = "disabled";
42 };
43
44 localbus@80000020 {
45 ranges = <0x0 0x0 0xfc000000 0x04000000 /* CS0: NOR flash */
46 0x1 0x0 0xe0000000 0x00010000 /* CS1: FRAM */
47 0x2 0x0 0xe0100000 0x00080000 /* CS2: asi1 */
48 0x3 0x0 0xe0300000 0x00020000 /* CS3: comm */
49 0x5 0x0 0xe0400000 0x00010000 /* CS5: safety */
50 0x6 0x0 0xe0200000 0x00080000>; /* CS6: asi2 */
51
52 flash@0,0 {
53 compatible = "cfi-flash";
54 reg = <0 0x00000000 0x04000000>;
55 #address-cells = <1>;
56 #size-cells = <1>;
57 bank-width = <2>;
58 device-width = <2>;
59
60 partition@0 {
61 label = "dtb-kernel-production";
62 reg = <0x00000000 0x00400000>;
63 };
64 partition@1 {
65 label = "filesystem-production";
66 reg = <0x00400000 0x03400000>;
67 };
68
69 partition@2 {
70 label = "recovery";
71 reg = <0x03800000 0x00700000>;
72 };
73
74 partition@3 {
75 label = "uboot-code";
76 reg = <0x03f00000 0x00040000>;
77 };
78 partition@4 {
79 label = "uboot-env1";
80 reg = <0x03f40000 0x00020000>;
81 };
82 partition@5 {
83 label = "uboot-env2";
84 reg = <0x03f60000 0x00020000>;
85 };
86 };
87
88 fram@1,0 {
89 compatible = "ifm,ac14xx-fram", "linux,uio-pdrv-genirq";
90 reg = <1 0x00000000 0x00010000>;
91 };
92
93 asi@2,0 {
94 /* masters mapping: CS, CS offset, size */
95 reg = <2 0x00000000 0x00080000
96 6 0x00000000 0x00080000>;
97 #address-cells = <1>;
98 #size-cells = <1>;
99 compatible = "ifm,ac14xx-asi-fpga";
100 gpios = <
101 &gpio_pic 26 0 /* prog */
102 &gpio_pic 27 0 /* done */
103 &gpio_pic 10 0 /* reset */
104 >;
105
106 master@1 {
107 interrupts = <20 0x2>;
108 interrupt-parent = <&gpio_pic>;
109 chipselect = <2 0x00009000 0x00009100>;
110 label = "AS-i master 1";
111 };
112
113 master@2 {
114 interrupts = <21 0x2>;
115 interrupt-parent = <&gpio_pic>;
116 chipselect = <6 0x00009000 0x00009100>;
117 label = "AS-i master 2";
118 };
119 };
120
121 netx@3,0 {
122 compatible = "ifm,netx";
123 reg = <0x3 0x00000000 0x00020000>;
124 chipselect = <3 0x00101140 0x00203100>;
125 interrupts = <17 0x8>;
126 gpios = <&gpio_pic 15 0>;
127 };
128
129 safety@5,0 {
130 compatible = "ifm,safety";
131 reg = <0x5 0x00000000 0x00010000>;
132 chipselect = <5 0x00009000 0x00009100>;
133 interrupts = <22 0x2>;
134 interrupt-parent = <&gpio_pic>;
135 gpios = <
136 &gpio_pic 12 0 /* prog */
137 &gpio_pic 11 0 /* done */
138 >;
139 };
140 };
141
142 soc@80000000 {
143
144 clock@f00 {
145 compatible = "fsl,mpc5121rev2-clock", "fsl,mpc5121-clock";
146 };
147
148 /*
149 * GPIO PIC:
150 * interrupts cell = <pin nr, sense>
151 * sense == 8: Level, low assertion
152 * sense == 2: Edge, high-to-low change
153 */
154 gpio_pic: gpio@1100 {
155 gpio-controller;
156 #gpio-cells = <2>;
157 interrupt-controller;
158 #interrupt-cells = <2>;
159 };
160
161 sdhc@1500 {
162 cd-gpios = <&gpio_pic 23 0>; /* card detect */
163 wp-gpios = <&gpio_pic 24 0>; /* write protect */
164 wp-inverted; /* WP active high */
165 };
166
167 i2c@1700 {
168 /* use Fast-mode */
169 clock-frequency = <400000>;
170
171 at24@30 {
172 compatible = "at24,24c01";
173 reg = <0x30>;
174 };
175
176 at24@31 {
177 compatible = "at24,24c01";
178 reg = <0x31>;
179 };
180
181 temp@48 {
182 compatible = "ad,ad7414";
183 reg = <0x48>;
184 };
185
186 at24@50 {
187 compatible = "at24,24c01";
188 reg = <0x50>;
189 };
190
191 at24@51 {
192 compatible = "at24,24c01";
193 reg = <0x51>;
194 };
195
196 at24@52 {
197 compatible = "at24,24c01";
198 reg = <0x52>;
199 };
200
201 at24@53 {
202 compatible = "at24,24c01";
203 reg = <0x53>;
204 };
205
206 at24@54 {
207 compatible = "at24,24c01";
208 reg = <0x54>;
209 };
210
211 at24@55 {
212 compatible = "at24,24c01";
213 reg = <0x55>;
214 };
215
216 at24@56 {
217 compatible = "at24,24c01";
218 reg = <0x56>;
219 };
220
221 at24@57 {
222 compatible = "at24,24c01";
223 reg = <0x57>;
224 };
225
226 rtc@68 {
227 compatible = "stm,m41t00";
228 reg = <0x68>;
229 };
230 };
231
232 axe_pic: axe-base@2000 {
233 compatible = "fsl,mpc5121-axe-base";
234 reg = <0x2000 0x100>;
235 interrupts = <42 0x8>;
236 interrupt-controller;
237 #interrupt-cells = <2>;
238 };
239
240 axe-app {
241 compatible = "fsl,mpc5121-axe-app";
242 interrupt-parent = <&axe_pic>;
243 interrupts = <
244 /* soft interrupts */
245 0 0x0 1 0x0 2 0x0 3 0x0
246 4 0x0 5 0x0 6 0x0 7 0x0
247 /* fifo interrupts */
248 8 0x0 9 0x0 10 0x0 11 0x0
249 >;
250 };
251
252 display@2100 {
253 edid = [00 FF FF FF FF FF FF 00 14 94 00 00 00 00 00 00
254 0A 12 01 03 80 1C 23 78 CA 88 FF 94 52 54 8E 27
255 1E 4C 50 00 00 00 01 01 01 01 01 01 01 01 01 01
256 01 01 01 01 01 01 FB 00 B0 14 00 DC 05 00 08 04
257 21 00 1C 23 00 00 00 18 00 00 00 FD 00 38 3C 1F
258 3C 01 0A 20 20 20 20 20 20 20 00 00 00 FC 00 45
259 54 30 31 38 30 30 33 44 4D 55 0A 0A 00 00 00 10
260 00 41 30 30 30 30 30 30 30 30 30 30 30 31 00 D5];
261 };
262
263 can@2300 {
264 status = "disabled";
265 };
266
267 can@2380 {
268 status = "disabled";
269 };
270
271 viu@2400 {
272 status = "disabled";
273 };
274
275 mdio@2800 {
276 phy0: ethernet-phy@1f {
277 compatible = "smsc,lan8700";
278 reg = <0x1f>;
279 };
280 };
281
282 enet: ethernet@2800 {
283 phy-handle = <&phy0>;
284 };
285
286 usb@3000 {
287 status = "disabled";
288 };
289
290 usb@4000 {
291 status = "disabled";
292 };
293
294 /* PSC3 serial port A, aka ttyPSC0 */
295 serial0: psc@11300 {
296 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
297 fsl,rx-fifo-size = <512>;
298 fsl,tx-fifo-size = <512>;
299 };
300
301 /* PSC4 in SPI mode */
302 spi4: psc@11400 {
303 compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
304 fsl,rx-fifo-size = <768>;
305 fsl,tx-fifo-size = <768>;
306 #address-cells = <1>;
307 #size-cells = <0>;
308 num-cs = <1>;
309 cs-gpios = <&gpio_pic 25 0>;
310
311 flash: m25p128@0 {
312 compatible = "st,m25p128";
313 spi-max-frequency = <20000000>;
314 reg = <0>;
315 #address-cells = <1>;
316 #size-cells = <1>;
317
318 partition@0 {
319 label = "spi-flash0";
320 reg = <0x00000000 0x01000000>;
321 };
322 };
323 };
324
325 /* PSC5 in SPI mode */
326 spi5: psc@11500 {
327 compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
328 fsl,mode = "spi-master";
329 fsl,rx-fifo-size = <128>;
330 fsl,tx-fifo-size = <128>;
331 #address-cells = <1>;
332 #size-cells = <0>;
333
334 lcd@0 {
335 compatible = "ilitek,ili922x";
336 reg = <0>;
337 spi-max-frequency = <100000>;
338 spi-cpol;
339 spi-cpha;
340 };
341 };
342
343 /* PSC7 serial port C, aka ttyPSC2 */
344 serial7: psc@11700 {
345 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
346 fsl,rx-fifo-size = <512>;
347 fsl,tx-fifo-size = <512>;
348 };
349
350 matrix_keypad@0 {
351 compatible = "gpio-matrix-keypad";
352 debounce-delay-ms = <5>;
353 col-scan-delay-us = <1>;
354 gpio-activelow;
355 col-gpios-binary;
356 col-switch-delay-ms = <200>;
357
358 col-gpios = <&gpio_pic 1 0>; /* pin1 */
359
360 row-gpios = <&gpio_pic 2 0 /* pin2 */
361 &gpio_pic 3 0 /* pin3 */
362 &gpio_pic 4 0>; /* pin4 */
363
364 linux,keymap = <0x0000006e /* FN LEFT */
365 0x01000067 /* UP */
366 0x02000066 /* FN RIGHT */
367 0x00010069 /* LEFT */
368 0x0101006a /* DOWN */
369 0x0201006c>; /* RIGHT */
370 };
371 };
372
373 leds {
374 compatible = "gpio-leds";
375
376 backlight {
377 label = "backlight";
378 gpios = <&gpio_pic 0 0>;
379 default-state = "keep";
380 };
381 green {
382 label = "green";
383 gpios = <&gpio_pic 18 0>;
384 default-state = "keep";
385 };
386 red {
387 label = "red";
388 gpios = <&gpio_pic 19 0>;
389 default-state = "keep";
390 };
391 };
392};
diff --git a/arch/powerpc/boot/dts/b4420qds.dts b/arch/powerpc/boot/dts/b4420qds.dts
new file mode 100644
index 000000000000..923156d03b30
--- /dev/null
+++ b/arch/powerpc/boot/dts/b4420qds.dts
@@ -0,0 +1,50 @@
1/*
2 * B4420DS Device Tree Source
3 *
4 * Copyright 2012 Freescale Semiconductor, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * This software is provided by Freescale Semiconductor "as is" and any
24 * express or implied warranties, including, but not limited to, the implied
25 * warranties of merchantability and fitness for a particular purpose are
26 * disclaimed. In no event shall Freescale Semiconductor be liable for any
27 * direct, indirect, incidental, special, exemplary, or consequential damages
28 * (including, but not limited to, procurement of substitute goods or services;
29 * loss of use, data, or profits; or business interruption) however caused and
30 * on any theory of liability, whether in contract, strict liability, or tort
31 * (including negligence or otherwise) arising in any way out of the use of
32 * this software, even if advised of the possibility of such damage.
33 */
34
35/include/ "fsl/b4420si-pre.dtsi"
36/include/ "b4qds.dts"
37
38/ {
39 model = "fsl,B4420QDS";
40 compatible = "fsl,B4420QDS";
41
42 ifc: localbus@ffe124000 {
43 board-control@3,0 {
44 compatible = "fsl,b4420qds-fpga", "fsl,fpga-qixis";
45 };
46 };
47
48};
49
50/include/ "fsl/b4420si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/b4860qds.dts b/arch/powerpc/boot/dts/b4860qds.dts
new file mode 100644
index 000000000000..78907f38bb77
--- /dev/null
+++ b/arch/powerpc/boot/dts/b4860qds.dts
@@ -0,0 +1,61 @@
1/*
2 * B4860DS Device Tree Source
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/b4860si-pre.dtsi"
36/include/ "b4qds.dts"
37
38/ {
39 model = "fsl,B4860QDS";
40 compatible = "fsl,B4860QDS";
41
42 ifc: localbus@ffe124000 {
43 board-control@3,0 {
44 compatible = "fsl,b4860qds-fpga", "fsl,fpga-qixis";
45 };
46 };
47
48 rio: rapidio@ffe0c0000 {
49 reg = <0xf 0xfe0c0000 0 0x11000>;
50
51 port1 {
52 ranges = <0 0 0xc 0x20000000 0 0x10000000>;
53 };
54 port2 {
55 ranges = <0 0 0xc 0x30000000 0 0x10000000>;
56 };
57 };
58
59};
60
61/include/ "fsl/b4860si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/b4qds.dts b/arch/powerpc/boot/dts/b4qds.dts
new file mode 100644
index 000000000000..e6d2f8f90544
--- /dev/null
+++ b/arch/powerpc/boot/dts/b4qds.dts
@@ -0,0 +1,169 @@
1/*
2 * B4420DS Device Tree Source
3 *
4 * Copyright 2012 Freescale Semiconductor, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * This software is provided by Freescale Semiconductor "as is" and any
24 * express or implied warranties, including, but not limited to, the implied
25 * warranties of merchantability and fitness for a particular purpose are
26 * disclaimed. In no event shall Freescale Semiconductor be liable for any
27 * direct, indirect, incidental, special, exemplary, or consequential damages
28 * (including, but not limited to, procurement of substitute goods or services;
29 * loss of use, data, or profits; or business interruption) however caused and
30 * on any theory of liability, whether in contract, strict liability, or tort
31 * (including negligence or otherwise) arising in any way out of the use of
32 * this software, even if advised of the possibility of such damage.
33 */
34
35/ {
36 model = "fsl,B4QDS";
37 compatible = "fsl,B4QDS";
38 #address-cells = <2>;
39 #size-cells = <2>;
40 interrupt-parent = <&mpic>;
41
42 ifc: localbus@ffe124000 {
43 reg = <0xf 0xfe124000 0 0x2000>;
44 ranges = <0 0 0xf 0xe8000000 0x08000000
45 2 0 0xf 0xff800000 0x00010000
46 3 0 0xf 0xffdf0000 0x00008000>;
47
48 nor@0,0 {
49 #address-cells = <1>;
50 #size-cells = <1>;
51 compatible = "cfi-flash";
52 reg = <0x0 0x0 0x8000000>;
53 bank-width = <2>;
54 device-width = <1>;
55 };
56
57 nand@2,0 {
58 #address-cells = <1>;
59 #size-cells = <1>;
60 compatible = "fsl,ifc-nand";
61 reg = <0x2 0x0 0x10000>;
62
63 partition@0 {
64 /* This location must not be altered */
65 /* 1MB for u-boot Bootloader Image */
66 reg = <0x0 0x00100000>;
67 label = "NAND U-Boot Image";
68 read-only;
69 };
70
71 partition@100000 {
72 /* 1MB for DTB Image */
73 reg = <0x00100000 0x00100000>;
74 label = "NAND DTB Image";
75 };
76
77 partition@200000 {
78 /* 10MB for Linux Kernel Image */
79 reg = <0x00200000 0x00A00000>;
80 label = "NAND Linux Kernel Image";
81 };
82
83 partition@c00000 {
84 /* 500MB for Root file System Image */
85 reg = <0x00c00000 0x1F400000>;
86 label = "NAND RFS Image";
87 };
88 };
89
90 board-control@3,0 {
91 compatible = "fsl,b4qds-fpga", "fsl,fpga-qixis";
92 reg = <3 0 0x300>;
93 };
94 };
95
96 memory {
97 device_type = "memory";
98 };
99
100 dcsr: dcsr@f00000000 {
101 ranges = <0x00000000 0xf 0x00000000 0x01052000>;
102 };
103
104 soc: soc@ffe000000 {
105 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
106 reg = <0xf 0xfe000000 0 0x00001000>;
107 spi@110000 {
108 flash@0 {
109 #address-cells = <1>;
110 #size-cells = <1>;
111 compatible = "sst,sst25wf040";
112 reg = <0>;
113 spi-max-frequency = <40000000>; /* input clock */
114 };
115 };
116
117 sdhc@114000 {
118 /*Disabled as there is no sdhc connector on B4420QDS board*/
119 status = "disabled";
120 };
121
122 i2c@118000 {
123 eeprom@50 {
124 compatible = "at24,24c64";
125 reg = <0x50>;
126 };
127 eeprom@51 {
128 compatible = "at24,24c256";
129 reg = <0x51>;
130 };
131 eeprom@53 {
132 compatible = "at24,24c256";
133 reg = <0x53>;
134 };
135 eeprom@57 {
136 compatible = "at24,24c256";
137 reg = <0x57>;
138 };
139 rtc@68 {
140 compatible = "dallas,ds3232";
141 reg = <0x68>;
142 };
143 };
144
145 usb@210000 {
146 dr_mode = "host";
147 phy_type = "ulpi";
148 };
149
150 };
151
152 pci0: pcie@ffe200000 {
153 reg = <0xf 0xfe200000 0 0x10000>;
154 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
155 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
156 pcie@0 {
157 ranges = <0x02000000 0 0xe0000000
158 0x02000000 0 0xe0000000
159 0 0x20000000
160
161 0x01000000 0 0x00000000
162 0x01000000 0 0x00000000
163 0 0x00010000>;
164 };
165 };
166
167};
168
169/include/ "fsl/b4si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi
new file mode 100644
index 000000000000..5a6615d0ade2
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/b4420si-post.dtsi
@@ -0,0 +1,98 @@
1/*
2 * B4420 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2012 Freescale Semiconductor, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * This software is provided by Freescale Semiconductor "as is" and any
24 * express or implied warranties, including, but not limited to, the implied
25 * warranties of merchantability and fitness for a particular purpose are
26 * disclaimed. In no event shall Freescale Semiconductor be liable for any
27 * direct, indirect, incidental, special, exemplary, or consequential damages
28 * (including, but not limited to, procurement of substitute goods or services;
29 * loss of use, data, or profits; or business interruption) however caused and
30 * on any theory of liability, whether in contract, strict liability, or tort
31 * (including negligence or otherwise) arising in any way out of the use of
32 * this software, even if advised of the possibility of such damage.
33 */
34
35/include/ "b4si-post.dtsi"
36
37/* controller at 0x200000 */
38&pci0 {
39 compatible = "fsl,b4420-pcie", "fsl,qoriq-pcie-v2.4";
40};
41
42&dcsr {
43 dcsr-epu@0 {
44 compatible = "fsl,b4420-dcsr-epu", "fsl,dcsr-epu";
45 };
46 dcsr-npc {
47 compatible = "fsl,b4420-dcsr-cnpc", "fsl,dcsr-cnpc";
48 };
49 dcsr-dpaa@9000 {
50 compatible = "fsl,b4420-dcsr-dpaa", "fsl,dcsr-dpaa";
51 };
52 dcsr-ocn@11000 {
53 compatible = "fsl,b4420-dcsr-ocn", "fsl,dcsr-ocn";
54 };
55 dcsr-nal@18000 {
56 compatible = "fsl,b4420-dcsr-nal", "fsl,dcsr-nal";
57 };
58 dcsr-rcpm@22000 {
59 compatible = "fsl,b4420-dcsr-rcpm", "fsl,dcsr-rcpm";
60 };
61 dcsr-snpc@30000 {
62 compatible = "fsl,b4420-dcsr-snpc", "fsl,dcsr-snpc";
63 };
64 dcsr-snpc@31000 {
65 compatible = "fsl,b4420-dcsr-snpc", "fsl,dcsr-snpc";
66 };
67 dcsr-cpu-sb-proxy@108000 {
68 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
69 cpu-handle = <&cpu1>;
70 reg = <0x108000 0x1000 0x109000 0x1000>;
71 };
72};
73
74&soc {
75 cpc: l3-cache-controller@10000 {
76 compatible = "fsl,b4420-l3-cache-controller", "cache";
77 };
78
79 corenet-cf@18000 {
80 compatible = "fsl,b4420-corenet-cf";
81 };
82
83 guts: global-utilities@e0000 {
84 compatible = "fsl,b4420-device-config", "fsl,qoriq-device-config-2.0";
85 };
86
87 clockgen: global-utilities@e1000 {
88 compatible = "fsl,b4420-clockgen", "fsl,qoriq-clockgen-2.0";
89 };
90
91 rcpm: global-utilities@e2000 {
92 compatible = "fsl,b4420-rcpm", "fsl,qoriq-rcpm-2.0";
93 };
94
95 L2: l2-cache-controller@c20000 {
96 compatible = "fsl,b4420-l2-cache-controller";
97 };
98};
diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
new file mode 100644
index 000000000000..7b4426e0a5a5
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
@@ -0,0 +1,73 @@
1/*
2 * B4420 Silicon/SoC Device Tree Source (pre include)
3 *
4 * Copyright 2012 Freescale Semiconductor, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * This software is provided by Freescale Semiconductor "as is" and any
24 * express or implied warranties, including, but not limited to, the implied
25 * warranties of merchantability and fitness for a particular purpose are
26 * disclaimed. In no event shall Freescale Semiconductor be liable for any
27 * direct, indirect, incidental, special, exemplary, or consequential damages
28 * (including, but not limited to, procurement of substitute goods or services;
29 * loss of use, data, or profits; or business interruption) however caused and
30 * on any theory of liability, whether in contract, strict liability, or tort
31 * (including negligence or otherwise) arising in any way out of the use of
32 * this software, even if advised of the possibility of such damage.
33 */
34
35/dts-v1/;
36
37/ {
38 compatible = "fsl,B4420";
39 #address-cells = <2>;
40 #size-cells = <2>;
41 interrupt-parent = <&mpic>;
42
43 aliases {
44 ccsr = &soc;
45 dcsr = &dcsr;
46
47 serial0 = &serial0;
48 serial1 = &serial1;
49 serial2 = &serial2;
50 serial3 = &serial3;
51 pci0 = &pci0;
52 dma0 = &dma0;
53 dma1 = &dma1;
54 sdhc = &sdhc;
55 };
56
57
58 cpus {
59 #address-cells = <1>;
60 #size-cells = <0>;
61
62 cpu0: PowerPC,e6500@0 {
63 device_type = "cpu";
64 reg = <0 1>;
65 next-level-cache = <&L2>;
66 };
67 cpu1: PowerPC,e6500@2 {
68 device_type = "cpu";
69 reg = <2 3>;
70 next-level-cache = <&L2>;
71 };
72 };
73};
diff --git a/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi
new file mode 100644
index 000000000000..e5cf6c81dd66
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/b4860si-post.dtsi
@@ -0,0 +1,142 @@
1/*
2 * B4860 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "b4si-post.dtsi"
36
37/* controller at 0x200000 */
38&pci0 {
39 compatible = "fsl,b4860-pcie", "fsl,qoriq-pcie-v2.4";
40};
41
42&rio {
43 compatible = "fsl,srio";
44 interrupts = <16 2 1 11>;
45 #address-cells = <2>;
46 #size-cells = <2>;
47 fsl,iommu-parent = <&pamu0>;
48 ranges;
49
50 port1 {
51 #address-cells = <2>;
52 #size-cells = <2>;
53 cell-index = <1>;
54 fsl,liodn-reg = <&guts 0x510>; /* RIO1LIODNR */
55 };
56
57 port2 {
58 #address-cells = <2>;
59 #size-cells = <2>;
60 cell-index = <2>;
61 fsl,liodn-reg = <&guts 0x514>; /* RIO2LIODNR */
62 };
63};
64
65&dcsr {
66 dcsr-epu@0 {
67 compatible = "fsl,b4860-dcsr-epu", "fsl,dcsr-epu";
68 };
69 dcsr-npc {
70 compatible = "fsl,b4860-dcsr-cnpc", "fsl,dcsr-cnpc";
71 };
72 dcsr-dpaa@9000 {
73 compatible = "fsl,b4860-dcsr-dpaa", "fsl,dcsr-dpaa";
74 };
75 dcsr-ocn@11000 {
76 compatible = "fsl,b4860-dcsr-ocn", "fsl,dcsr-ocn";
77 };
78 dcsr-ddr@13000 {
79 compatible = "fsl,dcsr-ddr";
80 dev-handle = <&ddr2>;
81 reg = <0x13000 0x1000>;
82 };
83 dcsr-nal@18000 {
84 compatible = "fsl,b4860-dcsr-nal", "fsl,dcsr-nal";
85 };
86 dcsr-rcpm@22000 {
87 compatible = "fsl,b4860-dcsr-rcpm", "fsl,dcsr-rcpm";
88 };
89 dcsr-snpc@30000 {
90 compatible = "fsl,b4860-dcsr-snpc", "fsl,dcsr-snpc";
91 };
92 dcsr-snpc@31000 {
93 compatible = "fsl,b4860-dcsr-snpc", "fsl,dcsr-snpc";
94 };
95 dcsr-cpu-sb-proxy@108000 {
96 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
97 cpu-handle = <&cpu1>;
98 reg = <0x108000 0x1000 0x109000 0x1000>;
99 };
100 dcsr-cpu-sb-proxy@110000 {
101 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
102 cpu-handle = <&cpu2>;
103 reg = <0x110000 0x1000 0x111000 0x1000>;
104 };
105 dcsr-cpu-sb-proxy@118000 {
106 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
107 cpu-handle = <&cpu3>;
108 reg = <0x118000 0x1000 0x119000 0x1000>;
109 };
110};
111
112&soc {
113 ddr2: memory-controller@9000 {
114 compatible = "fsl,qoriq-memory-controller-v4.5", "fsl,qoriq-memory-controller";
115 reg = <0x9000 0x1000>;
116 interrupts = <16 2 1 9>;
117 };
118
119 cpc: l3-cache-controller@10000 {
120 compatible = "fsl,b4860-l3-cache-controller", "cache";
121 };
122
123 corenet-cf@18000 {
124 compatible = "fsl,b4860-corenet-cf";
125 };
126
127 guts: global-utilities@e0000 {
128 compatible = "fsl,b4860-device-config", "fsl,qoriq-device-config-2.0";
129 };
130
131 clockgen: global-utilities@e1000 {
132 compatible = "fsl,b4860-clockgen", "fsl,qoriq-clockgen-2.0";
133 };
134
135 rcpm: global-utilities@e2000 {
136 compatible = "fsl,b4860-rcpm", "fsl,qoriq-rcpm-2.0";
137 };
138
139 L2: l2-cache-controller@c20000 {
140 compatible = "fsl,b4860-l2-cache-controller";
141 };
142};
diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
new file mode 100644
index 000000000000..5263fa46a3fb
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
@@ -0,0 +1,83 @@
1/*
2 * B4860 Silicon/SoC Device Tree Source (pre include)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/dts-v1/;
36
37/ {
38 compatible = "fsl,B4860";
39 #address-cells = <2>;
40 #size-cells = <2>;
41 interrupt-parent = <&mpic>;
42
43 aliases {
44 ccsr = &soc;
45 dcsr = &dcsr;
46
47 serial0 = &serial0;
48 serial1 = &serial1;
49 serial2 = &serial2;
50 serial3 = &serial3;
51 pci0 = &pci0;
52 dma0 = &dma0;
53 dma1 = &dma1;
54 sdhc = &sdhc;
55 };
56
57
58 cpus {
59 #address-cells = <1>;
60 #size-cells = <0>;
61
62 cpu0: PowerPC,e6500@0 {
63 device_type = "cpu";
64 reg = <0 1>;
65 next-level-cache = <&L2>;
66 };
67 cpu1: PowerPC,e6500@2 {
68 device_type = "cpu";
69 reg = <2 3>;
70 next-level-cache = <&L2>;
71 };
72 cpu2: PowerPC,e6500@4 {
73 device_type = "cpu";
74 reg = <4 5>;
75 next-level-cache = <&L2>;
76 };
77 cpu3: PowerPC,e6500@6 {
78 device_type = "cpu";
79 reg = <6 7>;
80 next-level-cache = <&L2>;
81 };
82 };
83};
diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
new file mode 100644
index 000000000000..73991547c69b
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
@@ -0,0 +1,268 @@
1/*
2 * B4420 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2012 Freescale Semiconductor, Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * This software is provided by Freescale Semiconductor "as is" and any
24 * express or implied warranties, including, but not limited to, the implied
25 * warranties of merchantability and fitness for a particular purpose are
26 * disclaimed. In no event shall Freescale Semiconductor be liable for any
27 * direct, indirect, incidental, special, exemplary, or consequential damages
28 * (including, but not limited to, procurement of substitute goods or services;
29 * loss of use, data, or profits; or business interruption) however caused and
30 * on any theory of liability, whether in contract, strict liability, or tort
31 * (including negligence or otherwise) arising in any way out of the use of
32 * this software, even if advised of the possibility of such damage.
33 */
34
35&ifc {
36 #address-cells = <2>;
37 #size-cells = <1>;
38 compatible = "fsl,ifc", "simple-bus";
39 interrupts = <25 2 0 0>;
40};
41
42/* controller at 0x200000 */
43&pci0 {
44 compatible = "fsl,b4-pcie", "fsl,qoriq-pcie-v2.4";
45 device_type = "pci";
46 #size-cells = <2>;
47 #address-cells = <3>;
48 bus-range = <0x0 0xff>;
49 interrupts = <20 2 0 0>;
50 fsl,iommu-parent = <&pamu0>;
51 pcie@0 {
52 #interrupt-cells = <1>;
53 #size-cells = <2>;
54 #address-cells = <3>;
55 device_type = "pci";
56 reg = <0 0 0 0 0>;
57 interrupts = <20 2 0 0>;
58 interrupt-map-mask = <0xf800 0 0 7>;
59 interrupt-map = <
60 /* IDSEL 0x0 */
61 0000 0 0 1 &mpic 40 1 0 0
62 0000 0 0 2 &mpic 1 1 0 0
63 0000 0 0 3 &mpic 2 1 0 0
64 0000 0 0 4 &mpic 3 1 0 0
65 >;
66 };
67};
68
69&dcsr {
70 #address-cells = <1>;
71 #size-cells = <1>;
72 compatible = "fsl,dcsr", "simple-bus";
73
74 dcsr-epu@0 {
75 compatible = "fsl,b4-dcsr-epu", "fsl,dcsr-epu";
76 interrupts = <52 2 0 0
77 84 2 0 0
78 85 2 0 0
79 94 2 0 0
80 95 2 0 0>;
81 reg = <0x0 0x1000>;
82 };
83 dcsr-npc {
84 compatible = "fsl,b4-dcsr-cnpc", "fsl,dcsr-cnpc";
85 reg = <0x1000 0x1000 0x1002000 0x10000>;
86 };
87 dcsr-nxc@2000 {
88 compatible = "fsl,dcsr-nxc";
89 reg = <0x2000 0x1000>;
90 };
91 dcsr-corenet {
92 compatible = "fsl,dcsr-corenet";
93 reg = <0x8000 0x1000 0x1A000 0x1000>;
94 };
95 dcsr-dpaa@9000 {
96 compatible = "fsl,b4-dcsr-dpaa", "fsl,dcsr-dpaa";
97 reg = <0x9000 0x1000>;
98 };
99 dcsr-ocn@11000 {
100 compatible = "fsl,b4-dcsr-ocn", "fsl,dcsr-ocn";
101 reg = <0x11000 0x1000>;
102 };
103 dcsr-ddr@12000 {
104 compatible = "fsl,dcsr-ddr";
105 dev-handle = <&ddr1>;
106 reg = <0x12000 0x1000>;
107 };
108 dcsr-nal@18000 {
109 compatible = "fsl,b4-dcsr-nal", "fsl,dcsr-nal";
110 reg = <0x18000 0x1000>;
111 };
112 dcsr-rcpm@22000 {
113 compatible = "fsl,b4-dcsr-rcpm", "fsl,dcsr-rcpm";
114 reg = <0x22000 0x1000>;
115 };
116 dcsr-snpc@30000 {
117 compatible = "fsl,b4-dcsr-snpc", "fsl,dcsr-snpc";
118 reg = <0x30000 0x1000 0x1022000 0x10000>;
119 };
120 dcsr-snpc@31000 {
121 compatible = "fsl,b4-dcsr-snpc", "fsl,dcsr-snpc";
122 reg = <0x31000 0x1000 0x1042000 0x10000>;
123 };
124 dcsr-cpu-sb-proxy@100000 {
125 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
126 cpu-handle = <&cpu0>;
127 reg = <0x100000 0x1000 0x101000 0x1000>;
128 };
129};
130
131&soc {
132 #address-cells = <1>;
133 #size-cells = <1>;
134 device_type = "soc";
135 compatible = "simple-bus";
136
137 soc-sram-error {
138 compatible = "fsl,soc-sram-error";
139 interrupts = <16 2 1 2>;
140 };
141
142 corenet-law@0 {
143 compatible = "fsl,corenet-law";
144 reg = <0x0 0x1000>;
145 fsl,num-laws = <32>;
146 };
147
148 ddr1: memory-controller@8000 {
149 compatible = "fsl,qoriq-memory-controller-v4.5", "fsl,qoriq-memory-controller";
150 reg = <0x8000 0x1000>;
151 interrupts = <16 2 1 8>;
152 };
153
154 cpc: l3-cache-controller@10000 {
155 compatible = "fsl,b4-l3-cache-controller", "cache";
156 reg = <0x10000 0x1000>;
157 interrupts = <16 2 1 4>;
158 };
159
160 corenet-cf@18000 {
161 compatible = "fsl,b4-corenet-cf";
162 reg = <0x18000 0x1000>;
163 interrupts = <16 2 1 0>;
164 fsl,ccf-num-csdids = <32>;
165 fsl,ccf-num-snoopids = <32>;
166 };
167
168 iommu@20000 {
169 compatible = "fsl,pamu-v1.0", "fsl,pamu";
170 reg = <0x20000 0x4000>;
171 #address-cells = <1>;
172 #size-cells = <1>;
173 interrupts = <
174 24 2 0 0
175 16 2 1 1>;
176
177
178 /* PCIe, DMA, SRIO */
179 pamu0: pamu@0 {
180 reg = <0 0x1000>;
181 fsl,primary-cache-geometry = <8 1>;
182 fsl,secondary-cache-geometry = <32 2>;
183 };
184
185 /* AXI2, Maple */
186 pamu1: pamu@1000 {
187 reg = <0x1000 0x1000>;
188 fsl,primary-cache-geometry = <32 1>;
189 fsl,secondary-cache-geometry = <32 2>;
190 };
191
192 /* Q/BMan */
193 pamu2: pamu@2000 {
194 reg = <0x2000 0x1000>;
195 fsl,primary-cache-geometry = <32 1>;
196 fsl,secondary-cache-geometry = <32 2>;
197 };
198
199 /* AXI1, FMAN */
200 pamu3: pamu@3000 {
201 reg = <0x3000 0x1000>;
202 fsl,primary-cache-geometry = <32 1>;
203 fsl,secondary-cache-geometry = <32 2>;
204 };
205 };
206
207/include/ "qoriq-mpic.dtsi"
208
209 guts: global-utilities@e0000 {
210 compatible = "fsl,b4-device-config";
211 reg = <0xe0000 0xe00>;
212 fsl,has-rstcr;
213 fsl,liodn-bits = <12>;
214 };
215
216 clockgen: global-utilities@e1000 {
217 compatible = "fsl,b4-clockgen", "fsl,qoriq-clockgen-2.0";
218 reg = <0xe1000 0x1000>;
219 };
220
221 rcpm: global-utilities@e2000 {
222 compatible = "fsl,b4-rcpm", "fsl,qoriq-rcpm-2.0";
223 reg = <0xe2000 0x1000>;
224 };
225
226/include/ "qoriq-dma-0.dtsi"
227 dma@100300 {
228 fsl,iommu-parent = <&pamu0>;
229 fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
230 };
231
232/include/ "qoriq-dma-1.dtsi"
233 dma@101300 {
234 fsl,iommu-parent = <&pamu0>;
235 fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
236 };
237
238/include/ "qonverge-usb2-dr-0.dtsi"
239 usb0: usb@210000 {
240 compatible = "fsl-usb2-dr-v2.4", "fsl-usb2-dr";
241 fsl,iommu-parent = <&pamu1>;
242 fsl,liodn-reg = <&guts 0x520>; /* USB1LIODNR */
243 };
244
245/include/ "qoriq-espi-0.dtsi"
246 spi@110000 {
247 fsl,espi-num-chipselects = <4>;
248 };
249
250/include/ "qoriq-esdhc-0.dtsi"
251 sdhc@114000 {
252 sdhci,auto-cmd12;
253 fsl,iommu-parent = <&pamu1>;
254 fsl,liodn-reg = <&guts 0x530>; /* eSDHCLIODNR */
255 };
256
257/include/ "qoriq-i2c-0.dtsi"
258/include/ "qoriq-i2c-1.dtsi"
259/include/ "qoriq-duart-0.dtsi"
260/include/ "qoriq-duart-1.dtsi"
261/include/ "qoriq-sec5.3-0.dtsi"
262
263 L2: l2-cache-controller@c20000 {
264 compatible = "fsl,b4-l2-cache-controller";
265 reg = <0xc20000 0x1000>;
266 next-level-cache = <&cpc>;
267 };
268};
diff --git a/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi
index 870c6535a053..ea145c91cfbd 100644
--- a/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi
+++ b/arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi
@@ -53,6 +53,7 @@
53 power-isa-mmc; // Memory Coherence 53 power-isa-mmc; // Memory Coherence
54 power-isa-scpm; // Store Conditional Page Mobility 54 power-isa-scpm; // Store Conditional Page Mobility
55 power-isa-wt; // Wait 55 power-isa-wt; // Wait
56 fsl,eref-deo; // Data Cache Extended Operations
56 mmu-type = "power-embedded"; 57 mmu-type = "power-embedded";
57 }; 58 };
58}; 59};
diff --git a/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi
index 3230212f7ad5..c254c981ae87 100644
--- a/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi
+++ b/arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi
@@ -54,6 +54,7 @@
54 power-isa-scpm; // Store Conditional Page Mobility 54 power-isa-scpm; // Store Conditional Page Mobility
55 power-isa-wt; // Wait 55 power-isa-wt; // Wait
56 power-isa-64; // 64-bit 56 power-isa-64; // 64-bit
57 fsl,eref-deo; // Data Cache Extended Operations
57 mmu-type = "power-embedded"; 58 mmu-type = "power-embedded";
58 }; 59 };
59}; 60};
diff --git a/arch/powerpc/boot/dts/fsl/e6500_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e6500_power_isa.dtsi
new file mode 100644
index 000000000000..a912dbeff359
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/e6500_power_isa.dtsi
@@ -0,0 +1,65 @@
1/*
2 * e6500 Power ISA Device Tree Source (include)
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/ {
36 cpus {
37 power-isa-version = "2.06";
38 power-isa-b; // Base
39 power-isa-e; // Embedded
40 power-isa-atb; // Alternate Time Base
41 power-isa-cs; // Cache Specification
42 power-isa-ds; // Decorated Storage
43 power-isa-e.ed; // Embedded.Enhanced Debug
44 power-isa-e.pd; // Embedded.External PID
45 power-isa-e.hv; // Embedded.Hypervisor
46 power-isa-e.le; // Embedded.Little-Endian
47 power-isa-e.pm; // Embedded.Performance Monitor
48 power-isa-e.pc; // Embedded.Processor Control
49 power-isa-ecl; // Embedded Cache Locking
50 power-isa-exp; // External Proxy
51 power-isa-fp; // Floating Point
52 power-isa-fp.r; // Floating Point.Record
53 power-isa-mmc; // Memory Coherence
54 power-isa-scpm; // Store Conditional Page Mobility
55 power-isa-wt; // Wait
56 power-isa-64; // 64-bit
57 power-isa-e.pt; // Embedded.Page Table
58 power-isa-e.hv.lrat; // Embedded.Hypervisor.LRAT
59 power-isa-e.em; // Embedded Multi-Threading
60 power-isa-v; // Vector (AltiVec)
61 fsl,eref-er; // Enhanced Reservations (Load and Reserve and Store Cond.)
62 fsl,eref-deo; // Data Cache Extended Operations
63 mmu-type = "power-embedded";
64 };
65};
diff --git a/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
index 941fa159cefb..f1105bffa915 100644
--- a/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1023si-post.dtsi
@@ -148,6 +148,7 @@
148 148
149 crypto: crypto@300000 { 149 crypto: crypto@300000 {
150 compatible = "fsl,sec-v4.2", "fsl,sec-v4.0"; 150 compatible = "fsl,sec-v4.2", "fsl,sec-v4.0";
151 fsl,sec-era = <3>;
151 #address-cells = <1>; 152 #address-cells = <1>;
152 #size-cells = <1>; 153 #size-cells = <1>;
153 reg = <0x30000 0x10000>; 154 reg = <0x30000 0x10000>;
diff --git a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
index 69ac1acd4349..dc6cc5afd189 100644
--- a/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
@@ -155,7 +155,7 @@
155 compatible = "fsl,dcsr", "simple-bus"; 155 compatible = "fsl,dcsr", "simple-bus";
156 156
157 dcsr-epu@0 { 157 dcsr-epu@0 {
158 compatible = "fsl,dcsr-epu"; 158 compatible = "fsl,p2041-dcsr-epu", "fsl,dcsr-epu";
159 interrupts = <52 2 0 0 159 interrupts = <52 2 0 0
160 84 2 0 0 160 84 2 0 0
161 85 2 0 0>; 161 85 2 0 0>;
diff --git a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi
index 9b5a81a4529c..3fa1e22d544a 100644
--- a/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p3041si-post.dtsi
@@ -182,7 +182,7 @@
182 compatible = "fsl,dcsr", "simple-bus"; 182 compatible = "fsl,dcsr", "simple-bus";
183 183
184 dcsr-epu@0 { 184 dcsr-epu@0 {
185 compatible = "fsl,dcsr-epu"; 185 compatible = "fsl,p3041-dcsr-epu", "fsl,dcsr-epu";
186 interrupts = <52 2 0 0 186 interrupts = <52 2 0 0
187 84 2 0 0 187 84 2 0 0
188 85 2 0 0>; 188 85 2 0 0>;
diff --git a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi
index 19859ad851eb..34769a7eafea 100644
--- a/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p4080si-post.dtsi
@@ -156,7 +156,7 @@
156 compatible = "fsl,dcsr", "simple-bus"; 156 compatible = "fsl,dcsr", "simple-bus";
157 157
158 dcsr-epu@0 { 158 dcsr-epu@0 {
159 compatible = "fsl,dcsr-epu"; 159 compatible = "fsl,p4080-dcsr-epu", "fsl,dcsr-epu";
160 interrupts = <52 2 0 0 160 interrupts = <52 2 0 0
161 84 2 0 0 161 84 2 0 0
162 85 2 0 0>; 162 85 2 0 0>;
diff --git a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
index 9ea77c3513f6..bc3ae5a2252f 100644
--- a/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p5020si-post.dtsi
@@ -184,7 +184,7 @@
184 compatible = "fsl,dcsr", "simple-bus"; 184 compatible = "fsl,dcsr", "simple-bus";
185 185
186 dcsr-epu@0 { 186 dcsr-epu@0 {
187 compatible = "fsl,dcsr-epu"; 187 compatible = "fsl,p5020-dcsr-epu", "fsl,dcsr-epu";
188 interrupts = <52 2 0 0 188 interrupts = <52 2 0 0
189 84 2 0 0 189 84 2 0 0
190 85 2 0 0>; 190 85 2 0 0>;
diff --git a/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi b/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi
index 97f8c26f9709..a91897f6af09 100644
--- a/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p5040si-post.dtsi
@@ -129,7 +129,7 @@
129 compatible = "fsl,dcsr", "simple-bus"; 129 compatible = "fsl,dcsr", "simple-bus";
130 130
131 dcsr-epu@0 { 131 dcsr-epu@0 {
132 compatible = "fsl,dcsr-epu"; 132 compatible = "fsl,p5040-dcsr-epu", "fsl,dcsr-epu";
133 interrupts = <52 2 0 0 133 interrupts = <52 2 0 0
134 84 2 0 0 134 84 2 0 0
135 85 2 0 0>; 135 85 2 0 0>;
diff --git a/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi b/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi
index ffadcb563ada..bb3d8266b5ce 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-sec4.4-0.dtsi
@@ -34,6 +34,7 @@
34 34
35crypto@30000 { 35crypto@30000 {
36 compatible = "fsl,sec-v4.4", "fsl,sec-v4.0"; 36 compatible = "fsl,sec-v4.4", "fsl,sec-v4.0";
37 fsl,sec-era = <3>;
37 #address-cells = <1>; 38 #address-cells = <1>;
38 #size-cells = <1>; 39 #size-cells = <1>;
39 ranges = <0x0 0x30000 0x10000>; 40 ranges = <0x0 0x30000 0x10000>;
diff --git a/arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi b/arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi
new file mode 100644
index 000000000000..29dad723091e
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qonverge-usb2-dr-0.dtsi
@@ -0,0 +1,41 @@
1/*
2 * QorIQ Qonverge USB Host device tree stub [ controller @ offset 0x210000 ]
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35usb@210000 {
36 compatible = "fsl-usb2-dr";
37 reg = <0x210000 0x1000>;
38 #address-cells = <1>;
39 #size-cells = <0>;
40 interrupts = <44 0x2 0 0>;
41};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-gpio-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-gpio-1.dtsi
new file mode 100644
index 000000000000..c2f9cdadb604
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-gpio-1.dtsi
@@ -0,0 +1,41 @@
1/*
2 * QorIQ GPIO device tree stub [ controller @ offset 0x131000 ]
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35gpio1: gpio@131000 {
36 compatible = "fsl,qoriq-gpio";
37 reg = <0x131000 0x1000>;
38 interrupts = <54 2 0 0>;
39 #gpio-cells = <2>;
40 gpio-controller;
41};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-gpio-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-gpio-2.dtsi
new file mode 100644
index 000000000000..33f3ccbac83f
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-gpio-2.dtsi
@@ -0,0 +1,41 @@
1/*
2 * QorIQ GPIO device tree stub [ controller @ offset 0x132000 ]
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35gpio2: gpio@132000 {
36 compatible = "fsl,qoriq-gpio";
37 reg = <0x132000 0x1000>;
38 interrupts = <86 2 0 0>;
39 #gpio-cells = <2>;
40 gpio-controller;
41};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-gpio-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-gpio-3.dtsi
new file mode 100644
index 000000000000..86954e95ea02
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-gpio-3.dtsi
@@ -0,0 +1,41 @@
1/*
2 * QorIQ GPIO device tree stub [ controller @ offset 0x133000 ]
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35gpio3: gpio@133000 {
36 compatible = "fsl,qoriq-gpio";
37 reg = <0x133000 0x1000>;
38 interrupts = <87 2 0 0>;
39 #gpio-cells = <2>;
40 gpio-controller;
41};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-sec4.0-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-sec4.0-0.dtsi
index 0cbbac329539..02bee5fcbb9a 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-sec4.0-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-sec4.0-0.dtsi
@@ -34,6 +34,7 @@
34 34
35crypto: crypto@300000 { 35crypto: crypto@300000 {
36 compatible = "fsl,sec-v4.0"; 36 compatible = "fsl,sec-v4.0";
37 fsl,sec-era = <1>;
37 #address-cells = <1>; 38 #address-cells = <1>;
38 #size-cells = <1>; 39 #size-cells = <1>;
39 reg = <0x300000 0x10000>; 40 reg = <0x300000 0x10000>;
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-sec4.2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-sec4.2-0.dtsi
index 7990e0d3d6f2..7f7574e53323 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-sec4.2-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-sec4.2-0.dtsi
@@ -34,6 +34,7 @@
34 34
35crypto: crypto@300000 { 35crypto: crypto@300000 {
36 compatible = "fsl,sec-v4.2", "fsl,sec-v4.0"; 36 compatible = "fsl,sec-v4.2", "fsl,sec-v4.0";
37 fsl,sec-era = <3>;
37 #address-cells = <1>; 38 #address-cells = <1>;
38 #size-cells = <1>; 39 #size-cells = <1>;
39 reg = <0x300000 0x10000>; 40 reg = <0x300000 0x10000>;
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-sec4.1-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-sec5.0-0.dtsi
index 3308986bba0d..e298efbb0f3e 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-sec4.1-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-sec5.0-0.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * QorIQ Sec/Crypto 4.1 device tree stub [ controller @ offset 0x300000 ] 2 * QorIQ Sec/Crypto 5.0 device tree stub [ controller @ offset 0x300000 ]
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -33,7 +33,8 @@
33 */ 33 */
34 34
35crypto: crypto@300000 { 35crypto: crypto@300000 {
36 compatible = "fsl,sec-v4.1", "fsl,sec-v4.0"; 36 compatible = "fsl,sec-v5.0", "fsl,sec-v4.0";
37 fsl,sec-era = <5>;
37 #address-cells = <1>; 38 #address-cells = <1>;
38 #size-cells = <1>; 39 #size-cells = <1>;
39 reg = <0x300000 0x10000>; 40 reg = <0x300000 0x10000>;
@@ -41,35 +42,35 @@ crypto: crypto@300000 {
41 interrupts = <92 2 0 0>; 42 interrupts = <92 2 0 0>;
42 43
43 sec_jr0: jr@1000 { 44 sec_jr0: jr@1000 {
44 compatible = "fsl,sec-v4.1-job-ring", 45 compatible = "fsl,sec-v5.0-job-ring",
45 "fsl,sec-v4.0-job-ring"; 46 "fsl,sec-v4.0-job-ring";
46 reg = <0x1000 0x1000>; 47 reg = <0x1000 0x1000>;
47 interrupts = <88 2 0 0>; 48 interrupts = <88 2 0 0>;
48 }; 49 };
49 50
50 sec_jr1: jr@2000 { 51 sec_jr1: jr@2000 {
51 compatible = "fsl,sec-v4.1-job-ring", 52 compatible = "fsl,sec-v5.0-job-ring",
52 "fsl,sec-v4.0-job-ring"; 53 "fsl,sec-v4.0-job-ring";
53 reg = <0x2000 0x1000>; 54 reg = <0x2000 0x1000>;
54 interrupts = <89 2 0 0>; 55 interrupts = <89 2 0 0>;
55 }; 56 };
56 57
57 sec_jr2: jr@3000 { 58 sec_jr2: jr@3000 {
58 compatible = "fsl,sec-v4.1-job-ring", 59 compatible = "fsl,sec-v5.0-job-ring",
59 "fsl,sec-v4.0-job-ring"; 60 "fsl,sec-v4.0-job-ring";
60 reg = <0x3000 0x1000>; 61 reg = <0x3000 0x1000>;
61 interrupts = <90 2 0 0>; 62 interrupts = <90 2 0 0>;
62 }; 63 };
63 64
64 sec_jr3: jr@4000 { 65 sec_jr3: jr@4000 {
65 compatible = "fsl,sec-v4.1-job-ring", 66 compatible = "fsl,sec-v5.0-job-ring",
66 "fsl,sec-v4.0-job-ring"; 67 "fsl,sec-v4.0-job-ring";
67 reg = <0x4000 0x1000>; 68 reg = <0x4000 0x1000>;
68 interrupts = <91 2 0 0>; 69 interrupts = <91 2 0 0>;
69 }; 70 };
70 71
71 rtic@6000 { 72 rtic@6000 {
72 compatible = "fsl,sec-v4.1-rtic", 73 compatible = "fsl,sec-v5.0-rtic",
73 "fsl,sec-v4.0-rtic"; 74 "fsl,sec-v4.0-rtic";
74 #address-cells = <1>; 75 #address-cells = <1>;
75 #size-cells = <1>; 76 #size-cells = <1>;
@@ -77,25 +78,25 @@ crypto: crypto@300000 {
77 ranges = <0x0 0x6100 0xe00>; 78 ranges = <0x0 0x6100 0xe00>;
78 79
79 rtic_a: rtic-a@0 { 80 rtic_a: rtic-a@0 {
80 compatible = "fsl,sec-v4.1-rtic-memory", 81 compatible = "fsl,sec-v5.0-rtic-memory",
81 "fsl,sec-v4.0-rtic-memory"; 82 "fsl,sec-v4.0-rtic-memory";
82 reg = <0x00 0x20 0x100 0x80>; 83 reg = <0x00 0x20 0x100 0x80>;
83 }; 84 };
84 85
85 rtic_b: rtic-b@20 { 86 rtic_b: rtic-b@20 {
86 compatible = "fsl,sec-v4.1-rtic-memory", 87 compatible = "fsl,sec-v5.0-rtic-memory",
87 "fsl,sec-v4.0-rtic-memory"; 88 "fsl,sec-v4.0-rtic-memory";
88 reg = <0x20 0x20 0x200 0x80>; 89 reg = <0x20 0x20 0x200 0x80>;
89 }; 90 };
90 91
91 rtic_c: rtic-c@40 { 92 rtic_c: rtic-c@40 {
92 compatible = "fsl,sec-v4.1-rtic-memory", 93 compatible = "fsl,sec-v5.0-rtic-memory",
93 "fsl,sec-v4.0-rtic-memory"; 94 "fsl,sec-v4.0-rtic-memory";
94 reg = <0x40 0x20 0x300 0x80>; 95 reg = <0x40 0x20 0x300 0x80>;
95 }; 96 };
96 97
97 rtic_d: rtic-d@60 { 98 rtic_d: rtic-d@60 {
98 compatible = "fsl,sec-v4.1-rtic-memory", 99 compatible = "fsl,sec-v5.0-rtic-memory",
99 "fsl,sec-v4.0-rtic-memory"; 100 "fsl,sec-v4.0-rtic-memory";
100 reg = <0x60 0x20 0x500 0x80>; 101 reg = <0x60 0x20 0x500 0x80>;
101 }; 102 };
@@ -103,7 +104,7 @@ crypto: crypto@300000 {
103}; 104};
104 105
105sec_mon: sec_mon@314000 { 106sec_mon: sec_mon@314000 {
106 compatible = "fsl,sec-v4.1-mon", "fsl,sec-v4.0-mon"; 107 compatible = "fsl,sec-v5.0-mon", "fsl,sec-v4.0-mon";
107 reg = <0x314000 0x1000>; 108 reg = <0x314000 0x1000>;
108 interrupts = <93 2 0 0>; 109 interrupts = <93 2 0 0>;
109}; 110};
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi
index 7b2ab8a8c1f4..33ff09d52e05 100644
--- a/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi
+++ b/arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi
@@ -34,6 +34,7 @@
34 34
35crypto: crypto@300000 { 35crypto: crypto@300000 {
36 compatible = "fsl,sec-v5.2", "fsl,sec-v5.0", "fsl,sec-v4.0"; 36 compatible = "fsl,sec-v5.2", "fsl,sec-v5.0", "fsl,sec-v4.0";
37 fsl,sec-era = <5>;
37 #address-cells = <1>; 38 #address-cells = <1>;
38 #size-cells = <1>; 39 #size-cells = <1>;
39 reg = <0x300000 0x10000>; 40 reg = <0x300000 0x10000>;
diff --git a/arch/powerpc/boot/dts/fsl/qoriq-sec5.3-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-sec5.3-0.dtsi
new file mode 100644
index 000000000000..08778221c194
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/qoriq-sec5.3-0.dtsi
@@ -0,0 +1,119 @@
1/*
2 * QorIQ Sec/Crypto 5.3 device tree stub [ controller @ offset 0x300000 ]
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35crypto: crypto@300000 {
36 compatible = "fsl,sec-v5.3", "fsl,sec-v5.0", "fsl,sec-v4.0";
37 fsl,sec-era = <4>;
38 #address-cells = <1>;
39 #size-cells = <1>;
40 reg = <0x300000 0x10000>;
41 ranges = <0 0x300000 0x10000>;
42 interrupts = <92 2 0 0>;
43
44 sec_jr0: jr@1000 {
45 compatible = "fsl,sec-v5.3-job-ring",
46 "fsl,sec-v5.0-job-ring",
47 "fsl,sec-v4.0-job-ring";
48 reg = <0x1000 0x1000>;
49 interrupts = <88 2 0 0>;
50 };
51
52 sec_jr1: jr@2000 {
53 compatible = "fsl,sec-v5.3-job-ring",
54 "fsl,sec-v5.0-job-ring",
55 "fsl,sec-v4.0-job-ring";
56 reg = <0x2000 0x1000>;
57 interrupts = <89 2 0 0>;
58 };
59
60 sec_jr2: jr@3000 {
61 compatible = "fsl,sec-v5.3-job-ring",
62 "fsl,sec-v5.0-job-ring",
63 "fsl,sec-v4.0-job-ring";
64 reg = <0x3000 0x1000>;
65 interrupts = <90 2 0 0>;
66 };
67
68 sec_jr3: jr@4000 {
69 compatible = "fsl,sec-v5.3-job-ring",
70 "fsl,sec-v5.0-job-ring",
71 "fsl,sec-v4.0-job-ring";
72 reg = <0x4000 0x1000>;
73 interrupts = <91 2 0 0>;
74 };
75
76 rtic@6000 {
77 compatible = "fsl,sec-v5.3-rtic",
78 "fsl,sec-v5.0-rtic",
79 "fsl,sec-v4.0-rtic";
80 #address-cells = <1>;
81 #size-cells = <1>;
82 reg = <0x6000 0x100>;
83 ranges = <0x0 0x6100 0xe00>;
84
85 rtic_a: rtic-a@0 {
86 compatible = "fsl,sec-v5.3-rtic-memory",
87 "fsl,sec-v5.0-rtic-memory",
88 "fsl,sec-v4.0-rtic-memory";
89 reg = <0x00 0x20 0x100 0x80>;
90 };
91
92 rtic_b: rtic-b@20 {
93 compatible = "fsl,sec-v5.3-rtic-memory",
94 "fsl,sec-v5.0-rtic-memory",
95 "fsl,sec-v4.0-rtic-memory";
96 reg = <0x20 0x20 0x200 0x80>;
97 };
98
99 rtic_c: rtic-c@40 {
100 compatible = "fsl,sec-v5.3-rtic-memory",
101 "fsl,sec-v5.0-rtic-memory",
102 "fsl,sec-v4.0-rtic-memory";
103 reg = <0x40 0x20 0x300 0x80>;
104 };
105
106 rtic_d: rtic-d@60 {
107 compatible = "fsl,sec-v5.3-rtic-memory",
108 "fsl,sec-v5.0-rtic-memory",
109 "fsl,sec-v4.0-rtic-memory";
110 reg = <0x60 0x20 0x500 0x80>;
111 };
112 };
113};
114
115sec_mon: sec_mon@314000 {
116 compatible = "fsl,sec-v5.3-mon", "fsl,sec-v5.0-mon", "fsl,sec-v4.0-mon";
117 reg = <0x314000 0x1000>;
118 interrupts = <93 2 0 0>;
119};
diff --git a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
new file mode 100644
index 000000000000..bd611a9cad32
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
@@ -0,0 +1,442 @@
1/*
2 * T4240 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35&ifc {
36 #address-cells = <2>;
37 #size-cells = <1>;
38 compatible = "fsl,ifc", "simple-bus";
39 interrupts = <25 2 0 0>;
40};
41
42/* controller at 0x240000 */
43&pci0 {
44 compatible = "fsl,t4240-pcie", "fsl,qoriq-pcie-v3.0";
45 device_type = "pci";
46 #size-cells = <2>;
47 #address-cells = <3>;
48 bus-range = <0x0 0xff>;
49 interrupts = <20 2 0 0>;
50 pcie@0 {
51 #interrupt-cells = <1>;
52 #size-cells = <2>;
53 #address-cells = <3>;
54 device_type = "pci";
55 reg = <0 0 0 0 0>;
56 interrupts = <20 2 0 0>;
57 interrupt-map-mask = <0xf800 0 0 7>;
58 interrupt-map = <
59 /* IDSEL 0x0 */
60 0000 0 0 1 &mpic 40 1 0 0
61 0000 0 0 2 &mpic 1 1 0 0
62 0000 0 0 3 &mpic 2 1 0 0
63 0000 0 0 4 &mpic 3 1 0 0
64 >;
65 };
66};
67
68/* controller at 0x250000 */
69&pci1 {
70 compatible = "fsl,t4240-pcie", "fsl,qoriq-pcie-v3.0";
71 device_type = "pci";
72 #size-cells = <2>;
73 #address-cells = <3>;
74 bus-range = <0 0xff>;
75 interrupts = <21 2 0 0>;
76 pcie@0 {
77 #interrupt-cells = <1>;
78 #size-cells = <2>;
79 #address-cells = <3>;
80 device_type = "pci";
81 reg = <0 0 0 0 0>;
82 interrupts = <21 2 0 0>;
83 interrupt-map-mask = <0xf800 0 0 7>;
84 interrupt-map = <
85 /* IDSEL 0x0 */
86 0000 0 0 1 &mpic 41 1 0 0
87 0000 0 0 2 &mpic 5 1 0 0
88 0000 0 0 3 &mpic 6 1 0 0
89 0000 0 0 4 &mpic 7 1 0 0
90 >;
91 };
92};
93
94/* controller at 0x260000 */
95&pci2 {
96 compatible = "fsl,t4240-pcie", "fsl,qoriq-pcie-v3.0";
97 device_type = "pci";
98 #size-cells = <2>;
99 #address-cells = <3>;
100 bus-range = <0x0 0xff>;
101 interrupts = <22 2 0 0>;
102 pcie@0 {
103 #interrupt-cells = <1>;
104 #size-cells = <2>;
105 #address-cells = <3>;
106 device_type = "pci";
107 reg = <0 0 0 0 0>;
108 interrupts = <22 2 0 0>;
109 interrupt-map-mask = <0xf800 0 0 7>;
110 interrupt-map = <
111 /* IDSEL 0x0 */
112 0000 0 0 1 &mpic 42 1 0 0
113 0000 0 0 2 &mpic 9 1 0 0
114 0000 0 0 3 &mpic 10 1 0 0
115 0000 0 0 4 &mpic 11 1 0 0
116 >;
117 };
118};
119
120/* controller at 0x270000 */
121&pci3 {
122 compatible = "fsl,t4240-pcie", "fsl,qoriq-pcie-v3.0";
123 device_type = "pci";
124 #size-cells = <2>;
125 #address-cells = <3>;
126 bus-range = <0x0 0xff>;
127 interrupts = <23 2 0 0>;
128 pcie@0 {
129 #interrupt-cells = <1>;
130 #size-cells = <2>;
131 #address-cells = <3>;
132 device_type = "pci";
133 reg = <0 0 0 0 0>;
134 interrupts = <23 2 0 0>;
135 interrupt-map-mask = <0xf800 0 0 7>;
136 interrupt-map = <
137 /* IDSEL 0x0 */
138 0000 0 0 1 &mpic 43 1 0 0
139 0000 0 0 2 &mpic 0 1 0 0
140 0000 0 0 3 &mpic 4 1 0 0
141 0000 0 0 4 &mpic 8 1 0 0
142 >;
143 };
144};
145
146&rio {
147 compatible = "fsl,srio";
148 interrupts = <16 2 1 11>;
149 #address-cells = <2>;
150 #size-cells = <2>;
151 ranges;
152
153 port1 {
154 #address-cells = <2>;
155 #size-cells = <2>;
156 cell-index = <1>;
157 };
158
159 port2 {
160 #address-cells = <2>;
161 #size-cells = <2>;
162 cell-index = <2>;
163 };
164};
165
166&dcsr {
167 #address-cells = <1>;
168 #size-cells = <1>;
169 compatible = "fsl,dcsr", "simple-bus";
170
171 dcsr-epu@0 {
172 compatible = "fsl,t4240-dcsr-epu", "fsl,dcsr-epu";
173 interrupts = <52 2 0 0
174 84 2 0 0
175 85 2 0 0
176 94 2 0 0
177 95 2 0 0>;
178 reg = <0x0 0x1000>;
179 };
180 dcsr-npc {
181 compatible = "fsl,t4240-dcsr-cnpc", "fsl,dcsr-cnpc";
182 reg = <0x1000 0x1000 0x1002000 0x10000>;
183 };
184 dcsr-nxc@2000 {
185 compatible = "fsl,dcsr-nxc";
186 reg = <0x2000 0x1000>;
187 };
188 dcsr-corenet {
189 compatible = "fsl,dcsr-corenet";
190 reg = <0x8000 0x1000 0x1A000 0x1000>;
191 };
192 dcsr-dpaa@9000 {
193 compatible = "fsl,t4240-dcsr-dpaa", "fsl,dcsr-dpaa";
194 reg = <0x9000 0x1000>;
195 };
196 dcsr-ocn@11000 {
197 compatible = "fsl,t4240-dcsr-ocn", "fsl,dcsr-ocn";
198 reg = <0x11000 0x1000>;
199 };
200 dcsr-ddr@12000 {
201 compatible = "fsl,dcsr-ddr";
202 dev-handle = <&ddr1>;
203 reg = <0x12000 0x1000>;
204 };
205 dcsr-ddr@13000 {
206 compatible = "fsl,dcsr-ddr";
207 dev-handle = <&ddr2>;
208 reg = <0x13000 0x1000>;
209 };
210 dcsr-ddr@14000 {
211 compatible = "fsl,dcsr-ddr";
212 dev-handle = <&ddr3>;
213 reg = <0x14000 0x1000>;
214 };
215 dcsr-nal@18000 {
216 compatible = "fsl,t4240-dcsr-nal", "fsl,dcsr-nal";
217 reg = <0x18000 0x1000>;
218 };
219 dcsr-rcpm@22000 {
220 compatible = "fsl,t4240-dcsr-rcpm", "fsl,dcsr-rcpm";
221 reg = <0x22000 0x1000>;
222 };
223 dcsr-snpc@30000 {
224 compatible = "fsl,t4240-dcsr-snpc", "fsl,dcsr-snpc";
225 reg = <0x30000 0x1000 0x1022000 0x10000>;
226 };
227 dcsr-snpc@31000 {
228 compatible = "fsl,t4240-dcsr-snpc", "fsl,dcsr-snpc";
229 reg = <0x31000 0x1000 0x1042000 0x10000>;
230 };
231 dcsr-snpc@32000 {
232 compatible = "fsl,t4240-dcsr-snpc", "fsl,dcsr-snpc";
233 reg = <0x32000 0x1000 0x1062000 0x10000>;
234 };
235 dcsr-cpu-sb-proxy@100000 {
236 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
237 cpu-handle = <&cpu0>;
238 reg = <0x100000 0x1000 0x101000 0x1000>;
239 };
240 dcsr-cpu-sb-proxy@108000 {
241 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
242 cpu-handle = <&cpu1>;
243 reg = <0x108000 0x1000 0x109000 0x1000>;
244 };
245 dcsr-cpu-sb-proxy@110000 {
246 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
247 cpu-handle = <&cpu2>;
248 reg = <0x110000 0x1000 0x111000 0x1000>;
249 };
250 dcsr-cpu-sb-proxy@118000 {
251 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
252 cpu-handle = <&cpu3>;
253 reg = <0x118000 0x1000 0x119000 0x1000>;
254 };
255 dcsr-cpu-sb-proxy@120000 {
256 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
257 cpu-handle = <&cpu4>;
258 reg = <0x120000 0x1000 0x121000 0x1000>;
259 };
260 dcsr-cpu-sb-proxy@128000 {
261 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
262 cpu-handle = <&cpu5>;
263 reg = <0x128000 0x1000 0x129000 0x1000>;
264 };
265 dcsr-cpu-sb-proxy@130000 {
266 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
267 cpu-handle = <&cpu6>;
268 reg = <0x130000 0x1000 0x131000 0x1000>;
269 };
270 dcsr-cpu-sb-proxy@138000 {
271 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
272 cpu-handle = <&cpu7>;
273 reg = <0x138000 0x1000 0x139000 0x1000>;
274 };
275 dcsr-cpu-sb-proxy@140000 {
276 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
277 cpu-handle = <&cpu8>;
278 reg = <0x140000 0x1000 0x141000 0x1000>;
279 };
280 dcsr-cpu-sb-proxy@148000 {
281 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
282 cpu-handle = <&cpu9>;
283 reg = <0x148000 0x1000 0x149000 0x1000>;
284 };
285 dcsr-cpu-sb-proxy@150000 {
286 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
287 cpu-handle = <&cpu10>;
288 reg = <0x150000 0x1000 0x151000 0x1000>;
289 };
290 dcsr-cpu-sb-proxy@158000 {
291 compatible = "fsl,dcsr-e6500-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
292 cpu-handle = <&cpu11>;
293 reg = <0x158000 0x1000 0x159000 0x1000>;
294 };
295};
296
297&soc {
298 #address-cells = <1>;
299 #size-cells = <1>;
300 device_type = "soc";
301 compatible = "simple-bus";
302
303 soc-sram-error {
304 compatible = "fsl,soc-sram-error";
305 interrupts = <16 2 1 29>;
306 };
307
308 corenet-law@0 {
309 compatible = "fsl,corenet-law";
310 reg = <0x0 0x1000>;
311 fsl,num-laws = <32>;
312 };
313
314 ddr1: memory-controller@8000 {
315 compatible = "fsl,qoriq-memory-controller-v4.7",
316 "fsl,qoriq-memory-controller";
317 reg = <0x8000 0x1000>;
318 interrupts = <16 2 1 23>;
319 };
320
321 ddr2: memory-controller@9000 {
322 compatible = "fsl,qoriq-memory-controller-v4.7",
323 "fsl,qoriq-memory-controller";
324 reg = <0x9000 0x1000>;
325 interrupts = <16 2 1 22>;
326 };
327
328 ddr3: memory-controller@a000 {
329 compatible = "fsl,qoriq-memory-controller-v4.7",
330 "fsl,qoriq-memory-controller";
331 reg = <0xa000 0x1000>;
332 interrupts = <16 2 1 21>;
333 };
334
335 cpc: l3-cache-controller@10000 {
336 compatible = "fsl,t4240-l3-cache-controller", "cache";
337 reg = <0x10000 0x1000
338 0x11000 0x1000
339 0x12000 0x1000>;
340 interrupts = <16 2 1 27
341 16 2 1 26
342 16 2 1 25>;
343 };
344
345 corenet-cf@18000 {
346 compatible = "fsl,corenet-cf";
347 reg = <0x18000 0x1000>;
348 interrupts = <16 2 1 31>;
349 fsl,ccf-num-csdids = <32>;
350 fsl,ccf-num-snoopids = <32>;
351 };
352
353 iommu@20000 {
354 compatible = "fsl,pamu-v1.0", "fsl,pamu";
355 reg = <0x20000 0x6000>;
356 interrupts = <
357 24 2 0 0
358 16 2 1 30>;
359 };
360
361/include/ "qoriq-mpic.dtsi"
362
363 guts: global-utilities@e0000 {
364 compatible = "fsl,t4240-device-config", "fsl,qoriq-device-config-2.0";
365 reg = <0xe0000 0xe00>;
366 fsl,has-rstcr;
367 fsl,liodn-bits = <12>;
368 };
369
370 clockgen: global-utilities@e1000 {
371 compatible = "fsl,t4240-clockgen", "fsl,qoriq-clockgen-2.0";
372 reg = <0xe1000 0x1000>;
373 };
374
375 rcpm: global-utilities@e2000 {
376 compatible = "fsl,t4240-rcpm", "fsl,qoriq-rcpm-2.0";
377 reg = <0xe2000 0x1000>;
378 };
379
380 sfp: sfp@e8000 {
381 compatible = "fsl,t4240-sfp";
382 reg = <0xe8000 0x1000>;
383 };
384
385 serdes: serdes@ea000 {
386 compatible = "fsl,t4240-serdes";
387 reg = <0xea000 0x4000>;
388 };
389
390/include/ "qoriq-dma-0.dtsi"
391/include/ "qoriq-dma-1.dtsi"
392
393/include/ "qoriq-espi-0.dtsi"
394 spi@110000 {
395 fsl,espi-num-chipselects = <4>;
396 };
397
398/include/ "qoriq-esdhc-0.dtsi"
399 sdhc@114000 {
400 compatible = "fsl,t4240-esdhc", "fsl,esdhc";
401 sdhci,auto-cmd12;
402 };
403/include/ "qoriq-i2c-0.dtsi"
404/include/ "qoriq-i2c-1.dtsi"
405/include/ "qoriq-duart-0.dtsi"
406/include/ "qoriq-duart-1.dtsi"
407/include/ "qoriq-gpio-0.dtsi"
408/include/ "qoriq-gpio-1.dtsi"
409/include/ "qoriq-gpio-2.dtsi"
410/include/ "qoriq-gpio-3.dtsi"
411/include/ "qoriq-usb2-mph-0.dtsi"
412 usb0: usb@210000 {
413 compatible = "fsl-usb2-mph-v2.4", "fsl-usb2-mph";
414 phy_type = "utmi";
415 port0;
416 };
417/include/ "qoriq-usb2-dr-0.dtsi"
418 usb1: usb@211000 {
419 compatible = "fsl-usb2-dr-v2.4", "fsl-usb2-dr";
420 dr_mode = "host";
421 phy_type = "utmi";
422 };
423/include/ "qoriq-sata2-0.dtsi"
424/include/ "qoriq-sata2-1.dtsi"
425/include/ "qoriq-sec5.0-0.dtsi"
426
427 L2_1: l2-cache-controller@c20000 {
428 compatible = "fsl,t4240-l2-cache-controller";
429 reg = <0xc20000 0x40000>;
430 next-level-cache = <&cpc>;
431 };
432 L2_2: l2-cache-controller@c60000 {
433 compatible = "fsl,t4240-l2-cache-controller";
434 reg = <0xc60000 0x40000>;
435 next-level-cache = <&cpc>;
436 };
437 L2_3: l2-cache-controller@ca0000 {
438 compatible = "fsl,t4240-l2-cache-controller";
439 reg = <0xca0000 0x40000>;
440 next-level-cache = <&cpc>;
441 };
442};
diff --git a/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi
new file mode 100644
index 000000000000..a93c55a88560
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/t4240si-pre.dtsi
@@ -0,0 +1,128 @@
1/*
2 * T4240 Silicon/SoC Device Tree Source (pre include)
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/dts-v1/;
36
37/include/ "e6500_power_isa.dtsi"
38
39/ {
40 compatible = "fsl,T4240";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44
45 aliases {
46 ccsr = &soc;
47 dcsr = &dcsr;
48
49 serial0 = &serial0;
50 serial1 = &serial1;
51 serial2 = &serial2;
52 serial3 = &serial3;
53 crypto = &crypto;
54 pci0 = &pci0;
55 pci1 = &pci1;
56 pci2 = &pci2;
57 pci3 = &pci3;
58 dma0 = &dma0;
59 dma1 = &dma1;
60 sdhc = &sdhc;
61 };
62
63 cpus {
64 #address-cells = <1>;
65 #size-cells = <0>;
66
67 cpu0: PowerPC,e6500@0 {
68 device_type = "cpu";
69 reg = <0 1>;
70 next-level-cache = <&L2_1>;
71 };
72 cpu1: PowerPC,e6500@2 {
73 device_type = "cpu";
74 reg = <2 3>;
75 next-level-cache = <&L2_1>;
76 };
77 cpu2: PowerPC,e6500@4 {
78 device_type = "cpu";
79 reg = <4 5>;
80 next-level-cache = <&L2_1>;
81 };
82 cpu3: PowerPC,e6500@6 {
83 device_type = "cpu";
84 reg = <6 7>;
85 next-level-cache = <&L2_1>;
86 };
87 cpu4: PowerPC,e6500@8 {
88 device_type = "cpu";
89 reg = <8 9>;
90 next-level-cache = <&L2_2>;
91 };
92 cpu5: PowerPC,e6500@10 {
93 device_type = "cpu";
94 reg = <10 11>;
95 next-level-cache = <&L2_2>;
96 };
97 cpu6: PowerPC,e6500@12 {
98 device_type = "cpu";
99 reg = <12 13>;
100 next-level-cache = <&L2_2>;
101 };
102 cpu7: PowerPC,e6500@14 {
103 device_type = "cpu";
104 reg = <14 15>;
105 next-level-cache = <&L2_2>;
106 };
107 cpu8: PowerPC,e6500@16 {
108 device_type = "cpu";
109 reg = <16 17>;
110 next-level-cache = <&L2_3>;
111 };
112 cpu9: PowerPC,e6500@18 {
113 device_type = "cpu";
114 reg = <18 19>;
115 next-level-cache = <&L2_3>;
116 };
117 cpu10: PowerPC,e6500@20 {
118 device_type = "cpu";
119 reg = <20 21>;
120 next-level-cache = <&L2_3>;
121 };
122 cpu11: PowerPC,e6500@22 {
123 device_type = "cpu";
124 reg = <22 23>;
125 next-level-cache = <&L2_3>;
126 };
127 };
128};
diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi b/arch/powerpc/boot/dts/mpc5121.dtsi
index 723e292b6b4e..bd14c00e5146 100644
--- a/arch/powerpc/boot/dts/mpc5121.dtsi
+++ b/arch/powerpc/boot/dts/mpc5121.dtsi
@@ -152,6 +152,8 @@
152 compatible = "fsl,mpc5121-sdhc"; 152 compatible = "fsl,mpc5121-sdhc";
153 reg = <0x1500 0x100>; 153 reg = <0x1500 0x100>;
154 interrupts = <8 0x8>; 154 interrupts = <8 0x8>;
155 dmas = <&dma0 30>;
156 dma-names = "rx-tx";
155 }; 157 };
156 158
157 i2c@1700 { 159 i2c@1700 {
@@ -384,7 +386,7 @@
384 interrupts = <40 0x8>; 386 interrupts = <40 0x8>;
385 }; 387 };
386 388
387 dma@14000 { 389 dma0: dma@14000 {
388 compatible = "fsl,mpc5121-dma"; 390 compatible = "fsl,mpc5121-dma";
389 reg = <0x14000 0x1800>; 391 reg = <0x14000 0x1800>;
390 interrupts = <65 0x8>; 392 interrupts = <65 0x8>;
diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
index f269b1382ef7..7d3cb79185cb 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -13,7 +13,7 @@
13 13
14/ { 14/ {
15 model = "mpc5121ads"; 15 model = "mpc5121ads";
16 compatible = "fsl,mpc5121ads"; 16 compatible = "fsl,mpc5121ads", "fsl,mpc5121";
17 17
18 nfc@40000000 { 18 nfc@40000000 {
19 /* 19 /*
diff --git a/arch/powerpc/boot/dts/mpc5125twr.dts b/arch/powerpc/boot/dts/mpc5125twr.dts
new file mode 100644
index 000000000000..4177b62240c2
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc5125twr.dts
@@ -0,0 +1,233 @@
1/*
2 * STx/Freescale ADS5125 MPC5125 silicon
3 *
4 * Copyright (C) 2009 Freescale Semiconductor Inc. All rights reserved.
5 *
6 * Reworked by Matteo Facchinetti (engineering@sirius-es.it)
7 * Copyright (C) 2013 Sirius Electronic Systems
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15/dts-v1/;
16
17/ {
18 model = "mpc5125twr"; // In BSP "mpc5125ads"
19 compatible = "fsl,mpc5125ads", "fsl,mpc5125";
20 #address-cells = <1>;
21 #size-cells = <1>;
22 interrupt-parent = <&ipic>;
23
24 aliases {
25 gpio0 = &gpio0;
26 gpio1 = &gpio1;
27 ethernet0 = &eth0;
28 };
29
30 cpus {
31 #address-cells = <1>;
32 #size-cells = <0>;
33
34 PowerPC,5125@0 {
35 device_type = "cpu";
36 reg = <0>;
37 d-cache-line-size = <0x20>; // 32 bytes
38 i-cache-line-size = <0x20>; // 32 bytes
39 d-cache-size = <0x8000>; // L1, 32K
40 i-cache-size = <0x8000>; // L1, 32K
41 timebase-frequency = <49500000>;// 49.5 MHz (csb/4)
42 bus-frequency = <198000000>; // 198 MHz csb bus
43 clock-frequency = <396000000>; // 396 MHz ppc core
44 };
45 };
46
47 memory {
48 device_type = "memory";
49 reg = <0x00000000 0x10000000>; // 256MB at 0
50 };
51
52 sram@30000000 {
53 compatible = "fsl,mpc5121-sram";
54 reg = <0x30000000 0x08000>; // 32K at 0x30000000
55 };
56
57 soc@80000000 {
58 compatible = "fsl,mpc5121-immr";
59 #address-cells = <1>;
60 #size-cells = <1>;
61 #interrupt-cells = <2>;
62 ranges = <0x0 0x80000000 0x400000>;
63 reg = <0x80000000 0x400000>;
64 bus-frequency = <66000000>; // 66 MHz ips bus
65
66 // IPIC
67 // interrupts cell = <intr #, sense>
68 // sense values match linux IORESOURCE_IRQ_* defines:
69 // sense == 8: Level, low assertion
70 // sense == 2: Edge, high-to-low change
71 //
72 ipic: interrupt-controller@c00 {
73 compatible = "fsl,mpc5121-ipic", "fsl,ipic";
74 interrupt-controller;
75 #address-cells = <0>;
76 #interrupt-cells = <2>;
77 reg = <0xc00 0x100>;
78 };
79
80 rtc@a00 { // Real time clock
81 compatible = "fsl,mpc5121-rtc";
82 reg = <0xa00 0x100>;
83 interrupts = <79 0x8 80 0x8>;
84 };
85
86 reset@e00 { // Reset module
87 compatible = "fsl,mpc5125-reset";
88 reg = <0xe00 0x100>;
89 };
90
91 clock@f00 { // Clock control
92 compatible = "fsl,mpc5121-clock";
93 reg = <0xf00 0x100>;
94 };
95
96 pmc@1000{ // Power Management Controller
97 compatible = "fsl,mpc5121-pmc";
98 reg = <0x1000 0x100>;
99 interrupts = <83 0x2>;
100 };
101
102 gpio0: gpio@1100 {
103 compatible = "fsl,mpc5125-gpio";
104 reg = <0x1100 0x080>;
105 interrupts = <78 0x8>;
106 };
107
108 gpio1: gpio@1180 {
109 compatible = "fsl,mpc5125-gpio";
110 reg = <0x1180 0x080>;
111 interrupts = <86 0x8>;
112 };
113
114 can@1300 { // CAN rev.2
115 compatible = "fsl,mpc5121-mscan";
116 interrupts = <12 0x8>;
117 reg = <0x1300 0x80>;
118 };
119
120 can@1380 {
121 compatible = "fsl,mpc5121-mscan";
122 interrupts = <13 0x8>;
123 reg = <0x1380 0x80>;
124 };
125
126 sdhc@1500 {
127 compatible = "fsl,mpc5121-sdhc";
128 interrupts = <8 0x8>;
129 reg = <0x1500 0x100>;
130 };
131
132 i2c@1700 {
133 #address-cells = <1>;
134 #size-cells = <0>;
135 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
136 reg = <0x1700 0x20>;
137 interrupts = <0x9 0x8>;
138 };
139
140 i2c@1720 {
141 #address-cells = <1>;
142 #size-cells = <0>;
143 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
144 reg = <0x1720 0x20>;
145 interrupts = <0xa 0x8>;
146 };
147
148 i2c@1740 {
149 #address-cells = <1>;
150 #size-cells = <0>;
151 compatible = "fsl,mpc5121-i2c", "fsl-i2c";
152 reg = <0x1740 0x20>;
153 interrupts = <0xb 0x8>;
154 };
155
156 i2ccontrol@1760 {
157 compatible = "fsl,mpc5121-i2c-ctrl";
158 reg = <0x1760 0x8>;
159 };
160
161 diu@2100 {
162 compatible = "fsl,mpc5121-diu";
163 reg = <0x2100 0x100>;
164 interrupts = <64 0x8>;
165 };
166
167 mdio@2800 {
168 compatible = "fsl,mpc5121-fec-mdio";
169 reg = <0x2800 0x800>;
170 #address-cells = <1>;
171 #size-cells = <0>;
172 phy0: ethernet-phy@0 {
173 reg = <1>;
174 };
175 };
176
177 eth0: ethernet@2800 {
178 compatible = "fsl,mpc5125-fec";
179 reg = <0x2800 0x800>;
180 local-mac-address = [ 00 00 00 00 00 00 ];
181 interrupts = <4 0x8>;
182 phy-handle = < &phy0 >;
183 phy-connection-type = "rmii";
184 };
185
186 // IO control
187 ioctl@a000 {
188 compatible = "fsl,mpc5125-ioctl";
189 reg = <0xA000 0x1000>;
190 };
191
192 usb@3000 {
193 compatible = "fsl,mpc5121-usb2-dr";
194 reg = <0x3000 0x400>;
195 #address-cells = <1>;
196 #size-cells = <0>;
197 interrupts = <43 0x8>;
198 dr_mode = "host";
199 phy_type = "ulpi";
200 };
201
202 // 5125 PSCs are not 52xx or 5121 PSC compatible
203 // PSC1 uart0 aka ttyPSC0
204 serial@11100 {
205 compatible = "fsl,mpc5125-psc-uart", "fsl,mpc5125-psc";
206 reg = <0x11100 0x100>;
207 interrupts = <40 0x8>;
208 fsl,rx-fifo-size = <16>;
209 fsl,tx-fifo-size = <16>;
210 };
211
212 // PSC9 uart1 aka ttyPSC1
213 serial@11900 {
214 compatible = "fsl,mpc5125-psc-uart", "fsl,mpc5125-psc";
215 reg = <0x11900 0x100>;
216 interrupts = <40 0x8>;
217 fsl,rx-fifo-size = <16>;
218 fsl,tx-fifo-size = <16>;
219 };
220
221 pscfifo@11f00 {
222 compatible = "fsl,mpc5121-psc-fifo";
223 reg = <0x11f00 0x100>;
224 interrupts = <40 0x8>;
225 };
226
227 dma@14000 {
228 compatible = "fsl,mpc5121-dma"; // BSP name: "mpc512x-dma2"
229 reg = <0x14000 0x1800>;
230 interrupts = <65 0x8>;
231 };
232 };
233};
diff --git a/arch/powerpc/boot/dts/mpc8536ds_36b.dts b/arch/powerpc/boot/dts/mpc8536ds_36b.dts
index f8a3b3413176..6c723ee108cd 100644
--- a/arch/powerpc/boot/dts/mpc8536ds_36b.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds_36b.dts
@@ -32,7 +32,7 @@
32 reg = <0 0 0 0>; // Filled by U-Boot 32 reg = <0 0 0 0>; // Filled by U-Boot
33 }; 33 };
34 34
35 lbc: localbus@ffe05000 { 35 lbc: localbus@fffe05000 {
36 reg = <0xf 0xffe05000 0 0x1000>; 36 reg = <0xf 0xffe05000 0 0x1000>;
37 37
38 ranges = <0x0 0x0 0xf 0xe8000000 0x08000000 38 ranges = <0x0 0x0 0xf 0xe8000000 0x08000000
@@ -44,7 +44,7 @@
44 ranges = <0x0 0xf 0xffe00000 0x100000>; 44 ranges = <0x0 0xf 0xffe00000 0x100000>;
45 }; 45 };
46 46
47 pci0: pci@ffe08000 { 47 pci0: pci@fffe08000 {
48 reg = <0xf 0xffe08000 0 0x1000>; 48 reg = <0xf 0xffe08000 0 0x1000>;
49 ranges = <0x02000000 0 0xf0000000 0xc 0x00000000 0 0x10000000 49 ranges = <0x02000000 0 0xf0000000 0xc 0x00000000 0 0x10000000
50 0x01000000 0 0x00000000 0xf 0xffc00000 0 0x00010000>; 50 0x01000000 0 0x00000000 0xf 0xffc00000 0 0x00010000>;
@@ -59,7 +59,7 @@
59 0x8800 0 0 4 &mpic 4 1 0 0>; 59 0x8800 0 0 4 &mpic 4 1 0 0>;
60 }; 60 };
61 61
62 pci1: pcie@ffe09000 { 62 pci1: pcie@fffe09000 {
63 reg = <0xf 0xffe09000 0 0x1000>; 63 reg = <0xf 0xffe09000 0 0x1000>;
64 ranges = <0x02000000 0 0xf8000000 0xc 0x18000000 0 0x08000000 64 ranges = <0x02000000 0 0xf8000000 0xc 0x18000000 0 0x08000000
65 0x01000000 0 0x00000000 0xf 0xffc20000 0 0x00010000>; 65 0x01000000 0 0x00000000 0xf 0xffc20000 0 0x00010000>;
diff --git a/arch/powerpc/boot/dts/p1021rdb-pc.dtsi b/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
index c13abfbbe2e2..d6274c58f496 100644
--- a/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
+++ b/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
@@ -62,11 +62,19 @@
62 }; 62 };
63 63
64 partition@400000 { 64 partition@400000 {
65 /* 11MB for JFFS2 based Root file System */ 65 /* 10.75MB for JFFS2 based Root file System */
66 reg = <0x00400000 0x00b00000>; 66 reg = <0x00400000 0x00ac0000>;
67 label = "NOR JFFS2 Root File System"; 67 label = "NOR JFFS2 Root File System";
68 }; 68 };
69 69
70 partition@ec0000 {
71 /* This location must not be altered */
72 /* 256KB for QE ucode firmware*/
73 reg = <0x00ec0000 0x00040000>;
74 label = "NOR QE microcode firmware";
75 read-only;
76 };
77
70 partition@f00000 { 78 partition@f00000 {
71 /* This location must not be altered */ 79 /* This location must not be altered */
72 /* 512KB for u-boot Bootloader Image */ 80 /* 512KB for u-boot Bootloader Image */
diff --git a/arch/powerpc/boot/dts/p1025rdb_36b.dts b/arch/powerpc/boot/dts/p1025rdb_36b.dts
index 4ce4bfa0eda4..06deb6f341ba 100644
--- a/arch/powerpc/boot/dts/p1025rdb_36b.dts
+++ b/arch/powerpc/boot/dts/p1025rdb_36b.dts
@@ -82,6 +82,11 @@
82 0x0 0x100000>; 82 0x0 0x100000>;
83 }; 83 };
84 }; 84 };
85
86 qe: qe@fffe80000 {
87 status = "disabled"; /* no firmware loaded */
88 };
89
85}; 90};
86 91
87/include/ "p1025rdb.dtsi" 92/include/ "p1025rdb.dtsi"
diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts
index 0b069477838a..74337403faee 100644
--- a/arch/powerpc/boot/dts/pdm360ng.dts
+++ b/arch/powerpc/boot/dts/pdm360ng.dts
@@ -17,7 +17,7 @@
17 17
18/ { 18/ {
19 model = "pdm360ng"; 19 model = "pdm360ng";
20 compatible = "ifm,pdm360ng"; 20 compatible = "ifm,pdm360ng", "fsl,mpc5121";
21 #address-cells = <1>; 21 #address-cells = <1>;
22 #size-cells = <1>; 22 #size-cells = <1>;
23 interrupt-parent = <&ipic>; 23 interrupt-parent = <&ipic>;
diff --git a/arch/powerpc/boot/dts/t4240qds.dts b/arch/powerpc/boot/dts/t4240qds.dts
new file mode 100644
index 000000000000..0555976dd0f3
--- /dev/null
+++ b/arch/powerpc/boot/dts/t4240qds.dts
@@ -0,0 +1,224 @@
1/*
2 * T4240QDS Device Tree Source
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35/include/ "fsl/t4240si-pre.dtsi"
36
37/ {
38 model = "fsl,T4240QDS";
39 compatible = "fsl,T4240QDS";
40 #address-cells = <2>;
41 #size-cells = <2>;
42 interrupt-parent = <&mpic>;
43
44 ifc: localbus@ffe124000 {
45 reg = <0xf 0xfe124000 0 0x2000>;
46 ranges = <0 0 0xf 0xe8000000 0x08000000
47 2 0 0xf 0xff800000 0x00010000
48 3 0 0xf 0xffdf0000 0x00008000>;
49
50 nor@0,0 {
51 #address-cells = <1>;
52 #size-cells = <1>;
53 compatible = "cfi-flash";
54 reg = <0x0 0x0 0x8000000>;
55
56 bank-width = <2>;
57 device-width = <1>;
58 };
59
60 nand@2,0 {
61 #address-cells = <1>;
62 #size-cells = <1>;
63 compatible = "fsl,ifc-nand";
64 reg = <0x2 0x0 0x10000>;
65
66 partition@0 {
67 /* This location must not be altered */
68 /* 1MB for u-boot Bootloader Image */
69 reg = <0x0 0x00100000>;
70 label = "NAND U-Boot Image";
71 read-only;
72 };
73
74 partition@100000 {
75 /* 1MB for DTB Image */
76 reg = <0x00100000 0x00100000>;
77 label = "NAND DTB Image";
78 };
79
80 partition@200000 {
81 /* 10MB for Linux Kernel Image */
82 reg = <0x00200000 0x00A00000>;
83 label = "NAND Linux Kernel Image";
84 };
85
86 partition@C00000 {
87 /* 500MB for Root file System Image */
88 reg = <0x00c00000 0x1F400000>;
89 label = "NAND RFS Image";
90 };
91 };
92
93 board-control@3,0 {
94 compatible = "fsl,t4240qds-fpga", "fsl,fpga-qixis";
95 reg = <3 0 0x300>;
96 };
97 };
98
99 memory {
100 device_type = "memory";
101 };
102
103 dcsr: dcsr@f00000000 {
104 ranges = <0x00000000 0xf 0x00000000 0x01072000>;
105 };
106
107 soc: soc@ffe000000 {
108 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
109 reg = <0xf 0xfe000000 0 0x00001000>;
110 spi@110000 {
111 flash@0 {
112 #address-cells = <1>;
113 #size-cells = <1>;
114 compatible = "sst,sst25wf040";
115 reg = <0>;
116 spi-max-frequency = <40000000>; /* input clock */
117 };
118 };
119
120 i2c@118000 {
121 eeprom@51 {
122 compatible = "at24,24c256";
123 reg = <0x51>;
124 };
125 eeprom@52 {
126 compatible = "at24,24c256";
127 reg = <0x52>;
128 };
129 eeprom@53 {
130 compatible = "at24,24c256";
131 reg = <0x53>;
132 };
133 eeprom@54 {
134 compatible = "at24,24c256";
135 reg = <0x54>;
136 };
137 eeprom@55 {
138 compatible = "at24,24c256";
139 reg = <0x55>;
140 };
141 eeprom@56 {
142 compatible = "at24,24c256";
143 reg = <0x56>;
144 };
145 rtc@68 {
146 compatible = "dallas,ds3232";
147 reg = <0x68>;
148 interrupts = <0x1 0x1 0 0>;
149 };
150 };
151 };
152
153 pci0: pcie@ffe240000 {
154 reg = <0xf 0xfe240000 0 0x10000>;
155 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
156 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
157 pcie@0 {
158 ranges = <0x02000000 0 0xe0000000
159 0x02000000 0 0xe0000000
160 0 0x20000000
161
162 0x01000000 0 0x00000000
163 0x01000000 0 0x00000000
164 0 0x00010000>;
165 };
166 };
167
168 pci1: pcie@ffe250000 {
169 reg = <0xf 0xfe250000 0 0x10000>;
170 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
171 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
172 pcie@0 {
173 ranges = <0x02000000 0 0xe0000000
174 0x02000000 0 0xe0000000
175 0 0x20000000
176
177 0x01000000 0 0x00000000
178 0x01000000 0 0x00000000
179 0 0x00010000>;
180 };
181 };
182
183 pci2: pcie@ffe260000 {
184 reg = <0xf 0xfe260000 0 0x1000>;
185 ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000
186 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
187 pcie@0 {
188 ranges = <0x02000000 0 0xe0000000
189 0x02000000 0 0xe0000000
190 0 0x20000000
191
192 0x01000000 0 0x00000000
193 0x01000000 0 0x00000000
194 0 0x00010000>;
195 };
196 };
197
198 pci3: pcie@ffe270000 {
199 reg = <0xf 0xfe270000 0 0x10000>;
200 ranges = <0x02000000 0 0xe0000000 0xc 0x60000000 0 0x20000000
201 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>;
202 pcie@0 {
203 ranges = <0x02000000 0 0xe0000000
204 0x02000000 0 0xe0000000
205 0 0x20000000
206
207 0x01000000 0 0x00000000
208 0x01000000 0 0x00000000
209 0 0x00010000>;
210 };
211 };
212 rio: rapidio@ffe0c0000 {
213 reg = <0xf 0xfe0c0000 0 0x11000>;
214
215 port1 {
216 ranges = <0 0 0xc 0x20000000 0 0x10000000>;
217 };
218 port2 {
219 ranges = <0 0 0xc 0x30000000 0 0x10000000>;
220 };
221 };
222};
223
224/include/ "fsl/t4240si-post.dtsi"
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index 3d139fa04050..6c8b020806ff 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -1,14 +1,13 @@
1CONFIG_PPC64=y 1CONFIG_PPC64=y
2CONFIG_PPC_BOOK3E_64=y 2CONFIG_PPC_BOOK3E_64=y
3# CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set 3CONFIG_ALTIVEC=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_NR_CPUS=2 5CONFIG_NR_CPUS=24
6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
8CONFIG_BSD_PROCESS_ACCT=y
9CONFIG_IRQ_DOMAIN_DEBUG=y 7CONFIG_IRQ_DOMAIN_DEBUG=y
10CONFIG_NO_HZ=y 8CONFIG_NO_HZ=y
11CONFIG_HIGH_RES_TIMERS=y 9CONFIG_HIGH_RES_TIMERS=y
10CONFIG_BSD_PROCESS_ACCT=y
12CONFIG_IKCONFIG=y 11CONFIG_IKCONFIG=y
13CONFIG_IKCONFIG_PROC=y 12CONFIG_IKCONFIG_PROC=y
14CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
@@ -22,10 +21,13 @@ CONFIG_MODVERSIONS=y
22# CONFIG_BLK_DEV_BSG is not set 21# CONFIG_BLK_DEV_BSG is not set
23CONFIG_PARTITION_ADVANCED=y 22CONFIG_PARTITION_ADVANCED=y
24CONFIG_MAC_PARTITION=y 23CONFIG_MAC_PARTITION=y
24CONFIG_B4_QDS=y
25CONFIG_P5020_DS=y 25CONFIG_P5020_DS=y
26CONFIG_P5040_DS=y 26CONFIG_P5040_DS=y
27CONFIG_T4240_QDS=y
27# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set 28# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
28CONFIG_BINFMT_MISC=m 29CONFIG_BINFMT_MISC=m
30CONFIG_FSL_IFC=y
29CONFIG_PCIEPORTBUS=y 31CONFIG_PCIEPORTBUS=y
30CONFIG_PCI_MSI=y 32CONFIG_PCI_MSI=y
31CONFIG_RAPIDIO=y 33CONFIG_RAPIDIO=y
@@ -58,16 +60,33 @@ CONFIG_IP_SCTP=m
58CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 60CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
59CONFIG_DEVTMPFS=y 61CONFIG_DEVTMPFS=y
60CONFIG_MTD=y 62CONFIG_MTD=y
63CONFIG_MTD_PARTITIONS=y
64CONFIG_MTD_OF_PARTS=y
61CONFIG_MTD_CMDLINE_PARTS=y 65CONFIG_MTD_CMDLINE_PARTS=y
62CONFIG_MTD_CHAR=y 66CONFIG_MTD_CHAR=y
67CONFIG_MTD_BLKDEVS=y
63CONFIG_MTD_BLOCK=y 68CONFIG_MTD_BLOCK=y
69CONFIG_FTL=y
64CONFIG_MTD_CFI=y 70CONFIG_MTD_CFI=y
71CONFIG_MTD_GEN_PROBE=y
72CONFIG_MTD_MAP_BANK_WIDTH_1=y
73CONFIG_MTD_MAP_BANK_WIDTH_2=y
74CONFIG_MTD_MAP_BANK_WIDTH_4=y
75CONFIG_MTD_CFI_I1=y
76CONFIG_MTD_CFI_I2=y
77CONFIG_MTD_CFI_INTELEXT=y
65CONFIG_MTD_CFI_AMDSTD=y 78CONFIG_MTD_CFI_AMDSTD=y
66CONFIG_MTD_PHYSMAP_OF=y 79CONFIG_MTD_PHYSMAP_OF=y
67CONFIG_MTD_M25P80=y 80CONFIG_MTD_M25P80=y
81CONFIG_MTD_CFI_UTIL=y
82CONFIG_MTD_NAND_ECC=y
68CONFIG_MTD_NAND=y 83CONFIG_MTD_NAND=y
84CONFIG_MTD_NAND_IDS=y
69CONFIG_MTD_NAND_FSL_ELBC=y 85CONFIG_MTD_NAND_FSL_ELBC=y
70CONFIG_MTD_NAND_FSL_IFC=y 86CONFIG_MTD_NAND_FSL_IFC=y
87CONFIG_MTD_UBI=y
88CONFIG_MTD_UBI_WL_THRESHOLD=4096
89CONFIG_MTD_UBI_BEB_RESERVE=1
71CONFIG_PROC_DEVICETREE=y 90CONFIG_PROC_DEVICETREE=y
72CONFIG_BLK_DEV_LOOP=y 91CONFIG_BLK_DEV_LOOP=y
73CONFIG_BLK_DEV_RAM=y 92CONFIG_BLK_DEV_RAM=y
@@ -78,6 +97,7 @@ CONFIG_SATA_FSL=y
78CONFIG_SATA_SIL24=y 97CONFIG_SATA_SIL24=y
79CONFIG_NETDEVICES=y 98CONFIG_NETDEVICES=y
80CONFIG_DUMMY=y 99CONFIG_DUMMY=y
100CONFIG_E1000E=y
81CONFIG_INPUT_FF_MEMLESS=m 101CONFIG_INPUT_FF_MEMLESS=m
82# CONFIG_INPUT_MOUSEDEV is not set 102# CONFIG_INPUT_MOUSEDEV is not set
83# CONFIG_INPUT_KEYBOARD is not set 103# CONFIG_INPUT_KEYBOARD is not set
@@ -121,7 +141,16 @@ CONFIG_NTFS_FS=y
121CONFIG_PROC_KCORE=y 141CONFIG_PROC_KCORE=y
122CONFIG_TMPFS=y 142CONFIG_TMPFS=y
123CONFIG_HUGETLBFS=y 143CONFIG_HUGETLBFS=y
124# CONFIG_MISC_FILESYSTEMS is not set 144CONFIG_MISC_FILESYSTEMS=y
145CONFIG_JFFS2_FS=y
146CONFIG_JFFS2_FS_DEBUG=1
147CONFIG_JFFS2_FS_WRITEBUFFER=y
148CONFIG_JFFS2_ZLIB=y
149CONFIG_JFFS2_RTIME=y
150CONFIG_UBIFS_FS=y
151CONFIG_UBIFS_FS_XATTR=y
152CONFIG_UBIFS_FS_LZO=y
153CONFIG_UBIFS_FS_ZLIB=y
125CONFIG_NFS_FS=y 154CONFIG_NFS_FS=y
126CONFIG_NFS_V4=y 155CONFIG_NFS_V4=y
127CONFIG_ROOT_NFS=y 156CONFIG_ROOT_NFS=y
@@ -129,6 +158,12 @@ CONFIG_NFSD=m
129CONFIG_NLS_ISO8859_1=y 158CONFIG_NLS_ISO8859_1=y
130CONFIG_NLS_UTF8=m 159CONFIG_NLS_UTF8=m
131CONFIG_CRC_T10DIF=y 160CONFIG_CRC_T10DIF=y
161CONFIG_CRC16=y
162CONFIG_ZLIB_DEFLATE=y
163CONFIG_LZO_COMPRESS=y
164CONFIG_LZO_DECOMPRESS=y
165CONFIG_CRYPTO_DEFLATE=y
166CONFIG_CRYPTO_LZO=y
132CONFIG_FRAME_WARN=1024 167CONFIG_FRAME_WARN=1024
133CONFIG_MAGIC_SYSRQ=y 168CONFIG_MAGIC_SYSRQ=y
134CONFIG_DEBUG_FS=y 169CONFIG_DEBUG_FS=y
@@ -140,6 +175,5 @@ CONFIG_CRYPTO_PCBC=m
140CONFIG_CRYPTO_MD4=y 175CONFIG_CRYPTO_MD4=y
141CONFIG_CRYPTO_SHA256=y 176CONFIG_CRYPTO_SHA256=y
142CONFIG_CRYPTO_SHA512=y 177CONFIG_CRYPTO_SHA512=y
143CONFIG_CRYPTO_AES=y
144# CONFIG_CRYPTO_ANSI_CPRNG is not set 178# CONFIG_CRYPTO_ANSI_CPRNG is not set
145CONFIG_CRYPTO_DEV_FSL_CAAM=y 179CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git a/arch/powerpc/configs/mpc512x_defconfig b/arch/powerpc/configs/mpc512x_defconfig
index 211fcc9ed700..0d0d981442fd 100644
--- a/arch/powerpc/configs/mpc512x_defconfig
+++ b/arch/powerpc/configs/mpc512x_defconfig
@@ -13,7 +13,7 @@ CONFIG_MODULE_UNLOAD=y
13# CONFIG_PPC_CHRP is not set 13# CONFIG_PPC_CHRP is not set
14CONFIG_PPC_MPC512x=y 14CONFIG_PPC_MPC512x=y
15CONFIG_MPC5121_ADS=y 15CONFIG_MPC5121_ADS=y
16CONFIG_MPC5121_GENERIC=y 16CONFIG_MPC512x_GENERIC=y
17CONFIG_PDM360NG=y 17CONFIG_PDM360NG=y
18# CONFIG_PPC_PMAC is not set 18# CONFIG_PPC_PMAC is not set
19CONFIG_NO_HZ=y 19CONFIG_NO_HZ=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index cf815e847cdc..5a58882e351e 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -1,13 +1,12 @@
1CONFIG_PPC_85xx=y 1CONFIG_PPC_85xx=y
2CONFIG_PHYS_64BIT=y 2CONFIG_PHYS_64BIT=y
3CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_AUDIT=y 5CONFIG_AUDIT=y
8CONFIG_IRQ_DOMAIN_DEBUG=y 6CONFIG_IRQ_DOMAIN_DEBUG=y
9CONFIG_NO_HZ=y 7CONFIG_NO_HZ=y
10CONFIG_HIGH_RES_TIMERS=y 8CONFIG_HIGH_RES_TIMERS=y
9CONFIG_BSD_PROCESS_ACCT=y
11CONFIG_IKCONFIG=y 10CONFIG_IKCONFIG=y
12CONFIG_IKCONFIG_PROC=y 11CONFIG_IKCONFIG_PROC=y
13CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
@@ -48,6 +47,7 @@ CONFIG_HIGHMEM=y
48CONFIG_BINFMT_MISC=m 47CONFIG_BINFMT_MISC=m
49CONFIG_MATH_EMULATION=y 48CONFIG_MATH_EMULATION=y
50CONFIG_FORCE_MAX_ZONEORDER=12 49CONFIG_FORCE_MAX_ZONEORDER=12
50CONFIG_FSL_IFC=y
51CONFIG_PCI=y 51CONFIG_PCI=y
52CONFIG_PCI_MSI=y 52CONFIG_PCI_MSI=y
53CONFIG_RAPIDIO=y 53CONFIG_RAPIDIO=y
@@ -79,18 +79,33 @@ CONFIG_IP_SCTP=m
79CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 79CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
80CONFIG_DEVTMPFS=y 80CONFIG_DEVTMPFS=y
81CONFIG_MTD=y 81CONFIG_MTD=y
82CONFIG_MTD_PARTITIONS=y
83CONFIG_MTD_OF_PARTS=y
82CONFIG_MTD_CMDLINE_PARTS=y 84CONFIG_MTD_CMDLINE_PARTS=y
83CONFIG_MTD_CHAR=y 85CONFIG_MTD_CHAR=y
86CONFIG_MTD_BLKDEVS=y
84CONFIG_MTD_BLOCK=y 87CONFIG_MTD_BLOCK=y
85CONFIG_FTL=y 88CONFIG_FTL=y
86CONFIG_MTD_CFI=y 89CONFIG_MTD_CFI=y
90CONFIG_MTD_GEN_PROBE=y
91CONFIG_MTD_MAP_BANK_WIDTH_1=y
92CONFIG_MTD_MAP_BANK_WIDTH_2=y
93CONFIG_MTD_MAP_BANK_WIDTH_4=y
94CONFIG_MTD_CFI_I1=y
95CONFIG_MTD_CFI_I2=y
87CONFIG_MTD_CFI_INTELEXT=y 96CONFIG_MTD_CFI_INTELEXT=y
88CONFIG_MTD_CFI_AMDSTD=y 97CONFIG_MTD_CFI_AMDSTD=y
89CONFIG_MTD_PHYSMAP_OF=y 98CONFIG_MTD_PHYSMAP_OF=y
90CONFIG_MTD_M25P80=y 99CONFIG_MTD_M25P80=y
100CONFIG_MTD_CFI_UTIL=y
101CONFIG_MTD_NAND_ECC=y
91CONFIG_MTD_NAND=y 102CONFIG_MTD_NAND=y
103CONFIG_MTD_NAND_IDS=y
92CONFIG_MTD_NAND_FSL_ELBC=y 104CONFIG_MTD_NAND_FSL_ELBC=y
93CONFIG_MTD_NAND_FSL_IFC=y 105CONFIG_MTD_NAND_FSL_IFC=y
106CONFIG_MTD_UBI=y
107CONFIG_MTD_UBI_WL_THRESHOLD=4096
108CONFIG_MTD_UBI_BEB_RESERVE=1
94CONFIG_PROC_DEVICETREE=y 109CONFIG_PROC_DEVICETREE=y
95CONFIG_BLK_DEV_LOOP=y 110CONFIG_BLK_DEV_LOOP=y
96CONFIG_BLK_DEV_NBD=y 111CONFIG_BLK_DEV_NBD=y
@@ -106,6 +121,7 @@ CONFIG_SCSI_LOGGING=y
106CONFIG_ATA=y 121CONFIG_ATA=y
107CONFIG_SATA_AHCI=y 122CONFIG_SATA_AHCI=y
108CONFIG_SATA_FSL=y 123CONFIG_SATA_FSL=y
124CONFIG_SATA_SIL24=y
109CONFIG_PATA_ALI=y 125CONFIG_PATA_ALI=y
110CONFIG_PATA_VIA=y 126CONFIG_PATA_VIA=y
111CONFIG_NETDEVICES=y 127CONFIG_NETDEVICES=y
@@ -113,6 +129,9 @@ CONFIG_DUMMY=y
113CONFIG_FS_ENET=y 129CONFIG_FS_ENET=y
114CONFIG_UCC_GETH=y 130CONFIG_UCC_GETH=y
115CONFIG_GIANFAR=y 131CONFIG_GIANFAR=y
132CONFIG_E1000=y
133CONFIG_E1000E=y
134CONFIG_IGB=y
116CONFIG_MARVELL_PHY=y 135CONFIG_MARVELL_PHY=y
117CONFIG_DAVICOM_PHY=y 136CONFIG_DAVICOM_PHY=y
118CONFIG_CICADA_PHY=y 137CONFIG_CICADA_PHY=y
@@ -132,7 +151,6 @@ CONFIG_SERIAL_8250_DETECT_IRQ=y
132CONFIG_SERIAL_8250_RSA=y 151CONFIG_SERIAL_8250_RSA=y
133CONFIG_SERIAL_QE=m 152CONFIG_SERIAL_QE=m
134CONFIG_NVRAM=y 153CONFIG_NVRAM=y
135CONFIG_I2C=y
136CONFIG_I2C_CHARDEV=y 154CONFIG_I2C_CHARDEV=y
137CONFIG_I2C_CPM=m 155CONFIG_I2C_CPM=m
138CONFIG_I2C_MPC=y 156CONFIG_I2C_MPC=y
@@ -206,6 +224,15 @@ CONFIG_NTFS_FS=y
206CONFIG_PROC_KCORE=y 224CONFIG_PROC_KCORE=y
207CONFIG_TMPFS=y 225CONFIG_TMPFS=y
208CONFIG_HUGETLBFS=y 226CONFIG_HUGETLBFS=y
227CONFIG_JFFS2_FS=y
228CONFIG_JFFS2_FS_DEBUG=1
229CONFIG_JFFS2_FS_WRITEBUFFER=y
230CONFIG_JFFS2_ZLIB=y
231CONFIG_JFFS2_RTIME=y
232CONFIG_UBIFS_FS=y
233CONFIG_UBIFS_FS_XATTR=y
234CONFIG_UBIFS_FS_LZO=y
235CONFIG_UBIFS_FS_ZLIB=y
209CONFIG_ADFS_FS=m 236CONFIG_ADFS_FS=m
210CONFIG_AFFS_FS=m 237CONFIG_AFFS_FS=m
211CONFIG_HFS_FS=m 238CONFIG_HFS_FS=m
@@ -224,13 +251,18 @@ CONFIG_NFS_V4=y
224CONFIG_ROOT_NFS=y 251CONFIG_ROOT_NFS=y
225CONFIG_NFSD=y 252CONFIG_NFSD=y
226CONFIG_CRC_T10DIF=y 253CONFIG_CRC_T10DIF=y
254CONFIG_CRC16=y
255CONFIG_ZLIB_DEFLATE=y
256CONFIG_LZO_COMPRESS=y
257CONFIG_LZO_DECOMPRESS=y
258CONFIG_CRYPTO_DEFLATE=y
259CONFIG_CRYPTO_LZO=y
227CONFIG_DEBUG_FS=y 260CONFIG_DEBUG_FS=y
228CONFIG_DETECT_HUNG_TASK=y 261CONFIG_DETECT_HUNG_TASK=y
229CONFIG_DEBUG_INFO=y 262CONFIG_DEBUG_INFO=y
230CONFIG_CRYPTO_PCBC=m 263CONFIG_CRYPTO_PCBC=m
231CONFIG_CRYPTO_SHA256=y 264CONFIG_CRYPTO_SHA256=y
232CONFIG_CRYPTO_SHA512=y 265CONFIG_CRYPTO_SHA512=y
233CONFIG_CRYPTO_AES=y
234# CONFIG_CRYPTO_ANSI_CPRNG is not set 266# CONFIG_CRYPTO_ANSI_CPRNG is not set
235CONFIG_CRYPTO_DEV_FSL_CAAM=y 267CONFIG_CRYPTO_DEV_FSL_CAAM=y
236CONFIG_CRYPTO_DEV_TALITOS=y 268CONFIG_CRYPTO_DEV_TALITOS=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 8d00ea5b8a9f..165e6b32baef 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -50,6 +50,7 @@ CONFIG_HIGHMEM=y
50CONFIG_BINFMT_MISC=m 50CONFIG_BINFMT_MISC=m
51CONFIG_MATH_EMULATION=y 51CONFIG_MATH_EMULATION=y
52CONFIG_FORCE_MAX_ZONEORDER=12 52CONFIG_FORCE_MAX_ZONEORDER=12
53CONFIG_FSL_IFC=y
53CONFIG_PCI=y 54CONFIG_PCI=y
54CONFIG_PCI_MSI=y 55CONFIG_PCI_MSI=y
55CONFIG_RAPIDIO=y 56CONFIG_RAPIDIO=y
@@ -81,18 +82,33 @@ CONFIG_IP_SCTP=m
81CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 82CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
82CONFIG_DEVTMPFS=y 83CONFIG_DEVTMPFS=y
83CONFIG_MTD=y 84CONFIG_MTD=y
85CONFIG_MTD_PARTITIONS=y
86CONFIG_MTD_OF_PARTS=y
84CONFIG_MTD_CMDLINE_PARTS=y 87CONFIG_MTD_CMDLINE_PARTS=y
85CONFIG_MTD_CHAR=y 88CONFIG_MTD_CHAR=y
89CONFIG_MTD_BLKDEVS=y
86CONFIG_MTD_BLOCK=y 90CONFIG_MTD_BLOCK=y
87CONFIG_FTL=y 91CONFIG_FTL=y
88CONFIG_MTD_CFI=y 92CONFIG_MTD_CFI=y
93CONFIG_MTD_GEN_PROBE=y
94CONFIG_MTD_MAP_BANK_WIDTH_1=y
95CONFIG_MTD_MAP_BANK_WIDTH_2=y
96CONFIG_MTD_MAP_BANK_WIDTH_4=y
97CONFIG_MTD_CFI_I1=y
98CONFIG_MTD_CFI_I2=y
89CONFIG_MTD_CFI_INTELEXT=y 99CONFIG_MTD_CFI_INTELEXT=y
90CONFIG_MTD_CFI_AMDSTD=y 100CONFIG_MTD_CFI_AMDSTD=y
91CONFIG_MTD_PHYSMAP_OF=y 101CONFIG_MTD_PHYSMAP_OF=y
92CONFIG_MTD_M25P80=y 102CONFIG_MTD_M25P80=y
103CONFIG_MTD_CFI_UTIL=y
104CONFIG_MTD_NAND_ECC=y
93CONFIG_MTD_NAND=y 105CONFIG_MTD_NAND=y
106CONFIG_MTD_NAND_IDS=y
94CONFIG_MTD_NAND_FSL_ELBC=y 107CONFIG_MTD_NAND_FSL_ELBC=y
95CONFIG_MTD_NAND_FSL_IFC=y 108CONFIG_MTD_NAND_FSL_IFC=y
109CONFIG_MTD_UBI=y
110CONFIG_MTD_UBI_WL_THRESHOLD=4096
111CONFIG_MTD_UBI_BEB_RESERVE=1
96CONFIG_PROC_DEVICETREE=y 112CONFIG_PROC_DEVICETREE=y
97CONFIG_BLK_DEV_LOOP=y 113CONFIG_BLK_DEV_LOOP=y
98CONFIG_BLK_DEV_NBD=y 114CONFIG_BLK_DEV_NBD=y
@@ -108,6 +124,7 @@ CONFIG_SCSI_LOGGING=y
108CONFIG_ATA=y 124CONFIG_ATA=y
109CONFIG_SATA_AHCI=y 125CONFIG_SATA_AHCI=y
110CONFIG_SATA_FSL=y 126CONFIG_SATA_FSL=y
127CONFIG_SATA_SIL24=y
111CONFIG_PATA_ALI=y 128CONFIG_PATA_ALI=y
112CONFIG_NETDEVICES=y 129CONFIG_NETDEVICES=y
113CONFIG_DUMMY=y 130CONFIG_DUMMY=y
@@ -207,6 +224,15 @@ CONFIG_NTFS_FS=y
207CONFIG_PROC_KCORE=y 224CONFIG_PROC_KCORE=y
208CONFIG_TMPFS=y 225CONFIG_TMPFS=y
209CONFIG_HUGETLBFS=y 226CONFIG_HUGETLBFS=y
227CONFIG_JFFS2_FS=y
228CONFIG_JFFS2_FS_DEBUG=1
229CONFIG_JFFS2_FS_WRITEBUFFER=y
230CONFIG_JFFS2_ZLIB=y
231CONFIG_JFFS2_RTIME=y
232CONFIG_UBIFS_FS=y
233CONFIG_UBIFS_FS_XATTR=y
234CONFIG_UBIFS_FS_LZO=y
235CONFIG_UBIFS_FS_ZLIB=y
210CONFIG_ADFS_FS=m 236CONFIG_ADFS_FS=m
211CONFIG_AFFS_FS=m 237CONFIG_AFFS_FS=m
212CONFIG_HFS_FS=m 238CONFIG_HFS_FS=m
@@ -225,6 +251,12 @@ CONFIG_NFS_V4=y
225CONFIG_ROOT_NFS=y 251CONFIG_ROOT_NFS=y
226CONFIG_NFSD=y 252CONFIG_NFSD=y
227CONFIG_CRC_T10DIF=y 253CONFIG_CRC_T10DIF=y
254CONFIG_CRC16=y
255CONFIG_ZLIB_DEFLATE=y
256CONFIG_LZO_COMPRESS=y
257CONFIG_LZO_DECOMPRESS=y
258CONFIG_CRYPTO_DEFLATE=y
259CONFIG_CRYPTO_LZO=y
228CONFIG_DEBUG_FS=y 260CONFIG_DEBUG_FS=y
229CONFIG_DETECT_HUNG_TASK=y 261CONFIG_DETECT_HUNG_TASK=y
230CONFIG_DEBUG_INFO=y 262CONFIG_DEBUG_INFO=y
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index 7a5c15fcc7cf..f79196232917 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -3,11 +3,11 @@ CONFIG_TUNE_CELL=y
3CONFIG_ALTIVEC=y 3CONFIG_ALTIVEC=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_NR_CPUS=2 5CONFIG_NR_CPUS=2
6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 6CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y 7CONFIG_POSIX_MQUEUE=y
9CONFIG_HIGH_RES_TIMERS=y 8CONFIG_HIGH_RES_TIMERS=y
10CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
10CONFIG_RD_LZMA=y
11CONFIG_CC_OPTIMIZE_FOR_SIZE=y 11CONFIG_CC_OPTIMIZE_FOR_SIZE=y
12CONFIG_EMBEDDED=y 12CONFIG_EMBEDDED=y
13# CONFIG_PERF_EVENTS is not set 13# CONFIG_PERF_EVENTS is not set
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
index 08bd299c75b1..910194e9a1e2 100644
--- a/arch/powerpc/include/asm/bitops.h
+++ b/arch/powerpc/include/asm/bitops.h
@@ -53,7 +53,7 @@
53#define smp_mb__after_clear_bit() smp_mb() 53#define smp_mb__after_clear_bit() smp_mb()
54 54
55/* Macro for generating the ***_bits() functions */ 55/* Macro for generating the ***_bits() functions */
56#define DEFINE_BITOP(fn, op, prefix, postfix) \ 56#define DEFINE_BITOP(fn, op, prefix) \
57static __inline__ void fn(unsigned long mask, \ 57static __inline__ void fn(unsigned long mask, \
58 volatile unsigned long *_p) \ 58 volatile unsigned long *_p) \
59{ \ 59{ \
@@ -66,16 +66,15 @@ static __inline__ void fn(unsigned long mask, \
66 PPC405_ERR77(0,%3) \ 66 PPC405_ERR77(0,%3) \
67 PPC_STLCX "%0,0,%3\n" \ 67 PPC_STLCX "%0,0,%3\n" \
68 "bne- 1b\n" \ 68 "bne- 1b\n" \
69 postfix \
70 : "=&r" (old), "+m" (*p) \ 69 : "=&r" (old), "+m" (*p) \
71 : "r" (mask), "r" (p) \ 70 : "r" (mask), "r" (p) \
72 : "cc", "memory"); \ 71 : "cc", "memory"); \
73} 72}
74 73
75DEFINE_BITOP(set_bits, or, "", "") 74DEFINE_BITOP(set_bits, or, "")
76DEFINE_BITOP(clear_bits, andc, "", "") 75DEFINE_BITOP(clear_bits, andc, "")
77DEFINE_BITOP(clear_bits_unlock, andc, PPC_RELEASE_BARRIER, "") 76DEFINE_BITOP(clear_bits_unlock, andc, PPC_RELEASE_BARRIER)
78DEFINE_BITOP(change_bits, xor, "", "") 77DEFINE_BITOP(change_bits, xor, "")
79 78
80static __inline__ void set_bit(int nr, volatile unsigned long *addr) 79static __inline__ void set_bit(int nr, volatile unsigned long *addr)
81{ 80{
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index fb3245e928ea..26807e5aff51 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -52,6 +52,7 @@ struct cpu_spec {
52 char *cpu_name; 52 char *cpu_name;
53 unsigned long cpu_features; /* Kernel features */ 53 unsigned long cpu_features; /* Kernel features */
54 unsigned int cpu_user_features; /* Userland features */ 54 unsigned int cpu_user_features; /* Userland features */
55 unsigned int cpu_user_features2; /* Userland features v2 */
55 unsigned int mmu_features; /* MMU features */ 56 unsigned int mmu_features; /* MMU features */
56 57
57 /* cache line sizes */ 58 /* cache line sizes */
@@ -151,7 +152,7 @@ extern const char *powerpc_base_platform;
151#define CPU_FTR_HVMODE LONG_ASM_CONST(0x0000000100000000) 152#define CPU_FTR_HVMODE LONG_ASM_CONST(0x0000000100000000)
152#define CPU_FTR_ARCH_201 LONG_ASM_CONST(0x0000000200000000) 153#define CPU_FTR_ARCH_201 LONG_ASM_CONST(0x0000000200000000)
153#define CPU_FTR_ARCH_206 LONG_ASM_CONST(0x0000000400000000) 154#define CPU_FTR_ARCH_206 LONG_ASM_CONST(0x0000000400000000)
154#define CPU_FTR_CFAR LONG_ASM_CONST(0x0000000800000000) 155#define CPU_FTR_ARCH_207S LONG_ASM_CONST(0x0000000800000000)
155#define CPU_FTR_IABR LONG_ASM_CONST(0x0000001000000000) 156#define CPU_FTR_IABR LONG_ASM_CONST(0x0000001000000000)
156#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000002000000000) 157#define CPU_FTR_MMCRA LONG_ASM_CONST(0x0000002000000000)
157#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000004000000000) 158#define CPU_FTR_CTRL LONG_ASM_CONST(0x0000004000000000)
@@ -172,7 +173,7 @@ extern const char *powerpc_base_platform;
172#define CPU_FTR_ICSWX LONG_ASM_CONST(0x0020000000000000) 173#define CPU_FTR_ICSWX LONG_ASM_CONST(0x0020000000000000)
173#define CPU_FTR_VMX_COPY LONG_ASM_CONST(0x0040000000000000) 174#define CPU_FTR_VMX_COPY LONG_ASM_CONST(0x0040000000000000)
174#define CPU_FTR_TM LONG_ASM_CONST(0x0080000000000000) 175#define CPU_FTR_TM LONG_ASM_CONST(0x0080000000000000)
175#define CPU_FTR_BCTAR LONG_ASM_CONST(0x0100000000000000) 176#define CPU_FTR_CFAR LONG_ASM_CONST(0x0100000000000000)
176#define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0200000000000000) 177#define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0200000000000000)
177#define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000) 178#define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000)
178 179
@@ -223,8 +224,10 @@ extern const char *powerpc_base_platform;
223/* We only set the TM feature if the kernel was compiled with TM supprt */ 224/* We only set the TM feature if the kernel was compiled with TM supprt */
224#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 225#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
225#define CPU_FTR_TM_COMP CPU_FTR_TM 226#define CPU_FTR_TM_COMP CPU_FTR_TM
227#define PPC_FEATURE2_HTM_COMP PPC_FEATURE2_HTM
226#else 228#else
227#define CPU_FTR_TM_COMP 0 229#define CPU_FTR_TM_COMP 0
230#define PPC_FEATURE2_HTM_COMP 0
228#endif 231#endif
229 232
230/* We need to mark all pages as being coherent if we're SMP or we have a 233/* We need to mark all pages as being coherent if we're SMP or we have a
@@ -374,7 +377,7 @@ extern const char *powerpc_base_platform;
374#define CPU_FTRS_E6500 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \ 377#define CPU_FTRS_E6500 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \
375 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ 378 CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \
376 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 379 CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
377 CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV) 380 CPU_FTR_DEBUG_LVL_EXC | CPU_FTR_EMB_HV | CPU_FTR_ALTIVEC_COMP)
378#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 381#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
379 382
380/* 64-bit CPUs */ 383/* 64-bit CPUs */
@@ -421,8 +424,8 @@ extern const char *powerpc_base_platform;
421 CPU_FTR_DSCR | CPU_FTR_SAO | \ 424 CPU_FTR_DSCR | CPU_FTR_SAO | \
422 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 425 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
423 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ 426 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
424 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | CPU_FTR_BCTAR | \ 427 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \
425 CPU_FTR_TM_COMP) 428 CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP)
426#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 429#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
427 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 430 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
428 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 431 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
diff --git a/arch/powerpc/include/asm/dma.h b/arch/powerpc/include/asm/dma.h
index f6813e919bb2..a5c6d83b5f60 100644
--- a/arch/powerpc/include/asm/dma.h
+++ b/arch/powerpc/include/asm/dma.h
@@ -16,10 +16,6 @@
16 * 16 *
17 * None of this really applies for Power Macintoshes. There is 17 * None of this really applies for Power Macintoshes. There is
18 * basically just enough here to get kernel/dma.c to compile. 18 * basically just enough here to get kernel/dma.c to compile.
19 *
20 * There may be some comments or restrictions made here which are
21 * not valid for the PReP platform. Take what you read
22 * with a grain of salt.
23 */ 19 */
24 20
25#include <asm/io.h> 21#include <asm/io.h>
@@ -57,7 +53,6 @@
57 * - page registers for 5-7 don't use data bit 0, represent 128K pages 53 * - page registers for 5-7 don't use data bit 0, represent 128K pages
58 * - page registers for 0-3 use bit 0, represent 64K pages 54 * - page registers for 0-3 use bit 0, represent 64K pages
59 * 55 *
60 * On PReP, DMA transfers are limited to the lower 16MB of _physical_ memory.
61 * On CHRP, the W83C553F (and VLSI Tollgate?) support full 32 bit addressing. 56 * On CHRP, the W83C553F (and VLSI Tollgate?) support full 32 bit addressing.
62 * Note that addresses loaded into registers must be _physical_ addresses, 57 * Note that addresses loaded into registers must be _physical_ addresses,
63 * not logical addresses (which may differ if paging is active). 58 * not logical addresses (which may differ if paging is active).
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index ac9790fc3836..cc0655a702a7 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -61,6 +61,7 @@ typedef elf_vrregset_t elf_fpxregset_t;
61 instruction set this cpu supports. This could be done in userspace, 61 instruction set this cpu supports. This could be done in userspace,
62 but it's not easy, and we've already done it here. */ 62 but it's not easy, and we've already done it here. */
63# define ELF_HWCAP (cur_cpu_spec->cpu_user_features) 63# define ELF_HWCAP (cur_cpu_spec->cpu_user_features)
64# define ELF_HWCAP2 (cur_cpu_spec->cpu_user_features2)
64 65
65/* This yields a string that ld.so will use to load implementation 66/* This yields a string that ld.so will use to load implementation
66 specific libraries for optimization. This is more specific in 67 specific libraries for optimization. This is more specific in
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 05e6d2ee1db9..8e5fae8beaf6 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -414,7 +414,6 @@ label##_relon_hv: \
414#define SOFTEN_NOTEST_HV(vec) _SOFTEN_TEST(EXC_HV, vec) 414#define SOFTEN_NOTEST_HV(vec) _SOFTEN_TEST(EXC_HV, vec)
415 415
416#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \ 416#define __MASKABLE_EXCEPTION_PSERIES(vec, label, h, extra) \
417 HMT_MEDIUM_PPR_DISCARD; \
418 SET_SCRATCH0(r13); /* save r13 */ \ 417 SET_SCRATCH0(r13); /* save r13 */ \
419 EXCEPTION_PROLOG_0(PACA_EXGEN); \ 418 EXCEPTION_PROLOG_0(PACA_EXGEN); \
420 __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \ 419 __EXCEPTION_PROLOG_1(PACA_EXGEN, extra, vec); \
@@ -427,6 +426,7 @@ label##_relon_hv: \
427 . = loc; \ 426 . = loc; \
428 .globl label##_pSeries; \ 427 .globl label##_pSeries; \
429label##_pSeries: \ 428label##_pSeries: \
429 HMT_MEDIUM_PPR_DISCARD; \
430 _MASKABLE_EXCEPTION_PSERIES(vec, label, \ 430 _MASKABLE_EXCEPTION_PSERIES(vec, label, \
431 EXC_STD, SOFTEN_TEST_PR) 431 EXC_STD, SOFTEN_TEST_PR)
432 432
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index 097dee57a7a9..0df54646f968 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -18,7 +18,6 @@
18#include <asm/feature-fixups.h> 18#include <asm/feature-fixups.h>
19 19
20/* firmware feature bitmask values */ 20/* firmware feature bitmask values */
21#define FIRMWARE_MAX_FEATURES 63
22 21
23#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001) 22#define FW_FEATURE_PFT ASM_CONST(0x0000000000000001)
24#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002) 23#define FW_FEATURE_TCE ASM_CONST(0x0000000000000002)
@@ -51,6 +50,8 @@
51#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000) 50#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000)
52#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000) 51#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000)
53#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000) 52#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)
53#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
54#define FW_FEATURE_PRRN ASM_CONST(0x0000000200000000)
54 55
55#ifndef __ASSEMBLY__ 56#ifndef __ASSEMBLY__
56 57
@@ -65,7 +66,8 @@ enum {
65 FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR | 66 FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR |
66 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | 67 FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR |
67 FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO | 68 FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO |
68 FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY, 69 FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY |
70 FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN,
69 FW_FEATURE_PSERIES_ALWAYS = 0, 71 FW_FEATURE_PSERIES_ALWAYS = 0,
70 FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2, 72 FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_OPALv2,
71 FW_FEATURE_POWERNV_ALWAYS = 0, 73 FW_FEATURE_POWERNV_ALWAYS = 0,
diff --git a/arch/powerpc/include/asm/hardirq.h b/arch/powerpc/include/asm/hardirq.h
index 3147a2970125..3bdcfce2c42a 100644
--- a/arch/powerpc/include/asm/hardirq.h
+++ b/arch/powerpc/include/asm/hardirq.h
@@ -10,6 +10,9 @@ typedef struct {
10 unsigned int pmu_irqs; 10 unsigned int pmu_irqs;
11 unsigned int mce_exceptions; 11 unsigned int mce_exceptions;
12 unsigned int spurious_irqs; 12 unsigned int spurious_irqs;
13#ifdef CONFIG_PPC_DOORBELL
14 unsigned int doorbell_irqs;
15#endif
13} ____cacheline_aligned irq_cpustat_t; 16} ____cacheline_aligned irq_cpustat_t;
14 17
15DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); 18DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 62e11a32c4c2..f2498c8e595d 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -3,9 +3,37 @@
3 3
4#ifdef CONFIG_HUGETLB_PAGE 4#ifdef CONFIG_HUGETLB_PAGE
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm-generic/hugetlb.h>
6 7
7extern struct kmem_cache *hugepte_cache; 8extern struct kmem_cache *hugepte_cache;
8 9
10#ifdef CONFIG_PPC_BOOK3S_64
11/*
12 * This should work for other subarchs too. But right now we use the
13 * new format only for 64bit book3s
14 */
15static inline pte_t *hugepd_page(hugepd_t hpd)
16{
17 BUG_ON(!hugepd_ok(hpd));
18 /*
19 * We have only four bits to encode, MMU page size
20 */
21 BUILD_BUG_ON((MMU_PAGE_COUNT - 1) > 0xf);
22 return (pte_t *)(hpd.pd & ~HUGEPD_SHIFT_MASK);
23}
24
25static inline unsigned int hugepd_mmu_psize(hugepd_t hpd)
26{
27 return (hpd.pd & HUGEPD_SHIFT_MASK) >> 2;
28}
29
30static inline unsigned int hugepd_shift(hugepd_t hpd)
31{
32 return mmu_psize_to_shift(hugepd_mmu_psize(hpd));
33}
34
35#else
36
9static inline pte_t *hugepd_page(hugepd_t hpd) 37static inline pte_t *hugepd_page(hugepd_t hpd)
10{ 38{
11 BUG_ON(!hugepd_ok(hpd)); 39 BUG_ON(!hugepd_ok(hpd));
@@ -17,6 +45,9 @@ static inline unsigned int hugepd_shift(hugepd_t hpd)
17 return hpd.pd & HUGEPD_SHIFT_MASK; 45 return hpd.pd & HUGEPD_SHIFT_MASK;
18} 46}
19 47
48#endif /* CONFIG_PPC_BOOK3S_64 */
49
50
20static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, 51static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
21 unsigned pdshift) 52 unsigned pdshift)
22{ 53{
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 4bc2c3dad6ad..cf4df8e2139a 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -270,6 +270,9 @@
270#define H_SET_MODE 0x31C 270#define H_SET_MODE 0x31C
271#define MAX_HCALL_OPCODE H_SET_MODE 271#define MAX_HCALL_OPCODE H_SET_MODE
272 272
273/* Platform specific hcalls, used by KVM */
274#define H_RTAS 0xf000
275
273#ifndef __ASSEMBLY__ 276#ifndef __ASSEMBLY__
274 277
275/** 278/**
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index e45c4947a772..d615b28dda82 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -95,15 +95,13 @@ static inline bool arch_irqs_disabled(void)
95#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1) 95#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1)
96#endif 96#endif
97 97
98static inline void hard_irq_disable(void) 98#define hard_irq_disable() do { \
99{ 99 __hard_irq_disable(); \
100 __hard_irq_disable(); 100 if (local_paca->soft_enabled) \
101 get_paca()->soft_enabled = 0; 101 trace_hardirqs_off(); \
102 get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; 102 get_paca()->soft_enabled = 0; \
103} 103 get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; \
104 104} while(0)
105/* include/linux/interrupt.h needs hard_irq_disable to be a macro */
106#define hard_irq_disable hard_irq_disable
107 105
108static inline bool lazy_irq_pending(void) 106static inline bool lazy_irq_pending(void)
109{ 107{
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f94ef4213e9d..dd15e5e37d6d 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -15,10 +15,6 @@
15extern int check_legacy_ioport(unsigned long base_port); 15extern int check_legacy_ioport(unsigned long base_port);
16#define I8042_DATA_REG 0x60 16#define I8042_DATA_REG 0x60
17#define FDC_BASE 0x3f0 17#define FDC_BASE 0x3f0
18/* only relevant for PReP */
19#define _PIDXR 0x279
20#define _PNPWRP 0xa79
21#define PNPBIOS_BASE 0xf000
22 18
23#if defined(CONFIG_PPC64) && defined(CONFIG_PCI) 19#if defined(CONFIG_PPC64) && defined(CONFIG_PCI)
24extern struct pci_dev *isa_bridge_pcidev; 20extern struct pci_dev *isa_bridge_pcidev;
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index aabcdba8f6b0..b9dd382cb349 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -67,6 +67,10 @@
67#define BOOKE_INTERRUPT_HV_SYSCALL 40 67#define BOOKE_INTERRUPT_HV_SYSCALL 40
68#define BOOKE_INTERRUPT_HV_PRIV 41 68#define BOOKE_INTERRUPT_HV_PRIV 41
69 69
70/* altivec */
71#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 42
72#define BOOKE_INTERRUPT_ALTIVEC_ASSIST 43
73
70/* book3s */ 74/* book3s */
71 75
72#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100 76#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 5a56e1c5f851..349ed85c7d61 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -142,6 +142,8 @@ extern int kvmppc_mmu_hv_init(void);
142extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); 142extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data);
143extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); 143extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data);
144extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); 144extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec);
145extern void kvmppc_book3s_dequeue_irqprio(struct kvm_vcpu *vcpu,
146 unsigned int vec);
145extern void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags); 147extern void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags);
146extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat, 148extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat,
147 bool upper, u32 val); 149 bool upper, u32 val);
@@ -156,7 +158,8 @@ void kvmppc_clear_ref_hpte(struct kvm *kvm, unsigned long *hptep,
156 unsigned long pte_index); 158 unsigned long pte_index);
157extern void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long addr, 159extern void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long addr,
158 unsigned long *nb_ret); 160 unsigned long *nb_ret);
159extern void kvmppc_unpin_guest_page(struct kvm *kvm, void *addr); 161extern void kvmppc_unpin_guest_page(struct kvm *kvm, void *addr,
162 unsigned long gpa, bool dirty);
160extern long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags, 163extern long kvmppc_virtmode_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
161 long pte_index, unsigned long pteh, unsigned long ptel); 164 long pte_index, unsigned long pteh, unsigned long ptel);
162extern long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, 165extern long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
@@ -458,6 +461,8 @@ static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
458#define OSI_SC_MAGIC_R4 0x77810F9B 461#define OSI_SC_MAGIC_R4 0x77810F9B
459 462
460#define INS_DCBZ 0x7c0007ec 463#define INS_DCBZ 0x7c0007ec
464/* TO = 31 for unconditional trap */
465#define INS_TW 0x7fe00008
461 466
462/* LPIDs we support with this build -- runtime limit may be lower */ 467/* LPIDs we support with this build -- runtime limit may be lower */
463#define KVMPPC_NR_LPIDS (LPID_RSVD + 1) 468#define KVMPPC_NR_LPIDS (LPID_RSVD + 1)
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 38bec1dc9928..9c1ff330c805 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -268,4 +268,17 @@ static inline int is_vrma_hpte(unsigned long hpte_v)
268 (HPTE_V_1TB_SEG | (VRMA_VSID << (40 - 16))); 268 (HPTE_V_1TB_SEG | (VRMA_VSID << (40 - 16)));
269} 269}
270 270
271#ifdef CONFIG_KVM_BOOK3S_64_HV
272/*
273 * Note modification of an HPTE; set the HPTE modified bit
274 * if anyone is interested.
275 */
276static inline void note_hpte_modification(struct kvm *kvm,
277 struct revmap_entry *rev)
278{
279 if (atomic_read(&kvm->arch.hpte_mod_interest))
280 rev->guest_rpte |= HPTE_GR_MODIFIED;
281}
282#endif /* CONFIG_KVM_BOOK3S_64_HV */
283
271#endif /* __ASM_KVM_BOOK3S_64_H__ */ 284#endif /* __ASM_KVM_BOOK3S_64_H__ */
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index cdc3d2717cc6..9039d3c97eec 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -20,6 +20,11 @@
20#ifndef __ASM_KVM_BOOK3S_ASM_H__ 20#ifndef __ASM_KVM_BOOK3S_ASM_H__
21#define __ASM_KVM_BOOK3S_ASM_H__ 21#define __ASM_KVM_BOOK3S_ASM_H__
22 22
23/* XICS ICP register offsets */
24#define XICS_XIRR 4
25#define XICS_MFRR 0xc
26#define XICS_IPI 2 /* interrupt source # for IPIs */
27
23#ifdef __ASSEMBLY__ 28#ifdef __ASSEMBLY__
24 29
25#ifdef CONFIG_KVM_BOOK3S_HANDLER 30#ifdef CONFIG_KVM_BOOK3S_HANDLER
@@ -81,10 +86,11 @@ struct kvmppc_host_state {
81#ifdef CONFIG_KVM_BOOK3S_64_HV 86#ifdef CONFIG_KVM_BOOK3S_64_HV
82 u8 hwthread_req; 87 u8 hwthread_req;
83 u8 hwthread_state; 88 u8 hwthread_state;
84 89 u8 host_ipi;
85 struct kvm_vcpu *kvm_vcpu; 90 struct kvm_vcpu *kvm_vcpu;
86 struct kvmppc_vcore *kvm_vcore; 91 struct kvmppc_vcore *kvm_vcore;
87 unsigned long xics_phys; 92 unsigned long xics_phys;
93 u32 saved_xirr;
88 u64 dabr; 94 u64 dabr;
89 u64 host_mmcr[3]; 95 u64 host_mmcr[3];
90 u32 host_pmc[8]; 96 u32 host_pmc[8];
diff --git a/arch/powerpc/include/asm/kvm_booke.h b/arch/powerpc/include/asm/kvm_booke.h
index b7cd3356a532..d3c1eb34c986 100644
--- a/arch/powerpc/include/asm/kvm_booke.h
+++ b/arch/powerpc/include/asm/kvm_booke.h
@@ -26,6 +26,8 @@
26/* LPIDs we support with this build -- runtime limit may be lower */ 26/* LPIDs we support with this build -- runtime limit may be lower */
27#define KVMPPC_NR_LPIDS 64 27#define KVMPPC_NR_LPIDS 64
28 28
29#define KVMPPC_INST_EHPRIV 0x7c00021c
30
29static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val) 31static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
30{ 32{
31 vcpu->arch.gpr[num] = val; 33 vcpu->arch.gpr[num] = val;
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index d1bb86074721..af326cde7cb6 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -44,6 +44,10 @@
44#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 44#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
45#endif 45#endif
46 46
47/* These values are internal and can be increased later */
48#define KVM_NR_IRQCHIPS 1
49#define KVM_IRQCHIP_NUM_PINS 256
50
47#if !defined(CONFIG_KVM_440) 51#if !defined(CONFIG_KVM_440)
48#include <linux/mmu_notifier.h> 52#include <linux/mmu_notifier.h>
49 53
@@ -188,6 +192,10 @@ struct kvmppc_linear_info {
188 int type; 192 int type;
189}; 193};
190 194
195/* XICS components, defined in book3s_xics.c */
196struct kvmppc_xics;
197struct kvmppc_icp;
198
191/* 199/*
192 * The reverse mapping array has one entry for each HPTE, 200 * The reverse mapping array has one entry for each HPTE,
193 * which stores the guest's view of the second word of the HPTE 201 * which stores the guest's view of the second word of the HPTE
@@ -255,6 +263,13 @@ struct kvm_arch {
255#endif /* CONFIG_KVM_BOOK3S_64_HV */ 263#endif /* CONFIG_KVM_BOOK3S_64_HV */
256#ifdef CONFIG_PPC_BOOK3S_64 264#ifdef CONFIG_PPC_BOOK3S_64
257 struct list_head spapr_tce_tables; 265 struct list_head spapr_tce_tables;
266 struct list_head rtas_tokens;
267#endif
268#ifdef CONFIG_KVM_MPIC
269 struct openpic *mpic;
270#endif
271#ifdef CONFIG_KVM_XICS
272 struct kvmppc_xics *xics;
258#endif 273#endif
259}; 274};
260 275
@@ -301,11 +316,13 @@ struct kvmppc_vcore {
301 * that a guest can register. 316 * that a guest can register.
302 */ 317 */
303struct kvmppc_vpa { 318struct kvmppc_vpa {
319 unsigned long gpa; /* Current guest phys addr */
304 void *pinned_addr; /* Address in kernel linear mapping */ 320 void *pinned_addr; /* Address in kernel linear mapping */
305 void *pinned_end; /* End of region */ 321 void *pinned_end; /* End of region */
306 unsigned long next_gpa; /* Guest phys addr for update */ 322 unsigned long next_gpa; /* Guest phys addr for update */
307 unsigned long len; /* Number of bytes required */ 323 unsigned long len; /* Number of bytes required */
308 u8 update_pending; /* 1 => update pinned_addr from next_gpa */ 324 u8 update_pending; /* 1 => update pinned_addr from next_gpa */
325 bool dirty; /* true => area has been modified by kernel */
309}; 326};
310 327
311struct kvmppc_pte { 328struct kvmppc_pte {
@@ -359,6 +376,11 @@ struct kvmppc_slb {
359#define KVMPPC_BOOKE_MAX_IAC 4 376#define KVMPPC_BOOKE_MAX_IAC 4
360#define KVMPPC_BOOKE_MAX_DAC 2 377#define KVMPPC_BOOKE_MAX_DAC 2
361 378
379/* KVMPPC_EPR_USER takes precedence over KVMPPC_EPR_KERNEL */
380#define KVMPPC_EPR_NONE 0 /* EPR not supported */
381#define KVMPPC_EPR_USER 1 /* exit to userspace to fill EPR */
382#define KVMPPC_EPR_KERNEL 2 /* in-kernel irqchip */
383
362struct kvmppc_booke_debug_reg { 384struct kvmppc_booke_debug_reg {
363 u32 dbcr0; 385 u32 dbcr0;
364 u32 dbcr1; 386 u32 dbcr1;
@@ -370,6 +392,12 @@ struct kvmppc_booke_debug_reg {
370 u64 dac[KVMPPC_BOOKE_MAX_DAC]; 392 u64 dac[KVMPPC_BOOKE_MAX_DAC];
371}; 393};
372 394
395#define KVMPPC_IRQ_DEFAULT 0
396#define KVMPPC_IRQ_MPIC 1
397#define KVMPPC_IRQ_XICS 2
398
399struct openpic;
400
373struct kvm_vcpu_arch { 401struct kvm_vcpu_arch {
374 ulong host_stack; 402 ulong host_stack;
375 u32 host_pid; 403 u32 host_pid;
@@ -502,8 +530,11 @@ struct kvm_vcpu_arch {
502 spinlock_t wdt_lock; 530 spinlock_t wdt_lock;
503 struct timer_list wdt_timer; 531 struct timer_list wdt_timer;
504 u32 tlbcfg[4]; 532 u32 tlbcfg[4];
533 u32 tlbps[4];
505 u32 mmucfg; 534 u32 mmucfg;
535 u32 eptcfg;
506 u32 epr; 536 u32 epr;
537 u32 crit_save;
507 struct kvmppc_booke_debug_reg dbg_reg; 538 struct kvmppc_booke_debug_reg dbg_reg;
508#endif 539#endif
509 gpa_t paddr_accessed; 540 gpa_t paddr_accessed;
@@ -521,7 +552,7 @@ struct kvm_vcpu_arch {
521 u8 sane; 552 u8 sane;
522 u8 cpu_type; 553 u8 cpu_type;
523 u8 hcall_needed; 554 u8 hcall_needed;
524 u8 epr_enabled; 555 u8 epr_flags; /* KVMPPC_EPR_xxx */
525 u8 epr_needed; 556 u8 epr_needed;
526 557
527 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ 558 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
@@ -548,6 +579,13 @@ struct kvm_vcpu_arch {
548 unsigned long magic_page_pa; /* phys addr to map the magic page to */ 579 unsigned long magic_page_pa; /* phys addr to map the magic page to */
549 unsigned long magic_page_ea; /* effect. addr to map the magic page to */ 580 unsigned long magic_page_ea; /* effect. addr to map the magic page to */
550 581
582 int irq_type; /* one of KVM_IRQ_* */
583 int irq_cpu_id;
584 struct openpic *mpic; /* KVM_IRQ_MPIC */
585#ifdef CONFIG_KVM_XICS
586 struct kvmppc_icp *icp; /* XICS presentation controller */
587#endif
588
551#ifdef CONFIG_KVM_BOOK3S_64_HV 589#ifdef CONFIG_KVM_BOOK3S_64_HV
552 struct kvm_vcpu_arch_shared shregs; 590 struct kvm_vcpu_arch_shared shregs;
553 591
@@ -588,5 +626,6 @@ struct kvm_vcpu_arch {
588#define KVM_MMIO_REG_FQPR 0x0060 626#define KVM_MMIO_REG_FQPR 0x0060
589 627
590#define __KVM_HAVE_ARCH_WQP 628#define __KVM_HAVE_ARCH_WQP
629#define __KVM_HAVE_CREATE_DEVICE
591 630
592#endif /* __POWERPC_KVM_HOST_H__ */ 631#endif /* __POWERPC_KVM_HOST_H__ */
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 44a657adf416..a5287fe03d77 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -44,7 +44,7 @@ enum emulation_result {
44 EMULATE_DO_DCR, /* kvm_run filled with DCR request */ 44 EMULATE_DO_DCR, /* kvm_run filled with DCR request */
45 EMULATE_FAIL, /* can't emulate this instruction */ 45 EMULATE_FAIL, /* can't emulate this instruction */
46 EMULATE_AGAIN, /* something went wrong. go again */ 46 EMULATE_AGAIN, /* something went wrong. go again */
47 EMULATE_DO_PAPR, /* kvm_run filled with PAPR request */ 47 EMULATE_EXIT_USER, /* emulation requires exit to user-space */
48}; 48};
49 49
50extern int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 50extern int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
@@ -104,8 +104,7 @@ extern void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu);
104extern void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu); 104extern void kvmppc_core_dequeue_dec(struct kvm_vcpu *vcpu);
105extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu, 105extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
106 struct kvm_interrupt *irq); 106 struct kvm_interrupt *irq);
107extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu, 107extern void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu);
108 struct kvm_interrupt *irq);
109extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu); 108extern void kvmppc_core_flush_tlb(struct kvm_vcpu *vcpu);
110 109
111extern int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, 110extern int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
@@ -131,6 +130,7 @@ extern long kvmppc_prepare_vrma(struct kvm *kvm,
131extern void kvmppc_map_vrma(struct kvm_vcpu *vcpu, 130extern void kvmppc_map_vrma(struct kvm_vcpu *vcpu,
132 struct kvm_memory_slot *memslot, unsigned long porder); 131 struct kvm_memory_slot *memslot, unsigned long porder);
133extern int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu); 132extern int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu);
133
134extern long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm, 134extern long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
135 struct kvm_create_spapr_tce *args); 135 struct kvm_create_spapr_tce *args);
136extern long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, 136extern long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn,
@@ -152,7 +152,7 @@ extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
152 struct kvm_userspace_memory_region *mem); 152 struct kvm_userspace_memory_region *mem);
153extern void kvmppc_core_commit_memory_region(struct kvm *kvm, 153extern void kvmppc_core_commit_memory_region(struct kvm *kvm,
154 struct kvm_userspace_memory_region *mem, 154 struct kvm_userspace_memory_region *mem,
155 struct kvm_memory_slot old); 155 const struct kvm_memory_slot *old);
156extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, 156extern int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm,
157 struct kvm_ppc_smmu_info *info); 157 struct kvm_ppc_smmu_info *info);
158extern void kvmppc_core_flush_memslot(struct kvm *kvm, 158extern void kvmppc_core_flush_memslot(struct kvm *kvm,
@@ -165,6 +165,18 @@ extern int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu);
165 165
166extern int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *); 166extern int kvm_vm_ioctl_get_htab_fd(struct kvm *kvm, struct kvm_get_htab_fd *);
167 167
168int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq);
169
170extern int kvm_vm_ioctl_rtas_define_token(struct kvm *kvm, void __user *argp);
171extern int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu);
172extern void kvmppc_rtas_tokens_free(struct kvm *kvm);
173extern int kvmppc_xics_set_xive(struct kvm *kvm, u32 irq, u32 server,
174 u32 priority);
175extern int kvmppc_xics_get_xive(struct kvm *kvm, u32 irq, u32 *server,
176 u32 *priority);
177extern int kvmppc_xics_int_on(struct kvm *kvm, u32 irq);
178extern int kvmppc_xics_int_off(struct kvm *kvm, u32 irq);
179
168/* 180/*
169 * Cuts out inst bits with ordering according to spec. 181 * Cuts out inst bits with ordering according to spec.
170 * That means the leftmost bit is zero. All given bits are included. 182 * That means the leftmost bit is zero. All given bits are included.
@@ -246,12 +258,29 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *);
246 258
247void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid); 259void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 pid);
248 260
261struct openpic;
262
249#ifdef CONFIG_KVM_BOOK3S_64_HV 263#ifdef CONFIG_KVM_BOOK3S_64_HV
250static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr) 264static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr)
251{ 265{
252 paca[cpu].kvm_hstate.xics_phys = addr; 266 paca[cpu].kvm_hstate.xics_phys = addr;
253} 267}
254 268
269static inline u32 kvmppc_get_xics_latch(void)
270{
271 u32 xirr = get_paca()->kvm_hstate.saved_xirr;
272
273 get_paca()->kvm_hstate.saved_xirr = 0;
274
275 return xirr;
276}
277
278static inline void kvmppc_set_host_ipi(int cpu, u8 host_ipi)
279{
280 paca[cpu].kvm_hstate.host_ipi = host_ipi;
281}
282
283extern void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu);
255extern void kvm_linear_init(void); 284extern void kvm_linear_init(void);
256 285
257#else 286#else
@@ -260,6 +289,46 @@ static inline void kvmppc_set_xics_phys(int cpu, unsigned long addr)
260 289
261static inline void kvm_linear_init(void) 290static inline void kvm_linear_init(void)
262{} 291{}
292
293static inline u32 kvmppc_get_xics_latch(void)
294{
295 return 0;
296}
297
298static inline void kvmppc_set_host_ipi(int cpu, u8 host_ipi)
299{}
300
301static inline void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu)
302{
303 kvm_vcpu_kick(vcpu);
304}
305#endif
306
307#ifdef CONFIG_KVM_XICS
308static inline int kvmppc_xics_enabled(struct kvm_vcpu *vcpu)
309{
310 return vcpu->arch.irq_type == KVMPPC_IRQ_XICS;
311}
312extern void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu);
313extern int kvmppc_xics_create_icp(struct kvm_vcpu *vcpu, unsigned long server);
314extern int kvm_vm_ioctl_xics_irq(struct kvm *kvm, struct kvm_irq_level *args);
315extern int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd);
316extern u64 kvmppc_xics_get_icp(struct kvm_vcpu *vcpu);
317extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
318extern int kvmppc_xics_connect_vcpu(struct kvm_device *dev,
319 struct kvm_vcpu *vcpu, u32 cpu);
320#else
321static inline int kvmppc_xics_enabled(struct kvm_vcpu *vcpu)
322 { return 0; }
323static inline void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu) { }
324static inline int kvmppc_xics_create_icp(struct kvm_vcpu *vcpu,
325 unsigned long server)
326 { return -EINVAL; }
327static inline int kvm_vm_ioctl_xics_irq(struct kvm *kvm,
328 struct kvm_irq_level *args)
329 { return -ENOTTY; }
330static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
331 { return 0; }
263#endif 332#endif
264 333
265static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr) 334static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr)
@@ -271,6 +340,32 @@ static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr)
271#endif 340#endif
272} 341}
273 342
343#ifdef CONFIG_KVM_MPIC
344
345void kvmppc_mpic_set_epr(struct kvm_vcpu *vcpu);
346int kvmppc_mpic_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu,
347 u32 cpu);
348void kvmppc_mpic_disconnect_vcpu(struct openpic *opp, struct kvm_vcpu *vcpu);
349
350#else
351
352static inline void kvmppc_mpic_set_epr(struct kvm_vcpu *vcpu)
353{
354}
355
356static inline int kvmppc_mpic_connect_vcpu(struct kvm_device *dev,
357 struct kvm_vcpu *vcpu, u32 cpu)
358{
359 return -EINVAL;
360}
361
362static inline void kvmppc_mpic_disconnect_vcpu(struct openpic *opp,
363 struct kvm_vcpu *vcpu)
364{
365}
366
367#endif /* CONFIG_KVM_MPIC */
368
274int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu, 369int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu,
275 struct kvm_config_tlb *cfg); 370 struct kvm_config_tlb *cfg);
276int kvm_vcpu_ioctl_dirty_tlb(struct kvm_vcpu *vcpu, 371int kvm_vcpu_ioctl_dirty_tlb(struct kvm_vcpu *vcpu,
@@ -283,8 +378,15 @@ void kvmppc_init_lpid(unsigned long nr_lpids);
283 378
284static inline void kvmppc_mmu_flush_icache(pfn_t pfn) 379static inline void kvmppc_mmu_flush_icache(pfn_t pfn)
285{ 380{
286 /* Clear i-cache for new pages */
287 struct page *page; 381 struct page *page;
382 /*
383 * We can only access pages that the kernel maps
384 * as memory. Bail out for unmapped ones.
385 */
386 if (!pfn_valid(pfn))
387 return;
388
389 /* Clear i-cache for new pages */
288 page = pfn_to_page(pfn); 390 page = pfn_to_page(pfn);
289 if (!test_bit(PG_arch_1, &page->flags)) { 391 if (!test_bit(PG_arch_1, &page->flags)) {
290 flush_dcache_icache_page(page); 392 flush_dcache_icache_page(page);
@@ -324,4 +426,6 @@ static inline ulong kvmppc_get_ea_indexed(struct kvm_vcpu *vcpu, int ra, int rb)
324 return ea; 426 return ea;
325} 427}
326 428
429extern void xics_wake_cpu(int cpu);
430
327#endif /* __POWERPC_KVM_PPC_H__ */ 431#endif /* __POWERPC_KVM_PPC_H__ */
diff --git a/arch/powerpc/include/asm/linkage.h b/arch/powerpc/include/asm/linkage.h
new file mode 100644
index 000000000000..b36f650a13ff
--- /dev/null
+++ b/arch/powerpc/include/asm/linkage.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_POWERPC_LINKAGE_H
2#define _ASM_POWERPC_LINKAGE_H
3
4#ifdef CONFIG_PPC64
5#define cond_syscall(x) \
6 asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n" \
7 "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
8#define SYSCALL_ALIAS(alias, name) \
9 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
10 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
11#endif
12
13#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 3d6b4100dac1..92386fc4e82a 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -29,6 +29,7 @@ struct rtc_time;
29struct file; 29struct file;
30struct pci_controller; 30struct pci_controller;
31struct kimage; 31struct kimage;
32struct pci_host_bridge;
32 33
33struct machdep_calls { 34struct machdep_calls {
34 char *name; 35 char *name;
@@ -50,7 +51,8 @@ struct machdep_calls {
50 unsigned long prpn, 51 unsigned long prpn,
51 unsigned long rflags, 52 unsigned long rflags,
52 unsigned long vflags, 53 unsigned long vflags,
53 int psize, int ssize); 54 int psize, int apsize,
55 int ssize);
54 long (*hpte_remove)(unsigned long hpte_group); 56 long (*hpte_remove)(unsigned long hpte_group);
55 void (*hpte_removebolted)(unsigned long ea, 57 void (*hpte_removebolted)(unsigned long ea,
56 int psize, int ssize); 58 int psize, int ssize);
@@ -107,6 +109,8 @@ struct machdep_calls {
107 void (*pcibios_fixup)(void); 109 void (*pcibios_fixup)(void);
108 int (*pci_probe_mode)(struct pci_bus *); 110 int (*pci_probe_mode)(struct pci_bus *);
109 void (*pci_irq_fixup)(struct pci_dev *dev); 111 void (*pci_irq_fixup)(struct pci_dev *dev);
112 int (*pcibios_root_bridge_prepare)(struct pci_host_bridge
113 *bridge);
110 114
111 /* To setup PHBs when using automatic OF platform driver for PCI */ 115 /* To setup PHBs when using automatic OF platform driver for PCI */
112 int (*pci_setup_phb)(struct pci_controller *host); 116 int (*pci_setup_phb)(struct pci_controller *host);
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index 99d43e0c1e4a..936db360790a 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -215,6 +215,7 @@
215#define TLBILX_T_CLASS3 7 215#define TLBILX_T_CLASS3 7
216 216
217#ifndef __ASSEMBLY__ 217#ifndef __ASSEMBLY__
218#include <asm/bug.h>
218 219
219extern unsigned int tlbcam_index; 220extern unsigned int tlbcam_index;
220 221
@@ -231,6 +232,10 @@ typedef struct {
231 u64 high_slices_psize; /* 4 bits per slice for now */ 232 u64 high_slices_psize; /* 4 bits per slice for now */
232 u16 user_psize; /* page size index */ 233 u16 user_psize; /* page size index */
233#endif 234#endif
235#ifdef CONFIG_PPC_64K_PAGES
236 /* for 4K PTE fragment support */
237 void *pte_frag;
238#endif
234} mm_context_t; 239} mm_context_t;
235 240
236/* Page size definitions, common between 32 and 64-bit 241/* Page size definitions, common between 32 and 64-bit
@@ -250,6 +255,23 @@ struct mmu_psize_def
250}; 255};
251extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; 256extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
252 257
258static inline int shift_to_mmu_psize(unsigned int shift)
259{
260 int psize;
261
262 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize)
263 if (mmu_psize_defs[psize].shift == shift)
264 return psize;
265 return -1;
266}
267
268static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
269{
270 if (mmu_psize_defs[mmu_psize].shift)
271 return mmu_psize_defs[mmu_psize].shift;
272 BUG();
273}
274
253/* The page sizes use the same names as 64-bit hash but are 275/* The page sizes use the same names as 64-bit hash but are
254 * constants 276 * constants
255 */ 277 */
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index b59e06f507ea..2accc9611248 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -21,6 +21,7 @@
21 * complete pgtable.h but only a portion of it. 21 * complete pgtable.h but only a portion of it.
22 */ 22 */
23#include <asm/pgtable-ppc64.h> 23#include <asm/pgtable-ppc64.h>
24#include <asm/bug.h>
24 25
25/* 26/*
26 * Segment table 27 * Segment table
@@ -154,11 +155,29 @@ extern unsigned long htab_hash_mask;
154struct mmu_psize_def 155struct mmu_psize_def
155{ 156{
156 unsigned int shift; /* number of bits */ 157 unsigned int shift; /* number of bits */
157 unsigned int penc; /* HPTE encoding */ 158 int penc[MMU_PAGE_COUNT]; /* HPTE encoding */
158 unsigned int tlbiel; /* tlbiel supported for that page size */ 159 unsigned int tlbiel; /* tlbiel supported for that page size */
159 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */ 160 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
160 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */ 161 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
161}; 162};
163extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
164
165static inline int shift_to_mmu_psize(unsigned int shift)
166{
167 int psize;
168
169 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize)
170 if (mmu_psize_defs[psize].shift == shift)
171 return psize;
172 return -1;
173}
174
175static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
176{
177 if (mmu_psize_defs[mmu_psize].shift)
178 return mmu_psize_defs[mmu_psize].shift;
179 BUG();
180}
162 181
163#endif /* __ASSEMBLY__ */ 182#endif /* __ASSEMBLY__ */
164 183
@@ -181,6 +200,13 @@ struct mmu_psize_def
181 */ 200 */
182#define VPN_SHIFT 12 201#define VPN_SHIFT 12
183 202
203/*
204 * HPTE Large Page (LP) details
205 */
206#define LP_SHIFT 12
207#define LP_BITS 8
208#define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
209
184#ifndef __ASSEMBLY__ 210#ifndef __ASSEMBLY__
185 211
186static inline int segment_shift(int ssize) 212static inline int segment_shift(int ssize)
@@ -193,7 +219,6 @@ static inline int segment_shift(int ssize)
193/* 219/*
194 * The current system page and segment sizes 220 * The current system page and segment sizes
195 */ 221 */
196extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
197extern int mmu_linear_psize; 222extern int mmu_linear_psize;
198extern int mmu_virtual_psize; 223extern int mmu_virtual_psize;
199extern int mmu_vmalloc_psize; 224extern int mmu_vmalloc_psize;
@@ -237,14 +262,14 @@ static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize,
237 262
238/* 263/*
239 * This function sets the AVPN and L fields of the HPTE appropriately 264 * This function sets the AVPN and L fields of the HPTE appropriately
240 * for the page size 265 * using the base page size and actual page size.
241 */ 266 */
242static inline unsigned long hpte_encode_v(unsigned long vpn, 267static inline unsigned long hpte_encode_v(unsigned long vpn, int base_psize,
243 int psize, int ssize) 268 int actual_psize, int ssize)
244{ 269{
245 unsigned long v; 270 unsigned long v;
246 v = hpte_encode_avpn(vpn, psize, ssize); 271 v = hpte_encode_avpn(vpn, base_psize, ssize);
247 if (psize != MMU_PAGE_4K) 272 if (actual_psize != MMU_PAGE_4K)
248 v |= HPTE_V_LARGE; 273 v |= HPTE_V_LARGE;
249 return v; 274 return v;
250} 275}
@@ -254,19 +279,17 @@ static inline unsigned long hpte_encode_v(unsigned long vpn,
254 * for the page size. We assume the pa is already "clean" that is properly 279 * for the page size. We assume the pa is already "clean" that is properly
255 * aligned for the requested page size 280 * aligned for the requested page size
256 */ 281 */
257static inline unsigned long hpte_encode_r(unsigned long pa, int psize) 282static inline unsigned long hpte_encode_r(unsigned long pa, int base_psize,
283 int actual_psize)
258{ 284{
259 unsigned long r;
260
261 /* A 4K page needs no special encoding */ 285 /* A 4K page needs no special encoding */
262 if (psize == MMU_PAGE_4K) 286 if (actual_psize == MMU_PAGE_4K)
263 return pa & HPTE_R_RPN; 287 return pa & HPTE_R_RPN;
264 else { 288 else {
265 unsigned int penc = mmu_psize_defs[psize].penc; 289 unsigned int penc = mmu_psize_defs[base_psize].penc[actual_psize];
266 unsigned int shift = mmu_psize_defs[psize].shift; 290 unsigned int shift = mmu_psize_defs[actual_psize].shift;
267 return (pa & ~((1ul << shift) - 1)) | (penc << 12); 291 return (pa & ~((1ul << shift) - 1)) | (penc << LP_SHIFT);
268 } 292 }
269 return r;
270} 293}
271 294
272/* 295/*
@@ -319,7 +342,8 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
319 unsigned int shift, unsigned int mmu_psize); 342 unsigned int shift, unsigned int mmu_psize);
320extern void hash_failure_debug(unsigned long ea, unsigned long access, 343extern void hash_failure_debug(unsigned long ea, unsigned long access,
321 unsigned long vsid, unsigned long trap, 344 unsigned long vsid, unsigned long trap,
322 int ssize, int psize, unsigned long pte); 345 int ssize, int psize, int lpsize,
346 unsigned long pte);
323extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 347extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
324 unsigned long pstart, unsigned long prot, 348 unsigned long pstart, unsigned long prot,
325 int psize, int ssize); 349 int psize, int ssize);
@@ -498,6 +522,10 @@ typedef struct {
498 unsigned long acop; /* mask of enabled coprocessor types */ 522 unsigned long acop; /* mask of enabled coprocessor types */
499 unsigned int cop_pid; /* pid value used with coprocessors */ 523 unsigned int cop_pid; /* pid value used with coprocessors */
500#endif /* CONFIG_PPC_ICSWX */ 524#endif /* CONFIG_PPC_ICSWX */
525#ifdef CONFIG_PPC_64K_PAGES
526 /* for 4K PTE fragment support */
527 void *pte_frag;
528#endif
501} mm_context_t; 529} mm_context_t;
502 530
503 531
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index a4b28f165b6c..b6c8b58b1d76 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -117,6 +117,7 @@ extern int opal_enter_rtas(struct rtas_args *args,
117#define OPAL_SET_SLOT_LED_STATUS 55 117#define OPAL_SET_SLOT_LED_STATUS 55
118#define OPAL_GET_EPOW_STATUS 56 118#define OPAL_GET_EPOW_STATUS 56
119#define OPAL_SET_SYSTEM_ATTENTION_LED 57 119#define OPAL_SET_SYSTEM_ATTENTION_LED 57
120#define OPAL_PCI_MSI_EOI 63
120 121
121#ifndef __ASSEMBLY__ 122#ifndef __ASSEMBLY__
122 123
@@ -506,6 +507,7 @@ int64_t opal_pci_get_xive_reissue(uint64_t phb_id, uint32_t xive_number,
506 uint8_t *p_bit, uint8_t *q_bit); 507 uint8_t *p_bit, uint8_t *q_bit);
507int64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number, 508int64_t opal_pci_set_xive_reissue(uint64_t phb_id, uint32_t xive_number,
508 uint8_t p_bit, uint8_t q_bit); 509 uint8_t p_bit, uint8_t q_bit);
510int64_t opal_pci_msi_eoi(uint64_t phb_id, uint32_t hw_irq);
509int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number, 511int64_t opal_pci_set_xive_pe(uint64_t phb_id, uint32_t pe_number,
510 uint32_t xive_num); 512 uint32_t xive_num);
511int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num, 513int64_t opal_get_xive_source(uint64_t phb_id, uint32_t xive_num,
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index f072e974f8a2..988c812aab5b 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -249,6 +249,7 @@ extern long long virt_phys_offset;
249#define is_kernel_addr(x) ((x) >= PAGE_OFFSET) 249#define is_kernel_addr(x) ((x) >= PAGE_OFFSET)
250#endif 250#endif
251 251
252#ifndef CONFIG_PPC_BOOK3S_64
252/* 253/*
253 * Use the top bit of the higher-level page table entries to indicate whether 254 * Use the top bit of the higher-level page table entries to indicate whether
254 * the entries we point to contain hugepages. This works because we know that 255 * the entries we point to contain hugepages. This works because we know that
@@ -260,6 +261,7 @@ extern long long virt_phys_offset;
260#else 261#else
261#define PD_HUGE 0x80000000 262#define PD_HUGE 0x80000000
262#endif 263#endif
264#endif /* CONFIG_PPC_BOOK3S_64 */
263 265
264/* 266/*
265 * Some number of bits at the level of the page table that points to 267 * Some number of bits at the level of the page table that points to
@@ -354,14 +356,27 @@ typedef unsigned long pgprot_t;
354typedef struct { signed long pd; } hugepd_t; 356typedef struct { signed long pd; } hugepd_t;
355 357
356#ifdef CONFIG_HUGETLB_PAGE 358#ifdef CONFIG_HUGETLB_PAGE
359#ifdef CONFIG_PPC_BOOK3S_64
360static inline int hugepd_ok(hugepd_t hpd)
361{
362 /*
363 * hugepd pointer, bottom two bits == 00 and next 4 bits
364 * indicate size of table
365 */
366 return (((hpd.pd & 0x3) == 0x0) && ((hpd.pd & HUGEPD_SHIFT_MASK) != 0));
367}
368#else
357static inline int hugepd_ok(hugepd_t hpd) 369static inline int hugepd_ok(hugepd_t hpd)
358{ 370{
359 return (hpd.pd > 0); 371 return (hpd.pd > 0);
360} 372}
373#endif
361 374
362#define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep)))) 375#define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep))))
376int pgd_huge(pgd_t pgd);
363#else /* CONFIG_HUGETLB_PAGE */ 377#else /* CONFIG_HUGETLB_PAGE */
364#define is_hugepd(pdep) 0 378#define is_hugepd(pdep) 0
379#define pgd_huge(pgd) 0
365#endif /* CONFIG_HUGETLB_PAGE */ 380#endif /* CONFIG_HUGETLB_PAGE */
366 381
367struct page; 382struct page;
@@ -378,7 +393,11 @@ void arch_free_page(struct page *page, int order);
378 393
379struct vm_area_struct; 394struct vm_area_struct;
380 395
396#ifdef CONFIG_PPC_64K_PAGES
397typedef pte_t *pgtable_t;
398#else
381typedef struct page *pgtable_t; 399typedef struct page *pgtable_t;
400#endif
382 401
383#include <asm-generic/memory_model.h> 402#include <asm-generic/memory_model.h>
384#endif /* __ASSEMBLY__ */ 403#endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
index cd915d6b093d..88693cef4f3d 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -99,8 +99,7 @@ extern unsigned long slice_get_unmapped_area(unsigned long addr,
99 unsigned long len, 99 unsigned long len,
100 unsigned long flags, 100 unsigned long flags,
101 unsigned int psize, 101 unsigned int psize,
102 int topdown, 102 int topdown);
103 int use_cache);
104 103
105extern unsigned int get_slice_psize(struct mm_struct *mm, 104extern unsigned int get_slice_psize(struct mm_struct *mm,
106 unsigned long addr); 105 unsigned long addr);
diff --git a/arch/powerpc/include/asm/parport.h b/arch/powerpc/include/asm/parport.h
index 6dc2577932b1..a452968b29ea 100644
--- a/arch/powerpc/include/asm/parport.h
+++ b/arch/powerpc/include/asm/parport.h
@@ -21,9 +21,7 @@ static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
21 int count = 0; 21 int count = 0;
22 int virq; 22 int virq;
23 23
24 for (np = NULL; (np = of_find_compatible_node(np, 24 for_each_compatible_node(np, "parallel", "pnpPNP,400") {
25 "parallel",
26 "pnpPNP,400")) != NULL;) {
27 prop = of_get_property(np, "reg", &propsize); 25 prop = of_get_property(np, "reg", &propsize);
28 if (!prop || propsize > 6*sizeof(u32)) 26 if (!prop || propsize > 6*sizeof(u32))
29 continue; 27 continue;
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 025a130729bc..8b11b5bd9938 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -39,11 +39,6 @@ struct pci_controller {
39 resource_size_t io_base_phys; 39 resource_size_t io_base_phys;
40 resource_size_t pci_io_size; 40 resource_size_t pci_io_size;
41 41
42 /* Some machines (PReP) have a non 1:1 mapping of
43 * the PCI memory space in the CPU bus space
44 */
45 resource_size_t pci_mem_offset;
46
47 /* Some machines have a special region to forward the ISA 42 /* Some machines have a special region to forward the ISA
48 * "memory" cycles such as VGA memory regions. Left to 0 43 * "memory" cycles such as VGA memory regions. Left to 0
49 * if unsupported 44 * if unsupported
@@ -70,6 +65,8 @@ struct pci_controller {
70 * BIG_ENDIAN - cfg_addr is a big endian register 65 * BIG_ENDIAN - cfg_addr is a big endian register
71 * BROKEN_MRM - the 440EPx/GRx chips have an errata that causes hangs on 66 * BROKEN_MRM - the 440EPx/GRx chips have an errata that causes hangs on
72 * the PLB4. Effectively disable MRM commands by setting this. 67 * the PLB4. Effectively disable MRM commands by setting this.
68 * FSL_CFG_REG_LINK - Freescale controller version in which the PCIe
69 * link status is in a RC PCIe cfg register (vs being a SoC register)
73 */ 70 */
74#define PPC_INDIRECT_TYPE_SET_CFG_TYPE 0x00000001 71#define PPC_INDIRECT_TYPE_SET_CFG_TYPE 0x00000001
75#define PPC_INDIRECT_TYPE_EXT_REG 0x00000002 72#define PPC_INDIRECT_TYPE_EXT_REG 0x00000002
@@ -77,12 +74,14 @@ struct pci_controller {
77#define PPC_INDIRECT_TYPE_NO_PCIE_LINK 0x00000008 74#define PPC_INDIRECT_TYPE_NO_PCIE_LINK 0x00000008
78#define PPC_INDIRECT_TYPE_BIG_ENDIAN 0x00000010 75#define PPC_INDIRECT_TYPE_BIG_ENDIAN 0x00000010
79#define PPC_INDIRECT_TYPE_BROKEN_MRM 0x00000020 76#define PPC_INDIRECT_TYPE_BROKEN_MRM 0x00000020
77#define PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK 0x00000040
80 u32 indirect_type; 78 u32 indirect_type;
81 /* Currently, we limit ourselves to 1 IO range and 3 mem 79 /* Currently, we limit ourselves to 1 IO range and 3 mem
82 * ranges since the common pci_bus structure can't handle more 80 * ranges since the common pci_bus structure can't handle more
83 */ 81 */
84 struct resource io_resource; 82 struct resource io_resource;
85 struct resource mem_resources[3]; 83 struct resource mem_resources[3];
84 resource_size_t mem_offset[3];
86 int global_number; /* PCI domain number */ 85 int global_number; /* PCI domain number */
87 86
88 resource_size_t dma_window_base_cur; 87 resource_size_t dma_window_base_cur;
@@ -90,9 +89,9 @@ struct pci_controller {
90 89
91#ifdef CONFIG_PPC64 90#ifdef CONFIG_PPC64
92 unsigned long buid; 91 unsigned long buid;
92#endif /* CONFIG_PPC64 */
93 93
94 void *private_data; 94 void *private_data;
95#endif /* CONFIG_PPC64 */
96}; 95};
97 96
98/* These are used for config access before all the PCI probing 97/* These are used for config access before all the PCI probing
@@ -117,6 +116,12 @@ extern void setup_indirect_pci(struct pci_controller* hose,
117 resource_size_t cfg_addr, 116 resource_size_t cfg_addr,
118 resource_size_t cfg_data, u32 flags); 117 resource_size_t cfg_data, u32 flags);
119 118
119extern int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
120 int offset, int len, u32 *val);
121
122extern int indirect_write_config(struct pci_bus *bus, unsigned int devfn,
123 int offset, int len, u32 val);
124
120static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) 125static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
121{ 126{
122 return bus->sysdata; 127 return bus->sysdata;
@@ -154,6 +159,8 @@ struct pci_dn {
154 159
155 int pci_ext_config_space; /* for pci devices */ 160 int pci_ext_config_space; /* for pci devices */
156 161
162 int force_32bit_msi:1;
163
157 struct pci_dev *pcidev; /* back-pointer to the pci device */ 164 struct pci_dev *pcidev; /* back-pointer to the pci device */
158#ifdef CONFIG_EEH 165#ifdef CONFIG_EEH
159 struct eeh_dev *edev; /* eeh device */ 166 struct eeh_dev *edev; /* eeh device */
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index d0aec72722e9..f265049dd7d6 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -33,6 +33,8 @@ struct power_pmu {
33 unsigned long *valp); 33 unsigned long *valp);
34 int (*get_alternatives)(u64 event_id, unsigned int flags, 34 int (*get_alternatives)(u64 event_id, unsigned int flags,
35 u64 alt[]); 35 u64 alt[]);
36 u64 (*bhrb_filter_map)(u64 branch_sample_type);
37 void (*config_bhrb)(u64 pmu_bhrb_filter);
36 void (*disable_pmc)(unsigned int pmc, unsigned long mmcr[]); 38 void (*disable_pmc)(unsigned int pmc, unsigned long mmcr[]);
37 int (*limited_pmc_event)(u64 event_id); 39 int (*limited_pmc_event)(u64 event_id);
38 u32 flags; 40 u32 flags;
@@ -42,6 +44,9 @@ struct power_pmu {
42 int (*cache_events)[PERF_COUNT_HW_CACHE_MAX] 44 int (*cache_events)[PERF_COUNT_HW_CACHE_MAX]
43 [PERF_COUNT_HW_CACHE_OP_MAX] 45 [PERF_COUNT_HW_CACHE_OP_MAX]
44 [PERF_COUNT_HW_CACHE_RESULT_MAX]; 46 [PERF_COUNT_HW_CACHE_RESULT_MAX];
47
48 /* BHRB entries in the PMU */
49 int bhrb_nr;
45}; 50};
46 51
47/* 52/*
@@ -52,6 +57,9 @@ struct power_pmu {
52#define PPMU_NO_SIPR 0x00000004 /* no SIPR/HV in MMCRA at all */ 57#define PPMU_NO_SIPR 0x00000004 /* no SIPR/HV in MMCRA at all */
53#define PPMU_NO_CONT_SAMPLING 0x00000008 /* no continuous sampling */ 58#define PPMU_NO_CONT_SAMPLING 0x00000008 /* no continuous sampling */
54#define PPMU_SIAR_VALID 0x00000010 /* Processor has SIAR Valid bit */ 59#define PPMU_SIAR_VALID 0x00000010 /* Processor has SIAR Valid bit */
60#define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */
61#define PPMU_HAS_SIER 0x00000040 /* Has SIER */
62#define PPMU_BHRB 0x00000080 /* has BHRB feature enabled */
55 63
56/* 64/*
57 * Values for flags to get_alternatives() 65 * Values for flags to get_alternatives()
@@ -65,6 +73,7 @@ extern int register_power_pmu(struct power_pmu *);
65struct pt_regs; 73struct pt_regs;
66extern unsigned long perf_misc_flags(struct pt_regs *regs); 74extern unsigned long perf_misc_flags(struct pt_regs *regs);
67extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 75extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
76extern unsigned long int read_bhrb(int n);
68 77
69/* 78/*
70 * Only override the default definitions in include/linux/perf_event.h 79 * Only override the default definitions in include/linux/perf_event.h
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h
index 580cf73b96e8..27b2386f738a 100644
--- a/arch/powerpc/include/asm/pgalloc-32.h
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -37,6 +37,17 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
37extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 37extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
38extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr); 38extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
39 39
40static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
41{
42 free_page((unsigned long)pte);
43}
44
45static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
46{
47 pgtable_page_dtor(ptepage);
48 __free_page(ptepage);
49}
50
40static inline void pgtable_free(void *table, unsigned index_size) 51static inline void pgtable_free(void *table, unsigned index_size)
41{ 52{
42 BUG_ON(index_size); /* 32-bit doesn't use this */ 53 BUG_ON(index_size); /* 32-bit doesn't use this */
@@ -45,4 +56,38 @@ static inline void pgtable_free(void *table, unsigned index_size)
45 56
46#define check_pgt_cache() do { } while (0) 57#define check_pgt_cache() do { } while (0)
47 58
59#ifdef CONFIG_SMP
60static inline void pgtable_free_tlb(struct mmu_gather *tlb,
61 void *table, int shift)
62{
63 unsigned long pgf = (unsigned long)table;
64 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
65 pgf |= shift;
66 tlb_remove_table(tlb, (void *)pgf);
67}
68
69static inline void __tlb_remove_table(void *_table)
70{
71 void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
72 unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
73
74 pgtable_free(table, shift);
75}
76#else
77static inline void pgtable_free_tlb(struct mmu_gather *tlb,
78 void *table, int shift)
79{
80 pgtable_free(table, shift);
81}
82#endif
83
84static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
85 unsigned long address)
86{
87 struct page *page = page_address(table);
88
89 tlb_flush_pgtable(tlb, address);
90 pgtable_page_dtor(page);
91 pgtable_free_tlb(tlb, page, 0);
92}
48#endif /* _ASM_POWERPC_PGALLOC_32_H */ 93#endif /* _ASM_POWERPC_PGALLOC_32_H */
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index 292725cec2e3..91acb12bac92 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -35,7 +35,10 @@ struct vmemmap_backing {
35#define MAX_PGTABLE_INDEX_SIZE 0xf 35#define MAX_PGTABLE_INDEX_SIZE 0xf
36 36
37extern struct kmem_cache *pgtable_cache[]; 37extern struct kmem_cache *pgtable_cache[];
38#define PGT_CACHE(shift) (pgtable_cache[(shift)-1]) 38#define PGT_CACHE(shift) ({ \
39 BUG_ON(!(shift)); \
40 pgtable_cache[(shift) - 1]; \
41 })
39 42
40static inline pgd_t *pgd_alloc(struct mm_struct *mm) 43static inline pgd_t *pgd_alloc(struct mm_struct *mm)
41{ 44{
@@ -72,8 +75,100 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
72#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte)) 75#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte))
73#define pmd_pgtable(pmd) pmd_page(pmd) 76#define pmd_pgtable(pmd) pmd_page(pmd)
74 77
78static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
79 unsigned long address)
80{
81 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
82}
83
84static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
85 unsigned long address)
86{
87 struct page *page;
88 pte_t *pte;
89
90 pte = pte_alloc_one_kernel(mm, address);
91 if (!pte)
92 return NULL;
93 page = virt_to_page(pte);
94 pgtable_page_ctor(page);
95 return page;
96}
97
98static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
99{
100 free_page((unsigned long)pte);
101}
102
103static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
104{
105 pgtable_page_dtor(ptepage);
106 __free_page(ptepage);
107}
108
109static inline void pgtable_free(void *table, unsigned index_size)
110{
111 if (!index_size)
112 free_page((unsigned long)table);
113 else {
114 BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE);
115 kmem_cache_free(PGT_CACHE(index_size), table);
116 }
117}
118
119#ifdef CONFIG_SMP
120static inline void pgtable_free_tlb(struct mmu_gather *tlb,
121 void *table, int shift)
122{
123 unsigned long pgf = (unsigned long)table;
124 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
125 pgf |= shift;
126 tlb_remove_table(tlb, (void *)pgf);
127}
128
129static inline void __tlb_remove_table(void *_table)
130{
131 void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
132 unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
133
134 pgtable_free(table, shift);
135}
136#else /* !CONFIG_SMP */
137static inline void pgtable_free_tlb(struct mmu_gather *tlb,
138 void *table, int shift)
139{
140 pgtable_free(table, shift);
141}
142#endif /* CONFIG_SMP */
143
144static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
145 unsigned long address)
146{
147 struct page *page = page_address(table);
148
149 tlb_flush_pgtable(tlb, address);
150 pgtable_page_dtor(page);
151 pgtable_free_tlb(tlb, page, 0);
152}
153
154#else /* if CONFIG_PPC_64K_PAGES */
155/*
156 * we support 16 fragments per PTE page.
157 */
158#define PTE_FRAG_NR 16
159/*
160 * We use a 2K PTE page fragment and another 2K for storing
161 * real_pte_t hash index
162 */
163#define PTE_FRAG_SIZE_SHIFT 12
164#define PTE_FRAG_SIZE (2 * PTRS_PER_PTE * sizeof(pte_t))
75 165
76#else /* CONFIG_PPC_64K_PAGES */ 166extern pte_t *page_table_alloc(struct mm_struct *, unsigned long, int);
167extern void page_table_free(struct mm_struct *, unsigned long *, int);
168extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift);
169#ifdef CONFIG_SMP
170extern void __tlb_remove_table(void *_table);
171#endif
77 172
78#define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd) 173#define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd)
79 174
@@ -83,51 +178,56 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
83 pmd_set(pmd, (unsigned long)pte); 178 pmd_set(pmd, (unsigned long)pte);
84} 179}
85 180
86#define pmd_populate(mm, pmd, pte_page) \ 181static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
87 pmd_populate_kernel(mm, pmd, page_address(pte_page)) 182 pgtable_t pte_page)
88#define pmd_pgtable(pmd) pmd_page(pmd)
89
90#endif /* CONFIG_PPC_64K_PAGES */
91
92static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
93{ 183{
94 return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE), 184 pmd_set(pmd, (unsigned long)pte_page);
95 GFP_KERNEL|__GFP_REPEAT);
96} 185}
97 186
98static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 187static inline pgtable_t pmd_pgtable(pmd_t pmd)
99{ 188{
100 kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd); 189 return (pgtable_t)(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE);
101} 190}
102 191
103static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 192static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
104 unsigned long address) 193 unsigned long address)
105{ 194{
106 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); 195 return (pte_t *)page_table_alloc(mm, address, 1);
107} 196}
108 197
109static inline pgtable_t pte_alloc_one(struct mm_struct *mm, 198static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
110 unsigned long address) 199 unsigned long address)
111{ 200{
112 struct page *page; 201 return (pgtable_t)page_table_alloc(mm, address, 0);
113 pte_t *pte; 202}
114 203
115 pte = pte_alloc_one_kernel(mm, address); 204static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
116 if (!pte) 205{
117 return NULL; 206 page_table_free(mm, (unsigned long *)pte, 1);
118 page = virt_to_page(pte);
119 pgtable_page_ctor(page);
120 return page;
121} 207}
122 208
123static inline void pgtable_free(void *table, unsigned index_size) 209static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
124{ 210{
125 if (!index_size) 211 page_table_free(mm, (unsigned long *)ptepage, 0);
126 free_page((unsigned long)table); 212}
127 else { 213
128 BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE); 214static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
129 kmem_cache_free(PGT_CACHE(index_size), table); 215 unsigned long address)
130 } 216{
217 tlb_flush_pgtable(tlb, address);
218 pgtable_free_tlb(tlb, table, 0);
219}
220#endif /* CONFIG_PPC_64K_PAGES */
221
222static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
223{
224 return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE),
225 GFP_KERNEL|__GFP_REPEAT);
226}
227
228static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
229{
230 kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd);
131} 231}
132 232
133#define __pmd_free_tlb(tlb, pmd, addr) \ 233#define __pmd_free_tlb(tlb, pmd, addr) \
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
index bf301ac62f35..e9a9f60e596d 100644
--- a/arch/powerpc/include/asm/pgalloc.h
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -3,6 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <asm-generic/tlb.h>
6 7
7#ifdef CONFIG_PPC_BOOK3E 8#ifdef CONFIG_PPC_BOOK3E
8extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address); 9extern void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address);
@@ -13,56 +14,11 @@ static inline void tlb_flush_pgtable(struct mmu_gather *tlb,
13} 14}
14#endif /* !CONFIG_PPC_BOOK3E */ 15#endif /* !CONFIG_PPC_BOOK3E */
15 16
16static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
17{
18 free_page((unsigned long)pte);
19}
20
21static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
22{
23 pgtable_page_dtor(ptepage);
24 __free_page(ptepage);
25}
26
27#ifdef CONFIG_PPC64 17#ifdef CONFIG_PPC64
28#include <asm/pgalloc-64.h> 18#include <asm/pgalloc-64.h>
29#else 19#else
30#include <asm/pgalloc-32.h> 20#include <asm/pgalloc-32.h>
31#endif 21#endif
32 22
33#ifdef CONFIG_SMP
34struct mmu_gather;
35extern void tlb_remove_table(struct mmu_gather *, void *);
36
37static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
38{
39 unsigned long pgf = (unsigned long)table;
40 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
41 pgf |= shift;
42 tlb_remove_table(tlb, (void *)pgf);
43}
44
45static inline void __tlb_remove_table(void *_table)
46{
47 void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
48 unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
49
50 pgtable_free(table, shift);
51}
52#else /* CONFIG_SMP */
53static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift)
54{
55 pgtable_free(table, shift);
56}
57#endif /* !CONFIG_SMP */
58
59static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage,
60 unsigned long address)
61{
62 tlb_flush_pgtable(tlb, address);
63 pgtable_page_dtor(ptepage);
64 pgtable_free_tlb(tlb, page_address(ptepage), 0);
65}
66
67#endif /* __KERNEL__ */ 23#endif /* __KERNEL__ */
68#endif /* _ASM_POWERPC_PGALLOC_H */ 24#endif /* _ASM_POWERPC_PGALLOC_H */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index be4e2878fbc0..45142d640720 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -4,10 +4,10 @@
4#include <asm-generic/pgtable-nopud.h> 4#include <asm-generic/pgtable-nopud.h>
5 5
6 6
7#define PTE_INDEX_SIZE 12 7#define PTE_INDEX_SIZE 8
8#define PMD_INDEX_SIZE 12 8#define PMD_INDEX_SIZE 10
9#define PUD_INDEX_SIZE 0 9#define PUD_INDEX_SIZE 0
10#define PGD_INDEX_SIZE 6 10#define PGD_INDEX_SIZE 12
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE) 13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 0182c203e411..e3d55f6f24fe 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -167,8 +167,7 @@
167 * Find an entry in a page-table-directory. We combine the address region 167 * Find an entry in a page-table-directory. We combine the address region
168 * (the high order N bits) and the pgd portion of the address. 168 * (the high order N bits) and the pgd portion of the address.
169 */ 169 */
170/* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */ 170#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
171#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x1ff)
172 171
173#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 172#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
174 173
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index a9cbd3ba5c33..7aeb9555f6ea 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -17,6 +17,12 @@ struct mm_struct;
17# include <asm/pgtable-ppc32.h> 17# include <asm/pgtable-ppc32.h>
18#endif 18#endif
19 19
20/*
21 * We save the slot number & secondary bit in the second half of the
22 * PTE page. We use the 8 bytes per each pte entry.
23 */
24#define PTE_PAGE_HIDX_OFFSET (PTRS_PER_PTE * 8)
25
20#ifndef __ASSEMBLY__ 26#ifndef __ASSEMBLY__
21 27
22#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
@@ -212,6 +218,8 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
212extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr, 218extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
213 unsigned long end, int write, struct page **pages, int *nr); 219 unsigned long end, int write, struct page **pages, int *nr);
214 220
221extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
222 unsigned long end, int write, struct page **pages, int *nr);
215#endif /* __ASSEMBLY__ */ 223#endif /* __ASSEMBLY__ */
216 224
217#endif /* __KERNEL__ */ 225#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 8752bc8e34a3..eccfc161e58e 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -82,6 +82,8 @@
82#define __REGA0_R31 31 82#define __REGA0_R31 31
83 83
84/* sorted alphabetically */ 84/* sorted alphabetically */
85#define PPC_INST_BHRBE 0x7c00025c
86#define PPC_INST_CLRBHRB 0x7c00035c
85#define PPC_INST_DCBA 0x7c0005ec 87#define PPC_INST_DCBA 0x7c0005ec
86#define PPC_INST_DCBA_MASK 0xfc0007fe 88#define PPC_INST_DCBA_MASK 0xfc0007fe
87#define PPC_INST_DCBAL 0x7c2005ec 89#define PPC_INST_DCBAL 0x7c2005ec
@@ -113,6 +115,10 @@
113#define PPC_INST_MFSPR_DSCR_MASK 0xfc1fffff 115#define PPC_INST_MFSPR_DSCR_MASK 0xfc1fffff
114#define PPC_INST_MTSPR_DSCR 0x7c1103a6 116#define PPC_INST_MTSPR_DSCR 0x7c1103a6
115#define PPC_INST_MTSPR_DSCR_MASK 0xfc1fffff 117#define PPC_INST_MTSPR_DSCR_MASK 0xfc1fffff
118#define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6
119#define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1fffff
120#define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6
121#define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1fffff
116#define PPC_INST_SLBFEE 0x7c0007a7 122#define PPC_INST_SLBFEE 0x7c0007a7
117 123
118#define PPC_INST_STRING 0x7c00042a 124#define PPC_INST_STRING 0x7c00042a
@@ -297,6 +303,12 @@
297#define PPC_NAP stringify_in_c(.long PPC_INST_NAP) 303#define PPC_NAP stringify_in_c(.long PPC_INST_NAP)
298#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP) 304#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP)
299 305
306/* BHRB instructions */
307#define PPC_CLRBHRB stringify_in_c(.long PPC_INST_CLRBHRB)
308#define PPC_MFBHRBE(r, n) stringify_in_c(.long PPC_INST_BHRBE | \
309 __PPC_RT(r) | \
310 (((n) & 0x3ff) << 11))
311
300/* Transactional memory instructions */ 312/* Transactional memory instructions */
301#define TRECHKPT stringify_in_c(.long PPC_INST_TRECHKPT) 313#define TRECHKPT stringify_in_c(.long PPC_INST_TRECHKPT)
302#define TRECLAIM(r) stringify_in_c(.long PPC_INST_TRECLAIM \ 314#define TRECLAIM(r) stringify_in_c(.long PPC_INST_TRECLAIM \
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 7ff9eaa3ea6c..d7e67ca8b4a6 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -40,7 +40,7 @@
40 * -- BenH. 40 * -- BenH.
41 */ 41 */
42 42
43/* PREP sub-platform types see residual.h for these */ 43/* PREP sub-platform types. Unused */
44#define _PREP_Motorola 0x01 /* motorola prep */ 44#define _PREP_Motorola 0x01 /* motorola prep */
45#define _PREP_Firm 0x02 /* firmworks prep */ 45#define _PREP_Firm 0x02 /* firmworks prep */
46#define _PREP_IBM 0x00 /* ibm prep */ 46#define _PREP_IBM 0x00 /* ibm prep */
@@ -56,13 +56,6 @@
56 56
57extern int _chrp_type; 57extern int _chrp_type;
58 58
59#ifdef CONFIG_PPC_PREP
60
61/* what kind of prep workstation we are */
62extern int _prep_type;
63
64#endif /* CONFIG_PPC_PREP */
65
66#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */ 59#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
67 60
68/* 61/*
@@ -288,6 +281,9 @@ struct thread_struct {
288#endif 281#endif
289#ifdef CONFIG_PPC_BOOK3S_64 282#ifdef CONFIG_PPC_BOOK3S_64
290 unsigned long tar; 283 unsigned long tar;
284 unsigned long ebbrr;
285 unsigned long ebbhr;
286 unsigned long bescr;
291#endif 287#endif
292}; 288};
293 289
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index 99c92d5363e4..bc2da154f68b 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -74,6 +74,75 @@ struct of_drconf_cell {
74#define DRCONF_MEM_AI_INVALID 0x00000040 74#define DRCONF_MEM_AI_INVALID 0x00000040
75#define DRCONF_MEM_RESERVED 0x00000080 75#define DRCONF_MEM_RESERVED 0x00000080
76 76
77/*
78 * There are two methods for telling firmware what our capabilities are.
79 * Newer machines have an "ibm,client-architecture-support" method on the
80 * root node. For older machines, we have to call the "process-elf-header"
81 * method in the /packages/elf-loader node, passing it a fake 32-bit
82 * ELF header containing a couple of PT_NOTE sections that contain
83 * structures that contain various information.
84 */
85
86/* New method - extensible architecture description vector. */
87
88/* Option vector bits - generic bits in byte 1 */
89#define OV_IGNORE 0x80 /* ignore this vector */
90#define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/
91
92/* Option vector 1: processor architectures supported */
93#define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */
94#define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */
95#define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */
96#define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */
97#define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */
98#define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */
99#define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */
100#define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */
101
102/* Option vector 2: Open Firmware options supported */
103#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */
104
105/* Option vector 3: processor options supported */
106#define OV3_FP 0x80 /* floating point */
107#define OV3_VMX 0x40 /* VMX/Altivec */
108#define OV3_DFP 0x20 /* decimal FP */
109
110/* Option vector 4: IBM PAPR implementation */
111#define OV4_MIN_ENT_CAP 0x01 /* minimum VP entitled capacity */
112
113/* Option vector 5: PAPR/OF options supported
114 * These bits are also used in firmware_has_feature() to validate
115 * the capabilities reported for vector 5 in the device tree so we
116 * encode the vector index in the define and use the OV5_FEAT()
117 * and OV5_INDX() macros to extract the desired information.
118 */
119#define OV5_FEAT(x) ((x) & 0xff)
120#define OV5_INDX(x) ((x) >> 8)
121#define OV5_LPAR 0x0280 /* logical partitioning supported */
122#define OV5_SPLPAR 0x0240 /* shared-processor LPAR supported */
123/* ibm,dynamic-reconfiguration-memory property supported */
124#define OV5_DRCONF_MEMORY 0x0220
125#define OV5_LARGE_PAGES 0x0210 /* large pages supported */
126#define OV5_DONATE_DEDICATE_CPU 0x0202 /* donate dedicated CPU support */
127#define OV5_MSI 0x0201 /* PCIe/MSI support */
128#define OV5_CMO 0x0480 /* Cooperative Memory Overcommitment */
129#define OV5_XCMO 0x0440 /* Page Coalescing */
130#define OV5_TYPE1_AFFINITY 0x0580 /* Type 1 NUMA affinity */
131#define OV5_PRRN 0x0540 /* Platform Resource Reassignment */
132#define OV5_PFO_HW_RNG 0x0E80 /* PFO Random Number Generator */
133#define OV5_PFO_HW_842 0x0E40 /* PFO Compression Accelerator */
134#define OV5_PFO_HW_ENCR 0x0E20 /* PFO Encryption Accelerator */
135#define OV5_SUB_PROCESSORS 0x0F01 /* 1,2,or 4 Sub-Processors supported */
136
137/* Option Vector 6: IBM PAPR hints */
138#define OV6_LINUX 0x02 /* Linux is our OS */
139
140/*
141 * The architecture vector has an array of PVR mask/value pairs,
142 * followed by # option vectors - 1, followed by the option vectors.
143 */
144extern unsigned char ibm_architecture_vec[];
145
77/* These includes are put at the bottom because they may contain things 146/* These includes are put at the bottom because they may contain things
78 * that are overridden by this file. Ideally they shouldn't be included 147 * that are overridden by this file. Ideally they shouldn't be included
79 * by this file, but there are a bunch of .c files that currently depend 148 * by this file, but there are a bunch of .c files that currently depend
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 5f995681bc1d..becc08e6a65c 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -92,7 +92,8 @@ static inline long regs_return_value(struct pt_regs *regs)
92 } while(0) 92 } while(0)
93 93
94struct task_struct; 94struct task_struct;
95extern unsigned long ptrace_get_reg(struct task_struct *task, int regno); 95extern int ptrace_get_reg(struct task_struct *task, int regno,
96 unsigned long *data);
96extern int ptrace_put_reg(struct task_struct *task, int regno, 97extern int ptrace_put_reg(struct task_struct *task, int regno,
97 unsigned long data); 98 unsigned long data);
98 99
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index c9c67fc888c9..a6136515c7f2 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -267,7 +267,17 @@
267#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */ 267#define SPRN_HSRR1 0x13B /* Hypervisor Save/Restore 1 */
268#define SPRN_FSCR 0x099 /* Facility Status & Control Register */ 268#define SPRN_FSCR 0x099 /* Facility Status & Control Register */
269#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */ 269#define FSCR_TAR (1 << (63-55)) /* Enable Target Address Register */
270#define FSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */
270#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */ 271#define FSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */
272#define SPRN_HFSCR 0xbe /* HV=1 Facility Status & Control Register */
273#define HFSCR_TAR (1 << (63-55)) /* Enable Target Address Register */
274#define HFSCR_EBB (1 << (63-56)) /* Enable Event Based Branching */
275#define HFSCR_TM (1 << (63-58)) /* Enable Transactional Memory */
276#define HFSCR_PM (1 << (63-60)) /* Enable prob/priv access to PMU SPRs */
277#define HFSCR_BHRB (1 << (63-59)) /* Enable Branch History Rolling Buffer*/
278#define HFSCR_DSCR (1 << (63-61)) /* Enable Data Stream Control Register */
279#define HFSCR_VECVSX (1 << (63-62)) /* Enable VMX/VSX */
280#define HFSCR_FP (1 << (63-63)) /* Enable Floating Point */
271#define SPRN_TAR 0x32f /* Target Address Register */ 281#define SPRN_TAR 0x32f /* Target Address Register */
272#define SPRN_LPCR 0x13E /* LPAR Control Register */ 282#define SPRN_LPCR 0x13E /* LPAR Control Register */
273#define LPCR_VPM0 (1ul << (63-0)) 283#define LPCR_VPM0 (1ul << (63-0))
@@ -290,6 +300,7 @@
290#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */ 300#define LPCR_PECE1 0x00002000 /* decrementer can cause exit */
291#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */ 301#define LPCR_PECE2 0x00001000 /* machine check etc can cause exit */
292#define LPCR_MER 0x00000800 /* Mediated External Exception */ 302#define LPCR_MER 0x00000800 /* Mediated External Exception */
303#define LPCR_MER_SH 11
293#define LPCR_LPES 0x0000000c 304#define LPCR_LPES 0x0000000c
294#define LPCR_LPES0 0x00000008 /* LPAR Env selector 0 */ 305#define LPCR_LPES0 0x00000008 /* LPAR Env selector 0 */
295#define LPCR_LPES1 0x00000004 /* LPAR Env selector 1 */ 306#define LPCR_LPES1 0x00000004 /* LPAR Env selector 1 */
@@ -631,6 +642,7 @@
631#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */ 642#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */
632#define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ 643#define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */
633#define SPRN_MMCR1 798 644#define SPRN_MMCR1 798
645#define SPRN_MMCR2 769
634#define SPRN_MMCRA 0x312 646#define SPRN_MMCRA 0x312
635#define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */ 647#define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */
636#define MMCRA_SDAR_DCACHE_MISS 0x40000000UL 648#define MMCRA_SDAR_DCACHE_MISS 0x40000000UL
@@ -649,6 +661,13 @@
649#define POWER7P_MMCRA_SIAR_VALID 0x10000000 /* P7+ SIAR contents valid */ 661#define POWER7P_MMCRA_SIAR_VALID 0x10000000 /* P7+ SIAR contents valid */
650#define POWER7P_MMCRA_SDAR_VALID 0x08000000 /* P7+ SDAR contents valid */ 662#define POWER7P_MMCRA_SDAR_VALID 0x08000000 /* P7+ SDAR contents valid */
651 663
664#define SPRN_MMCRH 316 /* Hypervisor monitor mode control register */
665#define SPRN_MMCRS 894 /* Supervisor monitor mode control register */
666#define SPRN_MMCRC 851 /* Core monitor mode control register */
667#define SPRN_EBBHR 804 /* Event based branch handler register */
668#define SPRN_EBBRR 805 /* Event based branch return register */
669#define SPRN_BESCR 806 /* Branch event status and control register */
670
652#define SPRN_PMC1 787 671#define SPRN_PMC1 787
653#define SPRN_PMC2 788 672#define SPRN_PMC2 788
654#define SPRN_PMC3 789 673#define SPRN_PMC3 789
@@ -659,6 +678,11 @@
659#define SPRN_PMC8 794 678#define SPRN_PMC8 794
660#define SPRN_SIAR 780 679#define SPRN_SIAR 780
661#define SPRN_SDAR 781 680#define SPRN_SDAR 781
681#define SPRN_SIER 784
682#define SIER_SIPR 0x2000000 /* Sampled MSR_PR */
683#define SIER_SIHV 0x1000000 /* Sampled MSR_HV */
684#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */
685#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */
662 686
663#define SPRN_PA6T_MMCR0 795 687#define SPRN_PA6T_MMCR0 795
664#define PA6T_MMCR0_EN0 0x0000000000000001UL 688#define PA6T_MMCR0_EN0 0x0000000000000001UL
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index aef00c675905..a8bc2bb4adc9 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -143,6 +143,8 @@ struct rtas_suspend_me_data {
143#define RTAS_TYPE_PMGM_TIME_ALARM 0x6f 143#define RTAS_TYPE_PMGM_TIME_ALARM 0x6f
144#define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70 144#define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70
145#define RTAS_TYPE_PMGM_SERVICE_PROC 0x71 145#define RTAS_TYPE_PMGM_SERVICE_PROC 0x71
146/* Platform Resource Reassignment Notification */
147#define RTAS_TYPE_PRRN 0xA0
146 148
147/* RTAS check-exception vector offset */ 149/* RTAS check-exception vector offset */
148#define RTAS_VECTOR_EXTERNAL_INTERRUPT 0x500 150#define RTAS_VECTOR_EXTERNAL_INTERRUPT 0x500
@@ -277,6 +279,10 @@ extern int early_init_dt_scan_rtas(unsigned long node,
277 279
278extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); 280extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
279 281
282#ifdef CONFIG_PPC_PSERIES
283extern int pseries_devicetree_update(s32 scope);
284#endif
285
280#ifdef CONFIG_PPC_RTAS_DAEMON 286#ifdef CONFIG_PPC_RTAS_DAEMON
281extern void rtas_cancel_event_scan(void); 287extern void rtas_cancel_event_scan(void);
282#else 288#else
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 195ce2ac5691..ffbaabebcdca 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -143,6 +143,8 @@ extern void __cpu_die(unsigned int cpu);
143/* for UP */ 143/* for UP */
144#define hard_smp_processor_id() get_hard_smp_processor_id(0) 144#define hard_smp_processor_id() get_hard_smp_processor_id(0)
145#define smp_setup_cpu_maps() 145#define smp_setup_cpu_maps()
146static inline void inhibit_secondary_onlining(void) {}
147static inline void uninhibit_secondary_onlining(void) {}
146 148
147#endif /* CONFIG_SMP */ 149#endif /* CONFIG_SMP */
148 150
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index ebbec52d21bd..43523fe0d8b4 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -190,7 +190,7 @@ SYSCALL_SPU(getcwd)
190SYSCALL_SPU(capget) 190SYSCALL_SPU(capget)
191SYSCALL_SPU(capset) 191SYSCALL_SPU(capset)
192COMPAT_SYS(sigaltstack) 192COMPAT_SYS(sigaltstack)
193SYSX_SPU(sys_sendfile,compat_sys_sendfile_wrapper,sys_sendfile) 193COMPAT_SYS_SPU(sendfile)
194SYSCALL(ni_syscall) 194SYSCALL(ni_syscall)
195SYSCALL(ni_syscall) 195SYSCALL(ni_syscall)
196PPC_SYS(vfork) 196PPC_SYS(vfork)
@@ -230,7 +230,7 @@ COMPAT_SYS_SPU(sched_setaffinity)
230COMPAT_SYS_SPU(sched_getaffinity) 230COMPAT_SYS_SPU(sched_getaffinity)
231SYSCALL(ni_syscall) 231SYSCALL(ni_syscall)
232SYSCALL(ni_syscall) 232SYSCALL(ni_syscall)
233SYSX(sys_ni_syscall,compat_sys_sendfile64_wrapper,sys_sendfile64) 233SYS32ONLY(sendfile64)
234COMPAT_SYS_SPU(io_setup) 234COMPAT_SYS_SPU(io_setup)
235SYSCALL_SPU(io_destroy) 235SYSCALL_SPU(io_destroy)
236COMPAT_SYS_SPU(io_getevents) 236COMPAT_SYS_SPU(io_getevents)
@@ -239,7 +239,7 @@ SYSCALL_SPU(io_cancel)
239SYSCALL(set_tid_address) 239SYSCALL(set_tid_address)
240SYSX_SPU(sys_fadvise64,ppc32_fadvise64,sys_fadvise64) 240SYSX_SPU(sys_fadvise64,ppc32_fadvise64,sys_fadvise64)
241SYSCALL(exit_group) 241SYSCALL(exit_group)
242SYSX(sys_lookup_dcookie,ppc32_lookup_dcookie,sys_lookup_dcookie) 242COMPAT_SYS(lookup_dcookie)
243SYSCALL_SPU(epoll_create) 243SYSCALL_SPU(epoll_create)
244SYSCALL_SPU(epoll_ctl) 244SYSCALL_SPU(epoll_ctl)
245SYSCALL_SPU(epoll_wait) 245SYSCALL_SPU(epoll_wait)
@@ -273,8 +273,8 @@ COMPAT_SYS(mq_timedreceive)
273COMPAT_SYS(mq_notify) 273COMPAT_SYS(mq_notify)
274COMPAT_SYS(mq_getsetattr) 274COMPAT_SYS(mq_getsetattr)
275COMPAT_SYS(kexec_load) 275COMPAT_SYS(kexec_load)
276COMPAT_SYS(add_key) 276SYSCALL(add_key)
277COMPAT_SYS(request_key) 277SYSCALL(request_key)
278COMPAT_SYS(keyctl) 278COMPAT_SYS(keyctl)
279COMPAT_SYS(waitid) 279COMPAT_SYS(waitid)
280SYSCALL(ioprio_set) 280SYSCALL(ioprio_set)
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 406b7b9a1341..8ceea14d6fe4 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -182,8 +182,6 @@ static inline bool test_thread_local_flags(unsigned int flags)
182#define is_32bit_task() (1) 182#define is_32bit_task() (1)
183#endif 183#endif
184 184
185#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
186
187#endif /* !__ASSEMBLY__ */ 185#endif /* !__ASSEMBLY__ */
188 186
189#endif /* __KERNEL__ */ 187#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 852ed1b384f6..161ab662843b 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -71,6 +71,7 @@ static inline void sysfs_remove_device_from_node(struct device *dev,
71#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR) 71#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
72extern int start_topology_update(void); 72extern int start_topology_update(void);
73extern int stop_topology_update(void); 73extern int stop_topology_update(void);
74extern int prrn_is_enabled(void);
74#else 75#else
75static inline int start_topology_update(void) 76static inline int start_topology_update(void)
76{ 77{
@@ -80,6 +81,10 @@ static inline int stop_topology_update(void)
80{ 81{
81 return 0; 82 return 0;
82} 83}
84static inline int prrn_is_enabled(void)
85{
86 return 0;
87}
83#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */ 88#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
84 89
85#include <asm-generic/topology.h> 90#include <asm-generic/topology.h>
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 1487f0f12293..3ca819f541bf 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -56,11 +56,5 @@
56#define __ARCH_WANT_SYS_VFORK 56#define __ARCH_WANT_SYS_VFORK
57#define __ARCH_WANT_SYS_CLONE 57#define __ARCH_WANT_SYS_CLONE
58 58
59/*
60 * "Conditional" syscalls
61 */
62#define cond_syscall(x) \
63 asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
64
65#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
66#endif /* _ASM_POWERPC_UNISTD_H_ */ 60#endif /* _ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/include/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h
index b532060d0916..23016020915e 100644
--- a/arch/powerpc/include/asm/uprobes.h
+++ b/arch/powerpc/include/asm/uprobes.h
@@ -51,4 +51,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
51extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk); 51extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
52extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 52extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
53extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 53extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
54extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
54#endif /* _ASM_UPROBES_H */ 55#endif /* _ASM_UPROBES_H */
diff --git a/arch/powerpc/include/asm/xics.h b/arch/powerpc/include/asm/xics.h
index 4ae9a09c3b89..282d43a0c855 100644
--- a/arch/powerpc/include/asm/xics.h
+++ b/arch/powerpc/include/asm/xics.h
@@ -150,6 +150,7 @@ extern void xics_register_ics(struct ics *ics);
150extern void xics_teardown_cpu(void); 150extern void xics_teardown_cpu(void);
151extern void xics_kexec_teardown_cpu(int secondary); 151extern void xics_kexec_teardown_cpu(int secondary);
152extern void xics_migrate_irqs_away(void); 152extern void xics_migrate_irqs_away(void);
153extern void icp_native_eoi(struct irq_data *d);
153#ifdef CONFIG_SMP 154#ifdef CONFIG_SMP
154extern int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask, 155extern int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask,
155 unsigned int strict_check); 156 unsigned int strict_check);
diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
index ed9dd8156962..5b7657959faa 100644
--- a/arch/powerpc/include/uapi/asm/cputable.h
+++ b/arch/powerpc/include/uapi/asm/cputable.h
@@ -1,6 +1,7 @@
1#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H 1#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H
2#define _UAPI__ASM_POWERPC_CPUTABLE_H 2#define _UAPI__ASM_POWERPC_CPUTABLE_H
3 3
4/* in AT_HWCAP */
4#define PPC_FEATURE_32 0x80000000 5#define PPC_FEATURE_32 0x80000000
5#define PPC_FEATURE_64 0x40000000 6#define PPC_FEATURE_64 0x40000000
6#define PPC_FEATURE_601_INSTR 0x20000000 7#define PPC_FEATURE_601_INSTR 0x20000000
@@ -33,4 +34,12 @@
33#define PPC_FEATURE_TRUE_LE 0x00000002 34#define PPC_FEATURE_TRUE_LE 0x00000002
34#define PPC_FEATURE_PPC_LE 0x00000001 35#define PPC_FEATURE_PPC_LE 0x00000001
35 36
37/* in AT_HWCAP2 */
38#define PPC_FEATURE2_ARCH_2_07 0x80000000
39#define PPC_FEATURE2_HTM 0x40000000
40#define PPC_FEATURE2_DSCR 0x20000000
41#define PPC_FEATURE2_EBB 0x10000000
42#define PPC_FEATURE2_ISEL 0x08000000
43#define PPC_FEATURE2_TAR 0x04000000
44
36#endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */ 45#endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h
index 16064d00adb9..0fb1a6e9ff90 100644
--- a/arch/powerpc/include/uapi/asm/kvm.h
+++ b/arch/powerpc/include/uapi/asm/kvm.h
@@ -25,6 +25,8 @@
25/* Select powerpc specific features in <linux/kvm.h> */ 25/* Select powerpc specific features in <linux/kvm.h> */
26#define __KVM_HAVE_SPAPR_TCE 26#define __KVM_HAVE_SPAPR_TCE
27#define __KVM_HAVE_PPC_SMT 27#define __KVM_HAVE_PPC_SMT
28#define __KVM_HAVE_IRQCHIP
29#define __KVM_HAVE_IRQ_LINE
28 30
29struct kvm_regs { 31struct kvm_regs {
30 __u64 pc; 32 __u64 pc;
@@ -272,8 +274,31 @@ struct kvm_debug_exit_arch {
272 274
273/* for KVM_SET_GUEST_DEBUG */ 275/* for KVM_SET_GUEST_DEBUG */
274struct kvm_guest_debug_arch { 276struct kvm_guest_debug_arch {
277 struct {
278 /* H/W breakpoint/watchpoint address */
279 __u64 addr;
280 /*
281 * Type denotes h/w breakpoint, read watchpoint, write
282 * watchpoint or watchpoint (both read and write).
283 */
284#define KVMPPC_DEBUG_NONE 0x0
285#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1)
286#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2)
287#define KVMPPC_DEBUG_WATCH_READ (1UL << 3)
288 __u32 type;
289 __u32 reserved;
290 } bp[16];
275}; 291};
276 292
293/* Debug related defines */
294/*
295 * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic
296 * and upper 16 bits are architecture specific. Architecture specific defines
297 * that ioctl is for setting hardware breakpoint or software breakpoint.
298 */
299#define KVM_GUESTDBG_USE_SW_BP 0x00010000
300#define KVM_GUESTDBG_USE_HW_BP 0x00020000
301
277/* definition of registers in kvm_run */ 302/* definition of registers in kvm_run */
278struct kvm_sync_regs { 303struct kvm_sync_regs {
279}; 304};
@@ -299,6 +324,12 @@ struct kvm_allocate_rma {
299 __u64 rma_size; 324 __u64 rma_size;
300}; 325};
301 326
327/* for KVM_CAP_PPC_RTAS */
328struct kvm_rtas_token_args {
329 char name[120];
330 __u64 token; /* Use a token of 0 to undefine a mapping */
331};
332
302struct kvm_book3e_206_tlb_entry { 333struct kvm_book3e_206_tlb_entry {
303 __u32 mas8; 334 __u32 mas8;
304 __u32 mas1; 335 __u32 mas1;
@@ -359,6 +390,26 @@ struct kvm_get_htab_header {
359 __u16 n_invalid; 390 __u16 n_invalid;
360}; 391};
361 392
393/* Per-vcpu XICS interrupt controller state */
394#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c)
395
396#define KVM_REG_PPC_ICP_CPPR_SHIFT 56 /* current proc priority */
397#define KVM_REG_PPC_ICP_CPPR_MASK 0xff
398#define KVM_REG_PPC_ICP_XISR_SHIFT 32 /* interrupt status field */
399#define KVM_REG_PPC_ICP_XISR_MASK 0xffffff
400#define KVM_REG_PPC_ICP_MFRR_SHIFT 24 /* pending IPI priority */
401#define KVM_REG_PPC_ICP_MFRR_MASK 0xff
402#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */
403#define KVM_REG_PPC_ICP_PPRI_MASK 0xff
404
405/* Device control API: PPC-specific devices */
406#define KVM_DEV_MPIC_GRP_MISC 1
407#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */
408
409#define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */
410#define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */
411
412/* One-Reg API: PPC-specific registers */
362#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1) 413#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1)
363#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2) 414#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2)
364#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3) 415#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3)
@@ -417,4 +468,47 @@ struct kvm_get_htab_header {
417#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85) 468#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85)
418#define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86) 469#define KVM_REG_PPC_EPR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x86)
419 470
471/* Timer Status Register OR/CLEAR interface */
472#define KVM_REG_PPC_OR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x87)
473#define KVM_REG_PPC_CLEAR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x88)
474#define KVM_REG_PPC_TCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x89)
475#define KVM_REG_PPC_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8a)
476
477/* Debugging: Special instruction for software breakpoint */
478#define KVM_REG_PPC_DEBUG_INST (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8b)
479
480/* MMU registers */
481#define KVM_REG_PPC_MAS0 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8c)
482#define KVM_REG_PPC_MAS1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8d)
483#define KVM_REG_PPC_MAS2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8e)
484#define KVM_REG_PPC_MAS7_3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8f)
485#define KVM_REG_PPC_MAS4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x90)
486#define KVM_REG_PPC_MAS6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x91)
487#define KVM_REG_PPC_MMUCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x92)
488/*
489 * TLBnCFG fields TLBnCFG_N_ENTRY and TLBnCFG_ASSOC can be changed only using
490 * KVM_CAP_SW_TLB ioctl
491 */
492#define KVM_REG_PPC_TLB0CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x93)
493#define KVM_REG_PPC_TLB1CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x94)
494#define KVM_REG_PPC_TLB2CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x95)
495#define KVM_REG_PPC_TLB3CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x96)
496#define KVM_REG_PPC_TLB0PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x97)
497#define KVM_REG_PPC_TLB1PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x98)
498#define KVM_REG_PPC_TLB2PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x99)
499#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a)
500#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b)
501
502/* PPC64 eXternal Interrupt Controller Specification */
503#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */
504
505/* Layout of 64-bit source attribute values */
506#define KVM_XICS_DESTINATION_SHIFT 0
507#define KVM_XICS_DESTINATION_MASK 0xffffffffULL
508#define KVM_XICS_PRIORITY_SHIFT 32
509#define KVM_XICS_PRIORITY_MASK 0xff
510#define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40)
511#define KVM_XICS_MASKED (1ULL << 41)
512#define KVM_XICS_PENDING (1ULL << 42)
513
420#endif /* __LINUX_KVM_POWERPC_H */ 514#endif /* __LINUX_KVM_POWERPC_H */
diff --git a/arch/powerpc/include/uapi/asm/linkage.h b/arch/powerpc/include/uapi/asm/linkage.h
deleted file mode 100644
index e1c4ac1cc4ba..000000000000
--- a/arch/powerpc/include/uapi/asm/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_POWERPC_LINKAGE_H
2#define _ASM_POWERPC_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/powerpc/include/uapi/asm/ptrace.h b/arch/powerpc/include/uapi/asm/ptrace.h
index 66b9ca4ee94a..77d2ed35b111 100644
--- a/arch/powerpc/include/uapi/asm/ptrace.h
+++ b/arch/powerpc/include/uapi/asm/ptrace.h
@@ -211,6 +211,7 @@ struct ppc_debug_info {
211#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002 211#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x0000000000000002
212#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004 212#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x0000000000000004
213#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008 213#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x0000000000000008
214#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x0000000000000010
214 215
215#ifndef __ASSEMBLY__ 216#ifndef __ASSEMBLY__
216 217
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index b6c17ec9b169..b51a97cfedf8 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -124,6 +124,9 @@ int main(void)
124 124
125#ifdef CONFIG_PPC_BOOK3S_64 125#ifdef CONFIG_PPC_BOOK3S_64
126 DEFINE(THREAD_TAR, offsetof(struct thread_struct, tar)); 126 DEFINE(THREAD_TAR, offsetof(struct thread_struct, tar));
127 DEFINE(THREAD_BESCR, offsetof(struct thread_struct, bescr));
128 DEFINE(THREAD_EBBHR, offsetof(struct thread_struct, ebbhr));
129 DEFINE(THREAD_EBBRR, offsetof(struct thread_struct, ebbrr));
127#endif 130#endif
128#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 131#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
129 DEFINE(PACATMSCRATCH, offsetof(struct paca_struct, tm_scratch)); 132 DEFINE(PACATMSCRATCH, offsetof(struct paca_struct, tm_scratch));
@@ -477,6 +480,7 @@ int main(void)
477 DEFINE(VCPU_DSISR, offsetof(struct kvm_vcpu, arch.shregs.dsisr)); 480 DEFINE(VCPU_DSISR, offsetof(struct kvm_vcpu, arch.shregs.dsisr));
478 DEFINE(VCPU_DAR, offsetof(struct kvm_vcpu, arch.shregs.dar)); 481 DEFINE(VCPU_DAR, offsetof(struct kvm_vcpu, arch.shregs.dar));
479 DEFINE(VCPU_VPA, offsetof(struct kvm_vcpu, arch.vpa.pinned_addr)); 482 DEFINE(VCPU_VPA, offsetof(struct kvm_vcpu, arch.vpa.pinned_addr));
483 DEFINE(VCPU_VPA_DIRTY, offsetof(struct kvm_vcpu, arch.vpa.dirty));
480#endif 484#endif
481#ifdef CONFIG_PPC_BOOK3S 485#ifdef CONFIG_PPC_BOOK3S
482 DEFINE(VCPU_VCPUID, offsetof(struct kvm_vcpu, vcpu_id)); 486 DEFINE(VCPU_VCPUID, offsetof(struct kvm_vcpu, vcpu_id));
@@ -573,6 +577,8 @@ int main(void)
573 HSTATE_FIELD(HSTATE_KVM_VCPU, kvm_vcpu); 577 HSTATE_FIELD(HSTATE_KVM_VCPU, kvm_vcpu);
574 HSTATE_FIELD(HSTATE_KVM_VCORE, kvm_vcore); 578 HSTATE_FIELD(HSTATE_KVM_VCORE, kvm_vcore);
575 HSTATE_FIELD(HSTATE_XICS_PHYS, xics_phys); 579 HSTATE_FIELD(HSTATE_XICS_PHYS, xics_phys);
580 HSTATE_FIELD(HSTATE_SAVED_XIRR, saved_xirr);
581 HSTATE_FIELD(HSTATE_HOST_IPI, host_ipi);
576 HSTATE_FIELD(HSTATE_MMCR, host_mmcr); 582 HSTATE_FIELD(HSTATE_MMCR, host_mmcr);
577 HSTATE_FIELD(HSTATE_PMC, host_pmc); 583 HSTATE_FIELD(HSTATE_PMC, host_pmc);
578 HSTATE_FIELD(HSTATE_PURR, host_purr); 584 HSTATE_FIELD(HSTATE_PURR, host_purr);
@@ -596,6 +602,7 @@ int main(void)
596 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 602 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
597 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); 603 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
598 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); 604 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
605 DEFINE(VCPU_CRIT_SAVE, offsetof(struct kvm_vcpu, arch.crit_save));
599#endif /* CONFIG_PPC_BOOK3S */ 606#endif /* CONFIG_PPC_BOOK3S */
600#endif /* CONFIG_KVM */ 607#endif /* CONFIG_KVM */
601 608
diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index dcd881937f7a..0b9af015bedc 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -53,6 +53,15 @@ _GLOBAL(__e500_dcache_setup)
53 isync 53 isync
54 blr 54 blr
55 55
56_GLOBAL(__setup_cpu_e6500)
57 mflr r6
58#ifdef CONFIG_PPC64
59 bl .setup_altivec_ivors
60#endif
61 bl __setup_cpu_e5500
62 mtlr r6
63 blr
64
56#ifdef CONFIG_PPC32 65#ifdef CONFIG_PPC32
57_GLOBAL(__setup_cpu_e200) 66_GLOBAL(__setup_cpu_e200)
58 /* enable dedicated debug exception handling resources (Debug APU) */ 67 /* enable dedicated debug exception handling resources (Debug APU) */
@@ -107,6 +116,13 @@ _GLOBAL(__setup_cpu_e5500)
107#endif 116#endif
108 117
109#ifdef CONFIG_PPC_BOOK3E_64 118#ifdef CONFIG_PPC_BOOK3E_64
119_GLOBAL(__restore_cpu_e6500)
120 mflr r5
121 bl .setup_altivec_ivors
122 bl __restore_cpu_e5500
123 mtlr r5
124 blr
125
110_GLOBAL(__restore_cpu_e5500) 126_GLOBAL(__restore_cpu_e5500)
111 mflr r4 127 mflr r4
112 bl __e500_icache_setup 128 bl __e500_icache_setup
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S
index ea847abb0d0a..a283b6442b26 100644
--- a/arch/powerpc/kernel/cpu_setup_power.S
+++ b/arch/powerpc/kernel/cpu_setup_power.S
@@ -49,6 +49,7 @@ _GLOBAL(__restore_cpu_power7)
49_GLOBAL(__setup_cpu_power8) 49_GLOBAL(__setup_cpu_power8)
50 mflr r11 50 mflr r11
51 bl __init_FSCR 51 bl __init_FSCR
52 bl __init_PMU
52 bl __init_hvmode_206 53 bl __init_hvmode_206
53 mtlr r11 54 mtlr r11
54 beqlr 55 beqlr
@@ -57,22 +58,28 @@ _GLOBAL(__setup_cpu_power8)
57 mfspr r3,SPRN_LPCR 58 mfspr r3,SPRN_LPCR
58 oris r3, r3, LPCR_AIL_3@h 59 oris r3, r3, LPCR_AIL_3@h
59 bl __init_LPCR 60 bl __init_LPCR
61 bl __init_HFSCR
60 bl __init_TLB 62 bl __init_TLB
63 bl __init_PMU_HV
61 mtlr r11 64 mtlr r11
62 blr 65 blr
63 66
64_GLOBAL(__restore_cpu_power8) 67_GLOBAL(__restore_cpu_power8)
65 mflr r11 68 mflr r11
66 bl __init_FSCR 69 bl __init_FSCR
70 bl __init_PMU
67 mfmsr r3 71 mfmsr r3
68 rldicl. r0,r3,4,63 72 rldicl. r0,r3,4,63
73 mtlr r11
69 beqlr 74 beqlr
70 li r0,0 75 li r0,0
71 mtspr SPRN_LPID,r0 76 mtspr SPRN_LPID,r0
72 mfspr r3,SPRN_LPCR 77 mfspr r3,SPRN_LPCR
73 oris r3, r3, LPCR_AIL_3@h 78 oris r3, r3, LPCR_AIL_3@h
74 bl __init_LPCR 79 bl __init_LPCR
80 bl __init_HFSCR
75 bl __init_TLB 81 bl __init_TLB
82 bl __init_PMU_HV
76 mtlr r11 83 mtlr r11
77 blr 84 blr
78 85
@@ -116,10 +123,17 @@ __init_LPCR:
116 123
117__init_FSCR: 124__init_FSCR:
118 mfspr r3,SPRN_FSCR 125 mfspr r3,SPRN_FSCR
119 ori r3,r3,FSCR_TAR|FSCR_DSCR 126 ori r3,r3,FSCR_TAR|FSCR_DSCR|FSCR_EBB
120 mtspr SPRN_FSCR,r3 127 mtspr SPRN_FSCR,r3
121 blr 128 blr
122 129
130__init_HFSCR:
131 mfspr r3,SPRN_HFSCR
132 ori r3,r3,HFSCR_TAR|HFSCR_TM|HFSCR_BHRB|HFSCR_PM|\
133 HFSCR_DSCR|HFSCR_VECVSX|HFSCR_FP|HFSCR_EBB
134 mtspr SPRN_HFSCR,r3
135 blr
136
123__init_TLB: 137__init_TLB:
124 /* Clear the TLB */ 138 /* Clear the TLB */
125 li r6,128 139 li r6,128
@@ -131,3 +145,18 @@ __init_TLB:
131 bdnz 2b 145 bdnz 2b
132 ptesync 146 ptesync
1331: blr 1471: blr
148
149__init_PMU_HV:
150 li r5,0
151 mtspr SPRN_MMCRC,r5
152 mtspr SPRN_MMCRH,r5
153 blr
154
155__init_PMU:
156 li r5,0
157 mtspr SPRN_MMCRS,r5
158 mtspr SPRN_MMCRA,r5
159 mtspr SPRN_MMCR0,r5
160 mtspr SPRN_MMCR1,r5
161 mtspr SPRN_MMCR2,r5
162 blr
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 19599ef352bc..c60bbec25c1f 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -74,7 +74,9 @@ extern void __restore_cpu_a2(void);
74#endif /* CONFIG_PPC64 */ 74#endif /* CONFIG_PPC64 */
75#if defined(CONFIG_E500) 75#if defined(CONFIG_E500)
76extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec); 76extern void __setup_cpu_e5500(unsigned long offset, struct cpu_spec* spec);
77extern void __setup_cpu_e6500(unsigned long offset, struct cpu_spec* spec);
77extern void __restore_cpu_e5500(void); 78extern void __restore_cpu_e5500(void);
79extern void __restore_cpu_e6500(void);
78#endif /* CONFIG_E500 */ 80#endif /* CONFIG_E500 */
79 81
80/* This table only contains "desktop" CPUs, it need to be filled with embedded 82/* This table only contains "desktop" CPUs, it need to be filled with embedded
@@ -96,10 +98,14 @@ extern void __restore_cpu_e5500(void);
96 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ 98 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
97 PPC_FEATURE_TRUE_LE | \ 99 PPC_FEATURE_TRUE_LE | \
98 PPC_FEATURE_PSERIES_PERFMON_COMPAT) 100 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
101#define COMMON_USER2_POWER7 (PPC_FEATURE2_DSCR)
99#define COMMON_USER_POWER8 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_06 |\ 102#define COMMON_USER_POWER8 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_06 |\
100 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ 103 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
101 PPC_FEATURE_TRUE_LE | \ 104 PPC_FEATURE_TRUE_LE | \
102 PPC_FEATURE_PSERIES_PERFMON_COMPAT) 105 PPC_FEATURE_PSERIES_PERFMON_COMPAT)
106#define COMMON_USER2_POWER8 (PPC_FEATURE2_ARCH_2_07 | \
107 PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
108 PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
103#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\ 109#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
104 PPC_FEATURE_TRUE_LE | \ 110 PPC_FEATURE_TRUE_LE | \
105 PPC_FEATURE_HAS_ALTIVEC_COMP) 111 PPC_FEATURE_HAS_ALTIVEC_COMP)
@@ -426,6 +432,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
426 .cpu_name = "POWER7 (architected)", 432 .cpu_name = "POWER7 (architected)",
427 .cpu_features = CPU_FTRS_POWER7, 433 .cpu_features = CPU_FTRS_POWER7,
428 .cpu_user_features = COMMON_USER_POWER7, 434 .cpu_user_features = COMMON_USER_POWER7,
435 .cpu_user_features2 = COMMON_USER2_POWER7,
429 .mmu_features = MMU_FTRS_POWER7, 436 .mmu_features = MMU_FTRS_POWER7,
430 .icache_bsize = 128, 437 .icache_bsize = 128,
431 .dcache_bsize = 128, 438 .dcache_bsize = 128,
@@ -441,6 +448,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
441 .cpu_name = "POWER8 (architected)", 448 .cpu_name = "POWER8 (architected)",
442 .cpu_features = CPU_FTRS_POWER8, 449 .cpu_features = CPU_FTRS_POWER8,
443 .cpu_user_features = COMMON_USER_POWER8, 450 .cpu_user_features = COMMON_USER_POWER8,
451 .cpu_user_features2 = COMMON_USER2_POWER8,
444 .mmu_features = MMU_FTRS_POWER8, 452 .mmu_features = MMU_FTRS_POWER8,
445 .icache_bsize = 128, 453 .icache_bsize = 128,
446 .dcache_bsize = 128, 454 .dcache_bsize = 128,
@@ -456,6 +464,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
456 .cpu_name = "POWER7 (raw)", 464 .cpu_name = "POWER7 (raw)",
457 .cpu_features = CPU_FTRS_POWER7, 465 .cpu_features = CPU_FTRS_POWER7,
458 .cpu_user_features = COMMON_USER_POWER7, 466 .cpu_user_features = COMMON_USER_POWER7,
467 .cpu_user_features2 = COMMON_USER2_POWER7,
459 .mmu_features = MMU_FTRS_POWER7, 468 .mmu_features = MMU_FTRS_POWER7,
460 .icache_bsize = 128, 469 .icache_bsize = 128,
461 .dcache_bsize = 128, 470 .dcache_bsize = 128,
@@ -473,6 +482,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
473 .cpu_name = "POWER7+ (raw)", 482 .cpu_name = "POWER7+ (raw)",
474 .cpu_features = CPU_FTRS_POWER7, 483 .cpu_features = CPU_FTRS_POWER7,
475 .cpu_user_features = COMMON_USER_POWER7, 484 .cpu_user_features = COMMON_USER_POWER7,
485 .cpu_user_features = COMMON_USER2_POWER7,
476 .mmu_features = MMU_FTRS_POWER7, 486 .mmu_features = MMU_FTRS_POWER7,
477 .icache_bsize = 128, 487 .icache_bsize = 128,
478 .dcache_bsize = 128, 488 .dcache_bsize = 128,
@@ -490,6 +500,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
490 .cpu_name = "POWER8 (raw)", 500 .cpu_name = "POWER8 (raw)",
491 .cpu_features = CPU_FTRS_POWER8, 501 .cpu_features = CPU_FTRS_POWER8,
492 .cpu_user_features = COMMON_USER_POWER8, 502 .cpu_user_features = COMMON_USER_POWER8,
503 .cpu_user_features2 = COMMON_USER2_POWER8,
493 .mmu_features = MMU_FTRS_POWER8, 504 .mmu_features = MMU_FTRS_POWER8,
494 .icache_bsize = 128, 505 .icache_bsize = 128,
495 .dcache_bsize = 128, 506 .dcache_bsize = 128,
@@ -1993,6 +2004,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
1993 .cpu_user_features = COMMON_USER_BOOKE | 2004 .cpu_user_features = COMMON_USER_BOOKE |
1994 PPC_FEATURE_HAS_SPE_COMP | 2005 PPC_FEATURE_HAS_SPE_COMP |
1995 PPC_FEATURE_HAS_EFP_SINGLE_COMP, 2006 PPC_FEATURE_HAS_EFP_SINGLE_COMP,
2007 .cpu_user_features2 = PPC_FEATURE2_ISEL,
1996 .mmu_features = MMU_FTR_TYPE_FSL_E, 2008 .mmu_features = MMU_FTR_TYPE_FSL_E,
1997 .icache_bsize = 32, 2009 .icache_bsize = 32,
1998 .dcache_bsize = 32, 2010 .dcache_bsize = 32,
@@ -2012,6 +2024,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
2012 PPC_FEATURE_HAS_SPE_COMP | 2024 PPC_FEATURE_HAS_SPE_COMP |
2013 PPC_FEATURE_HAS_EFP_SINGLE_COMP | 2025 PPC_FEATURE_HAS_EFP_SINGLE_COMP |
2014 PPC_FEATURE_HAS_EFP_DOUBLE_COMP, 2026 PPC_FEATURE_HAS_EFP_DOUBLE_COMP,
2027 .cpu_user_features2 = PPC_FEATURE2_ISEL,
2015 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS, 2028 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS,
2016 .icache_bsize = 32, 2029 .icache_bsize = 32,
2017 .dcache_bsize = 32, 2030 .dcache_bsize = 32,
@@ -2028,6 +2041,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
2028 .cpu_name = "e500mc", 2041 .cpu_name = "e500mc",
2029 .cpu_features = CPU_FTRS_E500MC, 2042 .cpu_features = CPU_FTRS_E500MC,
2030 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 2043 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
2044 .cpu_user_features2 = PPC_FEATURE2_ISEL,
2031 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | 2045 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
2032 MMU_FTR_USE_TLBILX, 2046 MMU_FTR_USE_TLBILX,
2033 .icache_bsize = 64, 2047 .icache_bsize = 64,
@@ -2046,6 +2060,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
2046 .cpu_name = "e5500", 2060 .cpu_name = "e5500",
2047 .cpu_features = CPU_FTRS_E5500, 2061 .cpu_features = CPU_FTRS_E5500,
2048 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 2062 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
2063 .cpu_user_features2 = PPC_FEATURE2_ISEL,
2049 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | 2064 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
2050 MMU_FTR_USE_TLBILX, 2065 MMU_FTR_USE_TLBILX,
2051 .icache_bsize = 64, 2066 .icache_bsize = 64,
@@ -2065,7 +2080,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2065 .pvr_value = 0x80400000, 2080 .pvr_value = 0x80400000,
2066 .cpu_name = "e6500", 2081 .cpu_name = "e6500",
2067 .cpu_features = CPU_FTRS_E6500, 2082 .cpu_features = CPU_FTRS_E6500,
2068 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU, 2083 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU |
2084 PPC_FEATURE_HAS_ALTIVEC_COMP,
2085 .cpu_user_features2 = PPC_FEATURE2_ISEL,
2069 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | 2086 .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
2070 MMU_FTR_USE_TLBILX, 2087 MMU_FTR_USE_TLBILX,
2071 .icache_bsize = 64, 2088 .icache_bsize = 64,
@@ -2073,9 +2090,9 @@ static struct cpu_spec __initdata cpu_specs[] = {
2073 .num_pmcs = 4, 2090 .num_pmcs = 4,
2074 .oprofile_cpu_type = "ppc/e6500", 2091 .oprofile_cpu_type = "ppc/e6500",
2075 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2092 .oprofile_type = PPC_OPROFILE_FSL_EMB,
2076 .cpu_setup = __setup_cpu_e5500, 2093 .cpu_setup = __setup_cpu_e6500,
2077#ifndef CONFIG_PPC32 2094#ifndef CONFIG_PPC32
2078 .cpu_restore = __restore_cpu_e5500, 2095 .cpu_restore = __restore_cpu_e6500,
2079#endif 2096#endif
2080 .machine_check = machine_check_e500mc, 2097 .machine_check = machine_check_e500mc,
2081 .platform = "ppce6500", 2098 .platform = "ppce6500",
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index b3ba5163eae2..9ec3fe174cba 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -150,10 +150,7 @@ void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
150 if (addr <= rtas_end && ((addr + PAGE_SIZE) > rtas_start)) 150 if (addr <= rtas_end && ((addr + PAGE_SIZE) > rtas_start))
151 continue; 151 continue;
152 152
153 ClearPageReserved(pfn_to_page(addr >> PAGE_SHIFT)); 153 free_reserved_page(pfn_to_page(addr >> PAGE_SHIFT));
154 init_page_count(pfn_to_page(addr >> PAGE_SHIFT));
155 free_page((unsigned long)__va(addr));
156 totalram_pages++;
157 } 154 }
158} 155}
159#endif 156#endif
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index 9ebbc24bb23c..d55c76c571f3 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -41,6 +41,8 @@ void doorbell_exception(struct pt_regs *regs)
41 41
42 may_hard_irq_enable(); 42 may_hard_irq_enable();
43 43
44 __get_cpu_var(irq_stat).doorbell_irqs++;
45
44 smp_ipi_demux(); 46 smp_ipi_demux();
45 47
46 irq_exit(); 48 irq_exit();
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 04d69c4a5ac2..3fe5259e2fea 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -458,7 +458,15 @@ BEGIN_FTR_SECTION
458 */ 458 */
459 mfspr r0,SPRN_TAR 459 mfspr r0,SPRN_TAR
460 std r0,THREAD_TAR(r3) 460 std r0,THREAD_TAR(r3)
461END_FTR_SECTION_IFSET(CPU_FTR_BCTAR) 461
462 /* Event based branch registers */
463 mfspr r0, SPRN_BESCR
464 std r0, THREAD_BESCR(r3)
465 mfspr r0, SPRN_EBBHR
466 std r0, THREAD_EBBHR(r3)
467 mfspr r0, SPRN_EBBRR
468 std r0, THREAD_EBBRR(r3)
469END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
462#endif 470#endif
463 471
464#ifdef CONFIG_SMP 472#ifdef CONFIG_SMP
@@ -545,9 +553,17 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
545 553
546#ifdef CONFIG_PPC_BOOK3S_64 554#ifdef CONFIG_PPC_BOOK3S_64
547BEGIN_FTR_SECTION 555BEGIN_FTR_SECTION
556 /* Event based branch registers */
557 ld r0, THREAD_BESCR(r4)
558 mtspr SPRN_BESCR, r0
559 ld r0, THREAD_EBBHR(r4)
560 mtspr SPRN_EBBHR, r0
561 ld r0, THREAD_EBBRR(r4)
562 mtspr SPRN_EBBRR, r0
563
548 ld r0,THREAD_TAR(r4) 564 ld r0,THREAD_TAR(r4)
549 mtspr SPRN_TAR,r0 565 mtspr SPRN_TAR,r0
550END_FTR_SECTION_IFSET(CPU_FTR_BCTAR) 566END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
551#endif 567#endif
552 568
553#ifdef CONFIG_ALTIVEC 569#ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
index 62c0dc237826..9f1ebf7338f1 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -17,6 +17,7 @@
17#include <asm/asm-compat.h> 17#include <asm/asm-compat.h>
18#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
19 19
20#ifndef CONFIG_PPC64
20/* epapr_ev_idle() was derived from e500_idle() */ 21/* epapr_ev_idle() was derived from e500_idle() */
21_GLOBAL(epapr_ev_idle) 22_GLOBAL(epapr_ev_idle)
22 CURRENT_THREAD_INFO(r3, r1) 23 CURRENT_THREAD_INFO(r3, r1)
@@ -42,6 +43,7 @@ epapr_ev_idle_start:
42 * _TLF_NAPPING. 43 * _TLF_NAPPING.
43 */ 44 */
44 b idle_loop 45 b idle_loop
46#endif
45 47
46/* Hypercall entry point. Will be patched with device tree instructions. */ 48/* Hypercall entry point. Will be patched with device tree instructions. */
47.global epapr_hypercall_start 49.global epapr_hypercall_start
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index ae54553eacd9..42a756eec9ff 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -299,6 +299,8 @@ interrupt_base_book3e: /* fake trap */
299 EXCEPTION_STUB(0x1a0, watchdog) /* 0x09f0 */ 299 EXCEPTION_STUB(0x1a0, watchdog) /* 0x09f0 */
300 EXCEPTION_STUB(0x1c0, data_tlb_miss) 300 EXCEPTION_STUB(0x1c0, data_tlb_miss)
301 EXCEPTION_STUB(0x1e0, instruction_tlb_miss) 301 EXCEPTION_STUB(0x1e0, instruction_tlb_miss)
302 EXCEPTION_STUB(0x200, altivec_unavailable) /* 0x0f20 */
303 EXCEPTION_STUB(0x220, altivec_assist) /* 0x1700 */
302 EXCEPTION_STUB(0x260, perfmon) 304 EXCEPTION_STUB(0x260, perfmon)
303 EXCEPTION_STUB(0x280, doorbell) 305 EXCEPTION_STUB(0x280, doorbell)
304 EXCEPTION_STUB(0x2a0, doorbell_crit) 306 EXCEPTION_STUB(0x2a0, doorbell_crit)
@@ -395,6 +397,45 @@ interrupt_end_book3e:
395 bl .kernel_fp_unavailable_exception 397 bl .kernel_fp_unavailable_exception
396 b .ret_from_except 398 b .ret_from_except
397 399
400/* Altivec Unavailable Interrupt */
401 START_EXCEPTION(altivec_unavailable);
402 NORMAL_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_ALTIVEC_UNAVAIL,
403 PROLOG_ADDITION_NONE)
404 /* we can probably do a shorter exception entry for that one... */
405 EXCEPTION_COMMON(0x200, PACA_EXGEN, INTS_KEEP)
406#ifdef CONFIG_ALTIVEC
407BEGIN_FTR_SECTION
408 ld r12,_MSR(r1)
409 andi. r0,r12,MSR_PR;
410 beq- 1f
411 bl .load_up_altivec
412 b fast_exception_return
4131:
414END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
415#endif
416 INTS_DISABLE
417 bl .save_nvgprs
418 addi r3,r1,STACK_FRAME_OVERHEAD
419 bl .altivec_unavailable_exception
420 b .ret_from_except
421
422/* AltiVec Assist */
423 START_EXCEPTION(altivec_assist);
424 NORMAL_EXCEPTION_PROLOG(0x220, BOOKE_INTERRUPT_ALTIVEC_ASSIST,
425 PROLOG_ADDITION_NONE)
426 EXCEPTION_COMMON(0x220, PACA_EXGEN, INTS_DISABLE)
427 bl .save_nvgprs
428 addi r3,r1,STACK_FRAME_OVERHEAD
429#ifdef CONFIG_ALTIVEC
430BEGIN_FTR_SECTION
431 bl .altivec_assist_exception
432END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
433#else
434 bl .unknown_exception
435#endif
436 b .ret_from_except
437
438
398/* Decrementer Interrupt */ 439/* Decrementer Interrupt */
399 MASKABLE_EXCEPTION(0x900, BOOKE_INTERRUPT_DECREMENTER, 440 MASKABLE_EXCEPTION(0x900, BOOKE_INTERRUPT_DECREMENTER,
400 decrementer, .timer_interrupt, ACK_DEC) 441 decrementer, .timer_interrupt, ACK_DEC)
@@ -807,6 +848,7 @@ fast_exception_return:
807BAD_STACK_TRAMPOLINE(0x000) 848BAD_STACK_TRAMPOLINE(0x000)
808BAD_STACK_TRAMPOLINE(0x100) 849BAD_STACK_TRAMPOLINE(0x100)
809BAD_STACK_TRAMPOLINE(0x200) 850BAD_STACK_TRAMPOLINE(0x200)
851BAD_STACK_TRAMPOLINE(0x220)
810BAD_STACK_TRAMPOLINE(0x260) 852BAD_STACK_TRAMPOLINE(0x260)
811BAD_STACK_TRAMPOLINE(0x280) 853BAD_STACK_TRAMPOLINE(0x280)
812BAD_STACK_TRAMPOLINE(0x2a0) 854BAD_STACK_TRAMPOLINE(0x2a0)
@@ -1350,6 +1392,11 @@ _GLOBAL(__setup_base_ivors)
1350 1392
1351 blr 1393 blr
1352 1394
1395_GLOBAL(setup_altivec_ivors)
1396 SET_IVOR(32, 0x200) /* AltiVec Unavailable */
1397 SET_IVOR(33, 0x220) /* AltiVec Assist */
1398 blr
1399
1353_GLOBAL(setup_perfmon_ivor) 1400_GLOBAL(setup_perfmon_ivor)
1354 SET_IVOR(35, 0x260) /* Performance Monitor */ 1401 SET_IVOR(35, 0x260) /* Performance Monitor */
1355 blr 1402 blr
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 56bd92362ce1..e6eba1bf61ad 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -235,6 +235,7 @@ instruction_access_slb_pSeries:
235 .globl hardware_interrupt_hv; 235 .globl hardware_interrupt_hv;
236hardware_interrupt_pSeries: 236hardware_interrupt_pSeries:
237hardware_interrupt_hv: 237hardware_interrupt_hv:
238 HMT_MEDIUM_PPR_DISCARD
238 BEGIN_FTR_SECTION 239 BEGIN_FTR_SECTION
239 _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt, 240 _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt,
240 EXC_HV, SOFTEN_TEST_HV) 241 EXC_HV, SOFTEN_TEST_HV)
@@ -254,7 +255,11 @@ hardware_interrupt_hv:
254 STD_EXCEPTION_PSERIES(0x800, 0x800, fp_unavailable) 255 STD_EXCEPTION_PSERIES(0x800, 0x800, fp_unavailable)
255 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x800) 256 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x800)
256 257
257 MASKABLE_EXCEPTION_PSERIES(0x900, 0x900, decrementer) 258 . = 0x900
259 .globl decrementer_pSeries
260decrementer_pSeries:
261 _MASKABLE_EXCEPTION_PSERIES(0x900, decrementer, EXC_STD, SOFTEN_TEST_PR)
262
258 STD_EXCEPTION_HV(0x980, 0x982, hdecrementer) 263 STD_EXCEPTION_HV(0x980, 0x982, hdecrementer)
259 264
260 MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super) 265 MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super)
@@ -688,9 +693,18 @@ slb_miss_user_pseries:
688 .align 7 693 .align 7
689 .globl machine_check_common 694 .globl machine_check_common
690machine_check_common: 695machine_check_common:
696
697 mfspr r10,SPRN_DAR
698 std r10,PACA_EXGEN+EX_DAR(r13)
699 mfspr r10,SPRN_DSISR
700 stw r10,PACA_EXGEN+EX_DSISR(r13)
691 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC) 701 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
692 FINISH_NAP 702 FINISH_NAP
693 DISABLE_INTS 703 DISABLE_INTS
704 ld r3,PACA_EXGEN+EX_DAR(r13)
705 lwz r4,PACA_EXGEN+EX_DSISR(r13)
706 std r3,_DAR(r1)
707 std r4,_DSISR(r1)
694 bl .save_nvgprs 708 bl .save_nvgprs
695 addi r3,r1,STACK_FRAME_OVERHEAD 709 addi r3,r1,STACK_FRAME_OVERHEAD
696 bl .machine_check_exception 710 bl .machine_check_exception
@@ -797,7 +811,7 @@ hardware_interrupt_relon_hv:
797 _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV) 811 _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV)
798 FTR_SECTION_ELSE 812 FTR_SECTION_ELSE
799 _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR) 813 _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR)
800 ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_206) 814 ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
801 STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment) 815 STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment)
802 STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check) 816 STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check)
803 STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable) 817 STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
@@ -870,10 +884,6 @@ tm_unavailable_relon_pSeries_1:
870 . = 0x5500 884 . = 0x5500
871 b denorm_exception_hv 885 b denorm_exception_hv
872#endif 886#endif
873#ifdef CONFIG_HVC_SCOM
874 STD_RELON_EXCEPTION_HV(0x5600, 0x1600, maintence_interrupt)
875 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1600)
876#endif /* CONFIG_HVC_SCOM */
877 STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist) 887 STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
878 888
879 /* Other future vectors */ 889 /* Other future vectors */
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 06c8202a69cf..2230fd0ca3e4 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -1045,10 +1045,7 @@ static void fadump_release_memory(unsigned long begin, unsigned long end)
1045 if (addr <= ra_end && ((addr + PAGE_SIZE) > ra_start)) 1045 if (addr <= ra_end && ((addr + PAGE_SIZE) > ra_start))
1046 continue; 1046 continue;
1047 1047
1048 ClearPageReserved(pfn_to_page(addr >> PAGE_SHIFT)); 1048 free_reserved_page(pfn_to_page(addr >> PAGE_SHIFT));
1049 init_page_count(pfn_to_page(addr >> PAGE_SHIFT));
1050 free_page((unsigned long)__va(addr));
1051 totalram_pages++;
1052 } 1049 }
1053} 1050}
1054 1051
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 7a2e5e421abf..97e2671cde7f 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -769,6 +769,8 @@ finish_tlb_load_47x:
769 */ 769 */
770 DEBUG_CRIT_EXCEPTION 770 DEBUG_CRIT_EXCEPTION
771 771
772interrupt_end:
773
772/* 774/*
773 * Global functions 775 * Global functions
774 */ 776 */
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 0886ae6dd5be..b61363d557b5 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -509,6 +509,7 @@ _GLOBAL(copy_and_flush)
509 sync 509 sync
510 addi r5,r5,8 510 addi r5,r5,8
511 addi r6,r6,8 511 addi r6,r6,8
512 isync
512 blr 513 blr
513 514
514.align 8 515.align 8
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index 5f051eeb93a2..a620203f7de3 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -199,11 +199,6 @@
199 .align 5; \ 199 .align 5; \
200label: 200label:
201 201
202#define FINISH_EXCEPTION(func) \
203 bl transfer_to_handler_full; \
204 .long func; \
205 .long ret_from_except_full
206
207#define EXCEPTION(n, intno, label, hdlr, xfer) \ 202#define EXCEPTION(n, intno, label, hdlr, xfer) \
208 START_EXCEPTION(label); \ 203 START_EXCEPTION(label); \
209 NORMAL_EXCEPTION_PROLOG(intno); \ 204 NORMAL_EXCEPTION_PROLOG(intno); \
@@ -286,13 +281,13 @@ label:
286 andis. r10,r10,(DBSR_IC|DBSR_BT)@h; \ 281 andis. r10,r10,(DBSR_IC|DBSR_BT)@h; \
287 beq+ 2f; \ 282 beq+ 2f; \
288 \ 283 \
289 lis r10,KERNELBASE@h; /* check if exception in vectors */ \ 284 lis r10,interrupt_base@h; /* check if exception in vectors */ \
290 ori r10,r10,KERNELBASE@l; \ 285 ori r10,r10,interrupt_base@l; \
291 cmplw r12,r10; \ 286 cmplw r12,r10; \
292 blt+ 2f; /* addr below exception vectors */ \ 287 blt+ 2f; /* addr below exception vectors */ \
293 \ 288 \
294 lis r10,DebugDebug@h; \ 289 lis r10,interrupt_end@h; \
295 ori r10,r10,DebugDebug@l; \ 290 ori r10,r10,interrupt_end@l; \
296 cmplw r12,r10; \ 291 cmplw r12,r10; \
297 bgt+ 2f; /* addr above exception vectors */ \ 292 bgt+ 2f; /* addr above exception vectors */ \
298 \ 293 \
@@ -339,13 +334,13 @@ label:
339 andis. r10,r10,(DBSR_IC|DBSR_BT)@h; \ 334 andis. r10,r10,(DBSR_IC|DBSR_BT)@h; \
340 beq+ 2f; \ 335 beq+ 2f; \
341 \ 336 \
342 lis r10,KERNELBASE@h; /* check if exception in vectors */ \ 337 lis r10,interrupt_base@h; /* check if exception in vectors */ \
343 ori r10,r10,KERNELBASE@l; \ 338 ori r10,r10,interrupt_base@l; \
344 cmplw r12,r10; \ 339 cmplw r12,r10; \
345 blt+ 2f; /* addr below exception vectors */ \ 340 blt+ 2f; /* addr below exception vectors */ \
346 \ 341 \
347 lis r10,DebugCrit@h; \ 342 lis r10,interrupt_end@h; \
348 ori r10,r10,DebugCrit@l; \ 343 ori r10,r10,interrupt_end@l; \
349 cmplw r12,r10; \ 344 cmplw r12,r10; \
350 bgt+ 2f; /* addr above exception vectors */ \ 345 bgt+ 2f; /* addr above exception vectors */ \
351 \ 346 \
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 6f62a737f607..d10a7cacccd2 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -605,6 +605,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
605 /* Embedded Hypervisor Privilege */ 605 /* Embedded Hypervisor Privilege */
606 EXCEPTION(0, HV_PRIV, Ehvpriv, unknown_exception, EXC_XFER_EE) 606 EXCEPTION(0, HV_PRIV, Ehvpriv, unknown_exception, EXC_XFER_EE)
607 607
608interrupt_end:
609
608/* 610/*
609 * Local functions 611 * Local functions
610 */ 612 */
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index ea78761aa169..939ea7ef0dc8 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -33,11 +33,6 @@
33#include <asm/runlatch.h> 33#include <asm/runlatch.h>
34#include <asm/smp.h> 34#include <asm/smp.h>
35 35
36#ifdef CONFIG_HOTPLUG_CPU
37#define cpu_should_die() cpu_is_offline(smp_processor_id())
38#else
39#define cpu_should_die() 0
40#endif
41 36
42unsigned long cpuidle_disable = IDLE_NO_OVERRIDE; 37unsigned long cpuidle_disable = IDLE_NO_OVERRIDE;
43EXPORT_SYMBOL(cpuidle_disable); 38EXPORT_SYMBOL(cpuidle_disable);
@@ -50,64 +45,38 @@ static int __init powersave_off(char *arg)
50} 45}
51__setup("powersave=off", powersave_off); 46__setup("powersave=off", powersave_off);
52 47
53/* 48#ifdef CONFIG_HOTPLUG_CPU
54 * The body of the idle task. 49void arch_cpu_idle_dead(void)
55 */
56void cpu_idle(void)
57{ 50{
58 set_thread_flag(TIF_POLLING_NRFLAG); 51 sched_preempt_enable_no_resched();
59 while (1) { 52 cpu_die();
60 tick_nohz_idle_enter(); 53}
61 rcu_idle_enter(); 54#endif
62
63 while (!need_resched() && !cpu_should_die()) {
64 ppc64_runlatch_off();
65
66 if (ppc_md.power_save) {
67 clear_thread_flag(TIF_POLLING_NRFLAG);
68 /*
69 * smp_mb is so clearing of TIF_POLLING_NRFLAG
70 * is ordered w.r.t. need_resched() test.
71 */
72 smp_mb();
73 local_irq_disable();
74
75 /* Don't trace irqs off for idle */
76 stop_critical_timings();
77
78 /* check again after disabling irqs */
79 if (!need_resched() && !cpu_should_die())
80 ppc_md.power_save();
81
82 start_critical_timings();
83
84 /* Some power_save functions return with
85 * interrupts enabled, some don't.
86 */
87 if (irqs_disabled())
88 local_irq_enable();
89 set_thread_flag(TIF_POLLING_NRFLAG);
90
91 } else {
92 /*
93 * Go into low thread priority and possibly
94 * low power mode.
95 */
96 HMT_low();
97 HMT_very_low();
98 }
99 }
100 55
101 HMT_medium(); 56void arch_cpu_idle(void)
102 ppc64_runlatch_on(); 57{
103 rcu_idle_exit(); 58 ppc64_runlatch_off();
104 tick_nohz_idle_exit(); 59
105 if (cpu_should_die()) { 60 if (ppc_md.power_save) {
106 sched_preempt_enable_no_resched(); 61 ppc_md.power_save();
107 cpu_die(); 62 /*
108 } 63 * Some power_save functions return with
109 schedule_preempt_disabled(); 64 * interrupts enabled, some don't.
65 */
66 if (irqs_disabled())
67 local_irq_enable();
68 } else {
69 local_irq_enable();
70 /*
71 * Go into low thread priority and possibly
72 * low power mode.
73 */
74 HMT_low();
75 HMT_very_low();
110 } 76 }
77
78 HMT_medium();
79 ppc64_runlatch_on();
111} 80}
112 81
113int powersave_nap; 82int powersave_nap;
diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
index 4c7cb4008585..bfb73cc209ce 100644
--- a/arch/powerpc/kernel/idle_book3e.S
+++ b/arch/powerpc/kernel/idle_book3e.S
@@ -16,11 +16,13 @@
16#include <asm/ppc-opcode.h> 16#include <asm/ppc-opcode.h>
17#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/thread_info.h> 18#include <asm/thread_info.h>
19#include <asm/epapr_hcalls.h>
19 20
20/* 64-bit version only for now */ 21/* 64-bit version only for now */
21#ifdef CONFIG_PPC64 22#ifdef CONFIG_PPC64
22 23
23_GLOBAL(book3e_idle) 24.macro BOOK3E_IDLE name loop
25_GLOBAL(\name)
24 /* Save LR for later */ 26 /* Save LR for later */
25 mflr r0 27 mflr r0
26 std r0,16(r1) 28 std r0,16(r1)
@@ -67,7 +69,33 @@ _GLOBAL(book3e_idle)
67 69
68 /* We can now re-enable hard interrupts and go to sleep */ 70 /* We can now re-enable hard interrupts and go to sleep */
69 wrteei 1 71 wrteei 1
701: PPC_WAIT(0) 72 \loop
73
74.endm
75
76.macro BOOK3E_IDLE_LOOP
771:
78 PPC_WAIT(0)
71 b 1b 79 b 1b
80.endm
81
82/* epapr_ev_idle_start below is patched with the proper hcall
83 opcodes during kernel initialization */
84.macro EPAPR_EV_IDLE_LOOP
85idle_loop:
86 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
87
88.global epapr_ev_idle_start
89epapr_ev_idle_start:
90 li r3, -1
91 nop
92 nop
93 nop
94 b idle_loop
95.endm
96
97BOOK3E_IDLE epapr_ev_idle EPAPR_EV_IDLE_LOOP
98
99BOOK3E_IDLE book3e_idle BOOK3E_IDLE_LOOP
72 100
73#endif /* CONFIG_PPC64 */ 101#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 31c4fdc6859c..c0d0dbddfba1 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -102,7 +102,7 @@ static int __init fail_iommu_debugfs(void)
102 struct dentry *dir = fault_create_debugfs_attr("fail_iommu", 102 struct dentry *dir = fault_create_debugfs_attr("fail_iommu",
103 NULL, &fail_iommu); 103 NULL, &fail_iommu);
104 104
105 return IS_ERR(dir) ? PTR_ERR(dir) : 0; 105 return PTR_RET(dir);
106} 106}
107late_initcall(fail_iommu_debugfs); 107late_initcall(fail_iommu_debugfs);
108 108
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 4f97fe345526..5cbcf4d5a808 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -374,6 +374,15 @@ int arch_show_interrupts(struct seq_file *p, int prec)
374 seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions); 374 seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
375 seq_printf(p, " Machine check exceptions\n"); 375 seq_printf(p, " Machine check exceptions\n");
376 376
377#ifdef CONFIG_PPC_DOORBELL
378 if (cpu_has_feature(CPU_FTR_DBELL)) {
379 seq_printf(p, "%*s: ", prec, "DBL");
380 for_each_online_cpu(j)
381 seq_printf(p, "%10u ", per_cpu(irq_stat, j).doorbell_irqs);
382 seq_printf(p, " Doorbell interrupts\n");
383 }
384#endif
385
377 return 0; 386 return 0;
378} 387}
379 388
@@ -387,6 +396,9 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
387 sum += per_cpu(irq_stat, cpu).pmu_irqs; 396 sum += per_cpu(irq_stat, cpu).pmu_irqs;
388 sum += per_cpu(irq_stat, cpu).mce_exceptions; 397 sum += per_cpu(irq_stat, cpu).mce_exceptions;
389 sum += per_cpu(irq_stat, cpu).spurious_irqs; 398 sum += per_cpu(irq_stat, cpu).spurious_irqs;
399#ifdef CONFIG_PPC_DOORBELL
400 sum += per_cpu(irq_stat, cpu).doorbell_irqs;
401#endif
390 402
391 return sum; 403 return sum;
392} 404}
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 5ca82cd4a374..c1eef241017a 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
159 if (user_mode(regs)) 159 if (user_mode(regs))
160 return 0; 160 return 0;
161 161
162 backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL); 162 backup_current_thread_info = kmalloc(sizeof(struct thread_info), GFP_KERNEL);
163 /* 163 /*
164 * On Book E and perhaps other processors, singlestep is handled on 164 * On Book E and perhaps other processors, singlestep is handled on
165 * the critical exception stack. This causes current_thread_info() 165 * the critical exception stack. This causes current_thread_info()
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index a61b133c4f99..6782221d49bd 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -756,12 +756,7 @@ static __init void kvm_free_tmp(void)
756 end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK; 756 end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK;
757 757
758 /* Free the tmp space we don't need */ 758 /* Free the tmp space we don't need */
759 for (; start < end; start += PAGE_SIZE) { 759 free_reserved_area(start, end, 0, NULL);
760 ClearPageReserved(virt_to_page(start));
761 init_page_count(virt_to_page(start));
762 free_page(start);
763 totalram_pages++;
764 }
765} 760}
766 761
767static int __init kvm_guest_init(void) 762static int __init kvm_guest_init(void)
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index f5725bce9ed2..d92f3871e9cf 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -41,8 +41,6 @@
41 41
42/* #define LPARCFG_DEBUG */ 42/* #define LPARCFG_DEBUG */
43 43
44static struct proc_dir_entry *proc_ppc64_lparcfg;
45
46/* 44/*
47 * Track sum of all purrs across all processors. This is used to further 45 * Track sum of all purrs across all processors. This is used to further
48 * calculate usage values by different applications 46 * calculate usage values by different applications
@@ -301,6 +299,7 @@ static void parse_system_parameter_string(struct seq_file *m)
301 __pa(rtas_data_buf), 299 __pa(rtas_data_buf),
302 RTAS_DATA_BUF_SIZE); 300 RTAS_DATA_BUF_SIZE);
303 memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH); 301 memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH);
302 local_buffer[SPLPAR_MAXLENGTH - 1] = '\0';
304 spin_unlock(&rtas_data_buf_lock); 303 spin_unlock(&rtas_data_buf_lock);
305 304
306 if (call_status != 0) { 305 if (call_status != 0) {
@@ -688,27 +687,22 @@ static const struct file_operations lparcfg_fops = {
688 687
689static int __init lparcfg_init(void) 688static int __init lparcfg_init(void)
690{ 689{
691 struct proc_dir_entry *ent;
692 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 690 umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
693 691
694 /* Allow writing if we have FW_FEATURE_SPLPAR */ 692 /* Allow writing if we have FW_FEATURE_SPLPAR */
695 if (firmware_has_feature(FW_FEATURE_SPLPAR)) 693 if (firmware_has_feature(FW_FEATURE_SPLPAR))
696 mode |= S_IWUSR; 694 mode |= S_IWUSR;
697 695
698 ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops); 696 if (!proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops)) {
699 if (!ent) {
700 printk(KERN_ERR "Failed to create powerpc/lparcfg\n"); 697 printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
701 return -EIO; 698 return -EIO;
702 } 699 }
703
704 proc_ppc64_lparcfg = ent;
705 return 0; 700 return 0;
706} 701}
707 702
708static void __exit lparcfg_cleanup(void) 703static void __exit lparcfg_cleanup(void)
709{ 704{
710 if (proc_ppc64_lparcfg) 705 remove_proc_subtree("powerpc/lparcfg", NULL);
711 remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent);
712} 706}
713 707
714module_init(lparcfg_init); 708module_init(lparcfg_init);
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index bec1e930ed73..48fbc2b97e95 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -511,8 +511,7 @@ int __init nvram_scan_partitions(void)
511 "detected: 0-length partition\n"); 511 "detected: 0-length partition\n");
512 goto out; 512 goto out;
513 } 513 }
514 tmp_part = (struct nvram_partition *) 514 tmp_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
515 kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
516 err = -ENOMEM; 515 err = -ENOMEM;
517 if (!tmp_part) { 516 if (!tmp_part) {
518 printk(KERN_ERR "nvram_scan_partitions: kmalloc failed\n"); 517 printk(KERN_ERR "nvram_scan_partitions: kmalloc failed\n");
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index fa12ae42d98c..f5c5c90799a7 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -30,6 +30,7 @@
30#include <linux/irq.h> 30#include <linux/irq.h>
31#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/vgaarb.h>
33 34
34#include <asm/processor.h> 35#include <asm/processor.h>
35#include <asm/io.h> 36#include <asm/io.h>
@@ -785,22 +786,8 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
785 hose->isa_mem_size = size; 786 hose->isa_mem_size = size;
786 } 787 }
787 788
788 /* We get the PCI/Mem offset from the first range or
789 * the, current one if the offset came from an ISA
790 * hole. If they don't match, bugger.
791 */
792 if (memno == 0 ||
793 (isa_hole >= 0 && pci_addr != 0 &&
794 hose->pci_mem_offset == isa_mb))
795 hose->pci_mem_offset = cpu_addr - pci_addr;
796 else if (pci_addr != 0 &&
797 hose->pci_mem_offset != cpu_addr - pci_addr) {
798 printk(KERN_INFO
799 " \\--> Skipped (offset mismatch) !\n");
800 continue;
801 }
802
803 /* Build resource */ 789 /* Build resource */
790 hose->mem_offset[memno] = cpu_addr - pci_addr;
804 res = &hose->mem_resources[memno++]; 791 res = &hose->mem_resources[memno++];
805 res->flags = IORESOURCE_MEM; 792 res->flags = IORESOURCE_MEM;
806 if (pci_space & 0x40000000) 793 if (pci_space & 0x40000000)
@@ -816,20 +803,6 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
816 res->child = NULL; 803 res->child = NULL;
817 } 804 }
818 } 805 }
819
820 /* If there's an ISA hole and the pci_mem_offset is -not- matching
821 * the ISA hole offset, then we need to remove the ISA hole from
822 * the resource list for that brige
823 */
824 if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) {
825 unsigned int next = isa_hole + 1;
826 printk(KERN_INFO " Removing ISA hole at 0x%016llx\n", isa_mb);
827 if (next < memno)
828 memmove(&hose->mem_resources[isa_hole],
829 &hose->mem_resources[next],
830 sizeof(struct resource) * (memno - next));
831 hose->mem_resources[--memno].flags = 0;
832 }
833} 806}
834 807
835/* Decide whether to display the domain number in /proc */ 808/* Decide whether to display the domain number in /proc */
@@ -844,6 +817,14 @@ int pci_proc_domain(struct pci_bus *bus)
844 return 1; 817 return 1;
845} 818}
846 819
820int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
821{
822 if (ppc_md.pcibios_root_bridge_prepare)
823 return ppc_md.pcibios_root_bridge_prepare(bridge);
824
825 return 0;
826}
827
847/* This header fixup will do the resource fixup for all devices as they are 828/* This header fixup will do the resource fixup for all devices as they are
848 * probed, but not for bridge ranges 829 * probed, but not for bridge ranges
849 */ 830 */
@@ -907,6 +888,7 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
907 struct pci_controller *hose = pci_bus_to_host(bus); 888 struct pci_controller *hose = pci_bus_to_host(bus);
908 struct pci_dev *dev = bus->self; 889 struct pci_dev *dev = bus->self;
909 resource_size_t offset; 890 resource_size_t offset;
891 struct pci_bus_region region;
910 u16 command; 892 u16 command;
911 int i; 893 int i;
912 894
@@ -916,10 +898,10 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
916 898
917 /* Job is a bit different between memory and IO */ 899 /* Job is a bit different between memory and IO */
918 if (res->flags & IORESOURCE_MEM) { 900 if (res->flags & IORESOURCE_MEM) {
919 /* If the BAR is non-0 (res != pci_mem_offset) then it's probably been 901 pcibios_resource_to_bus(dev, &region, res);
920 * initialized by somebody 902
921 */ 903 /* If the BAR is non-0 then it's probably been initialized */
922 if (res->start != hose->pci_mem_offset) 904 if (region.start != 0)
923 return 0; 905 return 0;
924 906
925 /* The BAR is 0, let's check if memory decoding is enabled on 907 /* The BAR is 0, let's check if memory decoding is enabled on
@@ -931,11 +913,11 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
931 913
932 /* Memory decoding is enabled and the BAR is 0. If any of the bridge 914 /* Memory decoding is enabled and the BAR is 0. If any of the bridge
933 * resources covers that starting address (0 then it's good enough for 915 * resources covers that starting address (0 then it's good enough for
934 * us for memory 916 * us for memory space)
935 */ 917 */
936 for (i = 0; i < 3; i++) { 918 for (i = 0; i < 3; i++) {
937 if ((hose->mem_resources[i].flags & IORESOURCE_MEM) && 919 if ((hose->mem_resources[i].flags & IORESOURCE_MEM) &&
938 hose->mem_resources[i].start == hose->pci_mem_offset) 920 hose->mem_resources[i].start == hose->mem_offset[i])
939 return 0; 921 return 0;
940 } 922 }
941 923
@@ -1023,6 +1005,27 @@ void pcibios_setup_bus_self(struct pci_bus *bus)
1023 ppc_md.pci_dma_bus_setup(bus); 1005 ppc_md.pci_dma_bus_setup(bus);
1024} 1006}
1025 1007
1008void pcibios_setup_device(struct pci_dev *dev)
1009{
1010 /* Fixup NUMA node as it may not be setup yet by the generic
1011 * code and is needed by the DMA init
1012 */
1013 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
1014
1015 /* Hook up default DMA ops */
1016 set_dma_ops(&dev->dev, pci_dma_ops);
1017 set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
1018
1019 /* Additional platform DMA/iommu setup */
1020 if (ppc_md.pci_dma_dev_setup)
1021 ppc_md.pci_dma_dev_setup(dev);
1022
1023 /* Read default IRQs and fixup if necessary */
1024 pci_read_irq_line(dev);
1025 if (ppc_md.pci_irq_fixup)
1026 ppc_md.pci_irq_fixup(dev);
1027}
1028
1026void pcibios_setup_bus_devices(struct pci_bus *bus) 1029void pcibios_setup_bus_devices(struct pci_bus *bus)
1027{ 1030{
1028 struct pci_dev *dev; 1031 struct pci_dev *dev;
@@ -1037,23 +1040,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
1037 if (dev->is_added) 1040 if (dev->is_added)
1038 continue; 1041 continue;
1039 1042
1040 /* Fixup NUMA node as it may not be setup yet by the generic 1043 pcibios_setup_device(dev);
1041 * code and is needed by the DMA init
1042 */
1043 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
1044
1045 /* Hook up default DMA ops */
1046 set_dma_ops(&dev->dev, pci_dma_ops);
1047 set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
1048
1049 /* Additional platform DMA/iommu setup */
1050 if (ppc_md.pci_dma_dev_setup)
1051 ppc_md.pci_dma_dev_setup(dev);
1052
1053 /* Read default IRQs and fixup if necessary */
1054 pci_read_irq_line(dev);
1055 if (ppc_md.pci_irq_fixup)
1056 ppc_md.pci_irq_fixup(dev);
1057 } 1044 }
1058} 1045}
1059 1046
@@ -1367,10 +1354,9 @@ static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus)
1367 1354
1368 no_io: 1355 no_io:
1369 /* Check for memory */ 1356 /* Check for memory */
1370 offset = hose->pci_mem_offset;
1371 pr_debug("hose mem offset: %016llx\n", (unsigned long long)offset);
1372 for (i = 0; i < 3; i++) { 1357 for (i = 0; i < 3; i++) {
1373 pres = &hose->mem_resources[i]; 1358 pres = &hose->mem_resources[i];
1359 offset = hose->mem_offset[i];
1374 if (!(pres->flags & IORESOURCE_MEM)) 1360 if (!(pres->flags & IORESOURCE_MEM))
1375 continue; 1361 continue;
1376 pr_debug("hose mem res: %pR\n", pres); 1362 pr_debug("hose mem res: %pR\n", pres);
@@ -1494,6 +1480,10 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1494 if (ppc_md.pcibios_enable_device_hook(dev)) 1480 if (ppc_md.pcibios_enable_device_hook(dev))
1495 return -EINVAL; 1481 return -EINVAL;
1496 1482
1483 /* avoid pcie irq fix up impact on cardbus */
1484 if (dev->hdr_type != PCI_HEADER_TYPE_CARDBUS)
1485 pcibios_setup_device(dev);
1486
1497 return pci_enable_resources(dev, mask); 1487 return pci_enable_resources(dev, mask);
1498} 1488}
1499 1489
@@ -1506,6 +1496,7 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1506 struct list_head *resources) 1496 struct list_head *resources)
1507{ 1497{
1508 struct resource *res; 1498 struct resource *res;
1499 resource_size_t offset;
1509 int i; 1500 int i;
1510 1501
1511 /* Hookup PHB IO resource */ 1502 /* Hookup PHB IO resource */
@@ -1515,49 +1506,37 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1515 printk(KERN_WARNING "PCI: I/O resource not set for host" 1506 printk(KERN_WARNING "PCI: I/O resource not set for host"
1516 " bridge %s (domain %d)\n", 1507 " bridge %s (domain %d)\n",
1517 hose->dn->full_name, hose->global_number); 1508 hose->dn->full_name, hose->global_number);
1518#ifdef CONFIG_PPC32 1509 } else {
1519 /* Workaround for lack of IO resource only on 32-bit */ 1510 offset = pcibios_io_space_offset(hose);
1520 res->start = (unsigned long)hose->io_base_virt - isa_io_base;
1521 res->end = res->start + IO_SPACE_LIMIT;
1522 res->flags = IORESOURCE_IO;
1523#endif /* CONFIG_PPC32 */
1524 }
1525 1511
1526 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n", 1512 pr_debug("PCI: PHB IO resource = %08llx-%08llx [%lx] off 0x%08llx\n",
1527 (unsigned long long)res->start, 1513 (unsigned long long)res->start,
1528 (unsigned long long)res->end, 1514 (unsigned long long)res->end,
1529 (unsigned long)res->flags); 1515 (unsigned long)res->flags,
1530 pci_add_resource_offset(resources, res, pcibios_io_space_offset(hose)); 1516 (unsigned long long)offset);
1517 pci_add_resource_offset(resources, res, offset);
1518 }
1531 1519
1532 /* Hookup PHB Memory resources */ 1520 /* Hookup PHB Memory resources */
1533 for (i = 0; i < 3; ++i) { 1521 for (i = 0; i < 3; ++i) {
1534 res = &hose->mem_resources[i]; 1522 res = &hose->mem_resources[i];
1535 if (!res->flags) { 1523 if (!res->flags) {
1536 if (i > 0)
1537 continue;
1538 printk(KERN_ERR "PCI: Memory resource 0 not set for " 1524 printk(KERN_ERR "PCI: Memory resource 0 not set for "
1539 "host bridge %s (domain %d)\n", 1525 "host bridge %s (domain %d)\n",
1540 hose->dn->full_name, hose->global_number); 1526 hose->dn->full_name, hose->global_number);
1541#ifdef CONFIG_PPC32 1527 continue;
1542 /* Workaround for lack of MEM resource only on 32-bit */
1543 res->start = hose->pci_mem_offset;
1544 res->end = (resource_size_t)-1LL;
1545 res->flags = IORESOURCE_MEM;
1546#endif /* CONFIG_PPC32 */
1547 } 1528 }
1529 offset = hose->mem_offset[i];
1548 1530
1549 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i, 1531
1532 pr_debug("PCI: PHB MEM resource %d = %08llx-%08llx [%lx] off 0x%08llx\n", i,
1550 (unsigned long long)res->start, 1533 (unsigned long long)res->start,
1551 (unsigned long long)res->end, 1534 (unsigned long long)res->end,
1552 (unsigned long)res->flags); 1535 (unsigned long)res->flags,
1553 pci_add_resource_offset(resources, res, hose->pci_mem_offset); 1536 (unsigned long long)offset);
1554 }
1555
1556 pr_debug("PCI: PHB MEM offset = %016llx\n",
1557 (unsigned long long)hose->pci_mem_offset);
1558 pr_debug("PCI: PHB IO offset = %08lx\n",
1559 (unsigned long)hose->io_base_virt - _IO_BASE);
1560 1537
1538 pci_add_resource_offset(resources, res, offset);
1539 }
1561} 1540}
1562 1541
1563/* 1542/*
@@ -1725,3 +1704,15 @@ static void fixup_hide_host_resource_fsl(struct pci_dev *dev)
1725} 1704}
1726DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl); 1705DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl);
1727DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl); 1706DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl);
1707
1708static void fixup_vga(struct pci_dev *pdev)
1709{
1710 u16 cmd;
1711
1712 pci_read_config_word(pdev, PCI_COMMAND, &cmd);
1713 if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !vga_default_device())
1714 vga_set_default_device(pdev);
1715
1716}
1717DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
1718 PCI_CLASS_DISPLAY_VGA, 8, fixup_vga);
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e37c2152acf4..432459c817fa 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -295,7 +295,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
295 case IOBASE_BRIDGE_NUMBER: 295 case IOBASE_BRIDGE_NUMBER:
296 return (long)hose->first_busno; 296 return (long)hose->first_busno;
297 case IOBASE_MEMORY: 297 case IOBASE_MEMORY:
298 return (long)hose->pci_mem_offset; 298 return (long)hose->mem_offset[0];
299 case IOBASE_IO: 299 case IOBASE_IO:
300 return (long)hose->io_base_phys; 300 return (long)hose->io_base_phys;
301 case IOBASE_ISA_IO: 301 case IOBASE_ISA_IO:
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 51a133a78a09..873050d26840 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -246,7 +246,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
246 case IOBASE_BRIDGE_NUMBER: 246 case IOBASE_BRIDGE_NUMBER:
247 return (long)hose->first_busno; 247 return (long)hose->first_busno;
248 case IOBASE_MEMORY: 248 case IOBASE_MEMORY:
249 return (long)hose->pci_mem_offset; 249 return (long)hose->mem_offset[0];
250 case IOBASE_IO: 250 case IOBASE_IO:
251 return (long)hose->io_base_phys; 251 return (long)hose->io_base_phys;
252 case IOBASE_ISA_IO: 252 case IOBASE_ISA_IO:
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
index f19d0bdc3241..feb8580fdc84 100644
--- a/arch/powerpc/kernel/proc_powerpc.c
+++ b/arch/powerpc/kernel/proc_powerpc.c
@@ -32,8 +32,6 @@
32static loff_t page_map_seek( struct file *file, loff_t off, int whence) 32static loff_t page_map_seek( struct file *file, loff_t off, int whence)
33{ 33{
34 loff_t new; 34 loff_t new;
35 struct proc_dir_entry *dp = PDE(file_inode(file));
36
37 switch(whence) { 35 switch(whence) {
38 case 0: 36 case 0:
39 new = off; 37 new = off;
@@ -42,12 +40,12 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
42 new = file->f_pos + off; 40 new = file->f_pos + off;
43 break; 41 break;
44 case 2: 42 case 2:
45 new = dp->size + off; 43 new = PAGE_SIZE + off;
46 break; 44 break;
47 default: 45 default:
48 return -EINVAL; 46 return -EINVAL;
49 } 47 }
50 if ( new < 0 || new > dp->size ) 48 if ( new < 0 || new > PAGE_SIZE )
51 return -EINVAL; 49 return -EINVAL;
52 return (file->f_pos = new); 50 return (file->f_pos = new);
53} 51}
@@ -55,19 +53,18 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
55static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, 53static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
56 loff_t *ppos) 54 loff_t *ppos)
57{ 55{
58 struct proc_dir_entry *dp = PDE(file_inode(file)); 56 return simple_read_from_buffer(buf, nbytes, ppos,
59 return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size); 57 PDE_DATA(file_inode(file)), PAGE_SIZE);
60} 58}
61 59
62static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) 60static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
63{ 61{
64 struct proc_dir_entry *dp = PDE(file_inode(file)); 62 if ((vma->vm_end - vma->vm_start) > PAGE_SIZE)
65
66 if ((vma->vm_end - vma->vm_start) > dp->size)
67 return -EINVAL; 63 return -EINVAL;
68 64
69 remap_pfn_range(vma, vma->vm_start, __pa(dp->data) >> PAGE_SHIFT, 65 remap_pfn_range(vma, vma->vm_start,
70 dp->size, vma->vm_page_prot); 66 __pa(PDE_DATA(file_inode(file))) >> PAGE_SHIFT,
67 PAGE_SIZE, vma->vm_page_prot);
71 return 0; 68 return 0;
72} 69}
73 70
@@ -86,7 +83,7 @@ static int __init proc_ppc64_init(void)
86 &page_map_fops, vdso_data); 83 &page_map_fops, vdso_data);
87 if (!pde) 84 if (!pde)
88 return 1; 85 return 1;
89 pde->size = PAGE_SIZE; 86 proc_set_size(pde, PAGE_SIZE);
90 87
91 return 0; 88 return 0;
92} 89}
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 16e77a81ab4f..ceb4e7b62cf4 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -831,6 +831,8 @@ void show_regs(struct pt_regs * regs)
831{ 831{
832 int i, trap; 832 int i, trap;
833 833
834 show_regs_print_info(KERN_DEFAULT);
835
834 printk("NIP: "REG" LR: "REG" CTR: "REG"\n", 836 printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
835 regs->nip, regs->link, regs->ctr); 837 regs->nip, regs->link, regs->ctr);
836 printk("REGS: %p TRAP: %04lx %s (%s)\n", 838 printk("REGS: %p TRAP: %04lx %s (%s)\n",
@@ -850,12 +852,6 @@ void show_regs(struct pt_regs * regs)
850#else 852#else
851 printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); 853 printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr);
852#endif 854#endif
853 printk("TASK = %p[%d] '%s' THREAD: %p",
854 current, task_pid_nr(current), current->comm, task_thread_info(current));
855
856#ifdef CONFIG_SMP
857 printk(" CPU: %d", raw_smp_processor_id());
858#endif /* CONFIG_SMP */
859 855
860 for (i = 0; i < 32; i++) { 856 for (i = 0; i < 32; i++) {
861 if ((i % REGS_PER_LINE) == 0) 857 if ((i % REGS_PER_LINE) == 0)
@@ -912,10 +908,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
912 flush_altivec_to_thread(src); 908 flush_altivec_to_thread(src);
913 flush_vsx_to_thread(src); 909 flush_vsx_to_thread(src);
914 flush_spe_to_thread(src); 910 flush_spe_to_thread(src);
915#ifdef CONFIG_HAVE_HW_BREAKPOINT
916 flush_ptrace_hw_breakpoint(src);
917#endif /* CONFIG_HAVE_HW_BREAKPOINT */
918
919 *dst = *src; 911 *dst = *src;
920 return 0; 912 return 0;
921} 913}
@@ -986,6 +978,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
986 p->thread.ksp_limit = (unsigned long)task_stack_page(p) + 978 p->thread.ksp_limit = (unsigned long)task_stack_page(p) +
987 _ALIGN_UP(sizeof(struct thread_info), 16); 979 _ALIGN_UP(sizeof(struct thread_info), 16);
988 980
981#ifdef CONFIG_HAVE_HW_BREAKPOINT
982 p->thread.ptrace_bps[0] = NULL;
983#endif
984
989#ifdef CONFIG_PPC_STD_MMU_64 985#ifdef CONFIG_PPC_STD_MMU_64
990 if (mmu_has_feature(MMU_FTR_SLB)) { 986 if (mmu_has_feature(MMU_FTR_SLB)) {
991 unsigned long sp_vsid; 987 unsigned long sp_vsid;
@@ -1362,12 +1358,6 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1362 } while (count++ < kstack_depth_to_print); 1358 } while (count++ < kstack_depth_to_print);
1363} 1359}
1364 1360
1365void dump_stack(void)
1366{
1367 show_stack(current, NULL);
1368}
1369EXPORT_SYMBOL(dump_stack);
1370
1371#ifdef CONFIG_PPC64 1361#ifdef CONFIG_PPC64
1372/* Called with hard IRQs off */ 1362/* Called with hard IRQs off */
1373void __ppc64_runlatch_on(void) 1363void __ppc64_runlatch_on(void)
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 13f8d168b3f1..5eccda9fd33f 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -627,16 +627,11 @@ static void __init early_cmdline_parse(void)
627 627
628#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 628#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
629/* 629/*
630 * There are two methods for telling firmware what our capabilities are. 630 * The architecture vector has an array of PVR mask/value pairs,
631 * Newer machines have an "ibm,client-architecture-support" method on the 631 * followed by # option vectors - 1, followed by the option vectors.
632 * root node. For older machines, we have to call the "process-elf-header" 632 *
633 * method in the /packages/elf-loader node, passing it a fake 32-bit 633 * See prom.h for the definition of the bits specified in the
634 * ELF header containing a couple of PT_NOTE sections that contain 634 * architecture vector.
635 * structures that contain various information.
636 */
637
638/*
639 * New method - extensible architecture description vector.
640 * 635 *
641 * Because the description vector contains a mix of byte and word 636 * Because the description vector contains a mix of byte and word
642 * values, we declare it as an unsigned char array, and use this 637 * values, we declare it as an unsigned char array, and use this
@@ -645,65 +640,7 @@ static void __init early_cmdline_parse(void)
645#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ 640#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
646 ((x) >> 8) & 0xff, (x) & 0xff 641 ((x) >> 8) & 0xff, (x) & 0xff
647 642
648/* Option vector bits - generic bits in byte 1 */ 643unsigned char ibm_architecture_vec[] = {
649#define OV_IGNORE 0x80 /* ignore this vector */
650#define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/
651
652/* Option vector 1: processor architectures supported */
653#define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */
654#define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */
655#define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */
656#define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */
657#define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */
658#define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */
659#define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */
660#define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */
661
662/* Option vector 2: Open Firmware options supported */
663#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */
664
665/* Option vector 3: processor options supported */
666#define OV3_FP 0x80 /* floating point */
667#define OV3_VMX 0x40 /* VMX/Altivec */
668#define OV3_DFP 0x20 /* decimal FP */
669
670/* Option vector 4: IBM PAPR implementation */
671#define OV4_MIN_ENT_CAP 0x01 /* minimum VP entitled capacity */
672
673/* Option vector 5: PAPR/OF options supported */
674#define OV5_LPAR 0x80 /* logical partitioning supported */
675#define OV5_SPLPAR 0x40 /* shared-processor LPAR supported */
676/* ibm,dynamic-reconfiguration-memory property supported */
677#define OV5_DRCONF_MEMORY 0x20
678#define OV5_LARGE_PAGES 0x10 /* large pages supported */
679#define OV5_DONATE_DEDICATE_CPU 0x02 /* donate dedicated CPU support */
680/* PCIe/MSI support. Without MSI full PCIe is not supported */
681#ifdef CONFIG_PCI_MSI
682#define OV5_MSI 0x01 /* PCIe/MSI support */
683#else
684#define OV5_MSI 0x00
685#endif /* CONFIG_PCI_MSI */
686#ifdef CONFIG_PPC_SMLPAR
687#define OV5_CMO 0x80 /* Cooperative Memory Overcommitment */
688#define OV5_XCMO 0x40 /* Page Coalescing */
689#else
690#define OV5_CMO 0x00
691#define OV5_XCMO 0x00
692#endif
693#define OV5_TYPE1_AFFINITY 0x80 /* Type 1 NUMA affinity */
694#define OV5_PFO_HW_RNG 0x80 /* PFO Random Number Generator */
695#define OV5_PFO_HW_842 0x40 /* PFO Compression Accelerator */
696#define OV5_PFO_HW_ENCR 0x20 /* PFO Encryption Accelerator */
697#define OV5_SUB_PROCESSORS 0x01 /* 1,2,or 4 Sub-Processors supported */
698
699/* Option Vector 6: IBM PAPR hints */
700#define OV6_LINUX 0x02 /* Linux is our OS */
701
702/*
703 * The architecture vector has an array of PVR mask/value pairs,
704 * followed by # option vectors - 1, followed by the option vectors.
705 */
706static unsigned char ibm_architecture_vec[] = {
707 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ 644 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */
708 W(0xffff0000), W(0x003e0000), /* POWER6 */ 645 W(0xffff0000), W(0x003e0000), /* POWER6 */
709 W(0xffff0000), W(0x003f0000), /* POWER7 */ 646 W(0xffff0000), W(0x003f0000), /* POWER7 */
@@ -747,11 +684,21 @@ static unsigned char ibm_architecture_vec[] = {
747 /* option vector 5: PAPR/OF options */ 684 /* option vector 5: PAPR/OF options */
748 19 - 2, /* length */ 685 19 - 2, /* length */
749 0, /* don't ignore, don't halt */ 686 0, /* don't ignore, don't halt */
750 OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES | OV5_DRCONF_MEMORY | 687 OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
751 OV5_DONATE_DEDICATE_CPU | OV5_MSI, 688 OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
689#ifdef CONFIG_PCI_MSI
690 /* PCIe/MSI support. Without MSI full PCIe is not supported */
691 OV5_FEAT(OV5_MSI),
692#else
752 0, 693 0,
753 OV5_CMO | OV5_XCMO, 694#endif
754 OV5_TYPE1_AFFINITY, 695 0,
696#ifdef CONFIG_PPC_SMLPAR
697 OV5_FEAT(OV5_CMO) | OV5_FEAT(OV5_XCMO),
698#else
699 0,
700#endif
701 OV5_FEAT(OV5_TYPE1_AFFINITY) | OV5_FEAT(OV5_PRRN),
755 0, 702 0,
756 0, 703 0,
757 0, 704 0,
@@ -765,8 +712,9 @@ static unsigned char ibm_architecture_vec[] = {
765 0, 712 0,
766 0, 713 0,
767 0, 714 0,
768 OV5_PFO_HW_RNG | OV5_PFO_HW_ENCR | OV5_PFO_HW_842, 715 OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
769 OV5_SUB_PROCESSORS, 716 OV5_FEAT(OV5_PFO_HW_842),
717 OV5_FEAT(OV5_SUB_PROCESSORS),
770 /* option vector 6: IBM PAPR hints */ 718 /* option vector 6: IBM PAPR hints */
771 4 - 2, /* length */ 719 4 - 2, /* length */
772 0, 720 0,
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index f9b30c68ba47..3b14d320e69f 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -180,9 +180,10 @@ static int set_user_msr(struct task_struct *task, unsigned long msr)
180} 180}
181 181
182#ifdef CONFIG_PPC64 182#ifdef CONFIG_PPC64
183static unsigned long get_user_dscr(struct task_struct *task) 183static int get_user_dscr(struct task_struct *task, unsigned long *data)
184{ 184{
185 return task->thread.dscr; 185 *data = task->thread.dscr;
186 return 0;
186} 187}
187 188
188static int set_user_dscr(struct task_struct *task, unsigned long dscr) 189static int set_user_dscr(struct task_struct *task, unsigned long dscr)
@@ -192,7 +193,7 @@ static int set_user_dscr(struct task_struct *task, unsigned long dscr)
192 return 0; 193 return 0;
193} 194}
194#else 195#else
195static unsigned long get_user_dscr(struct task_struct *task) 196static int get_user_dscr(struct task_struct *task, unsigned long *data)
196{ 197{
197 return -EIO; 198 return -EIO;
198} 199}
@@ -216,19 +217,23 @@ static int set_user_trap(struct task_struct *task, unsigned long trap)
216/* 217/*
217 * Get contents of register REGNO in task TASK. 218 * Get contents of register REGNO in task TASK.
218 */ 219 */
219unsigned long ptrace_get_reg(struct task_struct *task, int regno) 220int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data)
220{ 221{
221 if (task->thread.regs == NULL) 222 if ((task->thread.regs == NULL) || !data)
222 return -EIO; 223 return -EIO;
223 224
224 if (regno == PT_MSR) 225 if (regno == PT_MSR) {
225 return get_user_msr(task); 226 *data = get_user_msr(task);
227 return 0;
228 }
226 229
227 if (regno == PT_DSCR) 230 if (regno == PT_DSCR)
228 return get_user_dscr(task); 231 return get_user_dscr(task, data);
229 232
230 if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long))) 233 if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long))) {
231 return ((unsigned long *)task->thread.regs)[regno]; 234 *data = ((unsigned long *)task->thread.regs)[regno];
235 return 0;
236 }
232 237
233 return -EIO; 238 return -EIO;
234} 239}
@@ -1560,7 +1565,9 @@ long arch_ptrace(struct task_struct *child, long request,
1560 1565
1561 CHECK_FULL_REGS(child->thread.regs); 1566 CHECK_FULL_REGS(child->thread.regs);
1562 if (index < PT_FPR0) { 1567 if (index < PT_FPR0) {
1563 tmp = ptrace_get_reg(child, (int) index); 1568 ret = ptrace_get_reg(child, (int) index, &tmp);
1569 if (ret)
1570 break;
1564 } else { 1571 } else {
1565 unsigned int fpidx = index - PT_FPR0; 1572 unsigned int fpidx = index - PT_FPR0;
1566 1573
@@ -1637,6 +1644,8 @@ long arch_ptrace(struct task_struct *child, long request,
1637 dbginfo.sizeof_condition = 0; 1644 dbginfo.sizeof_condition = 0;
1638#ifdef CONFIG_HAVE_HW_BREAKPOINT 1645#ifdef CONFIG_HAVE_HW_BREAKPOINT
1639 dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE; 1646 dbginfo.features = PPC_DEBUG_FEATURE_DATA_BP_RANGE;
1647 if (cpu_has_feature(CPU_FTR_DAWR))
1648 dbginfo.features |= PPC_DEBUG_FEATURE_DATA_BP_DAWR;
1640#else 1649#else
1641 dbginfo.features = 0; 1650 dbginfo.features = 0;
1642#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 1651#endif /* CONFIG_HAVE_HW_BREAKPOINT */
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index c0244e766834..f51599e941c7 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -95,7 +95,9 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
95 95
96 CHECK_FULL_REGS(child->thread.regs); 96 CHECK_FULL_REGS(child->thread.regs);
97 if (index < PT_FPR0) { 97 if (index < PT_FPR0) {
98 tmp = ptrace_get_reg(child, index); 98 ret = ptrace_get_reg(child, index, &tmp);
99 if (ret)
100 break;
99 } else { 101 } else {
100 flush_fp_to_thread(child); 102 flush_fp_to_thread(child);
101 /* 103 /*
@@ -148,7 +150,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
148 tmp = ((u64 *)child->thread.fpr) 150 tmp = ((u64 *)child->thread.fpr)
149 [FPRINDEX_3264(numReg)]; 151 [FPRINDEX_3264(numReg)];
150 } else { /* register within PT_REGS struct */ 152 } else { /* register within PT_REGS struct */
151 tmp = ptrace_get_reg(child, numReg); 153 unsigned long tmp2;
154 ret = ptrace_get_reg(child, numReg, &tmp2);
155 if (ret)
156 break;
157 tmp = tmp2;
152 } 158 }
153 reg32bits = ((u32*)&tmp)[part]; 159 reg32bits = ((u32*)&tmp)[part];
154 ret = put_user(reg32bits, (u32 __user *)data); 160 ret = put_user(reg32bits, (u32 __user *)data);
@@ -232,7 +238,10 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
232 break; 238 break;
233 CHECK_FULL_REGS(child->thread.regs); 239 CHECK_FULL_REGS(child->thread.regs);
234 if (numReg < PT_FPR0) { 240 if (numReg < PT_FPR0) {
235 unsigned long freg = ptrace_get_reg(child, numReg); 241 unsigned long freg;
242 ret = ptrace_get_reg(child, numReg, &freg);
243 if (ret)
244 break;
236 if (index % 2) 245 if (index % 2)
237 freg = (freg & ~0xfffffffful) | (data & 0xfffffffful); 246 freg = (freg & ~0xfffffffful) | (data & 0xfffffffful);
238 else 247 else
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index c642f0132988..5b3022470126 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -57,13 +57,31 @@
57#define VALIDATE_READY -1001 /* Firmware image ready for validation */ 57#define VALIDATE_READY -1001 /* Firmware image ready for validation */
58#define VALIDATE_PARAM_ERR -3 /* RTAS Parameter Error */ 58#define VALIDATE_PARAM_ERR -3 /* RTAS Parameter Error */
59#define VALIDATE_HW_ERR -1 /* RTAS Hardware Error */ 59#define VALIDATE_HW_ERR -1 /* RTAS Hardware Error */
60#define VALIDATE_TMP_UPDATE 0 /* Validate Return Status */ 60
61#define VALIDATE_FLASH_AUTH 1 /* Validate Return Status */ 61/* ibm,validate-flash-image update result tokens */
62#define VALIDATE_INVALID_IMG 2 /* Validate Return Status */ 62#define VALIDATE_TMP_UPDATE 0 /* T side will be updated */
63#define VALIDATE_CUR_UNKNOWN 3 /* Validate Return Status */ 63#define VALIDATE_FLASH_AUTH 1 /* Partition does not have authority */
64#define VALIDATE_TMP_COMMIT_DL 4 /* Validate Return Status */ 64#define VALIDATE_INVALID_IMG 2 /* Candidate image is not valid */
65#define VALIDATE_TMP_COMMIT 5 /* Validate Return Status */ 65#define VALIDATE_CUR_UNKNOWN 3 /* Current fixpack level is unknown */
66#define VALIDATE_TMP_UPDATE_DL 6 /* Validate Return Status */ 66/*
67 * Current T side will be committed to P side before being replace with new
68 * image, and the new image is downlevel from current image
69 */
70#define VALIDATE_TMP_COMMIT_DL 4
71/*
72 * Current T side will be committed to P side before being replaced with new
73 * image
74 */
75#define VALIDATE_TMP_COMMIT 5
76/*
77 * T side will be updated with a downlevel image
78 */
79#define VALIDATE_TMP_UPDATE_DL 6
80/*
81 * The candidate image's release date is later than the system's firmware
82 * service entitlement date - service warranty period has expired
83 */
84#define VALIDATE_OUT_OF_WRNTY 7
67 85
68/* ibm,manage-flash-image operation tokens */ 86/* ibm,manage-flash-image operation tokens */
69#define RTAS_REJECT_TMP_IMG 0 87#define RTAS_REJECT_TMP_IMG 0
@@ -102,9 +120,10 @@ static struct kmem_cache *flash_block_cache = NULL;
102 120
103#define FLASH_BLOCK_LIST_VERSION (1UL) 121#define FLASH_BLOCK_LIST_VERSION (1UL)
104 122
105/* Local copy of the flash block list. 123/*
106 * We only allow one open of the flash proc file and create this 124 * Local copy of the flash block list.
107 * list as we go. The rtas_firmware_flash_list varable will be 125 *
126 * The rtas_firmware_flash_list varable will be
108 * set once the data is fully read. 127 * set once the data is fully read.
109 * 128 *
110 * For convenience as we build the list we use virtual addrs, 129 * For convenience as we build the list we use virtual addrs,
@@ -125,23 +144,23 @@ struct rtas_update_flash_t
125struct rtas_manage_flash_t 144struct rtas_manage_flash_t
126{ 145{
127 int status; /* Returned status */ 146 int status; /* Returned status */
128 unsigned int op; /* Reject or commit image */
129}; 147};
130 148
131/* Status int must be first member of struct */ 149/* Status int must be first member of struct */
132struct rtas_validate_flash_t 150struct rtas_validate_flash_t
133{ 151{
134 int status; /* Returned status */ 152 int status; /* Returned status */
135 char buf[VALIDATE_BUF_SIZE]; /* Candidate image buffer */ 153 char *buf; /* Candidate image buffer */
136 unsigned int buf_size; /* Size of image buf */ 154 unsigned int buf_size; /* Size of image buf */
137 unsigned int update_results; /* Update results token */ 155 unsigned int update_results; /* Update results token */
138}; 156};
139 157
140static DEFINE_SPINLOCK(flash_file_open_lock); 158static struct rtas_update_flash_t rtas_update_flash_data;
141static struct proc_dir_entry *firmware_flash_pde; 159static struct rtas_manage_flash_t rtas_manage_flash_data;
142static struct proc_dir_entry *firmware_update_pde; 160static struct rtas_validate_flash_t rtas_validate_flash_data;
143static struct proc_dir_entry *validate_pde; 161static DEFINE_MUTEX(rtas_update_flash_mutex);
144static struct proc_dir_entry *manage_pde; 162static DEFINE_MUTEX(rtas_manage_flash_mutex);
163static DEFINE_MUTEX(rtas_validate_flash_mutex);
145 164
146/* Do simple sanity checks on the flash image. */ 165/* Do simple sanity checks on the flash image. */
147static int flash_list_valid(struct flash_block_list *flist) 166static int flash_list_valid(struct flash_block_list *flist)
@@ -191,10 +210,10 @@ static void free_flash_list(struct flash_block_list *f)
191 210
192static int rtas_flash_release(struct inode *inode, struct file *file) 211static int rtas_flash_release(struct inode *inode, struct file *file)
193{ 212{
194 struct proc_dir_entry *dp = PDE(file_inode(file)); 213 struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
195 struct rtas_update_flash_t *uf; 214
196 215 mutex_lock(&rtas_update_flash_mutex);
197 uf = (struct rtas_update_flash_t *) dp->data; 216
198 if (uf->flist) { 217 if (uf->flist) {
199 /* File was opened in write mode for a new flash attempt */ 218 /* File was opened in write mode for a new flash attempt */
200 /* Clear saved list */ 219 /* Clear saved list */
@@ -214,13 +233,14 @@ static int rtas_flash_release(struct inode *inode, struct file *file)
214 uf->flist = NULL; 233 uf->flist = NULL;
215 } 234 }
216 235
217 atomic_dec(&dp->count); 236 mutex_unlock(&rtas_update_flash_mutex);
218 return 0; 237 return 0;
219} 238}
220 239
221static void get_flash_status_msg(int status, char *buf) 240static size_t get_flash_status_msg(int status, char *buf)
222{ 241{
223 char *msg; 242 const char *msg;
243 size_t len;
224 244
225 switch (status) { 245 switch (status) {
226 case FLASH_AUTH: 246 case FLASH_AUTH:
@@ -242,36 +262,47 @@ static void get_flash_status_msg(int status, char *buf)
242 msg = "ready: firmware image ready for flash on reboot\n"; 262 msg = "ready: firmware image ready for flash on reboot\n";
243 break; 263 break;
244 default: 264 default:
245 sprintf(buf, "error: unexpected status value %d\n", status); 265 return sprintf(buf, "error: unexpected status value %d\n",
246 return; 266 status);
247 } 267 }
248 268
249 strcpy(buf, msg); 269 len = strlen(msg);
270 memcpy(buf, msg, len + 1);
271 return len;
250} 272}
251 273
252/* Reading the proc file will show status (not the firmware contents) */ 274/* Reading the proc file will show status (not the firmware contents) */
253static ssize_t rtas_flash_read(struct file *file, char __user *buf, 275static ssize_t rtas_flash_read_msg(struct file *file, char __user *buf,
254 size_t count, loff_t *ppos) 276 size_t count, loff_t *ppos)
255{ 277{
256 struct proc_dir_entry *dp = PDE(file_inode(file)); 278 struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
257 struct rtas_update_flash_t *uf;
258 char msg[RTAS_MSG_MAXLEN]; 279 char msg[RTAS_MSG_MAXLEN];
280 size_t len;
281 int status;
259 282
260 uf = dp->data; 283 mutex_lock(&rtas_update_flash_mutex);
261 284 status = uf->status;
262 if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) { 285 mutex_unlock(&rtas_update_flash_mutex);
263 get_flash_status_msg(uf->status, msg);
264 } else { /* FIRMWARE_UPDATE_NAME */
265 sprintf(msg, "%d\n", uf->status);
266 }
267 286
268 return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg)); 287 /* Read as text message */
288 len = get_flash_status_msg(status, msg);
289 return simple_read_from_buffer(buf, count, ppos, msg, len);
269} 290}
270 291
271/* constructor for flash_block_cache */ 292static ssize_t rtas_flash_read_num(struct file *file, char __user *buf,
272void rtas_block_ctor(void *ptr) 293 size_t count, loff_t *ppos)
273{ 294{
274 memset(ptr, 0, RTAS_BLK_SIZE); 295 struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
296 char msg[RTAS_MSG_MAXLEN];
297 int status;
298
299 mutex_lock(&rtas_update_flash_mutex);
300 status = uf->status;
301 mutex_unlock(&rtas_update_flash_mutex);
302
303 /* Read as number */
304 sprintf(msg, "%d\n", status);
305 return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
275} 306}
276 307
277/* We could be much more efficient here. But to keep this function 308/* We could be much more efficient here. But to keep this function
@@ -282,25 +313,24 @@ void rtas_block_ctor(void *ptr)
282static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, 313static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
283 size_t count, loff_t *off) 314 size_t count, loff_t *off)
284{ 315{
285 struct proc_dir_entry *dp = PDE(file_inode(file)); 316 struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
286 struct rtas_update_flash_t *uf;
287 char *p; 317 char *p;
288 int next_free; 318 int next_free, rc;
289 struct flash_block_list *fl; 319 struct flash_block_list *fl;
290 320
291 uf = (struct rtas_update_flash_t *) dp->data; 321 mutex_lock(&rtas_update_flash_mutex);
292 322
293 if (uf->status == FLASH_AUTH || count == 0) 323 if (uf->status == FLASH_AUTH || count == 0)
294 return count; /* discard data */ 324 goto out; /* discard data */
295 325
296 /* In the case that the image is not ready for flashing, the memory 326 /* In the case that the image is not ready for flashing, the memory
297 * allocated for the block list will be freed upon the release of the 327 * allocated for the block list will be freed upon the release of the
298 * proc file 328 * proc file
299 */ 329 */
300 if (uf->flist == NULL) { 330 if (uf->flist == NULL) {
301 uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 331 uf->flist = kmem_cache_zalloc(flash_block_cache, GFP_KERNEL);
302 if (!uf->flist) 332 if (!uf->flist)
303 return -ENOMEM; 333 goto nomem;
304 } 334 }
305 335
306 fl = uf->flist; 336 fl = uf->flist;
@@ -309,63 +339,48 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
309 next_free = fl->num_blocks; 339 next_free = fl->num_blocks;
310 if (next_free == FLASH_BLOCKS_PER_NODE) { 340 if (next_free == FLASH_BLOCKS_PER_NODE) {
311 /* Need to allocate another block_list */ 341 /* Need to allocate another block_list */
312 fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 342 fl->next = kmem_cache_zalloc(flash_block_cache, GFP_KERNEL);
313 if (!fl->next) 343 if (!fl->next)
314 return -ENOMEM; 344 goto nomem;
315 fl = fl->next; 345 fl = fl->next;
316 next_free = 0; 346 next_free = 0;
317 } 347 }
318 348
319 if (count > RTAS_BLK_SIZE) 349 if (count > RTAS_BLK_SIZE)
320 count = RTAS_BLK_SIZE; 350 count = RTAS_BLK_SIZE;
321 p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); 351 p = kmem_cache_zalloc(flash_block_cache, GFP_KERNEL);
322 if (!p) 352 if (!p)
323 return -ENOMEM; 353 goto nomem;
324 354
325 if(copy_from_user(p, buffer, count)) { 355 if(copy_from_user(p, buffer, count)) {
326 kmem_cache_free(flash_block_cache, p); 356 kmem_cache_free(flash_block_cache, p);
327 return -EFAULT; 357 rc = -EFAULT;
358 goto error;
328 } 359 }
329 fl->blocks[next_free].data = p; 360 fl->blocks[next_free].data = p;
330 fl->blocks[next_free].length = count; 361 fl->blocks[next_free].length = count;
331 fl->num_blocks++; 362 fl->num_blocks++;
332 363out:
364 mutex_unlock(&rtas_update_flash_mutex);
333 return count; 365 return count;
334}
335 366
336static int rtas_excl_open(struct inode *inode, struct file *file) 367nomem:
337{ 368 rc = -ENOMEM;
338 struct proc_dir_entry *dp = PDE(inode); 369error:
339 370 mutex_unlock(&rtas_update_flash_mutex);
340 /* Enforce exclusive open with use count of PDE */ 371 return rc;
341 spin_lock(&flash_file_open_lock);
342 if (atomic_read(&dp->count) > 2) {
343 spin_unlock(&flash_file_open_lock);
344 return -EBUSY;
345 }
346
347 atomic_inc(&dp->count);
348 spin_unlock(&flash_file_open_lock);
349
350 return 0;
351}
352
353static int rtas_excl_release(struct inode *inode, struct file *file)
354{
355 struct proc_dir_entry *dp = PDE(inode);
356
357 atomic_dec(&dp->count);
358
359 return 0;
360} 372}
361 373
362static void manage_flash(struct rtas_manage_flash_t *args_buf) 374/*
375 * Flash management routines.
376 */
377static void manage_flash(struct rtas_manage_flash_t *args_buf, unsigned int op)
363{ 378{
364 s32 rc; 379 s32 rc;
365 380
366 do { 381 do {
367 rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, 382 rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, 1,
368 1, NULL, args_buf->op); 383 NULL, op);
369 } while (rtas_busy_delay(rc)); 384 } while (rtas_busy_delay(rc));
370 385
371 args_buf->status = rc; 386 args_buf->status = rc;
@@ -374,55 +389,62 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf)
374static ssize_t manage_flash_read(struct file *file, char __user *buf, 389static ssize_t manage_flash_read(struct file *file, char __user *buf,
375 size_t count, loff_t *ppos) 390 size_t count, loff_t *ppos)
376{ 391{
377 struct proc_dir_entry *dp = PDE(file_inode(file)); 392 struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data;
378 struct rtas_manage_flash_t *args_buf;
379 char msg[RTAS_MSG_MAXLEN]; 393 char msg[RTAS_MSG_MAXLEN];
380 int msglen; 394 int msglen, status;
381 395
382 args_buf = dp->data; 396 mutex_lock(&rtas_manage_flash_mutex);
383 if (args_buf == NULL) 397 status = args_buf->status;
384 return 0; 398 mutex_unlock(&rtas_manage_flash_mutex);
385
386 msglen = sprintf(msg, "%d\n", args_buf->status);
387 399
400 msglen = sprintf(msg, "%d\n", status);
388 return simple_read_from_buffer(buf, count, ppos, msg, msglen); 401 return simple_read_from_buffer(buf, count, ppos, msg, msglen);
389} 402}
390 403
391static ssize_t manage_flash_write(struct file *file, const char __user *buf, 404static ssize_t manage_flash_write(struct file *file, const char __user *buf,
392 size_t count, loff_t *off) 405 size_t count, loff_t *off)
393{ 406{
394 struct proc_dir_entry *dp = PDE(file_inode(file)); 407 struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data;
395 struct rtas_manage_flash_t *args_buf; 408 static const char reject_str[] = "0";
396 const char reject_str[] = "0"; 409 static const char commit_str[] = "1";
397 const char commit_str[] = "1";
398 char stkbuf[10]; 410 char stkbuf[10];
399 int op; 411 int op, rc;
412
413 mutex_lock(&rtas_manage_flash_mutex);
400 414
401 args_buf = (struct rtas_manage_flash_t *) dp->data;
402 if ((args_buf->status == MANAGE_AUTH) || (count == 0)) 415 if ((args_buf->status == MANAGE_AUTH) || (count == 0))
403 return count; 416 goto out;
404 417
405 op = -1; 418 op = -1;
406 if (buf) { 419 if (buf) {
407 if (count > 9) count = 9; 420 if (count > 9) count = 9;
408 if (copy_from_user (stkbuf, buf, count)) { 421 rc = -EFAULT;
409 return -EFAULT; 422 if (copy_from_user (stkbuf, buf, count))
410 } 423 goto error;
411 if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0) 424 if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0)
412 op = RTAS_REJECT_TMP_IMG; 425 op = RTAS_REJECT_TMP_IMG;
413 else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0) 426 else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0)
414 op = RTAS_COMMIT_TMP_IMG; 427 op = RTAS_COMMIT_TMP_IMG;
415 } 428 }
416 429
417 if (op == -1) /* buf is empty, or contains invalid string */ 430 if (op == -1) { /* buf is empty, or contains invalid string */
418 return -EINVAL; 431 rc = -EINVAL;
419 432 goto error;
420 args_buf->op = op; 433 }
421 manage_flash(args_buf);
422 434
435 manage_flash(args_buf, op);
436out:
437 mutex_unlock(&rtas_manage_flash_mutex);
423 return count; 438 return count;
439
440error:
441 mutex_unlock(&rtas_manage_flash_mutex);
442 return rc;
424} 443}
425 444
445/*
446 * Validation routines.
447 */
426static void validate_flash(struct rtas_validate_flash_t *args_buf) 448static void validate_flash(struct rtas_validate_flash_t *args_buf)
427{ 449{
428 int token = rtas_token("ibm,validate-flash-image"); 450 int token = rtas_token("ibm,validate-flash-image");
@@ -462,14 +484,14 @@ static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf,
462static ssize_t validate_flash_read(struct file *file, char __user *buf, 484static ssize_t validate_flash_read(struct file *file, char __user *buf,
463 size_t count, loff_t *ppos) 485 size_t count, loff_t *ppos)
464{ 486{
465 struct proc_dir_entry *dp = PDE(file_inode(file)); 487 struct rtas_validate_flash_t *const args_buf =
466 struct rtas_validate_flash_t *args_buf; 488 &rtas_validate_flash_data;
467 char msg[RTAS_MSG_MAXLEN]; 489 char msg[RTAS_MSG_MAXLEN];
468 int msglen; 490 int msglen;
469 491
470 args_buf = dp->data; 492 mutex_lock(&rtas_validate_flash_mutex);
471
472 msglen = get_validate_flash_msg(args_buf, msg); 493 msglen = get_validate_flash_msg(args_buf, msg);
494 mutex_unlock(&rtas_validate_flash_mutex);
473 495
474 return simple_read_from_buffer(buf, count, ppos, msg, msglen); 496 return simple_read_from_buffer(buf, count, ppos, msg, msglen);
475} 497}
@@ -477,24 +499,18 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
477static ssize_t validate_flash_write(struct file *file, const char __user *buf, 499static ssize_t validate_flash_write(struct file *file, const char __user *buf,
478 size_t count, loff_t *off) 500 size_t count, loff_t *off)
479{ 501{
480 struct proc_dir_entry *dp = PDE(file_inode(file)); 502 struct rtas_validate_flash_t *const args_buf =
481 struct rtas_validate_flash_t *args_buf; 503 &rtas_validate_flash_data;
482 int rc; 504 int rc;
483 505
484 args_buf = (struct rtas_validate_flash_t *) dp->data; 506 mutex_lock(&rtas_validate_flash_mutex);
485
486 if (dp->data == NULL) {
487 dp->data = kmalloc(sizeof(struct rtas_validate_flash_t),
488 GFP_KERNEL);
489 if (dp->data == NULL)
490 return -ENOMEM;
491 }
492 507
493 /* We are only interested in the first 4K of the 508 /* We are only interested in the first 4K of the
494 * candidate image */ 509 * candidate image */
495 if ((*off >= VALIDATE_BUF_SIZE) || 510 if ((*off >= VALIDATE_BUF_SIZE) ||
496 (args_buf->status == VALIDATE_AUTH)) { 511 (args_buf->status == VALIDATE_AUTH)) {
497 *off += count; 512 *off += count;
513 mutex_unlock(&rtas_validate_flash_mutex);
498 return count; 514 return count;
499 } 515 }
500 516
@@ -517,31 +533,29 @@ static ssize_t validate_flash_write(struct file *file, const char __user *buf,
517 *off += count; 533 *off += count;
518 rc = count; 534 rc = count;
519done: 535done:
520 if (rc < 0) { 536 mutex_unlock(&rtas_validate_flash_mutex);
521 kfree(dp->data);
522 dp->data = NULL;
523 }
524 return rc; 537 return rc;
525} 538}
526 539
527static int validate_flash_release(struct inode *inode, struct file *file) 540static int validate_flash_release(struct inode *inode, struct file *file)
528{ 541{
529 struct proc_dir_entry *dp = PDE(file_inode(file)); 542 struct rtas_validate_flash_t *const args_buf =
530 struct rtas_validate_flash_t *args_buf; 543 &rtas_validate_flash_data;
531 544
532 args_buf = (struct rtas_validate_flash_t *) dp->data; 545 mutex_lock(&rtas_validate_flash_mutex);
533 546
534 if (args_buf->status == VALIDATE_READY) { 547 if (args_buf->status == VALIDATE_READY) {
535 args_buf->buf_size = VALIDATE_BUF_SIZE; 548 args_buf->buf_size = VALIDATE_BUF_SIZE;
536 validate_flash(args_buf); 549 validate_flash(args_buf);
537 } 550 }
538 551
539 /* The matching atomic_inc was in rtas_excl_open() */ 552 mutex_unlock(&rtas_validate_flash_mutex);
540 atomic_dec(&dp->count);
541
542 return 0; 553 return 0;
543} 554}
544 555
556/*
557 * On-reboot flash update applicator.
558 */
545static void rtas_flash_firmware(int reboot_type) 559static void rtas_flash_firmware(int reboot_type)
546{ 560{
547 unsigned long image_size; 561 unsigned long image_size;
@@ -634,75 +648,57 @@ static void rtas_flash_firmware(int reboot_type)
634 spin_unlock(&rtas_data_buf_lock); 648 spin_unlock(&rtas_data_buf_lock);
635} 649}
636 650
637static void remove_flash_pde(struct proc_dir_entry *dp) 651/*
638{ 652 * Manifest of proc files to create
639 if (dp) { 653 */
640 kfree(dp->data); 654struct rtas_flash_file {
641 remove_proc_entry(dp->name, dp->parent); 655 const char *filename;
642 } 656 const char *rtas_call_name;
643}
644
645static int initialize_flash_pde_data(const char *rtas_call_name,
646 size_t buf_size,
647 struct proc_dir_entry *dp)
648{
649 int *status; 657 int *status;
650 int token; 658 const struct file_operations fops;
651
652 dp->data = kzalloc(buf_size, GFP_KERNEL);
653 if (dp->data == NULL)
654 return -ENOMEM;
655
656 /*
657 * This code assumes that the status int is the first member of the
658 * struct
659 */
660 status = (int *) dp->data;
661 token = rtas_token(rtas_call_name);
662 if (token == RTAS_UNKNOWN_SERVICE)
663 *status = FLASH_AUTH;
664 else
665 *status = FLASH_NO_OP;
666
667 return 0;
668}
669
670static struct proc_dir_entry *create_flash_pde(const char *filename,
671 const struct file_operations *fops)
672{
673 return proc_create(filename, S_IRUSR | S_IWUSR, NULL, fops);
674}
675
676static const struct file_operations rtas_flash_operations = {
677 .owner = THIS_MODULE,
678 .read = rtas_flash_read,
679 .write = rtas_flash_write,
680 .open = rtas_excl_open,
681 .release = rtas_flash_release,
682 .llseek = default_llseek,
683};
684
685static const struct file_operations manage_flash_operations = {
686 .owner = THIS_MODULE,
687 .read = manage_flash_read,
688 .write = manage_flash_write,
689 .open = rtas_excl_open,
690 .release = rtas_excl_release,
691 .llseek = default_llseek,
692}; 659};
693 660
694static const struct file_operations validate_flash_operations = { 661static const struct rtas_flash_file rtas_flash_files[] = {
695 .owner = THIS_MODULE, 662 {
696 .read = validate_flash_read, 663 .filename = "powerpc/rtas/" FIRMWARE_FLASH_NAME,
697 .write = validate_flash_write, 664 .rtas_call_name = "ibm,update-flash-64-and-reboot",
698 .open = rtas_excl_open, 665 .status = &rtas_update_flash_data.status,
699 .release = validate_flash_release, 666 .fops.read = rtas_flash_read_msg,
700 .llseek = default_llseek, 667 .fops.write = rtas_flash_write,
668 .fops.release = rtas_flash_release,
669 .fops.llseek = default_llseek,
670 },
671 {
672 .filename = "powerpc/rtas/" FIRMWARE_UPDATE_NAME,
673 .rtas_call_name = "ibm,update-flash-64-and-reboot",
674 .status = &rtas_update_flash_data.status,
675 .fops.read = rtas_flash_read_num,
676 .fops.write = rtas_flash_write,
677 .fops.release = rtas_flash_release,
678 .fops.llseek = default_llseek,
679 },
680 {
681 .filename = "powerpc/rtas/" VALIDATE_FLASH_NAME,
682 .rtas_call_name = "ibm,validate-flash-image",
683 .status = &rtas_validate_flash_data.status,
684 .fops.read = validate_flash_read,
685 .fops.write = validate_flash_write,
686 .fops.release = validate_flash_release,
687 .fops.llseek = default_llseek,
688 },
689 {
690 .filename = "powerpc/rtas/" MANAGE_FLASH_NAME,
691 .rtas_call_name = "ibm,manage-flash-image",
692 .status = &rtas_manage_flash_data.status,
693 .fops.read = manage_flash_read,
694 .fops.write = manage_flash_write,
695 .fops.llseek = default_llseek,
696 }
701}; 697};
702 698
703static int __init rtas_flash_init(void) 699static int __init rtas_flash_init(void)
704{ 700{
705 int rc; 701 int i;
706 702
707 if (rtas_token("ibm,update-flash-64-and-reboot") == 703 if (rtas_token("ibm,update-flash-64-and-reboot") ==
708 RTAS_UNKNOWN_SERVICE) { 704 RTAS_UNKNOWN_SERVICE) {
@@ -710,93 +706,70 @@ static int __init rtas_flash_init(void)
710 return 1; 706 return 1;
711 } 707 }
712 708
713 firmware_flash_pde = create_flash_pde("powerpc/rtas/" 709 rtas_validate_flash_data.buf = kzalloc(VALIDATE_BUF_SIZE, GFP_KERNEL);
714 FIRMWARE_FLASH_NAME, 710 if (!rtas_validate_flash_data.buf)
715 &rtas_flash_operations); 711 return -ENOMEM;
716 if (firmware_flash_pde == NULL) {
717 rc = -ENOMEM;
718 goto cleanup;
719 }
720 712
721 rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", 713 flash_block_cache = kmem_cache_create("rtas_flash_cache",
722 sizeof(struct rtas_update_flash_t), 714 RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
723 firmware_flash_pde); 715 NULL);
724 if (rc != 0) 716 if (!flash_block_cache) {
725 goto cleanup; 717 printk(KERN_ERR "%s: failed to create block cache\n",
726 718 __func__);
727 firmware_update_pde = create_flash_pde("powerpc/rtas/" 719 goto enomem_buf;
728 FIRMWARE_UPDATE_NAME,
729 &rtas_flash_operations);
730 if (firmware_update_pde == NULL) {
731 rc = -ENOMEM;
732 goto cleanup;
733 } 720 }
734 721
735 rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", 722 for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) {
736 sizeof(struct rtas_update_flash_t), 723 const struct rtas_flash_file *f = &rtas_flash_files[i];
737 firmware_update_pde); 724 int token;
738 if (rc != 0)
739 goto cleanup;
740
741 validate_pde = create_flash_pde("powerpc/rtas/" VALIDATE_FLASH_NAME,
742 &validate_flash_operations);
743 if (validate_pde == NULL) {
744 rc = -ENOMEM;
745 goto cleanup;
746 }
747 725
748 rc = initialize_flash_pde_data("ibm,validate-flash-image", 726 if (!proc_create(f->filename, S_IRUSR | S_IWUSR, NULL, &f->fops))
749 sizeof(struct rtas_validate_flash_t), 727 goto enomem;
750 validate_pde);
751 if (rc != 0)
752 goto cleanup;
753
754 manage_pde = create_flash_pde("powerpc/rtas/" MANAGE_FLASH_NAME,
755 &manage_flash_operations);
756 if (manage_pde == NULL) {
757 rc = -ENOMEM;
758 goto cleanup;
759 }
760 728
761 rc = initialize_flash_pde_data("ibm,manage-flash-image", 729 /*
762 sizeof(struct rtas_manage_flash_t), 730 * This code assumes that the status int is the first member of the
763 manage_pde); 731 * struct
764 if (rc != 0) 732 */
765 goto cleanup; 733 token = rtas_token(f->rtas_call_name);
734 if (token == RTAS_UNKNOWN_SERVICE)
735 *f->status = FLASH_AUTH;
736 else
737 *f->status = FLASH_NO_OP;
738 }
766 739
767 rtas_flash_term_hook = rtas_flash_firmware; 740 rtas_flash_term_hook = rtas_flash_firmware;
768
769 flash_block_cache = kmem_cache_create("rtas_flash_cache",
770 RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
771 rtas_block_ctor);
772 if (!flash_block_cache) {
773 printk(KERN_ERR "%s: failed to create block cache\n",
774 __func__);
775 rc = -ENOMEM;
776 goto cleanup;
777 }
778 return 0; 741 return 0;
779 742
780cleanup: 743enomem:
781 remove_flash_pde(firmware_flash_pde); 744 while (--i >= 0) {
782 remove_flash_pde(firmware_update_pde); 745 const struct rtas_flash_file *f = &rtas_flash_files[i];
783 remove_flash_pde(validate_pde); 746 remove_proc_entry(f->filename, NULL);
784 remove_flash_pde(manage_pde); 747 }
785 748
786 return rc; 749 kmem_cache_destroy(flash_block_cache);
750enomem_buf:
751 kfree(rtas_validate_flash_data.buf);
752 return -ENOMEM;
787} 753}
788 754
789static void __exit rtas_flash_cleanup(void) 755static void __exit rtas_flash_cleanup(void)
790{ 756{
757 int i;
758
791 rtas_flash_term_hook = NULL; 759 rtas_flash_term_hook = NULL;
792 760
793 if (flash_block_cache) 761 if (rtas_firmware_flash_list) {
794 kmem_cache_destroy(flash_block_cache); 762 free_flash_list(rtas_firmware_flash_list);
763 rtas_firmware_flash_list = NULL;
764 }
765
766 for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) {
767 const struct rtas_flash_file *f = &rtas_flash_files[i];
768 remove_proc_entry(f->filename, NULL);
769 }
795 770
796 remove_flash_pde(firmware_flash_pde); 771 kmem_cache_destroy(flash_block_cache);
797 remove_flash_pde(firmware_update_pde); 772 kfree(rtas_validate_flash_data.buf);
798 remove_flash_pde(validate_pde);
799 remove_flash_pde(manage_pde);
800} 773}
801 774
802module_init(rtas_flash_init); 775module_init(rtas_flash_init);
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 71cb20d6ec61..6e7b7cdeec65 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -201,7 +201,7 @@ static void python_countermeasures(struct device_node *dev)
201 iounmap(chip_regs); 201 iounmap(chip_regs);
202} 202}
203 203
204void __init init_pci_config_tokens (void) 204void __init init_pci_config_tokens(void)
205{ 205{
206 read_pci_config = rtas_token("read-pci-config"); 206 read_pci_config = rtas_token("read-pci-config");
207 write_pci_config = rtas_token("write-pci-config"); 207 write_pci_config = rtas_token("write-pci-config");
@@ -209,7 +209,7 @@ void __init init_pci_config_tokens (void)
209 ibm_write_pci_config = rtas_token("ibm,write-pci-config"); 209 ibm_write_pci_config = rtas_token("ibm,write-pci-config");
210} 210}
211 211
212unsigned long get_phb_buid (struct device_node *phb) 212unsigned long get_phb_buid(struct device_node *phb)
213{ 213{
214 struct resource r; 214 struct resource r;
215 215
diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
index 1045ff49cc6d..1130c53ad652 100644
--- a/arch/powerpc/kernel/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -29,6 +29,7 @@
29#include <asm/nvram.h> 29#include <asm/nvram.h>
30#include <linux/atomic.h> 30#include <linux/atomic.h>
31#include <asm/machdep.h> 31#include <asm/machdep.h>
32#include <asm/topology.h>
32 33
33 34
34static DEFINE_SPINLOCK(rtasd_log_lock); 35static DEFINE_SPINLOCK(rtasd_log_lock);
@@ -87,6 +88,8 @@ static char *rtas_event_type(int type)
87 return "Resource Deallocation Event"; 88 return "Resource Deallocation Event";
88 case RTAS_TYPE_DUMP: 89 case RTAS_TYPE_DUMP:
89 return "Dump Notification Event"; 90 return "Dump Notification Event";
91 case RTAS_TYPE_PRRN:
92 return "Platform Resource Reassignment Event";
90 } 93 }
91 94
92 return rtas_type[0]; 95 return rtas_type[0];
@@ -265,9 +268,51 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
265 spin_unlock_irqrestore(&rtasd_log_lock, s); 268 spin_unlock_irqrestore(&rtasd_log_lock, s);
266 return; 269 return;
267 } 270 }
271}
272
273#ifdef CONFIG_PPC_PSERIES
274static s32 prrn_update_scope;
268 275
276static void prrn_work_fn(struct work_struct *work)
277{
278 /*
279 * For PRRN, we must pass the negative of the scope value in
280 * the RTAS event.
281 */
282 pseries_devicetree_update(-prrn_update_scope);
269} 283}
270 284
285static DECLARE_WORK(prrn_work, prrn_work_fn);
286
287void prrn_schedule_update(u32 scope)
288{
289 flush_work(&prrn_work);
290 prrn_update_scope = scope;
291 schedule_work(&prrn_work);
292}
293
294static void handle_rtas_event(const struct rtas_error_log *log)
295{
296 if (log->type == RTAS_TYPE_PRRN) {
297 /* For PRRN Events the extended log length is used to denote
298 * the scope for calling rtas update-nodes.
299 */
300 if (prrn_is_enabled())
301 prrn_schedule_update(log->extended_log_length);
302 }
303
304 return;
305}
306
307#else
308
309static void handle_rtas_event(const struct rtas_error_log *log)
310{
311 return;
312}
313
314#endif
315
271static int rtas_log_open(struct inode * inode, struct file * file) 316static int rtas_log_open(struct inode * inode, struct file * file)
272{ 317{
273 return 0; 318 return 0;
@@ -388,8 +433,10 @@ static void do_event_scan(void)
388 break; 433 break;
389 } 434 }
390 435
391 if (error == 0) 436 if (error == 0) {
392 pSeries_log_error(logdata, ERR_TYPE_RTAS_LOG, 0); 437 pSeries_log_error(logdata, ERR_TYPE_RTAS_LOG, 0);
438 handle_rtas_event((struct rtas_error_log *)logdata);
439 }
393 440
394 } while(error == 0); 441 } while(error == 0);
395} 442}
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index bdc499c17872..63d051f5b7a5 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -621,12 +621,6 @@ int check_legacy_ioport(unsigned long base_port)
621 case FDC_BASE: /* FDC1 */ 621 case FDC_BASE: /* FDC1 */
622 np = of_find_node_by_type(NULL, "fdc"); 622 np = of_find_node_by_type(NULL, "fdc");
623 break; 623 break;
624#ifdef CONFIG_PPC_PREP
625 case _PIDXR:
626 case _PNPWRP:
627 case PNPBIOS_BASE:
628 /* implement me */
629#endif
630 default: 624 default:
631 /* ipmi is supposed to fail here */ 625 /* ipmi is supposed to fail here */
632 break; 626 break;
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 75fbaceb5c87..e379d3fd1694 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -583,7 +583,9 @@ void __init setup_arch(char **cmdline_p)
583 init_mm.end_code = (unsigned long) _etext; 583 init_mm.end_code = (unsigned long) _etext;
584 init_mm.end_data = (unsigned long) _edata; 584 init_mm.end_data = (unsigned long) _edata;
585 init_mm.brk = klimit; 585 init_mm.brk = klimit;
586 586#ifdef CONFIG_PPC_64K_PAGES
587 init_mm.context.pte_frag = NULL;
588#endif
587 irqstack_early_init(); 589 irqstack_early_init();
588 exc_lvl_early_init(); 590 exc_lvl_early_init();
589 emergency_stack_init(); 591 emergency_stack_init();
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 76bd9da8cb71..ee7ac5e6e28a 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -669,7 +669,7 @@ __cpuinit void start_secondary(void *unused)
669 669
670 local_irq_enable(); 670 local_irq_enable();
671 671
672 cpu_idle(); 672 cpu_startup_entry(CPUHP_ONLINE);
673 673
674 BUG(); 674 BUG();
675} 675}
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index d0bafc0cdf06..cd6e19d263b3 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -61,91 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); 61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
62} 62}
63 63
64#ifdef CONFIG_SYSVIPC
65long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
66 u32 fifth)
67{
68 int version;
69
70 version = call >> 16; /* hack for backward compatibility */
71 call &= 0xffff;
72
73 switch (call) {
74
75 case SEMTIMEDOP:
76 if (fifth)
77 /* sign extend semid */
78 return compat_sys_semtimedop((int)first,
79 compat_ptr(ptr), second,
80 compat_ptr(fifth));
81 /* else fall through for normal semop() */
82 case SEMOP:
83 /* struct sembuf is the same on 32 and 64bit :)) */
84 /* sign extend semid */
85 return sys_semtimedop((int)first, compat_ptr(ptr), second,
86 NULL);
87 case SEMGET:
88 /* sign extend key, nsems */
89 return sys_semget((int)first, (int)second, third);
90 case SEMCTL:
91 /* sign extend semid, semnum */
92 return compat_sys_semctl((int)first, (int)second, third,
93 compat_ptr(ptr));
94
95 case MSGSND:
96 /* sign extend msqid */
97 return compat_sys_msgsnd((int)first, (int)second, third,
98 compat_ptr(ptr));
99 case MSGRCV:
100 /* sign extend msqid, msgtyp */
101 return compat_sys_msgrcv((int)first, second, (int)fifth,
102 third, version, compat_ptr(ptr));
103 case MSGGET:
104 /* sign extend key */
105 return sys_msgget((int)first, second);
106 case MSGCTL:
107 /* sign extend msqid */
108 return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
109
110 case SHMAT:
111 /* sign extend shmid */
112 return compat_sys_shmat((int)first, second, third, version,
113 compat_ptr(ptr));
114 case SHMDT:
115 return sys_shmdt(compat_ptr(ptr));
116 case SHMGET:
117 /* sign extend key_t */
118 return sys_shmget((int)first, second, third);
119 case SHMCTL:
120 /* sign extend shmid */
121 return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
122
123 default:
124 return -ENOSYS;
125 }
126
127 return -ENOSYS;
128}
129#endif
130
131/* Note: it is necessary to treat out_fd and in_fd as unsigned ints,
132 * with the corresponding cast to a signed int to insure that the
133 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
134 * and the register representation of a signed int (msr in 64-bit mode) is performed.
135 */
136asmlinkage long compat_sys_sendfile_wrapper(u32 out_fd, u32 in_fd,
137 compat_off_t __user *offset, u32 count)
138{
139 return compat_sys_sendfile((int)out_fd, (int)in_fd, offset, count);
140}
141
142asmlinkage long compat_sys_sendfile64_wrapper(u32 out_fd, u32 in_fd,
143 compat_loff_t __user *offset, u32 count)
144{
145 return sys_sendfile((int)out_fd, (int)in_fd,
146 (off_t __user *)offset, count);
147}
148
149unsigned long compat_sys_mmap2(unsigned long addr, size_t len, 64unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
150 unsigned long prot, unsigned long flags, 65 unsigned long prot, unsigned long flags,
151 unsigned long fd, unsigned long pgoff) 66 unsigned long fd, unsigned long pgoff)
@@ -195,13 +110,6 @@ asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long h
195 return sys_ftruncate(fd, (high << 32) | low); 110 return sys_ftruncate(fd, (high << 32) | low);
196} 111}
197 112
198long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
199 size_t len)
200{
201 return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
202 buf, len);
203}
204
205long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, 113long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low,
206 size_t len, int advice) 114 size_t len, int advice)
207{ 115{
@@ -209,23 +117,6 @@ long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low,
209 advice); 117 advice);
210} 118}
211 119
212asmlinkage long compat_sys_add_key(const char __user *_type,
213 const char __user *_description,
214 const void __user *_payload,
215 u32 plen,
216 u32 ringid)
217{
218 return sys_add_key(_type, _description, _payload, plen, ringid);
219}
220
221asmlinkage long compat_sys_request_key(const char __user *_type,
222 const char __user *_description,
223 const char __user *_callout_info,
224 u32 destringid)
225{
226 return sys_request_key(_type, _description, _callout_info, destringid);
227}
228
229asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags, 120asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
230 unsigned offset_hi, unsigned offset_lo, 121 unsigned offset_hi, unsigned offset_lo,
231 unsigned nbytes_hi, unsigned nbytes_lo) 122 unsigned nbytes_hi, unsigned nbytes_lo)
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 3ce1f864c2d3..e68a84568b8b 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -180,7 +180,7 @@ SYSFS_PMCSETUP(dscr, SPRN_DSCR);
180SYSFS_PMCSETUP(pir, SPRN_PIR); 180SYSFS_PMCSETUP(pir, SPRN_PIR);
181 181
182static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 182static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
183static DEVICE_ATTR(spurr, 0600, show_spurr, NULL); 183static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
184static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr); 184static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
185static DEVICE_ATTR(purr, 0600, show_purr, store_purr); 185static DEVICE_ATTR(purr, 0600, show_purr, store_purr);
186static DEVICE_ATTR(pir, 0400, show_pir, NULL); 186static DEVICE_ATTR(pir, 0400, show_pir, NULL);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index f77fa22754bc..5fc29ad7e26f 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1049,10 +1049,8 @@ static int __init rtc_init(void)
1049 return -ENODEV; 1049 return -ENODEV;
1050 1050
1051 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 1051 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
1052 if (IS_ERR(pdev))
1053 return PTR_ERR(pdev);
1054 1052
1055 return 0; 1053 return PTR_RET(pdev);
1056} 1054}
1057 1055
1058module_init(rtc_init); 1056module_init(rtc_init);
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 37cc40ef5043..83efa2f7d926 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -970,7 +970,10 @@ static int emulate_instruction(struct pt_regs *regs)
970 970
971#ifdef CONFIG_PPC64 971#ifdef CONFIG_PPC64
972 /* Emulate the mfspr rD, DSCR. */ 972 /* Emulate the mfspr rD, DSCR. */
973 if (((instword & PPC_INST_MFSPR_DSCR_MASK) == PPC_INST_MFSPR_DSCR) && 973 if ((((instword & PPC_INST_MFSPR_DSCR_USER_MASK) ==
974 PPC_INST_MFSPR_DSCR_USER) ||
975 ((instword & PPC_INST_MFSPR_DSCR_MASK) ==
976 PPC_INST_MFSPR_DSCR)) &&
974 cpu_has_feature(CPU_FTR_DSCR)) { 977 cpu_has_feature(CPU_FTR_DSCR)) {
975 PPC_WARN_EMULATED(mfdscr, regs); 978 PPC_WARN_EMULATED(mfdscr, regs);
976 rd = (instword >> 21) & 0x1f; 979 rd = (instword >> 21) & 0x1f;
@@ -978,7 +981,10 @@ static int emulate_instruction(struct pt_regs *regs)
978 return 0; 981 return 0;
979 } 982 }
980 /* Emulate the mtspr DSCR, rD. */ 983 /* Emulate the mtspr DSCR, rD. */
981 if (((instword & PPC_INST_MTSPR_DSCR_MASK) == PPC_INST_MTSPR_DSCR) && 984 if ((((instword & PPC_INST_MTSPR_DSCR_USER_MASK) ==
985 PPC_INST_MTSPR_DSCR_USER) ||
986 ((instword & PPC_INST_MTSPR_DSCR_MASK) ==
987 PPC_INST_MTSPR_DSCR)) &&
982 cpu_has_feature(CPU_FTR_DSCR)) { 988 cpu_has_feature(CPU_FTR_DSCR)) {
983 PPC_WARN_EMULATED(mtdscr, regs); 989 PPC_WARN_EMULATED(mtdscr, regs);
984 rd = (instword >> 21) & 0x1f; 990 rd = (instword >> 21) & 0x1f;
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index f9748498fe58..13b867093499 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -156,15 +156,13 @@ static struct console udbg_console = {
156 .index = 0, 156 .index = 0,
157}; 157};
158 158
159static int early_console_initialized;
160
161/* 159/*
162 * Called by setup_system after ppc_md->probe and ppc_md->early_init. 160 * Called by setup_system after ppc_md->probe and ppc_md->early_init.
163 * Call it again after setting udbg_putc in ppc_md->setup_arch. 161 * Call it again after setting udbg_putc in ppc_md->setup_arch.
164 */ 162 */
165void __init register_early_udbg_console(void) 163void __init register_early_udbg_console(void)
166{ 164{
167 if (early_console_initialized) 165 if (early_console)
168 return; 166 return;
169 167
170 if (!udbg_putc) 168 if (!udbg_putc)
@@ -174,7 +172,7 @@ void __init register_early_udbg_console(void)
174 printk(KERN_INFO "early console immortal !\n"); 172 printk(KERN_INFO "early console immortal !\n");
175 udbg_console.flags &= ~CON_BOOT; 173 udbg_console.flags &= ~CON_BOOT;
176 } 174 }
177 early_console_initialized = 1; 175 early_console = &udbg_console;
178 register_console(&udbg_console); 176 register_console(&udbg_console);
179} 177}
180 178
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index bc77834dbf43..59f419b935f2 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -31,6 +31,16 @@
31#define UPROBE_TRAP_NR UINT_MAX 31#define UPROBE_TRAP_NR UINT_MAX
32 32
33/** 33/**
34 * is_trap_insn - check if the instruction is a trap variant
35 * @insn: instruction to be checked.
36 * Returns true if @insn is a trap variant.
37 */
38bool is_trap_insn(uprobe_opcode_t *insn)
39{
40 return (is_trap(*insn));
41}
42
43/**
34 * arch_uprobe_analyze_insn 44 * arch_uprobe_analyze_insn
35 * @mm: the probed address space. 45 * @mm: the probed address space.
36 * @arch_uprobe: the probepoint information. 46 * @arch_uprobe: the probepoint information.
@@ -43,12 +53,6 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
43 if (addr & 0x03) 53 if (addr & 0x03)
44 return -EINVAL; 54 return -EINVAL;
45 55
46 /*
47 * We currently don't support a uprobe on an already
48 * existing breakpoint instruction underneath
49 */
50 if (is_trap(auprobe->ainsn))
51 return -ENOTSUPP;
52 return 0; 56 return 0;
53} 57}
54 58
@@ -188,3 +192,16 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
188 192
189 return false; 193 return false;
190} 194}
195
196unsigned long
197arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs)
198{
199 unsigned long orig_ret_vaddr;
200
201 orig_ret_vaddr = regs->link;
202
203 /* Replace the return addr with trampoline addr */
204 regs->link = trampoline_vaddr;
205
206 return orig_ret_vaddr;
207}
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 1b2076f049ce..d4f463ac65b1 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -113,6 +113,10 @@ static struct vdso_patch_def vdso_patches[] = {
113 CPU_FTR_USE_TB, 0, 113 CPU_FTR_USE_TB, 0,
114 "__kernel_get_tbfreq", NULL 114 "__kernel_get_tbfreq", NULL
115 }, 115 },
116 {
117 CPU_FTR_USE_TB, 0,
118 "__kernel_time", NULL
119 },
116}; 120};
117 121
118/* 122/*
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 4ee09ee2e836..27e2f623210b 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -181,6 +181,32 @@ V_FUNCTION_END(__kernel_clock_getres)
181 181
182 182
183/* 183/*
184 * Exact prototype of time()
185 *
186 * time_t time(time *t);
187 *
188 */
189V_FUNCTION_BEGIN(__kernel_time)
190 .cfi_startproc
191 mflr r12
192 .cfi_register lr,r12
193
194 mr r11,r3 /* r11 holds t */
195 bl __get_datapage@local
196 mr r9, r3 /* datapage ptr in r9 */
197
198 lwz r3,STAMP_XTIME+TSPEC_TV_SEC(r9)
199
200 cmplwi r11,0 /* check if t is NULL */
201 beq 2f
202 stw r3,0(r11) /* store result at *t */
2032: mtlr r12
204 crclr cr0*4+so
205 blr
206 .cfi_endproc
207V_FUNCTION_END(__kernel_time)
208
209/*
184 * This is the core of clock_gettime() and gettimeofday(), 210 * This is the core of clock_gettime() and gettimeofday(),
185 * it returns the current time in r3 (seconds) and r4. 211 * it returns the current time in r3 (seconds) and r4.
186 * On entry, r7 gives the resolution of r4, either USEC_PER_SEC 212 * On entry, r7 gives the resolution of r4, either USEC_PER_SEC
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 43200ba2e570..f223409629b9 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -150,6 +150,7 @@ VERSION
150#ifdef CONFIG_PPC64 150#ifdef CONFIG_PPC64
151 __kernel_getcpu; 151 __kernel_getcpu;
152#endif 152#endif
153 __kernel_time;
153 154
154 local: *; 155 local: *;
155 }; 156 };
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index e97a9a0dc4ac..a76b4af37ef2 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -164,6 +164,32 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
164 .cfi_endproc 164 .cfi_endproc
165V_FUNCTION_END(__kernel_clock_getres) 165V_FUNCTION_END(__kernel_clock_getres)
166 166
167/*
168 * Exact prototype of time()
169 *
170 * time_t time(time *t);
171 *
172 */
173V_FUNCTION_BEGIN(__kernel_time)
174 .cfi_startproc
175 mflr r12
176 .cfi_register lr,r12
177
178 mr r11,r3 /* r11 holds t */
179 bl V_LOCAL_FUNC(__get_datapage)
180
181 ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3)
182
183 cmpldi r11,0 /* check if t is NULL */
184 beq 2f
185 std r4,0(r11) /* store result at *t */
1862: mtlr r12
187 crclr cr0*4+so
188 mr r3,r4
189 blr
190 .cfi_endproc
191V_FUNCTION_END(__kernel_time)
192
167 193
168/* 194/*
169 * This is the core of clock_gettime() and gettimeofday(), 195 * This is the core of clock_gettime() and gettimeofday(),
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index e6c1758f3588..e4863819663b 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -147,6 +147,7 @@ VERSION
147 __kernel_sync_dicache_p5; 147 __kernel_sync_dicache_p5;
148 __kernel_sigtramp_rt64; 148 __kernel_sigtramp_rt64;
149 __kernel_getcpu; 149 __kernel_getcpu;
150 __kernel_time;
150 151
151 local: *; 152 local: *;
152 }; 153 };
diff --git a/arch/powerpc/kvm/44x.c b/arch/powerpc/kvm/44x.c
index 3d7fd21c65f9..2f5c6b6d6877 100644
--- a/arch/powerpc/kvm/44x.c
+++ b/arch/powerpc/kvm/44x.c
@@ -124,6 +124,18 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
124 return kvmppc_set_sregs_ivor(vcpu, sregs); 124 return kvmppc_set_sregs_ivor(vcpu, sregs);
125} 125}
126 126
127int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
128 union kvmppc_one_reg *val)
129{
130 return -EINVAL;
131}
132
133int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id,
134 union kvmppc_one_reg *val)
135{
136 return -EINVAL;
137}
138
127struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) 139struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
128{ 140{
129 struct kvmppc_vcpu_44x *vcpu_44x; 141 struct kvmppc_vcpu_44x *vcpu_44x;
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index 63c67ec72e43..eb643f862579 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -136,21 +136,41 @@ config KVM_E500V2
136 If unsure, say N. 136 If unsure, say N.
137 137
138config KVM_E500MC 138config KVM_E500MC
139 bool "KVM support for PowerPC E500MC/E5500 processors" 139 bool "KVM support for PowerPC E500MC/E5500/E6500 processors"
140 depends on PPC_E500MC 140 depends on PPC_E500MC
141 select KVM 141 select KVM
142 select KVM_MMIO 142 select KVM_MMIO
143 select KVM_BOOKE_HV 143 select KVM_BOOKE_HV
144 select MMU_NOTIFIER 144 select MMU_NOTIFIER
145 ---help--- 145 ---help---
146 Support running unmodified E500MC/E5500 (32-bit) guest kernels in 146 Support running unmodified E500MC/E5500/E6500 guest kernels in
147 virtual machines on E500MC/E5500 host processors. 147 virtual machines on E500MC/E5500/E6500 host processors.
148 148
149 This module provides access to the hardware capabilities through 149 This module provides access to the hardware capabilities through
150 a character device node named /dev/kvm. 150 a character device node named /dev/kvm.
151 151
152 If unsure, say N. 152 If unsure, say N.
153 153
154config KVM_MPIC
155 bool "KVM in-kernel MPIC emulation"
156 depends on KVM && E500
157 select HAVE_KVM_IRQCHIP
158 select HAVE_KVM_IRQ_ROUTING
159 select HAVE_KVM_MSI
160 help
161 Enable support for emulating MPIC devices inside the
162 host kernel, rather than relying on userspace to emulate.
163 Currently, support is limited to certain versions of
164 Freescale's MPIC implementation.
165
166config KVM_XICS
167 bool "KVM in-kernel XICS emulation"
168 depends on KVM_BOOK3S_64 && !KVM_MPIC
169 ---help---
170 Include support for the XICS (eXternal Interrupt Controller
171 Specification) interrupt controller architecture used on
172 IBM POWER (pSeries) servers.
173
154source drivers/vhost/Kconfig 174source drivers/vhost/Kconfig
155 175
156endif # VIRTUALIZATION 176endif # VIRTUALIZATION
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index b772eded8c26..422de3f4d46c 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -72,12 +72,18 @@ kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_HV) := \
72 book3s_hv.o \ 72 book3s_hv.o \
73 book3s_hv_interrupts.o \ 73 book3s_hv_interrupts.o \
74 book3s_64_mmu_hv.o 74 book3s_64_mmu_hv.o
75kvm-book3s_64-builtin-xics-objs-$(CONFIG_KVM_XICS) := \
76 book3s_hv_rm_xics.o
75kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HV) := \ 77kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HV) := \
76 book3s_hv_rmhandlers.o \ 78 book3s_hv_rmhandlers.o \
77 book3s_hv_rm_mmu.o \ 79 book3s_hv_rm_mmu.o \
78 book3s_64_vio_hv.o \ 80 book3s_64_vio_hv.o \
79 book3s_hv_ras.o \ 81 book3s_hv_ras.o \
80 book3s_hv_builtin.o 82 book3s_hv_builtin.o \
83 $(kvm-book3s_64-builtin-xics-objs-y)
84
85kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
86 book3s_xics.o
81 87
82kvm-book3s_64-module-objs := \ 88kvm-book3s_64-module-objs := \
83 ../../../virt/kvm/kvm_main.o \ 89 ../../../virt/kvm/kvm_main.o \
@@ -86,6 +92,7 @@ kvm-book3s_64-module-objs := \
86 emulate.o \ 92 emulate.o \
87 book3s.o \ 93 book3s.o \
88 book3s_64_vio.o \ 94 book3s_64_vio.o \
95 book3s_rtas.o \
89 $(kvm-book3s_64-objs-y) 96 $(kvm-book3s_64-objs-y)
90 97
91kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-module-objs) 98kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-module-objs)
@@ -103,6 +110,9 @@ kvm-book3s_32-objs := \
103 book3s_32_mmu.o 110 book3s_32_mmu.o
104kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs) 111kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs)
105 112
113kvm-objs-$(CONFIG_KVM_MPIC) += mpic.o
114kvm-objs-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(addprefix ../../../virt/kvm/, irqchip.o)
115
106kvm-objs := $(kvm-objs-m) $(kvm-objs-y) 116kvm-objs := $(kvm-objs-m) $(kvm-objs-y)
107 117
108obj-$(CONFIG_KVM_440) += kvm.o 118obj-$(CONFIG_KVM_440) += kvm.o
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index a4b645285240..700df6f1d32c 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -104,7 +104,7 @@ static int kvmppc_book3s_vec2irqprio(unsigned int vec)
104 return prio; 104 return prio;
105} 105}
106 106
107static void kvmppc_book3s_dequeue_irqprio(struct kvm_vcpu *vcpu, 107void kvmppc_book3s_dequeue_irqprio(struct kvm_vcpu *vcpu,
108 unsigned int vec) 108 unsigned int vec)
109{ 109{
110 unsigned long old_pending = vcpu->arch.pending_exceptions; 110 unsigned long old_pending = vcpu->arch.pending_exceptions;
@@ -160,8 +160,7 @@ void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
160 kvmppc_book3s_queue_irqprio(vcpu, vec); 160 kvmppc_book3s_queue_irqprio(vcpu, vec);
161} 161}
162 162
163void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu, 163void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu)
164 struct kvm_interrupt *irq)
165{ 164{
166 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL); 165 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL);
167 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL_LEVEL); 166 kvmppc_book3s_dequeue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL_LEVEL);
@@ -530,6 +529,21 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
530 val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]); 529 val = get_reg_val(reg->id, vcpu->arch.vscr.u[3]);
531 break; 530 break;
532#endif /* CONFIG_ALTIVEC */ 531#endif /* CONFIG_ALTIVEC */
532 case KVM_REG_PPC_DEBUG_INST: {
533 u32 opcode = INS_TW;
534 r = copy_to_user((u32 __user *)(long)reg->addr,
535 &opcode, sizeof(u32));
536 break;
537 }
538#ifdef CONFIG_KVM_XICS
539 case KVM_REG_PPC_ICP_STATE:
540 if (!vcpu->arch.icp) {
541 r = -ENXIO;
542 break;
543 }
544 val = get_reg_val(reg->id, kvmppc_xics_get_icp(vcpu));
545 break;
546#endif /* CONFIG_KVM_XICS */
533 default: 547 default:
534 r = -EINVAL; 548 r = -EINVAL;
535 break; 549 break;
@@ -592,6 +606,16 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
592 vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val); 606 vcpu->arch.vscr.u[3] = set_reg_val(reg->id, val);
593 break; 607 break;
594#endif /* CONFIG_ALTIVEC */ 608#endif /* CONFIG_ALTIVEC */
609#ifdef CONFIG_KVM_XICS
610 case KVM_REG_PPC_ICP_STATE:
611 if (!vcpu->arch.icp) {
612 r = -ENXIO;
613 break;
614 }
615 r = kvmppc_xics_set_icp(vcpu,
616 set_reg_val(reg->id, val));
617 break;
618#endif /* CONFIG_KVM_XICS */
595 default: 619 default:
596 r = -EINVAL; 620 r = -EINVAL;
597 break; 621 break;
@@ -607,6 +631,12 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
607 return 0; 631 return 0;
608} 632}
609 633
634int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
635 struct kvm_guest_debug *dbg)
636{
637 return -EINVAL;
638}
639
610void kvmppc_decrementer_func(unsigned long data) 640void kvmppc_decrementer_func(unsigned long data)
611{ 641{
612 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; 642 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 5d7d29a313eb..3a9a1aceb14f 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -143,7 +143,7 @@ map_again:
143 } 143 }
144 144
145 ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags, 145 ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags,
146 MMU_PAGE_4K, MMU_SEGSIZE_256M); 146 MMU_PAGE_4K, MMU_PAGE_4K, MMU_SEGSIZE_256M);
147 147
148 if (ret < 0) { 148 if (ret < 0) {
149 /* If we couldn't map a primary PTE, try a secondary */ 149 /* If we couldn't map a primary PTE, try a secondary */
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 8cc18abd6dde..5880dfb31074 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -893,7 +893,10 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
893 /* Harvest R and C */ 893 /* Harvest R and C */
894 rcbits = hptep[1] & (HPTE_R_R | HPTE_R_C); 894 rcbits = hptep[1] & (HPTE_R_R | HPTE_R_C);
895 *rmapp |= rcbits << KVMPPC_RMAP_RC_SHIFT; 895 *rmapp |= rcbits << KVMPPC_RMAP_RC_SHIFT;
896 rev[i].guest_rpte = ptel | rcbits; 896 if (rcbits & ~rev[i].guest_rpte) {
897 rev[i].guest_rpte = ptel | rcbits;
898 note_hpte_modification(kvm, &rev[i]);
899 }
897 } 900 }
898 unlock_rmap(rmapp); 901 unlock_rmap(rmapp);
899 hptep[0] &= ~HPTE_V_HVLOCK; 902 hptep[0] &= ~HPTE_V_HVLOCK;
@@ -976,7 +979,10 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
976 /* Now check and modify the HPTE */ 979 /* Now check and modify the HPTE */
977 if ((hptep[0] & HPTE_V_VALID) && (hptep[1] & HPTE_R_R)) { 980 if ((hptep[0] & HPTE_V_VALID) && (hptep[1] & HPTE_R_R)) {
978 kvmppc_clear_ref_hpte(kvm, hptep, i); 981 kvmppc_clear_ref_hpte(kvm, hptep, i);
979 rev[i].guest_rpte |= HPTE_R_R; 982 if (!(rev[i].guest_rpte & HPTE_R_R)) {
983 rev[i].guest_rpte |= HPTE_R_R;
984 note_hpte_modification(kvm, &rev[i]);
985 }
980 ret = 1; 986 ret = 1;
981 } 987 }
982 hptep[0] &= ~HPTE_V_HVLOCK; 988 hptep[0] &= ~HPTE_V_HVLOCK;
@@ -1080,7 +1086,10 @@ static int kvm_test_clear_dirty(struct kvm *kvm, unsigned long *rmapp)
1080 hptep[1] &= ~HPTE_R_C; 1086 hptep[1] &= ~HPTE_R_C;
1081 eieio(); 1087 eieio();
1082 hptep[0] = (hptep[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID; 1088 hptep[0] = (hptep[0] & ~HPTE_V_ABSENT) | HPTE_V_VALID;
1083 rev[i].guest_rpte |= HPTE_R_C; 1089 if (!(rev[i].guest_rpte & HPTE_R_C)) {
1090 rev[i].guest_rpte |= HPTE_R_C;
1091 note_hpte_modification(kvm, &rev[i]);
1092 }
1084 ret = 1; 1093 ret = 1;
1085 } 1094 }
1086 hptep[0] &= ~HPTE_V_HVLOCK; 1095 hptep[0] &= ~HPTE_V_HVLOCK;
@@ -1090,11 +1099,30 @@ static int kvm_test_clear_dirty(struct kvm *kvm, unsigned long *rmapp)
1090 return ret; 1099 return ret;
1091} 1100}
1092 1101
1102static void harvest_vpa_dirty(struct kvmppc_vpa *vpa,
1103 struct kvm_memory_slot *memslot,
1104 unsigned long *map)
1105{
1106 unsigned long gfn;
1107
1108 if (!vpa->dirty || !vpa->pinned_addr)
1109 return;
1110 gfn = vpa->gpa >> PAGE_SHIFT;
1111 if (gfn < memslot->base_gfn ||
1112 gfn >= memslot->base_gfn + memslot->npages)
1113 return;
1114
1115 vpa->dirty = false;
1116 if (map)
1117 __set_bit_le(gfn - memslot->base_gfn, map);
1118}
1119
1093long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot, 1120long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot,
1094 unsigned long *map) 1121 unsigned long *map)
1095{ 1122{
1096 unsigned long i; 1123 unsigned long i;
1097 unsigned long *rmapp; 1124 unsigned long *rmapp;
1125 struct kvm_vcpu *vcpu;
1098 1126
1099 preempt_disable(); 1127 preempt_disable();
1100 rmapp = memslot->arch.rmap; 1128 rmapp = memslot->arch.rmap;
@@ -1103,6 +1131,15 @@ long kvmppc_hv_get_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot,
1103 __set_bit_le(i, map); 1131 __set_bit_le(i, map);
1104 ++rmapp; 1132 ++rmapp;
1105 } 1133 }
1134
1135 /* Harvest dirty bits from VPA and DTL updates */
1136 /* Note: we never modify the SLB shadow buffer areas */
1137 kvm_for_each_vcpu(i, vcpu, kvm) {
1138 spin_lock(&vcpu->arch.vpa_update_lock);
1139 harvest_vpa_dirty(&vcpu->arch.vpa, memslot, map);
1140 harvest_vpa_dirty(&vcpu->arch.dtl, memslot, map);
1141 spin_unlock(&vcpu->arch.vpa_update_lock);
1142 }
1106 preempt_enable(); 1143 preempt_enable();
1107 return 0; 1144 return 0;
1108} 1145}
@@ -1114,7 +1151,7 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
1114 unsigned long gfn = gpa >> PAGE_SHIFT; 1151 unsigned long gfn = gpa >> PAGE_SHIFT;
1115 struct page *page, *pages[1]; 1152 struct page *page, *pages[1];
1116 int npages; 1153 int npages;
1117 unsigned long hva, psize, offset; 1154 unsigned long hva, offset;
1118 unsigned long pa; 1155 unsigned long pa;
1119 unsigned long *physp; 1156 unsigned long *physp;
1120 int srcu_idx; 1157 int srcu_idx;
@@ -1146,14 +1183,9 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
1146 } 1183 }
1147 srcu_read_unlock(&kvm->srcu, srcu_idx); 1184 srcu_read_unlock(&kvm->srcu, srcu_idx);
1148 1185
1149 psize = PAGE_SIZE; 1186 offset = gpa & (PAGE_SIZE - 1);
1150 if (PageHuge(page)) {
1151 page = compound_head(page);
1152 psize <<= compound_order(page);
1153 }
1154 offset = gpa & (psize - 1);
1155 if (nb_ret) 1187 if (nb_ret)
1156 *nb_ret = psize - offset; 1188 *nb_ret = PAGE_SIZE - offset;
1157 return page_address(page) + offset; 1189 return page_address(page) + offset;
1158 1190
1159 err: 1191 err:
@@ -1161,11 +1193,31 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
1161 return NULL; 1193 return NULL;
1162} 1194}
1163 1195
1164void kvmppc_unpin_guest_page(struct kvm *kvm, void *va) 1196void kvmppc_unpin_guest_page(struct kvm *kvm, void *va, unsigned long gpa,
1197 bool dirty)
1165{ 1198{
1166 struct page *page = virt_to_page(va); 1199 struct page *page = virt_to_page(va);
1200 struct kvm_memory_slot *memslot;
1201 unsigned long gfn;
1202 unsigned long *rmap;
1203 int srcu_idx;
1167 1204
1168 put_page(page); 1205 put_page(page);
1206
1207 if (!dirty || !kvm->arch.using_mmu_notifiers)
1208 return;
1209
1210 /* We need to mark this page dirty in the rmap chain */
1211 gfn = gpa >> PAGE_SHIFT;
1212 srcu_idx = srcu_read_lock(&kvm->srcu);
1213 memslot = gfn_to_memslot(kvm, gfn);
1214 if (memslot) {
1215 rmap = &memslot->arch.rmap[gfn - memslot->base_gfn];
1216 lock_rmap(rmap);
1217 *rmap |= KVMPPC_RMAP_CHANGED;
1218 unlock_rmap(rmap);
1219 }
1220 srcu_read_unlock(&kvm->srcu, srcu_idx);
1169} 1221}
1170 1222
1171/* 1223/*
@@ -1193,16 +1245,36 @@ struct kvm_htab_ctx {
1193 1245
1194#define HPTE_SIZE (2 * sizeof(unsigned long)) 1246#define HPTE_SIZE (2 * sizeof(unsigned long))
1195 1247
1248/*
1249 * Returns 1 if this HPT entry has been modified or has pending
1250 * R/C bit changes.
1251 */
1252static int hpte_dirty(struct revmap_entry *revp, unsigned long *hptp)
1253{
1254 unsigned long rcbits_unset;
1255
1256 if (revp->guest_rpte & HPTE_GR_MODIFIED)
1257 return 1;
1258
1259 /* Also need to consider changes in reference and changed bits */
1260 rcbits_unset = ~revp->guest_rpte & (HPTE_R_R | HPTE_R_C);
1261 if ((hptp[0] & HPTE_V_VALID) && (hptp[1] & rcbits_unset))
1262 return 1;
1263
1264 return 0;
1265}
1266
1196static long record_hpte(unsigned long flags, unsigned long *hptp, 1267static long record_hpte(unsigned long flags, unsigned long *hptp,
1197 unsigned long *hpte, struct revmap_entry *revp, 1268 unsigned long *hpte, struct revmap_entry *revp,
1198 int want_valid, int first_pass) 1269 int want_valid, int first_pass)
1199{ 1270{
1200 unsigned long v, r; 1271 unsigned long v, r;
1272 unsigned long rcbits_unset;
1201 int ok = 1; 1273 int ok = 1;
1202 int valid, dirty; 1274 int valid, dirty;
1203 1275
1204 /* Unmodified entries are uninteresting except on the first pass */ 1276 /* Unmodified entries are uninteresting except on the first pass */
1205 dirty = !!(revp->guest_rpte & HPTE_GR_MODIFIED); 1277 dirty = hpte_dirty(revp, hptp);
1206 if (!first_pass && !dirty) 1278 if (!first_pass && !dirty)
1207 return 0; 1279 return 0;
1208 1280
@@ -1223,16 +1295,28 @@ static long record_hpte(unsigned long flags, unsigned long *hptp,
1223 while (!try_lock_hpte(hptp, HPTE_V_HVLOCK)) 1295 while (!try_lock_hpte(hptp, HPTE_V_HVLOCK))
1224 cpu_relax(); 1296 cpu_relax();
1225 v = hptp[0]; 1297 v = hptp[0];
1298
1299 /* re-evaluate valid and dirty from synchronized HPTE value */
1300 valid = !!(v & HPTE_V_VALID);
1301 dirty = !!(revp->guest_rpte & HPTE_GR_MODIFIED);
1302
1303 /* Harvest R and C into guest view if necessary */
1304 rcbits_unset = ~revp->guest_rpte & (HPTE_R_R | HPTE_R_C);
1305 if (valid && (rcbits_unset & hptp[1])) {
1306 revp->guest_rpte |= (hptp[1] & (HPTE_R_R | HPTE_R_C)) |
1307 HPTE_GR_MODIFIED;
1308 dirty = 1;
1309 }
1310
1226 if (v & HPTE_V_ABSENT) { 1311 if (v & HPTE_V_ABSENT) {
1227 v &= ~HPTE_V_ABSENT; 1312 v &= ~HPTE_V_ABSENT;
1228 v |= HPTE_V_VALID; 1313 v |= HPTE_V_VALID;
1314 valid = 1;
1229 } 1315 }
1230 /* re-evaluate valid and dirty from synchronized HPTE value */
1231 valid = !!(v & HPTE_V_VALID);
1232 if ((flags & KVM_GET_HTAB_BOLTED_ONLY) && !(v & HPTE_V_BOLTED)) 1316 if ((flags & KVM_GET_HTAB_BOLTED_ONLY) && !(v & HPTE_V_BOLTED))
1233 valid = 0; 1317 valid = 0;
1234 r = revp->guest_rpte | (hptp[1] & (HPTE_R_R | HPTE_R_C)); 1318
1235 dirty = !!(revp->guest_rpte & HPTE_GR_MODIFIED); 1319 r = revp->guest_rpte;
1236 /* only clear modified if this is the right sort of entry */ 1320 /* only clear modified if this is the right sort of entry */
1237 if (valid == want_valid && dirty) { 1321 if (valid == want_valid && dirty) {
1238 r &= ~HPTE_GR_MODIFIED; 1322 r &= ~HPTE_GR_MODIFIED;
@@ -1288,7 +1372,7 @@ static ssize_t kvm_htab_read(struct file *file, char __user *buf,
1288 /* Skip uninteresting entries, i.e. clean on not-first pass */ 1372 /* Skip uninteresting entries, i.e. clean on not-first pass */
1289 if (!first_pass) { 1373 if (!first_pass) {
1290 while (i < kvm->arch.hpt_npte && 1374 while (i < kvm->arch.hpt_npte &&
1291 !(revp->guest_rpte & HPTE_GR_MODIFIED)) { 1375 !hpte_dirty(revp, hptp)) {
1292 ++i; 1376 ++i;
1293 hptp += 2; 1377 hptp += 2;
1294 ++revp; 1378 ++revp;
@@ -1467,7 +1551,7 @@ static int kvm_htab_release(struct inode *inode, struct file *filp)
1467 return 0; 1551 return 0;
1468} 1552}
1469 1553
1470static struct file_operations kvm_htab_fops = { 1554static const struct file_operations kvm_htab_fops = {
1471 .read = kvm_htab_read, 1555 .read = kvm_htab_read,
1472 .write = kvm_htab_write, 1556 .write = kvm_htab_write,
1473 .llseek = default_llseek, 1557 .llseek = default_llseek,
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index 72ffc899c082..b2d3f3b2de72 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -92,7 +92,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp)
92 return 0; 92 return 0;
93} 93}
94 94
95static struct file_operations kvm_spapr_tce_fops = { 95static const struct file_operations kvm_spapr_tce_fops = {
96 .mmap = kvm_spapr_tce_mmap, 96 .mmap = kvm_spapr_tce_mmap,
97 .release = kvm_spapr_tce_release, 97 .release = kvm_spapr_tce_release,
98}; 98};
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index 836c56975e21..1f6344c4408d 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -194,7 +194,9 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
194 run->papr_hcall.args[i] = gpr; 194 run->papr_hcall.args[i] = gpr;
195 } 195 }
196 196
197 emulated = EMULATE_DO_PAPR; 197 run->exit_reason = KVM_EXIT_PAPR_HCALL;
198 vcpu->arch.hcall_needed = 1;
199 emulated = EMULATE_EXIT_USER;
198 break; 200 break;
199 } 201 }
200#endif 202#endif
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 80dcc53a1aba..9de24f8e03c7 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -66,6 +66,31 @@
66static void kvmppc_end_cede(struct kvm_vcpu *vcpu); 66static void kvmppc_end_cede(struct kvm_vcpu *vcpu);
67static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu); 67static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu);
68 68
69void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu)
70{
71 int me;
72 int cpu = vcpu->cpu;
73 wait_queue_head_t *wqp;
74
75 wqp = kvm_arch_vcpu_wq(vcpu);
76 if (waitqueue_active(wqp)) {
77 wake_up_interruptible(wqp);
78 ++vcpu->stat.halt_wakeup;
79 }
80
81 me = get_cpu();
82
83 /* CPU points to the first thread of the core */
84 if (cpu != me && cpu >= 0 && cpu < nr_cpu_ids) {
85 int real_cpu = cpu + vcpu->arch.ptid;
86 if (paca[real_cpu].kvm_hstate.xics_phys)
87 xics_wake_cpu(real_cpu);
88 else if (cpu_online(cpu))
89 smp_send_reschedule(cpu);
90 }
91 put_cpu();
92}
93
69/* 94/*
70 * We use the vcpu_load/put functions to measure stolen time. 95 * We use the vcpu_load/put functions to measure stolen time.
71 * Stolen time is counted as time when either the vcpu is able to 96 * Stolen time is counted as time when either the vcpu is able to
@@ -259,7 +284,7 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu,
259 len = ((struct reg_vpa *)va)->length.hword; 284 len = ((struct reg_vpa *)va)->length.hword;
260 else 285 else
261 len = ((struct reg_vpa *)va)->length.word; 286 len = ((struct reg_vpa *)va)->length.word;
262 kvmppc_unpin_guest_page(kvm, va); 287 kvmppc_unpin_guest_page(kvm, va, vpa, false);
263 288
264 /* Check length */ 289 /* Check length */
265 if (len > nb || len < sizeof(struct reg_vpa)) 290 if (len > nb || len < sizeof(struct reg_vpa))
@@ -359,13 +384,13 @@ static void kvmppc_update_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *vpap)
359 va = NULL; 384 va = NULL;
360 nb = 0; 385 nb = 0;
361 if (gpa) 386 if (gpa)
362 va = kvmppc_pin_guest_page(kvm, vpap->next_gpa, &nb); 387 va = kvmppc_pin_guest_page(kvm, gpa, &nb);
363 spin_lock(&vcpu->arch.vpa_update_lock); 388 spin_lock(&vcpu->arch.vpa_update_lock);
364 if (gpa == vpap->next_gpa) 389 if (gpa == vpap->next_gpa)
365 break; 390 break;
366 /* sigh... unpin that one and try again */ 391 /* sigh... unpin that one and try again */
367 if (va) 392 if (va)
368 kvmppc_unpin_guest_page(kvm, va); 393 kvmppc_unpin_guest_page(kvm, va, gpa, false);
369 } 394 }
370 395
371 vpap->update_pending = 0; 396 vpap->update_pending = 0;
@@ -375,12 +400,15 @@ static void kvmppc_update_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *vpap)
375 * has changed the mappings underlying guest memory, 400 * has changed the mappings underlying guest memory,
376 * so unregister the region. 401 * so unregister the region.
377 */ 402 */
378 kvmppc_unpin_guest_page(kvm, va); 403 kvmppc_unpin_guest_page(kvm, va, gpa, false);
379 va = NULL; 404 va = NULL;
380 } 405 }
381 if (vpap->pinned_addr) 406 if (vpap->pinned_addr)
382 kvmppc_unpin_guest_page(kvm, vpap->pinned_addr); 407 kvmppc_unpin_guest_page(kvm, vpap->pinned_addr, vpap->gpa,
408 vpap->dirty);
409 vpap->gpa = gpa;
383 vpap->pinned_addr = va; 410 vpap->pinned_addr = va;
411 vpap->dirty = false;
384 if (va) 412 if (va)
385 vpap->pinned_end = va + vpap->len; 413 vpap->pinned_end = va + vpap->len;
386} 414}
@@ -472,6 +500,7 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
472 /* order writing *dt vs. writing vpa->dtl_idx */ 500 /* order writing *dt vs. writing vpa->dtl_idx */
473 smp_wmb(); 501 smp_wmb();
474 vpa->dtl_idx = ++vcpu->arch.dtl_index; 502 vpa->dtl_idx = ++vcpu->arch.dtl_index;
503 vcpu->arch.dtl.dirty = true;
475} 504}
476 505
477int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) 506int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
@@ -479,7 +508,7 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
479 unsigned long req = kvmppc_get_gpr(vcpu, 3); 508 unsigned long req = kvmppc_get_gpr(vcpu, 3);
480 unsigned long target, ret = H_SUCCESS; 509 unsigned long target, ret = H_SUCCESS;
481 struct kvm_vcpu *tvcpu; 510 struct kvm_vcpu *tvcpu;
482 int idx; 511 int idx, rc;
483 512
484 switch (req) { 513 switch (req) {
485 case H_ENTER: 514 case H_ENTER:
@@ -515,6 +544,28 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
515 kvmppc_get_gpr(vcpu, 5), 544 kvmppc_get_gpr(vcpu, 5),
516 kvmppc_get_gpr(vcpu, 6)); 545 kvmppc_get_gpr(vcpu, 6));
517 break; 546 break;
547 case H_RTAS:
548 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
549 return RESUME_HOST;
550
551 rc = kvmppc_rtas_hcall(vcpu);
552
553 if (rc == -ENOENT)
554 return RESUME_HOST;
555 else if (rc == 0)
556 break;
557
558 /* Send the error out to userspace via KVM_RUN */
559 return rc;
560
561 case H_XIRR:
562 case H_CPPR:
563 case H_EOI:
564 case H_IPI:
565 if (kvmppc_xics_enabled(vcpu)) {
566 ret = kvmppc_xics_hcall(vcpu, req);
567 break;
568 } /* fallthrough */
518 default: 569 default:
519 return RESUME_HOST; 570 return RESUME_HOST;
520 } 571 }
@@ -913,15 +964,19 @@ out:
913 return ERR_PTR(err); 964 return ERR_PTR(err);
914} 965}
915 966
967static void unpin_vpa(struct kvm *kvm, struct kvmppc_vpa *vpa)
968{
969 if (vpa->pinned_addr)
970 kvmppc_unpin_guest_page(kvm, vpa->pinned_addr, vpa->gpa,
971 vpa->dirty);
972}
973
916void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) 974void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
917{ 975{
918 spin_lock(&vcpu->arch.vpa_update_lock); 976 spin_lock(&vcpu->arch.vpa_update_lock);
919 if (vcpu->arch.dtl.pinned_addr) 977 unpin_vpa(vcpu->kvm, &vcpu->arch.dtl);
920 kvmppc_unpin_guest_page(vcpu->kvm, vcpu->arch.dtl.pinned_addr); 978 unpin_vpa(vcpu->kvm, &vcpu->arch.slb_shadow);
921 if (vcpu->arch.slb_shadow.pinned_addr) 979 unpin_vpa(vcpu->kvm, &vcpu->arch.vpa);
922 kvmppc_unpin_guest_page(vcpu->kvm, vcpu->arch.slb_shadow.pinned_addr);
923 if (vcpu->arch.vpa.pinned_addr)
924 kvmppc_unpin_guest_page(vcpu->kvm, vcpu->arch.vpa.pinned_addr);
925 spin_unlock(&vcpu->arch.vpa_update_lock); 980 spin_unlock(&vcpu->arch.vpa_update_lock);
926 kvm_vcpu_uninit(vcpu); 981 kvm_vcpu_uninit(vcpu);
927 kmem_cache_free(kvm_vcpu_cache, vcpu); 982 kmem_cache_free(kvm_vcpu_cache, vcpu);
@@ -955,7 +1010,6 @@ static void kvmppc_end_cede(struct kvm_vcpu *vcpu)
955} 1010}
956 1011
957extern int __kvmppc_vcore_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 1012extern int __kvmppc_vcore_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
958extern void xics_wake_cpu(int cpu);
959 1013
960static void kvmppc_remove_runnable(struct kvmppc_vcore *vc, 1014static void kvmppc_remove_runnable(struct kvmppc_vcore *vc,
961 struct kvm_vcpu *vcpu) 1015 struct kvm_vcpu *vcpu)
@@ -1330,9 +1384,12 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1330 break; 1384 break;
1331 vc->runner = vcpu; 1385 vc->runner = vcpu;
1332 n_ceded = 0; 1386 n_ceded = 0;
1333 list_for_each_entry(v, &vc->runnable_threads, arch.run_list) 1387 list_for_each_entry(v, &vc->runnable_threads, arch.run_list) {
1334 if (!v->arch.pending_exceptions) 1388 if (!v->arch.pending_exceptions)
1335 n_ceded += v->arch.ceded; 1389 n_ceded += v->arch.ceded;
1390 else
1391 v->arch.ceded = 0;
1392 }
1336 if (n_ceded == vc->n_runnable) 1393 if (n_ceded == vc->n_runnable)
1337 kvmppc_vcore_blocked(vc); 1394 kvmppc_vcore_blocked(vc);
1338 else 1395 else
@@ -1483,7 +1540,7 @@ static int kvm_rma_release(struct inode *inode, struct file *filp)
1483 return 0; 1540 return 0;
1484} 1541}
1485 1542
1486static struct file_operations kvm_rma_fops = { 1543static const struct file_operations kvm_rma_fops = {
1487 .mmap = kvm_rma_mmap, 1544 .mmap = kvm_rma_mmap,
1488 .release = kvm_rma_release, 1545 .release = kvm_rma_release,
1489}; 1546};
@@ -1515,7 +1572,13 @@ static void kvmppc_add_seg_page_size(struct kvm_ppc_one_seg_page_size **sps,
1515 (*sps)->page_shift = def->shift; 1572 (*sps)->page_shift = def->shift;
1516 (*sps)->slb_enc = def->sllp; 1573 (*sps)->slb_enc = def->sllp;
1517 (*sps)->enc[0].page_shift = def->shift; 1574 (*sps)->enc[0].page_shift = def->shift;
1518 (*sps)->enc[0].pte_enc = def->penc; 1575 /*
1576 * Only return base page encoding. We don't want to return
1577 * all the supporting pte_enc, because our H_ENTER doesn't
1578 * support MPSS yet. Once they do, we can start passing all
1579 * support pte_enc here
1580 */
1581 (*sps)->enc[0].pte_enc = def->penc[linux_psize];
1519 (*sps)++; 1582 (*sps)++;
1520} 1583}
1521 1584
@@ -1639,12 +1702,12 @@ int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1639 1702
1640void kvmppc_core_commit_memory_region(struct kvm *kvm, 1703void kvmppc_core_commit_memory_region(struct kvm *kvm,
1641 struct kvm_userspace_memory_region *mem, 1704 struct kvm_userspace_memory_region *mem,
1642 struct kvm_memory_slot old) 1705 const struct kvm_memory_slot *old)
1643{ 1706{
1644 unsigned long npages = mem->memory_size >> PAGE_SHIFT; 1707 unsigned long npages = mem->memory_size >> PAGE_SHIFT;
1645 struct kvm_memory_slot *memslot; 1708 struct kvm_memory_slot *memslot;
1646 1709
1647 if (npages && old.npages) { 1710 if (npages && old->npages) {
1648 /* 1711 /*
1649 * If modifying a memslot, reset all the rmap dirty bits. 1712 * If modifying a memslot, reset all the rmap dirty bits.
1650 * If this is a new memslot, we don't need to do anything 1713 * If this is a new memslot, we don't need to do anything
@@ -1821,6 +1884,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1821 cpumask_setall(&kvm->arch.need_tlb_flush); 1884 cpumask_setall(&kvm->arch.need_tlb_flush);
1822 1885
1823 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables); 1886 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
1887 INIT_LIST_HEAD(&kvm->arch.rtas_tokens);
1824 1888
1825 kvm->arch.rma = NULL; 1889 kvm->arch.rma = NULL;
1826 1890
@@ -1866,6 +1930,8 @@ void kvmppc_core_destroy_vm(struct kvm *kvm)
1866 kvm->arch.rma = NULL; 1930 kvm->arch.rma = NULL;
1867 } 1931 }
1868 1932
1933 kvmppc_rtas_tokens_free(kvm);
1934
1869 kvmppc_free_hpt(kvm); 1935 kvmppc_free_hpt(kvm);
1870 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables)); 1936 WARN_ON(!list_empty(&kvm->arch.spapr_tce_tables));
1871} 1937}
diff --git a/arch/powerpc/kvm/book3s_hv_interrupts.S b/arch/powerpc/kvm/book3s_hv_interrupts.S
index 84035a528c80..37f1cc417ca0 100644
--- a/arch/powerpc/kvm/book3s_hv_interrupts.S
+++ b/arch/powerpc/kvm/book3s_hv_interrupts.S
@@ -122,11 +122,16 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
122 add r8,r8,r7 122 add r8,r8,r7
123 std r8,HSTATE_DECEXP(r13) 123 std r8,HSTATE_DECEXP(r13)
124 124
125#ifdef CONFIG_SMP
125 /* 126 /*
126 * On PPC970, if the guest vcpu has an external interrupt pending, 127 * On PPC970, if the guest vcpu has an external interrupt pending,
127 * send ourselves an IPI so as to interrupt the guest once it 128 * send ourselves an IPI so as to interrupt the guest once it
128 * enables interrupts. (It must have interrupts disabled, 129 * enables interrupts. (It must have interrupts disabled,
129 * otherwise we would already have delivered the interrupt.) 130 * otherwise we would already have delivered the interrupt.)
131 *
132 * XXX If this is a UP build, smp_send_reschedule is not available,
133 * so the interrupt will be delayed until the next time the vcpu
134 * enters the guest with interrupts enabled.
130 */ 135 */
131BEGIN_FTR_SECTION 136BEGIN_FTR_SECTION
132 ld r0, VCPU_PENDING_EXC(r4) 137 ld r0, VCPU_PENDING_EXC(r4)
@@ -141,6 +146,7 @@ BEGIN_FTR_SECTION
141 mr r4, r31 146 mr r4, r31
14232: 14732:
143END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) 148END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
149#endif /* CONFIG_SMP */
144 150
145 /* Jump to partition switch code */ 151 /* Jump to partition switch code */
146 bl .kvmppc_hv_entry_trampoline 152 bl .kvmppc_hv_entry_trampoline
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 19c93bae1aea..6dcbb49105a4 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -97,17 +97,6 @@ void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
97} 97}
98EXPORT_SYMBOL_GPL(kvmppc_add_revmap_chain); 98EXPORT_SYMBOL_GPL(kvmppc_add_revmap_chain);
99 99
100/*
101 * Note modification of an HPTE; set the HPTE modified bit
102 * if anyone is interested.
103 */
104static inline void note_hpte_modification(struct kvm *kvm,
105 struct revmap_entry *rev)
106{
107 if (atomic_read(&kvm->arch.hpte_mod_interest))
108 rev->guest_rpte |= HPTE_GR_MODIFIED;
109}
110
111/* Remove this HPTE from the chain for a real page */ 100/* Remove this HPTE from the chain for a real page */
112static void remove_revmap_chain(struct kvm *kvm, long pte_index, 101static void remove_revmap_chain(struct kvm *kvm, long pte_index,
113 struct revmap_entry *rev, 102 struct revmap_entry *rev,
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
new file mode 100644
index 000000000000..b4b0082f761c
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -0,0 +1,406 @@
1/*
2 * Copyright 2012 Michael Ellerman, IBM Corporation.
3 * Copyright 2012 Benjamin Herrenschmidt, IBM Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2, as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/kernel.h>
11#include <linux/kvm_host.h>
12#include <linux/err.h>
13
14#include <asm/kvm_book3s.h>
15#include <asm/kvm_ppc.h>
16#include <asm/hvcall.h>
17#include <asm/xics.h>
18#include <asm/debug.h>
19#include <asm/synch.h>
20#include <asm/ppc-opcode.h>
21
22#include "book3s_xics.h"
23
24#define DEBUG_PASSUP
25
26static inline void rm_writeb(unsigned long paddr, u8 val)
27{
28 __asm__ __volatile__("sync; stbcix %0,0,%1"
29 : : "r" (val), "r" (paddr) : "memory");
30}
31
32static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu,
33 struct kvm_vcpu *this_vcpu)
34{
35 struct kvmppc_icp *this_icp = this_vcpu->arch.icp;
36 unsigned long xics_phys;
37 int cpu;
38
39 /* Mark the target VCPU as having an interrupt pending */
40 vcpu->stat.queue_intr++;
41 set_bit(BOOK3S_IRQPRIO_EXTERNAL_LEVEL, &vcpu->arch.pending_exceptions);
42
43 /* Kick self ? Just set MER and return */
44 if (vcpu == this_vcpu) {
45 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) | LPCR_MER);
46 return;
47 }
48
49 /* Check if the core is loaded, if not, too hard */
50 cpu = vcpu->cpu;
51 if (cpu < 0 || cpu >= nr_cpu_ids) {
52 this_icp->rm_action |= XICS_RM_KICK_VCPU;
53 this_icp->rm_kick_target = vcpu;
54 return;
55 }
56 /* In SMT cpu will always point to thread 0, we adjust it */
57 cpu += vcpu->arch.ptid;
58
59 /* Not too hard, then poke the target */
60 xics_phys = paca[cpu].kvm_hstate.xics_phys;
61 rm_writeb(xics_phys + XICS_MFRR, IPI_PRIORITY);
62}
63
64static void icp_rm_clr_vcpu_irq(struct kvm_vcpu *vcpu)
65{
66 /* Note: Only called on self ! */
67 clear_bit(BOOK3S_IRQPRIO_EXTERNAL_LEVEL,
68 &vcpu->arch.pending_exceptions);
69 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~LPCR_MER);
70}
71
72static inline bool icp_rm_try_update(struct kvmppc_icp *icp,
73 union kvmppc_icp_state old,
74 union kvmppc_icp_state new)
75{
76 struct kvm_vcpu *this_vcpu = local_paca->kvm_hstate.kvm_vcpu;
77 bool success;
78
79 /* Calculate new output value */
80 new.out_ee = (new.xisr && (new.pending_pri < new.cppr));
81
82 /* Attempt atomic update */
83 success = cmpxchg64(&icp->state.raw, old.raw, new.raw) == old.raw;
84 if (!success)
85 goto bail;
86
87 /*
88 * Check for output state update
89 *
90 * Note that this is racy since another processor could be updating
91 * the state already. This is why we never clear the interrupt output
92 * here, we only ever set it. The clear only happens prior to doing
93 * an update and only by the processor itself. Currently we do it
94 * in Accept (H_XIRR) and Up_Cppr (H_XPPR).
95 *
96 * We also do not try to figure out whether the EE state has changed,
97 * we unconditionally set it if the new state calls for it. The reason
98 * for that is that we opportunistically remove the pending interrupt
99 * flag when raising CPPR, so we need to set it back here if an
100 * interrupt is still pending.
101 */
102 if (new.out_ee)
103 icp_rm_set_vcpu_irq(icp->vcpu, this_vcpu);
104
105 /* Expose the state change for debug purposes */
106 this_vcpu->arch.icp->rm_dbgstate = new;
107 this_vcpu->arch.icp->rm_dbgtgt = icp->vcpu;
108
109 bail:
110 return success;
111}
112
113static inline int check_too_hard(struct kvmppc_xics *xics,
114 struct kvmppc_icp *icp)
115{
116 return (xics->real_mode_dbg || icp->rm_action) ? H_TOO_HARD : H_SUCCESS;
117}
118
119static void icp_rm_down_cppr(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
120 u8 new_cppr)
121{
122 union kvmppc_icp_state old_state, new_state;
123 bool resend;
124
125 /*
126 * This handles several related states in one operation:
127 *
128 * ICP State: Down_CPPR
129 *
130 * Load CPPR with new value and if the XISR is 0
131 * then check for resends:
132 *
133 * ICP State: Resend
134 *
135 * If MFRR is more favored than CPPR, check for IPIs
136 * and notify ICS of a potential resend. This is done
137 * asynchronously (when used in real mode, we will have
138 * to exit here).
139 *
140 * We do not handle the complete Check_IPI as documented
141 * here. In the PAPR, this state will be used for both
142 * Set_MFRR and Down_CPPR. However, we know that we aren't
143 * changing the MFRR state here so we don't need to handle
144 * the case of an MFRR causing a reject of a pending irq,
145 * this will have been handled when the MFRR was set in the
146 * first place.
147 *
148 * Thus we don't have to handle rejects, only resends.
149 *
150 * When implementing real mode for HV KVM, resend will lead to
151 * a H_TOO_HARD return and the whole transaction will be handled
152 * in virtual mode.
153 */
154 do {
155 old_state = new_state = ACCESS_ONCE(icp->state);
156
157 /* Down_CPPR */
158 new_state.cppr = new_cppr;
159
160 /*
161 * Cut down Resend / Check_IPI / IPI
162 *
163 * The logic is that we cannot have a pending interrupt
164 * trumped by an IPI at this point (see above), so we
165 * know that either the pending interrupt is already an
166 * IPI (in which case we don't care to override it) or
167 * it's either more favored than us or non existent
168 */
169 if (new_state.mfrr < new_cppr &&
170 new_state.mfrr <= new_state.pending_pri) {
171 new_state.pending_pri = new_state.mfrr;
172 new_state.xisr = XICS_IPI;
173 }
174
175 /* Latch/clear resend bit */
176 resend = new_state.need_resend;
177 new_state.need_resend = 0;
178
179 } while (!icp_rm_try_update(icp, old_state, new_state));
180
181 /*
182 * Now handle resend checks. Those are asynchronous to the ICP
183 * state update in HW (ie bus transactions) so we can handle them
184 * separately here as well.
185 */
186 if (resend)
187 icp->rm_action |= XICS_RM_CHECK_RESEND;
188}
189
190
191unsigned long kvmppc_rm_h_xirr(struct kvm_vcpu *vcpu)
192{
193 union kvmppc_icp_state old_state, new_state;
194 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
195 struct kvmppc_icp *icp = vcpu->arch.icp;
196 u32 xirr;
197
198 if (!xics || !xics->real_mode)
199 return H_TOO_HARD;
200
201 /* First clear the interrupt */
202 icp_rm_clr_vcpu_irq(icp->vcpu);
203
204 /*
205 * ICP State: Accept_Interrupt
206 *
207 * Return the pending interrupt (if any) along with the
208 * current CPPR, then clear the XISR & set CPPR to the
209 * pending priority
210 */
211 do {
212 old_state = new_state = ACCESS_ONCE(icp->state);
213
214 xirr = old_state.xisr | (((u32)old_state.cppr) << 24);
215 if (!old_state.xisr)
216 break;
217 new_state.cppr = new_state.pending_pri;
218 new_state.pending_pri = 0xff;
219 new_state.xisr = 0;
220
221 } while (!icp_rm_try_update(icp, old_state, new_state));
222
223 /* Return the result in GPR4 */
224 vcpu->arch.gpr[4] = xirr;
225
226 return check_too_hard(xics, icp);
227}
228
229int kvmppc_rm_h_ipi(struct kvm_vcpu *vcpu, unsigned long server,
230 unsigned long mfrr)
231{
232 union kvmppc_icp_state old_state, new_state;
233 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
234 struct kvmppc_icp *icp, *this_icp = vcpu->arch.icp;
235 u32 reject;
236 bool resend;
237 bool local;
238
239 if (!xics || !xics->real_mode)
240 return H_TOO_HARD;
241
242 local = this_icp->server_num == server;
243 if (local)
244 icp = this_icp;
245 else
246 icp = kvmppc_xics_find_server(vcpu->kvm, server);
247 if (!icp)
248 return H_PARAMETER;
249
250 /*
251 * ICP state: Set_MFRR
252 *
253 * If the CPPR is more favored than the new MFRR, then
254 * nothing needs to be done as there can be no XISR to
255 * reject.
256 *
257 * If the CPPR is less favored, then we might be replacing
258 * an interrupt, and thus need to possibly reject it as in
259 *
260 * ICP state: Check_IPI
261 */
262 do {
263 old_state = new_state = ACCESS_ONCE(icp->state);
264
265 /* Set_MFRR */
266 new_state.mfrr = mfrr;
267
268 /* Check_IPI */
269 reject = 0;
270 resend = false;
271 if (mfrr < new_state.cppr) {
272 /* Reject a pending interrupt if not an IPI */
273 if (mfrr <= new_state.pending_pri)
274 reject = new_state.xisr;
275 new_state.pending_pri = mfrr;
276 new_state.xisr = XICS_IPI;
277 }
278
279 if (mfrr > old_state.mfrr && mfrr > new_state.cppr) {
280 resend = new_state.need_resend;
281 new_state.need_resend = 0;
282 }
283 } while (!icp_rm_try_update(icp, old_state, new_state));
284
285 /* Pass rejects to virtual mode */
286 if (reject && reject != XICS_IPI) {
287 this_icp->rm_action |= XICS_RM_REJECT;
288 this_icp->rm_reject = reject;
289 }
290
291 /* Pass resends to virtual mode */
292 if (resend)
293 this_icp->rm_action |= XICS_RM_CHECK_RESEND;
294
295 return check_too_hard(xics, this_icp);
296}
297
298int kvmppc_rm_h_cppr(struct kvm_vcpu *vcpu, unsigned long cppr)
299{
300 union kvmppc_icp_state old_state, new_state;
301 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
302 struct kvmppc_icp *icp = vcpu->arch.icp;
303 u32 reject;
304
305 if (!xics || !xics->real_mode)
306 return H_TOO_HARD;
307
308 /*
309 * ICP State: Set_CPPR
310 *
311 * We can safely compare the new value with the current
312 * value outside of the transaction as the CPPR is only
313 * ever changed by the processor on itself
314 */
315 if (cppr > icp->state.cppr) {
316 icp_rm_down_cppr(xics, icp, cppr);
317 goto bail;
318 } else if (cppr == icp->state.cppr)
319 return H_SUCCESS;
320
321 /*
322 * ICP State: Up_CPPR
323 *
324 * The processor is raising its priority, this can result
325 * in a rejection of a pending interrupt:
326 *
327 * ICP State: Reject_Current
328 *
329 * We can remove EE from the current processor, the update
330 * transaction will set it again if needed
331 */
332 icp_rm_clr_vcpu_irq(icp->vcpu);
333
334 do {
335 old_state = new_state = ACCESS_ONCE(icp->state);
336
337 reject = 0;
338 new_state.cppr = cppr;
339
340 if (cppr <= new_state.pending_pri) {
341 reject = new_state.xisr;
342 new_state.xisr = 0;
343 new_state.pending_pri = 0xff;
344 }
345
346 } while (!icp_rm_try_update(icp, old_state, new_state));
347
348 /* Pass rejects to virtual mode */
349 if (reject && reject != XICS_IPI) {
350 icp->rm_action |= XICS_RM_REJECT;
351 icp->rm_reject = reject;
352 }
353 bail:
354 return check_too_hard(xics, icp);
355}
356
357int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
358{
359 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
360 struct kvmppc_icp *icp = vcpu->arch.icp;
361 struct kvmppc_ics *ics;
362 struct ics_irq_state *state;
363 u32 irq = xirr & 0x00ffffff;
364 u16 src;
365
366 if (!xics || !xics->real_mode)
367 return H_TOO_HARD;
368
369 /*
370 * ICP State: EOI
371 *
372 * Note: If EOI is incorrectly used by SW to lower the CPPR
373 * value (ie more favored), we do not check for rejection of
374 * a pending interrupt, this is a SW error and PAPR sepcifies
375 * that we don't have to deal with it.
376 *
377 * The sending of an EOI to the ICS is handled after the
378 * CPPR update
379 *
380 * ICP State: Down_CPPR which we handle
381 * in a separate function as it's shared with H_CPPR.
382 */
383 icp_rm_down_cppr(xics, icp, xirr >> 24);
384
385 /* IPIs have no EOI */
386 if (irq == XICS_IPI)
387 goto bail;
388 /*
389 * EOI handling: If the interrupt is still asserted, we need to
390 * resend it. We can take a lockless "peek" at the ICS state here.
391 *
392 * "Message" interrupts will never have "asserted" set
393 */
394 ics = kvmppc_xics_find_ics(xics, irq, &src);
395 if (!ics)
396 goto bail;
397 state = &ics->irq_state[src];
398
399 /* Still asserted, resend it, we make it look like a reject */
400 if (state->asserted) {
401 icp->rm_action |= XICS_RM_REJECT;
402 icp->rm_reject = irq;
403 }
404 bail:
405 return check_too_hard(xics, icp);
406}
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index e33d11f1b977..b02f91e4c70d 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -79,10 +79,6 @@ _GLOBAL(kvmppc_hv_entry_trampoline)
79 * * 79 * *
80 *****************************************************************************/ 80 *****************************************************************************/
81 81
82#define XICS_XIRR 4
83#define XICS_QIRR 0xc
84#define XICS_IPI 2 /* interrupt source # for IPIs */
85
86/* 82/*
87 * We come in here when wakened from nap mode on a secondary hw thread. 83 * We come in here when wakened from nap mode on a secondary hw thread.
88 * Relocation is off and most register values are lost. 84 * Relocation is off and most register values are lost.
@@ -101,50 +97,51 @@ kvm_start_guest:
101 li r0,1 97 li r0,1
102 stb r0,PACA_NAPSTATELOST(r13) 98 stb r0,PACA_NAPSTATELOST(r13)
103 99
104 /* get vcpu pointer, NULL if we have no vcpu to run */ 100 /* were we napping due to cede? */
105 ld r4,HSTATE_KVM_VCPU(r13) 101 lbz r0,HSTATE_NAPPING(r13)
106 cmpdi cr1,r4,0 102 cmpwi r0,0
103 bne kvm_end_cede
104
105 /*
106 * We weren't napping due to cede, so this must be a secondary
107 * thread being woken up to run a guest, or being woken up due
108 * to a stray IPI. (Or due to some machine check or hypervisor
109 * maintenance interrupt while the core is in KVM.)
110 */
107 111
108 /* Check the wake reason in SRR1 to see why we got here */ 112 /* Check the wake reason in SRR1 to see why we got here */
109 mfspr r3,SPRN_SRR1 113 mfspr r3,SPRN_SRR1
110 rlwinm r3,r3,44-31,0x7 /* extract wake reason field */ 114 rlwinm r3,r3,44-31,0x7 /* extract wake reason field */
111 cmpwi r3,4 /* was it an external interrupt? */ 115 cmpwi r3,4 /* was it an external interrupt? */
112 bne 27f 116 bne 27f /* if not */
113 117 ld r5,HSTATE_XICS_PHYS(r13)
114 /* 118 li r7,XICS_XIRR /* if it was an external interrupt, */
115 * External interrupt - for now assume it is an IPI, since we
116 * should never get any other interrupts sent to offline threads.
117 * Only do this for secondary threads.
118 */
119 beq cr1,25f
120 lwz r3,VCPU_PTID(r4)
121 cmpwi r3,0
122 beq 27f
12325: ld r5,HSTATE_XICS_PHYS(r13)
124 li r0,0xff
125 li r6,XICS_QIRR
126 li r7,XICS_XIRR
127 lwzcix r8,r5,r7 /* get and ack the interrupt */ 119 lwzcix r8,r5,r7 /* get and ack the interrupt */
128 sync 120 sync
129 clrldi. r9,r8,40 /* get interrupt source ID. */ 121 clrldi. r9,r8,40 /* get interrupt source ID. */
130 beq 27f /* none there? */ 122 beq 28f /* none there? */
131 cmpwi r9,XICS_IPI 123 cmpwi r9,XICS_IPI /* was it an IPI? */
132 bne 26f 124 bne 29f
125 li r0,0xff
126 li r6,XICS_MFRR
133 stbcix r0,r5,r6 /* clear IPI */ 127 stbcix r0,r5,r6 /* clear IPI */
13426: stwcix r8,r5,r7 /* EOI the interrupt */ 128 stwcix r8,r5,r7 /* EOI the interrupt */
135 129 sync /* order loading of vcpu after that */
13627: /* XXX should handle hypervisor maintenance interrupts etc. here */
137 130
138 /* reload vcpu pointer after clearing the IPI */ 131 /* get vcpu pointer, NULL if we have no vcpu to run */
139 ld r4,HSTATE_KVM_VCPU(r13) 132 ld r4,HSTATE_KVM_VCPU(r13)
140 cmpdi r4,0 133 cmpdi r4,0
141 /* if we have no vcpu to run, go back to sleep */ 134 /* if we have no vcpu to run, go back to sleep */
142 beq kvm_no_guest 135 beq kvm_no_guest
136 b kvmppc_hv_entry
143 137
144 /* were we napping due to cede? */ 13827: /* XXX should handle hypervisor maintenance interrupts etc. here */
145 lbz r0,HSTATE_NAPPING(r13) 139 b kvm_no_guest
146 cmpwi r0,0 14028: /* SRR1 said external but ICP said nope?? */
147 bne kvm_end_cede 141 b kvm_no_guest
14229: /* External non-IPI interrupt to offline secondary thread? help?? */
143 stw r8,HSTATE_SAVED_XIRR(r13)
144 b kvm_no_guest
148 145
149.global kvmppc_hv_entry 146.global kvmppc_hv_entry
150kvmppc_hv_entry: 147kvmppc_hv_entry:
@@ -260,6 +257,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
260 lwz r5, LPPACA_YIELDCOUNT(r3) 257 lwz r5, LPPACA_YIELDCOUNT(r3)
261 addi r5, r5, 1 258 addi r5, r5, 1
262 stw r5, LPPACA_YIELDCOUNT(r3) 259 stw r5, LPPACA_YIELDCOUNT(r3)
260 li r6, 1
261 stb r6, VCPU_VPA_DIRTY(r4)
26325: 26225:
264 /* Load up DAR and DSISR */ 263 /* Load up DAR and DSISR */
265 ld r5, VCPU_DAR(r4) 264 ld r5, VCPU_DAR(r4)
@@ -485,20 +484,20 @@ toc_tlbie_lock:
485 mtctr r6 484 mtctr r6
486 mtxer r7 485 mtxer r7
487 486
487 ld r10, VCPU_PC(r4)
488 ld r11, VCPU_MSR(r4)
488kvmppc_cede_reentry: /* r4 = vcpu, r13 = paca */ 489kvmppc_cede_reentry: /* r4 = vcpu, r13 = paca */
489 ld r6, VCPU_SRR0(r4) 490 ld r6, VCPU_SRR0(r4)
490 ld r7, VCPU_SRR1(r4) 491 ld r7, VCPU_SRR1(r4)
491 ld r10, VCPU_PC(r4)
492 ld r11, VCPU_MSR(r4) /* r11 = vcpu->arch.msr & ~MSR_HV */
493 492
493 /* r11 = vcpu->arch.msr & ~MSR_HV */
494 rldicl r11, r11, 63 - MSR_HV_LG, 1 494 rldicl r11, r11, 63 - MSR_HV_LG, 1
495 rotldi r11, r11, 1 + MSR_HV_LG 495 rotldi r11, r11, 1 + MSR_HV_LG
496 ori r11, r11, MSR_ME 496 ori r11, r11, MSR_ME
497 497
498 /* Check if we can deliver an external or decrementer interrupt now */ 498 /* Check if we can deliver an external or decrementer interrupt now */
499 ld r0,VCPU_PENDING_EXC(r4) 499 ld r0,VCPU_PENDING_EXC(r4)
500 li r8,(1 << BOOK3S_IRQPRIO_EXTERNAL) 500 lis r8,(1 << BOOK3S_IRQPRIO_EXTERNAL_LEVEL)@h
501 oris r8,r8,(1 << BOOK3S_IRQPRIO_EXTERNAL_LEVEL)@h
502 and r0,r0,r8 501 and r0,r0,r8
503 cmpdi cr1,r0,0 502 cmpdi cr1,r0,0
504 andi. r0,r11,MSR_EE 503 andi. r0,r11,MSR_EE
@@ -526,10 +525,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
526 /* Move SRR0 and SRR1 into the respective regs */ 525 /* Move SRR0 and SRR1 into the respective regs */
5275: mtspr SPRN_SRR0, r6 5265: mtspr SPRN_SRR0, r6
528 mtspr SPRN_SRR1, r7 527 mtspr SPRN_SRR1, r7
529 li r0,0
530 stb r0,VCPU_CEDED(r4) /* cancel cede */
531 528
532fast_guest_return: 529fast_guest_return:
530 li r0,0
531 stb r0,VCPU_CEDED(r4) /* cancel cede */
533 mtspr SPRN_HSRR0,r10 532 mtspr SPRN_HSRR0,r10
534 mtspr SPRN_HSRR1,r11 533 mtspr SPRN_HSRR1,r11
535 534
@@ -676,17 +675,99 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
676 cmpwi r12,BOOK3S_INTERRUPT_SYSCALL 675 cmpwi r12,BOOK3S_INTERRUPT_SYSCALL
677 beq hcall_try_real_mode 676 beq hcall_try_real_mode
678 677
679 /* Check for mediated interrupts (could be done earlier really ...) */ 678 /* Only handle external interrupts here on arch 206 and later */
680BEGIN_FTR_SECTION 679BEGIN_FTR_SECTION
681 cmpwi r12,BOOK3S_INTERRUPT_EXTERNAL 680 b ext_interrupt_to_host
682 bne+ 1f 681END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
683 andi. r0,r11,MSR_EE 682
684 beq 1f 683 /* External interrupt ? */
685 mfspr r5,SPRN_LPCR 684 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
686 andi. r0,r5,LPCR_MER 685 bne+ ext_interrupt_to_host
687 bne bounce_ext_interrupt 686
6881: 687 /* External interrupt, first check for host_ipi. If this is
689END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 688 * set, we know the host wants us out so let's do it now
689 */
690do_ext_interrupt:
691 lbz r0, HSTATE_HOST_IPI(r13)
692 cmpwi r0, 0
693 bne ext_interrupt_to_host
694
695 /* Now read the interrupt from the ICP */
696 ld r5, HSTATE_XICS_PHYS(r13)
697 li r7, XICS_XIRR
698 cmpdi r5, 0
699 beq- ext_interrupt_to_host
700 lwzcix r3, r5, r7
701 rlwinm. r0, r3, 0, 0xffffff
702 sync
703 beq 3f /* if nothing pending in the ICP */
704
705 /* We found something in the ICP...
706 *
707 * If it's not an IPI, stash it in the PACA and return to
708 * the host, we don't (yet) handle directing real external
709 * interrupts directly to the guest
710 */
711 cmpwi r0, XICS_IPI
712 bne ext_stash_for_host
713
714 /* It's an IPI, clear the MFRR and EOI it */
715 li r0, 0xff
716 li r6, XICS_MFRR
717 stbcix r0, r5, r6 /* clear the IPI */
718 stwcix r3, r5, r7 /* EOI it */
719 sync
720
721 /* We need to re-check host IPI now in case it got set in the
722 * meantime. If it's clear, we bounce the interrupt to the
723 * guest
724 */
725 lbz r0, HSTATE_HOST_IPI(r13)
726 cmpwi r0, 0
727 bne- 1f
728
729 /* Allright, looks like an IPI for the guest, we need to set MER */
7303:
731 /* Check if any CPU is heading out to the host, if so head out too */
732 ld r5, HSTATE_KVM_VCORE(r13)
733 lwz r0, VCORE_ENTRY_EXIT(r5)
734 cmpwi r0, 0x100
735 bge ext_interrupt_to_host
736
737 /* See if there is a pending interrupt for the guest */
738 mfspr r8, SPRN_LPCR
739 ld r0, VCPU_PENDING_EXC(r9)
740 /* Insert EXTERNAL_LEVEL bit into LPCR at the MER bit position */
741 rldicl. r0, r0, 64 - BOOK3S_IRQPRIO_EXTERNAL_LEVEL, 63
742 rldimi r8, r0, LPCR_MER_SH, 63 - LPCR_MER_SH
743 beq 2f
744
745 /* And if the guest EE is set, we can deliver immediately, else
746 * we return to the guest with MER set
747 */
748 andi. r0, r11, MSR_EE
749 beq 2f
750 mtspr SPRN_SRR0, r10
751 mtspr SPRN_SRR1, r11
752 li r10, BOOK3S_INTERRUPT_EXTERNAL
753 li r11, (MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */
754 rotldi r11, r11, 63
7552: mr r4, r9
756 mtspr SPRN_LPCR, r8
757 b fast_guest_return
758
759 /* We raced with the host, we need to resend that IPI, bummer */
7601: li r0, IPI_PRIORITY
761 stbcix r0, r5, r6 /* set the IPI */
762 sync
763 b ext_interrupt_to_host
764
765ext_stash_for_host:
766 /* It's not an IPI and it's for the host, stash it in the PACA
767 * before exit, it will be picked up by the host ICP driver
768 */
769 stw r3, HSTATE_SAVED_XIRR(r13)
770ext_interrupt_to_host:
690 771
691guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */ 772guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */
692 /* Save DEC */ 773 /* Save DEC */
@@ -829,7 +910,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
829 beq 44f 910 beq 44f
830 ld r8,HSTATE_XICS_PHYS(r6) /* get thread's XICS reg addr */ 911 ld r8,HSTATE_XICS_PHYS(r6) /* get thread's XICS reg addr */
831 li r0,IPI_PRIORITY 912 li r0,IPI_PRIORITY
832 li r7,XICS_QIRR 913 li r7,XICS_MFRR
833 stbcix r0,r7,r8 /* trigger the IPI */ 914 stbcix r0,r7,r8 /* trigger the IPI */
83444: srdi. r3,r3,1 91544: srdi. r3,r3,1
835 addi r6,r6,PACA_SIZE 916 addi r6,r6,PACA_SIZE
@@ -1018,6 +1099,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1018 lwz r3, LPPACA_YIELDCOUNT(r8) 1099 lwz r3, LPPACA_YIELDCOUNT(r8)
1019 addi r3, r3, 1 1100 addi r3, r3, 1
1020 stw r3, LPPACA_YIELDCOUNT(r8) 1101 stw r3, LPPACA_YIELDCOUNT(r8)
1102 li r3, 1
1103 stb r3, VCPU_VPA_DIRTY(r9)
102125: 110425:
1022 /* Save PMU registers if requested */ 1105 /* Save PMU registers if requested */
1023 /* r8 and cr0.eq are live here */ 1106 /* r8 and cr0.eq are live here */
@@ -1350,11 +1433,19 @@ hcall_real_table:
1350 .long 0 /* 0x58 */ 1433 .long 0 /* 0x58 */
1351 .long 0 /* 0x5c */ 1434 .long 0 /* 0x5c */
1352 .long 0 /* 0x60 */ 1435 .long 0 /* 0x60 */
1353 .long 0 /* 0x64 */ 1436#ifdef CONFIG_KVM_XICS
1354 .long 0 /* 0x68 */ 1437 .long .kvmppc_rm_h_eoi - hcall_real_table
1355 .long 0 /* 0x6c */ 1438 .long .kvmppc_rm_h_cppr - hcall_real_table
1356 .long 0 /* 0x70 */ 1439 .long .kvmppc_rm_h_ipi - hcall_real_table
1357 .long 0 /* 0x74 */ 1440 .long 0 /* 0x70 - H_IPOLL */
1441 .long .kvmppc_rm_h_xirr - hcall_real_table
1442#else
1443 .long 0 /* 0x64 - H_EOI */
1444 .long 0 /* 0x68 - H_CPPR */
1445 .long 0 /* 0x6c - H_IPI */
1446 .long 0 /* 0x70 - H_IPOLL */
1447 .long 0 /* 0x74 - H_XIRR */
1448#endif
1358 .long 0 /* 0x78 */ 1449 .long 0 /* 0x78 */
1359 .long 0 /* 0x7c */ 1450 .long 0 /* 0x7c */
1360 .long 0 /* 0x80 */ 1451 .long 0 /* 0x80 */
@@ -1405,15 +1496,6 @@ ignore_hdec:
1405 mr r4,r9 1496 mr r4,r9
1406 b fast_guest_return 1497 b fast_guest_return
1407 1498
1408bounce_ext_interrupt:
1409 mr r4,r9
1410 mtspr SPRN_SRR0,r10
1411 mtspr SPRN_SRR1,r11
1412 li r10,BOOK3S_INTERRUPT_EXTERNAL
1413 li r11,(MSR_ME << 1) | 1 /* synthesize MSR_SF | MSR_ME */
1414 rotldi r11,r11,63
1415 b fast_guest_return
1416
1417_GLOBAL(kvmppc_h_set_dabr) 1499_GLOBAL(kvmppc_h_set_dabr)
1418 std r4,VCPU_DABR(r3) 1500 std r4,VCPU_DABR(r3)
1419 /* Work around P7 bug where DABR can get corrupted on mtspr */ 1501 /* Work around P7 bug where DABR can get corrupted on mtspr */
@@ -1519,6 +1601,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1519 b . 1601 b .
1520 1602
1521kvm_end_cede: 1603kvm_end_cede:
1604 /* get vcpu pointer */
1605 ld r4, HSTATE_KVM_VCPU(r13)
1606
1522 /* Woken by external or decrementer interrupt */ 1607 /* Woken by external or decrementer interrupt */
1523 ld r1, HSTATE_HOST_R1(r13) 1608 ld r1, HSTATE_HOST_R1(r13)
1524 1609
@@ -1558,6 +1643,16 @@ kvm_end_cede:
1558 li r0,0 1643 li r0,0
1559 stb r0,HSTATE_NAPPING(r13) 1644 stb r0,HSTATE_NAPPING(r13)
1560 1645
1646 /* Check the wake reason in SRR1 to see why we got here */
1647 mfspr r3, SPRN_SRR1
1648 rlwinm r3, r3, 44-31, 0x7 /* extract wake reason field */
1649 cmpwi r3, 4 /* was it an external interrupt? */
1650 li r12, BOOK3S_INTERRUPT_EXTERNAL
1651 mr r9, r4
1652 ld r10, VCPU_PC(r9)
1653 ld r11, VCPU_MSR(r9)
1654 beq do_ext_interrupt /* if so */
1655
1561 /* see if any other thread is already exiting */ 1656 /* see if any other thread is already exiting */
1562 lwz r0,VCORE_ENTRY_EXIT(r5) 1657 lwz r0,VCORE_ENTRY_EXIT(r5)
1563 cmpwi r0,0x100 1658 cmpwi r0,0x100
@@ -1577,8 +1672,7 @@ kvm_cede_prodded:
1577 1672
1578 /* we've ceded but we want to give control to the host */ 1673 /* we've ceded but we want to give control to the host */
1579kvm_cede_exit: 1674kvm_cede_exit:
1580 li r3,H_TOO_HARD 1675 b hcall_real_fallback
1581 blr
1582 1676
1583 /* Try to handle a machine check in real mode */ 1677 /* Try to handle a machine check in real mode */
1584machine_check_realmode: 1678machine_check_realmode:
@@ -1626,7 +1720,7 @@ secondary_nap:
1626 beq 37f 1720 beq 37f
1627 sync 1721 sync
1628 li r0, 0xff 1722 li r0, 0xff
1629 li r6, XICS_QIRR 1723 li r6, XICS_MFRR
1630 stbcix r0, r5, r6 /* clear the IPI */ 1724 stbcix r0, r5, r6 /* clear the IPI */
1631 stwcix r3, r5, r7 /* EOI it */ 1725 stwcix r3, r5, r7 /* EOI it */
163237: sync 172637: sync
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 5e93438afb06..bdc40b8e77d9 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -762,9 +762,7 @@ program_interrupt:
762 run->exit_reason = KVM_EXIT_MMIO; 762 run->exit_reason = KVM_EXIT_MMIO;
763 r = RESUME_HOST_NV; 763 r = RESUME_HOST_NV;
764 break; 764 break;
765 case EMULATE_DO_PAPR: 765 case EMULATE_EXIT_USER:
766 run->exit_reason = KVM_EXIT_PAPR_HCALL;
767 vcpu->arch.hcall_needed = 1;
768 r = RESUME_HOST_NV; 766 r = RESUME_HOST_NV;
769 break; 767 break;
770 default: 768 default:
@@ -1039,7 +1037,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
1039 if (!vcpu_book3s) 1037 if (!vcpu_book3s)
1040 goto out; 1038 goto out;
1041 1039
1042 vcpu_book3s->shadow_vcpu = (struct kvmppc_book3s_shadow_vcpu *) 1040 vcpu_book3s->shadow_vcpu =
1043 kzalloc(sizeof(*vcpu_book3s->shadow_vcpu), GFP_KERNEL); 1041 kzalloc(sizeof(*vcpu_book3s->shadow_vcpu), GFP_KERNEL);
1044 if (!vcpu_book3s->shadow_vcpu) 1042 if (!vcpu_book3s->shadow_vcpu)
1045 goto free_vcpu; 1043 goto free_vcpu;
@@ -1283,7 +1281,7 @@ int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1283 1281
1284void kvmppc_core_commit_memory_region(struct kvm *kvm, 1282void kvmppc_core_commit_memory_region(struct kvm *kvm,
1285 struct kvm_userspace_memory_region *mem, 1283 struct kvm_userspace_memory_region *mem,
1286 struct kvm_memory_slot old) 1284 const struct kvm_memory_slot *old)
1287{ 1285{
1288} 1286}
1289 1287
@@ -1298,6 +1296,7 @@ int kvmppc_core_init_vm(struct kvm *kvm)
1298{ 1296{
1299#ifdef CONFIG_PPC64 1297#ifdef CONFIG_PPC64
1300 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables); 1298 INIT_LIST_HEAD(&kvm->arch.spapr_tce_tables);
1299 INIT_LIST_HEAD(&kvm->arch.rtas_tokens);
1301#endif 1300#endif
1302 1301
1303 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 1302 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c
index ee02b30878ed..b24309c6c2d5 100644
--- a/arch/powerpc/kvm/book3s_pr_papr.c
+++ b/arch/powerpc/kvm/book3s_pr_papr.c
@@ -227,6 +227,13 @@ static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu)
227 return EMULATE_DONE; 227 return EMULATE_DONE;
228} 228}
229 229
230static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
231{
232 long rc = kvmppc_xics_hcall(vcpu, cmd);
233 kvmppc_set_gpr(vcpu, 3, rc);
234 return EMULATE_DONE;
235}
236
230int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd) 237int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
231{ 238{
232 switch (cmd) { 239 switch (cmd) {
@@ -246,6 +253,20 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
246 clear_bit(KVM_REQ_UNHALT, &vcpu->requests); 253 clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
247 vcpu->stat.halt_wakeup++; 254 vcpu->stat.halt_wakeup++;
248 return EMULATE_DONE; 255 return EMULATE_DONE;
256 case H_XIRR:
257 case H_CPPR:
258 case H_EOI:
259 case H_IPI:
260 if (kvmppc_xics_enabled(vcpu))
261 return kvmppc_h_pr_xics_hcall(vcpu, cmd);
262 break;
263 case H_RTAS:
264 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
265 return RESUME_HOST;
266 if (kvmppc_rtas_hcall(vcpu))
267 break;
268 kvmppc_set_gpr(vcpu, 3, 0);
269 return EMULATE_DONE;
249 } 270 }
250 271
251 return EMULATE_FAIL; 272 return EMULATE_FAIL;
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c
new file mode 100644
index 000000000000..3219ba895246
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_rtas.c
@@ -0,0 +1,274 @@
1/*
2 * Copyright 2012 Michael Ellerman, IBM Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2, as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/kernel.h>
10#include <linux/kvm_host.h>
11#include <linux/kvm.h>
12#include <linux/err.h>
13
14#include <asm/uaccess.h>
15#include <asm/kvm_book3s.h>
16#include <asm/kvm_ppc.h>
17#include <asm/hvcall.h>
18#include <asm/rtas.h>
19
20#ifdef CONFIG_KVM_XICS
21static void kvm_rtas_set_xive(struct kvm_vcpu *vcpu, struct rtas_args *args)
22{
23 u32 irq, server, priority;
24 int rc;
25
26 if (args->nargs != 3 || args->nret != 1) {
27 rc = -3;
28 goto out;
29 }
30
31 irq = args->args[0];
32 server = args->args[1];
33 priority = args->args[2];
34
35 rc = kvmppc_xics_set_xive(vcpu->kvm, irq, server, priority);
36 if (rc)
37 rc = -3;
38out:
39 args->rets[0] = rc;
40}
41
42static void kvm_rtas_get_xive(struct kvm_vcpu *vcpu, struct rtas_args *args)
43{
44 u32 irq, server, priority;
45 int rc;
46
47 if (args->nargs != 1 || args->nret != 3) {
48 rc = -3;
49 goto out;
50 }
51
52 irq = args->args[0];
53
54 server = priority = 0;
55 rc = kvmppc_xics_get_xive(vcpu->kvm, irq, &server, &priority);
56 if (rc) {
57 rc = -3;
58 goto out;
59 }
60
61 args->rets[1] = server;
62 args->rets[2] = priority;
63out:
64 args->rets[0] = rc;
65}
66
67static void kvm_rtas_int_off(struct kvm_vcpu *vcpu, struct rtas_args *args)
68{
69 u32 irq;
70 int rc;
71
72 if (args->nargs != 1 || args->nret != 1) {
73 rc = -3;
74 goto out;
75 }
76
77 irq = args->args[0];
78
79 rc = kvmppc_xics_int_off(vcpu->kvm, irq);
80 if (rc)
81 rc = -3;
82out:
83 args->rets[0] = rc;
84}
85
86static void kvm_rtas_int_on(struct kvm_vcpu *vcpu, struct rtas_args *args)
87{
88 u32 irq;
89 int rc;
90
91 if (args->nargs != 1 || args->nret != 1) {
92 rc = -3;
93 goto out;
94 }
95
96 irq = args->args[0];
97
98 rc = kvmppc_xics_int_on(vcpu->kvm, irq);
99 if (rc)
100 rc = -3;
101out:
102 args->rets[0] = rc;
103}
104#endif /* CONFIG_KVM_XICS */
105
106struct rtas_handler {
107 void (*handler)(struct kvm_vcpu *vcpu, struct rtas_args *args);
108 char *name;
109};
110
111static struct rtas_handler rtas_handlers[] = {
112#ifdef CONFIG_KVM_XICS
113 { .name = "ibm,set-xive", .handler = kvm_rtas_set_xive },
114 { .name = "ibm,get-xive", .handler = kvm_rtas_get_xive },
115 { .name = "ibm,int-off", .handler = kvm_rtas_int_off },
116 { .name = "ibm,int-on", .handler = kvm_rtas_int_on },
117#endif
118};
119
120struct rtas_token_definition {
121 struct list_head list;
122 struct rtas_handler *handler;
123 u64 token;
124};
125
126static int rtas_name_matches(char *s1, char *s2)
127{
128 struct kvm_rtas_token_args args;
129 return !strncmp(s1, s2, sizeof(args.name));
130}
131
132static int rtas_token_undefine(struct kvm *kvm, char *name)
133{
134 struct rtas_token_definition *d, *tmp;
135
136 lockdep_assert_held(&kvm->lock);
137
138 list_for_each_entry_safe(d, tmp, &kvm->arch.rtas_tokens, list) {
139 if (rtas_name_matches(d->handler->name, name)) {
140 list_del(&d->list);
141 kfree(d);
142 return 0;
143 }
144 }
145
146 /* It's not an error to undefine an undefined token */
147 return 0;
148}
149
150static int rtas_token_define(struct kvm *kvm, char *name, u64 token)
151{
152 struct rtas_token_definition *d;
153 struct rtas_handler *h = NULL;
154 bool found;
155 int i;
156
157 lockdep_assert_held(&kvm->lock);
158
159 list_for_each_entry(d, &kvm->arch.rtas_tokens, list) {
160 if (d->token == token)
161 return -EEXIST;
162 }
163
164 found = false;
165 for (i = 0; i < ARRAY_SIZE(rtas_handlers); i++) {
166 h = &rtas_handlers[i];
167 if (rtas_name_matches(h->name, name)) {
168 found = true;
169 break;
170 }
171 }
172
173 if (!found)
174 return -ENOENT;
175
176 d = kzalloc(sizeof(*d), GFP_KERNEL);
177 if (!d)
178 return -ENOMEM;
179
180 d->handler = h;
181 d->token = token;
182
183 list_add_tail(&d->list, &kvm->arch.rtas_tokens);
184
185 return 0;
186}
187
188int kvm_vm_ioctl_rtas_define_token(struct kvm *kvm, void __user *argp)
189{
190 struct kvm_rtas_token_args args;
191 int rc;
192
193 if (copy_from_user(&args, argp, sizeof(args)))
194 return -EFAULT;
195
196 mutex_lock(&kvm->lock);
197
198 if (args.token)
199 rc = rtas_token_define(kvm, args.name, args.token);
200 else
201 rc = rtas_token_undefine(kvm, args.name);
202
203 mutex_unlock(&kvm->lock);
204
205 return rc;
206}
207
208int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu)
209{
210 struct rtas_token_definition *d;
211 struct rtas_args args;
212 rtas_arg_t *orig_rets;
213 gpa_t args_phys;
214 int rc;
215
216 /* r4 contains the guest physical address of the RTAS args */
217 args_phys = kvmppc_get_gpr(vcpu, 4);
218
219 rc = kvm_read_guest(vcpu->kvm, args_phys, &args, sizeof(args));
220 if (rc)
221 goto fail;
222
223 /*
224 * args->rets is a pointer into args->args. Now that we've
225 * copied args we need to fix it up to point into our copy,
226 * not the guest args. We also need to save the original
227 * value so we can restore it on the way out.
228 */
229 orig_rets = args.rets;
230 args.rets = &args.args[args.nargs];
231
232 mutex_lock(&vcpu->kvm->lock);
233
234 rc = -ENOENT;
235 list_for_each_entry(d, &vcpu->kvm->arch.rtas_tokens, list) {
236 if (d->token == args.token) {
237 d->handler->handler(vcpu, &args);
238 rc = 0;
239 break;
240 }
241 }
242
243 mutex_unlock(&vcpu->kvm->lock);
244
245 if (rc == 0) {
246 args.rets = orig_rets;
247 rc = kvm_write_guest(vcpu->kvm, args_phys, &args, sizeof(args));
248 if (rc)
249 goto fail;
250 }
251
252 return rc;
253
254fail:
255 /*
256 * We only get here if the guest has called RTAS with a bogus
257 * args pointer. That means we can't get to the args, and so we
258 * can't fail the RTAS call. So fail right out to userspace,
259 * which should kill the guest.
260 */
261 return rc;
262}
263
264void kvmppc_rtas_tokens_free(struct kvm *kvm)
265{
266 struct rtas_token_definition *d, *tmp;
267
268 lockdep_assert_held(&kvm->lock);
269
270 list_for_each_entry_safe(d, tmp, &kvm->arch.rtas_tokens, list) {
271 list_del(&d->list);
272 kfree(d);
273 }
274}
diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
new file mode 100644
index 000000000000..f7a103756618
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -0,0 +1,1270 @@
1/*
2 * Copyright 2012 Michael Ellerman, IBM Corporation.
3 * Copyright 2012 Benjamin Herrenschmidt, IBM Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2, as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/kernel.h>
11#include <linux/kvm_host.h>
12#include <linux/err.h>
13#include <linux/gfp.h>
14#include <linux/anon_inodes.h>
15
16#include <asm/uaccess.h>
17#include <asm/kvm_book3s.h>
18#include <asm/kvm_ppc.h>
19#include <asm/hvcall.h>
20#include <asm/xics.h>
21#include <asm/debug.h>
22
23#include <linux/debugfs.h>
24#include <linux/seq_file.h>
25
26#include "book3s_xics.h"
27
28#if 1
29#define XICS_DBG(fmt...) do { } while (0)
30#else
31#define XICS_DBG(fmt...) trace_printk(fmt)
32#endif
33
34#define ENABLE_REALMODE true
35#define DEBUG_REALMODE false
36
37/*
38 * LOCKING
39 * =======
40 *
41 * Each ICS has a mutex protecting the information about the IRQ
42 * sources and avoiding simultaneous deliveries if the same interrupt.
43 *
44 * ICP operations are done via a single compare & swap transaction
45 * (most ICP state fits in the union kvmppc_icp_state)
46 */
47
48/*
49 * TODO
50 * ====
51 *
52 * - To speed up resends, keep a bitmap of "resend" set bits in the
53 * ICS
54 *
55 * - Speed up server# -> ICP lookup (array ? hash table ?)
56 *
57 * - Make ICS lockless as well, or at least a per-interrupt lock or hashed
58 * locks array to improve scalability
59 */
60
61/* -- ICS routines -- */
62
63static void icp_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
64 u32 new_irq);
65
66static int ics_deliver_irq(struct kvmppc_xics *xics, u32 irq, u32 level,
67 bool report_status)
68{
69 struct ics_irq_state *state;
70 struct kvmppc_ics *ics;
71 u16 src;
72
73 XICS_DBG("ics deliver %#x (level: %d)\n", irq, level);
74
75 ics = kvmppc_xics_find_ics(xics, irq, &src);
76 if (!ics) {
77 XICS_DBG("ics_deliver_irq: IRQ 0x%06x not found !\n", irq);
78 return -EINVAL;
79 }
80 state = &ics->irq_state[src];
81 if (!state->exists)
82 return -EINVAL;
83
84 if (report_status)
85 return state->asserted;
86
87 /*
88 * We set state->asserted locklessly. This should be fine as
89 * we are the only setter, thus concurrent access is undefined
90 * to begin with.
91 */
92 if (level == KVM_INTERRUPT_SET_LEVEL)
93 state->asserted = 1;
94 else if (level == KVM_INTERRUPT_UNSET) {
95 state->asserted = 0;
96 return 0;
97 }
98
99 /* Attempt delivery */
100 icp_deliver_irq(xics, NULL, irq);
101
102 return state->asserted;
103}
104
105static void ics_check_resend(struct kvmppc_xics *xics, struct kvmppc_ics *ics,
106 struct kvmppc_icp *icp)
107{
108 int i;
109
110 mutex_lock(&ics->lock);
111
112 for (i = 0; i < KVMPPC_XICS_IRQ_PER_ICS; i++) {
113 struct ics_irq_state *state = &ics->irq_state[i];
114
115 if (!state->resend)
116 continue;
117
118 XICS_DBG("resend %#x prio %#x\n", state->number,
119 state->priority);
120
121 mutex_unlock(&ics->lock);
122 icp_deliver_irq(xics, icp, state->number);
123 mutex_lock(&ics->lock);
124 }
125
126 mutex_unlock(&ics->lock);
127}
128
129static bool write_xive(struct kvmppc_xics *xics, struct kvmppc_ics *ics,
130 struct ics_irq_state *state,
131 u32 server, u32 priority, u32 saved_priority)
132{
133 bool deliver;
134
135 mutex_lock(&ics->lock);
136
137 state->server = server;
138 state->priority = priority;
139 state->saved_priority = saved_priority;
140 deliver = false;
141 if ((state->masked_pending || state->resend) && priority != MASKED) {
142 state->masked_pending = 0;
143 deliver = true;
144 }
145
146 mutex_unlock(&ics->lock);
147
148 return deliver;
149}
150
151int kvmppc_xics_set_xive(struct kvm *kvm, u32 irq, u32 server, u32 priority)
152{
153 struct kvmppc_xics *xics = kvm->arch.xics;
154 struct kvmppc_icp *icp;
155 struct kvmppc_ics *ics;
156 struct ics_irq_state *state;
157 u16 src;
158
159 if (!xics)
160 return -ENODEV;
161
162 ics = kvmppc_xics_find_ics(xics, irq, &src);
163 if (!ics)
164 return -EINVAL;
165 state = &ics->irq_state[src];
166
167 icp = kvmppc_xics_find_server(kvm, server);
168 if (!icp)
169 return -EINVAL;
170
171 XICS_DBG("set_xive %#x server %#x prio %#x MP:%d RS:%d\n",
172 irq, server, priority,
173 state->masked_pending, state->resend);
174
175 if (write_xive(xics, ics, state, server, priority, priority))
176 icp_deliver_irq(xics, icp, irq);
177
178 return 0;
179}
180
181int kvmppc_xics_get_xive(struct kvm *kvm, u32 irq, u32 *server, u32 *priority)
182{
183 struct kvmppc_xics *xics = kvm->arch.xics;
184 struct kvmppc_ics *ics;
185 struct ics_irq_state *state;
186 u16 src;
187
188 if (!xics)
189 return -ENODEV;
190
191 ics = kvmppc_xics_find_ics(xics, irq, &src);
192 if (!ics)
193 return -EINVAL;
194 state = &ics->irq_state[src];
195
196 mutex_lock(&ics->lock);
197 *server = state->server;
198 *priority = state->priority;
199 mutex_unlock(&ics->lock);
200
201 return 0;
202}
203
204int kvmppc_xics_int_on(struct kvm *kvm, u32 irq)
205{
206 struct kvmppc_xics *xics = kvm->arch.xics;
207 struct kvmppc_icp *icp;
208 struct kvmppc_ics *ics;
209 struct ics_irq_state *state;
210 u16 src;
211
212 if (!xics)
213 return -ENODEV;
214
215 ics = kvmppc_xics_find_ics(xics, irq, &src);
216 if (!ics)
217 return -EINVAL;
218 state = &ics->irq_state[src];
219
220 icp = kvmppc_xics_find_server(kvm, state->server);
221 if (!icp)
222 return -EINVAL;
223
224 if (write_xive(xics, ics, state, state->server, state->saved_priority,
225 state->saved_priority))
226 icp_deliver_irq(xics, icp, irq);
227
228 return 0;
229}
230
231int kvmppc_xics_int_off(struct kvm *kvm, u32 irq)
232{
233 struct kvmppc_xics *xics = kvm->arch.xics;
234 struct kvmppc_ics *ics;
235 struct ics_irq_state *state;
236 u16 src;
237
238 if (!xics)
239 return -ENODEV;
240
241 ics = kvmppc_xics_find_ics(xics, irq, &src);
242 if (!ics)
243 return -EINVAL;
244 state = &ics->irq_state[src];
245
246 write_xive(xics, ics, state, state->server, MASKED, state->priority);
247
248 return 0;
249}
250
251/* -- ICP routines, including hcalls -- */
252
253static inline bool icp_try_update(struct kvmppc_icp *icp,
254 union kvmppc_icp_state old,
255 union kvmppc_icp_state new,
256 bool change_self)
257{
258 bool success;
259
260 /* Calculate new output value */
261 new.out_ee = (new.xisr && (new.pending_pri < new.cppr));
262
263 /* Attempt atomic update */
264 success = cmpxchg64(&icp->state.raw, old.raw, new.raw) == old.raw;
265 if (!success)
266 goto bail;
267
268 XICS_DBG("UPD [%04x] - C:%02x M:%02x PP: %02x PI:%06x R:%d O:%d\n",
269 icp->server_num,
270 old.cppr, old.mfrr, old.pending_pri, old.xisr,
271 old.need_resend, old.out_ee);
272 XICS_DBG("UPD - C:%02x M:%02x PP: %02x PI:%06x R:%d O:%d\n",
273 new.cppr, new.mfrr, new.pending_pri, new.xisr,
274 new.need_resend, new.out_ee);
275 /*
276 * Check for output state update
277 *
278 * Note that this is racy since another processor could be updating
279 * the state already. This is why we never clear the interrupt output
280 * here, we only ever set it. The clear only happens prior to doing
281 * an update and only by the processor itself. Currently we do it
282 * in Accept (H_XIRR) and Up_Cppr (H_XPPR).
283 *
284 * We also do not try to figure out whether the EE state has changed,
285 * we unconditionally set it if the new state calls for it. The reason
286 * for that is that we opportunistically remove the pending interrupt
287 * flag when raising CPPR, so we need to set it back here if an
288 * interrupt is still pending.
289 */
290 if (new.out_ee) {
291 kvmppc_book3s_queue_irqprio(icp->vcpu,
292 BOOK3S_INTERRUPT_EXTERNAL_LEVEL);
293 if (!change_self)
294 kvmppc_fast_vcpu_kick(icp->vcpu);
295 }
296 bail:
297 return success;
298}
299
300static void icp_check_resend(struct kvmppc_xics *xics,
301 struct kvmppc_icp *icp)
302{
303 u32 icsid;
304
305 /* Order this load with the test for need_resend in the caller */
306 smp_rmb();
307 for_each_set_bit(icsid, icp->resend_map, xics->max_icsid + 1) {
308 struct kvmppc_ics *ics = xics->ics[icsid];
309
310 if (!test_and_clear_bit(icsid, icp->resend_map))
311 continue;
312 if (!ics)
313 continue;
314 ics_check_resend(xics, ics, icp);
315 }
316}
317
318static bool icp_try_to_deliver(struct kvmppc_icp *icp, u32 irq, u8 priority,
319 u32 *reject)
320{
321 union kvmppc_icp_state old_state, new_state;
322 bool success;
323
324 XICS_DBG("try deliver %#x(P:%#x) to server %#x\n", irq, priority,
325 icp->server_num);
326
327 do {
328 old_state = new_state = ACCESS_ONCE(icp->state);
329
330 *reject = 0;
331
332 /* See if we can deliver */
333 success = new_state.cppr > priority &&
334 new_state.mfrr > priority &&
335 new_state.pending_pri > priority;
336
337 /*
338 * If we can, check for a rejection and perform the
339 * delivery
340 */
341 if (success) {
342 *reject = new_state.xisr;
343 new_state.xisr = irq;
344 new_state.pending_pri = priority;
345 } else {
346 /*
347 * If we failed to deliver we set need_resend
348 * so a subsequent CPPR state change causes us
349 * to try a new delivery.
350 */
351 new_state.need_resend = true;
352 }
353
354 } while (!icp_try_update(icp, old_state, new_state, false));
355
356 return success;
357}
358
359static void icp_deliver_irq(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
360 u32 new_irq)
361{
362 struct ics_irq_state *state;
363 struct kvmppc_ics *ics;
364 u32 reject;
365 u16 src;
366
367 /*
368 * This is used both for initial delivery of an interrupt and
369 * for subsequent rejection.
370 *
371 * Rejection can be racy vs. resends. We have evaluated the
372 * rejection in an atomic ICP transaction which is now complete,
373 * so potentially the ICP can already accept the interrupt again.
374 *
375 * So we need to retry the delivery. Essentially the reject path
376 * boils down to a failed delivery. Always.
377 *
378 * Now the interrupt could also have moved to a different target,
379 * thus we may need to re-do the ICP lookup as well
380 */
381
382 again:
383 /* Get the ICS state and lock it */
384 ics = kvmppc_xics_find_ics(xics, new_irq, &src);
385 if (!ics) {
386 XICS_DBG("icp_deliver_irq: IRQ 0x%06x not found !\n", new_irq);
387 return;
388 }
389 state = &ics->irq_state[src];
390
391 /* Get a lock on the ICS */
392 mutex_lock(&ics->lock);
393
394 /* Get our server */
395 if (!icp || state->server != icp->server_num) {
396 icp = kvmppc_xics_find_server(xics->kvm, state->server);
397 if (!icp) {
398 pr_warn("icp_deliver_irq: IRQ 0x%06x server 0x%x not found !\n",
399 new_irq, state->server);
400 goto out;
401 }
402 }
403
404 /* Clear the resend bit of that interrupt */
405 state->resend = 0;
406
407 /*
408 * If masked, bail out
409 *
410 * Note: PAPR doesn't mention anything about masked pending
411 * when doing a resend, only when doing a delivery.
412 *
413 * However that would have the effect of losing a masked
414 * interrupt that was rejected and isn't consistent with
415 * the whole masked_pending business which is about not
416 * losing interrupts that occur while masked.
417 *
418 * I don't differenciate normal deliveries and resends, this
419 * implementation will differ from PAPR and not lose such
420 * interrupts.
421 */
422 if (state->priority == MASKED) {
423 XICS_DBG("irq %#x masked pending\n", new_irq);
424 state->masked_pending = 1;
425 goto out;
426 }
427
428 /*
429 * Try the delivery, this will set the need_resend flag
430 * in the ICP as part of the atomic transaction if the
431 * delivery is not possible.
432 *
433 * Note that if successful, the new delivery might have itself
434 * rejected an interrupt that was "delivered" before we took the
435 * icp mutex.
436 *
437 * In this case we do the whole sequence all over again for the
438 * new guy. We cannot assume that the rejected interrupt is less
439 * favored than the new one, and thus doesn't need to be delivered,
440 * because by the time we exit icp_try_to_deliver() the target
441 * processor may well have alrady consumed & completed it, and thus
442 * the rejected interrupt might actually be already acceptable.
443 */
444 if (icp_try_to_deliver(icp, new_irq, state->priority, &reject)) {
445 /*
446 * Delivery was successful, did we reject somebody else ?
447 */
448 if (reject && reject != XICS_IPI) {
449 mutex_unlock(&ics->lock);
450 new_irq = reject;
451 goto again;
452 }
453 } else {
454 /*
455 * We failed to deliver the interrupt we need to set the
456 * resend map bit and mark the ICS state as needing a resend
457 */
458 set_bit(ics->icsid, icp->resend_map);
459 state->resend = 1;
460
461 /*
462 * If the need_resend flag got cleared in the ICP some time
463 * between icp_try_to_deliver() atomic update and now, then
464 * we know it might have missed the resend_map bit. So we
465 * retry
466 */
467 smp_mb();
468 if (!icp->state.need_resend) {
469 mutex_unlock(&ics->lock);
470 goto again;
471 }
472 }
473 out:
474 mutex_unlock(&ics->lock);
475}
476
477static void icp_down_cppr(struct kvmppc_xics *xics, struct kvmppc_icp *icp,
478 u8 new_cppr)
479{
480 union kvmppc_icp_state old_state, new_state;
481 bool resend;
482
483 /*
484 * This handles several related states in one operation:
485 *
486 * ICP State: Down_CPPR
487 *
488 * Load CPPR with new value and if the XISR is 0
489 * then check for resends:
490 *
491 * ICP State: Resend
492 *
493 * If MFRR is more favored than CPPR, check for IPIs
494 * and notify ICS of a potential resend. This is done
495 * asynchronously (when used in real mode, we will have
496 * to exit here).
497 *
498 * We do not handle the complete Check_IPI as documented
499 * here. In the PAPR, this state will be used for both
500 * Set_MFRR and Down_CPPR. However, we know that we aren't
501 * changing the MFRR state here so we don't need to handle
502 * the case of an MFRR causing a reject of a pending irq,
503 * this will have been handled when the MFRR was set in the
504 * first place.
505 *
506 * Thus we don't have to handle rejects, only resends.
507 *
508 * When implementing real mode for HV KVM, resend will lead to
509 * a H_TOO_HARD return and the whole transaction will be handled
510 * in virtual mode.
511 */
512 do {
513 old_state = new_state = ACCESS_ONCE(icp->state);
514
515 /* Down_CPPR */
516 new_state.cppr = new_cppr;
517
518 /*
519 * Cut down Resend / Check_IPI / IPI
520 *
521 * The logic is that we cannot have a pending interrupt
522 * trumped by an IPI at this point (see above), so we
523 * know that either the pending interrupt is already an
524 * IPI (in which case we don't care to override it) or
525 * it's either more favored than us or non existent
526 */
527 if (new_state.mfrr < new_cppr &&
528 new_state.mfrr <= new_state.pending_pri) {
529 WARN_ON(new_state.xisr != XICS_IPI &&
530 new_state.xisr != 0);
531 new_state.pending_pri = new_state.mfrr;
532 new_state.xisr = XICS_IPI;
533 }
534
535 /* Latch/clear resend bit */
536 resend = new_state.need_resend;
537 new_state.need_resend = 0;
538
539 } while (!icp_try_update(icp, old_state, new_state, true));
540
541 /*
542 * Now handle resend checks. Those are asynchronous to the ICP
543 * state update in HW (ie bus transactions) so we can handle them
544 * separately here too
545 */
546 if (resend)
547 icp_check_resend(xics, icp);
548}
549
550static noinline unsigned long kvmppc_h_xirr(struct kvm_vcpu *vcpu)
551{
552 union kvmppc_icp_state old_state, new_state;
553 struct kvmppc_icp *icp = vcpu->arch.icp;
554 u32 xirr;
555
556 /* First, remove EE from the processor */
557 kvmppc_book3s_dequeue_irqprio(icp->vcpu,
558 BOOK3S_INTERRUPT_EXTERNAL_LEVEL);
559
560 /*
561 * ICP State: Accept_Interrupt
562 *
563 * Return the pending interrupt (if any) along with the
564 * current CPPR, then clear the XISR & set CPPR to the
565 * pending priority
566 */
567 do {
568 old_state = new_state = ACCESS_ONCE(icp->state);
569
570 xirr = old_state.xisr | (((u32)old_state.cppr) << 24);
571 if (!old_state.xisr)
572 break;
573 new_state.cppr = new_state.pending_pri;
574 new_state.pending_pri = 0xff;
575 new_state.xisr = 0;
576
577 } while (!icp_try_update(icp, old_state, new_state, true));
578
579 XICS_DBG("h_xirr vcpu %d xirr %#x\n", vcpu->vcpu_id, xirr);
580
581 return xirr;
582}
583
584static noinline int kvmppc_h_ipi(struct kvm_vcpu *vcpu, unsigned long server,
585 unsigned long mfrr)
586{
587 union kvmppc_icp_state old_state, new_state;
588 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
589 struct kvmppc_icp *icp;
590 u32 reject;
591 bool resend;
592 bool local;
593
594 XICS_DBG("h_ipi vcpu %d to server %lu mfrr %#lx\n",
595 vcpu->vcpu_id, server, mfrr);
596
597 icp = vcpu->arch.icp;
598 local = icp->server_num == server;
599 if (!local) {
600 icp = kvmppc_xics_find_server(vcpu->kvm, server);
601 if (!icp)
602 return H_PARAMETER;
603 }
604
605 /*
606 * ICP state: Set_MFRR
607 *
608 * If the CPPR is more favored than the new MFRR, then
609 * nothing needs to be rejected as there can be no XISR to
610 * reject. If the MFRR is being made less favored then
611 * there might be a previously-rejected interrupt needing
612 * to be resent.
613 *
614 * If the CPPR is less favored, then we might be replacing
615 * an interrupt, and thus need to possibly reject it as in
616 *
617 * ICP state: Check_IPI
618 */
619 do {
620 old_state = new_state = ACCESS_ONCE(icp->state);
621
622 /* Set_MFRR */
623 new_state.mfrr = mfrr;
624
625 /* Check_IPI */
626 reject = 0;
627 resend = false;
628 if (mfrr < new_state.cppr) {
629 /* Reject a pending interrupt if not an IPI */
630 if (mfrr <= new_state.pending_pri)
631 reject = new_state.xisr;
632 new_state.pending_pri = mfrr;
633 new_state.xisr = XICS_IPI;
634 }
635
636 if (mfrr > old_state.mfrr && mfrr > new_state.cppr) {
637 resend = new_state.need_resend;
638 new_state.need_resend = 0;
639 }
640 } while (!icp_try_update(icp, old_state, new_state, local));
641
642 /* Handle reject */
643 if (reject && reject != XICS_IPI)
644 icp_deliver_irq(xics, icp, reject);
645
646 /* Handle resend */
647 if (resend)
648 icp_check_resend(xics, icp);
649
650 return H_SUCCESS;
651}
652
653static noinline void kvmppc_h_cppr(struct kvm_vcpu *vcpu, unsigned long cppr)
654{
655 union kvmppc_icp_state old_state, new_state;
656 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
657 struct kvmppc_icp *icp = vcpu->arch.icp;
658 u32 reject;
659
660 XICS_DBG("h_cppr vcpu %d cppr %#lx\n", vcpu->vcpu_id, cppr);
661
662 /*
663 * ICP State: Set_CPPR
664 *
665 * We can safely compare the new value with the current
666 * value outside of the transaction as the CPPR is only
667 * ever changed by the processor on itself
668 */
669 if (cppr > icp->state.cppr)
670 icp_down_cppr(xics, icp, cppr);
671 else if (cppr == icp->state.cppr)
672 return;
673
674 /*
675 * ICP State: Up_CPPR
676 *
677 * The processor is raising its priority, this can result
678 * in a rejection of a pending interrupt:
679 *
680 * ICP State: Reject_Current
681 *
682 * We can remove EE from the current processor, the update
683 * transaction will set it again if needed
684 */
685 kvmppc_book3s_dequeue_irqprio(icp->vcpu,
686 BOOK3S_INTERRUPT_EXTERNAL_LEVEL);
687
688 do {
689 old_state = new_state = ACCESS_ONCE(icp->state);
690
691 reject = 0;
692 new_state.cppr = cppr;
693
694 if (cppr <= new_state.pending_pri) {
695 reject = new_state.xisr;
696 new_state.xisr = 0;
697 new_state.pending_pri = 0xff;
698 }
699
700 } while (!icp_try_update(icp, old_state, new_state, true));
701
702 /*
703 * Check for rejects. They are handled by doing a new delivery
704 * attempt (see comments in icp_deliver_irq).
705 */
706 if (reject && reject != XICS_IPI)
707 icp_deliver_irq(xics, icp, reject);
708}
709
710static noinline int kvmppc_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
711{
712 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
713 struct kvmppc_icp *icp = vcpu->arch.icp;
714 struct kvmppc_ics *ics;
715 struct ics_irq_state *state;
716 u32 irq = xirr & 0x00ffffff;
717 u16 src;
718
719 XICS_DBG("h_eoi vcpu %d eoi %#lx\n", vcpu->vcpu_id, xirr);
720
721 /*
722 * ICP State: EOI
723 *
724 * Note: If EOI is incorrectly used by SW to lower the CPPR
725 * value (ie more favored), we do not check for rejection of
726 * a pending interrupt, this is a SW error and PAPR sepcifies
727 * that we don't have to deal with it.
728 *
729 * The sending of an EOI to the ICS is handled after the
730 * CPPR update
731 *
732 * ICP State: Down_CPPR which we handle
733 * in a separate function as it's shared with H_CPPR.
734 */
735 icp_down_cppr(xics, icp, xirr >> 24);
736
737 /* IPIs have no EOI */
738 if (irq == XICS_IPI)
739 return H_SUCCESS;
740 /*
741 * EOI handling: If the interrupt is still asserted, we need to
742 * resend it. We can take a lockless "peek" at the ICS state here.
743 *
744 * "Message" interrupts will never have "asserted" set
745 */
746 ics = kvmppc_xics_find_ics(xics, irq, &src);
747 if (!ics) {
748 XICS_DBG("h_eoi: IRQ 0x%06x not found !\n", irq);
749 return H_PARAMETER;
750 }
751 state = &ics->irq_state[src];
752
753 /* Still asserted, resend it */
754 if (state->asserted)
755 icp_deliver_irq(xics, icp, irq);
756
757 return H_SUCCESS;
758}
759
760static noinline int kvmppc_xics_rm_complete(struct kvm_vcpu *vcpu, u32 hcall)
761{
762 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
763 struct kvmppc_icp *icp = vcpu->arch.icp;
764
765 XICS_DBG("XICS_RM: H_%x completing, act: %x state: %lx tgt: %p\n",
766 hcall, icp->rm_action, icp->rm_dbgstate.raw, icp->rm_dbgtgt);
767
768 if (icp->rm_action & XICS_RM_KICK_VCPU)
769 kvmppc_fast_vcpu_kick(icp->rm_kick_target);
770 if (icp->rm_action & XICS_RM_CHECK_RESEND)
771 icp_check_resend(xics, icp);
772 if (icp->rm_action & XICS_RM_REJECT)
773 icp_deliver_irq(xics, icp, icp->rm_reject);
774
775 icp->rm_action = 0;
776
777 return H_SUCCESS;
778}
779
780int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 req)
781{
782 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
783 unsigned long res;
784 int rc = H_SUCCESS;
785
786 /* Check if we have an ICP */
787 if (!xics || !vcpu->arch.icp)
788 return H_HARDWARE;
789
790 /* Check for real mode returning too hard */
791 if (xics->real_mode)
792 return kvmppc_xics_rm_complete(vcpu, req);
793
794 switch (req) {
795 case H_XIRR:
796 res = kvmppc_h_xirr(vcpu);
797 kvmppc_set_gpr(vcpu, 4, res);
798 break;
799 case H_CPPR:
800 kvmppc_h_cppr(vcpu, kvmppc_get_gpr(vcpu, 4));
801 break;
802 case H_EOI:
803 rc = kvmppc_h_eoi(vcpu, kvmppc_get_gpr(vcpu, 4));
804 break;
805 case H_IPI:
806 rc = kvmppc_h_ipi(vcpu, kvmppc_get_gpr(vcpu, 4),
807 kvmppc_get_gpr(vcpu, 5));
808 break;
809 }
810
811 return rc;
812}
813
814
815/* -- Initialisation code etc. -- */
816
817static int xics_debug_show(struct seq_file *m, void *private)
818{
819 struct kvmppc_xics *xics = m->private;
820 struct kvm *kvm = xics->kvm;
821 struct kvm_vcpu *vcpu;
822 int icsid, i;
823
824 if (!kvm)
825 return 0;
826
827 seq_printf(m, "=========\nICP state\n=========\n");
828
829 kvm_for_each_vcpu(i, vcpu, kvm) {
830 struct kvmppc_icp *icp = vcpu->arch.icp;
831 union kvmppc_icp_state state;
832
833 if (!icp)
834 continue;
835
836 state.raw = ACCESS_ONCE(icp->state.raw);
837 seq_printf(m, "cpu server %#lx XIRR:%#x PPRI:%#x CPPR:%#x MFRR:%#x OUT:%d NR:%d\n",
838 icp->server_num, state.xisr,
839 state.pending_pri, state.cppr, state.mfrr,
840 state.out_ee, state.need_resend);
841 }
842
843 for (icsid = 0; icsid <= KVMPPC_XICS_MAX_ICS_ID; icsid++) {
844 struct kvmppc_ics *ics = xics->ics[icsid];
845
846 if (!ics)
847 continue;
848
849 seq_printf(m, "=========\nICS state for ICS 0x%x\n=========\n",
850 icsid);
851
852 mutex_lock(&ics->lock);
853
854 for (i = 0; i < KVMPPC_XICS_IRQ_PER_ICS; i++) {
855 struct ics_irq_state *irq = &ics->irq_state[i];
856
857 seq_printf(m, "irq 0x%06x: server %#x prio %#x save prio %#x asserted %d resend %d masked pending %d\n",
858 irq->number, irq->server, irq->priority,
859 irq->saved_priority, irq->asserted,
860 irq->resend, irq->masked_pending);
861
862 }
863 mutex_unlock(&ics->lock);
864 }
865 return 0;
866}
867
868static int xics_debug_open(struct inode *inode, struct file *file)
869{
870 return single_open(file, xics_debug_show, inode->i_private);
871}
872
873static const struct file_operations xics_debug_fops = {
874 .open = xics_debug_open,
875 .read = seq_read,
876 .llseek = seq_lseek,
877 .release = single_release,
878};
879
880static void xics_debugfs_init(struct kvmppc_xics *xics)
881{
882 char *name;
883
884 name = kasprintf(GFP_KERNEL, "kvm-xics-%p", xics);
885 if (!name) {
886 pr_err("%s: no memory for name\n", __func__);
887 return;
888 }
889
890 xics->dentry = debugfs_create_file(name, S_IRUGO, powerpc_debugfs_root,
891 xics, &xics_debug_fops);
892
893 pr_debug("%s: created %s\n", __func__, name);
894 kfree(name);
895}
896
897static struct kvmppc_ics *kvmppc_xics_create_ics(struct kvm *kvm,
898 struct kvmppc_xics *xics, int irq)
899{
900 struct kvmppc_ics *ics;
901 int i, icsid;
902
903 icsid = irq >> KVMPPC_XICS_ICS_SHIFT;
904
905 mutex_lock(&kvm->lock);
906
907 /* ICS already exists - somebody else got here first */
908 if (xics->ics[icsid])
909 goto out;
910
911 /* Create the ICS */
912 ics = kzalloc(sizeof(struct kvmppc_ics), GFP_KERNEL);
913 if (!ics)
914 goto out;
915
916 mutex_init(&ics->lock);
917 ics->icsid = icsid;
918
919 for (i = 0; i < KVMPPC_XICS_IRQ_PER_ICS; i++) {
920 ics->irq_state[i].number = (icsid << KVMPPC_XICS_ICS_SHIFT) | i;
921 ics->irq_state[i].priority = MASKED;
922 ics->irq_state[i].saved_priority = MASKED;
923 }
924 smp_wmb();
925 xics->ics[icsid] = ics;
926
927 if (icsid > xics->max_icsid)
928 xics->max_icsid = icsid;
929
930 out:
931 mutex_unlock(&kvm->lock);
932 return xics->ics[icsid];
933}
934
935int kvmppc_xics_create_icp(struct kvm_vcpu *vcpu, unsigned long server_num)
936{
937 struct kvmppc_icp *icp;
938
939 if (!vcpu->kvm->arch.xics)
940 return -ENODEV;
941
942 if (kvmppc_xics_find_server(vcpu->kvm, server_num))
943 return -EEXIST;
944
945 icp = kzalloc(sizeof(struct kvmppc_icp), GFP_KERNEL);
946 if (!icp)
947 return -ENOMEM;
948
949 icp->vcpu = vcpu;
950 icp->server_num = server_num;
951 icp->state.mfrr = MASKED;
952 icp->state.pending_pri = MASKED;
953 vcpu->arch.icp = icp;
954
955 XICS_DBG("created server for vcpu %d\n", vcpu->vcpu_id);
956
957 return 0;
958}
959
960u64 kvmppc_xics_get_icp(struct kvm_vcpu *vcpu)
961{
962 struct kvmppc_icp *icp = vcpu->arch.icp;
963 union kvmppc_icp_state state;
964
965 if (!icp)
966 return 0;
967 state = icp->state;
968 return ((u64)state.cppr << KVM_REG_PPC_ICP_CPPR_SHIFT) |
969 ((u64)state.xisr << KVM_REG_PPC_ICP_XISR_SHIFT) |
970 ((u64)state.mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT) |
971 ((u64)state.pending_pri << KVM_REG_PPC_ICP_PPRI_SHIFT);
972}
973
974int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval)
975{
976 struct kvmppc_icp *icp = vcpu->arch.icp;
977 struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
978 union kvmppc_icp_state old_state, new_state;
979 struct kvmppc_ics *ics;
980 u8 cppr, mfrr, pending_pri;
981 u32 xisr;
982 u16 src;
983 bool resend;
984
985 if (!icp || !xics)
986 return -ENOENT;
987
988 cppr = icpval >> KVM_REG_PPC_ICP_CPPR_SHIFT;
989 xisr = (icpval >> KVM_REG_PPC_ICP_XISR_SHIFT) &
990 KVM_REG_PPC_ICP_XISR_MASK;
991 mfrr = icpval >> KVM_REG_PPC_ICP_MFRR_SHIFT;
992 pending_pri = icpval >> KVM_REG_PPC_ICP_PPRI_SHIFT;
993
994 /* Require the new state to be internally consistent */
995 if (xisr == 0) {
996 if (pending_pri != 0xff)
997 return -EINVAL;
998 } else if (xisr == XICS_IPI) {
999 if (pending_pri != mfrr || pending_pri >= cppr)
1000 return -EINVAL;
1001 } else {
1002 if (pending_pri >= mfrr || pending_pri >= cppr)
1003 return -EINVAL;
1004 ics = kvmppc_xics_find_ics(xics, xisr, &src);
1005 if (!ics)
1006 return -EINVAL;
1007 }
1008
1009 new_state.raw = 0;
1010 new_state.cppr = cppr;
1011 new_state.xisr = xisr;
1012 new_state.mfrr = mfrr;
1013 new_state.pending_pri = pending_pri;
1014
1015 /*
1016 * Deassert the CPU interrupt request.
1017 * icp_try_update will reassert it if necessary.
1018 */
1019 kvmppc_book3s_dequeue_irqprio(icp->vcpu,
1020 BOOK3S_INTERRUPT_EXTERNAL_LEVEL);
1021
1022 /*
1023 * Note that if we displace an interrupt from old_state.xisr,
1024 * we don't mark it as rejected. We expect userspace to set
1025 * the state of the interrupt sources to be consistent with
1026 * the ICP states (either before or afterwards, which doesn't
1027 * matter). We do handle resends due to CPPR becoming less
1028 * favoured because that is necessary to end up with a
1029 * consistent state in the situation where userspace restores
1030 * the ICS states before the ICP states.
1031 */
1032 do {
1033 old_state = ACCESS_ONCE(icp->state);
1034
1035 if (new_state.mfrr <= old_state.mfrr) {
1036 resend = false;
1037 new_state.need_resend = old_state.need_resend;
1038 } else {
1039 resend = old_state.need_resend;
1040 new_state.need_resend = 0;
1041 }
1042 } while (!icp_try_update(icp, old_state, new_state, false));
1043
1044 if (resend)
1045 icp_check_resend(xics, icp);
1046
1047 return 0;
1048}
1049
1050static int xics_get_source(struct kvmppc_xics *xics, long irq, u64 addr)
1051{
1052 int ret;
1053 struct kvmppc_ics *ics;
1054 struct ics_irq_state *irqp;
1055 u64 __user *ubufp = (u64 __user *) addr;
1056 u16 idx;
1057 u64 val, prio;
1058
1059 ics = kvmppc_xics_find_ics(xics, irq, &idx);
1060 if (!ics)
1061 return -ENOENT;
1062
1063 irqp = &ics->irq_state[idx];
1064 mutex_lock(&ics->lock);
1065 ret = -ENOENT;
1066 if (irqp->exists) {
1067 val = irqp->server;
1068 prio = irqp->priority;
1069 if (prio == MASKED) {
1070 val |= KVM_XICS_MASKED;
1071 prio = irqp->saved_priority;
1072 }
1073 val |= prio << KVM_XICS_PRIORITY_SHIFT;
1074 if (irqp->asserted)
1075 val |= KVM_XICS_LEVEL_SENSITIVE | KVM_XICS_PENDING;
1076 else if (irqp->masked_pending || irqp->resend)
1077 val |= KVM_XICS_PENDING;
1078 ret = 0;
1079 }
1080 mutex_unlock(&ics->lock);
1081
1082 if (!ret && put_user(val, ubufp))
1083 ret = -EFAULT;
1084
1085 return ret;
1086}
1087
1088static int xics_set_source(struct kvmppc_xics *xics, long irq, u64 addr)
1089{
1090 struct kvmppc_ics *ics;
1091 struct ics_irq_state *irqp;
1092 u64 __user *ubufp = (u64 __user *) addr;
1093 u16 idx;
1094 u64 val;
1095 u8 prio;
1096 u32 server;
1097
1098 if (irq < KVMPPC_XICS_FIRST_IRQ || irq >= KVMPPC_XICS_NR_IRQS)
1099 return -ENOENT;
1100
1101 ics = kvmppc_xics_find_ics(xics, irq, &idx);
1102 if (!ics) {
1103 ics = kvmppc_xics_create_ics(xics->kvm, xics, irq);
1104 if (!ics)
1105 return -ENOMEM;
1106 }
1107 irqp = &ics->irq_state[idx];
1108 if (get_user(val, ubufp))
1109 return -EFAULT;
1110
1111 server = val & KVM_XICS_DESTINATION_MASK;
1112 prio = val >> KVM_XICS_PRIORITY_SHIFT;
1113 if (prio != MASKED &&
1114 kvmppc_xics_find_server(xics->kvm, server) == NULL)
1115 return -EINVAL;
1116
1117 mutex_lock(&ics->lock);
1118 irqp->server = server;
1119 irqp->saved_priority = prio;
1120 if (val & KVM_XICS_MASKED)
1121 prio = MASKED;
1122 irqp->priority = prio;
1123 irqp->resend = 0;
1124 irqp->masked_pending = 0;
1125 irqp->asserted = 0;
1126 if ((val & KVM_XICS_PENDING) && (val & KVM_XICS_LEVEL_SENSITIVE))
1127 irqp->asserted = 1;
1128 irqp->exists = 1;
1129 mutex_unlock(&ics->lock);
1130
1131 if (val & KVM_XICS_PENDING)
1132 icp_deliver_irq(xics, NULL, irqp->number);
1133
1134 return 0;
1135}
1136
1137int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
1138 bool line_status)
1139{
1140 struct kvmppc_xics *xics = kvm->arch.xics;
1141
1142 return ics_deliver_irq(xics, irq, level, line_status);
1143}
1144
1145static int xics_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1146{
1147 struct kvmppc_xics *xics = dev->private;
1148
1149 switch (attr->group) {
1150 case KVM_DEV_XICS_GRP_SOURCES:
1151 return xics_set_source(xics, attr->attr, attr->addr);
1152 }
1153 return -ENXIO;
1154}
1155
1156static int xics_get_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1157{
1158 struct kvmppc_xics *xics = dev->private;
1159
1160 switch (attr->group) {
1161 case KVM_DEV_XICS_GRP_SOURCES:
1162 return xics_get_source(xics, attr->attr, attr->addr);
1163 }
1164 return -ENXIO;
1165}
1166
1167static int xics_has_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1168{
1169 switch (attr->group) {
1170 case KVM_DEV_XICS_GRP_SOURCES:
1171 if (attr->attr >= KVMPPC_XICS_FIRST_IRQ &&
1172 attr->attr < KVMPPC_XICS_NR_IRQS)
1173 return 0;
1174 break;
1175 }
1176 return -ENXIO;
1177}
1178
1179static void kvmppc_xics_free(struct kvm_device *dev)
1180{
1181 struct kvmppc_xics *xics = dev->private;
1182 int i;
1183 struct kvm *kvm = xics->kvm;
1184
1185 debugfs_remove(xics->dentry);
1186
1187 if (kvm)
1188 kvm->arch.xics = NULL;
1189
1190 for (i = 0; i <= xics->max_icsid; i++)
1191 kfree(xics->ics[i]);
1192 kfree(xics);
1193 kfree(dev);
1194}
1195
1196static int kvmppc_xics_create(struct kvm_device *dev, u32 type)
1197{
1198 struct kvmppc_xics *xics;
1199 struct kvm *kvm = dev->kvm;
1200 int ret = 0;
1201
1202 xics = kzalloc(sizeof(*xics), GFP_KERNEL);
1203 if (!xics)
1204 return -ENOMEM;
1205
1206 dev->private = xics;
1207 xics->dev = dev;
1208 xics->kvm = kvm;
1209
1210 /* Already there ? */
1211 mutex_lock(&kvm->lock);
1212 if (kvm->arch.xics)
1213 ret = -EEXIST;
1214 else
1215 kvm->arch.xics = xics;
1216 mutex_unlock(&kvm->lock);
1217
1218 if (ret)
1219 return ret;
1220
1221 xics_debugfs_init(xics);
1222
1223#ifdef CONFIG_KVM_BOOK3S_64_HV
1224 if (cpu_has_feature(CPU_FTR_ARCH_206)) {
1225 /* Enable real mode support */
1226 xics->real_mode = ENABLE_REALMODE;
1227 xics->real_mode_dbg = DEBUG_REALMODE;
1228 }
1229#endif /* CONFIG_KVM_BOOK3S_64_HV */
1230
1231 return 0;
1232}
1233
1234struct kvm_device_ops kvm_xics_ops = {
1235 .name = "kvm-xics",
1236 .create = kvmppc_xics_create,
1237 .destroy = kvmppc_xics_free,
1238 .set_attr = xics_set_attr,
1239 .get_attr = xics_get_attr,
1240 .has_attr = xics_has_attr,
1241};
1242
1243int kvmppc_xics_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu,
1244 u32 xcpu)
1245{
1246 struct kvmppc_xics *xics = dev->private;
1247 int r = -EBUSY;
1248
1249 if (dev->ops != &kvm_xics_ops)
1250 return -EPERM;
1251 if (xics->kvm != vcpu->kvm)
1252 return -EPERM;
1253 if (vcpu->arch.irq_type)
1254 return -EBUSY;
1255
1256 r = kvmppc_xics_create_icp(vcpu, xcpu);
1257 if (!r)
1258 vcpu->arch.irq_type = KVMPPC_IRQ_XICS;
1259
1260 return r;
1261}
1262
1263void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu)
1264{
1265 if (!vcpu->arch.icp)
1266 return;
1267 kfree(vcpu->arch.icp);
1268 vcpu->arch.icp = NULL;
1269 vcpu->arch.irq_type = KVMPPC_IRQ_DEFAULT;
1270}
diff --git a/arch/powerpc/kvm/book3s_xics.h b/arch/powerpc/kvm/book3s_xics.h
new file mode 100644
index 000000000000..dd9326c5c19b
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_xics.h
@@ -0,0 +1,130 @@
1/*
2 * Copyright 2012 Michael Ellerman, IBM Corporation.
3 * Copyright 2012 Benjamin Herrenschmidt, IBM Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2, as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef _KVM_PPC_BOOK3S_XICS_H
11#define _KVM_PPC_BOOK3S_XICS_H
12
13/*
14 * We use a two-level tree to store interrupt source information.
15 * There are up to 1024 ICS nodes, each of which can represent
16 * 1024 sources.
17 */
18#define KVMPPC_XICS_MAX_ICS_ID 1023
19#define KVMPPC_XICS_ICS_SHIFT 10
20#define KVMPPC_XICS_IRQ_PER_ICS (1 << KVMPPC_XICS_ICS_SHIFT)
21#define KVMPPC_XICS_SRC_MASK (KVMPPC_XICS_IRQ_PER_ICS - 1)
22
23/*
24 * Interrupt source numbers below this are reserved, for example
25 * 0 is "no interrupt", and 2 is used for IPIs.
26 */
27#define KVMPPC_XICS_FIRST_IRQ 16
28#define KVMPPC_XICS_NR_IRQS ((KVMPPC_XICS_MAX_ICS_ID + 1) * \
29 KVMPPC_XICS_IRQ_PER_ICS)
30
31/* Priority value to use for disabling an interrupt */
32#define MASKED 0xff
33
34/* State for one irq source */
35struct ics_irq_state {
36 u32 number;
37 u32 server;
38 u8 priority;
39 u8 saved_priority;
40 u8 resend;
41 u8 masked_pending;
42 u8 asserted; /* Only for LSI */
43 u8 exists;
44};
45
46/* Atomic ICP state, updated with a single compare & swap */
47union kvmppc_icp_state {
48 unsigned long raw;
49 struct {
50 u8 out_ee:1;
51 u8 need_resend:1;
52 u8 cppr;
53 u8 mfrr;
54 u8 pending_pri;
55 u32 xisr;
56 };
57};
58
59/* One bit per ICS */
60#define ICP_RESEND_MAP_SIZE (KVMPPC_XICS_MAX_ICS_ID / BITS_PER_LONG + 1)
61
62struct kvmppc_icp {
63 struct kvm_vcpu *vcpu;
64 unsigned long server_num;
65 union kvmppc_icp_state state;
66 unsigned long resend_map[ICP_RESEND_MAP_SIZE];
67
68 /* Real mode might find something too hard, here's the action
69 * it might request from virtual mode
70 */
71#define XICS_RM_KICK_VCPU 0x1
72#define XICS_RM_CHECK_RESEND 0x2
73#define XICS_RM_REJECT 0x4
74 u32 rm_action;
75 struct kvm_vcpu *rm_kick_target;
76 u32 rm_reject;
77
78 /* Debug stuff for real mode */
79 union kvmppc_icp_state rm_dbgstate;
80 struct kvm_vcpu *rm_dbgtgt;
81};
82
83struct kvmppc_ics {
84 struct mutex lock;
85 u16 icsid;
86 struct ics_irq_state irq_state[KVMPPC_XICS_IRQ_PER_ICS];
87};
88
89struct kvmppc_xics {
90 struct kvm *kvm;
91 struct kvm_device *dev;
92 struct dentry *dentry;
93 u32 max_icsid;
94 bool real_mode;
95 bool real_mode_dbg;
96 struct kvmppc_ics *ics[KVMPPC_XICS_MAX_ICS_ID + 1];
97};
98
99static inline struct kvmppc_icp *kvmppc_xics_find_server(struct kvm *kvm,
100 u32 nr)
101{
102 struct kvm_vcpu *vcpu = NULL;
103 int i;
104
105 kvm_for_each_vcpu(i, vcpu, kvm) {
106 if (vcpu->arch.icp && nr == vcpu->arch.icp->server_num)
107 return vcpu->arch.icp;
108 }
109 return NULL;
110}
111
112static inline struct kvmppc_ics *kvmppc_xics_find_ics(struct kvmppc_xics *xics,
113 u32 irq, u16 *source)
114{
115 u32 icsid = irq >> KVMPPC_XICS_ICS_SHIFT;
116 u16 src = irq & KVMPPC_XICS_SRC_MASK;
117 struct kvmppc_ics *ics;
118
119 if (source)
120 *source = src;
121 if (icsid > KVMPPC_XICS_MAX_ICS_ID)
122 return NULL;
123 ics = xics->ics[icsid];
124 if (!ics)
125 return NULL;
126 return ics;
127}
128
129
130#endif /* _KVM_PPC_BOOK3S_XICS_H */
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 020923e43134..1020119226db 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -222,8 +222,7 @@ void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
222 kvmppc_booke_queue_irqprio(vcpu, prio); 222 kvmppc_booke_queue_irqprio(vcpu, prio);
223} 223}
224 224
225void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu, 225void kvmppc_core_dequeue_external(struct kvm_vcpu *vcpu)
226 struct kvm_interrupt *irq)
227{ 226{
228 clear_bit(BOOKE_IRQPRIO_EXTERNAL, &vcpu->arch.pending_exceptions); 227 clear_bit(BOOKE_IRQPRIO_EXTERNAL, &vcpu->arch.pending_exceptions);
229 clear_bit(BOOKE_IRQPRIO_EXTERNAL_LEVEL, &vcpu->arch.pending_exceptions); 228 clear_bit(BOOKE_IRQPRIO_EXTERNAL_LEVEL, &vcpu->arch.pending_exceptions);
@@ -347,7 +346,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
347 keep_irq = true; 346 keep_irq = true;
348 } 347 }
349 348
350 if ((priority == BOOKE_IRQPRIO_EXTERNAL) && vcpu->arch.epr_enabled) 349 if ((priority == BOOKE_IRQPRIO_EXTERNAL) && vcpu->arch.epr_flags)
351 update_epr = true; 350 update_epr = true;
352 351
353 switch (priority) { 352 switch (priority) {
@@ -428,8 +427,14 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
428 set_guest_esr(vcpu, vcpu->arch.queued_esr); 427 set_guest_esr(vcpu, vcpu->arch.queued_esr);
429 if (update_dear == true) 428 if (update_dear == true)
430 set_guest_dear(vcpu, vcpu->arch.queued_dear); 429 set_guest_dear(vcpu, vcpu->arch.queued_dear);
431 if (update_epr == true) 430 if (update_epr == true) {
432 kvm_make_request(KVM_REQ_EPR_EXIT, vcpu); 431 if (vcpu->arch.epr_flags & KVMPPC_EPR_USER)
432 kvm_make_request(KVM_REQ_EPR_EXIT, vcpu);
433 else if (vcpu->arch.epr_flags & KVMPPC_EPR_KERNEL) {
434 BUG_ON(vcpu->arch.irq_type != KVMPPC_IRQ_MPIC);
435 kvmppc_mpic_set_epr(vcpu);
436 }
437 }
433 438
434 new_msr &= msr_mask; 439 new_msr &= msr_mask;
435#if defined(CONFIG_64BIT) 440#if defined(CONFIG_64BIT)
@@ -746,6 +751,9 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
746 kvmppc_core_queue_program(vcpu, ESR_PIL); 751 kvmppc_core_queue_program(vcpu, ESR_PIL);
747 return RESUME_HOST; 752 return RESUME_HOST;
748 753
754 case EMULATE_EXIT_USER:
755 return RESUME_HOST;
756
749 default: 757 default:
750 BUG(); 758 BUG();
751 } 759 }
@@ -1148,6 +1156,18 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1148 return r; 1156 return r;
1149} 1157}
1150 1158
1159static void kvmppc_set_tsr(struct kvm_vcpu *vcpu, u32 new_tsr)
1160{
1161 u32 old_tsr = vcpu->arch.tsr;
1162
1163 vcpu->arch.tsr = new_tsr;
1164
1165 if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
1166 arm_next_watchdog(vcpu);
1167
1168 update_timer_ints(vcpu);
1169}
1170
1151/* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */ 1171/* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */
1152int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 1172int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
1153{ 1173{
@@ -1287,16 +1307,8 @@ static int set_sregs_base(struct kvm_vcpu *vcpu,
1287 kvmppc_emulate_dec(vcpu); 1307 kvmppc_emulate_dec(vcpu);
1288 } 1308 }
1289 1309
1290 if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR) { 1310 if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR)
1291 u32 old_tsr = vcpu->arch.tsr; 1311 kvmppc_set_tsr(vcpu, sregs->u.e.tsr);
1292
1293 vcpu->arch.tsr = sregs->u.e.tsr;
1294
1295 if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
1296 arm_next_watchdog(vcpu);
1297
1298 update_timer_ints(vcpu);
1299 }
1300 1312
1301 return 0; 1313 return 0;
1302} 1314}
@@ -1409,84 +1421,134 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1409 1421
1410int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1422int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1411{ 1423{
1412 int r = -EINVAL; 1424 int r = 0;
1425 union kvmppc_one_reg val;
1426 int size;
1427 long int i;
1428
1429 size = one_reg_size(reg->id);
1430 if (size > sizeof(val))
1431 return -EINVAL;
1413 1432
1414 switch (reg->id) { 1433 switch (reg->id) {
1415 case KVM_REG_PPC_IAC1: 1434 case KVM_REG_PPC_IAC1:
1416 case KVM_REG_PPC_IAC2: 1435 case KVM_REG_PPC_IAC2:
1417 case KVM_REG_PPC_IAC3: 1436 case KVM_REG_PPC_IAC3:
1418 case KVM_REG_PPC_IAC4: { 1437 case KVM_REG_PPC_IAC4:
1419 int iac = reg->id - KVM_REG_PPC_IAC1; 1438 i = reg->id - KVM_REG_PPC_IAC1;
1420 r = copy_to_user((u64 __user *)(long)reg->addr, 1439 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.iac[i]);
1421 &vcpu->arch.dbg_reg.iac[iac], sizeof(u64));
1422 break; 1440 break;
1423 }
1424 case KVM_REG_PPC_DAC1: 1441 case KVM_REG_PPC_DAC1:
1425 case KVM_REG_PPC_DAC2: { 1442 case KVM_REG_PPC_DAC2:
1426 int dac = reg->id - KVM_REG_PPC_DAC1; 1443 i = reg->id - KVM_REG_PPC_DAC1;
1427 r = copy_to_user((u64 __user *)(long)reg->addr, 1444 val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac[i]);
1428 &vcpu->arch.dbg_reg.dac[dac], sizeof(u64));
1429 break; 1445 break;
1430 }
1431 case KVM_REG_PPC_EPR: { 1446 case KVM_REG_PPC_EPR: {
1432 u32 epr = get_guest_epr(vcpu); 1447 u32 epr = get_guest_epr(vcpu);
1433 r = put_user(epr, (u32 __user *)(long)reg->addr); 1448 val = get_reg_val(reg->id, epr);
1434 break; 1449 break;
1435 } 1450 }
1436#if defined(CONFIG_64BIT) 1451#if defined(CONFIG_64BIT)
1437 case KVM_REG_PPC_EPCR: 1452 case KVM_REG_PPC_EPCR:
1438 r = put_user(vcpu->arch.epcr, (u32 __user *)(long)reg->addr); 1453 val = get_reg_val(reg->id, vcpu->arch.epcr);
1439 break; 1454 break;
1440#endif 1455#endif
1456 case KVM_REG_PPC_TCR:
1457 val = get_reg_val(reg->id, vcpu->arch.tcr);
1458 break;
1459 case KVM_REG_PPC_TSR:
1460 val = get_reg_val(reg->id, vcpu->arch.tsr);
1461 break;
1462 case KVM_REG_PPC_DEBUG_INST:
1463 val = get_reg_val(reg->id, KVMPPC_INST_EHPRIV);
1464 break;
1441 default: 1465 default:
1466 r = kvmppc_get_one_reg(vcpu, reg->id, &val);
1442 break; 1467 break;
1443 } 1468 }
1469
1470 if (r)
1471 return r;
1472
1473 if (copy_to_user((char __user *)(unsigned long)reg->addr, &val, size))
1474 r = -EFAULT;
1475
1444 return r; 1476 return r;
1445} 1477}
1446 1478
1447int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) 1479int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
1448{ 1480{
1449 int r = -EINVAL; 1481 int r = 0;
1482 union kvmppc_one_reg val;
1483 int size;
1484 long int i;
1485
1486 size = one_reg_size(reg->id);
1487 if (size > sizeof(val))
1488 return -EINVAL;
1489
1490 if (copy_from_user(&val, (char __user *)(unsigned long)reg->addr, size))
1491 return -EFAULT;
1450 1492
1451 switch (reg->id) { 1493 switch (reg->id) {
1452 case KVM_REG_PPC_IAC1: 1494 case KVM_REG_PPC_IAC1:
1453 case KVM_REG_PPC_IAC2: 1495 case KVM_REG_PPC_IAC2:
1454 case KVM_REG_PPC_IAC3: 1496 case KVM_REG_PPC_IAC3:
1455 case KVM_REG_PPC_IAC4: { 1497 case KVM_REG_PPC_IAC4:
1456 int iac = reg->id - KVM_REG_PPC_IAC1; 1498 i = reg->id - KVM_REG_PPC_IAC1;
1457 r = copy_from_user(&vcpu->arch.dbg_reg.iac[iac], 1499 vcpu->arch.dbg_reg.iac[i] = set_reg_val(reg->id, val);
1458 (u64 __user *)(long)reg->addr, sizeof(u64));
1459 break; 1500 break;
1460 }
1461 case KVM_REG_PPC_DAC1: 1501 case KVM_REG_PPC_DAC1:
1462 case KVM_REG_PPC_DAC2: { 1502 case KVM_REG_PPC_DAC2:
1463 int dac = reg->id - KVM_REG_PPC_DAC1; 1503 i = reg->id - KVM_REG_PPC_DAC1;
1464 r = copy_from_user(&vcpu->arch.dbg_reg.dac[dac], 1504 vcpu->arch.dbg_reg.dac[i] = set_reg_val(reg->id, val);
1465 (u64 __user *)(long)reg->addr, sizeof(u64));
1466 break; 1505 break;
1467 }
1468 case KVM_REG_PPC_EPR: { 1506 case KVM_REG_PPC_EPR: {
1469 u32 new_epr; 1507 u32 new_epr = set_reg_val(reg->id, val);
1470 r = get_user(new_epr, (u32 __user *)(long)reg->addr); 1508 kvmppc_set_epr(vcpu, new_epr);
1471 if (!r)
1472 kvmppc_set_epr(vcpu, new_epr);
1473 break; 1509 break;
1474 } 1510 }
1475#if defined(CONFIG_64BIT) 1511#if defined(CONFIG_64BIT)
1476 case KVM_REG_PPC_EPCR: { 1512 case KVM_REG_PPC_EPCR: {
1477 u32 new_epcr; 1513 u32 new_epcr = set_reg_val(reg->id, val);
1478 r = get_user(new_epcr, (u32 __user *)(long)reg->addr); 1514 kvmppc_set_epcr(vcpu, new_epcr);
1479 if (r == 0)
1480 kvmppc_set_epcr(vcpu, new_epcr);
1481 break; 1515 break;
1482 } 1516 }
1483#endif 1517#endif
1518 case KVM_REG_PPC_OR_TSR: {
1519 u32 tsr_bits = set_reg_val(reg->id, val);
1520 kvmppc_set_tsr_bits(vcpu, tsr_bits);
1521 break;
1522 }
1523 case KVM_REG_PPC_CLEAR_TSR: {
1524 u32 tsr_bits = set_reg_val(reg->id, val);
1525 kvmppc_clr_tsr_bits(vcpu, tsr_bits);
1526 break;
1527 }
1528 case KVM_REG_PPC_TSR: {
1529 u32 tsr = set_reg_val(reg->id, val);
1530 kvmppc_set_tsr(vcpu, tsr);
1531 break;
1532 }
1533 case KVM_REG_PPC_TCR: {
1534 u32 tcr = set_reg_val(reg->id, val);
1535 kvmppc_set_tcr(vcpu, tcr);
1536 break;
1537 }
1484 default: 1538 default:
1539 r = kvmppc_set_one_reg(vcpu, reg->id, &val);
1485 break; 1540 break;
1486 } 1541 }
1542
1487 return r; 1543 return r;
1488} 1544}
1489 1545
1546int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
1547 struct kvm_guest_debug *dbg)
1548{
1549 return -EINVAL;
1550}
1551
1490int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 1552int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
1491{ 1553{
1492 return -ENOTSUPP; 1554 return -ENOTSUPP;
@@ -1531,7 +1593,7 @@ int kvmppc_core_prepare_memory_region(struct kvm *kvm,
1531 1593
1532void kvmppc_core_commit_memory_region(struct kvm *kvm, 1594void kvmppc_core_commit_memory_region(struct kvm *kvm,
1533 struct kvm_userspace_memory_region *mem, 1595 struct kvm_userspace_memory_region *mem,
1534 struct kvm_memory_slot old) 1596 const struct kvm_memory_slot *old)
1535{ 1597{
1536} 1598}
1537 1599
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index f4bb55c96517..2c6deb5ef2fe 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -54,8 +54,7 @@
54 (1<<BOOKE_INTERRUPT_DTLB_MISS) | \ 54 (1<<BOOKE_INTERRUPT_DTLB_MISS) | \
55 (1<<BOOKE_INTERRUPT_ALIGNMENT)) 55 (1<<BOOKE_INTERRUPT_ALIGNMENT))
56 56
57.macro KVM_HANDLER ivor_nr scratch srr0 57.macro __KVM_HANDLER ivor_nr scratch srr0
58_GLOBAL(kvmppc_handler_\ivor_nr)
59 /* Get pointer to vcpu and record exit number. */ 58 /* Get pointer to vcpu and record exit number. */
60 mtspr \scratch , r4 59 mtspr \scratch , r4
61 mfspr r4, SPRN_SPRG_THREAD 60 mfspr r4, SPRN_SPRG_THREAD
@@ -76,6 +75,43 @@ _GLOBAL(kvmppc_handler_\ivor_nr)
76 bctr 75 bctr
77.endm 76.endm
78 77
78.macro KVM_HANDLER ivor_nr scratch srr0
79_GLOBAL(kvmppc_handler_\ivor_nr)
80 __KVM_HANDLER \ivor_nr \scratch \srr0
81.endm
82
83.macro KVM_DBG_HANDLER ivor_nr scratch srr0
84_GLOBAL(kvmppc_handler_\ivor_nr)
85 mtspr \scratch, r4
86 mfspr r4, SPRN_SPRG_THREAD
87 lwz r4, THREAD_KVM_VCPU(r4)
88 stw r3, VCPU_CRIT_SAVE(r4)
89 mfcr r3
90 mfspr r4, SPRN_CSRR1
91 andi. r4, r4, MSR_PR
92 bne 1f
93 /* debug interrupt happened in enter/exit path */
94 mfspr r4, SPRN_CSRR1
95 rlwinm r4, r4, 0, ~MSR_DE
96 mtspr SPRN_CSRR1, r4
97 lis r4, 0xffff
98 ori r4, r4, 0xffff
99 mtspr SPRN_DBSR, r4
100 mfspr r4, SPRN_SPRG_THREAD
101 lwz r4, THREAD_KVM_VCPU(r4)
102 mtcr r3
103 lwz r3, VCPU_CRIT_SAVE(r4)
104 mfspr r4, \scratch
105 rfci
1061: /* debug interrupt happened in guest */
107 mtcr r3
108 mfspr r4, SPRN_SPRG_THREAD
109 lwz r4, THREAD_KVM_VCPU(r4)
110 lwz r3, VCPU_CRIT_SAVE(r4)
111 mfspr r4, \scratch
112 __KVM_HANDLER \ivor_nr \scratch \srr0
113.endm
114
79.macro KVM_HANDLER_ADDR ivor_nr 115.macro KVM_HANDLER_ADDR ivor_nr
80 .long kvmppc_handler_\ivor_nr 116 .long kvmppc_handler_\ivor_nr
81.endm 117.endm
@@ -100,7 +136,7 @@ KVM_HANDLER BOOKE_INTERRUPT_FIT SPRN_SPRG_RSCRATCH0 SPRN_SRR0
100KVM_HANDLER BOOKE_INTERRUPT_WATCHDOG SPRN_SPRG_RSCRATCH_CRIT SPRN_CSRR0 136KVM_HANDLER BOOKE_INTERRUPT_WATCHDOG SPRN_SPRG_RSCRATCH_CRIT SPRN_CSRR0
101KVM_HANDLER BOOKE_INTERRUPT_DTLB_MISS SPRN_SPRG_RSCRATCH0 SPRN_SRR0 137KVM_HANDLER BOOKE_INTERRUPT_DTLB_MISS SPRN_SPRG_RSCRATCH0 SPRN_SRR0
102KVM_HANDLER BOOKE_INTERRUPT_ITLB_MISS SPRN_SPRG_RSCRATCH0 SPRN_SRR0 138KVM_HANDLER BOOKE_INTERRUPT_ITLB_MISS SPRN_SPRG_RSCRATCH0 SPRN_SRR0
103KVM_HANDLER BOOKE_INTERRUPT_DEBUG SPRN_SPRG_RSCRATCH_CRIT SPRN_CSRR0 139KVM_DBG_HANDLER BOOKE_INTERRUPT_DEBUG SPRN_SPRG_RSCRATCH_CRIT SPRN_CSRR0
104KVM_HANDLER BOOKE_INTERRUPT_SPE_UNAVAIL SPRN_SPRG_RSCRATCH0 SPRN_SRR0 140KVM_HANDLER BOOKE_INTERRUPT_SPE_UNAVAIL SPRN_SPRG_RSCRATCH0 SPRN_SRR0
105KVM_HANDLER BOOKE_INTERRUPT_SPE_FP_DATA SPRN_SPRG_RSCRATCH0 SPRN_SRR0 141KVM_HANDLER BOOKE_INTERRUPT_SPE_FP_DATA SPRN_SPRG_RSCRATCH0 SPRN_SRR0
106KVM_HANDLER BOOKE_INTERRUPT_SPE_FP_ROUND SPRN_SPRG_RSCRATCH0 SPRN_SRR0 142KVM_HANDLER BOOKE_INTERRUPT_SPE_FP_ROUND SPRN_SPRG_RSCRATCH0 SPRN_SRR0
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index 6dd4de7802bf..ce6b73c29612 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -425,6 +425,20 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
425 return kvmppc_set_sregs_ivor(vcpu, sregs); 425 return kvmppc_set_sregs_ivor(vcpu, sregs);
426} 426}
427 427
428int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
429 union kvmppc_one_reg *val)
430{
431 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
432 return r;
433}
434
435int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id,
436 union kvmppc_one_reg *val)
437{
438 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
439 return r;
440}
441
428struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) 442struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
429{ 443{
430 struct kvmppc_vcpu_e500 *vcpu_e500; 444 struct kvmppc_vcpu_e500 *vcpu_e500;
diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h
index 33db48a8ce24..c2e5e98453a6 100644
--- a/arch/powerpc/kvm/e500.h
+++ b/arch/powerpc/kvm/e500.h
@@ -23,6 +23,10 @@
23#include <asm/mmu-book3e.h> 23#include <asm/mmu-book3e.h>
24#include <asm/tlb.h> 24#include <asm/tlb.h>
25 25
26enum vcpu_ftr {
27 VCPU_FTR_MMU_V2
28};
29
26#define E500_PID_NUM 3 30#define E500_PID_NUM 3
27#define E500_TLB_NUM 2 31#define E500_TLB_NUM 2
28 32
@@ -131,6 +135,10 @@ void kvmppc_e500_tlb_uninit(struct kvmppc_vcpu_e500 *vcpu_e500);
131void kvmppc_get_sregs_e500_tlb(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 135void kvmppc_get_sregs_e500_tlb(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
132int kvmppc_set_sregs_e500_tlb(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs); 136int kvmppc_set_sregs_e500_tlb(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs);
133 137
138int kvmppc_get_one_reg_e500_tlb(struct kvm_vcpu *vcpu, u64 id,
139 union kvmppc_one_reg *val);
140int kvmppc_set_one_reg_e500_tlb(struct kvm_vcpu *vcpu, u64 id,
141 union kvmppc_one_reg *val);
134 142
135#ifdef CONFIG_KVM_E500V2 143#ifdef CONFIG_KVM_E500V2
136unsigned int kvmppc_e500_get_sid(struct kvmppc_vcpu_e500 *vcpu_e500, 144unsigned int kvmppc_e500_get_sid(struct kvmppc_vcpu_e500 *vcpu_e500,
@@ -295,4 +303,18 @@ static inline unsigned int get_tlbmiss_tid(struct kvm_vcpu *vcpu)
295#define get_tlb_sts(gtlbe) (MAS1_TS) 303#define get_tlb_sts(gtlbe) (MAS1_TS)
296#endif /* !BOOKE_HV */ 304#endif /* !BOOKE_HV */
297 305
306static inline bool has_feature(const struct kvm_vcpu *vcpu,
307 enum vcpu_ftr ftr)
308{
309 bool has_ftr;
310 switch (ftr) {
311 case VCPU_FTR_MMU_V2:
312 has_ftr = ((vcpu->arch.mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V2);
313 break;
314 default:
315 return false;
316 }
317 return has_ftr;
318}
319
298#endif /* KVM_E500_H */ 320#endif /* KVM_E500_H */
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index e78f353a836a..b10a01243abd 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -284,6 +284,16 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
284 case SPRN_TLB1CFG: 284 case SPRN_TLB1CFG:
285 *spr_val = vcpu->arch.tlbcfg[1]; 285 *spr_val = vcpu->arch.tlbcfg[1];
286 break; 286 break;
287 case SPRN_TLB0PS:
288 if (!has_feature(vcpu, VCPU_FTR_MMU_V2))
289 return EMULATE_FAIL;
290 *spr_val = vcpu->arch.tlbps[0];
291 break;
292 case SPRN_TLB1PS:
293 if (!has_feature(vcpu, VCPU_FTR_MMU_V2))
294 return EMULATE_FAIL;
295 *spr_val = vcpu->arch.tlbps[1];
296 break;
287 case SPRN_L1CSR0: 297 case SPRN_L1CSR0:
288 *spr_val = vcpu_e500->l1csr0; 298 *spr_val = vcpu_e500->l1csr0;
289 break; 299 break;
@@ -307,6 +317,15 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
307 case SPRN_MMUCFG: 317 case SPRN_MMUCFG:
308 *spr_val = vcpu->arch.mmucfg; 318 *spr_val = vcpu->arch.mmucfg;
309 break; 319 break;
320 case SPRN_EPTCFG:
321 if (!has_feature(vcpu, VCPU_FTR_MMU_V2))
322 return EMULATE_FAIL;
323 /*
324 * Legacy Linux guests access EPTCFG register even if the E.PT
325 * category is disabled in the VM. Give them a chance to live.
326 */
327 *spr_val = vcpu->arch.eptcfg;
328 break;
310 329
311 /* extra exceptions */ 330 /* extra exceptions */
312 case SPRN_IVOR32: 331 case SPRN_IVOR32:
diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c
index 5c4475983f78..c41a5a96b558 100644
--- a/arch/powerpc/kvm/e500_mmu.c
+++ b/arch/powerpc/kvm/e500_mmu.c
@@ -596,6 +596,140 @@ int kvmppc_set_sregs_e500_tlb(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
596 return 0; 596 return 0;
597} 597}
598 598
599int kvmppc_get_one_reg_e500_tlb(struct kvm_vcpu *vcpu, u64 id,
600 union kvmppc_one_reg *val)
601{
602 int r = 0;
603 long int i;
604
605 switch (id) {
606 case KVM_REG_PPC_MAS0:
607 *val = get_reg_val(id, vcpu->arch.shared->mas0);
608 break;
609 case KVM_REG_PPC_MAS1:
610 *val = get_reg_val(id, vcpu->arch.shared->mas1);
611 break;
612 case KVM_REG_PPC_MAS2:
613 *val = get_reg_val(id, vcpu->arch.shared->mas2);
614 break;
615 case KVM_REG_PPC_MAS7_3:
616 *val = get_reg_val(id, vcpu->arch.shared->mas7_3);
617 break;
618 case KVM_REG_PPC_MAS4:
619 *val = get_reg_val(id, vcpu->arch.shared->mas4);
620 break;
621 case KVM_REG_PPC_MAS6:
622 *val = get_reg_val(id, vcpu->arch.shared->mas6);
623 break;
624 case KVM_REG_PPC_MMUCFG:
625 *val = get_reg_val(id, vcpu->arch.mmucfg);
626 break;
627 case KVM_REG_PPC_EPTCFG:
628 *val = get_reg_val(id, vcpu->arch.eptcfg);
629 break;
630 case KVM_REG_PPC_TLB0CFG:
631 case KVM_REG_PPC_TLB1CFG:
632 case KVM_REG_PPC_TLB2CFG:
633 case KVM_REG_PPC_TLB3CFG:
634 i = id - KVM_REG_PPC_TLB0CFG;
635 *val = get_reg_val(id, vcpu->arch.tlbcfg[i]);
636 break;
637 case KVM_REG_PPC_TLB0PS:
638 case KVM_REG_PPC_TLB1PS:
639 case KVM_REG_PPC_TLB2PS:
640 case KVM_REG_PPC_TLB3PS:
641 i = id - KVM_REG_PPC_TLB0PS;
642 *val = get_reg_val(id, vcpu->arch.tlbps[i]);
643 break;
644 default:
645 r = -EINVAL;
646 break;
647 }
648
649 return r;
650}
651
652int kvmppc_set_one_reg_e500_tlb(struct kvm_vcpu *vcpu, u64 id,
653 union kvmppc_one_reg *val)
654{
655 int r = 0;
656 long int i;
657
658 switch (id) {
659 case KVM_REG_PPC_MAS0:
660 vcpu->arch.shared->mas0 = set_reg_val(id, *val);
661 break;
662 case KVM_REG_PPC_MAS1:
663 vcpu->arch.shared->mas1 = set_reg_val(id, *val);
664 break;
665 case KVM_REG_PPC_MAS2:
666 vcpu->arch.shared->mas2 = set_reg_val(id, *val);
667 break;
668 case KVM_REG_PPC_MAS7_3:
669 vcpu->arch.shared->mas7_3 = set_reg_val(id, *val);
670 break;
671 case KVM_REG_PPC_MAS4:
672 vcpu->arch.shared->mas4 = set_reg_val(id, *val);
673 break;
674 case KVM_REG_PPC_MAS6:
675 vcpu->arch.shared->mas6 = set_reg_val(id, *val);
676 break;
677 /* Only allow MMU registers to be set to the config supported by KVM */
678 case KVM_REG_PPC_MMUCFG: {
679 u32 reg = set_reg_val(id, *val);
680 if (reg != vcpu->arch.mmucfg)
681 r = -EINVAL;
682 break;
683 }
684 case KVM_REG_PPC_EPTCFG: {
685 u32 reg = set_reg_val(id, *val);
686 if (reg != vcpu->arch.eptcfg)
687 r = -EINVAL;
688 break;
689 }
690 case KVM_REG_PPC_TLB0CFG:
691 case KVM_REG_PPC_TLB1CFG:
692 case KVM_REG_PPC_TLB2CFG:
693 case KVM_REG_PPC_TLB3CFG: {
694 /* MMU geometry (N_ENTRY/ASSOC) can be set only using SW_TLB */
695 u32 reg = set_reg_val(id, *val);
696 i = id - KVM_REG_PPC_TLB0CFG;
697 if (reg != vcpu->arch.tlbcfg[i])
698 r = -EINVAL;
699 break;
700 }
701 case KVM_REG_PPC_TLB0PS:
702 case KVM_REG_PPC_TLB1PS:
703 case KVM_REG_PPC_TLB2PS:
704 case KVM_REG_PPC_TLB3PS: {
705 u32 reg = set_reg_val(id, *val);
706 i = id - KVM_REG_PPC_TLB0PS;
707 if (reg != vcpu->arch.tlbps[i])
708 r = -EINVAL;
709 break;
710 }
711 default:
712 r = -EINVAL;
713 break;
714 }
715
716 return r;
717}
718
719static int vcpu_mmu_geometry_update(struct kvm_vcpu *vcpu,
720 struct kvm_book3e_206_tlb_params *params)
721{
722 vcpu->arch.tlbcfg[0] &= ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
723 if (params->tlb_sizes[0] <= 2048)
724 vcpu->arch.tlbcfg[0] |= params->tlb_sizes[0];
725 vcpu->arch.tlbcfg[0] |= params->tlb_ways[0] << TLBnCFG_ASSOC_SHIFT;
726
727 vcpu->arch.tlbcfg[1] &= ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
728 vcpu->arch.tlbcfg[1] |= params->tlb_sizes[1];
729 vcpu->arch.tlbcfg[1] |= params->tlb_ways[1] << TLBnCFG_ASSOC_SHIFT;
730 return 0;
731}
732
599int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu, 733int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu,
600 struct kvm_config_tlb *cfg) 734 struct kvm_config_tlb *cfg)
601{ 735{
@@ -692,16 +826,8 @@ int kvm_vcpu_ioctl_config_tlb(struct kvm_vcpu *vcpu,
692 vcpu_e500->gtlb_offset[0] = 0; 826 vcpu_e500->gtlb_offset[0] = 0;
693 vcpu_e500->gtlb_offset[1] = params.tlb_sizes[0]; 827 vcpu_e500->gtlb_offset[1] = params.tlb_sizes[0];
694 828
695 vcpu->arch.mmucfg = mfspr(SPRN_MMUCFG) & ~MMUCFG_LPIDSIZE; 829 /* Update vcpu's MMU geometry based on SW_TLB input */
696 830 vcpu_mmu_geometry_update(vcpu, &params);
697 vcpu->arch.tlbcfg[0] &= ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
698 if (params.tlb_sizes[0] <= 2048)
699 vcpu->arch.tlbcfg[0] |= params.tlb_sizes[0];
700 vcpu->arch.tlbcfg[0] |= params.tlb_ways[0] << TLBnCFG_ASSOC_SHIFT;
701
702 vcpu->arch.tlbcfg[1] &= ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
703 vcpu->arch.tlbcfg[1] |= params.tlb_sizes[1];
704 vcpu->arch.tlbcfg[1] |= params.tlb_ways[1] << TLBnCFG_ASSOC_SHIFT;
705 831
706 vcpu_e500->shared_tlb_pages = pages; 832 vcpu_e500->shared_tlb_pages = pages;
707 vcpu_e500->num_shared_tlb_pages = num_pages; 833 vcpu_e500->num_shared_tlb_pages = num_pages;
@@ -737,6 +863,39 @@ int kvm_vcpu_ioctl_dirty_tlb(struct kvm_vcpu *vcpu,
737 return 0; 863 return 0;
738} 864}
739 865
866/* Vcpu's MMU default configuration */
867static int vcpu_mmu_init(struct kvm_vcpu *vcpu,
868 struct kvmppc_e500_tlb_params *params)
869{
870 /* Initialize RASIZE, PIDSIZE, NTLBS and MAVN fields with host values*/
871 vcpu->arch.mmucfg = mfspr(SPRN_MMUCFG) & ~MMUCFG_LPIDSIZE;
872
873 /* Initialize TLBnCFG fields with host values and SW_TLB geometry*/
874 vcpu->arch.tlbcfg[0] = mfspr(SPRN_TLB0CFG) &
875 ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
876 vcpu->arch.tlbcfg[0] |= params[0].entries;
877 vcpu->arch.tlbcfg[0] |= params[0].ways << TLBnCFG_ASSOC_SHIFT;
878
879 vcpu->arch.tlbcfg[1] = mfspr(SPRN_TLB1CFG) &
880 ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
881 vcpu->arch.tlbcfg[1] |= params[1].entries;
882 vcpu->arch.tlbcfg[1] |= params[1].ways << TLBnCFG_ASSOC_SHIFT;
883
884 if (has_feature(vcpu, VCPU_FTR_MMU_V2)) {
885 vcpu->arch.tlbps[0] = mfspr(SPRN_TLB0PS);
886 vcpu->arch.tlbps[1] = mfspr(SPRN_TLB1PS);
887
888 vcpu->arch.mmucfg &= ~MMUCFG_LRAT;
889
890 /* Guest mmu emulation currently doesn't handle E.PT */
891 vcpu->arch.eptcfg = 0;
892 vcpu->arch.tlbcfg[0] &= ~TLBnCFG_PT;
893 vcpu->arch.tlbcfg[1] &= ~TLBnCFG_IND;
894 }
895
896 return 0;
897}
898
740int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500) 899int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500)
741{ 900{
742 struct kvm_vcpu *vcpu = &vcpu_e500->vcpu; 901 struct kvm_vcpu *vcpu = &vcpu_e500->vcpu;
@@ -781,18 +940,7 @@ int kvmppc_e500_tlb_init(struct kvmppc_vcpu_e500 *vcpu_e500)
781 if (!vcpu_e500->g2h_tlb1_map) 940 if (!vcpu_e500->g2h_tlb1_map)
782 goto err; 941 goto err;
783 942
784 /* Init TLB configuration register */ 943 vcpu_mmu_init(vcpu, vcpu_e500->gtlb_params);
785 vcpu->arch.tlbcfg[0] = mfspr(SPRN_TLB0CFG) &
786 ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
787 vcpu->arch.tlbcfg[0] |= vcpu_e500->gtlb_params[0].entries;
788 vcpu->arch.tlbcfg[0] |=
789 vcpu_e500->gtlb_params[0].ways << TLBnCFG_ASSOC_SHIFT;
790
791 vcpu->arch.tlbcfg[1] = mfspr(SPRN_TLB1CFG) &
792 ~(TLBnCFG_N_ENTRY | TLBnCFG_ASSOC);
793 vcpu->arch.tlbcfg[1] |= vcpu_e500->gtlb_params[1].entries;
794 vcpu->arch.tlbcfg[1] |=
795 vcpu_e500->gtlb_params[1].ways << TLBnCFG_ASSOC_SHIFT;
796 944
797 kvmppc_recalc_tlb1map_range(vcpu_e500); 945 kvmppc_recalc_tlb1map_range(vcpu_e500);
798 return 0; 946 return 0;
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 2f4baa074b2e..753cc99eff2b 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -177,6 +177,8 @@ int kvmppc_core_check_processor_compat(void)
177 r = 0; 177 r = 0;
178 else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0) 178 else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0)
179 r = 0; 179 r = 0;
180 else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0)
181 r = 0;
180 else 182 else
181 r = -ENOTSUPP; 183 r = -ENOTSUPP;
182 184
@@ -260,6 +262,20 @@ int kvmppc_core_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
260 return kvmppc_set_sregs_ivor(vcpu, sregs); 262 return kvmppc_set_sregs_ivor(vcpu, sregs);
261} 263}
262 264
265int kvmppc_get_one_reg(struct kvm_vcpu *vcpu, u64 id,
266 union kvmppc_one_reg *val)
267{
268 int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
269 return r;
270}
271
272int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id,
273 union kvmppc_one_reg *val)
274{
275 int r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val);
276 return r;
277}
278
263struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) 279struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
264{ 280{
265 struct kvmppc_vcpu_e500 *vcpu_e500; 281 struct kvmppc_vcpu_e500 *vcpu_e500;
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 7a73b6f72a8b..631a2650e4e4 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -38,6 +38,7 @@
38 38
39#define OP_31_XOP_TRAP 4 39#define OP_31_XOP_TRAP 4
40#define OP_31_XOP_LWZX 23 40#define OP_31_XOP_LWZX 23
41#define OP_31_XOP_DCBST 54
41#define OP_31_XOP_TRAP_64 68 42#define OP_31_XOP_TRAP_64 68
42#define OP_31_XOP_DCBF 86 43#define OP_31_XOP_DCBF 86
43#define OP_31_XOP_LBZX 87 44#define OP_31_XOP_LBZX 87
@@ -370,6 +371,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
370 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs); 371 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs);
371 break; 372 break;
372 373
374 case OP_31_XOP_DCBST:
373 case OP_31_XOP_DCBF: 375 case OP_31_XOP_DCBF:
374 case OP_31_XOP_DCBI: 376 case OP_31_XOP_DCBI:
375 /* Do nothing. The guest is performing dcbi because 377 /* Do nothing. The guest is performing dcbi because
diff --git a/arch/powerpc/kvm/irq.h b/arch/powerpc/kvm/irq.h
new file mode 100644
index 000000000000..5a9a10b90762
--- /dev/null
+++ b/arch/powerpc/kvm/irq.h
@@ -0,0 +1,20 @@
1#ifndef __IRQ_H
2#define __IRQ_H
3
4#include <linux/kvm_host.h>
5
6static inline int irqchip_in_kernel(struct kvm *kvm)
7{
8 int ret = 0;
9
10#ifdef CONFIG_KVM_MPIC
11 ret = ret || (kvm->arch.mpic != NULL);
12#endif
13#ifdef CONFIG_KVM_XICS
14 ret = ret || (kvm->arch.xics != NULL);
15#endif
16 smp_rmb();
17 return ret;
18}
19
20#endif
diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
new file mode 100644
index 000000000000..2861ae9eaae6
--- /dev/null
+++ b/arch/powerpc/kvm/mpic.c
@@ -0,0 +1,1853 @@
1/*
2 * OpenPIC emulation
3 *
4 * Copyright (c) 2004 Jocelyn Mayer
5 * 2011 Alexander Graf
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26#include <linux/slab.h>
27#include <linux/mutex.h>
28#include <linux/kvm_host.h>
29#include <linux/errno.h>
30#include <linux/fs.h>
31#include <linux/anon_inodes.h>
32#include <asm/uaccess.h>
33#include <asm/mpic.h>
34#include <asm/kvm_para.h>
35#include <asm/kvm_host.h>
36#include <asm/kvm_ppc.h>
37#include "iodev.h"
38
39#define MAX_CPU 32
40#define MAX_SRC 256
41#define MAX_TMR 4
42#define MAX_IPI 4
43#define MAX_MSI 8
44#define MAX_IRQ (MAX_SRC + MAX_IPI + MAX_TMR)
45#define VID 0x03 /* MPIC version ID */
46
47/* OpenPIC capability flags */
48#define OPENPIC_FLAG_IDR_CRIT (1 << 0)
49#define OPENPIC_FLAG_ILR (2 << 0)
50
51/* OpenPIC address map */
52#define OPENPIC_REG_SIZE 0x40000
53#define OPENPIC_GLB_REG_START 0x0
54#define OPENPIC_GLB_REG_SIZE 0x10F0
55#define OPENPIC_TMR_REG_START 0x10F0
56#define OPENPIC_TMR_REG_SIZE 0x220
57#define OPENPIC_MSI_REG_START 0x1600
58#define OPENPIC_MSI_REG_SIZE 0x200
59#define OPENPIC_SUMMARY_REG_START 0x3800
60#define OPENPIC_SUMMARY_REG_SIZE 0x800
61#define OPENPIC_SRC_REG_START 0x10000
62#define OPENPIC_SRC_REG_SIZE (MAX_SRC * 0x20)
63#define OPENPIC_CPU_REG_START 0x20000
64#define OPENPIC_CPU_REG_SIZE (0x100 + ((MAX_CPU - 1) * 0x1000))
65
66struct fsl_mpic_info {
67 int max_ext;
68};
69
70static struct fsl_mpic_info fsl_mpic_20 = {
71 .max_ext = 12,
72};
73
74static struct fsl_mpic_info fsl_mpic_42 = {
75 .max_ext = 12,
76};
77
78#define FRR_NIRQ_SHIFT 16
79#define FRR_NCPU_SHIFT 8
80#define FRR_VID_SHIFT 0
81
82#define VID_REVISION_1_2 2
83#define VID_REVISION_1_3 3
84
85#define VIR_GENERIC 0x00000000 /* Generic Vendor ID */
86
87#define GCR_RESET 0x80000000
88#define GCR_MODE_PASS 0x00000000
89#define GCR_MODE_MIXED 0x20000000
90#define GCR_MODE_PROXY 0x60000000
91
92#define TBCR_CI 0x80000000 /* count inhibit */
93#define TCCR_TOG 0x80000000 /* toggles when decrement to zero */
94
95#define IDR_EP_SHIFT 31
96#define IDR_EP_MASK (1 << IDR_EP_SHIFT)
97#define IDR_CI0_SHIFT 30
98#define IDR_CI1_SHIFT 29
99#define IDR_P1_SHIFT 1
100#define IDR_P0_SHIFT 0
101
102#define ILR_INTTGT_MASK 0x000000ff
103#define ILR_INTTGT_INT 0x00
104#define ILR_INTTGT_CINT 0x01 /* critical */
105#define ILR_INTTGT_MCP 0x02 /* machine check */
106#define NUM_OUTPUTS 3
107
108#define MSIIR_OFFSET 0x140
109#define MSIIR_SRS_SHIFT 29
110#define MSIIR_SRS_MASK (0x7 << MSIIR_SRS_SHIFT)
111#define MSIIR_IBS_SHIFT 24
112#define MSIIR_IBS_MASK (0x1f << MSIIR_IBS_SHIFT)
113
114static int get_current_cpu(void)
115{
116#if defined(CONFIG_KVM) && defined(CONFIG_BOOKE)
117 struct kvm_vcpu *vcpu = current->thread.kvm_vcpu;
118 return vcpu ? vcpu->arch.irq_cpu_id : -1;
119#else
120 /* XXX */
121 return -1;
122#endif
123}
124
125static int openpic_cpu_write_internal(void *opaque, gpa_t addr,
126 u32 val, int idx);
127static int openpic_cpu_read_internal(void *opaque, gpa_t addr,
128 u32 *ptr, int idx);
129
130enum irq_type {
131 IRQ_TYPE_NORMAL = 0,
132 IRQ_TYPE_FSLINT, /* FSL internal interrupt -- level only */
133 IRQ_TYPE_FSLSPECIAL, /* FSL timer/IPI interrupt, edge, no polarity */
134};
135
136struct irq_queue {
137 /* Round up to the nearest 64 IRQs so that the queue length
138 * won't change when moving between 32 and 64 bit hosts.
139 */
140 unsigned long queue[BITS_TO_LONGS((MAX_IRQ + 63) & ~63)];
141 int next;
142 int priority;
143};
144
145struct irq_source {
146 uint32_t ivpr; /* IRQ vector/priority register */
147 uint32_t idr; /* IRQ destination register */
148 uint32_t destmask; /* bitmap of CPU destinations */
149 int last_cpu;
150 int output; /* IRQ level, e.g. ILR_INTTGT_INT */
151 int pending; /* TRUE if IRQ is pending */
152 enum irq_type type;
153 bool level:1; /* level-triggered */
154 bool nomask:1; /* critical interrupts ignore mask on some FSL MPICs */
155};
156
157#define IVPR_MASK_SHIFT 31
158#define IVPR_MASK_MASK (1 << IVPR_MASK_SHIFT)
159#define IVPR_ACTIVITY_SHIFT 30
160#define IVPR_ACTIVITY_MASK (1 << IVPR_ACTIVITY_SHIFT)
161#define IVPR_MODE_SHIFT 29
162#define IVPR_MODE_MASK (1 << IVPR_MODE_SHIFT)
163#define IVPR_POLARITY_SHIFT 23
164#define IVPR_POLARITY_MASK (1 << IVPR_POLARITY_SHIFT)
165#define IVPR_SENSE_SHIFT 22
166#define IVPR_SENSE_MASK (1 << IVPR_SENSE_SHIFT)
167
168#define IVPR_PRIORITY_MASK (0xF << 16)
169#define IVPR_PRIORITY(_ivprr_) ((int)(((_ivprr_) & IVPR_PRIORITY_MASK) >> 16))
170#define IVPR_VECTOR(opp, _ivprr_) ((_ivprr_) & (opp)->vector_mask)
171
172/* IDR[EP/CI] are only for FSL MPIC prior to v4.0 */
173#define IDR_EP 0x80000000 /* external pin */
174#define IDR_CI 0x40000000 /* critical interrupt */
175
176struct irq_dest {
177 struct kvm_vcpu *vcpu;
178
179 int32_t ctpr; /* CPU current task priority */
180 struct irq_queue raised;
181 struct irq_queue servicing;
182
183 /* Count of IRQ sources asserting on non-INT outputs */
184 uint32_t outputs_active[NUM_OUTPUTS];
185};
186
187#define MAX_MMIO_REGIONS 10
188
189struct openpic {
190 struct kvm *kvm;
191 struct kvm_device *dev;
192 struct kvm_io_device mmio;
193 const struct mem_reg *mmio_regions[MAX_MMIO_REGIONS];
194 int num_mmio_regions;
195
196 gpa_t reg_base;
197 spinlock_t lock;
198
199 /* Behavior control */
200 struct fsl_mpic_info *fsl;
201 uint32_t model;
202 uint32_t flags;
203 uint32_t nb_irqs;
204 uint32_t vid;
205 uint32_t vir; /* Vendor identification register */
206 uint32_t vector_mask;
207 uint32_t tfrr_reset;
208 uint32_t ivpr_reset;
209 uint32_t idr_reset;
210 uint32_t brr1;
211 uint32_t mpic_mode_mask;
212
213 /* Global registers */
214 uint32_t frr; /* Feature reporting register */
215 uint32_t gcr; /* Global configuration register */
216 uint32_t pir; /* Processor initialization register */
217 uint32_t spve; /* Spurious vector register */
218 uint32_t tfrr; /* Timer frequency reporting register */
219 /* Source registers */
220 struct irq_source src[MAX_IRQ];
221 /* Local registers per output pin */
222 struct irq_dest dst[MAX_CPU];
223 uint32_t nb_cpus;
224 /* Timer registers */
225 struct {
226 uint32_t tccr; /* Global timer current count register */
227 uint32_t tbcr; /* Global timer base count register */
228 } timers[MAX_TMR];
229 /* Shared MSI registers */
230 struct {
231 uint32_t msir; /* Shared Message Signaled Interrupt Register */
232 } msi[MAX_MSI];
233 uint32_t max_irq;
234 uint32_t irq_ipi0;
235 uint32_t irq_tim0;
236 uint32_t irq_msi;
237};
238
239
240static void mpic_irq_raise(struct openpic *opp, struct irq_dest *dst,
241 int output)
242{
243 struct kvm_interrupt irq = {
244 .irq = KVM_INTERRUPT_SET_LEVEL,
245 };
246
247 if (!dst->vcpu) {
248 pr_debug("%s: destination cpu %d does not exist\n",
249 __func__, (int)(dst - &opp->dst[0]));
250 return;
251 }
252
253 pr_debug("%s: cpu %d output %d\n", __func__, dst->vcpu->arch.irq_cpu_id,
254 output);
255
256 if (output != ILR_INTTGT_INT) /* TODO */
257 return;
258
259 kvm_vcpu_ioctl_interrupt(dst->vcpu, &irq);
260}
261
262static void mpic_irq_lower(struct openpic *opp, struct irq_dest *dst,
263 int output)
264{
265 if (!dst->vcpu) {
266 pr_debug("%s: destination cpu %d does not exist\n",
267 __func__, (int)(dst - &opp->dst[0]));
268 return;
269 }
270
271 pr_debug("%s: cpu %d output %d\n", __func__, dst->vcpu->arch.irq_cpu_id,
272 output);
273
274 if (output != ILR_INTTGT_INT) /* TODO */
275 return;
276
277 kvmppc_core_dequeue_external(dst->vcpu);
278}
279
280static inline void IRQ_setbit(struct irq_queue *q, int n_IRQ)
281{
282 set_bit(n_IRQ, q->queue);
283}
284
285static inline void IRQ_resetbit(struct irq_queue *q, int n_IRQ)
286{
287 clear_bit(n_IRQ, q->queue);
288}
289
290static inline int IRQ_testbit(struct irq_queue *q, int n_IRQ)
291{
292 return test_bit(n_IRQ, q->queue);
293}
294
295static void IRQ_check(struct openpic *opp, struct irq_queue *q)
296{
297 int irq = -1;
298 int next = -1;
299 int priority = -1;
300
301 for (;;) {
302 irq = find_next_bit(q->queue, opp->max_irq, irq + 1);
303 if (irq == opp->max_irq)
304 break;
305
306 pr_debug("IRQ_check: irq %d set ivpr_pr=%d pr=%d\n",
307 irq, IVPR_PRIORITY(opp->src[irq].ivpr), priority);
308
309 if (IVPR_PRIORITY(opp->src[irq].ivpr) > priority) {
310 next = irq;
311 priority = IVPR_PRIORITY(opp->src[irq].ivpr);
312 }
313 }
314
315 q->next = next;
316 q->priority = priority;
317}
318
319static int IRQ_get_next(struct openpic *opp, struct irq_queue *q)
320{
321 /* XXX: optimize */
322 IRQ_check(opp, q);
323
324 return q->next;
325}
326
327static void IRQ_local_pipe(struct openpic *opp, int n_CPU, int n_IRQ,
328 bool active, bool was_active)
329{
330 struct irq_dest *dst;
331 struct irq_source *src;
332 int priority;
333
334 dst = &opp->dst[n_CPU];
335 src = &opp->src[n_IRQ];
336
337 pr_debug("%s: IRQ %d active %d was %d\n",
338 __func__, n_IRQ, active, was_active);
339
340 if (src->output != ILR_INTTGT_INT) {
341 pr_debug("%s: output %d irq %d active %d was %d count %d\n",
342 __func__, src->output, n_IRQ, active, was_active,
343 dst->outputs_active[src->output]);
344
345 /* On Freescale MPIC, critical interrupts ignore priority,
346 * IACK, EOI, etc. Before MPIC v4.1 they also ignore
347 * masking.
348 */
349 if (active) {
350 if (!was_active &&
351 dst->outputs_active[src->output]++ == 0) {
352 pr_debug("%s: Raise OpenPIC output %d cpu %d irq %d\n",
353 __func__, src->output, n_CPU, n_IRQ);
354 mpic_irq_raise(opp, dst, src->output);
355 }
356 } else {
357 if (was_active &&
358 --dst->outputs_active[src->output] == 0) {
359 pr_debug("%s: Lower OpenPIC output %d cpu %d irq %d\n",
360 __func__, src->output, n_CPU, n_IRQ);
361 mpic_irq_lower(opp, dst, src->output);
362 }
363 }
364
365 return;
366 }
367
368 priority = IVPR_PRIORITY(src->ivpr);
369
370 /* Even if the interrupt doesn't have enough priority,
371 * it is still raised, in case ctpr is lowered later.
372 */
373 if (active)
374 IRQ_setbit(&dst->raised, n_IRQ);
375 else
376 IRQ_resetbit(&dst->raised, n_IRQ);
377
378 IRQ_check(opp, &dst->raised);
379
380 if (active && priority <= dst->ctpr) {
381 pr_debug("%s: IRQ %d priority %d too low for ctpr %d on CPU %d\n",
382 __func__, n_IRQ, priority, dst->ctpr, n_CPU);
383 active = 0;
384 }
385
386 if (active) {
387 if (IRQ_get_next(opp, &dst->servicing) >= 0 &&
388 priority <= dst->servicing.priority) {
389 pr_debug("%s: IRQ %d is hidden by servicing IRQ %d on CPU %d\n",
390 __func__, n_IRQ, dst->servicing.next, n_CPU);
391 } else {
392 pr_debug("%s: Raise OpenPIC INT output cpu %d irq %d/%d\n",
393 __func__, n_CPU, n_IRQ, dst->raised.next);
394 mpic_irq_raise(opp, dst, ILR_INTTGT_INT);
395 }
396 } else {
397 IRQ_get_next(opp, &dst->servicing);
398 if (dst->raised.priority > dst->ctpr &&
399 dst->raised.priority > dst->servicing.priority) {
400 pr_debug("%s: IRQ %d inactive, IRQ %d prio %d above %d/%d, CPU %d\n",
401 __func__, n_IRQ, dst->raised.next,
402 dst->raised.priority, dst->ctpr,
403 dst->servicing.priority, n_CPU);
404 /* IRQ line stays asserted */
405 } else {
406 pr_debug("%s: IRQ %d inactive, current prio %d/%d, CPU %d\n",
407 __func__, n_IRQ, dst->ctpr,
408 dst->servicing.priority, n_CPU);
409 mpic_irq_lower(opp, dst, ILR_INTTGT_INT);
410 }
411 }
412}
413
414/* update pic state because registers for n_IRQ have changed value */
415static void openpic_update_irq(struct openpic *opp, int n_IRQ)
416{
417 struct irq_source *src;
418 bool active, was_active;
419 int i;
420
421 src = &opp->src[n_IRQ];
422 active = src->pending;
423
424 if ((src->ivpr & IVPR_MASK_MASK) && !src->nomask) {
425 /* Interrupt source is disabled */
426 pr_debug("%s: IRQ %d is disabled\n", __func__, n_IRQ);
427 active = false;
428 }
429
430 was_active = !!(src->ivpr & IVPR_ACTIVITY_MASK);
431
432 /*
433 * We don't have a similar check for already-active because
434 * ctpr may have changed and we need to withdraw the interrupt.
435 */
436 if (!active && !was_active) {
437 pr_debug("%s: IRQ %d is already inactive\n", __func__, n_IRQ);
438 return;
439 }
440
441 if (active)
442 src->ivpr |= IVPR_ACTIVITY_MASK;
443 else
444 src->ivpr &= ~IVPR_ACTIVITY_MASK;
445
446 if (src->destmask == 0) {
447 /* No target */
448 pr_debug("%s: IRQ %d has no target\n", __func__, n_IRQ);
449 return;
450 }
451
452 if (src->destmask == (1 << src->last_cpu)) {
453 /* Only one CPU is allowed to receive this IRQ */
454 IRQ_local_pipe(opp, src->last_cpu, n_IRQ, active, was_active);
455 } else if (!(src->ivpr & IVPR_MODE_MASK)) {
456 /* Directed delivery mode */
457 for (i = 0; i < opp->nb_cpus; i++) {
458 if (src->destmask & (1 << i)) {
459 IRQ_local_pipe(opp, i, n_IRQ, active,
460 was_active);
461 }
462 }
463 } else {
464 /* Distributed delivery mode */
465 for (i = src->last_cpu + 1; i != src->last_cpu; i++) {
466 if (i == opp->nb_cpus)
467 i = 0;
468
469 if (src->destmask & (1 << i)) {
470 IRQ_local_pipe(opp, i, n_IRQ, active,
471 was_active);
472 src->last_cpu = i;
473 break;
474 }
475 }
476 }
477}
478
479static void openpic_set_irq(void *opaque, int n_IRQ, int level)
480{
481 struct openpic *opp = opaque;
482 struct irq_source *src;
483
484 if (n_IRQ >= MAX_IRQ) {
485 WARN_ONCE(1, "%s: IRQ %d out of range\n", __func__, n_IRQ);
486 return;
487 }
488
489 src = &opp->src[n_IRQ];
490 pr_debug("openpic: set irq %d = %d ivpr=0x%08x\n",
491 n_IRQ, level, src->ivpr);
492 if (src->level) {
493 /* level-sensitive irq */
494 src->pending = level;
495 openpic_update_irq(opp, n_IRQ);
496 } else {
497 /* edge-sensitive irq */
498 if (level) {
499 src->pending = 1;
500 openpic_update_irq(opp, n_IRQ);
501 }
502
503 if (src->output != ILR_INTTGT_INT) {
504 /* Edge-triggered interrupts shouldn't be used
505 * with non-INT delivery, but just in case,
506 * try to make it do something sane rather than
507 * cause an interrupt storm. This is close to
508 * what you'd probably see happen in real hardware.
509 */
510 src->pending = 0;
511 openpic_update_irq(opp, n_IRQ);
512 }
513 }
514}
515
516static void openpic_reset(struct openpic *opp)
517{
518 int i;
519
520 opp->gcr = GCR_RESET;
521 /* Initialise controller registers */
522 opp->frr = ((opp->nb_irqs - 1) << FRR_NIRQ_SHIFT) |
523 (opp->vid << FRR_VID_SHIFT);
524
525 opp->pir = 0;
526 opp->spve = -1 & opp->vector_mask;
527 opp->tfrr = opp->tfrr_reset;
528 /* Initialise IRQ sources */
529 for (i = 0; i < opp->max_irq; i++) {
530 opp->src[i].ivpr = opp->ivpr_reset;
531 opp->src[i].idr = opp->idr_reset;
532
533 switch (opp->src[i].type) {
534 case IRQ_TYPE_NORMAL:
535 opp->src[i].level =
536 !!(opp->ivpr_reset & IVPR_SENSE_MASK);
537 break;
538
539 case IRQ_TYPE_FSLINT:
540 opp->src[i].ivpr |= IVPR_POLARITY_MASK;
541 break;
542
543 case IRQ_TYPE_FSLSPECIAL:
544 break;
545 }
546 }
547 /* Initialise IRQ destinations */
548 for (i = 0; i < MAX_CPU; i++) {
549 opp->dst[i].ctpr = 15;
550 memset(&opp->dst[i].raised, 0, sizeof(struct irq_queue));
551 opp->dst[i].raised.next = -1;
552 memset(&opp->dst[i].servicing, 0, sizeof(struct irq_queue));
553 opp->dst[i].servicing.next = -1;
554 }
555 /* Initialise timers */
556 for (i = 0; i < MAX_TMR; i++) {
557 opp->timers[i].tccr = 0;
558 opp->timers[i].tbcr = TBCR_CI;
559 }
560 /* Go out of RESET state */
561 opp->gcr = 0;
562}
563
564static inline uint32_t read_IRQreg_idr(struct openpic *opp, int n_IRQ)
565{
566 return opp->src[n_IRQ].idr;
567}
568
569static inline uint32_t read_IRQreg_ilr(struct openpic *opp, int n_IRQ)
570{
571 if (opp->flags & OPENPIC_FLAG_ILR)
572 return opp->src[n_IRQ].output;
573
574 return 0xffffffff;
575}
576
577static inline uint32_t read_IRQreg_ivpr(struct openpic *opp, int n_IRQ)
578{
579 return opp->src[n_IRQ].ivpr;
580}
581
582static inline void write_IRQreg_idr(struct openpic *opp, int n_IRQ,
583 uint32_t val)
584{
585 struct irq_source *src = &opp->src[n_IRQ];
586 uint32_t normal_mask = (1UL << opp->nb_cpus) - 1;
587 uint32_t crit_mask = 0;
588 uint32_t mask = normal_mask;
589 int crit_shift = IDR_EP_SHIFT - opp->nb_cpus;
590 int i;
591
592 if (opp->flags & OPENPIC_FLAG_IDR_CRIT) {
593 crit_mask = mask << crit_shift;
594 mask |= crit_mask | IDR_EP;
595 }
596
597 src->idr = val & mask;
598 pr_debug("Set IDR %d to 0x%08x\n", n_IRQ, src->idr);
599
600 if (opp->flags & OPENPIC_FLAG_IDR_CRIT) {
601 if (src->idr & crit_mask) {
602 if (src->idr & normal_mask) {
603 pr_debug("%s: IRQ configured for multiple output types, using critical\n",
604 __func__);
605 }
606
607 src->output = ILR_INTTGT_CINT;
608 src->nomask = true;
609 src->destmask = 0;
610
611 for (i = 0; i < opp->nb_cpus; i++) {
612 int n_ci = IDR_CI0_SHIFT - i;
613
614 if (src->idr & (1UL << n_ci))
615 src->destmask |= 1UL << i;
616 }
617 } else {
618 src->output = ILR_INTTGT_INT;
619 src->nomask = false;
620 src->destmask = src->idr & normal_mask;
621 }
622 } else {
623 src->destmask = src->idr;
624 }
625}
626
627static inline void write_IRQreg_ilr(struct openpic *opp, int n_IRQ,
628 uint32_t val)
629{
630 if (opp->flags & OPENPIC_FLAG_ILR) {
631 struct irq_source *src = &opp->src[n_IRQ];
632
633 src->output = val & ILR_INTTGT_MASK;
634 pr_debug("Set ILR %d to 0x%08x, output %d\n", n_IRQ, src->idr,
635 src->output);
636
637 /* TODO: on MPIC v4.0 only, set nomask for non-INT */
638 }
639}
640
641static inline void write_IRQreg_ivpr(struct openpic *opp, int n_IRQ,
642 uint32_t val)
643{
644 uint32_t mask;
645
646 /* NOTE when implementing newer FSL MPIC models: starting with v4.0,
647 * the polarity bit is read-only on internal interrupts.
648 */
649 mask = IVPR_MASK_MASK | IVPR_PRIORITY_MASK | IVPR_SENSE_MASK |
650 IVPR_POLARITY_MASK | opp->vector_mask;
651
652 /* ACTIVITY bit is read-only */
653 opp->src[n_IRQ].ivpr =
654 (opp->src[n_IRQ].ivpr & IVPR_ACTIVITY_MASK) | (val & mask);
655
656 /* For FSL internal interrupts, The sense bit is reserved and zero,
657 * and the interrupt is always level-triggered. Timers and IPIs
658 * have no sense or polarity bits, and are edge-triggered.
659 */
660 switch (opp->src[n_IRQ].type) {
661 case IRQ_TYPE_NORMAL:
662 opp->src[n_IRQ].level =
663 !!(opp->src[n_IRQ].ivpr & IVPR_SENSE_MASK);
664 break;
665
666 case IRQ_TYPE_FSLINT:
667 opp->src[n_IRQ].ivpr &= ~IVPR_SENSE_MASK;
668 break;
669
670 case IRQ_TYPE_FSLSPECIAL:
671 opp->src[n_IRQ].ivpr &= ~(IVPR_POLARITY_MASK | IVPR_SENSE_MASK);
672 break;
673 }
674
675 openpic_update_irq(opp, n_IRQ);
676 pr_debug("Set IVPR %d to 0x%08x -> 0x%08x\n", n_IRQ, val,
677 opp->src[n_IRQ].ivpr);
678}
679
680static void openpic_gcr_write(struct openpic *opp, uint64_t val)
681{
682 if (val & GCR_RESET) {
683 openpic_reset(opp);
684 return;
685 }
686
687 opp->gcr &= ~opp->mpic_mode_mask;
688 opp->gcr |= val & opp->mpic_mode_mask;
689}
690
691static int openpic_gbl_write(void *opaque, gpa_t addr, u32 val)
692{
693 struct openpic *opp = opaque;
694 int err = 0;
695
696 pr_debug("%s: addr %#llx <= %08x\n", __func__, addr, val);
697 if (addr & 0xF)
698 return 0;
699
700 switch (addr) {
701 case 0x00: /* Block Revision Register1 (BRR1) is Readonly */
702 break;
703 case 0x40:
704 case 0x50:
705 case 0x60:
706 case 0x70:
707 case 0x80:
708 case 0x90:
709 case 0xA0:
710 case 0xB0:
711 err = openpic_cpu_write_internal(opp, addr, val,
712 get_current_cpu());
713 break;
714 case 0x1000: /* FRR */
715 break;
716 case 0x1020: /* GCR */
717 openpic_gcr_write(opp, val);
718 break;
719 case 0x1080: /* VIR */
720 break;
721 case 0x1090: /* PIR */
722 /*
723 * This register is used to reset a CPU core --
724 * let userspace handle it.
725 */
726 err = -ENXIO;
727 break;
728 case 0x10A0: /* IPI_IVPR */
729 case 0x10B0:
730 case 0x10C0:
731 case 0x10D0: {
732 int idx;
733 idx = (addr - 0x10A0) >> 4;
734 write_IRQreg_ivpr(opp, opp->irq_ipi0 + idx, val);
735 break;
736 }
737 case 0x10E0: /* SPVE */
738 opp->spve = val & opp->vector_mask;
739 break;
740 default:
741 break;
742 }
743
744 return err;
745}
746
747static int openpic_gbl_read(void *opaque, gpa_t addr, u32 *ptr)
748{
749 struct openpic *opp = opaque;
750 u32 retval;
751 int err = 0;
752
753 pr_debug("%s: addr %#llx\n", __func__, addr);
754 retval = 0xFFFFFFFF;
755 if (addr & 0xF)
756 goto out;
757
758 switch (addr) {
759 case 0x1000: /* FRR */
760 retval = opp->frr;
761 retval |= (opp->nb_cpus - 1) << FRR_NCPU_SHIFT;
762 break;
763 case 0x1020: /* GCR */
764 retval = opp->gcr;
765 break;
766 case 0x1080: /* VIR */
767 retval = opp->vir;
768 break;
769 case 0x1090: /* PIR */
770 retval = 0x00000000;
771 break;
772 case 0x00: /* Block Revision Register1 (BRR1) */
773 retval = opp->brr1;
774 break;
775 case 0x40:
776 case 0x50:
777 case 0x60:
778 case 0x70:
779 case 0x80:
780 case 0x90:
781 case 0xA0:
782 case 0xB0:
783 err = openpic_cpu_read_internal(opp, addr,
784 &retval, get_current_cpu());
785 break;
786 case 0x10A0: /* IPI_IVPR */
787 case 0x10B0:
788 case 0x10C0:
789 case 0x10D0:
790 {
791 int idx;
792 idx = (addr - 0x10A0) >> 4;
793 retval = read_IRQreg_ivpr(opp, opp->irq_ipi0 + idx);
794 }
795 break;
796 case 0x10E0: /* SPVE */
797 retval = opp->spve;
798 break;
799 default:
800 break;
801 }
802
803out:
804 pr_debug("%s: => 0x%08x\n", __func__, retval);
805 *ptr = retval;
806 return err;
807}
808
809static int openpic_tmr_write(void *opaque, gpa_t addr, u32 val)
810{
811 struct openpic *opp = opaque;
812 int idx;
813
814 addr += 0x10f0;
815
816 pr_debug("%s: addr %#llx <= %08x\n", __func__, addr, val);
817 if (addr & 0xF)
818 return 0;
819
820 if (addr == 0x10f0) {
821 /* TFRR */
822 opp->tfrr = val;
823 return 0;
824 }
825
826 idx = (addr >> 6) & 0x3;
827 addr = addr & 0x30;
828
829 switch (addr & 0x30) {
830 case 0x00: /* TCCR */
831 break;
832 case 0x10: /* TBCR */
833 if ((opp->timers[idx].tccr & TCCR_TOG) != 0 &&
834 (val & TBCR_CI) == 0 &&
835 (opp->timers[idx].tbcr & TBCR_CI) != 0)
836 opp->timers[idx].tccr &= ~TCCR_TOG;
837
838 opp->timers[idx].tbcr = val;
839 break;
840 case 0x20: /* TVPR */
841 write_IRQreg_ivpr(opp, opp->irq_tim0 + idx, val);
842 break;
843 case 0x30: /* TDR */
844 write_IRQreg_idr(opp, opp->irq_tim0 + idx, val);
845 break;
846 }
847
848 return 0;
849}
850
851static int openpic_tmr_read(void *opaque, gpa_t addr, u32 *ptr)
852{
853 struct openpic *opp = opaque;
854 uint32_t retval = -1;
855 int idx;
856
857 pr_debug("%s: addr %#llx\n", __func__, addr);
858 if (addr & 0xF)
859 goto out;
860
861 idx = (addr >> 6) & 0x3;
862 if (addr == 0x0) {
863 /* TFRR */
864 retval = opp->tfrr;
865 goto out;
866 }
867
868 switch (addr & 0x30) {
869 case 0x00: /* TCCR */
870 retval = opp->timers[idx].tccr;
871 break;
872 case 0x10: /* TBCR */
873 retval = opp->timers[idx].tbcr;
874 break;
875 case 0x20: /* TIPV */
876 retval = read_IRQreg_ivpr(opp, opp->irq_tim0 + idx);
877 break;
878 case 0x30: /* TIDE (TIDR) */
879 retval = read_IRQreg_idr(opp, opp->irq_tim0 + idx);
880 break;
881 }
882
883out:
884 pr_debug("%s: => 0x%08x\n", __func__, retval);
885 *ptr = retval;
886 return 0;
887}
888
889static int openpic_src_write(void *opaque, gpa_t addr, u32 val)
890{
891 struct openpic *opp = opaque;
892 int idx;
893
894 pr_debug("%s: addr %#llx <= %08x\n", __func__, addr, val);
895
896 addr = addr & 0xffff;
897 idx = addr >> 5;
898
899 switch (addr & 0x1f) {
900 case 0x00:
901 write_IRQreg_ivpr(opp, idx, val);
902 break;
903 case 0x10:
904 write_IRQreg_idr(opp, idx, val);
905 break;
906 case 0x18:
907 write_IRQreg_ilr(opp, idx, val);
908 break;
909 }
910
911 return 0;
912}
913
914static int openpic_src_read(void *opaque, gpa_t addr, u32 *ptr)
915{
916 struct openpic *opp = opaque;
917 uint32_t retval;
918 int idx;
919
920 pr_debug("%s: addr %#llx\n", __func__, addr);
921 retval = 0xFFFFFFFF;
922
923 addr = addr & 0xffff;
924 idx = addr >> 5;
925
926 switch (addr & 0x1f) {
927 case 0x00:
928 retval = read_IRQreg_ivpr(opp, idx);
929 break;
930 case 0x10:
931 retval = read_IRQreg_idr(opp, idx);
932 break;
933 case 0x18:
934 retval = read_IRQreg_ilr(opp, idx);
935 break;
936 }
937
938 pr_debug("%s: => 0x%08x\n", __func__, retval);
939 *ptr = retval;
940 return 0;
941}
942
943static int openpic_msi_write(void *opaque, gpa_t addr, u32 val)
944{
945 struct openpic *opp = opaque;
946 int idx = opp->irq_msi;
947 int srs, ibs;
948
949 pr_debug("%s: addr %#llx <= 0x%08x\n", __func__, addr, val);
950 if (addr & 0xF)
951 return 0;
952
953 switch (addr) {
954 case MSIIR_OFFSET:
955 srs = val >> MSIIR_SRS_SHIFT;
956 idx += srs;
957 ibs = (val & MSIIR_IBS_MASK) >> MSIIR_IBS_SHIFT;
958 opp->msi[srs].msir |= 1 << ibs;
959 openpic_set_irq(opp, idx, 1);
960 break;
961 default:
962 /* most registers are read-only, thus ignored */
963 break;
964 }
965
966 return 0;
967}
968
969static int openpic_msi_read(void *opaque, gpa_t addr, u32 *ptr)
970{
971 struct openpic *opp = opaque;
972 uint32_t r = 0;
973 int i, srs;
974
975 pr_debug("%s: addr %#llx\n", __func__, addr);
976 if (addr & 0xF)
977 return -ENXIO;
978
979 srs = addr >> 4;
980
981 switch (addr) {
982 case 0x00:
983 case 0x10:
984 case 0x20:
985 case 0x30:
986 case 0x40:
987 case 0x50:
988 case 0x60:
989 case 0x70: /* MSIRs */
990 r = opp->msi[srs].msir;
991 /* Clear on read */
992 opp->msi[srs].msir = 0;
993 openpic_set_irq(opp, opp->irq_msi + srs, 0);
994 break;
995 case 0x120: /* MSISR */
996 for (i = 0; i < MAX_MSI; i++)
997 r |= (opp->msi[i].msir ? 1 : 0) << i;
998 break;
999 }
1000
1001 pr_debug("%s: => 0x%08x\n", __func__, r);
1002 *ptr = r;
1003 return 0;
1004}
1005
1006static int openpic_summary_read(void *opaque, gpa_t addr, u32 *ptr)
1007{
1008 uint32_t r = 0;
1009
1010 pr_debug("%s: addr %#llx\n", __func__, addr);
1011
1012 /* TODO: EISR/EIMR */
1013
1014 *ptr = r;
1015 return 0;
1016}
1017
1018static int openpic_summary_write(void *opaque, gpa_t addr, u32 val)
1019{
1020 pr_debug("%s: addr %#llx <= 0x%08x\n", __func__, addr, val);
1021
1022 /* TODO: EISR/EIMR */
1023 return 0;
1024}
1025
1026static int openpic_cpu_write_internal(void *opaque, gpa_t addr,
1027 u32 val, int idx)
1028{
1029 struct openpic *opp = opaque;
1030 struct irq_source *src;
1031 struct irq_dest *dst;
1032 int s_IRQ, n_IRQ;
1033
1034 pr_debug("%s: cpu %d addr %#llx <= 0x%08x\n", __func__, idx,
1035 addr, val);
1036
1037 if (idx < 0)
1038 return 0;
1039
1040 if (addr & 0xF)
1041 return 0;
1042
1043 dst = &opp->dst[idx];
1044 addr &= 0xFF0;
1045 switch (addr) {
1046 case 0x40: /* IPIDR */
1047 case 0x50:
1048 case 0x60:
1049 case 0x70:
1050 idx = (addr - 0x40) >> 4;
1051 /* we use IDE as mask which CPUs to deliver the IPI to still. */
1052 opp->src[opp->irq_ipi0 + idx].destmask |= val;
1053 openpic_set_irq(opp, opp->irq_ipi0 + idx, 1);
1054 openpic_set_irq(opp, opp->irq_ipi0 + idx, 0);
1055 break;
1056 case 0x80: /* CTPR */
1057 dst->ctpr = val & 0x0000000F;
1058
1059 pr_debug("%s: set CPU %d ctpr to %d, raised %d servicing %d\n",
1060 __func__, idx, dst->ctpr, dst->raised.priority,
1061 dst->servicing.priority);
1062
1063 if (dst->raised.priority <= dst->ctpr) {
1064 pr_debug("%s: Lower OpenPIC INT output cpu %d due to ctpr\n",
1065 __func__, idx);
1066 mpic_irq_lower(opp, dst, ILR_INTTGT_INT);
1067 } else if (dst->raised.priority > dst->servicing.priority) {
1068 pr_debug("%s: Raise OpenPIC INT output cpu %d irq %d\n",
1069 __func__, idx, dst->raised.next);
1070 mpic_irq_raise(opp, dst, ILR_INTTGT_INT);
1071 }
1072
1073 break;
1074 case 0x90: /* WHOAMI */
1075 /* Read-only register */
1076 break;
1077 case 0xA0: /* IACK */
1078 /* Read-only register */
1079 break;
1080 case 0xB0: { /* EOI */
1081 int notify_eoi;
1082
1083 pr_debug("EOI\n");
1084 s_IRQ = IRQ_get_next(opp, &dst->servicing);
1085
1086 if (s_IRQ < 0) {
1087 pr_debug("%s: EOI with no interrupt in service\n",
1088 __func__);
1089 break;
1090 }
1091
1092 IRQ_resetbit(&dst->servicing, s_IRQ);
1093 /* Notify listeners that the IRQ is over */
1094 notify_eoi = s_IRQ;
1095 /* Set up next servicing IRQ */
1096 s_IRQ = IRQ_get_next(opp, &dst->servicing);
1097 /* Check queued interrupts. */
1098 n_IRQ = IRQ_get_next(opp, &dst->raised);
1099 src = &opp->src[n_IRQ];
1100 if (n_IRQ != -1 &&
1101 (s_IRQ == -1 ||
1102 IVPR_PRIORITY(src->ivpr) > dst->servicing.priority)) {
1103 pr_debug("Raise OpenPIC INT output cpu %d irq %d\n",
1104 idx, n_IRQ);
1105 mpic_irq_raise(opp, dst, ILR_INTTGT_INT);
1106 }
1107
1108 spin_unlock(&opp->lock);
1109 kvm_notify_acked_irq(opp->kvm, 0, notify_eoi);
1110 spin_lock(&opp->lock);
1111
1112 break;
1113 }
1114 default:
1115 break;
1116 }
1117
1118 return 0;
1119}
1120
1121static int openpic_cpu_write(void *opaque, gpa_t addr, u32 val)
1122{
1123 struct openpic *opp = opaque;
1124
1125 return openpic_cpu_write_internal(opp, addr, val,
1126 (addr & 0x1f000) >> 12);
1127}
1128
1129static uint32_t openpic_iack(struct openpic *opp, struct irq_dest *dst,
1130 int cpu)
1131{
1132 struct irq_source *src;
1133 int retval, irq;
1134
1135 pr_debug("Lower OpenPIC INT output\n");
1136 mpic_irq_lower(opp, dst, ILR_INTTGT_INT);
1137
1138 irq = IRQ_get_next(opp, &dst->raised);
1139 pr_debug("IACK: irq=%d\n", irq);
1140
1141 if (irq == -1)
1142 /* No more interrupt pending */
1143 return opp->spve;
1144
1145 src = &opp->src[irq];
1146 if (!(src->ivpr & IVPR_ACTIVITY_MASK) ||
1147 !(IVPR_PRIORITY(src->ivpr) > dst->ctpr)) {
1148 pr_err("%s: bad raised IRQ %d ctpr %d ivpr 0x%08x\n",
1149 __func__, irq, dst->ctpr, src->ivpr);
1150 openpic_update_irq(opp, irq);
1151 retval = opp->spve;
1152 } else {
1153 /* IRQ enter servicing state */
1154 IRQ_setbit(&dst->servicing, irq);
1155 retval = IVPR_VECTOR(opp, src->ivpr);
1156 }
1157
1158 if (!src->level) {
1159 /* edge-sensitive IRQ */
1160 src->ivpr &= ~IVPR_ACTIVITY_MASK;
1161 src->pending = 0;
1162 IRQ_resetbit(&dst->raised, irq);
1163 }
1164
1165 if ((irq >= opp->irq_ipi0) && (irq < (opp->irq_ipi0 + MAX_IPI))) {
1166 src->destmask &= ~(1 << cpu);
1167 if (src->destmask && !src->level) {
1168 /* trigger on CPUs that didn't know about it yet */
1169 openpic_set_irq(opp, irq, 1);
1170 openpic_set_irq(opp, irq, 0);
1171 /* if all CPUs knew about it, set active bit again */
1172 src->ivpr |= IVPR_ACTIVITY_MASK;
1173 }
1174 }
1175
1176 return retval;
1177}
1178
1179void kvmppc_mpic_set_epr(struct kvm_vcpu *vcpu)
1180{
1181 struct openpic *opp = vcpu->arch.mpic;
1182 int cpu = vcpu->arch.irq_cpu_id;
1183 unsigned long flags;
1184
1185 spin_lock_irqsave(&opp->lock, flags);
1186
1187 if ((opp->gcr & opp->mpic_mode_mask) == GCR_MODE_PROXY)
1188 kvmppc_set_epr(vcpu, openpic_iack(opp, &opp->dst[cpu], cpu));
1189
1190 spin_unlock_irqrestore(&opp->lock, flags);
1191}
1192
1193static int openpic_cpu_read_internal(void *opaque, gpa_t addr,
1194 u32 *ptr, int idx)
1195{
1196 struct openpic *opp = opaque;
1197 struct irq_dest *dst;
1198 uint32_t retval;
1199
1200 pr_debug("%s: cpu %d addr %#llx\n", __func__, idx, addr);
1201 retval = 0xFFFFFFFF;
1202
1203 if (idx < 0)
1204 goto out;
1205
1206 if (addr & 0xF)
1207 goto out;
1208
1209 dst = &opp->dst[idx];
1210 addr &= 0xFF0;
1211 switch (addr) {
1212 case 0x80: /* CTPR */
1213 retval = dst->ctpr;
1214 break;
1215 case 0x90: /* WHOAMI */
1216 retval = idx;
1217 break;
1218 case 0xA0: /* IACK */
1219 retval = openpic_iack(opp, dst, idx);
1220 break;
1221 case 0xB0: /* EOI */
1222 retval = 0;
1223 break;
1224 default:
1225 break;
1226 }
1227 pr_debug("%s: => 0x%08x\n", __func__, retval);
1228
1229out:
1230 *ptr = retval;
1231 return 0;
1232}
1233
1234static int openpic_cpu_read(void *opaque, gpa_t addr, u32 *ptr)
1235{
1236 struct openpic *opp = opaque;
1237
1238 return openpic_cpu_read_internal(opp, addr, ptr,
1239 (addr & 0x1f000) >> 12);
1240}
1241
1242struct mem_reg {
1243 int (*read)(void *opaque, gpa_t addr, u32 *ptr);
1244 int (*write)(void *opaque, gpa_t addr, u32 val);
1245 gpa_t start_addr;
1246 int size;
1247};
1248
1249static const struct mem_reg openpic_gbl_mmio = {
1250 .write = openpic_gbl_write,
1251 .read = openpic_gbl_read,
1252 .start_addr = OPENPIC_GLB_REG_START,
1253 .size = OPENPIC_GLB_REG_SIZE,
1254};
1255
1256static const struct mem_reg openpic_tmr_mmio = {
1257 .write = openpic_tmr_write,
1258 .read = openpic_tmr_read,
1259 .start_addr = OPENPIC_TMR_REG_START,
1260 .size = OPENPIC_TMR_REG_SIZE,
1261};
1262
1263static const struct mem_reg openpic_cpu_mmio = {
1264 .write = openpic_cpu_write,
1265 .read = openpic_cpu_read,
1266 .start_addr = OPENPIC_CPU_REG_START,
1267 .size = OPENPIC_CPU_REG_SIZE,
1268};
1269
1270static const struct mem_reg openpic_src_mmio = {
1271 .write = openpic_src_write,
1272 .read = openpic_src_read,
1273 .start_addr = OPENPIC_SRC_REG_START,
1274 .size = OPENPIC_SRC_REG_SIZE,
1275};
1276
1277static const struct mem_reg openpic_msi_mmio = {
1278 .read = openpic_msi_read,
1279 .write = openpic_msi_write,
1280 .start_addr = OPENPIC_MSI_REG_START,
1281 .size = OPENPIC_MSI_REG_SIZE,
1282};
1283
1284static const struct mem_reg openpic_summary_mmio = {
1285 .read = openpic_summary_read,
1286 .write = openpic_summary_write,
1287 .start_addr = OPENPIC_SUMMARY_REG_START,
1288 .size = OPENPIC_SUMMARY_REG_SIZE,
1289};
1290
1291static void add_mmio_region(struct openpic *opp, const struct mem_reg *mr)
1292{
1293 if (opp->num_mmio_regions >= MAX_MMIO_REGIONS) {
1294 WARN(1, "kvm mpic: too many mmio regions\n");
1295 return;
1296 }
1297
1298 opp->mmio_regions[opp->num_mmio_regions++] = mr;
1299}
1300
1301static void fsl_common_init(struct openpic *opp)
1302{
1303 int i;
1304 int virq = MAX_SRC;
1305
1306 add_mmio_region(opp, &openpic_msi_mmio);
1307 add_mmio_region(opp, &openpic_summary_mmio);
1308
1309 opp->vid = VID_REVISION_1_2;
1310 opp->vir = VIR_GENERIC;
1311 opp->vector_mask = 0xFFFF;
1312 opp->tfrr_reset = 0;
1313 opp->ivpr_reset = IVPR_MASK_MASK;
1314 opp->idr_reset = 1 << 0;
1315 opp->max_irq = MAX_IRQ;
1316
1317 opp->irq_ipi0 = virq;
1318 virq += MAX_IPI;
1319 opp->irq_tim0 = virq;
1320 virq += MAX_TMR;
1321
1322 BUG_ON(virq > MAX_IRQ);
1323
1324 opp->irq_msi = 224;
1325
1326 for (i = 0; i < opp->fsl->max_ext; i++)
1327 opp->src[i].level = false;
1328
1329 /* Internal interrupts, including message and MSI */
1330 for (i = 16; i < MAX_SRC; i++) {
1331 opp->src[i].type = IRQ_TYPE_FSLINT;
1332 opp->src[i].level = true;
1333 }
1334
1335 /* timers and IPIs */
1336 for (i = MAX_SRC; i < virq; i++) {
1337 opp->src[i].type = IRQ_TYPE_FSLSPECIAL;
1338 opp->src[i].level = false;
1339 }
1340}
1341
1342static int kvm_mpic_read_internal(struct openpic *opp, gpa_t addr, u32 *ptr)
1343{
1344 int i;
1345
1346 for (i = 0; i < opp->num_mmio_regions; i++) {
1347 const struct mem_reg *mr = opp->mmio_regions[i];
1348
1349 if (mr->start_addr > addr || addr >= mr->start_addr + mr->size)
1350 continue;
1351
1352 return mr->read(opp, addr - mr->start_addr, ptr);
1353 }
1354
1355 return -ENXIO;
1356}
1357
1358static int kvm_mpic_write_internal(struct openpic *opp, gpa_t addr, u32 val)
1359{
1360 int i;
1361
1362 for (i = 0; i < opp->num_mmio_regions; i++) {
1363 const struct mem_reg *mr = opp->mmio_regions[i];
1364
1365 if (mr->start_addr > addr || addr >= mr->start_addr + mr->size)
1366 continue;
1367
1368 return mr->write(opp, addr - mr->start_addr, val);
1369 }
1370
1371 return -ENXIO;
1372}
1373
1374static int kvm_mpic_read(struct kvm_io_device *this, gpa_t addr,
1375 int len, void *ptr)
1376{
1377 struct openpic *opp = container_of(this, struct openpic, mmio);
1378 int ret;
1379 union {
1380 u32 val;
1381 u8 bytes[4];
1382 } u;
1383
1384 if (addr & (len - 1)) {
1385 pr_debug("%s: bad alignment %llx/%d\n",
1386 __func__, addr, len);
1387 return -EINVAL;
1388 }
1389
1390 spin_lock_irq(&opp->lock);
1391 ret = kvm_mpic_read_internal(opp, addr - opp->reg_base, &u.val);
1392 spin_unlock_irq(&opp->lock);
1393
1394 /*
1395 * Technically only 32-bit accesses are allowed, but be nice to
1396 * people dumping registers a byte at a time -- it works in real
1397 * hardware (reads only, not writes).
1398 */
1399 if (len == 4) {
1400 *(u32 *)ptr = u.val;
1401 pr_debug("%s: addr %llx ret %d len 4 val %x\n",
1402 __func__, addr, ret, u.val);
1403 } else if (len == 1) {
1404 *(u8 *)ptr = u.bytes[addr & 3];
1405 pr_debug("%s: addr %llx ret %d len 1 val %x\n",
1406 __func__, addr, ret, u.bytes[addr & 3]);
1407 } else {
1408 pr_debug("%s: bad length %d\n", __func__, len);
1409 return -EINVAL;
1410 }
1411
1412 return ret;
1413}
1414
1415static int kvm_mpic_write(struct kvm_io_device *this, gpa_t addr,
1416 int len, const void *ptr)
1417{
1418 struct openpic *opp = container_of(this, struct openpic, mmio);
1419 int ret;
1420
1421 if (len != 4) {
1422 pr_debug("%s: bad length %d\n", __func__, len);
1423 return -EOPNOTSUPP;
1424 }
1425 if (addr & 3) {
1426 pr_debug("%s: bad alignment %llx/%d\n", __func__, addr, len);
1427 return -EOPNOTSUPP;
1428 }
1429
1430 spin_lock_irq(&opp->lock);
1431 ret = kvm_mpic_write_internal(opp, addr - opp->reg_base,
1432 *(const u32 *)ptr);
1433 spin_unlock_irq(&opp->lock);
1434
1435 pr_debug("%s: addr %llx ret %d val %x\n",
1436 __func__, addr, ret, *(const u32 *)ptr);
1437
1438 return ret;
1439}
1440
1441static const struct kvm_io_device_ops mpic_mmio_ops = {
1442 .read = kvm_mpic_read,
1443 .write = kvm_mpic_write,
1444};
1445
1446static void map_mmio(struct openpic *opp)
1447{
1448 kvm_iodevice_init(&opp->mmio, &mpic_mmio_ops);
1449
1450 kvm_io_bus_register_dev(opp->kvm, KVM_MMIO_BUS,
1451 opp->reg_base, OPENPIC_REG_SIZE,
1452 &opp->mmio);
1453}
1454
1455static void unmap_mmio(struct openpic *opp)
1456{
1457 kvm_io_bus_unregister_dev(opp->kvm, KVM_MMIO_BUS, &opp->mmio);
1458}
1459
1460static int set_base_addr(struct openpic *opp, struct kvm_device_attr *attr)
1461{
1462 u64 base;
1463
1464 if (copy_from_user(&base, (u64 __user *)(long)attr->addr, sizeof(u64)))
1465 return -EFAULT;
1466
1467 if (base & 0x3ffff) {
1468 pr_debug("kvm mpic %s: KVM_DEV_MPIC_BASE_ADDR %08llx not aligned\n",
1469 __func__, base);
1470 return -EINVAL;
1471 }
1472
1473 if (base == opp->reg_base)
1474 return 0;
1475
1476 mutex_lock(&opp->kvm->slots_lock);
1477
1478 unmap_mmio(opp);
1479 opp->reg_base = base;
1480
1481 pr_debug("kvm mpic %s: KVM_DEV_MPIC_BASE_ADDR %08llx\n",
1482 __func__, base);
1483
1484 if (base == 0)
1485 goto out;
1486
1487 map_mmio(opp);
1488
1489out:
1490 mutex_unlock(&opp->kvm->slots_lock);
1491 return 0;
1492}
1493
1494#define ATTR_SET 0
1495#define ATTR_GET 1
1496
1497static int access_reg(struct openpic *opp, gpa_t addr, u32 *val, int type)
1498{
1499 int ret;
1500
1501 if (addr & 3)
1502 return -ENXIO;
1503
1504 spin_lock_irq(&opp->lock);
1505
1506 if (type == ATTR_SET)
1507 ret = kvm_mpic_write_internal(opp, addr, *val);
1508 else
1509 ret = kvm_mpic_read_internal(opp, addr, val);
1510
1511 spin_unlock_irq(&opp->lock);
1512
1513 pr_debug("%s: type %d addr %llx val %x\n", __func__, type, addr, *val);
1514
1515 return ret;
1516}
1517
1518static int mpic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1519{
1520 struct openpic *opp = dev->private;
1521 u32 attr32;
1522
1523 switch (attr->group) {
1524 case KVM_DEV_MPIC_GRP_MISC:
1525 switch (attr->attr) {
1526 case KVM_DEV_MPIC_BASE_ADDR:
1527 return set_base_addr(opp, attr);
1528 }
1529
1530 break;
1531
1532 case KVM_DEV_MPIC_GRP_REGISTER:
1533 if (get_user(attr32, (u32 __user *)(long)attr->addr))
1534 return -EFAULT;
1535
1536 return access_reg(opp, attr->attr, &attr32, ATTR_SET);
1537
1538 case KVM_DEV_MPIC_GRP_IRQ_ACTIVE:
1539 if (attr->attr > MAX_SRC)
1540 return -EINVAL;
1541
1542 if (get_user(attr32, (u32 __user *)(long)attr->addr))
1543 return -EFAULT;
1544
1545 if (attr32 != 0 && attr32 != 1)
1546 return -EINVAL;
1547
1548 spin_lock_irq(&opp->lock);
1549 openpic_set_irq(opp, attr->attr, attr32);
1550 spin_unlock_irq(&opp->lock);
1551 return 0;
1552 }
1553
1554 return -ENXIO;
1555}
1556
1557static int mpic_get_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1558{
1559 struct openpic *opp = dev->private;
1560 u64 attr64;
1561 u32 attr32;
1562 int ret;
1563
1564 switch (attr->group) {
1565 case KVM_DEV_MPIC_GRP_MISC:
1566 switch (attr->attr) {
1567 case KVM_DEV_MPIC_BASE_ADDR:
1568 mutex_lock(&opp->kvm->slots_lock);
1569 attr64 = opp->reg_base;
1570 mutex_unlock(&opp->kvm->slots_lock);
1571
1572 if (copy_to_user((u64 __user *)(long)attr->addr,
1573 &attr64, sizeof(u64)))
1574 return -EFAULT;
1575
1576 return 0;
1577 }
1578
1579 break;
1580
1581 case KVM_DEV_MPIC_GRP_REGISTER:
1582 ret = access_reg(opp, attr->attr, &attr32, ATTR_GET);
1583 if (ret)
1584 return ret;
1585
1586 if (put_user(attr32, (u32 __user *)(long)attr->addr))
1587 return -EFAULT;
1588
1589 return 0;
1590
1591 case KVM_DEV_MPIC_GRP_IRQ_ACTIVE:
1592 if (attr->attr > MAX_SRC)
1593 return -EINVAL;
1594
1595 spin_lock_irq(&opp->lock);
1596 attr32 = opp->src[attr->attr].pending;
1597 spin_unlock_irq(&opp->lock);
1598
1599 if (put_user(attr32, (u32 __user *)(long)attr->addr))
1600 return -EFAULT;
1601
1602 return 0;
1603 }
1604
1605 return -ENXIO;
1606}
1607
1608static int mpic_has_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
1609{
1610 switch (attr->group) {
1611 case KVM_DEV_MPIC_GRP_MISC:
1612 switch (attr->attr) {
1613 case KVM_DEV_MPIC_BASE_ADDR:
1614 return 0;
1615 }
1616
1617 break;
1618
1619 case KVM_DEV_MPIC_GRP_REGISTER:
1620 return 0;
1621
1622 case KVM_DEV_MPIC_GRP_IRQ_ACTIVE:
1623 if (attr->attr > MAX_SRC)
1624 break;
1625
1626 return 0;
1627 }
1628
1629 return -ENXIO;
1630}
1631
1632static void mpic_destroy(struct kvm_device *dev)
1633{
1634 struct openpic *opp = dev->private;
1635
1636 dev->kvm->arch.mpic = NULL;
1637 kfree(opp);
1638}
1639
1640static int mpic_set_default_irq_routing(struct openpic *opp)
1641{
1642 struct kvm_irq_routing_entry *routing;
1643
1644 /* Create a nop default map, so that dereferencing it still works */
1645 routing = kzalloc((sizeof(*routing)), GFP_KERNEL);
1646 if (!routing)
1647 return -ENOMEM;
1648
1649 kvm_set_irq_routing(opp->kvm, routing, 0, 0);
1650
1651 kfree(routing);
1652 return 0;
1653}
1654
1655static int mpic_create(struct kvm_device *dev, u32 type)
1656{
1657 struct openpic *opp;
1658 int ret;
1659
1660 /* We only support one MPIC at a time for now */
1661 if (dev->kvm->arch.mpic)
1662 return -EINVAL;
1663
1664 opp = kzalloc(sizeof(struct openpic), GFP_KERNEL);
1665 if (!opp)
1666 return -ENOMEM;
1667
1668 dev->private = opp;
1669 opp->kvm = dev->kvm;
1670 opp->dev = dev;
1671 opp->model = type;
1672 spin_lock_init(&opp->lock);
1673
1674 add_mmio_region(opp, &openpic_gbl_mmio);
1675 add_mmio_region(opp, &openpic_tmr_mmio);
1676 add_mmio_region(opp, &openpic_src_mmio);
1677 add_mmio_region(opp, &openpic_cpu_mmio);
1678
1679 switch (opp->model) {
1680 case KVM_DEV_TYPE_FSL_MPIC_20:
1681 opp->fsl = &fsl_mpic_20;
1682 opp->brr1 = 0x00400200;
1683 opp->flags |= OPENPIC_FLAG_IDR_CRIT;
1684 opp->nb_irqs = 80;
1685 opp->mpic_mode_mask = GCR_MODE_MIXED;
1686
1687 fsl_common_init(opp);
1688
1689 break;
1690
1691 case KVM_DEV_TYPE_FSL_MPIC_42:
1692 opp->fsl = &fsl_mpic_42;
1693 opp->brr1 = 0x00400402;
1694 opp->flags |= OPENPIC_FLAG_ILR;
1695 opp->nb_irqs = 196;
1696 opp->mpic_mode_mask = GCR_MODE_PROXY;
1697
1698 fsl_common_init(opp);
1699
1700 break;
1701
1702 default:
1703 ret = -ENODEV;
1704 goto err;
1705 }
1706
1707 ret = mpic_set_default_irq_routing(opp);
1708 if (ret)
1709 goto err;
1710
1711 openpic_reset(opp);
1712
1713 smp_wmb();
1714 dev->kvm->arch.mpic = opp;
1715
1716 return 0;
1717
1718err:
1719 kfree(opp);
1720 return ret;
1721}
1722
1723struct kvm_device_ops kvm_mpic_ops = {
1724 .name = "kvm-mpic",
1725 .create = mpic_create,
1726 .destroy = mpic_destroy,
1727 .set_attr = mpic_set_attr,
1728 .get_attr = mpic_get_attr,
1729 .has_attr = mpic_has_attr,
1730};
1731
1732int kvmppc_mpic_connect_vcpu(struct kvm_device *dev, struct kvm_vcpu *vcpu,
1733 u32 cpu)
1734{
1735 struct openpic *opp = dev->private;
1736 int ret = 0;
1737
1738 if (dev->ops != &kvm_mpic_ops)
1739 return -EPERM;
1740 if (opp->kvm != vcpu->kvm)
1741 return -EPERM;
1742 if (cpu < 0 || cpu >= MAX_CPU)
1743 return -EPERM;
1744
1745 spin_lock_irq(&opp->lock);
1746
1747 if (opp->dst[cpu].vcpu) {
1748 ret = -EEXIST;
1749 goto out;
1750 }
1751 if (vcpu->arch.irq_type) {
1752 ret = -EBUSY;
1753 goto out;
1754 }
1755
1756 opp->dst[cpu].vcpu = vcpu;
1757 opp->nb_cpus = max(opp->nb_cpus, cpu + 1);
1758
1759 vcpu->arch.mpic = opp;
1760 vcpu->arch.irq_cpu_id = cpu;
1761 vcpu->arch.irq_type = KVMPPC_IRQ_MPIC;
1762
1763 /* This might need to be changed if GCR gets extended */
1764 if (opp->mpic_mode_mask == GCR_MODE_PROXY)
1765 vcpu->arch.epr_flags |= KVMPPC_EPR_KERNEL;
1766
1767out:
1768 spin_unlock_irq(&opp->lock);
1769 return ret;
1770}
1771
1772/*
1773 * This should only happen immediately before the mpic is destroyed,
1774 * so we shouldn't need to worry about anything still trying to
1775 * access the vcpu pointer.
1776 */
1777void kvmppc_mpic_disconnect_vcpu(struct openpic *opp, struct kvm_vcpu *vcpu)
1778{
1779 BUG_ON(!opp->dst[vcpu->arch.irq_cpu_id].vcpu);
1780
1781 opp->dst[vcpu->arch.irq_cpu_id].vcpu = NULL;
1782}
1783
1784/*
1785 * Return value:
1786 * < 0 Interrupt was ignored (masked or not delivered for other reasons)
1787 * = 0 Interrupt was coalesced (previous irq is still pending)
1788 * > 0 Number of CPUs interrupt was delivered to
1789 */
1790static int mpic_set_irq(struct kvm_kernel_irq_routing_entry *e,
1791 struct kvm *kvm, int irq_source_id, int level,
1792 bool line_status)
1793{
1794 u32 irq = e->irqchip.pin;
1795 struct openpic *opp = kvm->arch.mpic;
1796 unsigned long flags;
1797
1798 spin_lock_irqsave(&opp->lock, flags);
1799 openpic_set_irq(opp, irq, level);
1800 spin_unlock_irqrestore(&opp->lock, flags);
1801
1802 /* All code paths we care about don't check for the return value */
1803 return 0;
1804}
1805
1806int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
1807 struct kvm *kvm, int irq_source_id, int level, bool line_status)
1808{
1809 struct openpic *opp = kvm->arch.mpic;
1810 unsigned long flags;
1811
1812 spin_lock_irqsave(&opp->lock, flags);
1813
1814 /*
1815 * XXX We ignore the target address for now, as we only support
1816 * a single MSI bank.
1817 */
1818 openpic_msi_write(kvm->arch.mpic, MSIIR_OFFSET, e->msi.data);
1819 spin_unlock_irqrestore(&opp->lock, flags);
1820
1821 /* All code paths we care about don't check for the return value */
1822 return 0;
1823}
1824
1825int kvm_set_routing_entry(struct kvm_irq_routing_table *rt,
1826 struct kvm_kernel_irq_routing_entry *e,
1827 const struct kvm_irq_routing_entry *ue)
1828{
1829 int r = -EINVAL;
1830
1831 switch (ue->type) {
1832 case KVM_IRQ_ROUTING_IRQCHIP:
1833 e->set = mpic_set_irq;
1834 e->irqchip.irqchip = ue->u.irqchip.irqchip;
1835 e->irqchip.pin = ue->u.irqchip.pin;
1836 if (e->irqchip.pin >= KVM_IRQCHIP_NUM_PINS)
1837 goto out;
1838 rt->chip[ue->u.irqchip.irqchip][e->irqchip.pin] = ue->gsi;
1839 break;
1840 case KVM_IRQ_ROUTING_MSI:
1841 e->set = kvm_set_msi;
1842 e->msi.address_lo = ue->u.msi.address_lo;
1843 e->msi.address_hi = ue->u.msi.address_hi;
1844 e->msi.data = ue->u.msi.data;
1845 break;
1846 default:
1847 goto out;
1848 }
1849
1850 r = 0;
1851out:
1852 return r;
1853}
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 934413cd3a1b..6316ee336e88 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -25,6 +25,7 @@
25#include <linux/hrtimer.h> 25#include <linux/hrtimer.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/file.h>
28#include <asm/cputable.h> 29#include <asm/cputable.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/kvm_ppc.h> 31#include <asm/kvm_ppc.h>
@@ -32,6 +33,7 @@
32#include <asm/cputhreads.h> 33#include <asm/cputhreads.h>
33#include <asm/irqflags.h> 34#include <asm/irqflags.h>
34#include "timing.h" 35#include "timing.h"
36#include "irq.h"
35#include "../mm/mmu_decl.h" 37#include "../mm/mmu_decl.h"
36 38
37#define CREATE_TRACE_POINTS 39#define CREATE_TRACE_POINTS
@@ -317,6 +319,7 @@ int kvm_dev_ioctl_check_extension(long ext)
317 case KVM_CAP_ENABLE_CAP: 319 case KVM_CAP_ENABLE_CAP:
318 case KVM_CAP_ONE_REG: 320 case KVM_CAP_ONE_REG:
319 case KVM_CAP_IOEVENTFD: 321 case KVM_CAP_IOEVENTFD:
322 case KVM_CAP_DEVICE_CTRL:
320 r = 1; 323 r = 1;
321 break; 324 break;
322#ifndef CONFIG_KVM_BOOK3S_64_HV 325#ifndef CONFIG_KVM_BOOK3S_64_HV
@@ -326,6 +329,9 @@ int kvm_dev_ioctl_check_extension(long ext)
326#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC) 329#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
327 case KVM_CAP_SW_TLB: 330 case KVM_CAP_SW_TLB:
328#endif 331#endif
332#ifdef CONFIG_KVM_MPIC
333 case KVM_CAP_IRQ_MPIC:
334#endif
329 r = 1; 335 r = 1;
330 break; 336 break;
331 case KVM_CAP_COALESCED_MMIO: 337 case KVM_CAP_COALESCED_MMIO:
@@ -335,6 +341,10 @@ int kvm_dev_ioctl_check_extension(long ext)
335#ifdef CONFIG_PPC_BOOK3S_64 341#ifdef CONFIG_PPC_BOOK3S_64
336 case KVM_CAP_SPAPR_TCE: 342 case KVM_CAP_SPAPR_TCE:
337 case KVM_CAP_PPC_ALLOC_HTAB: 343 case KVM_CAP_PPC_ALLOC_HTAB:
344 case KVM_CAP_PPC_RTAS:
345#ifdef CONFIG_KVM_XICS
346 case KVM_CAP_IRQ_XICS:
347#endif
338 r = 1; 348 r = 1;
339 break; 349 break;
340#endif /* CONFIG_PPC_BOOK3S_64 */ 350#endif /* CONFIG_PPC_BOOK3S_64 */
@@ -411,18 +421,17 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
411} 421}
412 422
413int kvm_arch_prepare_memory_region(struct kvm *kvm, 423int kvm_arch_prepare_memory_region(struct kvm *kvm,
414 struct kvm_memory_slot *memslot, 424 struct kvm_memory_slot *memslot,
415 struct kvm_memory_slot old, 425 struct kvm_userspace_memory_region *mem,
416 struct kvm_userspace_memory_region *mem, 426 enum kvm_mr_change change)
417 bool user_alloc)
418{ 427{
419 return kvmppc_core_prepare_memory_region(kvm, memslot, mem); 428 return kvmppc_core_prepare_memory_region(kvm, memslot, mem);
420} 429}
421 430
422void kvm_arch_commit_memory_region(struct kvm *kvm, 431void kvm_arch_commit_memory_region(struct kvm *kvm,
423 struct kvm_userspace_memory_region *mem, 432 struct kvm_userspace_memory_region *mem,
424 struct kvm_memory_slot old, 433 const struct kvm_memory_slot *old,
425 bool user_alloc) 434 enum kvm_mr_change change)
426{ 435{
427 kvmppc_core_commit_memory_region(kvm, mem, old); 436 kvmppc_core_commit_memory_region(kvm, mem, old);
428} 437}
@@ -460,6 +469,16 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
460 tasklet_kill(&vcpu->arch.tasklet); 469 tasklet_kill(&vcpu->arch.tasklet);
461 470
462 kvmppc_remove_vcpu_debugfs(vcpu); 471 kvmppc_remove_vcpu_debugfs(vcpu);
472
473 switch (vcpu->arch.irq_type) {
474 case KVMPPC_IRQ_MPIC:
475 kvmppc_mpic_disconnect_vcpu(vcpu->arch.mpic, vcpu);
476 break;
477 case KVMPPC_IRQ_XICS:
478 kvmppc_xics_free_icp(vcpu);
479 break;
480 }
481
463 kvmppc_core_vcpu_free(vcpu); 482 kvmppc_core_vcpu_free(vcpu);
464} 483}
465 484
@@ -532,12 +551,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
532#endif 551#endif
533} 552}
534 553
535int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
536 struct kvm_guest_debug *dbg)
537{
538 return -EINVAL;
539}
540
541static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu, 554static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu,
542 struct kvm_run *run) 555 struct kvm_run *run)
543{ 556{
@@ -612,6 +625,8 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
612int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, 625int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
613 unsigned int rt, unsigned int bytes, int is_bigendian) 626 unsigned int rt, unsigned int bytes, int is_bigendian)
614{ 627{
628 int idx, ret;
629
615 if (bytes > sizeof(run->mmio.data)) { 630 if (bytes > sizeof(run->mmio.data)) {
616 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__, 631 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__,
617 run->mmio.len); 632 run->mmio.len);
@@ -627,8 +642,14 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
627 vcpu->mmio_is_write = 0; 642 vcpu->mmio_is_write = 0;
628 vcpu->arch.mmio_sign_extend = 0; 643 vcpu->arch.mmio_sign_extend = 0;
629 644
630 if (!kvm_io_bus_read(vcpu->kvm, KVM_MMIO_BUS, run->mmio.phys_addr, 645 idx = srcu_read_lock(&vcpu->kvm->srcu);
631 bytes, &run->mmio.data)) { 646
647 ret = kvm_io_bus_read(vcpu->kvm, KVM_MMIO_BUS, run->mmio.phys_addr,
648 bytes, &run->mmio.data);
649
650 srcu_read_unlock(&vcpu->kvm->srcu, idx);
651
652 if (!ret) {
632 kvmppc_complete_mmio_load(vcpu, run); 653 kvmppc_complete_mmio_load(vcpu, run);
633 vcpu->mmio_needed = 0; 654 vcpu->mmio_needed = 0;
634 return EMULATE_DONE; 655 return EMULATE_DONE;
@@ -653,6 +674,7 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
653 u64 val, unsigned int bytes, int is_bigendian) 674 u64 val, unsigned int bytes, int is_bigendian)
654{ 675{
655 void *data = run->mmio.data; 676 void *data = run->mmio.data;
677 int idx, ret;
656 678
657 if (bytes > sizeof(run->mmio.data)) { 679 if (bytes > sizeof(run->mmio.data)) {
658 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__, 680 printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__,
@@ -682,9 +704,14 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
682 } 704 }
683 } 705 }
684 706
685 if (!kvm_io_bus_write(vcpu->kvm, KVM_MMIO_BUS, run->mmio.phys_addr, 707 idx = srcu_read_lock(&vcpu->kvm->srcu);
686 bytes, &run->mmio.data)) { 708
687 kvmppc_complete_mmio_load(vcpu, run); 709 ret = kvm_io_bus_write(vcpu->kvm, KVM_MMIO_BUS, run->mmio.phys_addr,
710 bytes, &run->mmio.data);
711
712 srcu_read_unlock(&vcpu->kvm->srcu, idx);
713
714 if (!ret) {
688 vcpu->mmio_needed = 0; 715 vcpu->mmio_needed = 0;
689 return EMULATE_DONE; 716 return EMULATE_DONE;
690 } 717 }
@@ -740,7 +767,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
740int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) 767int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
741{ 768{
742 if (irq->irq == KVM_INTERRUPT_UNSET) { 769 if (irq->irq == KVM_INTERRUPT_UNSET) {
743 kvmppc_core_dequeue_external(vcpu, irq); 770 kvmppc_core_dequeue_external(vcpu);
744 return 0; 771 return 0;
745 } 772 }
746 773
@@ -770,7 +797,10 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
770 break; 797 break;
771 case KVM_CAP_PPC_EPR: 798 case KVM_CAP_PPC_EPR:
772 r = 0; 799 r = 0;
773 vcpu->arch.epr_enabled = cap->args[0]; 800 if (cap->args[0])
801 vcpu->arch.epr_flags |= KVMPPC_EPR_USER;
802 else
803 vcpu->arch.epr_flags &= ~KVMPPC_EPR_USER;
774 break; 804 break;
775#ifdef CONFIG_BOOKE 805#ifdef CONFIG_BOOKE
776 case KVM_CAP_PPC_BOOKE_WATCHDOG: 806 case KVM_CAP_PPC_BOOKE_WATCHDOG:
@@ -791,6 +821,44 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
791 break; 821 break;
792 } 822 }
793#endif 823#endif
824#ifdef CONFIG_KVM_MPIC
825 case KVM_CAP_IRQ_MPIC: {
826 struct file *filp;
827 struct kvm_device *dev;
828
829 r = -EBADF;
830 filp = fget(cap->args[0]);
831 if (!filp)
832 break;
833
834 r = -EPERM;
835 dev = kvm_device_from_filp(filp);
836 if (dev)
837 r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]);
838
839 fput(filp);
840 break;
841 }
842#endif
843#ifdef CONFIG_KVM_XICS
844 case KVM_CAP_IRQ_XICS: {
845 struct file *filp;
846 struct kvm_device *dev;
847
848 r = -EBADF;
849 filp = fget(cap->args[0]);
850 if (!filp)
851 break;
852
853 r = -EPERM;
854 dev = kvm_device_from_filp(filp);
855 if (dev)
856 r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]);
857
858 fput(filp);
859 break;
860 }
861#endif /* CONFIG_KVM_XICS */
794 default: 862 default:
795 r = -EINVAL; 863 r = -EINVAL;
796 break; 864 break;
@@ -913,9 +981,22 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
913 return 0; 981 return 0;
914} 982}
915 983
984int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event,
985 bool line_status)
986{
987 if (!irqchip_in_kernel(kvm))
988 return -ENXIO;
989
990 irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
991 irq_event->irq, irq_event->level,
992 line_status);
993 return 0;
994}
995
916long kvm_arch_vm_ioctl(struct file *filp, 996long kvm_arch_vm_ioctl(struct file *filp,
917 unsigned int ioctl, unsigned long arg) 997 unsigned int ioctl, unsigned long arg)
918{ 998{
999 struct kvm *kvm __maybe_unused = filp->private_data;
919 void __user *argp = (void __user *)arg; 1000 void __user *argp = (void __user *)arg;
920 long r; 1001 long r;
921 1002
@@ -934,7 +1015,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
934#ifdef CONFIG_PPC_BOOK3S_64 1015#ifdef CONFIG_PPC_BOOK3S_64
935 case KVM_CREATE_SPAPR_TCE: { 1016 case KVM_CREATE_SPAPR_TCE: {
936 struct kvm_create_spapr_tce create_tce; 1017 struct kvm_create_spapr_tce create_tce;
937 struct kvm *kvm = filp->private_data;
938 1018
939 r = -EFAULT; 1019 r = -EFAULT;
940 if (copy_from_user(&create_tce, argp, sizeof(create_tce))) 1020 if (copy_from_user(&create_tce, argp, sizeof(create_tce)))
@@ -946,8 +1026,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
946 1026
947#ifdef CONFIG_KVM_BOOK3S_64_HV 1027#ifdef CONFIG_KVM_BOOK3S_64_HV
948 case KVM_ALLOCATE_RMA: { 1028 case KVM_ALLOCATE_RMA: {
949 struct kvm *kvm = filp->private_data;
950 struct kvm_allocate_rma rma; 1029 struct kvm_allocate_rma rma;
1030 struct kvm *kvm = filp->private_data;
951 1031
952 r = kvm_vm_ioctl_allocate_rma(kvm, &rma); 1032 r = kvm_vm_ioctl_allocate_rma(kvm, &rma);
953 if (r >= 0 && copy_to_user(argp, &rma, sizeof(rma))) 1033 if (r >= 0 && copy_to_user(argp, &rma, sizeof(rma)))
@@ -956,7 +1036,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
956 } 1036 }
957 1037
958 case KVM_PPC_ALLOCATE_HTAB: { 1038 case KVM_PPC_ALLOCATE_HTAB: {
959 struct kvm *kvm = filp->private_data;
960 u32 htab_order; 1039 u32 htab_order;
961 1040
962 r = -EFAULT; 1041 r = -EFAULT;
@@ -973,7 +1052,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
973 } 1052 }
974 1053
975 case KVM_PPC_GET_HTAB_FD: { 1054 case KVM_PPC_GET_HTAB_FD: {
976 struct kvm *kvm = filp->private_data;
977 struct kvm_get_htab_fd ghf; 1055 struct kvm_get_htab_fd ghf;
978 1056
979 r = -EFAULT; 1057 r = -EFAULT;
@@ -986,7 +1064,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
986 1064
987#ifdef CONFIG_PPC_BOOK3S_64 1065#ifdef CONFIG_PPC_BOOK3S_64
988 case KVM_PPC_GET_SMMU_INFO: { 1066 case KVM_PPC_GET_SMMU_INFO: {
989 struct kvm *kvm = filp->private_data;
990 struct kvm_ppc_smmu_info info; 1067 struct kvm_ppc_smmu_info info;
991 1068
992 memset(&info, 0, sizeof(info)); 1069 memset(&info, 0, sizeof(info));
@@ -995,6 +1072,12 @@ long kvm_arch_vm_ioctl(struct file *filp,
995 r = -EFAULT; 1072 r = -EFAULT;
996 break; 1073 break;
997 } 1074 }
1075 case KVM_PPC_RTAS_DEFINE_TOKEN: {
1076 struct kvm *kvm = filp->private_data;
1077
1078 r = kvm_vm_ioctl_rtas_define_token(kvm, argp);
1079 break;
1080 }
998#endif /* CONFIG_PPC_BOOK3S_64 */ 1081#endif /* CONFIG_PPC_BOOK3S_64 */
999 default: 1082 default:
1000 r = -ENOTTY; 1083 r = -ENOTTY;
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index d7efdbf640c7..4b921affa495 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -68,7 +68,11 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
68 next = pmd_addr_end(addr, end); 68 next = pmd_addr_end(addr, end);
69 if (pmd_none(pmd)) 69 if (pmd_none(pmd))
70 return 0; 70 return 0;
71 if (is_hugepd(pmdp)) { 71 if (pmd_huge(pmd)) {
72 if (!gup_hugepte((pte_t *)pmdp, PMD_SIZE, addr, next,
73 write, pages, nr))
74 return 0;
75 } else if (is_hugepd(pmdp)) {
72 if (!gup_hugepd((hugepd_t *)pmdp, PMD_SHIFT, 76 if (!gup_hugepd((hugepd_t *)pmdp, PMD_SHIFT,
73 addr, next, write, pages, nr)) 77 addr, next, write, pages, nr))
74 return 0; 78 return 0;
@@ -92,7 +96,11 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
92 next = pud_addr_end(addr, end); 96 next = pud_addr_end(addr, end);
93 if (pud_none(pud)) 97 if (pud_none(pud))
94 return 0; 98 return 0;
95 if (is_hugepd(pudp)) { 99 if (pud_huge(pud)) {
100 if (!gup_hugepte((pte_t *)pudp, PUD_SIZE, addr, next,
101 write, pages, nr))
102 return 0;
103 } else if (is_hugepd(pudp)) {
96 if (!gup_hugepd((hugepd_t *)pudp, PUD_SHIFT, 104 if (!gup_hugepd((hugepd_t *)pudp, PUD_SHIFT,
97 addr, next, write, pages, nr)) 105 addr, next, write, pages, nr))
98 return 0; 106 return 0;
@@ -153,7 +161,11 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
153 next = pgd_addr_end(addr, end); 161 next = pgd_addr_end(addr, end);
154 if (pgd_none(pgd)) 162 if (pgd_none(pgd))
155 goto slow; 163 goto slow;
156 if (is_hugepd(pgdp)) { 164 if (pgd_huge(pgd)) {
165 if (!gup_hugepte((pte_t *)pgdp, PGDIR_SIZE, addr, next,
166 write, pages, &nr))
167 goto slow;
168 } else if (is_hugepd(pgdp)) {
157 if (!gup_hugepd((hugepd_t *)pgdp, PGDIR_SHIFT, 169 if (!gup_hugepd((hugepd_t *)pgdp, PGDIR_SHIFT,
158 addr, next, write, pages, &nr)) 170 addr, next, write, pages, &nr))
159 goto slow; 171 goto slow;
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 7443481a315c..0e980acae67c 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -196,7 +196,8 @@ htab_insert_pte:
196 mr r4,r29 /* Retrieve vpn */ 196 mr r4,r29 /* Retrieve vpn */
197 li r7,0 /* !bolted, !secondary */ 197 li r7,0 /* !bolted, !secondary */
198 li r8,MMU_PAGE_4K /* page size */ 198 li r8,MMU_PAGE_4K /* page size */
199 ld r9,STK_PARAM(R9)(r1) /* segment size */ 199 li r9,MMU_PAGE_4K /* actual page size */
200 ld r10,STK_PARAM(R9)(r1) /* segment size */
200_GLOBAL(htab_call_hpte_insert1) 201_GLOBAL(htab_call_hpte_insert1)
201 bl . /* Patched by htab_finish_init() */ 202 bl . /* Patched by htab_finish_init() */
202 cmpdi 0,r3,0 203 cmpdi 0,r3,0
@@ -219,7 +220,8 @@ _GLOBAL(htab_call_hpte_insert1)
219 mr r4,r29 /* Retrieve vpn */ 220 mr r4,r29 /* Retrieve vpn */
220 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 221 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
221 li r8,MMU_PAGE_4K /* page size */ 222 li r8,MMU_PAGE_4K /* page size */
222 ld r9,STK_PARAM(R9)(r1) /* segment size */ 223 li r9,MMU_PAGE_4K /* actual page size */
224 ld r10,STK_PARAM(R9)(r1) /* segment size */
223_GLOBAL(htab_call_hpte_insert2) 225_GLOBAL(htab_call_hpte_insert2)
224 bl . /* Patched by htab_finish_init() */ 226 bl . /* Patched by htab_finish_init() */
225 cmpdi 0,r3,0 227 cmpdi 0,r3,0
@@ -490,7 +492,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
490 beq htab_inval_old_hpte 492 beq htab_inval_old_hpte
491 493
492 ld r6,STK_PARAM(R6)(r1) 494 ld r6,STK_PARAM(R6)(r1)
493 ori r26,r6,0x8000 /* Load the hidx mask */ 495 ori r26,r6,PTE_PAGE_HIDX_OFFSET /* Load the hidx mask. */
494 ld r26,0(r26) 496 ld r26,0(r26)
495 addi r5,r25,36 /* Check actual HPTE_SUB bit, this */ 497 addi r5,r25,36 /* Check actual HPTE_SUB bit, this */
496 rldcr. r0,r31,r5,0 /* must match pgtable.h definition */ 498 rldcr. r0,r31,r5,0 /* must match pgtable.h definition */
@@ -515,7 +517,8 @@ htab_special_pfn:
515 mr r4,r29 /* Retrieve vpn */ 517 mr r4,r29 /* Retrieve vpn */
516 li r7,0 /* !bolted, !secondary */ 518 li r7,0 /* !bolted, !secondary */
517 li r8,MMU_PAGE_4K /* page size */ 519 li r8,MMU_PAGE_4K /* page size */
518 ld r9,STK_PARAM(R9)(r1) /* segment size */ 520 li r9,MMU_PAGE_4K /* actual page size */
521 ld r10,STK_PARAM(R9)(r1) /* segment size */
519_GLOBAL(htab_call_hpte_insert1) 522_GLOBAL(htab_call_hpte_insert1)
520 bl . /* patched by htab_finish_init() */ 523 bl . /* patched by htab_finish_init() */
521 cmpdi 0,r3,0 524 cmpdi 0,r3,0
@@ -542,7 +545,8 @@ _GLOBAL(htab_call_hpte_insert1)
542 mr r4,r29 /* Retrieve vpn */ 545 mr r4,r29 /* Retrieve vpn */
543 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 546 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
544 li r8,MMU_PAGE_4K /* page size */ 547 li r8,MMU_PAGE_4K /* page size */
545 ld r9,STK_PARAM(R9)(r1) /* segment size */ 548 li r9,MMU_PAGE_4K /* actual page size */
549 ld r10,STK_PARAM(R9)(r1) /* segment size */
546_GLOBAL(htab_call_hpte_insert2) 550_GLOBAL(htab_call_hpte_insert2)
547 bl . /* patched by htab_finish_init() */ 551 bl . /* patched by htab_finish_init() */
548 cmpdi 0,r3,0 552 cmpdi 0,r3,0
@@ -607,7 +611,7 @@ htab_pte_insert_ok:
607 sld r4,r4,r5 611 sld r4,r4,r5
608 andc r26,r26,r4 612 andc r26,r26,r4
609 or r26,r26,r3 613 or r26,r26,r3
610 ori r5,r6,0x8000 614 ori r5,r6,PTE_PAGE_HIDX_OFFSET
611 std r26,0(r5) 615 std r26,0(r5)
612 lwsync 616 lwsync
613 std r30,0(r6) 617 std r30,0(r6)
@@ -840,7 +844,8 @@ ht64_insert_pte:
840 mr r4,r29 /* Retrieve vpn */ 844 mr r4,r29 /* Retrieve vpn */
841 li r7,0 /* !bolted, !secondary */ 845 li r7,0 /* !bolted, !secondary */
842 li r8,MMU_PAGE_64K 846 li r8,MMU_PAGE_64K
843 ld r9,STK_PARAM(R9)(r1) /* segment size */ 847 li r9,MMU_PAGE_64K /* actual page size */
848 ld r10,STK_PARAM(R9)(r1) /* segment size */
844_GLOBAL(ht64_call_hpte_insert1) 849_GLOBAL(ht64_call_hpte_insert1)
845 bl . /* patched by htab_finish_init() */ 850 bl . /* patched by htab_finish_init() */
846 cmpdi 0,r3,0 851 cmpdi 0,r3,0
@@ -863,7 +868,8 @@ _GLOBAL(ht64_call_hpte_insert1)
863 mr r4,r29 /* Retrieve vpn */ 868 mr r4,r29 /* Retrieve vpn */
864 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 869 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
865 li r8,MMU_PAGE_64K 870 li r8,MMU_PAGE_64K
866 ld r9,STK_PARAM(R9)(r1) /* segment size */ 871 li r9,MMU_PAGE_64K /* actual page size */
872 ld r10,STK_PARAM(R9)(r1) /* segment size */
867_GLOBAL(ht64_call_hpte_insert2) 873_GLOBAL(ht64_call_hpte_insert2)
868 bl . /* patched by htab_finish_init() */ 874 bl . /* patched by htab_finish_init() */
869 cmpdi 0,r3,0 875 cmpdi 0,r3,0
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index ffc1e00f7a22..6a2aead5b0e5 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -39,7 +39,7 @@
39 39
40DEFINE_RAW_SPINLOCK(native_tlbie_lock); 40DEFINE_RAW_SPINLOCK(native_tlbie_lock);
41 41
42static inline void __tlbie(unsigned long vpn, int psize, int ssize) 42static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize)
43{ 43{
44 unsigned long va; 44 unsigned long va;
45 unsigned int penc; 45 unsigned int penc;
@@ -61,17 +61,31 @@ static inline void __tlbie(unsigned long vpn, int psize, int ssize)
61 61
62 switch (psize) { 62 switch (psize) {
63 case MMU_PAGE_4K: 63 case MMU_PAGE_4K:
64 /* clear out bits after (52) [0....52.....63] */
65 va &= ~((1ul << (64 - 52)) - 1);
64 va |= ssize << 8; 66 va |= ssize << 8;
67 va |= mmu_psize_defs[apsize].sllp << 6;
65 asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) 68 asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2)
66 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) 69 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206)
67 : "memory"); 70 : "memory");
68 break; 71 break;
69 default: 72 default:
70 /* We need 14 to 14 + i bits of va */ 73 /* We need 14 to 14 + i bits of va */
71 penc = mmu_psize_defs[psize].penc; 74 penc = mmu_psize_defs[psize].penc[apsize];
72 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 75 va &= ~((1ul << mmu_psize_defs[apsize].shift) - 1);
73 va |= penc << 12; 76 va |= penc << 12;
74 va |= ssize << 8; 77 va |= ssize << 8;
78 /* Add AVAL part */
79 if (psize != apsize) {
80 /*
81 * MPSS, 64K base page size and 16MB parge page size
82 * We don't need all the bits, but rest of the bits
83 * must be ignored by the processor.
84 * vpn cover upto 65 bits of va. (0...65) and we need
85 * 58..64 bits of va.
86 */
87 va |= (vpn & 0xfe);
88 }
75 va |= 1; /* L */ 89 va |= 1; /* L */
76 asm volatile(ASM_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%1,%0), %2) 90 asm volatile(ASM_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%1,%0), %2)
77 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) 91 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206)
@@ -80,7 +94,7 @@ static inline void __tlbie(unsigned long vpn, int psize, int ssize)
80 } 94 }
81} 95}
82 96
83static inline void __tlbiel(unsigned long vpn, int psize, int ssize) 97static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)
84{ 98{
85 unsigned long va; 99 unsigned long va;
86 unsigned int penc; 100 unsigned int penc;
@@ -96,16 +110,30 @@ static inline void __tlbiel(unsigned long vpn, int psize, int ssize)
96 110
97 switch (psize) { 111 switch (psize) {
98 case MMU_PAGE_4K: 112 case MMU_PAGE_4K:
113 /* clear out bits after(52) [0....52.....63] */
114 va &= ~((1ul << (64 - 52)) - 1);
99 va |= ssize << 8; 115 va |= ssize << 8;
116 va |= mmu_psize_defs[apsize].sllp << 6;
100 asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)" 117 asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)"
101 : : "r"(va) : "memory"); 118 : : "r"(va) : "memory");
102 break; 119 break;
103 default: 120 default:
104 /* We need 14 to 14 + i bits of va */ 121 /* We need 14 to 14 + i bits of va */
105 penc = mmu_psize_defs[psize].penc; 122 penc = mmu_psize_defs[psize].penc[apsize];
106 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 123 va &= ~((1ul << mmu_psize_defs[apsize].shift) - 1);
107 va |= penc << 12; 124 va |= penc << 12;
108 va |= ssize << 8; 125 va |= ssize << 8;
126 /* Add AVAL part */
127 if (psize != apsize) {
128 /*
129 * MPSS, 64K base page size and 16MB parge page size
130 * We don't need all the bits, but rest of the bits
131 * must be ignored by the processor.
132 * vpn cover upto 65 bits of va. (0...65) and we need
133 * 58..64 bits of va.
134 */
135 va |= (vpn & 0xfe);
136 }
109 va |= 1; /* L */ 137 va |= 1; /* L */
110 asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)" 138 asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)"
111 : : "r"(va) : "memory"); 139 : : "r"(va) : "memory");
@@ -114,7 +142,8 @@ static inline void __tlbiel(unsigned long vpn, int psize, int ssize)
114 142
115} 143}
116 144
117static inline void tlbie(unsigned long vpn, int psize, int ssize, int local) 145static inline void tlbie(unsigned long vpn, int psize, int apsize,
146 int ssize, int local)
118{ 147{
119 unsigned int use_local = local && mmu_has_feature(MMU_FTR_TLBIEL); 148 unsigned int use_local = local && mmu_has_feature(MMU_FTR_TLBIEL);
120 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); 149 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
@@ -125,10 +154,10 @@ static inline void tlbie(unsigned long vpn, int psize, int ssize, int local)
125 raw_spin_lock(&native_tlbie_lock); 154 raw_spin_lock(&native_tlbie_lock);
126 asm volatile("ptesync": : :"memory"); 155 asm volatile("ptesync": : :"memory");
127 if (use_local) { 156 if (use_local) {
128 __tlbiel(vpn, psize, ssize); 157 __tlbiel(vpn, psize, apsize, ssize);
129 asm volatile("ptesync": : :"memory"); 158 asm volatile("ptesync": : :"memory");
130 } else { 159 } else {
131 __tlbie(vpn, psize, ssize); 160 __tlbie(vpn, psize, apsize, ssize);
132 asm volatile("eieio; tlbsync; ptesync": : :"memory"); 161 asm volatile("eieio; tlbsync; ptesync": : :"memory");
133 } 162 }
134 if (lock_tlbie && !use_local) 163 if (lock_tlbie && !use_local)
@@ -156,7 +185,7 @@ static inline void native_unlock_hpte(struct hash_pte *hptep)
156 185
157static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn, 186static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn,
158 unsigned long pa, unsigned long rflags, 187 unsigned long pa, unsigned long rflags,
159 unsigned long vflags, int psize, int ssize) 188 unsigned long vflags, int psize, int apsize, int ssize)
160{ 189{
161 struct hash_pte *hptep = htab_address + hpte_group; 190 struct hash_pte *hptep = htab_address + hpte_group;
162 unsigned long hpte_v, hpte_r; 191 unsigned long hpte_v, hpte_r;
@@ -183,8 +212,8 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn,
183 if (i == HPTES_PER_GROUP) 212 if (i == HPTES_PER_GROUP)
184 return -1; 213 return -1;
185 214
186 hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; 215 hpte_v = hpte_encode_v(vpn, psize, apsize, ssize) | vflags | HPTE_V_VALID;
187 hpte_r = hpte_encode_r(pa, psize) | rflags; 216 hpte_r = hpte_encode_r(pa, psize, apsize) | rflags;
188 217
189 if (!(vflags & HPTE_V_BOLTED)) { 218 if (!(vflags & HPTE_V_BOLTED)) {
190 DBG_LOW(" i=%x hpte_v=%016lx, hpte_r=%016lx\n", 219 DBG_LOW(" i=%x hpte_v=%016lx, hpte_r=%016lx\n",
@@ -244,6 +273,51 @@ static long native_hpte_remove(unsigned long hpte_group)
244 return i; 273 return i;
245} 274}
246 275
276static inline int __hpte_actual_psize(unsigned int lp, int psize)
277{
278 int i, shift;
279 unsigned int mask;
280
281 /* start from 1 ignoring MMU_PAGE_4K */
282 for (i = 1; i < MMU_PAGE_COUNT; i++) {
283
284 /* invalid penc */
285 if (mmu_psize_defs[psize].penc[i] == -1)
286 continue;
287 /*
288 * encoding bits per actual page size
289 * PTE LP actual page size
290 * rrrr rrrz >=8KB
291 * rrrr rrzz >=16KB
292 * rrrr rzzz >=32KB
293 * rrrr zzzz >=64KB
294 * .......
295 */
296 shift = mmu_psize_defs[i].shift - LP_SHIFT;
297 if (shift > LP_BITS)
298 shift = LP_BITS;
299 mask = (1 << shift) - 1;
300 if ((lp & mask) == mmu_psize_defs[psize].penc[i])
301 return i;
302 }
303 return -1;
304}
305
306static inline int hpte_actual_psize(struct hash_pte *hptep, int psize)
307{
308 /* Look at the 8 bit LP value */
309 unsigned int lp = (hptep->r >> LP_SHIFT) & ((1 << LP_BITS) - 1);
310
311 if (!(hptep->v & HPTE_V_VALID))
312 return -1;
313
314 /* First check if it is large page */
315 if (!(hptep->v & HPTE_V_LARGE))
316 return MMU_PAGE_4K;
317
318 return __hpte_actual_psize(lp, psize);
319}
320
247static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, 321static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
248 unsigned long vpn, int psize, int ssize, 322 unsigned long vpn, int psize, int ssize,
249 int local) 323 int local)
@@ -251,8 +325,9 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
251 struct hash_pte *hptep = htab_address + slot; 325 struct hash_pte *hptep = htab_address + slot;
252 unsigned long hpte_v, want_v; 326 unsigned long hpte_v, want_v;
253 int ret = 0; 327 int ret = 0;
328 int actual_psize;
254 329
255 want_v = hpte_encode_v(vpn, psize, ssize); 330 want_v = hpte_encode_avpn(vpn, psize, ssize);
256 331
257 DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)", 332 DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)",
258 vpn, want_v & HPTE_V_AVPN, slot, newpp); 333 vpn, want_v & HPTE_V_AVPN, slot, newpp);
@@ -260,9 +335,13 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
260 native_lock_hpte(hptep); 335 native_lock_hpte(hptep);
261 336
262 hpte_v = hptep->v; 337 hpte_v = hptep->v;
263 338 actual_psize = hpte_actual_psize(hptep, psize);
339 if (actual_psize < 0) {
340 native_unlock_hpte(hptep);
341 return -1;
342 }
264 /* Even if we miss, we need to invalidate the TLB */ 343 /* Even if we miss, we need to invalidate the TLB */
265 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) { 344 if (!HPTE_V_COMPARE(hpte_v, want_v)) {
266 DBG_LOW(" -> miss\n"); 345 DBG_LOW(" -> miss\n");
267 ret = -1; 346 ret = -1;
268 } else { 347 } else {
@@ -274,7 +353,7 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
274 native_unlock_hpte(hptep); 353 native_unlock_hpte(hptep);
275 354
276 /* Ensure it is out of the tlb too. */ 355 /* Ensure it is out of the tlb too. */
277 tlbie(vpn, psize, ssize, local); 356 tlbie(vpn, psize, actual_psize, ssize, local);
278 357
279 return ret; 358 return ret;
280} 359}
@@ -288,7 +367,7 @@ static long native_hpte_find(unsigned long vpn, int psize, int ssize)
288 unsigned long want_v, hpte_v; 367 unsigned long want_v, hpte_v;
289 368
290 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize); 369 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize);
291 want_v = hpte_encode_v(vpn, psize, ssize); 370 want_v = hpte_encode_avpn(vpn, psize, ssize);
292 371
293 /* Bolted mappings are only ever in the primary group */ 372 /* Bolted mappings are only ever in the primary group */
294 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 373 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
@@ -315,6 +394,7 @@ static long native_hpte_find(unsigned long vpn, int psize, int ssize)
315static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, 394static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
316 int psize, int ssize) 395 int psize, int ssize)
317{ 396{
397 int actual_psize;
318 unsigned long vpn; 398 unsigned long vpn;
319 unsigned long vsid; 399 unsigned long vsid;
320 long slot; 400 long slot;
@@ -327,13 +407,16 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
327 if (slot == -1) 407 if (slot == -1)
328 panic("could not find page to bolt\n"); 408 panic("could not find page to bolt\n");
329 hptep = htab_address + slot; 409 hptep = htab_address + slot;
410 actual_psize = hpte_actual_psize(hptep, psize);
411 if (actual_psize < 0)
412 return;
330 413
331 /* Update the HPTE */ 414 /* Update the HPTE */
332 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) | 415 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) |
333 (newpp & (HPTE_R_PP | HPTE_R_N)); 416 (newpp & (HPTE_R_PP | HPTE_R_N));
334 417
335 /* Ensure it is out of the tlb too. */ 418 /* Ensure it is out of the tlb too. */
336 tlbie(vpn, psize, ssize, 0); 419 tlbie(vpn, psize, actual_psize, ssize, 0);
337} 420}
338 421
339static void native_hpte_invalidate(unsigned long slot, unsigned long vpn, 422static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
@@ -343,64 +426,60 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
343 unsigned long hpte_v; 426 unsigned long hpte_v;
344 unsigned long want_v; 427 unsigned long want_v;
345 unsigned long flags; 428 unsigned long flags;
429 int actual_psize;
346 430
347 local_irq_save(flags); 431 local_irq_save(flags);
348 432
349 DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot); 433 DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot);
350 434
351 want_v = hpte_encode_v(vpn, psize, ssize); 435 want_v = hpte_encode_avpn(vpn, psize, ssize);
352 native_lock_hpte(hptep); 436 native_lock_hpte(hptep);
353 hpte_v = hptep->v; 437 hpte_v = hptep->v;
354 438
439 actual_psize = hpte_actual_psize(hptep, psize);
440 if (actual_psize < 0) {
441 native_unlock_hpte(hptep);
442 local_irq_restore(flags);
443 return;
444 }
355 /* Even if we miss, we need to invalidate the TLB */ 445 /* Even if we miss, we need to invalidate the TLB */
356 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) 446 if (!HPTE_V_COMPARE(hpte_v, want_v))
357 native_unlock_hpte(hptep); 447 native_unlock_hpte(hptep);
358 else 448 else
359 /* Invalidate the hpte. NOTE: this also unlocks it */ 449 /* Invalidate the hpte. NOTE: this also unlocks it */
360 hptep->v = 0; 450 hptep->v = 0;
361 451
362 /* Invalidate the TLB */ 452 /* Invalidate the TLB */
363 tlbie(vpn, psize, ssize, local); 453 tlbie(vpn, psize, actual_psize, ssize, local);
364 454
365 local_irq_restore(flags); 455 local_irq_restore(flags);
366} 456}
367 457
368#define LP_SHIFT 12
369#define LP_BITS 8
370#define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT)
371
372static void hpte_decode(struct hash_pte *hpte, unsigned long slot, 458static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
373 int *psize, int *ssize, unsigned long *vpn) 459 int *psize, int *apsize, int *ssize, unsigned long *vpn)
374{ 460{
375 unsigned long avpn, pteg, vpi; 461 unsigned long avpn, pteg, vpi;
376 unsigned long hpte_r = hpte->r;
377 unsigned long hpte_v = hpte->v; 462 unsigned long hpte_v = hpte->v;
378 unsigned long vsid, seg_off; 463 unsigned long vsid, seg_off;
379 int i, size, shift, penc; 464 int size, a_size, shift;
465 /* Look at the 8 bit LP value */
466 unsigned int lp = (hpte->r >> LP_SHIFT) & ((1 << LP_BITS) - 1);
380 467
381 if (!(hpte_v & HPTE_V_LARGE)) 468 if (!(hpte_v & HPTE_V_LARGE)) {
382 size = MMU_PAGE_4K; 469 size = MMU_PAGE_4K;
383 else { 470 a_size = MMU_PAGE_4K;
384 for (i = 0; i < LP_BITS; i++) { 471 } else {
385 if ((hpte_r & LP_MASK(i+1)) == LP_MASK(i+1))
386 break;
387 }
388 penc = LP_MASK(i+1) >> LP_SHIFT;
389 for (size = 0; size < MMU_PAGE_COUNT; size++) { 472 for (size = 0; size < MMU_PAGE_COUNT; size++) {
390 473
391 /* 4K pages are not represented by LP */
392 if (size == MMU_PAGE_4K)
393 continue;
394
395 /* valid entries have a shift value */ 474 /* valid entries have a shift value */
396 if (!mmu_psize_defs[size].shift) 475 if (!mmu_psize_defs[size].shift)
397 continue; 476 continue;
398 477
399 if (penc == mmu_psize_defs[size].penc) 478 a_size = __hpte_actual_psize(lp, size);
479 if (a_size != -1)
400 break; 480 break;
401 } 481 }
402 } 482 }
403
404 /* This works for all page sizes, and for 256M and 1T segments */ 483 /* This works for all page sizes, and for 256M and 1T segments */
405 *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT; 484 *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT;
406 shift = mmu_psize_defs[size].shift; 485 shift = mmu_psize_defs[size].shift;
@@ -433,7 +512,8 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
433 default: 512 default:
434 *vpn = size = 0; 513 *vpn = size = 0;
435 } 514 }
436 *psize = size; 515 *psize = size;
516 *apsize = a_size;
437} 517}
438 518
439/* 519/*
@@ -451,7 +531,7 @@ static void native_hpte_clear(void)
451 struct hash_pte *hptep = htab_address; 531 struct hash_pte *hptep = htab_address;
452 unsigned long hpte_v; 532 unsigned long hpte_v;
453 unsigned long pteg_count; 533 unsigned long pteg_count;
454 int psize, ssize; 534 int psize, apsize, ssize;
455 535
456 pteg_count = htab_hash_mask + 1; 536 pteg_count = htab_hash_mask + 1;
457 537
@@ -477,9 +557,9 @@ static void native_hpte_clear(void)
477 * already hold the native_tlbie_lock. 557 * already hold the native_tlbie_lock.
478 */ 558 */
479 if (hpte_v & HPTE_V_VALID) { 559 if (hpte_v & HPTE_V_VALID) {
480 hpte_decode(hptep, slot, &psize, &ssize, &vpn); 560 hpte_decode(hptep, slot, &psize, &apsize, &ssize, &vpn);
481 hptep->v = 0; 561 hptep->v = 0;
482 __tlbie(vpn, psize, ssize); 562 __tlbie(vpn, psize, apsize, ssize);
483 } 563 }
484 } 564 }
485 565
@@ -520,7 +600,7 @@ static void native_flush_hash_range(unsigned long number, int local)
520 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 600 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
521 slot += hidx & _PTEIDX_GROUP_IX; 601 slot += hidx & _PTEIDX_GROUP_IX;
522 hptep = htab_address + slot; 602 hptep = htab_address + slot;
523 want_v = hpte_encode_v(vpn, psize, ssize); 603 want_v = hpte_encode_avpn(vpn, psize, ssize);
524 native_lock_hpte(hptep); 604 native_lock_hpte(hptep);
525 hpte_v = hptep->v; 605 hpte_v = hptep->v;
526 if (!HPTE_V_COMPARE(hpte_v, want_v) || 606 if (!HPTE_V_COMPARE(hpte_v, want_v) ||
@@ -540,7 +620,7 @@ static void native_flush_hash_range(unsigned long number, int local)
540 620
541 pte_iterate_hashed_subpages(pte, psize, 621 pte_iterate_hashed_subpages(pte, psize,
542 vpn, index, shift) { 622 vpn, index, shift) {
543 __tlbiel(vpn, psize, ssize); 623 __tlbiel(vpn, psize, psize, ssize);
544 } pte_iterate_hashed_end(); 624 } pte_iterate_hashed_end();
545 } 625 }
546 asm volatile("ptesync":::"memory"); 626 asm volatile("ptesync":::"memory");
@@ -557,7 +637,7 @@ static void native_flush_hash_range(unsigned long number, int local)
557 637
558 pte_iterate_hashed_subpages(pte, psize, 638 pte_iterate_hashed_subpages(pte, psize,
559 vpn, index, shift) { 639 vpn, index, shift) {
560 __tlbie(vpn, psize, ssize); 640 __tlbie(vpn, psize, psize, ssize);
561 } pte_iterate_hashed_end(); 641 } pte_iterate_hashed_end();
562 } 642 }
563 asm volatile("eieio; tlbsync; ptesync":::"memory"); 643 asm volatile("eieio; tlbsync; ptesync":::"memory");
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index f410c3e12c1e..88ac0eeaadde 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -126,7 +126,7 @@ static struct mmu_psize_def mmu_psize_defaults_old[] = {
126 [MMU_PAGE_4K] = { 126 [MMU_PAGE_4K] = {
127 .shift = 12, 127 .shift = 12,
128 .sllp = 0, 128 .sllp = 0,
129 .penc = 0, 129 .penc = {[MMU_PAGE_4K] = 0, [1 ... MMU_PAGE_COUNT - 1] = -1},
130 .avpnm = 0, 130 .avpnm = 0,
131 .tlbiel = 0, 131 .tlbiel = 0,
132 }, 132 },
@@ -140,14 +140,15 @@ static struct mmu_psize_def mmu_psize_defaults_gp[] = {
140 [MMU_PAGE_4K] = { 140 [MMU_PAGE_4K] = {
141 .shift = 12, 141 .shift = 12,
142 .sllp = 0, 142 .sllp = 0,
143 .penc = 0, 143 .penc = {[MMU_PAGE_4K] = 0, [1 ... MMU_PAGE_COUNT - 1] = -1},
144 .avpnm = 0, 144 .avpnm = 0,
145 .tlbiel = 1, 145 .tlbiel = 1,
146 }, 146 },
147 [MMU_PAGE_16M] = { 147 [MMU_PAGE_16M] = {
148 .shift = 24, 148 .shift = 24,
149 .sllp = SLB_VSID_L, 149 .sllp = SLB_VSID_L,
150 .penc = 0, 150 .penc = {[0 ... MMU_PAGE_16M - 1] = -1, [MMU_PAGE_16M] = 0,
151 [MMU_PAGE_16M + 1 ... MMU_PAGE_COUNT - 1] = -1 },
151 .avpnm = 0x1UL, 152 .avpnm = 0x1UL,
152 .tlbiel = 0, 153 .tlbiel = 0,
153 }, 154 },
@@ -209,7 +210,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
209 210
210 BUG_ON(!ppc_md.hpte_insert); 211 BUG_ON(!ppc_md.hpte_insert);
211 ret = ppc_md.hpte_insert(hpteg, vpn, paddr, tprot, 212 ret = ppc_md.hpte_insert(hpteg, vpn, paddr, tprot,
212 HPTE_V_BOLTED, psize, ssize); 213 HPTE_V_BOLTED, psize, psize, ssize);
213 214
214 if (ret < 0) 215 if (ret < 0)
215 break; 216 break;
@@ -276,6 +277,30 @@ static void __init htab_init_seg_sizes(void)
276 of_scan_flat_dt(htab_dt_scan_seg_sizes, NULL); 277 of_scan_flat_dt(htab_dt_scan_seg_sizes, NULL);
277} 278}
278 279
280static int __init get_idx_from_shift(unsigned int shift)
281{
282 int idx = -1;
283
284 switch (shift) {
285 case 0xc:
286 idx = MMU_PAGE_4K;
287 break;
288 case 0x10:
289 idx = MMU_PAGE_64K;
290 break;
291 case 0x14:
292 idx = MMU_PAGE_1M;
293 break;
294 case 0x18:
295 idx = MMU_PAGE_16M;
296 break;
297 case 0x22:
298 idx = MMU_PAGE_16G;
299 break;
300 }
301 return idx;
302}
303
279static int __init htab_dt_scan_page_sizes(unsigned long node, 304static int __init htab_dt_scan_page_sizes(unsigned long node,
280 const char *uname, int depth, 305 const char *uname, int depth,
281 void *data) 306 void *data)
@@ -291,64 +316,65 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
291 prop = (u32 *)of_get_flat_dt_prop(node, 316 prop = (u32 *)of_get_flat_dt_prop(node,
292 "ibm,segment-page-sizes", &size); 317 "ibm,segment-page-sizes", &size);
293 if (prop != NULL) { 318 if (prop != NULL) {
294 DBG("Page sizes from device-tree:\n"); 319 pr_info("Page sizes from device-tree:\n");
295 size /= 4; 320 size /= 4;
296 cur_cpu_spec->mmu_features &= ~(MMU_FTR_16M_PAGE); 321 cur_cpu_spec->mmu_features &= ~(MMU_FTR_16M_PAGE);
297 while(size > 0) { 322 while(size > 0) {
298 unsigned int shift = prop[0]; 323 unsigned int base_shift = prop[0];
299 unsigned int slbenc = prop[1]; 324 unsigned int slbenc = prop[1];
300 unsigned int lpnum = prop[2]; 325 unsigned int lpnum = prop[2];
301 unsigned int lpenc = 0;
302 struct mmu_psize_def *def; 326 struct mmu_psize_def *def;
303 int idx = -1; 327 int idx, base_idx;
304 328
305 size -= 3; prop += 3; 329 size -= 3; prop += 3;
306 while(size > 0 && lpnum) { 330 base_idx = get_idx_from_shift(base_shift);
307 if (prop[0] == shift) 331 if (base_idx < 0) {
308 lpenc = prop[1]; 332 /*
309 prop += 2; size -= 2; 333 * skip the pte encoding also
310 lpnum--; 334 */
335 prop += lpnum * 2; size -= lpnum * 2;
336 continue;
311 } 337 }
312 switch(shift) { 338 def = &mmu_psize_defs[base_idx];
313 case 0xc: 339 if (base_idx == MMU_PAGE_16M)
314 idx = MMU_PAGE_4K;
315 break;
316 case 0x10:
317 idx = MMU_PAGE_64K;
318 break;
319 case 0x14:
320 idx = MMU_PAGE_1M;
321 break;
322 case 0x18:
323 idx = MMU_PAGE_16M;
324 cur_cpu_spec->mmu_features |= MMU_FTR_16M_PAGE; 340 cur_cpu_spec->mmu_features |= MMU_FTR_16M_PAGE;
325 break; 341
326 case 0x22: 342 def->shift = base_shift;
327 idx = MMU_PAGE_16G; 343 if (base_shift <= 23)
328 break;
329 }
330 if (idx < 0)
331 continue;
332 def = &mmu_psize_defs[idx];
333 def->shift = shift;
334 if (shift <= 23)
335 def->avpnm = 0; 344 def->avpnm = 0;
336 else 345 else
337 def->avpnm = (1 << (shift - 23)) - 1; 346 def->avpnm = (1 << (base_shift - 23)) - 1;
338 def->sllp = slbenc; 347 def->sllp = slbenc;
339 def->penc = lpenc; 348 /*
340 /* We don't know for sure what's up with tlbiel, so 349 * We don't know for sure what's up with tlbiel, so
341 * for now we only set it for 4K and 64K pages 350 * for now we only set it for 4K and 64K pages
342 */ 351 */
343 if (idx == MMU_PAGE_4K || idx == MMU_PAGE_64K) 352 if (base_idx == MMU_PAGE_4K || base_idx == MMU_PAGE_64K)
344 def->tlbiel = 1; 353 def->tlbiel = 1;
345 else 354 else
346 def->tlbiel = 0; 355 def->tlbiel = 0;
347 356
348 DBG(" %d: shift=%02x, sllp=%04lx, avpnm=%08lx, " 357 while (size > 0 && lpnum) {
349 "tlbiel=%d, penc=%d\n", 358 unsigned int shift = prop[0];
350 idx, shift, def->sllp, def->avpnm, def->tlbiel, 359 int penc = prop[1];
351 def->penc); 360
361 prop += 2; size -= 2;
362 lpnum--;
363
364 idx = get_idx_from_shift(shift);
365 if (idx < 0)
366 continue;
367
368 if (penc == -1)
369 pr_err("Invalid penc for base_shift=%d "
370 "shift=%d\n", base_shift, shift);
371
372 def->penc[idx] = penc;
373 pr_info("base_shift=%d: shift=%d, sllp=0x%04lx,"
374 " avpnm=0x%08lx, tlbiel=%d, penc=%d\n",
375 base_shift, shift, def->sllp,
376 def->avpnm, def->tlbiel, def->penc[idx]);
377 }
352 } 378 }
353 return 1; 379 return 1;
354 } 380 }
@@ -397,10 +423,21 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
397} 423}
398#endif /* CONFIG_HUGETLB_PAGE */ 424#endif /* CONFIG_HUGETLB_PAGE */
399 425
426static void mmu_psize_set_default_penc(void)
427{
428 int bpsize, apsize;
429 for (bpsize = 0; bpsize < MMU_PAGE_COUNT; bpsize++)
430 for (apsize = 0; apsize < MMU_PAGE_COUNT; apsize++)
431 mmu_psize_defs[bpsize].penc[apsize] = -1;
432}
433
400static void __init htab_init_page_sizes(void) 434static void __init htab_init_page_sizes(void)
401{ 435{
402 int rc; 436 int rc;
403 437
438 /* se the invalid penc to -1 */
439 mmu_psize_set_default_penc();
440
404 /* Default to 4K pages only */ 441 /* Default to 4K pages only */
405 memcpy(mmu_psize_defs, mmu_psize_defaults_old, 442 memcpy(mmu_psize_defs, mmu_psize_defaults_old,
406 sizeof(mmu_psize_defaults_old)); 443 sizeof(mmu_psize_defaults_old));
@@ -899,14 +936,14 @@ static inline int subpage_protection(struct mm_struct *mm, unsigned long ea)
899 936
900void hash_failure_debug(unsigned long ea, unsigned long access, 937void hash_failure_debug(unsigned long ea, unsigned long access,
901 unsigned long vsid, unsigned long trap, 938 unsigned long vsid, unsigned long trap,
902 int ssize, int psize, unsigned long pte) 939 int ssize, int psize, int lpsize, unsigned long pte)
903{ 940{
904 if (!printk_ratelimit()) 941 if (!printk_ratelimit())
905 return; 942 return;
906 pr_info("mm: Hashing failure ! EA=0x%lx access=0x%lx current=%s\n", 943 pr_info("mm: Hashing failure ! EA=0x%lx access=0x%lx current=%s\n",
907 ea, access, current->comm); 944 ea, access, current->comm);
908 pr_info(" trap=0x%lx vsid=0x%lx ssize=%d psize=%d pte=0x%lx\n", 945 pr_info(" trap=0x%lx vsid=0x%lx ssize=%d base psize=%d psize %d pte=0x%lx\n",
909 trap, vsid, ssize, psize, pte); 946 trap, vsid, ssize, psize, lpsize, pte);
910} 947}
911 948
912/* Result code is: 949/* Result code is:
@@ -1079,7 +1116,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
1079 */ 1116 */
1080 if (rc == -1) 1117 if (rc == -1)
1081 hash_failure_debug(ea, access, vsid, trap, ssize, psize, 1118 hash_failure_debug(ea, access, vsid, trap, ssize, psize,
1082 pte_val(*ptep)); 1119 psize, pte_val(*ptep));
1083#ifndef CONFIG_PPC_64K_PAGES 1120#ifndef CONFIG_PPC_64K_PAGES
1084 DBG_LOW(" o-pte: %016lx\n", pte_val(*ptep)); 1121 DBG_LOW(" o-pte: %016lx\n", pte_val(*ptep));
1085#else 1122#else
@@ -1157,7 +1194,9 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1157 */ 1194 */
1158 if (rc == -1) 1195 if (rc == -1)
1159 hash_failure_debug(ea, access, vsid, trap, ssize, 1196 hash_failure_debug(ea, access, vsid, trap, ssize,
1160 mm->context.user_psize, pte_val(*ptep)); 1197 mm->context.user_psize,
1198 mm->context.user_psize,
1199 pte_val(*ptep));
1161 1200
1162 local_irq_restore(flags); 1201 local_irq_restore(flags);
1163} 1202}
@@ -1191,6 +1230,7 @@ void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
1191 * unmapping it first, it may see the speculated version. 1230 * unmapping it first, it may see the speculated version.
1192 */ 1231 */
1193 if (local && cpu_has_feature(CPU_FTR_TM) && 1232 if (local && cpu_has_feature(CPU_FTR_TM) &&
1233 current->thread.regs &&
1194 MSR_TM_ACTIVE(current->thread.regs->msr)) { 1234 MSR_TM_ACTIVE(current->thread.regs->msr)) {
1195 tm_enable(); 1235 tm_enable();
1196 tm_abort(TM_CAUSE_TLBI); 1236 tm_abort(TM_CAUSE_TLBI);
@@ -1230,24 +1270,60 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
1230 bad_page_fault(regs, address, SIGBUS); 1270 bad_page_fault(regs, address, SIGBUS);
1231} 1271}
1232 1272
1273long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
1274 unsigned long pa, unsigned long rflags,
1275 unsigned long vflags, int psize, int ssize)
1276{
1277 unsigned long hpte_group;
1278 long slot;
1279
1280repeat:
1281 hpte_group = ((hash & htab_hash_mask) *
1282 HPTES_PER_GROUP) & ~0x7UL;
1283
1284 /* Insert into the hash table, primary slot */
1285 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, vflags,
1286 psize, psize, ssize);
1287
1288 /* Primary is full, try the secondary */
1289 if (unlikely(slot == -1)) {
1290 hpte_group = ((~hash & htab_hash_mask) *
1291 HPTES_PER_GROUP) & ~0x7UL;
1292 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags,
1293 vflags | HPTE_V_SECONDARY,
1294 psize, psize, ssize);
1295 if (slot == -1) {
1296 if (mftb() & 0x1)
1297 hpte_group = ((hash & htab_hash_mask) *
1298 HPTES_PER_GROUP)&~0x7UL;
1299
1300 ppc_md.hpte_remove(hpte_group);
1301 goto repeat;
1302 }
1303 }
1304
1305 return slot;
1306}
1307
1233#ifdef CONFIG_DEBUG_PAGEALLOC 1308#ifdef CONFIG_DEBUG_PAGEALLOC
1234static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi) 1309static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
1235{ 1310{
1236 unsigned long hash, hpteg; 1311 unsigned long hash;
1237 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize); 1312 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize);
1238 unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize); 1313 unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize);
1239 unsigned long mode = htab_convert_pte_flags(PAGE_KERNEL); 1314 unsigned long mode = htab_convert_pte_flags(PAGE_KERNEL);
1240 int ret; 1315 long ret;
1241 1316
1242 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize); 1317 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize);
1243 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
1244 1318
1245 /* Don't create HPTE entries for bad address */ 1319 /* Don't create HPTE entries for bad address */
1246 if (!vsid) 1320 if (!vsid)
1247 return; 1321 return;
1248 ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr), 1322
1249 mode, HPTE_V_BOLTED, 1323 ret = hpte_insert_repeating(hash, vpn, __pa(vaddr), mode,
1250 mmu_linear_psize, mmu_kernel_ssize); 1324 HPTE_V_BOLTED,
1325 mmu_linear_psize, mmu_kernel_ssize);
1326
1251 BUG_ON (ret < 0); 1327 BUG_ON (ret < 0);
1252 spin_lock(&linear_map_hash_lock); 1328 spin_lock(&linear_map_hash_lock);
1253 BUG_ON(linear_map_hash_slots[lmi] & 0x80); 1329 BUG_ON(linear_map_hash_slots[lmi] & 0x80);
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index cecad348f604..0f1d94a1fb82 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -14,6 +14,10 @@
14#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
15#include <asm/machdep.h> 15#include <asm/machdep.h>
16 16
17extern long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
18 unsigned long pa, unsigned long rlags,
19 unsigned long vflags, int psize, int ssize);
20
17int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, 21int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
18 pte_t *ptep, unsigned long trap, int local, int ssize, 22 pte_t *ptep, unsigned long trap, int local, int ssize,
19 unsigned int shift, unsigned int mmu_psize) 23 unsigned int shift, unsigned int mmu_psize)
@@ -83,14 +87,9 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
83 87
84 if (likely(!(old_pte & _PAGE_HASHPTE))) { 88 if (likely(!(old_pte & _PAGE_HASHPTE))) {
85 unsigned long hash = hpt_hash(vpn, shift, ssize); 89 unsigned long hash = hpt_hash(vpn, shift, ssize);
86 unsigned long hpte_group;
87 90
88 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT; 91 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
89 92
90repeat:
91 hpte_group = ((hash & htab_hash_mask) *
92 HPTES_PER_GROUP) & ~0x7UL;
93
94 /* clear HPTE slot informations in new PTE */ 93 /* clear HPTE slot informations in new PTE */
95#ifdef CONFIG_PPC_64K_PAGES 94#ifdef CONFIG_PPC_64K_PAGES
96 new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0; 95 new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0;
@@ -101,26 +100,8 @@ repeat:
101 rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | 100 rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
102 _PAGE_COHERENT | _PAGE_GUARDED)); 101 _PAGE_COHERENT | _PAGE_GUARDED));
103 102
104 /* Insert into the hash table, primary slot */ 103 slot = hpte_insert_repeating(hash, vpn, pa, rflags, 0,
105 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0, 104 mmu_psize, ssize);
106 mmu_psize, ssize);
107
108 /* Primary is full, try the secondary */
109 if (unlikely(slot == -1)) {
110 hpte_group = ((~hash & htab_hash_mask) *
111 HPTES_PER_GROUP) & ~0x7UL;
112 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags,
113 HPTE_V_SECONDARY,
114 mmu_psize, ssize);
115 if (slot == -1) {
116 if (mftb() & 0x1)
117 hpte_group = ((hash & htab_hash_mask) *
118 HPTES_PER_GROUP)&~0x7UL;
119
120 ppc_md.hpte_remove(hpte_group);
121 goto repeat;
122 }
123 }
124 105
125 /* 106 /*
126 * Hypervisor failure. Restore old pte and return -1 107 * Hypervisor failure. Restore old pte and return -1
@@ -129,7 +110,7 @@ repeat:
129 if (unlikely(slot == -2)) { 110 if (unlikely(slot == -2)) {
130 *ptep = __pte(old_pte); 111 *ptep = __pte(old_pte);
131 hash_failure_debug(ea, access, vsid, trap, ssize, 112 hash_failure_debug(ea, access, vsid, trap, ssize,
132 mmu_psize, old_pte); 113 mmu_psize, mmu_psize, old_pte);
133 return -1; 114 return -1;
134 } 115 }
135 116
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 1a6de0a7d8eb..237c8e5f2640 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -48,30 +48,71 @@ static u64 gpage_freearray[MAX_NUMBER_GPAGES];
48static unsigned nr_gpages; 48static unsigned nr_gpages;
49#endif 49#endif
50 50
51static inline int shift_to_mmu_psize(unsigned int shift) 51#define hugepd_none(hpd) ((hpd).pd == 0)
52
53#ifdef CONFIG_PPC_BOOK3S_64
54/*
55 * At this point we do the placement change only for BOOK3S 64. This would
56 * possibly work on other subarchs.
57 */
58
59/*
60 * We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have
61 * 16GB hugepage pte in PGD and 16MB hugepage pte at PMD;
62 */
63int pmd_huge(pmd_t pmd)
52{ 64{
53 int psize; 65 /*
66 * leaf pte for huge page, bottom two bits != 00
67 */
68 return ((pmd_val(pmd) & 0x3) != 0x0);
69}
54 70
55 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) 71int pud_huge(pud_t pud)
56 if (mmu_psize_defs[psize].shift == shift) 72{
57 return psize; 73 /*
58 return -1; 74 * leaf pte for huge page, bottom two bits != 00
75 */
76 return ((pud_val(pud) & 0x3) != 0x0);
59} 77}
60 78
61static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize) 79int pgd_huge(pgd_t pgd)
62{ 80{
63 if (mmu_psize_defs[mmu_psize].shift) 81 /*
64 return mmu_psize_defs[mmu_psize].shift; 82 * leaf pte for huge page, bottom two bits != 00
65 BUG(); 83 */
84 return ((pgd_val(pgd) & 0x3) != 0x0);
85}
86#else
87int pmd_huge(pmd_t pmd)
88{
89 return 0;
66} 90}
67 91
68#define hugepd_none(hpd) ((hpd).pd == 0) 92int pud_huge(pud_t pud)
93{
94 return 0;
95}
96
97int pgd_huge(pgd_t pgd)
98{
99 return 0;
100}
101#endif
69 102
103/*
104 * We have 4 cases for pgds and pmds:
105 * (1) invalid (all zeroes)
106 * (2) pointer to next table, as normal; bottom 6 bits == 0
107 * (3) leaf pte for huge page, bottom two bits != 00
108 * (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size of table
109 */
70pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift) 110pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift)
71{ 111{
72 pgd_t *pg; 112 pgd_t *pg;
73 pud_t *pu; 113 pud_t *pu;
74 pmd_t *pm; 114 pmd_t *pm;
115 pte_t *ret_pte;
75 hugepd_t *hpdp = NULL; 116 hugepd_t *hpdp = NULL;
76 unsigned pdshift = PGDIR_SHIFT; 117 unsigned pdshift = PGDIR_SHIFT;
77 118
@@ -79,30 +120,43 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift
79 *shift = 0; 120 *shift = 0;
80 121
81 pg = pgdir + pgd_index(ea); 122 pg = pgdir + pgd_index(ea);
82 if (is_hugepd(pg)) { 123
124 if (pgd_huge(*pg)) {
125 ret_pte = (pte_t *) pg;
126 goto out;
127 } else if (is_hugepd(pg))
83 hpdp = (hugepd_t *)pg; 128 hpdp = (hugepd_t *)pg;
84 } else if (!pgd_none(*pg)) { 129 else if (!pgd_none(*pg)) {
85 pdshift = PUD_SHIFT; 130 pdshift = PUD_SHIFT;
86 pu = pud_offset(pg, ea); 131 pu = pud_offset(pg, ea);
87 if (is_hugepd(pu)) 132
133 if (pud_huge(*pu)) {
134 ret_pte = (pte_t *) pu;
135 goto out;
136 } else if (is_hugepd(pu))
88 hpdp = (hugepd_t *)pu; 137 hpdp = (hugepd_t *)pu;
89 else if (!pud_none(*pu)) { 138 else if (!pud_none(*pu)) {
90 pdshift = PMD_SHIFT; 139 pdshift = PMD_SHIFT;
91 pm = pmd_offset(pu, ea); 140 pm = pmd_offset(pu, ea);
92 if (is_hugepd(pm)) 141
142 if (pmd_huge(*pm)) {
143 ret_pte = (pte_t *) pm;
144 goto out;
145 } else if (is_hugepd(pm))
93 hpdp = (hugepd_t *)pm; 146 hpdp = (hugepd_t *)pm;
94 else if (!pmd_none(*pm)) { 147 else if (!pmd_none(*pm))
95 return pte_offset_kernel(pm, ea); 148 return pte_offset_kernel(pm, ea);
96 }
97 } 149 }
98 } 150 }
99
100 if (!hpdp) 151 if (!hpdp)
101 return NULL; 152 return NULL;
102 153
154 ret_pte = hugepte_offset(hpdp, ea, pdshift);
155 pdshift = hugepd_shift(*hpdp);
156out:
103 if (shift) 157 if (shift)
104 *shift = hugepd_shift(*hpdp); 158 *shift = pdshift;
105 return hugepte_offset(hpdp, ea, pdshift); 159 return ret_pte;
106} 160}
107EXPORT_SYMBOL_GPL(find_linux_pte_or_hugepte); 161EXPORT_SYMBOL_GPL(find_linux_pte_or_hugepte);
108 162
@@ -145,6 +199,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
145 if (unlikely(!hugepd_none(*hpdp))) 199 if (unlikely(!hugepd_none(*hpdp)))
146 break; 200 break;
147 else 201 else
202 /* We use the old format for PPC_FSL_BOOK3E */
148 hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift; 203 hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift;
149 } 204 }
150 /* If we bailed from the for loop early, an error occurred, clean up */ 205 /* If we bailed from the for loop early, an error occurred, clean up */
@@ -156,9 +211,15 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
156#else 211#else
157 if (!hugepd_none(*hpdp)) 212 if (!hugepd_none(*hpdp))
158 kmem_cache_free(cachep, new); 213 kmem_cache_free(cachep, new);
159 else 214 else {
215#ifdef CONFIG_PPC_BOOK3S_64
216 hpdp->pd = (unsigned long)new |
217 (shift_to_mmu_psize(pshift) << 2);
218#else
160 hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift; 219 hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift;
161#endif 220#endif
221 }
222#endif
162 spin_unlock(&mm->page_table_lock); 223 spin_unlock(&mm->page_table_lock);
163 return 0; 224 return 0;
164} 225}
@@ -175,6 +236,61 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
175#define HUGEPD_PUD_SHIFT PMD_SHIFT 236#define HUGEPD_PUD_SHIFT PMD_SHIFT
176#endif 237#endif
177 238
239#ifdef CONFIG_PPC_BOOK3S_64
240/*
241 * At this point we do the placement change only for BOOK3S 64. This would
242 * possibly work on other subarchs.
243 */
244pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
245{
246 pgd_t *pg;
247 pud_t *pu;
248 pmd_t *pm;
249 hugepd_t *hpdp = NULL;
250 unsigned pshift = __ffs(sz);
251 unsigned pdshift = PGDIR_SHIFT;
252
253 addr &= ~(sz-1);
254 pg = pgd_offset(mm, addr);
255
256 if (pshift == PGDIR_SHIFT)
257 /* 16GB huge page */
258 return (pte_t *) pg;
259 else if (pshift > PUD_SHIFT)
260 /*
261 * We need to use hugepd table
262 */
263 hpdp = (hugepd_t *)pg;
264 else {
265 pdshift = PUD_SHIFT;
266 pu = pud_alloc(mm, pg, addr);
267 if (pshift == PUD_SHIFT)
268 return (pte_t *)pu;
269 else if (pshift > PMD_SHIFT)
270 hpdp = (hugepd_t *)pu;
271 else {
272 pdshift = PMD_SHIFT;
273 pm = pmd_alloc(mm, pu, addr);
274 if (pshift == PMD_SHIFT)
275 /* 16MB hugepage */
276 return (pte_t *)pm;
277 else
278 hpdp = (hugepd_t *)pm;
279 }
280 }
281 if (!hpdp)
282 return NULL;
283
284 BUG_ON(!hugepd_none(*hpdp) && !hugepd_ok(*hpdp));
285
286 if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift))
287 return NULL;
288
289 return hugepte_offset(hpdp, addr, pdshift);
290}
291
292#else
293
178pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz) 294pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
179{ 295{
180 pgd_t *pg; 296 pgd_t *pg;
@@ -212,6 +328,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
212 328
213 return hugepte_offset(hpdp, addr, pdshift); 329 return hugepte_offset(hpdp, addr, pdshift);
214} 330}
331#endif
215 332
216#ifdef CONFIG_PPC_FSL_BOOK3E 333#ifdef CONFIG_PPC_FSL_BOOK3E
217/* Build list of addresses of gigantic pages. This function is used in early 334/* Build list of addresses of gigantic pages. This function is used in early
@@ -475,7 +592,7 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
475 do { 592 do {
476 pmd = pmd_offset(pud, addr); 593 pmd = pmd_offset(pud, addr);
477 next = pmd_addr_end(addr, end); 594 next = pmd_addr_end(addr, end);
478 if (pmd_none(*pmd)) 595 if (pmd_none_or_clear_bad(pmd))
479 continue; 596 continue;
480#ifdef CONFIG_PPC_FSL_BOOK3E 597#ifdef CONFIG_PPC_FSL_BOOK3E
481 /* 598 /*
@@ -628,16 +745,6 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
628 return page; 745 return page;
629} 746}
630 747
631int pmd_huge(pmd_t pmd)
632{
633 return 0;
634}
635
636int pud_huge(pud_t pud)
637{
638 return 0;
639}
640
641struct page * 748struct page *
642follow_huge_pmd(struct mm_struct *mm, unsigned long address, 749follow_huge_pmd(struct mm_struct *mm, unsigned long address,
643 pmd_t *pmd, int write) 750 pmd_t *pmd, int write)
@@ -646,8 +753,8 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
646 return NULL; 753 return NULL;
647} 754}
648 755
649static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, 756int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
650 unsigned long end, int write, struct page **pages, int *nr) 757 unsigned long end, int write, struct page **pages, int *nr)
651{ 758{
652 unsigned long mask; 759 unsigned long mask;
653 unsigned long pte_end; 760 unsigned long pte_end;
@@ -742,7 +849,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
742 struct hstate *hstate = hstate_file(file); 849 struct hstate *hstate = hstate_file(file);
743 int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate)); 850 int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
744 851
745 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0); 852 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1);
746} 853}
747#endif 854#endif
748 855
@@ -883,11 +990,16 @@ static int __init hugetlbpage_init(void)
883 pdshift = PUD_SHIFT; 990 pdshift = PUD_SHIFT;
884 else 991 else
885 pdshift = PGDIR_SHIFT; 992 pdshift = PGDIR_SHIFT;
886 993 /*
887 pgtable_cache_add(pdshift - shift, NULL); 994 * if we have pdshift and shift value same, we don't
888 if (!PGT_CACHE(pdshift - shift)) 995 * use pgt cache for hugepd.
889 panic("hugetlbpage_init(): could not create " 996 */
890 "pgtable cache for %d bit pagesize\n", shift); 997 if (pdshift != shift) {
998 pgtable_cache_add(pdshift - shift, NULL);
999 if (!PGT_CACHE(pdshift - shift))
1000 panic("hugetlbpage_init(): could not create "
1001 "pgtable cache for %d bit pagesize\n", shift);
1002 }
891 } 1003 }
892 1004
893 /* Set default large page size. Currently, we pick 16M or 1M 1005 /* Set default large page size. Currently, we pick 16M or 1M
diff --git a/arch/powerpc/mm/icswx.c b/arch/powerpc/mm/icswx.c
index 8cdbd8634a58..915412e4d5ba 100644
--- a/arch/powerpc/mm/icswx.c
+++ b/arch/powerpc/mm/icswx.c
@@ -67,7 +67,7 @@
67 67
68void switch_cop(struct mm_struct *next) 68void switch_cop(struct mm_struct *next)
69{ 69{
70#ifdef CONFIG_ICSWX_PID 70#ifdef CONFIG_PPC_ICSWX_PID
71 mtspr(SPRN_PID, next->context.cop_pid); 71 mtspr(SPRN_PID, next->context.cop_pid);
72#endif 72#endif
73 mtspr(SPRN_ACOP, next->context.acop); 73 mtspr(SPRN_ACOP, next->context.acop);
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 7e2246fb2f31..c2787bf779ca 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -129,8 +129,7 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *))
129 align = max_t(unsigned long, align, minalign); 129 align = max_t(unsigned long, align, minalign);
130 name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift); 130 name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift);
131 new = kmem_cache_create(name, table_size, align, 0, ctor); 131 new = kmem_cache_create(name, table_size, align, 0, ctor);
132 PGT_CACHE(shift) = new; 132 pgtable_cache[shift - 1] = new;
133
134 pr_debug("Allocated pgtable cache for order %d\n", shift); 133 pr_debug("Allocated pgtable cache for order %d\n", shift);
135} 134}
136 135
@@ -263,19 +262,14 @@ static __meminit void vmemmap_list_populate(unsigned long phys,
263 vmemmap_list = vmem_back; 262 vmemmap_list = vmem_back;
264} 263}
265 264
266int __meminit vmemmap_populate(struct page *start_page, 265int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
267 unsigned long nr_pages, int node)
268{ 266{
269 unsigned long start = (unsigned long)start_page;
270 unsigned long end = (unsigned long)(start_page + nr_pages);
271 unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift; 267 unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
272 268
273 /* Align to the page size of the linear mapping. */ 269 /* Align to the page size of the linear mapping. */
274 start = _ALIGN_DOWN(start, page_size); 270 start = _ALIGN_DOWN(start, page_size);
275 271
276 pr_debug("vmemmap_populate page %p, %ld pages, node %d\n", 272 pr_debug("vmemmap_populate %lx..%lx, node %d\n", start, end, node);
277 start_page, nr_pages, node);
278 pr_debug(" -> map %lx..%lx\n", start, end);
279 273
280 for (; start < end; start += page_size) { 274 for (; start < end; start += page_size) {
281 void *p; 275 void *p;
@@ -298,7 +292,7 @@ int __meminit vmemmap_populate(struct page *start_page,
298 return 0; 292 return 0;
299} 293}
300 294
301void vmemmap_free(struct page *memmap, unsigned long nr_pages) 295void vmemmap_free(unsigned long start, unsigned long end)
302{ 296{
303} 297}
304 298
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index f1f7409a4183..0988a26e0413 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -66,10 +66,9 @@ unsigned long long memory_limit;
66 66
67#ifdef CONFIG_HIGHMEM 67#ifdef CONFIG_HIGHMEM
68pte_t *kmap_pte; 68pte_t *kmap_pte;
69EXPORT_SYMBOL(kmap_pte);
69pgprot_t kmap_prot; 70pgprot_t kmap_prot;
70
71EXPORT_SYMBOL(kmap_prot); 71EXPORT_SYMBOL(kmap_prot);
72EXPORT_SYMBOL(kmap_pte);
73 72
74static inline pte_t *virt_to_kpte(unsigned long vaddr) 73static inline pte_t *virt_to_kpte(unsigned long vaddr)
75{ 74{
@@ -352,13 +351,9 @@ void __init mem_init(void)
352 struct page *page = pfn_to_page(pfn); 351 struct page *page = pfn_to_page(pfn);
353 if (memblock_is_reserved(paddr)) 352 if (memblock_is_reserved(paddr))
354 continue; 353 continue;
355 ClearPageReserved(page); 354 free_highmem_page(page);
356 init_page_count(page);
357 __free_page(page);
358 totalhigh_pages++;
359 reservedpages--; 355 reservedpages--;
360 } 356 }
361 totalram_pages += totalhigh_pages;
362 printk(KERN_DEBUG "High memory: %luk\n", 357 printk(KERN_DEBUG "High memory: %luk\n",
363 totalhigh_pages << (PAGE_SHIFT-10)); 358 totalhigh_pages << (PAGE_SHIFT-10));
364 } 359 }
@@ -405,39 +400,14 @@ void __init mem_init(void)
405 400
406void free_initmem(void) 401void free_initmem(void)
407{ 402{
408 unsigned long addr;
409
410 ppc_md.progress = ppc_printk_progress; 403 ppc_md.progress = ppc_printk_progress;
411 404 free_initmem_default(POISON_FREE_INITMEM);
412 addr = (unsigned long)__init_begin;
413 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
414 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
415 ClearPageReserved(virt_to_page(addr));
416 init_page_count(virt_to_page(addr));
417 free_page(addr);
418 totalram_pages++;
419 }
420 pr_info("Freeing unused kernel memory: %luk freed\n",
421 ((unsigned long)__init_end -
422 (unsigned long)__init_begin) >> 10);
423} 405}
424 406
425#ifdef CONFIG_BLK_DEV_INITRD 407#ifdef CONFIG_BLK_DEV_INITRD
426void __init free_initrd_mem(unsigned long start, unsigned long end) 408void __init free_initrd_mem(unsigned long start, unsigned long end)
427{ 409{
428 if (start >= end) 410 free_reserved_area(start, end, 0, "initrd");
429 return;
430
431 start = _ALIGN_DOWN(start, PAGE_SIZE);
432 end = _ALIGN_UP(end, PAGE_SIZE);
433 pr_info("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
434
435 for (; start < end; start += PAGE_SIZE) {
436 ClearPageReserved(virt_to_page(start));
437 init_page_count(virt_to_page(start));
438 free_page(start);
439 totalram_pages++;
440 }
441} 411}
442#endif 412#endif
443 413
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c
index d1d1b92c5b99..178876aef40f 100644
--- a/arch/powerpc/mm/mmu_context_hash64.c
+++ b/arch/powerpc/mm/mmu_context_hash64.c
@@ -23,6 +23,7 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24 24
25#include <asm/mmu_context.h> 25#include <asm/mmu_context.h>
26#include <asm/pgalloc.h>
26 27
27#include "icswx.h" 28#include "icswx.h"
28 29
@@ -85,6 +86,9 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
85 spin_lock_init(mm->context.cop_lockp); 86 spin_lock_init(mm->context.cop_lockp);
86#endif /* CONFIG_PPC_ICSWX */ 87#endif /* CONFIG_PPC_ICSWX */
87 88
89#ifdef CONFIG_PPC_64K_PAGES
90 mm->context.pte_frag = NULL;
91#endif
88 return 0; 92 return 0;
89} 93}
90 94
@@ -96,13 +100,46 @@ void __destroy_context(int context_id)
96} 100}
97EXPORT_SYMBOL_GPL(__destroy_context); 101EXPORT_SYMBOL_GPL(__destroy_context);
98 102
103#ifdef CONFIG_PPC_64K_PAGES
104static void destroy_pagetable_page(struct mm_struct *mm)
105{
106 int count;
107 void *pte_frag;
108 struct page *page;
109
110 pte_frag = mm->context.pte_frag;
111 if (!pte_frag)
112 return;
113
114 page = virt_to_page(pte_frag);
115 /* drop all the pending references */
116 count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT;
117 /* We allow PTE_FRAG_NR fragments from a PTE page */
118 count = atomic_sub_return(PTE_FRAG_NR - count, &page->_count);
119 if (!count) {
120 pgtable_page_dtor(page);
121 free_hot_cold_page(page, 0);
122 }
123}
124
125#else
126static inline void destroy_pagetable_page(struct mm_struct *mm)
127{
128 return;
129}
130#endif
131
132
99void destroy_context(struct mm_struct *mm) 133void destroy_context(struct mm_struct *mm)
100{ 134{
135
101#ifdef CONFIG_PPC_ICSWX 136#ifdef CONFIG_PPC_ICSWX
102 drop_cop(mm->context.acop, mm); 137 drop_cop(mm->context.acop, mm);
103 kfree(mm->context.cop_lockp); 138 kfree(mm->context.cop_lockp);
104 mm->context.cop_lockp = NULL; 139 mm->context.cop_lockp = NULL;
105#endif /* CONFIG_PPC_ICSWX */ 140#endif /* CONFIG_PPC_ICSWX */
141
142 destroy_pagetable_page(mm);
106 __destroy_context(mm->context.id); 143 __destroy_context(mm->context.id);
107 subpage_prot_free(mm); 144 subpage_prot_free(mm);
108 mm->context.id = MMU_NO_CONTEXT; 145 mm->context.id = MMU_NO_CONTEXT;
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index bba87ca2b4d7..88c0425dc0a8 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -22,6 +22,11 @@
22#include <linux/pfn.h> 22#include <linux/pfn.h>
23#include <linux/cpuset.h> 23#include <linux/cpuset.h>
24#include <linux/node.h> 24#include <linux/node.h>
25#include <linux/stop_machine.h>
26#include <linux/proc_fs.h>
27#include <linux/seq_file.h>
28#include <linux/uaccess.h>
29#include <linux/slab.h>
25#include <asm/sparsemem.h> 30#include <asm/sparsemem.h>
26#include <asm/prom.h> 31#include <asm/prom.h>
27#include <asm/smp.h> 32#include <asm/smp.h>
@@ -29,6 +34,7 @@
29#include <asm/paca.h> 34#include <asm/paca.h>
30#include <asm/hvcall.h> 35#include <asm/hvcall.h>
31#include <asm/setup.h> 36#include <asm/setup.h>
37#include <asm/vdso.h>
32 38
33static int numa_enabled = 1; 39static int numa_enabled = 1;
34 40
@@ -62,14 +68,11 @@ static int distance_lookup_table[MAX_NUMNODES][MAX_DISTANCE_REF_POINTS];
62 */ 68 */
63static void __init setup_node_to_cpumask_map(void) 69static void __init setup_node_to_cpumask_map(void)
64{ 70{
65 unsigned int node, num = 0; 71 unsigned int node;
66 72
67 /* setup nr_node_ids if not done yet */ 73 /* setup nr_node_ids if not done yet */
68 if (nr_node_ids == MAX_NUMNODES) { 74 if (nr_node_ids == MAX_NUMNODES)
69 for_each_node_mask(node, node_possible_map) 75 setup_nr_node_ids();
70 num = node;
71 nr_node_ids = num + 1;
72 }
73 76
74 /* allocate the map */ 77 /* allocate the map */
75 for (node = 0; node < nr_node_ids; node++) 78 for (node = 0; node < nr_node_ids; node++)
@@ -79,7 +82,7 @@ static void __init setup_node_to_cpumask_map(void)
79 dbg("Node to cpumask map for %d nodes\n", nr_node_ids); 82 dbg("Node to cpumask map for %d nodes\n", nr_node_ids);
80} 83}
81 84
82static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn, 85static int __init fake_numa_create_new_node(unsigned long end_pfn,
83 unsigned int *nid) 86 unsigned int *nid)
84{ 87{
85 unsigned long long mem; 88 unsigned long long mem;
@@ -201,7 +204,7 @@ int __node_distance(int a, int b)
201 int distance = LOCAL_DISTANCE; 204 int distance = LOCAL_DISTANCE;
202 205
203 if (!form1_affinity) 206 if (!form1_affinity)
204 return distance; 207 return ((a == b) ? LOCAL_DISTANCE : REMOTE_DISTANCE);
205 208
206 for (i = 0; i < distance_ref_points_depth; i++) { 209 for (i = 0; i < distance_ref_points_depth; i++) {
207 if (distance_lookup_table[a][i] == distance_lookup_table[b][i]) 210 if (distance_lookup_table[a][i] == distance_lookup_table[b][i])
@@ -291,9 +294,7 @@ EXPORT_SYMBOL_GPL(of_node_to_nid);
291static int __init find_min_common_depth(void) 294static int __init find_min_common_depth(void)
292{ 295{
293 int depth; 296 int depth;
294 struct device_node *chosen;
295 struct device_node *root; 297 struct device_node *root;
296 const char *vec5;
297 298
298 if (firmware_has_feature(FW_FEATURE_OPAL)) 299 if (firmware_has_feature(FW_FEATURE_OPAL))
299 root = of_find_node_by_path("/ibm,opal"); 300 root = of_find_node_by_path("/ibm,opal");
@@ -325,24 +326,10 @@ static int __init find_min_common_depth(void)
325 326
326 distance_ref_points_depth /= sizeof(int); 327 distance_ref_points_depth /= sizeof(int);
327 328
328#define VEC5_AFFINITY_BYTE 5 329 if (firmware_has_feature(FW_FEATURE_OPAL) ||
329#define VEC5_AFFINITY 0x80 330 firmware_has_feature(FW_FEATURE_TYPE1_AFFINITY)) {
330 331 dbg("Using form 1 affinity\n");
331 if (firmware_has_feature(FW_FEATURE_OPAL))
332 form1_affinity = 1; 332 form1_affinity = 1;
333 else {
334 chosen = of_find_node_by_path("/chosen");
335 if (chosen) {
336 vec5 = of_get_property(chosen,
337 "ibm,architecture-vec-5", NULL);
338 if (vec5 && (vec5[VEC5_AFFINITY_BYTE] &
339 VEC5_AFFINITY)) {
340 dbg("Using form 1 affinity\n");
341 form1_affinity = 1;
342 }
343
344 of_node_put(chosen);
345 }
346 } 333 }
347 334
348 if (form1_affinity) { 335 if (form1_affinity) {
@@ -1270,10 +1257,18 @@ u64 memory_hotplug_max(void)
1270 1257
1271/* Virtual Processor Home Node (VPHN) support */ 1258/* Virtual Processor Home Node (VPHN) support */
1272#ifdef CONFIG_PPC_SPLPAR 1259#ifdef CONFIG_PPC_SPLPAR
1260struct topology_update_data {
1261 struct topology_update_data *next;
1262 unsigned int cpu;
1263 int old_nid;
1264 int new_nid;
1265};
1266
1273static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS]; 1267static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS];
1274static cpumask_t cpu_associativity_changes_mask; 1268static cpumask_t cpu_associativity_changes_mask;
1275static int vphn_enabled; 1269static int vphn_enabled;
1276static void set_topology_timer(void); 1270static int prrn_enabled;
1271static void reset_topology_timer(void);
1277 1272
1278/* 1273/*
1279 * Store the current values of the associativity change counters in the 1274 * Store the current values of the associativity change counters in the
@@ -1309,11 +1304,9 @@ static void setup_cpu_associativity_change_counters(void)
1309 */ 1304 */
1310static int update_cpu_associativity_changes_mask(void) 1305static int update_cpu_associativity_changes_mask(void)
1311{ 1306{
1312 int cpu, nr_cpus = 0; 1307 int cpu;
1313 cpumask_t *changes = &cpu_associativity_changes_mask; 1308 cpumask_t *changes = &cpu_associativity_changes_mask;
1314 1309
1315 cpumask_clear(changes);
1316
1317 for_each_possible_cpu(cpu) { 1310 for_each_possible_cpu(cpu) {
1318 int i, changed = 0; 1311 int i, changed = 0;
1319 u8 *counts = vphn_cpu_change_counts[cpu]; 1312 u8 *counts = vphn_cpu_change_counts[cpu];
@@ -1327,11 +1320,10 @@ static int update_cpu_associativity_changes_mask(void)
1327 } 1320 }
1328 if (changed) { 1321 if (changed) {
1329 cpumask_set_cpu(cpu, changes); 1322 cpumask_set_cpu(cpu, changes);
1330 nr_cpus++;
1331 } 1323 }
1332 } 1324 }
1333 1325
1334 return nr_cpus; 1326 return cpumask_weight(changes);
1335} 1327}
1336 1328
1337/* 1329/*
@@ -1423,40 +1415,84 @@ static long vphn_get_associativity(unsigned long cpu,
1423} 1415}
1424 1416
1425/* 1417/*
1418 * Update the CPU maps and sysfs entries for a single CPU when its NUMA
1419 * characteristics change. This function doesn't perform any locking and is
1420 * only safe to call from stop_machine().
1421 */
1422static int update_cpu_topology(void *data)
1423{
1424 struct topology_update_data *update;
1425 unsigned long cpu;
1426
1427 if (!data)
1428 return -EINVAL;
1429
1430 cpu = get_cpu();
1431
1432 for (update = data; update; update = update->next) {
1433 if (cpu != update->cpu)
1434 continue;
1435
1436 unregister_cpu_under_node(update->cpu, update->old_nid);
1437 unmap_cpu_from_node(update->cpu);
1438 map_cpu_to_node(update->cpu, update->new_nid);
1439 vdso_getcpu_init();
1440 register_cpu_under_node(update->cpu, update->new_nid);
1441 }
1442
1443 return 0;
1444}
1445
1446/*
1426 * Update the node maps and sysfs entries for each cpu whose home node 1447 * Update the node maps and sysfs entries for each cpu whose home node
1427 * has changed. Returns 1 when the topology has changed, and 0 otherwise. 1448 * has changed. Returns 1 when the topology has changed, and 0 otherwise.
1428 */ 1449 */
1429int arch_update_cpu_topology(void) 1450int arch_update_cpu_topology(void)
1430{ 1451{
1431 int cpu, nid, old_nid, changed = 0; 1452 unsigned int cpu, changed = 0;
1453 struct topology_update_data *updates, *ud;
1432 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; 1454 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
1455 cpumask_t updated_cpus;
1433 struct device *dev; 1456 struct device *dev;
1457 int weight, i = 0;
1458
1459 weight = cpumask_weight(&cpu_associativity_changes_mask);
1460 if (!weight)
1461 return 0;
1462
1463 updates = kzalloc(weight * (sizeof(*updates)), GFP_KERNEL);
1464 if (!updates)
1465 return 0;
1434 1466
1435 for_each_cpu(cpu,&cpu_associativity_changes_mask) { 1467 cpumask_clear(&updated_cpus);
1468
1469 for_each_cpu(cpu, &cpu_associativity_changes_mask) {
1470 ud = &updates[i++];
1471 ud->cpu = cpu;
1436 vphn_get_associativity(cpu, associativity); 1472 vphn_get_associativity(cpu, associativity);
1437 nid = associativity_to_nid(associativity); 1473 ud->new_nid = associativity_to_nid(associativity);
1438 1474
1439 if (nid < 0 || !node_online(nid)) 1475 if (ud->new_nid < 0 || !node_online(ud->new_nid))
1440 nid = first_online_node; 1476 ud->new_nid = first_online_node;
1441 1477
1442 old_nid = numa_cpu_lookup_table[cpu]; 1478 ud->old_nid = numa_cpu_lookup_table[cpu];
1479 cpumask_set_cpu(cpu, &updated_cpus);
1443 1480
1444 /* Disable hotplug while we update the cpu 1481 if (i < weight)
1445 * masks and sysfs. 1482 ud->next = &updates[i];
1446 */ 1483 }
1447 get_online_cpus(); 1484
1448 unregister_cpu_under_node(cpu, old_nid); 1485 stop_machine(update_cpu_topology, &updates[0], &updated_cpus);
1449 unmap_cpu_from_node(cpu); 1486
1450 map_cpu_to_node(cpu, nid); 1487 for (ud = &updates[0]; ud; ud = ud->next) {
1451 register_cpu_under_node(cpu, nid); 1488 dev = get_cpu_device(ud->cpu);
1452 put_online_cpus();
1453
1454 dev = get_cpu_device(cpu);
1455 if (dev) 1489 if (dev)
1456 kobject_uevent(&dev->kobj, KOBJ_CHANGE); 1490 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
1491 cpumask_clear_cpu(ud->cpu, &cpu_associativity_changes_mask);
1457 changed = 1; 1492 changed = 1;
1458 } 1493 }
1459 1494
1495 kfree(updates);
1460 return changed; 1496 return changed;
1461} 1497}
1462 1498
@@ -1473,49 +1509,165 @@ void topology_schedule_update(void)
1473 1509
1474static void topology_timer_fn(unsigned long ignored) 1510static void topology_timer_fn(unsigned long ignored)
1475{ 1511{
1476 if (!vphn_enabled) 1512 if (prrn_enabled && cpumask_weight(&cpu_associativity_changes_mask))
1477 return;
1478 if (update_cpu_associativity_changes_mask() > 0)
1479 topology_schedule_update(); 1513 topology_schedule_update();
1480 set_topology_timer(); 1514 else if (vphn_enabled) {
1515 if (update_cpu_associativity_changes_mask() > 0)
1516 topology_schedule_update();
1517 reset_topology_timer();
1518 }
1481} 1519}
1482static struct timer_list topology_timer = 1520static struct timer_list topology_timer =
1483 TIMER_INITIALIZER(topology_timer_fn, 0, 0); 1521 TIMER_INITIALIZER(topology_timer_fn, 0, 0);
1484 1522
1485static void set_topology_timer(void) 1523static void reset_topology_timer(void)
1486{ 1524{
1487 topology_timer.data = 0; 1525 topology_timer.data = 0;
1488 topology_timer.expires = jiffies + 60 * HZ; 1526 topology_timer.expires = jiffies + 60 * HZ;
1489 add_timer(&topology_timer); 1527 mod_timer(&topology_timer, topology_timer.expires);
1528}
1529
1530#ifdef CONFIG_SMP
1531
1532static void stage_topology_update(int core_id)
1533{
1534 cpumask_or(&cpu_associativity_changes_mask,
1535 &cpu_associativity_changes_mask, cpu_sibling_mask(core_id));
1536 reset_topology_timer();
1490} 1537}
1491 1538
1539static int dt_update_callback(struct notifier_block *nb,
1540 unsigned long action, void *data)
1541{
1542 struct of_prop_reconfig *update;
1543 int rc = NOTIFY_DONE;
1544
1545 switch (action) {
1546 case OF_RECONFIG_UPDATE_PROPERTY:
1547 update = (struct of_prop_reconfig *)data;
1548 if (!of_prop_cmp(update->dn->type, "cpu") &&
1549 !of_prop_cmp(update->prop->name, "ibm,associativity")) {
1550 u32 core_id;
1551 of_property_read_u32(update->dn, "reg", &core_id);
1552 stage_topology_update(core_id);
1553 rc = NOTIFY_OK;
1554 }
1555 break;
1556 }
1557
1558 return rc;
1559}
1560
1561static struct notifier_block dt_update_nb = {
1562 .notifier_call = dt_update_callback,
1563};
1564
1565#endif
1566
1492/* 1567/*
1493 * Start polling for VPHN associativity changes. 1568 * Start polling for associativity changes.
1494 */ 1569 */
1495int start_topology_update(void) 1570int start_topology_update(void)
1496{ 1571{
1497 int rc = 0; 1572 int rc = 0;
1498 1573
1499 /* Disabled until races with load balancing are fixed */ 1574 if (firmware_has_feature(FW_FEATURE_PRRN)) {
1500 if (0 && firmware_has_feature(FW_FEATURE_VPHN) && 1575 if (!prrn_enabled) {
1501 get_lppaca()->shared_proc) { 1576 prrn_enabled = 1;
1502 vphn_enabled = 1; 1577 vphn_enabled = 0;
1503 setup_cpu_associativity_change_counters(); 1578#ifdef CONFIG_SMP
1504 init_timer_deferrable(&topology_timer); 1579 rc = of_reconfig_notifier_register(&dt_update_nb);
1505 set_topology_timer(); 1580#endif
1506 rc = 1; 1581 }
1582 } else if (firmware_has_feature(FW_FEATURE_VPHN) &&
1583 get_lppaca()->shared_proc) {
1584 if (!vphn_enabled) {
1585 prrn_enabled = 0;
1586 vphn_enabled = 1;
1587 setup_cpu_associativity_change_counters();
1588 init_timer_deferrable(&topology_timer);
1589 reset_topology_timer();
1590 }
1507 } 1591 }
1508 1592
1509 return rc; 1593 return rc;
1510} 1594}
1511__initcall(start_topology_update);
1512 1595
1513/* 1596/*
1514 * Disable polling for VPHN associativity changes. 1597 * Disable polling for VPHN associativity changes.
1515 */ 1598 */
1516int stop_topology_update(void) 1599int stop_topology_update(void)
1517{ 1600{
1518 vphn_enabled = 0; 1601 int rc = 0;
1519 return del_timer_sync(&topology_timer); 1602
1603 if (prrn_enabled) {
1604 prrn_enabled = 0;
1605#ifdef CONFIG_SMP
1606 rc = of_reconfig_notifier_unregister(&dt_update_nb);
1607#endif
1608 } else if (vphn_enabled) {
1609 vphn_enabled = 0;
1610 rc = del_timer_sync(&topology_timer);
1611 }
1612
1613 return rc;
1614}
1615
1616int prrn_is_enabled(void)
1617{
1618 return prrn_enabled;
1619}
1620
1621static int topology_read(struct seq_file *file, void *v)
1622{
1623 if (vphn_enabled || prrn_enabled)
1624 seq_puts(file, "on\n");
1625 else
1626 seq_puts(file, "off\n");
1627
1628 return 0;
1629}
1630
1631static int topology_open(struct inode *inode, struct file *file)
1632{
1633 return single_open(file, topology_read, NULL);
1634}
1635
1636static ssize_t topology_write(struct file *file, const char __user *buf,
1637 size_t count, loff_t *off)
1638{
1639 char kbuf[4]; /* "on" or "off" plus null. */
1640 int read_len;
1641
1642 read_len = count < 3 ? count : 3;
1643 if (copy_from_user(kbuf, buf, read_len))
1644 return -EINVAL;
1645
1646 kbuf[read_len] = '\0';
1647
1648 if (!strncmp(kbuf, "on", 2))
1649 start_topology_update();
1650 else if (!strncmp(kbuf, "off", 3))
1651 stop_topology_update();
1652 else
1653 return -EINVAL;
1654
1655 return count;
1656}
1657
1658static const struct file_operations topology_ops = {
1659 .read = seq_read,
1660 .write = topology_write,
1661 .open = topology_open,
1662 .release = single_release
1663};
1664
1665static int topology_update_init(void)
1666{
1667 start_topology_update();
1668 proc_create("powerpc/topology_updates", 644, NULL, &topology_ops);
1669
1670 return 0;
1520} 1671}
1672device_initcall(topology_update_init);
1521#endif /* CONFIG_PPC_SPLPAR */ 1673#endif /* CONFIG_PPC_SPLPAR */
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 654258f165ae..a854096e1023 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -337,3 +337,121 @@ EXPORT_SYMBOL(__ioremap_at);
337EXPORT_SYMBOL(iounmap); 337EXPORT_SYMBOL(iounmap);
338EXPORT_SYMBOL(__iounmap); 338EXPORT_SYMBOL(__iounmap);
339EXPORT_SYMBOL(__iounmap_at); 339EXPORT_SYMBOL(__iounmap_at);
340
341#ifdef CONFIG_PPC_64K_PAGES
342static pte_t *get_from_cache(struct mm_struct *mm)
343{
344 void *pte_frag, *ret;
345
346 spin_lock(&mm->page_table_lock);
347 ret = mm->context.pte_frag;
348 if (ret) {
349 pte_frag = ret + PTE_FRAG_SIZE;
350 /*
351 * If we have taken up all the fragments mark PTE page NULL
352 */
353 if (((unsigned long)pte_frag & ~PAGE_MASK) == 0)
354 pte_frag = NULL;
355 mm->context.pte_frag = pte_frag;
356 }
357 spin_unlock(&mm->page_table_lock);
358 return (pte_t *)ret;
359}
360
361static pte_t *__alloc_for_cache(struct mm_struct *mm, int kernel)
362{
363 void *ret = NULL;
364 struct page *page = alloc_page(GFP_KERNEL | __GFP_NOTRACK |
365 __GFP_REPEAT | __GFP_ZERO);
366 if (!page)
367 return NULL;
368
369 ret = page_address(page);
370 spin_lock(&mm->page_table_lock);
371 /*
372 * If we find pgtable_page set, we return
373 * the allocated page with single fragement
374 * count.
375 */
376 if (likely(!mm->context.pte_frag)) {
377 atomic_set(&page->_count, PTE_FRAG_NR);
378 mm->context.pte_frag = ret + PTE_FRAG_SIZE;
379 }
380 spin_unlock(&mm->page_table_lock);
381
382 if (!kernel)
383 pgtable_page_ctor(page);
384
385 return (pte_t *)ret;
386}
387
388pte_t *page_table_alloc(struct mm_struct *mm, unsigned long vmaddr, int kernel)
389{
390 pte_t *pte;
391
392 pte = get_from_cache(mm);
393 if (pte)
394 return pte;
395
396 return __alloc_for_cache(mm, kernel);
397}
398
399void page_table_free(struct mm_struct *mm, unsigned long *table, int kernel)
400{
401 struct page *page = virt_to_page(table);
402 if (put_page_testzero(page)) {
403 if (!kernel)
404 pgtable_page_dtor(page);
405 free_hot_cold_page(page, 0);
406 }
407}
408
409#ifdef CONFIG_SMP
410static void page_table_free_rcu(void *table)
411{
412 struct page *page = virt_to_page(table);
413 if (put_page_testzero(page)) {
414 pgtable_page_dtor(page);
415 free_hot_cold_page(page, 0);
416 }
417}
418
419void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
420{
421 unsigned long pgf = (unsigned long)table;
422
423 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
424 pgf |= shift;
425 tlb_remove_table(tlb, (void *)pgf);
426}
427
428void __tlb_remove_table(void *_table)
429{
430 void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
431 unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
432
433 if (!shift)
434 /* PTE page needs special handling */
435 page_table_free_rcu(table);
436 else {
437 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
438 kmem_cache_free(PGT_CACHE(shift), table);
439 }
440}
441#else
442void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
443{
444 if (!shift) {
445 /* PTE page needs special handling */
446 struct page *page = virt_to_page(table);
447 if (put_page_testzero(page)) {
448 pgtable_page_dtor(page);
449 free_hot_cold_page(page, 0);
450 }
451 } else {
452 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
453 kmem_cache_free(PGT_CACHE(shift), table);
454 }
455}
456#endif
457#endif /* CONFIG_PPC_64K_PAGES */
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index cf9dada734b6..3e99c149271a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -237,134 +237,112 @@ static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psiz
237#endif 237#endif
238} 238}
239 239
240/*
241 * Compute which slice addr is part of;
242 * set *boundary_addr to the start or end boundary of that slice
243 * (depending on 'end' parameter);
244 * return boolean indicating if the slice is marked as available in the
245 * 'available' slice_mark.
246 */
247static bool slice_scan_available(unsigned long addr,
248 struct slice_mask available,
249 int end,
250 unsigned long *boundary_addr)
251{
252 unsigned long slice;
253 if (addr < SLICE_LOW_TOP) {
254 slice = GET_LOW_SLICE_INDEX(addr);
255 *boundary_addr = (slice + end) << SLICE_LOW_SHIFT;
256 return !!(available.low_slices & (1u << slice));
257 } else {
258 slice = GET_HIGH_SLICE_INDEX(addr);
259 *boundary_addr = (slice + end) ?
260 ((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP;
261 return !!(available.high_slices & (1u << slice));
262 }
263}
264
240static unsigned long slice_find_area_bottomup(struct mm_struct *mm, 265static unsigned long slice_find_area_bottomup(struct mm_struct *mm,
241 unsigned long len, 266 unsigned long len,
242 struct slice_mask available, 267 struct slice_mask available,
243 int psize, int use_cache) 268 int psize)
244{ 269{
245 struct vm_area_struct *vma;
246 unsigned long start_addr, addr;
247 struct slice_mask mask;
248 int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); 270 int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
249 271 unsigned long addr, found, next_end;
250 if (use_cache) { 272 struct vm_unmapped_area_info info;
251 if (len <= mm->cached_hole_size) { 273
252 start_addr = addr = TASK_UNMAPPED_BASE; 274 info.flags = 0;
253 mm->cached_hole_size = 0; 275 info.length = len;
254 } else 276 info.align_mask = PAGE_MASK & ((1ul << pshift) - 1);
255 start_addr = addr = mm->free_area_cache; 277 info.align_offset = 0;
256 } else 278
257 start_addr = addr = TASK_UNMAPPED_BASE; 279 addr = TASK_UNMAPPED_BASE;
258 280 while (addr < TASK_SIZE) {
259full_search: 281 info.low_limit = addr;
260 for (;;) { 282 if (!slice_scan_available(addr, available, 1, &addr))
261 addr = _ALIGN_UP(addr, 1ul << pshift);
262 if ((TASK_SIZE - len) < addr)
263 break;
264 vma = find_vma(mm, addr);
265 BUG_ON(vma && (addr >= vma->vm_end));
266
267 mask = slice_range_to_mask(addr, len);
268 if (!slice_check_fit(mask, available)) {
269 if (addr < SLICE_LOW_TOP)
270 addr = _ALIGN_UP(addr + 1, 1ul << SLICE_LOW_SHIFT);
271 else
272 addr = _ALIGN_UP(addr + 1, 1ul << SLICE_HIGH_SHIFT);
273 continue; 283 continue;
284
285 next_slice:
286 /*
287 * At this point [info.low_limit; addr) covers
288 * available slices only and ends at a slice boundary.
289 * Check if we need to reduce the range, or if we can
290 * extend it to cover the next available slice.
291 */
292 if (addr >= TASK_SIZE)
293 addr = TASK_SIZE;
294 else if (slice_scan_available(addr, available, 1, &next_end)) {
295 addr = next_end;
296 goto next_slice;
274 } 297 }
275 if (!vma || addr + len <= vma->vm_start) { 298 info.high_limit = addr;
276 /*
277 * Remember the place where we stopped the search:
278 */
279 if (use_cache)
280 mm->free_area_cache = addr + len;
281 return addr;
282 }
283 if (use_cache && (addr + mm->cached_hole_size) < vma->vm_start)
284 mm->cached_hole_size = vma->vm_start - addr;
285 addr = vma->vm_end;
286 }
287 299
288 /* Make sure we didn't miss any holes */ 300 found = vm_unmapped_area(&info);
289 if (use_cache && start_addr != TASK_UNMAPPED_BASE) { 301 if (!(found & ~PAGE_MASK))
290 start_addr = addr = TASK_UNMAPPED_BASE; 302 return found;
291 mm->cached_hole_size = 0;
292 goto full_search;
293 } 303 }
304
294 return -ENOMEM; 305 return -ENOMEM;
295} 306}
296 307
297static unsigned long slice_find_area_topdown(struct mm_struct *mm, 308static unsigned long slice_find_area_topdown(struct mm_struct *mm,
298 unsigned long len, 309 unsigned long len,
299 struct slice_mask available, 310 struct slice_mask available,
300 int psize, int use_cache) 311 int psize)
301{ 312{
302 struct vm_area_struct *vma;
303 unsigned long addr;
304 struct slice_mask mask;
305 int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT); 313 int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);
314 unsigned long addr, found, prev;
315 struct vm_unmapped_area_info info;
306 316
307 /* check if free_area_cache is useful for us */ 317 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
308 if (use_cache) { 318 info.length = len;
309 if (len <= mm->cached_hole_size) { 319 info.align_mask = PAGE_MASK & ((1ul << pshift) - 1);
310 mm->cached_hole_size = 0; 320 info.align_offset = 0;
311 mm->free_area_cache = mm->mmap_base;
312 }
313
314 /* either no address requested or can't fit in requested
315 * address hole
316 */
317 addr = mm->free_area_cache;
318
319 /* make sure it can fit in the remaining address space */
320 if (addr > len) {
321 addr = _ALIGN_DOWN(addr - len, 1ul << pshift);
322 mask = slice_range_to_mask(addr, len);
323 if (slice_check_fit(mask, available) &&
324 slice_area_is_free(mm, addr, len))
325 /* remember the address as a hint for
326 * next time
327 */
328 return (mm->free_area_cache = addr);
329 }
330 }
331 321
332 addr = mm->mmap_base; 322 addr = mm->mmap_base;
333 while (addr > len) { 323 while (addr > PAGE_SIZE) {
334 /* Go down by chunk size */ 324 info.high_limit = addr;
335 addr = _ALIGN_DOWN(addr - len, 1ul << pshift); 325 if (!slice_scan_available(addr - 1, available, 0, &addr))
336
337 /* Check for hit with different page size */
338 mask = slice_range_to_mask(addr, len);
339 if (!slice_check_fit(mask, available)) {
340 if (addr < SLICE_LOW_TOP)
341 addr = _ALIGN_DOWN(addr, 1ul << SLICE_LOW_SHIFT);
342 else if (addr < (1ul << SLICE_HIGH_SHIFT))
343 addr = SLICE_LOW_TOP;
344 else
345 addr = _ALIGN_DOWN(addr, 1ul << SLICE_HIGH_SHIFT);
346 continue; 326 continue;
347 }
348 327
328 prev_slice:
349 /* 329 /*
350 * Lookup failure means no vma is above this address, 330 * At this point [addr; info.high_limit) covers
351 * else if new region fits below vma->vm_start, 331 * available slices only and starts at a slice boundary.
352 * return with success: 332 * Check if we need to reduce the range, or if we can
333 * extend it to cover the previous available slice.
353 */ 334 */
354 vma = find_vma(mm, addr); 335 if (addr < PAGE_SIZE)
355 if (!vma || (addr + len) <= vma->vm_start) { 336 addr = PAGE_SIZE;
356 /* remember the address as a hint for next time */ 337 else if (slice_scan_available(addr - 1, available, 0, &prev)) {
357 if (use_cache) 338 addr = prev;
358 mm->free_area_cache = addr; 339 goto prev_slice;
359 return addr;
360 } 340 }
341 info.low_limit = addr;
361 342
362 /* remember the largest hole we saw so far */ 343 found = vm_unmapped_area(&info);
363 if (use_cache && (addr + mm->cached_hole_size) < vma->vm_start) 344 if (!(found & ~PAGE_MASK))
364 mm->cached_hole_size = vma->vm_start - addr; 345 return found;
365
366 /* try just below the current vma->vm_start */
367 addr = vma->vm_start;
368 } 346 }
369 347
370 /* 348 /*
@@ -373,28 +351,18 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
373 * can happen with large stack limits and large mmap() 351 * can happen with large stack limits and large mmap()
374 * allocations. 352 * allocations.
375 */ 353 */
376 addr = slice_find_area_bottomup(mm, len, available, psize, 0); 354 return slice_find_area_bottomup(mm, len, available, psize);
377
378 /*
379 * Restore the topdown base:
380 */
381 if (use_cache) {
382 mm->free_area_cache = mm->mmap_base;
383 mm->cached_hole_size = ~0UL;
384 }
385
386 return addr;
387} 355}
388 356
389 357
390static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len, 358static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len,
391 struct slice_mask mask, int psize, 359 struct slice_mask mask, int psize,
392 int topdown, int use_cache) 360 int topdown)
393{ 361{
394 if (topdown) 362 if (topdown)
395 return slice_find_area_topdown(mm, len, mask, psize, use_cache); 363 return slice_find_area_topdown(mm, len, mask, psize);
396 else 364 else
397 return slice_find_area_bottomup(mm, len, mask, psize, use_cache); 365 return slice_find_area_bottomup(mm, len, mask, psize);
398} 366}
399 367
400#define or_mask(dst, src) do { \ 368#define or_mask(dst, src) do { \
@@ -415,7 +383,7 @@ static unsigned long slice_find_area(struct mm_struct *mm, unsigned long len,
415 383
416unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len, 384unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
417 unsigned long flags, unsigned int psize, 385 unsigned long flags, unsigned int psize,
418 int topdown, int use_cache) 386 int topdown)
419{ 387{
420 struct slice_mask mask = {0, 0}; 388 struct slice_mask mask = {0, 0};
421 struct slice_mask good_mask; 389 struct slice_mask good_mask;
@@ -430,8 +398,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
430 BUG_ON(mm->task_size == 0); 398 BUG_ON(mm->task_size == 0);
431 399
432 slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize); 400 slice_dbg("slice_get_unmapped_area(mm=%p, psize=%d...\n", mm, psize);
433 slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d, use_cache=%d\n", 401 slice_dbg(" addr=%lx, len=%lx, flags=%lx, topdown=%d\n",
434 addr, len, flags, topdown, use_cache); 402 addr, len, flags, topdown);
435 403
436 if (len > mm->task_size) 404 if (len > mm->task_size)
437 return -ENOMEM; 405 return -ENOMEM;
@@ -503,8 +471,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
503 /* Now let's see if we can find something in the existing 471 /* Now let's see if we can find something in the existing
504 * slices for that size 472 * slices for that size
505 */ 473 */
506 newaddr = slice_find_area(mm, len, good_mask, psize, topdown, 474 newaddr = slice_find_area(mm, len, good_mask, psize, topdown);
507 use_cache);
508 if (newaddr != -ENOMEM) { 475 if (newaddr != -ENOMEM) {
509 /* Found within the good mask, we don't have to setup, 476 /* Found within the good mask, we don't have to setup,
510 * we thus return directly 477 * we thus return directly
@@ -536,8 +503,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
536 * anywhere in the good area. 503 * anywhere in the good area.
537 */ 504 */
538 if (addr) { 505 if (addr) {
539 addr = slice_find_area(mm, len, good_mask, psize, topdown, 506 addr = slice_find_area(mm, len, good_mask, psize, topdown);
540 use_cache);
541 if (addr != -ENOMEM) { 507 if (addr != -ENOMEM) {
542 slice_dbg(" found area at 0x%lx\n", addr); 508 slice_dbg(" found area at 0x%lx\n", addr);
543 return addr; 509 return addr;
@@ -547,15 +513,14 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
547 /* Now let's see if we can find something in the existing slices 513 /* Now let's see if we can find something in the existing slices
548 * for that size plus free slices 514 * for that size plus free slices
549 */ 515 */
550 addr = slice_find_area(mm, len, potential_mask, psize, topdown, 516 addr = slice_find_area(mm, len, potential_mask, psize, topdown);
551 use_cache);
552 517
553#ifdef CONFIG_PPC_64K_PAGES 518#ifdef CONFIG_PPC_64K_PAGES
554 if (addr == -ENOMEM && psize == MMU_PAGE_64K) { 519 if (addr == -ENOMEM && psize == MMU_PAGE_64K) {
555 /* retry the search with 4k-page slices included */ 520 /* retry the search with 4k-page slices included */
556 or_mask(potential_mask, compat_mask); 521 or_mask(potential_mask, compat_mask);
557 addr = slice_find_area(mm, len, potential_mask, psize, 522 addr = slice_find_area(mm, len, potential_mask, psize,
558 topdown, use_cache); 523 topdown);
559 } 524 }
560#endif 525#endif
561 526
@@ -586,8 +551,7 @@ unsigned long arch_get_unmapped_area(struct file *filp,
586 unsigned long flags) 551 unsigned long flags)
587{ 552{
588 return slice_get_unmapped_area(addr, len, flags, 553 return slice_get_unmapped_area(addr, len, flags,
589 current->mm->context.user_psize, 554 current->mm->context.user_psize, 0);
590 0, 1);
591} 555}
592 556
593unsigned long arch_get_unmapped_area_topdown(struct file *filp, 557unsigned long arch_get_unmapped_area_topdown(struct file *filp,
@@ -597,8 +561,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp,
597 const unsigned long flags) 561 const unsigned long flags)
598{ 562{
599 return slice_get_unmapped_area(addr0, len, flags, 563 return slice_get_unmapped_area(addr0, len, flags,
600 current->mm->context.user_psize, 564 current->mm->context.user_psize, 1);
601 1, 1);
602} 565}
603 566
604unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) 567unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr)
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index df32a838dcfa..6888cad5103d 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -414,9 +414,9 @@ static void setup_page_sizes(void)
414 414
415#ifdef CONFIG_PPC_FSL_BOOK3E 415#ifdef CONFIG_PPC_FSL_BOOK3E
416 unsigned int mmucfg = mfspr(SPRN_MMUCFG); 416 unsigned int mmucfg = mfspr(SPRN_MMUCFG);
417 int fsl_mmu = mmu_has_feature(MMU_FTR_TYPE_FSL_E);
417 418
418 if (((mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V1) && 419 if (fsl_mmu && (mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V1) {
419 (mmu_has_feature(MMU_FTR_TYPE_FSL_E))) {
420 unsigned int tlb1cfg = mfspr(SPRN_TLB1CFG); 420 unsigned int tlb1cfg = mfspr(SPRN_TLB1CFG);
421 unsigned int min_pg, max_pg; 421 unsigned int min_pg, max_pg;
422 422
@@ -442,6 +442,20 @@ static void setup_page_sizes(void)
442 442
443 goto no_indirect; 443 goto no_indirect;
444 } 444 }
445
446 if (fsl_mmu && (mmucfg & MMUCFG_MAVN) == MMUCFG_MAVN_V2) {
447 u32 tlb1ps = mfspr(SPRN_TLB1PS);
448
449 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
450 struct mmu_psize_def *def = &mmu_psize_defs[psize];
451
452 if (tlb1ps & (1U << (def->shift - 10))) {
453 def->flags |= MMU_PAGE_SIZE_DIRECT;
454 }
455 }
456
457 goto no_indirect;
458 }
445#endif 459#endif
446 460
447 tlb0cfg = mfspr(SPRN_TLB0CFG); 461 tlb0cfg = mfspr(SPRN_TLB0CFG);
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
index af3fac23768c..510fae10513d 100644
--- a/arch/powerpc/perf/Makefile
+++ b/arch/powerpc/perf/Makefile
@@ -2,9 +2,10 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
2 2
3obj-$(CONFIG_PERF_EVENTS) += callchain.o 3obj-$(CONFIG_PERF_EVENTS) += callchain.o
4 4
5obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o 5obj-$(CONFIG_PPC_PERF_CTRS) += core-book3s.o bhrb.o
6obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \ 6obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \
7 power5+-pmu.o power6-pmu.o power7-pmu.o 7 power5+-pmu.o power6-pmu.o power7-pmu.o \
8 power8-pmu.o
8obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o 9obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o
9 10
10obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o 11obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
diff --git a/arch/powerpc/perf/bhrb.S b/arch/powerpc/perf/bhrb.S
new file mode 100644
index 000000000000..d85f9a58ddbc
--- /dev/null
+++ b/arch/powerpc/perf/bhrb.S
@@ -0,0 +1,44 @@
1/*
2 * Basic assembly code to read BHRB entries
3 *
4 * Copyright 2013 Anshuman Khandual, IBM Corporation.
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#include <asm/ppc_asm.h>
12#include <asm/ppc-opcode.h>
13
14 .text
15
16.balign 8
17
18/* r3 = n (where n = [0-31])
19 * The maximum number of BHRB entries supported with PPC_MFBHRBE instruction
20 * is 1024. We have limited number of table entries here as POWER8 implements
21 * 32 BHRB entries.
22 */
23
24/* .global read_bhrb */
25_GLOBAL(read_bhrb)
26 cmpldi r3,31
27 bgt 1f
28 ld r4,bhrb_table@got(r2)
29 sldi r3,r3,3
30 add r3,r4,r3
31 mtctr r3
32 bctr
331: li r3,0
34 blr
35
36#define MFBHRB_TABLE1(n) PPC_MFBHRBE(R3,n); blr
37#define MFBHRB_TABLE2(n) MFBHRB_TABLE1(n); MFBHRB_TABLE1(n+1)
38#define MFBHRB_TABLE4(n) MFBHRB_TABLE2(n); MFBHRB_TABLE2(n+2)
39#define MFBHRB_TABLE8(n) MFBHRB_TABLE4(n); MFBHRB_TABLE4(n+4)
40#define MFBHRB_TABLE16(n) MFBHRB_TABLE8(n); MFBHRB_TABLE8(n+8)
41#define MFBHRB_TABLE32(n) MFBHRB_TABLE16(n); MFBHRB_TABLE16(n+16)
42
43bhrb_table:
44 MFBHRB_TABLE32(0)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 65362e98eb26..c627843c5b2e 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -19,6 +19,11 @@
19#include <asm/firmware.h> 19#include <asm/firmware.h>
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21 21
22#define BHRB_MAX_ENTRIES 32
23#define BHRB_TARGET 0x0000000000000002
24#define BHRB_PREDICTION 0x0000000000000001
25#define BHRB_EA 0xFFFFFFFFFFFFFFFC
26
22struct cpu_hw_events { 27struct cpu_hw_events {
23 int n_events; 28 int n_events;
24 int n_percpu; 29 int n_percpu;
@@ -38,7 +43,15 @@ struct cpu_hw_events {
38 43
39 unsigned int group_flag; 44 unsigned int group_flag;
40 int n_txn_start; 45 int n_txn_start;
46
47 /* BHRB bits */
48 u64 bhrb_filter; /* BHRB HW branch filter */
49 int bhrb_users;
50 void *bhrb_context;
51 struct perf_branch_stack bhrb_stack;
52 struct perf_branch_entry bhrb_entries[BHRB_MAX_ENTRIES];
41}; 53};
54
42DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events); 55DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
43 56
44struct power_pmu *ppmu; 57struct power_pmu *ppmu;
@@ -89,6 +102,11 @@ static inline int siar_valid(struct pt_regs *regs)
89 102
90#endif /* CONFIG_PPC32 */ 103#endif /* CONFIG_PPC32 */
91 104
105static bool regs_use_siar(struct pt_regs *regs)
106{
107 return !!(regs->result & 1);
108}
109
92/* 110/*
93 * Things that are specific to 64-bit implementations. 111 * Things that are specific to 64-bit implementations.
94 */ 112 */
@@ -98,11 +116,12 @@ static inline unsigned long perf_ip_adjust(struct pt_regs *regs)
98{ 116{
99 unsigned long mmcra = regs->dsisr; 117 unsigned long mmcra = regs->dsisr;
100 118
101 if ((mmcra & MMCRA_SAMPLE_ENABLE) && !(ppmu->flags & PPMU_ALT_SIPR)) { 119 if ((ppmu->flags & PPMU_HAS_SSLOT) && (mmcra & MMCRA_SAMPLE_ENABLE)) {
102 unsigned long slot = (mmcra & MMCRA_SLOT) >> MMCRA_SLOT_SHIFT; 120 unsigned long slot = (mmcra & MMCRA_SLOT) >> MMCRA_SLOT_SHIFT;
103 if (slot > 1) 121 if (slot > 1)
104 return 4 * (slot - 1); 122 return 4 * (slot - 1);
105 } 123 }
124
106 return 0; 125 return 0;
107} 126}
108 127
@@ -130,24 +149,35 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
130 *addrp = mfspr(SPRN_SDAR); 149 *addrp = mfspr(SPRN_SDAR);
131} 150}
132 151
133static bool mmcra_sihv(unsigned long mmcra) 152static bool regs_sihv(struct pt_regs *regs)
134{ 153{
135 unsigned long sihv = MMCRA_SIHV; 154 unsigned long sihv = MMCRA_SIHV;
136 155
156 if (ppmu->flags & PPMU_HAS_SIER)
157 return !!(regs->dar & SIER_SIHV);
158
137 if (ppmu->flags & PPMU_ALT_SIPR) 159 if (ppmu->flags & PPMU_ALT_SIPR)
138 sihv = POWER6_MMCRA_SIHV; 160 sihv = POWER6_MMCRA_SIHV;
139 161
140 return !!(mmcra & sihv); 162 return !!(regs->dsisr & sihv);
141} 163}
142 164
143static bool mmcra_sipr(unsigned long mmcra) 165static bool regs_sipr(struct pt_regs *regs)
144{ 166{
145 unsigned long sipr = MMCRA_SIPR; 167 unsigned long sipr = MMCRA_SIPR;
146 168
169 if (ppmu->flags & PPMU_HAS_SIER)
170 return !!(regs->dar & SIER_SIPR);
171
147 if (ppmu->flags & PPMU_ALT_SIPR) 172 if (ppmu->flags & PPMU_ALT_SIPR)
148 sipr = POWER6_MMCRA_SIPR; 173 sipr = POWER6_MMCRA_SIPR;
149 174
150 return !!(mmcra & sipr); 175 return !!(regs->dsisr & sipr);
176}
177
178static bool regs_no_sipr(struct pt_regs *regs)
179{
180 return !!(regs->result & 2);
151} 181}
152 182
153static inline u32 perf_flags_from_msr(struct pt_regs *regs) 183static inline u32 perf_flags_from_msr(struct pt_regs *regs)
@@ -161,8 +191,7 @@ static inline u32 perf_flags_from_msr(struct pt_regs *regs)
161 191
162static inline u32 perf_get_misc_flags(struct pt_regs *regs) 192static inline u32 perf_get_misc_flags(struct pt_regs *regs)
163{ 193{
164 unsigned long mmcra = regs->dsisr; 194 bool use_siar = regs_use_siar(regs);
165 unsigned long use_siar = regs->result;
166 195
167 if (!use_siar) 196 if (!use_siar)
168 return perf_flags_from_msr(regs); 197 return perf_flags_from_msr(regs);
@@ -173,7 +202,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
173 * SIAR which should give slightly more reliable 202 * SIAR which should give slightly more reliable
174 * results 203 * results
175 */ 204 */
176 if (ppmu->flags & PPMU_NO_SIPR) { 205 if (regs_no_sipr(regs)) {
177 unsigned long siar = mfspr(SPRN_SIAR); 206 unsigned long siar = mfspr(SPRN_SIAR);
178 if (siar >= PAGE_OFFSET) 207 if (siar >= PAGE_OFFSET)
179 return PERF_RECORD_MISC_KERNEL; 208 return PERF_RECORD_MISC_KERNEL;
@@ -181,16 +210,19 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
181 } 210 }
182 211
183 /* PR has priority over HV, so order below is important */ 212 /* PR has priority over HV, so order below is important */
184 if (mmcra_sipr(mmcra)) 213 if (regs_sipr(regs))
185 return PERF_RECORD_MISC_USER; 214 return PERF_RECORD_MISC_USER;
186 if (mmcra_sihv(mmcra) && (freeze_events_kernel != MMCR0_FCHV)) 215
216 if (regs_sihv(regs) && (freeze_events_kernel != MMCR0_FCHV))
187 return PERF_RECORD_MISC_HYPERVISOR; 217 return PERF_RECORD_MISC_HYPERVISOR;
218
188 return PERF_RECORD_MISC_KERNEL; 219 return PERF_RECORD_MISC_KERNEL;
189} 220}
190 221
191/* 222/*
192 * Overload regs->dsisr to store MMCRA so we only need to read it once 223 * Overload regs->dsisr to store MMCRA so we only need to read it once
193 * on each interrupt. 224 * on each interrupt.
225 * Overload regs->dar to store SIER if we have it.
194 * Overload regs->result to specify whether we should use the MSR (result 226 * Overload regs->result to specify whether we should use the MSR (result
195 * is zero) or the SIAR (result is non zero). 227 * is zero) or the SIAR (result is non zero).
196 */ 228 */
@@ -200,6 +232,24 @@ static inline void perf_read_regs(struct pt_regs *regs)
200 int marked = mmcra & MMCRA_SAMPLE_ENABLE; 232 int marked = mmcra & MMCRA_SAMPLE_ENABLE;
201 int use_siar; 233 int use_siar;
202 234
235 regs->dsisr = mmcra;
236 regs->result = 0;
237
238 if (ppmu->flags & PPMU_NO_SIPR)
239 regs->result |= 2;
240
241 /*
242 * On power8 if we're in random sampling mode, the SIER is updated.
243 * If we're in continuous sampling mode, we don't have SIPR.
244 */
245 if (ppmu->flags & PPMU_HAS_SIER) {
246 if (marked)
247 regs->dar = mfspr(SPRN_SIER);
248 else
249 regs->result |= 2;
250 }
251
252
203 /* 253 /*
204 * If this isn't a PMU exception (eg a software event) the SIAR is 254 * If this isn't a PMU exception (eg a software event) the SIAR is
205 * not valid. Use pt_regs. 255 * not valid. Use pt_regs.
@@ -223,13 +273,12 @@ static inline void perf_read_regs(struct pt_regs *regs)
223 use_siar = 1; 273 use_siar = 1;
224 else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) 274 else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
225 use_siar = 0; 275 use_siar = 0;
226 else if (!(ppmu->flags & PPMU_NO_SIPR) && mmcra_sipr(mmcra)) 276 else if (!regs_no_sipr(regs) && regs_sipr(regs))
227 use_siar = 0; 277 use_siar = 0;
228 else 278 else
229 use_siar = 1; 279 use_siar = 1;
230 280
231 regs->dsisr = mmcra; 281 regs->result |= use_siar;
232 regs->result = use_siar;
233} 282}
234 283
235/* 284/*
@@ -822,6 +871,9 @@ static void power_pmu_enable(struct pmu *pmu)
822 } 871 }
823 872
824 out: 873 out:
874 if (cpuhw->bhrb_users)
875 ppmu->config_bhrb(cpuhw->bhrb_filter);
876
825 local_irq_restore(flags); 877 local_irq_restore(flags);
826} 878}
827 879
@@ -852,6 +904,47 @@ static int collect_events(struct perf_event *group, int max_count,
852 return n; 904 return n;
853} 905}
854 906
907/* Reset all possible BHRB entries */
908static void power_pmu_bhrb_reset(void)
909{
910 asm volatile(PPC_CLRBHRB);
911}
912
913void power_pmu_bhrb_enable(struct perf_event *event)
914{
915 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
916
917 if (!ppmu->bhrb_nr)
918 return;
919
920 /* Clear BHRB if we changed task context to avoid data leaks */
921 if (event->ctx->task && cpuhw->bhrb_context != event->ctx) {
922 power_pmu_bhrb_reset();
923 cpuhw->bhrb_context = event->ctx;
924 }
925 cpuhw->bhrb_users++;
926}
927
928void power_pmu_bhrb_disable(struct perf_event *event)
929{
930 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
931
932 if (!ppmu->bhrb_nr)
933 return;
934
935 cpuhw->bhrb_users--;
936 WARN_ON_ONCE(cpuhw->bhrb_users < 0);
937
938 if (!cpuhw->disabled && !cpuhw->bhrb_users) {
939 /* BHRB cannot be turned off when other
940 * events are active on the PMU.
941 */
942
943 /* avoid stale pointer */
944 cpuhw->bhrb_context = NULL;
945 }
946}
947
855/* 948/*
856 * Add a event to the PMU. 949 * Add a event to the PMU.
857 * If all events are not already frozen, then we disable and 950 * If all events are not already frozen, then we disable and
@@ -911,6 +1004,9 @@ nocheck:
911 1004
912 ret = 0; 1005 ret = 0;
913 out: 1006 out:
1007 if (has_branch_stack(event))
1008 power_pmu_bhrb_enable(event);
1009
914 perf_pmu_enable(event->pmu); 1010 perf_pmu_enable(event->pmu);
915 local_irq_restore(flags); 1011 local_irq_restore(flags);
916 return ret; 1012 return ret;
@@ -963,6 +1059,9 @@ static void power_pmu_del(struct perf_event *event, int ef_flags)
963 cpuhw->mmcr[0] &= ~(MMCR0_PMXE | MMCR0_FCECE); 1059 cpuhw->mmcr[0] &= ~(MMCR0_PMXE | MMCR0_FCECE);
964 } 1060 }
965 1061
1062 if (has_branch_stack(event))
1063 power_pmu_bhrb_disable(event);
1064
966 perf_pmu_enable(event->pmu); 1065 perf_pmu_enable(event->pmu);
967 local_irq_restore(flags); 1066 local_irq_restore(flags);
968} 1067}
@@ -1081,6 +1180,15 @@ int power_pmu_commit_txn(struct pmu *pmu)
1081 return 0; 1180 return 0;
1082} 1181}
1083 1182
1183/* Called from ctxsw to prevent one process's branch entries to
1184 * mingle with the other process's entries during context switch.
1185 */
1186void power_pmu_flush_branch_stack(void)
1187{
1188 if (ppmu->bhrb_nr)
1189 power_pmu_bhrb_reset();
1190}
1191
1084/* 1192/*
1085 * Return 1 if we might be able to put event on a limited PMC, 1193 * Return 1 if we might be able to put event on a limited PMC,
1086 * or 0 if not. 1194 * or 0 if not.
@@ -1195,9 +1303,11 @@ static int power_pmu_event_init(struct perf_event *event)
1195 if (!ppmu) 1303 if (!ppmu)
1196 return -ENOENT; 1304 return -ENOENT;
1197 1305
1198 /* does not support taken branch sampling */ 1306 if (has_branch_stack(event)) {
1199 if (has_branch_stack(event)) 1307 /* PMU has BHRB enabled */
1200 return -EOPNOTSUPP; 1308 if (!(ppmu->flags & PPMU_BHRB))
1309 return -EOPNOTSUPP;
1310 }
1201 1311
1202 switch (event->attr.type) { 1312 switch (event->attr.type) {
1203 case PERF_TYPE_HARDWARE: 1313 case PERF_TYPE_HARDWARE:
@@ -1278,6 +1388,15 @@ static int power_pmu_event_init(struct perf_event *event)
1278 1388
1279 cpuhw = &get_cpu_var(cpu_hw_events); 1389 cpuhw = &get_cpu_var(cpu_hw_events);
1280 err = power_check_constraints(cpuhw, events, cflags, n + 1); 1390 err = power_check_constraints(cpuhw, events, cflags, n + 1);
1391
1392 if (has_branch_stack(event)) {
1393 cpuhw->bhrb_filter = ppmu->bhrb_filter_map(
1394 event->attr.branch_sample_type);
1395
1396 if(cpuhw->bhrb_filter == -1)
1397 return -EOPNOTSUPP;
1398 }
1399
1281 put_cpu_var(cpu_hw_events); 1400 put_cpu_var(cpu_hw_events);
1282 if (err) 1401 if (err)
1283 return -EINVAL; 1402 return -EINVAL;
@@ -1336,8 +1455,79 @@ struct pmu power_pmu = {
1336 .cancel_txn = power_pmu_cancel_txn, 1455 .cancel_txn = power_pmu_cancel_txn,
1337 .commit_txn = power_pmu_commit_txn, 1456 .commit_txn = power_pmu_commit_txn,
1338 .event_idx = power_pmu_event_idx, 1457 .event_idx = power_pmu_event_idx,
1458 .flush_branch_stack = power_pmu_flush_branch_stack,
1339}; 1459};
1340 1460
1461/* Processing BHRB entries */
1462void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
1463{
1464 u64 val;
1465 u64 addr;
1466 int r_index, u_index, target, pred;
1467
1468 r_index = 0;
1469 u_index = 0;
1470 while (r_index < ppmu->bhrb_nr) {
1471 /* Assembly read function */
1472 val = read_bhrb(r_index);
1473
1474 /* Terminal marker: End of valid BHRB entries */
1475 if (val == 0) {
1476 break;
1477 } else {
1478 /* BHRB field break up */
1479 addr = val & BHRB_EA;
1480 pred = val & BHRB_PREDICTION;
1481 target = val & BHRB_TARGET;
1482
1483 /* Probable Missed entry: Not applicable for POWER8 */
1484 if ((addr == 0) && (target == 0) && (pred == 1)) {
1485 r_index++;
1486 continue;
1487 }
1488
1489 /* Real Missed entry: Power8 based missed entry */
1490 if ((addr == 0) && (target == 1) && (pred == 1)) {
1491 r_index++;
1492 continue;
1493 }
1494
1495 /* Reserved condition: Not a valid entry */
1496 if ((addr == 0) && (target == 1) && (pred == 0)) {
1497 r_index++;
1498 continue;
1499 }
1500
1501 /* Is a target address */
1502 if (val & BHRB_TARGET) {
1503 /* First address cannot be a target address */
1504 if (r_index == 0) {
1505 r_index++;
1506 continue;
1507 }
1508
1509 /* Update target address for the previous entry */
1510 cpuhw->bhrb_entries[u_index - 1].to = addr;
1511 cpuhw->bhrb_entries[u_index - 1].mispred = pred;
1512 cpuhw->bhrb_entries[u_index - 1].predicted = ~pred;
1513
1514 /* Dont increment u_index */
1515 r_index++;
1516 } else {
1517 /* Update address, flags for current entry */
1518 cpuhw->bhrb_entries[u_index].from = addr;
1519 cpuhw->bhrb_entries[u_index].mispred = pred;
1520 cpuhw->bhrb_entries[u_index].predicted = ~pred;
1521
1522 /* Successfully popullated one entry */
1523 u_index++;
1524 r_index++;
1525 }
1526 }
1527 }
1528 cpuhw->bhrb_stack.nr = u_index;
1529 return;
1530}
1341 1531
1342/* 1532/*
1343 * A counter has overflowed; update its count and record 1533 * A counter has overflowed; update its count and record
@@ -1397,6 +1587,13 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
1397 if (event->attr.sample_type & PERF_SAMPLE_ADDR) 1587 if (event->attr.sample_type & PERF_SAMPLE_ADDR)
1398 perf_get_data_addr(regs, &data.addr); 1588 perf_get_data_addr(regs, &data.addr);
1399 1589
1590 if (event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK) {
1591 struct cpu_hw_events *cpuhw;
1592 cpuhw = &__get_cpu_var(cpu_hw_events);
1593 power_pmu_bhrb_read(cpuhw);
1594 data.br_stack = &cpuhw->bhrb_stack;
1595 }
1596
1400 if (perf_event_overflow(event, &data, regs)) 1597 if (perf_event_overflow(event, &data, regs))
1401 power_pmu_stop(event, 0); 1598 power_pmu_stop(event, 0);
1402 } 1599 }
@@ -1422,7 +1619,7 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
1422 */ 1619 */
1423unsigned long perf_instruction_pointer(struct pt_regs *regs) 1620unsigned long perf_instruction_pointer(struct pt_regs *regs)
1424{ 1621{
1425 unsigned long use_siar = regs->result; 1622 bool use_siar = regs_use_siar(regs);
1426 1623
1427 if (use_siar && siar_valid(regs)) 1624 if (use_siar && siar_valid(regs))
1428 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs); 1625 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
diff --git a/arch/powerpc/perf/power5+-pmu.c b/arch/powerpc/perf/power5+-pmu.c
index a8757baa28f3..b03b6dc0172d 100644
--- a/arch/powerpc/perf/power5+-pmu.c
+++ b/arch/powerpc/perf/power5+-pmu.c
@@ -671,7 +671,7 @@ static struct power_pmu power5p_pmu = {
671 .get_alternatives = power5p_get_alternatives, 671 .get_alternatives = power5p_get_alternatives,
672 .disable_pmc = power5p_disable_pmc, 672 .disable_pmc = power5p_disable_pmc,
673 .limited_pmc_event = power5p_limited_pmc_event, 673 .limited_pmc_event = power5p_limited_pmc_event,
674 .flags = PPMU_LIMITED_PMC5_6, 674 .flags = PPMU_LIMITED_PMC5_6 | PPMU_HAS_SSLOT,
675 .n_generic = ARRAY_SIZE(power5p_generic_events), 675 .n_generic = ARRAY_SIZE(power5p_generic_events),
676 .generic_events = power5p_generic_events, 676 .generic_events = power5p_generic_events,
677 .cache_events = &power5p_cache_events, 677 .cache_events = &power5p_cache_events,
diff --git a/arch/powerpc/perf/power5-pmu.c b/arch/powerpc/perf/power5-pmu.c
index e7f06eb7a861..1e8ce423c3af 100644
--- a/arch/powerpc/perf/power5-pmu.c
+++ b/arch/powerpc/perf/power5-pmu.c
@@ -615,6 +615,7 @@ static struct power_pmu power5_pmu = {
615 .n_generic = ARRAY_SIZE(power5_generic_events), 615 .n_generic = ARRAY_SIZE(power5_generic_events),
616 .generic_events = power5_generic_events, 616 .generic_events = power5_generic_events,
617 .cache_events = &power5_cache_events, 617 .cache_events = &power5_cache_events,
618 .flags = PPMU_HAS_SSLOT,
618}; 619};
619 620
620static int __init init_power5_pmu(void) 621static int __init init_power5_pmu(void)
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
new file mode 100644
index 000000000000..f7d1c4fff303
--- /dev/null
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -0,0 +1,592 @@
1/*
2 * Performance counter support for POWER8 processors.
3 *
4 * Copyright 2009 Paul Mackerras, IBM Corporation.
5 * Copyright 2013 Michael Ellerman, IBM Corporation.
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
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/perf_event.h>
15#include <asm/firmware.h>
16
17
18/*
19 * Some power8 event codes.
20 */
21#define PM_CYC 0x0001e
22#define PM_GCT_NOSLOT_CYC 0x100f8
23#define PM_CMPLU_STALL 0x4000a
24#define PM_INST_CMPL 0x00002
25#define PM_BRU_FIN 0x10068
26#define PM_BR_MPRED_CMPL 0x400f6
27
28
29/*
30 * Raw event encoding for POWER8:
31 *
32 * 60 56 52 48 44 40 36 32
33 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
34 * [ thresh_cmp ] [ thresh_ctl ]
35 * |
36 * thresh start/stop OR FAB match -*
37 *
38 * 28 24 20 16 12 8 4 0
39 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
40 * [ ] [ sample ] [cache] [ pmc ] [unit ] c m [ pmcxsel ]
41 * | | | | |
42 * | | | | *- mark
43 * | | *- L1/L2/L3 cache_sel |
44 * | | |
45 * | *- sampling mode for marked events *- combine
46 * |
47 * *- thresh_sel
48 *
49 * Below uses IBM bit numbering.
50 *
51 * MMCR1[x:y] = unit (PMCxUNIT)
52 * MMCR1[x] = combine (PMCxCOMB)
53 *
54 * if pmc == 3 and unit == 0 and pmcxsel[0:6] == 0b0101011
55 * # PM_MRK_FAB_RSP_MATCH
56 * MMCR1[20:27] = thresh_ctl (FAB_CRESP_MATCH / FAB_TYPE_MATCH)
57 * else if pmc == 4 and unit == 0xf and pmcxsel[0:6] == 0b0101001
58 * # PM_MRK_FAB_RSP_MATCH_CYC
59 * MMCR1[20:27] = thresh_ctl (FAB_CRESP_MATCH / FAB_TYPE_MATCH)
60 * else
61 * MMCRA[48:55] = thresh_ctl (THRESH START/END)
62 *
63 * if thresh_sel:
64 * MMCRA[45:47] = thresh_sel
65 *
66 * if thresh_cmp:
67 * MMCRA[22:24] = thresh_cmp[0:2]
68 * MMCRA[25:31] = thresh_cmp[3:9]
69 *
70 * if unit == 6 or unit == 7
71 * MMCRC[53:55] = cache_sel[1:3] (L2EVENT_SEL)
72 * else if unit == 8 or unit == 9:
73 * if cache_sel[0] == 0: # L3 bank
74 * MMCRC[47:49] = cache_sel[1:3] (L3EVENT_SEL0)
75 * else if cache_sel[0] == 1:
76 * MMCRC[50:51] = cache_sel[2:3] (L3EVENT_SEL1)
77 * else if cache_sel[1]: # L1 event
78 * MMCR1[16] = cache_sel[2]
79 * MMCR1[17] = cache_sel[3]
80 *
81 * if mark:
82 * MMCRA[63] = 1 (SAMPLE_ENABLE)
83 * MMCRA[57:59] = sample[0:2] (RAND_SAMP_ELIG)
84 * MMCRA[61:62] = sample[3:4] (RAND_SAMP_MODE)
85 *
86 */
87
88#define EVENT_THR_CMP_SHIFT 40 /* Threshold CMP value */
89#define EVENT_THR_CMP_MASK 0x3ff
90#define EVENT_THR_CTL_SHIFT 32 /* Threshold control value (start/stop) */
91#define EVENT_THR_CTL_MASK 0xffull
92#define EVENT_THR_SEL_SHIFT 29 /* Threshold select value */
93#define EVENT_THR_SEL_MASK 0x7
94#define EVENT_THRESH_SHIFT 29 /* All threshold bits */
95#define EVENT_THRESH_MASK 0x1fffffull
96#define EVENT_SAMPLE_SHIFT 24 /* Sampling mode & eligibility */
97#define EVENT_SAMPLE_MASK 0x1f
98#define EVENT_CACHE_SEL_SHIFT 20 /* L2/L3 cache select */
99#define EVENT_CACHE_SEL_MASK 0xf
100#define EVENT_IS_L1 (4 << EVENT_CACHE_SEL_SHIFT)
101#define EVENT_PMC_SHIFT 16 /* PMC number (1-based) */
102#define EVENT_PMC_MASK 0xf
103#define EVENT_UNIT_SHIFT 12 /* Unit */
104#define EVENT_UNIT_MASK 0xf
105#define EVENT_COMBINE_SHIFT 11 /* Combine bit */
106#define EVENT_COMBINE_MASK 0x1
107#define EVENT_MARKED_SHIFT 8 /* Marked bit */
108#define EVENT_MARKED_MASK 0x1
109#define EVENT_IS_MARKED (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT)
110#define EVENT_PSEL_MASK 0xff /* PMCxSEL value */
111
112/* MMCRA IFM bits - POWER8 */
113#define POWER8_MMCRA_IFM1 0x0000000040000000UL
114#define POWER8_MMCRA_IFM2 0x0000000080000000UL
115#define POWER8_MMCRA_IFM3 0x00000000C0000000UL
116
117#define ONLY_PLM \
118 (PERF_SAMPLE_BRANCH_USER |\
119 PERF_SAMPLE_BRANCH_KERNEL |\
120 PERF_SAMPLE_BRANCH_HV)
121
122/*
123 * Layout of constraint bits:
124 *
125 * 60 56 52 48 44 40 36 32
126 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
127 * [ fab_match ] [ thresh_cmp ] [ thresh_ctl ] [ ]
128 * |
129 * thresh_sel -*
130 *
131 * 28 24 20 16 12 8 4 0
132 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
133 * [ ] [ sample ] [ ] [6] [5] [4] [3] [2] [1]
134 * | |
135 * L1 I/D qualifier -* | Count of events for each PMC.
136 * | p1, p2, p3, p4, p5, p6.
137 * nc - number of counters -*
138 *
139 * The PMC fields P1..P6, and NC, are adder fields. As we accumulate constraints
140 * we want the low bit of each field to be added to any existing value.
141 *
142 * Everything else is a value field.
143 */
144
145#define CNST_FAB_MATCH_VAL(v) (((v) & EVENT_THR_CTL_MASK) << 56)
146#define CNST_FAB_MATCH_MASK CNST_FAB_MATCH_VAL(EVENT_THR_CTL_MASK)
147
148/* We just throw all the threshold bits into the constraint */
149#define CNST_THRESH_VAL(v) (((v) & EVENT_THRESH_MASK) << 32)
150#define CNST_THRESH_MASK CNST_THRESH_VAL(EVENT_THRESH_MASK)
151
152#define CNST_L1_QUAL_VAL(v) (((v) & 3) << 22)
153#define CNST_L1_QUAL_MASK CNST_L1_QUAL_VAL(3)
154
155#define CNST_SAMPLE_VAL(v) (((v) & EVENT_SAMPLE_MASK) << 16)
156#define CNST_SAMPLE_MASK CNST_SAMPLE_VAL(EVENT_SAMPLE_MASK)
157
158/*
159 * For NC we are counting up to 4 events. This requires three bits, and we need
160 * the fifth event to overflow and set the 4th bit. To achieve that we bias the
161 * fields by 3 in test_adder.
162 */
163#define CNST_NC_SHIFT 12
164#define CNST_NC_VAL (1 << CNST_NC_SHIFT)
165#define CNST_NC_MASK (8 << CNST_NC_SHIFT)
166#define POWER8_TEST_ADDER (3 << CNST_NC_SHIFT)
167
168/*
169 * For the per-PMC fields we have two bits. The low bit is added, so if two
170 * events ask for the same PMC the sum will overflow, setting the high bit,
171 * indicating an error. So our mask sets the high bit.
172 */
173#define CNST_PMC_SHIFT(pmc) ((pmc - 1) * 2)
174#define CNST_PMC_VAL(pmc) (1 << CNST_PMC_SHIFT(pmc))
175#define CNST_PMC_MASK(pmc) (2 << CNST_PMC_SHIFT(pmc))
176
177/* Our add_fields is defined as: */
178#define POWER8_ADD_FIELDS \
179 CNST_PMC_VAL(1) | CNST_PMC_VAL(2) | CNST_PMC_VAL(3) | \
180 CNST_PMC_VAL(4) | CNST_PMC_VAL(5) | CNST_PMC_VAL(6) | CNST_NC_VAL
181
182
183/* Bits in MMCR1 for POWER8 */
184#define MMCR1_UNIT_SHIFT(pmc) (60 - (4 * ((pmc) - 1)))
185#define MMCR1_COMBINE_SHIFT(pmc) (35 - ((pmc) - 1))
186#define MMCR1_PMCSEL_SHIFT(pmc) (24 - (((pmc) - 1)) * 8)
187#define MMCR1_DC_QUAL_SHIFT 47
188#define MMCR1_IC_QUAL_SHIFT 46
189
190/* Bits in MMCRA for POWER8 */
191#define MMCRA_SAMP_MODE_SHIFT 1
192#define MMCRA_SAMP_ELIG_SHIFT 4
193#define MMCRA_THR_CTL_SHIFT 8
194#define MMCRA_THR_SEL_SHIFT 16
195#define MMCRA_THR_CMP_SHIFT 32
196#define MMCRA_SDAR_MODE_TLB (1ull << 42)
197
198
199static inline bool event_is_fab_match(u64 event)
200{
201 /* Only check pmc, unit and pmcxsel, ignore the edge bit (0) */
202 event &= 0xff0fe;
203
204 /* PM_MRK_FAB_RSP_MATCH & PM_MRK_FAB_RSP_MATCH_CYC */
205 return (event == 0x30056 || event == 0x4f052);
206}
207
208static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)
209{
210 unsigned int unit, pmc, cache;
211 unsigned long mask, value;
212
213 mask = value = 0;
214
215 pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK;
216 unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK;
217 cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK;
218
219 if (pmc) {
220 if (pmc > 6)
221 return -1;
222
223 mask |= CNST_PMC_MASK(pmc);
224 value |= CNST_PMC_VAL(pmc);
225
226 if (pmc >= 5 && event != 0x500fa && event != 0x600f4)
227 return -1;
228 }
229
230 if (pmc <= 4) {
231 /*
232 * Add to number of counters in use. Note this includes events with
233 * a PMC of 0 - they still need a PMC, it's just assigned later.
234 * Don't count events on PMC 5 & 6, there is only one valid event
235 * on each of those counters, and they are handled above.
236 */
237 mask |= CNST_NC_MASK;
238 value |= CNST_NC_VAL;
239 }
240
241 if (unit >= 6 && unit <= 9) {
242 /*
243 * L2/L3 events contain a cache selector field, which is
244 * supposed to be programmed into MMCRC. However MMCRC is only
245 * HV writable, and there is no API for guest kernels to modify
246 * it. The solution is for the hypervisor to initialise the
247 * field to zeroes, and for us to only ever allow events that
248 * have a cache selector of zero.
249 */
250 if (cache)
251 return -1;
252
253 } else if (event & EVENT_IS_L1) {
254 mask |= CNST_L1_QUAL_MASK;
255 value |= CNST_L1_QUAL_VAL(cache);
256 }
257
258 if (event & EVENT_IS_MARKED) {
259 mask |= CNST_SAMPLE_MASK;
260 value |= CNST_SAMPLE_VAL(event >> EVENT_SAMPLE_SHIFT);
261 }
262
263 /*
264 * Special case for PM_MRK_FAB_RSP_MATCH and PM_MRK_FAB_RSP_MATCH_CYC,
265 * the threshold control bits are used for the match value.
266 */
267 if (event_is_fab_match(event)) {
268 mask |= CNST_FAB_MATCH_MASK;
269 value |= CNST_FAB_MATCH_VAL(event >> EVENT_THR_CTL_SHIFT);
270 } else {
271 /*
272 * Check the mantissa upper two bits are not zero, unless the
273 * exponent is also zero. See the THRESH_CMP_MANTISSA doc.
274 */
275 unsigned int cmp, exp;
276
277 cmp = (event >> EVENT_THR_CMP_SHIFT) & EVENT_THR_CMP_MASK;
278 exp = cmp >> 7;
279
280 if (exp && (cmp & 0x60) == 0)
281 return -1;
282
283 mask |= CNST_THRESH_MASK;
284 value |= CNST_THRESH_VAL(event >> EVENT_THRESH_SHIFT);
285 }
286
287 *maskp = mask;
288 *valp = value;
289
290 return 0;
291}
292
293static int power8_compute_mmcr(u64 event[], int n_ev,
294 unsigned int hwc[], unsigned long mmcr[])
295{
296 unsigned long mmcra, mmcr1, unit, combine, psel, cache, val;
297 unsigned int pmc, pmc_inuse;
298 int i;
299
300 pmc_inuse = 0;
301
302 /* First pass to count resource use */
303 for (i = 0; i < n_ev; ++i) {
304 pmc = (event[i] >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK;
305 if (pmc)
306 pmc_inuse |= 1 << pmc;
307 }
308
309 /* In continous sampling mode, update SDAR on TLB miss */
310 mmcra = MMCRA_SDAR_MODE_TLB;
311 mmcr1 = 0;
312
313 /* Second pass: assign PMCs, set all MMCR1 fields */
314 for (i = 0; i < n_ev; ++i) {
315 pmc = (event[i] >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK;
316 unit = (event[i] >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK;
317 combine = (event[i] >> EVENT_COMBINE_SHIFT) & EVENT_COMBINE_MASK;
318 psel = event[i] & EVENT_PSEL_MASK;
319
320 if (!pmc) {
321 for (pmc = 1; pmc <= 4; ++pmc) {
322 if (!(pmc_inuse & (1 << pmc)))
323 break;
324 }
325
326 pmc_inuse |= 1 << pmc;
327 }
328
329 if (pmc <= 4) {
330 mmcr1 |= unit << MMCR1_UNIT_SHIFT(pmc);
331 mmcr1 |= combine << MMCR1_COMBINE_SHIFT(pmc);
332 mmcr1 |= psel << MMCR1_PMCSEL_SHIFT(pmc);
333 }
334
335 if (event[i] & EVENT_IS_L1) {
336 cache = event[i] >> EVENT_CACHE_SEL_SHIFT;
337 mmcr1 |= (cache & 1) << MMCR1_IC_QUAL_SHIFT;
338 cache >>= 1;
339 mmcr1 |= (cache & 1) << MMCR1_DC_QUAL_SHIFT;
340 }
341
342 if (event[i] & EVENT_IS_MARKED) {
343 mmcra |= MMCRA_SAMPLE_ENABLE;
344
345 val = (event[i] >> EVENT_SAMPLE_SHIFT) & EVENT_SAMPLE_MASK;
346 if (val) {
347 mmcra |= (val & 3) << MMCRA_SAMP_MODE_SHIFT;
348 mmcra |= (val >> 2) << MMCRA_SAMP_ELIG_SHIFT;
349 }
350 }
351
352 /*
353 * PM_MRK_FAB_RSP_MATCH and PM_MRK_FAB_RSP_MATCH_CYC,
354 * the threshold bits are used for the match value.
355 */
356 if (event_is_fab_match(event[i])) {
357 mmcr1 |= (event[i] >> EVENT_THR_CTL_SHIFT) &
358 EVENT_THR_CTL_MASK;
359 } else {
360 val = (event[i] >> EVENT_THR_CTL_SHIFT) & EVENT_THR_CTL_MASK;
361 mmcra |= val << MMCRA_THR_CTL_SHIFT;
362 val = (event[i] >> EVENT_THR_SEL_SHIFT) & EVENT_THR_SEL_MASK;
363 mmcra |= val << MMCRA_THR_SEL_SHIFT;
364 val = (event[i] >> EVENT_THR_CMP_SHIFT) & EVENT_THR_CMP_MASK;
365 mmcra |= val << MMCRA_THR_CMP_SHIFT;
366 }
367
368 hwc[i] = pmc - 1;
369 }
370
371 /* Return MMCRx values */
372 mmcr[0] = 0;
373
374 /* pmc_inuse is 1-based */
375 if (pmc_inuse & 2)
376 mmcr[0] = MMCR0_PMC1CE;
377
378 if (pmc_inuse & 0x7c)
379 mmcr[0] |= MMCR0_PMCjCE;
380
381 mmcr[1] = mmcr1;
382 mmcr[2] = mmcra;
383
384 return 0;
385}
386
387#define MAX_ALT 2
388
389/* Table of alternatives, sorted by column 0 */
390static const unsigned int event_alternatives[][MAX_ALT] = {
391 { 0x10134, 0x301e2 }, /* PM_MRK_ST_CMPL */
392 { 0x10138, 0x40138 }, /* PM_BR_MRK_2PATH */
393 { 0x18082, 0x3e05e }, /* PM_L3_CO_MEPF */
394 { 0x1d14e, 0x401e8 }, /* PM_MRK_DATA_FROM_L2MISS */
395 { 0x1e054, 0x4000a }, /* PM_CMPLU_STALL */
396 { 0x20036, 0x40036 }, /* PM_BR_2PATH */
397 { 0x200f2, 0x300f2 }, /* PM_INST_DISP */
398 { 0x200f4, 0x600f4 }, /* PM_RUN_CYC */
399 { 0x2013c, 0x3012e }, /* PM_MRK_FILT_MATCH */
400 { 0x3e054, 0x400f0 }, /* PM_LD_MISS_L1 */
401 { 0x400fa, 0x500fa }, /* PM_RUN_INST_CMPL */
402};
403
404/*
405 * Scan the alternatives table for a match and return the
406 * index into the alternatives table if found, else -1.
407 */
408static int find_alternative(u64 event)
409{
410 int i, j;
411
412 for (i = 0; i < ARRAY_SIZE(event_alternatives); ++i) {
413 if (event < event_alternatives[i][0])
414 break;
415
416 for (j = 0; j < MAX_ALT && event_alternatives[i][j]; ++j)
417 if (event == event_alternatives[i][j])
418 return i;
419 }
420
421 return -1;
422}
423
424static int power8_get_alternatives(u64 event, unsigned int flags, u64 alt[])
425{
426 int i, j, num_alt = 0;
427 u64 alt_event;
428
429 alt[num_alt++] = event;
430
431 i = find_alternative(event);
432 if (i >= 0) {
433 /* Filter out the original event, it's already in alt[0] */
434 for (j = 0; j < MAX_ALT; ++j) {
435 alt_event = event_alternatives[i][j];
436 if (alt_event && alt_event != event)
437 alt[num_alt++] = alt_event;
438 }
439 }
440
441 if (flags & PPMU_ONLY_COUNT_RUN) {
442 /*
443 * We're only counting in RUN state, so PM_CYC is equivalent to
444 * PM_RUN_CYC and PM_INST_CMPL === PM_RUN_INST_CMPL.
445 */
446 j = num_alt;
447 for (i = 0; i < num_alt; ++i) {
448 switch (alt[i]) {
449 case 0x1e: /* PM_CYC */
450 alt[j++] = 0x600f4; /* PM_RUN_CYC */
451 break;
452 case 0x600f4: /* PM_RUN_CYC */
453 alt[j++] = 0x1e;
454 break;
455 case 0x2: /* PM_PPC_CMPL */
456 alt[j++] = 0x500fa; /* PM_RUN_INST_CMPL */
457 break;
458 case 0x500fa: /* PM_RUN_INST_CMPL */
459 alt[j++] = 0x2; /* PM_PPC_CMPL */
460 break;
461 }
462 }
463 num_alt = j;
464 }
465
466 return num_alt;
467}
468
469static void power8_disable_pmc(unsigned int pmc, unsigned long mmcr[])
470{
471 if (pmc <= 3)
472 mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SHIFT(pmc + 1));
473}
474
475PMU_FORMAT_ATTR(event, "config:0-49");
476PMU_FORMAT_ATTR(pmcxsel, "config:0-7");
477PMU_FORMAT_ATTR(mark, "config:8");
478PMU_FORMAT_ATTR(combine, "config:11");
479PMU_FORMAT_ATTR(unit, "config:12-15");
480PMU_FORMAT_ATTR(pmc, "config:16-19");
481PMU_FORMAT_ATTR(cache_sel, "config:20-23");
482PMU_FORMAT_ATTR(sample_mode, "config:24-28");
483PMU_FORMAT_ATTR(thresh_sel, "config:29-31");
484PMU_FORMAT_ATTR(thresh_stop, "config:32-35");
485PMU_FORMAT_ATTR(thresh_start, "config:36-39");
486PMU_FORMAT_ATTR(thresh_cmp, "config:40-49");
487
488static struct attribute *power8_pmu_format_attr[] = {
489 &format_attr_event.attr,
490 &format_attr_pmcxsel.attr,
491 &format_attr_mark.attr,
492 &format_attr_combine.attr,
493 &format_attr_unit.attr,
494 &format_attr_pmc.attr,
495 &format_attr_cache_sel.attr,
496 &format_attr_sample_mode.attr,
497 &format_attr_thresh_sel.attr,
498 &format_attr_thresh_stop.attr,
499 &format_attr_thresh_start.attr,
500 &format_attr_thresh_cmp.attr,
501 NULL,
502};
503
504struct attribute_group power8_pmu_format_group = {
505 .name = "format",
506 .attrs = power8_pmu_format_attr,
507};
508
509static const struct attribute_group *power8_pmu_attr_groups[] = {
510 &power8_pmu_format_group,
511 NULL,
512};
513
514static int power8_generic_events[] = {
515 [PERF_COUNT_HW_CPU_CYCLES] = PM_CYC,
516 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = PM_GCT_NOSLOT_CYC,
517 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = PM_CMPLU_STALL,
518 [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL,
519 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BRU_FIN,
520 [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL,
521};
522
523static u64 power8_bhrb_filter_map(u64 branch_sample_type)
524{
525 u64 pmu_bhrb_filter = 0;
526 u64 br_privilege = branch_sample_type & ONLY_PLM;
527
528 /* BHRB and regular PMU events share the same prvillege state
529 * filter configuration. BHRB is always recorded along with a
530 * regular PMU event. So privilege state filter criteria for BHRB
531 * and the companion PMU events has to be the same. As a default
532 * "perf record" tool sets all privillege bits ON when no filter
533 * criteria is provided in the command line. So as along as all
534 * privillege bits are ON or they are OFF, we are good to go.
535 */
536 if ((br_privilege != 7) && (br_privilege != 0))
537 return -1;
538
539 /* No branch filter requested */
540 if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY)
541 return pmu_bhrb_filter;
542
543 /* Invalid branch filter options - HW does not support */
544 if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_RETURN)
545 return -1;
546
547 if (branch_sample_type & PERF_SAMPLE_BRANCH_IND_CALL)
548 return -1;
549
550 if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_CALL) {
551 pmu_bhrb_filter |= POWER8_MMCRA_IFM1;
552 return pmu_bhrb_filter;
553 }
554
555 /* Every thing else is unsupported */
556 return -1;
557}
558
559static void power8_config_bhrb(u64 pmu_bhrb_filter)
560{
561 /* Enable BHRB filter in PMU */
562 mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter));
563}
564
565static struct power_pmu power8_pmu = {
566 .name = "POWER8",
567 .n_counter = 6,
568 .max_alternatives = MAX_ALT + 1,
569 .add_fields = POWER8_ADD_FIELDS,
570 .test_adder = POWER8_TEST_ADDER,
571 .compute_mmcr = power8_compute_mmcr,
572 .config_bhrb = power8_config_bhrb,
573 .bhrb_filter_map = power8_bhrb_filter_map,
574 .get_constraint = power8_get_constraint,
575 .get_alternatives = power8_get_alternatives,
576 .disable_pmc = power8_disable_pmc,
577 .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB,
578 .n_generic = ARRAY_SIZE(power8_generic_events),
579 .generic_events = power8_generic_events,
580 .attr_groups = power8_pmu_attr_groups,
581 .bhrb_nr = 32,
582};
583
584static int __init init_power8_pmu(void)
585{
586 if (!cur_cpu_spec->oprofile_cpu_type ||
587 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power8"))
588 return -ENODEV;
589
590 return register_power_pmu(&power8_pmu);
591}
592early_initcall(init_power8_pmu);
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index a392d12dd21f..bd40bbb15e14 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -20,7 +20,6 @@ config HOTFOOT
20 bool "Hotfoot" 20 bool "Hotfoot"
21 depends on 40x 21 depends on 40x
22 default n 22 default n
23 select 405EP
24 select PPC40x_SIMPLE 23 select PPC40x_SIMPLE
25 select PCI 24 select PCI
26 help 25 help
@@ -105,9 +104,6 @@ config 405GP
105 select IBM405_ERR51 104 select IBM405_ERR51
106 select IBM_EMAC_ZMII 105 select IBM_EMAC_ZMII
107 106
108config 405EP
109 bool
110
111config 405EX 107config 405EX
112 bool 108 bool
113 select IBM_EMAC_EMAC4 109 select IBM_EMAC_EMAC4
@@ -119,9 +115,6 @@ config 405EZ
119 select IBM_EMAC_MAL_CLR_ICINTSTAT 115 select IBM_EMAC_MAL_CLR_ICINTSTAT
120 select IBM_EMAC_MAL_COMMON_ERR 116 select IBM_EMAC_MAL_COMMON_ERR
121 117
122config 405GPR
123 bool
124
125config XILINX_VIRTEX 118config XILINX_VIRTEX
126 bool 119 bool
127 select DEFAULT_UIMAGE 120 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 0effe9f5a1ea..7be93367d92f 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -274,6 +274,8 @@ config 440EPX
274 select IBM_EMAC_EMAC4 274 select IBM_EMAC_EMAC4
275 select IBM_EMAC_RGMII 275 select IBM_EMAC_RGMII
276 select IBM_EMAC_ZMII 276 select IBM_EMAC_ZMII
277 select USB_EHCI_BIG_ENDIAN_MMIO
278 select USB_EHCI_BIG_ENDIAN_DESC
277 279
278config 440GRX 280config 440GRX
279 bool 281 bool
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index c16999802ecf..fc9c1cbfcb1d 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -7,6 +7,8 @@ config PPC_MPC512x
7 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
8 select FSL_PCI if PCI 8 select FSL_PCI if PCI
9 select ARCH_WANT_OPTIONAL_GPIOLIB 9 select ARCH_WANT_OPTIONAL_GPIOLIB
10 select USB_EHCI_BIG_ENDIAN_MMIO
11 select USB_EHCI_BIG_ENDIAN_DESC
10 12
11config MPC5121_ADS 13config MPC5121_ADS
12 bool "Freescale MPC5121E ADS" 14 bool "Freescale MPC5121E ADS"
@@ -15,16 +17,16 @@ config MPC5121_ADS
15 help 17 help
16 This option enables support for the MPC5121E ADS board. 18 This option enables support for the MPC5121E ADS board.
17 19
18config MPC5121_GENERIC 20config MPC512x_GENERIC
19 bool "Generic support for simple MPC5121 based boards" 21 bool "Generic support for simple MPC512x based boards"
20 depends on PPC_MPC512x 22 depends on PPC_MPC512x
21 select DEFAULT_UIMAGE 23 select DEFAULT_UIMAGE
22 help 24 help
23 This option enables support for simple MPC5121 based boards 25 This option enables support for simple MPC512x based boards
24 which do not need custom platform specific setup. 26 which do not need custom platform specific setup.
25 27
26 Compatible boards include: Protonic LVT base boards (ZANMCU 28 Compatible boards include: Protonic LVT base boards (ZANMCU
27 and VICVT2). 29 and VICVT2), Freescale MPC5125 Tower system.
28 30
29config PDM360NG 31config PDM360NG
30 bool "ifm PDM360NG board" 32 bool "ifm PDM360NG board"
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile
index 4efc1c4b6fb5..72fb9340e09f 100644
--- a/arch/powerpc/platforms/512x/Makefile
+++ b/arch/powerpc/platforms/512x/Makefile
@@ -3,5 +3,5 @@
3# 3#
4obj-y += clock.o mpc512x_shared.o 4obj-y += clock.o mpc512x_shared.o
5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o 5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o
6obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o 6obj-$(CONFIG_MPC512x_GENERIC) += mpc512x_generic.o
7obj-$(CONFIG_PDM360NG) += pdm360ng.o 7obj-$(CONFIG_PDM360NG) += pdm360ng.o
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 52d57d281724..e504166e089a 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -29,6 +29,8 @@
29#include <asm/mpc5121.h> 29#include <asm/mpc5121.h>
30#include <asm/clk_interface.h> 30#include <asm/clk_interface.h>
31 31
32#include "mpc512x.h"
33
32#undef CLK_DEBUG 34#undef CLK_DEBUG
33 35
34static int clocks_initialized; 36static int clocks_initialized;
@@ -683,8 +685,13 @@ static void psc_clks_init(void)
683 struct device_node *np; 685 struct device_node *np;
684 struct platform_device *ofdev; 686 struct platform_device *ofdev;
685 u32 reg; 687 u32 reg;
688 const char *psc_compat;
689
690 psc_compat = mpc512x_select_psc_compat();
691 if (!psc_compat)
692 return;
686 693
687 for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") { 694 for_each_compatible_node(np, NULL, psc_compat) {
688 if (!of_property_read_u32(np, "reg", &reg)) { 695 if (!of_property_read_u32(np, "reg", &reg)) {
689 int pscnum = (reg & 0xf00) >> 8; 696 int pscnum = (reg & 0xf00) >> 8;
690 struct clk *clk = psc_dev_clk(pscnum); 697 struct clk *clk = psc_dev_clk(pscnum);
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index c32b399eb952..0a8e60023944 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -15,6 +15,7 @@ extern void __init mpc512x_init_IRQ(void);
15extern void __init mpc512x_init(void); 15extern void __init mpc512x_init(void);
16extern int __init mpc5121_clk_init(void); 16extern int __init mpc5121_clk_init(void);
17void __init mpc512x_declare_of_platform_devices(void); 17void __init mpc512x_declare_of_platform_devices(void);
18extern const char *mpc512x_select_psc_compat(void);
18extern void mpc512x_restart(char *cmd); 19extern void mpc512x_restart(char *cmd);
19 20
20#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 21#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc512x_generic.c
index ca1ca6669990..5fb919b30924 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc512x_generic.c
@@ -4,7 +4,7 @@
4 * Author: John Rigby, <jrigby@freescale.com> 4 * Author: John Rigby, <jrigby@freescale.com>
5 * 5 *
6 * Description: 6 * Description:
7 * MPC5121 SoC setup 7 * MPC512x SoC setup
8 * 8 *
9 * This is free software; you can redistribute it and/or modify it 9 * This is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by 10 * under the terms of the GNU General Public License as published by
@@ -28,20 +28,22 @@
28 */ 28 */
29static const char * const board[] __initconst = { 29static const char * const board[] __initconst = {
30 "prt,prtlvt", 30 "prt,prtlvt",
31 "fsl,mpc5125ads",
32 "ifm,ac14xx",
31 NULL 33 NULL
32}; 34};
33 35
34/* 36/*
35 * Called very early, MMU is off, device-tree isn't unflattened 37 * Called very early, MMU is off, device-tree isn't unflattened
36 */ 38 */
37static int __init mpc5121_generic_probe(void) 39static int __init mpc512x_generic_probe(void)
38{ 40{
39 return of_flat_dt_match(of_get_flat_dt_root(), board); 41 return of_flat_dt_match(of_get_flat_dt_root(), board);
40} 42}
41 43
42define_machine(mpc5121_generic) { 44define_machine(mpc512x_generic) {
43 .name = "MPC5121 generic", 45 .name = "MPC512x generic",
44 .probe = mpc5121_generic_probe, 46 .probe = mpc512x_generic_probe,
45 .init = mpc512x_init, 47 .init = mpc512x_init,
46 .init_early = mpc512x_init_diu, 48 .init_early = mpc512x_init_diu,
47 .setup_arch = mpc512x_setup_diu, 49 .setup_arch = mpc512x_setup_diu,
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index d30235b7e3f7..6eb94ab99d39 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -172,12 +172,9 @@ static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb;
172 172
173static inline void mpc512x_free_bootmem(struct page *page) 173static inline void mpc512x_free_bootmem(struct page *page)
174{ 174{
175 __ClearPageReserved(page);
176 BUG_ON(PageTail(page)); 175 BUG_ON(PageTail(page));
177 BUG_ON(atomic_read(&page->_count) > 1); 176 BUG_ON(atomic_read(&page->_count) > 1);
178 atomic_set(&page->_count, 1); 177 free_reserved_page(page);
179 __free_page(page);
180 totalram_pages++;
181} 178}
182 179
183void mpc512x_release_bootmem(void) 180void mpc512x_release_bootmem(void)
@@ -330,26 +327,34 @@ void __init mpc512x_init_IRQ(void)
330static struct of_device_id __initdata of_bus_ids[] = { 327static struct of_device_id __initdata of_bus_ids[] = {
331 { .compatible = "fsl,mpc5121-immr", }, 328 { .compatible = "fsl,mpc5121-immr", },
332 { .compatible = "fsl,mpc5121-localbus", }, 329 { .compatible = "fsl,mpc5121-localbus", },
330 { .compatible = "fsl,mpc5121-mbx", },
331 { .compatible = "fsl,mpc5121-nfc", },
332 { .compatible = "fsl,mpc5121-sram", },
333 { .compatible = "fsl,mpc5121-pci", },
334 { .compatible = "gpio-leds", },
333 {}, 335 {},
334}; 336};
335 337
336void __init mpc512x_declare_of_platform_devices(void) 338void __init mpc512x_declare_of_platform_devices(void)
337{ 339{
338 struct device_node *np;
339
340 if (of_platform_bus_probe(NULL, of_bus_ids, NULL)) 340 if (of_platform_bus_probe(NULL, of_bus_ids, NULL))
341 printk(KERN_ERR __FILE__ ": " 341 printk(KERN_ERR __FILE__ ": "
342 "Error while probing of_platform bus\n"); 342 "Error while probing of_platform bus\n");
343
344 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-nfc");
345 if (np) {
346 of_platform_device_create(np, NULL, NULL);
347 of_node_put(np);
348 }
349} 343}
350 344
351#define DEFAULT_FIFO_SIZE 16 345#define DEFAULT_FIFO_SIZE 16
352 346
347const char *mpc512x_select_psc_compat(void)
348{
349 if (of_machine_is_compatible("fsl,mpc5121"))
350 return "fsl,mpc5121-psc";
351
352 if (of_machine_is_compatible("fsl,mpc5125"))
353 return "fsl,mpc5125-psc";
354
355 return NULL;
356}
357
353static unsigned int __init get_fifo_size(struct device_node *np, 358static unsigned int __init get_fifo_size(struct device_node *np,
354 char *prop_name) 359 char *prop_name)
355{ 360{
@@ -375,9 +380,16 @@ void __init mpc512x_psc_fifo_init(void)
375 void __iomem *psc; 380 void __iomem *psc;
376 unsigned int tx_fifo_size; 381 unsigned int tx_fifo_size;
377 unsigned int rx_fifo_size; 382 unsigned int rx_fifo_size;
383 const char *psc_compat;
378 int fifobase = 0; /* current fifo address in 32 bit words */ 384 int fifobase = 0; /* current fifo address in 32 bit words */
379 385
380 for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") { 386 psc_compat = mpc512x_select_psc_compat();
387 if (!psc_compat) {
388 pr_err("%s: no compatible devices found\n", __func__);
389 return;
390 }
391
392 for_each_compatible_node(np, NULL, psc_compat) {
381 tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size"); 393 tx_fifo_size = get_fifo_size(np, "fsl,tx-fifo-size");
382 rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size"); 394 rx_fifo_size = get_fifo_size(np, "fsl,rx-fifo-size");
383 395
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index a0dcd577fb0d..8f02b05f4c96 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -305,6 +305,40 @@ config PPC_QEMU_E500
305 unset based on the emulated CPU (or actual host CPU in the case 305 unset based on the emulated CPU (or actual host CPU in the case
306 of KVM). 306 of KVM).
307 307
308if PPC64
309
310config T4240_QDS
311 bool "Freescale T4240 QDS"
312 select DEFAULT_UIMAGE
313 select E500
314 select PPC_E500MC
315 select PHYS_64BIT
316 select SWIOTLB
317 select ARCH_REQUIRE_GPIOLIB
318 select GPIO_MPC8XXX
319 select HAS_RAPIDIO
320 select PPC_EPAPR_HV_PIC
321 help
322 This option enables support for the T4240 QDS board
323
324config B4_QDS
325 bool "Freescale B4 QDS"
326 select DEFAULT_UIMAGE
327 select E500
328 select PPC_E500MC
329 select PHYS_64BIT
330 select SWIOTLB
331 select GENERIC_GPIO
332 select ARCH_REQUIRE_GPIOLIB
333 select HAS_RAPIDIO
334 select PPC_EPAPR_HV_PIC
335 help
336 This option enables support for the B4 QDS board
337 The B4 application development system B4 QDS is a complete
338 debugging environment intended for engineers developing
339 applications for the B4.
340
341endif
308endif # FSL_SOC_BOOKE 342endif # FSL_SOC_BOOKE
309 343
310config TQM85xx 344config TQM85xx
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 07d0dbb141c0..2eab37ea4a9d 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
22obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 22obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
23obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o 23obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o
24obj-$(CONFIG_P5040_DS) += p5040_ds.o corenet_ds.o 24obj-$(CONFIG_P5040_DS) += p5040_ds.o corenet_ds.o
25obj-$(CONFIG_T4240_QDS) += t4240_qds.o corenet_ds.o
26obj-$(CONFIG_B4_QDS) += b4_qds.o corenet_ds.o
25obj-$(CONFIG_STX_GP3) += stx_gp3.o 27obj-$(CONFIG_STX_GP3) += stx_gp3.o
26obj-$(CONFIG_TQM85xx) += tqm85xx.o 28obj-$(CONFIG_TQM85xx) += tqm85xx.o
27obj-$(CONFIG_SBC8548) += sbc8548.o 29obj-$(CONFIG_SBC8548) += sbc8548.o
diff --git a/arch/powerpc/platforms/85xx/b4_qds.c b/arch/powerpc/platforms/85xx/b4_qds.c
new file mode 100644
index 000000000000..0c6702f8b88e
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/b4_qds.c
@@ -0,0 +1,102 @@
1/*
2 * B4 QDS Setup
3 * Should apply for QDS platform of B4860 and it's personalities.
4 * viz B4860/B4420/B4220QDS
5 *
6 * Copyright 2012 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/phy.h>
20
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
33
34#include "corenet_ds.h"
35
36/*
37 * Called very early, device-tree isn't unflattened
38 */
39static int __init b4_qds_probe(void)
40{
41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45
46 if ((of_flat_dt_is_compatible(root, "fsl,B4860QDS")) ||
47 (of_flat_dt_is_compatible(root, "fsl,B4420QDS")) ||
48 (of_flat_dt_is_compatible(root, "fsl,B4220QDS")))
49 return 1;
50
51 /* Check if we're running under the Freescale hypervisor */
52 if ((of_flat_dt_is_compatible(root, "fsl,B4860QDS-hv")) ||
53 (of_flat_dt_is_compatible(root, "fsl,B4420QDS-hv")) ||
54 (of_flat_dt_is_compatible(root, "fsl,B4220QDS-hv"))) {
55 ppc_md.init_IRQ = ehv_pic_init;
56 ppc_md.get_irq = ehv_pic_get_irq;
57 ppc_md.restart = fsl_hv_restart;
58 ppc_md.power_off = fsl_hv_halt;
59 ppc_md.halt = fsl_hv_halt;
60#ifdef CONFIG_SMP
61 /*
62 * Disable the timebase sync operations because we can't write
63 * to the timebase registers under the hypervisor.
64 */
65 smp_85xx_ops.give_timebase = NULL;
66 smp_85xx_ops.take_timebase = NULL;
67#endif
68 return 1;
69 }
70
71 return 0;
72}
73
74define_machine(b4_qds) {
75 .name = "B4 QDS",
76 .probe = b4_qds_probe,
77 .setup_arch = corenet_ds_setup_arch,
78 .init_IRQ = corenet_ds_pic_init,
79#ifdef CONFIG_PCI
80 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
81#endif
82/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
83#ifdef CONFIG_PPC64
84 .get_irq = mpic_get_irq,
85#else
86 .get_irq = mpic_get_coreint_irq,
87#endif
88 .restart = fsl_rstcr_restart,
89 .calibrate_decr = generic_calibrate_decr,
90 .progress = udbg_progress,
91#ifdef CONFIG_PPC64
92 .power_save = book3e_idle,
93#else
94 .power_save = e500_idle,
95#endif
96};
97
98machine_arch_initcall(b4_qds, corenet_ds_publish_devices);
99
100#ifdef CONFIG_SWIOTLB
101machine_arch_initcall(b4_qds, swiotlb_setup_bus_notifier);
102#endif
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index 6f355d8c92f6..c59c617eee93 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -40,7 +40,7 @@ void __init corenet_ds_pic_init(void)
40 if (ppc_md.get_irq == mpic_get_coreint_irq) 40 if (ppc_md.get_irq == mpic_get_coreint_irq)
41 flags |= MPIC_ENABLE_COREINT; 41 flags |= MPIC_ENABLE_COREINT;
42 42
43 mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC "); 43 mpic = mpic_alloc(NULL, 0, flags, 0, 512, " OpenPIC ");
44 BUG_ON(mpic == NULL); 44 BUG_ON(mpic == NULL);
45 45
46 mpic_init(mpic); 46 mpic_init(mpic);
@@ -83,6 +83,9 @@ static const struct of_device_id of_device_ids[] = {
83 { 83 {
84 .compatible = "fsl,qoriq-pcie-v2.4", 84 .compatible = "fsl,qoriq-pcie-v2.4",
85 }, 85 },
86 {
87 .compatible = "fsl,qoriq-pcie-v3.0",
88 },
86 /* The following two are for the Freescale hypervisor */ 89 /* The following two are for the Freescale hypervisor */
87 { 90 {
88 .name = "hypervisor", 91 .name = "hypervisor",
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 148c2f2d9780..6a1759939c6b 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -201,7 +201,7 @@ static int __cpuinit smp_85xx_kick_cpu(int nr)
201 * We don't set the BPTR register here since it already points 201 * We don't set the BPTR register here since it already points
202 * to the boot page properly. 202 * to the boot page properly.
203 */ 203 */
204 mpic_reset_core(hw_cpu); 204 mpic_reset_core(nr);
205 205
206 /* 206 /*
207 * wait until core is ready... 207 * wait until core is ready...
diff --git a/arch/powerpc/platforms/85xx/t4240_qds.c b/arch/powerpc/platforms/85xx/t4240_qds.c
new file mode 100644
index 000000000000..5998e9f33304
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/t4240_qds.c
@@ -0,0 +1,98 @@
1/*
2 * T4240 QDS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2012 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/phy.h>
20
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
33
34#include "corenet_ds.h"
35
36/*
37 * Called very early, device-tree isn't unflattened
38 */
39static int __init t4240_qds_probe(void)
40{
41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45
46 if (of_flat_dt_is_compatible(root, "fsl,T4240QDS"))
47 return 1;
48
49 /* Check if we're running under the Freescale hypervisor */
50 if (of_flat_dt_is_compatible(root, "fsl,T4240QDS-hv")) {
51 ppc_md.init_IRQ = ehv_pic_init;
52 ppc_md.get_irq = ehv_pic_get_irq;
53 ppc_md.restart = fsl_hv_restart;
54 ppc_md.power_off = fsl_hv_halt;
55 ppc_md.halt = fsl_hv_halt;
56#ifdef CONFIG_SMP
57 /*
58 * Disable the timebase sync operations because we can't write
59 * to the timebase registers under the hypervisor.
60 */
61 smp_85xx_ops.give_timebase = NULL;
62 smp_85xx_ops.take_timebase = NULL;
63#endif
64 return 1;
65 }
66
67 return 0;
68}
69
70define_machine(t4240_qds) {
71 .name = "T4240 QDS",
72 .probe = t4240_qds_probe,
73 .setup_arch = corenet_ds_setup_arch,
74 .init_IRQ = corenet_ds_pic_init,
75#ifdef CONFIG_PCI
76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
77#endif
78/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
79#ifdef CONFIG_PPC64
80 .get_irq = mpic_get_irq,
81#else
82 .get_irq = mpic_get_coreint_irq,
83#endif
84 .restart = fsl_rstcr_restart,
85 .calibrate_decr = generic_calibrate_decr,
86 .progress = udbg_progress,
87#ifdef CONFIG_PPC64
88 .power_save = book3e_idle,
89#else
90 .power_save = e500_idle,
91#endif
92};
93
94machine_arch_initcall(t4240_qds, corenet_ds_publish_devices);
95
96#ifdef CONFIG_SWIOTLB
97machine_arch_initcall(t4240_qds, swiotlb_setup_bus_notifier);
98#endif
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 52de8bccfb30..34d224be93ba 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -6,7 +6,6 @@ source "arch/powerpc/platforms/chrp/Kconfig"
6source "arch/powerpc/platforms/512x/Kconfig" 6source "arch/powerpc/platforms/512x/Kconfig"
7source "arch/powerpc/platforms/52xx/Kconfig" 7source "arch/powerpc/platforms/52xx/Kconfig"
8source "arch/powerpc/platforms/powermac/Kconfig" 8source "arch/powerpc/platforms/powermac/Kconfig"
9source "arch/powerpc/platforms/prep/Kconfig"
10source "arch/powerpc/platforms/maple/Kconfig" 9source "arch/powerpc/platforms/maple/Kconfig"
11source "arch/powerpc/platforms/pasemi/Kconfig" 10source "arch/powerpc/platforms/pasemi/Kconfig"
12source "arch/powerpc/platforms/ps3/Kconfig" 11source "arch/powerpc/platforms/ps3/Kconfig"
@@ -233,7 +232,7 @@ endmenu
233 232
234config PPC601_SYNC_FIX 233config PPC601_SYNC_FIX
235 bool "Workarounds for PPC601 bugs" 234 bool "Workarounds for PPC601 bugs"
236 depends on 6xx && (PPC_PREP || PPC_PMAC) 235 depends on 6xx && PPC_PMAC
237 help 236 help
238 Some versions of the PPC601 (the first PowerPC chip) have bugs which 237 Some versions of the PPC601 (the first PowerPC chip) have bugs which
239 mean that extra synchronization instructions are required near 238 mean that extra synchronization instructions are required near
@@ -344,7 +343,6 @@ config FSL_ULI1575
344 343
345config CPM 344config CPM
346 bool 345 bool
347 select PPC_CLOCK
348 346
349config OF_RTC 347config OF_RTC
350 bool 348 bool
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 18e3b76c78d7..54f3936001aa 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -230,7 +230,7 @@ config PHYS_64BIT
230 230
231config ALTIVEC 231config ALTIVEC
232 bool "AltiVec Support" 232 bool "AltiVec Support"
233 depends on 6xx || POWER4 233 depends on 6xx || POWER4 || (PPC_E500MC && PPC64)
234 ---help--- 234 ---help---
235 This option enables kernel support for the Altivec extensions to the 235 This option enables kernel support for the Altivec extensions to the
236 PowerPC processor. The kernel currently supports saving and restoring 236 PowerPC processor. The kernel currently supports saving and restoring
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 53aaefeb3386..9978f594cac0 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -113,34 +113,10 @@ config CBE_THERM
113 default m 113 default m
114 depends on CBE_RAS && SPU_BASE 114 depends on CBE_RAS && SPU_BASE
115 115
116config CBE_CPUFREQ
117 tristate "CBE frequency scaling"
118 depends on CBE_RAS && CPU_FREQ
119 default m
120 help
121 This adds the cpufreq driver for Cell BE processors.
122 For details, take a look at <file:Documentation/cpu-freq/>.
123 If you don't have such processor, say N
124
125config CBE_CPUFREQ_PMI_ENABLE
126 bool "CBE frequency scaling using PMI interface"
127 depends on CBE_CPUFREQ
128 default n
129 help
130 Select this, if you want to use the PMI interface
131 to switch frequencies. Using PMI, the
132 processor will not only be able to run at lower speed,
133 but also at lower core voltage.
134
135config CBE_CPUFREQ_PMI
136 tristate
137 depends on CBE_CPUFREQ_PMI_ENABLE
138 default CBE_CPUFREQ
139
140config PPC_PMI 116config PPC_PMI
141 tristate 117 tristate
142 default y 118 default y
143 depends on CBE_CPUFREQ_PMI || PPC_IBM_CELL_POWERBUTTON 119 depends on CPU_FREQ_CBE_PMI || PPC_IBM_CELL_POWERBUTTON
144 help 120 help
145 PMI (Platform Management Interrupt) is a way to 121 PMI (Platform Management Interrupt) is a way to
146 communicate with the BMC (Baseboard Management Controller). 122 communicate with the BMC (Baseboard Management Controller).
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index a4a89350bcfc..fe053e7c73ee 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -5,9 +5,6 @@ obj-$(CONFIG_PPC_CELL_NATIVE) += iommu.o setup.o spider-pic.o \
5obj-$(CONFIG_CBE_RAS) += ras.o 5obj-$(CONFIG_CBE_RAS) += ras.o
6 6
7obj-$(CONFIG_CBE_THERM) += cbe_thermal.o 7obj-$(CONFIG_CBE_THERM) += cbe_thermal.o
8obj-$(CONFIG_CBE_CPUFREQ_PMI) += cbe_cpufreq_pmi.o
9obj-$(CONFIG_CBE_CPUFREQ) += cbe-cpufreq.o
10cbe-cpufreq-y += cbe_cpufreq_pervasive.o cbe_cpufreq.o
11obj-$(CONFIG_CBE_CPUFREQ_SPU_GOVERNOR) += cpufreq_spudemand.o 8obj-$(CONFIG_CBE_CPUFREQ_SPU_GOVERNOR) += cpufreq_spudemand.o
12 9
13obj-$(CONFIG_PPC_IBM_CELL_POWERBUTTON) += cbe_powerbutton.o 10obj-$(CONFIG_PPC_IBM_CELL_POWERBUTTON) += cbe_powerbutton.o
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c
index 0f6f83988b3d..246e1d8b3af3 100644
--- a/arch/powerpc/platforms/cell/beat_htab.c
+++ b/arch/powerpc/platforms/cell/beat_htab.c
@@ -90,7 +90,7 @@ static inline unsigned int beat_read_mask(unsigned hpte_group)
90static long beat_lpar_hpte_insert(unsigned long hpte_group, 90static long beat_lpar_hpte_insert(unsigned long hpte_group,
91 unsigned long vpn, unsigned long pa, 91 unsigned long vpn, unsigned long pa,
92 unsigned long rflags, unsigned long vflags, 92 unsigned long rflags, unsigned long vflags,
93 int psize, int ssize) 93 int psize, int apsize, int ssize)
94{ 94{
95 unsigned long lpar_rc; 95 unsigned long lpar_rc;
96 u64 hpte_v, hpte_r, slot; 96 u64 hpte_v, hpte_r, slot;
@@ -103,9 +103,9 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
103 "rflags=%lx, vflags=%lx, psize=%d)\n", 103 "rflags=%lx, vflags=%lx, psize=%d)\n",
104 hpte_group, va, pa, rflags, vflags, psize); 104 hpte_group, va, pa, rflags, vflags, psize);
105 105
106 hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) | 106 hpte_v = hpte_encode_v(vpn, psize, apsize, MMU_SEGSIZE_256M) |
107 vflags | HPTE_V_VALID; 107 vflags | HPTE_V_VALID;
108 hpte_r = hpte_encode_r(pa, psize) | rflags; 108 hpte_r = hpte_encode_r(pa, psize, apsize) | rflags;
109 109
110 if (!(vflags & HPTE_V_BOLTED)) 110 if (!(vflags & HPTE_V_BOLTED))
111 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); 111 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
@@ -191,7 +191,7 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
191 u64 dummy0, dummy1; 191 u64 dummy0, dummy1;
192 unsigned long want_v; 192 unsigned long want_v;
193 193
194 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 194 want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
195 195
196 DBG_LOW(" update: " 196 DBG_LOW(" update: "
197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", 197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
@@ -228,7 +228,7 @@ static long beat_lpar_hpte_find(unsigned long vpn, int psize)
228 unsigned long want_v, hpte_v; 228 unsigned long want_v, hpte_v;
229 229
230 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M); 230 hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M);
231 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 231 want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
232 232
233 for (j = 0; j < 2; j++) { 233 for (j = 0; j < 2; j++) {
234 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 234 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
@@ -283,7 +283,7 @@ static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,
283 283
284 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 284 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n",
285 slot, va, psize, local); 285 slot, va, psize, local);
286 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 286 want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
287 287
288 raw_spin_lock_irqsave(&beat_htab_lock, flags); 288 raw_spin_lock_irqsave(&beat_htab_lock, flags);
289 dummy1 = beat_lpar_hpte_getword0(slot); 289 dummy1 = beat_lpar_hpte_getword0(slot);
@@ -314,7 +314,7 @@ void __init hpte_init_beat(void)
314static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, 314static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
315 unsigned long vpn, unsigned long pa, 315 unsigned long vpn, unsigned long pa,
316 unsigned long rflags, unsigned long vflags, 316 unsigned long rflags, unsigned long vflags,
317 int psize, int ssize) 317 int psize, int apsize, int ssize)
318{ 318{
319 unsigned long lpar_rc; 319 unsigned long lpar_rc;
320 u64 hpte_v, hpte_r, slot; 320 u64 hpte_v, hpte_r, slot;
@@ -327,9 +327,9 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
327 "rflags=%lx, vflags=%lx, psize=%d)\n", 327 "rflags=%lx, vflags=%lx, psize=%d)\n",
328 hpte_group, vpn, pa, rflags, vflags, psize); 328 hpte_group, vpn, pa, rflags, vflags, psize);
329 329
330 hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) | 330 hpte_v = hpte_encode_v(vpn, psize, apsize, MMU_SEGSIZE_256M) |
331 vflags | HPTE_V_VALID; 331 vflags | HPTE_V_VALID;
332 hpte_r = hpte_encode_r(pa, psize) | rflags; 332 hpte_r = hpte_encode_r(pa, psize, apsize) | rflags;
333 333
334 if (!(vflags & HPTE_V_BOLTED)) 334 if (!(vflags & HPTE_V_BOLTED))
335 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); 335 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
@@ -372,8 +372,8 @@ static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
372 unsigned long want_v; 372 unsigned long want_v;
373 unsigned long pss; 373 unsigned long pss;
374 374
375 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 375 want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
376 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; 376 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc[psize];
377 377
378 DBG_LOW(" update: " 378 DBG_LOW(" update: "
379 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", 379 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
@@ -402,8 +402,8 @@ static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn,
402 402
403 DBG_LOW(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n", 403 DBG_LOW(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n",
404 slot, vpn, psize, local); 404 slot, vpn, psize, local);
405 want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 405 want_v = hpte_encode_avpn(vpn, psize, MMU_SEGSIZE_256M);
406 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; 406 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc[psize];
407 407
408 lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss); 408 lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss);
409 409
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
deleted file mode 100644
index d4c39e32f147..000000000000
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ /dev/null
@@ -1,209 +0,0 @@
1/*
2 * cpufreq driver for the cell processor
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007
5 *
6 * Author: Christian Krafft <krafft@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/cpufreq.h>
24#include <linux/module.h>
25#include <linux/of_platform.h>
26
27#include <asm/machdep.h>
28#include <asm/prom.h>
29#include <asm/cell-regs.h>
30#include "cbe_cpufreq.h"
31
32static DEFINE_MUTEX(cbe_switch_mutex);
33
34
35/* the CBE supports an 8 step frequency scaling */
36static struct cpufreq_frequency_table cbe_freqs[] = {
37 {1, 0},
38 {2, 0},
39 {3, 0},
40 {4, 0},
41 {5, 0},
42 {6, 0},
43 {8, 0},
44 {10, 0},
45 {0, CPUFREQ_TABLE_END},
46};
47
48/*
49 * hardware specific functions
50 */
51
52static int set_pmode(unsigned int cpu, unsigned int slow_mode)
53{
54 int rc;
55
56 if (cbe_cpufreq_has_pmi)
57 rc = cbe_cpufreq_set_pmode_pmi(cpu, slow_mode);
58 else
59 rc = cbe_cpufreq_set_pmode(cpu, slow_mode);
60
61 pr_debug("register contains slow mode %d\n", cbe_cpufreq_get_pmode(cpu));
62
63 return rc;
64}
65
66/*
67 * cpufreq functions
68 */
69
70static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
71{
72 const u32 *max_freqp;
73 u32 max_freq;
74 int i, cur_pmode;
75 struct device_node *cpu;
76
77 cpu = of_get_cpu_node(policy->cpu, NULL);
78
79 if (!cpu)
80 return -ENODEV;
81
82 pr_debug("init cpufreq on CPU %d\n", policy->cpu);
83
84 /*
85 * Let's check we can actually get to the CELL regs
86 */
87 if (!cbe_get_cpu_pmd_regs(policy->cpu) ||
88 !cbe_get_cpu_mic_tm_regs(policy->cpu)) {
89 pr_info("invalid CBE regs pointers for cpufreq\n");
90 return -EINVAL;
91 }
92
93 max_freqp = of_get_property(cpu, "clock-frequency", NULL);
94
95 of_node_put(cpu);
96
97 if (!max_freqp)
98 return -EINVAL;
99
100 /* we need the freq in kHz */
101 max_freq = *max_freqp / 1000;
102
103 pr_debug("max clock-frequency is at %u kHz\n", max_freq);
104 pr_debug("initializing frequency table\n");
105
106 /* initialize frequency table */
107 for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
108 cbe_freqs[i].frequency = max_freq / cbe_freqs[i].index;
109 pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
110 }
111
112 /* if DEBUG is enabled set_pmode() measures the latency
113 * of a transition */
114 policy->cpuinfo.transition_latency = 25000;
115
116 cur_pmode = cbe_cpufreq_get_pmode(policy->cpu);
117 pr_debug("current pmode is at %d\n",cur_pmode);
118
119 policy->cur = cbe_freqs[cur_pmode].frequency;
120
121#ifdef CONFIG_SMP
122 cpumask_copy(policy->cpus, cpu_sibling_mask(policy->cpu));
123#endif
124
125 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
126
127 /* this ensures that policy->cpuinfo_min
128 * and policy->cpuinfo_max are set correctly */
129 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
130}
131
132static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
133{
134 cpufreq_frequency_table_put_attr(policy->cpu);
135 return 0;
136}
137
138static int cbe_cpufreq_verify(struct cpufreq_policy *policy)
139{
140 return cpufreq_frequency_table_verify(policy, cbe_freqs);
141}
142
143static int cbe_cpufreq_target(struct cpufreq_policy *policy,
144 unsigned int target_freq,
145 unsigned int relation)
146{
147 int rc;
148 struct cpufreq_freqs freqs;
149 unsigned int cbe_pmode_new;
150
151 cpufreq_frequency_table_target(policy,
152 cbe_freqs,
153 target_freq,
154 relation,
155 &cbe_pmode_new);
156
157 freqs.old = policy->cur;
158 freqs.new = cbe_freqs[cbe_pmode_new].frequency;
159 freqs.cpu = policy->cpu;
160
161 mutex_lock(&cbe_switch_mutex);
162 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
163
164 pr_debug("setting frequency for cpu %d to %d kHz, " \
165 "1/%d of max frequency\n",
166 policy->cpu,
167 cbe_freqs[cbe_pmode_new].frequency,
168 cbe_freqs[cbe_pmode_new].index);
169
170 rc = set_pmode(policy->cpu, cbe_pmode_new);
171
172 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
173 mutex_unlock(&cbe_switch_mutex);
174
175 return rc;
176}
177
178static struct cpufreq_driver cbe_cpufreq_driver = {
179 .verify = cbe_cpufreq_verify,
180 .target = cbe_cpufreq_target,
181 .init = cbe_cpufreq_cpu_init,
182 .exit = cbe_cpufreq_cpu_exit,
183 .name = "cbe-cpufreq",
184 .owner = THIS_MODULE,
185 .flags = CPUFREQ_CONST_LOOPS,
186};
187
188/*
189 * module init and destoy
190 */
191
192static int __init cbe_cpufreq_init(void)
193{
194 if (!machine_is(cell))
195 return -ENODEV;
196
197 return cpufreq_register_driver(&cbe_cpufreq_driver);
198}
199
200static void __exit cbe_cpufreq_exit(void)
201{
202 cpufreq_unregister_driver(&cbe_cpufreq_driver);
203}
204
205module_init(cbe_cpufreq_init);
206module_exit(cbe_cpufreq_exit);
207
208MODULE_LICENSE("GPL");
209MODULE_AUTHOR("Christian Krafft <krafft@de.ibm.com>");
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.h b/arch/powerpc/platforms/cell/cbe_cpufreq.h
deleted file mode 100644
index c1d86bfa92ff..000000000000
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * cbe_cpufreq.h
3 *
4 * This file contains the definitions used by the cbe_cpufreq driver.
5 *
6 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007
7 *
8 * Author: Christian Krafft <krafft@de.ibm.com>
9 *
10 */
11
12#include <linux/cpufreq.h>
13#include <linux/types.h>
14
15int cbe_cpufreq_set_pmode(int cpu, unsigned int pmode);
16int cbe_cpufreq_get_pmode(int cpu);
17
18int cbe_cpufreq_set_pmode_pmi(int cpu, unsigned int pmode);
19
20#if defined(CONFIG_CBE_CPUFREQ_PMI) || defined(CONFIG_CBE_CPUFREQ_PMI_MODULE)
21extern bool cbe_cpufreq_has_pmi;
22#else
23#define cbe_cpufreq_has_pmi (0)
24#endif
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c b/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c
deleted file mode 100644
index 20472e487b6f..000000000000
--- a/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * pervasive backend for the cbe_cpufreq driver
3 *
4 * This driver makes use of the pervasive unit to
5 * engage the desired frequency.
6 *
7 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007
8 *
9 * Author: Christian Krafft <krafft@de.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/io.h>
27#include <linux/kernel.h>
28#include <linux/time.h>
29#include <asm/machdep.h>
30#include <asm/hw_irq.h>
31#include <asm/cell-regs.h>
32
33#include "cbe_cpufreq.h"
34
35/* to write to MIC register */
36static u64 MIC_Slow_Fast_Timer_table[] = {
37 [0 ... 7] = 0x007fc00000000000ull,
38};
39
40/* more values for the MIC */
41static u64 MIC_Slow_Next_Timer_table[] = {
42 0x0000240000000000ull,
43 0x0000268000000000ull,
44 0x000029C000000000ull,
45 0x00002D0000000000ull,
46 0x0000300000000000ull,
47 0x0000334000000000ull,
48 0x000039C000000000ull,
49 0x00003FC000000000ull,
50};
51
52
53int cbe_cpufreq_set_pmode(int cpu, unsigned int pmode)
54{
55 struct cbe_pmd_regs __iomem *pmd_regs;
56 struct cbe_mic_tm_regs __iomem *mic_tm_regs;
57 unsigned long flags;
58 u64 value;
59#ifdef DEBUG
60 long time;
61#endif
62
63 local_irq_save(flags);
64
65 mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu);
66 pmd_regs = cbe_get_cpu_pmd_regs(cpu);
67
68#ifdef DEBUG
69 time = jiffies;
70#endif
71
72 out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]);
73 out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]);
74
75 out_be64(&mic_tm_regs->slow_next_timer_0, MIC_Slow_Next_Timer_table[pmode]);
76 out_be64(&mic_tm_regs->slow_next_timer_1, MIC_Slow_Next_Timer_table[pmode]);
77
78 value = in_be64(&pmd_regs->pmcr);
79 /* set bits to zero */
80 value &= 0xFFFFFFFFFFFFFFF8ull;
81 /* set bits to next pmode */
82 value |= pmode;
83
84 out_be64(&pmd_regs->pmcr, value);
85
86#ifdef DEBUG
87 /* wait until new pmode appears in status register */
88 value = in_be64(&pmd_regs->pmsr) & 0x07;
89 while (value != pmode) {
90 cpu_relax();
91 value = in_be64(&pmd_regs->pmsr) & 0x07;
92 }
93
94 time = jiffies - time;
95 time = jiffies_to_msecs(time);
96 pr_debug("had to wait %lu ms for a transition using " \
97 "pervasive unit\n", time);
98#endif
99 local_irq_restore(flags);
100
101 return 0;
102}
103
104
105int cbe_cpufreq_get_pmode(int cpu)
106{
107 int ret;
108 struct cbe_pmd_regs __iomem *pmd_regs;
109
110 pmd_regs = cbe_get_cpu_pmd_regs(cpu);
111 ret = in_be64(&pmd_regs->pmsr) & 0x07;
112
113 return ret;
114}
115
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
deleted file mode 100644
index 60a07a4f9326..000000000000
--- a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * pmi backend for the cbe_cpufreq driver
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007
5 *
6 * Author: Christian Krafft <krafft@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/kernel.h>
24#include <linux/types.h>
25#include <linux/timer.h>
26#include <linux/module.h>
27#include <linux/of_platform.h>
28
29#include <asm/processor.h>
30#include <asm/prom.h>
31#include <asm/pmi.h>
32#include <asm/cell-regs.h>
33
34#ifdef DEBUG
35#include <asm/time.h>
36#endif
37
38#include "cbe_cpufreq.h"
39
40static u8 pmi_slow_mode_limit[MAX_CBE];
41
42bool cbe_cpufreq_has_pmi = false;
43EXPORT_SYMBOL_GPL(cbe_cpufreq_has_pmi);
44
45/*
46 * hardware specific functions
47 */
48
49int cbe_cpufreq_set_pmode_pmi(int cpu, unsigned int pmode)
50{
51 int ret;
52 pmi_message_t pmi_msg;
53#ifdef DEBUG
54 long time;
55#endif
56 pmi_msg.type = PMI_TYPE_FREQ_CHANGE;
57 pmi_msg.data1 = cbe_cpu_to_node(cpu);
58 pmi_msg.data2 = pmode;
59
60#ifdef DEBUG
61 time = jiffies;
62#endif
63 pmi_send_message(pmi_msg);
64
65#ifdef DEBUG
66 time = jiffies - time;
67 time = jiffies_to_msecs(time);
68 pr_debug("had to wait %lu ms for a transition using " \
69 "PMI\n", time);
70#endif
71 ret = pmi_msg.data2;
72 pr_debug("PMI returned slow mode %d\n", ret);
73
74 return ret;
75}
76EXPORT_SYMBOL_GPL(cbe_cpufreq_set_pmode_pmi);
77
78
79static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg)
80{
81 u8 node, slow_mode;
82
83 BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
84
85 node = pmi_msg.data1;
86 slow_mode = pmi_msg.data2;
87
88 pmi_slow_mode_limit[node] = slow_mode;
89
90 pr_debug("cbe_handle_pmi: node: %d max_freq: %d\n", node, slow_mode);
91}
92
93static int pmi_notifier(struct notifier_block *nb,
94 unsigned long event, void *data)
95{
96 struct cpufreq_policy *policy = data;
97 struct cpufreq_frequency_table *cbe_freqs;
98 u8 node;
99
100 /* Should this really be called for CPUFREQ_ADJUST, CPUFREQ_INCOMPATIBLE
101 * and CPUFREQ_NOTIFY policy events?)
102 */
103 if (event == CPUFREQ_START)
104 return 0;
105
106 cbe_freqs = cpufreq_frequency_get_table(policy->cpu);
107 node = cbe_cpu_to_node(policy->cpu);
108
109 pr_debug("got notified, event=%lu, node=%u\n", event, node);
110
111 if (pmi_slow_mode_limit[node] != 0) {
112 pr_debug("limiting node %d to slow mode %d\n",
113 node, pmi_slow_mode_limit[node]);
114
115 cpufreq_verify_within_limits(policy, 0,
116
117 cbe_freqs[pmi_slow_mode_limit[node]].frequency);
118 }
119
120 return 0;
121}
122
123static struct notifier_block pmi_notifier_block = {
124 .notifier_call = pmi_notifier,
125};
126
127static struct pmi_handler cbe_pmi_handler = {
128 .type = PMI_TYPE_FREQ_CHANGE,
129 .handle_pmi_message = cbe_cpufreq_handle_pmi,
130};
131
132
133
134static int __init cbe_cpufreq_pmi_init(void)
135{
136 cbe_cpufreq_has_pmi = pmi_register_handler(&cbe_pmi_handler) == 0;
137
138 if (!cbe_cpufreq_has_pmi)
139 return -ENODEV;
140
141 cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
142
143 return 0;
144}
145
146static void __exit cbe_cpufreq_pmi_exit(void)
147{
148 cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
149 pmi_unregister_handler(&cbe_pmi_handler);
150}
151
152module_init(cbe_cpufreq_pmi_init);
153module_exit(cbe_cpufreq_pmi_exit);
154
155MODULE_LICENSE("GPL");
156MODULE_AUTHOR("Christian Krafft <krafft@de.ibm.com>");
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index e56bb651da1a..946306b1bb4e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -550,7 +550,7 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
550 */ 550 */
551 iommu = cell_iommu_for_node(dev_to_node(dev)); 551 iommu = cell_iommu_for_node(dev_to_node(dev));
552 if (iommu == NULL || list_empty(&iommu->windows)) { 552 if (iommu == NULL || list_empty(&iommu->windows)) {
553 printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n", 553 dev_err(dev, "iommu: missing iommu for %s (node %d)\n",
554 of_node_full_name(dev->of_node), dev_to_node(dev)); 554 of_node_full_name(dev->of_node), dev_to_node(dev));
555 return NULL; 555 return NULL;
556 } 556 }
diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
index 59c1a1694104..348a27b12512 100644
--- a/arch/powerpc/platforms/cell/pmu.c
+++ b/arch/powerpc/platforms/cell/pmu.c
@@ -382,7 +382,7 @@ static int __init cbe_init_pm_irq(void)
382 unsigned int irq; 382 unsigned int irq;
383 int rc, node; 383 int rc, node;
384 384
385 for_each_node(node) { 385 for_each_online_node(node) {
386 irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI | 386 irq = irq_create_mapping(NULL, IIC_IRQ_IOEX_PMI |
387 (node << IIC_IRQ_NODE_SHIFT)); 387 (node << IIC_IRQ_NODE_SHIFT));
388 if (irq == NO_IRQ) { 388 if (irq == NO_IRQ) {
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 8b1213993b10..f85db3a69b4a 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -715,7 +715,7 @@ static ssize_t spu_stat_show(struct device *dev,
715 spu->stats.libassist); 715 spu->stats.libassist);
716} 716}
717 717
718static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL); 718static DEVICE_ATTR(stat, 0444, spu_stat_show, NULL);
719 719
720#ifdef CONFIG_KEXEC 720#ifdef CONFIG_KEXEC
721 721
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 68c57d38745a..90986923a53a 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -149,7 +149,6 @@ static int __fops ## _open(struct inode *inode, struct file *file) \
149 return spufs_attr_open(inode, file, __get, __set, __fmt); \ 149 return spufs_attr_open(inode, file, __get, __set, __fmt); \
150} \ 150} \
151static const struct file_operations __fops = { \ 151static const struct file_operations __fops = { \
152 .owner = THIS_MODULE, \
153 .open = __fops ## _open, \ 152 .open = __fops ## _open, \
154 .release = spufs_attr_release, \ 153 .release = spufs_attr_release, \
155 .read = spufs_attr_read, \ 154 .read = spufs_attr_read, \
@@ -352,7 +351,7 @@ static unsigned long spufs_get_unmapped_area(struct file *file,
352 351
353 /* Else, try to obtain a 64K pages slice */ 352 /* Else, try to obtain a 64K pages slice */
354 return slice_get_unmapped_area(addr, len, flags, 353 return slice_get_unmapped_area(addr, len, flags,
355 MMU_PAGE_64K, 1, 0); 354 MMU_PAGE_64K, 1);
356} 355}
357#endif /* CONFIG_SPU_FS_64K_LS */ 356#endif /* CONFIG_SPU_FS_64K_LS */
358 357
@@ -2591,7 +2590,6 @@ static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait)
2591} 2590}
2592 2591
2593static const struct file_operations spufs_switch_log_fops = { 2592static const struct file_operations spufs_switch_log_fops = {
2594 .owner = THIS_MODULE,
2595 .open = spufs_switch_log_open, 2593 .open = spufs_switch_log_open,
2596 .read = spufs_switch_log_read, 2594 .read = spufs_switch_log_read,
2597 .poll = spufs_switch_log_poll, 2595 .poll = spufs_switch_log_poll,
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 3f3bb4cdbbec..35f77a42bedf 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -99,6 +99,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
99 if (!inode) 99 if (!inode)
100 goto out; 100 goto out;
101 101
102 inode->i_ino = get_next_ino();
102 inode->i_mode = mode; 103 inode->i_mode = mode;
103 inode->i_uid = current_fsuid(); 104 inode->i_uid = current_fsuid();
104 inode->i_gid = current_fsgid(); 105 inode->i_gid = current_fsgid();
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 5a8f50a9afa7..302ba43d73a1 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -9,7 +9,6 @@ config LINKSTATION
9 select FSL_SOC 9 select FSL_SOC
10 select PPC_UDBG_16550 if SERIAL_8250 10 select PPC_UDBG_16550 if SERIAL_8250
11 select DEFAULT_UIMAGE 11 select DEFAULT_UIMAGE
12 select MPC10X_OPENPIC
13 select MPC10X_BRIDGE 12 select MPC10X_BRIDGE
14 help 13 help
15 Select LINKSTATION if configuring for one of PPC- (MPC8241) 14 Select LINKSTATION if configuring for one of PPC- (MPC8241)
@@ -24,7 +23,6 @@ config STORCENTER
24 select MPIC 23 select MPIC
25 select FSL_SOC 24 select FSL_SOC
26 select PPC_UDBG_16550 if SERIAL_8250 25 select PPC_UDBG_16550 if SERIAL_8250
27 select MPC10X_OPENPIC
28 select MPC10X_BRIDGE 26 select MPC10X_BRIDGE
29 help 27 help
30 Select STORCENTER if configuring for the iomega StorCenter 28 Select STORCENTER if configuring for the iomega StorCenter
@@ -84,9 +82,6 @@ config MV64X60
84 select PPC_INDIRECT_PCI 82 select PPC_INDIRECT_PCI
85 select CHECK_CACHE_COHERENCY 83 select CHECK_CACHE_COHERENCY
86 84
87config MPC10X_OPENPIC
88 bool
89
90config GAMECUBE_COMMON 85config GAMECUBE_COMMON
91 bool 86 bool
92 87
diff --git a/arch/powerpc/platforms/embedded6xx/mpc10x.h b/arch/powerpc/platforms/embedded6xx/mpc10x.h
index b30a6a3b5bd2..b290b63661f1 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc10x.h
+++ b/arch/powerpc/platforms/embedded6xx/mpc10x.h
@@ -81,17 +81,6 @@
81#define MPC10X_MAPB_PCI_MEM_OFFSET (MPC10X_MAPB_ISA_MEM_BASE - \ 81#define MPC10X_MAPB_PCI_MEM_OFFSET (MPC10X_MAPB_ISA_MEM_BASE - \
82 MPC10X_MAPB_PCI_MEM_START) 82 MPC10X_MAPB_PCI_MEM_START)
83 83
84/* Set hose members to values appropriate for the mem map used */
85#define MPC10X_SETUP_HOSE(hose, map) { \
86 (hose)->pci_mem_offset = MPC10X_MAP##map##_PCI_MEM_OFFSET; \
87 (hose)->io_space.start = MPC10X_MAP##map##_PCI_IO_START; \
88 (hose)->io_space.end = MPC10X_MAP##map##_PCI_IO_END; \
89 (hose)->mem_space.start = MPC10X_MAP##map##_PCI_MEM_START; \
90 (hose)->mem_space.end = MPC10X_MAP##map##_PCI_MEM_END; \
91 (hose)->io_base_virt = (void *)MPC10X_MAP##map##_ISA_IO_BASE; \
92}
93
94
95/* Miscellaneous Configuration register offsets */ 84/* Miscellaneous Configuration register offsets */
96#define MPC10X_CFG_PIR_REG 0x09 85#define MPC10X_CFG_PIR_REG 0x09
97#define MPC10X_CFG_PIR_HOST_BRIDGE 0x00 86#define MPC10X_CFG_PIR_HOST_BRIDGE 0x00
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
index 890f30e70f98..be1e7958909e 100644
--- a/arch/powerpc/platforms/pasemi/cpufreq.c
+++ b/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -273,10 +273,9 @@ static int pas_cpufreq_target(struct cpufreq_policy *policy,
273 273
274 freqs.old = policy->cur; 274 freqs.old = policy->cur;
275 freqs.new = pas_freqs[pas_astate_new].frequency; 275 freqs.new = pas_freqs[pas_astate_new].frequency;
276 freqs.cpu = policy->cpu;
277 276
278 mutex_lock(&pas_switch_mutex); 277 mutex_lock(&pas_switch_mutex);
279 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 278 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
280 279
281 pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", 280 pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
282 policy->cpu, 281 policy->cpu,
@@ -288,7 +287,7 @@ static int pas_cpufreq_target(struct cpufreq_policy *policy,
288 for_each_online_cpu(i) 287 for_each_online_cpu(i)
289 set_astate(i, pas_astate_new); 288 set_astate(i, pas_astate_new);
290 289
291 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 290 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
292 mutex_unlock(&pas_switch_mutex); 291 mutex_unlock(&pas_switch_mutex);
293 292
294 ppc_proc_freq = freqs.new * 1000ul; 293 ppc_proc_freq = freqs.new * 1000ul;
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 311b804353b1..3104fad82480 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -335,7 +335,8 @@ static int pmu_set_cpu_speed(int low_speed)
335 return 0; 335 return 0;
336} 336}
337 337
338static int do_set_cpu_speed(int speed_mode, int notify) 338static int do_set_cpu_speed(struct cpufreq_policy *policy, int speed_mode,
339 int notify)
339{ 340{
340 struct cpufreq_freqs freqs; 341 struct cpufreq_freqs freqs;
341 unsigned long l3cr; 342 unsigned long l3cr;
@@ -343,13 +344,12 @@ static int do_set_cpu_speed(int speed_mode, int notify)
343 344
344 freqs.old = cur_freq; 345 freqs.old = cur_freq;
345 freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; 346 freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
346 freqs.cpu = smp_processor_id();
347 347
348 if (freqs.old == freqs.new) 348 if (freqs.old == freqs.new)
349 return 0; 349 return 0;
350 350
351 if (notify) 351 if (notify)
352 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 352 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
353 if (speed_mode == CPUFREQ_LOW && 353 if (speed_mode == CPUFREQ_LOW &&
354 cpu_has_feature(CPU_FTR_L3CR)) { 354 cpu_has_feature(CPU_FTR_L3CR)) {
355 l3cr = _get_L3CR(); 355 l3cr = _get_L3CR();
@@ -366,7 +366,7 @@ static int do_set_cpu_speed(int speed_mode, int notify)
366 _set_L3CR(prev_l3cr); 366 _set_L3CR(prev_l3cr);
367 } 367 }
368 if (notify) 368 if (notify)
369 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 369 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
370 cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; 370 cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
371 371
372 return 0; 372 return 0;
@@ -393,7 +393,7 @@ static int pmac_cpufreq_target( struct cpufreq_policy *policy,
393 target_freq, relation, &newstate)) 393 target_freq, relation, &newstate))
394 return -EINVAL; 394 return -EINVAL;
395 395
396 rc = do_set_cpu_speed(newstate, 1); 396 rc = do_set_cpu_speed(policy, newstate, 1);
397 397
398 ppc_proc_freq = cur_freq * 1000ul; 398 ppc_proc_freq = cur_freq * 1000ul;
399 return rc; 399 return rc;
@@ -442,7 +442,7 @@ static int pmac_cpufreq_suspend(struct cpufreq_policy *policy)
442 no_schedule = 1; 442 no_schedule = 1;
443 sleep_freq = cur_freq; 443 sleep_freq = cur_freq;
444 if (cur_freq == low_freq && !is_pmu_based) 444 if (cur_freq == low_freq && !is_pmu_based)
445 do_set_cpu_speed(CPUFREQ_HIGH, 0); 445 do_set_cpu_speed(policy, CPUFREQ_HIGH, 0);
446 return 0; 446 return 0;
447} 447}
448 448
@@ -458,7 +458,7 @@ static int pmac_cpufreq_resume(struct cpufreq_policy *policy)
458 * is that we force a switch to whatever it was, which is 458 * is that we force a switch to whatever it was, which is
459 * probably high speed due to our suspend() routine 459 * probably high speed due to our suspend() routine
460 */ 460 */
461 do_set_cpu_speed(sleep_freq == low_freq ? 461 do_set_cpu_speed(policy, sleep_freq == low_freq ?
462 CPUFREQ_LOW : CPUFREQ_HIGH, 0); 462 CPUFREQ_LOW : CPUFREQ_HIGH, 0);
463 463
464 ppc_proc_freq = cur_freq * 1000ul; 464 ppc_proc_freq = cur_freq * 1000ul;
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index 9650c6029c82..7ba423431cfe 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -339,11 +339,10 @@ static int g5_cpufreq_target(struct cpufreq_policy *policy,
339 339
340 freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; 340 freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency;
341 freqs.new = g5_cpu_freqs[newstate].frequency; 341 freqs.new = g5_cpu_freqs[newstate].frequency;
342 freqs.cpu = 0;
343 342
344 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 343 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
345 rc = g5_switch_freq(newstate); 344 rc = g5_switch_freq(newstate);
346 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 345 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
347 346
348 mutex_unlock(&g5_switch_mutex); 347 mutex_unlock(&g5_switch_mutex);
349 348
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 2b8af75abc23..cf7009b8c7b6 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -824,6 +824,7 @@ static void __init parse_region_decode(struct pci_controller *hose,
824 hose->mem_resources[cur].name = hose->dn->full_name; 824 hose->mem_resources[cur].name = hose->dn->full_name;
825 hose->mem_resources[cur].start = base; 825 hose->mem_resources[cur].start = base;
826 hose->mem_resources[cur].end = end; 826 hose->mem_resources[cur].end = end;
827 hose->mem_offset[cur] = 0;
827 DBG(" %d: 0x%08lx-0x%08lx\n", cur, base, end); 828 DBG(" %d: 0x%08lx-0x%08lx\n", cur, base, end);
828 } else { 829 } else {
829 DBG(" : -0x%08lx\n", end); 830 DBG(" : -0x%08lx\n", end);
@@ -866,7 +867,6 @@ static void __init setup_u3_ht(struct pci_controller* hose)
866 hose->io_resource.start = 0; 867 hose->io_resource.start = 0;
867 hose->io_resource.end = 0x003fffff; 868 hose->io_resource.end = 0x003fffff;
868 hose->io_resource.flags = IORESOURCE_IO; 869 hose->io_resource.flags = IORESOURCE_IO;
869 hose->pci_mem_offset = 0;
870 hose->first_busno = 0; 870 hose->first_busno = 0;
871 hose->last_busno = 0xef; 871 hose->last_busno = 0xef;
872 872
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 74fea5c21839..d3e840d643af 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -8,6 +8,11 @@ config PPC_POWERNV
8 select PPC_PCI_CHOICE if EMBEDDED 8 select PPC_PCI_CHOICE if EMBEDDED
9 default y 9 default y
10 10
11config POWERNV_MSI
12 bool "Support PCI MSI on PowerNV platform"
13 depends on PCI_MSI
14 default y
15
11config PPC_POWERNV_RTAS 16config PPC_POWERNV_RTAS
12 depends on PPC_POWERNV 17 depends on PPC_POWERNV
13 bool "Support for RTAS based PowerNV platforms such as BML" 18 bool "Support for RTAS based PowerNV platforms such as BML"
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 3bb07e5e43cd..6fabe92eafb6 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -107,3 +107,4 @@ OPAL_CALL(opal_pci_mask_pe_error, OPAL_PCI_MASK_PE_ERROR);
107OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS); 107OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS);
108OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS); 108OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS);
109OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED); 109OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED);
110OPAL_CALL(opal_pci_msi_eoi, OPAL_PCI_MSI_EOI);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index aaa0dba49471..ade4463226c6 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -34,7 +34,6 @@ int __init early_init_dt_scan_opal(unsigned long node,
34{ 34{
35 const void *basep, *entryp; 35 const void *basep, *entryp;
36 unsigned long basesz, entrysz; 36 unsigned long basesz, entrysz;
37 u64 glue;
38 37
39 if (depth != 1 || strcmp(uname, "ibm,opal") != 0) 38 if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
40 return 0; 39 return 0;
@@ -61,6 +60,16 @@ int __init early_init_dt_scan_opal(unsigned long node,
61 printk("OPAL V1 detected !\n"); 60 printk("OPAL V1 detected !\n");
62 } 61 }
63 62
63 return 1;
64}
65
66static int __init opal_register_exception_handlers(void)
67{
68 u64 glue;
69
70 if (!(powerpc_firmware_features & FW_FEATURE_OPAL))
71 return -ENODEV;
72
64 /* Hookup some exception handlers. We use the fwnmi area at 0x7000 73 /* Hookup some exception handlers. We use the fwnmi area at 0x7000
65 * to provide the glue space to OPAL 74 * to provide the glue space to OPAL
66 */ 75 */
@@ -74,9 +83,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
74 glue += 128; 83 glue += 128;
75 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue); 84 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue);
76 85
77 return 1; 86 return 0;
78} 87}
79 88
89early_initcall(opal_register_exception_handlers);
90
80int opal_get_chars(uint32_t vtermno, char *buf, int count) 91int opal_get_chars(uint32_t vtermno, char *buf, int count)
81{ 92{
82 s64 len, rc; 93 s64 len, rc;
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 8e90e8906df3..1da578b7c1bf 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -26,10 +26,12 @@
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/pci-bridge.h> 27#include <asm/pci-bridge.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/msi_bitmap.h>
29#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
30#include <asm/opal.h> 31#include <asm/opal.h>
31#include <asm/iommu.h> 32#include <asm/iommu.h>
32#include <asm/tce.h> 33#include <asm/tce.h>
34#include <asm/xics.h>
33 35
34#include "powernv.h" 36#include "powernv.h"
35#include "pci.h" 37#include "pci.h"
@@ -87,6 +89,7 @@ static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
87 return IODA_INVALID_PE; 89 return IODA_INVALID_PE;
88 } while(test_and_set_bit(pe, phb->ioda.pe_alloc)); 90 } while(test_and_set_bit(pe, phb->ioda.pe_alloc));
89 91
92 phb->ioda.pe_array[pe].phb = phb;
90 phb->ioda.pe_array[pe].pe_number = pe; 93 phb->ioda.pe_array[pe].pe_number = pe;
91 return pe; 94 return pe;
92} 95}
@@ -431,22 +434,102 @@ static void pnv_pci_ioda_setup_PEs(void)
431 } 434 }
432} 435}
433 436
434static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *dev) 437static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev)
435{ 438{
436 /* We delay DMA setup after we have assigned all PE# */ 439 struct pci_dn *pdn = pnv_ioda_get_pdn(pdev);
440 struct pnv_ioda_pe *pe;
441
442 /*
443 * The function can be called while the PE#
444 * hasn't been assigned. Do nothing for the
445 * case.
446 */
447 if (!pdn || pdn->pe_number == IODA_INVALID_PE)
448 return;
449
450 pe = &phb->ioda.pe_array[pdn->pe_number];
451 set_iommu_table_base(&pdev->dev, &pe->tce32_table);
437} 452}
438 453
439static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) 454static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,
455 u64 *startp, u64 *endp)
440{ 456{
441 struct pci_dev *dev; 457 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index;
458 unsigned long start, end, inc;
459
460 start = __pa(startp);
461 end = __pa(endp);
462
463 /* BML uses this case for p6/p7/galaxy2: Shift addr and put in node */
464 if (tbl->it_busno) {
465 start <<= 12;
466 end <<= 12;
467 inc = 128 << 12;
468 start |= tbl->it_busno;
469 end |= tbl->it_busno;
470 } else if (tbl->it_type & TCE_PCI_SWINV_PAIR) {
471 /* p7ioc-style invalidation, 2 TCEs per write */
472 start |= (1ull << 63);
473 end |= (1ull << 63);
474 inc = 16;
475 } else {
476 /* Default (older HW) */
477 inc = 128;
478 }
442 479
443 list_for_each_entry(dev, &bus->devices, bus_list) { 480 end |= inc - 1; /* round up end to be different than start */
444 set_iommu_table_base(&dev->dev, &pe->tce32_table); 481
445 if (dev->subordinate) 482 mb(); /* Ensure above stores are visible */
446 pnv_ioda_setup_bus_dma(pe, dev->subordinate); 483 while (start <= end) {
484 __raw_writeq(start, invalidate);
485 start += inc;
486 }
487
488 /*
489 * The iommu layer will do another mb() for us on build()
490 * and we don't care on free()
491 */
492}
493
494static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe,
495 struct iommu_table *tbl,
496 u64 *startp, u64 *endp)
497{
498 unsigned long start, end, inc;
499 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index;
500
501 /* We'll invalidate DMA address in PE scope */
502 start = 0x2ul << 60;
503 start |= (pe->pe_number & 0xFF);
504 end = start;
505
506 /* Figure out the start, end and step */
507 inc = tbl->it_offset + (((u64)startp - tbl->it_base) / sizeof(u64));
508 start |= (inc << 12);
509 inc = tbl->it_offset + (((u64)endp - tbl->it_base) / sizeof(u64));
510 end |= (inc << 12);
511 inc = (0x1ul << 12);
512 mb();
513
514 while (start <= end) {
515 __raw_writeq(start, invalidate);
516 start += inc;
447 } 517 }
448} 518}
449 519
520void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
521 u64 *startp, u64 *endp)
522{
523 struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe,
524 tce32_table);
525 struct pnv_phb *phb = pe->phb;
526
527 if (phb->type == PNV_PHB_IODA1)
528 pnv_pci_ioda1_tce_invalidate(tbl, startp, endp);
529 else
530 pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp);
531}
532
450static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, 533static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
451 struct pnv_ioda_pe *pe, unsigned int base, 534 struct pnv_ioda_pe *pe, unsigned int base,
452 unsigned int segs) 535 unsigned int segs)
@@ -518,16 +601,11 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
518 */ 601 */
519 tbl->it_busno = 0; 602 tbl->it_busno = 0;
520 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8); 603 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8);
521 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE 604 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE |
522 | TCE_PCI_SWINV_PAIR; 605 TCE_PCI_SWINV_PAIR;
523 } 606 }
524 iommu_init_table(tbl, phb->hose->node); 607 iommu_init_table(tbl, phb->hose->node);
525 608
526 if (pe->pdev)
527 set_iommu_table_base(&pe->pdev->dev, tbl);
528 else
529 pnv_ioda_setup_bus_dma(pe, pe->pbus);
530
531 return; 609 return;
532 fail: 610 fail:
533 /* XXX Failure: Try to fallback to 64-bit only ? */ 611 /* XXX Failure: Try to fallback to 64-bit only ? */
@@ -537,6 +615,76 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
537 __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); 615 __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs));
538} 616}
539 617
618static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
619 struct pnv_ioda_pe *pe)
620{
621 struct page *tce_mem = NULL;
622 void *addr;
623 const __be64 *swinvp;
624 struct iommu_table *tbl;
625 unsigned int tce_table_size, end;
626 int64_t rc;
627
628 /* We shouldn't already have a 32-bit DMA associated */
629 if (WARN_ON(pe->tce32_seg >= 0))
630 return;
631
632 /* The PE will reserve all possible 32-bits space */
633 pe->tce32_seg = 0;
634 end = (1 << ilog2(phb->ioda.m32_pci_base));
635 tce_table_size = (end / 0x1000) * 8;
636 pe_info(pe, "Setting up 32-bit TCE table at 0..%08x\n",
637 end);
638
639 /* Allocate TCE table */
640 tce_mem = alloc_pages_node(phb->hose->node, GFP_KERNEL,
641 get_order(tce_table_size));
642 if (!tce_mem) {
643 pe_err(pe, "Failed to allocate a 32-bit TCE memory\n");
644 goto fail;
645 }
646 addr = page_address(tce_mem);
647 memset(addr, 0, tce_table_size);
648
649 /*
650 * Map TCE table through TVT. The TVE index is the PE number
651 * shifted by 1 bit for 32-bits DMA space.
652 */
653 rc = opal_pci_map_pe_dma_window(phb->opal_id, pe->pe_number,
654 pe->pe_number << 1, 1, __pa(addr),
655 tce_table_size, 0x1000);
656 if (rc) {
657 pe_err(pe, "Failed to configure 32-bit TCE table,"
658 " err %ld\n", rc);
659 goto fail;
660 }
661
662 /* Setup linux iommu table */
663 tbl = &pe->tce32_table;
664 pnv_pci_setup_iommu_table(tbl, addr, tce_table_size, 0);
665
666 /* OPAL variant of PHB3 invalidated TCEs */
667 swinvp = of_get_property(phb->hose->dn, "ibm,opal-tce-kill", NULL);
668 if (swinvp) {
669 /* We need a couple more fields -- an address and a data
670 * to or. Since the bus is only printed out on table free
671 * errors, and on the first pass the data will be a relative
672 * bus number, print that out instead.
673 */
674 tbl->it_busno = 0;
675 tbl->it_index = (unsigned long)ioremap(be64_to_cpup(swinvp), 8);
676 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE;
677 }
678 iommu_init_table(tbl, phb->hose->node);
679
680 return;
681fail:
682 if (pe->tce32_seg >= 0)
683 pe->tce32_seg = -1;
684 if (tce_mem)
685 __free_pages(tce_mem, get_order(tce_table_size));
686}
687
540static void pnv_ioda_setup_dma(struct pnv_phb *phb) 688static void pnv_ioda_setup_dma(struct pnv_phb *phb)
541{ 689{
542 struct pci_controller *hose = phb->hose; 690 struct pci_controller *hose = phb->hose;
@@ -579,20 +727,49 @@ static void pnv_ioda_setup_dma(struct pnv_phb *phb)
579 if (segs > remaining) 727 if (segs > remaining)
580 segs = remaining; 728 segs = remaining;
581 } 729 }
582 pe_info(pe, "DMA weight %d, assigned %d DMA32 segments\n", 730
583 pe->dma_weight, segs); 731 /*
584 pnv_pci_ioda_setup_dma_pe(phb, pe, base, segs); 732 * For IODA2 compliant PHB3, we needn't care about the weight.
733 * The all available 32-bits DMA space will be assigned to
734 * the specific PE.
735 */
736 if (phb->type == PNV_PHB_IODA1) {
737 pe_info(pe, "DMA weight %d, assigned %d DMA32 segments\n",
738 pe->dma_weight, segs);
739 pnv_pci_ioda_setup_dma_pe(phb, pe, base, segs);
740 } else {
741 pe_info(pe, "Assign DMA32 space\n");
742 segs = 0;
743 pnv_pci_ioda2_setup_dma_pe(phb, pe);
744 }
745
585 remaining -= segs; 746 remaining -= segs;
586 base += segs; 747 base += segs;
587 } 748 }
588} 749}
589 750
590#ifdef CONFIG_PCI_MSI 751#ifdef CONFIG_PCI_MSI
752static void pnv_ioda2_msi_eoi(struct irq_data *d)
753{
754 unsigned int hw_irq = (unsigned int)irqd_to_hwirq(d);
755 struct irq_chip *chip = irq_data_get_irq_chip(d);
756 struct pnv_phb *phb = container_of(chip, struct pnv_phb,
757 ioda.irq_chip);
758 int64_t rc;
759
760 rc = opal_pci_msi_eoi(phb->opal_id, hw_irq);
761 WARN_ON_ONCE(rc);
762
763 icp_native_eoi(d);
764}
765
591static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, 766static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
592 unsigned int hwirq, unsigned int is_64, 767 unsigned int hwirq, unsigned int virq,
593 struct msi_msg *msg) 768 unsigned int is_64, struct msi_msg *msg)
594{ 769{
595 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); 770 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
771 struct irq_data *idata;
772 struct irq_chip *ichip;
596 unsigned int xive_num = hwirq - phb->msi_base; 773 unsigned int xive_num = hwirq - phb->msi_base;
597 uint64_t addr64; 774 uint64_t addr64;
598 uint32_t addr32, data; 775 uint32_t addr32, data;
@@ -637,6 +814,23 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
637 } 814 }
638 msg->data = data; 815 msg->data = data;
639 816
817 /*
818 * Change the IRQ chip for the MSI interrupts on PHB3.
819 * The corresponding IRQ chip should be populated for
820 * the first time.
821 */
822 if (phb->type == PNV_PHB_IODA2) {
823 if (!phb->ioda.irq_chip_init) {
824 idata = irq_get_irq_data(virq);
825 ichip = irq_data_get_irq_chip(idata);
826 phb->ioda.irq_chip_init = 1;
827 phb->ioda.irq_chip = *ichip;
828 phb->ioda.irq_chip.irq_eoi = pnv_ioda2_msi_eoi;
829 }
830
831 irq_set_chip(virq, &phb->ioda.irq_chip);
832 }
833
640 pr_devel("%s: %s-bit MSI on hwirq %x (xive #%d)," 834 pr_devel("%s: %s-bit MSI on hwirq %x (xive #%d),"
641 " address=%x_%08x data=%x PE# %d\n", 835 " address=%x_%08x data=%x PE# %d\n",
642 pci_name(dev), is_64 ? "64" : "32", hwirq, xive_num, 836 pci_name(dev), is_64 ? "64" : "32", hwirq, xive_num,
@@ -647,7 +841,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
647 841
648static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) 842static void pnv_pci_init_ioda_msis(struct pnv_phb *phb)
649{ 843{
650 unsigned int bmap_size; 844 unsigned int count;
651 const __be32 *prop = of_get_property(phb->hose->dn, 845 const __be32 *prop = of_get_property(phb->hose->dn,
652 "ibm,opal-msi-ranges", NULL); 846 "ibm,opal-msi-ranges", NULL);
653 if (!prop) { 847 if (!prop) {
@@ -658,18 +852,17 @@ static void pnv_pci_init_ioda_msis(struct pnv_phb *phb)
658 return; 852 return;
659 853
660 phb->msi_base = be32_to_cpup(prop); 854 phb->msi_base = be32_to_cpup(prop);
661 phb->msi_count = be32_to_cpup(prop + 1); 855 count = be32_to_cpup(prop + 1);
662 bmap_size = BITS_TO_LONGS(phb->msi_count) * sizeof(unsigned long); 856 if (msi_bitmap_alloc(&phb->msi_bmp, count, phb->hose->dn)) {
663 phb->msi_map = zalloc_maybe_bootmem(bmap_size, GFP_KERNEL);
664 if (!phb->msi_map) {
665 pr_err("PCI %d: Failed to allocate MSI bitmap !\n", 857 pr_err("PCI %d: Failed to allocate MSI bitmap !\n",
666 phb->hose->global_number); 858 phb->hose->global_number);
667 return; 859 return;
668 } 860 }
861
669 phb->msi_setup = pnv_pci_ioda_msi_setup; 862 phb->msi_setup = pnv_pci_ioda_msi_setup;
670 phb->msi32_support = 1; 863 phb->msi32_support = 1;
671 pr_info(" Allocated bitmap for %d MSIs (base IRQ 0x%x)\n", 864 pr_info(" Allocated bitmap for %d MSIs (base IRQ 0x%x)\n",
672 phb->msi_count, phb->msi_base); 865 count, phb->msi_base);
673} 866}
674#else 867#else
675static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { } 868static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { }
@@ -722,11 +915,14 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
722 index++; 915 index++;
723 } 916 }
724 } else if (res->flags & IORESOURCE_MEM) { 917 } else if (res->flags & IORESOURCE_MEM) {
918 /* WARNING: Assumes M32 is mem region 0 in PHB. We need to
919 * harden that algorithm when we start supporting M64
920 */
725 region.start = res->start - 921 region.start = res->start -
726 hose->pci_mem_offset - 922 hose->mem_offset[0] -
727 phb->ioda.m32_pci_base; 923 phb->ioda.m32_pci_base;
728 region.end = res->end - 924 region.end = res->end -
729 hose->pci_mem_offset - 925 hose->mem_offset[0] -
730 phb->ioda.m32_pci_base; 926 phb->ioda.m32_pci_base;
731 index = region.start / phb->ioda.m32_segsize; 927 index = region.start / phb->ioda.m32_segsize;
732 928
@@ -852,18 +1048,19 @@ static u32 pnv_ioda_bdfn_to_pe(struct pnv_phb *phb, struct pci_bus *bus,
852 return phb->ioda.pe_rmap[(bus->number << 8) | devfn]; 1048 return phb->ioda.pe_rmap[(bus->number << 8) | devfn];
853} 1049}
854 1050
855void __init pnv_pci_init_ioda1_phb(struct device_node *np) 1051void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
856{ 1052{
857 struct pci_controller *hose; 1053 struct pci_controller *hose;
858 static int primary = 1; 1054 static int primary = 1;
859 struct pnv_phb *phb; 1055 struct pnv_phb *phb;
860 unsigned long size, m32map_off, iomap_off, pemap_off; 1056 unsigned long size, m32map_off, iomap_off, pemap_off;
861 const u64 *prop64; 1057 const u64 *prop64;
1058 const u32 *prop32;
862 u64 phb_id; 1059 u64 phb_id;
863 void *aux; 1060 void *aux;
864 long rc; 1061 long rc;
865 1062
866 pr_info(" Initializing IODA OPAL PHB %s\n", np->full_name); 1063 pr_info(" Initializing IODA%d OPAL PHB %s\n", ioda_type, np->full_name);
867 1064
868 prop64 = of_get_property(np, "ibm,opal-phbid", NULL); 1065 prop64 = of_get_property(np, "ibm,opal-phbid", NULL);
869 if (!prop64) { 1066 if (!prop64) {
@@ -890,47 +1087,46 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
890 hose->last_busno = 0xff; 1087 hose->last_busno = 0xff;
891 hose->private_data = phb; 1088 hose->private_data = phb;
892 phb->opal_id = phb_id; 1089 phb->opal_id = phb_id;
893 phb->type = PNV_PHB_IODA1; 1090 phb->type = ioda_type;
894 1091
895 /* Detect specific models for error handling */ 1092 /* Detect specific models for error handling */
896 if (of_device_is_compatible(np, "ibm,p7ioc-pciex")) 1093 if (of_device_is_compatible(np, "ibm,p7ioc-pciex"))
897 phb->model = PNV_PHB_MODEL_P7IOC; 1094 phb->model = PNV_PHB_MODEL_P7IOC;
1095 else if (of_device_is_compatible(np, "ibm,power8-pciex"))
1096 phb->model = PNV_PHB_MODEL_PHB3;
898 else 1097 else
899 phb->model = PNV_PHB_MODEL_UNKNOWN; 1098 phb->model = PNV_PHB_MODEL_UNKNOWN;
900 1099
901 /* We parse "ranges" now since we need to deduce the register base 1100 /* Parse 32-bit and IO ranges (if any) */
902 * from the IO base
903 */
904 pci_process_bridge_OF_ranges(phb->hose, np, primary); 1101 pci_process_bridge_OF_ranges(phb->hose, np, primary);
905 primary = 0; 1102 primary = 0;
906 1103
907 /* Magic formula from Milton */ 1104 /* Get registers */
908 phb->regs = of_iomap(np, 0); 1105 phb->regs = of_iomap(np, 0);
909 if (phb->regs == NULL) 1106 if (phb->regs == NULL)
910 pr_err(" Failed to map registers !\n"); 1107 pr_err(" Failed to map registers !\n");
911 1108
912
913 /* XXX This is hack-a-thon. This needs to be changed so that:
914 * - we obtain stuff like PE# etc... from device-tree
915 * - we properly re-allocate M32 ourselves
916 * (the OFW one isn't very good)
917 */
918
919 /* Initialize more IODA stuff */ 1109 /* Initialize more IODA stuff */
920 phb->ioda.total_pe = 128; 1110 prop32 = of_get_property(np, "ibm,opal-num-pes", NULL);
1111 if (!prop32)
1112 phb->ioda.total_pe = 1;
1113 else
1114 phb->ioda.total_pe = *prop32;
921 1115
922 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]); 1116 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]);
923 /* OFW Has already off top 64k of M32 space (MSI space) */ 1117 /* FW Has already off top 64k of M32 space (MSI space) */
924 phb->ioda.m32_size += 0x10000; 1118 phb->ioda.m32_size += 0x10000;
925 1119
926 phb->ioda.m32_segsize = phb->ioda.m32_size / phb->ioda.total_pe; 1120 phb->ioda.m32_segsize = phb->ioda.m32_size / phb->ioda.total_pe;
927 phb->ioda.m32_pci_base = hose->mem_resources[0].start - 1121 phb->ioda.m32_pci_base = hose->mem_resources[0].start - hose->mem_offset[0];
928 hose->pci_mem_offset;
929 phb->ioda.io_size = hose->pci_io_size; 1122 phb->ioda.io_size = hose->pci_io_size;
930 phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe; 1123 phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe;
931 phb->ioda.io_pci_base = 0; /* XXX calculate this ? */ 1124 phb->ioda.io_pci_base = 0; /* XXX calculate this ? */
932 1125
933 /* Allocate aux data & arrays */ 1126 /* Allocate aux data & arrays
1127 *
1128 * XXX TODO: Don't allocate io segmap on PHB3
1129 */
934 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long)); 1130 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long));
935 m32map_off = size; 1131 m32map_off = size;
936 size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]); 1132 size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]);
@@ -960,7 +1156,7 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
960 hose->mem_resources[2].start = 0; 1156 hose->mem_resources[2].start = 0;
961 hose->mem_resources[2].end = 0; 1157 hose->mem_resources[2].end = 0;
962 1158
963#if 0 1159#if 0 /* We should really do that ... */
964 rc = opal_pci_set_phb_mem_window(opal->phb_id, 1160 rc = opal_pci_set_phb_mem_window(opal->phb_id,
965 window_type, 1161 window_type,
966 window_num, 1162 window_num,
@@ -974,16 +1170,6 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
974 phb->ioda.m32_size, phb->ioda.m32_segsize, 1170 phb->ioda.m32_size, phb->ioda.m32_segsize,
975 phb->ioda.io_size, phb->ioda.io_segsize); 1171 phb->ioda.io_size, phb->ioda.io_segsize);
976 1172
977 if (phb->regs) {
978 pr_devel(" BUID = 0x%016llx\n", in_be64(phb->regs + 0x100));
979 pr_devel(" PHB2_CR = 0x%016llx\n", in_be64(phb->regs + 0x160));
980 pr_devel(" IO_BAR = 0x%016llx\n", in_be64(phb->regs + 0x170));
981 pr_devel(" IO_BAMR = 0x%016llx\n", in_be64(phb->regs + 0x178));
982 pr_devel(" IO_SAR = 0x%016llx\n", in_be64(phb->regs + 0x180));
983 pr_devel(" M32_BAR = 0x%016llx\n", in_be64(phb->regs + 0x190));
984 pr_devel(" M32_BAMR = 0x%016llx\n", in_be64(phb->regs + 0x198));
985 pr_devel(" M32_SAR = 0x%016llx\n", in_be64(phb->regs + 0x1a0));
986 }
987 phb->hose->ops = &pnv_pci_ops; 1173 phb->hose->ops = &pnv_pci_ops;
988 1174
989 /* Setup RID -> PE mapping function */ 1175 /* Setup RID -> PE mapping function */
@@ -1011,7 +1197,18 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
1011 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); 1197 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
1012 if (rc) 1198 if (rc)
1013 pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc); 1199 pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc);
1014 opal_pci_set_pe(phb_id, 0, 0, 7, 1, 1 , OPAL_MAP_PE); 1200
1201 /*
1202 * On IODA1 map everything to PE#0, on IODA2 we assume the IODA reset
1203 * has cleared the RTT which has the same effect
1204 */
1205 if (ioda_type == PNV_PHB_IODA1)
1206 opal_pci_set_pe(phb_id, 0, 0, 7, 1, 1 , OPAL_MAP_PE);
1207}
1208
1209void pnv_pci_init_ioda2_phb(struct device_node *np)
1210{
1211 pnv_pci_init_ioda_phb(np, PNV_PHB_IODA2);
1015} 1212}
1016 1213
1017void __init pnv_pci_init_ioda_hub(struct device_node *np) 1214void __init pnv_pci_init_ioda_hub(struct device_node *np)
@@ -1034,6 +1231,6 @@ void __init pnv_pci_init_ioda_hub(struct device_node *np)
1034 for_each_child_of_node(np, phbn) { 1231 for_each_child_of_node(np, phbn) {
1035 /* Look for IODA1 PHBs */ 1232 /* Look for IODA1 PHBs */
1036 if (of_device_is_compatible(phbn, "ibm,ioda-phb")) 1233 if (of_device_is_compatible(phbn, "ibm,ioda-phb"))
1037 pnv_pci_init_ioda1_phb(phbn); 1234 pnv_pci_init_ioda_phb(phbn, PNV_PHB_IODA1);
1038 } 1235 }
1039} 1236}
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 7db8771a40f5..92b37a0186c9 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -26,6 +26,7 @@
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/pci-bridge.h> 27#include <asm/pci-bridge.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/msi_bitmap.h>
29#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
30#include <asm/opal.h> 31#include <asm/opal.h>
31#include <asm/iommu.h> 32#include <asm/iommu.h>
@@ -41,8 +42,8 @@
41 42
42#ifdef CONFIG_PCI_MSI 43#ifdef CONFIG_PCI_MSI
43static int pnv_pci_p5ioc2_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, 44static int pnv_pci_p5ioc2_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
44 unsigned int hwirq, unsigned int is_64, 45 unsigned int hwirq, unsigned int virq,
45 struct msi_msg *msg) 46 unsigned int is_64, struct msi_msg *msg)
46{ 47{
47 if (WARN_ON(!is_64)) 48 if (WARN_ON(!is_64))
48 return -ENXIO; 49 return -ENXIO;
@@ -55,7 +56,7 @@ static int pnv_pci_p5ioc2_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
55 56
56static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb) 57static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb)
57{ 58{
58 unsigned int bmap_size; 59 unsigned int count;
59 const __be32 *prop = of_get_property(phb->hose->dn, 60 const __be32 *prop = of_get_property(phb->hose->dn,
60 "ibm,opal-msi-ranges", NULL); 61 "ibm,opal-msi-ranges", NULL);
61 if (!prop) 62 if (!prop)
@@ -67,10 +68,8 @@ static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb)
67 if (of_device_is_compatible(phb->hose->dn, "ibm,p5ioc2-pcix")) 68 if (of_device_is_compatible(phb->hose->dn, "ibm,p5ioc2-pcix"))
68 return; 69 return;
69 phb->msi_base = be32_to_cpup(prop); 70 phb->msi_base = be32_to_cpup(prop);
70 phb->msi_count = be32_to_cpup(prop + 1); 71 count = be32_to_cpup(prop + 1);
71 bmap_size = BITS_TO_LONGS(phb->msi_count) * sizeof(unsigned long); 72 if (msi_bitmap_alloc(&phb->msi_bmp, count, phb->hose->dn)) {
72 phb->msi_map = zalloc_maybe_bootmem(bmap_size, GFP_KERNEL);
73 if (!phb->msi_map) {
74 pr_err("PCI %d: Failed to allocate MSI bitmap !\n", 73 pr_err("PCI %d: Failed to allocate MSI bitmap !\n",
75 phb->hose->global_number); 74 phb->hose->global_number);
76 return; 75 return;
@@ -78,7 +77,7 @@ static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb)
78 phb->msi_setup = pnv_pci_p5ioc2_msi_setup; 77 phb->msi_setup = pnv_pci_p5ioc2_msi_setup;
79 phb->msi32_support = 0; 78 phb->msi32_support = 0;
80 pr_info(" Allocated bitmap for %d MSIs (base IRQ 0x%x)\n", 79 pr_info(" Allocated bitmap for %d MSIs (base IRQ 0x%x)\n",
81 phb->msi_count, phb->msi_base); 80 count, phb->msi_base);
82} 81}
83#else 82#else
84static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb) { } 83static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb) { }
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index b8b8e0bd9897..55dfca844ddf 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -26,6 +26,7 @@
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/pci-bridge.h> 27#include <asm/pci-bridge.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/msi_bitmap.h>
29#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
30#include <asm/opal.h> 31#include <asm/opal.h>
31#include <asm/iommu.h> 32#include <asm/iommu.h>
@@ -47,43 +48,7 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
47 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 48 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
48 struct pnv_phb *phb = hose->private_data; 49 struct pnv_phb *phb = hose->private_data;
49 50
50 return (phb && phb->msi_map) ? 0 : -ENODEV; 51 return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
51}
52
53static unsigned int pnv_get_one_msi(struct pnv_phb *phb)
54{
55 unsigned long flags;
56 unsigned int id, rc;
57
58 spin_lock_irqsave(&phb->lock, flags);
59
60 id = find_next_zero_bit(phb->msi_map, phb->msi_count, phb->msi_next);
61 if (id >= phb->msi_count && phb->msi_next)
62 id = find_next_zero_bit(phb->msi_map, phb->msi_count, 0);
63 if (id >= phb->msi_count) {
64 rc = 0;
65 goto out;
66 }
67 __set_bit(id, phb->msi_map);
68 rc = id + phb->msi_base;
69out:
70 spin_unlock_irqrestore(&phb->lock, flags);
71 return rc;
72}
73
74static void pnv_put_msi(struct pnv_phb *phb, unsigned int hwirq)
75{
76 unsigned long flags;
77 unsigned int id;
78
79 if (WARN_ON(hwirq < phb->msi_base ||
80 hwirq >= (phb->msi_base + phb->msi_count)))
81 return;
82 id = hwirq - phb->msi_base;
83
84 spin_lock_irqsave(&phb->lock, flags);
85 __clear_bit(id, phb->msi_map);
86 spin_unlock_irqrestore(&phb->lock, flags);
87} 52}
88 53
89static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 54static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
@@ -92,7 +57,8 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
92 struct pnv_phb *phb = hose->private_data; 57 struct pnv_phb *phb = hose->private_data;
93 struct msi_desc *entry; 58 struct msi_desc *entry;
94 struct msi_msg msg; 59 struct msi_msg msg;
95 unsigned int hwirq, virq; 60 int hwirq;
61 unsigned int virq;
96 int rc; 62 int rc;
97 63
98 if (WARN_ON(!phb)) 64 if (WARN_ON(!phb))
@@ -104,25 +70,25 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
104 pci_name(pdev)); 70 pci_name(pdev));
105 return -ENXIO; 71 return -ENXIO;
106 } 72 }
107 hwirq = pnv_get_one_msi(phb); 73 hwirq = msi_bitmap_alloc_hwirqs(&phb->msi_bmp, 1);
108 if (!hwirq) { 74 if (hwirq < 0) {
109 pr_warn("%s: Failed to find a free MSI\n", 75 pr_warn("%s: Failed to find a free MSI\n",
110 pci_name(pdev)); 76 pci_name(pdev));
111 return -ENOSPC; 77 return -ENOSPC;
112 } 78 }
113 virq = irq_create_mapping(NULL, hwirq); 79 virq = irq_create_mapping(NULL, phb->msi_base + hwirq);
114 if (virq == NO_IRQ) { 80 if (virq == NO_IRQ) {
115 pr_warn("%s: Failed to map MSI to linux irq\n", 81 pr_warn("%s: Failed to map MSI to linux irq\n",
116 pci_name(pdev)); 82 pci_name(pdev));
117 pnv_put_msi(phb, hwirq); 83 msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq, 1);
118 return -ENOMEM; 84 return -ENOMEM;
119 } 85 }
120 rc = phb->msi_setup(phb, pdev, hwirq, entry->msi_attrib.is_64, 86 rc = phb->msi_setup(phb, pdev, phb->msi_base + hwirq,
121 &msg); 87 virq, entry->msi_attrib.is_64, &msg);
122 if (rc) { 88 if (rc) {
123 pr_warn("%s: Failed to setup MSI\n", pci_name(pdev)); 89 pr_warn("%s: Failed to setup MSI\n", pci_name(pdev));
124 irq_dispose_mapping(virq); 90 irq_dispose_mapping(virq);
125 pnv_put_msi(phb, hwirq); 91 msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq, 1);
126 return rc; 92 return rc;
127 } 93 }
128 irq_set_msi_desc(virq, entry); 94 irq_set_msi_desc(virq, entry);
@@ -144,7 +110,8 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev)
144 if (entry->irq == NO_IRQ) 110 if (entry->irq == NO_IRQ)
145 continue; 111 continue;
146 irq_set_msi_desc(entry->irq, NULL); 112 irq_set_msi_desc(entry->irq, NULL);
147 pnv_put_msi(phb, virq_to_hw(entry->irq)); 113 msi_bitmap_free_hwirqs(&phb->msi_bmp,
114 virq_to_hw(entry->irq) - phb->msi_base, 1);
148 irq_dispose_mapping(entry->irq); 115 irq_dispose_mapping(entry->irq);
149 } 116 }
150} 117}
@@ -362,48 +329,6 @@ struct pci_ops pnv_pci_ops = {
362 .write = pnv_pci_write_config, 329 .write = pnv_pci_write_config,
363}; 330};
364 331
365
366static void pnv_tce_invalidate(struct iommu_table *tbl,
367 u64 *startp, u64 *endp)
368{
369 u64 __iomem *invalidate = (u64 __iomem *)tbl->it_index;
370 unsigned long start, end, inc;
371
372 start = __pa(startp);
373 end = __pa(endp);
374
375
376 /* BML uses this case for p6/p7/galaxy2: Shift addr and put in node */
377 if (tbl->it_busno) {
378 start <<= 12;
379 end <<= 12;
380 inc = 128 << 12;
381 start |= tbl->it_busno;
382 end |= tbl->it_busno;
383 }
384 /* p7ioc-style invalidation, 2 TCEs per write */
385 else if (tbl->it_type & TCE_PCI_SWINV_PAIR) {
386 start |= (1ull << 63);
387 end |= (1ull << 63);
388 inc = 16;
389 }
390 /* Default (older HW) */
391 else
392 inc = 128;
393
394 end |= inc - 1; /* round up end to be different than start */
395
396 mb(); /* Ensure above stores are visible */
397 while (start <= end) {
398 __raw_writeq(start, invalidate);
399 start += inc;
400 }
401 /* The iommu layer will do another mb() for us on build() and
402 * we don't care on free()
403 */
404}
405
406
407static int pnv_tce_build(struct iommu_table *tbl, long index, long npages, 332static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
408 unsigned long uaddr, enum dma_data_direction direction, 333 unsigned long uaddr, enum dma_data_direction direction,
409 struct dma_attrs *attrs) 334 struct dma_attrs *attrs)
@@ -428,7 +353,7 @@ static int pnv_tce_build(struct iommu_table *tbl, long index, long npages,
428 * of flags if that becomes the case 353 * of flags if that becomes the case
429 */ 354 */
430 if (tbl->it_type & TCE_PCI_SWINV_CREATE) 355 if (tbl->it_type & TCE_PCI_SWINV_CREATE)
431 pnv_tce_invalidate(tbl, tces, tcep - 1); 356 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1);
432 357
433 return 0; 358 return 0;
434} 359}
@@ -442,8 +367,8 @@ static void pnv_tce_free(struct iommu_table *tbl, long index, long npages)
442 while (npages--) 367 while (npages--)
443 *(tcep++) = 0; 368 *(tcep++) = 0;
444 369
445 if (tbl->it_type & TCE_PCI_SWINV_FREE) 370 if (tbl->it_type & TCE_PCI_SWINV_CREATE)
446 pnv_tce_invalidate(tbl, tces, tcep - 1); 371 pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1);
447} 372}
448 373
449static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) 374static unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
@@ -525,7 +450,7 @@ static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
525 pnv_pci_dma_fallback_setup(hose, pdev); 450 pnv_pci_dma_fallback_setup(hose, pdev);
526} 451}
527 452
528/* Fixup wrong class code in p7ioc root complex */ 453/* Fixup wrong class code in p7ioc and p8 root complex */
529static void pnv_p7ioc_rc_quirk(struct pci_dev *dev) 454static void pnv_p7ioc_rc_quirk(struct pci_dev *dev)
530{ 455{
531 dev->class = PCI_CLASS_BRIDGE_PCI << 8; 456 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
@@ -591,6 +516,10 @@ void __init pnv_pci_init(void)
591 if (!found_ioda) 516 if (!found_ioda)
592 for_each_compatible_node(np, NULL, "ibm,p5ioc2") 517 for_each_compatible_node(np, NULL, "ibm,p5ioc2")
593 pnv_pci_init_p5ioc2_hub(np); 518 pnv_pci_init_p5ioc2_hub(np);
519
520 /* Look for ioda2 built-in PHB3's */
521 for_each_compatible_node(np, NULL, "ibm,ioda2-phb")
522 pnv_pci_init_ioda2_phb(np);
594 } 523 }
595 524
596 /* Setup the linkage between OF nodes and PHBs */ 525 /* Setup the linkage between OF nodes and PHBs */
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 7cfb7c883deb..48dc4bb856a1 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -4,9 +4,9 @@
4struct pci_dn; 4struct pci_dn;
5 5
6enum pnv_phb_type { 6enum pnv_phb_type {
7 PNV_PHB_P5IOC2, 7 PNV_PHB_P5IOC2 = 0,
8 PNV_PHB_IODA1, 8 PNV_PHB_IODA1 = 1,
9 PNV_PHB_IODA2, 9 PNV_PHB_IODA2 = 2,
10}; 10};
11 11
12/* Precise PHB model for error management */ 12/* Precise PHB model for error management */
@@ -14,6 +14,7 @@ enum pnv_phb_model {
14 PNV_PHB_MODEL_UNKNOWN, 14 PNV_PHB_MODEL_UNKNOWN,
15 PNV_PHB_MODEL_P5IOC2, 15 PNV_PHB_MODEL_P5IOC2,
16 PNV_PHB_MODEL_P7IOC, 16 PNV_PHB_MODEL_P7IOC,
17 PNV_PHB_MODEL_PHB3,
17}; 18};
18 19
19#define PNV_PCI_DIAG_BUF_SIZE 4096 20#define PNV_PCI_DIAG_BUF_SIZE 4096
@@ -22,8 +23,10 @@ enum pnv_phb_model {
22#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */ 23#define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */
23 24
24/* Data associated with a PE, including IOMMU tracking etc.. */ 25/* Data associated with a PE, including IOMMU tracking etc.. */
26struct pnv_phb;
25struct pnv_ioda_pe { 27struct pnv_ioda_pe {
26 unsigned long flags; 28 unsigned long flags;
29 struct pnv_phb *phb;
27 30
28 /* A PE can be associated with a single device or an 31 /* A PE can be associated with a single device or an
29 * entire bus (& children). In the former case, pdev 32 * entire bus (& children). In the former case, pdev
@@ -73,15 +76,13 @@ struct pnv_phb {
73 spinlock_t lock; 76 spinlock_t lock;
74 77
75#ifdef CONFIG_PCI_MSI 78#ifdef CONFIG_PCI_MSI
76 unsigned long *msi_map;
77 unsigned int msi_base; 79 unsigned int msi_base;
78 unsigned int msi_count;
79 unsigned int msi_next;
80 unsigned int msi32_support; 80 unsigned int msi32_support;
81 struct msi_bitmap msi_bmp;
81#endif 82#endif
82 int (*msi_setup)(struct pnv_phb *phb, struct pci_dev *dev, 83 int (*msi_setup)(struct pnv_phb *phb, struct pci_dev *dev,
83 unsigned int hwirq, unsigned int is_64, 84 unsigned int hwirq, unsigned int virq,
84 struct msi_msg *msg); 85 unsigned int is_64, struct msi_msg *msg);
85 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev); 86 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev);
86 void (*fixup_phb)(struct pci_controller *hose); 87 void (*fixup_phb)(struct pci_controller *hose);
87 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); 88 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn);
@@ -109,6 +110,10 @@ struct pnv_phb {
109 unsigned int *io_segmap; 110 unsigned int *io_segmap;
110 struct pnv_ioda_pe *pe_array; 111 struct pnv_ioda_pe *pe_array;
111 112
113 /* IRQ chip */
114 int irq_chip_init;
115 struct irq_chip irq_chip;
116
112 /* Sorted list of used PE's based 117 /* Sorted list of used PE's based
113 * on the sequence of creation 118 * on the sequence of creation
114 */ 119 */
@@ -150,6 +155,7 @@ extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
150 u64 dma_offset); 155 u64 dma_offset);
151extern void pnv_pci_init_p5ioc2_hub(struct device_node *np); 156extern void pnv_pci_init_p5ioc2_hub(struct device_node *np);
152extern void pnv_pci_init_ioda_hub(struct device_node *np); 157extern void pnv_pci_init_ioda_hub(struct device_node *np);
153 158extern void pnv_pci_init_ioda2_phb(struct device_node *np);
154 159extern void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
160 u64 *startp, u64 *endp);
155#endif /* __POWERNV_PCI_H */ 161#endif /* __POWERNV_PCI_H */
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 0bdc735db16f..6a3ecca5b725 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -77,9 +77,11 @@ int pnv_smp_kick_cpu(int nr)
77 if (!paca[nr].cpu_start && firmware_has_feature(FW_FEATURE_OPALv2)) { 77 if (!paca[nr].cpu_start && firmware_has_feature(FW_FEATURE_OPALv2)) {
78 pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu); 78 pr_devel("OPAL: Starting CPU %d (HW 0x%x)...\n", nr, pcpu);
79 rc = opal_start_cpu(pcpu, start_here); 79 rc = opal_start_cpu(pcpu, start_here);
80 if (rc != OPAL_SUCCESS) 80 if (rc != OPAL_SUCCESS) {
81 pr_warn("OPAL Error %ld starting CPU %d\n", 81 pr_warn("OPAL Error %ld starting CPU %d\n",
82 rc, nr); 82 rc, nr);
83 return -ENODEV;
84 }
83 } 85 }
84 return smp_generic_kick_cpu(nr); 86 return smp_generic_kick_cpu(nr);
85} 87}
diff --git a/arch/powerpc/platforms/prep/Kconfig b/arch/powerpc/platforms/prep/Kconfig
deleted file mode 100644
index 1547f66235d9..000000000000
--- a/arch/powerpc/platforms/prep/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1config PPC_PREP
2 bool "PowerPC Reference Platform (PReP) based machines"
3 depends on 6xx && BROKEN
4 select HAVE_PCSPKR_PLATFORM
5 select MPIC
6 select PPC_I8259
7 select PPC_INDIRECT_PCI
8 select PPC_UDBG_16550
9 select PPC_NATIVE
10 default n
11
12config PREP_RESIDUAL
13 bool "Support for PReP Residual Data"
14 depends on PPC_PREP
15 help
16 Some PReP systems have residual data passed to the kernel by the
17 firmware. This allows detection of memory size, devices present and
18 other useful pieces of information. Sometimes this information is
19 not present or incorrect, in which case it could lead to the machine
20 behaving incorrectly. If this happens, either disable PREP_RESIDUAL
21 or pass the 'noresidual' option to the kernel.
22
23 If you are running a PReP system, say Y here, otherwise say N.
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 6cc58201db8c..177a2f70700c 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -46,7 +46,7 @@ static DEFINE_SPINLOCK(ps3_htab_lock);
46 46
47static long ps3_hpte_insert(unsigned long hpte_group, unsigned long vpn, 47static long ps3_hpte_insert(unsigned long hpte_group, unsigned long vpn,
48 unsigned long pa, unsigned long rflags, unsigned long vflags, 48 unsigned long pa, unsigned long rflags, unsigned long vflags,
49 int psize, int ssize) 49 int psize, int apsize, int ssize)
50{ 50{
51 int result; 51 int result;
52 u64 hpte_v, hpte_r; 52 u64 hpte_v, hpte_r;
@@ -62,8 +62,8 @@ static long ps3_hpte_insert(unsigned long hpte_group, unsigned long vpn,
62 */ 62 */
63 vflags &= ~HPTE_V_SECONDARY; 63 vflags &= ~HPTE_V_SECONDARY;
64 64
65 hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; 65 hpte_v = hpte_encode_v(vpn, psize, apsize, ssize) | vflags | HPTE_V_VALID;
66 hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags; 66 hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize, apsize) | rflags;
67 67
68 spin_lock_irqsave(&ps3_htab_lock, flags); 68 spin_lock_irqsave(&ps3_htab_lock, flags);
69 69
@@ -117,7 +117,7 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
117 unsigned long flags; 117 unsigned long flags;
118 long ret; 118 long ret;
119 119
120 want_v = hpte_encode_v(vpn, psize, ssize); 120 want_v = hpte_encode_avpn(vpn, psize, ssize);
121 121
122 spin_lock_irqsave(&ps3_htab_lock, flags); 122 spin_lock_irqsave(&ps3_htab_lock, flags);
123 123
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index 40b5cb433005..cba1e6be68e5 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -89,10 +89,8 @@ static int __init ps3_rtc_init(void)
89 return -ENODEV; 89 return -ENODEV;
90 90
91 pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0); 91 pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
92 if (IS_ERR(pdev))
93 return PTR_ERR(pdev);
94 92
95 return 0; 93 return PTR_RET(pdev);
96} 94}
97 95
98module_init(ps3_rtc_init); 96module_init(ps3_rtc_init);
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index aa3693f7fb27..8c80588abacc 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -28,18 +28,18 @@
28 28
29#include "pseries.h" 29#include "pseries.h"
30 30
31typedef struct { 31struct hypertas_fw_feature {
32 unsigned long val; 32 unsigned long val;
33 char * name; 33 char * name;
34} firmware_feature_t; 34};
35 35
36/* 36/*
37 * The names in this table match names in rtas/ibm,hypertas-functions. If the 37 * The names in this table match names in rtas/ibm,hypertas-functions. If the
38 * entry ends in a '*', only upto the '*' is matched. Otherwise the entire 38 * entry ends in a '*', only upto the '*' is matched. Otherwise the entire
39 * string must match. 39 * string must match.
40 */ 40 */
41static __initdata firmware_feature_t 41static __initdata struct hypertas_fw_feature
42firmware_features_table[FIRMWARE_MAX_FEATURES] = { 42hypertas_fw_features_table[] = {
43 {FW_FEATURE_PFT, "hcall-pft"}, 43 {FW_FEATURE_PFT, "hcall-pft"},
44 {FW_FEATURE_TCE, "hcall-tce"}, 44 {FW_FEATURE_TCE, "hcall-tce"},
45 {FW_FEATURE_SPRG0, "hcall-sprg0"}, 45 {FW_FEATURE_SPRG0, "hcall-sprg0"},
@@ -69,20 +69,18 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
69 * device-tree/ibm,hypertas-functions. Ultimately this functionality may 69 * device-tree/ibm,hypertas-functions. Ultimately this functionality may
70 * be moved into prom.c prom_init(). 70 * be moved into prom.c prom_init().
71 */ 71 */
72void __init fw_feature_init(const char *hypertas, unsigned long len) 72void __init fw_hypertas_feature_init(const char *hypertas, unsigned long len)
73{ 73{
74 const char *s; 74 const char *s;
75 int i; 75 int i;
76 76
77 pr_debug(" -> fw_feature_init()\n"); 77 pr_debug(" -> fw_hypertas_feature_init()\n");
78 78
79 for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { 79 for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
80 for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { 80 for (i = 0; i < ARRAY_SIZE(hypertas_fw_features_table); i++) {
81 const char *name = firmware_features_table[i].name; 81 const char *name = hypertas_fw_features_table[i].name;
82 size_t size; 82 size_t size;
83 /* check value against table of strings */ 83
84 if (!name)
85 continue;
86 /* 84 /*
87 * If there is a '*' at the end of name, only check 85 * If there is a '*' at the end of name, only check
88 * upto there 86 * upto there
@@ -96,10 +94,40 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
96 94
97 /* we have a match */ 95 /* we have a match */
98 powerpc_firmware_features |= 96 powerpc_firmware_features |=
99 firmware_features_table[i].val; 97 hypertas_fw_features_table[i].val;
100 break; 98 break;
101 } 99 }
102 } 100 }
103 101
104 pr_debug(" <- fw_feature_init()\n"); 102 pr_debug(" <- fw_hypertas_feature_init()\n");
103}
104
105struct vec5_fw_feature {
106 unsigned long val;
107 unsigned int feature;
108};
109
110static __initdata struct vec5_fw_feature
111vec5_fw_features_table[] = {
112 {FW_FEATURE_TYPE1_AFFINITY, OV5_TYPE1_AFFINITY},
113 {FW_FEATURE_PRRN, OV5_PRRN},
114};
115
116void __init fw_vec5_feature_init(const char *vec5, unsigned long len)
117{
118 unsigned int index, feat;
119 int i;
120
121 pr_debug(" -> fw_vec5_feature_init()\n");
122
123 for (i = 0; i < ARRAY_SIZE(vec5_fw_features_table); i++) {
124 index = OV5_INDX(vec5_fw_features_table[i].feature);
125 feat = OV5_FEAT(vec5_fw_features_table[i].feature);
126
127 if (vec5[index] & feat)
128 powerpc_firmware_features |=
129 vec5_fw_features_table[i].val;
130 }
131
132 pr_debug(" <- fw_vec5_feature_init()\n");
105} 133}
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 2372c609fa2b..9a432de363b8 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -72,6 +72,7 @@ unsigned long memory_block_size_bytes(void)
72 return get_memblock_size(); 72 return get_memblock_size();
73} 73}
74 74
75#ifdef CONFIG_MEMORY_HOTREMOVE
75static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) 76static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
76{ 77{
77 unsigned long start, start_pfn; 78 unsigned long start, start_pfn;
@@ -153,6 +154,17 @@ static int pseries_remove_memory(struct device_node *np)
153 ret = pseries_remove_memblock(base, lmb_size); 154 ret = pseries_remove_memblock(base, lmb_size);
154 return ret; 155 return ret;
155} 156}
157#else
158static inline int pseries_remove_memblock(unsigned long base,
159 unsigned int memblock_size)
160{
161 return -EOPNOTSUPP;
162}
163static inline int pseries_remove_memory(struct device_node *np)
164{
165 return -EOPNOTSUPP;
166}
167#endif /* CONFIG_MEMORY_HOTREMOVE */
156 168
157static int pseries_add_memory(struct device_node *np) 169static int pseries_add_memory(struct device_node *np)
158{ 170{
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 1b2a174e7c59..86ae364900d6 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -924,6 +924,13 @@ static void restore_default_window(struct pci_dev *dev,
924 __restore_default_window(pci_dev_to_eeh_dev(dev), ddw_restore_token); 924 __restore_default_window(pci_dev_to_eeh_dev(dev), ddw_restore_token);
925} 925}
926 926
927struct failed_ddw_pdn {
928 struct device_node *pdn;
929 struct list_head list;
930};
931
932static LIST_HEAD(failed_ddw_pdn_list);
933
927/* 934/*
928 * If the PE supports dynamic dma windows, and there is space for a table 935 * If the PE supports dynamic dma windows, and there is space for a table
929 * that can map all pages in a linear offset, then setup such a table, 936 * that can map all pages in a linear offset, then setup such a table,
@@ -951,6 +958,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
951 struct dynamic_dma_window_prop *ddwprop; 958 struct dynamic_dma_window_prop *ddwprop;
952 const void *dma_window = NULL; 959 const void *dma_window = NULL;
953 unsigned long liobn, offset, size; 960 unsigned long liobn, offset, size;
961 struct failed_ddw_pdn *fpdn;
954 962
955 mutex_lock(&direct_window_init_mutex); 963 mutex_lock(&direct_window_init_mutex);
956 964
@@ -959,6 +967,18 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
959 goto out_unlock; 967 goto out_unlock;
960 968
961 /* 969 /*
970 * If we already went through this for a previous function of
971 * the same device and failed, we don't want to muck with the
972 * DMA window again, as it will race with in-flight operations
973 * and can lead to EEHs. The above mutex protects access to the
974 * list.
975 */
976 list_for_each_entry(fpdn, &failed_ddw_pdn_list, list) {
977 if (!strcmp(fpdn->pdn->full_name, pdn->full_name))
978 goto out_unlock;
979 }
980
981 /*
962 * the ibm,ddw-applicable property holds the tokens for: 982 * the ibm,ddw-applicable property holds the tokens for:
963 * ibm,query-pe-dma-window 983 * ibm,query-pe-dma-window
964 * ibm,create-pe-dma-window 984 * ibm,create-pe-dma-window
@@ -1114,6 +1134,12 @@ out_restore_window:
1114 if (ddw_restore_token) 1134 if (ddw_restore_token)
1115 restore_default_window(dev, ddw_restore_token); 1135 restore_default_window(dev, ddw_restore_token);
1116 1136
1137 fpdn = kzalloc(sizeof(*fpdn), GFP_KERNEL);
1138 if (!fpdn)
1139 goto out_unlock;
1140 fpdn->pdn = pdn;
1141 list_add(&fpdn->list, &failed_ddw_pdn_list);
1142
1117out_unlock: 1143out_unlock:
1118 mutex_unlock(&direct_window_init_mutex); 1144 mutex_unlock(&direct_window_init_mutex);
1119 return dma_addr; 1145 return dma_addr;
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 299731e9036b..6d62072a7d5a 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -109,7 +109,7 @@ void vpa_init(int cpu)
109static long pSeries_lpar_hpte_insert(unsigned long hpte_group, 109static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
110 unsigned long vpn, unsigned long pa, 110 unsigned long vpn, unsigned long pa,
111 unsigned long rflags, unsigned long vflags, 111 unsigned long rflags, unsigned long vflags,
112 int psize, int ssize) 112 int psize, int apsize, int ssize)
113{ 113{
114 unsigned long lpar_rc; 114 unsigned long lpar_rc;
115 unsigned long flags; 115 unsigned long flags;
@@ -121,8 +121,8 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
121 "pa=%016lx, rflags=%lx, vflags=%lx, psize=%d)\n", 121 "pa=%016lx, rflags=%lx, vflags=%lx, psize=%d)\n",
122 hpte_group, vpn, pa, rflags, vflags, psize); 122 hpte_group, vpn, pa, rflags, vflags, psize);
123 123
124 hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; 124 hpte_v = hpte_encode_v(vpn, psize, apsize, ssize) | vflags | HPTE_V_VALID;
125 hpte_r = hpte_encode_r(pa, psize) | rflags; 125 hpte_r = hpte_encode_r(pa, psize, apsize) | rflags;
126 126
127 if (!(vflags & HPTE_V_BOLTED)) 127 if (!(vflags & HPTE_V_BOLTED))
128 pr_devel(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); 128 pr_devel(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
@@ -155,7 +155,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
155 */ 155 */
156 if (unlikely(lpar_rc != H_SUCCESS)) { 156 if (unlikely(lpar_rc != H_SUCCESS)) {
157 if (!(vflags & HPTE_V_BOLTED)) 157 if (!(vflags & HPTE_V_BOLTED))
158 pr_devel(" lpar err %lu\n", lpar_rc); 158 pr_devel(" lpar err %ld\n", lpar_rc);
159 return -2; 159 return -2;
160 } 160 }
161 if (!(vflags & HPTE_V_BOLTED)) 161 if (!(vflags & HPTE_V_BOLTED))
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 6573808cc5f3..3d01eee9ffb1 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -37,14 +37,16 @@ struct update_props_workarea {
37#define UPDATE_DT_NODE 0x02000000 37#define UPDATE_DT_NODE 0x02000000
38#define ADD_DT_NODE 0x03000000 38#define ADD_DT_NODE 0x03000000
39 39
40static int mobility_rtas_call(int token, char *buf) 40#define MIGRATION_SCOPE (1)
41
42static int mobility_rtas_call(int token, char *buf, s32 scope)
41{ 43{
42 int rc; 44 int rc;
43 45
44 spin_lock(&rtas_data_buf_lock); 46 spin_lock(&rtas_data_buf_lock);
45 47
46 memcpy(rtas_data_buf, buf, RTAS_DATA_BUF_SIZE); 48 memcpy(rtas_data_buf, buf, RTAS_DATA_BUF_SIZE);
47 rc = rtas_call(token, 2, 1, NULL, rtas_data_buf, 1); 49 rc = rtas_call(token, 2, 1, NULL, rtas_data_buf, scope);
48 memcpy(buf, rtas_data_buf, RTAS_DATA_BUF_SIZE); 50 memcpy(buf, rtas_data_buf, RTAS_DATA_BUF_SIZE);
49 51
50 spin_unlock(&rtas_data_buf_lock); 52 spin_unlock(&rtas_data_buf_lock);
@@ -123,7 +125,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
123 return 0; 125 return 0;
124} 126}
125 127
126static int update_dt_node(u32 phandle) 128static int update_dt_node(u32 phandle, s32 scope)
127{ 129{
128 struct update_props_workarea *upwa; 130 struct update_props_workarea *upwa;
129 struct device_node *dn; 131 struct device_node *dn;
@@ -132,6 +134,7 @@ static int update_dt_node(u32 phandle)
132 char *prop_data; 134 char *prop_data;
133 char *rtas_buf; 135 char *rtas_buf;
134 int update_properties_token; 136 int update_properties_token;
137 u32 vd;
135 138
136 update_properties_token = rtas_token("ibm,update-properties"); 139 update_properties_token = rtas_token("ibm,update-properties");
137 if (update_properties_token == RTAS_UNKNOWN_SERVICE) 140 if (update_properties_token == RTAS_UNKNOWN_SERVICE)
@@ -151,19 +154,31 @@ static int update_dt_node(u32 phandle)
151 upwa->phandle = phandle; 154 upwa->phandle = phandle;
152 155
153 do { 156 do {
154 rc = mobility_rtas_call(update_properties_token, rtas_buf); 157 rc = mobility_rtas_call(update_properties_token, rtas_buf,
158 scope);
155 if (rc < 0) 159 if (rc < 0)
156 break; 160 break;
157 161
158 prop_data = rtas_buf + sizeof(*upwa); 162 prop_data = rtas_buf + sizeof(*upwa);
159 163
160 for (i = 0; i < upwa->nprops; i++) { 164 /* The first element of the buffer is the path of the node
165 * being updated in the form of a 8 byte string length
166 * followed by the string. Skip past this to get to the
167 * properties being updated.
168 */
169 vd = *prop_data++;
170 prop_data += vd;
171
172 /* The path we skipped over is counted as one of the elements
173 * returned so start counting at one.
174 */
175 for (i = 1; i < upwa->nprops; i++) {
161 char *prop_name; 176 char *prop_name;
162 u32 vd;
163 177
164 prop_name = prop_data + 1; 178 prop_name = prop_data;
165 prop_data += strlen(prop_name) + 1; 179 prop_data += strlen(prop_name) + 1;
166 vd = *prop_data++; 180 vd = *(u32 *)prop_data;
181 prop_data += sizeof(vd);
167 182
168 switch (vd) { 183 switch (vd) {
169 case 0x00000000: 184 case 0x00000000:
@@ -219,7 +234,7 @@ static int add_dt_node(u32 parent_phandle, u32 drc_index)
219 return rc; 234 return rc;
220} 235}
221 236
222static int pseries_devicetree_update(void) 237int pseries_devicetree_update(s32 scope)
223{ 238{
224 char *rtas_buf; 239 char *rtas_buf;
225 u32 *data; 240 u32 *data;
@@ -235,7 +250,7 @@ static int pseries_devicetree_update(void)
235 return -ENOMEM; 250 return -ENOMEM;
236 251
237 do { 252 do {
238 rc = mobility_rtas_call(update_nodes_token, rtas_buf); 253 rc = mobility_rtas_call(update_nodes_token, rtas_buf, scope);
239 if (rc && rc != 1) 254 if (rc && rc != 1)
240 break; 255 break;
241 256
@@ -256,7 +271,7 @@ static int pseries_devicetree_update(void)
256 delete_dt_node(phandle); 271 delete_dt_node(phandle);
257 break; 272 break;
258 case UPDATE_DT_NODE: 273 case UPDATE_DT_NODE:
259 update_dt_node(phandle); 274 update_dt_node(phandle, scope);
260 break; 275 break;
261 case ADD_DT_NODE: 276 case ADD_DT_NODE:
262 drc_index = *data++; 277 drc_index = *data++;
@@ -276,7 +291,7 @@ void post_mobility_fixup(void)
276 int rc; 291 int rc;
277 int activate_fw_token; 292 int activate_fw_token;
278 293
279 rc = pseries_devicetree_update(); 294 rc = pseries_devicetree_update(MIGRATION_SCOPE);
280 if (rc) { 295 if (rc) {
281 printk(KERN_ERR "Initial post-mobility device tree update " 296 printk(KERN_ERR "Initial post-mobility device tree update "
282 "failed: %d\n", rc); 297 "failed: %d\n", rc);
@@ -292,7 +307,7 @@ void post_mobility_fixup(void)
292 307
293 rc = rtas_call(activate_fw_token, 0, 1, NULL); 308 rc = rtas_call(activate_fw_token, 0, 1, NULL);
294 if (!rc) { 309 if (!rc) {
295 rc = pseries_devicetree_update(); 310 rc = pseries_devicetree_update(MIGRATION_SCOPE);
296 if (rc) 311 if (rc)
297 printk(KERN_ERR "Secondary post-mobility device tree " 312 printk(KERN_ERR "Secondary post-mobility device tree "
298 "update failed: %d\n", rc); 313 "update failed: %d\n", rc);
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index e5b084723131..420524e6f8c9 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -24,6 +24,7 @@ static int query_token, change_token;
24#define RTAS_RESET_FN 2 24#define RTAS_RESET_FN 2
25#define RTAS_CHANGE_MSI_FN 3 25#define RTAS_CHANGE_MSI_FN 3
26#define RTAS_CHANGE_MSIX_FN 4 26#define RTAS_CHANGE_MSIX_FN 4
27#define RTAS_CHANGE_32MSI_FN 5
27 28
28static struct pci_dn *get_pdn(struct pci_dev *pdev) 29static struct pci_dn *get_pdn(struct pci_dev *pdev)
29{ 30{
@@ -58,7 +59,8 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs)
58 59
59 seq_num = 1; 60 seq_num = 1;
60 do { 61 do {
61 if (func == RTAS_CHANGE_MSI_FN || func == RTAS_CHANGE_MSIX_FN) 62 if (func == RTAS_CHANGE_MSI_FN || func == RTAS_CHANGE_MSIX_FN ||
63 func == RTAS_CHANGE_32MSI_FN)
62 rc = rtas_call(change_token, 6, 4, rtas_ret, addr, 64 rc = rtas_call(change_token, 6, 4, rtas_ret, addr,
63 BUID_HI(buid), BUID_LO(buid), 65 BUID_HI(buid), BUID_LO(buid),
64 func, num_irqs, seq_num); 66 func, num_irqs, seq_num);
@@ -426,9 +428,12 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
426 */ 428 */
427again: 429again:
428 if (type == PCI_CAP_ID_MSI) { 430 if (type == PCI_CAP_ID_MSI) {
429 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); 431 if (pdn->force_32bit_msi)
432 rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec);
433 else
434 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec);
430 435
431 if (rc < 0) { 436 if (rc < 0 && !pdn->force_32bit_msi) {
432 pr_debug("rtas_msi: trying the old firmware call.\n"); 437 pr_debug("rtas_msi: trying the old firmware call.\n");
433 rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); 438 rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec);
434 } 439 }
@@ -512,3 +517,13 @@ static int rtas_msi_init(void)
512 return 0; 517 return 0;
513} 518}
514arch_initcall(rtas_msi_init); 519arch_initcall(rtas_msi_init);
520
521static void quirk_radeon(struct pci_dev *dev)
522{
523 struct pci_dn *pdn = get_pdn(dev);
524
525 if (pdn)
526 pdn->force_32bit_msi = 1;
527}
528DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon);
529DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon);
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 0b580f413a9a..5f93856cdf47 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -108,3 +108,56 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
108} 108}
109DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, 109DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
110 fixup_winbond_82c105); 110 fixup_winbond_82c105);
111
112int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
113{
114 struct device_node *dn, *pdn;
115 struct pci_bus *bus;
116 const uint32_t *pcie_link_speed_stats;
117
118 bus = bridge->bus;
119
120 dn = pcibios_get_phb_of_node(bus);
121 if (!dn)
122 return 0;
123
124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
125 pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn,
126 "ibm,pcie-link-speed-stats", NULL);
127 if (pcie_link_speed_stats)
128 break;
129 }
130
131 of_node_put(pdn);
132
133 if (!pcie_link_speed_stats) {
134 pr_err("no ibm,pcie-link-speed-stats property\n");
135 return 0;
136 }
137
138 switch (pcie_link_speed_stats[0]) {
139 case 0x01:
140 bus->max_bus_speed = PCIE_SPEED_2_5GT;
141 break;
142 case 0x02:
143 bus->max_bus_speed = PCIE_SPEED_5_0GT;
144 break;
145 default:
146 bus->max_bus_speed = PCI_SPEED_UNKNOWN;
147 break;
148 }
149
150 switch (pcie_link_speed_stats[1]) {
151 case 0x01:
152 bus->cur_bus_speed = PCIE_SPEED_2_5GT;
153 break;
154 case 0x02:
155 bus->cur_bus_speed = PCIE_SPEED_5_0GT;
156 break;
157 default:
158 bus->cur_bus_speed = PCI_SPEED_UNKNOWN;
159 break;
160 }
161
162 return 0;
163}
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index f368668d97b3..f35787b6a5e0 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -58,40 +58,39 @@ static inline long extended_cede_processor(unsigned long latency_hint)
58static inline long vpa_call(unsigned long flags, unsigned long cpu, 58static inline long vpa_call(unsigned long flags, unsigned long cpu,
59 unsigned long vpa) 59 unsigned long vpa)
60{ 60{
61 /* flags are in bits 16-18 (counting from most significant bit) */ 61 flags = flags << H_VPA_FUNC_SHIFT;
62 flags = flags << (63 - 18);
63 62
64 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa); 63 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
65} 64}
66 65
67static inline long unregister_vpa(unsigned long cpu) 66static inline long unregister_vpa(unsigned long cpu)
68{ 67{
69 return vpa_call(0x5, cpu, 0); 68 return vpa_call(H_VPA_DEREG_VPA, cpu, 0);
70} 69}
71 70
72static inline long register_vpa(unsigned long cpu, unsigned long vpa) 71static inline long register_vpa(unsigned long cpu, unsigned long vpa)
73{ 72{
74 return vpa_call(0x1, cpu, vpa); 73 return vpa_call(H_VPA_REG_VPA, cpu, vpa);
75} 74}
76 75
77static inline long unregister_slb_shadow(unsigned long cpu) 76static inline long unregister_slb_shadow(unsigned long cpu)
78{ 77{
79 return vpa_call(0x7, cpu, 0); 78 return vpa_call(H_VPA_DEREG_SLB, cpu, 0);
80} 79}
81 80
82static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa) 81static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
83{ 82{
84 return vpa_call(0x3, cpu, vpa); 83 return vpa_call(H_VPA_REG_SLB, cpu, vpa);
85} 84}
86 85
87static inline long unregister_dtl(unsigned long cpu) 86static inline long unregister_dtl(unsigned long cpu)
88{ 87{
89 return vpa_call(0x6, cpu, 0); 88 return vpa_call(H_VPA_DEREG_DTL, cpu, 0);
90} 89}
91 90
92static inline long register_dtl(unsigned long cpu, unsigned long vpa) 91static inline long register_dtl(unsigned long cpu, unsigned long vpa)
93{ 92{
94 return vpa_call(0x2, cpu, vpa); 93 return vpa_call(H_VPA_REG_DTL, cpu, vpa);
95} 94}
96 95
97static inline long plpar_page_set_loaned(unsigned long vpa) 96static inline long plpar_page_set_loaned(unsigned long vpa)
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 4d806b419606..4644efa06941 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -23,8 +23,8 @@
23#include "pseries.h" 23#include "pseries.h"
24 24
25struct cpuidle_driver pseries_idle_driver = { 25struct cpuidle_driver pseries_idle_driver = {
26 .name = "pseries_idle", 26 .name = "pseries_idle",
27 .owner = THIS_MODULE, 27 .owner = THIS_MODULE,
28}; 28};
29 29
30#define MAX_IDLE_STATE_COUNT 2 30#define MAX_IDLE_STATE_COUNT 2
@@ -33,10 +33,8 @@ static int max_idle_state = MAX_IDLE_STATE_COUNT - 1;
33static struct cpuidle_device __percpu *pseries_cpuidle_devices; 33static struct cpuidle_device __percpu *pseries_cpuidle_devices;
34static struct cpuidle_state *cpuidle_state_table; 34static struct cpuidle_state *cpuidle_state_table;
35 35
36static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) 36static inline void idle_loop_prolog(unsigned long *in_purr)
37{ 37{
38
39 *kt_before = ktime_get();
40 *in_purr = mfspr(SPRN_PURR); 38 *in_purr = mfspr(SPRN_PURR);
41 /* 39 /*
42 * Indicate to the HV that we are idle. Now would be 40 * Indicate to the HV that we are idle. Now would be
@@ -45,12 +43,10 @@ static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
45 get_lppaca()->idle = 1; 43 get_lppaca()->idle = 1;
46} 44}
47 45
48static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before) 46static inline void idle_loop_epilog(unsigned long in_purr)
49{ 47{
50 get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr; 48 get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
51 get_lppaca()->idle = 0; 49 get_lppaca()->idle = 0;
52
53 return ktime_to_us(ktime_sub(ktime_get(), kt_before));
54} 50}
55 51
56static int snooze_loop(struct cpuidle_device *dev, 52static int snooze_loop(struct cpuidle_device *dev,
@@ -58,10 +54,9 @@ static int snooze_loop(struct cpuidle_device *dev,
58 int index) 54 int index)
59{ 55{
60 unsigned long in_purr; 56 unsigned long in_purr;
61 ktime_t kt_before;
62 int cpu = dev->cpu; 57 int cpu = dev->cpu;
63 58
64 idle_loop_prolog(&in_purr, &kt_before); 59 idle_loop_prolog(&in_purr);
65 local_irq_enable(); 60 local_irq_enable();
66 set_thread_flag(TIF_POLLING_NRFLAG); 61 set_thread_flag(TIF_POLLING_NRFLAG);
67 62
@@ -75,8 +70,8 @@ static int snooze_loop(struct cpuidle_device *dev,
75 clear_thread_flag(TIF_POLLING_NRFLAG); 70 clear_thread_flag(TIF_POLLING_NRFLAG);
76 smp_mb(); 71 smp_mb();
77 72
78 dev->last_residency = 73 idle_loop_epilog(in_purr);
79 (int)idle_loop_epilog(in_purr, kt_before); 74
80 return index; 75 return index;
81} 76}
82 77
@@ -102,9 +97,8 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
102 int index) 97 int index)
103{ 98{
104 unsigned long in_purr; 99 unsigned long in_purr;
105 ktime_t kt_before;
106 100
107 idle_loop_prolog(&in_purr, &kt_before); 101 idle_loop_prolog(&in_purr);
108 get_lppaca()->donate_dedicated_cpu = 1; 102 get_lppaca()->donate_dedicated_cpu = 1;
109 103
110 ppc64_runlatch_off(); 104 ppc64_runlatch_off();
@@ -112,8 +106,9 @@ static int dedicated_cede_loop(struct cpuidle_device *dev,
112 check_and_cede_processor(); 106 check_and_cede_processor();
113 107
114 get_lppaca()->donate_dedicated_cpu = 0; 108 get_lppaca()->donate_dedicated_cpu = 0;
115 dev->last_residency = 109
116 (int)idle_loop_epilog(in_purr, kt_before); 110 idle_loop_epilog(in_purr);
111
117 return index; 112 return index;
118} 113}
119 114
@@ -122,9 +117,8 @@ static int shared_cede_loop(struct cpuidle_device *dev,
122 int index) 117 int index)
123{ 118{
124 unsigned long in_purr; 119 unsigned long in_purr;
125 ktime_t kt_before;
126 120
127 idle_loop_prolog(&in_purr, &kt_before); 121 idle_loop_prolog(&in_purr);
128 122
129 /* 123 /*
130 * Yield the processor to the hypervisor. We return if 124 * Yield the processor to the hypervisor. We return if
@@ -135,8 +129,8 @@ static int shared_cede_loop(struct cpuidle_device *dev,
135 */ 129 */
136 check_and_cede_processor(); 130 check_and_cede_processor();
137 131
138 dev->last_residency = 132 idle_loop_epilog(in_purr);
139 (int)idle_loop_epilog(in_purr, kt_before); 133
140 return index; 134 return index;
141} 135}
142 136
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 9a3dda07566f..c2a3a258001c 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -19,7 +19,10 @@ extern void request_event_sources_irqs(struct device_node *np,
19 19
20#include <linux/of.h> 20#include <linux/of.h>
21 21
22extern void __init fw_feature_init(const char *hypertas, unsigned long len); 22extern void __init fw_hypertas_feature_init(const char *hypertas,
23 unsigned long len);
24extern void __init fw_vec5_feature_init(const char *hypertas,
25 unsigned long len);
23 26
24struct pt_regs; 27struct pt_regs;
25 28
@@ -60,4 +63,8 @@ extern int dlpar_detach_node(struct device_node *);
60/* Snooze Delay, pseries_idle */ 63/* Snooze Delay, pseries_idle */
61DECLARE_PER_CPU(long, smt_snooze_delay); 64DECLARE_PER_CPU(long, smt_snooze_delay);
62 65
66/* PCI root bridge prepare function override for pseries */
67struct pci_host_bridge;
68int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
69
63#endif /* _PSERIES_PSERIES_H */ 70#endif /* _PSERIES_PSERIES_H */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index d6491bd481d0..f93cdf55628c 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)
452 452
453 ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops); 453 ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
454 if (ent) 454 if (ent)
455 ent->size = 0; 455 proc_set_size(ent, 0);
456 456
457 return 0; 457 return 0;
458} 458}
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 47f3cda2a68b..b502ab61aafa 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -41,13 +41,12 @@
41 41
42 42
43static unsigned int ibm_scan_log_dump; /* RTAS token */ 43static unsigned int ibm_scan_log_dump; /* RTAS token */
44static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */ 44static unsigned int *scanlog_buffer; /* The data buffer */
45 45
46static ssize_t scanlog_read(struct file *file, char __user *buf, 46static ssize_t scanlog_read(struct file *file, char __user *buf,
47 size_t count, loff_t *ppos) 47 size_t count, loff_t *ppos)
48{ 48{
49 struct proc_dir_entry *dp = PDE(file_inode(file)); 49 unsigned int *data = scanlog_buffer;
50 unsigned int *data = (unsigned int *)dp->data;
51 int status; 50 int status;
52 unsigned long len, off; 51 unsigned long len, off;
53 unsigned int wait_time; 52 unsigned int wait_time;
@@ -135,8 +134,7 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,
135 134
136static int scanlog_open(struct inode * inode, struct file * file) 135static int scanlog_open(struct inode * inode, struct file * file)
137{ 136{
138 struct proc_dir_entry *dp = PDE(inode); 137 unsigned int *data = scanlog_buffer;
139 unsigned int *data = (unsigned int *)dp->data;
140 138
141 if (data[0] != 0) { 139 if (data[0] != 0) {
142 /* This imperfect test stops a second copy of the 140 /* This imperfect test stops a second copy of the
@@ -152,11 +150,9 @@ static int scanlog_open(struct inode * inode, struct file * file)
152 150
153static int scanlog_release(struct inode * inode, struct file * file) 151static int scanlog_release(struct inode * inode, struct file * file)
154{ 152{
155 struct proc_dir_entry *dp = PDE(inode); 153 unsigned int *data = scanlog_buffer;
156 unsigned int *data = (unsigned int *)dp->data;
157 154
158 data[0] = 0; 155 data[0] = 0;
159
160 return 0; 156 return 0;
161} 157}
162 158
@@ -172,7 +168,6 @@ const struct file_operations scanlog_fops = {
172static int __init scanlog_init(void) 168static int __init scanlog_init(void)
173{ 169{
174 struct proc_dir_entry *ent; 170 struct proc_dir_entry *ent;
175 void *data;
176 int err = -ENOMEM; 171 int err = -ENOMEM;
177 172
178 ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); 173 ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
@@ -180,29 +175,24 @@ static int __init scanlog_init(void)
180 return -ENODEV; 175 return -ENODEV;
181 176
182 /* Ideally we could allocate a buffer < 4G */ 177 /* Ideally we could allocate a buffer < 4G */
183 data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); 178 scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
184 if (!data) 179 if (!scanlog_buffer)
185 goto err; 180 goto err;
186 181
187 ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL, 182 ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
188 &scanlog_fops, data); 183 &scanlog_fops);
189 if (!ent) 184 if (!ent)
190 goto err; 185 goto err;
191
192 proc_ppc64_scan_log_dump = ent;
193
194 return 0; 186 return 0;
195err: 187err:
196 kfree(data); 188 kfree(scanlog_buffer);
197 return err; 189 return err;
198} 190}
199 191
200static void __exit scanlog_cleanup(void) 192static void __exit scanlog_cleanup(void)
201{ 193{
202 if (proc_ppc64_scan_log_dump) { 194 remove_proc_entry("powerpc/rtas/scan-log-dump", NULL);
203 kfree(proc_ppc64_scan_log_dump->data); 195 kfree(scanlog_buffer);
204 remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent);
205 }
206} 196}
207 197
208module_init(scanlog_init); 198module_init(scanlog_init);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 8bcc9ca6682f..c11c8238797c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -466,6 +466,8 @@ static void __init pSeries_setup_arch(void)
466 else 466 else
467 ppc_md.enable_pmcs = power4_enable_pmcs; 467 ppc_md.enable_pmcs = power4_enable_pmcs;
468 468
469 ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
470
469 if (firmware_has_feature(FW_FEATURE_SET_MODE)) { 471 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
470 long rc; 472 long rc;
471 if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) { 473 if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) {
@@ -628,25 +630,39 @@ static void __init pSeries_init_early(void)
628 * Called very early, MMU is off, device-tree isn't unflattened 630 * Called very early, MMU is off, device-tree isn't unflattened
629 */ 631 */
630 632
631static int __init pSeries_probe_hypertas(unsigned long node, 633static int __init pseries_probe_fw_features(unsigned long node,
632 const char *uname, int depth, 634 const char *uname, int depth,
633 void *data) 635 void *data)
634{ 636{
635 const char *hypertas; 637 const char *prop;
636 unsigned long len; 638 unsigned long len;
639 static int hypertas_found;
640 static int vec5_found;
637 641
638 if (depth != 1 || 642 if (depth != 1)
639 (strcmp(uname, "rtas") != 0 && strcmp(uname, "rtas@0") != 0))
640 return 0; 643 return 0;
641 644
642 hypertas = of_get_flat_dt_prop(node, "ibm,hypertas-functions", &len); 645 if (!strcmp(uname, "rtas") || !strcmp(uname, "rtas@0")) {
643 if (!hypertas) 646 prop = of_get_flat_dt_prop(node, "ibm,hypertas-functions",
644 return 1; 647 &len);
648 if (prop) {
649 powerpc_firmware_features |= FW_FEATURE_LPAR;
650 fw_hypertas_feature_init(prop, len);
651 }
645 652
646 powerpc_firmware_features |= FW_FEATURE_LPAR; 653 hypertas_found = 1;
647 fw_feature_init(hypertas, len); 654 }
648 655
649 return 1; 656 if (!strcmp(uname, "chosen")) {
657 prop = of_get_flat_dt_prop(node, "ibm,architecture-vec-5",
658 &len);
659 if (prop)
660 fw_vec5_feature_init(prop, len);
661
662 vec5_found = 1;
663 }
664
665 return hypertas_found && vec5_found;
650} 666}
651 667
652static int __init pSeries_probe(void) 668static int __init pSeries_probe(void)
@@ -669,7 +685,7 @@ static int __init pSeries_probe(void)
669 pr_debug("pSeries detected, looking for LPAR capability...\n"); 685 pr_debug("pSeries detected, looking for LPAR capability...\n");
670 686
671 /* Now try to figure out if we are running on LPAR */ 687 /* Now try to figure out if we are running on LPAR */
672 of_scan_flat_dt(pSeries_probe_hypertas, NULL); 688 of_scan_flat_dt(pseries_probe_fw_features, NULL);
673 689
674 if (firmware_has_feature(FW_FEATURE_LPAR)) 690 if (firmware_has_feature(FW_FEATURE_LPAR))
675 hpte_init_lpar(); 691 hpte_init_lpar();
diff --git a/arch/powerpc/platforms/wsp/Kconfig b/arch/powerpc/platforms/wsp/Kconfig
index 79d2225b7608..422a175b10ee 100644
--- a/arch/powerpc/platforms/wsp/Kconfig
+++ b/arch/powerpc/platforms/wsp/Kconfig
@@ -9,7 +9,6 @@ config PPC_WSP
9 select PCI 9 select PCI
10 select PPC_IO_WORKAROUNDS if PCI 10 select PPC_IO_WORKAROUNDS if PCI
11 select PPC_INDIRECT_PIO if PCI 11 select PPC_INDIRECT_PIO if PCI
12 select PPC_WSP_COPRO
13 default n 12 default n
14 13
15menu "WSP platform selection" 14menu "WSP platform selection"
@@ -29,7 +28,3 @@ config PPC_CHROMA
29 default y 28 default y
30 29
31endmenu 30endmenu
32
33config PPC_A2_DD2
34 bool "Support for DD2 based A2/WSP systems"
35 depends on PPC_A2
diff --git a/arch/powerpc/platforms/wsp/wsp_pci.c b/arch/powerpc/platforms/wsp/wsp_pci.c
index 8e22f561d171..62cb527493e7 100644
--- a/arch/powerpc/platforms/wsp/wsp_pci.c
+++ b/arch/powerpc/platforms/wsp/wsp_pci.c
@@ -502,7 +502,7 @@ static void __init wsp_pcie_configure_hw(struct pci_controller *hose)
502 (~(hose->mem_resources[0].end - 502 (~(hose->mem_resources[0].end -
503 hose->mem_resources[0].start)) & 0x3ffffff0000ul); 503 hose->mem_resources[0].start)) & 0x3ffffff0000ul);
504 out_be64(hose->cfg_data + PCIE_REG_M32A_START_ADDR, 504 out_be64(hose->cfg_data + PCIE_REG_M32A_START_ADDR,
505 (hose->mem_resources[0].start - hose->pci_mem_offset) | 1); 505 (hose->mem_resources[0].start - hose->mem_offset[0]) | 1);
506 506
507 /* Clear all TVT entries 507 /* Clear all TVT entries
508 * 508 *
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index a84fecf63c4d..ab4cb5476472 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -19,6 +19,7 @@ config PPC_MSI_BITMAP
19 default y if MPIC 19 default y if MPIC
20 default y if FSL_PCI 20 default y if FSL_PCI
21 default y if PPC4xx_MSI 21 default y if PPC4xx_MSI
22 default y if POWERNV_MSI
22 23
23source "arch/powerpc/sysdev/xics/Kconfig" 24source "arch/powerpc/sysdev/xics/Kconfig"
24 25
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 178c99427b1c..ab02db3d02d8 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -333,6 +333,8 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
333 return 0; 333 return 0;
334} 334}
335 335
336static struct lock_class_key fsl_msi_irq_class;
337
336static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, 338static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
337 int offset, int irq_index) 339 int offset, int irq_index)
338{ 340{
@@ -351,7 +353,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
351 dev_err(&dev->dev, "No memory for MSI cascade data\n"); 353 dev_err(&dev->dev, "No memory for MSI cascade data\n");
352 return -ENOMEM; 354 return -ENOMEM;
353 } 355 }
354 356 irq_set_lockdep_class(virt_msir, &fsl_msi_irq_class);
355 msi->msi_virqs[irq_index] = virt_msir; 357 msi->msi_virqs[irq_index] = virt_msir;
356 cascade_data->index = offset; 358 cascade_data->index = offset;
357 cascade_data->msi_data = msi; 359 cascade_data->msi_data = msi;
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 682084dba19b..028ac1f71b51 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -54,16 +54,63 @@ static void quirk_fsl_pcie_header(struct pci_dev *dev)
54 return; 54 return;
55} 55}
56 56
57static int __init fsl_pcie_check_link(struct pci_controller *hose) 57static int fsl_indirect_read_config(struct pci_bus *, unsigned int,
58 int, int, u32 *);
59
60static int fsl_pcie_check_link(struct pci_controller *hose)
58{ 61{
59 u32 val; 62 u32 val = 0;
63
64 if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
65 if (hose->ops->read == fsl_indirect_read_config) {
66 struct pci_bus bus;
67 bus.number = 0;
68 bus.sysdata = hose;
69 bus.ops = hose->ops;
70 indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
71 } else
72 early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val);
73 if (val < PCIE_LTSSM_L0)
74 return 1;
75 } else {
76 struct ccsr_pci __iomem *pci = hose->private_data;
77 /* for PCIe IP rev 3.0 or greater use CSR0 for link state */
78 val = (in_be32(&pci->pex_csr0) & PEX_CSR0_LTSSM_MASK)
79 >> PEX_CSR0_LTSSM_SHIFT;
80 if (val != PEX_CSR0_LTSSM_L0)
81 return 1;
82 }
60 83
61 early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val);
62 if (val < PCIE_LTSSM_L0)
63 return 1;
64 return 0; 84 return 0;
65} 85}
66 86
87static int fsl_indirect_read_config(struct pci_bus *bus, unsigned int devfn,
88 int offset, int len, u32 *val)
89{
90 struct pci_controller *hose = pci_bus_to_host(bus);
91
92 if (fsl_pcie_check_link(hose))
93 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
94 else
95 hose->indirect_type &= ~PPC_INDIRECT_TYPE_NO_PCIE_LINK;
96
97 return indirect_read_config(bus, devfn, offset, len, val);
98}
99
100static struct pci_ops fsl_indirect_pci_ops =
101{
102 .read = fsl_indirect_read_config,
103 .write = indirect_write_config,
104};
105
106static void __init fsl_setup_indirect_pci(struct pci_controller* hose,
107 resource_size_t cfg_addr,
108 resource_size_t cfg_data, u32 flags)
109{
110 setup_indirect_pci(hose, cfg_addr, cfg_data, flags);
111 hose->ops = &fsl_indirect_pci_ops;
112}
113
67#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx) 114#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
68 115
69#define MAX_PHYS_ADDR_BITS 40 116#define MAX_PHYS_ADDR_BITS 40
@@ -106,7 +153,7 @@ static int setup_one_atmu(struct ccsr_pci __iomem *pci,
106 flags |= 0x10000000; /* enable relaxed ordering */ 153 flags |= 0x10000000; /* enable relaxed ordering */
107 154
108 for (i = 0; size > 0; i++) { 155 for (i = 0; size > 0; i++) {
109 unsigned int bits = min(__ilog2(size), 156 unsigned int bits = min(ilog2(size),
110 __ffs(pci_addr | phys_addr)); 157 __ffs(pci_addr | phys_addr));
111 158
112 if (index + i >= 5) 159 if (index + i >= 5)
@@ -126,13 +173,12 @@ static int setup_one_atmu(struct ccsr_pci __iomem *pci,
126} 173}
127 174
128/* atmu setup for fsl pci/pcie controller */ 175/* atmu setup for fsl pci/pcie controller */
129static void setup_pci_atmu(struct pci_controller *hose, 176static void setup_pci_atmu(struct pci_controller *hose)
130 struct resource *rsrc)
131{ 177{
132 struct ccsr_pci __iomem *pci; 178 struct ccsr_pci __iomem *pci = hose->private_data;
133 int i, j, n, mem_log, win_idx = 3, start_idx = 1, end_idx = 4; 179 int i, j, n, mem_log, win_idx = 3, start_idx = 1, end_idx = 4;
134 u64 mem, sz, paddr_hi = 0; 180 u64 mem, sz, paddr_hi = 0;
135 u64 paddr_lo = ULLONG_MAX; 181 u64 offset = 0, paddr_lo = ULLONG_MAX;
136 u32 pcicsrbar = 0, pcicsrbar_sz; 182 u32 pcicsrbar = 0, pcicsrbar_sz;
137 u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL | 183 u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL |
138 PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; 184 PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP;
@@ -140,15 +186,6 @@ static void setup_pci_atmu(struct pci_controller *hose,
140 const u64 *reg; 186 const u64 *reg;
141 int len; 187 int len;
142 188
143 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
144 (u64)rsrc->start, (u64)resource_size(rsrc));
145
146 pci = ioremap(rsrc->start, resource_size(rsrc));
147 if (!pci) {
148 dev_err(hose->parent, "Unable to map ATMU registers\n");
149 return;
150 }
151
152 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 189 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
153 if (in_be32(&pci->block_rev1) >= PCIE_IP_REV_2_2) { 190 if (in_be32(&pci->block_rev1) >= PCIE_IP_REV_2_2) {
154 win_idx = 2; 191 win_idx = 2;
@@ -171,8 +208,9 @@ static void setup_pci_atmu(struct pci_controller *hose,
171 paddr_lo = min(paddr_lo, (u64)hose->mem_resources[i].start); 208 paddr_lo = min(paddr_lo, (u64)hose->mem_resources[i].start);
172 paddr_hi = max(paddr_hi, (u64)hose->mem_resources[i].end); 209 paddr_hi = max(paddr_hi, (u64)hose->mem_resources[i].end);
173 210
174 n = setup_one_atmu(pci, j, &hose->mem_resources[i], 211 /* We assume all memory resources have the same offset */
175 hose->pci_mem_offset); 212 offset = hose->mem_offset[i];
213 n = setup_one_atmu(pci, j, &hose->mem_resources[i], offset);
176 214
177 if (n < 0 || j >= 5) { 215 if (n < 0 || j >= 5) {
178 pr_err("Ran out of outbound PCI ATMUs for resource %d!\n", i); 216 pr_err("Ran out of outbound PCI ATMUs for resource %d!\n", i);
@@ -196,23 +234,23 @@ static void setup_pci_atmu(struct pci_controller *hose,
196 out_be32(&pci->pow[j].powbar, (hose->io_base_phys >> 12)); 234 out_be32(&pci->pow[j].powbar, (hose->io_base_phys >> 12));
197 /* Enable, IO R/W */ 235 /* Enable, IO R/W */
198 out_be32(&pci->pow[j].powar, 0x80088000 236 out_be32(&pci->pow[j].powar, 0x80088000
199 | (__ilog2(hose->io_resource.end 237 | (ilog2(hose->io_resource.end
200 - hose->io_resource.start + 1) - 1)); 238 - hose->io_resource.start + 1) - 1));
201 } 239 }
202 } 240 }
203 241
204 /* convert to pci address space */ 242 /* convert to pci address space */
205 paddr_hi -= hose->pci_mem_offset; 243 paddr_hi -= offset;
206 paddr_lo -= hose->pci_mem_offset; 244 paddr_lo -= offset;
207 245
208 if (paddr_hi == paddr_lo) { 246 if (paddr_hi == paddr_lo) {
209 pr_err("%s: No outbound window space\n", name); 247 pr_err("%s: No outbound window space\n", name);
210 goto out; 248 return;
211 } 249 }
212 250
213 if (paddr_lo == 0) { 251 if (paddr_lo == 0) {
214 pr_err("%s: No space for inbound window\n", name); 252 pr_err("%s: No space for inbound window\n", name);
215 goto out; 253 return;
216 } 254 }
217 255
218 /* setup PCSRBAR/PEXCSRBAR */ 256 /* setup PCSRBAR/PEXCSRBAR */
@@ -261,7 +299,7 @@ static void setup_pci_atmu(struct pci_controller *hose,
261 } 299 }
262 300
263 sz = min(mem, paddr_lo); 301 sz = min(mem, paddr_lo);
264 mem_log = __ilog2_u64(sz); 302 mem_log = ilog2(sz);
265 303
266 /* PCIe can overmap inbound & outbound since RX & TX are separated */ 304 /* PCIe can overmap inbound & outbound since RX & TX are separated */
267 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 305 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
@@ -290,7 +328,7 @@ static void setup_pci_atmu(struct pci_controller *hose,
290 * SWIOTLB and access the full range of memory 328 * SWIOTLB and access the full range of memory
291 */ 329 */
292 if (sz != mem) { 330 if (sz != mem) {
293 mem_log = __ilog2_u64(mem); 331 mem_log = ilog2(mem);
294 332
295 /* Size window up if we dont fit in exact power-of-2 */ 333 /* Size window up if we dont fit in exact power-of-2 */
296 if ((1ull << mem_log) != mem) 334 if ((1ull << mem_log) != mem)
@@ -327,7 +365,7 @@ static void setup_pci_atmu(struct pci_controller *hose,
327 sz -= 1ull << mem_log; 365 sz -= 1ull << mem_log;
328 366
329 if (sz) { 367 if (sz) {
330 mem_log = __ilog2_u64(sz); 368 mem_log = ilog2(sz);
331 piwar |= (mem_log - 1); 369 piwar |= (mem_log - 1);
332 370
333 out_be32(&pci->piw[win_idx].pitar, paddr >> 12); 371 out_be32(&pci->piw[win_idx].pitar, paddr >> 12);
@@ -358,9 +396,6 @@ static void setup_pci_atmu(struct pci_controller *hose,
358 pr_info("%s: DMA window size is 0x%llx\n", name, 396 pr_info("%s: DMA window size is 0x%llx\n", name,
359 (u64)hose->dma_window_size); 397 (u64)hose->dma_window_size);
360 } 398 }
361
362out:
363 iounmap(pci);
364} 399}
365 400
366static void __init setup_pci_cmd(struct pci_controller *hose) 401static void __init setup_pci_cmd(struct pci_controller *hose)
@@ -429,6 +464,7 @@ int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
429 const int *bus_range; 464 const int *bus_range;
430 u8 hdr_type, progif; 465 u8 hdr_type, progif;
431 struct device_node *dev; 466 struct device_node *dev;
467 struct ccsr_pci __iomem *pci;
432 468
433 dev = pdev->dev.of_node; 469 dev = pdev->dev.of_node;
434 470
@@ -461,8 +497,18 @@ int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
461 hose->first_busno = bus_range ? bus_range[0] : 0x0; 497 hose->first_busno = bus_range ? bus_range[0] : 0x0;
462 hose->last_busno = bus_range ? bus_range[1] : 0xff; 498 hose->last_busno = bus_range ? bus_range[1] : 0xff;
463 499
464 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4, 500 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n",
465 PPC_INDIRECT_TYPE_BIG_ENDIAN); 501 (u64)rsrc.start, (u64)resource_size(&rsrc));
502
503 pci = hose->private_data = ioremap(rsrc.start, resource_size(&rsrc));
504 if (!hose->private_data)
505 goto no_bridge;
506
507 fsl_setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4,
508 PPC_INDIRECT_TYPE_BIG_ENDIAN);
509
510 if (in_be32(&pci->block_rev1) < PCIE_IP_REV_3_0)
511 hose->indirect_type |= PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK;
466 512
467 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 513 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
468 /* For PCIE read HEADER_TYPE to identify controler mode */ 514 /* For PCIE read HEADER_TYPE to identify controler mode */
@@ -500,11 +546,12 @@ int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
500 pci_process_bridge_OF_ranges(hose, dev, is_primary); 546 pci_process_bridge_OF_ranges(hose, dev, is_primary);
501 547
502 /* Setup PEX window registers */ 548 /* Setup PEX window registers */
503 setup_pci_atmu(hose, &rsrc); 549 setup_pci_atmu(hose);
504 550
505 return 0; 551 return 0;
506 552
507no_bridge: 553no_bridge:
554 iounmap(hose->private_data);
508 /* unmap cfg_data & cfg_addr separately if not on same page */ 555 /* unmap cfg_data & cfg_addr separately if not on same page */
509 if (((unsigned long)hose->cfg_data & PAGE_MASK) != 556 if (((unsigned long)hose->cfg_data & PAGE_MASK) !=
510 ((unsigned long)hose->cfg_addr & PAGE_MASK)) 557 ((unsigned long)hose->cfg_addr & PAGE_MASK))
@@ -681,6 +728,7 @@ static int __init mpc83xx_pcie_setup(struct pci_controller *hose,
681 WARN_ON(hose->dn->data); 728 WARN_ON(hose->dn->data);
682 hose->dn->data = pcie; 729 hose->dn->data = pcie;
683 hose->ops = &mpc83xx_pcie_ops; 730 hose->ops = &mpc83xx_pcie_ops;
731 hose->indirect_type |= PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK;
684 732
685 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAH, 0); 733 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAH, 0);
686 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAL, 0); 734 out_le32(pcie->cfg_type0 + PEX_OUTWIN0_TAL, 0);
@@ -766,8 +814,8 @@ int __init mpc83xx_add_bridge(struct device_node *dev)
766 if (ret) 814 if (ret)
767 goto err0; 815 goto err0;
768 } else { 816 } else {
769 setup_indirect_pci(hose, rsrc_cfg.start, 817 fsl_setup_indirect_pci(hose, rsrc_cfg.start,
770 rsrc_cfg.start + 4, 0); 818 rsrc_cfg.start + 4, 0);
771 } 819 }
772 820
773 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. " 821 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. "
@@ -836,6 +884,7 @@ static const struct of_device_id pci_ids[] = {
836 { .compatible = "fsl,qoriq-pcie-v2.2", }, 884 { .compatible = "fsl,qoriq-pcie-v2.2", },
837 { .compatible = "fsl,qoriq-pcie-v2.3", }, 885 { .compatible = "fsl,qoriq-pcie-v2.3", },
838 { .compatible = "fsl,qoriq-pcie-v2.4", }, 886 { .compatible = "fsl,qoriq-pcie-v2.4", },
887 { .compatible = "fsl,qoriq-pcie-v3.0", },
839 888
840 /* 889 /*
841 * The following entries are for compatibility with older device 890 * The following entries are for compatibility with older device
@@ -927,7 +976,7 @@ static int fsl_pci_resume(struct device *dev)
927 return -ENODEV; 976 return -ENODEV;
928 } 977 }
929 978
930 setup_pci_atmu(hose, &pci_rsrc); 979 setup_pci_atmu(hose);
931 980
932 return 0; 981 return 0;
933} 982}
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index c495c00c8740..72b5625330e2 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -14,9 +14,12 @@
14#ifndef __POWERPC_FSL_PCI_H 14#ifndef __POWERPC_FSL_PCI_H
15#define __POWERPC_FSL_PCI_H 15#define __POWERPC_FSL_PCI_H
16 16
17struct platform_device;
18
17#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ 19#define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */
18#define PCIE_LTSSM_L0 0x16 /* L0 state */ 20#define PCIE_LTSSM_L0 0x16 /* L0 state */
19#define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ 21#define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */
22#define PCIE_IP_REV_3_0 0x02080300 /* PCIE IP block version Rev3.0 */
20#define PIWAR_EN 0x80000000 /* Enable */ 23#define PIWAR_EN 0x80000000 /* Enable */
21#define PIWAR_PF 0x20000000 /* prefetch */ 24#define PIWAR_PF 0x20000000 /* prefetch */
22#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */ 25#define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */
@@ -89,6 +92,16 @@ struct ccsr_pci {
89 __be32 pex_err_cap_r1; /* 0x.e2c - PCIE error capture register 0 */ 92 __be32 pex_err_cap_r1; /* 0x.e2c - PCIE error capture register 0 */
90 __be32 pex_err_cap_r2; /* 0x.e30 - PCIE error capture register 0 */ 93 __be32 pex_err_cap_r2; /* 0x.e30 - PCIE error capture register 0 */
91 __be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture register 0 */ 94 __be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture register 0 */
95 u8 res_e38[200];
96 __be32 pdb_stat; /* 0x.f00 - PCIE Debug Status */
97 u8 res_f04[16];
98 __be32 pex_csr0; /* 0x.f14 - PEX Control/Status register 0*/
99#define PEX_CSR0_LTSSM_MASK 0xFC
100#define PEX_CSR0_LTSSM_SHIFT 2
101#define PEX_CSR0_LTSSM_L0 0x11
102 __be32 pex_csr1; /* 0x.f18 - PEX Control/Status register 1*/
103 u8 res_f1c[228];
104
92}; 105};
93 106
94extern int fsl_add_bridge(struct platform_device *pdev, int is_primary); 107extern int fsl_add_bridge(struct platform_device *pdev, int is_primary);
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index 82fdad885d20..c6c8b526a4f6 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -20,9 +20,8 @@
20#include <asm/pci-bridge.h> 20#include <asm/pci-bridge.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22 22
23static int 23int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
24indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, 24 int offset, int len, u32 *val)
25 int len, u32 *val)
26{ 25{
27 struct pci_controller *hose = pci_bus_to_host(bus); 26 struct pci_controller *hose = pci_bus_to_host(bus);
28 volatile void __iomem *cfg_data; 27 volatile void __iomem *cfg_data;
@@ -78,9 +77,8 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
78 return PCIBIOS_SUCCESSFUL; 77 return PCIBIOS_SUCCESSFUL;
79} 78}
80 79
81static int 80int indirect_write_config(struct pci_bus *bus, unsigned int devfn,
82indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset, 81 int offset, int len, u32 val)
83 int len, u32 val)
84{ 82{
85 struct pci_controller *hose = pci_bus_to_host(bus); 83 struct pci_controller *hose = pci_bus_to_host(bus);
86 volatile void __iomem *cfg_data; 84 volatile void __iomem *cfg_data;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index d30e6a676c89..ee21b5e71aec 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1001,8 +1001,12 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq,
1001 1001
1002 if (hw == mpic->spurious_vec) 1002 if (hw == mpic->spurious_vec)
1003 return -EINVAL; 1003 return -EINVAL;
1004 if (mpic->protected && test_bit(hw, mpic->protected)) 1004 if (mpic->protected && test_bit(hw, mpic->protected)) {
1005 return -EINVAL; 1005 pr_warning("mpic: Mapping of source 0x%x failed, "
1006 "source protected by firmware !\n",\
1007 (unsigned int)hw);
1008 return -EPERM;
1009 }
1006 1010
1007#ifdef CONFIG_SMP 1011#ifdef CONFIG_SMP
1008 else if (hw >= mpic->ipi_vecs[0]) { 1012 else if (hw >= mpic->ipi_vecs[0]) {
@@ -1029,8 +1033,12 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq,
1029 if (mpic_map_error_int(mpic, virq, hw)) 1033 if (mpic_map_error_int(mpic, virq, hw))
1030 return 0; 1034 return 0;
1031 1035
1032 if (hw >= mpic->num_sources) 1036 if (hw >= mpic->num_sources) {
1037 pr_warning("mpic: Mapping of source 0x%x failed, "
1038 "source out of range !\n",\
1039 (unsigned int)hw);
1033 return -EINVAL; 1040 return -EINVAL;
1041 }
1034 1042
1035 mpic_msi_reserve_hwirq(mpic, hw); 1043 mpic_msi_reserve_hwirq(mpic, hw);
1036 1044
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index 56e8b3c3c890..64603a10b863 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -257,6 +257,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose,
257 /* Setup outbound memory windows */ 257 /* Setup outbound memory windows */
258 for (i = j = 0; i < 3; i++) { 258 for (i = j = 0; i < 3; i++) {
259 struct resource *res = &hose->mem_resources[i]; 259 struct resource *res = &hose->mem_resources[i];
260 resource_size_t offset = hose->mem_offset[i];
260 261
261 /* we only care about memory windows */ 262 /* we only care about memory windows */
262 if (!(res->flags & IORESOURCE_MEM)) 263 if (!(res->flags & IORESOURCE_MEM))
@@ -270,7 +271,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose,
270 /* Configure the resource */ 271 /* Configure the resource */
271 if (ppc4xx_setup_one_pci_PMM(hose, reg, 272 if (ppc4xx_setup_one_pci_PMM(hose, reg,
272 res->start, 273 res->start,
273 res->start - hose->pci_mem_offset, 274 res->start - offset,
274 resource_size(res), 275 resource_size(res),
275 res->flags, 276 res->flags,
276 j) == 0) { 277 j) == 0) {
@@ -279,7 +280,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose,
279 /* If the resource PCI address is 0 then we have our 280 /* If the resource PCI address is 0 then we have our
280 * ISA memory hole 281 * ISA memory hole
281 */ 282 */
282 if (res->start == hose->pci_mem_offset) 283 if (res->start == offset)
283 found_isa_hole = 1; 284 found_isa_hole = 1;
284 } 285 }
285 } 286 }
@@ -457,6 +458,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose,
457 /* Setup outbound memory windows */ 458 /* Setup outbound memory windows */
458 for (i = j = 0; i < 3; i++) { 459 for (i = j = 0; i < 3; i++) {
459 struct resource *res = &hose->mem_resources[i]; 460 struct resource *res = &hose->mem_resources[i];
461 resource_size_t offset = hose->mem_offset[i];
460 462
461 /* we only care about memory windows */ 463 /* we only care about memory windows */
462 if (!(res->flags & IORESOURCE_MEM)) 464 if (!(res->flags & IORESOURCE_MEM))
@@ -470,7 +472,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose,
470 /* Configure the resource */ 472 /* Configure the resource */
471 if (ppc4xx_setup_one_pcix_POM(hose, reg, 473 if (ppc4xx_setup_one_pcix_POM(hose, reg,
472 res->start, 474 res->start,
473 res->start - hose->pci_mem_offset, 475 res->start - offset,
474 resource_size(res), 476 resource_size(res),
475 res->flags, 477 res->flags,
476 j) == 0) { 478 j) == 0) {
@@ -479,7 +481,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose,
479 /* If the resource PCI address is 0 then we have our 481 /* If the resource PCI address is 0 then we have our
480 * ISA memory hole 482 * ISA memory hole
481 */ 483 */
482 if (res->start == hose->pci_mem_offset) 484 if (res->start == offset)
483 found_isa_hole = 1; 485 found_isa_hole = 1;
484 } 486 }
485 } 487 }
@@ -1792,6 +1794,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port,
1792 /* Setup outbound memory windows */ 1794 /* Setup outbound memory windows */
1793 for (i = j = 0; i < 3; i++) { 1795 for (i = j = 0; i < 3; i++) {
1794 struct resource *res = &hose->mem_resources[i]; 1796 struct resource *res = &hose->mem_resources[i];
1797 resource_size_t offset = hose->mem_offset[i];
1795 1798
1796 /* we only care about memory windows */ 1799 /* we only care about memory windows */
1797 if (!(res->flags & IORESOURCE_MEM)) 1800 if (!(res->flags & IORESOURCE_MEM))
@@ -1805,7 +1808,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port,
1805 /* Configure the resource */ 1808 /* Configure the resource */
1806 if (ppc4xx_setup_one_pciex_POM(port, hose, mbase, 1809 if (ppc4xx_setup_one_pciex_POM(port, hose, mbase,
1807 res->start, 1810 res->start,
1808 res->start - hose->pci_mem_offset, 1811 res->start - offset,
1809 resource_size(res), 1812 resource_size(res),
1810 res->flags, 1813 res->flags,
1811 j) == 0) { 1814 j) == 0) {
@@ -1814,7 +1817,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port,
1814 /* If the resource PCI address is 0 then we have our 1817 /* If the resource PCI address is 0 then we have our
1815 * ISA memory hole 1818 * ISA memory hole
1816 */ 1819 */
1817 if (res->start == hose->pci_mem_offset) 1820 if (res->start == offset)
1818 found_isa_hole = 1; 1821 found_isa_hole = 1;
1819 } 1822 }
1820 } 1823 }
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/arch/powerpc/sysdev/qe_lib/Kconfig
index 41ac3dfac98e..3c251993bacd 100644
--- a/arch/powerpc/sysdev/qe_lib/Kconfig
+++ b/arch/powerpc/sysdev/qe_lib/Kconfig
@@ -22,6 +22,6 @@ config UCC
22 22
23config QE_USB 23config QE_USB
24 bool 24 bool
25 default y if USB_GADGET_FSL_QE 25 default y if USB_FSL_QE
26 help 26 help
27 QE USB Controller support 27 QE USB Controller support
diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
index 9afba924e94f..af79e1ea74b6 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -62,10 +62,7 @@ static int __init add_rtc(void)
62 pd = platform_device_register_simple("rtc_cmos", -1, 62 pd = platform_device_register_simple("rtc_cmos", -1,
63 &res[0], num_res); 63 &res[0], num_res);
64 64
65 if (IS_ERR(pd)) 65 return PTR_RET(pd);
66 return PTR_ERR(pd);
67
68 return 0;
69} 66}
70fs_initcall(add_rtc); 67fs_initcall(add_rtc);
71 68
diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c
index 48861d3fcd07..7cd728b3b5e4 100644
--- a/arch/powerpc/sysdev/xics/icp-native.c
+++ b/arch/powerpc/sysdev/xics/icp-native.c
@@ -51,6 +51,12 @@ static struct icp_ipl __iomem *icp_native_regs[NR_CPUS];
51static inline unsigned int icp_native_get_xirr(void) 51static inline unsigned int icp_native_get_xirr(void)
52{ 52{
53 int cpu = smp_processor_id(); 53 int cpu = smp_processor_id();
54 unsigned int xirr;
55
56 /* Handled an interrupt latched by KVM */
57 xirr = kvmppc_get_xics_latch();
58 if (xirr)
59 return xirr;
54 60
55 return in_be32(&icp_native_regs[cpu]->xirr.word); 61 return in_be32(&icp_native_regs[cpu]->xirr.word);
56} 62}
@@ -81,7 +87,7 @@ static void icp_native_set_cpu_priority(unsigned char cppr)
81 iosync(); 87 iosync();
82} 88}
83 89
84static void icp_native_eoi(struct irq_data *d) 90void icp_native_eoi(struct irq_data *d)
85{ 91{
86 unsigned int hw_irq = (unsigned int)irqd_to_hwirq(d); 92 unsigned int hw_irq = (unsigned int)irqd_to_hwirq(d);
87 93
@@ -138,6 +144,7 @@ static unsigned int icp_native_get_irq(void)
138 144
139static void icp_native_cause_ipi(int cpu, unsigned long data) 145static void icp_native_cause_ipi(int cpu, unsigned long data)
140{ 146{
147 kvmppc_set_host_ipi(cpu, 1);
141 icp_native_set_qirr(cpu, IPI_PRIORITY); 148 icp_native_set_qirr(cpu, IPI_PRIORITY);
142} 149}
143 150
@@ -151,6 +158,7 @@ static irqreturn_t icp_native_ipi_action(int irq, void *dev_id)
151{ 158{
152 int cpu = smp_processor_id(); 159 int cpu = smp_processor_id();
153 160
161 kvmppc_set_host_ipi(cpu, 0);
154 icp_native_set_qirr(cpu, 0xff); 162 icp_native_set_qirr(cpu, 0xff);
155 163
156 return smp_ipi_demux(); 164 return smp_ipi_demux();
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 13f85defabed..96bf5bd30fbc 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1430,7 +1430,7 @@ static void excprint(struct pt_regs *fp)
1430 printf(" sp: %lx\n", fp->gpr[1]); 1430 printf(" sp: %lx\n", fp->gpr[1]);
1431 printf(" msr: %lx\n", fp->msr); 1431 printf(" msr: %lx\n", fp->msr);
1432 1432
1433 if (trap == 0x300 || trap == 0x380 || trap == 0x600) { 1433 if (trap == 0x300 || trap == 0x380 || trap == 0x600 || trap == 0x200) {
1434 printf(" dar: %lx\n", fp->dar); 1434 printf(" dar: %lx\n", fp->dar);
1435 if (trap != 0x380) 1435 if (trap != 0x380)
1436 printf(" dsisr: %lx\n", fp->dsisr); 1436 printf(" dsisr: %lx\n", fp->dsisr);
@@ -2947,7 +2947,7 @@ static void sysrq_handle_xmon(int key)
2947 2947
2948static struct sysrq_key_op sysrq_xmon_op = { 2948static struct sysrq_key_op sysrq_xmon_op = {
2949 .handler = sysrq_handle_xmon, 2949 .handler = sysrq_handle_xmon,
2950 .help_msg = "Xmon", 2950 .help_msg = "xmon(x)",
2951 .action_msg = "Entering xmon", 2951 .action_msg = "Entering xmon",
2952}; 2952};
2953 2953
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index eb8fb629f00b..2c9789da0e24 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -91,6 +91,7 @@ config S390
91 select ARCH_INLINE_WRITE_UNLOCK_BH 91 select ARCH_INLINE_WRITE_UNLOCK_BH
92 select ARCH_INLINE_WRITE_UNLOCK_IRQ 92 select ARCH_INLINE_WRITE_UNLOCK_IRQ
93 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 93 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
94 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 95 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
95 select ARCH_WANT_IPC_PARSE_VERSION 96 select ARCH_WANT_IPC_PARSE_VERSION
96 select BUILDTIME_EXTABLE_SORT 97 select BUILDTIME_EXTABLE_SORT
@@ -131,7 +132,6 @@ config S390
131 select HAVE_PERF_EVENTS 132 select HAVE_PERF_EVENTS
132 select HAVE_REGS_AND_STACK_ACCESS_API 133 select HAVE_REGS_AND_STACK_ACCESS_API
133 select HAVE_SYSCALL_TRACEPOINTS 134 select HAVE_SYSCALL_TRACEPOINTS
134 select HAVE_SYSCALL_WRAPPERS
135 select HAVE_UID16 if 32BIT 135 select HAVE_UID16 if 32BIT
136 select HAVE_VIRT_CPU_ACCOUNTING 136 select HAVE_VIRT_CPU_ACCOUNTING
137 select VIRT_TO_BUS 137 select VIRT_TO_BUS
@@ -375,19 +375,6 @@ config PACK_STACK
375 375
376 Say Y if you are unsure. 376 Say Y if you are unsure.
377 377
378config SMALL_STACK
379 def_bool n
380 prompt "Use 8kb for kernel stack instead of 16kb"
381 depends on PACK_STACK && 64BIT && !LOCKDEP
382 help
383 If you say Y here and the compiler supports the -mkernel-backchain
384 option the kernel will use a smaller kernel stack size. The reduced
385 size is 8kb instead of 16kb. This allows to run more threads on a
386 system and reduces the pressure on the memory management for higher
387 order page allocations.
388
389 Say N if you are unsure.
390
391config CHECK_STACK 378config CHECK_STACK
392 def_bool y 379 def_bool y
393 prompt "Detect kernel stack overflow" 380 prompt "Detect kernel stack overflow"
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug
index fc32a2df4974..c56878e1245f 100644
--- a/arch/s390/Kconfig.debug
+++ b/arch/s390/Kconfig.debug
@@ -17,20 +17,6 @@ config STRICT_DEVMEM
17 17
18 If you are unsure, say Y. 18 If you are unsure, say Y.
19 19
20config DEBUG_STRICT_USER_COPY_CHECKS
21 def_bool n
22 prompt "Strict user copy size checks"
23 ---help---
24 Enabling this option turns a certain set of sanity checks for user
25 copy operations into compile time warnings.
26
27 The copy_from_user() etc checks are there to help test if there
28 are sufficient security checks on the length argument of
29 the copy operation, by having gcc prove that the argument is
30 within bounds.
31
32 If unsure, or if you run an older (pre 4.4) gcc, say N.
33
34config S390_PTDUMP 20config S390_PTDUMP
35 bool "Export kernel pagetable layout to userspace via debugfs" 21 bool "Export kernel pagetable layout to userspace via debugfs"
36 depends on DEBUG_KERNEL 22 depends on DEBUG_KERNEL
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 7e3ce78d4290..a7d68a467ce8 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -55,22 +55,12 @@ cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
55ifeq ($(call cc-option-yn,-mkernel-backchain),y) 55ifeq ($(call cc-option-yn,-mkernel-backchain),y)
56cflags-$(CONFIG_PACK_STACK) += -mkernel-backchain -D__PACK_STACK 56cflags-$(CONFIG_PACK_STACK) += -mkernel-backchain -D__PACK_STACK
57aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK 57aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
58cflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
59aflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
60ifdef CONFIG_SMALL_STACK
61STACK_SIZE := $(shell echo $$(($(STACK_SIZE)/2)) )
62endif
63endif 58endif
64 59
65# new style option for packed stacks 60# new style option for packed stacks
66ifeq ($(call cc-option-yn,-mpacked-stack),y) 61ifeq ($(call cc-option-yn,-mpacked-stack),y)
67cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK 62cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
68aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK 63aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
69cflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
70aflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
71ifdef CONFIG_SMALL_STACK
72STACK_SIZE := $(shell echo $$(($(STACK_SIZE)/2)) )
73endif
74endif 64endif
75 65
76ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y) 66ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c
index 9fd4a40c6752..bb5dd496614f 100644
--- a/arch/s390/hypfs/hypfs_dbfs.c
+++ b/arch/s390/hypfs/hypfs_dbfs.c
@@ -105,9 +105,7 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
105int hypfs_dbfs_init(void) 105int hypfs_dbfs_init(void)
106{ 106{
107 dbfs_dir = debugfs_create_dir("s390_hypfs", NULL); 107 dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
108 if (IS_ERR(dbfs_dir)) 108 return PTR_RET(dbfs_dir);
109 return PTR_ERR(dbfs_dir);
110 return 0;
111} 109}
112 110
113void hypfs_dbfs_exit(void) 111void hypfs_dbfs_exit(void)
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 15422933c60b..4d8604e311f3 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -61,8 +61,6 @@ extern const char _sb_findmap[];
61 61
62#ifndef CONFIG_64BIT 62#ifndef CONFIG_64BIT
63 63
64#define __BITOPS_ALIGN 3
65#define __BITOPS_WORDSIZE 32
66#define __BITOPS_OR "or" 64#define __BITOPS_OR "or"
67#define __BITOPS_AND "nr" 65#define __BITOPS_AND "nr"
68#define __BITOPS_XOR "xr" 66#define __BITOPS_XOR "xr"
@@ -81,8 +79,6 @@ extern const char _sb_findmap[];
81 79
82#else /* CONFIG_64BIT */ 80#else /* CONFIG_64BIT */
83 81
84#define __BITOPS_ALIGN 7
85#define __BITOPS_WORDSIZE 64
86#define __BITOPS_OR "ogr" 82#define __BITOPS_OR "ogr"
87#define __BITOPS_AND "ngr" 83#define __BITOPS_AND "ngr"
88#define __BITOPS_XOR "xgr" 84#define __BITOPS_XOR "xgr"
@@ -101,8 +97,7 @@ extern const char _sb_findmap[];
101 97
102#endif /* CONFIG_64BIT */ 98#endif /* CONFIG_64BIT */
103 99
104#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE) 100#define __BITOPS_WORDS(bits) (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
105#define __BITOPS_BARRIER() asm volatile("" : : : "memory")
106 101
107#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
108/* 103/*
@@ -114,9 +109,9 @@ static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
114 109
115 addr = (unsigned long) ptr; 110 addr = (unsigned long) ptr;
116 /* calculate address for CS */ 111 /* calculate address for CS */
117 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 112 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
118 /* make OR mask */ 113 /* make OR mask */
119 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1)); 114 mask = 1UL << (nr & (BITS_PER_LONG - 1));
120 /* Do the atomic update. */ 115 /* Do the atomic update. */
121 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR); 116 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
122} 117}
@@ -130,9 +125,9 @@ static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
130 125
131 addr = (unsigned long) ptr; 126 addr = (unsigned long) ptr;
132 /* calculate address for CS */ 127 /* calculate address for CS */
133 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 128 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
134 /* make AND mask */ 129 /* make AND mask */
135 mask = ~(1UL << (nr & (__BITOPS_WORDSIZE - 1))); 130 mask = ~(1UL << (nr & (BITS_PER_LONG - 1)));
136 /* Do the atomic update. */ 131 /* Do the atomic update. */
137 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND); 132 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
138} 133}
@@ -146,9 +141,9 @@ static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
146 141
147 addr = (unsigned long) ptr; 142 addr = (unsigned long) ptr;
148 /* calculate address for CS */ 143 /* calculate address for CS */
149 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 144 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
150 /* make XOR mask */ 145 /* make XOR mask */
151 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1)); 146 mask = 1UL << (nr & (BITS_PER_LONG - 1));
152 /* Do the atomic update. */ 147 /* Do the atomic update. */
153 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR); 148 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
154} 149}
@@ -163,12 +158,12 @@ test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
163 158
164 addr = (unsigned long) ptr; 159 addr = (unsigned long) ptr;
165 /* calculate address for CS */ 160 /* calculate address for CS */
166 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 161 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
167 /* make OR/test mask */ 162 /* make OR/test mask */
168 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1)); 163 mask = 1UL << (nr & (BITS_PER_LONG - 1));
169 /* Do the atomic update. */ 164 /* Do the atomic update. */
170 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR); 165 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
171 __BITOPS_BARRIER(); 166 barrier();
172 return (old & mask) != 0; 167 return (old & mask) != 0;
173} 168}
174 169
@@ -182,12 +177,12 @@ test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
182 177
183 addr = (unsigned long) ptr; 178 addr = (unsigned long) ptr;
184 /* calculate address for CS */ 179 /* calculate address for CS */
185 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 180 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
186 /* make AND/test mask */ 181 /* make AND/test mask */
187 mask = ~(1UL << (nr & (__BITOPS_WORDSIZE - 1))); 182 mask = ~(1UL << (nr & (BITS_PER_LONG - 1)));
188 /* Do the atomic update. */ 183 /* Do the atomic update. */
189 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND); 184 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
190 __BITOPS_BARRIER(); 185 barrier();
191 return (old ^ new) != 0; 186 return (old ^ new) != 0;
192} 187}
193 188
@@ -201,12 +196,12 @@ test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
201 196
202 addr = (unsigned long) ptr; 197 addr = (unsigned long) ptr;
203 /* calculate address for CS */ 198 /* calculate address for CS */
204 addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3; 199 addr += (nr ^ (nr & (BITS_PER_LONG - 1))) >> 3;
205 /* make XOR/test mask */ 200 /* make XOR/test mask */
206 mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1)); 201 mask = 1UL << (nr & (BITS_PER_LONG - 1));
207 /* Do the atomic update. */ 202 /* Do the atomic update. */
208 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR); 203 __BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
209 __BITOPS_BARRIER(); 204 barrier();
210 return (old & mask) != 0; 205 return (old & mask) != 0;
211} 206}
212#endif /* CONFIG_SMP */ 207#endif /* CONFIG_SMP */
@@ -218,7 +213,7 @@ static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
218{ 213{
219 unsigned long addr; 214 unsigned long addr;
220 215
221 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 216 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
222 asm volatile( 217 asm volatile(
223 " oc %O0(1,%R0),%1" 218 " oc %O0(1,%R0),%1"
224 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" ); 219 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" );
@@ -229,7 +224,7 @@ __constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
229{ 224{
230 unsigned long addr; 225 unsigned long addr;
231 226
232 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 227 addr = ((unsigned long) ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
233 *(unsigned char *) addr |= 1 << (nr & 7); 228 *(unsigned char *) addr |= 1 << (nr & 7);
234} 229}
235 230
@@ -246,7 +241,7 @@ __clear_bit(unsigned long nr, volatile unsigned long *ptr)
246{ 241{
247 unsigned long addr; 242 unsigned long addr;
248 243
249 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 244 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
250 asm volatile( 245 asm volatile(
251 " nc %O0(1,%R0),%1" 246 " nc %O0(1,%R0),%1"
252 : "=Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7]) : "cc" ); 247 : "=Q" (*(char *) addr) : "Q" (_ni_bitmap[nr & 7]) : "cc" );
@@ -257,7 +252,7 @@ __constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
257{ 252{
258 unsigned long addr; 253 unsigned long addr;
259 254
260 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 255 addr = ((unsigned long) ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
261 *(unsigned char *) addr &= ~(1 << (nr & 7)); 256 *(unsigned char *) addr &= ~(1 << (nr & 7));
262} 257}
263 258
@@ -273,7 +268,7 @@ static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
273{ 268{
274 unsigned long addr; 269 unsigned long addr;
275 270
276 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 271 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
277 asm volatile( 272 asm volatile(
278 " xc %O0(1,%R0),%1" 273 " xc %O0(1,%R0),%1"
279 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" ); 274 : "=Q" (*(char *) addr) : "Q" (_oi_bitmap[nr & 7]) : "cc" );
@@ -284,7 +279,7 @@ __constant_change_bit(const unsigned long nr, volatile unsigned long *ptr)
284{ 279{
285 unsigned long addr; 280 unsigned long addr;
286 281
287 addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 282 addr = ((unsigned long) ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
288 *(unsigned char *) addr ^= 1 << (nr & 7); 283 *(unsigned char *) addr ^= 1 << (nr & 7);
289} 284}
290 285
@@ -302,7 +297,7 @@ test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
302 unsigned long addr; 297 unsigned long addr;
303 unsigned char ch; 298 unsigned char ch;
304 299
305 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 300 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
306 ch = *(unsigned char *) addr; 301 ch = *(unsigned char *) addr;
307 asm volatile( 302 asm volatile(
308 " oc %O0(1,%R0),%1" 303 " oc %O0(1,%R0),%1"
@@ -321,7 +316,7 @@ test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
321 unsigned long addr; 316 unsigned long addr;
322 unsigned char ch; 317 unsigned char ch;
323 318
324 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 319 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
325 ch = *(unsigned char *) addr; 320 ch = *(unsigned char *) addr;
326 asm volatile( 321 asm volatile(
327 " nc %O0(1,%R0),%1" 322 " nc %O0(1,%R0),%1"
@@ -340,7 +335,7 @@ test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
340 unsigned long addr; 335 unsigned long addr;
341 unsigned char ch; 336 unsigned char ch;
342 337
343 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 338 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
344 ch = *(unsigned char *) addr; 339 ch = *(unsigned char *) addr;
345 asm volatile( 340 asm volatile(
346 " xc %O0(1,%R0),%1" 341 " xc %O0(1,%R0),%1"
@@ -376,7 +371,7 @@ static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr
376 unsigned long addr; 371 unsigned long addr;
377 unsigned char ch; 372 unsigned char ch;
378 373
379 addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3); 374 addr = (unsigned long) ptr + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
380 ch = *(volatile unsigned char *) addr; 375 ch = *(volatile unsigned char *) addr;
381 return (ch >> (nr & 7)) & 1; 376 return (ch >> (nr & 7)) & 1;
382} 377}
@@ -384,7 +379,7 @@ static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr
384static inline int 379static inline int
385__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { 380__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
386 return (((volatile char *) addr) 381 return (((volatile char *) addr)
387 [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7))) != 0; 382 [(nr^(BITS_PER_LONG-8))>>3] & (1<<(nr&7))) != 0;
388} 383}
389 384
390#define test_bit(nr,addr) \ 385#define test_bit(nr,addr) \
@@ -693,18 +688,18 @@ static inline int find_next_bit_left(const unsigned long *addr,
693 688
694 if (offset >= size) 689 if (offset >= size)
695 return size; 690 return size;
696 bit = offset & (__BITOPS_WORDSIZE - 1); 691 bit = offset & (BITS_PER_LONG - 1);
697 offset -= bit; 692 offset -= bit;
698 size -= offset; 693 size -= offset;
699 p = addr + offset / __BITOPS_WORDSIZE; 694 p = addr + offset / BITS_PER_LONG;
700 if (bit) { 695 if (bit) {
701 set = __flo_word(0, *p & (~0UL << bit)); 696 set = __flo_word(0, *p & (~0UL << bit));
702 if (set >= size) 697 if (set >= size)
703 return size + offset; 698 return size + offset;
704 if (set < __BITOPS_WORDSIZE) 699 if (set < BITS_PER_LONG)
705 return set + offset; 700 return set + offset;
706 offset += __BITOPS_WORDSIZE; 701 offset += BITS_PER_LONG;
707 size -= __BITOPS_WORDSIZE; 702 size -= BITS_PER_LONG;
708 p++; 703 p++;
709 } 704 }
710 return offset + find_first_bit_left(p, size); 705 return offset + find_first_bit_left(p, size);
@@ -736,22 +731,22 @@ static inline int find_next_zero_bit (const unsigned long * addr,
736 731
737 if (offset >= size) 732 if (offset >= size)
738 return size; 733 return size;
739 bit = offset & (__BITOPS_WORDSIZE - 1); 734 bit = offset & (BITS_PER_LONG - 1);
740 offset -= bit; 735 offset -= bit;
741 size -= offset; 736 size -= offset;
742 p = addr + offset / __BITOPS_WORDSIZE; 737 p = addr + offset / BITS_PER_LONG;
743 if (bit) { 738 if (bit) {
744 /* 739 /*
745 * __ffz_word returns __BITOPS_WORDSIZE 740 * __ffz_word returns BITS_PER_LONG
746 * if no zero bit is present in the word. 741 * if no zero bit is present in the word.
747 */ 742 */
748 set = __ffz_word(bit, *p >> bit); 743 set = __ffz_word(bit, *p >> bit);
749 if (set >= size) 744 if (set >= size)
750 return size + offset; 745 return size + offset;
751 if (set < __BITOPS_WORDSIZE) 746 if (set < BITS_PER_LONG)
752 return set + offset; 747 return set + offset;
753 offset += __BITOPS_WORDSIZE; 748 offset += BITS_PER_LONG;
754 size -= __BITOPS_WORDSIZE; 749 size -= BITS_PER_LONG;
755 p++; 750 p++;
756 } 751 }
757 return offset + find_first_zero_bit(p, size); 752 return offset + find_first_zero_bit(p, size);
@@ -773,22 +768,22 @@ static inline int find_next_bit (const unsigned long * addr,
773 768
774 if (offset >= size) 769 if (offset >= size)
775 return size; 770 return size;
776 bit = offset & (__BITOPS_WORDSIZE - 1); 771 bit = offset & (BITS_PER_LONG - 1);
777 offset -= bit; 772 offset -= bit;
778 size -= offset; 773 size -= offset;
779 p = addr + offset / __BITOPS_WORDSIZE; 774 p = addr + offset / BITS_PER_LONG;
780 if (bit) { 775 if (bit) {
781 /* 776 /*
782 * __ffs_word returns __BITOPS_WORDSIZE 777 * __ffs_word returns BITS_PER_LONG
783 * if no one bit is present in the word. 778 * if no one bit is present in the word.
784 */ 779 */
785 set = __ffs_word(0, *p & (~0UL << bit)); 780 set = __ffs_word(0, *p & (~0UL << bit));
786 if (set >= size) 781 if (set >= size)
787 return size + offset; 782 return size + offset;
788 if (set < __BITOPS_WORDSIZE) 783 if (set < BITS_PER_LONG)
789 return set + offset; 784 return set + offset;
790 offset += __BITOPS_WORDSIZE; 785 offset += BITS_PER_LONG;
791 size -= __BITOPS_WORDSIZE; 786 size -= BITS_PER_LONG;
792 p++; 787 p++;
793 } 788 }
794 return offset + find_first_bit(p, size); 789 return offset + find_first_bit(p, size);
@@ -843,22 +838,22 @@ static inline int find_next_zero_bit_le(void *vaddr, unsigned long size,
843 838
844 if (offset >= size) 839 if (offset >= size)
845 return size; 840 return size;
846 bit = offset & (__BITOPS_WORDSIZE - 1); 841 bit = offset & (BITS_PER_LONG - 1);
847 offset -= bit; 842 offset -= bit;
848 size -= offset; 843 size -= offset;
849 p = addr + offset / __BITOPS_WORDSIZE; 844 p = addr + offset / BITS_PER_LONG;
850 if (bit) { 845 if (bit) {
851 /* 846 /*
852 * s390 version of ffz returns __BITOPS_WORDSIZE 847 * s390 version of ffz returns BITS_PER_LONG
853 * if no zero bit is present in the word. 848 * if no zero bit is present in the word.
854 */ 849 */
855 set = __ffz_word(bit, __load_ulong_le(p, 0) >> bit); 850 set = __ffz_word(bit, __load_ulong_le(p, 0) >> bit);
856 if (set >= size) 851 if (set >= size)
857 return size + offset; 852 return size + offset;
858 if (set < __BITOPS_WORDSIZE) 853 if (set < BITS_PER_LONG)
859 return set + offset; 854 return set + offset;
860 offset += __BITOPS_WORDSIZE; 855 offset += BITS_PER_LONG;
861 size -= __BITOPS_WORDSIZE; 856 size -= BITS_PER_LONG;
862 p++; 857 p++;
863 } 858 }
864 return offset + find_first_zero_bit_le(p, size); 859 return offset + find_first_zero_bit_le(p, size);
@@ -885,22 +880,22 @@ static inline int find_next_bit_le(void *vaddr, unsigned long size,
885 880
886 if (offset >= size) 881 if (offset >= size)
887 return size; 882 return size;
888 bit = offset & (__BITOPS_WORDSIZE - 1); 883 bit = offset & (BITS_PER_LONG - 1);
889 offset -= bit; 884 offset -= bit;
890 size -= offset; 885 size -= offset;
891 p = addr + offset / __BITOPS_WORDSIZE; 886 p = addr + offset / BITS_PER_LONG;
892 if (bit) { 887 if (bit) {
893 /* 888 /*
894 * s390 version of ffz returns __BITOPS_WORDSIZE 889 * s390 version of ffz returns BITS_PER_LONG
895 * if no zero bit is present in the word. 890 * if no zero bit is present in the word.
896 */ 891 */
897 set = __ffs_word(0, __load_ulong_le(p, 0) & (~0UL << bit)); 892 set = __ffs_word(0, __load_ulong_le(p, 0) & (~0UL << bit));
898 if (set >= size) 893 if (set >= size)
899 return size + offset; 894 return size + offset;
900 if (set < __BITOPS_WORDSIZE) 895 if (set < BITS_PER_LONG)
901 return set + offset; 896 return set + offset;
902 offset += __BITOPS_WORDSIZE; 897 offset += BITS_PER_LONG;
903 size -= __BITOPS_WORDSIZE; 898 size -= BITS_PER_LONG;
904 p++; 899 p++;
905 } 900 }
906 return offset + find_first_bit_le(p, size); 901 return offset + find_first_bit_le(p, size);
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index e6061617a50b..f201af8be580 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -220,7 +220,8 @@ extern void ccw_device_get_id(struct ccw_device *, struct ccw_dev_id *);
220#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver) 220#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
221 221
222extern struct ccw_device *ccw_device_probe_console(void); 222extern struct ccw_device *ccw_device_probe_console(void);
223extern int ccw_device_force_console(void); 223extern void ccw_device_wait_idle(struct ccw_device *);
224extern int ccw_device_force_console(struct ccw_device *);
224 225
225int ccw_device_siosl(struct ccw_device *); 226int ccw_device_siosl(struct ccw_device *);
226 227
diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h
index ad2b924167d7..ffb898961c8d 100644
--- a/arch/s390/include/asm/cio.h
+++ b/arch/s390/include/asm/cio.h
@@ -296,8 +296,6 @@ static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
296 return 0; 296 return 0;
297} 297}
298 298
299extern void wait_cons_dev(void);
300
301extern void css_schedule_reprobe(void); 299extern void css_schedule_reprobe(void);
302 300
303extern void reipl_ccw_dev(struct ccw_dev_id *id); 301extern void reipl_ccw_dev(struct ccw_dev_id *id);
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index f8c6df6cd1f0..c1e7c646727c 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -70,6 +70,22 @@ typedef u32 compat_ulong_t;
70typedef u64 compat_u64; 70typedef u64 compat_u64;
71typedef u32 compat_uptr_t; 71typedef u32 compat_uptr_t;
72 72
73typedef struct {
74 u32 mask;
75 u32 addr;
76} __aligned(8) psw_compat_t;
77
78typedef struct {
79 psw_compat_t psw;
80 u32 gprs[NUM_GPRS];
81 u32 acrs[NUM_ACRS];
82 u32 orig_gpr2;
83} s390_compat_regs;
84
85typedef struct {
86 u32 gprs_high[NUM_GPRS];
87} s390_compat_regs_high;
88
73struct compat_timespec { 89struct compat_timespec {
74 compat_time_t tv_sec; 90 compat_time_t tv_sec;
75 s32 tv_nsec; 91 s32 tv_nsec;
@@ -124,18 +140,33 @@ struct compat_flock64 {
124}; 140};
125 141
126struct compat_statfs { 142struct compat_statfs {
127 s32 f_type; 143 u32 f_type;
128 s32 f_bsize; 144 u32 f_bsize;
129 s32 f_blocks; 145 u32 f_blocks;
130 s32 f_bfree; 146 u32 f_bfree;
131 s32 f_bavail; 147 u32 f_bavail;
132 s32 f_files; 148 u32 f_files;
133 s32 f_ffree; 149 u32 f_ffree;
150 compat_fsid_t f_fsid;
151 u32 f_namelen;
152 u32 f_frsize;
153 u32 f_flags;
154 u32 f_spare[4];
155};
156
157struct compat_statfs64 {
158 u32 f_type;
159 u32 f_bsize;
160 u64 f_blocks;
161 u64 f_bfree;
162 u64 f_bavail;
163 u64 f_files;
164 u64 f_ffree;
134 compat_fsid_t f_fsid; 165 compat_fsid_t f_fsid;
135 s32 f_namelen; 166 u32 f_namelen;
136 s32 f_frsize; 167 u32 f_frsize;
137 s32 f_flags; 168 u32 f_flags;
138 s32 f_spare[5]; 169 u32 f_spare[4];
139}; 170};
140 171
141#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff 172#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
@@ -248,8 +279,6 @@ static inline int is_compat_task(void)
248 return is_32bit_task(); 279 return is_32bit_task();
249} 280}
250 281
251#endif
252
253static inline void __user *arch_compat_alloc_user_space(long len) 282static inline void __user *arch_compat_alloc_user_space(long len)
254{ 283{
255 unsigned long stack; 284 unsigned long stack;
@@ -260,6 +289,8 @@ static inline void __user *arch_compat_alloc_user_space(long len)
260 return (void __user *) (stack - len); 289 return (void __user *) (stack - len);
261} 290}
262 291
292#endif
293
263struct compat_ipc64_perm { 294struct compat_ipc64_perm {
264 compat_key_t key; 295 compat_key_t key;
265 __compat_uid32_t uid; 296 __compat_uid32_t uid;
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 1bfdf24b85a2..78f4f8711d58 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -119,6 +119,8 @@
119 */ 119 */
120 120
121#include <asm/ptrace.h> 121#include <asm/ptrace.h>
122#include <asm/compat.h>
123#include <asm/syscall.h>
122#include <asm/user.h> 124#include <asm/user.h>
123 125
124typedef s390_fp_regs elf_fpregset_t; 126typedef s390_fp_regs elf_fpregset_t;
@@ -180,18 +182,31 @@ extern unsigned long elf_hwcap;
180extern char elf_platform[]; 182extern char elf_platform[];
181#define ELF_PLATFORM (elf_platform) 183#define ELF_PLATFORM (elf_platform)
182 184
183#ifdef CONFIG_64BIT 185#ifndef CONFIG_COMPAT
186#define SET_PERSONALITY(ex) \
187do { \
188 set_personality(PER_LINUX | \
189 (current->personality & (~PER_MASK))); \
190 current_thread_info()->sys_call_table = \
191 (unsigned long) &sys_call_table; \
192} while (0)
193#else /* CONFIG_COMPAT */
184#define SET_PERSONALITY(ex) \ 194#define SET_PERSONALITY(ex) \
185do { \ 195do { \
186 if (personality(current->personality) != PER_LINUX32) \ 196 if (personality(current->personality) != PER_LINUX32) \
187 set_personality(PER_LINUX | \ 197 set_personality(PER_LINUX | \
188 (current->personality & ~PER_MASK)); \ 198 (current->personality & ~PER_MASK)); \
189 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 199 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) { \
190 set_thread_flag(TIF_31BIT); \ 200 set_thread_flag(TIF_31BIT); \
191 else \ 201 current_thread_info()->sys_call_table = \
202 (unsigned long) &sys_call_table_emu; \
203 } else { \
192 clear_thread_flag(TIF_31BIT); \ 204 clear_thread_flag(TIF_31BIT); \
205 current_thread_info()->sys_call_table = \
206 (unsigned long) &sys_call_table; \
207 } \
193} while (0) 208} while (0)
194#endif /* CONFIG_64BIT */ 209#endif /* CONFIG_COMPAT */
195 210
196#define STACK_RND_MASK 0x7ffUL 211#define STACK_RND_MASK 0x7ffUL
197 212
diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index 593753ee07f3..bd90359d6d22 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -114,7 +114,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
114#define huge_ptep_set_wrprotect(__mm, __addr, __ptep) \ 114#define huge_ptep_set_wrprotect(__mm, __addr, __ptep) \
115({ \ 115({ \
116 pte_t __pte = huge_ptep_get(__ptep); \ 116 pte_t __pte = huge_ptep_get(__ptep); \
117 if (pte_write(__pte)) { \ 117 if (huge_pte_write(__pte)) { \
118 huge_ptep_invalidate(__mm, __addr, __ptep); \ 118 huge_ptep_invalidate(__mm, __addr, __ptep); \
119 set_huge_pte_at(__mm, __addr, __ptep, \ 119 set_huge_pte_at(__mm, __addr, __ptep, \
120 huge_pte_wrprotect(__pte)); \ 120 huge_pte_wrprotect(__pte)); \
@@ -127,4 +127,58 @@ static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
127 huge_ptep_invalidate(vma->vm_mm, address, ptep); 127 huge_ptep_invalidate(vma->vm_mm, address, ptep);
128} 128}
129 129
130static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
131{
132 pte_t pte;
133 pmd_t pmd;
134
135 pmd = mk_pmd_phys(page_to_phys(page), pgprot);
136 pte_val(pte) = pmd_val(pmd);
137 return pte;
138}
139
140static inline int huge_pte_write(pte_t pte)
141{
142 pmd_t pmd;
143
144 pmd_val(pmd) = pte_val(pte);
145 return pmd_write(pmd);
146}
147
148static inline int huge_pte_dirty(pte_t pte)
149{
150 /* No dirty bit in the segment table entry. */
151 return 0;
152}
153
154static inline pte_t huge_pte_mkwrite(pte_t pte)
155{
156 pmd_t pmd;
157
158 pmd_val(pmd) = pte_val(pte);
159 pte_val(pte) = pmd_val(pmd_mkwrite(pmd));
160 return pte;
161}
162
163static inline pte_t huge_pte_mkdirty(pte_t pte)
164{
165 /* No dirty bit in the segment table entry. */
166 return pte;
167}
168
169static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
170{
171 pmd_t pmd;
172
173 pmd_val(pmd) = pte_val(pte);
174 pte_val(pte) = pmd_val(pmd_modify(pmd, newprot));
175 return pte;
176}
177
178static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
179 pte_t *ptep)
180{
181 pmd_clear((pmd_t *) ptep);
182}
183
130#endif /* _ASM_S390_HUGETLB_H */ 184#endif /* _ASM_S390_HUGETLB_H */
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 05333b7f0469..6c1801235db9 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -140,6 +140,7 @@ static inline bool zdev_enabled(struct zpci_dev *zdev)
140struct zpci_dev *zpci_alloc_device(void); 140struct zpci_dev *zpci_alloc_device(void);
141int zpci_create_device(struct zpci_dev *); 141int zpci_create_device(struct zpci_dev *);
142int zpci_enable_device(struct zpci_dev *); 142int zpci_enable_device(struct zpci_dev *);
143int zpci_disable_device(struct zpci_dev *);
143void zpci_stop_device(struct zpci_dev *); 144void zpci_stop_device(struct zpci_dev *);
144void zpci_free_device(struct zpci_dev *); 145void zpci_free_device(struct zpci_dev *);
145int zpci_scan_device(struct zpci_dev *); 146int zpci_scan_device(struct zpci_dev *);
diff --git a/arch/s390/include/asm/pci_debug.h b/arch/s390/include/asm/pci_debug.h
index 6bbec4265b6e..1ca5d1047c71 100644
--- a/arch/s390/include/asm/pci_debug.h
+++ b/arch/s390/include/asm/pci_debug.h
@@ -7,14 +7,11 @@ extern debug_info_t *pci_debug_msg_id;
7extern debug_info_t *pci_debug_err_id; 7extern debug_info_t *pci_debug_err_id;
8 8
9#ifdef CONFIG_PCI_DEBUG 9#ifdef CONFIG_PCI_DEBUG
10#define zpci_dbg(fmt, args...) \ 10#define zpci_dbg(imp, fmt, args...) \
11 do { \ 11 debug_sprintf_event(pci_debug_msg_id, imp, fmt, ##args)
12 if (pci_debug_msg_id->level >= 2) \
13 debug_sprintf_event(pci_debug_msg_id, 2, fmt , ## args);\
14 } while (0)
15 12
16#else /* !CONFIG_PCI_DEBUG */ 13#else /* !CONFIG_PCI_DEBUG */
17#define zpci_dbg(fmt, args...) do { } while (0) 14#define zpci_dbg(imp, fmt, args...) do { } while (0)
18#endif 15#endif
19 16
20#define zpci_err(text...) \ 17#define zpci_err(text...) \
diff --git a/arch/s390/include/asm/pci_insn.h b/arch/s390/include/asm/pci_insn.h
index 1486a98d5dad..e6a2bdd4d705 100644
--- a/arch/s390/include/asm/pci_insn.h
+++ b/arch/s390/include/asm/pci_insn.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_S390_PCI_INSN_H 1#ifndef _ASM_S390_PCI_INSN_H
2#define _ASM_S390_PCI_INSN_H 2#define _ASM_S390_PCI_INSN_H
3 3
4#include <linux/delay.h>
5
6#define ZPCI_INSN_BUSY_DELAY 1 /* 1 microsecond */
7
8/* Load/Store status codes */ 4/* Load/Store status codes */
9#define ZPCI_PCI_ST_FUNC_NOT_ENABLED 4 5#define ZPCI_PCI_ST_FUNC_NOT_ENABLED 4
10#define ZPCI_PCI_ST_FUNC_IN_ERR 8 6#define ZPCI_PCI_ST_FUNC_IN_ERR 8
@@ -82,199 +78,12 @@ struct zpci_fib {
82 u64 reserved7; 78 u64 reserved7;
83} __packed; 79} __packed;
84 80
85/* Modify PCI Function Controls */
86static inline u8 __mpcifc(u64 req, struct zpci_fib *fib, u8 *status)
87{
88 u8 cc;
89
90 asm volatile (
91 " .insn rxy,0xe300000000d0,%[req],%[fib]\n"
92 " ipm %[cc]\n"
93 " srl %[cc],28\n"
94 : [cc] "=d" (cc), [req] "+d" (req), [fib] "+Q" (*fib)
95 : : "cc");
96 *status = req >> 24 & 0xff;
97 return cc;
98}
99
100static inline int mpcifc_instr(u64 req, struct zpci_fib *fib)
101{
102 u8 cc, status;
103
104 do {
105 cc = __mpcifc(req, fib, &status);
106 if (cc == 2)
107 msleep(ZPCI_INSN_BUSY_DELAY);
108 } while (cc == 2);
109
110 if (cc)
111 printk_once(KERN_ERR "%s: error cc: %d status: %d\n",
112 __func__, cc, status);
113 return (cc) ? -EIO : 0;
114}
115
116/* Refresh PCI Translations */
117static inline u8 __rpcit(u64 fn, u64 addr, u64 range, u8 *status)
118{
119 register u64 __addr asm("2") = addr;
120 register u64 __range asm("3") = range;
121 u8 cc;
122
123 asm volatile (
124 " .insn rre,0xb9d30000,%[fn],%[addr]\n"
125 " ipm %[cc]\n"
126 " srl %[cc],28\n"
127 : [cc] "=d" (cc), [fn] "+d" (fn)
128 : [addr] "d" (__addr), "d" (__range)
129 : "cc");
130 *status = fn >> 24 & 0xff;
131 return cc;
132}
133
134static inline int rpcit_instr(u64 fn, u64 addr, u64 range)
135{
136 u8 cc, status;
137
138 do {
139 cc = __rpcit(fn, addr, range, &status);
140 if (cc == 2)
141 udelay(ZPCI_INSN_BUSY_DELAY);
142 } while (cc == 2);
143
144 if (cc)
145 printk_once(KERN_ERR "%s: error cc: %d status: %d dma_addr: %Lx size: %Lx\n",
146 __func__, cc, status, addr, range);
147 return (cc) ? -EIO : 0;
148}
149
150/* Store PCI function controls */
151static inline u8 __stpcifc(u32 handle, u8 space, struct zpci_fib *fib, u8 *status)
152{
153 u64 fn = (u64) handle << 32 | space << 16;
154 u8 cc;
155
156 asm volatile (
157 " .insn rxy,0xe300000000d4,%[fn],%[fib]\n"
158 " ipm %[cc]\n"
159 " srl %[cc],28\n"
160 : [cc] "=d" (cc), [fn] "+d" (fn), [fib] "=m" (*fib)
161 : : "cc");
162 *status = fn >> 24 & 0xff;
163 return cc;
164}
165
166/* Set Interruption Controls */
167static inline void sic_instr(u16 ctl, char *unused, u8 isc)
168{
169 asm volatile (
170 " .insn rsy,0xeb00000000d1,%[ctl],%[isc],%[u]\n"
171 : : [ctl] "d" (ctl), [isc] "d" (isc << 27), [u] "Q" (*unused));
172}
173
174/* PCI Load */
175static inline u8 __pcilg(u64 *data, u64 req, u64 offset, u8 *status)
176{
177 register u64 __req asm("2") = req;
178 register u64 __offset asm("3") = offset;
179 u64 __data;
180 u8 cc;
181
182 asm volatile (
183 " .insn rre,0xb9d20000,%[data],%[req]\n"
184 " ipm %[cc]\n"
185 " srl %[cc],28\n"
186 : [cc] "=d" (cc), [data] "=d" (__data), [req] "+d" (__req)
187 : "d" (__offset)
188 : "cc");
189 *status = __req >> 24 & 0xff;
190 *data = __data;
191 return cc;
192}
193
194static inline int pcilg_instr(u64 *data, u64 req, u64 offset)
195{
196 u8 cc, status;
197
198 do {
199 cc = __pcilg(data, req, offset, &status);
200 if (cc == 2)
201 udelay(ZPCI_INSN_BUSY_DELAY);
202 } while (cc == 2);
203
204 if (cc) {
205 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
206 __func__, cc, status, req, offset);
207 /* TODO: on IO errors set data to 0xff...
208 * here or in users of pcilg (le conversion)?
209 */
210 }
211 return (cc) ? -EIO : 0;
212}
213
214/* PCI Store */
215static inline u8 __pcistg(u64 data, u64 req, u64 offset, u8 *status)
216{
217 register u64 __req asm("2") = req;
218 register u64 __offset asm("3") = offset;
219 u8 cc;
220
221 asm volatile (
222 " .insn rre,0xb9d00000,%[data],%[req]\n"
223 " ipm %[cc]\n"
224 " srl %[cc],28\n"
225 : [cc] "=d" (cc), [req] "+d" (__req)
226 : "d" (__offset), [data] "d" (data)
227 : "cc");
228 *status = __req >> 24 & 0xff;
229 return cc;
230}
231
232static inline int pcistg_instr(u64 data, u64 req, u64 offset)
233{
234 u8 cc, status;
235
236 do {
237 cc = __pcistg(data, req, offset, &status);
238 if (cc == 2)
239 udelay(ZPCI_INSN_BUSY_DELAY);
240 } while (cc == 2);
241
242 if (cc)
243 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
244 __func__, cc, status, req, offset);
245 return (cc) ? -EIO : 0;
246}
247
248/* PCI Store Block */
249static inline u8 __pcistb(const u64 *data, u64 req, u64 offset, u8 *status)
250{
251 u8 cc;
252
253 asm volatile (
254 " .insn rsy,0xeb00000000d0,%[req],%[offset],%[data]\n"
255 " ipm %[cc]\n"
256 " srl %[cc],28\n"
257 : [cc] "=d" (cc), [req] "+d" (req)
258 : [offset] "d" (offset), [data] "Q" (*data)
259 : "cc");
260 *status = req >> 24 & 0xff;
261 return cc;
262}
263
264static inline int pcistb_instr(const u64 *data, u64 req, u64 offset)
265{
266 u8 cc, status;
267
268 do {
269 cc = __pcistb(data, req, offset, &status);
270 if (cc == 2)
271 udelay(ZPCI_INSN_BUSY_DELAY);
272 } while (cc == 2);
273 81
274 if (cc) 82int s390pci_mod_fc(u64 req, struct zpci_fib *fib);
275 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n", 83int s390pci_refresh_trans(u64 fn, u64 addr, u64 range);
276 __func__, cc, status, req, offset); 84int s390pci_load(u64 *data, u64 req, u64 offset);
277 return (cc) ? -EIO : 0; 85int s390pci_store(u64 data, u64 req, u64 offset);
278} 86int s390pci_store_block(const u64 *data, u64 req, u64 offset);
87void set_irq_ctrl(u16 ctl, char *unused, u8 isc);
279 88
280#endif 89#endif
diff --git a/arch/s390/include/asm/pci_io.h b/arch/s390/include/asm/pci_io.h
index 5fd81f31d6c7..83a9caa6ae53 100644
--- a/arch/s390/include/asm/pci_io.h
+++ b/arch/s390/include/asm/pci_io.h
@@ -36,7 +36,7 @@ static inline RETTYPE zpci_read_##RETTYPE(const volatile void __iomem *addr) \
36 u64 data; \ 36 u64 data; \
37 int rc; \ 37 int rc; \
38 \ 38 \
39 rc = pcilg_instr(&data, req, ZPCI_OFFSET(addr)); \ 39 rc = s390pci_load(&data, req, ZPCI_OFFSET(addr)); \
40 if (rc) \ 40 if (rc) \
41 data = -1ULL; \ 41 data = -1ULL; \
42 return (RETTYPE) data; \ 42 return (RETTYPE) data; \
@@ -50,7 +50,7 @@ static inline void zpci_write_##VALTYPE(VALTYPE val, \
50 u64 req = ZPCI_CREATE_REQ(entry->fh, entry->bar, LENGTH); \ 50 u64 req = ZPCI_CREATE_REQ(entry->fh, entry->bar, LENGTH); \
51 u64 data = (VALTYPE) val; \ 51 u64 data = (VALTYPE) val; \
52 \ 52 \
53 pcistg_instr(data, req, ZPCI_OFFSET(addr)); \ 53 s390pci_store(data, req, ZPCI_OFFSET(addr)); \
54} 54}
55 55
56zpci_read(8, u64) 56zpci_read(8, u64)
@@ -83,15 +83,18 @@ static inline int zpci_write_single(u64 req, const u64 *data, u64 offset, u8 len
83 val = 0; /* let FW report error */ 83 val = 0; /* let FW report error */
84 break; 84 break;
85 } 85 }
86 return pcistg_instr(val, req, offset); 86 return s390pci_store(val, req, offset);
87} 87}
88 88
89static inline int zpci_read_single(u64 req, u64 *dst, u64 offset, u8 len) 89static inline int zpci_read_single(u64 req, u64 *dst, u64 offset, u8 len)
90{ 90{
91 u64 data; 91 u64 data;
92 u8 cc; 92 int cc;
93
94 cc = s390pci_load(&data, req, offset);
95 if (cc)
96 goto out;
93 97
94 cc = pcilg_instr(&data, req, offset);
95 switch (len) { 98 switch (len) {
96 case 1: 99 case 1:
97 *((u8 *) dst) = (u8) data; 100 *((u8 *) dst) = (u8) data;
@@ -106,12 +109,13 @@ static inline int zpci_read_single(u64 req, u64 *dst, u64 offset, u8 len)
106 *((u64 *) dst) = (u64) data; 109 *((u64 *) dst) = (u64) data;
107 break; 110 break;
108 } 111 }
112out:
109 return cc; 113 return cc;
110} 114}
111 115
112static inline int zpci_write_block(u64 req, const u64 *data, u64 offset) 116static inline int zpci_write_block(u64 req, const u64 *data, u64 offset)
113{ 117{
114 return pcistb_instr(data, req, offset); 118 return s390pci_store_block(data, req, offset);
115} 119}
116 120
117static inline u8 zpci_get_max_write_size(u64 src, u64 dst, int len, int max) 121static inline u8 zpci_get_max_write_size(u64 src, u64 dst, int len, int max)
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 3cb47cf02530..4105b8221fdd 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -306,6 +306,7 @@ extern unsigned long MODULES_END;
306#define RCP_HC_BIT 0x00200000UL 306#define RCP_HC_BIT 0x00200000UL
307#define RCP_GR_BIT 0x00040000UL 307#define RCP_GR_BIT 0x00040000UL
308#define RCP_GC_BIT 0x00020000UL 308#define RCP_GC_BIT 0x00020000UL
309#define RCP_IN_BIT 0x00008000UL /* IPTE notify bit */
309 310
310/* User dirty / referenced bit for KVM's migration feature */ 311/* User dirty / referenced bit for KVM's migration feature */
311#define KVM_UR_BIT 0x00008000UL 312#define KVM_UR_BIT 0x00008000UL
@@ -373,6 +374,7 @@ extern unsigned long MODULES_END;
373#define RCP_HC_BIT 0x0020000000000000UL 374#define RCP_HC_BIT 0x0020000000000000UL
374#define RCP_GR_BIT 0x0004000000000000UL 375#define RCP_GR_BIT 0x0004000000000000UL
375#define RCP_GC_BIT 0x0002000000000000UL 376#define RCP_GC_BIT 0x0002000000000000UL
377#define RCP_IN_BIT 0x0000800000000000UL /* IPTE notify bit */
376 378
377/* User dirty / referenced bit for KVM's migration feature */ 379/* User dirty / referenced bit for KVM's migration feature */
378#define KVM_UR_BIT 0x0000800000000000UL 380#define KVM_UR_BIT 0x0000800000000000UL
@@ -424,6 +426,13 @@ extern unsigned long MODULES_END;
424#define __S110 PAGE_RW 426#define __S110 PAGE_RW
425#define __S111 PAGE_RW 427#define __S111 PAGE_RW
426 428
429/*
430 * Segment entry (large page) protection definitions.
431 */
432#define SEGMENT_NONE __pgprot(_HPAGE_TYPE_NONE)
433#define SEGMENT_RO __pgprot(_HPAGE_TYPE_RO)
434#define SEGMENT_RW __pgprot(_HPAGE_TYPE_RW)
435
427static inline int mm_exclusive(struct mm_struct *mm) 436static inline int mm_exclusive(struct mm_struct *mm)
428{ 437{
429 return likely(mm == current->active_mm && 438 return likely(mm == current->active_mm &&
@@ -739,35 +748,67 @@ struct gmap {
739 748
740/** 749/**
741 * struct gmap_rmap - reverse mapping for segment table entries 750 * struct gmap_rmap - reverse mapping for segment table entries
742 * @next: pointer to the next gmap_rmap structure in the list 751 * @gmap: pointer to the gmap_struct
743 * @entry: pointer to a segment table entry 752 * @entry: pointer to a segment table entry
753 * @vmaddr: virtual address in the guest address space
744 */ 754 */
745struct gmap_rmap { 755struct gmap_rmap {
746 struct list_head list; 756 struct list_head list;
757 struct gmap *gmap;
747 unsigned long *entry; 758 unsigned long *entry;
759 unsigned long vmaddr;
748}; 760};
749 761
750/** 762/**
751 * struct gmap_pgtable - gmap information attached to a page table 763 * struct gmap_pgtable - gmap information attached to a page table
752 * @vmaddr: address of the 1MB segment in the process virtual memory 764 * @vmaddr: address of the 1MB segment in the process virtual memory
753 * @mapper: list of segment table entries maping a page table 765 * @mapper: list of segment table entries mapping a page table
754 */ 766 */
755struct gmap_pgtable { 767struct gmap_pgtable {
756 unsigned long vmaddr; 768 unsigned long vmaddr;
757 struct list_head mapper; 769 struct list_head mapper;
758}; 770};
759 771
772/**
773 * struct gmap_notifier - notify function block for page invalidation
774 * @notifier_call: address of callback function
775 */
776struct gmap_notifier {
777 struct list_head list;
778 void (*notifier_call)(struct gmap *gmap, unsigned long address);
779};
780
760struct gmap *gmap_alloc(struct mm_struct *mm); 781struct gmap *gmap_alloc(struct mm_struct *mm);
761void gmap_free(struct gmap *gmap); 782void gmap_free(struct gmap *gmap);
762void gmap_enable(struct gmap *gmap); 783void gmap_enable(struct gmap *gmap);
763void gmap_disable(struct gmap *gmap); 784void gmap_disable(struct gmap *gmap);
764int gmap_map_segment(struct gmap *gmap, unsigned long from, 785int gmap_map_segment(struct gmap *gmap, unsigned long from,
765 unsigned long to, unsigned long length); 786 unsigned long to, unsigned long len);
766int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len); 787int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len);
788unsigned long __gmap_translate(unsigned long address, struct gmap *);
789unsigned long gmap_translate(unsigned long address, struct gmap *);
767unsigned long __gmap_fault(unsigned long address, struct gmap *); 790unsigned long __gmap_fault(unsigned long address, struct gmap *);
768unsigned long gmap_fault(unsigned long address, struct gmap *); 791unsigned long gmap_fault(unsigned long address, struct gmap *);
769void gmap_discard(unsigned long from, unsigned long to, struct gmap *); 792void gmap_discard(unsigned long from, unsigned long to, struct gmap *);
770 793
794void gmap_register_ipte_notifier(struct gmap_notifier *);
795void gmap_unregister_ipte_notifier(struct gmap_notifier *);
796int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len);
797void gmap_do_ipte_notify(struct mm_struct *, unsigned long addr, pte_t *);
798
799static inline pgste_t pgste_ipte_notify(struct mm_struct *mm,
800 unsigned long addr,
801 pte_t *ptep, pgste_t pgste)
802{
803#ifdef CONFIG_PGSTE
804 if (pgste_val(pgste) & RCP_IN_BIT) {
805 pgste_val(pgste) &= ~RCP_IN_BIT;
806 gmap_do_ipte_notify(mm, addr, ptep);
807 }
808#endif
809 return pgste;
810}
811
771/* 812/*
772 * Certain architectures need to do special things when PTEs 813 * Certain architectures need to do special things when PTEs
773 * within a page table are directly modified. Thus, the following 814 * within a page table are directly modified. Thus, the following
@@ -912,26 +953,6 @@ static inline pte_t pte_mkspecial(pte_t pte)
912#ifdef CONFIG_HUGETLB_PAGE 953#ifdef CONFIG_HUGETLB_PAGE
913static inline pte_t pte_mkhuge(pte_t pte) 954static inline pte_t pte_mkhuge(pte_t pte)
914{ 955{
915 /*
916 * PROT_NONE needs to be remapped from the pte type to the ste type.
917 * The HW invalid bit is also different for pte and ste. The pte
918 * invalid bit happens to be the same as the ste _SEGMENT_ENTRY_LARGE
919 * bit, so we don't have to clear it.
920 */
921 if (pte_val(pte) & _PAGE_INVALID) {
922 if (pte_val(pte) & _PAGE_SWT)
923 pte_val(pte) |= _HPAGE_TYPE_NONE;
924 pte_val(pte) |= _SEGMENT_ENTRY_INV;
925 }
926 /*
927 * Clear SW pte bits, there are no SW bits in a segment table entry.
928 */
929 pte_val(pte) &= ~(_PAGE_SWT | _PAGE_SWX | _PAGE_SWC |
930 _PAGE_SWR | _PAGE_SWW);
931 /*
932 * Also set the change-override bit because we don't need dirty bit
933 * tracking for hugetlbfs pages.
934 */
935 pte_val(pte) |= (_SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_CO); 956 pte_val(pte) |= (_SEGMENT_ENTRY_LARGE | _SEGMENT_ENTRY_CO);
936 return pte; 957 return pte;
937} 958}
@@ -1043,8 +1064,10 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
1043 pte_t pte; 1064 pte_t pte;
1044 1065
1045 mm->context.flush_mm = 1; 1066 mm->context.flush_mm = 1;
1046 if (mm_has_pgste(mm)) 1067 if (mm_has_pgste(mm)) {
1047 pgste = pgste_get_lock(ptep); 1068 pgste = pgste_get_lock(ptep);
1069 pgste = pgste_ipte_notify(mm, address, ptep, pgste);
1070 }
1048 1071
1049 pte = *ptep; 1072 pte = *ptep;
1050 if (!mm_exclusive(mm)) 1073 if (!mm_exclusive(mm))
@@ -1063,11 +1086,14 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm,
1063 unsigned long address, 1086 unsigned long address,
1064 pte_t *ptep) 1087 pte_t *ptep)
1065{ 1088{
1089 pgste_t pgste;
1066 pte_t pte; 1090 pte_t pte;
1067 1091
1068 mm->context.flush_mm = 1; 1092 mm->context.flush_mm = 1;
1069 if (mm_has_pgste(mm)) 1093 if (mm_has_pgste(mm)) {
1070 pgste_get_lock(ptep); 1094 pgste = pgste_get_lock(ptep);
1095 pgste_ipte_notify(mm, address, ptep, pgste);
1096 }
1071 1097
1072 pte = *ptep; 1098 pte = *ptep;
1073 if (!mm_exclusive(mm)) 1099 if (!mm_exclusive(mm))
@@ -1093,8 +1119,10 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
1093 pgste_t pgste; 1119 pgste_t pgste;
1094 pte_t pte; 1120 pte_t pte;
1095 1121
1096 if (mm_has_pgste(vma->vm_mm)) 1122 if (mm_has_pgste(vma->vm_mm)) {
1097 pgste = pgste_get_lock(ptep); 1123 pgste = pgste_get_lock(ptep);
1124 pgste = pgste_ipte_notify(vma->vm_mm, address, ptep, pgste);
1125 }
1098 1126
1099 pte = *ptep; 1127 pte = *ptep;
1100 __ptep_ipte(address, ptep); 1128 __ptep_ipte(address, ptep);
@@ -1122,8 +1150,11 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
1122 pgste_t pgste; 1150 pgste_t pgste;
1123 pte_t pte; 1151 pte_t pte;
1124 1152
1125 if (mm_has_pgste(mm)) 1153 if (mm_has_pgste(mm)) {
1126 pgste = pgste_get_lock(ptep); 1154 pgste = pgste_get_lock(ptep);
1155 if (!full)
1156 pgste = pgste_ipte_notify(mm, address, ptep, pgste);
1157 }
1127 1158
1128 pte = *ptep; 1159 pte = *ptep;
1129 if (!full) 1160 if (!full)
@@ -1146,8 +1177,10 @@ static inline pte_t ptep_set_wrprotect(struct mm_struct *mm,
1146 1177
1147 if (pte_write(pte)) { 1178 if (pte_write(pte)) {
1148 mm->context.flush_mm = 1; 1179 mm->context.flush_mm = 1;
1149 if (mm_has_pgste(mm)) 1180 if (mm_has_pgste(mm)) {
1150 pgste = pgste_get_lock(ptep); 1181 pgste = pgste_get_lock(ptep);
1182 pgste = pgste_ipte_notify(mm, address, ptep, pgste);
1183 }
1151 1184
1152 if (!mm_exclusive(mm)) 1185 if (!mm_exclusive(mm))
1153 __ptep_ipte(address, ptep); 1186 __ptep_ipte(address, ptep);
@@ -1171,8 +1204,10 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
1171 1204
1172 if (pte_same(*ptep, entry)) 1205 if (pte_same(*ptep, entry))
1173 return 0; 1206 return 0;
1174 if (mm_has_pgste(vma->vm_mm)) 1207 if (mm_has_pgste(vma->vm_mm)) {
1175 pgste = pgste_get_lock(ptep); 1208 pgste = pgste_get_lock(ptep);
1209 pgste = pgste_ipte_notify(vma->vm_mm, address, ptep, pgste);
1210 }
1176 1211
1177 __ptep_ipte(address, ptep); 1212 __ptep_ipte(address, ptep);
1178 1213
@@ -1276,31 +1311,7 @@ static inline void __pmd_idte(unsigned long address, pmd_t *pmdp)
1276 } 1311 }
1277} 1312}
1278 1313
1279#ifdef CONFIG_TRANSPARENT_HUGEPAGE 1314#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLB_PAGE)
1280
1281#define SEGMENT_NONE __pgprot(_HPAGE_TYPE_NONE)
1282#define SEGMENT_RO __pgprot(_HPAGE_TYPE_RO)
1283#define SEGMENT_RW __pgprot(_HPAGE_TYPE_RW)
1284
1285#define __HAVE_ARCH_PGTABLE_DEPOSIT
1286extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
1287
1288#define __HAVE_ARCH_PGTABLE_WITHDRAW
1289extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
1290
1291static inline int pmd_trans_splitting(pmd_t pmd)
1292{
1293 return pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT;
1294}
1295
1296static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1297 pmd_t *pmdp, pmd_t entry)
1298{
1299 if (!(pmd_val(entry) & _SEGMENT_ENTRY_INV) && MACHINE_HAS_EDAT1)
1300 pmd_val(entry) |= _SEGMENT_ENTRY_CO;
1301 *pmdp = entry;
1302}
1303
1304static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot) 1315static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
1305{ 1316{
1306 /* 1317 /*
@@ -1321,10 +1332,11 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
1321 return pmd; 1332 return pmd;
1322} 1333}
1323 1334
1324static inline pmd_t pmd_mkhuge(pmd_t pmd) 1335static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
1325{ 1336{
1326 pmd_val(pmd) |= _SEGMENT_ENTRY_LARGE; 1337 pmd_t __pmd;
1327 return pmd; 1338 pmd_val(__pmd) = physpage + massage_pgprot_pmd(pgprot);
1339 return __pmd;
1328} 1340}
1329 1341
1330static inline pmd_t pmd_mkwrite(pmd_t pmd) 1342static inline pmd_t pmd_mkwrite(pmd_t pmd)
@@ -1334,6 +1346,34 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
1334 pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO; 1346 pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
1335 return pmd; 1347 return pmd;
1336} 1348}
1349#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLB_PAGE */
1350
1351#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1352
1353#define __HAVE_ARCH_PGTABLE_DEPOSIT
1354extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
1355
1356#define __HAVE_ARCH_PGTABLE_WITHDRAW
1357extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
1358
1359static inline int pmd_trans_splitting(pmd_t pmd)
1360{
1361 return pmd_val(pmd) & _SEGMENT_ENTRY_SPLIT;
1362}
1363
1364static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1365 pmd_t *pmdp, pmd_t entry)
1366{
1367 if (!(pmd_val(entry) & _SEGMENT_ENTRY_INV) && MACHINE_HAS_EDAT1)
1368 pmd_val(entry) |= _SEGMENT_ENTRY_CO;
1369 *pmdp = entry;
1370}
1371
1372static inline pmd_t pmd_mkhuge(pmd_t pmd)
1373{
1374 pmd_val(pmd) |= _SEGMENT_ENTRY_LARGE;
1375 return pmd;
1376}
1337 1377
1338static inline pmd_t pmd_wrprotect(pmd_t pmd) 1378static inline pmd_t pmd_wrprotect(pmd_t pmd)
1339{ 1379{
@@ -1430,13 +1470,6 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
1430 } 1470 }
1431} 1471}
1432 1472
1433static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
1434{
1435 pmd_t __pmd;
1436 pmd_val(__pmd) = physpage + massage_pgprot_pmd(pgprot);
1437 return __pmd;
1438}
1439
1440#define pfn_pmd(pfn, pgprot) mk_pmd_phys(__pa((pfn) << PAGE_SHIFT), (pgprot)) 1473#define pfn_pmd(pfn, pgprot) mk_pmd_phys(__pa((pfn) << PAGE_SHIFT), (pgprot))
1441#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot)) 1474#define mk_pmd(page, pgprot) pfn_pmd(page_to_pfn(page), (pgprot))
1442 1475
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 94e749c90230..6b499870662f 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -161,7 +161,8 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
161 161
162extern void show_code(struct pt_regs *regs); 162extern void show_code(struct pt_regs *regs);
163extern void print_fn_code(unsigned char *code, unsigned long len); 163extern void print_fn_code(unsigned char *code, unsigned long len);
164extern int insn_to_mnemonic(unsigned char *instruction, char buf[8]); 164extern int insn_to_mnemonic(unsigned char *instruction, char *buf,
165 unsigned int len);
165 166
166unsigned long get_wchan(struct task_struct *p); 167unsigned long get_wchan(struct task_struct *p);
167#define task_pt_regs(tsk) ((struct pt_regs *) \ 168#define task_pt_regs(tsk) ((struct pt_regs *) \
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 3ee5da3bc10c..559512a455da 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -9,9 +9,7 @@
9#include <uapi/asm/ptrace.h> 9#include <uapi/asm/ptrace.h>
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12#ifndef __s390x__ 12
13#else /* __s390x__ */
14#endif /* __s390x__ */
15extern long psw_kernel_bits; 13extern long psw_kernel_bits;
16extern long psw_user_bits; 14extern long psw_user_bits;
17 15
@@ -77,8 +75,6 @@ struct per_struct_kernel {
77#define PER_CONTROL_SUSPENSION 0x00400000UL 75#define PER_CONTROL_SUSPENSION 0x00400000UL
78#define PER_CONTROL_ALTERATION 0x00200000UL 76#define PER_CONTROL_ALTERATION 0x00200000UL
79 77
80#ifdef __s390x__
81#endif /* __s390x__ */
82/* 78/*
83 * These are defined as per linux/ptrace.h, which see. 79 * These are defined as per linux/ptrace.h, which see.
84 */ 80 */
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index ff67d730c00c..59880dbaf360 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -33,8 +33,6 @@
33 33
34#define CHUNK_READ_WRITE 0 34#define CHUNK_READ_WRITE 0
35#define CHUNK_READ_ONLY 1 35#define CHUNK_READ_ONLY 1
36#define CHUNK_OLDMEM 4
37#define CHUNK_CRASHK 5
38 36
39struct mem_chunk { 37struct mem_chunk {
40 unsigned long addr; 38 unsigned long addr;
@@ -43,13 +41,12 @@ struct mem_chunk {
43}; 41};
44 42
45extern struct mem_chunk memory_chunk[]; 43extern struct mem_chunk memory_chunk[];
46extern unsigned long real_memory_size;
47extern int memory_end_set; 44extern int memory_end_set;
48extern unsigned long memory_end; 45extern unsigned long memory_end;
49 46
50void detect_memory_layout(struct mem_chunk chunk[]); 47void detect_memory_layout(struct mem_chunk chunk[], unsigned long maxsize);
51void create_mem_hole(struct mem_chunk memory_chunk[], unsigned long addr, 48void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
52 unsigned long size, int type); 49 unsigned long size);
53 50
54#define PRIMARY_SPACE_MODE 0 51#define PRIMARY_SPACE_MODE 0
55#define ACCESS_REGISTER_MODE 1 52#define ACCESS_REGISTER_MODE 1
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index fe7b99759e12..cd29d2f4e4f3 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -23,6 +23,7 @@
23 * type here is what we want [need] for both 32 bit and 64 bit systems. 23 * type here is what we want [need] for both 32 bit and 64 bit systems.
24 */ 24 */
25extern const unsigned int sys_call_table[]; 25extern const unsigned int sys_call_table[];
26extern const unsigned int sys_call_table_emu[];
26 27
27static inline long syscall_get_nr(struct task_struct *task, 28static inline long syscall_get_nr(struct task_struct *task,
28 struct pt_regs *regs) 29 struct pt_regs *regs)
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 9e2cfe0349c3..eb5f64d26d06 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -14,13 +14,8 @@
14#define THREAD_ORDER 1 14#define THREAD_ORDER 1
15#define ASYNC_ORDER 1 15#define ASYNC_ORDER 1
16#else /* CONFIG_64BIT */ 16#else /* CONFIG_64BIT */
17#ifndef __SMALL_STACK
18#define THREAD_ORDER 2 17#define THREAD_ORDER 2
19#define ASYNC_ORDER 2 18#define ASYNC_ORDER 2
20#else
21#define THREAD_ORDER 1
22#define ASYNC_ORDER 1
23#endif
24#endif /* CONFIG_64BIT */ 19#endif /* CONFIG_64BIT */
25 20
26#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) 21#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
@@ -41,6 +36,7 @@ struct thread_info {
41 struct task_struct *task; /* main task structure */ 36 struct task_struct *task; /* main task structure */
42 struct exec_domain *exec_domain; /* execution domain */ 37 struct exec_domain *exec_domain; /* execution domain */
43 unsigned long flags; /* low level flags */ 38 unsigned long flags; /* low level flags */
39 unsigned long sys_call_table; /* System call table address */
44 unsigned int cpu; /* current CPU */ 40 unsigned int cpu; /* current CPU */
45 int preempt_count; /* 0 => preemptable, <0 => BUG */ 41 int preempt_count; /* 0 => preemptable, <0 => BUG */
46 struct restart_block restart_block; 42 struct restart_block restart_block;
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index a6667a952969..651886353551 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -54,12 +54,4 @@
54#define __ARCH_WANT_SYS_VFORK 54#define __ARCH_WANT_SYS_VFORK
55#define __ARCH_WANT_SYS_CLONE 55#define __ARCH_WANT_SYS_CLONE
56 56
57/*
58 * "Conditional" syscalls
59 *
60 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
61 * but it doesn't work on all toolchains, so we just do it by hand
62 */
63#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
64
65#endif /* _ASM_S390_UNISTD_H_ */ 57#endif /* _ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index 7bf68fff7c5d..9ccd1905bdad 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -44,5 +44,6 @@ header-y += termios.h
44header-y += types.h 44header-y += types.h
45header-y += ucontext.h 45header-y += ucontext.h
46header-y += unistd.h 46header-y += unistd.h
47header-y += virtio-ccw.h
47header-y += vtoc.h 48header-y += vtoc.h
48header-y += zcrypt.h 49header-y += zcrypt.h
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
index a5ca214b34fd..3aa9f1ec5b29 100644
--- a/arch/s390/include/uapi/asm/ptrace.h
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -215,12 +215,6 @@ typedef struct
215 unsigned long addr; 215 unsigned long addr;
216} __attribute__ ((aligned(8))) psw_t; 216} __attribute__ ((aligned(8))) psw_t;
217 217
218typedef struct
219{
220 __u32 mask;
221 __u32 addr;
222} __attribute__ ((aligned(8))) psw_compat_t;
223
224#ifndef __s390x__ 218#ifndef __s390x__
225 219
226#define PSW_MASK_PER 0x40000000UL 220#define PSW_MASK_PER 0x40000000UL
@@ -295,20 +289,6 @@ typedef struct
295 unsigned long orig_gpr2; 289 unsigned long orig_gpr2;
296} s390_regs; 290} s390_regs;
297 291
298typedef struct
299{
300 psw_compat_t psw;
301 __u32 gprs[NUM_GPRS];
302 __u32 acrs[NUM_ACRS];
303 __u32 orig_gpr2;
304} s390_compat_regs;
305
306typedef struct
307{
308 __u32 gprs_high[NUM_GPRS];
309} s390_compat_regs_high;
310
311
312/* 292/*
313 * Now for the user space program event recording (trace) definitions. 293 * Now for the user space program event recording (trace) definitions.
314 * The following structures are used only for the ptrace interface, don't 294 * The following structures are used only for the ptrace interface, don't
diff --git a/arch/s390/include/uapi/asm/statfs.h b/arch/s390/include/uapi/asm/statfs.h
index 5acca0a34c20..a61d538756f2 100644
--- a/arch/s390/include/uapi/asm/statfs.h
+++ b/arch/s390/include/uapi/asm/statfs.h
@@ -7,9 +7,6 @@
7#ifndef _S390_STATFS_H 7#ifndef _S390_STATFS_H
8#define _S390_STATFS_H 8#define _S390_STATFS_H
9 9
10#ifndef __s390x__
11#include <asm-generic/statfs.h>
12#else
13/* 10/*
14 * We can't use <asm-generic/statfs.h> because in 64-bit mode 11 * We can't use <asm-generic/statfs.h> because in 64-bit mode
15 * we mix ints of different sizes in our struct statfs. 12 * we mix ints of different sizes in our struct statfs.
@@ -21,49 +18,33 @@ typedef __kernel_fsid_t fsid_t;
21#endif 18#endif
22 19
23struct statfs { 20struct statfs {
24 int f_type; 21 unsigned int f_type;
25 int f_bsize; 22 unsigned int f_bsize;
26 long f_blocks; 23 unsigned long f_blocks;
27 long f_bfree; 24 unsigned long f_bfree;
28 long f_bavail; 25 unsigned long f_bavail;
29 long f_files; 26 unsigned long f_files;
30 long f_ffree; 27 unsigned long f_ffree;
31 __kernel_fsid_t f_fsid; 28 __kernel_fsid_t f_fsid;
32 int f_namelen; 29 unsigned int f_namelen;
33 int f_frsize; 30 unsigned int f_frsize;
34 int f_flags; 31 unsigned int f_flags;
35 int f_spare[4]; 32 unsigned int f_spare[4];
36}; 33};
37 34
38struct statfs64 { 35struct statfs64 {
39 int f_type; 36 unsigned int f_type;
40 int f_bsize; 37 unsigned int f_bsize;
41 long f_blocks; 38 unsigned long f_blocks;
42 long f_bfree; 39 unsigned long f_bfree;
43 long f_bavail; 40 unsigned long f_bavail;
44 long f_files; 41 unsigned long f_files;
45 long f_ffree; 42 unsigned long f_ffree;
46 __kernel_fsid_t f_fsid; 43 __kernel_fsid_t f_fsid;
47 int f_namelen; 44 unsigned int f_namelen;
48 int f_frsize; 45 unsigned int f_frsize;
49 int f_flags; 46 unsigned int f_flags;
50 int f_spare[4]; 47 unsigned int f_spare[4];
51}; 48};
52 49
53struct compat_statfs64 {
54 __u32 f_type;
55 __u32 f_bsize;
56 __u64 f_blocks;
57 __u64 f_bfree;
58 __u64 f_bavail;
59 __u64 f_files;
60 __u64 f_ffree;
61 __kernel_fsid_t f_fsid;
62 __u32 f_namelen;
63 __u32 f_frsize;
64 __u32 f_flags;
65 __u32 f_spare[4];
66};
67
68#endif /* __s390x__ */
69#endif 50#endif
diff --git a/arch/s390/include/uapi/asm/virtio-ccw.h b/arch/s390/include/uapi/asm/virtio-ccw.h
new file mode 100644
index 000000000000..a9a4ebf79fa7
--- /dev/null
+++ b/arch/s390/include/uapi/asm/virtio-ccw.h
@@ -0,0 +1,21 @@
1/*
2 * Definitions for virtio-ccw devices.
3 *
4 * Copyright IBM Corp. 2013
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 only)
8 * as published by the Free Software Foundation.
9 *
10 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
11 */
12#ifndef __KVM_VIRTIO_CCW_H
13#define __KVM_VIRTIO_CCW_H
14
15/* Alignment of vring buffers. */
16#define KVM_VIRTIO_CCW_RING_ALIGN 4096
17
18/* Subcode for diagnose 500 (virtio hypercall). */
19#define KVM_S390_VIRTIO_CCW_NOTIFY 3
20
21#endif
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 2ac311ef5c9b..4bb2a4656163 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -14,16 +14,25 @@ endif
14CFLAGS_smp.o := -Wno-nonnull 14CFLAGS_smp.o := -Wno-nonnull
15 15
16# 16#
17# Disable tailcall optimizations for stack / callchain walking functions
18# since this might generate broken code when accessing register 15 and
19# passing its content to other functions.
20#
21CFLAGS_stacktrace.o += -fno-optimize-sibling-calls
22CFLAGS_dumpstack.o += -fno-optimize-sibling-calls
23
24#
17# Pass UTS_MACHINE for user_regset definition 25# Pass UTS_MACHINE for user_regset definition
18# 26#
19CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' 27CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
20 28
21CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w 29CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
22 30
23obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o \ 31obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o
24 processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o \ 32obj-y += processor.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o
25 debug.o irq.o ipl.o dis.o diag.o mem_detect.o sclp.o vdso.o \ 33obj-y += debug.o irq.o ipl.o dis.o diag.o sclp.o vdso.o
26 sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o 34obj-y += sysinfo.o jump_label.o lgr.o os_info.o machine_kexec.o pgm_check.o
35obj-y += dumpstack.o
27 36
28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 37obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 38obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index fface87056eb..7a82f9f70100 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -35,6 +35,7 @@ int main(void)
35 DEFINE(__TI_task, offsetof(struct thread_info, task)); 35 DEFINE(__TI_task, offsetof(struct thread_info, task));
36 DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain)); 36 DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain));
37 DEFINE(__TI_flags, offsetof(struct thread_info, flags)); 37 DEFINE(__TI_flags, offsetof(struct thread_info, flags));
38 DEFINE(__TI_sysc_table, offsetof(struct thread_info, sys_call_table));
38 DEFINE(__TI_cpu, offsetof(struct thread_info, cpu)); 39 DEFINE(__TI_cpu, offsetof(struct thread_info, cpu));
39 DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count)); 40 DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count));
40 DEFINE(__TI_user_timer, offsetof(struct thread_info, user_timer)); 41 DEFINE(__TI_user_timer, offsetof(struct thread_info, user_timer));
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 19f26de27fae..8b6e4f5288a2 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -288,51 +288,13 @@ asmlinkage long sys32_getegid16(void)
288 return high2lowgid(from_kgid_munged(current_user_ns(), current_egid())); 288 return high2lowgid(from_kgid_munged(current_user_ns(), current_egid()));
289} 289}
290 290
291/*
292 * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation.
293 *
294 * This is really horribly ugly.
295 */
296#ifdef CONFIG_SYSVIPC 291#ifdef CONFIG_SYSVIPC
297asmlinkage long sys32_ipc(u32 call, int first, int second, int third, u32 ptr) 292COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
293 unsigned long, third, compat_uptr_t, ptr)
298{ 294{
299 if (call >> 16) /* hack for backward compatibility */ 295 if (call >> 16) /* hack for backward compatibility */
300 return -EINVAL; 296 return -EINVAL;
301 switch (call) { 297 return compat_sys_ipc(call, first, second, third, ptr, third);
302 case SEMTIMEDOP:
303 return compat_sys_semtimedop(first, compat_ptr(ptr),
304 second, compat_ptr(third));
305 case SEMOP:
306 /* struct sembuf is the same on 32 and 64bit :)) */
307 return sys_semtimedop(first, compat_ptr(ptr),
308 second, NULL);
309 case SEMGET:
310 return sys_semget(first, second, third);
311 case SEMCTL:
312 return compat_sys_semctl(first, second, third,
313 compat_ptr(ptr));
314 case MSGSND:
315 return compat_sys_msgsnd(first, second, third,
316 compat_ptr(ptr));
317 case MSGRCV:
318 return compat_sys_msgrcv(first, second, 0, third,
319 0, compat_ptr(ptr));
320 case MSGGET:
321 return sys_msgget((key_t) first, second);
322 case MSGCTL:
323 return compat_sys_msgctl(first, second, compat_ptr(ptr));
324 case SHMAT:
325 return compat_sys_shmat(first, second, third,
326 0, compat_ptr(ptr));
327 case SHMDT:
328 return sys_shmdt(compat_ptr(ptr));
329 case SHMGET:
330 return sys_shmget(first, (unsigned)second, third);
331 case SHMCTL:
332 return compat_sys_shmctl(first, second, compat_ptr(ptr));
333 }
334
335 return -ENOSYS;
336} 298}
337#endif 299#endif
338 300
@@ -373,48 +335,6 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
373 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 335 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
374} 336}
375 337
376asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count)
377{
378 mm_segment_t old_fs = get_fs();
379 int ret;
380 off_t of;
381
382 if (offset && get_user(of, offset))
383 return -EFAULT;
384
385 set_fs(KERNEL_DS);
386 ret = sys_sendfile(out_fd, in_fd,
387 offset ? (off_t __force __user *) &of : NULL, count);
388 set_fs(old_fs);
389
390 if (offset && put_user(of, offset))
391 return -EFAULT;
392
393 return ret;
394}
395
396asmlinkage long sys32_sendfile64(int out_fd, int in_fd,
397 compat_loff_t __user *offset, s32 count)
398{
399 mm_segment_t old_fs = get_fs();
400 int ret;
401 loff_t lof;
402
403 if (offset && get_user(lof, offset))
404 return -EFAULT;
405
406 set_fs(KERNEL_DS);
407 ret = sys_sendfile64(out_fd, in_fd,
408 offset ? (loff_t __force __user *) &lof : NULL,
409 count);
410 set_fs(old_fs);
411
412 if (offset && put_user(lof, offset))
413 return -EFAULT;
414
415 return ret;
416}
417
418struct stat64_emu31 { 338struct stat64_emu31 {
419 unsigned long long st_dev; 339 unsigned long long st_dev;
420 unsigned int __pad1; 340 unsigned int __pad1;
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 00d92a5a6f6c..976518c0592a 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -94,7 +94,6 @@ long sys32_getuid16(void);
94long sys32_geteuid16(void); 94long sys32_geteuid16(void);
95long sys32_getgid16(void); 95long sys32_getgid16(void);
96long sys32_getegid16(void); 96long sys32_getegid16(void);
97long sys32_ipc(u32 call, int first, int second, int third, u32 ptr);
98long sys32_truncate64(const char __user * path, unsigned long high, 97long sys32_truncate64(const char __user * path, unsigned long high,
99 unsigned long low); 98 unsigned long low);
100long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low); 99long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low);
@@ -106,10 +105,6 @@ long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
106long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 105long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
107 size_t count, u32 poshi, u32 poslo); 106 size_t count, u32 poshi, u32 poslo);
108compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count); 107compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count);
109long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
110 size_t count);
111long sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset,
112 s32 count);
113long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf); 108long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf);
114long sys32_lstat64(const char __user * filename, 109long sys32_lstat64(const char __user * filename,
115 struct stat64_emu31 __user * statbuf); 110 struct stat64_emu31 __user * statbuf);
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 6de049fbe62d..c439ac9ced09 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -362,6 +362,7 @@ static int setup_frame32(int sig, struct k_sigaction *ka,
362 /* set extra registers only for synchronous signals */ 362 /* set extra registers only for synchronous signals */
363 regs->gprs[4] = regs->int_code & 127; 363 regs->gprs[4] = regs->int_code & 127;
364 regs->gprs[5] = regs->int_parm_long; 364 regs->gprs[5] = regs->int_parm_long;
365 regs->gprs[6] = task_thread_info(current)->last_break;
365 } 366 }
366 367
367 /* Place signal number on stack to allow backtrace from handler. */ 368 /* Place signal number on stack to allow backtrace from handler. */
@@ -421,6 +422,7 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
421 regs->gprs[2] = map_signal(sig); 422 regs->gprs[2] = map_signal(sig);
422 regs->gprs[3] = (__force __u64) &frame->info; 423 regs->gprs[3] = (__force __u64) &frame->info;
423 regs->gprs[4] = (__force __u64) &frame->uc; 424 regs->gprs[4] = (__force __u64) &frame->uc;
425 regs->gprs[5] = task_thread_info(current)->last_break;
424 return 0; 426 return 0;
425 427
426give_sigsegv: 428give_sigsegv:
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 3c98c4dc5aca..2d72d9e96c15 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -258,11 +258,6 @@ ENTRY(sys32_mmap2_wrapper)
258 llgtr %r2,%r2 # struct mmap_arg_struct_emu31 * 258 llgtr %r2,%r2 # struct mmap_arg_struct_emu31 *
259 jg sys32_mmap2 # branch to system call 259 jg sys32_mmap2 # branch to system call
260 260
261ENTRY(compat_sys_getrusage_wrapper)
262 lgfr %r2,%r2 # int
263 llgtr %r3,%r3 # struct rusage_emu31 *
264 jg compat_sys_getrusage # branch to system call
265
266ENTRY(compat_sys_gettimeofday_wrapper) 261ENTRY(compat_sys_gettimeofday_wrapper)
267 llgtr %r2,%r2 # struct timeval_emu31 * 262 llgtr %r2,%r2 # struct timeval_emu31 *
268 llgtr %r3,%r3 # struct timezone * 263 llgtr %r3,%r3 # struct timezone *
@@ -393,14 +388,6 @@ ENTRY(compat_sys_sysinfo_wrapper)
393 llgtr %r2,%r2 # struct sysinfo_emu31 * 388 llgtr %r2,%r2 # struct sysinfo_emu31 *
394 jg compat_sys_sysinfo # branch to system call 389 jg compat_sys_sysinfo # branch to system call
395 390
396ENTRY(sys32_ipc_wrapper)
397 llgfr %r2,%r2 # uint
398 lgfr %r3,%r3 # int
399 lgfr %r4,%r4 # int
400 lgfr %r5,%r5 # int
401 llgfr %r6,%r6 # u32
402 jg sys32_ipc # branch to system call
403
404ENTRY(sys32_fsync_wrapper) 391ENTRY(sys32_fsync_wrapper)
405 llgfr %r2,%r2 # unsigned int 392 llgfr %r2,%r2 # unsigned int
406 jg sys_fsync # branch to system call 393 jg sys_fsync # branch to system call
@@ -666,13 +653,6 @@ ENTRY(sys32_capset_wrapper)
666 llgtr %r3,%r3 # const cap_user_data_t 653 llgtr %r3,%r3 # const cap_user_data_t
667 jg sys_capset # branch to system call 654 jg sys_capset # branch to system call
668 655
669ENTRY(sys32_sendfile_wrapper)
670 lgfr %r2,%r2 # int
671 lgfr %r3,%r3 # int
672 llgtr %r4,%r4 # __kernel_off_emu31_t *
673 llgfr %r5,%r5 # size_t
674 jg sys32_sendfile # branch to system call
675
676#sys32_vfork_wrapper # done in vfork_glue 656#sys32_vfork_wrapper # done in vfork_glue
677 657
678ENTRY(sys32_truncate64_wrapper) 658ENTRY(sys32_truncate64_wrapper)
@@ -938,13 +918,6 @@ ENTRY(sys_epoll_wait_wrapper)
938 lgfr %r5,%r5 # int 918 lgfr %r5,%r5 # int
939 jg sys_epoll_wait # branch to system call 919 jg sys_epoll_wait # branch to system call
940 920
941ENTRY(sys32_lookup_dcookie_wrapper)
942 sllg %r2,%r2,32 # get high word of 64bit dcookie
943 or %r2,%r3 # get low word of 64bit dcookie
944 llgtr %r3,%r4 # char *
945 llgfr %r4,%r5 # size_t
946 jg sys_lookup_dcookie
947
948ENTRY(sys32_fadvise64_wrapper) 921ENTRY(sys32_fadvise64_wrapper)
949 lgfr %r2,%r2 # int 922 lgfr %r2,%r2 # int
950 sllg %r3,%r3,32 # get high word of 64bit loff_t 923 sllg %r3,%r3,32 # get high word of 64bit loff_t
@@ -1264,29 +1237,12 @@ ENTRY(sys_tee_wrapper)
1264 llgfr %r5,%r5 # unsigned int 1237 llgfr %r5,%r5 # unsigned int
1265 jg sys_tee 1238 jg sys_tee
1266 1239
1267ENTRY(compat_sys_vmsplice_wrapper)
1268 lgfr %r2,%r2 # int
1269 llgtr %r3,%r3 # compat_iovec *
1270 llgfr %r4,%r4 # unsigned int
1271 llgfr %r5,%r5 # unsigned int
1272 jg compat_sys_vmsplice
1273
1274ENTRY(sys_getcpu_wrapper) 1240ENTRY(sys_getcpu_wrapper)
1275 llgtr %r2,%r2 # unsigned * 1241 llgtr %r2,%r2 # unsigned *
1276 llgtr %r3,%r3 # unsigned * 1242 llgtr %r3,%r3 # unsigned *
1277 llgtr %r4,%r4 # struct getcpu_cache * 1243 llgtr %r4,%r4 # struct getcpu_cache *
1278 jg sys_getcpu 1244 jg sys_getcpu
1279 1245
1280ENTRY(compat_sys_epoll_pwait_wrapper)
1281 lgfr %r2,%r2 # int
1282 llgtr %r3,%r3 # struct compat_epoll_event *
1283 lgfr %r4,%r4 # int
1284 lgfr %r5,%r5 # int
1285 llgtr %r6,%r6 # compat_sigset_t *
1286 llgf %r0,164(%r15) # compat_size_t
1287 stg %r0,160(%r15)
1288 jg compat_sys_epoll_pwait
1289
1290ENTRY(compat_sys_utimes_wrapper) 1246ENTRY(compat_sys_utimes_wrapper)
1291 llgtr %r2,%r2 # char * 1247 llgtr %r2,%r2 # char *
1292 llgtr %r3,%r3 # struct compat_timeval * 1248 llgtr %r3,%r3 # struct compat_timeval *
@@ -1299,12 +1255,6 @@ ENTRY(compat_sys_utimensat_wrapper)
1299 lgfr %r5,%r5 # int 1255 lgfr %r5,%r5 # int
1300 jg compat_sys_utimensat 1256 jg compat_sys_utimensat
1301 1257
1302ENTRY(compat_sys_signalfd_wrapper)
1303 lgfr %r2,%r2 # int
1304 llgtr %r3,%r3 # compat_sigset_t *
1305 llgfr %r4,%r4 # compat_size_t
1306 jg compat_sys_signalfd
1307
1308ENTRY(sys_eventfd_wrapper) 1258ENTRY(sys_eventfd_wrapper)
1309 llgfr %r2,%r2 # unsigned int 1259 llgfr %r2,%r2 # unsigned int
1310 jg sys_eventfd 1260 jg sys_eventfd
@@ -1323,13 +1273,6 @@ ENTRY(sys_timerfd_create_wrapper)
1323 lgfr %r3,%r3 # int 1273 lgfr %r3,%r3 # int
1324 jg sys_timerfd_create 1274 jg sys_timerfd_create
1325 1275
1326ENTRY(compat_sys_signalfd4_wrapper)
1327 lgfr %r2,%r2 # int
1328 llgtr %r3,%r3 # compat_sigset_t *
1329 llgfr %r4,%r4 # compat_size_t
1330 lgfr %r5,%r5 # int
1331 jg compat_sys_signalfd4
1332
1333ENTRY(sys_eventfd2_wrapper) 1276ENTRY(sys_eventfd2_wrapper)
1334 llgfr %r2,%r2 # unsigned int 1277 llgfr %r2,%r2 # unsigned int
1335 lgfr %r3,%r3 # int 1278 lgfr %r3,%r3 # int
@@ -1361,13 +1304,6 @@ ENTRY(sys32_readahead_wrapper)
1361 lgfr %r5,%r5 # s32 1304 lgfr %r5,%r5 # s32
1362 jg sys32_readahead # branch to system call 1305 jg sys32_readahead # branch to system call
1363 1306
1364ENTRY(sys32_sendfile64_wrapper)
1365 lgfr %r2,%r2 # int
1366 lgfr %r3,%r3 # int
1367 llgtr %r4,%r4 # compat_loff_t *
1368 lgfr %r5,%r5 # s32
1369 jg sys32_sendfile64 # branch to system call
1370
1371ENTRY(sys_tkill_wrapper) 1307ENTRY(sys_tkill_wrapper)
1372 lgfr %r2,%r2 # pid_t 1308 lgfr %r2,%r2 # pid_t
1373 lgfr %r3,%r3 # int 1309 lgfr %r3,%r3 # int
@@ -1387,22 +1323,6 @@ ENTRY(compat_sys_keyctl_wrapper)
1387 llgfr %r6,%r6 # u32 1323 llgfr %r6,%r6 # u32
1388 jg compat_sys_keyctl # branch to system call 1324 jg compat_sys_keyctl # branch to system call
1389 1325
1390ENTRY(compat_sys_preadv_wrapper)
1391 llgfr %r2,%r2 # unsigned long
1392 llgtr %r3,%r3 # compat_iovec *
1393 llgfr %r4,%r4 # unsigned long
1394 llgfr %r5,%r5 # u32
1395 llgfr %r6,%r6 # u32
1396 jg compat_sys_preadv # branch to system call
1397
1398ENTRY(compat_sys_pwritev_wrapper)
1399 llgfr %r2,%r2 # unsigned long
1400 llgtr %r3,%r3 # compat_iovec *
1401 llgfr %r4,%r4 # unsigned long
1402 llgfr %r5,%r5 # u32
1403 llgfr %r6,%r6 # u32
1404 jg compat_sys_pwritev # branch to system call
1405
1406ENTRY(sys_perf_event_open_wrapper) 1326ENTRY(sys_perf_event_open_wrapper)
1407 llgtr %r2,%r2 # const struct perf_event_attr * 1327 llgtr %r2,%r2 # const struct perf_event_attr *
1408 lgfr %r3,%r3 # pid_t 1328 lgfr %r3,%r3 # pid_t
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index fb8d8781a011..f703d91bf720 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -88,8 +88,8 @@ static struct mem_chunk *get_memory_layout(void)
88 struct mem_chunk *chunk_array; 88 struct mem_chunk *chunk_array;
89 89
90 chunk_array = kzalloc_panic(MEMORY_CHUNKS * sizeof(struct mem_chunk)); 90 chunk_array = kzalloc_panic(MEMORY_CHUNKS * sizeof(struct mem_chunk));
91 detect_memory_layout(chunk_array); 91 detect_memory_layout(chunk_array, 0);
92 create_mem_hole(chunk_array, OLDMEM_BASE, OLDMEM_SIZE, CHUNK_CRASHK); 92 create_mem_hole(chunk_array, OLDMEM_BASE, OLDMEM_SIZE);
93 return chunk_array; 93 return chunk_array;
94} 94}
95 95
@@ -344,7 +344,7 @@ static int loads_init(Elf64_Phdr *phdr, u64 loads_offset)
344 for (i = 0; i < MEMORY_CHUNKS; i++) { 344 for (i = 0; i < MEMORY_CHUNKS; i++) {
345 mem_chunk = &chunk_array[i]; 345 mem_chunk = &chunk_array[i];
346 if (mem_chunk->size == 0) 346 if (mem_chunk->size == 0)
347 break; 347 continue;
348 if (chunk_array[i].type != CHUNK_READ_WRITE && 348 if (chunk_array[i].type != CHUNK_READ_WRITE &&
349 chunk_array[i].type != CHUNK_READ_ONLY) 349 chunk_array[i].type != CHUNK_READ_ONLY)
350 continue; 350 continue;
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index 3ad5e9540160..7f4a4a8c847c 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -1696,14 +1696,15 @@ static struct insn *find_insn(unsigned char *code)
1696 * insn_to_mnemonic - decode an s390 instruction 1696 * insn_to_mnemonic - decode an s390 instruction
1697 * @instruction: instruction to decode 1697 * @instruction: instruction to decode
1698 * @buf: buffer to fill with mnemonic 1698 * @buf: buffer to fill with mnemonic
1699 * @len: length of buffer
1699 * 1700 *
1700 * Decode the instruction at @instruction and store the corresponding 1701 * Decode the instruction at @instruction and store the corresponding
1701 * mnemonic into @buf. 1702 * mnemonic into @buf of length @len.
1702 * @buf is left unchanged if the instruction could not be decoded. 1703 * @buf is left unchanged if the instruction could not be decoded.
1703 * Returns: 1704 * Returns:
1704 * %0 on success, %-ENOENT if the instruction was not found. 1705 * %0 on success, %-ENOENT if the instruction was not found.
1705 */ 1706 */
1706int insn_to_mnemonic(unsigned char *instruction, char buf[8]) 1707int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len)
1707{ 1708{
1708 struct insn *insn; 1709 struct insn *insn;
1709 1710
@@ -1711,10 +1712,10 @@ int insn_to_mnemonic(unsigned char *instruction, char buf[8])
1711 if (!insn) 1712 if (!insn)
1712 return -ENOENT; 1713 return -ENOENT;
1713 if (insn->name[0] == '\0') 1714 if (insn->name[0] == '\0')
1714 snprintf(buf, 8, "%s", 1715 snprintf(buf, len, "%s",
1715 long_insn_name[(int) insn->name[1]]); 1716 long_insn_name[(int) insn->name[1]]);
1716 else 1717 else
1717 snprintf(buf, 8, "%.5s", insn->name); 1718 snprintf(buf, len, "%.5s", insn->name);
1718 return 0; 1719 return 0;
1719} 1720}
1720EXPORT_SYMBOL_GPL(insn_to_mnemonic); 1721EXPORT_SYMBOL_GPL(insn_to_mnemonic);
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c
new file mode 100644
index 000000000000..298297477257
--- /dev/null
+++ b/arch/s390/kernel/dumpstack.c
@@ -0,0 +1,212 @@
1/*
2 * Stack dumping functions
3 *
4 * Copyright IBM Corp. 1999, 2013
5 */
6
7#include <linux/kallsyms.h>
8#include <linux/hardirq.h>
9#include <linux/kprobes.h>
10#include <linux/utsname.h>
11#include <linux/export.h>
12#include <linux/kdebug.h>
13#include <linux/ptrace.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <asm/processor.h>
17#include <asm/debug.h>
18#include <asm/ipl.h>
19
20#ifndef CONFIG_64BIT
21#define LONG "%08lx "
22#define FOURLONG "%08lx %08lx %08lx %08lx\n"
23static int kstack_depth_to_print = 12;
24#else /* CONFIG_64BIT */
25#define LONG "%016lx "
26#define FOURLONG "%016lx %016lx %016lx %016lx\n"
27static int kstack_depth_to_print = 20;
28#endif /* CONFIG_64BIT */
29
30/*
31 * For show_trace we have tree different stack to consider:
32 * - the panic stack which is used if the kernel stack has overflown
33 * - the asynchronous interrupt stack (cpu related)
34 * - the synchronous kernel stack (process related)
35 * The stack trace can start at any of the three stack and can potentially
36 * touch all of them. The order is: panic stack, async stack, sync stack.
37 */
38static unsigned long
39__show_trace(unsigned long sp, unsigned long low, unsigned long high)
40{
41 struct stack_frame *sf;
42 struct pt_regs *regs;
43
44 while (1) {
45 sp = sp & PSW_ADDR_INSN;
46 if (sp < low || sp > high - sizeof(*sf))
47 return sp;
48 sf = (struct stack_frame *) sp;
49 printk("([<%016lx>] ", sf->gprs[8] & PSW_ADDR_INSN);
50 print_symbol("%s)\n", sf->gprs[8] & PSW_ADDR_INSN);
51 /* Follow the backchain. */
52 while (1) {
53 low = sp;
54 sp = sf->back_chain & PSW_ADDR_INSN;
55 if (!sp)
56 break;
57 if (sp <= low || sp > high - sizeof(*sf))
58 return sp;
59 sf = (struct stack_frame *) sp;
60 printk(" [<%016lx>] ", sf->gprs[8] & PSW_ADDR_INSN);
61 print_symbol("%s\n", sf->gprs[8] & PSW_ADDR_INSN);
62 }
63 /* Zero backchain detected, check for interrupt frame. */
64 sp = (unsigned long) (sf + 1);
65 if (sp <= low || sp > high - sizeof(*regs))
66 return sp;
67 regs = (struct pt_regs *) sp;
68 printk(" [<%016lx>] ", regs->psw.addr & PSW_ADDR_INSN);
69 print_symbol("%s\n", regs->psw.addr & PSW_ADDR_INSN);
70 low = sp;
71 sp = regs->gprs[15];
72 }
73}
74
75static void show_trace(struct task_struct *task, unsigned long *stack)
76{
77 register unsigned long __r15 asm ("15");
78 unsigned long sp;
79
80 sp = (unsigned long) stack;
81 if (!sp)
82 sp = task ? task->thread.ksp : __r15;
83 printk("Call Trace:\n");
84#ifdef CONFIG_CHECK_STACK
85 sp = __show_trace(sp, S390_lowcore.panic_stack - 4096,
86 S390_lowcore.panic_stack);
87#endif
88 sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE,
89 S390_lowcore.async_stack);
90 if (task)
91 __show_trace(sp, (unsigned long) task_stack_page(task),
92 (unsigned long) task_stack_page(task) + THREAD_SIZE);
93 else
94 __show_trace(sp, S390_lowcore.thread_info,
95 S390_lowcore.thread_info + THREAD_SIZE);
96 if (!task)
97 task = current;
98 debug_show_held_locks(task);
99}
100
101void show_stack(struct task_struct *task, unsigned long *sp)
102{
103 register unsigned long *__r15 asm ("15");
104 unsigned long *stack;
105 int i;
106
107 if (!sp)
108 stack = task ? (unsigned long *) task->thread.ksp : __r15;
109 else
110 stack = sp;
111
112 for (i = 0; i < kstack_depth_to_print; i++) {
113 if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
114 break;
115 if ((i * sizeof(long) % 32) == 0)
116 printk("%s ", i == 0 ? "" : "\n");
117 printk(LONG, *stack++);
118 }
119 printk("\n");
120 show_trace(task, sp);
121}
122
123static void show_last_breaking_event(struct pt_regs *regs)
124{
125#ifdef CONFIG_64BIT
126 printk("Last Breaking-Event-Address:\n");
127 printk(" [<%016lx>] ", regs->args[0] & PSW_ADDR_INSN);
128 print_symbol("%s\n", regs->args[0] & PSW_ADDR_INSN);
129#endif
130}
131
132static inline int mask_bits(struct pt_regs *regs, unsigned long bits)
133{
134 return (regs->psw.mask & bits) / ((~bits + 1) & bits);
135}
136
137void show_registers(struct pt_regs *regs)
138{
139 char *mode;
140
141 mode = user_mode(regs) ? "User" : "Krnl";
142 printk("%s PSW : %p %p",
143 mode, (void *) regs->psw.mask,
144 (void *) regs->psw.addr);
145 print_symbol(" (%s)\n", regs->psw.addr & PSW_ADDR_INSN);
146 printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x "
147 "P:%x AS:%x CC:%x PM:%x", mask_bits(regs, PSW_MASK_PER),
148 mask_bits(regs, PSW_MASK_DAT), mask_bits(regs, PSW_MASK_IO),
149 mask_bits(regs, PSW_MASK_EXT), mask_bits(regs, PSW_MASK_KEY),
150 mask_bits(regs, PSW_MASK_MCHECK), mask_bits(regs, PSW_MASK_WAIT),
151 mask_bits(regs, PSW_MASK_PSTATE), mask_bits(regs, PSW_MASK_ASC),
152 mask_bits(regs, PSW_MASK_CC), mask_bits(regs, PSW_MASK_PM));
153#ifdef CONFIG_64BIT
154 printk(" EA:%x", mask_bits(regs, PSW_MASK_EA | PSW_MASK_BA));
155#endif
156 printk("\n%s GPRS: " FOURLONG, mode,
157 regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]);
158 printk(" " FOURLONG,
159 regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]);
160 printk(" " FOURLONG,
161 regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]);
162 printk(" " FOURLONG,
163 regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]);
164 show_code(regs);
165}
166
167void show_regs(struct pt_regs *regs)
168{
169 show_regs_print_info(KERN_DEFAULT);
170 show_registers(regs);
171 /* Show stack backtrace if pt_regs is from kernel mode */
172 if (!user_mode(regs))
173 show_trace(NULL, (unsigned long *) regs->gprs[15]);
174 show_last_breaking_event(regs);
175}
176
177static DEFINE_SPINLOCK(die_lock);
178
179void die(struct pt_regs *regs, const char *str)
180{
181 static int die_counter;
182
183 oops_enter();
184 lgr_info_log();
185 debug_stop_all();
186 console_verbose();
187 spin_lock_irq(&die_lock);
188 bust_spinlocks(1);
189 printk("%s: %04x [#%d] ", str, regs->int_code & 0xffff, ++die_counter);
190#ifdef CONFIG_PREEMPT
191 printk("PREEMPT ");
192#endif
193#ifdef CONFIG_SMP
194 printk("SMP ");
195#endif
196#ifdef CONFIG_DEBUG_PAGEALLOC
197 printk("DEBUG_PAGEALLOC");
198#endif
199 printk("\n");
200 notify_die(DIE_OOPS, str, regs, 0, regs->int_code & 0xffff, SIGSEGV);
201 print_modules();
202 show_regs(regs);
203 bust_spinlocks(0);
204 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
205 spin_unlock_irq(&die_lock);
206 if (in_interrupt())
207 panic("Fatal exception in interrupt");
208 if (panic_on_oops)
209 panic("Fatal exception: panic_on_oops");
210 oops_exit();
211 do_exit(SIGSEGV);
212}
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index bda011e2f8ae..dc8770d7173c 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -482,7 +482,6 @@ void __init startup_init(void)
482 detect_machine_facilities(); 482 detect_machine_facilities();
483 setup_topology(); 483 setup_topology();
484 sclp_facilities_detect(); 484 sclp_facilities_detect();
485 detect_memory_layout(memory_chunk);
486#ifdef CONFIG_DYNAMIC_FTRACE 485#ifdef CONFIG_DYNAMIC_FTRACE
487 S390_lowcore.ftrace_func = (unsigned long)ftrace_caller; 486 S390_lowcore.ftrace_func = (unsigned long)ftrace_caller;
488#endif 487#endif
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 94feff7d6132..4d5e6f8a7978 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -45,6 +45,7 @@ _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
45 45
46STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 46STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
47STACK_SIZE = 1 << STACK_SHIFT 47STACK_SIZE = 1 << STACK_SHIFT
48STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
48 49
49#define BASED(name) name-system_call(%r13) 50#define BASED(name) name-system_call(%r13)
50 51
@@ -97,10 +98,10 @@ STACK_SIZE = 1 << STACK_SHIFT
97 sra %r14,\shift 98 sra %r14,\shift
98 jnz 1f 99 jnz 1f
99 CHECK_STACK 1<<\shift,\savearea 100 CHECK_STACK 1<<\shift,\savearea
101 ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
100 j 2f 102 j 2f
1011: l %r15,\stack # load target stack 1031: l %r15,\stack # load target stack
1022: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 1042: la %r11,STACK_FRAME_OVERHEAD(%r15)
103 la %r11,STACK_FRAME_OVERHEAD(%r15)
104 .endm 105 .endm
105 106
106 .macro ADD64 high,low,timer 107 .macro ADD64 high,low,timer
@@ -150,7 +151,7 @@ ENTRY(__switch_to)
150 l %r4,__THREAD_info(%r2) # get thread_info of prev 151 l %r4,__THREAD_info(%r2) # get thread_info of prev
151 l %r5,__THREAD_info(%r3) # get thread_info of next 152 l %r5,__THREAD_info(%r3) # get thread_info of next
152 lr %r15,%r5 153 lr %r15,%r5
153 ahi %r15,STACK_SIZE # end of kernel stack of next 154 ahi %r15,STACK_INIT # end of kernel stack of next
154 st %r3,__LC_CURRENT # store task struct of next 155 st %r3,__LC_CURRENT # store task struct of next
155 st %r5,__LC_THREAD_INFO # store thread info of next 156 st %r5,__LC_THREAD_INFO # store thread info of next
156 st %r15,__LC_KERNEL_STACK # store end of kernel stack 157 st %r15,__LC_KERNEL_STACK # store end of kernel stack
@@ -178,7 +179,6 @@ sysc_stm:
178 l %r13,__LC_SVC_NEW_PSW+4 179 l %r13,__LC_SVC_NEW_PSW+4
179sysc_per: 180sysc_per:
180 l %r15,__LC_KERNEL_STACK 181 l %r15,__LC_KERNEL_STACK
181 ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
182 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs 182 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
183sysc_vtime: 183sysc_vtime:
184 UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER 184 UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER
@@ -188,6 +188,7 @@ sysc_vtime:
188 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC 188 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
189sysc_do_svc: 189sysc_do_svc:
190 oi __TI_flags+3(%r12),_TIF_SYSCALL 190 oi __TI_flags+3(%r12),_TIF_SYSCALL
191 l %r10,__TI_sysc_table(%r12) # 31 bit system call table
191 lh %r8,__PT_INT_CODE+2(%r11) 192 lh %r8,__PT_INT_CODE+2(%r11)
192 sla %r8,2 # shift and test for svc0 193 sla %r8,2 # shift and test for svc0
193 jnz sysc_nr_ok 194 jnz sysc_nr_ok
@@ -198,7 +199,6 @@ sysc_do_svc:
198 lr %r8,%r1 199 lr %r8,%r1
199 sla %r8,2 200 sla %r8,2
200sysc_nr_ok: 201sysc_nr_ok:
201 l %r10,BASED(.Lsys_call_table) # 31 bit system call table
202 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 202 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
203 st %r2,__PT_ORIG_GPR2(%r11) 203 st %r2,__PT_ORIG_GPR2(%r11)
204 st %r7,STACK_FRAME_OVERHEAD(%r15) 204 st %r7,STACK_FRAME_OVERHEAD(%r15)
@@ -359,11 +359,11 @@ ENTRY(pgm_check_handler)
359 tm __LC_PGM_ILC+3,0x80 # check for per exception 359 tm __LC_PGM_ILC+3,0x80 # check for per exception
360 jnz pgm_svcper # -> single stepped svc 360 jnz pgm_svcper # -> single stepped svc
3610: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC 3610: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC
362 ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
362 j 2f 363 j 2f
3631: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER 3641: UPDATE_VTIME %r14,%r15,__LC_SYNC_ENTER_TIMER
364 l %r15,__LC_KERNEL_STACK 365 l %r15,__LC_KERNEL_STACK
3652: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 3662: la %r11,STACK_FRAME_OVERHEAD(%r15)
366 la %r11,STACK_FRAME_OVERHEAD(%r15)
367 stm %r0,%r7,__PT_R0(%r11) 367 stm %r0,%r7,__PT_R0(%r11)
368 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_SYNC 368 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_SYNC
369 stm %r8,%r9,__PT_PSW(%r11) 369 stm %r8,%r9,__PT_PSW(%r11)
@@ -485,7 +485,6 @@ io_work:
485# 485#
486io_work_user: 486io_work_user:
487 l %r1,__LC_KERNEL_STACK 487 l %r1,__LC_KERNEL_STACK
488 ahi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
489 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) 488 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
490 xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1) 489 xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1)
491 la %r11,STACK_FRAME_OVERHEAD(%r1) 490 la %r11,STACK_FRAME_OVERHEAD(%r1)
@@ -646,7 +645,6 @@ mcck_skip:
646 tm __PT_PSW+1(%r11),0x01 # returning to user ? 645 tm __PT_PSW+1(%r11),0x01 # returning to user ?
647 jno mcck_return 646 jno mcck_return
648 l %r1,__LC_KERNEL_STACK # switch to kernel stack 647 l %r1,__LC_KERNEL_STACK # switch to kernel stack
649 ahi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
650 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) 648 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
651 xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1) 649 xc __SF_BACKCHAIN(4,%r1),__SF_BACKCHAIN(%r1)
652 la %r11,STACK_FRAME_OVERHEAD(%r15) 650 la %r11,STACK_FRAME_OVERHEAD(%r15)
@@ -674,6 +672,7 @@ mcck_panic:
674 sra %r14,PAGE_SHIFT 672 sra %r14,PAGE_SHIFT
675 jz 0f 673 jz 0f
676 l %r15,__LC_PANIC_STACK 674 l %r15,__LC_PANIC_STACK
675 j mcck_skip
6770: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 6760: ahi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
678 j mcck_skip 677 j mcck_skip
679 678
@@ -714,12 +713,10 @@ ENTRY(restart_int_handler)
714 */ 713 */
715stack_overflow: 714stack_overflow:
716 l %r15,__LC_PANIC_STACK # change to panic stack 715 l %r15,__LC_PANIC_STACK # change to panic stack
717 ahi %r15,-__PT_SIZE # create pt_regs 716 la %r11,STACK_FRAME_OVERHEAD(%r15)
718 stm %r0,%r7,__PT_R0(%r15) 717 stm %r0,%r7,__PT_R0(%r11)
719 stm %r8,%r9,__PT_PSW(%r15) 718 stm %r8,%r9,__PT_PSW(%r11)
720 mvc __PT_R8(32,%r11),0(%r14) 719 mvc __PT_R8(32,%r11),0(%r14)
721 lr %r15,%r11
722 ahi %r15,-STACK_FRAME_OVERHEAD
723 l %r1,BASED(1f) 720 l %r1,BASED(1f)
724 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 721 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
725 lr %r2,%r11 # pass pointer to pt_regs 722 lr %r2,%r11 # pass pointer to pt_regs
@@ -799,15 +796,14 @@ cleanup_system_call:
799 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 796 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
800 # set up saved register 11 797 # set up saved register 11
801 l %r15,__LC_KERNEL_STACK 798 l %r15,__LC_KERNEL_STACK
802 ahi %r15,-__PT_SIZE 799 la %r9,STACK_FRAME_OVERHEAD(%r15)
803 st %r15,12(%r11) # r11 pt_regs pointer 800 st %r9,12(%r11) # r11 pt_regs pointer
804 # fill pt_regs 801 # fill pt_regs
805 mvc __PT_R8(32,%r15),__LC_SAVE_AREA_SYNC 802 mvc __PT_R8(32,%r9),__LC_SAVE_AREA_SYNC
806 stm %r0,%r7,__PT_R0(%r15) 803 stm %r0,%r7,__PT_R0(%r9)
807 mvc __PT_PSW(8,%r15),__LC_SVC_OLD_PSW 804 mvc __PT_PSW(8,%r9),__LC_SVC_OLD_PSW
808 mvc __PT_INT_CODE(4,%r15),__LC_SVC_ILC 805 mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC
809 # setup saved register 15 806 # setup saved register 15
810 ahi %r15,-STACK_FRAME_OVERHEAD
811 st %r15,28(%r11) # r15 stack pointer 807 st %r15,28(%r11) # r15 stack pointer
812 # set new psw address and exit 808 # set new psw address and exit
813 l %r9,BASED(cleanup_table+4) # sysc_do_svc + 0x80000000 809 l %r9,BASED(cleanup_table+4) # sysc_do_svc + 0x80000000
@@ -910,7 +906,6 @@ cleanup_idle_wait:
910.Ltrace_enter: .long do_syscall_trace_enter 906.Ltrace_enter: .long do_syscall_trace_enter
911.Ltrace_exit: .long do_syscall_trace_exit 907.Ltrace_exit: .long do_syscall_trace_exit
912.Lschedule_tail: .long schedule_tail 908.Lschedule_tail: .long schedule_tail
913.Lsys_call_table: .long sys_call_table
914.Lsysc_per: .long sysc_per + 0x80000000 909.Lsysc_per: .long sysc_per + 0x80000000
915#ifdef CONFIG_TRACE_IRQFLAGS 910#ifdef CONFIG_TRACE_IRQFLAGS
916.Lhardirqs_on: .long trace_hardirqs_on_caller 911.Lhardirqs_on: .long trace_hardirqs_on_caller
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index c3a736a3ed44..aa0ab02e9595 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -7,6 +7,7 @@
7#include <asm/cputime.h> 7#include <asm/cputime.h>
8 8
9extern void *restart_stack; 9extern void *restart_stack;
10extern unsigned long suspend_zero_pages;
10 11
11void system_call(void); 12void system_call(void);
12void pgm_check_handler(void); 13void pgm_check_handler(void);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 2e6d60c55f90..4c17eece707e 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -39,6 +39,7 @@ __PT_R15 = __PT_GPRS + 120
39 39
40STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 40STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
41STACK_SIZE = 1 << STACK_SHIFT 41STACK_SIZE = 1 << STACK_SHIFT
42STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE
42 43
43_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ 44_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
44 _TIF_MCCK_PENDING | _TIF_PER_TRAP ) 45 _TIF_MCCK_PENDING | _TIF_PER_TRAP )
@@ -124,10 +125,10 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
124 srag %r14,%r14,\shift 125 srag %r14,%r14,\shift
125 jnz 1f 126 jnz 1f
126 CHECK_STACK 1<<\shift,\savearea 127 CHECK_STACK 1<<\shift,\savearea
128 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
127 j 2f 129 j 2f
1281: lg %r15,\stack # load target stack 1301: lg %r15,\stack # load target stack
1292: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 1312: la %r11,STACK_FRAME_OVERHEAD(%r15)
130 la %r11,STACK_FRAME_OVERHEAD(%r15)
131 .endm 132 .endm
132 133
133 .macro UPDATE_VTIME scratch,enter_timer 134 .macro UPDATE_VTIME scratch,enter_timer
@@ -177,7 +178,7 @@ ENTRY(__switch_to)
177 lg %r4,__THREAD_info(%r2) # get thread_info of prev 178 lg %r4,__THREAD_info(%r2) # get thread_info of prev
178 lg %r5,__THREAD_info(%r3) # get thread_info of next 179 lg %r5,__THREAD_info(%r3) # get thread_info of next
179 lgr %r15,%r5 180 lgr %r15,%r5
180 aghi %r15,STACK_SIZE # end of kernel stack of next 181 aghi %r15,STACK_INIT # end of kernel stack of next
181 stg %r3,__LC_CURRENT # store task struct of next 182 stg %r3,__LC_CURRENT # store task struct of next
182 stg %r5,__LC_THREAD_INFO # store thread info of next 183 stg %r5,__LC_THREAD_INFO # store thread info of next
183 stg %r15,__LC_KERNEL_STACK # store end of kernel stack 184 stg %r15,__LC_KERNEL_STACK # store end of kernel stack
@@ -203,10 +204,8 @@ sysc_stmg:
203 stmg %r8,%r15,__LC_SAVE_AREA_SYNC 204 stmg %r8,%r15,__LC_SAVE_AREA_SYNC
204 lg %r10,__LC_LAST_BREAK 205 lg %r10,__LC_LAST_BREAK
205 lg %r12,__LC_THREAD_INFO 206 lg %r12,__LC_THREAD_INFO
206 larl %r13,system_call
207sysc_per: 207sysc_per:
208 lg %r15,__LC_KERNEL_STACK 208 lg %r15,__LC_KERNEL_STACK
209 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
210 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs 209 la %r11,STACK_FRAME_OVERHEAD(%r15) # pointer to pt_regs
211sysc_vtime: 210sysc_vtime:
212 UPDATE_VTIME %r13,__LC_SYNC_ENTER_TIMER 211 UPDATE_VTIME %r13,__LC_SYNC_ENTER_TIMER
@@ -217,6 +216,7 @@ sysc_vtime:
217 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC 216 mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
218sysc_do_svc: 217sysc_do_svc:
219 oi __TI_flags+7(%r12),_TIF_SYSCALL 218 oi __TI_flags+7(%r12),_TIF_SYSCALL
219 lg %r10,__TI_sysc_table(%r12) # address of system call table
220 llgh %r8,__PT_INT_CODE+2(%r11) 220 llgh %r8,__PT_INT_CODE+2(%r11)
221 slag %r8,%r8,2 # shift and test for svc 0 221 slag %r8,%r8,2 # shift and test for svc 0
222 jnz sysc_nr_ok 222 jnz sysc_nr_ok
@@ -227,13 +227,6 @@ sysc_do_svc:
227 sth %r1,__PT_INT_CODE+2(%r11) 227 sth %r1,__PT_INT_CODE+2(%r11)
228 slag %r8,%r1,2 228 slag %r8,%r1,2
229sysc_nr_ok: 229sysc_nr_ok:
230 larl %r10,sys_call_table # 64 bit system call table
231#ifdef CONFIG_COMPAT
232 tm __TI_flags+5(%r12),(_TIF_31BIT>>16)
233 jno sysc_noemu
234 larl %r10,sys_call_table_emu # 31 bit system call table
235sysc_noemu:
236#endif
237 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 230 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
238 stg %r2,__PT_ORIG_GPR2(%r11) 231 stg %r2,__PT_ORIG_GPR2(%r11)
239 stg %r7,STACK_FRAME_OVERHEAD(%r15) 232 stg %r7,STACK_FRAME_OVERHEAD(%r15)
@@ -389,6 +382,7 @@ ENTRY(pgm_check_handler)
389 tm __LC_PGM_ILC+3,0x80 # check for per exception 382 tm __LC_PGM_ILC+3,0x80 # check for per exception
390 jnz pgm_svcper # -> single stepped svc 383 jnz pgm_svcper # -> single stepped svc
3910: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC 3840: CHECK_STACK STACK_SIZE,__LC_SAVE_AREA_SYNC
385 aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
392 j 2f 386 j 2f
3931: UPDATE_VTIME %r14,__LC_SYNC_ENTER_TIMER 3871: UPDATE_VTIME %r14,__LC_SYNC_ENTER_TIMER
394 LAST_BREAK %r14 388 LAST_BREAK %r14
@@ -398,8 +392,7 @@ ENTRY(pgm_check_handler)
398 tm __LC_PGM_ILC+2,0x02 # check for transaction abort 392 tm __LC_PGM_ILC+2,0x02 # check for transaction abort
399 jz 2f 393 jz 2f
400 mvc __THREAD_trap_tdb(256,%r14),0(%r13) 394 mvc __THREAD_trap_tdb(256,%r14),0(%r13)
4012: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) 3952: la %r11,STACK_FRAME_OVERHEAD(%r15)
402 la %r11,STACK_FRAME_OVERHEAD(%r15)
403 stmg %r0,%r7,__PT_R0(%r11) 396 stmg %r0,%r7,__PT_R0(%r11)
404 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC 397 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
405 stmg %r8,%r9,__PT_PSW(%r11) 398 stmg %r8,%r9,__PT_PSW(%r11)
@@ -526,7 +519,6 @@ io_work:
526# 519#
527io_work_user: 520io_work_user:
528 lg %r1,__LC_KERNEL_STACK 521 lg %r1,__LC_KERNEL_STACK
529 aghi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
530 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) 522 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
531 xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) 523 xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1)
532 la %r11,STACK_FRAME_OVERHEAD(%r1) 524 la %r11,STACK_FRAME_OVERHEAD(%r1)
@@ -688,7 +680,6 @@ mcck_skip:
688 tm __PT_PSW+1(%r11),0x01 # returning to user ? 680 tm __PT_PSW+1(%r11),0x01 # returning to user ?
689 jno mcck_return 681 jno mcck_return
690 lg %r1,__LC_KERNEL_STACK # switch to kernel stack 682 lg %r1,__LC_KERNEL_STACK # switch to kernel stack
691 aghi %r1,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
692 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11) 683 mvc STACK_FRAME_OVERHEAD(__PT_SIZE,%r1),0(%r11)
693 xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1) 684 xc __SF_BACKCHAIN(8,%r1),__SF_BACKCHAIN(%r1)
694 la %r11,STACK_FRAME_OVERHEAD(%r1) 685 la %r11,STACK_FRAME_OVERHEAD(%r1)
@@ -755,14 +746,12 @@ ENTRY(restart_int_handler)
755 * Setup a pt_regs so that show_trace can provide a good call trace. 746 * Setup a pt_regs so that show_trace can provide a good call trace.
756 */ 747 */
757stack_overflow: 748stack_overflow:
758 lg %r11,__LC_PANIC_STACK # change to panic stack 749 lg %r15,__LC_PANIC_STACK # change to panic stack
759 aghi %r11,-__PT_SIZE # create pt_regs 750 la %r11,STACK_FRAME_OVERHEAD(%r15)
760 stmg %r0,%r7,__PT_R0(%r11) 751 stmg %r0,%r7,__PT_R0(%r11)
761 stmg %r8,%r9,__PT_PSW(%r11) 752 stmg %r8,%r9,__PT_PSW(%r11)
762 mvc __PT_R8(64,%r11),0(%r14) 753 mvc __PT_R8(64,%r11),0(%r14)
763 stg %r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2 754 stg %r10,__PT_ORIG_GPR2(%r11) # store last break to orig_gpr2
764 lgr %r15,%r11
765 aghi %r15,-STACK_FRAME_OVERHEAD
766 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 755 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
767 lgr %r2,%r11 # pass pointer to pt_regs 756 lgr %r2,%r11 # pass pointer to pt_regs
768 jg kernel_stack_overflow 757 jg kernel_stack_overflow
@@ -846,15 +835,14 @@ cleanup_system_call:
846 mvc __TI_last_break(8,%r12),16(%r11) 835 mvc __TI_last_break(8,%r12),16(%r11)
8470: # set up saved register r11 8360: # set up saved register r11
848 lg %r15,__LC_KERNEL_STACK 837 lg %r15,__LC_KERNEL_STACK
849 aghi %r15,-__PT_SIZE 838 la %r9,STACK_FRAME_OVERHEAD(%r15)
850 stg %r15,24(%r11) # r11 pt_regs pointer 839 stg %r9,24(%r11) # r11 pt_regs pointer
851 # fill pt_regs 840 # fill pt_regs
852 mvc __PT_R8(64,%r15),__LC_SAVE_AREA_SYNC 841 mvc __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC
853 stmg %r0,%r7,__PT_R0(%r15) 842 stmg %r0,%r7,__PT_R0(%r9)
854 mvc __PT_PSW(16,%r15),__LC_SVC_OLD_PSW 843 mvc __PT_PSW(16,%r9),__LC_SVC_OLD_PSW
855 mvc __PT_INT_CODE(4,%r15),__LC_SVC_ILC 844 mvc __PT_INT_CODE(4,%r9),__LC_SVC_ILC
856 # setup saved register r15 845 # setup saved register r15
857 aghi %r15,-STACK_FRAME_OVERHEAD
858 stg %r15,56(%r11) # r15 stack pointer 846 stg %r15,56(%r11) # r15 stack pointer
859 # set new psw address and exit 847 # set new psw address and exit
860 larl %r9,sysc_do_svc 848 larl %r9,sysc_do_svc
@@ -1011,6 +999,7 @@ sys_call_table:
1011#ifdef CONFIG_COMPAT 999#ifdef CONFIG_COMPAT
1012 1000
1013#define SYSCALL(esa,esame,emu) .long emu 1001#define SYSCALL(esa,esame,emu) .long emu
1002 .globl sys_call_table_emu
1014sys_call_table_emu: 1003sys_call_table_emu:
1015#include "syscalls.S" 1004#include "syscalls.S"
1016#undef SYSCALL 1005#undef SYSCALL
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 1630f439cd2a..f7fb58903f6a 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -33,7 +33,7 @@ struct irq_class {
33}; 33};
34 34
35/* 35/*
36 * The list of "main" irq classes on s390. This is the list of interrrupts 36 * The list of "main" irq classes on s390. This is the list of interrupts
37 * that appear both in /proc/stat ("intr" line) and /proc/interrupts. 37 * that appear both in /proc/stat ("intr" line) and /proc/interrupts.
38 * Historically only external and I/O interrupts have been part of /proc/stat. 38 * Historically only external and I/O interrupts have been part of /proc/stat.
39 * We can't add the split external and I/O sub classes since the first field 39 * We can't add the split external and I/O sub classes since the first field
@@ -162,10 +162,8 @@ asmlinkage void do_softirq(void)
162#ifdef CONFIG_PROC_FS 162#ifdef CONFIG_PROC_FS
163void init_irq_proc(void) 163void init_irq_proc(void)
164{ 164{
165 struct proc_dir_entry *root_irq_dir; 165 if (proc_mkdir("irq", NULL))
166 166 create_prof_cpu_mask();
167 root_irq_dir = proc_mkdir("irq", NULL);
168 create_prof_cpu_mask(root_irq_dir);
169} 167}
170#endif 168#endif
171 169
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index b3de27700016..ac2178161ec3 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -13,6 +13,7 @@
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/ftrace.h> 14#include <linux/ftrace.h>
15#include <linux/debug_locks.h> 15#include <linux/debug_locks.h>
16#include <linux/suspend.h>
16#include <asm/cio.h> 17#include <asm/cio.h>
17#include <asm/setup.h> 18#include <asm/setup.h>
18#include <asm/pgtable.h> 19#include <asm/pgtable.h>
@@ -67,6 +68,35 @@ void setup_regs(void)
67 memcpy((void *) SAVE_AREA_BASE, (void *) sa, sizeof(struct save_area)); 68 memcpy((void *) SAVE_AREA_BASE, (void *) sa, sizeof(struct save_area));
68} 69}
69 70
71/*
72 * PM notifier callback for kdump
73 */
74static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
75 void *ptr)
76{
77 switch (action) {
78 case PM_SUSPEND_PREPARE:
79 case PM_HIBERNATION_PREPARE:
80 if (crashk_res.start)
81 crash_map_reserved_pages();
82 break;
83 case PM_POST_SUSPEND:
84 case PM_POST_HIBERNATION:
85 if (crashk_res.start)
86 crash_unmap_reserved_pages();
87 break;
88 default:
89 return NOTIFY_DONE;
90 }
91 return NOTIFY_OK;
92}
93
94static int __init machine_kdump_pm_init(void)
95{
96 pm_notifier(machine_kdump_pm_cb, 0);
97 return 0;
98}
99arch_initcall(machine_kdump_pm_init);
70#endif 100#endif
71 101
72/* 102/*
diff --git a/arch/s390/kernel/mem_detect.c b/arch/s390/kernel/mem_detect.c
deleted file mode 100644
index 22d502e885ed..000000000000
--- a/arch/s390/kernel/mem_detect.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * Copyright IBM Corp. 2008, 2009
3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <asm/ipl.h>
10#include <asm/sclp.h>
11#include <asm/setup.h>
12
13#define ADDR2G (1ULL << 31)
14
15static void find_memory_chunks(struct mem_chunk chunk[])
16{
17 unsigned long long memsize, rnmax, rzm;
18 unsigned long addr = 0, size;
19 int i = 0, type;
20
21 rzm = sclp_get_rzm();
22 rnmax = sclp_get_rnmax();
23 memsize = rzm * rnmax;
24 if (!rzm)
25 rzm = 1ULL << 17;
26 if (sizeof(long) == 4) {
27 rzm = min(ADDR2G, rzm);
28 memsize = memsize ? min(ADDR2G, memsize) : ADDR2G;
29 }
30 do {
31 size = 0;
32 type = tprot(addr);
33 do {
34 size += rzm;
35 if (memsize && addr + size >= memsize)
36 break;
37 } while (type == tprot(addr + size));
38 if (type == CHUNK_READ_WRITE || type == CHUNK_READ_ONLY) {
39 chunk[i].addr = addr;
40 chunk[i].size = size;
41 chunk[i].type = type;
42 i++;
43 }
44 addr += size;
45 } while (addr < memsize && i < MEMORY_CHUNKS);
46}
47
48void detect_memory_layout(struct mem_chunk chunk[])
49{
50 unsigned long flags, cr0;
51
52 memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk));
53 /* Disable IRQs, DAT and low address protection so tprot does the
54 * right thing and we don't get scheduled away with low address
55 * protection disabled.
56 */
57 flags = __arch_local_irq_stnsm(0xf8);
58 __ctl_store(cr0, 0, 0);
59 __ctl_clear_bit(0, 28);
60 find_memory_chunks(chunk);
61 __ctl_load(cr0, 0, 0);
62 arch_local_irq_restore(flags);
63}
64EXPORT_SYMBOL(detect_memory_layout);
65
66/*
67 * Move memory chunks array from index "from" to index "to"
68 */
69static void mem_chunk_move(struct mem_chunk chunk[], int to, int from)
70{
71 int cnt = MEMORY_CHUNKS - to;
72
73 memmove(&chunk[to], &chunk[from], cnt * sizeof(struct mem_chunk));
74}
75
76/*
77 * Initialize memory chunk
78 */
79static void mem_chunk_init(struct mem_chunk *chunk, unsigned long addr,
80 unsigned long size, int type)
81{
82 chunk->type = type;
83 chunk->addr = addr;
84 chunk->size = size;
85}
86
87/*
88 * Create memory hole with given address, size, and type
89 */
90void create_mem_hole(struct mem_chunk chunk[], unsigned long addr,
91 unsigned long size, int type)
92{
93 unsigned long lh_start, lh_end, lh_size, ch_start, ch_end, ch_size;
94 int i, ch_type;
95
96 for (i = 0; i < MEMORY_CHUNKS; i++) {
97 if (chunk[i].size == 0)
98 continue;
99
100 /* Define chunk properties */
101 ch_start = chunk[i].addr;
102 ch_size = chunk[i].size;
103 ch_end = ch_start + ch_size - 1;
104 ch_type = chunk[i].type;
105
106 /* Is memory chunk hit by memory hole? */
107 if (addr + size <= ch_start)
108 continue; /* No: memory hole in front of chunk */
109 if (addr > ch_end)
110 continue; /* No: memory hole after chunk */
111
112 /* Yes: Define local hole properties */
113 lh_start = max(addr, chunk[i].addr);
114 lh_end = min(addr + size - 1, ch_end);
115 lh_size = lh_end - lh_start + 1;
116
117 if (lh_start == ch_start && lh_end == ch_end) {
118 /* Hole covers complete memory chunk */
119 mem_chunk_init(&chunk[i], lh_start, lh_size, type);
120 } else if (lh_end == ch_end) {
121 /* Hole starts in memory chunk and convers chunk end */
122 mem_chunk_move(chunk, i + 1, i);
123 mem_chunk_init(&chunk[i], ch_start, ch_size - lh_size,
124 ch_type);
125 mem_chunk_init(&chunk[i + 1], lh_start, lh_size, type);
126 i += 1;
127 } else if (lh_start == ch_start) {
128 /* Hole ends in memory chunk */
129 mem_chunk_move(chunk, i + 1, i);
130 mem_chunk_init(&chunk[i], lh_start, lh_size, type);
131 mem_chunk_init(&chunk[i + 1], lh_end + 1,
132 ch_size - lh_size, ch_type);
133 break;
134 } else {
135 /* Hole splits memory chunk */
136 mem_chunk_move(chunk, i + 2, i);
137 mem_chunk_init(&chunk[i], ch_start,
138 lh_start - ch_start, ch_type);
139 mem_chunk_init(&chunk[i + 1], lh_start, lh_size, type);
140 mem_chunk_init(&chunk[i + 2], lh_end + 1,
141 ch_end - lh_end, ch_type);
142 break;
143 }
144 }
145}
diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c
index 46480d81df00..d112fc66f993 100644
--- a/arch/s390/kernel/os_info.c
+++ b/arch/s390/kernel/os_info.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/crash_dump.h> 11#include <linux/crash_dump.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h>
13#include <asm/checksum.h> 14#include <asm/checksum.h>
14#include <asm/lowcore.h> 15#include <asm/lowcore.h>
15#include <asm/os_info.h> 16#include <asm/os_info.h>
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 536d64579d9a..2bc3eddae34a 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -61,18 +61,8 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
61 return sf->gprs[8]; 61 return sf->gprs[8];
62} 62}
63 63
64/* 64void arch_cpu_idle(void)
65 * The idle loop on a S390...
66 */
67static void default_idle(void)
68{ 65{
69 if (cpu_is_offline(smp_processor_id()))
70 cpu_die();
71 local_irq_disable();
72 if (need_resched()) {
73 local_irq_enable();
74 return;
75 }
76 local_mcck_disable(); 66 local_mcck_disable();
77 if (test_thread_flag(TIF_MCCK_PENDING)) { 67 if (test_thread_flag(TIF_MCCK_PENDING)) {
78 local_mcck_enable(); 68 local_mcck_enable();
@@ -83,19 +73,15 @@ static void default_idle(void)
83 vtime_stop_cpu(); 73 vtime_stop_cpu();
84} 74}
85 75
86void cpu_idle(void) 76void arch_cpu_idle_exit(void)
87{ 77{
88 for (;;) { 78 if (test_thread_flag(TIF_MCCK_PENDING))
89 tick_nohz_idle_enter(); 79 s390_handle_mcck();
90 rcu_idle_enter(); 80}
91 while (!need_resched() && !test_thread_flag(TIF_MCCK_PENDING)) 81
92 default_idle(); 82void arch_cpu_idle_dead(void)
93 rcu_idle_exit(); 83{
94 tick_nohz_idle_exit(); 84 cpu_die();
95 if (test_thread_flag(TIF_MCCK_PENDING))
96 s390_handle_mcck();
97 schedule_preempt_disabled();
98 }
99} 85}
100 86
101extern void __kprobes kernel_thread_starter(void); 87extern void __kprobes kernel_thread_starter(void);
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 29268859d8ee..0a49095104c9 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -226,25 +226,17 @@ static void __init conmode_default(void)
226} 226}
227 227
228#ifdef CONFIG_ZFCPDUMP 228#ifdef CONFIG_ZFCPDUMP
229static void __init setup_zfcpdump(unsigned int console_devno) 229static void __init setup_zfcpdump(void)
230{ 230{
231 static char str[41];
232
233 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 231 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
234 return; 232 return;
235 if (OLDMEM_BASE) 233 if (OLDMEM_BASE)
236 return; 234 return;
237 if (console_devno != -1) 235 strcat(boot_command_line, " cio_ignore=all,!ipldev,!condev");
238 sprintf(str, " cio_ignore=all,!0.0.%04x,!0.0.%04x",
239 ipl_info.data.fcp.dev_id.devno, console_devno);
240 else
241 sprintf(str, " cio_ignore=all,!0.0.%04x",
242 ipl_info.data.fcp.dev_id.devno);
243 strcat(boot_command_line, str);
244 console_loglevel = 2; 236 console_loglevel = 2;
245} 237}
246#else 238#else
247static inline void setup_zfcpdump(unsigned int console_devno) {} 239static inline void setup_zfcpdump(void) {}
248#endif /* CONFIG_ZFCPDUMP */ 240#endif /* CONFIG_ZFCPDUMP */
249 241
250 /* 242 /*
@@ -377,11 +369,14 @@ static void __init setup_lowcore(void)
377 PSW_MASK_DAT | PSW_MASK_MCHECK; 369 PSW_MASK_DAT | PSW_MASK_MCHECK;
378 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler; 370 lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler;
379 lc->clock_comparator = -1ULL; 371 lc->clock_comparator = -1ULL;
380 lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE; 372 lc->kernel_stack = ((unsigned long) &init_thread_union)
373 + THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
381 lc->async_stack = (unsigned long) 374 lc->async_stack = (unsigned long)
382 __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0) + ASYNC_SIZE; 375 __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0)
376 + ASYNC_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
383 lc->panic_stack = (unsigned long) 377 lc->panic_stack = (unsigned long)
384 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE; 378 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0)
379 + PAGE_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
385 lc->current_task = (unsigned long) init_thread_union.thread_info.task; 380 lc->current_task = (unsigned long) init_thread_union.thread_info.task;
386 lc->thread_info = (unsigned long) &init_thread_union; 381 lc->thread_info = (unsigned long) &init_thread_union;
387 lc->machine_flags = S390_lowcore.machine_flags; 382 lc->machine_flags = S390_lowcore.machine_flags;
@@ -468,14 +463,10 @@ static void __init setup_resources(void)
468 for (i = 0; i < MEMORY_CHUNKS; i++) { 463 for (i = 0; i < MEMORY_CHUNKS; i++) {
469 if (!memory_chunk[i].size) 464 if (!memory_chunk[i].size)
470 continue; 465 continue;
471 if (memory_chunk[i].type == CHUNK_OLDMEM ||
472 memory_chunk[i].type == CHUNK_CRASHK)
473 continue;
474 res = alloc_bootmem_low(sizeof(*res)); 466 res = alloc_bootmem_low(sizeof(*res));
475 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 467 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
476 switch (memory_chunk[i].type) { 468 switch (memory_chunk[i].type) {
477 case CHUNK_READ_WRITE: 469 case CHUNK_READ_WRITE:
478 case CHUNK_CRASHK:
479 res->name = "System RAM"; 470 res->name = "System RAM";
480 break; 471 break;
481 case CHUNK_READ_ONLY: 472 case CHUNK_READ_ONLY:
@@ -507,12 +498,10 @@ static void __init setup_resources(void)
507 } 498 }
508} 499}
509 500
510unsigned long real_memory_size;
511EXPORT_SYMBOL_GPL(real_memory_size);
512
513static void __init setup_memory_end(void) 501static void __init setup_memory_end(void)
514{ 502{
515 unsigned long vmax, vmalloc_size, tmp; 503 unsigned long vmax, vmalloc_size, tmp;
504 unsigned long real_memory_size = 0;
516 int i; 505 int i;
517 506
518 507
@@ -522,7 +511,6 @@ static void __init setup_memory_end(void)
522 memory_end_set = 1; 511 memory_end_set = 1;
523 } 512 }
524#endif 513#endif
525 real_memory_size = 0;
526 memory_end &= PAGE_MASK; 514 memory_end &= PAGE_MASK;
527 515
528 /* 516 /*
@@ -535,6 +523,8 @@ static void __init setup_memory_end(void)
535 unsigned long align; 523 unsigned long align;
536 524
537 chunk = &memory_chunk[i]; 525 chunk = &memory_chunk[i];
526 if (!chunk->size)
527 continue;
538 align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1); 528 align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1);
539 start = (chunk->addr + align - 1) & ~(align - 1); 529 start = (chunk->addr + align - 1) & ~(align - 1);
540 end = (chunk->addr + chunk->size) & ~(align - 1); 530 end = (chunk->addr + chunk->size) & ~(align - 1);
@@ -585,6 +575,8 @@ static void __init setup_memory_end(void)
585 for (i = 0; i < MEMORY_CHUNKS; i++) { 575 for (i = 0; i < MEMORY_CHUNKS; i++) {
586 struct mem_chunk *chunk = &memory_chunk[i]; 576 struct mem_chunk *chunk = &memory_chunk[i];
587 577
578 if (!chunk->size)
579 continue;
588 if (chunk->addr >= memory_end) { 580 if (chunk->addr >= memory_end) {
589 memset(chunk, 0, sizeof(*chunk)); 581 memset(chunk, 0, sizeof(*chunk));
590 continue; 582 continue;
@@ -685,15 +677,6 @@ static int __init verify_crash_base(unsigned long crash_base,
685} 677}
686 678
687/* 679/*
688 * Reserve kdump memory by creating a memory hole in the mem_chunk array
689 */
690static void __init reserve_kdump_bootmem(unsigned long addr, unsigned long size,
691 int type)
692{
693 create_mem_hole(memory_chunk, addr, size, type);
694}
695
696/*
697 * When kdump is enabled, we have to ensure that no memory from 680 * When kdump is enabled, we have to ensure that no memory from
698 * the area [0 - crashkernel memory size] and 681 * the area [0 - crashkernel memory size] and
699 * [crashk_res.start - crashk_res.end] is set offline. 682 * [crashk_res.start - crashk_res.end] is set offline.
@@ -724,16 +707,22 @@ static struct notifier_block kdump_mem_nb = {
724static void reserve_oldmem(void) 707static void reserve_oldmem(void)
725{ 708{
726#ifdef CONFIG_CRASH_DUMP 709#ifdef CONFIG_CRASH_DUMP
710 unsigned long real_size = 0;
711 int i;
712
727 if (!OLDMEM_BASE) 713 if (!OLDMEM_BASE)
728 return; 714 return;
715 for (i = 0; i < MEMORY_CHUNKS; i++) {
716 struct mem_chunk *chunk = &memory_chunk[i];
729 717
730 reserve_kdump_bootmem(OLDMEM_BASE, OLDMEM_SIZE, CHUNK_OLDMEM); 718 real_size = max(real_size, chunk->addr + chunk->size);
731 reserve_kdump_bootmem(OLDMEM_SIZE, memory_end - OLDMEM_SIZE, 719 }
732 CHUNK_OLDMEM); 720 create_mem_hole(memory_chunk, OLDMEM_BASE, OLDMEM_SIZE);
733 if (OLDMEM_BASE + OLDMEM_SIZE == real_memory_size) 721 create_mem_hole(memory_chunk, OLDMEM_SIZE, real_size - OLDMEM_SIZE);
722 if (OLDMEM_BASE + OLDMEM_SIZE == real_size)
734 saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1; 723 saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1;
735 else 724 else
736 saved_max_pfn = PFN_DOWN(real_memory_size) - 1; 725 saved_max_pfn = PFN_DOWN(real_size) - 1;
737#endif 726#endif
738} 727}
739 728
@@ -772,7 +761,7 @@ static void __init reserve_crashkernel(void)
772 crashk_res.start = crash_base; 761 crashk_res.start = crash_base;
773 crashk_res.end = crash_base + crash_size - 1; 762 crashk_res.end = crash_base + crash_size - 1;
774 insert_resource(&iomem_resource, &crashk_res); 763 insert_resource(&iomem_resource, &crashk_res);
775 reserve_kdump_bootmem(crash_base, crash_size, CHUNK_CRASHK); 764 create_mem_hole(memory_chunk, crash_base, crash_size);
776 pr_info("Reserving %lluMB of memory at %lluMB " 765 pr_info("Reserving %lluMB of memory at %lluMB "
777 "for crashkernel (System RAM: %luMB)\n", 766 "for crashkernel (System RAM: %luMB)\n",
778 crash_size >> 20, crash_base >> 20, memory_end >> 20); 767 crash_size >> 20, crash_base >> 20, memory_end >> 20);
@@ -844,11 +833,10 @@ static void __init setup_memory(void)
844 * Register RAM areas with the bootmem allocator. 833 * Register RAM areas with the bootmem allocator.
845 */ 834 */
846 835
847 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 836 for (i = 0; i < MEMORY_CHUNKS; i++) {
848 unsigned long start_chunk, end_chunk, pfn; 837 unsigned long start_chunk, end_chunk, pfn;
849 838
850 if (memory_chunk[i].type != CHUNK_READ_WRITE && 839 if (!memory_chunk[i].size)
851 memory_chunk[i].type != CHUNK_CRASHK)
852 continue; 840 continue;
853 start_chunk = PFN_DOWN(memory_chunk[i].addr); 841 start_chunk = PFN_DOWN(memory_chunk[i].addr);
854 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size); 842 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size);
@@ -1064,12 +1052,12 @@ void __init setup_arch(char **cmdline_p)
1064 memcpy(&uaccess, &uaccess_std, sizeof(uaccess)); 1052 memcpy(&uaccess, &uaccess_std, sizeof(uaccess));
1065 1053
1066 parse_early_param(); 1054 parse_early_param();
1067 1055 detect_memory_layout(memory_chunk, memory_end);
1068 os_info_init(); 1056 os_info_init();
1069 setup_ipl(); 1057 setup_ipl();
1058 reserve_oldmem();
1070 setup_memory_end(); 1059 setup_memory_end();
1071 setup_addressing_mode(); 1060 setup_addressing_mode();
1072 reserve_oldmem();
1073 reserve_crashkernel(); 1061 reserve_crashkernel();
1074 setup_memory(); 1062 setup_memory();
1075 setup_resources(); 1063 setup_resources();
@@ -1094,5 +1082,5 @@ void __init setup_arch(char **cmdline_p)
1094 set_preferred_console(); 1082 set_preferred_console();
1095 1083
1096 /* Setup zfcpdump support */ 1084 /* Setup zfcpdump support */
1097 setup_zfcpdump(console_devno); 1085 setup_zfcpdump();
1098} 1086}
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 549c9d173c0f..8074cb4b7cbf 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -181,8 +181,10 @@ static int __cpuinit pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu)
181 lc = pcpu->lowcore; 181 lc = pcpu->lowcore;
182 memcpy(lc, &S390_lowcore, 512); 182 memcpy(lc, &S390_lowcore, 512);
183 memset((char *) lc + 512, 0, sizeof(*lc) - 512); 183 memset((char *) lc + 512, 0, sizeof(*lc) - 512);
184 lc->async_stack = pcpu->async_stack + ASYNC_SIZE; 184 lc->async_stack = pcpu->async_stack + ASYNC_SIZE
185 lc->panic_stack = pcpu->panic_stack + PAGE_SIZE; 185 - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
186 lc->panic_stack = pcpu->panic_stack + PAGE_SIZE
187 - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
186 lc->cpu_nr = cpu; 188 lc->cpu_nr = cpu;
187#ifndef CONFIG_64BIT 189#ifndef CONFIG_64BIT
188 if (MACHINE_HAS_IEEE) { 190 if (MACHINE_HAS_IEEE) {
@@ -253,7 +255,8 @@ static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk)
253 struct _lowcore *lc = pcpu->lowcore; 255 struct _lowcore *lc = pcpu->lowcore;
254 struct thread_info *ti = task_thread_info(tsk); 256 struct thread_info *ti = task_thread_info(tsk);
255 257
256 lc->kernel_stack = (unsigned long) task_stack_page(tsk) + THREAD_SIZE; 258 lc->kernel_stack = (unsigned long) task_stack_page(tsk)
259 + THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
257 lc->thread_info = (unsigned long) task_thread_info(tsk); 260 lc->thread_info = (unsigned long) task_thread_info(tsk);
258 lc->current_task = (unsigned long) tsk; 261 lc->current_task = (unsigned long) tsk;
259 lc->user_timer = ti->user_timer; 262 lc->user_timer = ti->user_timer;
@@ -711,8 +714,7 @@ static void __cpuinit smp_start_secondary(void *cpuvoid)
711 set_cpu_online(smp_processor_id(), true); 714 set_cpu_online(smp_processor_id(), true);
712 inc_irq_stat(CPU_RST); 715 inc_irq_stat(CPU_RST);
713 local_irq_enable(); 716 local_irq_enable();
714 /* cpu_idle will call schedule for us */ 717 cpu_startup_entry(CPUHP_ONLINE);
715 cpu_idle();
716} 718}
717 719
718/* Upping and downing of CPUs */ 720/* Upping and downing of CPUs */
@@ -810,8 +812,10 @@ void __init smp_prepare_boot_cpu(void)
810 pcpu->state = CPU_STATE_CONFIGURED; 812 pcpu->state = CPU_STATE_CONFIGURED;
811 pcpu->address = boot_cpu_address; 813 pcpu->address = boot_cpu_address;
812 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix(); 814 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix();
813 pcpu->async_stack = S390_lowcore.async_stack - ASYNC_SIZE; 815 pcpu->async_stack = S390_lowcore.async_stack - ASYNC_SIZE
814 pcpu->panic_stack = S390_lowcore.panic_stack - PAGE_SIZE; 816 + STACK_FRAME_OVERHEAD + sizeof(struct pt_regs);
817 pcpu->panic_stack = S390_lowcore.panic_stack - PAGE_SIZE
818 + STACK_FRAME_OVERHEAD + sizeof(struct pt_regs);
815 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 819 S390_lowcore.percpu_offset = __per_cpu_offset[0];
816 smp_cpu_set_polarization(0, POLARIZATION_UNKNOWN); 820 smp_cpu_set_polarization(0, POLARIZATION_UNKNOWN);
817 set_cpu_present(0, true); 821 set_cpu_present(0, true);
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index aa1494d0e380..c479d2f9605b 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -41,6 +41,7 @@ struct page_key_data {
41static struct page_key_data *page_key_data; 41static struct page_key_data *page_key_data;
42static struct page_key_data *page_key_rp, *page_key_wp; 42static struct page_key_data *page_key_rp, *page_key_wp;
43static unsigned long page_key_rx, page_key_wx; 43static unsigned long page_key_rx, page_key_wx;
44unsigned long suspend_zero_pages;
44 45
45/* 46/*
46 * For each page in the hibernation image one additional byte is 47 * For each page in the hibernation image one additional byte is
@@ -149,6 +150,36 @@ int pfn_is_nosave(unsigned long pfn)
149 return 0; 150 return 0;
150} 151}
151 152
153/*
154 * PM notifier callback for suspend
155 */
156static int suspend_pm_cb(struct notifier_block *nb, unsigned long action,
157 void *ptr)
158{
159 switch (action) {
160 case PM_SUSPEND_PREPARE:
161 case PM_HIBERNATION_PREPARE:
162 suspend_zero_pages = __get_free_pages(GFP_KERNEL, LC_ORDER);
163 if (!suspend_zero_pages)
164 return NOTIFY_BAD;
165 break;
166 case PM_POST_SUSPEND:
167 case PM_POST_HIBERNATION:
168 free_pages(suspend_zero_pages, LC_ORDER);
169 break;
170 default:
171 return NOTIFY_DONE;
172 }
173 return NOTIFY_OK;
174}
175
176static int __init suspend_pm_init(void)
177{
178 pm_notifier(suspend_pm_cb, 0);
179 return 0;
180}
181arch_initcall(suspend_pm_init);
182
152void save_processor_state(void) 183void save_processor_state(void)
153{ 184{
154 /* swsusp_arch_suspend() actually saves all cpu register contents. 185 /* swsusp_arch_suspend() actually saves all cpu register contents.
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index d4ca4e0617b5..c487be4cfc81 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -36,8 +36,8 @@ ENTRY(swsusp_arch_suspend)
36 /* Store prefix register on stack */ 36 /* Store prefix register on stack */
37 stpx __SF_EMPTY(%r15) 37 stpx __SF_EMPTY(%r15)
38 38
39 /* Save prefix register contents for lowcore */ 39 /* Save prefix register contents for lowcore copy */
40 llgf %r4,__SF_EMPTY(%r15) 40 llgf %r10,__SF_EMPTY(%r15)
41 41
42 /* Get pointer to save area */ 42 /* Get pointer to save area */
43 lghi %r1,0x1000 43 lghi %r1,0x1000
@@ -91,7 +91,18 @@ ENTRY(swsusp_arch_suspend)
91 xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15) 91 xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15)
92 spx __SF_EMPTY(%r15) 92 spx __SF_EMPTY(%r15)
93 93
94 /* Save absolute zero pages */
95 larl %r2,suspend_zero_pages
96 lg %r2,0(%r2)
97 lghi %r4,0
98 lghi %r3,2*PAGE_SIZE
99 lghi %r5,2*PAGE_SIZE
1001: mvcle %r2,%r4,0
101 jo 1b
102
103 /* Copy lowcore to absolute zero lowcore */
94 lghi %r2,0 104 lghi %r2,0
105 lgr %r4,%r10
95 lghi %r3,2*PAGE_SIZE 106 lghi %r3,2*PAGE_SIZE
96 lghi %r5,2*PAGE_SIZE 107 lghi %r5,2*PAGE_SIZE
971: mvcle %r2,%r4,0 1081: mvcle %r2,%r4,0
@@ -248,8 +259,20 @@ restore_registers:
248 /* Load old stack */ 259 /* Load old stack */
249 lg %r15,0x2f8(%r13) 260 lg %r15,0x2f8(%r13)
250 261
262 /* Save prefix register */
263 mvc __SF_EMPTY(4,%r15),0x318(%r13)
264
265 /* Restore absolute zero pages */
266 lghi %r2,0
267 larl %r4,suspend_zero_pages
268 lg %r4,0(%r4)
269 lghi %r3,2*PAGE_SIZE
270 lghi %r5,2*PAGE_SIZE
2711: mvcle %r2,%r4,0
272 jo 1b
273
251 /* Restore prefix register */ 274 /* Restore prefix register */
252 spx 0x318(%r13) 275 spx __SF_EMPTY(%r15)
253 276
254 /* Activate DAT */ 277 /* Activate DAT */
255 stosm __SF_EMPTY(%r15),0x04 278 stosm __SF_EMPTY(%r15),0x04
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index d0964d22adb5..23eb222c1658 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -132,19 +132,9 @@ SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
132 * to 132 * to
133 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len 133 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
134 */ 134 */
135SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset, 135SYSCALL_DEFINE5(s390_fallocate, int, fd, int, mode, loff_t, offset,
136 u32 len_high, u32 len_low) 136 u32, len_high, u32, len_low)
137{ 137{
138 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); 138 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
139} 139}
140#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
141asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
142 long len_high, long len_low)
143{
144 return SYSC_s390_fallocate((int) fd, (int) mode, offset,
145 (u32) len_high, (u32) len_low);
146}
147SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
148#endif
149
150#endif 140#endif
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 630b935d1284..9f214e992eed 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -85,7 +85,7 @@ SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper)
85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper) 85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ 86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */
87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper) 87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper)
88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage_wrapper) 88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage)
89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper) 89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper)
90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper) 90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper)
91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */ 91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */
@@ -118,14 +118,14 @@ SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat_wrapper)
118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper) 118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper)
119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper) 119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper)
120NI_SYSCALL /* old uname syscall */ 120NI_SYSCALL /* old uname syscall */
121SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,sys32_lookup_dcookie_wrapper) /* 110 */ 121SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,compat_sys_lookup_dcookie) /* 110 */
122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup) 122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup)
123NI_SYSCALL /* old "idle" system call */ 123NI_SYSCALL /* old "idle" system call */
124NI_SYSCALL /* vm86old for i386 */ 124NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper)
128SYSCALL(sys_s390_ipc,sys_s390_ipc,sys32_ipc_wrapper) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,compat_sys_s390_ipc)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */ 131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */
@@ -195,7 +195,7 @@ SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper)
195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper) 195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */ 196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */
197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack) 197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack)
198SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper) 198SYSCALL(sys_sendfile,sys_sendfile64,compat_sys_sendfile)
199NI_SYSCALL /* streams1 */ 199NI_SYSCALL /* streams1 */
200NI_SYSCALL /* streams2 */ 200NI_SYSCALL /* streams2 */
201SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */ 201SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */
@@ -231,7 +231,7 @@ SYSCALL(sys_madvise,sys_madvise,sys32_madvise_wrapper)
231SYSCALL(sys_getdents64,sys_getdents64,sys32_getdents64_wrapper) /* 220 */ 231SYSCALL(sys_getdents64,sys_getdents64,sys32_getdents64_wrapper) /* 220 */
232SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64_wrapper) 232SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64_wrapper)
233SYSCALL(sys_readahead,sys_readahead,sys32_readahead_wrapper) 233SYSCALL(sys_readahead,sys_readahead,sys32_readahead_wrapper)
234SYSCALL(sys_sendfile64,sys_ni_syscall,sys32_sendfile64_wrapper) 234SYSCALL(sys_sendfile64,sys_ni_syscall,compat_sys_sendfile64)
235SYSCALL(sys_setxattr,sys_setxattr,sys32_setxattr_wrapper) 235SYSCALL(sys_setxattr,sys_setxattr,sys32_setxattr_wrapper)
236SYSCALL(sys_lsetxattr,sys_lsetxattr,sys32_lsetxattr_wrapper) /* 225 */ 236SYSCALL(sys_lsetxattr,sys_lsetxattr,sys32_lsetxattr_wrapper) /* 225 */
237SYSCALL(sys_fsetxattr,sys_fsetxattr,sys32_fsetxattr_wrapper) 237SYSCALL(sys_fsetxattr,sys_fsetxattr,sys32_fsetxattr_wrapper)
@@ -317,27 +317,27 @@ SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) 317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper)
318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) 318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) 319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper) 320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice)
321NI_SYSCALL /* 310 sys_move_pages */ 321NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper) 323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait)
324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) 324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper) 325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ 326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */
327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) 327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd)
328NI_SYSCALL /* 317 old sys_timer_fd */ 328NI_SYSCALL /* 317 old sys_timer_fd */
329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) 329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper)
330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) 330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper)
331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */ 331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */
332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime) 332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime)
333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4_wrapper) 333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4)
334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper) 334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper)
335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper) 335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper)
336SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */ 336SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */
337SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper) 337SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper)
338SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper) 338SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper) 339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv)
340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) 340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev)
341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */ 341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */
342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) 342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper) 343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper)
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 13dd63fba367..c5762324d9ee 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -12,49 +12,16 @@
12 * 'Traps.c' handles hardware traps and faults after we have saved some 12 * 'Traps.c' handles hardware traps and faults after we have saved some
13 * state in 'asm.s'. 13 * state in 'asm.s'.
14 */ 14 */
15#include <linux/sched.h> 15#include <linux/kprobes.h>
16#include <linux/kernel.h> 16#include <linux/kdebug.h>
17#include <linux/string.h> 17#include <linux/module.h>
18#include <linux/errno.h>
19#include <linux/ptrace.h> 18#include <linux/ptrace.h>
20#include <linux/timer.h> 19#include <linux/sched.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/smp.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/seq_file.h>
26#include <linux/delay.h>
27#include <linux/module.h>
28#include <linux/kdebug.h>
29#include <linux/kallsyms.h>
30#include <linux/reboot.h>
31#include <linux/kprobes.h>
32#include <linux/bug.h>
33#include <linux/utsname.h>
34#include <asm/uaccess.h>
35#include <asm/io.h>
36#include <linux/atomic.h>
37#include <asm/mathemu.h>
38#include <asm/cpcmd.h>
39#include <asm/lowcore.h>
40#include <asm/debug.h>
41#include <asm/ipl.h>
42#include "entry.h" 21#include "entry.h"
43 22
44int show_unhandled_signals = 1; 23int show_unhandled_signals = 1;
45 24
46#define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; })
47
48#ifndef CONFIG_64BIT
49#define LONG "%08lx "
50#define FOURLONG "%08lx %08lx %08lx %08lx\n"
51static int kstack_depth_to_print = 12;
52#else /* CONFIG_64BIT */
53#define LONG "%016lx "
54#define FOURLONG "%016lx %016lx %016lx %016lx\n"
55static int kstack_depth_to_print = 20;
56#endif /* CONFIG_64BIT */
57
58static inline void __user *get_trap_ip(struct pt_regs *regs) 25static inline void __user *get_trap_ip(struct pt_regs *regs)
59{ 26{
60#ifdef CONFIG_64BIT 27#ifdef CONFIG_64BIT
@@ -72,215 +39,6 @@ static inline void __user *get_trap_ip(struct pt_regs *regs)
72#endif 39#endif
73} 40}
74 41
75/*
76 * For show_trace we have tree different stack to consider:
77 * - the panic stack which is used if the kernel stack has overflown
78 * - the asynchronous interrupt stack (cpu related)
79 * - the synchronous kernel stack (process related)
80 * The stack trace can start at any of the three stack and can potentially
81 * touch all of them. The order is: panic stack, async stack, sync stack.
82 */
83static unsigned long
84__show_trace(unsigned long sp, unsigned long low, unsigned long high)
85{
86 struct stack_frame *sf;
87 struct pt_regs *regs;
88
89 while (1) {
90 sp = sp & PSW_ADDR_INSN;
91 if (sp < low || sp > high - sizeof(*sf))
92 return sp;
93 sf = (struct stack_frame *) sp;
94 printk("([<%016lx>] ", sf->gprs[8] & PSW_ADDR_INSN);
95 print_symbol("%s)\n", sf->gprs[8] & PSW_ADDR_INSN);
96 /* Follow the backchain. */
97 while (1) {
98 low = sp;
99 sp = sf->back_chain & PSW_ADDR_INSN;
100 if (!sp)
101 break;
102 if (sp <= low || sp > high - sizeof(*sf))
103 return sp;
104 sf = (struct stack_frame *) sp;
105 printk(" [<%016lx>] ", sf->gprs[8] & PSW_ADDR_INSN);
106 print_symbol("%s\n", sf->gprs[8] & PSW_ADDR_INSN);
107 }
108 /* Zero backchain detected, check for interrupt frame. */
109 sp = (unsigned long) (sf + 1);
110 if (sp <= low || sp > high - sizeof(*regs))
111 return sp;
112 regs = (struct pt_regs *) sp;
113 printk(" [<%016lx>] ", regs->psw.addr & PSW_ADDR_INSN);
114 print_symbol("%s\n", regs->psw.addr & PSW_ADDR_INSN);
115 low = sp;
116 sp = regs->gprs[15];
117 }
118}
119
120static void show_trace(struct task_struct *task, unsigned long *stack)
121{
122 register unsigned long __r15 asm ("15");
123 unsigned long sp;
124
125 sp = (unsigned long) stack;
126 if (!sp)
127 sp = task ? task->thread.ksp : __r15;
128 printk("Call Trace:\n");
129#ifdef CONFIG_CHECK_STACK
130 sp = __show_trace(sp, S390_lowcore.panic_stack - 4096,
131 S390_lowcore.panic_stack);
132#endif
133 sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE,
134 S390_lowcore.async_stack);
135 if (task)
136 __show_trace(sp, (unsigned long) task_stack_page(task),
137 (unsigned long) task_stack_page(task) + THREAD_SIZE);
138 else
139 __show_trace(sp, S390_lowcore.thread_info,
140 S390_lowcore.thread_info + THREAD_SIZE);
141 if (!task)
142 task = current;
143 debug_show_held_locks(task);
144}
145
146void show_stack(struct task_struct *task, unsigned long *sp)
147{
148 register unsigned long * __r15 asm ("15");
149 unsigned long *stack;
150 int i;
151
152 if (!sp)
153 stack = task ? (unsigned long *) task->thread.ksp : __r15;
154 else
155 stack = sp;
156
157 for (i = 0; i < kstack_depth_to_print; i++) {
158 if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
159 break;
160 if ((i * sizeof(long) % 32) == 0)
161 printk("%s ", i == 0 ? "" : "\n");
162 printk(LONG, *stack++);
163 }
164 printk("\n");
165 show_trace(task, sp);
166}
167
168static void show_last_breaking_event(struct pt_regs *regs)
169{
170#ifdef CONFIG_64BIT
171 printk("Last Breaking-Event-Address:\n");
172 printk(" [<%016lx>] ", regs->args[0] & PSW_ADDR_INSN);
173 print_symbol("%s\n", regs->args[0] & PSW_ADDR_INSN);
174#endif
175}
176
177/*
178 * The architecture-independent dump_stack generator
179 */
180void dump_stack(void)
181{
182 printk("CPU: %d %s %s %.*s\n",
183 task_thread_info(current)->cpu, print_tainted(),
184 init_utsname()->release,
185 (int)strcspn(init_utsname()->version, " "),
186 init_utsname()->version);
187 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
188 current->comm, current->pid, current,
189 (void *) current->thread.ksp);
190 show_stack(NULL, NULL);
191}
192EXPORT_SYMBOL(dump_stack);
193
194static inline int mask_bits(struct pt_regs *regs, unsigned long bits)
195{
196 return (regs->psw.mask & bits) / ((~bits + 1) & bits);
197}
198
199void show_registers(struct pt_regs *regs)
200{
201 char *mode;
202
203 mode = user_mode(regs) ? "User" : "Krnl";
204 printk("%s PSW : %p %p",
205 mode, (void *) regs->psw.mask,
206 (void *) regs->psw.addr);
207 print_symbol(" (%s)\n", regs->psw.addr & PSW_ADDR_INSN);
208 printk(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x "
209 "P:%x AS:%x CC:%x PM:%x", mask_bits(regs, PSW_MASK_PER),
210 mask_bits(regs, PSW_MASK_DAT), mask_bits(regs, PSW_MASK_IO),
211 mask_bits(regs, PSW_MASK_EXT), mask_bits(regs, PSW_MASK_KEY),
212 mask_bits(regs, PSW_MASK_MCHECK), mask_bits(regs, PSW_MASK_WAIT),
213 mask_bits(regs, PSW_MASK_PSTATE), mask_bits(regs, PSW_MASK_ASC),
214 mask_bits(regs, PSW_MASK_CC), mask_bits(regs, PSW_MASK_PM));
215#ifdef CONFIG_64BIT
216 printk(" EA:%x", mask_bits(regs, PSW_MASK_EA | PSW_MASK_BA));
217#endif
218 printk("\n%s GPRS: " FOURLONG, mode,
219 regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]);
220 printk(" " FOURLONG,
221 regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]);
222 printk(" " FOURLONG,
223 regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]);
224 printk(" " FOURLONG,
225 regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]);
226
227 show_code(regs);
228}
229
230void show_regs(struct pt_regs *regs)
231{
232 printk("CPU: %d %s %s %.*s\n",
233 task_thread_info(current)->cpu, print_tainted(),
234 init_utsname()->release,
235 (int)strcspn(init_utsname()->version, " "),
236 init_utsname()->version);
237 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
238 current->comm, current->pid, current,
239 (void *) current->thread.ksp);
240 show_registers(regs);
241 /* Show stack backtrace if pt_regs is from kernel mode */
242 if (!user_mode(regs))
243 show_trace(NULL, (unsigned long *) regs->gprs[15]);
244 show_last_breaking_event(regs);
245}
246
247static DEFINE_SPINLOCK(die_lock);
248
249void die(struct pt_regs *regs, const char *str)
250{
251 static int die_counter;
252
253 oops_enter();
254 lgr_info_log();
255 debug_stop_all();
256 console_verbose();
257 spin_lock_irq(&die_lock);
258 bust_spinlocks(1);
259 printk("%s: %04x [#%d] ", str, regs->int_code & 0xffff, ++die_counter);
260#ifdef CONFIG_PREEMPT
261 printk("PREEMPT ");
262#endif
263#ifdef CONFIG_SMP
264 printk("SMP ");
265#endif
266#ifdef CONFIG_DEBUG_PAGEALLOC
267 printk("DEBUG_PAGEALLOC");
268#endif
269 printk("\n");
270 notify_die(DIE_OOPS, str, regs, 0, regs->int_code & 0xffff, SIGSEGV);
271 print_modules();
272 show_regs(regs);
273 bust_spinlocks(0);
274 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
275 spin_unlock_irq(&die_lock);
276 if (in_interrupt())
277 panic("Fatal exception in interrupt");
278 if (panic_on_oops)
279 panic("Fatal exception: panic_on_oops");
280 oops_exit();
281 do_exit(SIGSEGV);
282}
283
284static inline void report_user_fault(struct pt_regs *regs, int signr) 42static inline void report_user_fault(struct pt_regs *regs, int signr)
285{ 43{
286 if ((task_pid_nr(current) > 1) && !show_unhandled_signals) 44 if ((task_pid_nr(current) > 1) && !show_unhandled_signals)
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index a0042acbd989..3fb09359eda6 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -158,8 +158,6 @@ void __kprobes vtime_stop_cpu(void)
158 unsigned long psw_mask; 158 unsigned long psw_mask;
159 159
160 trace_hardirqs_on(); 160 trace_hardirqs_on();
161 /* Don't trace preempt off for idle. */
162 stop_critical_timings();
163 161
164 /* Wait for external, I/O or machine check interrupt. */ 162 /* Wait for external, I/O or machine check interrupt. */
165 psw_mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_DAT | 163 psw_mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_DAT |
@@ -169,9 +167,6 @@ void __kprobes vtime_stop_cpu(void)
169 /* Call the assembler magic in entry.S */ 167 /* Call the assembler magic in entry.S */
170 psw_idle(idle, psw_mask); 168 psw_idle(idle, psw_mask);
171 169
172 /* Reenable preemption tracer. */
173 start_critical_timings();
174
175 /* Account time spent with enabled wait psw loaded as idle time. */ 170 /* Account time spent with enabled wait psw loaded as idle time. */
176 idle->sequence++; 171 idle->sequence++;
177 smp_wmb(); 172 smp_wmb();
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index 60f9f8ae0fc8..70b46eacf8e1 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -22,6 +22,7 @@ config KVM
22 select PREEMPT_NOTIFIERS 22 select PREEMPT_NOTIFIERS
23 select ANON_INODES 23 select ANON_INODES
24 select HAVE_KVM_CPU_RELAX_INTERCEPT 24 select HAVE_KVM_CPU_RELAX_INTERCEPT
25 select HAVE_KVM_EVENTFD
25 ---help--- 26 ---help---
26 Support hosting paravirtualized guest machines using the SIE 27 Support hosting paravirtualized guest machines using the SIE
27 virtualization capability on the mainframe. This should work 28 virtualization capability on the mainframe. This should work
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index 3975722bb19d..8fe9d65a4585 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -6,7 +6,7 @@
6# it under the terms of the GNU General Public License (version 2 only) 6# it under the terms of the GNU General Public License (version 2 only)
7# as published by the Free Software Foundation. 7# as published by the Free Software Foundation.
8 8
9common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o) 9common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o eventfd.o)
10 10
11ccflags-y := -Ivirt/kvm -Iarch/s390/kvm 11ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
12 12
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index a390687feb13..1c01a9912989 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/kvm.h> 14#include <linux/kvm.h>
15#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
16#include <asm/virtio-ccw.h>
16#include "kvm-s390.h" 17#include "kvm-s390.h"
17#include "trace.h" 18#include "trace.h"
18#include "trace-s390.h" 19#include "trace-s390.h"
@@ -104,6 +105,29 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
104 return -EREMOTE; 105 return -EREMOTE;
105} 106}
106 107
108static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu)
109{
110 int ret, idx;
111
112 /* No virtio-ccw notification? Get out quickly. */
113 if (!vcpu->kvm->arch.css_support ||
114 (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY))
115 return -EOPNOTSUPP;
116
117 idx = srcu_read_lock(&vcpu->kvm->srcu);
118 /*
119 * The layout is as follows:
120 * - gpr 2 contains the subchannel id (passed as addr)
121 * - gpr 3 contains the virtqueue index (passed as datamatch)
122 */
123 ret = kvm_io_bus_write(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS,
124 vcpu->run->s.regs.gprs[2],
125 8, &vcpu->run->s.regs.gprs[3]);
126 srcu_read_unlock(&vcpu->kvm->srcu, idx);
127 /* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */
128 return ret < 0 ? ret : 0;
129}
130
107int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) 131int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
108{ 132{
109 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; 133 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16;
@@ -118,6 +142,8 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
118 return __diag_time_slice_end_directed(vcpu); 142 return __diag_time_slice_end_directed(vcpu);
119 case 0x308: 143 case 0x308:
120 return __diag_ipl_functions(vcpu); 144 return __diag_ipl_functions(vcpu);
145 case 0x500:
146 return __diag_virtio_hypercall(vcpu);
121 default: 147 default:
122 return -EOPNOTSUPP; 148 return -EOPNOTSUPP;
123 } 149 }
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index 4703f129e95e..302e0e52b009 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -18,369 +18,86 @@
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include "kvm-s390.h" 19#include "kvm-s390.h"
20 20
21static inline void __user *__guestaddr_to_user(struct kvm_vcpu *vcpu, 21static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu,
22 unsigned long guestaddr) 22 void __user *gptr,
23 int prefixing)
23{ 24{
24 unsigned long prefix = vcpu->arch.sie_block->prefix; 25 unsigned long prefix = vcpu->arch.sie_block->prefix;
25 26 unsigned long gaddr = (unsigned long) gptr;
26 if (guestaddr < 2 * PAGE_SIZE) 27 unsigned long uaddr;
27 guestaddr += prefix; 28
28 else if ((guestaddr >= prefix) && (guestaddr < prefix + 2 * PAGE_SIZE)) 29 if (prefixing) {
29 guestaddr -= prefix; 30 if (gaddr < 2 * PAGE_SIZE)
30 31 gaddr += prefix;
31 return (void __user *) gmap_fault(guestaddr, vcpu->arch.gmap); 32 else if ((gaddr >= prefix) && (gaddr < prefix + 2 * PAGE_SIZE))
32} 33 gaddr -= prefix;
33
34static inline int get_guest_u64(struct kvm_vcpu *vcpu, unsigned long guestaddr,
35 u64 *result)
36{
37 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
38
39 BUG_ON(guestaddr & 7);
40
41 if (IS_ERR((void __force *) uptr))
42 return PTR_ERR((void __force *) uptr);
43
44 return get_user(*result, (unsigned long __user *) uptr);
45}
46
47static inline int get_guest_u32(struct kvm_vcpu *vcpu, unsigned long guestaddr,
48 u32 *result)
49{
50 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
51
52 BUG_ON(guestaddr & 3);
53
54 if (IS_ERR((void __force *) uptr))
55 return PTR_ERR((void __force *) uptr);
56
57 return get_user(*result, (u32 __user *) uptr);
58}
59
60static inline int get_guest_u16(struct kvm_vcpu *vcpu, unsigned long guestaddr,
61 u16 *result)
62{
63 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
64
65 BUG_ON(guestaddr & 1);
66
67 if (IS_ERR(uptr))
68 return PTR_ERR(uptr);
69
70 return get_user(*result, (u16 __user *) uptr);
71}
72
73static inline int get_guest_u8(struct kvm_vcpu *vcpu, unsigned long guestaddr,
74 u8 *result)
75{
76 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
77
78 if (IS_ERR((void __force *) uptr))
79 return PTR_ERR((void __force *) uptr);
80
81 return get_user(*result, (u8 __user *) uptr);
82}
83
84static inline int put_guest_u64(struct kvm_vcpu *vcpu, unsigned long guestaddr,
85 u64 value)
86{
87 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
88
89 BUG_ON(guestaddr & 7);
90
91 if (IS_ERR((void __force *) uptr))
92 return PTR_ERR((void __force *) uptr);
93
94 return put_user(value, (u64 __user *) uptr);
95}
96
97static inline int put_guest_u32(struct kvm_vcpu *vcpu, unsigned long guestaddr,
98 u32 value)
99{
100 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
101
102 BUG_ON(guestaddr & 3);
103
104 if (IS_ERR((void __force *) uptr))
105 return PTR_ERR((void __force *) uptr);
106
107 return put_user(value, (u32 __user *) uptr);
108}
109
110static inline int put_guest_u16(struct kvm_vcpu *vcpu, unsigned long guestaddr,
111 u16 value)
112{
113 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
114
115 BUG_ON(guestaddr & 1);
116
117 if (IS_ERR((void __force *) uptr))
118 return PTR_ERR((void __force *) uptr);
119
120 return put_user(value, (u16 __user *) uptr);
121}
122
123static inline int put_guest_u8(struct kvm_vcpu *vcpu, unsigned long guestaddr,
124 u8 value)
125{
126 void __user *uptr = __guestaddr_to_user(vcpu, guestaddr);
127
128 if (IS_ERR((void __force *) uptr))
129 return PTR_ERR((void __force *) uptr);
130
131 return put_user(value, (u8 __user *) uptr);
132}
133
134
135static inline int __copy_to_guest_slow(struct kvm_vcpu *vcpu,
136 unsigned long guestdest,
137 void *from, unsigned long n)
138{
139 int rc;
140 unsigned long i;
141 u8 *data = from;
142
143 for (i = 0; i < n; i++) {
144 rc = put_guest_u8(vcpu, guestdest++, *(data++));
145 if (rc < 0)
146 return rc;
147 } 34 }
148 return 0; 35 uaddr = gmap_fault(gaddr, vcpu->arch.gmap);
149} 36 if (IS_ERR_VALUE(uaddr))
150 37 uaddr = -EFAULT;
151static inline int __copy_to_guest_fast(struct kvm_vcpu *vcpu, 38 return (void __user *)uaddr;
152 unsigned long guestdest, 39}
153 void *from, unsigned long n) 40
154{ 41#define get_guest(vcpu, x, gptr) \
155 int r; 42({ \
43 __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\
44 int __mask = sizeof(__typeof__(*(gptr))) - 1; \
45 int __ret = PTR_RET((void __force *)__uptr); \
46 \
47 if (!__ret) { \
48 BUG_ON((unsigned long)__uptr & __mask); \
49 __ret = get_user(x, __uptr); \
50 } \
51 __ret; \
52})
53
54#define put_guest(vcpu, x, gptr) \
55({ \
56 __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\
57 int __mask = sizeof(__typeof__(*(gptr))) - 1; \
58 int __ret = PTR_RET((void __force *)__uptr); \
59 \
60 if (!__ret) { \
61 BUG_ON((unsigned long)__uptr & __mask); \
62 __ret = put_user(x, __uptr); \
63 } \
64 __ret; \
65})
66
67static inline int __copy_guest(struct kvm_vcpu *vcpu, unsigned long to,
68 unsigned long from, unsigned long len,
69 int to_guest, int prefixing)
70{
71 unsigned long _len, rc;
156 void __user *uptr; 72 void __user *uptr;
157 unsigned long size;
158
159 if (guestdest + n < guestdest)
160 return -EFAULT;
161
162 /* simple case: all within one segment table entry? */
163 if ((guestdest & PMD_MASK) == ((guestdest+n) & PMD_MASK)) {
164 uptr = (void __user *) gmap_fault(guestdest, vcpu->arch.gmap);
165
166 if (IS_ERR((void __force *) uptr))
167 return PTR_ERR((void __force *) uptr);
168
169 r = copy_to_user(uptr, from, n);
170
171 if (r)
172 r = -EFAULT;
173
174 goto out;
175 }
176
177 /* copy first segment */
178 uptr = (void __user *)gmap_fault(guestdest, vcpu->arch.gmap);
179
180 if (IS_ERR((void __force *) uptr))
181 return PTR_ERR((void __force *) uptr);
182 73
183 size = PMD_SIZE - (guestdest & ~PMD_MASK); 74 while (len) {
184 75 uptr = to_guest ? (void __user *)to : (void __user *)from;
185 r = copy_to_user(uptr, from, size); 76 uptr = __gptr_to_uptr(vcpu, uptr, prefixing);
186 77 if (IS_ERR((void __force *)uptr))
187 if (r) { 78 return -EFAULT;
188 r = -EFAULT; 79 _len = PAGE_SIZE - ((unsigned long)uptr & (PAGE_SIZE - 1));
189 goto out; 80 _len = min(_len, len);
190 } 81 if (to_guest)
191 from += size; 82 rc = copy_to_user((void __user *) uptr, (void *)from, _len);
192 n -= size; 83 else
193 guestdest += size; 84 rc = copy_from_user((void *)to, (void __user *)uptr, _len);
194 85 if (rc)
195 /* copy full segments */ 86 return -EFAULT;
196 while (n >= PMD_SIZE) { 87 len -= _len;
197 uptr = (void __user *)gmap_fault(guestdest, vcpu->arch.gmap); 88 from += _len;
198 89 to += _len;
199 if (IS_ERR((void __force *) uptr))
200 return PTR_ERR((void __force *) uptr);
201
202 r = copy_to_user(uptr, from, PMD_SIZE);
203
204 if (r) {
205 r = -EFAULT;
206 goto out;
207 }
208 from += PMD_SIZE;
209 n -= PMD_SIZE;
210 guestdest += PMD_SIZE;
211 }
212
213 /* copy the tail segment */
214 if (n) {
215 uptr = (void __user *)gmap_fault(guestdest, vcpu->arch.gmap);
216
217 if (IS_ERR((void __force *) uptr))
218 return PTR_ERR((void __force *) uptr);
219
220 r = copy_to_user(uptr, from, n);
221
222 if (r)
223 r = -EFAULT;
224 }
225out:
226 return r;
227}
228
229static inline int copy_to_guest_absolute(struct kvm_vcpu *vcpu,
230 unsigned long guestdest,
231 void *from, unsigned long n)
232{
233 return __copy_to_guest_fast(vcpu, guestdest, from, n);
234}
235
236static inline int copy_to_guest(struct kvm_vcpu *vcpu, unsigned long guestdest,
237 void *from, unsigned long n)
238{
239 unsigned long prefix = vcpu->arch.sie_block->prefix;
240
241 if ((guestdest < 2 * PAGE_SIZE) && (guestdest + n > 2 * PAGE_SIZE))
242 goto slowpath;
243
244 if ((guestdest < prefix) && (guestdest + n > prefix))
245 goto slowpath;
246
247 if ((guestdest < prefix + 2 * PAGE_SIZE)
248 && (guestdest + n > prefix + 2 * PAGE_SIZE))
249 goto slowpath;
250
251 if (guestdest < 2 * PAGE_SIZE)
252 guestdest += prefix;
253 else if ((guestdest >= prefix) && (guestdest < prefix + 2 * PAGE_SIZE))
254 guestdest -= prefix;
255
256 return __copy_to_guest_fast(vcpu, guestdest, from, n);
257slowpath:
258 return __copy_to_guest_slow(vcpu, guestdest, from, n);
259}
260
261static inline int __copy_from_guest_slow(struct kvm_vcpu *vcpu, void *to,
262 unsigned long guestsrc,
263 unsigned long n)
264{
265 int rc;
266 unsigned long i;
267 u8 *data = to;
268
269 for (i = 0; i < n; i++) {
270 rc = get_guest_u8(vcpu, guestsrc++, data++);
271 if (rc < 0)
272 return rc;
273 } 90 }
274 return 0; 91 return 0;
275} 92}
276 93
277static inline int __copy_from_guest_fast(struct kvm_vcpu *vcpu, void *to, 94#define copy_to_guest(vcpu, to, from, size) \
278 unsigned long guestsrc, 95 __copy_guest(vcpu, to, (unsigned long)from, size, 1, 1)
279 unsigned long n) 96#define copy_from_guest(vcpu, to, from, size) \
280{ 97 __copy_guest(vcpu, (unsigned long)to, from, size, 0, 1)
281 int r; 98#define copy_to_guest_absolute(vcpu, to, from, size) \
282 void __user *uptr; 99 __copy_guest(vcpu, to, (unsigned long)from, size, 1, 0)
283 unsigned long size; 100#define copy_from_guest_absolute(vcpu, to, from, size) \
284 101 __copy_guest(vcpu, (unsigned long)to, from, size, 0, 0)
285 if (guestsrc + n < guestsrc)
286 return -EFAULT;
287
288 /* simple case: all within one segment table entry? */
289 if ((guestsrc & PMD_MASK) == ((guestsrc+n) & PMD_MASK)) {
290 uptr = (void __user *) gmap_fault(guestsrc, vcpu->arch.gmap);
291
292 if (IS_ERR((void __force *) uptr))
293 return PTR_ERR((void __force *) uptr);
294
295 r = copy_from_user(to, uptr, n);
296
297 if (r)
298 r = -EFAULT;
299
300 goto out;
301 }
302
303 /* copy first segment */
304 uptr = (void __user *)gmap_fault(guestsrc, vcpu->arch.gmap);
305
306 if (IS_ERR((void __force *) uptr))
307 return PTR_ERR((void __force *) uptr);
308
309 size = PMD_SIZE - (guestsrc & ~PMD_MASK);
310
311 r = copy_from_user(to, uptr, size);
312
313 if (r) {
314 r = -EFAULT;
315 goto out;
316 }
317 to += size;
318 n -= size;
319 guestsrc += size;
320
321 /* copy full segments */
322 while (n >= PMD_SIZE) {
323 uptr = (void __user *)gmap_fault(guestsrc, vcpu->arch.gmap);
324
325 if (IS_ERR((void __force *) uptr))
326 return PTR_ERR((void __force *) uptr);
327
328 r = copy_from_user(to, uptr, PMD_SIZE);
329
330 if (r) {
331 r = -EFAULT;
332 goto out;
333 }
334 to += PMD_SIZE;
335 n -= PMD_SIZE;
336 guestsrc += PMD_SIZE;
337 }
338
339 /* copy the tail segment */
340 if (n) {
341 uptr = (void __user *)gmap_fault(guestsrc, vcpu->arch.gmap);
342
343 if (IS_ERR((void __force *) uptr))
344 return PTR_ERR((void __force *) uptr);
345
346 r = copy_from_user(to, uptr, n);
347
348 if (r)
349 r = -EFAULT;
350 }
351out:
352 return r;
353}
354
355static inline int copy_from_guest_absolute(struct kvm_vcpu *vcpu, void *to,
356 unsigned long guestsrc,
357 unsigned long n)
358{
359 return __copy_from_guest_fast(vcpu, to, guestsrc, n);
360}
361
362static inline int copy_from_guest(struct kvm_vcpu *vcpu, void *to,
363 unsigned long guestsrc, unsigned long n)
364{
365 unsigned long prefix = vcpu->arch.sie_block->prefix;
366
367 if ((guestsrc < 2 * PAGE_SIZE) && (guestsrc + n > 2 * PAGE_SIZE))
368 goto slowpath;
369 102
370 if ((guestsrc < prefix) && (guestsrc + n > prefix)) 103#endif /* __KVM_S390_GACCESS_H */
371 goto slowpath;
372
373 if ((guestsrc < prefix + 2 * PAGE_SIZE)
374 && (guestsrc + n > prefix + 2 * PAGE_SIZE))
375 goto slowpath;
376
377 if (guestsrc < 2 * PAGE_SIZE)
378 guestsrc += prefix;
379 else if ((guestsrc >= prefix) && (guestsrc < prefix + 2 * PAGE_SIZE))
380 guestsrc -= prefix;
381
382 return __copy_from_guest_fast(vcpu, to, guestsrc, n);
383slowpath:
384 return __copy_from_guest_slow(vcpu, to, guestsrc, n);
385}
386#endif
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index f26ff1e31bdb..b7d1b2edeeb3 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -43,12 +43,10 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
43 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr); 43 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr);
44 44
45 do { 45 do {
46 rc = get_guest_u64(vcpu, useraddr, 46 rc = get_guest(vcpu, vcpu->arch.sie_block->gcr[reg],
47 &vcpu->arch.sie_block->gcr[reg]); 47 (u64 __user *) useraddr);
48 if (rc == -EFAULT) { 48 if (rc)
49 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 49 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
50 break;
51 }
52 useraddr += 8; 50 useraddr += 8;
53 if (reg == reg3) 51 if (reg == reg3)
54 break; 52 break;
@@ -78,11 +76,9 @@ static int handle_lctl(struct kvm_vcpu *vcpu)
78 76
79 reg = reg1; 77 reg = reg1;
80 do { 78 do {
81 rc = get_guest_u32(vcpu, useraddr, &val); 79 rc = get_guest(vcpu, val, (u32 __user *) useraddr);
82 if (rc == -EFAULT) { 80 if (rc)
83 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 81 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
84 break;
85 }
86 vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul; 82 vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul;
87 vcpu->arch.sie_block->gcr[reg] |= val; 83 vcpu->arch.sie_block->gcr[reg] |= val;
88 useraddr += 4; 84 useraddr += 4;
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 37116a77cb4b..5c948177529e 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -180,7 +180,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
180 struct kvm_s390_interrupt_info *inti) 180 struct kvm_s390_interrupt_info *inti)
181{ 181{
182 const unsigned short table[] = { 2, 4, 4, 6 }; 182 const unsigned short table[] = { 2, 4, 4, 6 };
183 int rc, exception = 0; 183 int rc = 0;
184 184
185 switch (inti->type) { 185 switch (inti->type) {
186 case KVM_S390_INT_EMERGENCY: 186 case KVM_S390_INT_EMERGENCY:
@@ -188,74 +188,41 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
188 vcpu->stat.deliver_emergency_signal++; 188 vcpu->stat.deliver_emergency_signal++;
189 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 189 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
190 inti->emerg.code, 0); 190 inti->emerg.code, 0);
191 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1201); 191 rc = put_guest(vcpu, 0x1201, (u16 __user *)__LC_EXT_INT_CODE);
192 if (rc == -EFAULT) 192 rc |= put_guest(vcpu, inti->emerg.code,
193 exception = 1; 193 (u16 __user *)__LC_EXT_CPU_ADDR);
194 194 rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
195 rc = put_guest_u16(vcpu, __LC_EXT_CPU_ADDR, inti->emerg.code); 195 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
196 if (rc == -EFAULT) 196 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
197 exception = 1; 197 __LC_EXT_NEW_PSW, sizeof(psw_t));
198
199 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
200 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
201 if (rc == -EFAULT)
202 exception = 1;
203
204 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
205 __LC_EXT_NEW_PSW, sizeof(psw_t));
206 if (rc == -EFAULT)
207 exception = 1;
208 break; 198 break;
209
210 case KVM_S390_INT_EXTERNAL_CALL: 199 case KVM_S390_INT_EXTERNAL_CALL:
211 VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp ext call"); 200 VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp ext call");
212 vcpu->stat.deliver_external_call++; 201 vcpu->stat.deliver_external_call++;
213 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 202 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
214 inti->extcall.code, 0); 203 inti->extcall.code, 0);
215 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1202); 204 rc = put_guest(vcpu, 0x1202, (u16 __user *)__LC_EXT_INT_CODE);
216 if (rc == -EFAULT) 205 rc |= put_guest(vcpu, inti->extcall.code,
217 exception = 1; 206 (u16 __user *)__LC_EXT_CPU_ADDR);
218 207 rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
219 rc = put_guest_u16(vcpu, __LC_EXT_CPU_ADDR, inti->extcall.code); 208 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
220 if (rc == -EFAULT) 209 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
221 exception = 1; 210 __LC_EXT_NEW_PSW, sizeof(psw_t));
222
223 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
224 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
225 if (rc == -EFAULT)
226 exception = 1;
227
228 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
229 __LC_EXT_NEW_PSW, sizeof(psw_t));
230 if (rc == -EFAULT)
231 exception = 1;
232 break; 211 break;
233
234 case KVM_S390_INT_SERVICE: 212 case KVM_S390_INT_SERVICE:
235 VCPU_EVENT(vcpu, 4, "interrupt: sclp parm:%x", 213 VCPU_EVENT(vcpu, 4, "interrupt: sclp parm:%x",
236 inti->ext.ext_params); 214 inti->ext.ext_params);
237 vcpu->stat.deliver_service_signal++; 215 vcpu->stat.deliver_service_signal++;
238 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 216 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
239 inti->ext.ext_params, 0); 217 inti->ext.ext_params, 0);
240 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2401); 218 rc = put_guest(vcpu, 0x2401, (u16 __user *)__LC_EXT_INT_CODE);
241 if (rc == -EFAULT) 219 rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
242 exception = 1; 220 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
243 221 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
244 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW, 222 __LC_EXT_NEW_PSW, sizeof(psw_t));
245 &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); 223 rc |= put_guest(vcpu, inti->ext.ext_params,
246 if (rc == -EFAULT) 224 (u32 __user *)__LC_EXT_PARAMS);
247 exception = 1;
248
249 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
250 __LC_EXT_NEW_PSW, sizeof(psw_t));
251 if (rc == -EFAULT)
252 exception = 1;
253
254 rc = put_guest_u32(vcpu, __LC_EXT_PARAMS, inti->ext.ext_params);
255 if (rc == -EFAULT)
256 exception = 1;
257 break; 225 break;
258
259 case KVM_S390_INT_VIRTIO: 226 case KVM_S390_INT_VIRTIO:
260 VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%llx", 227 VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%llx",
261 inti->ext.ext_params, inti->ext.ext_params2); 228 inti->ext.ext_params, inti->ext.ext_params2);
@@ -263,34 +230,17 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
263 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 230 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
264 inti->ext.ext_params, 231 inti->ext.ext_params,
265 inti->ext.ext_params2); 232 inti->ext.ext_params2);
266 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2603); 233 rc = put_guest(vcpu, 0x2603, (u16 __user *)__LC_EXT_INT_CODE);
267 if (rc == -EFAULT) 234 rc |= put_guest(vcpu, 0x0d00, (u16 __user *)__LC_EXT_CPU_ADDR);
268 exception = 1; 235 rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
269 236 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
270 rc = put_guest_u16(vcpu, __LC_EXT_CPU_ADDR, 0x0d00); 237 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
271 if (rc == -EFAULT) 238 __LC_EXT_NEW_PSW, sizeof(psw_t));
272 exception = 1; 239 rc |= put_guest(vcpu, inti->ext.ext_params,
273 240 (u32 __user *)__LC_EXT_PARAMS);
274 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW, 241 rc |= put_guest(vcpu, inti->ext.ext_params2,
275 &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); 242 (u64 __user *)__LC_EXT_PARAMS2);
276 if (rc == -EFAULT)
277 exception = 1;
278
279 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
280 __LC_EXT_NEW_PSW, sizeof(psw_t));
281 if (rc == -EFAULT)
282 exception = 1;
283
284 rc = put_guest_u32(vcpu, __LC_EXT_PARAMS, inti->ext.ext_params);
285 if (rc == -EFAULT)
286 exception = 1;
287
288 rc = put_guest_u64(vcpu, __LC_EXT_PARAMS2,
289 inti->ext.ext_params2);
290 if (rc == -EFAULT)
291 exception = 1;
292 break; 243 break;
293
294 case KVM_S390_SIGP_STOP: 244 case KVM_S390_SIGP_STOP:
295 VCPU_EVENT(vcpu, 4, "%s", "interrupt: cpu stop"); 245 VCPU_EVENT(vcpu, 4, "%s", "interrupt: cpu stop");
296 vcpu->stat.deliver_stop_signal++; 246 vcpu->stat.deliver_stop_signal++;
@@ -313,18 +263,14 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
313 vcpu->stat.deliver_restart_signal++; 263 vcpu->stat.deliver_restart_signal++;
314 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 264 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
315 0, 0); 265 0, 0);
316 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, 266 rc = copy_to_guest(vcpu,
317 restart_old_psw), &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); 267 offsetof(struct _lowcore, restart_old_psw),
318 if (rc == -EFAULT) 268 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
319 exception = 1; 269 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
320 270 offsetof(struct _lowcore, restart_psw),
321 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw, 271 sizeof(psw_t));
322 offsetof(struct _lowcore, restart_psw), sizeof(psw_t));
323 if (rc == -EFAULT)
324 exception = 1;
325 atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); 272 atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
326 break; 273 break;
327
328 case KVM_S390_PROGRAM_INT: 274 case KVM_S390_PROGRAM_INT:
329 VCPU_EVENT(vcpu, 4, "interrupt: pgm check code:%x, ilc:%x", 275 VCPU_EVENT(vcpu, 4, "interrupt: pgm check code:%x, ilc:%x",
330 inti->pgm.code, 276 inti->pgm.code,
@@ -332,24 +278,13 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
332 vcpu->stat.deliver_program_int++; 278 vcpu->stat.deliver_program_int++;
333 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 279 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
334 inti->pgm.code, 0); 280 inti->pgm.code, 0);
335 rc = put_guest_u16(vcpu, __LC_PGM_INT_CODE, inti->pgm.code); 281 rc = put_guest(vcpu, inti->pgm.code, (u16 __user *)__LC_PGM_INT_CODE);
336 if (rc == -EFAULT) 282 rc |= put_guest(vcpu, table[vcpu->arch.sie_block->ipa >> 14],
337 exception = 1; 283 (u16 __user *)__LC_PGM_ILC);
338 284 rc |= copy_to_guest(vcpu, __LC_PGM_OLD_PSW,
339 rc = put_guest_u16(vcpu, __LC_PGM_ILC, 285 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
340 table[vcpu->arch.sie_block->ipa >> 14]); 286 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
341 if (rc == -EFAULT) 287 __LC_PGM_NEW_PSW, sizeof(psw_t));
342 exception = 1;
343
344 rc = copy_to_guest(vcpu, __LC_PGM_OLD_PSW,
345 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
346 if (rc == -EFAULT)
347 exception = 1;
348
349 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
350 __LC_PGM_NEW_PSW, sizeof(psw_t));
351 if (rc == -EFAULT)
352 exception = 1;
353 break; 288 break;
354 289
355 case KVM_S390_MCHK: 290 case KVM_S390_MCHK:
@@ -358,24 +293,13 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
358 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 293 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
359 inti->mchk.cr14, 294 inti->mchk.cr14,
360 inti->mchk.mcic); 295 inti->mchk.mcic);
361 rc = kvm_s390_vcpu_store_status(vcpu, 296 rc = kvm_s390_vcpu_store_status(vcpu,
362 KVM_S390_STORE_STATUS_PREFIXED); 297 KVM_S390_STORE_STATUS_PREFIXED);
363 if (rc == -EFAULT) 298 rc |= put_guest(vcpu, inti->mchk.mcic, (u64 __user *) __LC_MCCK_CODE);
364 exception = 1; 299 rc |= copy_to_guest(vcpu, __LC_MCK_OLD_PSW,
365 300 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
366 rc = put_guest_u64(vcpu, __LC_MCCK_CODE, inti->mchk.mcic); 301 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
367 if (rc == -EFAULT) 302 __LC_MCK_NEW_PSW, sizeof(psw_t));
368 exception = 1;
369
370 rc = copy_to_guest(vcpu, __LC_MCK_OLD_PSW,
371 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
372 if (rc == -EFAULT)
373 exception = 1;
374
375 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
376 __LC_MCK_NEW_PSW, sizeof(psw_t));
377 if (rc == -EFAULT)
378 exception = 1;
379 break; 303 break;
380 304
381 case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX: 305 case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX:
@@ -388,67 +312,44 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
388 vcpu->stat.deliver_io_int++; 312 vcpu->stat.deliver_io_int++;
389 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 313 trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
390 param0, param1); 314 param0, param1);
391 rc = put_guest_u16(vcpu, __LC_SUBCHANNEL_ID, 315 rc = put_guest(vcpu, inti->io.subchannel_id,
392 inti->io.subchannel_id); 316 (u16 __user *) __LC_SUBCHANNEL_ID);
393 if (rc == -EFAULT) 317 rc |= put_guest(vcpu, inti->io.subchannel_nr,
394 exception = 1; 318 (u16 __user *) __LC_SUBCHANNEL_NR);
395 319 rc |= put_guest(vcpu, inti->io.io_int_parm,
396 rc = put_guest_u16(vcpu, __LC_SUBCHANNEL_NR, 320 (u32 __user *) __LC_IO_INT_PARM);
397 inti->io.subchannel_nr); 321 rc |= put_guest(vcpu, inti->io.io_int_word,
398 if (rc == -EFAULT) 322 (u32 __user *) __LC_IO_INT_WORD);
399 exception = 1; 323 rc |= copy_to_guest(vcpu, __LC_IO_OLD_PSW,
400 324 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
401 rc = put_guest_u32(vcpu, __LC_IO_INT_PARM, 325 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
402 inti->io.io_int_parm); 326 __LC_IO_NEW_PSW, sizeof(psw_t));
403 if (rc == -EFAULT)
404 exception = 1;
405
406 rc = put_guest_u32(vcpu, __LC_IO_INT_WORD,
407 inti->io.io_int_word);
408 if (rc == -EFAULT)
409 exception = 1;
410
411 rc = copy_to_guest(vcpu, __LC_IO_OLD_PSW,
412 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
413 if (rc == -EFAULT)
414 exception = 1;
415
416 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
417 __LC_IO_NEW_PSW, sizeof(psw_t));
418 if (rc == -EFAULT)
419 exception = 1;
420 break; 327 break;
421 } 328 }
422 default: 329 default:
423 BUG(); 330 BUG();
424 } 331 }
425 if (exception) { 332 if (rc) {
426 printk("kvm: The guest lowcore is not mapped during interrupt " 333 printk("kvm: The guest lowcore is not mapped during interrupt "
427 "delivery, killing userspace\n"); 334 "delivery, killing userspace\n");
428 do_exit(SIGKILL); 335 do_exit(SIGKILL);
429 } 336 }
430} 337}
431 338
432static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu) 339static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu)
433{ 340{
434 int rc, exception = 0; 341 int rc;
435 342
436 if (psw_extint_disabled(vcpu)) 343 if (psw_extint_disabled(vcpu))
437 return 0; 344 return 0;
438 if (!(vcpu->arch.sie_block->gcr[0] & 0x800ul)) 345 if (!(vcpu->arch.sie_block->gcr[0] & 0x800ul))
439 return 0; 346 return 0;
440 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1004); 347 rc = put_guest(vcpu, 0x1004, (u16 __user *)__LC_EXT_INT_CODE);
441 if (rc == -EFAULT) 348 rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
442 exception = 1; 349 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
443 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW, 350 rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
444 &vcpu->arch.sie_block->gpsw, sizeof(psw_t)); 351 __LC_EXT_NEW_PSW, sizeof(psw_t));
445 if (rc == -EFAULT) 352 if (rc) {
446 exception = 1;
447 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
448 __LC_EXT_NEW_PSW, sizeof(psw_t));
449 if (rc == -EFAULT)
450 exception = 1;
451 if (exception) {
452 printk("kvm: The guest lowcore is not mapped during interrupt " 353 printk("kvm: The guest lowcore is not mapped during interrupt "
453 "delivery, killing userspace\n"); 354 "delivery, killing userspace\n");
454 do_exit(SIGKILL); 355 do_exit(SIGKILL);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 4cf35a0a79e7..c1c7c683fa26 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -142,12 +142,16 @@ int kvm_dev_ioctl_check_extension(long ext)
142 case KVM_CAP_ONE_REG: 142 case KVM_CAP_ONE_REG:
143 case KVM_CAP_ENABLE_CAP: 143 case KVM_CAP_ENABLE_CAP:
144 case KVM_CAP_S390_CSS_SUPPORT: 144 case KVM_CAP_S390_CSS_SUPPORT:
145 case KVM_CAP_IOEVENTFD:
145 r = 1; 146 r = 1;
146 break; 147 break;
147 case KVM_CAP_NR_VCPUS: 148 case KVM_CAP_NR_VCPUS:
148 case KVM_CAP_MAX_VCPUS: 149 case KVM_CAP_MAX_VCPUS:
149 r = KVM_MAX_VCPUS; 150 r = KVM_MAX_VCPUS;
150 break; 151 break;
152 case KVM_CAP_NR_MEMSLOTS:
153 r = KVM_USER_MEM_SLOTS;
154 break;
151 case KVM_CAP_S390_COW: 155 case KVM_CAP_S390_COW:
152 r = MACHINE_HAS_ESOP; 156 r = MACHINE_HAS_ESOP;
153 break; 157 break;
@@ -632,8 +636,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
632 } else { 636 } else {
633 VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction"); 637 VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
634 trace_kvm_s390_sie_fault(vcpu); 638 trace_kvm_s390_sie_fault(vcpu);
635 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 639 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
636 rc = 0;
637 } 640 }
638 } 641 }
639 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 642 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
@@ -974,22 +977,13 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
974/* Section: memory related */ 977/* Section: memory related */
975int kvm_arch_prepare_memory_region(struct kvm *kvm, 978int kvm_arch_prepare_memory_region(struct kvm *kvm,
976 struct kvm_memory_slot *memslot, 979 struct kvm_memory_slot *memslot,
977 struct kvm_memory_slot old,
978 struct kvm_userspace_memory_region *mem, 980 struct kvm_userspace_memory_region *mem,
979 bool user_alloc) 981 enum kvm_mr_change change)
980{ 982{
981 /* A few sanity checks. We can have exactly one memory slot which has 983 /* A few sanity checks. We can have memory slots which have to be
982 to start at guest virtual zero and which has to be located at a 984 located/ended at a segment boundary (1MB). The memory in userland is
983 page boundary in userland and which has to end at a page boundary. 985 ok to be fragmented into various different vmas. It is okay to mmap()
984 The memory in userland is ok to be fragmented into various different 986 and munmap() stuff in this slot after doing this call at any time */
985 vmas. It is okay to mmap() and munmap() stuff in this slot after
986 doing this call at any time */
987
988 if (mem->slot)
989 return -EINVAL;
990
991 if (mem->guest_phys_addr)
992 return -EINVAL;
993 987
994 if (mem->userspace_addr & 0xffffful) 988 if (mem->userspace_addr & 0xffffful)
995 return -EINVAL; 989 return -EINVAL;
@@ -997,19 +991,26 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
997 if (mem->memory_size & 0xffffful) 991 if (mem->memory_size & 0xffffful)
998 return -EINVAL; 992 return -EINVAL;
999 993
1000 if (!user_alloc)
1001 return -EINVAL;
1002
1003 return 0; 994 return 0;
1004} 995}
1005 996
1006void kvm_arch_commit_memory_region(struct kvm *kvm, 997void kvm_arch_commit_memory_region(struct kvm *kvm,
1007 struct kvm_userspace_memory_region *mem, 998 struct kvm_userspace_memory_region *mem,
1008 struct kvm_memory_slot old, 999 const struct kvm_memory_slot *old,
1009 bool user_alloc) 1000 enum kvm_mr_change change)
1010{ 1001{
1011 int rc; 1002 int rc;
1012 1003
1004 /* If the basics of the memslot do not change, we do not want
1005 * to update the gmap. Every update causes several unnecessary
1006 * segment translation exceptions. This is usually handled just
1007 * fine by the normal fault handler + gmap, but it will also
1008 * cause faults on the prefix page of running guest CPUs.
1009 */
1010 if (old->userspace_addr == mem->userspace_addr &&
1011 old->base_gfn * PAGE_SIZE == mem->guest_phys_addr &&
1012 old->npages * PAGE_SIZE == mem->memory_size)
1013 return;
1013 1014
1014 rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr, 1015 rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr,
1015 mem->guest_phys_addr, mem->memory_size); 1016 mem->guest_phys_addr, mem->memory_size);
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 4d89d64a8161..efc14f687265 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -110,12 +110,12 @@ enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
110void kvm_s390_tasklet(unsigned long parm); 110void kvm_s390_tasklet(unsigned long parm);
111void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu); 111void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu);
112void kvm_s390_deliver_pending_machine_checks(struct kvm_vcpu *vcpu); 112void kvm_s390_deliver_pending_machine_checks(struct kvm_vcpu *vcpu);
113int kvm_s390_inject_vm(struct kvm *kvm, 113int __must_check kvm_s390_inject_vm(struct kvm *kvm,
114 struct kvm_s390_interrupt *s390int); 114 struct kvm_s390_interrupt *s390int);
115int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu, 115int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
116 struct kvm_s390_interrupt *s390int); 116 struct kvm_s390_interrupt *s390int);
117int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code); 117int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
118int kvm_s390_inject_sigp_stop(struct kvm_vcpu *vcpu, int action); 118int __must_check kvm_s390_inject_sigp_stop(struct kvm_vcpu *vcpu, int action);
119struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm, 119struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
120 u64 cr6, u64 schid); 120 u64 cr6, u64 schid);
121 121
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 0ef9894606e5..6bbd7b5a0bbe 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -14,6 +14,8 @@
14#include <linux/kvm.h> 14#include <linux/kvm.h>
15#include <linux/gfp.h> 15#include <linux/gfp.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/compat.h>
18#include <asm/asm-offsets.h>
17#include <asm/current.h> 19#include <asm/current.h>
18#include <asm/debug.h> 20#include <asm/debug.h>
19#include <asm/ebcdic.h> 21#include <asm/ebcdic.h>
@@ -35,31 +37,24 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu)
35 operand2 = kvm_s390_get_base_disp_s(vcpu); 37 operand2 = kvm_s390_get_base_disp_s(vcpu);
36 38
37 /* must be word boundary */ 39 /* must be word boundary */
38 if (operand2 & 3) { 40 if (operand2 & 3)
39 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 41 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
40 goto out;
41 }
42 42
43 /* get the value */ 43 /* get the value */
44 if (get_guest_u32(vcpu, operand2, &address)) { 44 if (get_guest(vcpu, address, (u32 __user *) operand2))
45 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 45 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
46 goto out;
47 }
48 46
49 address = address & 0x7fffe000u; 47 address = address & 0x7fffe000u;
50 48
51 /* make sure that the new value is valid memory */ 49 /* make sure that the new value is valid memory */
52 if (copy_from_guest_absolute(vcpu, &tmp, address, 1) || 50 if (copy_from_guest_absolute(vcpu, &tmp, address, 1) ||
53 (copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1))) { 51 (copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1)))
54 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 52 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
55 goto out;
56 }
57 53
58 kvm_s390_set_prefix(vcpu, address); 54 kvm_s390_set_prefix(vcpu, address);
59 55
60 VCPU_EVENT(vcpu, 5, "setting prefix to %x", address); 56 VCPU_EVENT(vcpu, 5, "setting prefix to %x", address);
61 trace_kvm_s390_handle_prefix(vcpu, 1, address); 57 trace_kvm_s390_handle_prefix(vcpu, 1, address);
62out:
63 return 0; 58 return 0;
64} 59}
65 60
@@ -73,49 +68,37 @@ static int handle_store_prefix(struct kvm_vcpu *vcpu)
73 operand2 = kvm_s390_get_base_disp_s(vcpu); 68 operand2 = kvm_s390_get_base_disp_s(vcpu);
74 69
75 /* must be word boundary */ 70 /* must be word boundary */
76 if (operand2 & 3) { 71 if (operand2 & 3)
77 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 72 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
78 goto out;
79 }
80 73
81 address = vcpu->arch.sie_block->prefix; 74 address = vcpu->arch.sie_block->prefix;
82 address = address & 0x7fffe000u; 75 address = address & 0x7fffe000u;
83 76
84 /* get the value */ 77 /* get the value */
85 if (put_guest_u32(vcpu, operand2, address)) { 78 if (put_guest(vcpu, address, (u32 __user *)operand2))
86 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 79 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
87 goto out;
88 }
89 80
90 VCPU_EVENT(vcpu, 5, "storing prefix to %x", address); 81 VCPU_EVENT(vcpu, 5, "storing prefix to %x", address);
91 trace_kvm_s390_handle_prefix(vcpu, 0, address); 82 trace_kvm_s390_handle_prefix(vcpu, 0, address);
92out:
93 return 0; 83 return 0;
94} 84}
95 85
96static int handle_store_cpu_address(struct kvm_vcpu *vcpu) 86static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
97{ 87{
98 u64 useraddr; 88 u64 useraddr;
99 int rc;
100 89
101 vcpu->stat.instruction_stap++; 90 vcpu->stat.instruction_stap++;
102 91
103 useraddr = kvm_s390_get_base_disp_s(vcpu); 92 useraddr = kvm_s390_get_base_disp_s(vcpu);
104 93
105 if (useraddr & 1) { 94 if (useraddr & 1)
106 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 95 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
107 goto out;
108 }
109 96
110 rc = put_guest_u16(vcpu, useraddr, vcpu->vcpu_id); 97 if (put_guest(vcpu, vcpu->vcpu_id, (u16 __user *)useraddr))
111 if (rc == -EFAULT) { 98 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
112 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
113 goto out;
114 }
115 99
116 VCPU_EVENT(vcpu, 5, "storing cpu address to %llx", useraddr); 100 VCPU_EVENT(vcpu, 5, "storing cpu address to %llx", useraddr);
117 trace_kvm_s390_handle_stap(vcpu, useraddr); 101 trace_kvm_s390_handle_stap(vcpu, useraddr);
118out:
119 return 0; 102 return 0;
120} 103}
121 104
@@ -129,36 +112,38 @@ static int handle_skey(struct kvm_vcpu *vcpu)
129 112
130static int handle_tpi(struct kvm_vcpu *vcpu) 113static int handle_tpi(struct kvm_vcpu *vcpu)
131{ 114{
132 u64 addr;
133 struct kvm_s390_interrupt_info *inti; 115 struct kvm_s390_interrupt_info *inti;
116 u64 addr;
134 int cc; 117 int cc;
135 118
136 addr = kvm_s390_get_base_disp_s(vcpu); 119 addr = kvm_s390_get_base_disp_s(vcpu);
137 120 if (addr & 3)
121 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
122 cc = 0;
138 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0); 123 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0);
139 if (inti) { 124 if (!inti)
140 if (addr) { 125 goto no_interrupt;
141 /* 126 cc = 1;
142 * Store the two-word I/O interruption code into the 127 if (addr) {
143 * provided area. 128 /*
144 */ 129 * Store the two-word I/O interruption code into the
145 put_guest_u16(vcpu, addr, inti->io.subchannel_id); 130 * provided area.
146 put_guest_u16(vcpu, addr + 2, inti->io.subchannel_nr); 131 */
147 put_guest_u32(vcpu, addr + 4, inti->io.io_int_parm); 132 put_guest(vcpu, inti->io.subchannel_id, (u16 __user *) addr);
148 } else { 133 put_guest(vcpu, inti->io.subchannel_nr, (u16 __user *) (addr + 2));
149 /* 134 put_guest(vcpu, inti->io.io_int_parm, (u32 __user *) (addr + 4));
150 * Store the three-word I/O interruption code into 135 } else {
151 * the appropriate lowcore area. 136 /*
152 */ 137 * Store the three-word I/O interruption code into
153 put_guest_u16(vcpu, 184, inti->io.subchannel_id); 138 * the appropriate lowcore area.
154 put_guest_u16(vcpu, 186, inti->io.subchannel_nr); 139 */
155 put_guest_u32(vcpu, 188, inti->io.io_int_parm); 140 put_guest(vcpu, inti->io.subchannel_id, (u16 __user *) __LC_SUBCHANNEL_ID);
156 put_guest_u32(vcpu, 192, inti->io.io_int_word); 141 put_guest(vcpu, inti->io.subchannel_nr, (u16 __user *) __LC_SUBCHANNEL_NR);
157 } 142 put_guest(vcpu, inti->io.io_int_parm, (u32 __user *) __LC_IO_INT_PARM);
158 cc = 1; 143 put_guest(vcpu, inti->io.io_int_word, (u32 __user *) __LC_IO_INT_WORD);
159 } else 144 }
160 cc = 0;
161 kfree(inti); 145 kfree(inti);
146no_interrupt:
162 /* Set condition code and we're done. */ 147 /* Set condition code and we're done. */
163 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); 148 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
164 vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44; 149 vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44;
@@ -230,13 +215,10 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
230 215
231 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list), 216 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list),
232 &facility_list, sizeof(facility_list)); 217 &facility_list, sizeof(facility_list));
233 if (rc == -EFAULT) 218 if (rc)
234 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 219 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
235 else { 220 VCPU_EVENT(vcpu, 5, "store facility list value %x", facility_list);
236 VCPU_EVENT(vcpu, 5, "store facility list value %x", 221 trace_kvm_s390_handle_stfl(vcpu, facility_list);
237 facility_list);
238 trace_kvm_s390_handle_stfl(vcpu, facility_list);
239 }
240 return 0; 222 return 0;
241} 223}
242 224
@@ -249,112 +231,80 @@ static void handle_new_psw(struct kvm_vcpu *vcpu)
249 231
250#define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA) 232#define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA)
251#define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL 233#define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL
252#define PSW_ADDR_24 0x00000000000fffffUL 234#define PSW_ADDR_24 0x0000000000ffffffUL
253#define PSW_ADDR_31 0x000000007fffffffUL 235#define PSW_ADDR_31 0x000000007fffffffUL
254 236
237static int is_valid_psw(psw_t *psw) {
238 if (psw->mask & PSW_MASK_UNASSIGNED)
239 return 0;
240 if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) {
241 if (psw->addr & ~PSW_ADDR_31)
242 return 0;
243 }
244 if (!(psw->mask & PSW_MASK_ADDR_MODE) && (psw->addr & ~PSW_ADDR_24))
245 return 0;
246 if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_EA)
247 return 0;
248 return 1;
249}
250
255int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu) 251int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
256{ 252{
257 u64 addr; 253 psw_t *gpsw = &vcpu->arch.sie_block->gpsw;
258 psw_compat_t new_psw; 254 psw_compat_t new_psw;
255 u64 addr;
259 256
260 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 257 if (gpsw->mask & PSW_MASK_PSTATE)
261 return kvm_s390_inject_program_int(vcpu, 258 return kvm_s390_inject_program_int(vcpu,
262 PGM_PRIVILEGED_OPERATION); 259 PGM_PRIVILEGED_OPERATION);
263
264 addr = kvm_s390_get_base_disp_s(vcpu); 260 addr = kvm_s390_get_base_disp_s(vcpu);
265 261 if (addr & 7)
266 if (addr & 7) { 262 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
267 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 263 if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw)))
268 goto out; 264 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
269 } 265 if (!(new_psw.mask & PSW32_MASK_BASE))
270 266 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
271 if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) { 267 gpsw->mask = (new_psw.mask & ~PSW32_MASK_BASE) << 32;
272 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 268 gpsw->mask |= new_psw.addr & PSW32_ADDR_AMODE;
273 goto out; 269 gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE;
274 } 270 if (!is_valid_psw(gpsw))
275 271 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
276 if (!(new_psw.mask & PSW32_MASK_BASE)) {
277 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
278 goto out;
279 }
280
281 vcpu->arch.sie_block->gpsw.mask =
282 (new_psw.mask & ~PSW32_MASK_BASE) << 32;
283 vcpu->arch.sie_block->gpsw.addr = new_psw.addr;
284
285 if ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_UNASSIGNED) ||
286 (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
287 (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_24)) ||
288 ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
289 PSW_MASK_EA)) {
290 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
291 goto out;
292 }
293
294 handle_new_psw(vcpu); 272 handle_new_psw(vcpu);
295out:
296 return 0; 273 return 0;
297} 274}
298 275
299static int handle_lpswe(struct kvm_vcpu *vcpu) 276static int handle_lpswe(struct kvm_vcpu *vcpu)
300{ 277{
301 u64 addr;
302 psw_t new_psw; 278 psw_t new_psw;
279 u64 addr;
303 280
304 addr = kvm_s390_get_base_disp_s(vcpu); 281 addr = kvm_s390_get_base_disp_s(vcpu);
305 282 if (addr & 7)
306 if (addr & 7) { 283 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
307 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 284 if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw)))
308 goto out; 285 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
309 } 286 vcpu->arch.sie_block->gpsw = new_psw;
310 287 if (!is_valid_psw(&vcpu->arch.sie_block->gpsw))
311 if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) { 288 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
312 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
313 goto out;
314 }
315
316 vcpu->arch.sie_block->gpsw.mask = new_psw.mask;
317 vcpu->arch.sie_block->gpsw.addr = new_psw.addr;
318
319 if ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_UNASSIGNED) ||
320 (((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
321 PSW_MASK_BA) &&
322 (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_31)) ||
323 (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
324 (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_24)) ||
325 ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
326 PSW_MASK_EA)) {
327 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
328 goto out;
329 }
330
331 handle_new_psw(vcpu); 289 handle_new_psw(vcpu);
332out:
333 return 0; 290 return 0;
334} 291}
335 292
336static int handle_stidp(struct kvm_vcpu *vcpu) 293static int handle_stidp(struct kvm_vcpu *vcpu)
337{ 294{
338 u64 operand2; 295 u64 operand2;
339 int rc;
340 296
341 vcpu->stat.instruction_stidp++; 297 vcpu->stat.instruction_stidp++;
342 298
343 operand2 = kvm_s390_get_base_disp_s(vcpu); 299 operand2 = kvm_s390_get_base_disp_s(vcpu);
344 300
345 if (operand2 & 7) { 301 if (operand2 & 7)
346 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 302 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
347 goto out;
348 }
349 303
350 rc = put_guest_u64(vcpu, operand2, vcpu->arch.stidp_data); 304 if (put_guest(vcpu, vcpu->arch.stidp_data, (u64 __user *)operand2))
351 if (rc == -EFAULT) { 305 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
352 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
353 goto out;
354 }
355 306
356 VCPU_EVENT(vcpu, 5, "%s", "store cpu id"); 307 VCPU_EVENT(vcpu, 5, "%s", "store cpu id");
357out:
358 return 0; 308 return 0;
359} 309}
360 310
@@ -394,8 +344,9 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
394 int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28; 344 int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28;
395 int sel1 = vcpu->run->s.regs.gprs[0] & 0xff; 345 int sel1 = vcpu->run->s.regs.gprs[0] & 0xff;
396 int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff; 346 int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff;
347 unsigned long mem = 0;
397 u64 operand2; 348 u64 operand2;
398 unsigned long mem; 349 int rc = 0;
399 350
400 vcpu->stat.instruction_stsi++; 351 vcpu->stat.instruction_stsi++;
401 VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2); 352 VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2);
@@ -414,37 +365,37 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
414 case 2: 365 case 2:
415 mem = get_zeroed_page(GFP_KERNEL); 366 mem = get_zeroed_page(GFP_KERNEL);
416 if (!mem) 367 if (!mem)
417 goto out_fail; 368 goto out_no_data;
418 if (stsi((void *) mem, fc, sel1, sel2)) 369 if (stsi((void *) mem, fc, sel1, sel2))
419 goto out_mem; 370 goto out_no_data;
420 break; 371 break;
421 case 3: 372 case 3:
422 if (sel1 != 2 || sel2 != 2) 373 if (sel1 != 2 || sel2 != 2)
423 goto out_fail; 374 goto out_no_data;
424 mem = get_zeroed_page(GFP_KERNEL); 375 mem = get_zeroed_page(GFP_KERNEL);
425 if (!mem) 376 if (!mem)
426 goto out_fail; 377 goto out_no_data;
427 handle_stsi_3_2_2(vcpu, (void *) mem); 378 handle_stsi_3_2_2(vcpu, (void *) mem);
428 break; 379 break;
429 default: 380 default:
430 goto out_fail; 381 goto out_no_data;
431 } 382 }
432 383
433 if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) { 384 if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) {
434 kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); 385 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
435 goto out_mem; 386 goto out_exception;
436 } 387 }
437 trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); 388 trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
438 free_page(mem); 389 free_page(mem);
439 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); 390 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
440 vcpu->run->s.regs.gprs[0] = 0; 391 vcpu->run->s.regs.gprs[0] = 0;
441 return 0; 392 return 0;
442out_mem: 393out_no_data:
443 free_page(mem);
444out_fail:
445 /* condition code 3 */ 394 /* condition code 3 */
446 vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; 395 vcpu->arch.sie_block->gpsw.mask |= 3ul << 44;
447 return 0; 396out_exception:
397 free_page(mem);
398 return rc;
448} 399}
449 400
450static const intercept_handler_t b2_handlers[256] = { 401static const intercept_handler_t b2_handlers[256] = {
@@ -575,20 +526,13 @@ static int handle_tprot(struct kvm_vcpu *vcpu)
575 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT) 526 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT)
576 return -EOPNOTSUPP; 527 return -EOPNOTSUPP;
577 528
578
579 /* we must resolve the address without holding the mmap semaphore.
580 * This is ok since the userspace hypervisor is not supposed to change
581 * the mapping while the guest queries the memory. Otherwise the guest
582 * might crash or get wrong info anyway. */
583 user_address = (unsigned long) __guestaddr_to_user(vcpu, address1);
584
585 down_read(&current->mm->mmap_sem); 529 down_read(&current->mm->mmap_sem);
530 user_address = __gmap_translate(address1, vcpu->arch.gmap);
531 if (IS_ERR_VALUE(user_address))
532 goto out_inject;
586 vma = find_vma(current->mm, user_address); 533 vma = find_vma(current->mm, user_address);
587 if (!vma) { 534 if (!vma)
588 up_read(&current->mm->mmap_sem); 535 goto out_inject;
589 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
590 }
591
592 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); 536 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
593 if (!(vma->vm_flags & VM_WRITE) && (vma->vm_flags & VM_READ)) 537 if (!(vma->vm_flags & VM_WRITE) && (vma->vm_flags & VM_READ))
594 vcpu->arch.sie_block->gpsw.mask |= (1ul << 44); 538 vcpu->arch.sie_block->gpsw.mask |= (1ul << 44);
@@ -597,6 +541,10 @@ static int handle_tprot(struct kvm_vcpu *vcpu)
597 541
598 up_read(&current->mm->mmap_sem); 542 up_read(&current->mm->mmap_sem);
599 return 0; 543 return 0;
544
545out_inject:
546 up_read(&current->mm->mmap_sem);
547 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
600} 548}
601 549
602int kvm_s390_handle_e5(struct kvm_vcpu *vcpu) 550int kvm_s390_handle_e5(struct kvm_vcpu *vcpu)
diff --git a/arch/s390/kvm/trace.h b/arch/s390/kvm/trace.h
index 2b29e62351d3..c2f582bb1cb2 100644
--- a/arch/s390/kvm/trace.h
+++ b/arch/s390/kvm/trace.h
@@ -67,7 +67,7 @@ TRACE_EVENT(kvm_s390_sie_fault,
67#define sie_intercept_code \ 67#define sie_intercept_code \
68 {0x04, "Instruction"}, \ 68 {0x04, "Instruction"}, \
69 {0x08, "Program interruption"}, \ 69 {0x08, "Program interruption"}, \
70 {0x0C, "Instruction and program interuption"}, \ 70 {0x0C, "Instruction and program interruption"}, \
71 {0x10, "External request"}, \ 71 {0x10, "External request"}, \
72 {0x14, "External interruption"}, \ 72 {0x14, "External interruption"}, \
73 {0x18, "I/O request"}, \ 73 {0x18, "I/O request"}, \
@@ -117,7 +117,7 @@ TRACE_EVENT(kvm_s390_intercept_instruction,
117 __entry->instruction, 117 __entry->instruction,
118 insn_to_mnemonic((unsigned char *) 118 insn_to_mnemonic((unsigned char *)
119 &__entry->instruction, 119 &__entry->instruction,
120 __entry->insn) ? 120 __entry->insn, sizeof(__entry->insn)) ?
121 "unknown" : __entry->insn) 121 "unknown" : __entry->insn)
122 ); 122 );
123 123
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index 6ab0d0b5cec8..20b0e97a7df2 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -3,7 +3,6 @@
3# 3#
4 4
5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o 5lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
6obj-y += usercopy.o
7obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o mem32.o 6obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o mem32.o
8obj-$(CONFIG_64BIT) += mem64.o 7obj-$(CONFIG_64BIT) += mem64.o
9lib-$(CONFIG_64BIT) += uaccess_mvcos.o 8lib-$(CONFIG_64BIT) += uaccess_mvcos.o
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 466fb3383960..50ea137a2d3c 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -89,16 +89,19 @@ static unsigned long follow_table(struct mm_struct *mm,
89 if (unlikely(*table & _REGION_ENTRY_INV)) 89 if (unlikely(*table & _REGION_ENTRY_INV))
90 return -0x39UL; 90 return -0x39UL;
91 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 91 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
92 /* fallthrough */
92 case _ASCE_TYPE_REGION2: 93 case _ASCE_TYPE_REGION2:
93 table = table + ((address >> 42) & 0x7ff); 94 table = table + ((address >> 42) & 0x7ff);
94 if (unlikely(*table & _REGION_ENTRY_INV)) 95 if (unlikely(*table & _REGION_ENTRY_INV))
95 return -0x3aUL; 96 return -0x3aUL;
96 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 97 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
98 /* fallthrough */
97 case _ASCE_TYPE_REGION3: 99 case _ASCE_TYPE_REGION3:
98 table = table + ((address >> 31) & 0x7ff); 100 table = table + ((address >> 31) & 0x7ff);
99 if (unlikely(*table & _REGION_ENTRY_INV)) 101 if (unlikely(*table & _REGION_ENTRY_INV))
100 return -0x3bUL; 102 return -0x3bUL;
101 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 103 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
104 /* fallthrough */
102 case _ASCE_TYPE_SEGMENT: 105 case _ASCE_TYPE_SEGMENT:
103 table = table + ((address >> 20) & 0x7ff); 106 table = table + ((address >> 20) & 0x7ff);
104 if (unlikely(*table & _SEGMENT_ENTRY_INV)) 107 if (unlikely(*table & _SEGMENT_ENTRY_INV))
diff --git a/arch/s390/lib/usercopy.c b/arch/s390/lib/usercopy.c
deleted file mode 100644
index 14b363fec8a2..000000000000
--- a/arch/s390/lib/usercopy.c
+++ /dev/null
@@ -1,8 +0,0 @@
1#include <linux/module.h>
2#include <linux/bug.h>
3
4void copy_from_user_overflow(void)
5{
6 WARN(1, "Buffer overflow detected!\n");
7}
8EXPORT_SYMBOL(copy_from_user_overflow);
diff --git a/arch/s390/mm/Makefile b/arch/s390/mm/Makefile
index 640bea12303c..839592ca265c 100644
--- a/arch/s390/mm/Makefile
+++ b/arch/s390/mm/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o maccess.o 5obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o maccess.o
6obj-y += page-states.o gup.o extable.o pageattr.o 6obj-y += page-states.o gup.o extable.o pageattr.o mem_detect.o
7 7
8obj-$(CONFIG_CMM) += cmm.o 8obj-$(CONFIG_CMM) += cmm.o
9obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 9obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 479e94282910..9d84a1feefef 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -458,12 +458,10 @@ static int __init cmm_init(void)
458 if (rc) 458 if (rc)
459 goto out_pm; 459 goto out_pm;
460 cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread"); 460 cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread");
461 rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0; 461 if (!IS_ERR(cmm_thread_ptr))
462 if (rc) 462 return 0;
463 goto out_kthread;
464 return 0;
465 463
466out_kthread: 464 rc = PTR_ERR(cmm_thread_ptr);
467 unregister_pm_notifier(&cmm_power_notifier); 465 unregister_pm_notifier(&cmm_power_notifier);
468out_pm: 466out_pm:
469 unregister_oom_notifier(&cmm_oom_nb); 467 unregister_oom_notifier(&cmm_oom_nb);
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 2fb9e63b8fc4..047c3e4c59a2 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -395,8 +395,13 @@ void __kprobes do_protection_exception(struct pt_regs *regs)
395 int fault; 395 int fault;
396 396
397 trans_exc_code = regs->int_parm_long; 397 trans_exc_code = regs->int_parm_long;
398 /* Protection exception is suppressing, decrement psw address. */ 398 /*
399 regs->psw.addr = __rewind_psw(regs->psw, regs->int_code >> 16); 399 * Protection exceptions are suppressing, decrement psw address.
400 * The exception to this rule are aborted transactions, for these
401 * the PSW already points to the correct location.
402 */
403 if (!(regs->int_code & 0x200))
404 regs->psw.addr = __rewind_psw(regs->psw, regs->int_code >> 16);
400 /* 405 /*
401 * Check for low-address protection. This needs to be treated 406 * Check for low-address protection. This needs to be treated
402 * as a special case because the translation exception code 407 * as a special case because the translation exception code
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
index 532525ec88c1..121089d57802 100644
--- a/arch/s390/mm/hugetlbpage.c
+++ b/arch/s390/mm/hugetlbpage.c
@@ -39,7 +39,7 @@ int arch_prepare_hugepage(struct page *page)
39 if (!ptep) 39 if (!ptep)
40 return -ENOMEM; 40 return -ENOMEM;
41 41
42 pte = mk_pte(page, PAGE_RW); 42 pte_val(pte) = addr;
43 for (i = 0; i < PTRS_PER_PTE; i++) { 43 for (i = 0; i < PTRS_PER_PTE; i++) {
44 set_pte_at(&init_mm, addr + i * PAGE_SIZE, ptep + i, pte); 44 set_pte_at(&init_mm, addr + i * PAGE_SIZE, ptep + i, pte);
45 pte_val(pte) += PAGE_SIZE; 45 pte_val(pte) += PAGE_SIZE;
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 49ce6bb2c641..89ebae4008f2 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/memory.h>
24#include <linux/pfn.h> 25#include <linux/pfn.h>
25#include <linux/poison.h> 26#include <linux/poison.h>
26#include <linux/initrd.h> 27#include <linux/initrd.h>
@@ -36,17 +37,17 @@
36#include <asm/tlbflush.h> 37#include <asm/tlbflush.h>
37#include <asm/sections.h> 38#include <asm/sections.h>
38#include <asm/ctl_reg.h> 39#include <asm/ctl_reg.h>
40#include <asm/sclp.h>
39 41
40pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); 42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
41 43
42unsigned long empty_zero_page, zero_page_mask; 44unsigned long empty_zero_page, zero_page_mask;
43EXPORT_SYMBOL(empty_zero_page); 45EXPORT_SYMBOL(empty_zero_page);
44 46
45static unsigned long __init setup_zero_pages(void) 47static void __init setup_zero_pages(void)
46{ 48{
47 struct cpuid cpu_id; 49 struct cpuid cpu_id;
48 unsigned int order; 50 unsigned int order;
49 unsigned long size;
50 struct page *page; 51 struct page *page;
51 int i; 52 int i;
52 53
@@ -63,10 +64,18 @@ static unsigned long __init setup_zero_pages(void)
63 break; 64 break;
64 case 0x2097: /* z10 */ 65 case 0x2097: /* z10 */
65 case 0x2098: /* z10 */ 66 case 0x2098: /* z10 */
66 default: 67 case 0x2817: /* z196 */
68 case 0x2818: /* z196 */
67 order = 2; 69 order = 2;
68 break; 70 break;
71 case 0x2827: /* zEC12 */
72 default:
73 order = 5;
74 break;
69 } 75 }
76 /* Limit number of empty zero pages for small memory sizes */
77 if (order > 2 && totalram_pages <= 16384)
78 order = 2;
70 79
71 empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order); 80 empty_zero_page = __get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
72 if (!empty_zero_page) 81 if (!empty_zero_page)
@@ -75,14 +84,11 @@ static unsigned long __init setup_zero_pages(void)
75 page = virt_to_page((void *) empty_zero_page); 84 page = virt_to_page((void *) empty_zero_page);
76 split_page(page, order); 85 split_page(page, order);
77 for (i = 1 << order; i > 0; i--) { 86 for (i = 1 << order; i > 0; i--) {
78 SetPageReserved(page); 87 mark_page_reserved(page);
79 page++; 88 page++;
80 } 89 }
81 90
82 size = PAGE_SIZE << order; 91 zero_page_mask = ((PAGE_SIZE << order) - 1) & PAGE_MASK;
83 zero_page_mask = (size - 1) & PAGE_MASK;
84
85 return 1UL << order;
86} 92}
87 93
88/* 94/*
@@ -139,7 +145,7 @@ void __init mem_init(void)
139 145
140 /* this will put all low memory onto the freelists */ 146 /* this will put all low memory onto the freelists */
141 totalram_pages += free_all_bootmem(); 147 totalram_pages += free_all_bootmem();
142 totalram_pages -= setup_zero_pages(); /* Setup zeroed pages. */ 148 setup_zero_pages(); /* Setup zeroed pages. */
143 149
144 reservedpages = 0; 150 reservedpages = 0;
145 151
@@ -158,34 +164,15 @@ void __init mem_init(void)
158 PFN_ALIGN((unsigned long)&_eshared) - 1); 164 PFN_ALIGN((unsigned long)&_eshared) - 1);
159} 165}
160 166
161void free_init_pages(char *what, unsigned long begin, unsigned long end)
162{
163 unsigned long addr = begin;
164
165 if (begin >= end)
166 return;
167 for (; addr < end; addr += PAGE_SIZE) {
168 ClearPageReserved(virt_to_page(addr));
169 init_page_count(virt_to_page(addr));
170 memset((void *)(addr & PAGE_MASK), POISON_FREE_INITMEM,
171 PAGE_SIZE);
172 free_page(addr);
173 totalram_pages++;
174 }
175 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
176}
177
178void free_initmem(void) 167void free_initmem(void)
179{ 168{
180 free_init_pages("unused kernel memory", 169 free_initmem_default(0);
181 (unsigned long)&__init_begin,
182 (unsigned long)&__init_end);
183} 170}
184 171
185#ifdef CONFIG_BLK_DEV_INITRD 172#ifdef CONFIG_BLK_DEV_INITRD
186void __init free_initrd_mem(unsigned long start, unsigned long end) 173void __init free_initrd_mem(unsigned long start, unsigned long end)
187{ 174{
188 free_init_pages("initrd memory", start, end); 175 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
189} 176}
190#endif 177#endif
191 178
@@ -229,6 +216,15 @@ int arch_add_memory(int nid, u64 start, u64 size)
229 return rc; 216 return rc;
230} 217}
231 218
219unsigned long memory_block_size_bytes(void)
220{
221 /*
222 * Make sure the memory block size is always greater
223 * or equal than the memory increment size.
224 */
225 return max_t(unsigned long, MIN_MEMORY_BLOCK_SIZE, sclp_get_rzm());
226}
227
232#ifdef CONFIG_MEMORY_HOTREMOVE 228#ifdef CONFIG_MEMORY_HOTREMOVE
233int arch_remove_memory(u64 start, u64 size) 229int arch_remove_memory(u64 start, u64 size)
234{ 230{
diff --git a/arch/s390/mm/mem_detect.c b/arch/s390/mm/mem_detect.c
new file mode 100644
index 000000000000..3cbd3b8bf311
--- /dev/null
+++ b/arch/s390/mm/mem_detect.c
@@ -0,0 +1,134 @@
1/*
2 * Copyright IBM Corp. 2008, 2009
3 *
4 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <asm/ipl.h>
10#include <asm/sclp.h>
11#include <asm/setup.h>
12
13#define ADDR2G (1ULL << 31)
14
15static void find_memory_chunks(struct mem_chunk chunk[], unsigned long maxsize)
16{
17 unsigned long long memsize, rnmax, rzm;
18 unsigned long addr = 0, size;
19 int i = 0, type;
20
21 rzm = sclp_get_rzm();
22 rnmax = sclp_get_rnmax();
23 memsize = rzm * rnmax;
24 if (!rzm)
25 rzm = 1ULL << 17;
26 if (sizeof(long) == 4) {
27 rzm = min(ADDR2G, rzm);
28 memsize = memsize ? min(ADDR2G, memsize) : ADDR2G;
29 }
30 if (maxsize)
31 memsize = memsize ? min((unsigned long)memsize, maxsize) : maxsize;
32 do {
33 size = 0;
34 type = tprot(addr);
35 do {
36 size += rzm;
37 if (memsize && addr + size >= memsize)
38 break;
39 } while (type == tprot(addr + size));
40 if (type == CHUNK_READ_WRITE || type == CHUNK_READ_ONLY) {
41 if (memsize && (addr + size > memsize))
42 size = memsize - addr;
43 chunk[i].addr = addr;
44 chunk[i].size = size;
45 chunk[i].type = type;
46 i++;
47 }
48 addr += size;
49 } while (addr < memsize && i < MEMORY_CHUNKS);
50}
51
52/**
53 * detect_memory_layout - fill mem_chunk array with memory layout data
54 * @chunk: mem_chunk array to be filled
55 * @maxsize: maximum address where memory detection should stop
56 *
57 * Fills the passed in memory chunk array with the memory layout of the
58 * machine. The array must have a size of at least MEMORY_CHUNKS and will
59 * be fully initialized afterwards.
60 * If the maxsize paramater has a value > 0 memory detection will stop at
61 * that address. It is guaranteed that all chunks have an ending address
62 * that is smaller than maxsize.
63 * If maxsize is 0 all memory will be detected.
64 */
65void detect_memory_layout(struct mem_chunk chunk[], unsigned long maxsize)
66{
67 unsigned long flags, flags_dat, cr0;
68
69 memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk));
70 /*
71 * Disable IRQs, DAT and low address protection so tprot does the
72 * right thing and we don't get scheduled away with low address
73 * protection disabled.
74 */
75 local_irq_save(flags);
76 flags_dat = __arch_local_irq_stnsm(0xfb);
77 /*
78 * In case DAT was enabled, make sure chunk doesn't reside in vmalloc
79 * space. We have disabled DAT and any access to vmalloc area will
80 * cause an exception.
81 * If DAT was disabled we are called from early ipl code.
82 */
83 if (test_bit(5, &flags_dat)) {
84 if (WARN_ON_ONCE(is_vmalloc_or_module_addr(chunk)))
85 goto out;
86 }
87 __ctl_store(cr0, 0, 0);
88 __ctl_clear_bit(0, 28);
89 find_memory_chunks(chunk, maxsize);
90 __ctl_load(cr0, 0, 0);
91out:
92 __arch_local_irq_ssm(flags_dat);
93 local_irq_restore(flags);
94}
95EXPORT_SYMBOL(detect_memory_layout);
96
97/*
98 * Create memory hole with given address and size.
99 */
100void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
101 unsigned long size)
102{
103 int i;
104
105 for (i = 0; i < MEMORY_CHUNKS; i++) {
106 struct mem_chunk *chunk = &mem_chunk[i];
107
108 if (chunk->size == 0)
109 continue;
110 if (addr > chunk->addr + chunk->size)
111 continue;
112 if (addr + size <= chunk->addr)
113 continue;
114 /* Split */
115 if ((addr > chunk->addr) &&
116 (addr + size < chunk->addr + chunk->size)) {
117 struct mem_chunk *new = chunk + 1;
118
119 memmove(new, chunk, (MEMORY_CHUNKS-i-1) * sizeof(*new));
120 new->addr = addr + size;
121 new->size = chunk->addr + chunk->size - new->addr;
122 chunk->size = addr - chunk->addr;
123 continue;
124 } else if ((addr <= chunk->addr) &&
125 (addr + size >= chunk->addr + chunk->size)) {
126 memset(chunk, 0 , sizeof(*chunk));
127 } else if (addr + size < chunk->addr + chunk->size) {
128 chunk->size = chunk->addr + chunk->size - addr - size;
129 chunk->addr = addr + size;
130 } else if (addr > chunk->addr) {
131 chunk->size = addr - chunk->addr;
132 }
133 }
134}
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c
index d21040ed5e59..80adfbf75065 100644
--- a/arch/s390/mm/pageattr.c
+++ b/arch/s390/mm/pageattr.c
@@ -9,31 +9,25 @@
9#include <asm/pgtable.h> 9#include <asm/pgtable.h>
10#include <asm/page.h> 10#include <asm/page.h>
11 11
12static inline unsigned long sske_frame(unsigned long addr, unsigned char skey)
13{
14 asm volatile(".insn rrf,0xb22b0000,%[skey],%[addr],9,0"
15 : [addr] "+a" (addr) : [skey] "d" (skey));
16 return addr;
17}
18
12void storage_key_init_range(unsigned long start, unsigned long end) 19void storage_key_init_range(unsigned long start, unsigned long end)
13{ 20{
14 unsigned long boundary, function, size; 21 unsigned long boundary, size;
15 22
16 while (start < end) { 23 while (start < end) {
17 if (MACHINE_HAS_EDAT2) {
18 /* set storage keys for a 2GB frame */
19 function = 0x22000 | PAGE_DEFAULT_KEY;
20 size = 1UL << 31;
21 boundary = (start + size) & ~(size - 1);
22 if (boundary <= end) {
23 do {
24 start = pfmf(function, start);
25 } while (start < boundary);
26 continue;
27 }
28 }
29 if (MACHINE_HAS_EDAT1) { 24 if (MACHINE_HAS_EDAT1) {
30 /* set storage keys for a 1MB frame */ 25 /* set storage keys for a 1MB frame */
31 function = 0x21000 | PAGE_DEFAULT_KEY;
32 size = 1UL << 20; 26 size = 1UL << 20;
33 boundary = (start + size) & ~(size - 1); 27 boundary = (start + size) & ~(size - 1);
34 if (boundary <= end) { 28 if (boundary <= end) {
35 do { 29 do {
36 start = pfmf(function, start); 30 start = sske_frame(start, PAGE_DEFAULT_KEY);
37 } while (start < boundary); 31 } while (start < boundary);
38 continue; 32 continue;
39 } 33 }
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index ae44d2a34313..7805ddca833d 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -379,75 +379,184 @@ out_unmap:
379} 379}
380EXPORT_SYMBOL_GPL(gmap_map_segment); 380EXPORT_SYMBOL_GPL(gmap_map_segment);
381 381
382/* 382static unsigned long *gmap_table_walk(unsigned long address, struct gmap *gmap)
383 * this function is assumed to be called with mmap_sem held
384 */
385unsigned long __gmap_fault(unsigned long address, struct gmap *gmap)
386{ 383{
387 unsigned long *table, vmaddr, segment; 384 unsigned long *table;
388 struct mm_struct *mm;
389 struct gmap_pgtable *mp;
390 struct gmap_rmap *rmap;
391 struct vm_area_struct *vma;
392 struct page *page;
393 pgd_t *pgd;
394 pud_t *pud;
395 pmd_t *pmd;
396 385
397 current->thread.gmap_addr = address;
398 mm = gmap->mm;
399 /* Walk the gmap address space page table */
400 table = gmap->table + ((address >> 53) & 0x7ff); 386 table = gmap->table + ((address >> 53) & 0x7ff);
401 if (unlikely(*table & _REGION_ENTRY_INV)) 387 if (unlikely(*table & _REGION_ENTRY_INV))
402 return -EFAULT; 388 return ERR_PTR(-EFAULT);
403 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 389 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
404 table = table + ((address >> 42) & 0x7ff); 390 table = table + ((address >> 42) & 0x7ff);
405 if (unlikely(*table & _REGION_ENTRY_INV)) 391 if (unlikely(*table & _REGION_ENTRY_INV))
406 return -EFAULT; 392 return ERR_PTR(-EFAULT);
407 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 393 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
408 table = table + ((address >> 31) & 0x7ff); 394 table = table + ((address >> 31) & 0x7ff);
409 if (unlikely(*table & _REGION_ENTRY_INV)) 395 if (unlikely(*table & _REGION_ENTRY_INV))
410 return -EFAULT; 396 return ERR_PTR(-EFAULT);
411 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 397 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
412 table = table + ((address >> 20) & 0x7ff); 398 table = table + ((address >> 20) & 0x7ff);
399 return table;
400}
413 401
402/**
403 * __gmap_translate - translate a guest address to a user space address
404 * @address: guest address
405 * @gmap: pointer to guest mapping meta data structure
406 *
407 * Returns user space address which corresponds to the guest address or
408 * -EFAULT if no such mapping exists.
409 * This function does not establish potentially missing page table entries.
410 * The mmap_sem of the mm that belongs to the address space must be held
411 * when this function gets called.
412 */
413unsigned long __gmap_translate(unsigned long address, struct gmap *gmap)
414{
415 unsigned long *segment_ptr, vmaddr, segment;
416 struct gmap_pgtable *mp;
417 struct page *page;
418
419 current->thread.gmap_addr = address;
420 segment_ptr = gmap_table_walk(address, gmap);
421 if (IS_ERR(segment_ptr))
422 return PTR_ERR(segment_ptr);
414 /* Convert the gmap address to an mm address. */ 423 /* Convert the gmap address to an mm address. */
415 segment = *table; 424 segment = *segment_ptr;
416 if (likely(!(segment & _SEGMENT_ENTRY_INV))) { 425 if (!(segment & _SEGMENT_ENTRY_INV)) {
417 page = pfn_to_page(segment >> PAGE_SHIFT); 426 page = pfn_to_page(segment >> PAGE_SHIFT);
418 mp = (struct gmap_pgtable *) page->index; 427 mp = (struct gmap_pgtable *) page->index;
419 return mp->vmaddr | (address & ~PMD_MASK); 428 return mp->vmaddr | (address & ~PMD_MASK);
420 } else if (segment & _SEGMENT_ENTRY_RO) { 429 } else if (segment & _SEGMENT_ENTRY_RO) {
421 vmaddr = segment & _SEGMENT_ENTRY_ORIGIN; 430 vmaddr = segment & _SEGMENT_ENTRY_ORIGIN;
422 vma = find_vma(mm, vmaddr); 431 return vmaddr | (address & ~PMD_MASK);
423 if (!vma || vma->vm_start > vmaddr) 432 }
424 return -EFAULT; 433 return -EFAULT;
425 434}
426 /* Walk the parent mm page table */ 435EXPORT_SYMBOL_GPL(__gmap_translate);
427 pgd = pgd_offset(mm, vmaddr); 436
428 pud = pud_alloc(mm, pgd, vmaddr); 437/**
429 if (!pud) 438 * gmap_translate - translate a guest address to a user space address
430 return -ENOMEM; 439 * @address: guest address
431 pmd = pmd_alloc(mm, pud, vmaddr); 440 * @gmap: pointer to guest mapping meta data structure
432 if (!pmd) 441 *
433 return -ENOMEM; 442 * Returns user space address which corresponds to the guest address or
434 if (!pmd_present(*pmd) && 443 * -EFAULT if no such mapping exists.
435 __pte_alloc(mm, vma, pmd, vmaddr)) 444 * This function does not establish potentially missing page table entries.
436 return -ENOMEM; 445 */
437 /* pmd now points to a valid segment table entry. */ 446unsigned long gmap_translate(unsigned long address, struct gmap *gmap)
438 rmap = kmalloc(sizeof(*rmap), GFP_KERNEL|__GFP_REPEAT); 447{
439 if (!rmap) 448 unsigned long rc;
440 return -ENOMEM; 449
441 /* Link gmap segment table entry location to page table. */ 450 down_read(&gmap->mm->mmap_sem);
442 page = pmd_page(*pmd); 451 rc = __gmap_translate(address, gmap);
443 mp = (struct gmap_pgtable *) page->index; 452 up_read(&gmap->mm->mmap_sem);
444 rmap->entry = table; 453 return rc;
445 spin_lock(&mm->page_table_lock); 454}
455EXPORT_SYMBOL_GPL(gmap_translate);
456
457static int gmap_connect_pgtable(unsigned long address, unsigned long segment,
458 unsigned long *segment_ptr, struct gmap *gmap)
459{
460 unsigned long vmaddr;
461 struct vm_area_struct *vma;
462 struct gmap_pgtable *mp;
463 struct gmap_rmap *rmap;
464 struct mm_struct *mm;
465 struct page *page;
466 pgd_t *pgd;
467 pud_t *pud;
468 pmd_t *pmd;
469
470 mm = gmap->mm;
471 vmaddr = segment & _SEGMENT_ENTRY_ORIGIN;
472 vma = find_vma(mm, vmaddr);
473 if (!vma || vma->vm_start > vmaddr)
474 return -EFAULT;
475 /* Walk the parent mm page table */
476 pgd = pgd_offset(mm, vmaddr);
477 pud = pud_alloc(mm, pgd, vmaddr);
478 if (!pud)
479 return -ENOMEM;
480 pmd = pmd_alloc(mm, pud, vmaddr);
481 if (!pmd)
482 return -ENOMEM;
483 if (!pmd_present(*pmd) &&
484 __pte_alloc(mm, vma, pmd, vmaddr))
485 return -ENOMEM;
486 /* pmd now points to a valid segment table entry. */
487 rmap = kmalloc(sizeof(*rmap), GFP_KERNEL|__GFP_REPEAT);
488 if (!rmap)
489 return -ENOMEM;
490 /* Link gmap segment table entry location to page table. */
491 page = pmd_page(*pmd);
492 mp = (struct gmap_pgtable *) page->index;
493 rmap->gmap = gmap;
494 rmap->entry = segment_ptr;
495 rmap->vmaddr = address;
496 spin_lock(&mm->page_table_lock);
497 if (*segment_ptr == segment) {
446 list_add(&rmap->list, &mp->mapper); 498 list_add(&rmap->list, &mp->mapper);
447 spin_unlock(&mm->page_table_lock);
448 /* Set gmap segment table entry to page table. */ 499 /* Set gmap segment table entry to page table. */
449 *table = pmd_val(*pmd) & PAGE_MASK; 500 *segment_ptr = pmd_val(*pmd) & PAGE_MASK;
450 return vmaddr | (address & ~PMD_MASK); 501 rmap = NULL;
502 }
503 spin_unlock(&mm->page_table_lock);
504 kfree(rmap);
505 return 0;
506}
507
508static void gmap_disconnect_pgtable(struct mm_struct *mm, unsigned long *table)
509{
510 struct gmap_rmap *rmap, *next;
511 struct gmap_pgtable *mp;
512 struct page *page;
513 int flush;
514
515 flush = 0;
516 spin_lock(&mm->page_table_lock);
517 page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
518 mp = (struct gmap_pgtable *) page->index;
519 list_for_each_entry_safe(rmap, next, &mp->mapper, list) {
520 *rmap->entry =
521 _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO | mp->vmaddr;
522 list_del(&rmap->list);
523 kfree(rmap);
524 flush = 1;
525 }
526 spin_unlock(&mm->page_table_lock);
527 if (flush)
528 __tlb_flush_global();
529}
530
531/*
532 * this function is assumed to be called with mmap_sem held
533 */
534unsigned long __gmap_fault(unsigned long address, struct gmap *gmap)
535{
536 unsigned long *segment_ptr, segment;
537 struct gmap_pgtable *mp;
538 struct page *page;
539 int rc;
540
541 current->thread.gmap_addr = address;
542 segment_ptr = gmap_table_walk(address, gmap);
543 if (IS_ERR(segment_ptr))
544 return -EFAULT;
545 /* Convert the gmap address to an mm address. */
546 while (1) {
547 segment = *segment_ptr;
548 if (!(segment & _SEGMENT_ENTRY_INV)) {
549 /* Page table is present */
550 page = pfn_to_page(segment >> PAGE_SHIFT);
551 mp = (struct gmap_pgtable *) page->index;
552 return mp->vmaddr | (address & ~PMD_MASK);
553 }
554 if (!(segment & _SEGMENT_ENTRY_RO))
555 /* Nothing mapped in the gmap address space. */
556 break;
557 rc = gmap_connect_pgtable(address, segment, segment_ptr, gmap);
558 if (rc)
559 return rc;
451 } 560 }
452 return -EFAULT; 561 return -EFAULT;
453} 562}
@@ -511,27 +620,116 @@ void gmap_discard(unsigned long from, unsigned long to, struct gmap *gmap)
511} 620}
512EXPORT_SYMBOL_GPL(gmap_discard); 621EXPORT_SYMBOL_GPL(gmap_discard);
513 622
514void gmap_unmap_notifier(struct mm_struct *mm, unsigned long *table) 623static LIST_HEAD(gmap_notifier_list);
624static DEFINE_SPINLOCK(gmap_notifier_lock);
625
626/**
627 * gmap_register_ipte_notifier - register a pte invalidation callback
628 * @nb: pointer to the gmap notifier block
629 */
630void gmap_register_ipte_notifier(struct gmap_notifier *nb)
515{ 631{
516 struct gmap_rmap *rmap, *next; 632 spin_lock(&gmap_notifier_lock);
633 list_add(&nb->list, &gmap_notifier_list);
634 spin_unlock(&gmap_notifier_lock);
635}
636EXPORT_SYMBOL_GPL(gmap_register_ipte_notifier);
637
638/**
639 * gmap_unregister_ipte_notifier - remove a pte invalidation callback
640 * @nb: pointer to the gmap notifier block
641 */
642void gmap_unregister_ipte_notifier(struct gmap_notifier *nb)
643{
644 spin_lock(&gmap_notifier_lock);
645 list_del_init(&nb->list);
646 spin_unlock(&gmap_notifier_lock);
647}
648EXPORT_SYMBOL_GPL(gmap_unregister_ipte_notifier);
649
650/**
651 * gmap_ipte_notify - mark a range of ptes for invalidation notification
652 * @gmap: pointer to guest mapping meta data structure
653 * @address: virtual address in the guest address space
654 * @len: size of area
655 *
656 * Returns 0 if for each page in the given range a gmap mapping exists and
657 * the invalidation notification could be set. If the gmap mapping is missing
658 * for one or more pages -EFAULT is returned. If no memory could be allocated
659 * -ENOMEM is returned. This function establishes missing page table entries.
660 */
661int gmap_ipte_notify(struct gmap *gmap, unsigned long start, unsigned long len)
662{
663 unsigned long addr;
664 spinlock_t *ptl;
665 pte_t *ptep, entry;
666 pgste_t pgste;
667 int rc = 0;
668
669 if ((start & ~PAGE_MASK) || (len & ~PAGE_MASK))
670 return -EINVAL;
671 down_read(&gmap->mm->mmap_sem);
672 while (len) {
673 /* Convert gmap address and connect the page tables */
674 addr = __gmap_fault(start, gmap);
675 if (IS_ERR_VALUE(addr)) {
676 rc = addr;
677 break;
678 }
679 /* Get the page mapped */
680 if (get_user_pages(current, gmap->mm, addr, 1, 1, 0,
681 NULL, NULL) != 1) {
682 rc = -EFAULT;
683 break;
684 }
685 /* Walk the process page table, lock and get pte pointer */
686 ptep = get_locked_pte(gmap->mm, addr, &ptl);
687 if (unlikely(!ptep))
688 continue;
689 /* Set notification bit in the pgste of the pte */
690 entry = *ptep;
691 if ((pte_val(entry) & (_PAGE_INVALID | _PAGE_RO)) == 0) {
692 pgste = pgste_get_lock(ptep);
693 pgste_val(pgste) |= RCP_IN_BIT;
694 pgste_set_unlock(ptep, pgste);
695 start += PAGE_SIZE;
696 len -= PAGE_SIZE;
697 }
698 spin_unlock(ptl);
699 }
700 up_read(&gmap->mm->mmap_sem);
701 return rc;
702}
703EXPORT_SYMBOL_GPL(gmap_ipte_notify);
704
705/**
706 * gmap_do_ipte_notify - call all invalidation callbacks for a specific pte.
707 * @mm: pointer to the process mm_struct
708 * @addr: virtual address in the process address space
709 * @pte: pointer to the page table entry
710 *
711 * This function is assumed to be called with the page table lock held
712 * for the pte to notify.
713 */
714void gmap_do_ipte_notify(struct mm_struct *mm, unsigned long addr, pte_t *pte)
715{
716 unsigned long segment_offset;
717 struct gmap_notifier *nb;
517 struct gmap_pgtable *mp; 718 struct gmap_pgtable *mp;
719 struct gmap_rmap *rmap;
518 struct page *page; 720 struct page *page;
519 int flush;
520 721
521 flush = 0; 722 segment_offset = ((unsigned long) pte) & (255 * sizeof(pte_t));
522 spin_lock(&mm->page_table_lock); 723 segment_offset = segment_offset * (4096 / sizeof(pte_t));
523 page = pfn_to_page(__pa(table) >> PAGE_SHIFT); 724 page = pfn_to_page(__pa(pte) >> PAGE_SHIFT);
524 mp = (struct gmap_pgtable *) page->index; 725 mp = (struct gmap_pgtable *) page->index;
525 list_for_each_entry_safe(rmap, next, &mp->mapper, list) { 726 spin_lock(&gmap_notifier_lock);
526 *rmap->entry = 727 list_for_each_entry(rmap, &mp->mapper, list) {
527 _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO | mp->vmaddr; 728 list_for_each_entry(nb, &gmap_notifier_list, list)
528 list_del(&rmap->list); 729 nb->notifier_call(rmap->gmap,
529 kfree(rmap); 730 rmap->vmaddr + segment_offset);
530 flush = 1;
531 } 731 }
532 spin_unlock(&mm->page_table_lock); 732 spin_unlock(&gmap_notifier_lock);
533 if (flush)
534 __tlb_flush_global();
535} 733}
536 734
537static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, 735static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm,
@@ -586,8 +784,8 @@ static inline void page_table_free_pgste(unsigned long *table)
586{ 784{
587} 785}
588 786
589static inline void gmap_unmap_notifier(struct mm_struct *mm, 787static inline void gmap_disconnect_pgtable(struct mm_struct *mm,
590 unsigned long *table) 788 unsigned long *table)
591{ 789{
592} 790}
593 791
@@ -653,7 +851,7 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
653 unsigned int bit, mask; 851 unsigned int bit, mask;
654 852
655 if (mm_has_pgste(mm)) { 853 if (mm_has_pgste(mm)) {
656 gmap_unmap_notifier(mm, table); 854 gmap_disconnect_pgtable(mm, table);
657 return page_table_free_pgste(table); 855 return page_table_free_pgste(table);
658 } 856 }
659 /* Free 1K/2K page table fragment of a 4K page */ 857 /* Free 1K/2K page table fragment of a 4K page */
@@ -696,7 +894,7 @@ void page_table_free_rcu(struct mmu_gather *tlb, unsigned long *table)
696 894
697 mm = tlb->mm; 895 mm = tlb->mm;
698 if (mm_has_pgste(mm)) { 896 if (mm_has_pgste(mm)) {
699 gmap_unmap_notifier(mm, table); 897 gmap_disconnect_pgtable(mm, table);
700 table = (unsigned long *) (__pa(table) | FRAG_MASK); 898 table = (unsigned long *) (__pa(table) | FRAG_MASK);
701 tlb_remove_table(tlb, table); 899 tlb_remove_table(tlb, table);
702 return; 900 return;
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index ffab84db6907..8b268fcc4612 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -191,19 +191,16 @@ static void vmem_remove_range(unsigned long start, unsigned long size)
191/* 191/*
192 * Add a backed mem_map array to the virtual mem_map array. 192 * Add a backed mem_map array to the virtual mem_map array.
193 */ 193 */
194int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node) 194int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
195{ 195{
196 unsigned long address, start_addr, end_addr; 196 unsigned long address = start;
197 pgd_t *pg_dir; 197 pgd_t *pg_dir;
198 pud_t *pu_dir; 198 pud_t *pu_dir;
199 pmd_t *pm_dir; 199 pmd_t *pm_dir;
200 pte_t *pt_dir; 200 pte_t *pt_dir;
201 int ret = -ENOMEM; 201 int ret = -ENOMEM;
202 202
203 start_addr = (unsigned long) start; 203 for (address = start; address < end;) {
204 end_addr = (unsigned long) (start + nr);
205
206 for (address = start_addr; address < end_addr;) {
207 pg_dir = pgd_offset_k(address); 204 pg_dir = pgd_offset_k(address);
208 if (pgd_none(*pg_dir)) { 205 if (pgd_none(*pg_dir)) {
209 pu_dir = vmem_pud_alloc(); 206 pu_dir = vmem_pud_alloc();
@@ -262,14 +259,14 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
262 } 259 }
263 address += PAGE_SIZE; 260 address += PAGE_SIZE;
264 } 261 }
265 memset(start, 0, nr * sizeof(struct page)); 262 memset((void *)start, 0, end - start);
266 ret = 0; 263 ret = 0;
267out: 264out:
268 flush_tlb_kernel_range(start_addr, end_addr); 265 flush_tlb_kernel_range(start, end);
269 return ret; 266 return ret;
270} 267}
271 268
272void vmemmap_free(struct page *memmap, unsigned long nr_pages) 269void vmemmap_free(unsigned long start, unsigned long end)
273{ 270{
274} 271}
275 272
@@ -378,9 +375,8 @@ void __init vmem_map_init(void)
378 375
379 ro_start = PFN_ALIGN((unsigned long)&_stext); 376 ro_start = PFN_ALIGN((unsigned long)&_stext);
380 ro_end = (unsigned long)&_eshared & PAGE_MASK; 377 ro_end = (unsigned long)&_eshared & PAGE_MASK;
381 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 378 for (i = 0; i < MEMORY_CHUNKS; i++) {
382 if (memory_chunk[i].type == CHUNK_CRASHK || 379 if (!memory_chunk[i].size)
383 memory_chunk[i].type == CHUNK_OLDMEM)
384 continue; 380 continue;
385 start = memory_chunk[i].addr; 381 start = memory_chunk[i].addr;
386 end = memory_chunk[i].addr + memory_chunk[i].size; 382 end = memory_chunk[i].addr + memory_chunk[i].size;
@@ -415,9 +411,6 @@ static int __init vmem_convert_memory_chunk(void)
415 for (i = 0; i < MEMORY_CHUNKS; i++) { 411 for (i = 0; i < MEMORY_CHUNKS; i++) {
416 if (!memory_chunk[i].size) 412 if (!memory_chunk[i].size)
417 continue; 413 continue;
418 if (memory_chunk[i].type == CHUNK_CRASHK ||
419 memory_chunk[i].type == CHUNK_OLDMEM)
420 continue;
421 seg = kzalloc(sizeof(*seg), GFP_KERNEL); 414 seg = kzalloc(sizeof(*seg), GFP_KERNEL);
422 if (!seg) 415 if (!seg)
423 panic("Out of memory...\n"); 416 panic("Out of memory...\n");
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 0972e91cced2..82f165f8078c 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -747,10 +747,9 @@ void bpf_jit_compile(struct sk_filter *fp)
747 747
748 if (!bpf_jit_enable) 748 if (!bpf_jit_enable)
749 return; 749 return;
750 addrs = kmalloc(fp->len * sizeof(*addrs), GFP_KERNEL); 750 addrs = kcalloc(fp->len, sizeof(*addrs), GFP_KERNEL);
751 if (addrs == NULL) 751 if (addrs == NULL)
752 return; 752 return;
753 memset(addrs, 0, fp->len * sizeof(*addrs));
754 memset(&jit, 0, sizeof(cjit)); 753 memset(&jit, 0, sizeof(cjit));
755 memset(&cjit, 0, sizeof(cjit)); 754 memset(&cjit, 0, sizeof(cjit));
756 755
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index 584b93674ea4..ffeb17ce7f31 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -440,6 +440,7 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
440 switch (id.machine) { 440 switch (id.machine) {
441 case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break; 441 case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break;
442 case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break; 442 case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break;
443 case 0x2827: ops->cpu_type = "s390/zEC12"; break;
443 default: return -ENODEV; 444 default: return -ENODEV;
444 } 445 }
445 } 446 }
diff --git a/arch/s390/pci/Makefile b/arch/s390/pci/Makefile
index f0f426a113ce..086a2e37935d 100644
--- a/arch/s390/pci/Makefile
+++ b/arch/s390/pci/Makefile
@@ -2,5 +2,5 @@
2# Makefile for the s390 PCI subsystem. 2# Makefile for the s390 PCI subsystem.
3# 3#
4 4
5obj-$(CONFIG_PCI) += pci.o pci_dma.o pci_clp.o pci_msi.o \ 5obj-$(CONFIG_PCI) += pci.o pci_dma.o pci_clp.o pci_msi.o pci_sysfs.o \
6 pci_sysfs.o pci_event.o pci_debug.o 6 pci_event.o pci_debug.o pci_insn.o
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 27b4c17855b9..e6f15b5d8b7d 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -99,9 +99,6 @@ static int __read_mostly aisb_max;
99static struct kmem_cache *zdev_irq_cache; 99static struct kmem_cache *zdev_irq_cache;
100static struct kmem_cache *zdev_fmb_cache; 100static struct kmem_cache *zdev_fmb_cache;
101 101
102debug_info_t *pci_debug_msg_id;
103debug_info_t *pci_debug_err_id;
104
105static inline int irq_to_msi_nr(unsigned int irq) 102static inline int irq_to_msi_nr(unsigned int irq)
106{ 103{
107 return irq & ZPCI_MSI_MASK; 104 return irq & ZPCI_MSI_MASK;
@@ -179,7 +176,7 @@ static int zpci_register_airq(struct zpci_dev *zdev, unsigned int aisb,
179 fib->aisb = (u64) bucket->aisb + aisb / 8; 176 fib->aisb = (u64) bucket->aisb + aisb / 8;
180 fib->aisbo = aisb & ZPCI_MSI_MASK; 177 fib->aisbo = aisb & ZPCI_MSI_MASK;
181 178
182 rc = mpcifc_instr(req, fib); 179 rc = s390pci_mod_fc(req, fib);
183 pr_debug("%s mpcifc returned noi: %d\n", __func__, fib->noi); 180 pr_debug("%s mpcifc returned noi: %d\n", __func__, fib->noi);
184 181
185 free_page((unsigned long) fib); 182 free_page((unsigned long) fib);
@@ -209,7 +206,7 @@ static int mod_pci(struct zpci_dev *zdev, int fn, u8 dmaas, struct mod_pci_args
209 fib->iota = args->iota; 206 fib->iota = args->iota;
210 fib->fmb_addr = args->fmb_addr; 207 fib->fmb_addr = args->fmb_addr;
211 208
212 rc = mpcifc_instr(req, fib); 209 rc = s390pci_mod_fc(req, fib);
213 free_page((unsigned long) fib); 210 free_page((unsigned long) fib);
214 return rc; 211 return rc;
215} 212}
@@ -249,10 +246,9 @@ int zpci_fmb_enable_device(struct zpci_dev *zdev)
249 if (zdev->fmb) 246 if (zdev->fmb)
250 return -EINVAL; 247 return -EINVAL;
251 248
252 zdev->fmb = kmem_cache_alloc(zdev_fmb_cache, GFP_KERNEL); 249 zdev->fmb = kmem_cache_zalloc(zdev_fmb_cache, GFP_KERNEL);
253 if (!zdev->fmb) 250 if (!zdev->fmb)
254 return -ENOMEM; 251 return -ENOMEM;
255 memset(zdev->fmb, 0, sizeof(*zdev->fmb));
256 WARN_ON((u64) zdev->fmb & 0xf); 252 WARN_ON((u64) zdev->fmb & 0xf);
257 253
258 args.fmb_addr = virt_to_phys(zdev->fmb); 254 args.fmb_addr = virt_to_phys(zdev->fmb);
@@ -284,12 +280,12 @@ static int zpci_cfg_load(struct zpci_dev *zdev, int offset, u32 *val, u8 len)
284 u64 data; 280 u64 data;
285 int rc; 281 int rc;
286 282
287 rc = pcilg_instr(&data, req, offset); 283 rc = s390pci_load(&data, req, offset);
288 data = data << ((8 - len) * 8); 284 if (!rc) {
289 data = le64_to_cpu(data); 285 data = data << ((8 - len) * 8);
290 if (!rc) 286 data = le64_to_cpu(data);
291 *val = (u32) data; 287 *val = (u32) data;
292 else 288 } else
293 *val = 0xffffffff; 289 *val = 0xffffffff;
294 return rc; 290 return rc;
295} 291}
@@ -302,7 +298,7 @@ static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len)
302 298
303 data = cpu_to_le64(data); 299 data = cpu_to_le64(data);
304 data = data >> ((8 - len) * 8); 300 data = data >> ((8 - len) * 8);
305 rc = pcistg_instr(data, req, offset); 301 rc = s390pci_store(data, req, offset);
306 return rc; 302 return rc;
307} 303}
308 304
@@ -409,20 +405,28 @@ static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
409 int size, u32 *val) 405 int size, u32 *val)
410{ 406{
411 struct zpci_dev *zdev = get_zdev_by_bus(bus); 407 struct zpci_dev *zdev = get_zdev_by_bus(bus);
408 int ret;
412 409
413 if (!zdev || devfn != ZPCI_DEVFN) 410 if (!zdev || devfn != ZPCI_DEVFN)
414 return 0; 411 ret = -ENODEV;
415 return zpci_cfg_load(zdev, where, val, size); 412 else
413 ret = zpci_cfg_load(zdev, where, val, size);
414
415 return ret;
416} 416}
417 417
418static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, 418static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
419 int size, u32 val) 419 int size, u32 val)
420{ 420{
421 struct zpci_dev *zdev = get_zdev_by_bus(bus); 421 struct zpci_dev *zdev = get_zdev_by_bus(bus);
422 int ret;
422 423
423 if (!zdev || devfn != ZPCI_DEVFN) 424 if (!zdev || devfn != ZPCI_DEVFN)
424 return 0; 425 ret = -ENODEV;
425 return zpci_cfg_store(zdev, where, val, size); 426 else
427 ret = zpci_cfg_store(zdev, where, val, size);
428
429 return ret;
426} 430}
427 431
428static struct pci_ops pci_root_ops = { 432static struct pci_ops pci_root_ops = {
@@ -474,7 +478,7 @@ scan:
474 } 478 }
475 479
476 /* enable interrupts again */ 480 /* enable interrupts again */
477 sic_instr(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC); 481 set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC);
478 482
479 /* check again to not lose initiative */ 483 /* check again to not lose initiative */
480 rmb(); 484 rmb();
@@ -596,19 +600,6 @@ static void zpci_map_resources(struct zpci_dev *zdev)
596 } 600 }
597}; 601};
598 602
599static void zpci_unmap_resources(struct pci_dev *pdev)
600{
601 resource_size_t len;
602 int i;
603
604 for (i = 0; i < PCI_BAR_COUNT; i++) {
605 len = pci_resource_len(pdev, i);
606 if (!len)
607 continue;
608 pci_iounmap(pdev, (void *) pdev->resource[i].start);
609 }
610};
611
612struct zpci_dev *zpci_alloc_device(void) 603struct zpci_dev *zpci_alloc_device(void)
613{ 604{
614 struct zpci_dev *zdev; 605 struct zpci_dev *zdev;
@@ -636,32 +627,6 @@ void zpci_free_device(struct zpci_dev *zdev)
636 kfree(zdev); 627 kfree(zdev);
637} 628}
638 629
639/* Called on removal of pci_dev, leaves zpci and bus device */
640static void zpci_remove_device(struct pci_dev *pdev)
641{
642 struct zpci_dev *zdev = get_zdev(pdev);
643
644 dev_info(&pdev->dev, "Removing device %u\n", zdev->domain);
645 zdev->state = ZPCI_FN_STATE_CONFIGURED;
646 zpci_dma_exit_device(zdev);
647 zpci_fmb_disable_device(zdev);
648 zpci_sysfs_remove_device(&pdev->dev);
649 zpci_unmap_resources(pdev);
650 list_del(&zdev->entry); /* can be called from init */
651 zdev->pdev = NULL;
652}
653
654static void zpci_scan_devices(void)
655{
656 struct zpci_dev *zdev;
657
658 mutex_lock(&zpci_list_lock);
659 list_for_each_entry(zdev, &zpci_list, entry)
660 if (zdev->state == ZPCI_FN_STATE_CONFIGURED)
661 zpci_scan_device(zdev);
662 mutex_unlock(&zpci_list_lock);
663}
664
665/* 630/*
666 * Too late for any s390 specific setup, since interrupts must be set up 631 * Too late for any s390 specific setup, since interrupts must be set up
667 * already which requires DMA setup too and the pci scan will access the 632 * already which requires DMA setup too and the pci scan will access the
@@ -688,12 +653,6 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
688 return 0; 653 return 0;
689} 654}
690 655
691void pcibios_disable_device(struct pci_dev *pdev)
692{
693 zpci_remove_device(pdev);
694 pdev->sysdata = NULL;
695}
696
697int pcibios_add_platform_entries(struct pci_dev *pdev) 656int pcibios_add_platform_entries(struct pci_dev *pdev)
698{ 657{
699 return zpci_sysfs_add_device(&pdev->dev); 658 return zpci_sysfs_add_device(&pdev->dev);
@@ -789,7 +748,7 @@ static int __init zpci_irq_init(void)
789 spin_lock_init(&bucket->lock); 748 spin_lock_init(&bucket->lock);
790 /* set summary to 1 to be called every time for the ISC */ 749 /* set summary to 1 to be called every time for the ISC */
791 *zpci_irq_si = 1; 750 *zpci_irq_si = 1;
792 sic_instr(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC); 751 set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC);
793 return 0; 752 return 0;
794 753
795out_ai: 754out_ai:
@@ -872,7 +831,19 @@ static void zpci_free_iomap(struct zpci_dev *zdev, int entry)
872 spin_unlock(&zpci_iomap_lock); 831 spin_unlock(&zpci_iomap_lock);
873} 832}
874 833
875static int zpci_create_device_bus(struct zpci_dev *zdev) 834int pcibios_add_device(struct pci_dev *pdev)
835{
836 struct zpci_dev *zdev = get_zdev(pdev);
837
838 zdev->pdev = pdev;
839 zpci_debug_init_device(zdev);
840 zpci_fmb_enable_device(zdev);
841 zpci_map_resources(zdev);
842
843 return 0;
844}
845
846static int zpci_scan_bus(struct zpci_dev *zdev)
876{ 847{
877 struct resource *res; 848 struct resource *res;
878 LIST_HEAD(resources); 849 LIST_HEAD(resources);
@@ -909,8 +880,8 @@ static int zpci_create_device_bus(struct zpci_dev *zdev)
909 pci_add_resource(&resources, res); 880 pci_add_resource(&resources, res);
910 } 881 }
911 882
912 zdev->bus = pci_create_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, 883 zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops,
913 zdev, &resources); 884 zdev, &resources);
914 if (!zdev->bus) 885 if (!zdev->bus)
915 return -EIO; 886 return -EIO;
916 887
@@ -959,6 +930,13 @@ out:
959} 930}
960EXPORT_SYMBOL_GPL(zpci_enable_device); 931EXPORT_SYMBOL_GPL(zpci_enable_device);
961 932
933int zpci_disable_device(struct zpci_dev *zdev)
934{
935 zpci_dma_exit_device(zdev);
936 return clp_disable_fh(zdev);
937}
938EXPORT_SYMBOL_GPL(zpci_disable_device);
939
962int zpci_create_device(struct zpci_dev *zdev) 940int zpci_create_device(struct zpci_dev *zdev)
963{ 941{
964 int rc; 942 int rc;
@@ -967,9 +945,16 @@ int zpci_create_device(struct zpci_dev *zdev)
967 if (rc) 945 if (rc)
968 goto out; 946 goto out;
969 947
970 rc = zpci_create_device_bus(zdev); 948 if (zdev->state == ZPCI_FN_STATE_CONFIGURED) {
949 rc = zpci_enable_device(zdev);
950 if (rc)
951 goto out_free;
952
953 zdev->state = ZPCI_FN_STATE_ONLINE;
954 }
955 rc = zpci_scan_bus(zdev);
971 if (rc) 956 if (rc)
972 goto out_bus; 957 goto out_disable;
973 958
974 mutex_lock(&zpci_list_lock); 959 mutex_lock(&zpci_list_lock);
975 list_add_tail(&zdev->entry, &zpci_list); 960 list_add_tail(&zdev->entry, &zpci_list);
@@ -977,21 +962,12 @@ int zpci_create_device(struct zpci_dev *zdev)
977 hotplug_ops->create_slot(zdev); 962 hotplug_ops->create_slot(zdev);
978 mutex_unlock(&zpci_list_lock); 963 mutex_unlock(&zpci_list_lock);
979 964
980 if (zdev->state == ZPCI_FN_STATE_STANDBY)
981 return 0;
982
983 rc = zpci_enable_device(zdev);
984 if (rc)
985 goto out_start;
986 return 0; 965 return 0;
987 966
988out_start: 967out_disable:
989 mutex_lock(&zpci_list_lock); 968 if (zdev->state == ZPCI_FN_STATE_ONLINE)
990 list_del(&zdev->entry); 969 zpci_disable_device(zdev);
991 if (hotplug_ops) 970out_free:
992 hotplug_ops->remove_slot(zdev);
993 mutex_unlock(&zpci_list_lock);
994out_bus:
995 zpci_free_domain(zdev); 971 zpci_free_domain(zdev);
996out: 972out:
997 return rc; 973 return rc;
@@ -1016,15 +992,9 @@ int zpci_scan_device(struct zpci_dev *zdev)
1016 goto out; 992 goto out;
1017 } 993 }
1018 994
1019 zpci_debug_init_device(zdev);
1020 zpci_fmb_enable_device(zdev);
1021 zpci_map_resources(zdev);
1022 pci_bus_add_devices(zdev->bus); 995 pci_bus_add_devices(zdev->bus);
1023 996
1024 /* now that pdev was added to the bus mark it as used */
1025 zdev->state = ZPCI_FN_STATE_ONLINE;
1026 return 0; 997 return 0;
1027
1028out: 998out:
1029 zpci_dma_exit_device(zdev); 999 zpci_dma_exit_device(zdev);
1030 clp_disable_fh(zdev); 1000 clp_disable_fh(zdev);
@@ -1087,13 +1057,13 @@ void zpci_deregister_hp_ops(void)
1087} 1057}
1088EXPORT_SYMBOL_GPL(zpci_deregister_hp_ops); 1058EXPORT_SYMBOL_GPL(zpci_deregister_hp_ops);
1089 1059
1090unsigned int s390_pci_probe = 1; 1060unsigned int s390_pci_probe;
1091EXPORT_SYMBOL_GPL(s390_pci_probe); 1061EXPORT_SYMBOL_GPL(s390_pci_probe);
1092 1062
1093char * __init pcibios_setup(char *str) 1063char * __init pcibios_setup(char *str)
1094{ 1064{
1095 if (!strcmp(str, "off")) { 1065 if (!strcmp(str, "on")) {
1096 s390_pci_probe = 0; 1066 s390_pci_probe = 1;
1097 return NULL; 1067 return NULL;
1098 } 1068 }
1099 return str; 1069 return str;
@@ -1138,7 +1108,6 @@ static int __init pci_base_init(void)
1138 if (rc) 1108 if (rc)
1139 goto out_find; 1109 goto out_find;
1140 1110
1141 zpci_scan_devices();
1142 return 0; 1111 return 0;
1143 1112
1144out_find: 1113out_find:
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index f339fe2feb15..bd34359d1546 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -13,6 +13,7 @@
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <asm/pci_debug.h>
16#include <asm/pci_clp.h> 17#include <asm/pci_clp.h>
17 18
18/* 19/*
@@ -144,6 +145,7 @@ int clp_add_pci_device(u32 fid, u32 fh, int configured)
144 struct zpci_dev *zdev; 145 struct zpci_dev *zdev;
145 int rc; 146 int rc;
146 147
148 zpci_dbg(3, "add fid:%x, fh:%x, c:%d\n", fid, fh, configured);
147 zdev = zpci_alloc_device(); 149 zdev = zpci_alloc_device();
148 if (IS_ERR(zdev)) 150 if (IS_ERR(zdev))
149 return PTR_ERR(zdev); 151 return PTR_ERR(zdev);
@@ -204,8 +206,8 @@ static int clp_set_pci_fn(u32 *fh, u8 nr_dma_as, u8 command)
204 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) 206 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
205 *fh = rrb->response.fh; 207 *fh = rrb->response.fh;
206 else { 208 else {
207 pr_err("Set PCI FN failed with response: %x cc: %d\n", 209 zpci_dbg(0, "SPF fh:%x, cc:%d, resp:%x\n", *fh, rc,
208 rrb->response.hdr.rsp, rc); 210 rrb->response.hdr.rsp);
209 rc = -EIO; 211 rc = -EIO;
210 } 212 }
211 clp_free_block(rrb); 213 clp_free_block(rrb);
@@ -221,6 +223,8 @@ int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as)
221 if (!rc) 223 if (!rc)
222 /* Success -> store enabled handle in zdev */ 224 /* Success -> store enabled handle in zdev */
223 zdev->fh = fh; 225 zdev->fh = fh;
226
227 zpci_dbg(3, "ena fid:%x, fh:%x, rc:%d\n", zdev->fid, zdev->fh, rc);
224 return rc; 228 return rc;
225} 229}
226 230
@@ -237,9 +241,8 @@ int clp_disable_fh(struct zpci_dev *zdev)
237 if (!rc) 241 if (!rc)
238 /* Success -> store disabled handle in zdev */ 242 /* Success -> store disabled handle in zdev */
239 zdev->fh = fh; 243 zdev->fh = fh;
240 else 244
241 dev_err(&zdev->pdev->dev, 245 zpci_dbg(3, "dis fid:%x, fh:%x, rc:%d\n", zdev->fid, zdev->fh, rc);
242 "Failed to disable fn handle: 0x%x\n", fh);
243 return rc; 246 return rc;
244} 247}
245 248
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
index a5d07bc2a547..771b82359af4 100644
--- a/arch/s390/pci/pci_debug.c
+++ b/arch/s390/pci/pci_debug.c
@@ -11,12 +11,17 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/seq_file.h> 12#include <linux/seq_file.h>
13#include <linux/debugfs.h> 13#include <linux/debugfs.h>
14#include <linux/export.h>
14#include <linux/pci.h> 15#include <linux/pci.h>
15#include <asm/debug.h> 16#include <asm/debug.h>
16 17
17#include <asm/pci_dma.h> 18#include <asm/pci_dma.h>
18 19
19static struct dentry *debugfs_root; 20static struct dentry *debugfs_root;
21debug_info_t *pci_debug_msg_id;
22EXPORT_SYMBOL_GPL(pci_debug_msg_id);
23debug_info_t *pci_debug_err_id;
24EXPORT_SYMBOL_GPL(pci_debug_err_id);
20 25
21static char *pci_perf_names[] = { 26static char *pci_perf_names[] = {
22 /* hardware counters */ 27 /* hardware counters */
@@ -168,7 +173,6 @@ int __init zpci_debug_init(void)
168 return -EINVAL; 173 return -EINVAL;
169 debug_register_view(pci_debug_msg_id, &debug_sprintf_view); 174 debug_register_view(pci_debug_msg_id, &debug_sprintf_view);
170 debug_set_level(pci_debug_msg_id, 3); 175 debug_set_level(pci_debug_msg_id, 3);
171 zpci_dbg("Debug view initialized\n");
172 176
173 /* error log */ 177 /* error log */
174 pci_debug_err_id = debug_register("pci_error", 2, 1, 16); 178 pci_debug_err_id = debug_register("pci_error", 2, 1, 16);
@@ -176,7 +180,6 @@ int __init zpci_debug_init(void)
176 return -EINVAL; 180 return -EINVAL;
177 debug_register_view(pci_debug_err_id, &debug_hex_ascii_view); 181 debug_register_view(pci_debug_err_id, &debug_hex_ascii_view);
178 debug_set_level(pci_debug_err_id, 6); 182 debug_set_level(pci_debug_err_id, 6);
179 zpci_err("Debug view initialized\n");
180 183
181 debugfs_root = debugfs_create_dir("pci", NULL); 184 debugfs_root = debugfs_create_dir("pci", NULL);
182 return 0; 185 return 0;
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index a547419907c3..f8e69d5bc0a9 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -169,8 +169,9 @@ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa,
169 * needs to be redone! 169 * needs to be redone!
170 */ 170 */
171 goto no_refresh; 171 goto no_refresh;
172 rc = rpcit_instr((u64) zdev->fh << 32, start_dma_addr, 172
173 nr_pages * PAGE_SIZE); 173 rc = s390pci_refresh_trans((u64) zdev->fh << 32, start_dma_addr,
174 nr_pages * PAGE_SIZE);
174 175
175no_refresh: 176no_refresh:
176 spin_unlock_irqrestore(&zdev->dma_table_lock, irq_flags); 177 spin_unlock_irqrestore(&zdev->dma_table_lock, irq_flags);
@@ -268,8 +269,6 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
268 int flags = ZPCI_PTE_VALID; 269 int flags = ZPCI_PTE_VALID;
269 dma_addr_t dma_addr; 270 dma_addr_t dma_addr;
270 271
271 WARN_ON_ONCE(offset > PAGE_SIZE);
272
273 /* This rounds up number of pages based on size and offset */ 272 /* This rounds up number of pages based on size and offset */
274 nr_pages = iommu_num_pages(pa, size, PAGE_SIZE); 273 nr_pages = iommu_num_pages(pa, size, PAGE_SIZE);
275 iommu_page_index = dma_alloc_iommu(zdev, nr_pages); 274 iommu_page_index = dma_alloc_iommu(zdev, nr_pages);
@@ -291,7 +290,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
291 290
292 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) { 291 if (!dma_update_trans(zdev, pa, dma_addr, size, flags)) {
293 atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages); 292 atomic64_add(nr_pages, (atomic64_t *) &zdev->fmb->mapped_pages);
294 return dma_addr + offset; 293 return dma_addr + (offset & ~PAGE_MASK);
295 } 294 }
296 295
297out_free: 296out_free:
diff --git a/arch/s390/pci/pci_insn.c b/arch/s390/pci/pci_insn.c
new file mode 100644
index 000000000000..22eeb9d7ffeb
--- /dev/null
+++ b/arch/s390/pci/pci_insn.c
@@ -0,0 +1,202 @@
1/*
2 * s390 specific pci instructions
3 *
4 * Copyright IBM Corp. 2013
5 */
6
7#include <linux/export.h>
8#include <linux/errno.h>
9#include <linux/delay.h>
10#include <asm/pci_insn.h>
11#include <asm/processor.h>
12
13#define ZPCI_INSN_BUSY_DELAY 1 /* 1 microsecond */
14
15/* Modify PCI Function Controls */
16static inline u8 __mpcifc(u64 req, struct zpci_fib *fib, u8 *status)
17{
18 u8 cc;
19
20 asm volatile (
21 " .insn rxy,0xe300000000d0,%[req],%[fib]\n"
22 " ipm %[cc]\n"
23 " srl %[cc],28\n"
24 : [cc] "=d" (cc), [req] "+d" (req), [fib] "+Q" (*fib)
25 : : "cc");
26 *status = req >> 24 & 0xff;
27 return cc;
28}
29
30int s390pci_mod_fc(u64 req, struct zpci_fib *fib)
31{
32 u8 cc, status;
33
34 do {
35 cc = __mpcifc(req, fib, &status);
36 if (cc == 2)
37 msleep(ZPCI_INSN_BUSY_DELAY);
38 } while (cc == 2);
39
40 if (cc)
41 printk_once(KERN_ERR "%s: error cc: %d status: %d\n",
42 __func__, cc, status);
43 return (cc) ? -EIO : 0;
44}
45
46/* Refresh PCI Translations */
47static inline u8 __rpcit(u64 fn, u64 addr, u64 range, u8 *status)
48{
49 register u64 __addr asm("2") = addr;
50 register u64 __range asm("3") = range;
51 u8 cc;
52
53 asm volatile (
54 " .insn rre,0xb9d30000,%[fn],%[addr]\n"
55 " ipm %[cc]\n"
56 " srl %[cc],28\n"
57 : [cc] "=d" (cc), [fn] "+d" (fn)
58 : [addr] "d" (__addr), "d" (__range)
59 : "cc");
60 *status = fn >> 24 & 0xff;
61 return cc;
62}
63
64int s390pci_refresh_trans(u64 fn, u64 addr, u64 range)
65{
66 u8 cc, status;
67
68 do {
69 cc = __rpcit(fn, addr, range, &status);
70 if (cc == 2)
71 udelay(ZPCI_INSN_BUSY_DELAY);
72 } while (cc == 2);
73
74 if (cc)
75 printk_once(KERN_ERR "%s: error cc: %d status: %d dma_addr: %Lx size: %Lx\n",
76 __func__, cc, status, addr, range);
77 return (cc) ? -EIO : 0;
78}
79
80/* Set Interruption Controls */
81void set_irq_ctrl(u16 ctl, char *unused, u8 isc)
82{
83 asm volatile (
84 " .insn rsy,0xeb00000000d1,%[ctl],%[isc],%[u]\n"
85 : : [ctl] "d" (ctl), [isc] "d" (isc << 27), [u] "Q" (*unused));
86}
87
88/* PCI Load */
89static inline int __pcilg(u64 *data, u64 req, u64 offset, u8 *status)
90{
91 register u64 __req asm("2") = req;
92 register u64 __offset asm("3") = offset;
93 int cc = -ENXIO;
94 u64 __data;
95
96 asm volatile (
97 " .insn rre,0xb9d20000,%[data],%[req]\n"
98 "0: ipm %[cc]\n"
99 " srl %[cc],28\n"
100 "1:\n"
101 EX_TABLE(0b, 1b)
102 : [cc] "+d" (cc), [data] "=d" (__data), [req] "+d" (__req)
103 : "d" (__offset)
104 : "cc");
105 *status = __req >> 24 & 0xff;
106 if (!cc)
107 *data = __data;
108
109 return cc;
110}
111
112int s390pci_load(u64 *data, u64 req, u64 offset)
113{
114 u8 status;
115 int cc;
116
117 do {
118 cc = __pcilg(data, req, offset, &status);
119 if (cc == 2)
120 udelay(ZPCI_INSN_BUSY_DELAY);
121 } while (cc == 2);
122
123 if (cc)
124 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
125 __func__, cc, status, req, offset);
126 return (cc > 0) ? -EIO : cc;
127}
128EXPORT_SYMBOL_GPL(s390pci_load);
129
130/* PCI Store */
131static inline int __pcistg(u64 data, u64 req, u64 offset, u8 *status)
132{
133 register u64 __req asm("2") = req;
134 register u64 __offset asm("3") = offset;
135 int cc = -ENXIO;
136
137 asm volatile (
138 " .insn rre,0xb9d00000,%[data],%[req]\n"
139 "0: ipm %[cc]\n"
140 " srl %[cc],28\n"
141 "1:\n"
142 EX_TABLE(0b, 1b)
143 : [cc] "+d" (cc), [req] "+d" (__req)
144 : "d" (__offset), [data] "d" (data)
145 : "cc");
146 *status = __req >> 24 & 0xff;
147 return cc;
148}
149
150int s390pci_store(u64 data, u64 req, u64 offset)
151{
152 u8 status;
153 int cc;
154
155 do {
156 cc = __pcistg(data, req, offset, &status);
157 if (cc == 2)
158 udelay(ZPCI_INSN_BUSY_DELAY);
159 } while (cc == 2);
160
161 if (cc)
162 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
163 __func__, cc, status, req, offset);
164 return (cc > 0) ? -EIO : cc;
165}
166EXPORT_SYMBOL_GPL(s390pci_store);
167
168/* PCI Store Block */
169static inline int __pcistb(const u64 *data, u64 req, u64 offset, u8 *status)
170{
171 int cc = -ENXIO;
172
173 asm volatile (
174 " .insn rsy,0xeb00000000d0,%[req],%[offset],%[data]\n"
175 "0: ipm %[cc]\n"
176 " srl %[cc],28\n"
177 "1:\n"
178 EX_TABLE(0b, 1b)
179 : [cc] "+d" (cc), [req] "+d" (req)
180 : [offset] "d" (offset), [data] "Q" (*data)
181 : "cc");
182 *status = req >> 24 & 0xff;
183 return cc;
184}
185
186int s390pci_store_block(const u64 *data, u64 req, u64 offset)
187{
188 u8 status;
189 int cc;
190
191 do {
192 cc = __pcistb(data, req, offset, &status);
193 if (cc == 2)
194 udelay(ZPCI_INSN_BUSY_DELAY);
195 } while (cc == 2);
196
197 if (cc)
198 printk_once(KERN_ERR "%s: error cc: %d status: %d req: %Lx offset: %Lx\n",
199 __func__, cc, status, req, offset);
200 return (cc > 0) ? -EIO : cc;
201}
202EXPORT_SYMBOL_GPL(s390pci_store_block);
diff --git a/arch/s390/pci/pci_msi.c b/arch/s390/pci/pci_msi.c
index 0297931335e1..b097aed05a9b 100644
--- a/arch/s390/pci/pci_msi.c
+++ b/arch/s390/pci/pci_msi.c
@@ -18,8 +18,9 @@
18 18
19/* mapping of irq numbers to msi_desc */ 19/* mapping of irq numbers to msi_desc */
20static struct hlist_head *msi_hash; 20static struct hlist_head *msi_hash;
21static unsigned int msihash_shift = 6; 21static const unsigned int msi_hash_bits = 8;
22#define msi_hashfn(nr) hash_long(nr, msihash_shift) 22#define MSI_HASH_BUCKETS (1U << msi_hash_bits)
23#define msi_hashfn(nr) hash_long(nr, msi_hash_bits)
23 24
24static DEFINE_SPINLOCK(msi_map_lock); 25static DEFINE_SPINLOCK(msi_map_lock);
25 26
@@ -74,6 +75,7 @@ int zpci_setup_msi_irq(struct zpci_dev *zdev, struct msi_desc *msi,
74 map->irq = nr; 75 map->irq = nr;
75 map->msi = msi; 76 map->msi = msi;
76 zdev->msi_map[nr & ZPCI_MSI_MASK] = map; 77 zdev->msi_map[nr & ZPCI_MSI_MASK] = map;
78 INIT_HLIST_NODE(&map->msi_chain);
77 79
78 pr_debug("%s hashing irq: %u to bucket nr: %llu\n", 80 pr_debug("%s hashing irq: %u to bucket nr: %llu\n",
79 __func__, nr, msi_hashfn(nr)); 81 __func__, nr, msi_hashfn(nr));
@@ -125,11 +127,11 @@ int __init zpci_msihash_init(void)
125{ 127{
126 unsigned int i; 128 unsigned int i;
127 129
128 msi_hash = kmalloc(256 * sizeof(*msi_hash), GFP_KERNEL); 130 msi_hash = kmalloc(MSI_HASH_BUCKETS * sizeof(*msi_hash), GFP_KERNEL);
129 if (!msi_hash) 131 if (!msi_hash)
130 return -ENOMEM; 132 return -ENOMEM;
131 133
132 for (i = 0; i < (1U << msihash_shift); i++) 134 for (i = 0; i < MSI_HASH_BUCKETS; i++)
133 INIT_HLIST_HEAD(&msi_hash[i]); 135 INIT_HLIST_HEAD(&msi_hash[i]);
134 return 0; 136 return 0;
135} 137}
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
index 79568466b578..f4c6d02421d3 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -41,24 +41,6 @@ void machine_halt(void) {}
41/* If or when software machine-power-off is implemented, add code here. */ 41/* If or when software machine-power-off is implemented, add code here. */
42void machine_power_off(void) {} 42void machine_power_off(void) {}
43 43
44/*
45 * The idle thread. There's no useful work to be
46 * done, so just try to conserve power and have a
47 * low exit latency (ie sit in a loop waiting for
48 * somebody to say that they'd like to reschedule)
49 */
50void __noreturn cpu_idle(void)
51{
52 /* endless idle loop with no priority at all */
53 while (1) {
54 rcu_idle_enter();
55 while (!need_resched())
56 barrier();
57 rcu_idle_exit();
58 schedule_preempt_disabled();
59 }
60}
61
62void ret_from_fork(void); 44void ret_from_fork(void);
63void ret_from_kernel_thread(void); 45void ret_from_kernel_thread(void);
64 46
diff --git a/arch/score/kernel/traps.c b/arch/score/kernel/traps.c
index 0e46fb19a848..1517a7dcd6d9 100644
--- a/arch/score/kernel/traps.c
+++ b/arch/score/kernel/traps.c
@@ -117,6 +117,8 @@ static void show_code(unsigned int *pc)
117 */ 117 */
118void show_regs(struct pt_regs *regs) 118void show_regs(struct pt_regs *regs)
119{ 119{
120 show_regs_print_info(KERN_DEFAULT);
121
120 printk("r0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", 122 printk("r0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
121 regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3], 123 regs->regs[0], regs->regs[1], regs->regs[2], regs->regs[3],
122 regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]); 124 regs->regs[4], regs->regs[5], regs->regs[6], regs->regs[7]);
@@ -149,16 +151,6 @@ static void show_registers(struct pt_regs *regs)
149 printk(KERN_NOTICE "\n"); 151 printk(KERN_NOTICE "\n");
150} 152}
151 153
152/*
153 * The architecture-independent dump_stack generator
154 */
155void dump_stack(void)
156{
157 show_stack(current_thread_info()->task,
158 (long *) get_irq_regs()->regs[0]);
159}
160EXPORT_SYMBOL(dump_stack);
161
162void __die(const char *str, struct pt_regs *regs, const char *file, 154void __die(const char *str, struct pt_regs *regs, const char *file,
163 const char *func, unsigned long line) 155 const char *func, unsigned long line)
164{ 156{
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c
index cee6bce1e30c..d8f988a37d16 100644
--- a/arch/score/mm/init.c
+++ b/arch/score/mm/init.c
@@ -31,7 +31,7 @@
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/mman.h> 32#include <linux/mman.h>
33#include <linux/pagemap.h> 33#include <linux/pagemap.h>
34#include <linux/proc_fs.h> 34#include <linux/kcore.h>
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/initrd.h> 36#include <linux/initrd.h>
37 37
@@ -43,7 +43,7 @@ EXPORT_SYMBOL_GPL(empty_zero_page);
43 43
44static struct kcore_list kcore_mem, kcore_vmalloc; 44static struct kcore_list kcore_mem, kcore_vmalloc;
45 45
46static unsigned long setup_zero_page(void) 46static void setup_zero_page(void)
47{ 47{
48 struct page *page; 48 struct page *page;
49 49
@@ -52,9 +52,7 @@ static unsigned long setup_zero_page(void)
52 panic("Oh boy, that early out of memory?"); 52 panic("Oh boy, that early out of memory?");
53 53
54 page = virt_to_page((void *) empty_zero_page); 54 page = virt_to_page((void *) empty_zero_page);
55 SetPageReserved(page); 55 mark_page_reserved(page);
56
57 return 1UL;
58} 56}
59 57
60#ifndef CONFIG_NEED_MULTIPLE_NODES 58#ifndef CONFIG_NEED_MULTIPLE_NODES
@@ -84,7 +82,7 @@ void __init mem_init(void)
84 82
85 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 83 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
86 totalram_pages += free_all_bootmem(); 84 totalram_pages += free_all_bootmem();
87 totalram_pages -= setup_zero_page(); /* Setup zeroed pages. */ 85 setup_zero_page(); /* Setup zeroed pages. */
88 reservedpages = 0; 86 reservedpages = 0;
89 87
90 for (tmp = 0; tmp < max_low_pfn; tmp++) 88 for (tmp = 0; tmp < max_low_pfn; tmp++)
@@ -109,37 +107,16 @@ void __init mem_init(void)
109} 107}
110#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 108#endif /* !CONFIG_NEED_MULTIPLE_NODES */
111 109
112static void free_init_pages(const char *what, unsigned long begin, unsigned long end)
113{
114 unsigned long pfn;
115
116 for (pfn = PFN_UP(begin); pfn < PFN_DOWN(end); pfn++) {
117 struct page *page = pfn_to_page(pfn);
118 void *addr = phys_to_virt(PFN_PHYS(pfn));
119
120 ClearPageReserved(page);
121 init_page_count(page);
122 memset(addr, POISON_FREE_INITMEM, PAGE_SIZE);
123 __free_page(page);
124 totalram_pages++;
125 }
126 printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
127}
128
129#ifdef CONFIG_BLK_DEV_INITRD 110#ifdef CONFIG_BLK_DEV_INITRD
130void free_initrd_mem(unsigned long start, unsigned long end) 111void free_initrd_mem(unsigned long start, unsigned long end)
131{ 112{
132 free_init_pages("initrd memory", 113 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
133 virt_to_phys((void *) start),
134 virt_to_phys((void *) end));
135} 114}
136#endif 115#endif
137 116
138void __init_refok free_initmem(void) 117void __init_refok free_initmem(void)
139{ 118{
140 free_init_pages("unused kernel memory", 119 free_initmem_default(POISON_FREE_INITMEM);
141 __pa(&__init_begin),
142 __pa(&__init_end));
143} 120}
144 121
145unsigned long pgd_current; 122unsigned long pgd_current;
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5e859633ce69..78d8ace57272 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -33,6 +33,7 @@ config SUPERH
33 select GENERIC_ATOMIC64 33 select GENERIC_ATOMIC64
34 select GENERIC_IRQ_SHOW 34 select GENERIC_IRQ_SHOW
35 select GENERIC_SMP_IDLE_THREAD 35 select GENERIC_SMP_IDLE_THREAD
36 select GENERIC_IDLE_POLL_SETUP
36 select GENERIC_CLOCKEVENTS 37 select GENERIC_CLOCKEVENTS
37 select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST 38 select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
38 select GENERIC_STRNCPY_FROM_USER 39 select GENERIC_STRNCPY_FROM_USER
@@ -148,9 +149,6 @@ config ARCH_HAS_ILOG2_U32
148config ARCH_HAS_ILOG2_U64 149config ARCH_HAS_ILOG2_U64
149 def_bool n 150 def_bool n
150 151
151config ARCH_HAS_DEFAULT_IDLE
152 def_bool y
153
154config NO_IOPORT 152config NO_IOPORT
155 def_bool !PCI 153 def_bool !PCI
156 depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN && \ 154 depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN && \
@@ -624,25 +622,7 @@ config SH_CLK_CPG_LEGACY
624endmenu 622endmenu
625 623
626menu "CPU Frequency scaling" 624menu "CPU Frequency scaling"
627
628source "drivers/cpufreq/Kconfig" 625source "drivers/cpufreq/Kconfig"
629
630config SH_CPU_FREQ
631 tristate "SuperH CPU Frequency driver"
632 depends on CPU_FREQ
633 select CPU_FREQ_TABLE
634 help
635 This adds the cpufreq driver for SuperH. Any CPU that supports
636 clock rate rounding through the clock framework can use this
637 driver. While it will make the kernel slightly larger, this is
638 harmless for CPUs that don't support rate rounding. The driver
639 will also generate a notice in the boot log before disabling
640 itself if the CPU in question is not capable of rate rounding.
641
642 For details, take a look at <file:Documentation/cpu-freq>.
643
644 If unsure, say N.
645
646endmenu 626endmenu
647 627
648source "arch/sh/drivers/Kconfig" 628source "arch/sh/drivers/Kconfig"
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index aaff7671101b..764530c85aa9 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -254,11 +254,13 @@ static int usbhs_get_id(struct platform_device *pdev)
254 return gpio_get_value(GPIO_PTB3); 254 return gpio_get_value(GPIO_PTB3);
255} 255}
256 256
257static void usbhs_phy_reset(struct platform_device *pdev) 257static int usbhs_phy_reset(struct platform_device *pdev)
258{ 258{
259 /* enable vbus if HOST */ 259 /* enable vbus if HOST */
260 if (!gpio_get_value(GPIO_PTB3)) 260 if (!gpio_get_value(GPIO_PTB3))
261 gpio_set_value(GPIO_PTB5, 1); 261 gpio_set_value(GPIO_PTB5, 1);
262
263 return 0;
262} 264}
263 265
264static struct renesas_usbhs_platform_info usbhs_info = { 266static struct renesas_usbhs_platform_info usbhs_info = {
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index f46848f088e4..c0eec08d8f95 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
16#include <linux/seq_file.h>
16#include <linux/list.h> 17#include <linux/list.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
@@ -308,11 +309,9 @@ int dma_extend(unsigned int chan, unsigned long op, void *param)
308} 309}
309EXPORT_SYMBOL(dma_extend); 310EXPORT_SYMBOL(dma_extend);
310 311
311static int dma_read_proc(char *buf, char **start, off_t off, 312static int dma_proc_show(struct seq_file *m, void *v)
312 int len, int *eof, void *data)
313{ 313{
314 struct dma_info *info; 314 struct dma_info *info = v;
315 char *p = buf;
316 315
317 if (list_empty(&registered_dmac_list)) 316 if (list_empty(&registered_dmac_list))
318 return 0; 317 return 0;
@@ -332,14 +331,26 @@ static int dma_read_proc(char *buf, char **start, off_t off,
332 if (!(channel->flags & DMA_CONFIGURED)) 331 if (!(channel->flags & DMA_CONFIGURED))
333 continue; 332 continue;
334 333
335 p += sprintf(p, "%2d: %14s %s\n", i, 334 seq_printf(m, "%2d: %14s %s\n", i,
336 info->name, channel->dev_id); 335 info->name, channel->dev_id);
337 } 336 }
338 } 337 }
339 338
340 return p - buf; 339 return 0;
340}
341
342static int dma_proc_open(struct inode *inode, struct file *file)
343{
344 return single_open(file, dma_proc_show, NULL);
341} 345}
342 346
347static const struct file_operations dma_proc_fops = {
348 .open = dma_proc_open,
349 .read = seq_read,
350 .llseek = seq_lseek,
351 .release = single_release,
352};
353
343int register_dmac(struct dma_info *info) 354int register_dmac(struct dma_info *info)
344{ 355{
345 unsigned int total_channels, i; 356 unsigned int total_channels, i;
@@ -412,8 +423,7 @@ EXPORT_SYMBOL(unregister_dmac);
412static int __init dma_api_init(void) 423static int __init dma_api_init(void)
413{ 424{
414 printk(KERN_NOTICE "DMA: Registering DMA API.\n"); 425 printk(KERN_NOTICE "DMA: Registering DMA API.\n");
415 return create_proc_read_entry("dma", 0, 0, dma_read_proc, 0) 426 return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM;
416 ? 0 : -ENOMEM;
417} 427}
418subsys_initcall(dma_api_init); 428subsys_initcall(dma_api_init);
419 429
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index c2c85f6cd738..a162a7f86b2e 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -35,7 +35,7 @@ static unsigned int nr_ports;
35 35
36static struct sh7786_pcie_hwops { 36static struct sh7786_pcie_hwops {
37 int (*core_init)(void); 37 int (*core_init)(void);
38 async_func_ptr *port_init_hw; 38 async_func_t port_init_hw;
39} *sh7786_pcie_hwops; 39} *sh7786_pcie_hwops;
40 40
41static struct resource sh7786_pci0_resources[] = { 41static struct resource sh7786_pci0_resources[] = {
diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h
index b3808c7d67b2..699255d6d1c6 100644
--- a/arch/sh/include/asm/hugetlb.h
+++ b/arch/sh/include/asm/hugetlb.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/cacheflush.h> 4#include <asm/cacheflush.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm-generic/hugetlb.h>
6 7
7 8
8static inline int is_hugepage_only_range(struct mm_struct *mm, 9static inline int is_hugepage_only_range(struct mm_struct *mm,
diff --git a/arch/sh/include/asm/suspend.h b/arch/sh/include/asm/suspend.h
index e14567a7e9a1..70ae0b2888ab 100644
--- a/arch/sh/include/asm/suspend.h
+++ b/arch/sh/include/asm/suspend.h
@@ -14,9 +14,9 @@ struct swsusp_arch_regs {
14void sh_mobile_call_standby(unsigned long mode); 14void sh_mobile_call_standby(unsigned long mode);
15 15
16#ifdef CONFIG_CPU_IDLE 16#ifdef CONFIG_CPU_IDLE
17void sh_mobile_setup_cpuidle(void); 17int sh_mobile_setup_cpuidle(void);
18#else 18#else
19static inline void sh_mobile_setup_cpuidle(void) {} 19static inline int sh_mobile_setup_cpuidle(void) { return 0; }
20#endif 20#endif
21 21
22/* notifier chains for pre/post sleep hooks */ 22/* notifier chains for pre/post sleep hooks */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 7d5ac4e48485..45a93669289d 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -207,8 +207,6 @@ static inline bool test_and_clear_restore_sigmask(void)
207 return true; 207 return true;
208} 208}
209 209
210#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
211
212#endif /* !__ASSEMBLY__ */ 210#endif /* !__ASSEMBLY__ */
213 211
214#endif /* __KERNEL__ */ 212#endif /* __KERNEL__ */
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 5e90fa2b7eed..e77816c4b9bc 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -30,12 +30,4 @@
30# define __ARCH_WANT_SYS_VFORK 30# define __ARCH_WANT_SYS_VFORK
31# define __ARCH_WANT_SYS_CLONE 31# define __ARCH_WANT_SYS_CLONE
32 32
33/*
34 * "Conditional" syscalls
35 *
36 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
37 * but it doesn't work on all toolchains, so we just do it by hand
38 */
39# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
40
41#include <uapi/asm/unistd.h> 33#include <uapi/asm/unistd.h>
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index f259b37874e9..261c8bfd75ce 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -31,7 +31,6 @@ obj-$(CONFIG_VSYSCALL) += vsyscall/
31obj-$(CONFIG_SMP) += smp.o 31obj-$(CONFIG_SMP) += smp.o
32obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 32obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
33obj-$(CONFIG_KGDB) += kgdb.o 33obj-$(CONFIG_KGDB) += kgdb.o
34obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
35obj-$(CONFIG_MODULES) += sh_ksyms_$(BITS).o module.o 34obj-$(CONFIG_MODULES) += sh_ksyms_$(BITS).o module.o
36obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 35obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
37obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 36obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c
index 96c6c2634cb4..eef17dcc3a41 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c
@@ -8,12 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7203_pfc_resources[] = {
18 [0] = {
19 .start = 0xfffe3800,
20 .end = 0xfffe3a9f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7203", NULL, 0); 27 return sh_pfc_register("pfc-sh7203", sh7203_pfc_resources,
28 ARRAY_SIZE(sh7203_pfc_resources));
18} 29}
19arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c
index b1b7c1bae127..569decbd6d93 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7264.c
@@ -8,12 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7264_pfc_resources[] = {
18 [0] = {
19 .start = 0xfffe3800,
20 .end = 0xfffe393f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7264", NULL, 0); 27 return sh_pfc_register("pfc-sh7264", sh7264_pfc_resources,
28 ARRAY_SIZE(sh7264_pfc_resources));
18} 29}
19arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c b/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
index dc2a86830456..1825b0bd523d 100644
--- a/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
+++ b/arch/sh/kernel/cpu/sh2a/pinmux-sh7269.c
@@ -13,8 +13,17 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <cpu/pfc.h> 14#include <cpu/pfc.h>
15 15
16static struct resource sh7269_pfc_resources[] = {
17 [0] = {
18 .start = 0xfffe3800,
19 .end = 0xfffe391f,
20 .flags = IORESOURCE_MEM,
21 },
22};
23
16static int __init plat_pinmux_setup(void) 24static int __init plat_pinmux_setup(void)
17{ 25{
18 return sh_pfc_register("pfc-sh7269", NULL, 0); 26 return sh_pfc_register("pfc-sh7269", sh7269_pfc_resources,
27 ARRAY_SIZE(sh7269_pfc_resources));
19} 28}
20arch_initcall(plat_pinmux_setup); 29arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c b/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c
index 7d3744ac7b08..26e90a66ebb7 100644
--- a/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c
+++ b/arch/sh/kernel/cpu/sh3/pinmux-sh7720.c
@@ -8,13 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7720_pfc_resources[] = {
18 [0] = {
19 .start = 0xa4050100,
20 .end = 0xa405016f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7720", NULL, 0); 27 return sh_pfc_register("pfc-sh7720", sh7720_pfc_resources,
28 ARRAY_SIZE(sh7720_pfc_resources));
18} 29}
19
20arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
index d9bcc4290997..271bbc864929 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7722.c
@@ -1,10 +1,20 @@
1#include <linux/bug.h>
1#include <linux/init.h> 2#include <linux/init.h>
2#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/ioport.h>
3#include <cpu/pfc.h> 5#include <cpu/pfc.h>
4 6
7static struct resource sh7722_pfc_resources[] = {
8 [0] = {
9 .start = 0xa4050100,
10 .end = 0xa405018f,
11 .flags = IORESOURCE_MEM,
12 },
13};
14
5static int __init plat_pinmux_setup(void) 15static int __init plat_pinmux_setup(void)
6{ 16{
7 return sh_pfc_register("pfc-sh7722", NULL, 0); 17 return sh_pfc_register("pfc-sh7722", sh7722_pfc_resources,
18 ARRAY_SIZE(sh7722_pfc_resources));
8} 19}
9
10arch_initcall(plat_pinmux_setup); 20arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c
index bcec7ad7f783..99c637d5bf7a 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7723.c
@@ -8,13 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7723_pfc_resources[] = {
18 [0] = {
19 .start = 0xa4050100,
20 .end = 0xa405016f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7723", NULL, 0); 27 return sh_pfc_register("pfc-sh7723", sh7723_pfc_resources,
28 ARRAY_SIZE(sh7723_pfc_resources));
18} 29}
19
20arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c
index 5c3541d6aed8..63be4749e341 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7724.c
@@ -13,12 +13,23 @@
13 * for more details. 13 * for more details.
14 */ 14 */
15 15
16#include <linux/bug.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/ioport.h>
18#include <cpu/pfc.h> 20#include <cpu/pfc.h>
19 21
22static struct resource sh7724_pfc_resources[] = {
23 [0] = {
24 .start = 0xa4050100,
25 .end = 0xa405016f,
26 .flags = IORESOURCE_MEM,
27 },
28};
29
20static int __init plat_pinmux_setup(void) 30static int __init plat_pinmux_setup(void)
21{ 31{
22 return sh_pfc_register("pfc-sh7724", NULL, 0); 32 return sh_pfc_register("pfc-sh7724", sh7724_pfc_resources,
33 ARRAY_SIZE(sh7724_pfc_resources));
23} 34}
24arch_initcall(plat_pinmux_setup); 35arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
index cda6bd177b8c..567745d44221 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
@@ -13,12 +13,23 @@
13 * for more details. 13 * for more details.
14 */ 14 */
15 15
16#include <linux/bug.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/ioport.h>
18#include <cpu/pfc.h> 20#include <cpu/pfc.h>
19 21
22static struct resource sh7757_pfc_resources[] = {
23 [0] = {
24 .start = 0xffec0000,
25 .end = 0xffec008f,
26 .flags = IORESOURCE_MEM,
27 },
28};
29
20static int __init plat_pinmux_setup(void) 30static int __init plat_pinmux_setup(void)
21{ 31{
22 return sh_pfc_register("pfc-sh7757", NULL, 0); 32 return sh_pfc_register("pfc-sh7757", sh7757_pfc_resources,
33 ARRAY_SIZE(sh7757_pfc_resources));
23} 34}
24arch_initcall(plat_pinmux_setup); 35arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c
index 01055b809f64..e336ab8b5125 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7785.c
@@ -8,13 +8,23 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#include <linux/bug.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/ioport.h>
13#include <cpu/pfc.h> 15#include <cpu/pfc.h>
14 16
17static struct resource sh7785_pfc_resources[] = {
18 [0] = {
19 .start = 0xffe70000,
20 .end = 0xffe7008f,
21 .flags = IORESOURCE_MEM,
22 },
23};
24
15static int __init plat_pinmux_setup(void) 25static int __init plat_pinmux_setup(void)
16{ 26{
17 return sh_pfc_register("pfc-sh7785", NULL, 0); 27 return sh_pfc_register("pfc-sh7785", sh7785_pfc_resources,
28 ARRAY_SIZE(sh7785_pfc_resources));
18} 29}
19
20arch_initcall(plat_pinmux_setup); 30arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c
index 3061778d55da..9a459556a2f7 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7786.c
@@ -13,13 +13,23 @@
13 * for more details. 13 * for more details.
14 */ 14 */
15 15
16#include <linux/bug.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/ioport.h>
18#include <cpu/pfc.h> 20#include <cpu/pfc.h>
19 21
22static struct resource sh7786_pfc_resources[] = {
23 [0] = {
24 .start = 0xffcc0000,
25 .end = 0xffcc008f,
26 .flags = IORESOURCE_MEM,
27 },
28};
29
20static int __init plat_pinmux_setup(void) 30static int __init plat_pinmux_setup(void)
21{ 31{
22 return sh_pfc_register("pfc-sh7786", NULL, 0); 32 return sh_pfc_register("pfc-sh7786", sh7786_pfc_resources,
33 ARRAY_SIZE(sh7786_pfc_resources));
23} 34}
24
25arch_initcall(plat_pinmux_setup); 35arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c b/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
index ace84acc55ea..444bf25c60fa 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
@@ -7,12 +7,23 @@
7 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details. 8 * for more details.
9 */ 9 */
10#include <linux/bug.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/ioport.h>
12#include <cpu/pfc.h> 14#include <cpu/pfc.h>
13 15
14static int __init shx3_pinmux_setup(void) 16static struct resource shx3_pfc_resources[] = {
17 [0] = {
18 .start = 0xffc70000,
19 .end = 0xffc7001f,
20 .flags = IORESOURCE_MEM,
21 },
22};
23
24static int __init plat_pinmux_setup(void)
15{ 25{
16 return sh_pfc_register("pfc-shx3", NULL, 0); 26 return sh_pfc_register("pfc-shx3", shx3_pfc_resources,
27 ARRAY_SIZE(shx3_pfc_resources));
17} 28}
18arch_initcall(shx3_pinmux_setup); 29arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c
index 1ddc876d3b26..d30622592116 100644
--- a/arch/sh/kernel/cpu/shmobile/cpuidle.c
+++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c
@@ -51,70 +51,53 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev,
51 return k; 51 return k;
52} 52}
53 53
54static struct cpuidle_device cpuidle_dev;
55static struct cpuidle_driver cpuidle_driver = { 54static struct cpuidle_driver cpuidle_driver = {
56 .name = "sh_idle", 55 .name = "sh_idle",
57 .owner = THIS_MODULE, 56 .owner = THIS_MODULE,
58 .en_core_tk_irqen = 1, 57 .states = {
58 {
59 .exit_latency = 1,
60 .target_residency = 1 * 2,
61 .power_usage = 3,
62 .flags = CPUIDLE_FLAG_TIME_VALID,
63 .enter = cpuidle_sleep_enter,
64 .name = "C1",
65 .desc = "SuperH Sleep Mode",
66 },
67 {
68 .exit_latency = 100,
69 .target_residency = 1 * 2,
70 .power_usage = 1,
71 .flags = CPUIDLE_FLAG_TIME_VALID,
72 .enter = cpuidle_sleep_enter,
73 .name = "C2",
74 .desc = "SuperH Sleep Mode [SF]",
75 .disabled = true,
76 },
77 {
78 .exit_latency = 2300,
79 .target_residency = 1 * 2,
80 .power_usage = 1,
81 .flags = CPUIDLE_FLAG_TIME_VALID,
82 .enter = cpuidle_sleep_enter,
83 .name = "C3",
84 .desc = "SuperH Mobile Standby Mode [SF]",
85 .disabled = true,
86 },
87 },
88 .safe_state_index = 0,
89 .state_count = 3,
59}; 90};
60 91
61void sh_mobile_setup_cpuidle(void) 92int __init sh_mobile_setup_cpuidle(void)
62{ 93{
63 struct cpuidle_device *dev = &cpuidle_dev; 94 int ret;
64 struct cpuidle_driver *drv = &cpuidle_driver;
65 struct cpuidle_state *state;
66 int i;
67 95
96 if (sh_mobile_sleep_supported & SUSP_SH_SF)
97 cpuidle_driver.states[1].disabled = false;
68 98
69 for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 99 if (sh_mobile_sleep_supported & SUSP_SH_STANDBY)
70 drv->states[i].name[0] = '\0'; 100 cpuidle_driver.states[2].disabled = false;
71 drv->states[i].desc[0] = '\0';
72 }
73 101
74 i = CPUIDLE_DRIVER_STATE_START; 102 return cpuidle_register(&cpuidle_driver);
75
76 state = &drv->states[i++];
77 snprintf(state->name, CPUIDLE_NAME_LEN, "C1");
78 strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN);
79 state->exit_latency = 1;
80 state->target_residency = 1 * 2;
81 state->power_usage = 3;
82 state->flags = 0;
83 state->flags |= CPUIDLE_FLAG_TIME_VALID;
84 state->enter = cpuidle_sleep_enter;
85
86 drv->safe_state_index = i-1;
87
88 if (sh_mobile_sleep_supported & SUSP_SH_SF) {
89 state = &drv->states[i++];
90 snprintf(state->name, CPUIDLE_NAME_LEN, "C2");
91 strncpy(state->desc, "SuperH Sleep Mode [SF]",
92 CPUIDLE_DESC_LEN);
93 state->exit_latency = 100;
94 state->target_residency = 1 * 2;
95 state->power_usage = 1;
96 state->flags = 0;
97 state->flags |= CPUIDLE_FLAG_TIME_VALID;
98 state->enter = cpuidle_sleep_enter;
99 }
100
101 if (sh_mobile_sleep_supported & SUSP_SH_STANDBY) {
102 state = &drv->states[i++];
103 snprintf(state->name, CPUIDLE_NAME_LEN, "C3");
104 strncpy(state->desc, "SuperH Mobile Standby Mode [SF]",
105 CPUIDLE_DESC_LEN);
106 state->exit_latency = 2300;
107 state->target_residency = 1 * 2;
108 state->power_usage = 1;
109 state->flags = 0;
110 state->flags |= CPUIDLE_FLAG_TIME_VALID;
111 state->enter = cpuidle_sleep_enter;
112 }
113
114 drv->state_count = i;
115 dev->state_count = i;
116
117 cpuidle_register_driver(&cpuidle_driver);
118
119 cpuidle_register_device(dev);
120} 103}
diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c
index 08d27fac8d08..ac37b7234f85 100644
--- a/arch/sh/kernel/cpu/shmobile/pm.c
+++ b/arch/sh/kernel/cpu/shmobile/pm.c
@@ -150,8 +150,7 @@ static const struct platform_suspend_ops sh_pm_ops = {
150static int __init sh_pm_init(void) 150static int __init sh_pm_init(void)
151{ 151{
152 suspend_set_ops(&sh_pm_ops); 152 suspend_set_ops(&sh_pm_ops);
153 sh_mobile_setup_cpuidle(); 153 return sh_mobile_setup_cpuidle();
154 return 0;
155} 154}
156 155
157late_initcall(sh_pm_init); 156late_initcall(sh_pm_init);
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c
deleted file mode 100644
index e68b45b6f3f9..000000000000
--- a/arch/sh/kernel/cpufreq.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 * arch/sh/kernel/cpufreq.c
3 *
4 * cpufreq driver for the SuperH processors.
5 *
6 * Copyright (C) 2002 - 2012 Paul Mundt
7 * Copyright (C) 2002 M. R. Brown
8 *
9 * Clock framework bits from arch/avr32/mach-at32ap/cpufreq.c
10 *
11 * Copyright (C) 2004-2007 Atmel Corporation
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#define pr_fmt(fmt) "cpufreq: " fmt
18
19#include <linux/types.h>
20#include <linux/cpufreq.h>
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/err.h>
25#include <linux/cpumask.h>
26#include <linux/cpu.h>
27#include <linux/smp.h>
28#include <linux/sched.h> /* set_cpus_allowed() */
29#include <linux/clk.h>
30#include <linux/percpu.h>
31#include <linux/sh_clk.h>
32
33static DEFINE_PER_CPU(struct clk, sh_cpuclk);
34
35static unsigned int sh_cpufreq_get(unsigned int cpu)
36{
37 return (clk_get_rate(&per_cpu(sh_cpuclk, cpu)) + 500) / 1000;
38}
39
40/*
41 * Here we notify other drivers of the proposed change and the final change.
42 */
43static int sh_cpufreq_target(struct cpufreq_policy *policy,
44 unsigned int target_freq,
45 unsigned int relation)
46{
47 unsigned int cpu = policy->cpu;
48 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
49 cpumask_t cpus_allowed;
50 struct cpufreq_freqs freqs;
51 struct device *dev;
52 long freq;
53
54 if (!cpu_online(cpu))
55 return -ENODEV;
56
57 cpus_allowed = current->cpus_allowed;
58 set_cpus_allowed_ptr(current, cpumask_of(cpu));
59
60 BUG_ON(smp_processor_id() != cpu);
61
62 dev = get_cpu_device(cpu);
63
64 /* Convert target_freq from kHz to Hz */
65 freq = clk_round_rate(cpuclk, target_freq * 1000);
66
67 if (freq < (policy->min * 1000) || freq > (policy->max * 1000))
68 return -EINVAL;
69
70 dev_dbg(dev, "requested frequency %u Hz\n", target_freq * 1000);
71
72 freqs.cpu = cpu;
73 freqs.old = sh_cpufreq_get(cpu);
74 freqs.new = (freq + 500) / 1000;
75 freqs.flags = 0;
76
77 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
78 set_cpus_allowed_ptr(current, &cpus_allowed);
79 clk_set_rate(cpuclk, freq);
80 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
81
82 dev_dbg(dev, "set frequency %lu Hz\n", freq);
83
84 return 0;
85}
86
87static int sh_cpufreq_verify(struct cpufreq_policy *policy)
88{
89 struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu);
90 struct cpufreq_frequency_table *freq_table;
91
92 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
93 if (freq_table)
94 return cpufreq_frequency_table_verify(policy, freq_table);
95
96 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
97 policy->cpuinfo.max_freq);
98
99 policy->min = (clk_round_rate(cpuclk, 1) + 500) / 1000;
100 policy->max = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
101
102 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
103 policy->cpuinfo.max_freq);
104
105 return 0;
106}
107
108static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
109{
110 unsigned int cpu = policy->cpu;
111 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
112 struct cpufreq_frequency_table *freq_table;
113 struct device *dev;
114
115 if (!cpu_online(cpu))
116 return -ENODEV;
117
118 dev = get_cpu_device(cpu);
119
120 cpuclk = clk_get(dev, "cpu_clk");
121 if (IS_ERR(cpuclk)) {
122 dev_err(dev, "couldn't get CPU clk\n");
123 return PTR_ERR(cpuclk);
124 }
125
126 policy->cur = policy->min = policy->max = sh_cpufreq_get(cpu);
127
128 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
129 if (freq_table) {
130 int result;
131
132 result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
133 if (!result)
134 cpufreq_frequency_table_get_attr(freq_table, cpu);
135 } else {
136 dev_notice(dev, "no frequency table found, falling back "
137 "to rate rounding.\n");
138
139 policy->cpuinfo.min_freq =
140 (clk_round_rate(cpuclk, 1) + 500) / 1000;
141 policy->cpuinfo.max_freq =
142 (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
143 }
144
145 policy->min = policy->cpuinfo.min_freq;
146 policy->max = policy->cpuinfo.max_freq;
147
148 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
149
150 dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, "
151 "Maximum %u.%03u MHz.\n",
152 policy->min / 1000, policy->min % 1000,
153 policy->max / 1000, policy->max % 1000);
154
155 return 0;
156}
157
158static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy)
159{
160 unsigned int cpu = policy->cpu;
161 struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu);
162
163 cpufreq_frequency_table_put_attr(cpu);
164 clk_put(cpuclk);
165
166 return 0;
167}
168
169static struct freq_attr *sh_freq_attr[] = {
170 &cpufreq_freq_attr_scaling_available_freqs,
171 NULL,
172};
173
174static struct cpufreq_driver sh_cpufreq_driver = {
175 .owner = THIS_MODULE,
176 .name = "sh",
177 .get = sh_cpufreq_get,
178 .target = sh_cpufreq_target,
179 .verify = sh_cpufreq_verify,
180 .init = sh_cpufreq_cpu_init,
181 .exit = sh_cpufreq_cpu_exit,
182 .attr = sh_freq_attr,
183};
184
185static int __init sh_cpufreq_module_init(void)
186{
187 pr_notice("SuperH CPU frequency driver.\n");
188 return cpufreq_register_driver(&sh_cpufreq_driver);
189}
190
191static void __exit sh_cpufreq_module_exit(void)
192{
193 cpufreq_unregister_driver(&sh_cpufreq_driver);
194}
195
196module_init(sh_cpufreq_module_init);
197module_exit(sh_cpufreq_module_exit);
198
199MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>");
200MODULE_DESCRIPTION("cpufreq driver for SuperH");
201MODULE_LICENSE("GPL");
diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
index 7617dc4129ac..b959f5592604 100644
--- a/arch/sh/kernel/dumpstack.c
+++ b/arch/sh/kernel/dumpstack.c
@@ -158,9 +158,3 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
158 (unsigned long)task_stack_page(tsk)); 158 (unsigned long)task_stack_page(tsk));
159 show_trace(tsk, sp, NULL); 159 show_trace(tsk, sp, NULL);
160} 160}
161
162void dump_stack(void)
163{
164 show_stack(NULL, NULL);
165}
166EXPORT_SYMBOL(dump_stack);
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index 3d5a1b387cc0..2ea4483fd722 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -24,98 +24,24 @@
24 24
25static void (*sh_idle)(void); 25static void (*sh_idle)(void);
26 26
27static int hlt_counter; 27void default_idle(void)
28
29static int __init nohlt_setup(char *__unused)
30{
31 hlt_counter = 1;
32 return 1;
33}
34__setup("nohlt", nohlt_setup);
35
36static int __init hlt_setup(char *__unused)
37{
38 hlt_counter = 0;
39 return 1;
40}
41__setup("hlt", hlt_setup);
42
43static inline int hlt_works(void)
44{
45 return !hlt_counter;
46}
47
48/*
49 * On SMP it's slightly faster (but much more power-consuming!)
50 * to poll the ->work.need_resched flag instead of waiting for the
51 * cross-CPU IPI to arrive. Use this option with caution.
52 */
53static void poll_idle(void)
54{ 28{
29 set_bl_bit();
55 local_irq_enable(); 30 local_irq_enable();
56 while (!need_resched()) 31 /* Isn't this racy ? */
57 cpu_relax(); 32 cpu_sleep();
33 clear_bl_bit();
58} 34}
59 35
60void default_idle(void) 36void arch_cpu_idle_dead(void)
61{ 37{
62 if (hlt_works()) { 38 play_dead();
63 clear_thread_flag(TIF_POLLING_NRFLAG);
64 smp_mb__after_clear_bit();
65
66 set_bl_bit();
67 if (!need_resched()) {
68 local_irq_enable();
69 cpu_sleep();
70 } else
71 local_irq_enable();
72
73 set_thread_flag(TIF_POLLING_NRFLAG);
74 clear_bl_bit();
75 } else
76 poll_idle();
77} 39}
78 40
79/* 41void arch_cpu_idle(void)
80 * The idle thread. There's no useful work to be done, so just try to conserve
81 * power and have a low exit latency (ie sit in a loop waiting for somebody to
82 * say that they'd like to reschedule)
83 */
84void cpu_idle(void)
85{ 42{
86 unsigned int cpu = smp_processor_id(); 43 if (cpuidle_idle_call())
87 44 sh_idle();
88 set_thread_flag(TIF_POLLING_NRFLAG);
89
90 /* endless idle loop with no priority at all */
91 while (1) {
92 tick_nohz_idle_enter();
93 rcu_idle_enter();
94
95 while (!need_resched()) {
96 check_pgt_cache();
97 rmb();
98
99 if (cpu_is_offline(cpu))
100 play_dead();
101
102 local_irq_disable();
103 /* Don't trace irqs off for idle */
104 stop_critical_timings();
105 if (cpuidle_idle_call())
106 sh_idle();
107 /*
108 * Sanity check to ensure that sh_idle() returns
109 * with IRQs enabled
110 */
111 WARN_ON(irqs_disabled());
112 start_critical_timings();
113 }
114
115 rcu_idle_exit();
116 tick_nohz_idle_exit();
117 schedule_preempt_disabled();
118 }
119} 45}
120 46
121void __init select_idle_routine(void) 47void __init select_idle_routine(void)
@@ -123,13 +49,8 @@ void __init select_idle_routine(void)
123 /* 49 /*
124 * If a platform has set its own idle routine, leave it alone. 50 * If a platform has set its own idle routine, leave it alone.
125 */ 51 */
126 if (sh_idle) 52 if (!sh_idle)
127 return;
128
129 if (hlt_works())
130 sh_idle = default_idle; 53 sh_idle = default_idle;
131 else
132 sh_idle = poll_idle;
133} 54}
134 55
135void stop_this_cpu(void *unused) 56void stop_this_cpu(void *unused)
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 73eb66fc6253..ebd3933005b4 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -32,11 +32,7 @@
32void show_regs(struct pt_regs * regs) 32void show_regs(struct pt_regs * regs)
33{ 33{
34 printk("\n"); 34 printk("\n");
35 printk("Pid : %d, Comm: \t\t%s\n", task_pid_nr(current), current->comm); 35 show_regs_print_info(KERN_DEFAULT);
36 printk("CPU : %d \t\t%s (%s %.*s)\n\n",
37 smp_processor_id(), print_tainted(), init_utsname()->release,
38 (int)strcspn(init_utsname()->version, " "),
39 init_utsname()->version);
40 36
41 print_symbol("PC is at %s\n", instruction_pointer(regs)); 37 print_symbol("PC is at %s\n", instruction_pointer(regs));
42 print_symbol("PR is at %s\n", regs->pr); 38 print_symbol("PR is at %s\n", regs->pr);
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index e611c85144b1..174d124b419e 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -40,6 +40,7 @@ void show_regs(struct pt_regs *regs)
40 unsigned long long ah, al, bh, bl, ch, cl; 40 unsigned long long ah, al, bh, bl, ch, cl;
41 41
42 printk("\n"); 42 printk("\n");
43 show_regs_print_info(KERN_DEFAULT);
43 44
44 ah = (regs->pc) >> 32; 45 ah = (regs->pc) >> 32;
45 al = (regs->pc) & 0xffffffff; 46 al = (regs->pc) & 0xffffffff;
diff --git a/arch/sh/kernel/sh_bios.c b/arch/sh/kernel/sh_bios.c
index 47475cca068a..fe584e516964 100644
--- a/arch/sh/kernel/sh_bios.c
+++ b/arch/sh/kernel/sh_bios.c
@@ -104,6 +104,7 @@ void sh_bios_vbr_reload(void)
104 ); 104 );
105} 105}
106 106
107#ifdef CONFIG_EARLY_PRINTK
107/* 108/*
108 * Print a string through the BIOS 109 * Print a string through the BIOS
109 */ 110 */
@@ -144,8 +145,6 @@ static struct console bios_console = {
144 .index = -1, 145 .index = -1,
145}; 146};
146 147
147static struct console *early_console;
148
149static int __init setup_early_printk(char *buf) 148static int __init setup_early_printk(char *buf)
150{ 149{
151 int keep_early = 0; 150 int keep_early = 0;
@@ -170,3 +169,4 @@ static int __init setup_early_printk(char *buf)
170 return 0; 169 return 0;
171} 170}
172early_param("earlyprintk", setup_early_printk); 171early_param("earlyprintk", setup_early_printk);
172#endif
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 2062aa88af41..45696451f0ea 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -203,7 +203,7 @@ asmlinkage void __cpuinit start_secondary(void)
203 set_cpu_online(cpu, true); 203 set_cpu_online(cpu, true);
204 per_cpu(cpu_state, cpu) = CPU_ONLINE; 204 per_cpu(cpu_state, cpu) = CPU_ONLINE;
205 205
206 cpu_idle(); 206 cpu_startup_entry(CPUHP_ONLINE);
207} 207}
208 208
209extern struct { 209extern struct {
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 5a43a871e097..dba285e86808 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -137,13 +137,6 @@ config ARCH_SPARSEMEM_ENABLE
137config ARCH_SPARSEMEM_DEFAULT 137config ARCH_SPARSEMEM_DEFAULT
138 def_bool y 138 def_bool y
139 139
140config MAX_ACTIVE_REGIONS
141 int
142 default "6" if (CPU_SUBTYPE_SHX3 && SPARSEMEM)
143 default "2" if SPARSEMEM && (CPU_SUBTYPE_SH7722 || \
144 CPU_SUBTYPE_SH7785)
145 default "1"
146
147config ARCH_SELECT_MEMORY_MODEL 140config ARCH_SELECT_MEMORY_MODEL
148 def_bool y 141 def_bool y
149 142
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c
index aea14855e656..ec2b25302427 100644
--- a/arch/sh/mm/alignment.c
+++ b/arch/sh/mm/alignment.c
@@ -140,7 +140,7 @@ static int alignment_proc_open(struct inode *inode, struct file *file)
140static ssize_t alignment_proc_write(struct file *file, 140static ssize_t alignment_proc_write(struct file *file,
141 const char __user *buffer, size_t count, loff_t *pos) 141 const char __user *buffer, size_t count, loff_t *pos)
142{ 142{
143 int *data = PDE(file_inode(file))->data; 143 int *data = PDE_DATA(file_inode(file));
144 char mode; 144 char mode;
145 145
146 if (count > 0) { 146 if (count > 0) {
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 105794037143..20f9ead650d3 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -417,15 +417,13 @@ void __init mem_init(void)
417 417
418 for_each_online_node(nid) { 418 for_each_online_node(nid) {
419 pg_data_t *pgdat = NODE_DATA(nid); 419 pg_data_t *pgdat = NODE_DATA(nid);
420 unsigned long node_pages = 0;
421 void *node_high_memory; 420 void *node_high_memory;
422 421
423 num_physpages += pgdat->node_present_pages; 422 num_physpages += pgdat->node_present_pages;
424 423
425 if (pgdat->node_spanned_pages) 424 if (pgdat->node_spanned_pages)
426 node_pages = free_all_bootmem_node(pgdat); 425 totalram_pages += free_all_bootmem_node(pgdat);
427 426
428 totalram_pages += node_pages;
429 427
430 node_high_memory = (void *)__va((pgdat->node_start_pfn + 428 node_high_memory = (void *)__va((pgdat->node_start_pfn +
431 pgdat->node_spanned_pages) << 429 pgdat->node_spanned_pages) <<
@@ -501,31 +499,13 @@ void __init mem_init(void)
501 499
502void free_initmem(void) 500void free_initmem(void)
503{ 501{
504 unsigned long addr; 502 free_initmem_default(0);
505
506 addr = (unsigned long)(&__init_begin);
507 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
508 ClearPageReserved(virt_to_page(addr));
509 init_page_count(virt_to_page(addr));
510 free_page(addr);
511 totalram_pages++;
512 }
513 printk("Freeing unused kernel memory: %ldk freed\n",
514 ((unsigned long)&__init_end -
515 (unsigned long)&__init_begin) >> 10);
516} 503}
517 504
518#ifdef CONFIG_BLK_DEV_INITRD 505#ifdef CONFIG_BLK_DEV_INITRD
519void free_initrd_mem(unsigned long start, unsigned long end) 506void free_initrd_mem(unsigned long start, unsigned long end)
520{ 507{
521 unsigned long p; 508 free_reserved_area(start, end, 0, "initrd");
522 for (p = start; p < end; p += PAGE_SIZE) {
523 ClearPageReserved(virt_to_page(p));
524 init_page_count(virt_to_page(p));
525 free_page(p);
526 totalram_pages++;
527 }
528 printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
529} 509}
530#endif 510#endif
531 511
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 3d361f236308..a639c0d07b8b 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -62,7 +62,6 @@ config SPARC64
62 select HAVE_RCU_TABLE_FREE if SMP 62 select HAVE_RCU_TABLE_FREE if SMP
63 select HAVE_MEMBLOCK 63 select HAVE_MEMBLOCK
64 select HAVE_MEMBLOCK_NODE_MAP 64 select HAVE_MEMBLOCK_NODE_MAP
65 select HAVE_SYSCALL_WRAPPERS
66 select HAVE_ARCH_TRANSPARENT_HUGEPAGE 65 select HAVE_ARCH_TRANSPARENT_HUGEPAGE
67 select HAVE_DYNAMIC_FTRACE 66 select HAVE_DYNAMIC_FTRACE
68 select HAVE_FTRACE_MCOUNT_RECORD 67 select HAVE_FTRACE_MCOUNT_RECORD
@@ -100,6 +99,9 @@ config HAVE_LATENCYTOP_SUPPORT
100 bool 99 bool
101 default y if SPARC64 100 default y if SPARC64
102 101
102config ARCH_HIBERNATION_POSSIBLE
103 def_bool y if SPARC64
104
103config AUDIT_ARCH 105config AUDIT_ARCH
104 bool 106 bool
105 default y 107 default y
@@ -254,29 +256,6 @@ config HOTPLUG_CPU
254 256
255if SPARC64 257if SPARC64
256source "drivers/cpufreq/Kconfig" 258source "drivers/cpufreq/Kconfig"
257
258config US3_FREQ
259 tristate "UltraSPARC-III CPU Frequency driver"
260 depends on CPU_FREQ
261 select CPU_FREQ_TABLE
262 help
263 This adds the CPUFreq driver for UltraSPARC-III processors.
264
265 For details, take a look at <file:Documentation/cpu-freq>.
266
267 If in doubt, say N.
268
269config US2E_FREQ
270 tristate "UltraSPARC-IIe CPU Frequency driver"
271 depends on CPU_FREQ
272 select CPU_FREQ_TABLE
273 help
274 This adds the CPUFreq driver for UltraSPARC-IIe processors.
275
276 For details, take a look at <file:Documentation/cpu-freq>.
277
278 If in doubt, say N.
279
280endif 259endif
281 260
282config US3_MC 261config US3_MC
@@ -327,6 +306,10 @@ config ARCH_SPARSEMEM_DEFAULT
327 306
328source "mm/Kconfig" 307source "mm/Kconfig"
329 308
309if SPARC64
310source "kernel/power/Kconfig"
311endif
312
330config SCHED_SMT 313config SCHED_SMT
331 bool "SMT (Hyperthreading) scheduler support" 314 bool "SMT (Hyperthreading) scheduler support"
332 depends on SPARC64 && SMP 315 depends on SPARC64 && SMP
@@ -407,6 +390,8 @@ config SERIAL_CONSOLE
407config SPARC_LEON 390config SPARC_LEON
408 bool "Sparc Leon processor family" 391 bool "Sparc Leon processor family"
409 depends on SPARC32 392 depends on SPARC32
393 select USB_EHCI_BIG_ENDIAN_MMIO
394 select USB_EHCI_BIG_ENDIAN_DESC
410 ---help--- 395 ---help---
411 If you say Y here if you are running on a SPARC-LEON processor. 396 If you say Y here if you are running on a SPARC-LEON processor.
412 The LEON processor is a synthesizable VHDL model of the 397 The LEON processor is a synthesizable VHDL model of the
@@ -494,7 +479,18 @@ config LEON_PCI
494 depends on PCI && SPARC_LEON 479 depends on PCI && SPARC_LEON
495 default y 480 default y
496 481
497config GRPCI2 482config SPARC_GRPCI1
483 bool "GRPCI Host Bridge Support"
484 depends on LEON_PCI
485 default y
486 help
487 Say Y here to include the GRPCI Host Bridge Driver. The GRPCI
488 PCI host controller is typically found in GRLIB SPARC32/LEON
489 systems. The driver has one property (all_pci_errors) controlled
490 from the bootloader that makes the GRPCI to generate interrupts
491 on detected PCI Parity and System errors.
492
493config SPARC_GRPCI2
498 bool "GRPCI2 Host Bridge Support" 494 bool "GRPCI2 Host Bridge Support"
499 depends on LEON_PCI 495 depends on LEON_PCI
500 default y 496 default y
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 541b8b075c7d..9ff423678cbc 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -57,6 +57,7 @@ core-y += arch/sparc/
57libs-y += arch/sparc/prom/ 57libs-y += arch/sparc/prom/
58libs-y += arch/sparc/lib/ 58libs-y += arch/sparc/lib/
59 59
60drivers-$(CONFIG_PM) += arch/sparc/power/
60drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ 61drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/
61 62
62boot := arch/sparc/boot 63boot := arch/sparc/boot
diff --git a/arch/sparc/include/asm/cmpxchg_64.h b/arch/sparc/include/asm/cmpxchg_64.h
index b30eb37294c5..4adefe8e2885 100644
--- a/arch/sparc/include/asm/cmpxchg_64.h
+++ b/arch/sparc/include/asm/cmpxchg_64.h
@@ -141,5 +141,6 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
141 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 141 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
142 cmpxchg_local((ptr), (o), (n)); \ 142 cmpxchg_local((ptr), (o), (n)); \
143 }) 143 })
144#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
144 145
145#endif /* __ARCH_SPARC64_CMPXCHG__ */ 146#endif /* __ARCH_SPARC64_CMPXCHG__ */
diff --git a/arch/sparc/include/asm/head_32.h b/arch/sparc/include/asm/head_32.h
index a76874838f61..5f1dbe315bc8 100644
--- a/arch/sparc/include/asm/head_32.h
+++ b/arch/sparc/include/asm/head_32.h
@@ -55,15 +55,15 @@
55 55
56/* The Get Condition Codes software trap for userland. */ 56/* The Get Condition Codes software trap for userland. */
57#define GETCC_TRAP \ 57#define GETCC_TRAP \
58 b getcc_trap_handler; mov %psr, %l0; nop; nop; 58 b getcc_trap_handler; rd %psr, %l0; nop; nop;
59 59
60/* The Set Condition Codes software trap for userland. */ 60/* The Set Condition Codes software trap for userland. */
61#define SETCC_TRAP \ 61#define SETCC_TRAP \
62 b setcc_trap_handler; mov %psr, %l0; nop; nop; 62 b setcc_trap_handler; rd %psr, %l0; nop; nop;
63 63
64/* The Get PSR software trap for userland. */ 64/* The Get PSR software trap for userland. */
65#define GETPSR_TRAP \ 65#define GETPSR_TRAP \
66 mov %psr, %i0; jmp %l2; rett %l2 + 4; nop; 66 rd %psr, %i0; jmp %l2; rett %l2 + 4; nop;
67 67
68/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and 68/* This is for hard interrupts from level 1-14, 15 is non-maskable (nmi) and
69 * gets handled with another macro. 69 * gets handled with another macro.
diff --git a/arch/sparc/include/asm/hibernate.h b/arch/sparc/include/asm/hibernate.h
new file mode 100644
index 000000000000..2ec34f842249
--- /dev/null
+++ b/arch/sparc/include/asm/hibernate.h
@@ -0,0 +1,23 @@
1/*
2 * hibernate.h: Hibernaton support specific for sparc64.
3 *
4 * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
5 */
6
7#ifndef ___SPARC_HIBERNATE_H
8#define ___SPARC_HIBERNATE_H
9
10struct saved_context {
11 unsigned long fp;
12 unsigned long cwp;
13 unsigned long wstate;
14
15 unsigned long tick;
16 unsigned long pstate;
17
18 unsigned long g4;
19 unsigned long g5;
20 unsigned long g6;
21};
22
23#endif
diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h
index 7eb57d245044..e4cab465b81f 100644
--- a/arch/sparc/include/asm/hugetlb.h
+++ b/arch/sparc/include/asm/hugetlb.h
@@ -2,6 +2,7 @@
2#define _ASM_SPARC64_HUGETLB_H 2#define _ASM_SPARC64_HUGETLB_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm-generic/hugetlb.h>
5 6
6 7
7void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, 8void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
diff --git a/arch/sparc/include/asm/leon_pci.h b/arch/sparc/include/asm/leon_pci.h
index f48527ebdd8f..bfd3ab3092b5 100644
--- a/arch/sparc/include/asm/leon_pci.h
+++ b/arch/sparc/include/asm/leon_pci.h
@@ -12,6 +12,7 @@ struct leon_pci_info {
12 struct pci_ops *ops; 12 struct pci_ops *ops;
13 struct resource io_space; 13 struct resource io_space;
14 struct resource mem_space; 14 struct resource mem_space;
15 struct resource busn;
15 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); 16 int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
16}; 17};
17 18
diff --git a/arch/sparc/include/asm/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h
index 9191ca62ed9c..3d528f06e4b0 100644
--- a/arch/sparc/include/asm/mmu_context_64.h
+++ b/arch/sparc/include/asm/mmu_context_64.h
@@ -68,7 +68,7 @@ extern void smp_tsb_sync(struct mm_struct *mm);
68 68
69extern void __flush_tlb_mm(unsigned long, unsigned long); 69extern void __flush_tlb_mm(unsigned long, unsigned long);
70 70
71/* Switch the current MM context. Interrupts are disabled. */ 71/* Switch the current MM context. */
72static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) 72static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
73{ 73{
74 unsigned long ctx_valid, flags; 74 unsigned long ctx_valid, flags;
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
index cce72ce4c334..4c3f7f01c709 100644
--- a/arch/sparc/include/asm/processor_64.h
+++ b/arch/sparc/include/asm/processor_64.h
@@ -18,9 +18,6 @@
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/page.h> 19#include <asm/page.h>
20 20
21/* Don't hold the runqueue lock over context switch */
22#define __ARCH_WANT_UNLOCKED_CTXSW
23
24/* The sparc has no problems with write protection */ 21/* The sparc has no problems with write protection */
25#define wp_works_ok 1 22#define wp_works_ok 1
26#define wp_works_ok__is_a_macro /* for versions in ksyms.c */ 23#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 25849ae3e900..dd3807599bb9 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -132,8 +132,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
132#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ 132#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
133 _TIF_SIGPENDING) 133 _TIF_SIGPENDING)
134 134
135#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
136
137#endif /* __KERNEL__ */ 135#endif /* __KERNEL__ */
138 136
139#endif /* _ASM_THREAD_INFO_H */ 137#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 269bd92313df..d5e504251079 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -256,8 +256,6 @@ static inline bool test_and_clear_restore_sigmask(void)
256 return true; 256 return true;
257} 257}
258 258
259#define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
260
261#define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0) 259#define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0)
262#define test_thread_64bit_stack(__SP) \ 260#define test_thread_64bit_stack(__SP) \
263 ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \ 261 ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 5356810bd7e7..dfa53fdd5cbc 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -45,12 +45,4 @@
45#define __ARCH_WANT_COMPAT_SYS_SENDFILE 45#define __ARCH_WANT_COMPAT_SYS_SENDFILE
46#endif 46#endif
47 47
48/*
49 * "Conditional" syscalls
50 *
51 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
52 * but it doesn't work on all toolchains, so we just do it by hand
53 */
54#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
55
56#endif /* _SPARC_UNISTD_H */ 48#endif /* _SPARC_UNISTD_H */
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 6cf591b7e1c6..d432fb20358e 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,7 +74,8 @@ obj-y += dma.o
74 74
75obj-$(CONFIG_PCIC_PCI) += pcic.o 75obj-$(CONFIG_PCIC_PCI) += pcic.o
76obj-$(CONFIG_LEON_PCI) += leon_pci.o 76obj-$(CONFIG_LEON_PCI) += leon_pci.o
77obj-$(CONFIG_GRPCI2) += leon_pci_grpci2.o 77obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
78obj-$(CONFIG_SPARC_GRPCI1)+= leon_pci_grpci1.o
78 79
79obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o 80obj-$(CONFIG_SMP) += trampoline_$(BITS).o smp_$(BITS).o
80obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o 81obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o
@@ -102,9 +103,6 @@ obj-$(CONFIG_PCI_MSI) += pci_msi.o
102 103
103obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o 104obj-$(CONFIG_COMPAT) += sys32.o sys_sparc32.o signal32.o
104 105
105# sparc64 cpufreq
106obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o
107obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o
108obj-$(CONFIG_US3_MC) += chmc.o 106obj-$(CONFIG_US3_MC) += chmc.o
109 107
110obj-$(CONFIG_KPROBES) += kprobes.o 108obj-$(CONFIG_KPROBES) += kprobes.o
diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c
index 68f7e1118e9b..961b87f99e69 100644
--- a/arch/sparc/kernel/asm-offsets.c
+++ b/arch/sparc/kernel/asm-offsets.c
@@ -14,6 +14,8 @@
14// #include <linux/mm.h> 14// #include <linux/mm.h>
15#include <linux/kbuild.h> 15#include <linux/kbuild.h>
16 16
17#include <asm/hibernate.h>
18
17#ifdef CONFIG_SPARC32 19#ifdef CONFIG_SPARC32
18int sparc32_foo(void) 20int sparc32_foo(void)
19{ 21{
@@ -24,6 +26,19 @@ int sparc32_foo(void)
24#else 26#else
25int sparc64_foo(void) 27int sparc64_foo(void)
26{ 28{
29#ifdef CONFIG_HIBERNATION
30 BLANK();
31 OFFSET(SC_REG_FP, saved_context, fp);
32 OFFSET(SC_REG_CWP, saved_context, cwp);
33 OFFSET(SC_REG_WSTATE, saved_context, wstate);
34
35 OFFSET(SC_REG_TICK, saved_context, tick);
36 OFFSET(SC_REG_PSTATE, saved_context, pstate);
37
38 OFFSET(SC_REG_G4, saved_context, g4);
39 OFFSET(SC_REG_G5, saved_context, g5);
40 OFFSET(SC_REG_G6, saved_context, g6);
41#endif
27 return 0; 42 return 0;
28} 43}
29#endif 44#endif
diff --git a/arch/sparc/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S
index 9365432904d6..605c960b2fa6 100644
--- a/arch/sparc/kernel/hvtramp.S
+++ b/arch/sparc/kernel/hvtramp.S
@@ -128,8 +128,7 @@ hv_cpu_startup:
128 128
129 call smp_callin 129 call smp_callin
130 nop 130 nop
131 call cpu_idle 131
132 mov 0, %o0
133 call cpu_panic 132 call cpu_panic
134 nop 133 nop
135 134
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 0f094db918c7..2096468de9b2 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -693,7 +693,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
693 693
694static int sparc_io_proc_open(struct inode *inode, struct file *file) 694static int sparc_io_proc_open(struct inode *inode, struct file *file)
695{ 695{
696 return single_open(file, sparc_io_proc_show, PDE(inode)->data); 696 return single_open(file, sparc_io_proc_show, PDE_DATA(inode));
697} 697}
698 698
699static const struct file_operations sparc_io_proc_fops = { 699static const struct file_operations sparc_io_proc_fops = {
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 87f60ee65433..7c0231dabe44 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -213,6 +213,7 @@ unsigned int leon_build_device_irq(unsigned int real_irq,
213{ 213{
214 unsigned int irq; 214 unsigned int irq;
215 unsigned long mask; 215 unsigned long mask;
216 struct irq_desc *desc;
216 217
217 irq = 0; 218 irq = 0;
218 mask = leon_get_irqmask(real_irq); 219 mask = leon_get_irqmask(real_irq);
@@ -226,9 +227,12 @@ unsigned int leon_build_device_irq(unsigned int real_irq,
226 if (do_ack) 227 if (do_ack)
227 mask |= LEON_DO_ACK_HW; 228 mask |= LEON_DO_ACK_HW;
228 229
229 irq_set_chip_and_handler_name(irq, &leon_irq, 230 desc = irq_to_desc(irq);
230 flow_handler, name); 231 if (!desc || !desc->handle_irq || desc->handle_irq == handle_bad_irq) {
231 irq_set_chip_data(irq, (void *)mask); 232 irq_set_chip_and_handler_name(irq, &leon_irq,
233 flow_handler, name);
234 irq_set_chip_data(irq, (void *)mask);
235 }
232 236
233out: 237out:
234 return irq; 238 return irq;
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 852dc8430528..88aaaa57bb64 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -29,6 +29,8 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
29 pci_add_resource_offset(&resources, &info->io_space, 29 pci_add_resource_offset(&resources, &info->io_space,
30 info->io_space.start - 0x1000); 30 info->io_space.start - 0x1000);
31 pci_add_resource(&resources, &info->mem_space); 31 pci_add_resource(&resources, &info->mem_space);
32 info->busn.flags = IORESOURCE_BUS;
33 pci_add_resource(&resources, &info->busn);
32 34
33 root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, 35 root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info,
34 &resources); 36 &resources);
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
new file mode 100644
index 000000000000..7739a54315e2
--- /dev/null
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -0,0 +1,724 @@
1/*
2 * leon_pci_grpci1.c: GRPCI1 Host PCI driver
3 *
4 * Copyright (C) 2013 Aeroflex Gaisler AB
5 *
6 * This GRPCI1 driver does not support PCI interrupts taken from
7 * GPIO pins. Interrupt generation at PCI parity and system error
8 * detection is by default turned off since some GRPCI1 cores does
9 * not support detection. It can be turned on from the bootloader
10 * using the all_pci_errors property.
11 *
12 * Contributors: Daniel Hellstrom <daniel@gaisler.com>
13 */
14
15#include <linux/of_device.h>
16#include <linux/export.h>
17#include <linux/kernel.h>
18#include <linux/of_irq.h>
19#include <linux/delay.h>
20#include <linux/pci.h>
21
22#include <asm/leon_pci.h>
23#include <asm/sections.h>
24#include <asm/vaddrs.h>
25#include <asm/leon.h>
26#include <asm/io.h>
27
28#include "irq.h"
29
30/* Enable/Disable Debugging Configuration Space Access */
31#undef GRPCI1_DEBUG_CFGACCESS
32
33/*
34 * GRPCI1 APB Register MAP
35 */
36struct grpci1_regs {
37 unsigned int cfg_stat; /* 0x00 Configuration / Status */
38 unsigned int bar0; /* 0x04 BAR0 (RO) */
39 unsigned int page0; /* 0x08 PAGE0 (RO) */
40 unsigned int bar1; /* 0x0C BAR1 (RO) */
41 unsigned int page1; /* 0x10 PAGE1 */
42 unsigned int iomap; /* 0x14 IO Map */
43 unsigned int stat_cmd; /* 0x18 PCI Status & Command (RO) */
44 unsigned int irq; /* 0x1C Interrupt register */
45};
46
47#define REGLOAD(a) (be32_to_cpu(__raw_readl(&(a))))
48#define REGSTORE(a, v) (__raw_writel(cpu_to_be32(v), &(a)))
49
50#define PAGE0_BTEN_BIT 0
51#define PAGE0_BTEN (1 << PAGE0_BTEN_BIT)
52
53#define CFGSTAT_HOST_BIT 13
54#define CFGSTAT_CTO_BIT 8
55#define CFGSTAT_HOST (1 << CFGSTAT_HOST_BIT)
56#define CFGSTAT_CTO (1 << CFGSTAT_CTO_BIT)
57
58#define IRQ_DPE (1 << 9)
59#define IRQ_SSE (1 << 8)
60#define IRQ_RMA (1 << 7)
61#define IRQ_RTA (1 << 6)
62#define IRQ_STA (1 << 5)
63#define IRQ_DPED (1 << 4)
64#define IRQ_INTD (1 << 3)
65#define IRQ_INTC (1 << 2)
66#define IRQ_INTB (1 << 1)
67#define IRQ_INTA (1 << 0)
68#define IRQ_DEF_ERRORS (IRQ_RMA | IRQ_RTA | IRQ_STA)
69#define IRQ_ALL_ERRORS (IRQ_DPED | IRQ_DEF_ERRORS | IRQ_SSE | IRQ_DPE)
70#define IRQ_INTX (IRQ_INTA | IRQ_INTB | IRQ_INTC | IRQ_INTD)
71#define IRQ_MASK_BIT 16
72
73#define DEF_PCI_ERRORS (PCI_STATUS_SIG_TARGET_ABORT | \
74 PCI_STATUS_REC_TARGET_ABORT | \
75 PCI_STATUS_REC_MASTER_ABORT)
76#define ALL_PCI_ERRORS (PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY | \
77 PCI_STATUS_SIG_SYSTEM_ERROR | DEF_PCI_ERRORS)
78
79#define TGT 256
80
81struct grpci1_priv {
82 struct leon_pci_info info; /* must be on top of this structure */
83 struct grpci1_regs *regs; /* GRPCI register map */
84 struct device *dev;
85 int pci_err_mask; /* STATUS register error mask */
86 int irq; /* LEON irqctrl GRPCI IRQ */
87 unsigned char irq_map[4]; /* GRPCI nexus PCI INTX# IRQs */
88 unsigned int irq_err; /* GRPCI nexus Virt Error IRQ */
89
90 /* AHB PCI Windows */
91 unsigned long pci_area; /* MEMORY */
92 unsigned long pci_area_end;
93 unsigned long pci_io; /* I/O */
94 unsigned long pci_conf; /* CONFIGURATION */
95 unsigned long pci_conf_end;
96 unsigned long pci_io_va;
97};
98
99static struct grpci1_priv *grpci1priv;
100
101static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
102 unsigned int devfn, int where, u32 val);
103
104int grpci1_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
105{
106 struct grpci1_priv *priv = dev->bus->sysdata;
107 int irq_group;
108
109 /* Use default IRQ decoding on PCI BUS0 according slot numbering */
110 irq_group = slot & 0x3;
111 pin = ((pin - 1) + irq_group) & 0x3;
112
113 return priv->irq_map[pin];
114}
115
116static int grpci1_cfg_r32(struct grpci1_priv *priv, unsigned int bus,
117 unsigned int devfn, int where, u32 *val)
118{
119 u32 *pci_conf, tmp, cfg;
120
121 if (where & 0x3)
122 return -EINVAL;
123
124 if (bus == 0) {
125 devfn += (0x8 * 6); /* start at AD16=Device0 */
126 } else if (bus == TGT) {
127 bus = 0;
128 devfn = 0; /* special case: bridge controller itself */
129 }
130
131 /* Select bus */
132 cfg = REGLOAD(priv->regs->cfg_stat);
133 REGSTORE(priv->regs->cfg_stat, (cfg & ~(0xf << 23)) | (bus << 23));
134
135 /* do read access */
136 pci_conf = (u32 *) (priv->pci_conf | (devfn << 8) | (where & 0xfc));
137 tmp = LEON3_BYPASS_LOAD_PA(pci_conf);
138
139 /* check if master abort was received */
140 if (REGLOAD(priv->regs->cfg_stat) & CFGSTAT_CTO) {
141 *val = 0xffffffff;
142 /* Clear Master abort bit in PCI cfg space (is set) */
143 tmp = REGLOAD(priv->regs->stat_cmd);
144 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, tmp);
145 } else {
146 /* Bus always little endian (unaffected by byte-swapping) */
147 *val = flip_dword(tmp);
148 }
149
150 return 0;
151}
152
153static int grpci1_cfg_r16(struct grpci1_priv *priv, unsigned int bus,
154 unsigned int devfn, int where, u32 *val)
155{
156 u32 v;
157 int ret;
158
159 if (where & 0x1)
160 return -EINVAL;
161 ret = grpci1_cfg_r32(priv, bus, devfn, where & ~0x3, &v);
162 *val = 0xffff & (v >> (8 * (where & 0x3)));
163 return ret;
164}
165
166static int grpci1_cfg_r8(struct grpci1_priv *priv, unsigned int bus,
167 unsigned int devfn, int where, u32 *val)
168{
169 u32 v;
170 int ret;
171
172 ret = grpci1_cfg_r32(priv, bus, devfn, where & ~0x3, &v);
173 *val = 0xff & (v >> (8 * (where & 3)));
174
175 return ret;
176}
177
178static int grpci1_cfg_w32(struct grpci1_priv *priv, unsigned int bus,
179 unsigned int devfn, int where, u32 val)
180{
181 unsigned int *pci_conf;
182 u32 cfg;
183
184 if (where & 0x3)
185 return -EINVAL;
186
187 if (bus == 0) {
188 devfn += (0x8 * 6); /* start at AD16=Device0 */
189 } else if (bus == TGT) {
190 bus = 0;
191 devfn = 0; /* special case: bridge controller itself */
192 }
193
194 /* Select bus */
195 cfg = REGLOAD(priv->regs->cfg_stat);
196 REGSTORE(priv->regs->cfg_stat, (cfg & ~(0xf << 23)) | (bus << 23));
197
198 pci_conf = (unsigned int *) (priv->pci_conf |
199 (devfn << 8) | (where & 0xfc));
200 LEON3_BYPASS_STORE_PA(pci_conf, flip_dword(val));
201
202 return 0;
203}
204
205static int grpci1_cfg_w16(struct grpci1_priv *priv, unsigned int bus,
206 unsigned int devfn, int where, u32 val)
207{
208 int ret;
209 u32 v;
210
211 if (where & 0x1)
212 return -EINVAL;
213 ret = grpci1_cfg_r32(priv, bus, devfn, where&~3, &v);
214 if (ret)
215 return ret;
216 v = (v & ~(0xffff << (8 * (where & 0x3)))) |
217 ((0xffff & val) << (8 * (where & 0x3)));
218 return grpci1_cfg_w32(priv, bus, devfn, where & ~0x3, v);
219}
220
221static int grpci1_cfg_w8(struct grpci1_priv *priv, unsigned int bus,
222 unsigned int devfn, int where, u32 val)
223{
224 int ret;
225 u32 v;
226
227 ret = grpci1_cfg_r32(priv, bus, devfn, where & ~0x3, &v);
228 if (ret != 0)
229 return ret;
230 v = (v & ~(0xff << (8 * (where & 0x3)))) |
231 ((0xff & val) << (8 * (where & 0x3)));
232 return grpci1_cfg_w32(priv, bus, devfn, where & ~0x3, v);
233}
234
235/* Read from Configuration Space. When entering here the PCI layer has taken
236 * the pci_lock spinlock and IRQ is off.
237 */
238static int grpci1_read_config(struct pci_bus *bus, unsigned int devfn,
239 int where, int size, u32 *val)
240{
241 struct grpci1_priv *priv = grpci1priv;
242 unsigned int busno = bus->number;
243 int ret;
244
245 if (PCI_SLOT(devfn) > 15 || busno > 15) {
246 *val = ~0;
247 return 0;
248 }
249
250 switch (size) {
251 case 1:
252 ret = grpci1_cfg_r8(priv, busno, devfn, where, val);
253 break;
254 case 2:
255 ret = grpci1_cfg_r16(priv, busno, devfn, where, val);
256 break;
257 case 4:
258 ret = grpci1_cfg_r32(priv, busno, devfn, where, val);
259 break;
260 default:
261 ret = -EINVAL;
262 break;
263 }
264
265#ifdef GRPCI1_DEBUG_CFGACCESS
266 printk(KERN_INFO
267 "grpci1_read_config: [%02x:%02x:%x] ofs=%d val=%x size=%d\n",
268 busno, PCI_SLOT(devfn), PCI_FUNC(devfn), where, *val, size);
269#endif
270
271 return ret;
272}
273
274/* Write to Configuration Space. When entering here the PCI layer has taken
275 * the pci_lock spinlock and IRQ is off.
276 */
277static int grpci1_write_config(struct pci_bus *bus, unsigned int devfn,
278 int where, int size, u32 val)
279{
280 struct grpci1_priv *priv = grpci1priv;
281 unsigned int busno = bus->number;
282
283 if (PCI_SLOT(devfn) > 15 || busno > 15)
284 return 0;
285
286#ifdef GRPCI1_DEBUG_CFGACCESS
287 printk(KERN_INFO
288 "grpci1_write_config: [%02x:%02x:%x] ofs=%d size=%d val=%x\n",
289 busno, PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val);
290#endif
291
292 switch (size) {
293 default:
294 return -EINVAL;
295 case 1:
296 return grpci1_cfg_w8(priv, busno, devfn, where, val);
297 case 2:
298 return grpci1_cfg_w16(priv, busno, devfn, where, val);
299 case 4:
300 return grpci1_cfg_w32(priv, busno, devfn, where, val);
301 }
302}
303
304static struct pci_ops grpci1_ops = {
305 .read = grpci1_read_config,
306 .write = grpci1_write_config,
307};
308
309/* GENIRQ IRQ chip implementation for grpci1 irqmode=0..2. In configuration
310 * 3 where all PCI Interrupts has a separate IRQ on the system IRQ controller
311 * this is not needed and the standard IRQ controller can be used.
312 */
313
314static void grpci1_mask_irq(struct irq_data *data)
315{
316 u32 irqidx;
317 struct grpci1_priv *priv = grpci1priv;
318
319 irqidx = (u32)data->chip_data - 1;
320 if (irqidx > 3) /* only mask PCI interrupts here */
321 return;
322 irqidx += IRQ_MASK_BIT;
323
324 REGSTORE(priv->regs->irq, REGLOAD(priv->regs->irq) & ~(1 << irqidx));
325}
326
327static void grpci1_unmask_irq(struct irq_data *data)
328{
329 u32 irqidx;
330 struct grpci1_priv *priv = grpci1priv;
331
332 irqidx = (u32)data->chip_data - 1;
333 if (irqidx > 3) /* only unmask PCI interrupts here */
334 return;
335 irqidx += IRQ_MASK_BIT;
336
337 REGSTORE(priv->regs->irq, REGLOAD(priv->regs->irq) | (1 << irqidx));
338}
339
340static unsigned int grpci1_startup_irq(struct irq_data *data)
341{
342 grpci1_unmask_irq(data);
343 return 0;
344}
345
346static void grpci1_shutdown_irq(struct irq_data *data)
347{
348 grpci1_mask_irq(data);
349}
350
351static struct irq_chip grpci1_irq = {
352 .name = "grpci1",
353 .irq_startup = grpci1_startup_irq,
354 .irq_shutdown = grpci1_shutdown_irq,
355 .irq_mask = grpci1_mask_irq,
356 .irq_unmask = grpci1_unmask_irq,
357};
358
359/* Handle one or multiple IRQs from the PCI core */
360static void grpci1_pci_flow_irq(unsigned int irq, struct irq_desc *desc)
361{
362 struct grpci1_priv *priv = grpci1priv;
363 int i, ack = 0;
364 unsigned int irqreg;
365
366 irqreg = REGLOAD(priv->regs->irq);
367 irqreg = (irqreg >> IRQ_MASK_BIT) & irqreg;
368
369 /* Error Interrupt? */
370 if (irqreg & IRQ_ALL_ERRORS) {
371 generic_handle_irq(priv->irq_err);
372 ack = 1;
373 }
374
375 /* PCI Interrupt? */
376 if (irqreg & IRQ_INTX) {
377 /* Call respective PCI Interrupt handler */
378 for (i = 0; i < 4; i++) {
379 if (irqreg & (1 << i))
380 generic_handle_irq(priv->irq_map[i]);
381 }
382 ack = 1;
383 }
384
385 /*
386 * Call "first level" IRQ chip end-of-irq handler. It will ACK LEON IRQ
387 * Controller, this must be done after IRQ sources have been handled to
388 * avoid double IRQ generation
389 */
390 if (ack)
391 desc->irq_data.chip->irq_eoi(&desc->irq_data);
392}
393
394/* Create a virtual IRQ */
395static unsigned int grpci1_build_device_irq(unsigned int irq)
396{
397 unsigned int virq = 0, pil;
398
399 pil = 1 << 8;
400 virq = irq_alloc(irq, pil);
401 if (virq == 0)
402 goto out;
403
404 irq_set_chip_and_handler_name(virq, &grpci1_irq, handle_simple_irq,
405 "pcilvl");
406 irq_set_chip_data(virq, (void *)irq);
407
408out:
409 return virq;
410}
411
412/*
413 * Initialize mappings AMBA<->PCI, clear IRQ state, setup PCI interface
414 *
415 * Target BARs:
416 * BAR0: unused in this implementation
417 * BAR1: peripheral DMA to host's memory (size at least 256MByte)
418 * BAR2..BAR5: not implemented in hardware
419 */
420void grpci1_hw_init(struct grpci1_priv *priv)
421{
422 u32 ahbadr, bar_sz, data, pciadr;
423 struct grpci1_regs *regs = priv->regs;
424
425 /* set 1:1 mapping between AHB -> PCI memory space */
426 REGSTORE(regs->cfg_stat, priv->pci_area & 0xf0000000);
427
428 /* map PCI accesses to target BAR1 to Linux kernel memory 1:1 */
429 ahbadr = 0xf0000000 & (u32)__pa(PAGE_ALIGN((unsigned long) &_end));
430 REGSTORE(regs->page1, ahbadr);
431
432 /* translate I/O accesses to 0, I/O Space always @ PCI low 64Kbytes */
433 REGSTORE(regs->iomap, REGLOAD(regs->iomap) & 0x0000ffff);
434
435 /* disable and clear pending interrupts */
436 REGSTORE(regs->irq, 0);
437
438 /* Setup BAR0 outside access range so that it does not conflict with
439 * peripheral DMA. There is no need to set up the PAGE0 register.
440 */
441 grpci1_cfg_w32(priv, TGT, 0, PCI_BASE_ADDRESS_0, 0xffffffff);
442 grpci1_cfg_r32(priv, TGT, 0, PCI_BASE_ADDRESS_0, &bar_sz);
443 bar_sz = ~bar_sz + 1;
444 pciadr = priv->pci_area - bar_sz;
445 grpci1_cfg_w32(priv, TGT, 0, PCI_BASE_ADDRESS_0, pciadr);
446
447 /*
448 * Setup the Host's PCI Target BAR1 for other peripherals to access,
449 * and do DMA to the host's memory.
450 */
451 grpci1_cfg_w32(priv, TGT, 0, PCI_BASE_ADDRESS_1, ahbadr);
452
453 /*
454 * Setup Latency Timer and cache line size. Default cache line
455 * size will result in poor performance (256 word fetches), 0xff
456 * will set it according to the max size of the PCI FIFO.
457 */
458 grpci1_cfg_w8(priv, TGT, 0, PCI_CACHE_LINE_SIZE, 0xff);
459 grpci1_cfg_w8(priv, TGT, 0, PCI_LATENCY_TIMER, 0x40);
460
461 /* set as bus master, enable pci memory responses, clear status bits */
462 grpci1_cfg_r32(priv, TGT, 0, PCI_COMMAND, &data);
463 data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
464 grpci1_cfg_w32(priv, TGT, 0, PCI_COMMAND, data);
465}
466
467static irqreturn_t grpci1_jump_interrupt(int irq, void *arg)
468{
469 struct grpci1_priv *priv = arg;
470 dev_err(priv->dev, "Jump IRQ happened\n");
471 return IRQ_NONE;
472}
473
474/* Handle GRPCI1 Error Interrupt */
475static irqreturn_t grpci1_err_interrupt(int irq, void *arg)
476{
477 struct grpci1_priv *priv = arg;
478 u32 status;
479
480 grpci1_cfg_r16(priv, TGT, 0, PCI_STATUS, &status);
481 status &= priv->pci_err_mask;
482
483 if (status == 0)
484 return IRQ_NONE;
485
486 if (status & PCI_STATUS_PARITY)
487 dev_err(priv->dev, "Data Parity Error\n");
488
489 if (status & PCI_STATUS_SIG_TARGET_ABORT)
490 dev_err(priv->dev, "Signalled Target Abort\n");
491
492 if (status & PCI_STATUS_REC_TARGET_ABORT)
493 dev_err(priv->dev, "Received Target Abort\n");
494
495 if (status & PCI_STATUS_REC_MASTER_ABORT)
496 dev_err(priv->dev, "Received Master Abort\n");
497
498 if (status & PCI_STATUS_SIG_SYSTEM_ERROR)
499 dev_err(priv->dev, "Signalled System Error\n");
500
501 if (status & PCI_STATUS_DETECTED_PARITY)
502 dev_err(priv->dev, "Parity Error\n");
503
504 /* Clear handled INT TYPE IRQs */
505 grpci1_cfg_w16(priv, TGT, 0, PCI_STATUS, status);
506
507 return IRQ_HANDLED;
508}
509
510static int grpci1_of_probe(struct platform_device *ofdev)
511{
512 struct grpci1_regs *regs;
513 struct grpci1_priv *priv;
514 int err, len;
515 const int *tmp;
516 u32 cfg, size, err_mask;
517 struct resource *res;
518
519 if (grpci1priv) {
520 dev_err(&ofdev->dev, "only one GRPCI1 supported\n");
521 return -ENODEV;
522 }
523
524 if (ofdev->num_resources < 3) {
525 dev_err(&ofdev->dev, "not enough APB/AHB resources\n");
526 return -EIO;
527 }
528
529 priv = devm_kzalloc(&ofdev->dev, sizeof(*priv), GFP_KERNEL);
530 if (!priv) {
531 dev_err(&ofdev->dev, "memory allocation failed\n");
532 return -ENOMEM;
533 }
534 platform_set_drvdata(ofdev, priv);
535 priv->dev = &ofdev->dev;
536
537 /* find device register base address */
538 res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
539 regs = devm_request_and_ioremap(&ofdev->dev, res);
540 if (!regs) {
541 dev_err(&ofdev->dev, "io-regs mapping failed\n");
542 return -EADDRNOTAVAIL;
543 }
544
545 /*
546 * check that we're in Host Slot and that we can act as a Host Bridge
547 * and not only as target/peripheral.
548 */
549 cfg = REGLOAD(regs->cfg_stat);
550 if ((cfg & CFGSTAT_HOST) == 0) {
551 dev_err(&ofdev->dev, "not in host system slot\n");
552 return -EIO;
553 }
554
555 /* check that BAR1 support 256 MByte so that we can map kernel space */
556 REGSTORE(regs->page1, 0xffffffff);
557 size = ~REGLOAD(regs->page1) + 1;
558 if (size < 0x10000000) {
559 dev_err(&ofdev->dev, "BAR1 must be at least 256MByte\n");
560 return -EIO;
561 }
562
563 /* hardware must support little-endian PCI (byte-twisting) */
564 if ((REGLOAD(regs->page0) & PAGE0_BTEN) == 0) {
565 dev_err(&ofdev->dev, "byte-twisting is required\n");
566 return -EIO;
567 }
568
569 priv->regs = regs;
570 priv->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
571 dev_info(&ofdev->dev, "host found at 0x%p, irq%d\n", regs, priv->irq);
572
573 /* Find PCI Memory, I/O and Configuration Space Windows */
574 priv->pci_area = ofdev->resource[1].start;
575 priv->pci_area_end = ofdev->resource[1].end+1;
576 priv->pci_io = ofdev->resource[2].start;
577 priv->pci_conf = ofdev->resource[2].start + 0x10000;
578 priv->pci_conf_end = priv->pci_conf + 0x10000;
579 priv->pci_io_va = (unsigned long)ioremap(priv->pci_io, 0x10000);
580 if (!priv->pci_io_va) {
581 dev_err(&ofdev->dev, "unable to map PCI I/O area\n");
582 return -EIO;
583 }
584
585 printk(KERN_INFO
586 "GRPCI1: MEMORY SPACE [0x%08lx - 0x%08lx]\n"
587 " I/O SPACE [0x%08lx - 0x%08lx]\n"
588 " CONFIG SPACE [0x%08lx - 0x%08lx]\n",
589 priv->pci_area, priv->pci_area_end-1,
590 priv->pci_io, priv->pci_conf-1,
591 priv->pci_conf, priv->pci_conf_end-1);
592
593 /*
594 * I/O Space resources in I/O Window mapped into Virtual Adr Space
595 * We never use low 4KB because some devices seem have problems using
596 * address 0.
597 */
598 priv->info.io_space.name = "GRPCI1 PCI I/O Space";
599 priv->info.io_space.start = priv->pci_io_va + 0x1000;
600 priv->info.io_space.end = priv->pci_io_va + 0x10000 - 1;
601 priv->info.io_space.flags = IORESOURCE_IO;
602
603 /*
604 * grpci1 has no prefetchable memory, map everything as
605 * non-prefetchable memory
606 */
607 priv->info.mem_space.name = "GRPCI1 PCI MEM Space";
608 priv->info.mem_space.start = priv->pci_area;
609 priv->info.mem_space.end = priv->pci_area_end - 1;
610 priv->info.mem_space.flags = IORESOURCE_MEM;
611
612 if (request_resource(&iomem_resource, &priv->info.mem_space) < 0) {
613 dev_err(&ofdev->dev, "unable to request PCI memory area\n");
614 err = -ENOMEM;
615 goto err1;
616 }
617
618 if (request_resource(&ioport_resource, &priv->info.io_space) < 0) {
619 dev_err(&ofdev->dev, "unable to request PCI I/O area\n");
620 err = -ENOMEM;
621 goto err2;
622 }
623
624 /* setup maximum supported PCI buses */
625 priv->info.busn.name = "GRPCI1 busn";
626 priv->info.busn.start = 0;
627 priv->info.busn.end = 15;
628
629 grpci1priv = priv;
630
631 /* Initialize hardware */
632 grpci1_hw_init(priv);
633
634 /*
635 * Get PCI Interrupt to System IRQ mapping and setup IRQ handling
636 * Error IRQ. All PCI and PCI-Error interrupts are shared using the
637 * same system IRQ.
638 */
639 leon_update_virq_handling(priv->irq, grpci1_pci_flow_irq, "pcilvl", 0);
640
641 priv->irq_map[0] = grpci1_build_device_irq(1);
642 priv->irq_map[1] = grpci1_build_device_irq(2);
643 priv->irq_map[2] = grpci1_build_device_irq(3);
644 priv->irq_map[3] = grpci1_build_device_irq(4);
645 priv->irq_err = grpci1_build_device_irq(5);
646
647 printk(KERN_INFO " PCI INTA..D#: IRQ%d, IRQ%d, IRQ%d, IRQ%d\n",
648 priv->irq_map[0], priv->irq_map[1], priv->irq_map[2],
649 priv->irq_map[3]);
650
651 /* Enable IRQs on LEON IRQ controller */
652 err = devm_request_irq(&ofdev->dev, priv->irq, grpci1_jump_interrupt, 0,
653 "GRPCI1_JUMP", priv);
654 if (err) {
655 dev_err(&ofdev->dev, "ERR IRQ request failed: %d\n", err);
656 goto err3;
657 }
658
659 /* Setup IRQ handler for access errors */
660 err = devm_request_irq(&ofdev->dev, priv->irq_err,
661 grpci1_err_interrupt, IRQF_SHARED, "GRPCI1_ERR",
662 priv);
663 if (err) {
664 dev_err(&ofdev->dev, "ERR VIRQ request failed: %d\n", err);
665 goto err3;
666 }
667
668 tmp = of_get_property(ofdev->dev.of_node, "all_pci_errors", &len);
669 if (tmp && (len == 4)) {
670 priv->pci_err_mask = ALL_PCI_ERRORS;
671 err_mask = IRQ_ALL_ERRORS << IRQ_MASK_BIT;
672 } else {
673 priv->pci_err_mask = DEF_PCI_ERRORS;
674 err_mask = IRQ_DEF_ERRORS << IRQ_MASK_BIT;
675 }
676
677 /*
678 * Enable Error Interrupts. PCI interrupts are unmasked once request_irq
679 * is called by the PCI Device drivers
680 */
681 REGSTORE(regs->irq, err_mask);
682
683 /* Init common layer and scan buses */
684 priv->info.ops = &grpci1_ops;
685 priv->info.map_irq = grpci1_map_irq;
686 leon_pci_init(ofdev, &priv->info);
687
688 return 0;
689
690err3:
691 release_resource(&priv->info.io_space);
692err2:
693 release_resource(&priv->info.mem_space);
694err1:
695 iounmap((void *)priv->pci_io_va);
696 grpci1priv = NULL;
697 return err;
698}
699
700static struct of_device_id grpci1_of_match[] = {
701 {
702 .name = "GAISLER_PCIFBRG",
703 },
704 {
705 .name = "01_014",
706 },
707 {},
708};
709
710static struct platform_driver grpci1_of_driver = {
711 .driver = {
712 .name = "grpci1",
713 .owner = THIS_MODULE,
714 .of_match_table = grpci1_of_match,
715 },
716 .probe = grpci1_of_probe,
717};
718
719static int __init grpci1_init(void)
720{
721 return platform_driver_register(&grpci1_of_driver);
722}
723
724subsys_initcall(grpci1_init);
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index 4d1487138d26..5f0402aab7fb 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -799,6 +799,11 @@ static int grpci2_of_probe(struct platform_device *ofdev)
799 if (request_resource(&ioport_resource, &priv->info.io_space) < 0) 799 if (request_resource(&ioport_resource, &priv->info.io_space) < 0)
800 goto err4; 800 goto err4;
801 801
802 /* setup maximum supported PCI buses */
803 priv->info.busn.name = "GRPCI2 busn";
804 priv->info.busn.start = 0;
805 priv->info.busn.end = 255;
806
802 grpci2_hw_init(priv); 807 grpci2_hw_init(priv);
803 808
804 /* 809 /*
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c
index 708bca435219..bdf53d9a8d46 100644
--- a/arch/sparc/kernel/leon_pmc.c
+++ b/arch/sparc/kernel/leon_pmc.c
@@ -48,7 +48,7 @@ void pmc_leon_idle_fixup(void)
48 */ 48 */
49 register unsigned int address = (unsigned int)leon3_irqctrl_regs; 49 register unsigned int address = (unsigned int)leon3_irqctrl_regs;
50 __asm__ __volatile__ ( 50 __asm__ __volatile__ (
51 "mov %%g0, %%asr19\n" 51 "wr %%g0, %%asr19\n"
52 "lda [%0] %1, %%g0\n" 52 "lda [%0] %1, %%g0\n"
53 : 53 :
54 : "r"(address), "i"(ASI_LEON_BYPASS)); 54 : "r"(address), "i"(ASI_LEON_BYPASS));
@@ -61,7 +61,7 @@ void pmc_leon_idle_fixup(void)
61void pmc_leon_idle(void) 61void pmc_leon_idle(void)
62{ 62{
63 /* For systems without power-down, this will be no-op */ 63 /* For systems without power-down, this will be no-op */
64 __asm__ __volatile__ ("mov %g0, %asr19\n\t"); 64 __asm__ __volatile__ ("wr %g0, %asr19\n\t");
65} 65}
66 66
67/* Install LEON Power Down function */ 67/* Install LEON Power Down function */
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 62eede13831a..fdd819dfdacf 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -64,23 +64,12 @@ extern void fpsave(unsigned long *, unsigned long *, void *, unsigned long *);
64struct task_struct *last_task_used_math = NULL; 64struct task_struct *last_task_used_math = NULL;
65struct thread_info *current_set[NR_CPUS]; 65struct thread_info *current_set[NR_CPUS];
66 66
67/* 67/* Idle loop support. */
68 * the idle loop on a Sparc... ;) 68void arch_cpu_idle(void)
69 */
70void cpu_idle(void)
71{ 69{
72 set_thread_flag(TIF_POLLING_NRFLAG); 70 if (sparc_idle)
73 71 (*sparc_idle)();
74 /* endless idle loop with no priority at all */ 72 local_irq_enable();
75 for (;;) {
76 while (!need_resched()) {
77 if (sparc_idle)
78 (*sparc_idle)();
79 else
80 cpu_relax();
81 }
82 schedule_preempt_disabled();
83 }
84} 73}
85 74
86/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */ 75/* XXX cli/sti -> local_irq_xxx here, check this works once SMP is fixed. */
@@ -123,6 +112,8 @@ void show_regs(struct pt_regs *r)
123{ 112{
124 struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14]; 113 struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14];
125 114
115 show_regs_print_info(KERN_DEFAULT);
116
126 printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n", 117 printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n",
127 r->psr, r->pc, r->npc, r->y, print_tainted()); 118 r->psr, r->pc, r->npc, r->y, print_tainted());
128 printk("PC: <%pS>\n", (void *) r->pc); 119 printk("PC: <%pS>\n", (void *) r->pc);
@@ -153,11 +144,13 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
153 struct reg_window32 *rw; 144 struct reg_window32 *rw;
154 int count = 0; 145 int count = 0;
155 146
156 if (tsk != NULL) 147 if (!tsk)
157 task_base = (unsigned long) task_stack_page(tsk); 148 tsk = current;
158 else
159 task_base = (unsigned long) current_thread_info();
160 149
150 if (tsk == current && !_ksp)
151 __asm__ __volatile__("mov %%fp, %0" : "=r" (_ksp));
152
153 task_base = (unsigned long) task_stack_page(tsk);
161 fp = (unsigned long) _ksp; 154 fp = (unsigned long) _ksp;
162 do { 155 do {
163 /* Bogus frame pointer? */ 156 /* Bogus frame pointer? */
@@ -173,17 +166,6 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
173 printk("\n"); 166 printk("\n");
174} 167}
175 168
176void dump_stack(void)
177{
178 unsigned long *ksp;
179
180 __asm__ __volatile__("mov %%fp, %0"
181 : "=r" (ksp));
182 show_stack(current, ksp);
183}
184
185EXPORT_SYMBOL(dump_stack);
186
187/* 169/*
188 * Note: sparc64 has a pretty intricated thread_saved_pc, check it out. 170 * Note: sparc64 has a pretty intricated thread_saved_pc, check it out.
189 */ 171 */
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index cdb80b2adbe0..baebab215492 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -52,20 +52,17 @@
52 52
53#include "kstack.h" 53#include "kstack.h"
54 54
55static void sparc64_yield(int cpu) 55/* Idle loop support on sparc64. */
56void arch_cpu_idle(void)
56{ 57{
57 if (tlb_type != hypervisor) { 58 if (tlb_type != hypervisor) {
58 touch_nmi_watchdog(); 59 touch_nmi_watchdog();
59 return; 60 } else {
60 }
61
62 clear_thread_flag(TIF_POLLING_NRFLAG);
63 smp_mb__after_clear_bit();
64
65 while (!need_resched() && !cpu_is_offline(cpu)) {
66 unsigned long pstate; 61 unsigned long pstate;
67 62
68 /* Disable interrupts. */ 63 /* The sun4v sleeping code requires that we have PSTATE.IE cleared over
64 * the cpu sleep hypervisor call.
65 */
69 __asm__ __volatile__( 66 __asm__ __volatile__(
70 "rdpr %%pstate, %0\n\t" 67 "rdpr %%pstate, %0\n\t"
71 "andn %0, %1, %0\n\t" 68 "andn %0, %1, %0\n\t"
@@ -73,7 +70,7 @@ static void sparc64_yield(int cpu)
73 : "=&r" (pstate) 70 : "=&r" (pstate)
74 : "i" (PSTATE_IE)); 71 : "i" (PSTATE_IE));
75 72
76 if (!need_resched() && !cpu_is_offline(cpu)) 73 if (!need_resched() && !cpu_is_offline(smp_processor_id()))
77 sun4v_cpu_yield(); 74 sun4v_cpu_yield();
78 75
79 /* Re-enable interrupts. */ 76 /* Re-enable interrupts. */
@@ -84,36 +81,16 @@ static void sparc64_yield(int cpu)
84 : "=&r" (pstate) 81 : "=&r" (pstate)
85 : "i" (PSTATE_IE)); 82 : "i" (PSTATE_IE));
86 } 83 }
87 84 local_irq_enable();
88 set_thread_flag(TIF_POLLING_NRFLAG);
89} 85}
90 86
91/* The idle loop on sparc64. */
92void cpu_idle(void)
93{
94 int cpu = smp_processor_id();
95
96 set_thread_flag(TIF_POLLING_NRFLAG);
97
98 while(1) {
99 tick_nohz_idle_enter();
100 rcu_idle_enter();
101
102 while (!need_resched() && !cpu_is_offline(cpu))
103 sparc64_yield(cpu);
104
105 rcu_idle_exit();
106 tick_nohz_idle_exit();
107
108#ifdef CONFIG_HOTPLUG_CPU 87#ifdef CONFIG_HOTPLUG_CPU
109 if (cpu_is_offline(cpu)) { 88void arch_cpu_idle_dead()
110 sched_preempt_enable_no_resched(); 89{
111 cpu_play_dead(); 90 sched_preempt_enable_no_resched();
112 } 91 cpu_play_dead();
113#endif
114 schedule_preempt_disabled();
115 }
116} 92}
93#endif
117 94
118#ifdef CONFIG_COMPAT 95#ifdef CONFIG_COMPAT
119static void show_regwindow32(struct pt_regs *regs) 96static void show_regwindow32(struct pt_regs *regs)
@@ -186,6 +163,8 @@ static void show_regwindow(struct pt_regs *regs)
186 163
187void show_regs(struct pt_regs *regs) 164void show_regs(struct pt_regs *regs)
188{ 165{
166 show_regs_print_info(KERN_DEFAULT);
167
189 printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate, 168 printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate,
190 regs->tpc, regs->tnpc, regs->y, print_tainted()); 169 regs->tpc, regs->tnpc, regs->y, print_tainted());
191 printk("TPC: <%pS>\n", (void *) regs->tpc); 170 printk("TPC: <%pS>\n", (void *) regs->tpc);
@@ -315,7 +294,7 @@ static void sysrq_handle_globreg(int key)
315 294
316static struct sysrq_key_op sparc_globalreg_op = { 295static struct sysrq_key_op sparc_globalreg_op = {
317 .handler = sysrq_handle_globreg, 296 .handler = sysrq_handle_globreg,
318 .help_msg = "global-regs(Y)", 297 .help_msg = "global-regs(y)",
319 .action_msg = "Show Global CPU Regs", 298 .action_msg = "Show Global CPU Regs",
320}; 299};
321 300
@@ -385,7 +364,7 @@ static void sysrq_handle_globpmu(int key)
385 364
386static struct sysrq_key_op sparc_globalpmu_op = { 365static struct sysrq_key_op sparc_globalpmu_op = {
387 .handler = sysrq_handle_globpmu, 366 .handler = sysrq_handle_globpmu,
388 .help_msg = "global-pmu(X)", 367 .help_msg = "global-pmu(x)",
389 .action_msg = "Show Global PMU Regs", 368 .action_msg = "Show Global PMU Regs",
390}; 369};
391 370
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index 9e7e6d718367..e3f2b81c23f1 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -369,7 +369,7 @@ void __cpuinit sparc_start_secondary(void *arg)
369 local_irq_enable(); 369 local_irq_enable();
370 370
371 wmb(); 371 wmb();
372 cpu_idle(); 372 cpu_startup_entry(CPUHP_ONLINE);
373 373
374 /* We should never reach here! */ 374 /* We should never reach here! */
375 BUG(); 375 BUG();
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index ca64d2a86ec0..77539eda928c 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -127,6 +127,8 @@ void __cpuinit smp_callin(void)
127 127
128 /* idle thread is expected to have preempt disabled */ 128 /* idle thread is expected to have preempt disabled */
129 preempt_disable(); 129 preempt_disable();
130
131 cpu_startup_entry(CPUHP_ONLINE);
130} 132}
131 133
132void cpu_panic(void) 134void cpu_panic(void)
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index e490ac9327c7..f8933be3ca8b 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8#include <linux/kernel_stat.h> 8#include <linux/kernel_stat.h>
9#include <linux/slab.h>
9#include <linux/seq_file.h> 10#include <linux/seq_file.h>
10 11
11#include <asm/timer.h> 12#include <asm/timer.h>
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S
index 240a3cecc11e..2e680b5245c9 100644
--- a/arch/sparc/kernel/sys32.S
+++ b/arch/sparc/kernel/sys32.S
@@ -36,7 +36,6 @@ STUB: sra REG1, 0, REG1; \
36 jmpl %g1 + %lo(SYSCALL), %g0; \ 36 jmpl %g1 + %lo(SYSCALL), %g0; \
37 sra REG3, 0, REG3 37 sra REG3, 0, REG3
38 38
39SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
40SIGN1(sys32_readahead, compat_sys_readahead, %o0) 39SIGN1(sys32_readahead, compat_sys_readahead, %o0)
41SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4) 40SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
42SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5) 41SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
@@ -46,12 +45,9 @@ SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
46SIGN1(sys32_mq_open, compat_sys_mq_open, %o1) 45SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
47SIGN1(sys32_select, compat_sys_select, %o0) 46SIGN1(sys32_select, compat_sys_select, %o0)
48SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5) 47SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5)
49SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
50SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) 48SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0)
51SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) 49SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
52SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) 50SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
53SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5)
54SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0)
55 51
56 .globl sys32_mmap2 52 .globl sys32_mmap2
57sys32_mmap2: 53sys32_mmap2:
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index f38f2280fade..3d0ddbc005fe 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -49,71 +49,6 @@
49#include <asm/mmu_context.h> 49#include <asm/mmu_context.h>
50#include <asm/compat_signal.h> 50#include <asm/compat_signal.h>
51 51
52#ifdef CONFIG_SYSVIPC
53asmlinkage long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, u32 fifth)
54{
55 int version;
56
57 version = call >> 16; /* hack for backward compatibility */
58 call &= 0xffff;
59
60 switch (call) {
61 case SEMTIMEDOP:
62 if (fifth)
63 /* sign extend semid */
64 return compat_sys_semtimedop((int)first,
65 compat_ptr(ptr), second,
66 compat_ptr(fifth));
67 /* else fall through for normal semop() */
68 case SEMOP:
69 /* struct sembuf is the same on 32 and 64bit :)) */
70 /* sign extend semid */
71 return sys_semtimedop((int)first, compat_ptr(ptr), second,
72 NULL);
73 case SEMGET:
74 /* sign extend key, nsems */
75 return sys_semget((int)first, (int)second, third);
76 case SEMCTL:
77 /* sign extend semid, semnum */
78 return compat_sys_semctl((int)first, (int)second, third,
79 compat_ptr(ptr));
80
81 case MSGSND:
82 /* sign extend msqid */
83 return compat_sys_msgsnd((int)first, (int)second, third,
84 compat_ptr(ptr));
85 case MSGRCV:
86 /* sign extend msqid, msgtyp */
87 return compat_sys_msgrcv((int)first, second, (int)fifth,
88 third, version, compat_ptr(ptr));
89 case MSGGET:
90 /* sign extend key */
91 return sys_msgget((int)first, second);
92 case MSGCTL:
93 /* sign extend msqid */
94 return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
95
96 case SHMAT:
97 /* sign extend shmid */
98 return compat_sys_shmat((int)first, second, third, version,
99 compat_ptr(ptr));
100 case SHMDT:
101 return sys_shmdt(compat_ptr(ptr));
102 case SHMGET:
103 /* sign extend key_t */
104 return sys_shmget((int)first, second, third);
105 case SHMCTL:
106 /* sign extend shmid */
107 return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
108
109 default:
110 return -ENOSYS;
111 }
112
113 return -ENOSYS;
114}
115#endif
116
117asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 52asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
118{ 53{
119 if ((int)high < 0) 54 if ((int)high < 0)
@@ -303,15 +238,7 @@ long compat_sys_fadvise64_64(int fd,
303 advice); 238 advice);
304} 239}
305 240
306long sys32_lookup_dcookie(unsigned long cookie_high, 241long sys32_sync_file_range(unsigned int fd, unsigned long off_high, unsigned long off_low, unsigned long nb_high, unsigned long nb_low, unsigned int flags)
307 unsigned long cookie_low,
308 char __user *buf, size_t len)
309{
310 return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
311 buf, len);
312}
313
314long compat_sync_file_range(int fd, unsigned long off_high, unsigned long off_low, unsigned long nb_high, unsigned long nb_low, int flags)
315{ 242{
316 return sys_sync_file_range(fd, 243 return sys_sync_file_range(fd,
317 (off_high << 32) | off_low, 244 (off_high << 32) | off_low,
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 708bc29d36a8..2daaaa6eda23 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -353,7 +353,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second
353 case SEMCTL: { 353 case SEMCTL: {
354 err = sys_semctl(first, second, 354 err = sys_semctl(first, second,
355 (int)third | IPC_64, 355 (int)third | IPC_64,
356 (union semun) ptr); 356 (unsigned long) ptr);
357 goto out; 357 goto out;
358 } 358 }
359 default: 359 default:
@@ -470,10 +470,6 @@ SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len)
470 470
471 return vm_munmap(addr, len); 471 return vm_munmap(addr, len);
472} 472}
473
474extern unsigned long do_mremap(unsigned long addr,
475 unsigned long old_len, unsigned long new_len,
476 unsigned long flags, unsigned long new_addr);
477 473
478SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len, 474SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len,
479 unsigned long, new_len, unsigned long, flags, 475 unsigned long, new_len, unsigned long, flags,
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 088134834dab..8fd932080215 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -23,9 +23,9 @@ sys_call_table32:
23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod 23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, compat_sys_lseek 24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, compat_sys_lseek
25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, compat_sys_sigaltstack, sys_pause 26/*25*/ .word compat_sys_vmsplice, compat_sys_ptrace, sys_alarm, compat_sys_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
28 .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile 28 .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, compat_sys_sendfile
29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid 29/*40*/ .word compat_sys_newlstat, sys_dup, sys_sparc_pipe, compat_sys_times, sys_getuid
30 .word sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16 30 .word sys_umount, sys_setgid16, sys_getgid16, sys_signal, sys_geteuid16
31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl 31/*50*/ .word sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
@@ -41,7 +41,7 @@ sys_call_table32:
41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending 41/*100*/ .word sys_getpriority, sys32_rt_sigreturn, compat_sys_rt_sigaction, compat_sys_rt_sigprocmask, compat_sys_rt_sigpending
42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid 42 .word compat_sys_rt_sigtimedwait, compat_sys_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid
43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall 43/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
44 .word sys_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd 44 .word sys_getgroups, compat_sys_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd
45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod 45/*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod
46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate 46 .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate
47/*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall 47/*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall
@@ -59,7 +59,7 @@ sys_call_table32:
59/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl 59/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
60 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, compat_sys_sparc_sigaction, sys_sgetmask 60 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, compat_sys_sparc_sigaction, sys_sgetmask
61/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 61/*200*/ .word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
62 .word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64 62 .word sys32_readahead, sys32_socketcall, sys_syslog, compat_sys_lookup_dcookie, sys32_fadvise64
63/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, compat_sys_sysinfo 63/*210*/ .word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, compat_sys_sysinfo
64 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys_ioprio_get, compat_sys_adjtimex 64 .word compat_sys_ipc, sys32_sigreturn, sys_clone, sys_ioprio_get, compat_sys_adjtimex
65/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid 65/*220*/ .word compat_sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
diff --git a/arch/sparc/kernel/trampoline_64.S b/arch/sparc/kernel/trampoline_64.S
index da1b781b5e65..2e973a26fbda 100644
--- a/arch/sparc/kernel/trampoline_64.S
+++ b/arch/sparc/kernel/trampoline_64.S
@@ -407,8 +407,7 @@ after_lock_tlb:
407 407
408 call smp_callin 408 call smp_callin
409 nop 409 nop
410 call cpu_idle 410
411 mov 0, %o0
412 call cpu_panic 411 call cpu_panic
413 nop 412 nop
4141: b,a,pt %xcc, 1b 4131: b,a,pt %xcc, 1b
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 8d38ca97aa23..b3f833ab90eb 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2350,13 +2350,6 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
2350 } while (++count < 16); 2350 } while (++count < 16);
2351} 2351}
2352 2352
2353void dump_stack(void)
2354{
2355 show_stack(current, NULL);
2356}
2357
2358EXPORT_SYMBOL(dump_stack);
2359
2360static inline struct reg_window *kernel_stack_up(struct reg_window *rw) 2353static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2361{ 2354{
2362 unsigned long fp = rw->ins[6]; 2355 unsigned long fp = rw->ins[6];
diff --git a/arch/sparc/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
deleted file mode 100644
index 489fc15f3194..000000000000
--- a/arch/sparc/kernel/us2e_cpufreq.c
+++ /dev/null
@@ -1,413 +0,0 @@
1/* us2e_cpufreq.c: UltraSPARC-IIe cpu frequency support
2 *
3 * Copyright (C) 2003 David S. Miller (davem@redhat.com)
4 *
5 * Many thanks to Dominik Brodowski for fixing up the cpufreq
6 * infrastructure in order to make this driver easier to implement.
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/sched.h>
12#include <linux/smp.h>
13#include <linux/cpufreq.h>
14#include <linux/threads.h>
15#include <linux/slab.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18
19#include <asm/asi.h>
20#include <asm/timer.h>
21
22static struct cpufreq_driver *cpufreq_us2e_driver;
23
24struct us2e_freq_percpu_info {
25 struct cpufreq_frequency_table table[6];
26};
27
28/* Indexed by cpu number. */
29static struct us2e_freq_percpu_info *us2e_freq_table;
30
31#define HBIRD_MEM_CNTL0_ADDR 0x1fe0000f010UL
32#define HBIRD_ESTAR_MODE_ADDR 0x1fe0000f080UL
33
34/* UltraSPARC-IIe has five dividers: 1, 2, 4, 6, and 8. These are controlled
35 * in the ESTAR mode control register.
36 */
37#define ESTAR_MODE_DIV_1 0x0000000000000000UL
38#define ESTAR_MODE_DIV_2 0x0000000000000001UL
39#define ESTAR_MODE_DIV_4 0x0000000000000003UL
40#define ESTAR_MODE_DIV_6 0x0000000000000002UL
41#define ESTAR_MODE_DIV_8 0x0000000000000004UL
42#define ESTAR_MODE_DIV_MASK 0x0000000000000007UL
43
44#define MCTRL0_SREFRESH_ENAB 0x0000000000010000UL
45#define MCTRL0_REFR_COUNT_MASK 0x0000000000007f00UL
46#define MCTRL0_REFR_COUNT_SHIFT 8
47#define MCTRL0_REFR_INTERVAL 7800
48#define MCTRL0_REFR_CLKS_P_CNT 64
49
50static unsigned long read_hbreg(unsigned long addr)
51{
52 unsigned long ret;
53
54 __asm__ __volatile__("ldxa [%1] %2, %0"
55 : "=&r" (ret)
56 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
57 return ret;
58}
59
60static void write_hbreg(unsigned long addr, unsigned long val)
61{
62 __asm__ __volatile__("stxa %0, [%1] %2\n\t"
63 "membar #Sync"
64 : /* no outputs */
65 : "r" (val), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)
66 : "memory");
67 if (addr == HBIRD_ESTAR_MODE_ADDR) {
68 /* Need to wait 16 clock cycles for the PLL to lock. */
69 udelay(1);
70 }
71}
72
73static void self_refresh_ctl(int enable)
74{
75 unsigned long mctrl = read_hbreg(HBIRD_MEM_CNTL0_ADDR);
76
77 if (enable)
78 mctrl |= MCTRL0_SREFRESH_ENAB;
79 else
80 mctrl &= ~MCTRL0_SREFRESH_ENAB;
81 write_hbreg(HBIRD_MEM_CNTL0_ADDR, mctrl);
82 (void) read_hbreg(HBIRD_MEM_CNTL0_ADDR);
83}
84
85static void frob_mem_refresh(int cpu_slowing_down,
86 unsigned long clock_tick,
87 unsigned long old_divisor, unsigned long divisor)
88{
89 unsigned long old_refr_count, refr_count, mctrl;
90
91 refr_count = (clock_tick * MCTRL0_REFR_INTERVAL);
92 refr_count /= (MCTRL0_REFR_CLKS_P_CNT * divisor * 1000000000UL);
93
94 mctrl = read_hbreg(HBIRD_MEM_CNTL0_ADDR);
95 old_refr_count = (mctrl & MCTRL0_REFR_COUNT_MASK)
96 >> MCTRL0_REFR_COUNT_SHIFT;
97
98 mctrl &= ~MCTRL0_REFR_COUNT_MASK;
99 mctrl |= refr_count << MCTRL0_REFR_COUNT_SHIFT;
100 write_hbreg(HBIRD_MEM_CNTL0_ADDR, mctrl);
101 mctrl = read_hbreg(HBIRD_MEM_CNTL0_ADDR);
102
103 if (cpu_slowing_down && !(mctrl & MCTRL0_SREFRESH_ENAB)) {
104 unsigned long usecs;
105
106 /* We have to wait for both refresh counts (old
107 * and new) to go to zero.
108 */
109 usecs = (MCTRL0_REFR_CLKS_P_CNT *
110 (refr_count + old_refr_count) *
111 1000000UL *
112 old_divisor) / clock_tick;
113 udelay(usecs + 1UL);
114 }
115}
116
117static void us2e_transition(unsigned long estar, unsigned long new_bits,
118 unsigned long clock_tick,
119 unsigned long old_divisor, unsigned long divisor)
120{
121 unsigned long flags;
122
123 local_irq_save(flags);
124
125 estar &= ~ESTAR_MODE_DIV_MASK;
126
127 /* This is based upon the state transition diagram in the IIe manual. */
128 if (old_divisor == 2 && divisor == 1) {
129 self_refresh_ctl(0);
130 write_hbreg(HBIRD_ESTAR_MODE_ADDR, estar | new_bits);
131 frob_mem_refresh(0, clock_tick, old_divisor, divisor);
132 } else if (old_divisor == 1 && divisor == 2) {
133 frob_mem_refresh(1, clock_tick, old_divisor, divisor);
134 write_hbreg(HBIRD_ESTAR_MODE_ADDR, estar | new_bits);
135 self_refresh_ctl(1);
136 } else if (old_divisor == 1 && divisor > 2) {
137 us2e_transition(estar, ESTAR_MODE_DIV_2, clock_tick,
138 1, 2);
139 us2e_transition(estar, new_bits, clock_tick,
140 2, divisor);
141 } else if (old_divisor > 2 && divisor == 1) {
142 us2e_transition(estar, ESTAR_MODE_DIV_2, clock_tick,
143 old_divisor, 2);
144 us2e_transition(estar, new_bits, clock_tick,
145 2, divisor);
146 } else if (old_divisor < divisor) {
147 frob_mem_refresh(0, clock_tick, old_divisor, divisor);
148 write_hbreg(HBIRD_ESTAR_MODE_ADDR, estar | new_bits);
149 } else if (old_divisor > divisor) {
150 write_hbreg(HBIRD_ESTAR_MODE_ADDR, estar | new_bits);
151 frob_mem_refresh(1, clock_tick, old_divisor, divisor);
152 } else {
153 BUG();
154 }
155
156 local_irq_restore(flags);
157}
158
159static unsigned long index_to_estar_mode(unsigned int index)
160{
161 switch (index) {
162 case 0:
163 return ESTAR_MODE_DIV_1;
164
165 case 1:
166 return ESTAR_MODE_DIV_2;
167
168 case 2:
169 return ESTAR_MODE_DIV_4;
170
171 case 3:
172 return ESTAR_MODE_DIV_6;
173
174 case 4:
175 return ESTAR_MODE_DIV_8;
176
177 default:
178 BUG();
179 }
180}
181
182static unsigned long index_to_divisor(unsigned int index)
183{
184 switch (index) {
185 case 0:
186 return 1;
187
188 case 1:
189 return 2;
190
191 case 2:
192 return 4;
193
194 case 3:
195 return 6;
196
197 case 4:
198 return 8;
199
200 default:
201 BUG();
202 }
203}
204
205static unsigned long estar_to_divisor(unsigned long estar)
206{
207 unsigned long ret;
208
209 switch (estar & ESTAR_MODE_DIV_MASK) {
210 case ESTAR_MODE_DIV_1:
211 ret = 1;
212 break;
213 case ESTAR_MODE_DIV_2:
214 ret = 2;
215 break;
216 case ESTAR_MODE_DIV_4:
217 ret = 4;
218 break;
219 case ESTAR_MODE_DIV_6:
220 ret = 6;
221 break;
222 case ESTAR_MODE_DIV_8:
223 ret = 8;
224 break;
225 default:
226 BUG();
227 }
228
229 return ret;
230}
231
232static unsigned int us2e_freq_get(unsigned int cpu)
233{
234 cpumask_t cpus_allowed;
235 unsigned long clock_tick, estar;
236
237 if (!cpu_online(cpu))
238 return 0;
239
240 cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
241 set_cpus_allowed_ptr(current, cpumask_of(cpu));
242
243 clock_tick = sparc64_get_clock_tick(cpu) / 1000;
244 estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
245
246 set_cpus_allowed_ptr(current, &cpus_allowed);
247
248 return clock_tick / estar_to_divisor(estar);
249}
250
251static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
252{
253 unsigned long new_bits, new_freq;
254 unsigned long clock_tick, divisor, old_divisor, estar;
255 cpumask_t cpus_allowed;
256 struct cpufreq_freqs freqs;
257
258 if (!cpu_online(cpu))
259 return;
260
261 cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
262 set_cpus_allowed_ptr(current, cpumask_of(cpu));
263
264 new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000;
265 new_bits = index_to_estar_mode(index);
266 divisor = index_to_divisor(index);
267 new_freq /= divisor;
268
269 estar = read_hbreg(HBIRD_ESTAR_MODE_ADDR);
270
271 old_divisor = estar_to_divisor(estar);
272
273 freqs.old = clock_tick / old_divisor;
274 freqs.new = new_freq;
275 freqs.cpu = cpu;
276 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
277
278 if (old_divisor != divisor)
279 us2e_transition(estar, new_bits, clock_tick * 1000,
280 old_divisor, divisor);
281
282 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
283
284 set_cpus_allowed_ptr(current, &cpus_allowed);
285}
286
287static int us2e_freq_target(struct cpufreq_policy *policy,
288 unsigned int target_freq,
289 unsigned int relation)
290{
291 unsigned int new_index = 0;
292
293 if (cpufreq_frequency_table_target(policy,
294 &us2e_freq_table[policy->cpu].table[0],
295 target_freq, relation, &new_index))
296 return -EINVAL;
297
298 us2e_set_cpu_divider_index(policy->cpu, new_index);
299
300 return 0;
301}
302
303static int us2e_freq_verify(struct cpufreq_policy *policy)
304{
305 return cpufreq_frequency_table_verify(policy,
306 &us2e_freq_table[policy->cpu].table[0]);
307}
308
309static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
310{
311 unsigned int cpu = policy->cpu;
312 unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
313 struct cpufreq_frequency_table *table =
314 &us2e_freq_table[cpu].table[0];
315
316 table[0].index = 0;
317 table[0].frequency = clock_tick / 1;
318 table[1].index = 1;
319 table[1].frequency = clock_tick / 2;
320 table[2].index = 2;
321 table[2].frequency = clock_tick / 4;
322 table[2].index = 3;
323 table[2].frequency = clock_tick / 6;
324 table[2].index = 4;
325 table[2].frequency = clock_tick / 8;
326 table[2].index = 5;
327 table[3].frequency = CPUFREQ_TABLE_END;
328
329 policy->cpuinfo.transition_latency = 0;
330 policy->cur = clock_tick;
331
332 return cpufreq_frequency_table_cpuinfo(policy, table);
333}
334
335static int us2e_freq_cpu_exit(struct cpufreq_policy *policy)
336{
337 if (cpufreq_us2e_driver)
338 us2e_set_cpu_divider_index(policy->cpu, 0);
339
340 return 0;
341}
342
343static int __init us2e_freq_init(void)
344{
345 unsigned long manuf, impl, ver;
346 int ret;
347
348 if (tlb_type != spitfire)
349 return -ENODEV;
350
351 __asm__("rdpr %%ver, %0" : "=r" (ver));
352 manuf = ((ver >> 48) & 0xffff);
353 impl = ((ver >> 32) & 0xffff);
354
355 if (manuf == 0x17 && impl == 0x13) {
356 struct cpufreq_driver *driver;
357
358 ret = -ENOMEM;
359 driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
360 if (!driver)
361 goto err_out;
362
363 us2e_freq_table = kzalloc(
364 (NR_CPUS * sizeof(struct us2e_freq_percpu_info)),
365 GFP_KERNEL);
366 if (!us2e_freq_table)
367 goto err_out;
368
369 driver->init = us2e_freq_cpu_init;
370 driver->verify = us2e_freq_verify;
371 driver->target = us2e_freq_target;
372 driver->get = us2e_freq_get;
373 driver->exit = us2e_freq_cpu_exit;
374 driver->owner = THIS_MODULE,
375 strcpy(driver->name, "UltraSPARC-IIe");
376
377 cpufreq_us2e_driver = driver;
378 ret = cpufreq_register_driver(driver);
379 if (ret)
380 goto err_out;
381
382 return 0;
383
384err_out:
385 if (driver) {
386 kfree(driver);
387 cpufreq_us2e_driver = NULL;
388 }
389 kfree(us2e_freq_table);
390 us2e_freq_table = NULL;
391 return ret;
392 }
393
394 return -ENODEV;
395}
396
397static void __exit us2e_freq_exit(void)
398{
399 if (cpufreq_us2e_driver) {
400 cpufreq_unregister_driver(cpufreq_us2e_driver);
401 kfree(cpufreq_us2e_driver);
402 cpufreq_us2e_driver = NULL;
403 kfree(us2e_freq_table);
404 us2e_freq_table = NULL;
405 }
406}
407
408MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
409MODULE_DESCRIPTION("cpufreq driver for UltraSPARC-IIe");
410MODULE_LICENSE("GPL");
411
412module_init(us2e_freq_init);
413module_exit(us2e_freq_exit);
diff --git a/arch/sparc/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
deleted file mode 100644
index eb1624b931d9..000000000000
--- a/arch/sparc/kernel/us3_cpufreq.c
+++ /dev/null
@@ -1,274 +0,0 @@
1/* us3_cpufreq.c: UltraSPARC-III cpu frequency support
2 *
3 * Copyright (C) 2003 David S. Miller (davem@redhat.com)
4 *
5 * Many thanks to Dominik Brodowski for fixing up the cpufreq
6 * infrastructure in order to make this driver easier to implement.
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/sched.h>
12#include <linux/smp.h>
13#include <linux/cpufreq.h>
14#include <linux/threads.h>
15#include <linux/slab.h>
16#include <linux/init.h>
17
18#include <asm/head.h>
19#include <asm/timer.h>
20
21static struct cpufreq_driver *cpufreq_us3_driver;
22
23struct us3_freq_percpu_info {
24 struct cpufreq_frequency_table table[4];
25};
26
27/* Indexed by cpu number. */
28static struct us3_freq_percpu_info *us3_freq_table;
29
30/* UltraSPARC-III has three dividers: 1, 2, and 32. These are controlled
31 * in the Safari config register.
32 */
33#define SAFARI_CFG_DIV_1 0x0000000000000000UL
34#define SAFARI_CFG_DIV_2 0x0000000040000000UL
35#define SAFARI_CFG_DIV_32 0x0000000080000000UL
36#define SAFARI_CFG_DIV_MASK 0x00000000C0000000UL
37
38static unsigned long read_safari_cfg(void)
39{
40 unsigned long ret;
41
42 __asm__ __volatile__("ldxa [%%g0] %1, %0"
43 : "=&r" (ret)
44 : "i" (ASI_SAFARI_CONFIG));
45 return ret;
46}
47
48static void write_safari_cfg(unsigned long val)
49{
50 __asm__ __volatile__("stxa %0, [%%g0] %1\n\t"
51 "membar #Sync"
52 : /* no outputs */
53 : "r" (val), "i" (ASI_SAFARI_CONFIG)
54 : "memory");
55}
56
57static unsigned long get_current_freq(unsigned int cpu, unsigned long safari_cfg)
58{
59 unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
60 unsigned long ret;
61
62 switch (safari_cfg & SAFARI_CFG_DIV_MASK) {
63 case SAFARI_CFG_DIV_1:
64 ret = clock_tick / 1;
65 break;
66 case SAFARI_CFG_DIV_2:
67 ret = clock_tick / 2;
68 break;
69 case SAFARI_CFG_DIV_32:
70 ret = clock_tick / 32;
71 break;
72 default:
73 BUG();
74 }
75
76 return ret;
77}
78
79static unsigned int us3_freq_get(unsigned int cpu)
80{
81 cpumask_t cpus_allowed;
82 unsigned long reg;
83 unsigned int ret;
84
85 if (!cpu_online(cpu))
86 return 0;
87
88 cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
89 set_cpus_allowed_ptr(current, cpumask_of(cpu));
90
91 reg = read_safari_cfg();
92 ret = get_current_freq(cpu, reg);
93
94 set_cpus_allowed_ptr(current, &cpus_allowed);
95
96 return ret;
97}
98
99static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
100{
101 unsigned long new_bits, new_freq, reg;
102 cpumask_t cpus_allowed;
103 struct cpufreq_freqs freqs;
104
105 if (!cpu_online(cpu))
106 return;
107
108 cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
109 set_cpus_allowed_ptr(current, cpumask_of(cpu));
110
111 new_freq = sparc64_get_clock_tick(cpu) / 1000;
112 switch (index) {
113 case 0:
114 new_bits = SAFARI_CFG_DIV_1;
115 new_freq /= 1;
116 break;
117 case 1:
118 new_bits = SAFARI_CFG_DIV_2;
119 new_freq /= 2;
120 break;
121 case 2:
122 new_bits = SAFARI_CFG_DIV_32;
123 new_freq /= 32;
124 break;
125
126 default:
127 BUG();
128 }
129
130 reg = read_safari_cfg();
131
132 freqs.old = get_current_freq(cpu, reg);
133 freqs.new = new_freq;
134 freqs.cpu = cpu;
135 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
136
137 reg &= ~SAFARI_CFG_DIV_MASK;
138 reg |= new_bits;
139 write_safari_cfg(reg);
140
141 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
142
143 set_cpus_allowed_ptr(current, &cpus_allowed);
144}
145
146static int us3_freq_target(struct cpufreq_policy *policy,
147 unsigned int target_freq,
148 unsigned int relation)
149{
150 unsigned int new_index = 0;
151
152 if (cpufreq_frequency_table_target(policy,
153 &us3_freq_table[policy->cpu].table[0],
154 target_freq,
155 relation,
156 &new_index))
157 return -EINVAL;
158
159 us3_set_cpu_divider_index(policy->cpu, new_index);
160
161 return 0;
162}
163
164static int us3_freq_verify(struct cpufreq_policy *policy)
165{
166 return cpufreq_frequency_table_verify(policy,
167 &us3_freq_table[policy->cpu].table[0]);
168}
169
170static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
171{
172 unsigned int cpu = policy->cpu;
173 unsigned long clock_tick = sparc64_get_clock_tick(cpu) / 1000;
174 struct cpufreq_frequency_table *table =
175 &us3_freq_table[cpu].table[0];
176
177 table[0].index = 0;
178 table[0].frequency = clock_tick / 1;
179 table[1].index = 1;
180 table[1].frequency = clock_tick / 2;
181 table[2].index = 2;
182 table[2].frequency = clock_tick / 32;
183 table[3].index = 0;
184 table[3].frequency = CPUFREQ_TABLE_END;
185
186 policy->cpuinfo.transition_latency = 0;
187 policy->cur = clock_tick;
188
189 return cpufreq_frequency_table_cpuinfo(policy, table);
190}
191
192static int us3_freq_cpu_exit(struct cpufreq_policy *policy)
193{
194 if (cpufreq_us3_driver)
195 us3_set_cpu_divider_index(policy->cpu, 0);
196
197 return 0;
198}
199
200static int __init us3_freq_init(void)
201{
202 unsigned long manuf, impl, ver;
203 int ret;
204
205 if (tlb_type != cheetah && tlb_type != cheetah_plus)
206 return -ENODEV;
207
208 __asm__("rdpr %%ver, %0" : "=r" (ver));
209 manuf = ((ver >> 48) & 0xffff);
210 impl = ((ver >> 32) & 0xffff);
211
212 if (manuf == CHEETAH_MANUF &&
213 (impl == CHEETAH_IMPL ||
214 impl == CHEETAH_PLUS_IMPL ||
215 impl == JAGUAR_IMPL ||
216 impl == PANTHER_IMPL)) {
217 struct cpufreq_driver *driver;
218
219 ret = -ENOMEM;
220 driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
221 if (!driver)
222 goto err_out;
223
224 us3_freq_table = kzalloc(
225 (NR_CPUS * sizeof(struct us3_freq_percpu_info)),
226 GFP_KERNEL);
227 if (!us3_freq_table)
228 goto err_out;
229
230 driver->init = us3_freq_cpu_init;
231 driver->verify = us3_freq_verify;
232 driver->target = us3_freq_target;
233 driver->get = us3_freq_get;
234 driver->exit = us3_freq_cpu_exit;
235 driver->owner = THIS_MODULE,
236 strcpy(driver->name, "UltraSPARC-III");
237
238 cpufreq_us3_driver = driver;
239 ret = cpufreq_register_driver(driver);
240 if (ret)
241 goto err_out;
242
243 return 0;
244
245err_out:
246 if (driver) {
247 kfree(driver);
248 cpufreq_us3_driver = NULL;
249 }
250 kfree(us3_freq_table);
251 us3_freq_table = NULL;
252 return ret;
253 }
254
255 return -ENODEV;
256}
257
258static void __exit us3_freq_exit(void)
259{
260 if (cpufreq_us3_driver) {
261 cpufreq_unregister_driver(cpufreq_us3_driver);
262 kfree(cpufreq_us3_driver);
263 cpufreq_us3_driver = NULL;
264 kfree(us3_freq_table);
265 us3_freq_table = NULL;
266 }
267}
268
269MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
270MODULE_DESCRIPTION("cpufreq driver for UltraSPARC-III");
271MODULE_LICENSE("GPL");
272
273module_init(us3_freq_init);
274module_exit(us3_freq_exit);
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 3e244f31e56b..8647fcc5ca6c 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -342,6 +342,7 @@ static void vio_remove(struct mdesc_handle *hp, u64 node)
342 printk(KERN_INFO "VIO: Removing device %s\n", dev_name(dev)); 342 printk(KERN_INFO "VIO: Removing device %s\n", dev_name(dev));
343 343
344 device_unregister(dev); 344 device_unregister(dev);
345 put_device(dev);
345 } 346 }
346} 347}
347 348
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index 8410065f2862..dbe119b63b48 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -45,4 +45,3 @@ obj-y += iomap.o
45obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o 45obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o
46obj-y += ksyms.o 46obj-y += ksyms.o
47obj-$(CONFIG_SPARC64) += PeeCeeI.o 47obj-$(CONFIG_SPARC64) += PeeCeeI.o
48obj-y += usercopy.o
diff --git a/arch/sparc/lib/usercopy.c b/arch/sparc/lib/usercopy.c
deleted file mode 100644
index 5c4284ce1c03..000000000000
--- a/arch/sparc/lib/usercopy.c
+++ /dev/null
@@ -1,9 +0,0 @@
1#include <linux/module.h>
2#include <linux/kernel.h>
3#include <linux/bug.h>
4
5void copy_from_user_overflow(void)
6{
7 WARN(1, "Buffer overflow detected!\n");
8}
9EXPORT_SYMBOL(copy_from_user_overflow);
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 48e0c030e8f5..4490c397bb5b 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
282 printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn); 282 printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
283#endif 283#endif
284 284
285 for (tmp = start_pfn; tmp < end_pfn; tmp++) { 285 for (tmp = start_pfn; tmp < end_pfn; tmp++)
286 struct page *page = pfn_to_page(tmp); 286 free_highmem_page(pfn_to_page(tmp));
287
288 ClearPageReserved(page);
289 init_page_count(page);
290 __free_page(page);
291 totalhigh_pages++;
292 }
293} 287}
294 288
295void __init mem_init(void) 289void __init mem_init(void)
@@ -347,8 +341,6 @@ void __init mem_init(void)
347 map_high_region(start_pfn, end_pfn); 341 map_high_region(start_pfn, end_pfn);
348 } 342 }
349 343
350 totalram_pages += totalhigh_pages;
351
352 codepages = (((unsigned long) &_etext) - ((unsigned long)&_start)); 344 codepages = (((unsigned long) &_etext) - ((unsigned long)&_start));
353 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT; 345 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
354 datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext)); 346 datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 1588d33d5492..cf72a8a5b3aa 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -681,10 +681,9 @@ void get_new_mmu_context(struct mm_struct *mm)
681{ 681{
682 unsigned long ctx, new_ctx; 682 unsigned long ctx, new_ctx;
683 unsigned long orig_pgsz_bits; 683 unsigned long orig_pgsz_bits;
684 unsigned long flags;
685 int new_version; 684 int new_version;
686 685
687 spin_lock_irqsave(&ctx_alloc_lock, flags); 686 spin_lock(&ctx_alloc_lock);
688 orig_pgsz_bits = (mm->context.sparc64_ctx_val & CTX_PGSZ_MASK); 687 orig_pgsz_bits = (mm->context.sparc64_ctx_val & CTX_PGSZ_MASK);
689 ctx = (tlb_context_cache + 1) & CTX_NR_MASK; 688 ctx = (tlb_context_cache + 1) & CTX_NR_MASK;
690 new_ctx = find_next_zero_bit(mmu_context_bmap, 1 << CTX_NR_BITS, ctx); 689 new_ctx = find_next_zero_bit(mmu_context_bmap, 1 << CTX_NR_BITS, ctx);
@@ -720,7 +719,7 @@ void get_new_mmu_context(struct mm_struct *mm)
720out: 719out:
721 tlb_context_cache = new_ctx; 720 tlb_context_cache = new_ctx;
722 mm->context.sparc64_ctx_val = new_ctx | orig_pgsz_bits; 721 mm->context.sparc64_ctx_val = new_ctx | orig_pgsz_bits;
723 spin_unlock_irqrestore(&ctx_alloc_lock, flags); 722 spin_unlock(&ctx_alloc_lock);
724 723
725 if (unlikely(new_version)) 724 if (unlikely(new_version))
726 smp_new_mmu_context_version(); 725 smp_new_mmu_context_version();
@@ -2125,7 +2124,6 @@ void free_initmem(void)
2125 ClearPageReserved(p); 2124 ClearPageReserved(p);
2126 init_page_count(p); 2125 init_page_count(p);
2127 __free_page(p); 2126 __free_page(p);
2128 num_physpages++;
2129 totalram_pages++; 2127 totalram_pages++;
2130 } 2128 }
2131 } 2129 }
@@ -2142,7 +2140,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
2142 ClearPageReserved(p); 2140 ClearPageReserved(p);
2143 init_page_count(p); 2141 init_page_count(p);
2144 __free_page(p); 2142 __free_page(p);
2145 num_physpages++;
2146 totalram_pages++; 2143 totalram_pages++;
2147 } 2144 }
2148} 2145}
@@ -2181,10 +2178,9 @@ unsigned long vmemmap_table[VMEMMAP_SIZE];
2181static long __meminitdata addr_start, addr_end; 2178static long __meminitdata addr_start, addr_end;
2182static int __meminitdata node_start; 2179static int __meminitdata node_start;
2183 2180
2184int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node) 2181int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend,
2182 int node)
2185{ 2183{
2186 unsigned long vstart = (unsigned long) start;
2187 unsigned long vend = (unsigned long) (start + nr);
2188 unsigned long phys_start = (vstart - VMEMMAP_BASE); 2184 unsigned long phys_start = (vstart - VMEMMAP_BASE);
2189 unsigned long phys_end = (vend - VMEMMAP_BASE); 2185 unsigned long phys_end = (vend - VMEMMAP_BASE);
2190 unsigned long addr = phys_start & VMEMMAP_CHUNK_MASK; 2186 unsigned long addr = phys_start & VMEMMAP_CHUNK_MASK;
@@ -2236,7 +2232,7 @@ void __meminit vmemmap_populate_print_last(void)
2236 } 2232 }
2237} 2233}
2238 2234
2239void vmemmap_free(struct page *memmap, unsigned long nr_pages) 2235void vmemmap_free(unsigned long start, unsigned long end)
2240{ 2236{
2241} 2237}
2242 2238
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 272aa4f7657e..83d89bcb44af 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -87,7 +87,7 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
87 if (!tb->active) { 87 if (!tb->active) {
88 global_flush_tlb_page(mm, vaddr); 88 global_flush_tlb_page(mm, vaddr);
89 flush_tsb_user_page(mm, vaddr); 89 flush_tsb_user_page(mm, vaddr);
90 return; 90 goto out;
91 } 91 }
92 92
93 if (nr == 0) 93 if (nr == 0)
@@ -98,6 +98,7 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
98 if (nr >= TLB_BATCH_NR) 98 if (nr >= TLB_BATCH_NR)
99 flush_tlb_pending(); 99 flush_tlb_pending();
100 100
101out:
101 put_cpu_var(tlb_batch); 102 put_cpu_var(tlb_batch);
102} 103}
103 104
diff --git a/arch/sparc/power/Makefile b/arch/sparc/power/Makefile
new file mode 100644
index 000000000000..3201ace0ddbd
--- /dev/null
+++ b/arch/sparc/power/Makefile
@@ -0,0 +1,3 @@
1# Makefile for Sparc-specific hibernate files.
2
3obj-$(CONFIG_HIBERNATION) += hibernate.o hibernate_asm.o
diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c
new file mode 100644
index 000000000000..42b0b8ce699a
--- /dev/null
+++ b/arch/sparc/power/hibernate.c
@@ -0,0 +1,42 @@
1/*
2 * hibernate.c: Hibernaton support specific for sparc64.
3 *
4 * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
5 */
6
7#include <linux/mm.h>
8
9#include <asm/hibernate.h>
10#include <asm/visasm.h>
11#include <asm/page.h>
12#include <asm/tlb.h>
13
14/* References to section boundaries */
15extern const void __nosave_begin, __nosave_end;
16
17struct saved_context saved_context;
18
19/*
20 * pfn_is_nosave - check if given pfn is in the 'nosave' section
21 */
22
23int pfn_is_nosave(unsigned long pfn)
24{
25 unsigned long nosave_begin_pfn = PFN_DOWN((unsigned long)&__nosave_begin);
26 unsigned long nosave_end_pfn = PFN_DOWN((unsigned long)&__nosave_end);
27
28 return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
29}
30
31void save_processor_state(void)
32{
33 save_and_clear_fpu();
34}
35
36void restore_processor_state(void)
37{
38 struct mm_struct *mm = current->active_mm;
39
40 load_secondary_context(mm);
41 tsb_context_switch(mm);
42}
diff --git a/arch/sparc/power/hibernate_asm.S b/arch/sparc/power/hibernate_asm.S
new file mode 100644
index 000000000000..79942166df84
--- /dev/null
+++ b/arch/sparc/power/hibernate_asm.S
@@ -0,0 +1,131 @@
1/*
2 * hibernate_asm.S: Hibernaton support specific for sparc64.
3 *
4 * Copyright (C) 2013 Kirill V Tkhai (tkhai@yandex.ru)
5 */
6
7#include <linux/linkage.h>
8
9#include <asm/asm-offsets.h>
10#include <asm/cpudata.h>
11#include <asm/page.h>
12
13ENTRY(swsusp_arch_suspend)
14 save %sp, -128, %sp
15 save %sp, -128, %sp
16 flushw
17
18 setuw saved_context, %g3
19
20 /* Save window regs */
21 rdpr %cwp, %g2
22 stx %g2, [%g3 + SC_REG_CWP]
23 rdpr %wstate, %g2
24 stx %g2, [%g3 + SC_REG_WSTATE]
25 stx %fp, [%g3 + SC_REG_FP]
26
27 /* Save state regs */
28 rdpr %tick, %g2
29 stx %g2, [%g3 + SC_REG_TICK]
30 rdpr %pstate, %g2
31 stx %g2, [%g3 + SC_REG_PSTATE]
32
33 /* Save global regs */
34 stx %g4, [%g3 + SC_REG_G4]
35 stx %g5, [%g3 + SC_REG_G5]
36 stx %g6, [%g3 + SC_REG_G6]
37
38 call swsusp_save
39 nop
40
41 mov %o0, %i0
42 restore
43
44 mov %o0, %i0
45 ret
46 restore
47
48ENTRY(swsusp_arch_resume)
49 /* Write restore_pblist to %l0 */
50 sethi %hi(restore_pblist), %l0
51 ldx [%l0 + %lo(restore_pblist)], %l0
52
53 call __flush_tlb_all
54 nop
55
56 /* Write PAGE_OFFSET to %g7 */
57 sethi %uhi(PAGE_OFFSET), %g7
58 sllx %g7, 32, %g7
59
60 setuw (PAGE_SIZE-8), %g3
61
62 /* Use MMU Bypass */
63 rd %asi, %g1
64 wr %g0, ASI_PHYS_USE_EC, %asi
65
66 ba fill_itlb
67 nop
68
69pbe_loop:
70 cmp %l0, %g0
71 be restore_ctx
72 sub %l0, %g7, %l0
73
74 ldxa [%l0 ] %asi, %l1 /* address */
75 ldxa [%l0 + 8] %asi, %l2 /* orig_address */
76
77 /* phys addr */
78 sub %l1, %g7, %l1
79 sub %l2, %g7, %l2
80
81 mov %g3, %l3 /* PAGE_SIZE-8 */
82copy_loop:
83 ldxa [%l1 + %l3] ASI_PHYS_USE_EC, %g2
84 stxa %g2, [%l2 + %l3] ASI_PHYS_USE_EC
85 cmp %l3, %g0
86 bne copy_loop
87 sub %l3, 8, %l3
88
89 /* next pbe */
90 ba pbe_loop
91 ldxa [%l0 + 16] %asi, %l0
92
93restore_ctx:
94 setuw saved_context, %g3
95
96 /* Restore window regs */
97 wrpr %g0, 0, %canrestore
98 wrpr %g0, 0, %otherwin
99 wrpr %g0, 6, %cansave
100 wrpr %g0, 0, %cleanwin
101
102 ldxa [%g3 + SC_REG_CWP] %asi, %g2
103 wrpr %g2, %cwp
104 ldxa [%g3 + SC_REG_WSTATE] %asi, %g2
105 wrpr %g2, %wstate
106 ldxa [%g3 + SC_REG_FP] %asi, %fp
107
108 /* Restore state regs */
109 ldxa [%g3 + SC_REG_PSTATE] %asi, %g2
110 wrpr %g2, %pstate
111 ldxa [%g3 + SC_REG_TICK] %asi, %g2
112 wrpr %g2, %tick
113
114 /* Restore global regs */
115 ldxa [%g3 + SC_REG_G4] %asi, %g4
116 ldxa [%g3 + SC_REG_G5] %asi, %g5
117 ldxa [%g3 + SC_REG_G6] %asi, %g6
118
119 wr %g1, %g0, %asi
120
121 restore
122 restore
123
124 wrpr %g0, 14, %pil
125
126 retl
127 mov %g0, %o0
128
129fill_itlb:
130 ba pbe_loop
131 wrpr %g0, 15, %pil
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 25877aebc685..5b6a40dd5556 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -16,12 +16,15 @@ config TILE
16 select GENERIC_PENDING_IRQ if SMP 16 select GENERIC_PENDING_IRQ if SMP
17 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
18 select HAVE_DEBUG_BUGVERBOSE 18 select HAVE_DEBUG_BUGVERBOSE
19 select HAVE_SYSCALL_WRAPPERS if TILEGX
20 select VIRT_TO_BUS 19 select VIRT_TO_BUS
21 select SYS_HYPERVISOR 20 select SYS_HYPERVISOR
21 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
22 select ARCH_HAVE_NMI_SAFE_CMPXCHG 22 select ARCH_HAVE_NMI_SAFE_CMPXCHG
23 select GENERIC_CLOCKEVENTS 23 select GENERIC_CLOCKEVENTS
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select HAVE_ARCH_TRACEHOOK
26 select HAVE_SYSCALL_TRACEPOINTS
27 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
25 28
26# FIXME: investigate whether we need/want these options. 29# FIXME: investigate whether we need/want these options.
27# select HAVE_IOREMAP_PROT 30# select HAVE_IOREMAP_PROT
@@ -40,9 +43,6 @@ config MMU
40config GENERIC_CSUM 43config GENERIC_CSUM
41 def_bool y 44 def_bool y
42 45
43config SEMAPHORE_SLEEPERS
44 def_bool y
45
46config HAVE_ARCH_ALLOC_REMAP 46config HAVE_ARCH_ALLOC_REMAP
47 def_bool y 47 def_bool y
48 48
@@ -67,12 +67,6 @@ config HUGETLB_SUPER_PAGES
67config RWSEM_GENERIC_SPINLOCK 67config RWSEM_GENERIC_SPINLOCK
68 def_bool y 68 def_bool y
69 69
70# We have a very flat architecture from a migration point of view,
71# so save boot time by presetting this (particularly useful on tile-sim).
72config DEFAULT_MIGRATION_COST
73 int
74 default "10000000"
75
76# We only support gcc 4.4 and above, so this should work. 70# We only support gcc 4.4 and above, so this should work.
77config ARCH_SUPPORTS_OPTIMIZED_INLINING 71config ARCH_SUPPORTS_OPTIMIZED_INLINING
78 def_bool y 72 def_bool y
@@ -114,13 +108,6 @@ config STRICT_DEVMEM
114config SMP 108config SMP
115 def_bool y 109 def_bool y
116 110
117# Allow checking for compile-time determined overflow errors in
118# copy_from_user(). There are still unprovable places in the
119# generic code as of 2.6.34, so this option is not really compatible
120# with -Werror, which is more useful in general.
121config DEBUG_COPY_FROM_USER
122 def_bool n
123
124config HVC_TILE 111config HVC_TILE
125 depends on TTY 112 depends on TTY
126 select HVC_DRIVER 113 select HVC_DRIVER
@@ -420,11 +407,6 @@ endmenu
420 407
421menu "Executable file formats" 408menu "Executable file formats"
422 409
423# only elf supported
424config KCORE_ELF
425 def_bool y
426 depends on PROC_FS
427
428source "fs/Kconfig.binfmt" 410source "fs/Kconfig.binfmt"
429 411
430endmenu 412endmenu
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h
index f2461429a4a4..e71387ab20ca 100644
--- a/arch/tile/include/asm/atomic.h
+++ b/arch/tile/include/asm/atomic.h
@@ -131,4 +131,25 @@ static inline int atomic_read(const atomic_t *v)
131#include <asm/atomic_64.h> 131#include <asm/atomic_64.h>
132#endif 132#endif
133 133
134#ifndef __ASSEMBLY__
135
136static inline long long atomic64_dec_if_positive(atomic64_t *v)
137{
138 long long c, old, dec;
139
140 c = atomic64_read(v);
141 for (;;) {
142 dec = c - 1;
143 if (unlikely(dec < 0))
144 break;
145 old = atomic64_cmpxchg((v), c, dec);
146 if (likely(old == c))
147 break;
148 c = old;
149 }
150 return dec;
151}
152
153#endif /* __ASSEMBLY__ */
154
134#endif /* _ASM_TILE_ATOMIC_H */ 155#endif /* _ASM_TILE_ATOMIC_H */
diff --git a/arch/tile/include/asm/hugetlb.h b/arch/tile/include/asm/hugetlb.h
index 0f885af2b621..3257733003f8 100644
--- a/arch/tile/include/asm/hugetlb.h
+++ b/arch/tile/include/asm/hugetlb.h
@@ -16,6 +16,7 @@
16#define _ASM_TILE_HUGETLB_H 16#define _ASM_TILE_HUGETLB_H
17 17
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm-generic/hugetlb.h>
19 20
20 21
21static inline int is_hugepage_only_range(struct mm_struct *mm, 22static inline int is_hugepage_only_range(struct mm_struct *mm,
diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h
index 2e83fc1b9467..fd412260aff7 100644
--- a/arch/tile/include/asm/ptrace.h
+++ b/arch/tile/include/asm/ptrace.h
@@ -44,7 +44,8 @@ typedef unsigned long pt_reg_t;
44struct pt_regs *get_pt_regs(struct pt_regs *); 44struct pt_regs *get_pt_regs(struct pt_regs *);
45 45
46/* Trace the current syscall. */ 46/* Trace the current syscall. */
47extern void do_syscall_trace(void); 47extern int do_syscall_trace_enter(struct pt_regs *regs);
48extern void do_syscall_trace_exit(struct pt_regs *regs);
48 49
49#define arch_has_single_step() (1) 50#define arch_has_single_step() (1)
50 51
diff --git a/arch/tile/include/asm/syscall.h b/arch/tile/include/asm/syscall.h
index d35e0dcb67b1..9644b88f133d 100644
--- a/arch/tile/include/asm/syscall.h
+++ b/arch/tile/include/asm/syscall.h
@@ -22,6 +22,12 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <arch/abi.h> 23#include <arch/abi.h>
24 24
25/* The array of function pointers for syscalls. */
26extern void *sys_call_table[];
27#ifdef CONFIG_COMPAT
28extern void *compat_sys_call_table[];
29#endif
30
25/* 31/*
26 * Only the low 32 bits of orig_r0 are meaningful, so we return int. 32 * Only the low 32 bits of orig_r0 are meaningful, so we return int.
27 * This importantly ignores the high bits on 64-bit, so comparisons 33 * This importantly ignores the high bits on 64-bit, so comparisons
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h
index 78886e2417a6..07b298450ef2 100644
--- a/arch/tile/include/asm/syscalls.h
+++ b/arch/tile/include/asm/syscalls.h
@@ -24,12 +24,6 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/compat.h> 25#include <linux/compat.h>
26 26
27/* The array of function pointers for syscalls. */
28extern void *sys_call_table[];
29#ifdef CONFIG_COMPAT
30extern void *compat_sys_call_table[];
31#endif
32
33/* 27/*
34 * Note that by convention, any syscall which requires the current 28 * Note that by convention, any syscall which requires the current
35 * register set takes an additional "struct pt_regs *" pointer; a 29 * register set takes an additional "struct pt_regs *" pointer; a
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h
index e9c670d7a7fe..d1733dee98a2 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -124,6 +124,7 @@ extern void _cpu_idle(void);
124#define TIF_SECCOMP 6 /* secure computing */ 124#define TIF_SECCOMP 6 /* secure computing */
125#define TIF_MEMDIE 7 /* OOM killer at work */ 125#define TIF_MEMDIE 7 /* OOM killer at work */
126#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ 126#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
127#define TIF_SYSCALL_TRACEPOINT 9 /* syscall tracepoint instrumentation */
127 128
128#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 129#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
129#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 130#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
@@ -134,12 +135,19 @@ extern void _cpu_idle(void);
134#define _TIF_SECCOMP (1<<TIF_SECCOMP) 135#define _TIF_SECCOMP (1<<TIF_SECCOMP)
135#define _TIF_MEMDIE (1<<TIF_MEMDIE) 136#define _TIF_MEMDIE (1<<TIF_MEMDIE)
136#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 137#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
138#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
137 139
138/* Work to do on any return to user space. */ 140/* Work to do on any return to user space. */
139#define _TIF_ALLWORK_MASK \ 141#define _TIF_ALLWORK_MASK \
140 (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\ 142 (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\
141 _TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME) 143 _TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME)
142 144
145/* Work to do at syscall entry. */
146#define _TIF_SYSCALL_ENTRY_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT)
147
148/* Work to do at syscall exit. */
149#define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT)
150
143/* 151/*
144 * Thread-synchronous status. 152 * Thread-synchronous status.
145 * 153 *
@@ -153,8 +161,6 @@ extern void _cpu_idle(void);
153#define TS_POLLING 0x0004 /* in idle loop but not sleeping */ 161#define TS_POLLING 0x0004 /* in idle loop but not sleeping */
154#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal */ 162#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal */
155 163
156#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
157
158#ifndef __ASSEMBLY__ 164#ifndef __ASSEMBLY__
159#define HAVE_SET_RESTORE_SIGMASK 1 165#define HAVE_SET_RESTORE_SIGMASK 1
160static inline void set_restore_sigmask(void) 166static inline void set_restore_sigmask(void)
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h
index 9ab078a4605d..8a082bc6bca5 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
@@ -395,7 +395,12 @@ _copy_from_user(void *to, const void __user *from, unsigned long n)
395 return n; 395 return n;
396} 396}
397 397
398#ifdef CONFIG_DEBUG_COPY_FROM_USER 398#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
399/*
400 * There are still unprovable places in the generic code as of 2.6.34, so this
401 * option is not really compatible with -Werror, which is more useful in
402 * general.
403 */
399extern void copy_from_user_overflow(void) 404extern void copy_from_user_overflow(void)
400 __compiletime_warning("copy_from_user() size is not provably correct"); 405 __compiletime_warning("copy_from_user() size is not provably correct");
401 406
diff --git a/arch/tile/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
index cd7b6dd9d471..3866397aaf5a 100644
--- a/arch/tile/include/uapi/asm/unistd.h
+++ b/arch/tile/include/uapi/asm/unistd.h
@@ -20,6 +20,8 @@
20/* Use the standard ABI for syscalls. */ 20/* Use the standard ABI for syscalls. */
21#include <asm-generic/unistd.h> 21#include <asm-generic/unistd.h>
22 22
23#define NR_syscalls __NR_syscalls
24
23/* Additional Tilera-specific syscalls. */ 25/* Additional Tilera-specific syscalls. */
24#define __NR_cacheflush (__NR_arch_specific_syscall + 1) 26#define __NR_cacheflush (__NR_arch_specific_syscall + 1)
25__SYSCALL(__NR_cacheflush, sys_cacheflush) 27__SYSCALL(__NR_cacheflush, sys_cacheflush)
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index 6ea4cdb3c6a0..ed378416b86a 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -56,12 +56,6 @@ COMPAT_SYSCALL_DEFINE6(pwrite64, unsigned int, fd, char __user *, ubuf,
56 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low); 56 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low);
57} 57}
58 58
59COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, low, u32, high,
60 char __user *, buf, size_t, len)
61{
62 return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len);
63}
64
65COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags, 59COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags,
66 u32, offset_lo, u32, offset_hi, 60 u32, offset_lo, u32, offset_hi,
67 u32, nbytes_lo, u32, nbytes_hi) 61 u32, nbytes_lo, u32, nbytes_hi)
diff --git a/arch/tile/kernel/early_printk.c b/arch/tile/kernel/early_printk.c
index afb9c9a0d887..34d72a151bf3 100644
--- a/arch/tile/kernel/early_printk.c
+++ b/arch/tile/kernel/early_printk.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/irqflags.h> 19#include <linux/irqflags.h>
20#include <linux/printk.h>
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <hv/hypervisor.h> 22#include <hv/hypervisor.h>
22 23
@@ -33,25 +34,8 @@ static struct console early_hv_console = {
33}; 34};
34 35
35/* Direct interface for emergencies */ 36/* Direct interface for emergencies */
36static struct console *early_console = &early_hv_console;
37static int early_console_initialized;
38static int early_console_complete; 37static int early_console_complete;
39 38
40static void early_vprintk(const char *fmt, va_list ap)
41{
42 char buf[512];
43 int n = vscnprintf(buf, sizeof(buf), fmt, ap);
44 early_console->write(early_console, buf, n);
45}
46
47void early_printk(const char *fmt, ...)
48{
49 va_list ap;
50 va_start(ap, fmt);
51 early_vprintk(fmt, ap);
52 va_end(ap);
53}
54
55void early_panic(const char *fmt, ...) 39void early_panic(const char *fmt, ...)
56{ 40{
57 va_list ap; 41 va_list ap;
@@ -69,14 +53,13 @@ static int __initdata keep_early;
69 53
70static int __init setup_early_printk(char *str) 54static int __init setup_early_printk(char *str)
71{ 55{
72 if (early_console_initialized) 56 if (early_console)
73 return 1; 57 return 1;
74 58
75 if (str != NULL && strncmp(str, "keep", 4) == 0) 59 if (str != NULL && strncmp(str, "keep", 4) == 0)
76 keep_early = 1; 60 keep_early = 1;
77 61
78 early_console = &early_hv_console; 62 early_console = &early_hv_console;
79 early_console_initialized = 1;
80 register_console(early_console); 63 register_console(early_console);
81 64
82 return 0; 65 return 0;
@@ -85,12 +68,12 @@ static int __init setup_early_printk(char *str)
85void __init disable_early_printk(void) 68void __init disable_early_printk(void)
86{ 69{
87 early_console_complete = 1; 70 early_console_complete = 1;
88 if (!early_console_initialized || !early_console) 71 if (!early_console)
89 return; 72 return;
90 if (!keep_early) { 73 if (!keep_early) {
91 early_printk("disabling early console\n"); 74 early_printk("disabling early console\n");
92 unregister_console(early_console); 75 unregister_console(early_console);
93 early_console_initialized = 0; 76 early_console = NULL;
94 } else { 77 } else {
95 early_printk("keeping early console\n"); 78 early_printk("keeping early console\n");
96 } 79 }
@@ -98,7 +81,7 @@ void __init disable_early_printk(void)
98 81
99void warn_early_printk(void) 82void warn_early_printk(void)
100{ 83{
101 if (early_console_complete || early_console_initialized) 84 if (early_console_complete || early_console)
102 return; 85 return;
103 early_printk("\ 86 early_printk("\
104Machine shutting down before console output is fully initialized.\n\ 87Machine shutting down before console output is fully initialized.\n\
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index 20273ee37deb..38ac189d9575 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -914,7 +914,7 @@ static int hardwall_proc_show(struct seq_file *sf, void *v)
914static int hardwall_proc_open(struct inode *inode, 914static int hardwall_proc_open(struct inode *inode,
915 struct file *file) 915 struct file *file)
916{ 916{
917 return single_open(file, hardwall_proc_show, PDE(inode)->data); 917 return single_open(file, hardwall_proc_show, PDE_DATA(inode));
918} 918}
919 919
920static const struct file_operations hardwall_proc_fops = { 920static const struct file_operations hardwall_proc_fops = {
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index f212bf7cea86..cb52d66343ed 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1201,7 +1201,10 @@ handle_syscall:
1201 lw r30, r31 1201 lw r30, r31
1202 andi r30, r30, _TIF_SYSCALL_TRACE 1202 andi r30, r30, _TIF_SYSCALL_TRACE
1203 bzt r30, .Lrestore_syscall_regs 1203 bzt r30, .Lrestore_syscall_regs
1204 jal do_syscall_trace 1204 {
1205 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1206 jal do_syscall_trace_enter
1207 }
1205 FEEDBACK_REENTER(handle_syscall) 1208 FEEDBACK_REENTER(handle_syscall)
1206 1209
1207 /* 1210 /*
@@ -1252,7 +1255,10 @@ handle_syscall:
1252 lw r30, r31 1255 lw r30, r31
1253 andi r30, r30, _TIF_SYSCALL_TRACE 1256 andi r30, r30, _TIF_SYSCALL_TRACE
1254 bzt r30, 1f 1257 bzt r30, 1f
1255 jal do_syscall_trace 1258 {
1259 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1260 jal do_syscall_trace_exit
1261 }
1256 FEEDBACK_REENTER(handle_syscall) 1262 FEEDBACK_REENTER(handle_syscall)
12571: { 12631: {
1258 movei r30, 0 /* not an NMI */ 1264 movei r30, 0 /* not an NMI */
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 4ea080902654..85d483957027 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1000,13 +1000,19 @@ handle_syscall:
1000 1000
1001 /* Trace syscalls, if requested. */ 1001 /* Trace syscalls, if requested. */
1002 addi r31, r31, THREAD_INFO_FLAGS_OFFSET 1002 addi r31, r31, THREAD_INFO_FLAGS_OFFSET
1003 ld r30, r31 1003 {
1004 andi r30, r30, _TIF_SYSCALL_TRACE 1004 ld r30, r31
1005 moveli r32, _TIF_SYSCALL_ENTRY_WORK
1006 }
1007 and r30, r30, r32
1005 { 1008 {
1006 addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET 1009 addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET
1007 beqzt r30, .Lrestore_syscall_regs 1010 beqzt r30, .Lrestore_syscall_regs
1008 } 1011 }
1009 jal do_syscall_trace 1012 {
1013 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1014 jal do_syscall_trace_enter
1015 }
1010 FEEDBACK_REENTER(handle_syscall) 1016 FEEDBACK_REENTER(handle_syscall)
1011 1017
1012 /* 1018 /*
@@ -1071,13 +1077,19 @@ handle_syscall:
1071 FEEDBACK_REENTER(handle_syscall) 1077 FEEDBACK_REENTER(handle_syscall)
1072 1078
1073 /* Do syscall trace again, if requested. */ 1079 /* Do syscall trace again, if requested. */
1074 ld r30, r31 1080 {
1075 andi r0, r30, _TIF_SYSCALL_TRACE 1081 ld r30, r31
1082 moveli r32, _TIF_SYSCALL_EXIT_WORK
1083 }
1084 and r0, r30, r32
1076 { 1085 {
1077 andi r0, r30, _TIF_SINGLESTEP 1086 andi r0, r30, _TIF_SINGLESTEP
1078 beqzt r0, 1f 1087 beqzt r0, 1f
1079 } 1088 }
1080 jal do_syscall_trace 1089 {
1090 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1091 jal do_syscall_trace_exit
1092 }
1081 FEEDBACK_REENTER(handle_syscall) 1093 FEEDBACK_REENTER(handle_syscall)
1082 andi r0, r30, _TIF_SINGLESTEP 1094 andi r0, r30, _TIF_SINGLESTEP
1083 1095
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index caf93ae11793..8ac304484f98 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -40,13 +40,11 @@
40#include <arch/abi.h> 40#include <arch/abi.h>
41#include <arch/sim_def.h> 41#include <arch/sim_def.h>
42 42
43
44/* 43/*
45 * Use the (x86) "idle=poll" option to prefer low latency when leaving the 44 * Use the (x86) "idle=poll" option to prefer low latency when leaving the
46 * idle loop over low power while in the idle loop, e.g. if we have 45 * idle loop over low power while in the idle loop, e.g. if we have
47 * one thread per core and we want to get threads out of futex waits fast. 46 * one thread per core and we want to get threads out of futex waits fast.
48 */ 47 */
49static int no_idle_nap;
50static int __init idle_setup(char *str) 48static int __init idle_setup(char *str)
51{ 49{
52 if (!str) 50 if (!str)
@@ -54,64 +52,19 @@ static int __init idle_setup(char *str)
54 52
55 if (!strcmp(str, "poll")) { 53 if (!strcmp(str, "poll")) {
56 pr_info("using polling idle threads.\n"); 54 pr_info("using polling idle threads.\n");
57 no_idle_nap = 1; 55 cpu_idle_poll_ctrl(true);
58 } else if (!strcmp(str, "halt")) 56 return 0;
59 no_idle_nap = 0; 57 } else if (!strcmp(str, "halt")) {
60 else 58 return 0;
61 return -1; 59 }
62 60 return -1;
63 return 0;
64} 61}
65early_param("idle", idle_setup); 62early_param("idle", idle_setup);
66 63
67/* 64void arch_cpu_idle(void)
68 * The idle thread. There's no useful work to be
69 * done, so just try to conserve power and have a
70 * low exit latency (ie sit in a loop waiting for
71 * somebody to say that they'd like to reschedule)
72 */
73void cpu_idle(void)
74{ 65{
75 int cpu = smp_processor_id(); 66 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
76 67 _cpu_idle();
77
78 current_thread_info()->status |= TS_POLLING;
79
80 if (no_idle_nap) {
81 while (1) {
82 while (!need_resched())
83 cpu_relax();
84 schedule();
85 }
86 }
87
88 /* endless idle loop with no priority at all */
89 while (1) {
90 tick_nohz_idle_enter();
91 rcu_idle_enter();
92 while (!need_resched()) {
93 if (cpu_is_offline(cpu))
94 BUG(); /* no HOTPLUG_CPU */
95
96 local_irq_disable();
97 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
98 current_thread_info()->status &= ~TS_POLLING;
99 /*
100 * TS_POLLING-cleared state must be visible before we
101 * test NEED_RESCHED:
102 */
103 smp_mb();
104
105 if (!need_resched())
106 _cpu_idle();
107 else
108 local_irq_enable();
109 current_thread_info()->status |= TS_POLLING;
110 }
111 rcu_idle_exit();
112 tick_nohz_idle_exit();
113 schedule_preempt_disabled();
114 }
115} 68}
116 69
117/* 70/*
@@ -620,8 +573,7 @@ void show_regs(struct pt_regs *regs)
620 int i; 573 int i;
621 574
622 pr_err("\n"); 575 pr_err("\n");
623 pr_err(" Pid: %d, comm: %20s, CPU: %d\n", 576 show_regs_print_info(KERN_ERR);
624 tsk->pid, tsk->comm, smp_processor_id());
625#ifdef __tilegx__ 577#ifdef __tilegx__
626 for (i = 0; i < 51; i += 3) 578 for (i = 0; i < 51; i += 3)
627 pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n", 579 pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n",
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 9835312d5a91..0f83ed4602b2 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -21,9 +21,13 @@
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <linux/regset.h> 22#include <linux/regset.h>
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/tracehook.h>
24#include <asm/traps.h> 25#include <asm/traps.h>
25#include <arch/chip.h> 26#include <arch/chip.h>
26 27
28#define CREATE_TRACE_POINTS
29#include <trace/events/syscalls.h>
30
27void user_enable_single_step(struct task_struct *child) 31void user_enable_single_step(struct task_struct *child)
28{ 32{
29 set_tsk_thread_flag(child, TIF_SINGLESTEP); 33 set_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -246,29 +250,26 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
246} 250}
247#endif 251#endif
248 252
249void do_syscall_trace(void) 253int do_syscall_trace_enter(struct pt_regs *regs)
250{ 254{
251 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 255 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
252 return; 256 if (tracehook_report_syscall_entry(regs))
257 regs->regs[TREG_SYSCALL_NR] = -1;
258 }
253 259
254 if (!(current->ptrace & PT_PTRACED)) 260 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
255 return; 261 trace_sys_enter(regs, regs->regs[TREG_SYSCALL_NR]);
256 262
257 /* 263 return regs->regs[TREG_SYSCALL_NR];
258 * The 0x80 provides a way for the tracing parent to distinguish 264}
259 * between a syscall stop and SIGTRAP delivery
260 */
261 ptrace_notify(SIGTRAP|((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
262 265
263 /* 266void do_syscall_trace_exit(struct pt_regs *regs)
264 * this isn't the same as continuing with a signal, but it will do 267{
265 * for normal use. strace only continues with a signal if the 268 if (test_thread_flag(TIF_SYSCALL_TRACE))
266 * stopping signal is not SIGTRAP. -brl 269 tracehook_report_syscall_exit(regs, 0);
267 */ 270
268 if (current->exit_code) { 271 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
269 send_sig(current->exit_code, current, 1); 272 trace_sys_exit(regs, regs->regs[0]);
270 current->exit_code = 0;
271 }
272} 273}
273 274
274void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) 275void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c
index e686c5ac90be..44bab29bf2f3 100644
--- a/arch/tile/kernel/smpboot.c
+++ b/arch/tile/kernel/smpboot.c
@@ -207,9 +207,7 @@ void __cpuinit online_secondary(void)
207 /* Set up tile-timer clock-event device on this cpu */ 207 /* Set up tile-timer clock-event device on this cpu */
208 setup_tile_timer(); 208 setup_tile_timer();
209 209
210 preempt_enable(); 210 cpu_startup_entry(CPUHP_ONLINE);
211
212 cpu_idle();
213} 211}
214 212
215int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 213int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index f6f50f2a5e37..5ac397ec6986 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -230,6 +230,10 @@ int setup_profiling_timer(unsigned int multiplier)
230 */ 230 */
231cycles_t ns2cycles(unsigned long nsecs) 231cycles_t ns2cycles(unsigned long nsecs)
232{ 232{
233 struct clock_event_device *dev = &__get_cpu_var(tile_timer); 233 /*
234 * We do not have to disable preemption here as each core has the same
235 * clock frequency.
236 */
237 struct clock_event_device *dev = &__raw_get_cpu_var(tile_timer);
234 return ((u64)nsecs * dev->mult) >> dev->shift; 238 return ((u64)nsecs * dev->mult) >> dev->shift;
235} 239}
diff --git a/arch/tile/lib/uaccess.c b/arch/tile/lib/uaccess.c
index f8d398c9ee7f..030abe3ee4f1 100644
--- a/arch/tile/lib/uaccess.c
+++ b/arch/tile/lib/uaccess.c
@@ -22,11 +22,3 @@ int __range_ok(unsigned long addr, unsigned long size)
22 is_arch_mappable_range(addr, size)); 22 is_arch_mappable_range(addr, size));
23} 23}
24EXPORT_SYMBOL(__range_ok); 24EXPORT_SYMBOL(__range_ok);
25
26#ifdef CONFIG_DEBUG_COPY_FROM_USER
27void copy_from_user_overflow(void)
28{
29 WARN(1, "Buffer overflow detected!\n");
30}
31EXPORT_SYMBOL(copy_from_user_overflow);
32#endif
diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c
index b3b4972c2451..dfd63ce87327 100644
--- a/arch/tile/mm/pgtable.c
+++ b/arch/tile/mm/pgtable.c
@@ -592,12 +592,7 @@ void iounmap(volatile void __iomem *addr_in)
592 in parallel. Reuse of the virtual address is prevented by 592 in parallel. Reuse of the virtual address is prevented by
593 leaving it in the global lists until we're done with it. 593 leaving it in the global lists until we're done with it.
594 cpa takes care of the direct mappings. */ 594 cpa takes care of the direct mappings. */
595 read_lock(&vmlist_lock); 595 p = find_vm_area((void *)addr);
596 for (p = vmlist; p; p = p->next) {
597 if (p->addr == addr)
598 break;
599 }
600 read_unlock(&vmlist_lock);
601 596
602 if (!p) { 597 if (!p) {
603 pr_err("iounmap: bad address %p\n", addr); 598 pr_err("iounmap: bad address %p\n", addr);
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 80b47cb71e0a..acbe6c67afba 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -568,11 +568,7 @@ void chan_interrupt(struct line *line, int irq)
568 reactivate_fd(chan->fd, irq); 568 reactivate_fd(chan->fd, irq);
569 if (err == -EIO) { 569 if (err == -EIO) {
570 if (chan->primary) { 570 if (chan->primary) {
571 struct tty_struct *tty = tty_port_tty_get(&line->port); 571 tty_port_tty_hangup(&line->port, false);
572 if (tty != NULL) {
573 tty_hangup(tty);
574 tty_kref_put(tty);
575 }
576 if (line->chan_out != chan) 572 if (line->chan_out != chan)
577 close_one_chan(line->chan_out, 1); 573 close_one_chan(line->chan_out, 1);
578 } 574 }
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index be541cf69fd2..8035145f043b 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -248,7 +248,6 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
248{ 248{
249 struct chan *chan = data; 249 struct chan *chan = data;
250 struct line *line = chan->line; 250 struct line *line = chan->line;
251 struct tty_struct *tty;
252 int err; 251 int err;
253 252
254 /* 253 /*
@@ -267,12 +266,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
267 } 266 }
268 spin_unlock(&line->lock); 267 spin_unlock(&line->lock);
269 268
270 tty = tty_port_tty_get(&line->port); 269 tty_port_tty_wakeup(&line->port);
271 if (tty == NULL)
272 return IRQ_NONE;
273
274 tty_wakeup(tty);
275 tty_kref_put(tty);
276 270
277 return IRQ_HANDLED; 271 return IRQ_HANDLED;
278} 272}
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 4bd82ac0210f..d7d21851e60c 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -782,8 +782,7 @@ static int create_proc_mconsole(void)
782 782
783 ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops); 783 ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops);
784 if (ent == NULL) { 784 if (ent == NULL) {
785 printk(KERN_INFO "create_proc_mconsole : create_proc_entry " 785 printk(KERN_INFO "create_proc_mconsole : proc_create failed\n");
786 "failed\n");
787 return 0; 786 return 0;
788 } 787 }
789 return 0; 788 return 0;
diff --git a/arch/um/include/shared/common-offsets.h b/arch/um/include/shared/common-offsets.h
index 2df313b6a586..c92306809029 100644
--- a/arch/um/include/shared/common-offsets.h
+++ b/arch/um/include/shared/common-offsets.h
@@ -30,8 +30,8 @@ DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
30#ifdef CONFIG_PRINTK 30#ifdef CONFIG_PRINTK
31DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK); 31DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK);
32#endif 32#endif
33#ifdef CONFIG_NO_HZ 33#ifdef CONFIG_NO_HZ_COMMON
34DEFINE(UML_CONFIG_NO_HZ, CONFIG_NO_HZ); 34DEFINE(UML_CONFIG_NO_HZ_COMMON, CONFIG_NO_HZ_COMMON);
35#endif 35#endif
36#ifdef CONFIG_UML_X86 36#ifdef CONFIG_UML_X86
37DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86); 37DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86);
diff --git a/arch/um/kernel/early_printk.c b/arch/um/kernel/early_printk.c
index 49480f092456..4a0800bc37b2 100644
--- a/arch/um/kernel/early_printk.c
+++ b/arch/um/kernel/early_printk.c
@@ -16,7 +16,7 @@ static void early_console_write(struct console *con, const char *s, unsigned int
16 um_early_printk(s, n); 16 um_early_printk(s, n);
17} 17}
18 18
19static struct console early_console = { 19static struct console early_console_dev = {
20 .name = "earlycon", 20 .name = "earlycon",
21 .write = early_console_write, 21 .write = early_console_write,
22 .flags = CON_BOOT, 22 .flags = CON_BOOT,
@@ -25,8 +25,10 @@ static struct console early_console = {
25 25
26static int __init setup_early_printk(char *buf) 26static int __init setup_early_printk(char *buf)
27{ 27{
28 register_console(&early_console); 28 if (!early_console) {
29 29 early_console = &early_console_dev;
30 register_console(&early_console_dev);
31 }
30 return 0; 32 return 0;
31} 33}
32 34
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 5abcbfbe7e25..9df292b270a8 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -42,17 +42,12 @@ static unsigned long brk_end;
42static void setup_highmem(unsigned long highmem_start, 42static void setup_highmem(unsigned long highmem_start,
43 unsigned long highmem_len) 43 unsigned long highmem_len)
44{ 44{
45 struct page *page;
46 unsigned long highmem_pfn; 45 unsigned long highmem_pfn;
47 int i; 46 int i;
48 47
49 highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT; 48 highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT;
50 for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) { 49 for (i = 0; i < highmem_len >> PAGE_SHIFT; i++)
51 page = &mem_map[highmem_pfn + i]; 50 free_highmem_page(&mem_map[highmem_pfn + i]);
52 ClearPageReserved(page);
53 init_page_count(page);
54 __free_page(page);
55 }
56} 51}
57#endif 52#endif
58 53
@@ -73,18 +68,13 @@ void __init mem_init(void)
73 totalram_pages = free_all_bootmem(); 68 totalram_pages = free_all_bootmem();
74 max_low_pfn = totalram_pages; 69 max_low_pfn = totalram_pages;
75#ifdef CONFIG_HIGHMEM 70#ifdef CONFIG_HIGHMEM
76 totalhigh_pages = highmem >> PAGE_SHIFT; 71 setup_highmem(end_iomem, highmem);
77 totalram_pages += totalhigh_pages;
78#endif 72#endif
79 num_physpages = totalram_pages; 73 num_physpages = totalram_pages;
80 max_pfn = totalram_pages; 74 max_pfn = totalram_pages;
81 printk(KERN_INFO "Memory: %luk available\n", 75 printk(KERN_INFO "Memory: %luk available\n",
82 nr_free_pages() << (PAGE_SHIFT-10)); 76 nr_free_pages() << (PAGE_SHIFT-10));
83 kmalloc_ok = 1; 77 kmalloc_ok = 1;
84
85#ifdef CONFIG_HIGHMEM
86 setup_highmem(end_iomem, highmem);
87#endif
88} 78}
89 79
90/* 80/*
@@ -254,15 +244,7 @@ void free_initmem(void)
254#ifdef CONFIG_BLK_DEV_INITRD 244#ifdef CONFIG_BLK_DEV_INITRD
255void free_initrd_mem(unsigned long start, unsigned long end) 245void free_initrd_mem(unsigned long start, unsigned long end)
256{ 246{
257 if (start < end) 247 free_reserved_area(start, end, 0, "initrd");
258 printk(KERN_INFO "Freeing initrd memory: %ldk freed\n",
259 (end - start) >> 10);
260 for (; start < end; start += PAGE_SIZE) {
261 ClearPageReserved(virt_to_page(start));
262 init_page_count(virt_to_page(start));
263 free_page(start);
264 totalram_pages++;
265 }
266} 248}
267#endif 249#endif
268 250
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index b462b13c5bae..bbcef522bcb1 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -210,33 +210,14 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
210 kmalloc_ok = save_kmalloc_ok; 210 kmalloc_ok = save_kmalloc_ok;
211} 211}
212 212
213void default_idle(void) 213void arch_cpu_idle(void)
214{ 214{
215 unsigned long long nsecs; 215 unsigned long long nsecs;
216 216
217 while (1) {
218 /* endless idle loop with no priority at all */
219
220 /*
221 * although we are an idle CPU, we do not want to
222 * get into the scheduler unnecessarily.
223 */
224 if (need_resched())
225 schedule();
226
227 tick_nohz_idle_enter();
228 rcu_idle_enter();
229 nsecs = disable_timer();
230 idle_sleep(nsecs);
231 rcu_idle_exit();
232 tick_nohz_idle_exit();
233 }
234}
235
236void cpu_idle(void)
237{
238 cpu_tasks[current_thread_info()->cpu].pid = os_getpid(); 217 cpu_tasks[current_thread_info()->cpu].pid = os_getpid();
239 default_idle(); 218 nsecs = disable_timer();
219 idle_sleep(nsecs);
220 local_irq_enable();
240} 221}
241 222
242int __cant_sleep(void) { 223int __cant_sleep(void) {
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index e562ff80409a..7d101a2a1541 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -35,18 +35,6 @@ void show_trace(struct task_struct *task, unsigned long * stack)
35} 35}
36#endif 36#endif
37 37
38/*
39 * stack dumps generator - this is used by arch-independent code.
40 * And this is identical to i386 currently.
41 */
42void dump_stack(void)
43{
44 unsigned long stack;
45
46 show_trace(current, &stack);
47}
48EXPORT_SYMBOL(dump_stack);
49
50/*Stolen from arch/i386/kernel/traps.c */ 38/*Stolen from arch/i386/kernel/traps.c */
51static const int kstack_depth_to_print = 24; 39static const int kstack_depth_to_print = 24;
52 40
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index fac388cb464f..e9824d5dd7d5 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -79,7 +79,7 @@ long long os_nsecs(void)
79 return timeval_to_ns(&tv); 79 return timeval_to_ns(&tv);
80} 80}
81 81
82#ifdef UML_CONFIG_NO_HZ 82#ifdef UML_CONFIG_NO_HZ_COMMON
83static int after_sleep_interval(struct timespec *ts) 83static int after_sleep_interval(struct timespec *ts)
84{ 84{
85 return 0; 85 return 0;
diff --git a/arch/um/sys-ppc/sysrq.c b/arch/um/sys-ppc/sysrq.c
index f889449f9285..1ff1ad7f27da 100644
--- a/arch/um/sys-ppc/sysrq.c
+++ b/arch/um/sys-ppc/sysrq.c
@@ -11,6 +11,8 @@
11void show_regs(struct pt_regs_subarch *regs) 11void show_regs(struct pt_regs_subarch *regs)
12{ 12{
13 printk("\n"); 13 printk("\n");
14 show_regs_print_info(KERN_DEFAULT);
15
14 printk("show_regs(): insert regs here.\n"); 16 printk("show_regs(): insert regs here.\n");
15#if 0 17#if 0
16 printk("\n"); 18 printk("\n");
diff --git a/arch/unicore32/kernel/Makefile b/arch/unicore32/kernel/Makefile
index fa497e0efe5a..607a72f2ae35 100644
--- a/arch/unicore32/kernel/Makefile
+++ b/arch/unicore32/kernel/Makefile
@@ -9,7 +9,6 @@ obj-y += setup.o signal.o sys.o stacktrace.o traps.o
9obj-$(CONFIG_MODULES) += ksyms.o module.o 9obj-$(CONFIG_MODULES) += ksyms.o module.o
10obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 10obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
11 11
12obj-$(CONFIG_CPU_FREQ) += cpu-ucv2.o
13obj-$(CONFIG_UNICORE_FPU_F64) += fpu-ucf64.o 12obj-$(CONFIG_UNICORE_FPU_F64) += fpu-ucf64.o
14 13
15# obj-y for architecture PKUnity v3 14# obj-y for architecture PKUnity v3
diff --git a/arch/unicore32/kernel/cpu-ucv2.c b/arch/unicore32/kernel/cpu-ucv2.c
deleted file mode 100644
index 4a99f62584c7..000000000000
--- a/arch/unicore32/kernel/cpu-ucv2.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * linux/arch/unicore32/kernel/cpu-ucv2.c: clock scaling for the UniCore-II
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Maintained by GUAN Xue-tao <gxt@mprc.pku.edu.cn>
7 * Copyright (C) 2001-2010 Guan Xuetao
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/init.h>
17#include <linux/clk.h>
18#include <linux/cpufreq.h>
19
20#include <mach/hardware.h>
21
22static struct cpufreq_driver ucv2_driver;
23
24/* make sure that only the "userspace" governor is run
25 * -- anything else wouldn't make sense on this platform, anyway.
26 */
27int ucv2_verify_speed(struct cpufreq_policy *policy)
28{
29 if (policy->cpu)
30 return -EINVAL;
31
32 cpufreq_verify_within_limits(policy,
33 policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
34
35 return 0;
36}
37
38static unsigned int ucv2_getspeed(unsigned int cpu)
39{
40 struct clk *mclk = clk_get(NULL, "MAIN_CLK");
41
42 if (cpu)
43 return 0;
44 return clk_get_rate(mclk)/1000;
45}
46
47static int ucv2_target(struct cpufreq_policy *policy,
48 unsigned int target_freq,
49 unsigned int relation)
50{
51 unsigned int cur = ucv2_getspeed(0);
52 struct cpufreq_freqs freqs;
53 struct clk *mclk = clk_get(NULL, "MAIN_CLK");
54
55 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
56
57 if (!clk_set_rate(mclk, target_freq * 1000)) {
58 freqs.old = cur;
59 freqs.new = target_freq;
60 freqs.cpu = 0;
61 }
62
63 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
64
65 return 0;
66}
67
68static int __init ucv2_cpu_init(struct cpufreq_policy *policy)
69{
70 if (policy->cpu != 0)
71 return -EINVAL;
72 policy->cur = ucv2_getspeed(0);
73 policy->min = policy->cpuinfo.min_freq = 250000;
74 policy->max = policy->cpuinfo.max_freq = 1000000;
75 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
76 return 0;
77}
78
79static struct cpufreq_driver ucv2_driver = {
80 .flags = CPUFREQ_STICKY,
81 .verify = ucv2_verify_speed,
82 .target = ucv2_target,
83 .get = ucv2_getspeed,
84 .init = ucv2_cpu_init,
85 .name = "UniCore-II",
86};
87
88static int __init ucv2_cpufreq_init(void)
89{
90 return cpufreq_register_driver(&ucv2_driver);
91}
92
93arch_initcall(ucv2_cpufreq_init);
diff --git a/arch/unicore32/kernel/early_printk.c b/arch/unicore32/kernel/early_printk.c
index 3922255f1fa8..9be0d5d02a9a 100644
--- a/arch/unicore32/kernel/early_printk.c
+++ b/arch/unicore32/kernel/early_printk.c
@@ -33,21 +33,17 @@ static struct console early_ocd_console = {
33 .index = -1, 33 .index = -1,
34}; 34};
35 35
36/* Direct interface for emergencies */
37static struct console *early_console = &early_ocd_console;
38
39static int __initdata keep_early;
40
41static int __init setup_early_printk(char *buf) 36static int __init setup_early_printk(char *buf)
42{ 37{
43 if (!buf) 38 int keep_early;
39
40 if (!buf || early_console)
44 return 0; 41 return 0;
45 42
46 if (strstr(buf, "keep")) 43 if (strstr(buf, "keep"))
47 keep_early = 1; 44 keep_early = 1;
48 45
49 if (!strncmp(buf, "ocd", 3)) 46 early_console = &early_ocd_console;
50 early_console = &early_ocd_console;
51 47
52 if (keep_early) 48 if (keep_early)
53 early_console->flags &= ~CON_BOOT; 49 early_console->flags &= ~CON_BOOT;
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index 872d7e22d847..c9447691bdac 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -45,25 +45,10 @@ static const char * const processor_modes[] = {
45 "UK18", "UK19", "UK1A", "EXTN", "UK1C", "UK1D", "UK1E", "SUSR" 45 "UK18", "UK19", "UK1A", "EXTN", "UK1C", "UK1D", "UK1E", "SUSR"
46}; 46};
47 47
48void cpu_idle(void) 48void arch_cpu_idle(void)
49{ 49{
50 /* endless idle loop with no priority at all */ 50 cpu_do_idle();
51 while (1) { 51 local_irq_enable();
52 tick_nohz_idle_enter();
53 rcu_idle_enter();
54 while (!need_resched()) {
55 local_irq_disable();
56 stop_critical_timings();
57 cpu_do_idle();
58 local_irq_enable();
59 start_critical_timings();
60 }
61 rcu_idle_exit();
62 tick_nohz_idle_exit();
63 preempt_enable_no_resched();
64 schedule();
65 preempt_disable();
66 }
67} 52}
68 53
69static char reboot_mode = 'h'; 54static char reboot_mode = 'h';
@@ -159,11 +144,7 @@ void __show_regs(struct pt_regs *regs)
159 unsigned long flags; 144 unsigned long flags;
160 char buf[64]; 145 char buf[64];
161 146
162 printk(KERN_DEFAULT "CPU: %d %s (%s %.*s)\n", 147 show_regs_print_info(KERN_DEFAULT);
163 raw_smp_processor_id(), print_tainted(),
164 init_utsname()->release,
165 (int)strcspn(init_utsname()->version, " "),
166 init_utsname()->version);
167 print_symbol("PC is at %s\n", instruction_pointer(regs)); 148 print_symbol("PC is at %s\n", instruction_pointer(regs));
168 print_symbol("LR is at %s\n", regs->UCreg_lr); 149 print_symbol("LR is at %s\n", regs->UCreg_lr);
169 printk(KERN_DEFAULT "pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n" 150 printk(KERN_DEFAULT "pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
diff --git a/arch/unicore32/kernel/traps.c b/arch/unicore32/kernel/traps.c
index 0870b68d2ad9..c54e32410ead 100644
--- a/arch/unicore32/kernel/traps.c
+++ b/arch/unicore32/kernel/traps.c
@@ -170,12 +170,6 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
170 c_backtrace(fp, mode); 170 c_backtrace(fp, mode);
171} 171}
172 172
173void dump_stack(void)
174{
175 dump_backtrace(NULL, NULL);
176}
177EXPORT_SYMBOL(dump_stack);
178
179void show_stack(struct task_struct *tsk, unsigned long *sp) 173void show_stack(struct task_struct *tsk, unsigned long *sp)
180{ 174{
181 dump_backtrace(NULL, tsk); 175 dump_backtrace(NULL, tsk);
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index de186bde8975..63df12d71ce3 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -66,6 +66,9 @@ void show_mem(unsigned int filter)
66 printk(KERN_DEFAULT "Mem-info:\n"); 66 printk(KERN_DEFAULT "Mem-info:\n");
67 show_free_areas(filter); 67 show_free_areas(filter);
68 68
69 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
70 return;
71
69 for_each_bank(i, mi) { 72 for_each_bank(i, mi) {
70 struct membank *bank = &mi->bank[i]; 73 struct membank *bank = &mi->bank[i];
71 unsigned int pfn1, pfn2; 74 unsigned int pfn1, pfn2;
@@ -313,24 +316,6 @@ void __init bootmem_init(void)
313 max_pfn = max_high - PHYS_PFN_OFFSET; 316 max_pfn = max_high - PHYS_PFN_OFFSET;
314} 317}
315 318
316static inline int free_area(unsigned long pfn, unsigned long end, char *s)
317{
318 unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
319
320 for (; pfn < end; pfn++) {
321 struct page *page = pfn_to_page(pfn);
322 ClearPageReserved(page);
323 init_page_count(page);
324 __free_page(page);
325 pages++;
326 }
327
328 if (size && s)
329 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
330
331 return pages;
332}
333
334static inline void 319static inline void
335free_memmap(unsigned long start_pfn, unsigned long end_pfn) 320free_memmap(unsigned long start_pfn, unsigned long end_pfn)
336{ 321{
@@ -404,9 +389,9 @@ void __init mem_init(void)
404 389
405 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 390 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
406 391
407 /* this will put all unused low memory onto the freelists */
408 free_unused_memmap(&meminfo); 392 free_unused_memmap(&meminfo);
409 393
394 /* this will put all unused low memory onto the freelists */
410 totalram_pages += free_all_bootmem(); 395 totalram_pages += free_all_bootmem();
411 396
412 reserved_pages = free_pages = 0; 397 reserved_pages = free_pages = 0;
@@ -491,9 +476,7 @@ void __init mem_init(void)
491 476
492void free_initmem(void) 477void free_initmem(void)
493{ 478{
494 totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), 479 free_initmem_default(0);
495 __phys_to_pfn(__pa(__init_end)),
496 "init");
497} 480}
498 481
499#ifdef CONFIG_BLK_DEV_INITRD 482#ifdef CONFIG_BLK_DEV_INITRD
@@ -503,9 +486,7 @@ static int keep_initrd;
503void free_initrd_mem(unsigned long start, unsigned long end) 486void free_initrd_mem(unsigned long start, unsigned long end)
504{ 487{
505 if (!keep_initrd) 488 if (!keep_initrd)
506 totalram_pages += free_area(__phys_to_pfn(__pa(start)), 489 free_reserved_area(start, end, 0, "initrd");
507 __phys_to_pfn(__pa(end)),
508 "initrd");
509} 490}
510 491
511static int __init keepinitrd_setup(char *__unused) 492static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/unicore32/mm/ioremap.c b/arch/unicore32/mm/ioremap.c
index b7a605597b08..13068ee22f33 100644
--- a/arch/unicore32/mm/ioremap.c
+++ b/arch/unicore32/mm/ioremap.c
@@ -235,7 +235,7 @@ EXPORT_SYMBOL(__uc32_ioremap_cached);
235void __uc32_iounmap(volatile void __iomem *io_addr) 235void __uc32_iounmap(volatile void __iomem *io_addr)
236{ 236{
237 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr); 237 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
238 struct vm_struct **p, *tmp; 238 struct vm_struct *vm;
239 239
240 /* 240 /*
241 * If this is a section based mapping we need to handle it 241 * If this is a section based mapping we need to handle it
@@ -244,17 +244,10 @@ void __uc32_iounmap(volatile void __iomem *io_addr)
244 * all the mappings before the area can be reclaimed 244 * all the mappings before the area can be reclaimed
245 * by someone else. 245 * by someone else.
246 */ 246 */
247 write_lock(&vmlist_lock); 247 vm = find_vm_area(addr);
248 for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) { 248 if (vm && (vm->flags & VM_IOREMAP) &&
249 if ((tmp->flags & VM_IOREMAP) && (tmp->addr == addr)) { 249 (vm->flags & VM_UNICORE_SECTION_MAPPING))
250 if (tmp->flags & VM_UNICORE_SECTION_MAPPING) { 250 unmap_area_sections((unsigned long)vm->addr, vm->size);
251 unmap_area_sections((unsigned long)tmp->addr,
252 tmp->size);
253 }
254 break;
255 }
256 }
257 write_unlock(&vmlist_lock);
258 251
259 vunmap(addr); 252 vunmap(addr);
260} 253}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 15b5cef4aa38..5db2117ae288 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -20,6 +20,7 @@ config X86_64
20### Arch settings 20### Arch settings
21config X86 21config X86
22 def_bool y 22 def_bool y
23 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
23 select HAVE_AOUT if X86_32 24 select HAVE_AOUT if X86_32
24 select HAVE_UNSTABLE_SCHED_CLOCK 25 select HAVE_UNSTABLE_SCHED_CLOCK
25 select ARCH_SUPPORTS_NUMA_BALANCING 26 select ARCH_SUPPORTS_NUMA_BALANCING
@@ -120,6 +121,7 @@ config X86
120 select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION 121 select OLD_SIGSUSPEND3 if X86_32 || IA32_EMULATION
121 select OLD_SIGACTION if X86_32 122 select OLD_SIGACTION if X86_32
122 select COMPAT_OLD_SIGACTION if IA32_EMULATION 123 select COMPAT_OLD_SIGACTION if IA32_EMULATION
124 select RTC_LIB
123 125
124config INSTRUCTION_DECODER 126config INSTRUCTION_DECODER
125 def_bool y 127 def_bool y
@@ -188,9 +190,6 @@ config GENERIC_CALIBRATE_DELAY
188config ARCH_HAS_CPU_RELAX 190config ARCH_HAS_CPU_RELAX
189 def_bool y 191 def_bool y
190 192
191config ARCH_HAS_DEFAULT_IDLE
192 def_bool y
193
194config ARCH_HAS_CACHE_LINE_SIZE 193config ARCH_HAS_CACHE_LINE_SIZE
195 def_bool y 194 def_bool y
196 195
@@ -389,7 +388,7 @@ config X86_NUMACHIP
389 388
390config X86_VSMP 389config X86_VSMP
391 bool "ScaleMP vSMP" 390 bool "ScaleMP vSMP"
392 select PARAVIRT_GUEST 391 select HYPERVISOR_GUEST
393 select PARAVIRT 392 select PARAVIRT
394 depends on X86_64 && PCI 393 depends on X86_64 && PCI
395 depends on X86_EXTENDED_PLATFORM 394 depends on X86_EXTENDED_PLATFORM
@@ -596,44 +595,17 @@ config SCHED_OMIT_FRAME_POINTER
596 595
597 If in doubt, say "Y". 596 If in doubt, say "Y".
598 597
599menuconfig PARAVIRT_GUEST 598menuconfig HYPERVISOR_GUEST
600 bool "Paravirtualized guest support" 599 bool "Linux guest support"
601 ---help---
602 Say Y here to get to see options related to running Linux under
603 various hypervisors. This option alone does not add any kernel code.
604
605 If you say N, all options in this submenu will be skipped and disabled.
606
607if PARAVIRT_GUEST
608
609config PARAVIRT_TIME_ACCOUNTING
610 bool "Paravirtual steal time accounting"
611 select PARAVIRT
612 default n
613 ---help--- 600 ---help---
614 Select this option to enable fine granularity task steal time 601 Say Y here to enable options for running Linux under various hyper-
615 accounting. Time spent executing other tasks in parallel with 602 visors. This option enables basic hypervisor detection and platform
616 the current vCPU is discounted from the vCPU power. To account for 603 setup.
617 that, there can be a small performance impact.
618
619 If in doubt, say N here.
620
621source "arch/x86/xen/Kconfig"
622 604
623config KVM_GUEST 605 If you say N, all options in this submenu will be skipped and
624 bool "KVM Guest support (including kvmclock)" 606 disabled, and Linux guest support won't be built in.
625 select PARAVIRT
626 select PARAVIRT
627 select PARAVIRT_CLOCK
628 default y if PARAVIRT_GUEST
629 ---help---
630 This option enables various optimizations for running under the KVM
631 hypervisor. It includes a paravirtualized clock, so that instead
632 of relying on a PIT (or probably other) emulation by the
633 underlying device model, the host provides the guest with
634 timing infrastructure such as time of day, and system time
635 607
636source "arch/x86/lguest/Kconfig" 608if HYPERVISOR_GUEST
637 609
638config PARAVIRT 610config PARAVIRT
639 bool "Enable paravirtualization code" 611 bool "Enable paravirtualization code"
@@ -643,6 +615,13 @@ config PARAVIRT
643 over full virtualization. However, when run without a hypervisor 615 over full virtualization. However, when run without a hypervisor
644 the kernel is theoretically slower and slightly larger. 616 the kernel is theoretically slower and slightly larger.
645 617
618config PARAVIRT_DEBUG
619 bool "paravirt-ops debugging"
620 depends on PARAVIRT && DEBUG_KERNEL
621 ---help---
622 Enable to debug paravirt_ops internals. Specifically, BUG if
623 a paravirt_op is missing when it is called.
624
646config PARAVIRT_SPINLOCKS 625config PARAVIRT_SPINLOCKS
647 bool "Paravirtualization layer for spinlocks" 626 bool "Paravirtualization layer for spinlocks"
648 depends on PARAVIRT && SMP 627 depends on PARAVIRT && SMP
@@ -656,17 +635,38 @@ config PARAVIRT_SPINLOCKS
656 635
657 If you are unsure how to answer this question, answer N. 636 If you are unsure how to answer this question, answer N.
658 637
659config PARAVIRT_CLOCK 638source "arch/x86/xen/Kconfig"
660 bool
661 639
662endif 640config KVM_GUEST
641 bool "KVM Guest support (including kvmclock)"
642 depends on PARAVIRT
643 select PARAVIRT_CLOCK
644 default y
645 ---help---
646 This option enables various optimizations for running under the KVM
647 hypervisor. It includes a paravirtualized clock, so that instead
648 of relying on a PIT (or probably other) emulation by the
649 underlying device model, the host provides the guest with
650 timing infrastructure such as time of day, and system time
663 651
664config PARAVIRT_DEBUG 652source "arch/x86/lguest/Kconfig"
665 bool "paravirt-ops debugging" 653
666 depends on PARAVIRT && DEBUG_KERNEL 654config PARAVIRT_TIME_ACCOUNTING
655 bool "Paravirtual steal time accounting"
656 depends on PARAVIRT
657 default n
667 ---help--- 658 ---help---
668 Enable to debug paravirt_ops internals. Specifically, BUG if 659 Select this option to enable fine granularity task steal time
669 a paravirt_op is missing when it is called. 660 accounting. Time spent executing other tasks in parallel with
661 the current vCPU is discounted from the vCPU power. To account for
662 that, there can be a small performance impact.
663
664 If in doubt, say N here.
665
666config PARAVIRT_CLOCK
667 bool
668
669endif #HYPERVISOR_GUEST
670 670
671config NO_BOOTMEM 671config NO_BOOTMEM
672 def_bool y 672 def_bool y
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index b322f124ee3c..c198b7e13e7b 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -131,7 +131,7 @@ config DOUBLEFAULT
131 131
132config DEBUG_TLBFLUSH 132config DEBUG_TLBFLUSH
133 bool "Set upper limit of TLB entries to flush one-by-one" 133 bool "Set upper limit of TLB entries to flush one-by-one"
134 depends on DEBUG_KERNEL && (X86_64 || X86_INVLPG) 134 depends on DEBUG_KERNEL
135 ---help--- 135 ---help---
136 136
137 X86-only for now. 137 X86-only for now.
@@ -292,20 +292,6 @@ config OPTIMIZE_INLINING
292 292
293 If unsure, say N. 293 If unsure, say N.
294 294
295config DEBUG_STRICT_USER_COPY_CHECKS
296 bool "Strict copy size checks"
297 depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
298 ---help---
299 Enabling this option turns a certain set of sanity checks for user
300 copy operations into compile time failures.
301
302 The copy_from_user() etc checks are there to help test if there
303 are sufficient security checks on the length argument of
304 the copy operation, by having gcc prove that the argument is
305 within bounds.
306
307 If unsure, or if you run an older (pre 4.4) gcc, say N.
308
309config DEBUG_NMI_SELFTEST 295config DEBUG_NMI_SELFTEST
310 bool "NMI Selftest" 296 bool "NMI Selftest"
311 depends on DEBUG_KERNEL && X86_LOCAL_APIC 297 depends on DEBUG_KERNEL && X86_LOCAL_APIC
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 8615f7581820..35ee62fccf98 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -258,7 +258,7 @@ static efi_status_t setup_efi_vars(struct boot_params *params)
258 u64 store_size, remaining_size, var_size; 258 u64 store_size, remaining_size, var_size;
259 efi_status_t status; 259 efi_status_t status;
260 260
261 if (!sys_table->runtime->query_variable_info) 261 if (sys_table->runtime->hdr.revision < EFI_2_00_SYSTEM_TABLE_REVISION)
262 return EFI_UNSUPPORTED; 262 return EFI_UNSUPPORTED;
263 263
264 data = (struct setup_data *)(unsigned long)params->hdr.setup_data; 264 data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
@@ -266,7 +266,7 @@ static efi_status_t setup_efi_vars(struct boot_params *params)
266 while (data && data->next) 266 while (data && data->next)
267 data = (struct setup_data *)(unsigned long)data->next; 267 data = (struct setup_data *)(unsigned long)data->next;
268 268
269 status = efi_call_phys4(sys_table->runtime->query_variable_info, 269 status = efi_call_phys4((void *)sys_table->runtime->query_variable_info,
270 EFI_VARIABLE_NON_VOLATILE | 270 EFI_VARIABLE_NON_VOLATILE |
271 EFI_VARIABLE_BOOTSERVICE_ACCESS | 271 EFI_VARIABLE_BOOTSERVICE_ACCESS |
272 EFI_VARIABLE_RUNTIME_ACCESS, &store_size, 272 EFI_VARIABLE_RUNTIME_ACCESS, &store_size,
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index c1d383d1fb7e..16f24e6dad79 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -52,7 +52,7 @@ ENTRY(startup_32)
52 jnz 1f 52 jnz 1f
53 53
54 cli 54 cli
55 movl $(__KERNEL_DS), %eax 55 movl $(__BOOT_DS), %eax
56 movl %eax, %ds 56 movl %eax, %ds
57 movl %eax, %es 57 movl %eax, %es
58 movl %eax, %ss 58 movl %eax, %ss
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 63947a8f9f0f..a3a0ed80f17c 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -2,6 +2,10 @@
2# Arch-specific CryptoAPI modules. 2# Arch-specific CryptoAPI modules.
3# 3#
4 4
5avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no)
6avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\
7 $(comma)4)$(comma)%ymm2,yes,no)
8
5obj-$(CONFIG_CRYPTO_ABLK_HELPER_X86) += ablk_helper.o 9obj-$(CONFIG_CRYPTO_ABLK_HELPER_X86) += ablk_helper.o
6obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o 10obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o
7 11
@@ -12,22 +16,37 @@ obj-$(CONFIG_CRYPTO_SERPENT_SSE2_586) += serpent-sse2-i586.o
12 16
13obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o 17obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o
14obj-$(CONFIG_CRYPTO_CAMELLIA_X86_64) += camellia-x86_64.o 18obj-$(CONFIG_CRYPTO_CAMELLIA_X86_64) += camellia-x86_64.o
15obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64) += camellia-aesni-avx-x86_64.o
16obj-$(CONFIG_CRYPTO_CAST5_AVX_X86_64) += cast5-avx-x86_64.o
17obj-$(CONFIG_CRYPTO_CAST6_AVX_X86_64) += cast6-avx-x86_64.o
18obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o 19obj-$(CONFIG_CRYPTO_BLOWFISH_X86_64) += blowfish-x86_64.o
19obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o 20obj-$(CONFIG_CRYPTO_TWOFISH_X86_64) += twofish-x86_64.o
20obj-$(CONFIG_CRYPTO_TWOFISH_X86_64_3WAY) += twofish-x86_64-3way.o 21obj-$(CONFIG_CRYPTO_TWOFISH_X86_64_3WAY) += twofish-x86_64-3way.o
21obj-$(CONFIG_CRYPTO_TWOFISH_AVX_X86_64) += twofish-avx-x86_64.o
22obj-$(CONFIG_CRYPTO_SALSA20_X86_64) += salsa20-x86_64.o 22obj-$(CONFIG_CRYPTO_SALSA20_X86_64) += salsa20-x86_64.o
23obj-$(CONFIG_CRYPTO_SERPENT_SSE2_X86_64) += serpent-sse2-x86_64.o 23obj-$(CONFIG_CRYPTO_SERPENT_SSE2_X86_64) += serpent-sse2-x86_64.o
24obj-$(CONFIG_CRYPTO_SERPENT_AVX_X86_64) += serpent-avx-x86_64.o
25obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o 24obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
26obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o 25obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o
27 26
28obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o 27obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o
29obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o 28obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
30obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o 29obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
30obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
31obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
32
33# These modules require assembler to support AVX.
34ifeq ($(avx_supported),yes)
35 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64) += \
36 camellia-aesni-avx-x86_64.o
37 obj-$(CONFIG_CRYPTO_CAST5_AVX_X86_64) += cast5-avx-x86_64.o
38 obj-$(CONFIG_CRYPTO_CAST6_AVX_X86_64) += cast6-avx-x86_64.o
39 obj-$(CONFIG_CRYPTO_TWOFISH_AVX_X86_64) += twofish-avx-x86_64.o
40 obj-$(CONFIG_CRYPTO_SERPENT_AVX_X86_64) += serpent-avx-x86_64.o
41endif
42
43# These modules require assembler to support AVX2.
44ifeq ($(avx2_supported),yes)
45 obj-$(CONFIG_CRYPTO_BLOWFISH_AVX2_X86_64) += blowfish-avx2.o
46 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o
47 obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o
48 obj-$(CONFIG_CRYPTO_TWOFISH_AVX2_X86_64) += twofish-avx2.o
49endif
31 50
32aes-i586-y := aes-i586-asm_32.o aes_glue.o 51aes-i586-y := aes-i586-asm_32.o aes_glue.o
33twofish-i586-y := twofish-i586-asm_32.o twofish_glue.o 52twofish-i586-y := twofish-i586-asm_32.o twofish_glue.o
@@ -36,21 +55,35 @@ serpent-sse2-i586-y := serpent-sse2-i586-asm_32.o serpent_sse2_glue.o
36 55
37aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o 56aes-x86_64-y := aes-x86_64-asm_64.o aes_glue.o
38camellia-x86_64-y := camellia-x86_64-asm_64.o camellia_glue.o 57camellia-x86_64-y := camellia-x86_64-asm_64.o camellia_glue.o
39camellia-aesni-avx-x86_64-y := camellia-aesni-avx-asm_64.o \
40 camellia_aesni_avx_glue.o
41cast5-avx-x86_64-y := cast5-avx-x86_64-asm_64.o cast5_avx_glue.o
42cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o
43blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o 58blowfish-x86_64-y := blowfish-x86_64-asm_64.o blowfish_glue.o
44twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o 59twofish-x86_64-y := twofish-x86_64-asm_64.o twofish_glue.o
45twofish-x86_64-3way-y := twofish-x86_64-asm_64-3way.o twofish_glue_3way.o 60twofish-x86_64-3way-y := twofish-x86_64-asm_64-3way.o twofish_glue_3way.o
46twofish-avx-x86_64-y := twofish-avx-x86_64-asm_64.o twofish_avx_glue.o
47salsa20-x86_64-y := salsa20-x86_64-asm_64.o salsa20_glue.o 61salsa20-x86_64-y := salsa20-x86_64-asm_64.o salsa20_glue.o
48serpent-sse2-x86_64-y := serpent-sse2-x86_64-asm_64.o serpent_sse2_glue.o 62serpent-sse2-x86_64-y := serpent-sse2-x86_64-asm_64.o serpent_sse2_glue.o
49serpent-avx-x86_64-y := serpent-avx-x86_64-asm_64.o serpent_avx_glue.o 63
64ifeq ($(avx_supported),yes)
65 camellia-aesni-avx-x86_64-y := camellia-aesni-avx-asm_64.o \
66 camellia_aesni_avx_glue.o
67 cast5-avx-x86_64-y := cast5-avx-x86_64-asm_64.o cast5_avx_glue.o
68 cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o
69 twofish-avx-x86_64-y := twofish-avx-x86_64-asm_64.o \
70 twofish_avx_glue.o
71 serpent-avx-x86_64-y := serpent-avx-x86_64-asm_64.o \
72 serpent_avx_glue.o
73endif
74
75ifeq ($(avx2_supported),yes)
76 blowfish-avx2-y := blowfish-avx2-asm_64.o blowfish_avx2_glue.o
77 camellia-aesni-avx2-y := camellia-aesni-avx2-asm_64.o camellia_aesni_avx2_glue.o
78 serpent-avx2-y := serpent-avx2-asm_64.o serpent_avx2_glue.o
79 twofish-avx2-y := twofish-avx2-asm_64.o twofish_avx2_glue.o
80endif
50 81
51aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o 82aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
52ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o 83ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
53sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o 84sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o
54crc32c-intel-y := crc32c-intel_glue.o 85crc32c-intel-y := crc32c-intel_glue.o
55crc32c-intel-$(CONFIG_CRYPTO_CRC32C_X86_64) += crc32c-pcl-intel-asm_64.o 86crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o
56crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o 87crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o
88sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o
89sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
index 04b797767b9e..62fe22cd4cba 100644
--- a/arch/x86/crypto/aesni-intel_asm.S
+++ b/arch/x86/crypto/aesni-intel_asm.S
@@ -34,6 +34,10 @@
34 34
35#ifdef __x86_64__ 35#ifdef __x86_64__
36.data 36.data
37.align 16
38.Lgf128mul_x_ble_mask:
39 .octa 0x00000000000000010000000000000087
40
37POLY: .octa 0xC2000000000000000000000000000001 41POLY: .octa 0xC2000000000000000000000000000001
38TWOONE: .octa 0x00000001000000000000000000000001 42TWOONE: .octa 0x00000001000000000000000000000001
39 43
@@ -105,6 +109,8 @@ enc: .octa 0x2
105#define CTR %xmm11 109#define CTR %xmm11
106#define INC %xmm12 110#define INC %xmm12
107 111
112#define GF128MUL_MASK %xmm10
113
108#ifdef __x86_64__ 114#ifdef __x86_64__
109#define AREG %rax 115#define AREG %rax
110#define KEYP %rdi 116#define KEYP %rdi
@@ -2636,4 +2642,115 @@ ENTRY(aesni_ctr_enc)
2636.Lctr_enc_just_ret: 2642.Lctr_enc_just_ret:
2637 ret 2643 ret
2638ENDPROC(aesni_ctr_enc) 2644ENDPROC(aesni_ctr_enc)
2645
2646/*
2647 * _aesni_gf128mul_x_ble: internal ABI
2648 * Multiply in GF(2^128) for XTS IVs
2649 * input:
2650 * IV: current IV
2651 * GF128MUL_MASK == mask with 0x87 and 0x01
2652 * output:
2653 * IV: next IV
2654 * changed:
2655 * CTR: == temporary value
2656 */
2657#define _aesni_gf128mul_x_ble() \
2658 pshufd $0x13, IV, CTR; \
2659 paddq IV, IV; \
2660 psrad $31, CTR; \
2661 pand GF128MUL_MASK, CTR; \
2662 pxor CTR, IV;
2663
2664/*
2665 * void aesni_xts_crypt8(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
2666 * bool enc, u8 *iv)
2667 */
2668ENTRY(aesni_xts_crypt8)
2669 cmpb $0, %cl
2670 movl $0, %ecx
2671 movl $240, %r10d
2672 leaq _aesni_enc4, %r11
2673 leaq _aesni_dec4, %rax
2674 cmovel %r10d, %ecx
2675 cmoveq %rax, %r11
2676
2677 movdqa .Lgf128mul_x_ble_mask, GF128MUL_MASK
2678 movups (IVP), IV
2679
2680 mov 480(KEYP), KLEN
2681 addq %rcx, KEYP
2682
2683 movdqa IV, STATE1
2684 pxor 0x00(INP), STATE1
2685 movdqu IV, 0x00(OUTP)
2686
2687 _aesni_gf128mul_x_ble()
2688 movdqa IV, STATE2
2689 pxor 0x10(INP), STATE2
2690 movdqu IV, 0x10(OUTP)
2691
2692 _aesni_gf128mul_x_ble()
2693 movdqa IV, STATE3
2694 pxor 0x20(INP), STATE3
2695 movdqu IV, 0x20(OUTP)
2696
2697 _aesni_gf128mul_x_ble()
2698 movdqa IV, STATE4
2699 pxor 0x30(INP), STATE4
2700 movdqu IV, 0x30(OUTP)
2701
2702 call *%r11
2703
2704 pxor 0x00(OUTP), STATE1
2705 movdqu STATE1, 0x00(OUTP)
2706
2707 _aesni_gf128mul_x_ble()
2708 movdqa IV, STATE1
2709 pxor 0x40(INP), STATE1
2710 movdqu IV, 0x40(OUTP)
2711
2712 pxor 0x10(OUTP), STATE2
2713 movdqu STATE2, 0x10(OUTP)
2714
2715 _aesni_gf128mul_x_ble()
2716 movdqa IV, STATE2
2717 pxor 0x50(INP), STATE2
2718 movdqu IV, 0x50(OUTP)
2719
2720 pxor 0x20(OUTP), STATE3
2721 movdqu STATE3, 0x20(OUTP)
2722
2723 _aesni_gf128mul_x_ble()
2724 movdqa IV, STATE3
2725 pxor 0x60(INP), STATE3
2726 movdqu IV, 0x60(OUTP)
2727
2728 pxor 0x30(OUTP), STATE4
2729 movdqu STATE4, 0x30(OUTP)
2730
2731 _aesni_gf128mul_x_ble()
2732 movdqa IV, STATE4
2733 pxor 0x70(INP), STATE4
2734 movdqu IV, 0x70(OUTP)
2735
2736 _aesni_gf128mul_x_ble()
2737 movups IV, (IVP)
2738
2739 call *%r11
2740
2741 pxor 0x40(OUTP), STATE1
2742 movdqu STATE1, 0x40(OUTP)
2743
2744 pxor 0x50(OUTP), STATE2
2745 movdqu STATE2, 0x50(OUTP)
2746
2747 pxor 0x60(OUTP), STATE3
2748 movdqu STATE3, 0x60(OUTP)
2749
2750 pxor 0x70(OUTP), STATE4
2751 movdqu STATE4, 0x70(OUTP)
2752
2753 ret
2754ENDPROC(aesni_xts_crypt8)
2755
2639#endif 2756#endif
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index a0795da22c02..f80e668785c0 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -39,6 +39,9 @@
39#include <crypto/internal/aead.h> 39#include <crypto/internal/aead.h>
40#include <linux/workqueue.h> 40#include <linux/workqueue.h>
41#include <linux/spinlock.h> 41#include <linux/spinlock.h>
42#ifdef CONFIG_X86_64
43#include <asm/crypto/glue_helper.h>
44#endif
42 45
43#if defined(CONFIG_CRYPTO_PCBC) || defined(CONFIG_CRYPTO_PCBC_MODULE) 46#if defined(CONFIG_CRYPTO_PCBC) || defined(CONFIG_CRYPTO_PCBC_MODULE)
44#define HAS_PCBC 47#define HAS_PCBC
@@ -102,6 +105,9 @@ void crypto_fpu_exit(void);
102asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out, 105asmlinkage void aesni_ctr_enc(struct crypto_aes_ctx *ctx, u8 *out,
103 const u8 *in, unsigned int len, u8 *iv); 106 const u8 *in, unsigned int len, u8 *iv);
104 107
108asmlinkage void aesni_xts_crypt8(struct crypto_aes_ctx *ctx, u8 *out,
109 const u8 *in, bool enc, u8 *iv);
110
105/* asmlinkage void aesni_gcm_enc() 111/* asmlinkage void aesni_gcm_enc()
106 * void *ctx, AES Key schedule. Starts on a 16 byte boundary. 112 * void *ctx, AES Key schedule. Starts on a 16 byte boundary.
107 * u8 *out, Ciphertext output. Encrypt in-place is allowed. 113 * u8 *out, Ciphertext output. Encrypt in-place is allowed.
@@ -510,6 +516,78 @@ static void aesni_xts_tweak(void *ctx, u8 *out, const u8 *in)
510 aesni_enc(ctx, out, in); 516 aesni_enc(ctx, out, in);
511} 517}
512 518
519#ifdef CONFIG_X86_64
520
521static void aesni_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
522{
523 glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(aesni_enc));
524}
525
526static void aesni_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv)
527{
528 glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(aesni_dec));
529}
530
531static void aesni_xts_enc8(void *ctx, u128 *dst, const u128 *src, le128 *iv)
532{
533 aesni_xts_crypt8(ctx, (u8 *)dst, (const u8 *)src, true, (u8 *)iv);
534}
535
536static void aesni_xts_dec8(void *ctx, u128 *dst, const u128 *src, le128 *iv)
537{
538 aesni_xts_crypt8(ctx, (u8 *)dst, (const u8 *)src, false, (u8 *)iv);
539}
540
541static const struct common_glue_ctx aesni_enc_xts = {
542 .num_funcs = 2,
543 .fpu_blocks_limit = 1,
544
545 .funcs = { {
546 .num_blocks = 8,
547 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(aesni_xts_enc8) }
548 }, {
549 .num_blocks = 1,
550 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(aesni_xts_enc) }
551 } }
552};
553
554static const struct common_glue_ctx aesni_dec_xts = {
555 .num_funcs = 2,
556 .fpu_blocks_limit = 1,
557
558 .funcs = { {
559 .num_blocks = 8,
560 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(aesni_xts_dec8) }
561 }, {
562 .num_blocks = 1,
563 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(aesni_xts_dec) }
564 } }
565};
566
567static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
568 struct scatterlist *src, unsigned int nbytes)
569{
570 struct aesni_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
571
572 return glue_xts_crypt_128bit(&aesni_enc_xts, desc, dst, src, nbytes,
573 XTS_TWEAK_CAST(aesni_xts_tweak),
574 aes_ctx(ctx->raw_tweak_ctx),
575 aes_ctx(ctx->raw_crypt_ctx));
576}
577
578static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
579 struct scatterlist *src, unsigned int nbytes)
580{
581 struct aesni_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
582
583 return glue_xts_crypt_128bit(&aesni_dec_xts, desc, dst, src, nbytes,
584 XTS_TWEAK_CAST(aesni_xts_tweak),
585 aes_ctx(ctx->raw_tweak_ctx),
586 aes_ctx(ctx->raw_crypt_ctx));
587}
588
589#else
590
513static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 591static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
514 struct scatterlist *src, unsigned int nbytes) 592 struct scatterlist *src, unsigned int nbytes)
515{ 593{
@@ -560,6 +638,8 @@ static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
560 return ret; 638 return ret;
561} 639}
562 640
641#endif
642
563#ifdef CONFIG_X86_64 643#ifdef CONFIG_X86_64
564static int rfc4106_init(struct crypto_tfm *tfm) 644static int rfc4106_init(struct crypto_tfm *tfm)
565{ 645{
diff --git a/arch/x86/crypto/blowfish-avx2-asm_64.S b/arch/x86/crypto/blowfish-avx2-asm_64.S
new file mode 100644
index 000000000000..784452e0d05d
--- /dev/null
+++ b/arch/x86/crypto/blowfish-avx2-asm_64.S
@@ -0,0 +1,449 @@
1/*
2 * x86_64/AVX2 assembler optimized version of Blowfish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
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#include <linux/linkage.h>
14
15.file "blowfish-avx2-asm_64.S"
16
17.data
18.align 32
19
20.Lprefetch_mask:
21.long 0*64
22.long 1*64
23.long 2*64
24.long 3*64
25.long 4*64
26.long 5*64
27.long 6*64
28.long 7*64
29
30.Lbswap32_mask:
31.long 0x00010203
32.long 0x04050607
33.long 0x08090a0b
34.long 0x0c0d0e0f
35
36.Lbswap128_mask:
37 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
38.Lbswap_iv_mask:
39 .byte 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0
40
41.text
42/* structure of crypto context */
43#define p 0
44#define s0 ((16 + 2) * 4)
45#define s1 ((16 + 2 + (1 * 256)) * 4)
46#define s2 ((16 + 2 + (2 * 256)) * 4)
47#define s3 ((16 + 2 + (3 * 256)) * 4)
48
49/* register macros */
50#define CTX %rdi
51#define RIO %rdx
52
53#define RS0 %rax
54#define RS1 %r8
55#define RS2 %r9
56#define RS3 %r10
57
58#define RLOOP %r11
59#define RLOOPd %r11d
60
61#define RXr0 %ymm8
62#define RXr1 %ymm9
63#define RXr2 %ymm10
64#define RXr3 %ymm11
65#define RXl0 %ymm12
66#define RXl1 %ymm13
67#define RXl2 %ymm14
68#define RXl3 %ymm15
69
70/* temp regs */
71#define RT0 %ymm0
72#define RT0x %xmm0
73#define RT1 %ymm1
74#define RT1x %xmm1
75#define RIDX0 %ymm2
76#define RIDX1 %ymm3
77#define RIDX1x %xmm3
78#define RIDX2 %ymm4
79#define RIDX3 %ymm5
80
81/* vpgatherdd mask and '-1' */
82#define RNOT %ymm6
83
84/* byte mask, (-1 >> 24) */
85#define RBYTE %ymm7
86
87/***********************************************************************
88 * 32-way AVX2 blowfish
89 ***********************************************************************/
90#define F(xl, xr) \
91 vpsrld $24, xl, RIDX0; \
92 vpsrld $16, xl, RIDX1; \
93 vpsrld $8, xl, RIDX2; \
94 vpand RBYTE, RIDX1, RIDX1; \
95 vpand RBYTE, RIDX2, RIDX2; \
96 vpand RBYTE, xl, RIDX3; \
97 \
98 vpgatherdd RNOT, (RS0, RIDX0, 4), RT0; \
99 vpcmpeqd RNOT, RNOT, RNOT; \
100 vpcmpeqd RIDX0, RIDX0, RIDX0; \
101 \
102 vpgatherdd RNOT, (RS1, RIDX1, 4), RT1; \
103 vpcmpeqd RIDX1, RIDX1, RIDX1; \
104 vpaddd RT0, RT1, RT0; \
105 \
106 vpgatherdd RIDX0, (RS2, RIDX2, 4), RT1; \
107 vpxor RT0, RT1, RT0; \
108 \
109 vpgatherdd RIDX1, (RS3, RIDX3, 4), RT1; \
110 vpcmpeqd RNOT, RNOT, RNOT; \
111 vpaddd RT0, RT1, RT0; \
112 \
113 vpxor RT0, xr, xr;
114
115#define add_roundkey(xl, nmem) \
116 vpbroadcastd nmem, RT0; \
117 vpxor RT0, xl ## 0, xl ## 0; \
118 vpxor RT0, xl ## 1, xl ## 1; \
119 vpxor RT0, xl ## 2, xl ## 2; \
120 vpxor RT0, xl ## 3, xl ## 3;
121
122#define round_enc() \
123 add_roundkey(RXr, p(CTX,RLOOP,4)); \
124 F(RXl0, RXr0); \
125 F(RXl1, RXr1); \
126 F(RXl2, RXr2); \
127 F(RXl3, RXr3); \
128 \
129 add_roundkey(RXl, p+4(CTX,RLOOP,4)); \
130 F(RXr0, RXl0); \
131 F(RXr1, RXl1); \
132 F(RXr2, RXl2); \
133 F(RXr3, RXl3);
134
135#define round_dec() \
136 add_roundkey(RXr, p+4*2(CTX,RLOOP,4)); \
137 F(RXl0, RXr0); \
138 F(RXl1, RXr1); \
139 F(RXl2, RXr2); \
140 F(RXl3, RXr3); \
141 \
142 add_roundkey(RXl, p+4(CTX,RLOOP,4)); \
143 F(RXr0, RXl0); \
144 F(RXr1, RXl1); \
145 F(RXr2, RXl2); \
146 F(RXr3, RXl3);
147
148#define init_round_constants() \
149 vpcmpeqd RNOT, RNOT, RNOT; \
150 leaq s0(CTX), RS0; \
151 leaq s1(CTX), RS1; \
152 leaq s2(CTX), RS2; \
153 leaq s3(CTX), RS3; \
154 vpsrld $24, RNOT, RBYTE;
155
156#define transpose_2x2(x0, x1, t0) \
157 vpunpckldq x0, x1, t0; \
158 vpunpckhdq x0, x1, x1; \
159 \
160 vpunpcklqdq t0, x1, x0; \
161 vpunpckhqdq t0, x1, x1;
162
163#define read_block(xl, xr) \
164 vbroadcasti128 .Lbswap32_mask, RT1; \
165 \
166 vpshufb RT1, xl ## 0, xl ## 0; \
167 vpshufb RT1, xr ## 0, xr ## 0; \
168 vpshufb RT1, xl ## 1, xl ## 1; \
169 vpshufb RT1, xr ## 1, xr ## 1; \
170 vpshufb RT1, xl ## 2, xl ## 2; \
171 vpshufb RT1, xr ## 2, xr ## 2; \
172 vpshufb RT1, xl ## 3, xl ## 3; \
173 vpshufb RT1, xr ## 3, xr ## 3; \
174 \
175 transpose_2x2(xl ## 0, xr ## 0, RT0); \
176 transpose_2x2(xl ## 1, xr ## 1, RT0); \
177 transpose_2x2(xl ## 2, xr ## 2, RT0); \
178 transpose_2x2(xl ## 3, xr ## 3, RT0);
179
180#define write_block(xl, xr) \
181 vbroadcasti128 .Lbswap32_mask, RT1; \
182 \
183 transpose_2x2(xl ## 0, xr ## 0, RT0); \
184 transpose_2x2(xl ## 1, xr ## 1, RT0); \
185 transpose_2x2(xl ## 2, xr ## 2, RT0); \
186 transpose_2x2(xl ## 3, xr ## 3, RT0); \
187 \
188 vpshufb RT1, xl ## 0, xl ## 0; \
189 vpshufb RT1, xr ## 0, xr ## 0; \
190 vpshufb RT1, xl ## 1, xl ## 1; \
191 vpshufb RT1, xr ## 1, xr ## 1; \
192 vpshufb RT1, xl ## 2, xl ## 2; \
193 vpshufb RT1, xr ## 2, xr ## 2; \
194 vpshufb RT1, xl ## 3, xl ## 3; \
195 vpshufb RT1, xr ## 3, xr ## 3;
196
197.align 8
198__blowfish_enc_blk32:
199 /* input:
200 * %rdi: ctx, CTX
201 * RXl0..4, RXr0..4: plaintext
202 * output:
203 * RXl0..4, RXr0..4: ciphertext (RXl <=> RXr swapped)
204 */
205 init_round_constants();
206
207 read_block(RXl, RXr);
208
209 movl $1, RLOOPd;
210 add_roundkey(RXl, p+4*(0)(CTX));
211
212.align 4
213.L__enc_loop:
214 round_enc();
215
216 leal 2(RLOOPd), RLOOPd;
217 cmpl $17, RLOOPd;
218 jne .L__enc_loop;
219
220 add_roundkey(RXr, p+4*(17)(CTX));
221
222 write_block(RXl, RXr);
223
224 ret;
225ENDPROC(__blowfish_enc_blk32)
226
227.align 8
228__blowfish_dec_blk32:
229 /* input:
230 * %rdi: ctx, CTX
231 * RXl0..4, RXr0..4: ciphertext
232 * output:
233 * RXl0..4, RXr0..4: plaintext (RXl <=> RXr swapped)
234 */
235 init_round_constants();
236
237 read_block(RXl, RXr);
238
239 movl $14, RLOOPd;
240 add_roundkey(RXl, p+4*(17)(CTX));
241
242.align 4
243.L__dec_loop:
244 round_dec();
245
246 addl $-2, RLOOPd;
247 jns .L__dec_loop;
248
249 add_roundkey(RXr, p+4*(0)(CTX));
250
251 write_block(RXl, RXr);
252
253 ret;
254ENDPROC(__blowfish_dec_blk32)
255
256ENTRY(blowfish_ecb_enc_32way)
257 /* input:
258 * %rdi: ctx, CTX
259 * %rsi: dst
260 * %rdx: src
261 */
262
263 vzeroupper;
264
265 vmovdqu 0*32(%rdx), RXl0;
266 vmovdqu 1*32(%rdx), RXr0;
267 vmovdqu 2*32(%rdx), RXl1;
268 vmovdqu 3*32(%rdx), RXr1;
269 vmovdqu 4*32(%rdx), RXl2;
270 vmovdqu 5*32(%rdx), RXr2;
271 vmovdqu 6*32(%rdx), RXl3;
272 vmovdqu 7*32(%rdx), RXr3;
273
274 call __blowfish_enc_blk32;
275
276 vmovdqu RXr0, 0*32(%rsi);
277 vmovdqu RXl0, 1*32(%rsi);
278 vmovdqu RXr1, 2*32(%rsi);
279 vmovdqu RXl1, 3*32(%rsi);
280 vmovdqu RXr2, 4*32(%rsi);
281 vmovdqu RXl2, 5*32(%rsi);
282 vmovdqu RXr3, 6*32(%rsi);
283 vmovdqu RXl3, 7*32(%rsi);
284
285 vzeroupper;
286
287 ret;
288ENDPROC(blowfish_ecb_enc_32way)
289
290ENTRY(blowfish_ecb_dec_32way)
291 /* input:
292 * %rdi: ctx, CTX
293 * %rsi: dst
294 * %rdx: src
295 */
296
297 vzeroupper;
298
299 vmovdqu 0*32(%rdx), RXl0;
300 vmovdqu 1*32(%rdx), RXr0;
301 vmovdqu 2*32(%rdx), RXl1;
302 vmovdqu 3*32(%rdx), RXr1;
303 vmovdqu 4*32(%rdx), RXl2;
304 vmovdqu 5*32(%rdx), RXr2;
305 vmovdqu 6*32(%rdx), RXl3;
306 vmovdqu 7*32(%rdx), RXr3;
307
308 call __blowfish_dec_blk32;
309
310 vmovdqu RXr0, 0*32(%rsi);
311 vmovdqu RXl0, 1*32(%rsi);
312 vmovdqu RXr1, 2*32(%rsi);
313 vmovdqu RXl1, 3*32(%rsi);
314 vmovdqu RXr2, 4*32(%rsi);
315 vmovdqu RXl2, 5*32(%rsi);
316 vmovdqu RXr3, 6*32(%rsi);
317 vmovdqu RXl3, 7*32(%rsi);
318
319 vzeroupper;
320
321 ret;
322ENDPROC(blowfish_ecb_dec_32way)
323
324ENTRY(blowfish_cbc_dec_32way)
325 /* input:
326 * %rdi: ctx, CTX
327 * %rsi: dst
328 * %rdx: src
329 */
330
331 vzeroupper;
332
333 vmovdqu 0*32(%rdx), RXl0;
334 vmovdqu 1*32(%rdx), RXr0;
335 vmovdqu 2*32(%rdx), RXl1;
336 vmovdqu 3*32(%rdx), RXr1;
337 vmovdqu 4*32(%rdx), RXl2;
338 vmovdqu 5*32(%rdx), RXr2;
339 vmovdqu 6*32(%rdx), RXl3;
340 vmovdqu 7*32(%rdx), RXr3;
341
342 call __blowfish_dec_blk32;
343
344 /* xor with src */
345 vmovq (%rdx), RT0x;
346 vpshufd $0x4f, RT0x, RT0x;
347 vinserti128 $1, 8(%rdx), RT0, RT0;
348 vpxor RT0, RXr0, RXr0;
349 vpxor 0*32+24(%rdx), RXl0, RXl0;
350 vpxor 1*32+24(%rdx), RXr1, RXr1;
351 vpxor 2*32+24(%rdx), RXl1, RXl1;
352 vpxor 3*32+24(%rdx), RXr2, RXr2;
353 vpxor 4*32+24(%rdx), RXl2, RXl2;
354 vpxor 5*32+24(%rdx), RXr3, RXr3;
355 vpxor 6*32+24(%rdx), RXl3, RXl3;
356
357 vmovdqu RXr0, (0*32)(%rsi);
358 vmovdqu RXl0, (1*32)(%rsi);
359 vmovdqu RXr1, (2*32)(%rsi);
360 vmovdqu RXl1, (3*32)(%rsi);
361 vmovdqu RXr2, (4*32)(%rsi);
362 vmovdqu RXl2, (5*32)(%rsi);
363 vmovdqu RXr3, (6*32)(%rsi);
364 vmovdqu RXl3, (7*32)(%rsi);
365
366 vzeroupper;
367
368 ret;
369ENDPROC(blowfish_cbc_dec_32way)
370
371ENTRY(blowfish_ctr_32way)
372 /* input:
373 * %rdi: ctx, CTX
374 * %rsi: dst
375 * %rdx: src
376 * %rcx: iv (big endian, 64bit)
377 */
378
379 vzeroupper;
380
381 vpcmpeqd RT0, RT0, RT0;
382 vpsrldq $8, RT0, RT0; /* a: -1, b: 0, c: -1, d: 0 */
383
384 vpcmpeqd RT1x, RT1x, RT1x;
385 vpaddq RT1x, RT1x, RT1x; /* a: -2, b: -2 */
386 vpxor RIDX0, RIDX0, RIDX0;
387 vinserti128 $1, RT1x, RIDX0, RIDX0; /* a: 0, b: 0, c: -2, d: -2 */
388
389 vpaddq RIDX0, RT0, RT0; /* a: -1, b: 0, c: -3, d: -2 */
390
391 vpcmpeqd RT1, RT1, RT1;
392 vpaddq RT1, RT1, RT1; /* a: -2, b: -2, c: -2, d: -2 */
393 vpaddq RT1, RT1, RIDX2; /* a: -4, b: -4, c: -4, d: -4 */
394
395 vbroadcasti128 .Lbswap_iv_mask, RIDX0;
396 vbroadcasti128 .Lbswap128_mask, RIDX1;
397
398 /* load IV and byteswap */
399 vmovq (%rcx), RT1x;
400 vinserti128 $1, RT1x, RT1, RT1; /* a: BE, b: 0, c: BE, d: 0 */
401 vpshufb RIDX0, RT1, RT1; /* a: LE, b: LE, c: LE, d: LE */
402
403 /* construct IVs */
404 vpsubq RT0, RT1, RT1; /* a: le1, b: le0, c: le3, d: le2 */
405 vpshufb RIDX1, RT1, RXl0; /* a: be0, b: be1, c: be2, d: be3 */
406 vpsubq RIDX2, RT1, RT1; /* le5, le4, le7, le6 */
407 vpshufb RIDX1, RT1, RXr0; /* be4, be5, be6, be7 */
408 vpsubq RIDX2, RT1, RT1;
409 vpshufb RIDX1, RT1, RXl1;
410 vpsubq RIDX2, RT1, RT1;
411 vpshufb RIDX1, RT1, RXr1;
412 vpsubq RIDX2, RT1, RT1;
413 vpshufb RIDX1, RT1, RXl2;
414 vpsubq RIDX2, RT1, RT1;
415 vpshufb RIDX1, RT1, RXr2;
416 vpsubq RIDX2, RT1, RT1;
417 vpshufb RIDX1, RT1, RXl3;
418 vpsubq RIDX2, RT1, RT1;
419 vpshufb RIDX1, RT1, RXr3;
420
421 /* store last IV */
422 vpsubq RIDX2, RT1, RT1; /* a: le33, b: le32, ... */
423 vpshufb RIDX1x, RT1x, RT1x; /* a: be32, ... */
424 vmovq RT1x, (%rcx);
425
426 call __blowfish_enc_blk32;
427
428 /* dst = src ^ iv */
429 vpxor 0*32(%rdx), RXr0, RXr0;
430 vpxor 1*32(%rdx), RXl0, RXl0;
431 vpxor 2*32(%rdx), RXr1, RXr1;
432 vpxor 3*32(%rdx), RXl1, RXl1;
433 vpxor 4*32(%rdx), RXr2, RXr2;
434 vpxor 5*32(%rdx), RXl2, RXl2;
435 vpxor 6*32(%rdx), RXr3, RXr3;
436 vpxor 7*32(%rdx), RXl3, RXl3;
437 vmovdqu RXr0, (0*32)(%rsi);
438 vmovdqu RXl0, (1*32)(%rsi);
439 vmovdqu RXr1, (2*32)(%rsi);
440 vmovdqu RXl1, (3*32)(%rsi);
441 vmovdqu RXr2, (4*32)(%rsi);
442 vmovdqu RXl2, (5*32)(%rsi);
443 vmovdqu RXr3, (6*32)(%rsi);
444 vmovdqu RXl3, (7*32)(%rsi);
445
446 vzeroupper;
447
448 ret;
449ENDPROC(blowfish_ctr_32way)
diff --git a/arch/x86/crypto/blowfish_avx2_glue.c b/arch/x86/crypto/blowfish_avx2_glue.c
new file mode 100644
index 000000000000..4417e9aea78d
--- /dev/null
+++ b/arch/x86/crypto/blowfish_avx2_glue.c
@@ -0,0 +1,585 @@
1/*
2 * Glue Code for x86_64/AVX2 assembler optimized version of Blowfish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 *
6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by:
7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
8 * CTR part based on code (crypto/ctr.c) by:
9 * (C) Copyright IBM Corp. 2007 - Joy Latten <latten@us.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 */
22
23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/crypto.h>
26#include <linux/err.h>
27#include <crypto/algapi.h>
28#include <crypto/blowfish.h>
29#include <crypto/cryptd.h>
30#include <crypto/ctr.h>
31#include <asm/i387.h>
32#include <asm/xcr.h>
33#include <asm/xsave.h>
34#include <asm/crypto/blowfish.h>
35#include <asm/crypto/ablk_helper.h>
36#include <crypto/scatterwalk.h>
37
38#define BF_AVX2_PARALLEL_BLOCKS 32
39
40/* 32-way AVX2 parallel cipher functions */
41asmlinkage void blowfish_ecb_enc_32way(struct bf_ctx *ctx, u8 *dst,
42 const u8 *src);
43asmlinkage void blowfish_ecb_dec_32way(struct bf_ctx *ctx, u8 *dst,
44 const u8 *src);
45asmlinkage void blowfish_cbc_dec_32way(struct bf_ctx *ctx, u8 *dst,
46 const u8 *src);
47asmlinkage void blowfish_ctr_32way(struct bf_ctx *ctx, u8 *dst, const u8 *src,
48 __be64 *iv);
49
50static inline bool bf_fpu_begin(bool fpu_enabled, unsigned int nbytes)
51{
52 if (fpu_enabled)
53 return true;
54
55 /* FPU is only used when chunk to be processed is large enough, so
56 * do not enable FPU until it is necessary.
57 */
58 if (nbytes < BF_BLOCK_SIZE * BF_AVX2_PARALLEL_BLOCKS)
59 return false;
60
61 kernel_fpu_begin();
62 return true;
63}
64
65static inline void bf_fpu_end(bool fpu_enabled)
66{
67 if (fpu_enabled)
68 kernel_fpu_end();
69}
70
71static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
72 bool enc)
73{
74 bool fpu_enabled = false;
75 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
76 const unsigned int bsize = BF_BLOCK_SIZE;
77 unsigned int nbytes;
78 int err;
79
80 err = blkcipher_walk_virt(desc, walk);
81 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
82
83 while ((nbytes = walk->nbytes)) {
84 u8 *wsrc = walk->src.virt.addr;
85 u8 *wdst = walk->dst.virt.addr;
86
87 fpu_enabled = bf_fpu_begin(fpu_enabled, nbytes);
88
89 /* Process multi-block AVX2 batch */
90 if (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS) {
91 do {
92 if (enc)
93 blowfish_ecb_enc_32way(ctx, wdst, wsrc);
94 else
95 blowfish_ecb_dec_32way(ctx, wdst, wsrc);
96
97 wsrc += bsize * BF_AVX2_PARALLEL_BLOCKS;
98 wdst += bsize * BF_AVX2_PARALLEL_BLOCKS;
99 nbytes -= bsize * BF_AVX2_PARALLEL_BLOCKS;
100 } while (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS);
101
102 if (nbytes < bsize)
103 goto done;
104 }
105
106 /* Process multi-block batch */
107 if (nbytes >= bsize * BF_PARALLEL_BLOCKS) {
108 do {
109 if (enc)
110 blowfish_enc_blk_4way(ctx, wdst, wsrc);
111 else
112 blowfish_dec_blk_4way(ctx, wdst, wsrc);
113
114 wsrc += bsize * BF_PARALLEL_BLOCKS;
115 wdst += bsize * BF_PARALLEL_BLOCKS;
116 nbytes -= bsize * BF_PARALLEL_BLOCKS;
117 } while (nbytes >= bsize * BF_PARALLEL_BLOCKS);
118
119 if (nbytes < bsize)
120 goto done;
121 }
122
123 /* Handle leftovers */
124 do {
125 if (enc)
126 blowfish_enc_blk(ctx, wdst, wsrc);
127 else
128 blowfish_dec_blk(ctx, wdst, wsrc);
129
130 wsrc += bsize;
131 wdst += bsize;
132 nbytes -= bsize;
133 } while (nbytes >= bsize);
134
135done:
136 err = blkcipher_walk_done(desc, walk, nbytes);
137 }
138
139 bf_fpu_end(fpu_enabled);
140 return err;
141}
142
143static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
144 struct scatterlist *src, unsigned int nbytes)
145{
146 struct blkcipher_walk walk;
147
148 blkcipher_walk_init(&walk, dst, src, nbytes);
149 return ecb_crypt(desc, &walk, true);
150}
151
152static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
153 struct scatterlist *src, unsigned int nbytes)
154{
155 struct blkcipher_walk walk;
156
157 blkcipher_walk_init(&walk, dst, src, nbytes);
158 return ecb_crypt(desc, &walk, false);
159}
160
161static unsigned int __cbc_encrypt(struct blkcipher_desc *desc,
162 struct blkcipher_walk *walk)
163{
164 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
165 unsigned int bsize = BF_BLOCK_SIZE;
166 unsigned int nbytes = walk->nbytes;
167 u64 *src = (u64 *)walk->src.virt.addr;
168 u64 *dst = (u64 *)walk->dst.virt.addr;
169 u64 *iv = (u64 *)walk->iv;
170
171 do {
172 *dst = *src ^ *iv;
173 blowfish_enc_blk(ctx, (u8 *)dst, (u8 *)dst);
174 iv = dst;
175
176 src += 1;
177 dst += 1;
178 nbytes -= bsize;
179 } while (nbytes >= bsize);
180
181 *(u64 *)walk->iv = *iv;
182 return nbytes;
183}
184
185static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
186 struct scatterlist *src, unsigned int nbytes)
187{
188 struct blkcipher_walk walk;
189 int err;
190
191 blkcipher_walk_init(&walk, dst, src, nbytes);
192 err = blkcipher_walk_virt(desc, &walk);
193
194 while ((nbytes = walk.nbytes)) {
195 nbytes = __cbc_encrypt(desc, &walk);
196 err = blkcipher_walk_done(desc, &walk, nbytes);
197 }
198
199 return err;
200}
201
202static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
203 struct blkcipher_walk *walk)
204{
205 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
206 const unsigned int bsize = BF_BLOCK_SIZE;
207 unsigned int nbytes = walk->nbytes;
208 u64 *src = (u64 *)walk->src.virt.addr;
209 u64 *dst = (u64 *)walk->dst.virt.addr;
210 u64 last_iv;
211 int i;
212
213 /* Start of the last block. */
214 src += nbytes / bsize - 1;
215 dst += nbytes / bsize - 1;
216
217 last_iv = *src;
218
219 /* Process multi-block AVX2 batch */
220 if (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS) {
221 do {
222 nbytes -= bsize * (BF_AVX2_PARALLEL_BLOCKS - 1);
223 src -= BF_AVX2_PARALLEL_BLOCKS - 1;
224 dst -= BF_AVX2_PARALLEL_BLOCKS - 1;
225
226 blowfish_cbc_dec_32way(ctx, (u8 *)dst, (u8 *)src);
227
228 nbytes -= bsize;
229 if (nbytes < bsize)
230 goto done;
231
232 *dst ^= *(src - 1);
233 src -= 1;
234 dst -= 1;
235 } while (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS);
236
237 if (nbytes < bsize)
238 goto done;
239 }
240
241 /* Process multi-block batch */
242 if (nbytes >= bsize * BF_PARALLEL_BLOCKS) {
243 u64 ivs[BF_PARALLEL_BLOCKS - 1];
244
245 do {
246 nbytes -= bsize * (BF_PARALLEL_BLOCKS - 1);
247 src -= BF_PARALLEL_BLOCKS - 1;
248 dst -= BF_PARALLEL_BLOCKS - 1;
249
250 for (i = 0; i < BF_PARALLEL_BLOCKS - 1; i++)
251 ivs[i] = src[i];
252
253 blowfish_dec_blk_4way(ctx, (u8 *)dst, (u8 *)src);
254
255 for (i = 0; i < BF_PARALLEL_BLOCKS - 1; i++)
256 dst[i + 1] ^= ivs[i];
257
258 nbytes -= bsize;
259 if (nbytes < bsize)
260 goto done;
261
262 *dst ^= *(src - 1);
263 src -= 1;
264 dst -= 1;
265 } while (nbytes >= bsize * BF_PARALLEL_BLOCKS);
266
267 if (nbytes < bsize)
268 goto done;
269 }
270
271 /* Handle leftovers */
272 for (;;) {
273 blowfish_dec_blk(ctx, (u8 *)dst, (u8 *)src);
274
275 nbytes -= bsize;
276 if (nbytes < bsize)
277 break;
278
279 *dst ^= *(src - 1);
280 src -= 1;
281 dst -= 1;
282 }
283
284done:
285 *dst ^= *(u64 *)walk->iv;
286 *(u64 *)walk->iv = last_iv;
287
288 return nbytes;
289}
290
291static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
292 struct scatterlist *src, unsigned int nbytes)
293{
294 bool fpu_enabled = false;
295 struct blkcipher_walk walk;
296 int err;
297
298 blkcipher_walk_init(&walk, dst, src, nbytes);
299 err = blkcipher_walk_virt(desc, &walk);
300 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
301
302 while ((nbytes = walk.nbytes)) {
303 fpu_enabled = bf_fpu_begin(fpu_enabled, nbytes);
304 nbytes = __cbc_decrypt(desc, &walk);
305 err = blkcipher_walk_done(desc, &walk, nbytes);
306 }
307
308 bf_fpu_end(fpu_enabled);
309 return err;
310}
311
312static void ctr_crypt_final(struct blkcipher_desc *desc,
313 struct blkcipher_walk *walk)
314{
315 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
316 u8 *ctrblk = walk->iv;
317 u8 keystream[BF_BLOCK_SIZE];
318 u8 *src = walk->src.virt.addr;
319 u8 *dst = walk->dst.virt.addr;
320 unsigned int nbytes = walk->nbytes;
321
322 blowfish_enc_blk(ctx, keystream, ctrblk);
323 crypto_xor(keystream, src, nbytes);
324 memcpy(dst, keystream, nbytes);
325
326 crypto_inc(ctrblk, BF_BLOCK_SIZE);
327}
328
329static unsigned int __ctr_crypt(struct blkcipher_desc *desc,
330 struct blkcipher_walk *walk)
331{
332 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
333 unsigned int bsize = BF_BLOCK_SIZE;
334 unsigned int nbytes = walk->nbytes;
335 u64 *src = (u64 *)walk->src.virt.addr;
336 u64 *dst = (u64 *)walk->dst.virt.addr;
337 int i;
338
339 /* Process multi-block AVX2 batch */
340 if (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS) {
341 do {
342 blowfish_ctr_32way(ctx, (u8 *)dst, (u8 *)src,
343 (__be64 *)walk->iv);
344
345 src += BF_AVX2_PARALLEL_BLOCKS;
346 dst += BF_AVX2_PARALLEL_BLOCKS;
347 nbytes -= bsize * BF_AVX2_PARALLEL_BLOCKS;
348 } while (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS);
349
350 if (nbytes < bsize)
351 goto done;
352 }
353
354 /* Process four block batch */
355 if (nbytes >= bsize * BF_PARALLEL_BLOCKS) {
356 __be64 ctrblocks[BF_PARALLEL_BLOCKS];
357 u64 ctrblk = be64_to_cpu(*(__be64 *)walk->iv);
358
359 do {
360 /* create ctrblks for parallel encrypt */
361 for (i = 0; i < BF_PARALLEL_BLOCKS; i++) {
362 if (dst != src)
363 dst[i] = src[i];
364
365 ctrblocks[i] = cpu_to_be64(ctrblk++);
366 }
367
368 blowfish_enc_blk_xor_4way(ctx, (u8 *)dst,
369 (u8 *)ctrblocks);
370
371 src += BF_PARALLEL_BLOCKS;
372 dst += BF_PARALLEL_BLOCKS;
373 nbytes -= bsize * BF_PARALLEL_BLOCKS;
374 } while (nbytes >= bsize * BF_PARALLEL_BLOCKS);
375
376 *(__be64 *)walk->iv = cpu_to_be64(ctrblk);
377
378 if (nbytes < bsize)
379 goto done;
380 }
381
382 /* Handle leftovers */
383 do {
384 u64 ctrblk;
385
386 if (dst != src)
387 *dst = *src;
388
389 ctrblk = *(u64 *)walk->iv;
390 be64_add_cpu((__be64 *)walk->iv, 1);
391
392 blowfish_enc_blk_xor(ctx, (u8 *)dst, (u8 *)&ctrblk);
393
394 src += 1;
395 dst += 1;
396 } while ((nbytes -= bsize) >= bsize);
397
398done:
399 return nbytes;
400}
401
402static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
403 struct scatterlist *src, unsigned int nbytes)
404{
405 bool fpu_enabled = false;
406 struct blkcipher_walk walk;
407 int err;
408
409 blkcipher_walk_init(&walk, dst, src, nbytes);
410 err = blkcipher_walk_virt_block(desc, &walk, BF_BLOCK_SIZE);
411 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
412
413 while ((nbytes = walk.nbytes) >= BF_BLOCK_SIZE) {
414 fpu_enabled = bf_fpu_begin(fpu_enabled, nbytes);
415 nbytes = __ctr_crypt(desc, &walk);
416 err = blkcipher_walk_done(desc, &walk, nbytes);
417 }
418
419 bf_fpu_end(fpu_enabled);
420
421 if (walk.nbytes) {
422 ctr_crypt_final(desc, &walk);
423 err = blkcipher_walk_done(desc, &walk, 0);
424 }
425
426 return err;
427}
428
429static struct crypto_alg bf_algs[6] = { {
430 .cra_name = "__ecb-blowfish-avx2",
431 .cra_driver_name = "__driver-ecb-blowfish-avx2",
432 .cra_priority = 0,
433 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
434 .cra_blocksize = BF_BLOCK_SIZE,
435 .cra_ctxsize = sizeof(struct bf_ctx),
436 .cra_alignmask = 0,
437 .cra_type = &crypto_blkcipher_type,
438 .cra_module = THIS_MODULE,
439 .cra_u = {
440 .blkcipher = {
441 .min_keysize = BF_MIN_KEY_SIZE,
442 .max_keysize = BF_MAX_KEY_SIZE,
443 .setkey = blowfish_setkey,
444 .encrypt = ecb_encrypt,
445 .decrypt = ecb_decrypt,
446 },
447 },
448}, {
449 .cra_name = "__cbc-blowfish-avx2",
450 .cra_driver_name = "__driver-cbc-blowfish-avx2",
451 .cra_priority = 0,
452 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
453 .cra_blocksize = BF_BLOCK_SIZE,
454 .cra_ctxsize = sizeof(struct bf_ctx),
455 .cra_alignmask = 0,
456 .cra_type = &crypto_blkcipher_type,
457 .cra_module = THIS_MODULE,
458 .cra_u = {
459 .blkcipher = {
460 .min_keysize = BF_MIN_KEY_SIZE,
461 .max_keysize = BF_MAX_KEY_SIZE,
462 .setkey = blowfish_setkey,
463 .encrypt = cbc_encrypt,
464 .decrypt = cbc_decrypt,
465 },
466 },
467}, {
468 .cra_name = "__ctr-blowfish-avx2",
469 .cra_driver_name = "__driver-ctr-blowfish-avx2",
470 .cra_priority = 0,
471 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
472 .cra_blocksize = 1,
473 .cra_ctxsize = sizeof(struct bf_ctx),
474 .cra_alignmask = 0,
475 .cra_type = &crypto_blkcipher_type,
476 .cra_module = THIS_MODULE,
477 .cra_u = {
478 .blkcipher = {
479 .min_keysize = BF_MIN_KEY_SIZE,
480 .max_keysize = BF_MAX_KEY_SIZE,
481 .ivsize = BF_BLOCK_SIZE,
482 .setkey = blowfish_setkey,
483 .encrypt = ctr_crypt,
484 .decrypt = ctr_crypt,
485 },
486 },
487}, {
488 .cra_name = "ecb(blowfish)",
489 .cra_driver_name = "ecb-blowfish-avx2",
490 .cra_priority = 400,
491 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
492 .cra_blocksize = BF_BLOCK_SIZE,
493 .cra_ctxsize = sizeof(struct async_helper_ctx),
494 .cra_alignmask = 0,
495 .cra_type = &crypto_ablkcipher_type,
496 .cra_module = THIS_MODULE,
497 .cra_init = ablk_init,
498 .cra_exit = ablk_exit,
499 .cra_u = {
500 .ablkcipher = {
501 .min_keysize = BF_MIN_KEY_SIZE,
502 .max_keysize = BF_MAX_KEY_SIZE,
503 .setkey = ablk_set_key,
504 .encrypt = ablk_encrypt,
505 .decrypt = ablk_decrypt,
506 },
507 },
508}, {
509 .cra_name = "cbc(blowfish)",
510 .cra_driver_name = "cbc-blowfish-avx2",
511 .cra_priority = 400,
512 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
513 .cra_blocksize = BF_BLOCK_SIZE,
514 .cra_ctxsize = sizeof(struct async_helper_ctx),
515 .cra_alignmask = 0,
516 .cra_type = &crypto_ablkcipher_type,
517 .cra_module = THIS_MODULE,
518 .cra_init = ablk_init,
519 .cra_exit = ablk_exit,
520 .cra_u = {
521 .ablkcipher = {
522 .min_keysize = BF_MIN_KEY_SIZE,
523 .max_keysize = BF_MAX_KEY_SIZE,
524 .ivsize = BF_BLOCK_SIZE,
525 .setkey = ablk_set_key,
526 .encrypt = __ablk_encrypt,
527 .decrypt = ablk_decrypt,
528 },
529 },
530}, {
531 .cra_name = "ctr(blowfish)",
532 .cra_driver_name = "ctr-blowfish-avx2",
533 .cra_priority = 400,
534 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
535 .cra_blocksize = 1,
536 .cra_ctxsize = sizeof(struct async_helper_ctx),
537 .cra_alignmask = 0,
538 .cra_type = &crypto_ablkcipher_type,
539 .cra_module = THIS_MODULE,
540 .cra_init = ablk_init,
541 .cra_exit = ablk_exit,
542 .cra_u = {
543 .ablkcipher = {
544 .min_keysize = BF_MIN_KEY_SIZE,
545 .max_keysize = BF_MAX_KEY_SIZE,
546 .ivsize = BF_BLOCK_SIZE,
547 .setkey = ablk_set_key,
548 .encrypt = ablk_encrypt,
549 .decrypt = ablk_encrypt,
550 .geniv = "chainiv",
551 },
552 },
553} };
554
555
556static int __init init(void)
557{
558 u64 xcr0;
559
560 if (!cpu_has_avx2 || !cpu_has_osxsave) {
561 pr_info("AVX2 instructions are not detected.\n");
562 return -ENODEV;
563 }
564
565 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
566 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
567 pr_info("AVX detected but unusable.\n");
568 return -ENODEV;
569 }
570
571 return crypto_register_algs(bf_algs, ARRAY_SIZE(bf_algs));
572}
573
574static void __exit fini(void)
575{
576 crypto_unregister_algs(bf_algs, ARRAY_SIZE(bf_algs));
577}
578
579module_init(init);
580module_exit(fini);
581
582MODULE_LICENSE("GPL");
583MODULE_DESCRIPTION("Blowfish Cipher Algorithm, AVX2 optimized");
584MODULE_ALIAS("blowfish");
585MODULE_ALIAS("blowfish-asm");
diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
index 50ec333b70e6..3548d76dbaa9 100644
--- a/arch/x86/crypto/blowfish_glue.c
+++ b/arch/x86/crypto/blowfish_glue.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Glue Code for assembler optimized version of Blowfish 2 * Glue Code for assembler optimized version of Blowfish
3 * 3 *
4 * Copyright (c) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 4 * Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 * 5 *
6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by: 6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by:
7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> 7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
@@ -32,40 +32,24 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <crypto/algapi.h> 34#include <crypto/algapi.h>
35#include <asm/crypto/blowfish.h>
35 36
36/* regular block cipher functions */ 37/* regular block cipher functions */
37asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src, 38asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src,
38 bool xor); 39 bool xor);
40EXPORT_SYMBOL_GPL(__blowfish_enc_blk);
41
39asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src); 42asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src);
43EXPORT_SYMBOL_GPL(blowfish_dec_blk);
40 44
41/* 4-way parallel cipher functions */ 45/* 4-way parallel cipher functions */
42asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst, 46asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
43 const u8 *src, bool xor); 47 const u8 *src, bool xor);
48EXPORT_SYMBOL_GPL(__blowfish_enc_blk_4way);
49
44asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst, 50asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst,
45 const u8 *src); 51 const u8 *src);
46 52EXPORT_SYMBOL_GPL(blowfish_dec_blk_4way);
47static inline void blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src)
48{
49 __blowfish_enc_blk(ctx, dst, src, false);
50}
51
52static inline void blowfish_enc_blk_xor(struct bf_ctx *ctx, u8 *dst,
53 const u8 *src)
54{
55 __blowfish_enc_blk(ctx, dst, src, true);
56}
57
58static inline void blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
59 const u8 *src)
60{
61 __blowfish_enc_blk_4way(ctx, dst, src, false);
62}
63
64static inline void blowfish_enc_blk_xor_4way(struct bf_ctx *ctx, u8 *dst,
65 const u8 *src)
66{
67 __blowfish_enc_blk_4way(ctx, dst, src, true);
68}
69 53
70static void blowfish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 54static void blowfish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
71{ 55{
diff --git a/arch/x86/crypto/camellia-aesni-avx-asm_64.S b/arch/x86/crypto/camellia-aesni-avx-asm_64.S
index cfc163469c71..ce71f9212409 100644
--- a/arch/x86/crypto/camellia-aesni-avx-asm_64.S
+++ b/arch/x86/crypto/camellia-aesni-avx-asm_64.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * x86_64/AVX/AES-NI assembler implementation of Camellia 2 * x86_64/AVX/AES-NI assembler implementation of Camellia
3 * 3 *
4 * Copyright © 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -589,6 +589,10 @@ ENDPROC(roundsm16_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
589.Lbswap128_mask: 589.Lbswap128_mask:
590 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 590 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
591 591
592/* For XTS mode IV generation */
593.Lxts_gf128mul_and_shl1_mask:
594 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
595
592/* 596/*
593 * pre-SubByte transform 597 * pre-SubByte transform
594 * 598 *
@@ -1090,3 +1094,177 @@ ENTRY(camellia_ctr_16way)
1090 1094
1091 ret; 1095 ret;
1092ENDPROC(camellia_ctr_16way) 1096ENDPROC(camellia_ctr_16way)
1097
1098#define gf128mul_x_ble(iv, mask, tmp) \
1099 vpsrad $31, iv, tmp; \
1100 vpaddq iv, iv, iv; \
1101 vpshufd $0x13, tmp, tmp; \
1102 vpand mask, tmp, tmp; \
1103 vpxor tmp, iv, iv;
1104
1105.align 8
1106camellia_xts_crypt_16way:
1107 /* input:
1108 * %rdi: ctx, CTX
1109 * %rsi: dst (16 blocks)
1110 * %rdx: src (16 blocks)
1111 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
1112 * %r8: index for input whitening key
1113 * %r9: pointer to __camellia_enc_blk16 or __camellia_dec_blk16
1114 */
1115
1116 subq $(16 * 16), %rsp;
1117 movq %rsp, %rax;
1118
1119 vmovdqa .Lxts_gf128mul_and_shl1_mask, %xmm14;
1120
1121 /* load IV */
1122 vmovdqu (%rcx), %xmm0;
1123 vpxor 0 * 16(%rdx), %xmm0, %xmm15;
1124 vmovdqu %xmm15, 15 * 16(%rax);
1125 vmovdqu %xmm0, 0 * 16(%rsi);
1126
1127 /* construct IVs */
1128 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1129 vpxor 1 * 16(%rdx), %xmm0, %xmm15;
1130 vmovdqu %xmm15, 14 * 16(%rax);
1131 vmovdqu %xmm0, 1 * 16(%rsi);
1132
1133 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1134 vpxor 2 * 16(%rdx), %xmm0, %xmm13;
1135 vmovdqu %xmm0, 2 * 16(%rsi);
1136
1137 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1138 vpxor 3 * 16(%rdx), %xmm0, %xmm12;
1139 vmovdqu %xmm0, 3 * 16(%rsi);
1140
1141 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1142 vpxor 4 * 16(%rdx), %xmm0, %xmm11;
1143 vmovdqu %xmm0, 4 * 16(%rsi);
1144
1145 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1146 vpxor 5 * 16(%rdx), %xmm0, %xmm10;
1147 vmovdqu %xmm0, 5 * 16(%rsi);
1148
1149 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1150 vpxor 6 * 16(%rdx), %xmm0, %xmm9;
1151 vmovdqu %xmm0, 6 * 16(%rsi);
1152
1153 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1154 vpxor 7 * 16(%rdx), %xmm0, %xmm8;
1155 vmovdqu %xmm0, 7 * 16(%rsi);
1156
1157 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1158 vpxor 8 * 16(%rdx), %xmm0, %xmm7;
1159 vmovdqu %xmm0, 8 * 16(%rsi);
1160
1161 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1162 vpxor 9 * 16(%rdx), %xmm0, %xmm6;
1163 vmovdqu %xmm0, 9 * 16(%rsi);
1164
1165 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1166 vpxor 10 * 16(%rdx), %xmm0, %xmm5;
1167 vmovdqu %xmm0, 10 * 16(%rsi);
1168
1169 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1170 vpxor 11 * 16(%rdx), %xmm0, %xmm4;
1171 vmovdqu %xmm0, 11 * 16(%rsi);
1172
1173 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1174 vpxor 12 * 16(%rdx), %xmm0, %xmm3;
1175 vmovdqu %xmm0, 12 * 16(%rsi);
1176
1177 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1178 vpxor 13 * 16(%rdx), %xmm0, %xmm2;
1179 vmovdqu %xmm0, 13 * 16(%rsi);
1180
1181 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1182 vpxor 14 * 16(%rdx), %xmm0, %xmm1;
1183 vmovdqu %xmm0, 14 * 16(%rsi);
1184
1185 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1186 vpxor 15 * 16(%rdx), %xmm0, %xmm15;
1187 vmovdqu %xmm15, 0 * 16(%rax);
1188 vmovdqu %xmm0, 15 * 16(%rsi);
1189
1190 gf128mul_x_ble(%xmm0, %xmm14, %xmm15);
1191 vmovdqu %xmm0, (%rcx);
1192
1193 /* inpack16_pre: */
1194 vmovq (key_table)(CTX, %r8, 8), %xmm15;
1195 vpshufb .Lpack_bswap, %xmm15, %xmm15;
1196 vpxor 0 * 16(%rax), %xmm15, %xmm0;
1197 vpxor %xmm1, %xmm15, %xmm1;
1198 vpxor %xmm2, %xmm15, %xmm2;
1199 vpxor %xmm3, %xmm15, %xmm3;
1200 vpxor %xmm4, %xmm15, %xmm4;
1201 vpxor %xmm5, %xmm15, %xmm5;
1202 vpxor %xmm6, %xmm15, %xmm6;
1203 vpxor %xmm7, %xmm15, %xmm7;
1204 vpxor %xmm8, %xmm15, %xmm8;
1205 vpxor %xmm9, %xmm15, %xmm9;
1206 vpxor %xmm10, %xmm15, %xmm10;
1207 vpxor %xmm11, %xmm15, %xmm11;
1208 vpxor %xmm12, %xmm15, %xmm12;
1209 vpxor %xmm13, %xmm15, %xmm13;
1210 vpxor 14 * 16(%rax), %xmm15, %xmm14;
1211 vpxor 15 * 16(%rax), %xmm15, %xmm15;
1212
1213 call *%r9;
1214
1215 addq $(16 * 16), %rsp;
1216
1217 vpxor 0 * 16(%rsi), %xmm7, %xmm7;
1218 vpxor 1 * 16(%rsi), %xmm6, %xmm6;
1219 vpxor 2 * 16(%rsi), %xmm5, %xmm5;
1220 vpxor 3 * 16(%rsi), %xmm4, %xmm4;
1221 vpxor 4 * 16(%rsi), %xmm3, %xmm3;
1222 vpxor 5 * 16(%rsi), %xmm2, %xmm2;
1223 vpxor 6 * 16(%rsi), %xmm1, %xmm1;
1224 vpxor 7 * 16(%rsi), %xmm0, %xmm0;
1225 vpxor 8 * 16(%rsi), %xmm15, %xmm15;
1226 vpxor 9 * 16(%rsi), %xmm14, %xmm14;
1227 vpxor 10 * 16(%rsi), %xmm13, %xmm13;
1228 vpxor 11 * 16(%rsi), %xmm12, %xmm12;
1229 vpxor 12 * 16(%rsi), %xmm11, %xmm11;
1230 vpxor 13 * 16(%rsi), %xmm10, %xmm10;
1231 vpxor 14 * 16(%rsi), %xmm9, %xmm9;
1232 vpxor 15 * 16(%rsi), %xmm8, %xmm8;
1233 write_output(%xmm7, %xmm6, %xmm5, %xmm4, %xmm3, %xmm2, %xmm1, %xmm0,
1234 %xmm15, %xmm14, %xmm13, %xmm12, %xmm11, %xmm10, %xmm9,
1235 %xmm8, %rsi);
1236
1237 ret;
1238ENDPROC(camellia_xts_crypt_16way)
1239
1240ENTRY(camellia_xts_enc_16way)
1241 /* input:
1242 * %rdi: ctx, CTX
1243 * %rsi: dst (16 blocks)
1244 * %rdx: src (16 blocks)
1245 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
1246 */
1247 xorl %r8d, %r8d; /* input whitening key, 0 for enc */
1248
1249 leaq __camellia_enc_blk16, %r9;
1250
1251 jmp camellia_xts_crypt_16way;
1252ENDPROC(camellia_xts_enc_16way)
1253
1254ENTRY(camellia_xts_dec_16way)
1255 /* input:
1256 * %rdi: ctx, CTX
1257 * %rsi: dst (16 blocks)
1258 * %rdx: src (16 blocks)
1259 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
1260 */
1261
1262 cmpl $16, key_length(CTX);
1263 movl $32, %r8d;
1264 movl $24, %eax;
1265 cmovel %eax, %r8d; /* input whitening key, last for dec */
1266
1267 leaq __camellia_dec_blk16, %r9;
1268
1269 jmp camellia_xts_crypt_16way;
1270ENDPROC(camellia_xts_dec_16way)
diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
new file mode 100644
index 000000000000..91a1878fcc3e
--- /dev/null
+++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
@@ -0,0 +1,1368 @@
1/*
2 * x86_64/AVX2/AES-NI assembler implementation of Camellia
3 *
4 * Copyright © 2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
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#include <linux/linkage.h>
14
15#define CAMELLIA_TABLE_BYTE_LEN 272
16
17/* struct camellia_ctx: */
18#define key_table 0
19#define key_length CAMELLIA_TABLE_BYTE_LEN
20
21/* register macros */
22#define CTX %rdi
23#define RIO %r8
24
25/**********************************************************************
26 helper macros
27 **********************************************************************/
28#define filter_8bit(x, lo_t, hi_t, mask4bit, tmp0) \
29 vpand x, mask4bit, tmp0; \
30 vpandn x, mask4bit, x; \
31 vpsrld $4, x, x; \
32 \
33 vpshufb tmp0, lo_t, tmp0; \
34 vpshufb x, hi_t, x; \
35 vpxor tmp0, x, x;
36
37#define ymm0_x xmm0
38#define ymm1_x xmm1
39#define ymm2_x xmm2
40#define ymm3_x xmm3
41#define ymm4_x xmm4
42#define ymm5_x xmm5
43#define ymm6_x xmm6
44#define ymm7_x xmm7
45#define ymm8_x xmm8
46#define ymm9_x xmm9
47#define ymm10_x xmm10
48#define ymm11_x xmm11
49#define ymm12_x xmm12
50#define ymm13_x xmm13
51#define ymm14_x xmm14
52#define ymm15_x xmm15
53
54/*
55 * AES-NI instructions do not support ymmX registers, so we need splitting and
56 * merging.
57 */
58#define vaesenclast256(zero, yreg, tmp) \
59 vextracti128 $1, yreg, tmp##_x; \
60 vaesenclast zero##_x, yreg##_x, yreg##_x; \
61 vaesenclast zero##_x, tmp##_x, tmp##_x; \
62 vinserti128 $1, tmp##_x, yreg, yreg;
63
64/**********************************************************************
65 32-way camellia
66 **********************************************************************/
67
68/*
69 * IN:
70 * x0..x7: byte-sliced AB state
71 * mem_cd: register pointer storing CD state
72 * key: index for key material
73 * OUT:
74 * x0..x7: new byte-sliced CD state
75 */
76#define roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, t0, t1, t2, t3, t4, t5, t6, \
77 t7, mem_cd, key) \
78 /* \
79 * S-function with AES subbytes \
80 */ \
81 vbroadcasti128 .Linv_shift_row, t4; \
82 vpbroadcastb .L0f0f0f0f, t7; \
83 vbroadcasti128 .Lpre_tf_lo_s1, t0; \
84 vbroadcasti128 .Lpre_tf_hi_s1, t1; \
85 \
86 /* AES inverse shift rows */ \
87 vpshufb t4, x0, x0; \
88 vpshufb t4, x7, x7; \
89 vpshufb t4, x1, x1; \
90 vpshufb t4, x4, x4; \
91 vpshufb t4, x2, x2; \
92 vpshufb t4, x5, x5; \
93 vpshufb t4, x3, x3; \
94 vpshufb t4, x6, x6; \
95 \
96 /* prefilter sboxes 1, 2 and 3 */ \
97 vbroadcasti128 .Lpre_tf_lo_s4, t2; \
98 vbroadcasti128 .Lpre_tf_hi_s4, t3; \
99 filter_8bit(x0, t0, t1, t7, t6); \
100 filter_8bit(x7, t0, t1, t7, t6); \
101 filter_8bit(x1, t0, t1, t7, t6); \
102 filter_8bit(x4, t0, t1, t7, t6); \
103 filter_8bit(x2, t0, t1, t7, t6); \
104 filter_8bit(x5, t0, t1, t7, t6); \
105 \
106 /* prefilter sbox 4 */ \
107 vpxor t4##_x, t4##_x, t4##_x; \
108 filter_8bit(x3, t2, t3, t7, t6); \
109 filter_8bit(x6, t2, t3, t7, t6); \
110 \
111 /* AES subbytes + AES shift rows */ \
112 vbroadcasti128 .Lpost_tf_lo_s1, t0; \
113 vbroadcasti128 .Lpost_tf_hi_s1, t1; \
114 vaesenclast256(t4, x0, t5); \
115 vaesenclast256(t4, x7, t5); \
116 vaesenclast256(t4, x1, t5); \
117 vaesenclast256(t4, x4, t5); \
118 vaesenclast256(t4, x2, t5); \
119 vaesenclast256(t4, x5, t5); \
120 vaesenclast256(t4, x3, t5); \
121 vaesenclast256(t4, x6, t5); \
122 \
123 /* postfilter sboxes 1 and 4 */ \
124 vbroadcasti128 .Lpost_tf_lo_s3, t2; \
125 vbroadcasti128 .Lpost_tf_hi_s3, t3; \
126 filter_8bit(x0, t0, t1, t7, t6); \
127 filter_8bit(x7, t0, t1, t7, t6); \
128 filter_8bit(x3, t0, t1, t7, t6); \
129 filter_8bit(x6, t0, t1, t7, t6); \
130 \
131 /* postfilter sbox 3 */ \
132 vbroadcasti128 .Lpost_tf_lo_s2, t4; \
133 vbroadcasti128 .Lpost_tf_hi_s2, t5; \
134 filter_8bit(x2, t2, t3, t7, t6); \
135 filter_8bit(x5, t2, t3, t7, t6); \
136 \
137 vpbroadcastq key, t0; /* higher 64-bit duplicate ignored */ \
138 \
139 /* postfilter sbox 2 */ \
140 filter_8bit(x1, t4, t5, t7, t2); \
141 filter_8bit(x4, t4, t5, t7, t2); \
142 \
143 vpsrldq $1, t0, t1; \
144 vpsrldq $2, t0, t2; \
145 vpsrldq $3, t0, t3; \
146 vpsrldq $4, t0, t4; \
147 vpsrldq $5, t0, t5; \
148 vpsrldq $6, t0, t6; \
149 vpsrldq $7, t0, t7; \
150 vpbroadcastb t0##_x, t0; \
151 vpbroadcastb t1##_x, t1; \
152 vpbroadcastb t2##_x, t2; \
153 vpbroadcastb t3##_x, t3; \
154 vpbroadcastb t4##_x, t4; \
155 vpbroadcastb t6##_x, t6; \
156 vpbroadcastb t5##_x, t5; \
157 vpbroadcastb t7##_x, t7; \
158 \
159 /* P-function */ \
160 vpxor x5, x0, x0; \
161 vpxor x6, x1, x1; \
162 vpxor x7, x2, x2; \
163 vpxor x4, x3, x3; \
164 \
165 vpxor x2, x4, x4; \
166 vpxor x3, x5, x5; \
167 vpxor x0, x6, x6; \
168 vpxor x1, x7, x7; \
169 \
170 vpxor x7, x0, x0; \
171 vpxor x4, x1, x1; \
172 vpxor x5, x2, x2; \
173 vpxor x6, x3, x3; \
174 \
175 vpxor x3, x4, x4; \
176 vpxor x0, x5, x5; \
177 vpxor x1, x6, x6; \
178 vpxor x2, x7, x7; /* note: high and low parts swapped */ \
179 \
180 /* Add key material and result to CD (x becomes new CD) */ \
181 \
182 vpxor t7, x0, x0; \
183 vpxor 4 * 32(mem_cd), x0, x0; \
184 \
185 vpxor t6, x1, x1; \
186 vpxor 5 * 32(mem_cd), x1, x1; \
187 \
188 vpxor t5, x2, x2; \
189 vpxor 6 * 32(mem_cd), x2, x2; \
190 \
191 vpxor t4, x3, x3; \
192 vpxor 7 * 32(mem_cd), x3, x3; \
193 \
194 vpxor t3, x4, x4; \
195 vpxor 0 * 32(mem_cd), x4, x4; \
196 \
197 vpxor t2, x5, x5; \
198 vpxor 1 * 32(mem_cd), x5, x5; \
199 \
200 vpxor t1, x6, x6; \
201 vpxor 2 * 32(mem_cd), x6, x6; \
202 \
203 vpxor t0, x7, x7; \
204 vpxor 3 * 32(mem_cd), x7, x7;
205
206/*
207 * Size optimization... with inlined roundsm16 binary would be over 5 times
208 * larger and would only marginally faster.
209 */
210.align 8
211roundsm32_x0_x1_x2_x3_x4_x5_x6_x7_y0_y1_y2_y3_y4_y5_y6_y7_cd:
212 roundsm32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
213 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, %ymm15,
214 %rcx, (%r9));
215 ret;
216ENDPROC(roundsm32_x0_x1_x2_x3_x4_x5_x6_x7_y0_y1_y2_y3_y4_y5_y6_y7_cd)
217
218.align 8
219roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab:
220 roundsm32(%ymm4, %ymm5, %ymm6, %ymm7, %ymm0, %ymm1, %ymm2, %ymm3,
221 %ymm12, %ymm13, %ymm14, %ymm15, %ymm8, %ymm9, %ymm10, %ymm11,
222 %rax, (%r9));
223 ret;
224ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
225
226/*
227 * IN/OUT:
228 * x0..x7: byte-sliced AB state preloaded
229 * mem_ab: byte-sliced AB state in memory
230 * mem_cb: byte-sliced CD state in memory
231 */
232#define two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
233 y6, y7, mem_ab, mem_cd, i, dir, store_ab) \
234 leaq (key_table + (i) * 8)(CTX), %r9; \
235 call roundsm32_x0_x1_x2_x3_x4_x5_x6_x7_y0_y1_y2_y3_y4_y5_y6_y7_cd; \
236 \
237 vmovdqu x0, 4 * 32(mem_cd); \
238 vmovdqu x1, 5 * 32(mem_cd); \
239 vmovdqu x2, 6 * 32(mem_cd); \
240 vmovdqu x3, 7 * 32(mem_cd); \
241 vmovdqu x4, 0 * 32(mem_cd); \
242 vmovdqu x5, 1 * 32(mem_cd); \
243 vmovdqu x6, 2 * 32(mem_cd); \
244 vmovdqu x7, 3 * 32(mem_cd); \
245 \
246 leaq (key_table + ((i) + (dir)) * 8)(CTX), %r9; \
247 call roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab; \
248 \
249 store_ab(x0, x1, x2, x3, x4, x5, x6, x7, mem_ab);
250
251#define dummy_store(x0, x1, x2, x3, x4, x5, x6, x7, mem_ab) /* do nothing */
252
253#define store_ab_state(x0, x1, x2, x3, x4, x5, x6, x7, mem_ab) \
254 /* Store new AB state */ \
255 vmovdqu x4, 4 * 32(mem_ab); \
256 vmovdqu x5, 5 * 32(mem_ab); \
257 vmovdqu x6, 6 * 32(mem_ab); \
258 vmovdqu x7, 7 * 32(mem_ab); \
259 vmovdqu x0, 0 * 32(mem_ab); \
260 vmovdqu x1, 1 * 32(mem_ab); \
261 vmovdqu x2, 2 * 32(mem_ab); \
262 vmovdqu x3, 3 * 32(mem_ab);
263
264#define enc_rounds32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
265 y6, y7, mem_ab, mem_cd, i) \
266 two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
267 y6, y7, mem_ab, mem_cd, (i) + 2, 1, store_ab_state); \
268 two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
269 y6, y7, mem_ab, mem_cd, (i) + 4, 1, store_ab_state); \
270 two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
271 y6, y7, mem_ab, mem_cd, (i) + 6, 1, dummy_store);
272
273#define dec_rounds32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
274 y6, y7, mem_ab, mem_cd, i) \
275 two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
276 y6, y7, mem_ab, mem_cd, (i) + 7, -1, store_ab_state); \
277 two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
278 y6, y7, mem_ab, mem_cd, (i) + 5, -1, store_ab_state); \
279 two_roundsm32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
280 y6, y7, mem_ab, mem_cd, (i) + 3, -1, dummy_store);
281
282/*
283 * IN:
284 * v0..3: byte-sliced 32-bit integers
285 * OUT:
286 * v0..3: (IN <<< 1)
287 */
288#define rol32_1_32(v0, v1, v2, v3, t0, t1, t2, zero) \
289 vpcmpgtb v0, zero, t0; \
290 vpaddb v0, v0, v0; \
291 vpabsb t0, t0; \
292 \
293 vpcmpgtb v1, zero, t1; \
294 vpaddb v1, v1, v1; \
295 vpabsb t1, t1; \
296 \
297 vpcmpgtb v2, zero, t2; \
298 vpaddb v2, v2, v2; \
299 vpabsb t2, t2; \
300 \
301 vpor t0, v1, v1; \
302 \
303 vpcmpgtb v3, zero, t0; \
304 vpaddb v3, v3, v3; \
305 vpabsb t0, t0; \
306 \
307 vpor t1, v2, v2; \
308 vpor t2, v3, v3; \
309 vpor t0, v0, v0;
310
311/*
312 * IN:
313 * r: byte-sliced AB state in memory
314 * l: byte-sliced CD state in memory
315 * OUT:
316 * x0..x7: new byte-sliced CD state
317 */
318#define fls32(l, l0, l1, l2, l3, l4, l5, l6, l7, r, t0, t1, t2, t3, tt0, \
319 tt1, tt2, tt3, kll, klr, krl, krr) \
320 /* \
321 * t0 = kll; \
322 * t0 &= ll; \
323 * lr ^= rol32(t0, 1); \
324 */ \
325 vpbroadcastd kll, t0; /* only lowest 32-bit used */ \
326 vpxor tt0, tt0, tt0; \
327 vpbroadcastb t0##_x, t3; \
328 vpsrldq $1, t0, t0; \
329 vpbroadcastb t0##_x, t2; \
330 vpsrldq $1, t0, t0; \
331 vpbroadcastb t0##_x, t1; \
332 vpsrldq $1, t0, t0; \
333 vpbroadcastb t0##_x, t0; \
334 \
335 vpand l0, t0, t0; \
336 vpand l1, t1, t1; \
337 vpand l2, t2, t2; \
338 vpand l3, t3, t3; \
339 \
340 rol32_1_32(t3, t2, t1, t0, tt1, tt2, tt3, tt0); \
341 \
342 vpxor l4, t0, l4; \
343 vmovdqu l4, 4 * 32(l); \
344 vpxor l5, t1, l5; \
345 vmovdqu l5, 5 * 32(l); \
346 vpxor l6, t2, l6; \
347 vmovdqu l6, 6 * 32(l); \
348 vpxor l7, t3, l7; \
349 vmovdqu l7, 7 * 32(l); \
350 \
351 /* \
352 * t2 = krr; \
353 * t2 |= rr; \
354 * rl ^= t2; \
355 */ \
356 \
357 vpbroadcastd krr, t0; /* only lowest 32-bit used */ \
358 vpbroadcastb t0##_x, t3; \
359 vpsrldq $1, t0, t0; \
360 vpbroadcastb t0##_x, t2; \
361 vpsrldq $1, t0, t0; \
362 vpbroadcastb t0##_x, t1; \
363 vpsrldq $1, t0, t0; \
364 vpbroadcastb t0##_x, t0; \
365 \
366 vpor 4 * 32(r), t0, t0; \
367 vpor 5 * 32(r), t1, t1; \
368 vpor 6 * 32(r), t2, t2; \
369 vpor 7 * 32(r), t3, t3; \
370 \
371 vpxor 0 * 32(r), t0, t0; \
372 vpxor 1 * 32(r), t1, t1; \
373 vpxor 2 * 32(r), t2, t2; \
374 vpxor 3 * 32(r), t3, t3; \
375 vmovdqu t0, 0 * 32(r); \
376 vmovdqu t1, 1 * 32(r); \
377 vmovdqu t2, 2 * 32(r); \
378 vmovdqu t3, 3 * 32(r); \
379 \
380 /* \
381 * t2 = krl; \
382 * t2 &= rl; \
383 * rr ^= rol32(t2, 1); \
384 */ \
385 vpbroadcastd krl, t0; /* only lowest 32-bit used */ \
386 vpbroadcastb t0##_x, t3; \
387 vpsrldq $1, t0, t0; \
388 vpbroadcastb t0##_x, t2; \
389 vpsrldq $1, t0, t0; \
390 vpbroadcastb t0##_x, t1; \
391 vpsrldq $1, t0, t0; \
392 vpbroadcastb t0##_x, t0; \
393 \
394 vpand 0 * 32(r), t0, t0; \
395 vpand 1 * 32(r), t1, t1; \
396 vpand 2 * 32(r), t2, t2; \
397 vpand 3 * 32(r), t3, t3; \
398 \
399 rol32_1_32(t3, t2, t1, t0, tt1, tt2, tt3, tt0); \
400 \
401 vpxor 4 * 32(r), t0, t0; \
402 vpxor 5 * 32(r), t1, t1; \
403 vpxor 6 * 32(r), t2, t2; \
404 vpxor 7 * 32(r), t3, t3; \
405 vmovdqu t0, 4 * 32(r); \
406 vmovdqu t1, 5 * 32(r); \
407 vmovdqu t2, 6 * 32(r); \
408 vmovdqu t3, 7 * 32(r); \
409 \
410 /* \
411 * t0 = klr; \
412 * t0 |= lr; \
413 * ll ^= t0; \
414 */ \
415 \
416 vpbroadcastd klr, t0; /* only lowest 32-bit used */ \
417 vpbroadcastb t0##_x, t3; \
418 vpsrldq $1, t0, t0; \
419 vpbroadcastb t0##_x, t2; \
420 vpsrldq $1, t0, t0; \
421 vpbroadcastb t0##_x, t1; \
422 vpsrldq $1, t0, t0; \
423 vpbroadcastb t0##_x, t0; \
424 \
425 vpor l4, t0, t0; \
426 vpor l5, t1, t1; \
427 vpor l6, t2, t2; \
428 vpor l7, t3, t3; \
429 \
430 vpxor l0, t0, l0; \
431 vmovdqu l0, 0 * 32(l); \
432 vpxor l1, t1, l1; \
433 vmovdqu l1, 1 * 32(l); \
434 vpxor l2, t2, l2; \
435 vmovdqu l2, 2 * 32(l); \
436 vpxor l3, t3, l3; \
437 vmovdqu l3, 3 * 32(l);
438
439#define transpose_4x4(x0, x1, x2, x3, t1, t2) \
440 vpunpckhdq x1, x0, t2; \
441 vpunpckldq x1, x0, x0; \
442 \
443 vpunpckldq x3, x2, t1; \
444 vpunpckhdq x3, x2, x2; \
445 \
446 vpunpckhqdq t1, x0, x1; \
447 vpunpcklqdq t1, x0, x0; \
448 \
449 vpunpckhqdq x2, t2, x3; \
450 vpunpcklqdq x2, t2, x2;
451
452#define byteslice_16x16b_fast(a0, b0, c0, d0, a1, b1, c1, d1, a2, b2, c2, d2, \
453 a3, b3, c3, d3, st0, st1) \
454 vmovdqu d2, st0; \
455 vmovdqu d3, st1; \
456 transpose_4x4(a0, a1, a2, a3, d2, d3); \
457 transpose_4x4(b0, b1, b2, b3, d2, d3); \
458 vmovdqu st0, d2; \
459 vmovdqu st1, d3; \
460 \
461 vmovdqu a0, st0; \
462 vmovdqu a1, st1; \
463 transpose_4x4(c0, c1, c2, c3, a0, a1); \
464 transpose_4x4(d0, d1, d2, d3, a0, a1); \
465 \
466 vbroadcasti128 .Lshufb_16x16b, a0; \
467 vmovdqu st1, a1; \
468 vpshufb a0, a2, a2; \
469 vpshufb a0, a3, a3; \
470 vpshufb a0, b0, b0; \
471 vpshufb a0, b1, b1; \
472 vpshufb a0, b2, b2; \
473 vpshufb a0, b3, b3; \
474 vpshufb a0, a1, a1; \
475 vpshufb a0, c0, c0; \
476 vpshufb a0, c1, c1; \
477 vpshufb a0, c2, c2; \
478 vpshufb a0, c3, c3; \
479 vpshufb a0, d0, d0; \
480 vpshufb a0, d1, d1; \
481 vpshufb a0, d2, d2; \
482 vpshufb a0, d3, d3; \
483 vmovdqu d3, st1; \
484 vmovdqu st0, d3; \
485 vpshufb a0, d3, a0; \
486 vmovdqu d2, st0; \
487 \
488 transpose_4x4(a0, b0, c0, d0, d2, d3); \
489 transpose_4x4(a1, b1, c1, d1, d2, d3); \
490 vmovdqu st0, d2; \
491 vmovdqu st1, d3; \
492 \
493 vmovdqu b0, st0; \
494 vmovdqu b1, st1; \
495 transpose_4x4(a2, b2, c2, d2, b0, b1); \
496 transpose_4x4(a3, b3, c3, d3, b0, b1); \
497 vmovdqu st0, b0; \
498 vmovdqu st1, b1; \
499 /* does not adjust output bytes inside vectors */
500
501/* load blocks to registers and apply pre-whitening */
502#define inpack32_pre(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
503 y6, y7, rio, key) \
504 vpbroadcastq key, x0; \
505 vpshufb .Lpack_bswap, x0, x0; \
506 \
507 vpxor 0 * 32(rio), x0, y7; \
508 vpxor 1 * 32(rio), x0, y6; \
509 vpxor 2 * 32(rio), x0, y5; \
510 vpxor 3 * 32(rio), x0, y4; \
511 vpxor 4 * 32(rio), x0, y3; \
512 vpxor 5 * 32(rio), x0, y2; \
513 vpxor 6 * 32(rio), x0, y1; \
514 vpxor 7 * 32(rio), x0, y0; \
515 vpxor 8 * 32(rio), x0, x7; \
516 vpxor 9 * 32(rio), x0, x6; \
517 vpxor 10 * 32(rio), x0, x5; \
518 vpxor 11 * 32(rio), x0, x4; \
519 vpxor 12 * 32(rio), x0, x3; \
520 vpxor 13 * 32(rio), x0, x2; \
521 vpxor 14 * 32(rio), x0, x1; \
522 vpxor 15 * 32(rio), x0, x0;
523
524/* byteslice pre-whitened blocks and store to temporary memory */
525#define inpack32_post(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
526 y6, y7, mem_ab, mem_cd) \
527 byteslice_16x16b_fast(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, \
528 y4, y5, y6, y7, (mem_ab), (mem_cd)); \
529 \
530 vmovdqu x0, 0 * 32(mem_ab); \
531 vmovdqu x1, 1 * 32(mem_ab); \
532 vmovdqu x2, 2 * 32(mem_ab); \
533 vmovdqu x3, 3 * 32(mem_ab); \
534 vmovdqu x4, 4 * 32(mem_ab); \
535 vmovdqu x5, 5 * 32(mem_ab); \
536 vmovdqu x6, 6 * 32(mem_ab); \
537 vmovdqu x7, 7 * 32(mem_ab); \
538 vmovdqu y0, 0 * 32(mem_cd); \
539 vmovdqu y1, 1 * 32(mem_cd); \
540 vmovdqu y2, 2 * 32(mem_cd); \
541 vmovdqu y3, 3 * 32(mem_cd); \
542 vmovdqu y4, 4 * 32(mem_cd); \
543 vmovdqu y5, 5 * 32(mem_cd); \
544 vmovdqu y6, 6 * 32(mem_cd); \
545 vmovdqu y7, 7 * 32(mem_cd);
546
547/* de-byteslice, apply post-whitening and store blocks */
548#define outunpack32(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, \
549 y5, y6, y7, key, stack_tmp0, stack_tmp1) \
550 byteslice_16x16b_fast(y0, y4, x0, x4, y1, y5, x1, x5, y2, y6, x2, x6, \
551 y3, y7, x3, x7, stack_tmp0, stack_tmp1); \
552 \
553 vmovdqu x0, stack_tmp0; \
554 \
555 vpbroadcastq key, x0; \
556 vpshufb .Lpack_bswap, x0, x0; \
557 \
558 vpxor x0, y7, y7; \
559 vpxor x0, y6, y6; \
560 vpxor x0, y5, y5; \
561 vpxor x0, y4, y4; \
562 vpxor x0, y3, y3; \
563 vpxor x0, y2, y2; \
564 vpxor x0, y1, y1; \
565 vpxor x0, y0, y0; \
566 vpxor x0, x7, x7; \
567 vpxor x0, x6, x6; \
568 vpxor x0, x5, x5; \
569 vpxor x0, x4, x4; \
570 vpxor x0, x3, x3; \
571 vpxor x0, x2, x2; \
572 vpxor x0, x1, x1; \
573 vpxor stack_tmp0, x0, x0;
574
575#define write_output(x0, x1, x2, x3, x4, x5, x6, x7, y0, y1, y2, y3, y4, y5, \
576 y6, y7, rio) \
577 vmovdqu x0, 0 * 32(rio); \
578 vmovdqu x1, 1 * 32(rio); \
579 vmovdqu x2, 2 * 32(rio); \
580 vmovdqu x3, 3 * 32(rio); \
581 vmovdqu x4, 4 * 32(rio); \
582 vmovdqu x5, 5 * 32(rio); \
583 vmovdqu x6, 6 * 32(rio); \
584 vmovdqu x7, 7 * 32(rio); \
585 vmovdqu y0, 8 * 32(rio); \
586 vmovdqu y1, 9 * 32(rio); \
587 vmovdqu y2, 10 * 32(rio); \
588 vmovdqu y3, 11 * 32(rio); \
589 vmovdqu y4, 12 * 32(rio); \
590 vmovdqu y5, 13 * 32(rio); \
591 vmovdqu y6, 14 * 32(rio); \
592 vmovdqu y7, 15 * 32(rio);
593
594.data
595.align 32
596
597#define SHUFB_BYTES(idx) \
598 0 + (idx), 4 + (idx), 8 + (idx), 12 + (idx)
599
600.Lshufb_16x16b:
601 .byte SHUFB_BYTES(0), SHUFB_BYTES(1), SHUFB_BYTES(2), SHUFB_BYTES(3)
602 .byte SHUFB_BYTES(0), SHUFB_BYTES(1), SHUFB_BYTES(2), SHUFB_BYTES(3)
603
604.Lpack_bswap:
605 .long 0x00010203, 0x04050607, 0x80808080, 0x80808080
606 .long 0x00010203, 0x04050607, 0x80808080, 0x80808080
607
608/* For CTR-mode IV byteswap */
609.Lbswap128_mask:
610 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
611
612/* For XTS mode */
613.Lxts_gf128mul_and_shl1_mask_0:
614 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
615.Lxts_gf128mul_and_shl1_mask_1:
616 .byte 0x0e, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0
617
618/*
619 * pre-SubByte transform
620 *
621 * pre-lookup for sbox1, sbox2, sbox3:
622 * swap_bitendianness(
623 * isom_map_camellia_to_aes(
624 * camellia_f(
625 * swap_bitendianess(in)
626 * )
627 * )
628 * )
629 *
630 * (note: '⊕ 0xc5' inside camellia_f())
631 */
632.Lpre_tf_lo_s1:
633 .byte 0x45, 0xe8, 0x40, 0xed, 0x2e, 0x83, 0x2b, 0x86
634 .byte 0x4b, 0xe6, 0x4e, 0xe3, 0x20, 0x8d, 0x25, 0x88
635.Lpre_tf_hi_s1:
636 .byte 0x00, 0x51, 0xf1, 0xa0, 0x8a, 0xdb, 0x7b, 0x2a
637 .byte 0x09, 0x58, 0xf8, 0xa9, 0x83, 0xd2, 0x72, 0x23
638
639/*
640 * pre-SubByte transform
641 *
642 * pre-lookup for sbox4:
643 * swap_bitendianness(
644 * isom_map_camellia_to_aes(
645 * camellia_f(
646 * swap_bitendianess(in <<< 1)
647 * )
648 * )
649 * )
650 *
651 * (note: '⊕ 0xc5' inside camellia_f())
652 */
653.Lpre_tf_lo_s4:
654 .byte 0x45, 0x40, 0x2e, 0x2b, 0x4b, 0x4e, 0x20, 0x25
655 .byte 0x14, 0x11, 0x7f, 0x7a, 0x1a, 0x1f, 0x71, 0x74
656.Lpre_tf_hi_s4:
657 .byte 0x00, 0xf1, 0x8a, 0x7b, 0x09, 0xf8, 0x83, 0x72
658 .byte 0xad, 0x5c, 0x27, 0xd6, 0xa4, 0x55, 0x2e, 0xdf
659
660/*
661 * post-SubByte transform
662 *
663 * post-lookup for sbox1, sbox4:
664 * swap_bitendianness(
665 * camellia_h(
666 * isom_map_aes_to_camellia(
667 * swap_bitendianness(
668 * aes_inverse_affine_transform(in)
669 * )
670 * )
671 * )
672 * )
673 *
674 * (note: '⊕ 0x6e' inside camellia_h())
675 */
676.Lpost_tf_lo_s1:
677 .byte 0x3c, 0xcc, 0xcf, 0x3f, 0x32, 0xc2, 0xc1, 0x31
678 .byte 0xdc, 0x2c, 0x2f, 0xdf, 0xd2, 0x22, 0x21, 0xd1
679.Lpost_tf_hi_s1:
680 .byte 0x00, 0xf9, 0x86, 0x7f, 0xd7, 0x2e, 0x51, 0xa8
681 .byte 0xa4, 0x5d, 0x22, 0xdb, 0x73, 0x8a, 0xf5, 0x0c
682
683/*
684 * post-SubByte transform
685 *
686 * post-lookup for sbox2:
687 * swap_bitendianness(
688 * camellia_h(
689 * isom_map_aes_to_camellia(
690 * swap_bitendianness(
691 * aes_inverse_affine_transform(in)
692 * )
693 * )
694 * )
695 * ) <<< 1
696 *
697 * (note: '⊕ 0x6e' inside camellia_h())
698 */
699.Lpost_tf_lo_s2:
700 .byte 0x78, 0x99, 0x9f, 0x7e, 0x64, 0x85, 0x83, 0x62
701 .byte 0xb9, 0x58, 0x5e, 0xbf, 0xa5, 0x44, 0x42, 0xa3
702.Lpost_tf_hi_s2:
703 .byte 0x00, 0xf3, 0x0d, 0xfe, 0xaf, 0x5c, 0xa2, 0x51
704 .byte 0x49, 0xba, 0x44, 0xb7, 0xe6, 0x15, 0xeb, 0x18
705
706/*
707 * post-SubByte transform
708 *
709 * post-lookup for sbox3:
710 * swap_bitendianness(
711 * camellia_h(
712 * isom_map_aes_to_camellia(
713 * swap_bitendianness(
714 * aes_inverse_affine_transform(in)
715 * )
716 * )
717 * )
718 * ) >>> 1
719 *
720 * (note: '⊕ 0x6e' inside camellia_h())
721 */
722.Lpost_tf_lo_s3:
723 .byte 0x1e, 0x66, 0xe7, 0x9f, 0x19, 0x61, 0xe0, 0x98
724 .byte 0x6e, 0x16, 0x97, 0xef, 0x69, 0x11, 0x90, 0xe8
725.Lpost_tf_hi_s3:
726 .byte 0x00, 0xfc, 0x43, 0xbf, 0xeb, 0x17, 0xa8, 0x54
727 .byte 0x52, 0xae, 0x11, 0xed, 0xb9, 0x45, 0xfa, 0x06
728
729/* For isolating SubBytes from AESENCLAST, inverse shift row */
730.Linv_shift_row:
731 .byte 0x00, 0x0d, 0x0a, 0x07, 0x04, 0x01, 0x0e, 0x0b
732 .byte 0x08, 0x05, 0x02, 0x0f, 0x0c, 0x09, 0x06, 0x03
733
734.align 4
735/* 4-bit mask */
736.L0f0f0f0f:
737 .long 0x0f0f0f0f
738
739.text
740
741.align 8
742__camellia_enc_blk32:
743 /* input:
744 * %rdi: ctx, CTX
745 * %rax: temporary storage, 512 bytes
746 * %ymm0..%ymm15: 32 plaintext blocks
747 * output:
748 * %ymm0..%ymm15: 32 encrypted blocks, order swapped:
749 * 7, 8, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8
750 */
751
752 leaq 8 * 32(%rax), %rcx;
753
754 inpack32_post(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
755 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
756 %ymm15, %rax, %rcx);
757
758 enc_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
759 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
760 %ymm15, %rax, %rcx, 0);
761
762 fls32(%rax, %ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
763 %rcx, %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
764 %ymm15,
765 ((key_table + (8) * 8) + 0)(CTX),
766 ((key_table + (8) * 8) + 4)(CTX),
767 ((key_table + (8) * 8) + 8)(CTX),
768 ((key_table + (8) * 8) + 12)(CTX));
769
770 enc_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
771 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
772 %ymm15, %rax, %rcx, 8);
773
774 fls32(%rax, %ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
775 %rcx, %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
776 %ymm15,
777 ((key_table + (16) * 8) + 0)(CTX),
778 ((key_table + (16) * 8) + 4)(CTX),
779 ((key_table + (16) * 8) + 8)(CTX),
780 ((key_table + (16) * 8) + 12)(CTX));
781
782 enc_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
783 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
784 %ymm15, %rax, %rcx, 16);
785
786 movl $24, %r8d;
787 cmpl $16, key_length(CTX);
788 jne .Lenc_max32;
789
790.Lenc_done:
791 /* load CD for output */
792 vmovdqu 0 * 32(%rcx), %ymm8;
793 vmovdqu 1 * 32(%rcx), %ymm9;
794 vmovdqu 2 * 32(%rcx), %ymm10;
795 vmovdqu 3 * 32(%rcx), %ymm11;
796 vmovdqu 4 * 32(%rcx), %ymm12;
797 vmovdqu 5 * 32(%rcx), %ymm13;
798 vmovdqu 6 * 32(%rcx), %ymm14;
799 vmovdqu 7 * 32(%rcx), %ymm15;
800
801 outunpack32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
802 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
803 %ymm15, (key_table)(CTX, %r8, 8), (%rax), 1 * 32(%rax));
804
805 ret;
806
807.align 8
808.Lenc_max32:
809 movl $32, %r8d;
810
811 fls32(%rax, %ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
812 %rcx, %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
813 %ymm15,
814 ((key_table + (24) * 8) + 0)(CTX),
815 ((key_table + (24) * 8) + 4)(CTX),
816 ((key_table + (24) * 8) + 8)(CTX),
817 ((key_table + (24) * 8) + 12)(CTX));
818
819 enc_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
820 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
821 %ymm15, %rax, %rcx, 24);
822
823 jmp .Lenc_done;
824ENDPROC(__camellia_enc_blk32)
825
826.align 8
827__camellia_dec_blk32:
828 /* input:
829 * %rdi: ctx, CTX
830 * %rax: temporary storage, 512 bytes
831 * %r8d: 24 for 16 byte key, 32 for larger
832 * %ymm0..%ymm15: 16 encrypted blocks
833 * output:
834 * %ymm0..%ymm15: 16 plaintext blocks, order swapped:
835 * 7, 8, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8
836 */
837
838 leaq 8 * 32(%rax), %rcx;
839
840 inpack32_post(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
841 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
842 %ymm15, %rax, %rcx);
843
844 cmpl $32, %r8d;
845 je .Ldec_max32;
846
847.Ldec_max24:
848 dec_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
849 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
850 %ymm15, %rax, %rcx, 16);
851
852 fls32(%rax, %ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
853 %rcx, %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
854 %ymm15,
855 ((key_table + (16) * 8) + 8)(CTX),
856 ((key_table + (16) * 8) + 12)(CTX),
857 ((key_table + (16) * 8) + 0)(CTX),
858 ((key_table + (16) * 8) + 4)(CTX));
859
860 dec_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
861 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
862 %ymm15, %rax, %rcx, 8);
863
864 fls32(%rax, %ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
865 %rcx, %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
866 %ymm15,
867 ((key_table + (8) * 8) + 8)(CTX),
868 ((key_table + (8) * 8) + 12)(CTX),
869 ((key_table + (8) * 8) + 0)(CTX),
870 ((key_table + (8) * 8) + 4)(CTX));
871
872 dec_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
873 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
874 %ymm15, %rax, %rcx, 0);
875
876 /* load CD for output */
877 vmovdqu 0 * 32(%rcx), %ymm8;
878 vmovdqu 1 * 32(%rcx), %ymm9;
879 vmovdqu 2 * 32(%rcx), %ymm10;
880 vmovdqu 3 * 32(%rcx), %ymm11;
881 vmovdqu 4 * 32(%rcx), %ymm12;
882 vmovdqu 5 * 32(%rcx), %ymm13;
883 vmovdqu 6 * 32(%rcx), %ymm14;
884 vmovdqu 7 * 32(%rcx), %ymm15;
885
886 outunpack32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
887 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
888 %ymm15, (key_table)(CTX), (%rax), 1 * 32(%rax));
889
890 ret;
891
892.align 8
893.Ldec_max32:
894 dec_rounds32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
895 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
896 %ymm15, %rax, %rcx, 24);
897
898 fls32(%rax, %ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
899 %rcx, %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
900 %ymm15,
901 ((key_table + (24) * 8) + 8)(CTX),
902 ((key_table + (24) * 8) + 12)(CTX),
903 ((key_table + (24) * 8) + 0)(CTX),
904 ((key_table + (24) * 8) + 4)(CTX));
905
906 jmp .Ldec_max24;
907ENDPROC(__camellia_dec_blk32)
908
909ENTRY(camellia_ecb_enc_32way)
910 /* input:
911 * %rdi: ctx, CTX
912 * %rsi: dst (32 blocks)
913 * %rdx: src (32 blocks)
914 */
915
916 vzeroupper;
917
918 inpack32_pre(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
919 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
920 %ymm15, %rdx, (key_table)(CTX));
921
922 /* now dst can be used as temporary buffer (even in src == dst case) */
923 movq %rsi, %rax;
924
925 call __camellia_enc_blk32;
926
927 write_output(%ymm7, %ymm6, %ymm5, %ymm4, %ymm3, %ymm2, %ymm1, %ymm0,
928 %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
929 %ymm8, %rsi);
930
931 vzeroupper;
932
933 ret;
934ENDPROC(camellia_ecb_enc_32way)
935
936ENTRY(camellia_ecb_dec_32way)
937 /* input:
938 * %rdi: ctx, CTX
939 * %rsi: dst (32 blocks)
940 * %rdx: src (32 blocks)
941 */
942
943 vzeroupper;
944
945 cmpl $16, key_length(CTX);
946 movl $32, %r8d;
947 movl $24, %eax;
948 cmovel %eax, %r8d; /* max */
949
950 inpack32_pre(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
951 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
952 %ymm15, %rdx, (key_table)(CTX, %r8, 8));
953
954 /* now dst can be used as temporary buffer (even in src == dst case) */
955 movq %rsi, %rax;
956
957 call __camellia_dec_blk32;
958
959 write_output(%ymm7, %ymm6, %ymm5, %ymm4, %ymm3, %ymm2, %ymm1, %ymm0,
960 %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
961 %ymm8, %rsi);
962
963 vzeroupper;
964
965 ret;
966ENDPROC(camellia_ecb_dec_32way)
967
968ENTRY(camellia_cbc_dec_32way)
969 /* input:
970 * %rdi: ctx, CTX
971 * %rsi: dst (32 blocks)
972 * %rdx: src (32 blocks)
973 */
974
975 vzeroupper;
976
977 cmpl $16, key_length(CTX);
978 movl $32, %r8d;
979 movl $24, %eax;
980 cmovel %eax, %r8d; /* max */
981
982 inpack32_pre(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
983 %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
984 %ymm15, %rdx, (key_table)(CTX, %r8, 8));
985
986 movq %rsp, %r10;
987 cmpq %rsi, %rdx;
988 je .Lcbc_dec_use_stack;
989
990 /* dst can be used as temporary storage, src is not overwritten. */
991 movq %rsi, %rax;
992 jmp .Lcbc_dec_continue;
993
994.Lcbc_dec_use_stack:
995 /*
996 * dst still in-use (because dst == src), so use stack for temporary
997 * storage.
998 */
999 subq $(16 * 32), %rsp;
1000 movq %rsp, %rax;
1001
1002.Lcbc_dec_continue:
1003 call __camellia_dec_blk32;
1004
1005 vmovdqu %ymm7, (%rax);
1006 vpxor %ymm7, %ymm7, %ymm7;
1007 vinserti128 $1, (%rdx), %ymm7, %ymm7;
1008 vpxor (%rax), %ymm7, %ymm7;
1009 movq %r10, %rsp;
1010 vpxor (0 * 32 + 16)(%rdx), %ymm6, %ymm6;
1011 vpxor (1 * 32 + 16)(%rdx), %ymm5, %ymm5;
1012 vpxor (2 * 32 + 16)(%rdx), %ymm4, %ymm4;
1013 vpxor (3 * 32 + 16)(%rdx), %ymm3, %ymm3;
1014 vpxor (4 * 32 + 16)(%rdx), %ymm2, %ymm2;
1015 vpxor (5 * 32 + 16)(%rdx), %ymm1, %ymm1;
1016 vpxor (6 * 32 + 16)(%rdx), %ymm0, %ymm0;
1017 vpxor (7 * 32 + 16)(%rdx), %ymm15, %ymm15;
1018 vpxor (8 * 32 + 16)(%rdx), %ymm14, %ymm14;
1019 vpxor (9 * 32 + 16)(%rdx), %ymm13, %ymm13;
1020 vpxor (10 * 32 + 16)(%rdx), %ymm12, %ymm12;
1021 vpxor (11 * 32 + 16)(%rdx), %ymm11, %ymm11;
1022 vpxor (12 * 32 + 16)(%rdx), %ymm10, %ymm10;
1023 vpxor (13 * 32 + 16)(%rdx), %ymm9, %ymm9;
1024 vpxor (14 * 32 + 16)(%rdx), %ymm8, %ymm8;
1025 write_output(%ymm7, %ymm6, %ymm5, %ymm4, %ymm3, %ymm2, %ymm1, %ymm0,
1026 %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
1027 %ymm8, %rsi);
1028
1029 vzeroupper;
1030
1031 ret;
1032ENDPROC(camellia_cbc_dec_32way)
1033
1034#define inc_le128(x, minus_one, tmp) \
1035 vpcmpeqq minus_one, x, tmp; \
1036 vpsubq minus_one, x, x; \
1037 vpslldq $8, tmp, tmp; \
1038 vpsubq tmp, x, x;
1039
1040#define add2_le128(x, minus_one, minus_two, tmp1, tmp2) \
1041 vpcmpeqq minus_one, x, tmp1; \
1042 vpcmpeqq minus_two, x, tmp2; \
1043 vpsubq minus_two, x, x; \
1044 vpor tmp2, tmp1, tmp1; \
1045 vpslldq $8, tmp1, tmp1; \
1046 vpsubq tmp1, x, x;
1047
1048ENTRY(camellia_ctr_32way)
1049 /* input:
1050 * %rdi: ctx, CTX
1051 * %rsi: dst (32 blocks)
1052 * %rdx: src (32 blocks)
1053 * %rcx: iv (little endian, 128bit)
1054 */
1055
1056 vzeroupper;
1057
1058 movq %rsp, %r10;
1059 cmpq %rsi, %rdx;
1060 je .Lctr_use_stack;
1061
1062 /* dst can be used as temporary storage, src is not overwritten. */
1063 movq %rsi, %rax;
1064 jmp .Lctr_continue;
1065
1066.Lctr_use_stack:
1067 subq $(16 * 32), %rsp;
1068 movq %rsp, %rax;
1069
1070.Lctr_continue:
1071 vpcmpeqd %ymm15, %ymm15, %ymm15;
1072 vpsrldq $8, %ymm15, %ymm15; /* ab: -1:0 ; cd: -1:0 */
1073 vpaddq %ymm15, %ymm15, %ymm12; /* ab: -2:0 ; cd: -2:0 */
1074
1075 /* load IV and byteswap */
1076 vmovdqu (%rcx), %xmm0;
1077 vmovdqa %xmm0, %xmm1;
1078 inc_le128(%xmm0, %xmm15, %xmm14);
1079 vbroadcasti128 .Lbswap128_mask, %ymm14;
1080 vinserti128 $1, %xmm0, %ymm1, %ymm0;
1081 vpshufb %ymm14, %ymm0, %ymm13;
1082 vmovdqu %ymm13, 15 * 32(%rax);
1083
1084 /* construct IVs */
1085 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13); /* ab:le2 ; cd:le3 */
1086 vpshufb %ymm14, %ymm0, %ymm13;
1087 vmovdqu %ymm13, 14 * 32(%rax);
1088 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1089 vpshufb %ymm14, %ymm0, %ymm13;
1090 vmovdqu %ymm13, 13 * 32(%rax);
1091 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1092 vpshufb %ymm14, %ymm0, %ymm13;
1093 vmovdqu %ymm13, 12 * 32(%rax);
1094 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1095 vpshufb %ymm14, %ymm0, %ymm13;
1096 vmovdqu %ymm13, 11 * 32(%rax);
1097 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1098 vpshufb %ymm14, %ymm0, %ymm10;
1099 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1100 vpshufb %ymm14, %ymm0, %ymm9;
1101 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1102 vpshufb %ymm14, %ymm0, %ymm8;
1103 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1104 vpshufb %ymm14, %ymm0, %ymm7;
1105 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1106 vpshufb %ymm14, %ymm0, %ymm6;
1107 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1108 vpshufb %ymm14, %ymm0, %ymm5;
1109 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1110 vpshufb %ymm14, %ymm0, %ymm4;
1111 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1112 vpshufb %ymm14, %ymm0, %ymm3;
1113 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1114 vpshufb %ymm14, %ymm0, %ymm2;
1115 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1116 vpshufb %ymm14, %ymm0, %ymm1;
1117 add2_le128(%ymm0, %ymm15, %ymm12, %ymm11, %ymm13);
1118 vextracti128 $1, %ymm0, %xmm13;
1119 vpshufb %ymm14, %ymm0, %ymm0;
1120 inc_le128(%xmm13, %xmm15, %xmm14);
1121 vmovdqu %xmm13, (%rcx);
1122
1123 /* inpack32_pre: */
1124 vpbroadcastq (key_table)(CTX), %ymm15;
1125 vpshufb .Lpack_bswap, %ymm15, %ymm15;
1126 vpxor %ymm0, %ymm15, %ymm0;
1127 vpxor %ymm1, %ymm15, %ymm1;
1128 vpxor %ymm2, %ymm15, %ymm2;
1129 vpxor %ymm3, %ymm15, %ymm3;
1130 vpxor %ymm4, %ymm15, %ymm4;
1131 vpxor %ymm5, %ymm15, %ymm5;
1132 vpxor %ymm6, %ymm15, %ymm6;
1133 vpxor %ymm7, %ymm15, %ymm7;
1134 vpxor %ymm8, %ymm15, %ymm8;
1135 vpxor %ymm9, %ymm15, %ymm9;
1136 vpxor %ymm10, %ymm15, %ymm10;
1137 vpxor 11 * 32(%rax), %ymm15, %ymm11;
1138 vpxor 12 * 32(%rax), %ymm15, %ymm12;
1139 vpxor 13 * 32(%rax), %ymm15, %ymm13;
1140 vpxor 14 * 32(%rax), %ymm15, %ymm14;
1141 vpxor 15 * 32(%rax), %ymm15, %ymm15;
1142
1143 call __camellia_enc_blk32;
1144
1145 movq %r10, %rsp;
1146
1147 vpxor 0 * 32(%rdx), %ymm7, %ymm7;
1148 vpxor 1 * 32(%rdx), %ymm6, %ymm6;
1149 vpxor 2 * 32(%rdx), %ymm5, %ymm5;
1150 vpxor 3 * 32(%rdx), %ymm4, %ymm4;
1151 vpxor 4 * 32(%rdx), %ymm3, %ymm3;
1152 vpxor 5 * 32(%rdx), %ymm2, %ymm2;
1153 vpxor 6 * 32(%rdx), %ymm1, %ymm1;
1154 vpxor 7 * 32(%rdx), %ymm0, %ymm0;
1155 vpxor 8 * 32(%rdx), %ymm15, %ymm15;
1156 vpxor 9 * 32(%rdx), %ymm14, %ymm14;
1157 vpxor 10 * 32(%rdx), %ymm13, %ymm13;
1158 vpxor 11 * 32(%rdx), %ymm12, %ymm12;
1159 vpxor 12 * 32(%rdx), %ymm11, %ymm11;
1160 vpxor 13 * 32(%rdx), %ymm10, %ymm10;
1161 vpxor 14 * 32(%rdx), %ymm9, %ymm9;
1162 vpxor 15 * 32(%rdx), %ymm8, %ymm8;
1163 write_output(%ymm7, %ymm6, %ymm5, %ymm4, %ymm3, %ymm2, %ymm1, %ymm0,
1164 %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
1165 %ymm8, %rsi);
1166
1167 vzeroupper;
1168
1169 ret;
1170ENDPROC(camellia_ctr_32way)
1171
1172#define gf128mul_x_ble(iv, mask, tmp) \
1173 vpsrad $31, iv, tmp; \
1174 vpaddq iv, iv, iv; \
1175 vpshufd $0x13, tmp, tmp; \
1176 vpand mask, tmp, tmp; \
1177 vpxor tmp, iv, iv;
1178
1179#define gf128mul_x2_ble(iv, mask1, mask2, tmp0, tmp1) \
1180 vpsrad $31, iv, tmp0; \
1181 vpaddq iv, iv, tmp1; \
1182 vpsllq $2, iv, iv; \
1183 vpshufd $0x13, tmp0, tmp0; \
1184 vpsrad $31, tmp1, tmp1; \
1185 vpand mask2, tmp0, tmp0; \
1186 vpshufd $0x13, tmp1, tmp1; \
1187 vpxor tmp0, iv, iv; \
1188 vpand mask1, tmp1, tmp1; \
1189 vpxor tmp1, iv, iv;
1190
1191.align 8
1192camellia_xts_crypt_32way:
1193 /* input:
1194 * %rdi: ctx, CTX
1195 * %rsi: dst (32 blocks)
1196 * %rdx: src (32 blocks)
1197 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
1198 * %r8: index for input whitening key
1199 * %r9: pointer to __camellia_enc_blk32 or __camellia_dec_blk32
1200 */
1201
1202 vzeroupper;
1203
1204 subq $(16 * 32), %rsp;
1205 movq %rsp, %rax;
1206
1207 vbroadcasti128 .Lxts_gf128mul_and_shl1_mask_0, %ymm12;
1208
1209 /* load IV and construct second IV */
1210 vmovdqu (%rcx), %xmm0;
1211 vmovdqa %xmm0, %xmm15;
1212 gf128mul_x_ble(%xmm0, %xmm12, %xmm13);
1213 vbroadcasti128 .Lxts_gf128mul_and_shl1_mask_1, %ymm13;
1214 vinserti128 $1, %xmm0, %ymm15, %ymm0;
1215 vpxor 0 * 32(%rdx), %ymm0, %ymm15;
1216 vmovdqu %ymm15, 15 * 32(%rax);
1217 vmovdqu %ymm0, 0 * 32(%rsi);
1218
1219 /* construct IVs */
1220 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1221 vpxor 1 * 32(%rdx), %ymm0, %ymm15;
1222 vmovdqu %ymm15, 14 * 32(%rax);
1223 vmovdqu %ymm0, 1 * 32(%rsi);
1224
1225 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1226 vpxor 2 * 32(%rdx), %ymm0, %ymm15;
1227 vmovdqu %ymm15, 13 * 32(%rax);
1228 vmovdqu %ymm0, 2 * 32(%rsi);
1229
1230 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1231 vpxor 3 * 32(%rdx), %ymm0, %ymm15;
1232 vmovdqu %ymm15, 12 * 32(%rax);
1233 vmovdqu %ymm0, 3 * 32(%rsi);
1234
1235 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1236 vpxor 4 * 32(%rdx), %ymm0, %ymm11;
1237 vmovdqu %ymm0, 4 * 32(%rsi);
1238
1239 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1240 vpxor 5 * 32(%rdx), %ymm0, %ymm10;
1241 vmovdqu %ymm0, 5 * 32(%rsi);
1242
1243 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1244 vpxor 6 * 32(%rdx), %ymm0, %ymm9;
1245 vmovdqu %ymm0, 6 * 32(%rsi);
1246
1247 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1248 vpxor 7 * 32(%rdx), %ymm0, %ymm8;
1249 vmovdqu %ymm0, 7 * 32(%rsi);
1250
1251 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1252 vpxor 8 * 32(%rdx), %ymm0, %ymm7;
1253 vmovdqu %ymm0, 8 * 32(%rsi);
1254
1255 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1256 vpxor 9 * 32(%rdx), %ymm0, %ymm6;
1257 vmovdqu %ymm0, 9 * 32(%rsi);
1258
1259 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1260 vpxor 10 * 32(%rdx), %ymm0, %ymm5;
1261 vmovdqu %ymm0, 10 * 32(%rsi);
1262
1263 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1264 vpxor 11 * 32(%rdx), %ymm0, %ymm4;
1265 vmovdqu %ymm0, 11 * 32(%rsi);
1266
1267 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1268 vpxor 12 * 32(%rdx), %ymm0, %ymm3;
1269 vmovdqu %ymm0, 12 * 32(%rsi);
1270
1271 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1272 vpxor 13 * 32(%rdx), %ymm0, %ymm2;
1273 vmovdqu %ymm0, 13 * 32(%rsi);
1274
1275 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1276 vpxor 14 * 32(%rdx), %ymm0, %ymm1;
1277 vmovdqu %ymm0, 14 * 32(%rsi);
1278
1279 gf128mul_x2_ble(%ymm0, %ymm12, %ymm13, %ymm14, %ymm15);
1280 vpxor 15 * 32(%rdx), %ymm0, %ymm15;
1281 vmovdqu %ymm15, 0 * 32(%rax);
1282 vmovdqu %ymm0, 15 * 32(%rsi);
1283
1284 vextracti128 $1, %ymm0, %xmm0;
1285 gf128mul_x_ble(%xmm0, %xmm12, %xmm15);
1286 vmovdqu %xmm0, (%rcx);
1287
1288 /* inpack32_pre: */
1289 vpbroadcastq (key_table)(CTX, %r8, 8), %ymm15;
1290 vpshufb .Lpack_bswap, %ymm15, %ymm15;
1291 vpxor 0 * 32(%rax), %ymm15, %ymm0;
1292 vpxor %ymm1, %ymm15, %ymm1;
1293 vpxor %ymm2, %ymm15, %ymm2;
1294 vpxor %ymm3, %ymm15, %ymm3;
1295 vpxor %ymm4, %ymm15, %ymm4;
1296 vpxor %ymm5, %ymm15, %ymm5;
1297 vpxor %ymm6, %ymm15, %ymm6;
1298 vpxor %ymm7, %ymm15, %ymm7;
1299 vpxor %ymm8, %ymm15, %ymm8;
1300 vpxor %ymm9, %ymm15, %ymm9;
1301 vpxor %ymm10, %ymm15, %ymm10;
1302 vpxor %ymm11, %ymm15, %ymm11;
1303 vpxor 12 * 32(%rax), %ymm15, %ymm12;
1304 vpxor 13 * 32(%rax), %ymm15, %ymm13;
1305 vpxor 14 * 32(%rax), %ymm15, %ymm14;
1306 vpxor 15 * 32(%rax), %ymm15, %ymm15;
1307
1308 call *%r9;
1309
1310 addq $(16 * 32), %rsp;
1311
1312 vpxor 0 * 32(%rsi), %ymm7, %ymm7;
1313 vpxor 1 * 32(%rsi), %ymm6, %ymm6;
1314 vpxor 2 * 32(%rsi), %ymm5, %ymm5;
1315 vpxor 3 * 32(%rsi), %ymm4, %ymm4;
1316 vpxor 4 * 32(%rsi), %ymm3, %ymm3;
1317 vpxor 5 * 32(%rsi), %ymm2, %ymm2;
1318 vpxor 6 * 32(%rsi), %ymm1, %ymm1;
1319 vpxor 7 * 32(%rsi), %ymm0, %ymm0;
1320 vpxor 8 * 32(%rsi), %ymm15, %ymm15;
1321 vpxor 9 * 32(%rsi), %ymm14, %ymm14;
1322 vpxor 10 * 32(%rsi), %ymm13, %ymm13;
1323 vpxor 11 * 32(%rsi), %ymm12, %ymm12;
1324 vpxor 12 * 32(%rsi), %ymm11, %ymm11;
1325 vpxor 13 * 32(%rsi), %ymm10, %ymm10;
1326 vpxor 14 * 32(%rsi), %ymm9, %ymm9;
1327 vpxor 15 * 32(%rsi), %ymm8, %ymm8;
1328 write_output(%ymm7, %ymm6, %ymm5, %ymm4, %ymm3, %ymm2, %ymm1, %ymm0,
1329 %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
1330 %ymm8, %rsi);
1331
1332 vzeroupper;
1333
1334 ret;
1335ENDPROC(camellia_xts_crypt_32way)
1336
1337ENTRY(camellia_xts_enc_32way)
1338 /* input:
1339 * %rdi: ctx, CTX
1340 * %rsi: dst (32 blocks)
1341 * %rdx: src (32 blocks)
1342 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
1343 */
1344
1345 xorl %r8d, %r8d; /* input whitening key, 0 for enc */
1346
1347 leaq __camellia_enc_blk32, %r9;
1348
1349 jmp camellia_xts_crypt_32way;
1350ENDPROC(camellia_xts_enc_32way)
1351
1352ENTRY(camellia_xts_dec_32way)
1353 /* input:
1354 * %rdi: ctx, CTX
1355 * %rsi: dst (32 blocks)
1356 * %rdx: src (32 blocks)
1357 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
1358 */
1359
1360 cmpl $16, key_length(CTX);
1361 movl $32, %r8d;
1362 movl $24, %eax;
1363 cmovel %eax, %r8d; /* input whitening key, last for dec */
1364
1365 leaq __camellia_dec_blk32, %r9;
1366
1367 jmp camellia_xts_crypt_32way;
1368ENDPROC(camellia_xts_dec_32way)
diff --git a/arch/x86/crypto/camellia_aesni_avx2_glue.c b/arch/x86/crypto/camellia_aesni_avx2_glue.c
new file mode 100644
index 000000000000..414fe5d7946b
--- /dev/null
+++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c
@@ -0,0 +1,586 @@
1/*
2 * Glue Code for x86_64/AVX2/AES-NI assembler optimized version of Camellia
3 *
4 * Copyright © 2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
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#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/crypto.h>
16#include <linux/err.h>
17#include <crypto/algapi.h>
18#include <crypto/ctr.h>
19#include <crypto/lrw.h>
20#include <crypto/xts.h>
21#include <asm/xcr.h>
22#include <asm/xsave.h>
23#include <asm/crypto/camellia.h>
24#include <asm/crypto/ablk_helper.h>
25#include <asm/crypto/glue_helper.h>
26
27#define CAMELLIA_AESNI_PARALLEL_BLOCKS 16
28#define CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS 32
29
30/* 32-way AVX2/AES-NI parallel cipher functions */
31asmlinkage void camellia_ecb_enc_32way(struct camellia_ctx *ctx, u8 *dst,
32 const u8 *src);
33asmlinkage void camellia_ecb_dec_32way(struct camellia_ctx *ctx, u8 *dst,
34 const u8 *src);
35
36asmlinkage void camellia_cbc_dec_32way(struct camellia_ctx *ctx, u8 *dst,
37 const u8 *src);
38asmlinkage void camellia_ctr_32way(struct camellia_ctx *ctx, u8 *dst,
39 const u8 *src, le128 *iv);
40
41asmlinkage void camellia_xts_enc_32way(struct camellia_ctx *ctx, u8 *dst,
42 const u8 *src, le128 *iv);
43asmlinkage void camellia_xts_dec_32way(struct camellia_ctx *ctx, u8 *dst,
44 const u8 *src, le128 *iv);
45
46static const struct common_glue_ctx camellia_enc = {
47 .num_funcs = 4,
48 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
49
50 .funcs = { {
51 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS,
52 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_ecb_enc_32way) }
53 }, {
54 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
55 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_ecb_enc_16way) }
56 }, {
57 .num_blocks = 2,
58 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_enc_blk_2way) }
59 }, {
60 .num_blocks = 1,
61 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_enc_blk) }
62 } }
63};
64
65static const struct common_glue_ctx camellia_ctr = {
66 .num_funcs = 4,
67 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
68
69 .funcs = { {
70 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS,
71 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(camellia_ctr_32way) }
72 }, {
73 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
74 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(camellia_ctr_16way) }
75 }, {
76 .num_blocks = 2,
77 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(camellia_crypt_ctr_2way) }
78 }, {
79 .num_blocks = 1,
80 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(camellia_crypt_ctr) }
81 } }
82};
83
84static const struct common_glue_ctx camellia_enc_xts = {
85 .num_funcs = 3,
86 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
87
88 .funcs = { {
89 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS,
90 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_enc_32way) }
91 }, {
92 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
93 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_enc_16way) }
94 }, {
95 .num_blocks = 1,
96 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_enc) }
97 } }
98};
99
100static const struct common_glue_ctx camellia_dec = {
101 .num_funcs = 4,
102 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
103
104 .funcs = { {
105 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS,
106 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_ecb_dec_32way) }
107 }, {
108 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
109 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_ecb_dec_16way) }
110 }, {
111 .num_blocks = 2,
112 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_dec_blk_2way) }
113 }, {
114 .num_blocks = 1,
115 .fn_u = { .ecb = GLUE_FUNC_CAST(camellia_dec_blk) }
116 } }
117};
118
119static const struct common_glue_ctx camellia_dec_cbc = {
120 .num_funcs = 4,
121 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
122
123 .funcs = { {
124 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS,
125 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(camellia_cbc_dec_32way) }
126 }, {
127 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
128 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(camellia_cbc_dec_16way) }
129 }, {
130 .num_blocks = 2,
131 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(camellia_decrypt_cbc_2way) }
132 }, {
133 .num_blocks = 1,
134 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(camellia_dec_blk) }
135 } }
136};
137
138static const struct common_glue_ctx camellia_dec_xts = {
139 .num_funcs = 3,
140 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
141
142 .funcs = { {
143 .num_blocks = CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS,
144 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_dec_32way) }
145 }, {
146 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
147 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_dec_16way) }
148 }, {
149 .num_blocks = 1,
150 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_dec) }
151 } }
152};
153
154static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
155 struct scatterlist *src, unsigned int nbytes)
156{
157 return glue_ecb_crypt_128bit(&camellia_enc, desc, dst, src, nbytes);
158}
159
160static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
161 struct scatterlist *src, unsigned int nbytes)
162{
163 return glue_ecb_crypt_128bit(&camellia_dec, desc, dst, src, nbytes);
164}
165
166static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
167 struct scatterlist *src, unsigned int nbytes)
168{
169 return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(camellia_enc_blk), desc,
170 dst, src, nbytes);
171}
172
173static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
174 struct scatterlist *src, unsigned int nbytes)
175{
176 return glue_cbc_decrypt_128bit(&camellia_dec_cbc, desc, dst, src,
177 nbytes);
178}
179
180static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
181 struct scatterlist *src, unsigned int nbytes)
182{
183 return glue_ctr_crypt_128bit(&camellia_ctr, desc, dst, src, nbytes);
184}
185
186static inline bool camellia_fpu_begin(bool fpu_enabled, unsigned int nbytes)
187{
188 return glue_fpu_begin(CAMELLIA_BLOCK_SIZE,
189 CAMELLIA_AESNI_PARALLEL_BLOCKS, NULL, fpu_enabled,
190 nbytes);
191}
192
193static inline void camellia_fpu_end(bool fpu_enabled)
194{
195 glue_fpu_end(fpu_enabled);
196}
197
198static int camellia_setkey(struct crypto_tfm *tfm, const u8 *in_key,
199 unsigned int key_len)
200{
201 return __camellia_setkey(crypto_tfm_ctx(tfm), in_key, key_len,
202 &tfm->crt_flags);
203}
204
205struct crypt_priv {
206 struct camellia_ctx *ctx;
207 bool fpu_enabled;
208};
209
210static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
211{
212 const unsigned int bsize = CAMELLIA_BLOCK_SIZE;
213 struct crypt_priv *ctx = priv;
214 int i;
215
216 ctx->fpu_enabled = camellia_fpu_begin(ctx->fpu_enabled, nbytes);
217
218 if (nbytes >= CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS * bsize) {
219 camellia_ecb_enc_32way(ctx->ctx, srcdst, srcdst);
220 srcdst += bsize * CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS;
221 nbytes -= bsize * CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS;
222 }
223
224 if (nbytes >= CAMELLIA_AESNI_PARALLEL_BLOCKS * bsize) {
225 camellia_ecb_enc_16way(ctx->ctx, srcdst, srcdst);
226 srcdst += bsize * CAMELLIA_AESNI_PARALLEL_BLOCKS;
227 nbytes -= bsize * CAMELLIA_AESNI_PARALLEL_BLOCKS;
228 }
229
230 while (nbytes >= CAMELLIA_PARALLEL_BLOCKS * bsize) {
231 camellia_enc_blk_2way(ctx->ctx, srcdst, srcdst);
232 srcdst += bsize * CAMELLIA_PARALLEL_BLOCKS;
233 nbytes -= bsize * CAMELLIA_PARALLEL_BLOCKS;
234 }
235
236 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
237 camellia_enc_blk(ctx->ctx, srcdst, srcdst);
238}
239
240static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
241{
242 const unsigned int bsize = CAMELLIA_BLOCK_SIZE;
243 struct crypt_priv *ctx = priv;
244 int i;
245
246 ctx->fpu_enabled = camellia_fpu_begin(ctx->fpu_enabled, nbytes);
247
248 if (nbytes >= CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS * bsize) {
249 camellia_ecb_dec_32way(ctx->ctx, srcdst, srcdst);
250 srcdst += bsize * CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS;
251 nbytes -= bsize * CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS;
252 }
253
254 if (nbytes >= CAMELLIA_AESNI_PARALLEL_BLOCKS * bsize) {
255 camellia_ecb_dec_16way(ctx->ctx, srcdst, srcdst);
256 srcdst += bsize * CAMELLIA_AESNI_PARALLEL_BLOCKS;
257 nbytes -= bsize * CAMELLIA_AESNI_PARALLEL_BLOCKS;
258 }
259
260 while (nbytes >= CAMELLIA_PARALLEL_BLOCKS * bsize) {
261 camellia_dec_blk_2way(ctx->ctx, srcdst, srcdst);
262 srcdst += bsize * CAMELLIA_PARALLEL_BLOCKS;
263 nbytes -= bsize * CAMELLIA_PARALLEL_BLOCKS;
264 }
265
266 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
267 camellia_dec_blk(ctx->ctx, srcdst, srcdst);
268}
269
270static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
271 struct scatterlist *src, unsigned int nbytes)
272{
273 struct camellia_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
274 be128 buf[CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS];
275 struct crypt_priv crypt_ctx = {
276 .ctx = &ctx->camellia_ctx,
277 .fpu_enabled = false,
278 };
279 struct lrw_crypt_req req = {
280 .tbuf = buf,
281 .tbuflen = sizeof(buf),
282
283 .table_ctx = &ctx->lrw_table,
284 .crypt_ctx = &crypt_ctx,
285 .crypt_fn = encrypt_callback,
286 };
287 int ret;
288
289 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
290 ret = lrw_crypt(desc, dst, src, nbytes, &req);
291 camellia_fpu_end(crypt_ctx.fpu_enabled);
292
293 return ret;
294}
295
296static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
297 struct scatterlist *src, unsigned int nbytes)
298{
299 struct camellia_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
300 be128 buf[CAMELLIA_AESNI_AVX2_PARALLEL_BLOCKS];
301 struct crypt_priv crypt_ctx = {
302 .ctx = &ctx->camellia_ctx,
303 .fpu_enabled = false,
304 };
305 struct lrw_crypt_req req = {
306 .tbuf = buf,
307 .tbuflen = sizeof(buf),
308
309 .table_ctx = &ctx->lrw_table,
310 .crypt_ctx = &crypt_ctx,
311 .crypt_fn = decrypt_callback,
312 };
313 int ret;
314
315 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
316 ret = lrw_crypt(desc, dst, src, nbytes, &req);
317 camellia_fpu_end(crypt_ctx.fpu_enabled);
318
319 return ret;
320}
321
322static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
323 struct scatterlist *src, unsigned int nbytes)
324{
325 struct camellia_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
326
327 return glue_xts_crypt_128bit(&camellia_enc_xts, desc, dst, src, nbytes,
328 XTS_TWEAK_CAST(camellia_enc_blk),
329 &ctx->tweak_ctx, &ctx->crypt_ctx);
330}
331
332static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
333 struct scatterlist *src, unsigned int nbytes)
334{
335 struct camellia_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
336
337 return glue_xts_crypt_128bit(&camellia_dec_xts, desc, dst, src, nbytes,
338 XTS_TWEAK_CAST(camellia_enc_blk),
339 &ctx->tweak_ctx, &ctx->crypt_ctx);
340}
341
342static struct crypto_alg cmll_algs[10] = { {
343 .cra_name = "__ecb-camellia-aesni-avx2",
344 .cra_driver_name = "__driver-ecb-camellia-aesni-avx2",
345 .cra_priority = 0,
346 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
347 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
348 .cra_ctxsize = sizeof(struct camellia_ctx),
349 .cra_alignmask = 0,
350 .cra_type = &crypto_blkcipher_type,
351 .cra_module = THIS_MODULE,
352 .cra_u = {
353 .blkcipher = {
354 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
355 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
356 .setkey = camellia_setkey,
357 .encrypt = ecb_encrypt,
358 .decrypt = ecb_decrypt,
359 },
360 },
361}, {
362 .cra_name = "__cbc-camellia-aesni-avx2",
363 .cra_driver_name = "__driver-cbc-camellia-aesni-avx2",
364 .cra_priority = 0,
365 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
366 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
367 .cra_ctxsize = sizeof(struct camellia_ctx),
368 .cra_alignmask = 0,
369 .cra_type = &crypto_blkcipher_type,
370 .cra_module = THIS_MODULE,
371 .cra_u = {
372 .blkcipher = {
373 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
374 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
375 .setkey = camellia_setkey,
376 .encrypt = cbc_encrypt,
377 .decrypt = cbc_decrypt,
378 },
379 },
380}, {
381 .cra_name = "__ctr-camellia-aesni-avx2",
382 .cra_driver_name = "__driver-ctr-camellia-aesni-avx2",
383 .cra_priority = 0,
384 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
385 .cra_blocksize = 1,
386 .cra_ctxsize = sizeof(struct camellia_ctx),
387 .cra_alignmask = 0,
388 .cra_type = &crypto_blkcipher_type,
389 .cra_module = THIS_MODULE,
390 .cra_u = {
391 .blkcipher = {
392 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
393 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
394 .ivsize = CAMELLIA_BLOCK_SIZE,
395 .setkey = camellia_setkey,
396 .encrypt = ctr_crypt,
397 .decrypt = ctr_crypt,
398 },
399 },
400}, {
401 .cra_name = "__lrw-camellia-aesni-avx2",
402 .cra_driver_name = "__driver-lrw-camellia-aesni-avx2",
403 .cra_priority = 0,
404 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
405 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
406 .cra_ctxsize = sizeof(struct camellia_lrw_ctx),
407 .cra_alignmask = 0,
408 .cra_type = &crypto_blkcipher_type,
409 .cra_module = THIS_MODULE,
410 .cra_exit = lrw_camellia_exit_tfm,
411 .cra_u = {
412 .blkcipher = {
413 .min_keysize = CAMELLIA_MIN_KEY_SIZE +
414 CAMELLIA_BLOCK_SIZE,
415 .max_keysize = CAMELLIA_MAX_KEY_SIZE +
416 CAMELLIA_BLOCK_SIZE,
417 .ivsize = CAMELLIA_BLOCK_SIZE,
418 .setkey = lrw_camellia_setkey,
419 .encrypt = lrw_encrypt,
420 .decrypt = lrw_decrypt,
421 },
422 },
423}, {
424 .cra_name = "__xts-camellia-aesni-avx2",
425 .cra_driver_name = "__driver-xts-camellia-aesni-avx2",
426 .cra_priority = 0,
427 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
428 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
429 .cra_ctxsize = sizeof(struct camellia_xts_ctx),
430 .cra_alignmask = 0,
431 .cra_type = &crypto_blkcipher_type,
432 .cra_module = THIS_MODULE,
433 .cra_u = {
434 .blkcipher = {
435 .min_keysize = CAMELLIA_MIN_KEY_SIZE * 2,
436 .max_keysize = CAMELLIA_MAX_KEY_SIZE * 2,
437 .ivsize = CAMELLIA_BLOCK_SIZE,
438 .setkey = xts_camellia_setkey,
439 .encrypt = xts_encrypt,
440 .decrypt = xts_decrypt,
441 },
442 },
443}, {
444 .cra_name = "ecb(camellia)",
445 .cra_driver_name = "ecb-camellia-aesni-avx2",
446 .cra_priority = 500,
447 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
448 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
449 .cra_ctxsize = sizeof(struct async_helper_ctx),
450 .cra_alignmask = 0,
451 .cra_type = &crypto_ablkcipher_type,
452 .cra_module = THIS_MODULE,
453 .cra_init = ablk_init,
454 .cra_exit = ablk_exit,
455 .cra_u = {
456 .ablkcipher = {
457 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
458 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
459 .setkey = ablk_set_key,
460 .encrypt = ablk_encrypt,
461 .decrypt = ablk_decrypt,
462 },
463 },
464}, {
465 .cra_name = "cbc(camellia)",
466 .cra_driver_name = "cbc-camellia-aesni-avx2",
467 .cra_priority = 500,
468 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
469 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
470 .cra_ctxsize = sizeof(struct async_helper_ctx),
471 .cra_alignmask = 0,
472 .cra_type = &crypto_ablkcipher_type,
473 .cra_module = THIS_MODULE,
474 .cra_init = ablk_init,
475 .cra_exit = ablk_exit,
476 .cra_u = {
477 .ablkcipher = {
478 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
479 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
480 .ivsize = CAMELLIA_BLOCK_SIZE,
481 .setkey = ablk_set_key,
482 .encrypt = __ablk_encrypt,
483 .decrypt = ablk_decrypt,
484 },
485 },
486}, {
487 .cra_name = "ctr(camellia)",
488 .cra_driver_name = "ctr-camellia-aesni-avx2",
489 .cra_priority = 500,
490 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
491 .cra_blocksize = 1,
492 .cra_ctxsize = sizeof(struct async_helper_ctx),
493 .cra_alignmask = 0,
494 .cra_type = &crypto_ablkcipher_type,
495 .cra_module = THIS_MODULE,
496 .cra_init = ablk_init,
497 .cra_exit = ablk_exit,
498 .cra_u = {
499 .ablkcipher = {
500 .min_keysize = CAMELLIA_MIN_KEY_SIZE,
501 .max_keysize = CAMELLIA_MAX_KEY_SIZE,
502 .ivsize = CAMELLIA_BLOCK_SIZE,
503 .setkey = ablk_set_key,
504 .encrypt = ablk_encrypt,
505 .decrypt = ablk_encrypt,
506 .geniv = "chainiv",
507 },
508 },
509}, {
510 .cra_name = "lrw(camellia)",
511 .cra_driver_name = "lrw-camellia-aesni-avx2",
512 .cra_priority = 500,
513 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
514 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
515 .cra_ctxsize = sizeof(struct async_helper_ctx),
516 .cra_alignmask = 0,
517 .cra_type = &crypto_ablkcipher_type,
518 .cra_module = THIS_MODULE,
519 .cra_init = ablk_init,
520 .cra_exit = ablk_exit,
521 .cra_u = {
522 .ablkcipher = {
523 .min_keysize = CAMELLIA_MIN_KEY_SIZE +
524 CAMELLIA_BLOCK_SIZE,
525 .max_keysize = CAMELLIA_MAX_KEY_SIZE +
526 CAMELLIA_BLOCK_SIZE,
527 .ivsize = CAMELLIA_BLOCK_SIZE,
528 .setkey = ablk_set_key,
529 .encrypt = ablk_encrypt,
530 .decrypt = ablk_decrypt,
531 },
532 },
533}, {
534 .cra_name = "xts(camellia)",
535 .cra_driver_name = "xts-camellia-aesni-avx2",
536 .cra_priority = 500,
537 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
538 .cra_blocksize = CAMELLIA_BLOCK_SIZE,
539 .cra_ctxsize = sizeof(struct async_helper_ctx),
540 .cra_alignmask = 0,
541 .cra_type = &crypto_ablkcipher_type,
542 .cra_module = THIS_MODULE,
543 .cra_init = ablk_init,
544 .cra_exit = ablk_exit,
545 .cra_u = {
546 .ablkcipher = {
547 .min_keysize = CAMELLIA_MIN_KEY_SIZE * 2,
548 .max_keysize = CAMELLIA_MAX_KEY_SIZE * 2,
549 .ivsize = CAMELLIA_BLOCK_SIZE,
550 .setkey = ablk_set_key,
551 .encrypt = ablk_encrypt,
552 .decrypt = ablk_decrypt,
553 },
554 },
555} };
556
557static int __init camellia_aesni_init(void)
558{
559 u64 xcr0;
560
561 if (!cpu_has_avx2 || !cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
562 pr_info("AVX2 or AES-NI instructions are not detected.\n");
563 return -ENODEV;
564 }
565
566 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
567 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
568 pr_info("AVX2 detected but unusable.\n");
569 return -ENODEV;
570 }
571
572 return crypto_register_algs(cmll_algs, ARRAY_SIZE(cmll_algs));
573}
574
575static void __exit camellia_aesni_fini(void)
576{
577 crypto_unregister_algs(cmll_algs, ARRAY_SIZE(cmll_algs));
578}
579
580module_init(camellia_aesni_init);
581module_exit(camellia_aesni_fini);
582
583MODULE_LICENSE("GPL");
584MODULE_DESCRIPTION("Camellia Cipher Algorithm, AES-NI/AVX2 optimized");
585MODULE_ALIAS("camellia");
586MODULE_ALIAS("camellia-asm");
diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c
index 96cbb6068fce..37fd0c0a81ea 100644
--- a/arch/x86/crypto/camellia_aesni_avx_glue.c
+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Glue Code for x86_64/AVX/AES-NI assembler optimized version of Camellia 2 * Glue Code for x86_64/AVX/AES-NI assembler optimized version of Camellia
3 * 3 *
4 * Copyright © 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -26,16 +26,44 @@
26 26
27#define CAMELLIA_AESNI_PARALLEL_BLOCKS 16 27#define CAMELLIA_AESNI_PARALLEL_BLOCKS 16
28 28
29/* 16-way AES-NI parallel cipher functions */ 29/* 16-way parallel cipher functions (avx/aes-ni) */
30asmlinkage void camellia_ecb_enc_16way(struct camellia_ctx *ctx, u8 *dst, 30asmlinkage void camellia_ecb_enc_16way(struct camellia_ctx *ctx, u8 *dst,
31 const u8 *src); 31 const u8 *src);
32EXPORT_SYMBOL_GPL(camellia_ecb_enc_16way);
33
32asmlinkage void camellia_ecb_dec_16way(struct camellia_ctx *ctx, u8 *dst, 34asmlinkage void camellia_ecb_dec_16way(struct camellia_ctx *ctx, u8 *dst,
33 const u8 *src); 35 const u8 *src);
36EXPORT_SYMBOL_GPL(camellia_ecb_dec_16way);
34 37
35asmlinkage void camellia_cbc_dec_16way(struct camellia_ctx *ctx, u8 *dst, 38asmlinkage void camellia_cbc_dec_16way(struct camellia_ctx *ctx, u8 *dst,
36 const u8 *src); 39 const u8 *src);
40EXPORT_SYMBOL_GPL(camellia_cbc_dec_16way);
41
37asmlinkage void camellia_ctr_16way(struct camellia_ctx *ctx, u8 *dst, 42asmlinkage void camellia_ctr_16way(struct camellia_ctx *ctx, u8 *dst,
38 const u8 *src, le128 *iv); 43 const u8 *src, le128 *iv);
44EXPORT_SYMBOL_GPL(camellia_ctr_16way);
45
46asmlinkage void camellia_xts_enc_16way(struct camellia_ctx *ctx, u8 *dst,
47 const u8 *src, le128 *iv);
48EXPORT_SYMBOL_GPL(camellia_xts_enc_16way);
49
50asmlinkage void camellia_xts_dec_16way(struct camellia_ctx *ctx, u8 *dst,
51 const u8 *src, le128 *iv);
52EXPORT_SYMBOL_GPL(camellia_xts_dec_16way);
53
54void camellia_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
55{
56 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
57 GLUE_FUNC_CAST(camellia_enc_blk));
58}
59EXPORT_SYMBOL_GPL(camellia_xts_enc);
60
61void camellia_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv)
62{
63 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
64 GLUE_FUNC_CAST(camellia_dec_blk));
65}
66EXPORT_SYMBOL_GPL(camellia_xts_dec);
39 67
40static const struct common_glue_ctx camellia_enc = { 68static const struct common_glue_ctx camellia_enc = {
41 .num_funcs = 3, 69 .num_funcs = 3,
@@ -69,6 +97,19 @@ static const struct common_glue_ctx camellia_ctr = {
69 } } 97 } }
70}; 98};
71 99
100static const struct common_glue_ctx camellia_enc_xts = {
101 .num_funcs = 2,
102 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
103
104 .funcs = { {
105 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
106 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_enc_16way) }
107 }, {
108 .num_blocks = 1,
109 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_enc) }
110 } }
111};
112
72static const struct common_glue_ctx camellia_dec = { 113static const struct common_glue_ctx camellia_dec = {
73 .num_funcs = 3, 114 .num_funcs = 3,
74 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS, 115 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
@@ -101,6 +142,19 @@ static const struct common_glue_ctx camellia_dec_cbc = {
101 } } 142 } }
102}; 143};
103 144
145static const struct common_glue_ctx camellia_dec_xts = {
146 .num_funcs = 2,
147 .fpu_blocks_limit = CAMELLIA_AESNI_PARALLEL_BLOCKS,
148
149 .funcs = { {
150 .num_blocks = CAMELLIA_AESNI_PARALLEL_BLOCKS,
151 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_dec_16way) }
152 }, {
153 .num_blocks = 1,
154 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(camellia_xts_dec) }
155 } }
156};
157
104static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 158static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
105 struct scatterlist *src, unsigned int nbytes) 159 struct scatterlist *src, unsigned int nbytes)
106{ 160{
@@ -261,54 +315,20 @@ static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
261 struct scatterlist *src, unsigned int nbytes) 315 struct scatterlist *src, unsigned int nbytes)
262{ 316{
263 struct camellia_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 317 struct camellia_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
264 be128 buf[CAMELLIA_AESNI_PARALLEL_BLOCKS];
265 struct crypt_priv crypt_ctx = {
266 .ctx = &ctx->crypt_ctx,
267 .fpu_enabled = false,
268 };
269 struct xts_crypt_req req = {
270 .tbuf = buf,
271 .tbuflen = sizeof(buf),
272 318
273 .tweak_ctx = &ctx->tweak_ctx, 319 return glue_xts_crypt_128bit(&camellia_enc_xts, desc, dst, src, nbytes,
274 .tweak_fn = XTS_TWEAK_CAST(camellia_enc_blk), 320 XTS_TWEAK_CAST(camellia_enc_blk),
275 .crypt_ctx = &crypt_ctx, 321 &ctx->tweak_ctx, &ctx->crypt_ctx);
276 .crypt_fn = encrypt_callback,
277 };
278 int ret;
279
280 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
281 ret = xts_crypt(desc, dst, src, nbytes, &req);
282 camellia_fpu_end(crypt_ctx.fpu_enabled);
283
284 return ret;
285} 322}
286 323
287static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 324static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
288 struct scatterlist *src, unsigned int nbytes) 325 struct scatterlist *src, unsigned int nbytes)
289{ 326{
290 struct camellia_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 327 struct camellia_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
291 be128 buf[CAMELLIA_AESNI_PARALLEL_BLOCKS];
292 struct crypt_priv crypt_ctx = {
293 .ctx = &ctx->crypt_ctx,
294 .fpu_enabled = false,
295 };
296 struct xts_crypt_req req = {
297 .tbuf = buf,
298 .tbuflen = sizeof(buf),
299
300 .tweak_ctx = &ctx->tweak_ctx,
301 .tweak_fn = XTS_TWEAK_CAST(camellia_enc_blk),
302 .crypt_ctx = &crypt_ctx,
303 .crypt_fn = decrypt_callback,
304 };
305 int ret;
306 328
307 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; 329 return glue_xts_crypt_128bit(&camellia_dec_xts, desc, dst, src, nbytes,
308 ret = xts_crypt(desc, dst, src, nbytes, &req); 330 XTS_TWEAK_CAST(camellia_enc_blk),
309 camellia_fpu_end(crypt_ctx.fpu_enabled); 331 &ctx->tweak_ctx, &ctx->crypt_ctx);
310
311 return ret;
312} 332}
313 333
314static struct crypto_alg cmll_algs[10] = { { 334static struct crypto_alg cmll_algs[10] = { {
diff --git a/arch/x86/crypto/cast6-avx-x86_64-asm_64.S b/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
index f93b6105a0ce..e3531f833951 100644
--- a/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
@@ -4,7 +4,7 @@
4 * Copyright (C) 2012 Johannes Goetzfried 4 * Copyright (C) 2012 Johannes Goetzfried
5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
6 * 6 *
7 * Copyright © 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 7 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -227,6 +227,8 @@
227.data 227.data
228 228
229.align 16 229.align 16
230.Lxts_gf128mul_and_shl1_mask:
231 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
230.Lbswap_mask: 232.Lbswap_mask:
231 .byte 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 233 .byte 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12
232.Lbswap128_mask: 234.Lbswap128_mask:
@@ -424,3 +426,47 @@ ENTRY(cast6_ctr_8way)
424 426
425 ret; 427 ret;
426ENDPROC(cast6_ctr_8way) 428ENDPROC(cast6_ctr_8way)
429
430ENTRY(cast6_xts_enc_8way)
431 /* input:
432 * %rdi: ctx, CTX
433 * %rsi: dst
434 * %rdx: src
435 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
436 */
437
438 movq %rsi, %r11;
439
440 /* regs <= src, dst <= IVs, regs <= regs xor IVs */
441 load_xts_8way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2,
442 RX, RKR, RKM, .Lxts_gf128mul_and_shl1_mask);
443
444 call __cast6_enc_blk8;
445
446 /* dst <= regs xor IVs(in dst) */
447 store_xts_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
448
449 ret;
450ENDPROC(cast6_xts_enc_8way)
451
452ENTRY(cast6_xts_dec_8way)
453 /* input:
454 * %rdi: ctx, CTX
455 * %rsi: dst
456 * %rdx: src
457 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
458 */
459
460 movq %rsi, %r11;
461
462 /* regs <= src, dst <= IVs, regs <= regs xor IVs */
463 load_xts_8way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2,
464 RX, RKR, RKM, .Lxts_gf128mul_and_shl1_mask);
465
466 call __cast6_dec_blk8;
467
468 /* dst <= regs xor IVs(in dst) */
469 store_xts_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
470
471 ret;
472ENDPROC(cast6_xts_dec_8way)
diff --git a/arch/x86/crypto/cast6_avx_glue.c b/arch/x86/crypto/cast6_avx_glue.c
index 92f7ca24790a..8d0dfb86a559 100644
--- a/arch/x86/crypto/cast6_avx_glue.c
+++ b/arch/x86/crypto/cast6_avx_glue.c
@@ -4,6 +4,8 @@
4 * Copyright (C) 2012 Johannes Goetzfried 4 * Copyright (C) 2012 Johannes Goetzfried
5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
6 * 6 *
7 * Copyright © 2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
@@ -50,6 +52,23 @@ asmlinkage void cast6_cbc_dec_8way(struct cast6_ctx *ctx, u8 *dst,
50asmlinkage void cast6_ctr_8way(struct cast6_ctx *ctx, u8 *dst, const u8 *src, 52asmlinkage void cast6_ctr_8way(struct cast6_ctx *ctx, u8 *dst, const u8 *src,
51 le128 *iv); 53 le128 *iv);
52 54
55asmlinkage void cast6_xts_enc_8way(struct cast6_ctx *ctx, u8 *dst,
56 const u8 *src, le128 *iv);
57asmlinkage void cast6_xts_dec_8way(struct cast6_ctx *ctx, u8 *dst,
58 const u8 *src, le128 *iv);
59
60static void cast6_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
61{
62 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
63 GLUE_FUNC_CAST(__cast6_encrypt));
64}
65
66static void cast6_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv)
67{
68 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
69 GLUE_FUNC_CAST(__cast6_decrypt));
70}
71
53static void cast6_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv) 72static void cast6_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv)
54{ 73{
55 be128 ctrblk; 74 be128 ctrblk;
@@ -87,6 +106,19 @@ static const struct common_glue_ctx cast6_ctr = {
87 } } 106 } }
88}; 107};
89 108
109static const struct common_glue_ctx cast6_enc_xts = {
110 .num_funcs = 2,
111 .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS,
112
113 .funcs = { {
114 .num_blocks = CAST6_PARALLEL_BLOCKS,
115 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(cast6_xts_enc_8way) }
116 }, {
117 .num_blocks = 1,
118 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(cast6_xts_enc) }
119 } }
120};
121
90static const struct common_glue_ctx cast6_dec = { 122static const struct common_glue_ctx cast6_dec = {
91 .num_funcs = 2, 123 .num_funcs = 2,
92 .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS, 124 .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS,
@@ -113,6 +145,19 @@ static const struct common_glue_ctx cast6_dec_cbc = {
113 } } 145 } }
114}; 146};
115 147
148static const struct common_glue_ctx cast6_dec_xts = {
149 .num_funcs = 2,
150 .fpu_blocks_limit = CAST6_PARALLEL_BLOCKS,
151
152 .funcs = { {
153 .num_blocks = CAST6_PARALLEL_BLOCKS,
154 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(cast6_xts_dec_8way) }
155 }, {
156 .num_blocks = 1,
157 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(cast6_xts_dec) }
158 } }
159};
160
116static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 161static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
117 struct scatterlist *src, unsigned int nbytes) 162 struct scatterlist *src, unsigned int nbytes)
118{ 163{
@@ -307,54 +352,20 @@ static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
307 struct scatterlist *src, unsigned int nbytes) 352 struct scatterlist *src, unsigned int nbytes)
308{ 353{
309 struct cast6_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 354 struct cast6_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
310 be128 buf[CAST6_PARALLEL_BLOCKS];
311 struct crypt_priv crypt_ctx = {
312 .ctx = &ctx->crypt_ctx,
313 .fpu_enabled = false,
314 };
315 struct xts_crypt_req req = {
316 .tbuf = buf,
317 .tbuflen = sizeof(buf),
318 355
319 .tweak_ctx = &ctx->tweak_ctx, 356 return glue_xts_crypt_128bit(&cast6_enc_xts, desc, dst, src, nbytes,
320 .tweak_fn = XTS_TWEAK_CAST(__cast6_encrypt), 357 XTS_TWEAK_CAST(__cast6_encrypt),
321 .crypt_ctx = &crypt_ctx, 358 &ctx->tweak_ctx, &ctx->crypt_ctx);
322 .crypt_fn = encrypt_callback,
323 };
324 int ret;
325
326 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
327 ret = xts_crypt(desc, dst, src, nbytes, &req);
328 cast6_fpu_end(crypt_ctx.fpu_enabled);
329
330 return ret;
331} 359}
332 360
333static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 361static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
334 struct scatterlist *src, unsigned int nbytes) 362 struct scatterlist *src, unsigned int nbytes)
335{ 363{
336 struct cast6_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 364 struct cast6_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
337 be128 buf[CAST6_PARALLEL_BLOCKS];
338 struct crypt_priv crypt_ctx = {
339 .ctx = &ctx->crypt_ctx,
340 .fpu_enabled = false,
341 };
342 struct xts_crypt_req req = {
343 .tbuf = buf,
344 .tbuflen = sizeof(buf),
345
346 .tweak_ctx = &ctx->tweak_ctx,
347 .tweak_fn = XTS_TWEAK_CAST(__cast6_encrypt),
348 .crypt_ctx = &crypt_ctx,
349 .crypt_fn = decrypt_callback,
350 };
351 int ret;
352 365
353 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; 366 return glue_xts_crypt_128bit(&cast6_dec_xts, desc, dst, src, nbytes,
354 ret = xts_crypt(desc, dst, src, nbytes, &req); 367 XTS_TWEAK_CAST(__cast6_encrypt),
355 cast6_fpu_end(crypt_ctx.fpu_enabled); 368 &ctx->tweak_ctx, &ctx->crypt_ctx);
356
357 return ret;
358} 369}
359 370
360static struct crypto_alg cast6_algs[10] = { { 371static struct crypto_alg cast6_algs[10] = { {
diff --git a/arch/x86/crypto/crc32-pclmul_asm.S b/arch/x86/crypto/crc32-pclmul_asm.S
index c8335014a044..94c27df8a549 100644
--- a/arch/x86/crypto/crc32-pclmul_asm.S
+++ b/arch/x86/crypto/crc32-pclmul_asm.S
@@ -101,9 +101,8 @@
101 * uint crc32_pclmul_le_16(unsigned char const *buffer, 101 * uint crc32_pclmul_le_16(unsigned char const *buffer,
102 * size_t len, uint crc32) 102 * size_t len, uint crc32)
103 */ 103 */
104.globl crc32_pclmul_le_16 104
105.align 4, 0x90 105ENTRY(crc32_pclmul_le_16) /* buffer and buffer size are 16 bytes aligned */
106crc32_pclmul_le_16:/* buffer and buffer size are 16 bytes aligned */
107 movdqa (BUF), %xmm1 106 movdqa (BUF), %xmm1
108 movdqa 0x10(BUF), %xmm2 107 movdqa 0x10(BUF), %xmm2
109 movdqa 0x20(BUF), %xmm3 108 movdqa 0x20(BUF), %xmm3
@@ -244,3 +243,4 @@ fold_64:
244 pextrd $0x01, %xmm1, %eax 243 pextrd $0x01, %xmm1, %eax
245 244
246 ret 245 ret
246ENDPROC(crc32_pclmul_le_16)
diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
index cf1a7ec4cc3a..dbc4339b5417 100644
--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
+++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
@@ -1,9 +1,10 @@
1/* 1/*
2 * Implement fast CRC32C with PCLMULQDQ instructions. (x86_64) 2 * Implement fast CRC32C with PCLMULQDQ instructions. (x86_64)
3 * 3 *
4 * The white paper on CRC32C calculations with PCLMULQDQ instruction can be 4 * The white papers on CRC32C calculations with PCLMULQDQ instruction can be
5 * downloaded from: 5 * downloaded from:
6 * http://download.intel.com/design/intarch/papers/323405.pdf 6 * http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/crc-iscsi-polynomial-crc32-instruction-paper.pdf
7 * http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-paper.pdf
7 * 8 *
8 * Copyright (C) 2012 Intel Corporation. 9 * Copyright (C) 2012 Intel Corporation.
9 * 10 *
@@ -42,6 +43,7 @@
42 * SOFTWARE. 43 * SOFTWARE.
43 */ 44 */
44 45
46#include <asm/inst.h>
45#include <linux/linkage.h> 47#include <linux/linkage.h>
46 48
47## ISCSI CRC 32 Implementation with crc32 and pclmulqdq Instruction 49## ISCSI CRC 32 Implementation with crc32 and pclmulqdq Instruction
@@ -225,10 +227,10 @@ LABEL crc_ %i
225 movdqa (bufp), %xmm0 # 2 consts: K1:K2 227 movdqa (bufp), %xmm0 # 2 consts: K1:K2
226 228
227 movq crc_init, %xmm1 # CRC for block 1 229 movq crc_init, %xmm1 # CRC for block 1
228 pclmulqdq $0x00,%xmm0,%xmm1 # Multiply by K2 230 PCLMULQDQ 0x00,%xmm0,%xmm1 # Multiply by K2
229 231
230 movq crc1, %xmm2 # CRC for block 2 232 movq crc1, %xmm2 # CRC for block 2
231 pclmulqdq $0x10, %xmm0, %xmm2 # Multiply by K1 233 PCLMULQDQ 0x10, %xmm0, %xmm2 # Multiply by K1
232 234
233 pxor %xmm2,%xmm1 235 pxor %xmm2,%xmm1
234 movq %xmm1, %rax 236 movq %xmm1, %rax
diff --git a/arch/x86/crypto/glue_helper-asm-avx.S b/arch/x86/crypto/glue_helper-asm-avx.S
index f7b6ea2ddfdb..02ee2308fb38 100644
--- a/arch/x86/crypto/glue_helper-asm-avx.S
+++ b/arch/x86/crypto/glue_helper-asm-avx.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Shared glue code for 128bit block ciphers, AVX assembler macros 2 * Shared glue code for 128bit block ciphers, AVX assembler macros
3 * 3 *
4 * Copyright (c) 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -89,3 +89,62 @@
89 vpxor (6*16)(src), x6, x6; \ 89 vpxor (6*16)(src), x6, x6; \
90 vpxor (7*16)(src), x7, x7; \ 90 vpxor (7*16)(src), x7, x7; \
91 store_8way(dst, x0, x1, x2, x3, x4, x5, x6, x7); 91 store_8way(dst, x0, x1, x2, x3, x4, x5, x6, x7);
92
93#define gf128mul_x_ble(iv, mask, tmp) \
94 vpsrad $31, iv, tmp; \
95 vpaddq iv, iv, iv; \
96 vpshufd $0x13, tmp, tmp; \
97 vpand mask, tmp, tmp; \
98 vpxor tmp, iv, iv;
99
100#define load_xts_8way(iv, src, dst, x0, x1, x2, x3, x4, x5, x6, x7, tiv, t0, \
101 t1, xts_gf128mul_and_shl1_mask) \
102 vmovdqa xts_gf128mul_and_shl1_mask, t0; \
103 \
104 /* load IV */ \
105 vmovdqu (iv), tiv; \
106 vpxor (0*16)(src), tiv, x0; \
107 vmovdqu tiv, (0*16)(dst); \
108 \
109 /* construct and store IVs, also xor with source */ \
110 gf128mul_x_ble(tiv, t0, t1); \
111 vpxor (1*16)(src), tiv, x1; \
112 vmovdqu tiv, (1*16)(dst); \
113 \
114 gf128mul_x_ble(tiv, t0, t1); \
115 vpxor (2*16)(src), tiv, x2; \
116 vmovdqu tiv, (2*16)(dst); \
117 \
118 gf128mul_x_ble(tiv, t0, t1); \
119 vpxor (3*16)(src), tiv, x3; \
120 vmovdqu tiv, (3*16)(dst); \
121 \
122 gf128mul_x_ble(tiv, t0, t1); \
123 vpxor (4*16)(src), tiv, x4; \
124 vmovdqu tiv, (4*16)(dst); \
125 \
126 gf128mul_x_ble(tiv, t0, t1); \
127 vpxor (5*16)(src), tiv, x5; \
128 vmovdqu tiv, (5*16)(dst); \
129 \
130 gf128mul_x_ble(tiv, t0, t1); \
131 vpxor (6*16)(src), tiv, x6; \
132 vmovdqu tiv, (6*16)(dst); \
133 \
134 gf128mul_x_ble(tiv, t0, t1); \
135 vpxor (7*16)(src), tiv, x7; \
136 vmovdqu tiv, (7*16)(dst); \
137 \
138 gf128mul_x_ble(tiv, t0, t1); \
139 vmovdqu tiv, (iv);
140
141#define store_xts_8way(dst, x0, x1, x2, x3, x4, x5, x6, x7) \
142 vpxor (0*16)(dst), x0, x0; \
143 vpxor (1*16)(dst), x1, x1; \
144 vpxor (2*16)(dst), x2, x2; \
145 vpxor (3*16)(dst), x3, x3; \
146 vpxor (4*16)(dst), x4, x4; \
147 vpxor (5*16)(dst), x5, x5; \
148 vpxor (6*16)(dst), x6, x6; \
149 vpxor (7*16)(dst), x7, x7; \
150 store_8way(dst, x0, x1, x2, x3, x4, x5, x6, x7);
diff --git a/arch/x86/crypto/glue_helper-asm-avx2.S b/arch/x86/crypto/glue_helper-asm-avx2.S
new file mode 100644
index 000000000000..a53ac11dd385
--- /dev/null
+++ b/arch/x86/crypto/glue_helper-asm-avx2.S
@@ -0,0 +1,180 @@
1/*
2 * Shared glue code for 128bit block ciphers, AVX2 assembler macros
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
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#define load_16way(src, x0, x1, x2, x3, x4, x5, x6, x7) \
14 vmovdqu (0*32)(src), x0; \
15 vmovdqu (1*32)(src), x1; \
16 vmovdqu (2*32)(src), x2; \
17 vmovdqu (3*32)(src), x3; \
18 vmovdqu (4*32)(src), x4; \
19 vmovdqu (5*32)(src), x5; \
20 vmovdqu (6*32)(src), x6; \
21 vmovdqu (7*32)(src), x7;
22
23#define store_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7) \
24 vmovdqu x0, (0*32)(dst); \
25 vmovdqu x1, (1*32)(dst); \
26 vmovdqu x2, (2*32)(dst); \
27 vmovdqu x3, (3*32)(dst); \
28 vmovdqu x4, (4*32)(dst); \
29 vmovdqu x5, (5*32)(dst); \
30 vmovdqu x6, (6*32)(dst); \
31 vmovdqu x7, (7*32)(dst);
32
33#define store_cbc_16way(src, dst, x0, x1, x2, x3, x4, x5, x6, x7, t0) \
34 vpxor t0, t0, t0; \
35 vinserti128 $1, (src), t0, t0; \
36 vpxor t0, x0, x0; \
37 vpxor (0*32+16)(src), x1, x1; \
38 vpxor (1*32+16)(src), x2, x2; \
39 vpxor (2*32+16)(src), x3, x3; \
40 vpxor (3*32+16)(src), x4, x4; \
41 vpxor (4*32+16)(src), x5, x5; \
42 vpxor (5*32+16)(src), x6, x6; \
43 vpxor (6*32+16)(src), x7, x7; \
44 store_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7);
45
46#define inc_le128(x, minus_one, tmp) \
47 vpcmpeqq minus_one, x, tmp; \
48 vpsubq minus_one, x, x; \
49 vpslldq $8, tmp, tmp; \
50 vpsubq tmp, x, x;
51
52#define add2_le128(x, minus_one, minus_two, tmp1, tmp2) \
53 vpcmpeqq minus_one, x, tmp1; \
54 vpcmpeqq minus_two, x, tmp2; \
55 vpsubq minus_two, x, x; \
56 vpor tmp2, tmp1, tmp1; \
57 vpslldq $8, tmp1, tmp1; \
58 vpsubq tmp1, x, x;
59
60#define load_ctr_16way(iv, bswap, x0, x1, x2, x3, x4, x5, x6, x7, t0, t0x, t1, \
61 t1x, t2, t2x, t3, t3x, t4, t5) \
62 vpcmpeqd t0, t0, t0; \
63 vpsrldq $8, t0, t0; /* ab: -1:0 ; cd: -1:0 */ \
64 vpaddq t0, t0, t4; /* ab: -2:0 ; cd: -2:0 */\
65 \
66 /* load IV and byteswap */ \
67 vmovdqu (iv), t2x; \
68 vmovdqa t2x, t3x; \
69 inc_le128(t2x, t0x, t1x); \
70 vbroadcasti128 bswap, t1; \
71 vinserti128 $1, t2x, t3, t2; /* ab: le0 ; cd: le1 */ \
72 vpshufb t1, t2, x0; \
73 \
74 /* construct IVs */ \
75 add2_le128(t2, t0, t4, t3, t5); /* ab: le2 ; cd: le3 */ \
76 vpshufb t1, t2, x1; \
77 add2_le128(t2, t0, t4, t3, t5); \
78 vpshufb t1, t2, x2; \
79 add2_le128(t2, t0, t4, t3, t5); \
80 vpshufb t1, t2, x3; \
81 add2_le128(t2, t0, t4, t3, t5); \
82 vpshufb t1, t2, x4; \
83 add2_le128(t2, t0, t4, t3, t5); \
84 vpshufb t1, t2, x5; \
85 add2_le128(t2, t0, t4, t3, t5); \
86 vpshufb t1, t2, x6; \
87 add2_le128(t2, t0, t4, t3, t5); \
88 vpshufb t1, t2, x7; \
89 vextracti128 $1, t2, t2x; \
90 inc_le128(t2x, t0x, t3x); \
91 vmovdqu t2x, (iv);
92
93#define store_ctr_16way(src, dst, x0, x1, x2, x3, x4, x5, x6, x7) \
94 vpxor (0*32)(src), x0, x0; \
95 vpxor (1*32)(src), x1, x1; \
96 vpxor (2*32)(src), x2, x2; \
97 vpxor (3*32)(src), x3, x3; \
98 vpxor (4*32)(src), x4, x4; \
99 vpxor (5*32)(src), x5, x5; \
100 vpxor (6*32)(src), x6, x6; \
101 vpxor (7*32)(src), x7, x7; \
102 store_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7);
103
104#define gf128mul_x_ble(iv, mask, tmp) \
105 vpsrad $31, iv, tmp; \
106 vpaddq iv, iv, iv; \
107 vpshufd $0x13, tmp, tmp; \
108 vpand mask, tmp, tmp; \
109 vpxor tmp, iv, iv;
110
111#define gf128mul_x2_ble(iv, mask1, mask2, tmp0, tmp1) \
112 vpsrad $31, iv, tmp0; \
113 vpaddq iv, iv, tmp1; \
114 vpsllq $2, iv, iv; \
115 vpshufd $0x13, tmp0, tmp0; \
116 vpsrad $31, tmp1, tmp1; \
117 vpand mask2, tmp0, tmp0; \
118 vpshufd $0x13, tmp1, tmp1; \
119 vpxor tmp0, iv, iv; \
120 vpand mask1, tmp1, tmp1; \
121 vpxor tmp1, iv, iv;
122
123#define load_xts_16way(iv, src, dst, x0, x1, x2, x3, x4, x5, x6, x7, tiv, \
124 tivx, t0, t0x, t1, t1x, t2, t2x, t3, \
125 xts_gf128mul_and_shl1_mask_0, \
126 xts_gf128mul_and_shl1_mask_1) \
127 vbroadcasti128 xts_gf128mul_and_shl1_mask_0, t1; \
128 \
129 /* load IV and construct second IV */ \
130 vmovdqu (iv), tivx; \
131 vmovdqa tivx, t0x; \
132 gf128mul_x_ble(tivx, t1x, t2x); \
133 vbroadcasti128 xts_gf128mul_and_shl1_mask_1, t2; \
134 vinserti128 $1, tivx, t0, tiv; \
135 vpxor (0*32)(src), tiv, x0; \
136 vmovdqu tiv, (0*32)(dst); \
137 \
138 /* construct and store IVs, also xor with source */ \
139 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
140 vpxor (1*32)(src), tiv, x1; \
141 vmovdqu tiv, (1*32)(dst); \
142 \
143 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
144 vpxor (2*32)(src), tiv, x2; \
145 vmovdqu tiv, (2*32)(dst); \
146 \
147 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
148 vpxor (3*32)(src), tiv, x3; \
149 vmovdqu tiv, (3*32)(dst); \
150 \
151 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
152 vpxor (4*32)(src), tiv, x4; \
153 vmovdqu tiv, (4*32)(dst); \
154 \
155 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
156 vpxor (5*32)(src), tiv, x5; \
157 vmovdqu tiv, (5*32)(dst); \
158 \
159 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
160 vpxor (6*32)(src), tiv, x6; \
161 vmovdqu tiv, (6*32)(dst); \
162 \
163 gf128mul_x2_ble(tiv, t1, t2, t0, t3); \
164 vpxor (7*32)(src), tiv, x7; \
165 vmovdqu tiv, (7*32)(dst); \
166 \
167 vextracti128 $1, tiv, tivx; \
168 gf128mul_x_ble(tivx, t1x, t2x); \
169 vmovdqu tivx, (iv);
170
171#define store_xts_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7) \
172 vpxor (0*32)(dst), x0, x0; \
173 vpxor (1*32)(dst), x1, x1; \
174 vpxor (2*32)(dst), x2, x2; \
175 vpxor (3*32)(dst), x3, x3; \
176 vpxor (4*32)(dst), x4, x4; \
177 vpxor (5*32)(dst), x5, x5; \
178 vpxor (6*32)(dst), x6, x6; \
179 vpxor (7*32)(dst), x7, x7; \
180 store_16way(dst, x0, x1, x2, x3, x4, x5, x6, x7);
diff --git a/arch/x86/crypto/glue_helper.c b/arch/x86/crypto/glue_helper.c
index 22ce4f683e55..432f1d76ceb8 100644
--- a/arch/x86/crypto/glue_helper.c
+++ b/arch/x86/crypto/glue_helper.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Shared glue code for 128bit block ciphers 2 * Shared glue code for 128bit block ciphers
3 * 3 *
4 * Copyright (c) 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 * 5 *
6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by: 6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by:
7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> 7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
@@ -304,4 +304,99 @@ int glue_ctr_crypt_128bit(const struct common_glue_ctx *gctx,
304} 304}
305EXPORT_SYMBOL_GPL(glue_ctr_crypt_128bit); 305EXPORT_SYMBOL_GPL(glue_ctr_crypt_128bit);
306 306
307static unsigned int __glue_xts_crypt_128bit(const struct common_glue_ctx *gctx,
308 void *ctx,
309 struct blkcipher_desc *desc,
310 struct blkcipher_walk *walk)
311{
312 const unsigned int bsize = 128 / 8;
313 unsigned int nbytes = walk->nbytes;
314 u128 *src = (u128 *)walk->src.virt.addr;
315 u128 *dst = (u128 *)walk->dst.virt.addr;
316 unsigned int num_blocks, func_bytes;
317 unsigned int i;
318
319 /* Process multi-block batch */
320 for (i = 0; i < gctx->num_funcs; i++) {
321 num_blocks = gctx->funcs[i].num_blocks;
322 func_bytes = bsize * num_blocks;
323
324 if (nbytes >= func_bytes) {
325 do {
326 gctx->funcs[i].fn_u.xts(ctx, dst, src,
327 (le128 *)walk->iv);
328
329 src += num_blocks;
330 dst += num_blocks;
331 nbytes -= func_bytes;
332 } while (nbytes >= func_bytes);
333
334 if (nbytes < bsize)
335 goto done;
336 }
337 }
338
339done:
340 return nbytes;
341}
342
343/* for implementations implementing faster XTS IV generator */
344int glue_xts_crypt_128bit(const struct common_glue_ctx *gctx,
345 struct blkcipher_desc *desc, struct scatterlist *dst,
346 struct scatterlist *src, unsigned int nbytes,
347 void (*tweak_fn)(void *ctx, u8 *dst, const u8 *src),
348 void *tweak_ctx, void *crypt_ctx)
349{
350 const unsigned int bsize = 128 / 8;
351 bool fpu_enabled = false;
352 struct blkcipher_walk walk;
353 int err;
354
355 blkcipher_walk_init(&walk, dst, src, nbytes);
356
357 err = blkcipher_walk_virt(desc, &walk);
358 nbytes = walk.nbytes;
359 if (!nbytes)
360 return err;
361
362 /* set minimum length to bsize, for tweak_fn */
363 fpu_enabled = glue_fpu_begin(bsize, gctx->fpu_blocks_limit,
364 desc, fpu_enabled,
365 nbytes < bsize ? bsize : nbytes);
366
367 /* calculate first value of T */
368 tweak_fn(tweak_ctx, walk.iv, walk.iv);
369
370 while (nbytes) {
371 nbytes = __glue_xts_crypt_128bit(gctx, crypt_ctx, desc, &walk);
372
373 err = blkcipher_walk_done(desc, &walk, nbytes);
374 nbytes = walk.nbytes;
375 }
376
377 glue_fpu_end(fpu_enabled);
378
379 return err;
380}
381EXPORT_SYMBOL_GPL(glue_xts_crypt_128bit);
382
383void glue_xts_crypt_128bit_one(void *ctx, u128 *dst, const u128 *src, le128 *iv,
384 common_glue_func_t fn)
385{
386 le128 ivblk = *iv;
387
388 /* generate next IV */
389 le128_gf128mul_x_ble(iv, &ivblk);
390
391 /* CC <- T xor C */
392 u128_xor(dst, src, (u128 *)&ivblk);
393
394 /* PP <- D(Key2,CC) */
395 fn(ctx, (u8 *)dst, (u8 *)dst);
396
397 /* P <- T xor PP */
398 u128_xor(dst, dst, (u128 *)&ivblk);
399}
400EXPORT_SYMBOL_GPL(glue_xts_crypt_128bit_one);
401
307MODULE_LICENSE("GPL"); 402MODULE_LICENSE("GPL");
diff --git a/arch/x86/crypto/serpent-avx-x86_64-asm_64.S b/arch/x86/crypto/serpent-avx-x86_64-asm_64.S
index 43c938612b74..2f202f49872b 100644
--- a/arch/x86/crypto/serpent-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/serpent-avx-x86_64-asm_64.S
@@ -4,8 +4,7 @@
4 * Copyright (C) 2012 Johannes Goetzfried 4 * Copyright (C) 2012 Johannes Goetzfried
5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
6 * 6 *
7 * Based on arch/x86/crypto/serpent-sse2-x86_64-asm_64.S by 7 * Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
8 * Copyright (C) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -34,6 +33,8 @@
34 33
35.Lbswap128_mask: 34.Lbswap128_mask:
36 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 35 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
36.Lxts_gf128mul_and_shl1_mask:
37 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
37 38
38.text 39.text
39 40
@@ -739,3 +740,43 @@ ENTRY(serpent_ctr_8way_avx)
739 740
740 ret; 741 ret;
741ENDPROC(serpent_ctr_8way_avx) 742ENDPROC(serpent_ctr_8way_avx)
743
744ENTRY(serpent_xts_enc_8way_avx)
745 /* input:
746 * %rdi: ctx, CTX
747 * %rsi: dst
748 * %rdx: src
749 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
750 */
751
752 /* regs <= src, dst <= IVs, regs <= regs xor IVs */
753 load_xts_8way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2,
754 RK0, RK1, RK2, .Lxts_gf128mul_and_shl1_mask);
755
756 call __serpent_enc_blk8_avx;
757
758 /* dst <= regs xor IVs(in dst) */
759 store_xts_8way(%rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
760
761 ret;
762ENDPROC(serpent_xts_enc_8way_avx)
763
764ENTRY(serpent_xts_dec_8way_avx)
765 /* input:
766 * %rdi: ctx, CTX
767 * %rsi: dst
768 * %rdx: src
769 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
770 */
771
772 /* regs <= src, dst <= IVs, regs <= regs xor IVs */
773 load_xts_8way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2,
774 RK0, RK1, RK2, .Lxts_gf128mul_and_shl1_mask);
775
776 call __serpent_dec_blk8_avx;
777
778 /* dst <= regs xor IVs(in dst) */
779 store_xts_8way(%rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2);
780
781 ret;
782ENDPROC(serpent_xts_dec_8way_avx)
diff --git a/arch/x86/crypto/serpent-avx2-asm_64.S b/arch/x86/crypto/serpent-avx2-asm_64.S
new file mode 100644
index 000000000000..b222085cccac
--- /dev/null
+++ b/arch/x86/crypto/serpent-avx2-asm_64.S
@@ -0,0 +1,800 @@
1/*
2 * x86_64/AVX2 assembler optimized version of Serpent
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 *
6 * Based on AVX assembler implementation of Serpent by:
7 * Copyright © 2012 Johannes Goetzfried
8 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 */
16
17#include <linux/linkage.h>
18#include "glue_helper-asm-avx2.S"
19
20.file "serpent-avx2-asm_64.S"
21
22.data
23.align 16
24
25.Lbswap128_mask:
26 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
27.Lxts_gf128mul_and_shl1_mask_0:
28 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
29.Lxts_gf128mul_and_shl1_mask_1:
30 .byte 0x0e, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0
31
32.text
33
34#define CTX %rdi
35
36#define RNOT %ymm0
37#define tp %ymm1
38
39#define RA1 %ymm2
40#define RA2 %ymm3
41#define RB1 %ymm4
42#define RB2 %ymm5
43#define RC1 %ymm6
44#define RC2 %ymm7
45#define RD1 %ymm8
46#define RD2 %ymm9
47#define RE1 %ymm10
48#define RE2 %ymm11
49
50#define RK0 %ymm12
51#define RK1 %ymm13
52#define RK2 %ymm14
53#define RK3 %ymm15
54
55#define RK0x %xmm12
56#define RK1x %xmm13
57#define RK2x %xmm14
58#define RK3x %xmm15
59
60#define S0_1(x0, x1, x2, x3, x4) \
61 vpor x0, x3, tp; \
62 vpxor x3, x0, x0; \
63 vpxor x2, x3, x4; \
64 vpxor RNOT, x4, x4; \
65 vpxor x1, tp, x3; \
66 vpand x0, x1, x1; \
67 vpxor x4, x1, x1; \
68 vpxor x0, x2, x2;
69#define S0_2(x0, x1, x2, x3, x4) \
70 vpxor x3, x0, x0; \
71 vpor x0, x4, x4; \
72 vpxor x2, x0, x0; \
73 vpand x1, x2, x2; \
74 vpxor x2, x3, x3; \
75 vpxor RNOT, x1, x1; \
76 vpxor x4, x2, x2; \
77 vpxor x2, x1, x1;
78
79#define S1_1(x0, x1, x2, x3, x4) \
80 vpxor x0, x1, tp; \
81 vpxor x3, x0, x0; \
82 vpxor RNOT, x3, x3; \
83 vpand tp, x1, x4; \
84 vpor tp, x0, x0; \
85 vpxor x2, x3, x3; \
86 vpxor x3, x0, x0; \
87 vpxor x3, tp, x1;
88#define S1_2(x0, x1, x2, x3, x4) \
89 vpxor x4, x3, x3; \
90 vpor x4, x1, x1; \
91 vpxor x2, x4, x4; \
92 vpand x0, x2, x2; \
93 vpxor x1, x2, x2; \
94 vpor x0, x1, x1; \
95 vpxor RNOT, x0, x0; \
96 vpxor x2, x0, x0; \
97 vpxor x1, x4, x4;
98
99#define S2_1(x0, x1, x2, x3, x4) \
100 vpxor RNOT, x3, x3; \
101 vpxor x0, x1, x1; \
102 vpand x2, x0, tp; \
103 vpxor x3, tp, tp; \
104 vpor x0, x3, x3; \
105 vpxor x1, x2, x2; \
106 vpxor x1, x3, x3; \
107 vpand tp, x1, x1;
108#define S2_2(x0, x1, x2, x3, x4) \
109 vpxor x2, tp, tp; \
110 vpand x3, x2, x2; \
111 vpor x1, x3, x3; \
112 vpxor RNOT, tp, tp; \
113 vpxor tp, x3, x3; \
114 vpxor tp, x0, x4; \
115 vpxor x2, tp, x0; \
116 vpor x2, x1, x1;
117
118#define S3_1(x0, x1, x2, x3, x4) \
119 vpxor x3, x1, tp; \
120 vpor x0, x3, x3; \
121 vpand x0, x1, x4; \
122 vpxor x2, x0, x0; \
123 vpxor tp, x2, x2; \
124 vpand x3, tp, x1; \
125 vpxor x3, x2, x2; \
126 vpor x4, x0, x0; \
127 vpxor x3, x4, x4;
128#define S3_2(x0, x1, x2, x3, x4) \
129 vpxor x0, x1, x1; \
130 vpand x3, x0, x0; \
131 vpand x4, x3, x3; \
132 vpxor x2, x3, x3; \
133 vpor x1, x4, x4; \
134 vpand x1, x2, x2; \
135 vpxor x3, x4, x4; \
136 vpxor x3, x0, x0; \
137 vpxor x2, x3, x3;
138
139#define S4_1(x0, x1, x2, x3, x4) \
140 vpand x0, x3, tp; \
141 vpxor x3, x0, x0; \
142 vpxor x2, tp, tp; \
143 vpor x3, x2, x2; \
144 vpxor x1, x0, x0; \
145 vpxor tp, x3, x4; \
146 vpor x0, x2, x2; \
147 vpxor x1, x2, x2;
148#define S4_2(x0, x1, x2, x3, x4) \
149 vpand x0, x1, x1; \
150 vpxor x4, x1, x1; \
151 vpand x2, x4, x4; \
152 vpxor tp, x2, x2; \
153 vpxor x0, x4, x4; \
154 vpor x1, tp, x3; \
155 vpxor RNOT, x1, x1; \
156 vpxor x0, x3, x3;
157
158#define S5_1(x0, x1, x2, x3, x4) \
159 vpor x0, x1, tp; \
160 vpxor tp, x2, x2; \
161 vpxor RNOT, x3, x3; \
162 vpxor x0, x1, x4; \
163 vpxor x2, x0, x0; \
164 vpand x4, tp, x1; \
165 vpor x3, x4, x4; \
166 vpxor x0, x4, x4;
167#define S5_2(x0, x1, x2, x3, x4) \
168 vpand x3, x0, x0; \
169 vpxor x3, x1, x1; \
170 vpxor x2, x3, x3; \
171 vpxor x1, x0, x0; \
172 vpand x4, x2, x2; \
173 vpxor x2, x1, x1; \
174 vpand x0, x2, x2; \
175 vpxor x2, x3, x3;
176
177#define S6_1(x0, x1, x2, x3, x4) \
178 vpxor x0, x3, x3; \
179 vpxor x2, x1, tp; \
180 vpxor x0, x2, x2; \
181 vpand x3, x0, x0; \
182 vpor x3, tp, tp; \
183 vpxor RNOT, x1, x4; \
184 vpxor tp, x0, x0; \
185 vpxor x2, tp, x1;
186#define S6_2(x0, x1, x2, x3, x4) \
187 vpxor x4, x3, x3; \
188 vpxor x0, x4, x4; \
189 vpand x0, x2, x2; \
190 vpxor x1, x4, x4; \
191 vpxor x3, x2, x2; \
192 vpand x1, x3, x3; \
193 vpxor x0, x3, x3; \
194 vpxor x2, x1, x1;
195
196#define S7_1(x0, x1, x2, x3, x4) \
197 vpxor RNOT, x1, tp; \
198 vpxor RNOT, x0, x0; \
199 vpand x2, tp, x1; \
200 vpxor x3, x1, x1; \
201 vpor tp, x3, x3; \
202 vpxor x2, tp, x4; \
203 vpxor x3, x2, x2; \
204 vpxor x0, x3, x3; \
205 vpor x1, x0, x0;
206#define S7_2(x0, x1, x2, x3, x4) \
207 vpand x0, x2, x2; \
208 vpxor x4, x0, x0; \
209 vpxor x3, x4, x4; \
210 vpand x0, x3, x3; \
211 vpxor x1, x4, x4; \
212 vpxor x4, x2, x2; \
213 vpxor x1, x3, x3; \
214 vpor x0, x4, x4; \
215 vpxor x1, x4, x4;
216
217#define SI0_1(x0, x1, x2, x3, x4) \
218 vpxor x0, x1, x1; \
219 vpor x1, x3, tp; \
220 vpxor x1, x3, x4; \
221 vpxor RNOT, x0, x0; \
222 vpxor tp, x2, x2; \
223 vpxor x0, tp, x3; \
224 vpand x1, x0, x0; \
225 vpxor x2, x0, x0;
226#define SI0_2(x0, x1, x2, x3, x4) \
227 vpand x3, x2, x2; \
228 vpxor x4, x3, x3; \
229 vpxor x3, x2, x2; \
230 vpxor x3, x1, x1; \
231 vpand x0, x3, x3; \
232 vpxor x0, x1, x1; \
233 vpxor x2, x0, x0; \
234 vpxor x3, x4, x4;
235
236#define SI1_1(x0, x1, x2, x3, x4) \
237 vpxor x3, x1, x1; \
238 vpxor x2, x0, tp; \
239 vpxor RNOT, x2, x2; \
240 vpor x1, x0, x4; \
241 vpxor x3, x4, x4; \
242 vpand x1, x3, x3; \
243 vpxor x2, x1, x1; \
244 vpand x4, x2, x2;
245#define SI1_2(x0, x1, x2, x3, x4) \
246 vpxor x1, x4, x4; \
247 vpor x3, x1, x1; \
248 vpxor tp, x3, x3; \
249 vpxor tp, x2, x2; \
250 vpor x4, tp, x0; \
251 vpxor x4, x2, x2; \
252 vpxor x0, x1, x1; \
253 vpxor x1, x4, x4;
254
255#define SI2_1(x0, x1, x2, x3, x4) \
256 vpxor x1, x2, x2; \
257 vpxor RNOT, x3, tp; \
258 vpor x2, tp, tp; \
259 vpxor x3, x2, x2; \
260 vpxor x0, x3, x4; \
261 vpxor x1, tp, x3; \
262 vpor x2, x1, x1; \
263 vpxor x0, x2, x2;
264#define SI2_2(x0, x1, x2, x3, x4) \
265 vpxor x4, x1, x1; \
266 vpor x3, x4, x4; \
267 vpxor x3, x2, x2; \
268 vpxor x2, x4, x4; \
269 vpand x1, x2, x2; \
270 vpxor x3, x2, x2; \
271 vpxor x4, x3, x3; \
272 vpxor x0, x4, x4;
273
274#define SI3_1(x0, x1, x2, x3, x4) \
275 vpxor x1, x2, x2; \
276 vpand x2, x1, tp; \
277 vpxor x0, tp, tp; \
278 vpor x1, x0, x0; \
279 vpxor x3, x1, x4; \
280 vpxor x3, x0, x0; \
281 vpor tp, x3, x3; \
282 vpxor x2, tp, x1;
283#define SI3_2(x0, x1, x2, x3, x4) \
284 vpxor x3, x1, x1; \
285 vpxor x2, x0, x0; \
286 vpxor x3, x2, x2; \
287 vpand x1, x3, x3; \
288 vpxor x0, x1, x1; \
289 vpand x2, x0, x0; \
290 vpxor x3, x4, x4; \
291 vpxor x0, x3, x3; \
292 vpxor x1, x0, x0;
293
294#define SI4_1(x0, x1, x2, x3, x4) \
295 vpxor x3, x2, x2; \
296 vpand x1, x0, tp; \
297 vpxor x2, tp, tp; \
298 vpor x3, x2, x2; \
299 vpxor RNOT, x0, x4; \
300 vpxor tp, x1, x1; \
301 vpxor x2, tp, x0; \
302 vpand x4, x2, x2;
303#define SI4_2(x0, x1, x2, x3, x4) \
304 vpxor x0, x2, x2; \
305 vpor x4, x0, x0; \
306 vpxor x3, x0, x0; \
307 vpand x2, x3, x3; \
308 vpxor x3, x4, x4; \
309 vpxor x1, x3, x3; \
310 vpand x0, x1, x1; \
311 vpxor x1, x4, x4; \
312 vpxor x3, x0, x0;
313
314#define SI5_1(x0, x1, x2, x3, x4) \
315 vpor x2, x1, tp; \
316 vpxor x1, x2, x2; \
317 vpxor x3, tp, tp; \
318 vpand x1, x3, x3; \
319 vpxor x3, x2, x2; \
320 vpor x0, x3, x3; \
321 vpxor RNOT, x0, x0; \
322 vpxor x2, x3, x3; \
323 vpor x0, x2, x2;
324#define SI5_2(x0, x1, x2, x3, x4) \
325 vpxor tp, x1, x4; \
326 vpxor x4, x2, x2; \
327 vpand x0, x4, x4; \
328 vpxor tp, x0, x0; \
329 vpxor x3, tp, x1; \
330 vpand x2, x0, x0; \
331 vpxor x3, x2, x2; \
332 vpxor x2, x0, x0; \
333 vpxor x4, x2, x2; \
334 vpxor x3, x4, x4;
335
336#define SI6_1(x0, x1, x2, x3, x4) \
337 vpxor x2, x0, x0; \
338 vpand x3, x0, tp; \
339 vpxor x3, x2, x2; \
340 vpxor x2, tp, tp; \
341 vpxor x1, x3, x3; \
342 vpor x0, x2, x2; \
343 vpxor x3, x2, x2; \
344 vpand tp, x3, x3;
345#define SI6_2(x0, x1, x2, x3, x4) \
346 vpxor RNOT, tp, tp; \
347 vpxor x1, x3, x3; \
348 vpand x2, x1, x1; \
349 vpxor tp, x0, x4; \
350 vpxor x4, x3, x3; \
351 vpxor x2, x4, x4; \
352 vpxor x1, tp, x0; \
353 vpxor x0, x2, x2;
354
355#define SI7_1(x0, x1, x2, x3, x4) \
356 vpand x0, x3, tp; \
357 vpxor x2, x0, x0; \
358 vpor x3, x2, x2; \
359 vpxor x1, x3, x4; \
360 vpxor RNOT, x0, x0; \
361 vpor tp, x1, x1; \
362 vpxor x0, x4, x4; \
363 vpand x2, x0, x0; \
364 vpxor x1, x0, x0;
365#define SI7_2(x0, x1, x2, x3, x4) \
366 vpand x2, x1, x1; \
367 vpxor x2, tp, x3; \
368 vpxor x3, x4, x4; \
369 vpand x3, x2, x2; \
370 vpor x0, x3, x3; \
371 vpxor x4, x1, x1; \
372 vpxor x4, x3, x3; \
373 vpand x0, x4, x4; \
374 vpxor x2, x4, x4;
375
376#define get_key(i,j,t) \
377 vpbroadcastd (4*(i)+(j))*4(CTX), t;
378
379#define K2(x0, x1, x2, x3, x4, i) \
380 get_key(i, 0, RK0); \
381 get_key(i, 1, RK1); \
382 get_key(i, 2, RK2); \
383 get_key(i, 3, RK3); \
384 vpxor RK0, x0 ## 1, x0 ## 1; \
385 vpxor RK1, x1 ## 1, x1 ## 1; \
386 vpxor RK2, x2 ## 1, x2 ## 1; \
387 vpxor RK3, x3 ## 1, x3 ## 1; \
388 vpxor RK0, x0 ## 2, x0 ## 2; \
389 vpxor RK1, x1 ## 2, x1 ## 2; \
390 vpxor RK2, x2 ## 2, x2 ## 2; \
391 vpxor RK3, x3 ## 2, x3 ## 2;
392
393#define LK2(x0, x1, x2, x3, x4, i) \
394 vpslld $13, x0 ## 1, x4 ## 1; \
395 vpsrld $(32 - 13), x0 ## 1, x0 ## 1; \
396 vpor x4 ## 1, x0 ## 1, x0 ## 1; \
397 vpxor x0 ## 1, x1 ## 1, x1 ## 1; \
398 vpslld $3, x2 ## 1, x4 ## 1; \
399 vpsrld $(32 - 3), x2 ## 1, x2 ## 1; \
400 vpor x4 ## 1, x2 ## 1, x2 ## 1; \
401 vpxor x2 ## 1, x1 ## 1, x1 ## 1; \
402 vpslld $13, x0 ## 2, x4 ## 2; \
403 vpsrld $(32 - 13), x0 ## 2, x0 ## 2; \
404 vpor x4 ## 2, x0 ## 2, x0 ## 2; \
405 vpxor x0 ## 2, x1 ## 2, x1 ## 2; \
406 vpslld $3, x2 ## 2, x4 ## 2; \
407 vpsrld $(32 - 3), x2 ## 2, x2 ## 2; \
408 vpor x4 ## 2, x2 ## 2, x2 ## 2; \
409 vpxor x2 ## 2, x1 ## 2, x1 ## 2; \
410 vpslld $1, x1 ## 1, x4 ## 1; \
411 vpsrld $(32 - 1), x1 ## 1, x1 ## 1; \
412 vpor x4 ## 1, x1 ## 1, x1 ## 1; \
413 vpslld $3, x0 ## 1, x4 ## 1; \
414 vpxor x2 ## 1, x3 ## 1, x3 ## 1; \
415 vpxor x4 ## 1, x3 ## 1, x3 ## 1; \
416 get_key(i, 1, RK1); \
417 vpslld $1, x1 ## 2, x4 ## 2; \
418 vpsrld $(32 - 1), x1 ## 2, x1 ## 2; \
419 vpor x4 ## 2, x1 ## 2, x1 ## 2; \
420 vpslld $3, x0 ## 2, x4 ## 2; \
421 vpxor x2 ## 2, x3 ## 2, x3 ## 2; \
422 vpxor x4 ## 2, x3 ## 2, x3 ## 2; \
423 get_key(i, 3, RK3); \
424 vpslld $7, x3 ## 1, x4 ## 1; \
425 vpsrld $(32 - 7), x3 ## 1, x3 ## 1; \
426 vpor x4 ## 1, x3 ## 1, x3 ## 1; \
427 vpslld $7, x1 ## 1, x4 ## 1; \
428 vpxor x1 ## 1, x0 ## 1, x0 ## 1; \
429 vpxor x3 ## 1, x0 ## 1, x0 ## 1; \
430 vpxor x3 ## 1, x2 ## 1, x2 ## 1; \
431 vpxor x4 ## 1, x2 ## 1, x2 ## 1; \
432 get_key(i, 0, RK0); \
433 vpslld $7, x3 ## 2, x4 ## 2; \
434 vpsrld $(32 - 7), x3 ## 2, x3 ## 2; \
435 vpor x4 ## 2, x3 ## 2, x3 ## 2; \
436 vpslld $7, x1 ## 2, x4 ## 2; \
437 vpxor x1 ## 2, x0 ## 2, x0 ## 2; \
438 vpxor x3 ## 2, x0 ## 2, x0 ## 2; \
439 vpxor x3 ## 2, x2 ## 2, x2 ## 2; \
440 vpxor x4 ## 2, x2 ## 2, x2 ## 2; \
441 get_key(i, 2, RK2); \
442 vpxor RK1, x1 ## 1, x1 ## 1; \
443 vpxor RK3, x3 ## 1, x3 ## 1; \
444 vpslld $5, x0 ## 1, x4 ## 1; \
445 vpsrld $(32 - 5), x0 ## 1, x0 ## 1; \
446 vpor x4 ## 1, x0 ## 1, x0 ## 1; \
447 vpslld $22, x2 ## 1, x4 ## 1; \
448 vpsrld $(32 - 22), x2 ## 1, x2 ## 1; \
449 vpor x4 ## 1, x2 ## 1, x2 ## 1; \
450 vpxor RK0, x0 ## 1, x0 ## 1; \
451 vpxor RK2, x2 ## 1, x2 ## 1; \
452 vpxor RK1, x1 ## 2, x1 ## 2; \
453 vpxor RK3, x3 ## 2, x3 ## 2; \
454 vpslld $5, x0 ## 2, x4 ## 2; \
455 vpsrld $(32 - 5), x0 ## 2, x0 ## 2; \
456 vpor x4 ## 2, x0 ## 2, x0 ## 2; \
457 vpslld $22, x2 ## 2, x4 ## 2; \
458 vpsrld $(32 - 22), x2 ## 2, x2 ## 2; \
459 vpor x4 ## 2, x2 ## 2, x2 ## 2; \
460 vpxor RK0, x0 ## 2, x0 ## 2; \
461 vpxor RK2, x2 ## 2, x2 ## 2;
462
463#define KL2(x0, x1, x2, x3, x4, i) \
464 vpxor RK0, x0 ## 1, x0 ## 1; \
465 vpxor RK2, x2 ## 1, x2 ## 1; \
466 vpsrld $5, x0 ## 1, x4 ## 1; \
467 vpslld $(32 - 5), x0 ## 1, x0 ## 1; \
468 vpor x4 ## 1, x0 ## 1, x0 ## 1; \
469 vpxor RK3, x3 ## 1, x3 ## 1; \
470 vpxor RK1, x1 ## 1, x1 ## 1; \
471 vpsrld $22, x2 ## 1, x4 ## 1; \
472 vpslld $(32 - 22), x2 ## 1, x2 ## 1; \
473 vpor x4 ## 1, x2 ## 1, x2 ## 1; \
474 vpxor x3 ## 1, x2 ## 1, x2 ## 1; \
475 vpxor RK0, x0 ## 2, x0 ## 2; \
476 vpxor RK2, x2 ## 2, x2 ## 2; \
477 vpsrld $5, x0 ## 2, x4 ## 2; \
478 vpslld $(32 - 5), x0 ## 2, x0 ## 2; \
479 vpor x4 ## 2, x0 ## 2, x0 ## 2; \
480 vpxor RK3, x3 ## 2, x3 ## 2; \
481 vpxor RK1, x1 ## 2, x1 ## 2; \
482 vpsrld $22, x2 ## 2, x4 ## 2; \
483 vpslld $(32 - 22), x2 ## 2, x2 ## 2; \
484 vpor x4 ## 2, x2 ## 2, x2 ## 2; \
485 vpxor x3 ## 2, x2 ## 2, x2 ## 2; \
486 vpxor x3 ## 1, x0 ## 1, x0 ## 1; \
487 vpslld $7, x1 ## 1, x4 ## 1; \
488 vpxor x1 ## 1, x0 ## 1, x0 ## 1; \
489 vpxor x4 ## 1, x2 ## 1, x2 ## 1; \
490 vpsrld $1, x1 ## 1, x4 ## 1; \
491 vpslld $(32 - 1), x1 ## 1, x1 ## 1; \
492 vpor x4 ## 1, x1 ## 1, x1 ## 1; \
493 vpxor x3 ## 2, x0 ## 2, x0 ## 2; \
494 vpslld $7, x1 ## 2, x4 ## 2; \
495 vpxor x1 ## 2, x0 ## 2, x0 ## 2; \
496 vpxor x4 ## 2, x2 ## 2, x2 ## 2; \
497 vpsrld $1, x1 ## 2, x4 ## 2; \
498 vpslld $(32 - 1), x1 ## 2, x1 ## 2; \
499 vpor x4 ## 2, x1 ## 2, x1 ## 2; \
500 vpsrld $7, x3 ## 1, x4 ## 1; \
501 vpslld $(32 - 7), x3 ## 1, x3 ## 1; \
502 vpor x4 ## 1, x3 ## 1, x3 ## 1; \
503 vpxor x0 ## 1, x1 ## 1, x1 ## 1; \
504 vpslld $3, x0 ## 1, x4 ## 1; \
505 vpxor x4 ## 1, x3 ## 1, x3 ## 1; \
506 vpsrld $7, x3 ## 2, x4 ## 2; \
507 vpslld $(32 - 7), x3 ## 2, x3 ## 2; \
508 vpor x4 ## 2, x3 ## 2, x3 ## 2; \
509 vpxor x0 ## 2, x1 ## 2, x1 ## 2; \
510 vpslld $3, x0 ## 2, x4 ## 2; \
511 vpxor x4 ## 2, x3 ## 2, x3 ## 2; \
512 vpsrld $13, x0 ## 1, x4 ## 1; \
513 vpslld $(32 - 13), x0 ## 1, x0 ## 1; \
514 vpor x4 ## 1, x0 ## 1, x0 ## 1; \
515 vpxor x2 ## 1, x1 ## 1, x1 ## 1; \
516 vpxor x2 ## 1, x3 ## 1, x3 ## 1; \
517 vpsrld $3, x2 ## 1, x4 ## 1; \
518 vpslld $(32 - 3), x2 ## 1, x2 ## 1; \
519 vpor x4 ## 1, x2 ## 1, x2 ## 1; \
520 vpsrld $13, x0 ## 2, x4 ## 2; \
521 vpslld $(32 - 13), x0 ## 2, x0 ## 2; \
522 vpor x4 ## 2, x0 ## 2, x0 ## 2; \
523 vpxor x2 ## 2, x1 ## 2, x1 ## 2; \
524 vpxor x2 ## 2, x3 ## 2, x3 ## 2; \
525 vpsrld $3, x2 ## 2, x4 ## 2; \
526 vpslld $(32 - 3), x2 ## 2, x2 ## 2; \
527 vpor x4 ## 2, x2 ## 2, x2 ## 2;
528
529#define S(SBOX, x0, x1, x2, x3, x4) \
530 SBOX ## _1(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \
531 SBOX ## _2(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \
532 SBOX ## _1(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); \
533 SBOX ## _2(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2);
534
535#define SP(SBOX, x0, x1, x2, x3, x4, i) \
536 get_key(i, 0, RK0); \
537 SBOX ## _1(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \
538 get_key(i, 2, RK2); \
539 SBOX ## _2(x0 ## 1, x1 ## 1, x2 ## 1, x3 ## 1, x4 ## 1); \
540 get_key(i, 3, RK3); \
541 SBOX ## _1(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); \
542 get_key(i, 1, RK1); \
543 SBOX ## _2(x0 ## 2, x1 ## 2, x2 ## 2, x3 ## 2, x4 ## 2); \
544
545#define transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \
546 vpunpckldq x1, x0, t0; \
547 vpunpckhdq x1, x0, t2; \
548 vpunpckldq x3, x2, t1; \
549 vpunpckhdq x3, x2, x3; \
550 \
551 vpunpcklqdq t1, t0, x0; \
552 vpunpckhqdq t1, t0, x1; \
553 vpunpcklqdq x3, t2, x2; \
554 vpunpckhqdq x3, t2, x3;
555
556#define read_blocks(x0, x1, x2, x3, t0, t1, t2) \
557 transpose_4x4(x0, x1, x2, x3, t0, t1, t2)
558
559#define write_blocks(x0, x1, x2, x3, t0, t1, t2) \
560 transpose_4x4(x0, x1, x2, x3, t0, t1, t2)
561
562.align 8
563__serpent_enc_blk16:
564 /* input:
565 * %rdi: ctx, CTX
566 * RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2: plaintext
567 * output:
568 * RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2: ciphertext
569 */
570
571 vpcmpeqd RNOT, RNOT, RNOT;
572
573 read_blocks(RA1, RB1, RC1, RD1, RK0, RK1, RK2);
574 read_blocks(RA2, RB2, RC2, RD2, RK0, RK1, RK2);
575
576 K2(RA, RB, RC, RD, RE, 0);
577 S(S0, RA, RB, RC, RD, RE); LK2(RC, RB, RD, RA, RE, 1);
578 S(S1, RC, RB, RD, RA, RE); LK2(RE, RD, RA, RC, RB, 2);
579 S(S2, RE, RD, RA, RC, RB); LK2(RB, RD, RE, RC, RA, 3);
580 S(S3, RB, RD, RE, RC, RA); LK2(RC, RA, RD, RB, RE, 4);
581 S(S4, RC, RA, RD, RB, RE); LK2(RA, RD, RB, RE, RC, 5);
582 S(S5, RA, RD, RB, RE, RC); LK2(RC, RA, RD, RE, RB, 6);
583 S(S6, RC, RA, RD, RE, RB); LK2(RD, RB, RA, RE, RC, 7);
584 S(S7, RD, RB, RA, RE, RC); LK2(RC, RA, RE, RD, RB, 8);
585 S(S0, RC, RA, RE, RD, RB); LK2(RE, RA, RD, RC, RB, 9);
586 S(S1, RE, RA, RD, RC, RB); LK2(RB, RD, RC, RE, RA, 10);
587 S(S2, RB, RD, RC, RE, RA); LK2(RA, RD, RB, RE, RC, 11);
588 S(S3, RA, RD, RB, RE, RC); LK2(RE, RC, RD, RA, RB, 12);
589 S(S4, RE, RC, RD, RA, RB); LK2(RC, RD, RA, RB, RE, 13);
590 S(S5, RC, RD, RA, RB, RE); LK2(RE, RC, RD, RB, RA, 14);
591 S(S6, RE, RC, RD, RB, RA); LK2(RD, RA, RC, RB, RE, 15);
592 S(S7, RD, RA, RC, RB, RE); LK2(RE, RC, RB, RD, RA, 16);
593 S(S0, RE, RC, RB, RD, RA); LK2(RB, RC, RD, RE, RA, 17);
594 S(S1, RB, RC, RD, RE, RA); LK2(RA, RD, RE, RB, RC, 18);
595 S(S2, RA, RD, RE, RB, RC); LK2(RC, RD, RA, RB, RE, 19);
596 S(S3, RC, RD, RA, RB, RE); LK2(RB, RE, RD, RC, RA, 20);
597 S(S4, RB, RE, RD, RC, RA); LK2(RE, RD, RC, RA, RB, 21);
598 S(S5, RE, RD, RC, RA, RB); LK2(RB, RE, RD, RA, RC, 22);
599 S(S6, RB, RE, RD, RA, RC); LK2(RD, RC, RE, RA, RB, 23);
600 S(S7, RD, RC, RE, RA, RB); LK2(RB, RE, RA, RD, RC, 24);
601 S(S0, RB, RE, RA, RD, RC); LK2(RA, RE, RD, RB, RC, 25);
602 S(S1, RA, RE, RD, RB, RC); LK2(RC, RD, RB, RA, RE, 26);
603 S(S2, RC, RD, RB, RA, RE); LK2(RE, RD, RC, RA, RB, 27);
604 S(S3, RE, RD, RC, RA, RB); LK2(RA, RB, RD, RE, RC, 28);
605 S(S4, RA, RB, RD, RE, RC); LK2(RB, RD, RE, RC, RA, 29);
606 S(S5, RB, RD, RE, RC, RA); LK2(RA, RB, RD, RC, RE, 30);
607 S(S6, RA, RB, RD, RC, RE); LK2(RD, RE, RB, RC, RA, 31);
608 S(S7, RD, RE, RB, RC, RA); K2(RA, RB, RC, RD, RE, 32);
609
610 write_blocks(RA1, RB1, RC1, RD1, RK0, RK1, RK2);
611 write_blocks(RA2, RB2, RC2, RD2, RK0, RK1, RK2);
612
613 ret;
614ENDPROC(__serpent_enc_blk16)
615
616.align 8
617__serpent_dec_blk16:
618 /* input:
619 * %rdi: ctx, CTX
620 * RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2: ciphertext
621 * output:
622 * RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2: plaintext
623 */
624
625 vpcmpeqd RNOT, RNOT, RNOT;
626
627 read_blocks(RA1, RB1, RC1, RD1, RK0, RK1, RK2);
628 read_blocks(RA2, RB2, RC2, RD2, RK0, RK1, RK2);
629
630 K2(RA, RB, RC, RD, RE, 32);
631 SP(SI7, RA, RB, RC, RD, RE, 31); KL2(RB, RD, RA, RE, RC, 31);
632 SP(SI6, RB, RD, RA, RE, RC, 30); KL2(RA, RC, RE, RB, RD, 30);
633 SP(SI5, RA, RC, RE, RB, RD, 29); KL2(RC, RD, RA, RE, RB, 29);
634 SP(SI4, RC, RD, RA, RE, RB, 28); KL2(RC, RA, RB, RE, RD, 28);
635 SP(SI3, RC, RA, RB, RE, RD, 27); KL2(RB, RC, RD, RE, RA, 27);
636 SP(SI2, RB, RC, RD, RE, RA, 26); KL2(RC, RA, RE, RD, RB, 26);
637 SP(SI1, RC, RA, RE, RD, RB, 25); KL2(RB, RA, RE, RD, RC, 25);
638 SP(SI0, RB, RA, RE, RD, RC, 24); KL2(RE, RC, RA, RB, RD, 24);
639 SP(SI7, RE, RC, RA, RB, RD, 23); KL2(RC, RB, RE, RD, RA, 23);
640 SP(SI6, RC, RB, RE, RD, RA, 22); KL2(RE, RA, RD, RC, RB, 22);
641 SP(SI5, RE, RA, RD, RC, RB, 21); KL2(RA, RB, RE, RD, RC, 21);
642 SP(SI4, RA, RB, RE, RD, RC, 20); KL2(RA, RE, RC, RD, RB, 20);
643 SP(SI3, RA, RE, RC, RD, RB, 19); KL2(RC, RA, RB, RD, RE, 19);
644 SP(SI2, RC, RA, RB, RD, RE, 18); KL2(RA, RE, RD, RB, RC, 18);
645 SP(SI1, RA, RE, RD, RB, RC, 17); KL2(RC, RE, RD, RB, RA, 17);
646 SP(SI0, RC, RE, RD, RB, RA, 16); KL2(RD, RA, RE, RC, RB, 16);
647 SP(SI7, RD, RA, RE, RC, RB, 15); KL2(RA, RC, RD, RB, RE, 15);
648 SP(SI6, RA, RC, RD, RB, RE, 14); KL2(RD, RE, RB, RA, RC, 14);
649 SP(SI5, RD, RE, RB, RA, RC, 13); KL2(RE, RC, RD, RB, RA, 13);
650 SP(SI4, RE, RC, RD, RB, RA, 12); KL2(RE, RD, RA, RB, RC, 12);
651 SP(SI3, RE, RD, RA, RB, RC, 11); KL2(RA, RE, RC, RB, RD, 11);
652 SP(SI2, RA, RE, RC, RB, RD, 10); KL2(RE, RD, RB, RC, RA, 10);
653 SP(SI1, RE, RD, RB, RC, RA, 9); KL2(RA, RD, RB, RC, RE, 9);
654 SP(SI0, RA, RD, RB, RC, RE, 8); KL2(RB, RE, RD, RA, RC, 8);
655 SP(SI7, RB, RE, RD, RA, RC, 7); KL2(RE, RA, RB, RC, RD, 7);
656 SP(SI6, RE, RA, RB, RC, RD, 6); KL2(RB, RD, RC, RE, RA, 6);
657 SP(SI5, RB, RD, RC, RE, RA, 5); KL2(RD, RA, RB, RC, RE, 5);
658 SP(SI4, RD, RA, RB, RC, RE, 4); KL2(RD, RB, RE, RC, RA, 4);
659 SP(SI3, RD, RB, RE, RC, RA, 3); KL2(RE, RD, RA, RC, RB, 3);
660 SP(SI2, RE, RD, RA, RC, RB, 2); KL2(RD, RB, RC, RA, RE, 2);
661 SP(SI1, RD, RB, RC, RA, RE, 1); KL2(RE, RB, RC, RA, RD, 1);
662 S(SI0, RE, RB, RC, RA, RD); K2(RC, RD, RB, RE, RA, 0);
663
664 write_blocks(RC1, RD1, RB1, RE1, RK0, RK1, RK2);
665 write_blocks(RC2, RD2, RB2, RE2, RK0, RK1, RK2);
666
667 ret;
668ENDPROC(__serpent_dec_blk16)
669
670ENTRY(serpent_ecb_enc_16way)
671 /* input:
672 * %rdi: ctx, CTX
673 * %rsi: dst
674 * %rdx: src
675 */
676
677 vzeroupper;
678
679 load_16way(%rdx, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
680
681 call __serpent_enc_blk16;
682
683 store_16way(%rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
684
685 vzeroupper;
686
687 ret;
688ENDPROC(serpent_ecb_enc_16way)
689
690ENTRY(serpent_ecb_dec_16way)
691 /* input:
692 * %rdi: ctx, CTX
693 * %rsi: dst
694 * %rdx: src
695 */
696
697 vzeroupper;
698
699 load_16way(%rdx, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
700
701 call __serpent_dec_blk16;
702
703 store_16way(%rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2);
704
705 vzeroupper;
706
707 ret;
708ENDPROC(serpent_ecb_dec_16way)
709
710ENTRY(serpent_cbc_dec_16way)
711 /* input:
712 * %rdi: ctx, CTX
713 * %rsi: dst
714 * %rdx: src
715 */
716
717 vzeroupper;
718
719 load_16way(%rdx, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
720
721 call __serpent_dec_blk16;
722
723 store_cbc_16way(%rdx, %rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2,
724 RK0);
725
726 vzeroupper;
727
728 ret;
729ENDPROC(serpent_cbc_dec_16way)
730
731ENTRY(serpent_ctr_16way)
732 /* input:
733 * %rdi: ctx, CTX
734 * %rsi: dst (16 blocks)
735 * %rdx: src (16 blocks)
736 * %rcx: iv (little endian, 128bit)
737 */
738
739 vzeroupper;
740
741 load_ctr_16way(%rcx, .Lbswap128_mask, RA1, RB1, RC1, RD1, RA2, RB2, RC2,
742 RD2, RK0, RK0x, RK1, RK1x, RK2, RK2x, RK3, RK3x, RNOT,
743 tp);
744
745 call __serpent_enc_blk16;
746
747 store_ctr_16way(%rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
748
749 vzeroupper;
750
751 ret;
752ENDPROC(serpent_ctr_16way)
753
754ENTRY(serpent_xts_enc_16way)
755 /* input:
756 * %rdi: ctx, CTX
757 * %rsi: dst (16 blocks)
758 * %rdx: src (16 blocks)
759 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
760 */
761
762 vzeroupper;
763
764 load_xts_16way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2,
765 RD2, RK0, RK0x, RK1, RK1x, RK2, RK2x, RK3, RK3x, RNOT,
766 .Lxts_gf128mul_and_shl1_mask_0,
767 .Lxts_gf128mul_and_shl1_mask_1);
768
769 call __serpent_enc_blk16;
770
771 store_xts_16way(%rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
772
773 vzeroupper;
774
775 ret;
776ENDPROC(serpent_xts_enc_16way)
777
778ENTRY(serpent_xts_dec_16way)
779 /* input:
780 * %rdi: ctx, CTX
781 * %rsi: dst (16 blocks)
782 * %rdx: src (16 blocks)
783 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
784 */
785
786 vzeroupper;
787
788 load_xts_16way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2,
789 RD2, RK0, RK0x, RK1, RK1x, RK2, RK2x, RK3, RK3x, RNOT,
790 .Lxts_gf128mul_and_shl1_mask_0,
791 .Lxts_gf128mul_and_shl1_mask_1);
792
793 call __serpent_dec_blk16;
794
795 store_xts_16way(%rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2);
796
797 vzeroupper;
798
799 ret;
800ENDPROC(serpent_xts_dec_16way)
diff --git a/arch/x86/crypto/serpent_avx2_glue.c b/arch/x86/crypto/serpent_avx2_glue.c
new file mode 100644
index 000000000000..23aabc6c20a5
--- /dev/null
+++ b/arch/x86/crypto/serpent_avx2_glue.c
@@ -0,0 +1,562 @@
1/*
2 * Glue Code for x86_64/AVX2 assembler optimized version of Serpent
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
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#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/crypto.h>
16#include <linux/err.h>
17#include <crypto/algapi.h>
18#include <crypto/ctr.h>
19#include <crypto/lrw.h>
20#include <crypto/xts.h>
21#include <crypto/serpent.h>
22#include <asm/xcr.h>
23#include <asm/xsave.h>
24#include <asm/crypto/serpent-avx.h>
25#include <asm/crypto/ablk_helper.h>
26#include <asm/crypto/glue_helper.h>
27
28#define SERPENT_AVX2_PARALLEL_BLOCKS 16
29
30/* 16-way AVX2 parallel cipher functions */
31asmlinkage void serpent_ecb_enc_16way(struct serpent_ctx *ctx, u8 *dst,
32 const u8 *src);
33asmlinkage void serpent_ecb_dec_16way(struct serpent_ctx *ctx, u8 *dst,
34 const u8 *src);
35asmlinkage void serpent_cbc_dec_16way(void *ctx, u128 *dst, const u128 *src);
36
37asmlinkage void serpent_ctr_16way(void *ctx, u128 *dst, const u128 *src,
38 le128 *iv);
39asmlinkage void serpent_xts_enc_16way(struct serpent_ctx *ctx, u8 *dst,
40 const u8 *src, le128 *iv);
41asmlinkage void serpent_xts_dec_16way(struct serpent_ctx *ctx, u8 *dst,
42 const u8 *src, le128 *iv);
43
44static const struct common_glue_ctx serpent_enc = {
45 .num_funcs = 3,
46 .fpu_blocks_limit = 8,
47
48 .funcs = { {
49 .num_blocks = 16,
50 .fn_u = { .ecb = GLUE_FUNC_CAST(serpent_ecb_enc_16way) }
51 }, {
52 .num_blocks = 8,
53 .fn_u = { .ecb = GLUE_FUNC_CAST(serpent_ecb_enc_8way_avx) }
54 }, {
55 .num_blocks = 1,
56 .fn_u = { .ecb = GLUE_FUNC_CAST(__serpent_encrypt) }
57 } }
58};
59
60static const struct common_glue_ctx serpent_ctr = {
61 .num_funcs = 3,
62 .fpu_blocks_limit = 8,
63
64 .funcs = { {
65 .num_blocks = 16,
66 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(serpent_ctr_16way) }
67 }, {
68 .num_blocks = 8,
69 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(serpent_ctr_8way_avx) }
70 }, {
71 .num_blocks = 1,
72 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(__serpent_crypt_ctr) }
73 } }
74};
75
76static const struct common_glue_ctx serpent_enc_xts = {
77 .num_funcs = 3,
78 .fpu_blocks_limit = 8,
79
80 .funcs = { {
81 .num_blocks = 16,
82 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_enc_16way) }
83 }, {
84 .num_blocks = 8,
85 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_enc_8way_avx) }
86 }, {
87 .num_blocks = 1,
88 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_enc) }
89 } }
90};
91
92static const struct common_glue_ctx serpent_dec = {
93 .num_funcs = 3,
94 .fpu_blocks_limit = 8,
95
96 .funcs = { {
97 .num_blocks = 16,
98 .fn_u = { .ecb = GLUE_FUNC_CAST(serpent_ecb_dec_16way) }
99 }, {
100 .num_blocks = 8,
101 .fn_u = { .ecb = GLUE_FUNC_CAST(serpent_ecb_dec_8way_avx) }
102 }, {
103 .num_blocks = 1,
104 .fn_u = { .ecb = GLUE_FUNC_CAST(__serpent_decrypt) }
105 } }
106};
107
108static const struct common_glue_ctx serpent_dec_cbc = {
109 .num_funcs = 3,
110 .fpu_blocks_limit = 8,
111
112 .funcs = { {
113 .num_blocks = 16,
114 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(serpent_cbc_dec_16way) }
115 }, {
116 .num_blocks = 8,
117 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(serpent_cbc_dec_8way_avx) }
118 }, {
119 .num_blocks = 1,
120 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(__serpent_decrypt) }
121 } }
122};
123
124static const struct common_glue_ctx serpent_dec_xts = {
125 .num_funcs = 3,
126 .fpu_blocks_limit = 8,
127
128 .funcs = { {
129 .num_blocks = 16,
130 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_dec_16way) }
131 }, {
132 .num_blocks = 8,
133 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_dec_8way_avx) }
134 }, {
135 .num_blocks = 1,
136 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_dec) }
137 } }
138};
139
140static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
141 struct scatterlist *src, unsigned int nbytes)
142{
143 return glue_ecb_crypt_128bit(&serpent_enc, desc, dst, src, nbytes);
144}
145
146static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
147 struct scatterlist *src, unsigned int nbytes)
148{
149 return glue_ecb_crypt_128bit(&serpent_dec, desc, dst, src, nbytes);
150}
151
152static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
153 struct scatterlist *src, unsigned int nbytes)
154{
155 return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(__serpent_encrypt), desc,
156 dst, src, nbytes);
157}
158
159static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
160 struct scatterlist *src, unsigned int nbytes)
161{
162 return glue_cbc_decrypt_128bit(&serpent_dec_cbc, desc, dst, src,
163 nbytes);
164}
165
166static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
167 struct scatterlist *src, unsigned int nbytes)
168{
169 return glue_ctr_crypt_128bit(&serpent_ctr, desc, dst, src, nbytes);
170}
171
172static inline bool serpent_fpu_begin(bool fpu_enabled, unsigned int nbytes)
173{
174 /* since reusing AVX functions, starts using FPU at 8 parallel blocks */
175 return glue_fpu_begin(SERPENT_BLOCK_SIZE, 8, NULL, fpu_enabled, nbytes);
176}
177
178static inline void serpent_fpu_end(bool fpu_enabled)
179{
180 glue_fpu_end(fpu_enabled);
181}
182
183struct crypt_priv {
184 struct serpent_ctx *ctx;
185 bool fpu_enabled;
186};
187
188static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
189{
190 const unsigned int bsize = SERPENT_BLOCK_SIZE;
191 struct crypt_priv *ctx = priv;
192 int i;
193
194 ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes);
195
196 if (nbytes >= SERPENT_AVX2_PARALLEL_BLOCKS * bsize) {
197 serpent_ecb_enc_16way(ctx->ctx, srcdst, srcdst);
198 srcdst += bsize * SERPENT_AVX2_PARALLEL_BLOCKS;
199 nbytes -= bsize * SERPENT_AVX2_PARALLEL_BLOCKS;
200 }
201
202 while (nbytes >= SERPENT_PARALLEL_BLOCKS * bsize) {
203 serpent_ecb_enc_8way_avx(ctx->ctx, srcdst, srcdst);
204 srcdst += bsize * SERPENT_PARALLEL_BLOCKS;
205 nbytes -= bsize * SERPENT_PARALLEL_BLOCKS;
206 }
207
208 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
209 __serpent_encrypt(ctx->ctx, srcdst, srcdst);
210}
211
212static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
213{
214 const unsigned int bsize = SERPENT_BLOCK_SIZE;
215 struct crypt_priv *ctx = priv;
216 int i;
217
218 ctx->fpu_enabled = serpent_fpu_begin(ctx->fpu_enabled, nbytes);
219
220 if (nbytes >= SERPENT_AVX2_PARALLEL_BLOCKS * bsize) {
221 serpent_ecb_dec_16way(ctx->ctx, srcdst, srcdst);
222 srcdst += bsize * SERPENT_AVX2_PARALLEL_BLOCKS;
223 nbytes -= bsize * SERPENT_AVX2_PARALLEL_BLOCKS;
224 }
225
226 while (nbytes >= SERPENT_PARALLEL_BLOCKS * bsize) {
227 serpent_ecb_dec_8way_avx(ctx->ctx, srcdst, srcdst);
228 srcdst += bsize * SERPENT_PARALLEL_BLOCKS;
229 nbytes -= bsize * SERPENT_PARALLEL_BLOCKS;
230 }
231
232 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
233 __serpent_decrypt(ctx->ctx, srcdst, srcdst);
234}
235
236static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
237 struct scatterlist *src, unsigned int nbytes)
238{
239 struct serpent_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
240 be128 buf[SERPENT_AVX2_PARALLEL_BLOCKS];
241 struct crypt_priv crypt_ctx = {
242 .ctx = &ctx->serpent_ctx,
243 .fpu_enabled = false,
244 };
245 struct lrw_crypt_req req = {
246 .tbuf = buf,
247 .tbuflen = sizeof(buf),
248
249 .table_ctx = &ctx->lrw_table,
250 .crypt_ctx = &crypt_ctx,
251 .crypt_fn = encrypt_callback,
252 };
253 int ret;
254
255 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
256 ret = lrw_crypt(desc, dst, src, nbytes, &req);
257 serpent_fpu_end(crypt_ctx.fpu_enabled);
258
259 return ret;
260}
261
262static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
263 struct scatterlist *src, unsigned int nbytes)
264{
265 struct serpent_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
266 be128 buf[SERPENT_AVX2_PARALLEL_BLOCKS];
267 struct crypt_priv crypt_ctx = {
268 .ctx = &ctx->serpent_ctx,
269 .fpu_enabled = false,
270 };
271 struct lrw_crypt_req req = {
272 .tbuf = buf,
273 .tbuflen = sizeof(buf),
274
275 .table_ctx = &ctx->lrw_table,
276 .crypt_ctx = &crypt_ctx,
277 .crypt_fn = decrypt_callback,
278 };
279 int ret;
280
281 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
282 ret = lrw_crypt(desc, dst, src, nbytes, &req);
283 serpent_fpu_end(crypt_ctx.fpu_enabled);
284
285 return ret;
286}
287
288static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
289 struct scatterlist *src, unsigned int nbytes)
290{
291 struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
292
293 return glue_xts_crypt_128bit(&serpent_enc_xts, desc, dst, src, nbytes,
294 XTS_TWEAK_CAST(__serpent_encrypt),
295 &ctx->tweak_ctx, &ctx->crypt_ctx);
296}
297
298static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
299 struct scatterlist *src, unsigned int nbytes)
300{
301 struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
302
303 return glue_xts_crypt_128bit(&serpent_dec_xts, desc, dst, src, nbytes,
304 XTS_TWEAK_CAST(__serpent_encrypt),
305 &ctx->tweak_ctx, &ctx->crypt_ctx);
306}
307
308static struct crypto_alg srp_algs[10] = { {
309 .cra_name = "__ecb-serpent-avx2",
310 .cra_driver_name = "__driver-ecb-serpent-avx2",
311 .cra_priority = 0,
312 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
313 .cra_blocksize = SERPENT_BLOCK_SIZE,
314 .cra_ctxsize = sizeof(struct serpent_ctx),
315 .cra_alignmask = 0,
316 .cra_type = &crypto_blkcipher_type,
317 .cra_module = THIS_MODULE,
318 .cra_list = LIST_HEAD_INIT(srp_algs[0].cra_list),
319 .cra_u = {
320 .blkcipher = {
321 .min_keysize = SERPENT_MIN_KEY_SIZE,
322 .max_keysize = SERPENT_MAX_KEY_SIZE,
323 .setkey = serpent_setkey,
324 .encrypt = ecb_encrypt,
325 .decrypt = ecb_decrypt,
326 },
327 },
328}, {
329 .cra_name = "__cbc-serpent-avx2",
330 .cra_driver_name = "__driver-cbc-serpent-avx2",
331 .cra_priority = 0,
332 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
333 .cra_blocksize = SERPENT_BLOCK_SIZE,
334 .cra_ctxsize = sizeof(struct serpent_ctx),
335 .cra_alignmask = 0,
336 .cra_type = &crypto_blkcipher_type,
337 .cra_module = THIS_MODULE,
338 .cra_list = LIST_HEAD_INIT(srp_algs[1].cra_list),
339 .cra_u = {
340 .blkcipher = {
341 .min_keysize = SERPENT_MIN_KEY_SIZE,
342 .max_keysize = SERPENT_MAX_KEY_SIZE,
343 .setkey = serpent_setkey,
344 .encrypt = cbc_encrypt,
345 .decrypt = cbc_decrypt,
346 },
347 },
348}, {
349 .cra_name = "__ctr-serpent-avx2",
350 .cra_driver_name = "__driver-ctr-serpent-avx2",
351 .cra_priority = 0,
352 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
353 .cra_blocksize = 1,
354 .cra_ctxsize = sizeof(struct serpent_ctx),
355 .cra_alignmask = 0,
356 .cra_type = &crypto_blkcipher_type,
357 .cra_module = THIS_MODULE,
358 .cra_list = LIST_HEAD_INIT(srp_algs[2].cra_list),
359 .cra_u = {
360 .blkcipher = {
361 .min_keysize = SERPENT_MIN_KEY_SIZE,
362 .max_keysize = SERPENT_MAX_KEY_SIZE,
363 .ivsize = SERPENT_BLOCK_SIZE,
364 .setkey = serpent_setkey,
365 .encrypt = ctr_crypt,
366 .decrypt = ctr_crypt,
367 },
368 },
369}, {
370 .cra_name = "__lrw-serpent-avx2",
371 .cra_driver_name = "__driver-lrw-serpent-avx2",
372 .cra_priority = 0,
373 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
374 .cra_blocksize = SERPENT_BLOCK_SIZE,
375 .cra_ctxsize = sizeof(struct serpent_lrw_ctx),
376 .cra_alignmask = 0,
377 .cra_type = &crypto_blkcipher_type,
378 .cra_module = THIS_MODULE,
379 .cra_list = LIST_HEAD_INIT(srp_algs[3].cra_list),
380 .cra_exit = lrw_serpent_exit_tfm,
381 .cra_u = {
382 .blkcipher = {
383 .min_keysize = SERPENT_MIN_KEY_SIZE +
384 SERPENT_BLOCK_SIZE,
385 .max_keysize = SERPENT_MAX_KEY_SIZE +
386 SERPENT_BLOCK_SIZE,
387 .ivsize = SERPENT_BLOCK_SIZE,
388 .setkey = lrw_serpent_setkey,
389 .encrypt = lrw_encrypt,
390 .decrypt = lrw_decrypt,
391 },
392 },
393}, {
394 .cra_name = "__xts-serpent-avx2",
395 .cra_driver_name = "__driver-xts-serpent-avx2",
396 .cra_priority = 0,
397 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
398 .cra_blocksize = SERPENT_BLOCK_SIZE,
399 .cra_ctxsize = sizeof(struct serpent_xts_ctx),
400 .cra_alignmask = 0,
401 .cra_type = &crypto_blkcipher_type,
402 .cra_module = THIS_MODULE,
403 .cra_list = LIST_HEAD_INIT(srp_algs[4].cra_list),
404 .cra_u = {
405 .blkcipher = {
406 .min_keysize = SERPENT_MIN_KEY_SIZE * 2,
407 .max_keysize = SERPENT_MAX_KEY_SIZE * 2,
408 .ivsize = SERPENT_BLOCK_SIZE,
409 .setkey = xts_serpent_setkey,
410 .encrypt = xts_encrypt,
411 .decrypt = xts_decrypt,
412 },
413 },
414}, {
415 .cra_name = "ecb(serpent)",
416 .cra_driver_name = "ecb-serpent-avx2",
417 .cra_priority = 600,
418 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
419 .cra_blocksize = SERPENT_BLOCK_SIZE,
420 .cra_ctxsize = sizeof(struct async_helper_ctx),
421 .cra_alignmask = 0,
422 .cra_type = &crypto_ablkcipher_type,
423 .cra_module = THIS_MODULE,
424 .cra_list = LIST_HEAD_INIT(srp_algs[5].cra_list),
425 .cra_init = ablk_init,
426 .cra_exit = ablk_exit,
427 .cra_u = {
428 .ablkcipher = {
429 .min_keysize = SERPENT_MIN_KEY_SIZE,
430 .max_keysize = SERPENT_MAX_KEY_SIZE,
431 .setkey = ablk_set_key,
432 .encrypt = ablk_encrypt,
433 .decrypt = ablk_decrypt,
434 },
435 },
436}, {
437 .cra_name = "cbc(serpent)",
438 .cra_driver_name = "cbc-serpent-avx2",
439 .cra_priority = 600,
440 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
441 .cra_blocksize = SERPENT_BLOCK_SIZE,
442 .cra_ctxsize = sizeof(struct async_helper_ctx),
443 .cra_alignmask = 0,
444 .cra_type = &crypto_ablkcipher_type,
445 .cra_module = THIS_MODULE,
446 .cra_list = LIST_HEAD_INIT(srp_algs[6].cra_list),
447 .cra_init = ablk_init,
448 .cra_exit = ablk_exit,
449 .cra_u = {
450 .ablkcipher = {
451 .min_keysize = SERPENT_MIN_KEY_SIZE,
452 .max_keysize = SERPENT_MAX_KEY_SIZE,
453 .ivsize = SERPENT_BLOCK_SIZE,
454 .setkey = ablk_set_key,
455 .encrypt = __ablk_encrypt,
456 .decrypt = ablk_decrypt,
457 },
458 },
459}, {
460 .cra_name = "ctr(serpent)",
461 .cra_driver_name = "ctr-serpent-avx2",
462 .cra_priority = 600,
463 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
464 .cra_blocksize = 1,
465 .cra_ctxsize = sizeof(struct async_helper_ctx),
466 .cra_alignmask = 0,
467 .cra_type = &crypto_ablkcipher_type,
468 .cra_module = THIS_MODULE,
469 .cra_list = LIST_HEAD_INIT(srp_algs[7].cra_list),
470 .cra_init = ablk_init,
471 .cra_exit = ablk_exit,
472 .cra_u = {
473 .ablkcipher = {
474 .min_keysize = SERPENT_MIN_KEY_SIZE,
475 .max_keysize = SERPENT_MAX_KEY_SIZE,
476 .ivsize = SERPENT_BLOCK_SIZE,
477 .setkey = ablk_set_key,
478 .encrypt = ablk_encrypt,
479 .decrypt = ablk_encrypt,
480 .geniv = "chainiv",
481 },
482 },
483}, {
484 .cra_name = "lrw(serpent)",
485 .cra_driver_name = "lrw-serpent-avx2",
486 .cra_priority = 600,
487 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
488 .cra_blocksize = SERPENT_BLOCK_SIZE,
489 .cra_ctxsize = sizeof(struct async_helper_ctx),
490 .cra_alignmask = 0,
491 .cra_type = &crypto_ablkcipher_type,
492 .cra_module = THIS_MODULE,
493 .cra_list = LIST_HEAD_INIT(srp_algs[8].cra_list),
494 .cra_init = ablk_init,
495 .cra_exit = ablk_exit,
496 .cra_u = {
497 .ablkcipher = {
498 .min_keysize = SERPENT_MIN_KEY_SIZE +
499 SERPENT_BLOCK_SIZE,
500 .max_keysize = SERPENT_MAX_KEY_SIZE +
501 SERPENT_BLOCK_SIZE,
502 .ivsize = SERPENT_BLOCK_SIZE,
503 .setkey = ablk_set_key,
504 .encrypt = ablk_encrypt,
505 .decrypt = ablk_decrypt,
506 },
507 },
508}, {
509 .cra_name = "xts(serpent)",
510 .cra_driver_name = "xts-serpent-avx2",
511 .cra_priority = 600,
512 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
513 .cra_blocksize = SERPENT_BLOCK_SIZE,
514 .cra_ctxsize = sizeof(struct async_helper_ctx),
515 .cra_alignmask = 0,
516 .cra_type = &crypto_ablkcipher_type,
517 .cra_module = THIS_MODULE,
518 .cra_list = LIST_HEAD_INIT(srp_algs[9].cra_list),
519 .cra_init = ablk_init,
520 .cra_exit = ablk_exit,
521 .cra_u = {
522 .ablkcipher = {
523 .min_keysize = SERPENT_MIN_KEY_SIZE * 2,
524 .max_keysize = SERPENT_MAX_KEY_SIZE * 2,
525 .ivsize = SERPENT_BLOCK_SIZE,
526 .setkey = ablk_set_key,
527 .encrypt = ablk_encrypt,
528 .decrypt = ablk_decrypt,
529 },
530 },
531} };
532
533static int __init init(void)
534{
535 u64 xcr0;
536
537 if (!cpu_has_avx2 || !cpu_has_osxsave) {
538 pr_info("AVX2 instructions are not detected.\n");
539 return -ENODEV;
540 }
541
542 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
543 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
544 pr_info("AVX detected but unusable.\n");
545 return -ENODEV;
546 }
547
548 return crypto_register_algs(srp_algs, ARRAY_SIZE(srp_algs));
549}
550
551static void __exit fini(void)
552{
553 crypto_unregister_algs(srp_algs, ARRAY_SIZE(srp_algs));
554}
555
556module_init(init);
557module_exit(fini);
558
559MODULE_LICENSE("GPL");
560MODULE_DESCRIPTION("Serpent Cipher Algorithm, AVX2 optimized");
561MODULE_ALIAS("serpent");
562MODULE_ALIAS("serpent-asm");
diff --git a/arch/x86/crypto/serpent_avx_glue.c b/arch/x86/crypto/serpent_avx_glue.c
index 52abaaf28e7f..9ae83cf8d21e 100644
--- a/arch/x86/crypto/serpent_avx_glue.c
+++ b/arch/x86/crypto/serpent_avx_glue.c
@@ -4,8 +4,7 @@
4 * Copyright (C) 2012 Johannes Goetzfried 4 * Copyright (C) 2012 Johannes Goetzfried
5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
6 * 6 *
7 * Glue code based on serpent_sse2_glue.c by: 7 * Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
8 * Copyright (C) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
9 * 8 *
10 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -42,7 +41,32 @@
42#include <asm/crypto/ablk_helper.h> 41#include <asm/crypto/ablk_helper.h>
43#include <asm/crypto/glue_helper.h> 42#include <asm/crypto/glue_helper.h>
44 43
45static void serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv) 44/* 8-way parallel cipher functions */
45asmlinkage void serpent_ecb_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst,
46 const u8 *src);
47EXPORT_SYMBOL_GPL(serpent_ecb_enc_8way_avx);
48
49asmlinkage void serpent_ecb_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst,
50 const u8 *src);
51EXPORT_SYMBOL_GPL(serpent_ecb_dec_8way_avx);
52
53asmlinkage void serpent_cbc_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst,
54 const u8 *src);
55EXPORT_SYMBOL_GPL(serpent_cbc_dec_8way_avx);
56
57asmlinkage void serpent_ctr_8way_avx(struct serpent_ctx *ctx, u8 *dst,
58 const u8 *src, le128 *iv);
59EXPORT_SYMBOL_GPL(serpent_ctr_8way_avx);
60
61asmlinkage void serpent_xts_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst,
62 const u8 *src, le128 *iv);
63EXPORT_SYMBOL_GPL(serpent_xts_enc_8way_avx);
64
65asmlinkage void serpent_xts_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst,
66 const u8 *src, le128 *iv);
67EXPORT_SYMBOL_GPL(serpent_xts_dec_8way_avx);
68
69void __serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv)
46{ 70{
47 be128 ctrblk; 71 be128 ctrblk;
48 72
@@ -52,6 +76,22 @@ static void serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv)
52 __serpent_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk); 76 __serpent_encrypt(ctx, (u8 *)&ctrblk, (u8 *)&ctrblk);
53 u128_xor(dst, src, (u128 *)&ctrblk); 77 u128_xor(dst, src, (u128 *)&ctrblk);
54} 78}
79EXPORT_SYMBOL_GPL(__serpent_crypt_ctr);
80
81void serpent_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
82{
83 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
84 GLUE_FUNC_CAST(__serpent_encrypt));
85}
86EXPORT_SYMBOL_GPL(serpent_xts_enc);
87
88void serpent_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv)
89{
90 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
91 GLUE_FUNC_CAST(__serpent_decrypt));
92}
93EXPORT_SYMBOL_GPL(serpent_xts_dec);
94
55 95
56static const struct common_glue_ctx serpent_enc = { 96static const struct common_glue_ctx serpent_enc = {
57 .num_funcs = 2, 97 .num_funcs = 2,
@@ -75,7 +115,20 @@ static const struct common_glue_ctx serpent_ctr = {
75 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(serpent_ctr_8way_avx) } 115 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(serpent_ctr_8way_avx) }
76 }, { 116 }, {
77 .num_blocks = 1, 117 .num_blocks = 1,
78 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(serpent_crypt_ctr) } 118 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(__serpent_crypt_ctr) }
119 } }
120};
121
122static const struct common_glue_ctx serpent_enc_xts = {
123 .num_funcs = 2,
124 .fpu_blocks_limit = SERPENT_PARALLEL_BLOCKS,
125
126 .funcs = { {
127 .num_blocks = SERPENT_PARALLEL_BLOCKS,
128 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_enc_8way_avx) }
129 }, {
130 .num_blocks = 1,
131 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_enc) }
79 } } 132 } }
80}; 133};
81 134
@@ -105,6 +158,19 @@ static const struct common_glue_ctx serpent_dec_cbc = {
105 } } 158 } }
106}; 159};
107 160
161static const struct common_glue_ctx serpent_dec_xts = {
162 .num_funcs = 2,
163 .fpu_blocks_limit = SERPENT_PARALLEL_BLOCKS,
164
165 .funcs = { {
166 .num_blocks = SERPENT_PARALLEL_BLOCKS,
167 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_dec_8way_avx) }
168 }, {
169 .num_blocks = 1,
170 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(serpent_xts_dec) }
171 } }
172};
173
108static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 174static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
109 struct scatterlist *src, unsigned int nbytes) 175 struct scatterlist *src, unsigned int nbytes)
110{ 176{
@@ -187,13 +253,8 @@ static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
187 __serpent_decrypt(ctx->ctx, srcdst, srcdst); 253 __serpent_decrypt(ctx->ctx, srcdst, srcdst);
188} 254}
189 255
190struct serpent_lrw_ctx { 256int lrw_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
191 struct lrw_table_ctx lrw_table; 257 unsigned int keylen)
192 struct serpent_ctx serpent_ctx;
193};
194
195static int lrw_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
196 unsigned int keylen)
197{ 258{
198 struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm); 259 struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm);
199 int err; 260 int err;
@@ -206,6 +267,7 @@ static int lrw_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
206 return lrw_init_table(&ctx->lrw_table, key + keylen - 267 return lrw_init_table(&ctx->lrw_table, key + keylen -
207 SERPENT_BLOCK_SIZE); 268 SERPENT_BLOCK_SIZE);
208} 269}
270EXPORT_SYMBOL_GPL(lrw_serpent_setkey);
209 271
210static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 272static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
211 struct scatterlist *src, unsigned int nbytes) 273 struct scatterlist *src, unsigned int nbytes)
@@ -259,20 +321,16 @@ static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
259 return ret; 321 return ret;
260} 322}
261 323
262static void lrw_exit_tfm(struct crypto_tfm *tfm) 324void lrw_serpent_exit_tfm(struct crypto_tfm *tfm)
263{ 325{
264 struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm); 326 struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm);
265 327
266 lrw_free_table(&ctx->lrw_table); 328 lrw_free_table(&ctx->lrw_table);
267} 329}
330EXPORT_SYMBOL_GPL(lrw_serpent_exit_tfm);
268 331
269struct serpent_xts_ctx { 332int xts_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
270 struct serpent_ctx tweak_ctx; 333 unsigned int keylen)
271 struct serpent_ctx crypt_ctx;
272};
273
274static int xts_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
275 unsigned int keylen)
276{ 334{
277 struct serpent_xts_ctx *ctx = crypto_tfm_ctx(tfm); 335 struct serpent_xts_ctx *ctx = crypto_tfm_ctx(tfm);
278 u32 *flags = &tfm->crt_flags; 336 u32 *flags = &tfm->crt_flags;
@@ -294,59 +352,26 @@ static int xts_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
294 /* second half of xts-key is for tweak */ 352 /* second half of xts-key is for tweak */
295 return __serpent_setkey(&ctx->tweak_ctx, key + keylen / 2, keylen / 2); 353 return __serpent_setkey(&ctx->tweak_ctx, key + keylen / 2, keylen / 2);
296} 354}
355EXPORT_SYMBOL_GPL(xts_serpent_setkey);
297 356
298static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 357static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
299 struct scatterlist *src, unsigned int nbytes) 358 struct scatterlist *src, unsigned int nbytes)
300{ 359{
301 struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 360 struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
302 be128 buf[SERPENT_PARALLEL_BLOCKS];
303 struct crypt_priv crypt_ctx = {
304 .ctx = &ctx->crypt_ctx,
305 .fpu_enabled = false,
306 };
307 struct xts_crypt_req req = {
308 .tbuf = buf,
309 .tbuflen = sizeof(buf),
310
311 .tweak_ctx = &ctx->tweak_ctx,
312 .tweak_fn = XTS_TWEAK_CAST(__serpent_encrypt),
313 .crypt_ctx = &crypt_ctx,
314 .crypt_fn = encrypt_callback,
315 };
316 int ret;
317
318 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
319 ret = xts_crypt(desc, dst, src, nbytes, &req);
320 serpent_fpu_end(crypt_ctx.fpu_enabled);
321 361
322 return ret; 362 return glue_xts_crypt_128bit(&serpent_enc_xts, desc, dst, src, nbytes,
363 XTS_TWEAK_CAST(__serpent_encrypt),
364 &ctx->tweak_ctx, &ctx->crypt_ctx);
323} 365}
324 366
325static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 367static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
326 struct scatterlist *src, unsigned int nbytes) 368 struct scatterlist *src, unsigned int nbytes)
327{ 369{
328 struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 370 struct serpent_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
329 be128 buf[SERPENT_PARALLEL_BLOCKS];
330 struct crypt_priv crypt_ctx = {
331 .ctx = &ctx->crypt_ctx,
332 .fpu_enabled = false,
333 };
334 struct xts_crypt_req req = {
335 .tbuf = buf,
336 .tbuflen = sizeof(buf),
337
338 .tweak_ctx = &ctx->tweak_ctx,
339 .tweak_fn = XTS_TWEAK_CAST(__serpent_encrypt),
340 .crypt_ctx = &crypt_ctx,
341 .crypt_fn = decrypt_callback,
342 };
343 int ret;
344 371
345 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; 372 return glue_xts_crypt_128bit(&serpent_dec_xts, desc, dst, src, nbytes,
346 ret = xts_crypt(desc, dst, src, nbytes, &req); 373 XTS_TWEAK_CAST(__serpent_encrypt),
347 serpent_fpu_end(crypt_ctx.fpu_enabled); 374 &ctx->tweak_ctx, &ctx->crypt_ctx);
348
349 return ret;
350} 375}
351 376
352static struct crypto_alg serpent_algs[10] = { { 377static struct crypto_alg serpent_algs[10] = { {
@@ -417,7 +442,7 @@ static struct crypto_alg serpent_algs[10] = { {
417 .cra_alignmask = 0, 442 .cra_alignmask = 0,
418 .cra_type = &crypto_blkcipher_type, 443 .cra_type = &crypto_blkcipher_type,
419 .cra_module = THIS_MODULE, 444 .cra_module = THIS_MODULE,
420 .cra_exit = lrw_exit_tfm, 445 .cra_exit = lrw_serpent_exit_tfm,
421 .cra_u = { 446 .cra_u = {
422 .blkcipher = { 447 .blkcipher = {
423 .min_keysize = SERPENT_MIN_KEY_SIZE + 448 .min_keysize = SERPENT_MIN_KEY_SIZE +
diff --git a/arch/x86/crypto/sha256-avx-asm.S b/arch/x86/crypto/sha256-avx-asm.S
new file mode 100644
index 000000000000..56610c4bf31b
--- /dev/null
+++ b/arch/x86/crypto/sha256-avx-asm.S
@@ -0,0 +1,496 @@
1########################################################################
2# Implement fast SHA-256 with AVX1 instructions. (x86_64)
3#
4# Copyright (C) 2013 Intel Corporation.
5#
6# Authors:
7# James Guilford <james.guilford@intel.com>
8# Kirk Yap <kirk.s.yap@intel.com>
9# Tim Chen <tim.c.chen@linux.intel.com>
10#
11# This software is available to you under a choice of one of two
12# licenses. You may choose to be licensed under the terms of the GNU
13# General Public License (GPL) Version 2, available from the file
14# COPYING in the main directory of this source tree, or the
15# OpenIB.org BSD license below:
16#
17# Redistribution and use in source and binary forms, with or
18# without modification, are permitted provided that the following
19# conditions are met:
20#
21# - Redistributions of source code must retain the above
22# copyright notice, this list of conditions and the following
23# disclaimer.
24#
25# - Redistributions in binary form must reproduce the above
26# copyright notice, this list of conditions and the following
27# disclaimer in the documentation and/or other materials
28# provided with the distribution.
29#
30# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
34# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
35# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37# SOFTWARE.
38########################################################################
39#
40# This code is described in an Intel White-Paper:
41# "Fast SHA-256 Implementations on Intel Architecture Processors"
42#
43# To find it, surf to http://www.intel.com/p/en_US/embedded
44# and search for that title.
45#
46########################################################################
47# This code schedules 1 block at a time, with 4 lanes per block
48########################################################################
49
50#ifdef CONFIG_AS_AVX
51#include <linux/linkage.h>
52
53## assume buffers not aligned
54#define VMOVDQ vmovdqu
55
56################################ Define Macros
57
58# addm [mem], reg
59# Add reg to mem using reg-mem add and store
60.macro addm p1 p2
61 add \p1, \p2
62 mov \p2, \p1
63.endm
64
65
66.macro MY_ROR p1 p2
67 shld $(32-(\p1)), \p2, \p2
68.endm
69
70################################
71
72# COPY_XMM_AND_BSWAP xmm, [mem], byte_flip_mask
73# Load xmm with mem and byte swap each dword
74.macro COPY_XMM_AND_BSWAP p1 p2 p3
75 VMOVDQ \p2, \p1
76 vpshufb \p3, \p1, \p1
77.endm
78
79################################
80
81X0 = %xmm4
82X1 = %xmm5
83X2 = %xmm6
84X3 = %xmm7
85
86XTMP0 = %xmm0
87XTMP1 = %xmm1
88XTMP2 = %xmm2
89XTMP3 = %xmm3
90XTMP4 = %xmm8
91XFER = %xmm9
92XTMP5 = %xmm11
93
94SHUF_00BA = %xmm10 # shuffle xBxA -> 00BA
95SHUF_DC00 = %xmm12 # shuffle xDxC -> DC00
96BYTE_FLIP_MASK = %xmm13
97
98NUM_BLKS = %rdx # 3rd arg
99CTX = %rsi # 2nd arg
100INP = %rdi # 1st arg
101
102SRND = %rdi # clobbers INP
103c = %ecx
104d = %r8d
105e = %edx
106TBL = %rbp
107a = %eax
108b = %ebx
109
110f = %r9d
111g = %r10d
112h = %r11d
113
114y0 = %r13d
115y1 = %r14d
116y2 = %r15d
117
118
119_INP_END_SIZE = 8
120_INP_SIZE = 8
121_XFER_SIZE = 8
122_XMM_SAVE_SIZE = 0
123
124_INP_END = 0
125_INP = _INP_END + _INP_END_SIZE
126_XFER = _INP + _INP_SIZE
127_XMM_SAVE = _XFER + _XFER_SIZE
128STACK_SIZE = _XMM_SAVE + _XMM_SAVE_SIZE
129
130# rotate_Xs
131# Rotate values of symbols X0...X3
132.macro rotate_Xs
133X_ = X0
134X0 = X1
135X1 = X2
136X2 = X3
137X3 = X_
138.endm
139
140# ROTATE_ARGS
141# Rotate values of symbols a...h
142.macro ROTATE_ARGS
143TMP_ = h
144h = g
145g = f
146f = e
147e = d
148d = c
149c = b
150b = a
151a = TMP_
152.endm
153
154.macro FOUR_ROUNDS_AND_SCHED
155 ## compute s0 four at a time and s1 two at a time
156 ## compute W[-16] + W[-7] 4 at a time
157
158 mov e, y0 # y0 = e
159 MY_ROR (25-11), y0 # y0 = e >> (25-11)
160 mov a, y1 # y1 = a
161 vpalignr $4, X2, X3, XTMP0 # XTMP0 = W[-7]
162 MY_ROR (22-13), y1 # y1 = a >> (22-13)
163 xor e, y0 # y0 = e ^ (e >> (25-11))
164 mov f, y2 # y2 = f
165 MY_ROR (11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
166 xor a, y1 # y1 = a ^ (a >> (22-13)
167 xor g, y2 # y2 = f^g
168 vpaddd X0, XTMP0, XTMP0 # XTMP0 = W[-7] + W[-16]
169 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
170 and e, y2 # y2 = (f^g)&e
171 MY_ROR (13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
172 ## compute s0
173 vpalignr $4, X0, X1, XTMP1 # XTMP1 = W[-15]
174 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
175 MY_ROR 6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
176 xor g, y2 # y2 = CH = ((f^g)&e)^g
177 MY_ROR 2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
178 add y0, y2 # y2 = S1 + CH
179 add _XFER(%rsp), y2 # y2 = k + w + S1 + CH
180 mov a, y0 # y0 = a
181 add y2, h # h = h + S1 + CH + k + w
182 mov a, y2 # y2 = a
183 vpsrld $7, XTMP1, XTMP2
184 or c, y0 # y0 = a|c
185 add h, d # d = d + h + S1 + CH + k + w
186 and c, y2 # y2 = a&c
187 vpslld $(32-7), XTMP1, XTMP3
188 and b, y0 # y0 = (a|c)&b
189 add y1, h # h = h + S1 + CH + k + w + S0
190 vpor XTMP2, XTMP3, XTMP3 # XTMP1 = W[-15] MY_ROR 7
191 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
192 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
193 ROTATE_ARGS
194 mov e, y0 # y0 = e
195 mov a, y1 # y1 = a
196 MY_ROR (25-11), y0 # y0 = e >> (25-11)
197 xor e, y0 # y0 = e ^ (e >> (25-11))
198 mov f, y2 # y2 = f
199 MY_ROR (22-13), y1 # y1 = a >> (22-13)
200 vpsrld $18, XTMP1, XTMP2 #
201 xor a, y1 # y1 = a ^ (a >> (22-13)
202 MY_ROR (11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
203 xor g, y2 # y2 = f^g
204 vpsrld $3, XTMP1, XTMP4 # XTMP4 = W[-15] >> 3
205 MY_ROR (13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
206 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
207 and e, y2 # y2 = (f^g)&e
208 MY_ROR 6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
209 vpslld $(32-18), XTMP1, XTMP1
210 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
211 xor g, y2 # y2 = CH = ((f^g)&e)^g
212 vpxor XTMP1, XTMP3, XTMP3 #
213 add y0, y2 # y2 = S1 + CH
214 add (1*4 + _XFER)(%rsp), y2 # y2 = k + w + S1 + CH
215 MY_ROR 2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
216 vpxor XTMP2, XTMP3, XTMP3 # XTMP1 = W[-15] MY_ROR 7 ^ W[-15] MY_ROR
217 mov a, y0 # y0 = a
218 add y2, h # h = h + S1 + CH + k + w
219 mov a, y2 # y2 = a
220 vpxor XTMP4, XTMP3, XTMP1 # XTMP1 = s0
221 or c, y0 # y0 = a|c
222 add h, d # d = d + h + S1 + CH + k + w
223 and c, y2 # y2 = a&c
224 ## compute low s1
225 vpshufd $0b11111010, X3, XTMP2 # XTMP2 = W[-2] {BBAA}
226 and b, y0 # y0 = (a|c)&b
227 add y1, h # h = h + S1 + CH + k + w + S0
228 vpaddd XTMP1, XTMP0, XTMP0 # XTMP0 = W[-16] + W[-7] + s0
229 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
230 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
231 ROTATE_ARGS
232 mov e, y0 # y0 = e
233 mov a, y1 # y1 = a
234 MY_ROR (25-11), y0 # y0 = e >> (25-11)
235 xor e, y0 # y0 = e ^ (e >> (25-11))
236 MY_ROR (22-13), y1 # y1 = a >> (22-13)
237 mov f, y2 # y2 = f
238 xor a, y1 # y1 = a ^ (a >> (22-13)
239 MY_ROR (11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
240 vpsrld $10, XTMP2, XTMP4 # XTMP4 = W[-2] >> 10 {BBAA}
241 xor g, y2 # y2 = f^g
242 vpsrlq $19, XTMP2, XTMP3 # XTMP3 = W[-2] MY_ROR 19 {xBxA}
243 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
244 and e, y2 # y2 = (f^g)&e
245 vpsrlq $17, XTMP2, XTMP2 # XTMP2 = W[-2] MY_ROR 17 {xBxA}
246 MY_ROR (13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
247 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
248 xor g, y2 # y2 = CH = ((f^g)&e)^g
249 MY_ROR 6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
250 vpxor XTMP3, XTMP2, XTMP2 #
251 add y0, y2 # y2 = S1 + CH
252 MY_ROR 2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
253 add (2*4 + _XFER)(%rsp), y2 # y2 = k + w + S1 + CH
254 vpxor XTMP2, XTMP4, XTMP4 # XTMP4 = s1 {xBxA}
255 mov a, y0 # y0 = a
256 add y2, h # h = h + S1 + CH + k + w
257 mov a, y2 # y2 = a
258 vpshufb SHUF_00BA, XTMP4, XTMP4 # XTMP4 = s1 {00BA}
259 or c, y0 # y0 = a|c
260 add h, d # d = d + h + S1 + CH + k + w
261 and c, y2 # y2 = a&c
262 vpaddd XTMP4, XTMP0, XTMP0 # XTMP0 = {..., ..., W[1], W[0]}
263 and b, y0 # y0 = (a|c)&b
264 add y1, h # h = h + S1 + CH + k + w + S0
265 ## compute high s1
266 vpshufd $0b01010000, XTMP0, XTMP2 # XTMP2 = W[-2] {DDCC}
267 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
268 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
269 ROTATE_ARGS
270 mov e, y0 # y0 = e
271 MY_ROR (25-11), y0 # y0 = e >> (25-11)
272 mov a, y1 # y1 = a
273 MY_ROR (22-13), y1 # y1 = a >> (22-13)
274 xor e, y0 # y0 = e ^ (e >> (25-11))
275 mov f, y2 # y2 = f
276 MY_ROR (11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
277 vpsrld $10, XTMP2, XTMP5 # XTMP5 = W[-2] >> 10 {DDCC}
278 xor a, y1 # y1 = a ^ (a >> (22-13)
279 xor g, y2 # y2 = f^g
280 vpsrlq $19, XTMP2, XTMP3 # XTMP3 = W[-2] MY_ROR 19 {xDxC}
281 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
282 and e, y2 # y2 = (f^g)&e
283 MY_ROR (13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
284 vpsrlq $17, XTMP2, XTMP2 # XTMP2 = W[-2] MY_ROR 17 {xDxC}
285 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
286 MY_ROR 6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
287 xor g, y2 # y2 = CH = ((f^g)&e)^g
288 vpxor XTMP3, XTMP2, XTMP2
289 MY_ROR 2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
290 add y0, y2 # y2 = S1 + CH
291 add (3*4 + _XFER)(%rsp), y2 # y2 = k + w + S1 + CH
292 vpxor XTMP2, XTMP5, XTMP5 # XTMP5 = s1 {xDxC}
293 mov a, y0 # y0 = a
294 add y2, h # h = h + S1 + CH + k + w
295 mov a, y2 # y2 = a
296 vpshufb SHUF_DC00, XTMP5, XTMP5 # XTMP5 = s1 {DC00}
297 or c, y0 # y0 = a|c
298 add h, d # d = d + h + S1 + CH + k + w
299 and c, y2 # y2 = a&c
300 vpaddd XTMP0, XTMP5, X0 # X0 = {W[3], W[2], W[1], W[0]}
301 and b, y0 # y0 = (a|c)&b
302 add y1, h # h = h + S1 + CH + k + w + S0
303 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
304 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
305 ROTATE_ARGS
306 rotate_Xs
307.endm
308
309## input is [rsp + _XFER + %1 * 4]
310.macro DO_ROUND round
311 mov e, y0 # y0 = e
312 MY_ROR (25-11), y0 # y0 = e >> (25-11)
313 mov a, y1 # y1 = a
314 xor e, y0 # y0 = e ^ (e >> (25-11))
315 MY_ROR (22-13), y1 # y1 = a >> (22-13)
316 mov f, y2 # y2 = f
317 xor a, y1 # y1 = a ^ (a >> (22-13)
318 MY_ROR (11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
319 xor g, y2 # y2 = f^g
320 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
321 MY_ROR (13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
322 and e, y2 # y2 = (f^g)&e
323 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
324 MY_ROR 6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
325 xor g, y2 # y2 = CH = ((f^g)&e)^g
326 add y0, y2 # y2 = S1 + CH
327 MY_ROR 2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
328 offset = \round * 4 + _XFER #
329 add offset(%rsp), y2 # y2 = k + w + S1 + CH
330 mov a, y0 # y0 = a
331 add y2, h # h = h + S1 + CH + k + w
332 mov a, y2 # y2 = a
333 or c, y0 # y0 = a|c
334 add h, d # d = d + h + S1 + CH + k + w
335 and c, y2 # y2 = a&c
336 and b, y0 # y0 = (a|c)&b
337 add y1, h # h = h + S1 + CH + k + w + S0
338 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
339 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
340 ROTATE_ARGS
341.endm
342
343########################################################################
344## void sha256_transform_avx(void *input_data, UINT32 digest[8], UINT64 num_blks)
345## arg 1 : pointer to input data
346## arg 2 : pointer to digest
347## arg 3 : Num blocks
348########################################################################
349.text
350ENTRY(sha256_transform_avx)
351.align 32
352 pushq %rbx
353 pushq %rbp
354 pushq %r13
355 pushq %r14
356 pushq %r15
357 pushq %r12
358
359 mov %rsp, %r12
360 subq $STACK_SIZE, %rsp # allocate stack space
361 and $~15, %rsp # align stack pointer
362
363 shl $6, NUM_BLKS # convert to bytes
364 jz done_hash
365 add INP, NUM_BLKS # pointer to end of data
366 mov NUM_BLKS, _INP_END(%rsp)
367
368 ## load initial digest
369 mov 4*0(CTX), a
370 mov 4*1(CTX), b
371 mov 4*2(CTX), c
372 mov 4*3(CTX), d
373 mov 4*4(CTX), e
374 mov 4*5(CTX), f
375 mov 4*6(CTX), g
376 mov 4*7(CTX), h
377
378 vmovdqa PSHUFFLE_BYTE_FLIP_MASK(%rip), BYTE_FLIP_MASK
379 vmovdqa _SHUF_00BA(%rip), SHUF_00BA
380 vmovdqa _SHUF_DC00(%rip), SHUF_DC00
381loop0:
382 lea K256(%rip), TBL
383
384 ## byte swap first 16 dwords
385 COPY_XMM_AND_BSWAP X0, 0*16(INP), BYTE_FLIP_MASK
386 COPY_XMM_AND_BSWAP X1, 1*16(INP), BYTE_FLIP_MASK
387 COPY_XMM_AND_BSWAP X2, 2*16(INP), BYTE_FLIP_MASK
388 COPY_XMM_AND_BSWAP X3, 3*16(INP), BYTE_FLIP_MASK
389
390 mov INP, _INP(%rsp)
391
392 ## schedule 48 input dwords, by doing 3 rounds of 16 each
393 mov $3, SRND
394.align 16
395loop1:
396 vpaddd (TBL), X0, XFER
397 vmovdqa XFER, _XFER(%rsp)
398 FOUR_ROUNDS_AND_SCHED
399
400 vpaddd 1*16(TBL), X0, XFER
401 vmovdqa XFER, _XFER(%rsp)
402 FOUR_ROUNDS_AND_SCHED
403
404 vpaddd 2*16(TBL), X0, XFER
405 vmovdqa XFER, _XFER(%rsp)
406 FOUR_ROUNDS_AND_SCHED
407
408 vpaddd 3*16(TBL), X0, XFER
409 vmovdqa XFER, _XFER(%rsp)
410 add $4*16, TBL
411 FOUR_ROUNDS_AND_SCHED
412
413 sub $1, SRND
414 jne loop1
415
416 mov $2, SRND
417loop2:
418 vpaddd (TBL), X0, XFER
419 vmovdqa XFER, _XFER(%rsp)
420 DO_ROUND 0
421 DO_ROUND 1
422 DO_ROUND 2
423 DO_ROUND 3
424
425 vpaddd 1*16(TBL), X1, XFER
426 vmovdqa XFER, _XFER(%rsp)
427 add $2*16, TBL
428 DO_ROUND 0
429 DO_ROUND 1
430 DO_ROUND 2
431 DO_ROUND 3
432
433 vmovdqa X2, X0
434 vmovdqa X3, X1
435
436 sub $1, SRND
437 jne loop2
438
439 addm (4*0)(CTX),a
440 addm (4*1)(CTX),b
441 addm (4*2)(CTX),c
442 addm (4*3)(CTX),d
443 addm (4*4)(CTX),e
444 addm (4*5)(CTX),f
445 addm (4*6)(CTX),g
446 addm (4*7)(CTX),h
447
448 mov _INP(%rsp), INP
449 add $64, INP
450 cmp _INP_END(%rsp), INP
451 jne loop0
452
453done_hash:
454
455 mov %r12, %rsp
456
457 popq %r12
458 popq %r15
459 popq %r14
460 popq %r13
461 popq %rbp
462 popq %rbx
463 ret
464ENDPROC(sha256_transform_avx)
465
466.data
467.align 64
468K256:
469 .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
470 .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
471 .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
472 .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
473 .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
474 .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
475 .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
476 .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
477 .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
478 .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
479 .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
480 .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
481 .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
482 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
483 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
484 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
485
486PSHUFFLE_BYTE_FLIP_MASK:
487 .octa 0x0c0d0e0f08090a0b0405060700010203
488
489# shuffle xBxA -> 00BA
490_SHUF_00BA:
491 .octa 0xFFFFFFFFFFFFFFFF0b0a090803020100
492
493# shuffle xDxC -> DC00
494_SHUF_DC00:
495 .octa 0x0b0a090803020100FFFFFFFFFFFFFFFF
496#endif
diff --git a/arch/x86/crypto/sha256-avx2-asm.S b/arch/x86/crypto/sha256-avx2-asm.S
new file mode 100644
index 000000000000..9e86944c539d
--- /dev/null
+++ b/arch/x86/crypto/sha256-avx2-asm.S
@@ -0,0 +1,772 @@
1########################################################################
2# Implement fast SHA-256 with AVX2 instructions. (x86_64)
3#
4# Copyright (C) 2013 Intel Corporation.
5#
6# Authors:
7# James Guilford <james.guilford@intel.com>
8# Kirk Yap <kirk.s.yap@intel.com>
9# Tim Chen <tim.c.chen@linux.intel.com>
10#
11# This software is available to you under a choice of one of two
12# licenses. You may choose to be licensed under the terms of the GNU
13# General Public License (GPL) Version 2, available from the file
14# COPYING in the main directory of this source tree, or the
15# OpenIB.org BSD license below:
16#
17# Redistribution and use in source and binary forms, with or
18# without modification, are permitted provided that the following
19# conditions are met:
20#
21# - Redistributions of source code must retain the above
22# copyright notice, this list of conditions and the following
23# disclaimer.
24#
25# - Redistributions in binary form must reproduce the above
26# copyright notice, this list of conditions and the following
27# disclaimer in the documentation and/or other materials
28# provided with the distribution.
29#
30# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
34# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
35# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37# SOFTWARE.
38#
39########################################################################
40#
41# This code is described in an Intel White-Paper:
42# "Fast SHA-256 Implementations on Intel Architecture Processors"
43#
44# To find it, surf to http://www.intel.com/p/en_US/embedded
45# and search for that title.
46#
47########################################################################
48# This code schedules 2 blocks at a time, with 4 lanes per block
49########################################################################
50
51#ifdef CONFIG_AS_AVX2
52#include <linux/linkage.h>
53
54## assume buffers not aligned
55#define VMOVDQ vmovdqu
56
57################################ Define Macros
58
59# addm [mem], reg
60# Add reg to mem using reg-mem add and store
61.macro addm p1 p2
62 add \p1, \p2
63 mov \p2, \p1
64.endm
65
66################################
67
68X0 = %ymm4
69X1 = %ymm5
70X2 = %ymm6
71X3 = %ymm7
72
73# XMM versions of above
74XWORD0 = %xmm4
75XWORD1 = %xmm5
76XWORD2 = %xmm6
77XWORD3 = %xmm7
78
79XTMP0 = %ymm0
80XTMP1 = %ymm1
81XTMP2 = %ymm2
82XTMP3 = %ymm3
83XTMP4 = %ymm8
84XFER = %ymm9
85XTMP5 = %ymm11
86
87SHUF_00BA = %ymm10 # shuffle xBxA -> 00BA
88SHUF_DC00 = %ymm12 # shuffle xDxC -> DC00
89BYTE_FLIP_MASK = %ymm13
90
91X_BYTE_FLIP_MASK = %xmm13 # XMM version of BYTE_FLIP_MASK
92
93NUM_BLKS = %rdx # 3rd arg
94CTX = %rsi # 2nd arg
95INP = %rdi # 1st arg
96c = %ecx
97d = %r8d
98e = %edx # clobbers NUM_BLKS
99y3 = %edi # clobbers INP
100
101
102TBL = %rbp
103SRND = CTX # SRND is same register as CTX
104
105a = %eax
106b = %ebx
107f = %r9d
108g = %r10d
109h = %r11d
110old_h = %r11d
111
112T1 = %r12d
113y0 = %r13d
114y1 = %r14d
115y2 = %r15d
116
117
118_XFER_SIZE = 2*64*4 # 2 blocks, 64 rounds, 4 bytes/round
119_XMM_SAVE_SIZE = 0
120_INP_END_SIZE = 8
121_INP_SIZE = 8
122_CTX_SIZE = 8
123_RSP_SIZE = 8
124
125_XFER = 0
126_XMM_SAVE = _XFER + _XFER_SIZE
127_INP_END = _XMM_SAVE + _XMM_SAVE_SIZE
128_INP = _INP_END + _INP_END_SIZE
129_CTX = _INP + _INP_SIZE
130_RSP = _CTX + _CTX_SIZE
131STACK_SIZE = _RSP + _RSP_SIZE
132
133# rotate_Xs
134# Rotate values of symbols X0...X3
135.macro rotate_Xs
136 X_ = X0
137 X0 = X1
138 X1 = X2
139 X2 = X3
140 X3 = X_
141.endm
142
143# ROTATE_ARGS
144# Rotate values of symbols a...h
145.macro ROTATE_ARGS
146 old_h = h
147 TMP_ = h
148 h = g
149 g = f
150 f = e
151 e = d
152 d = c
153 c = b
154 b = a
155 a = TMP_
156.endm
157
158.macro FOUR_ROUNDS_AND_SCHED disp
159################################### RND N + 0 ############################
160
161 mov a, y3 # y3 = a # MAJA
162 rorx $25, e, y0 # y0 = e >> 25 # S1A
163 rorx $11, e, y1 # y1 = e >> 11 # S1B
164
165 addl \disp(%rsp, SRND), h # h = k + w + h # --
166 or c, y3 # y3 = a|c # MAJA
167 vpalignr $4, X2, X3, XTMP0 # XTMP0 = W[-7]
168 mov f, y2 # y2 = f # CH
169 rorx $13, a, T1 # T1 = a >> 13 # S0B
170
171 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
172 xor g, y2 # y2 = f^g # CH
173 vpaddd X0, XTMP0, XTMP0 # XTMP0 = W[-7] + W[-16]# y1 = (e >> 6)# S1
174 rorx $6, e, y1 # y1 = (e >> 6) # S1
175
176 and e, y2 # y2 = (f^g)&e # CH
177 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
178 rorx $22, a, y1 # y1 = a >> 22 # S0A
179 add h, d # d = k + w + h + d # --
180
181 and b, y3 # y3 = (a|c)&b # MAJA
182 vpalignr $4, X0, X1, XTMP1 # XTMP1 = W[-15]
183 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
184 rorx $2, a, T1 # T1 = (a >> 2) # S0
185
186 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
187 vpsrld $7, XTMP1, XTMP2
188 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
189 mov a, T1 # T1 = a # MAJB
190 and c, T1 # T1 = a&c # MAJB
191
192 add y0, y2 # y2 = S1 + CH # --
193 vpslld $(32-7), XTMP1, XTMP3
194 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
195 add y1, h # h = k + w + h + S0 # --
196
197 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
198 vpor XTMP2, XTMP3, XTMP3 # XTMP3 = W[-15] ror 7
199
200 vpsrld $18, XTMP1, XTMP2
201 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
202 add y3, h # h = t1 + S0 + MAJ # --
203
204
205 ROTATE_ARGS
206
207################################### RND N + 1 ############################
208
209 mov a, y3 # y3 = a # MAJA
210 rorx $25, e, y0 # y0 = e >> 25 # S1A
211 rorx $11, e, y1 # y1 = e >> 11 # S1B
212 offset = \disp + 1*4
213 addl offset(%rsp, SRND), h # h = k + w + h # --
214 or c, y3 # y3 = a|c # MAJA
215
216
217 vpsrld $3, XTMP1, XTMP4 # XTMP4 = W[-15] >> 3
218 mov f, y2 # y2 = f # CH
219 rorx $13, a, T1 # T1 = a >> 13 # S0B
220 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
221 xor g, y2 # y2 = f^g # CH
222
223
224 rorx $6, e, y1 # y1 = (e >> 6) # S1
225 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
226 rorx $22, a, y1 # y1 = a >> 22 # S0A
227 and e, y2 # y2 = (f^g)&e # CH
228 add h, d # d = k + w + h + d # --
229
230 vpslld $(32-18), XTMP1, XTMP1
231 and b, y3 # y3 = (a|c)&b # MAJA
232 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
233
234 vpxor XTMP1, XTMP3, XTMP3
235 rorx $2, a, T1 # T1 = (a >> 2) # S0
236 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
237
238 vpxor XTMP2, XTMP3, XTMP3 # XTMP3 = W[-15] ror 7 ^ W[-15] ror 18
239 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
240 mov a, T1 # T1 = a # MAJB
241 and c, T1 # T1 = a&c # MAJB
242 add y0, y2 # y2 = S1 + CH # --
243
244 vpxor XTMP4, XTMP3, XTMP1 # XTMP1 = s0
245 vpshufd $0b11111010, X3, XTMP2 # XTMP2 = W[-2] {BBAA}
246 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
247 add y1, h # h = k + w + h + S0 # --
248
249 vpaddd XTMP1, XTMP0, XTMP0 # XTMP0 = W[-16] + W[-7] + s0
250 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
251 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
252 add y3, h # h = t1 + S0 + MAJ # --
253
254 vpsrld $10, XTMP2, XTMP4 # XTMP4 = W[-2] >> 10 {BBAA}
255
256
257 ROTATE_ARGS
258
259################################### RND N + 2 ############################
260
261 mov a, y3 # y3 = a # MAJA
262 rorx $25, e, y0 # y0 = e >> 25 # S1A
263 offset = \disp + 2*4
264 addl offset(%rsp, SRND), h # h = k + w + h # --
265
266 vpsrlq $19, XTMP2, XTMP3 # XTMP3 = W[-2] ror 19 {xBxA}
267 rorx $11, e, y1 # y1 = e >> 11 # S1B
268 or c, y3 # y3 = a|c # MAJA
269 mov f, y2 # y2 = f # CH
270 xor g, y2 # y2 = f^g # CH
271
272 rorx $13, a, T1 # T1 = a >> 13 # S0B
273 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
274 vpsrlq $17, XTMP2, XTMP2 # XTMP2 = W[-2] ror 17 {xBxA}
275 and e, y2 # y2 = (f^g)&e # CH
276
277 rorx $6, e, y1 # y1 = (e >> 6) # S1
278 vpxor XTMP3, XTMP2, XTMP2
279 add h, d # d = k + w + h + d # --
280 and b, y3 # y3 = (a|c)&b # MAJA
281
282 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
283 rorx $22, a, y1 # y1 = a >> 22 # S0A
284 vpxor XTMP2, XTMP4, XTMP4 # XTMP4 = s1 {xBxA}
285 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
286
287 vpshufb SHUF_00BA, XTMP4, XTMP4 # XTMP4 = s1 {00BA}
288 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
289 rorx $2, a ,T1 # T1 = (a >> 2) # S0
290 vpaddd XTMP4, XTMP0, XTMP0 # XTMP0 = {..., ..., W[1], W[0]}
291
292 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
293 mov a, T1 # T1 = a # MAJB
294 and c, T1 # T1 = a&c # MAJB
295 add y0, y2 # y2 = S1 + CH # --
296 vpshufd $0b01010000, XTMP0, XTMP2 # XTMP2 = W[-2] {DDCC}
297
298 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
299 add y1,h # h = k + w + h + S0 # --
300 add y2,d # d = k + w + h + d + S1 + CH = d + t1 # --
301 add y2,h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
302
303 add y3,h # h = t1 + S0 + MAJ # --
304
305
306 ROTATE_ARGS
307
308################################### RND N + 3 ############################
309
310 mov a, y3 # y3 = a # MAJA
311 rorx $25, e, y0 # y0 = e >> 25 # S1A
312 rorx $11, e, y1 # y1 = e >> 11 # S1B
313 offset = \disp + 3*4
314 addl offset(%rsp, SRND), h # h = k + w + h # --
315 or c, y3 # y3 = a|c # MAJA
316
317
318 vpsrld $10, XTMP2, XTMP5 # XTMP5 = W[-2] >> 10 {DDCC}
319 mov f, y2 # y2 = f # CH
320 rorx $13, a, T1 # T1 = a >> 13 # S0B
321 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
322 xor g, y2 # y2 = f^g # CH
323
324
325 vpsrlq $19, XTMP2, XTMP3 # XTMP3 = W[-2] ror 19 {xDxC}
326 rorx $6, e, y1 # y1 = (e >> 6) # S1
327 and e, y2 # y2 = (f^g)&e # CH
328 add h, d # d = k + w + h + d # --
329 and b, y3 # y3 = (a|c)&b # MAJA
330
331 vpsrlq $17, XTMP2, XTMP2 # XTMP2 = W[-2] ror 17 {xDxC}
332 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
333 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
334
335 vpxor XTMP3, XTMP2, XTMP2
336 rorx $22, a, y1 # y1 = a >> 22 # S0A
337 add y0, y2 # y2 = S1 + CH # --
338
339 vpxor XTMP2, XTMP5, XTMP5 # XTMP5 = s1 {xDxC}
340 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
341 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
342
343 rorx $2, a, T1 # T1 = (a >> 2) # S0
344 vpshufb SHUF_DC00, XTMP5, XTMP5 # XTMP5 = s1 {DC00}
345
346 vpaddd XTMP0, XTMP5, X0 # X0 = {W[3], W[2], W[1], W[0]}
347 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
348 mov a, T1 # T1 = a # MAJB
349 and c, T1 # T1 = a&c # MAJB
350 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
351
352 add y1, h # h = k + w + h + S0 # --
353 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
354 add y3, h # h = t1 + S0 + MAJ # --
355
356 ROTATE_ARGS
357 rotate_Xs
358.endm
359
360.macro DO_4ROUNDS disp
361################################### RND N + 0 ###########################
362
363 mov f, y2 # y2 = f # CH
364 rorx $25, e, y0 # y0 = e >> 25 # S1A
365 rorx $11, e, y1 # y1 = e >> 11 # S1B
366 xor g, y2 # y2 = f^g # CH
367
368 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
369 rorx $6, e, y1 # y1 = (e >> 6) # S1
370 and e, y2 # y2 = (f^g)&e # CH
371
372 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
373 rorx $13, a, T1 # T1 = a >> 13 # S0B
374 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
375 rorx $22, a, y1 # y1 = a >> 22 # S0A
376 mov a, y3 # y3 = a # MAJA
377
378 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
379 rorx $2, a, T1 # T1 = (a >> 2) # S0
380 addl \disp(%rsp, SRND), h # h = k + w + h # --
381 or c, y3 # y3 = a|c # MAJA
382
383 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
384 mov a, T1 # T1 = a # MAJB
385 and b, y3 # y3 = (a|c)&b # MAJA
386 and c, T1 # T1 = a&c # MAJB
387 add y0, y2 # y2 = S1 + CH # --
388
389
390 add h, d # d = k + w + h + d # --
391 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
392 add y1, h # h = k + w + h + S0 # --
393 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
394
395 ROTATE_ARGS
396
397################################### RND N + 1 ###########################
398
399 add y2, old_h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
400 mov f, y2 # y2 = f # CH
401 rorx $25, e, y0 # y0 = e >> 25 # S1A
402 rorx $11, e, y1 # y1 = e >> 11 # S1B
403 xor g, y2 # y2 = f^g # CH
404
405 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
406 rorx $6, e, y1 # y1 = (e >> 6) # S1
407 and e, y2 # y2 = (f^g)&e # CH
408 add y3, old_h # h = t1 + S0 + MAJ # --
409
410 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
411 rorx $13, a, T1 # T1 = a >> 13 # S0B
412 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
413 rorx $22, a, y1 # y1 = a >> 22 # S0A
414 mov a, y3 # y3 = a # MAJA
415
416 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
417 rorx $2, a, T1 # T1 = (a >> 2) # S0
418 offset = 4*1 + \disp
419 addl offset(%rsp, SRND), h # h = k + w + h # --
420 or c, y3 # y3 = a|c # MAJA
421
422 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
423 mov a, T1 # T1 = a # MAJB
424 and b, y3 # y3 = (a|c)&b # MAJA
425 and c, T1 # T1 = a&c # MAJB
426 add y0, y2 # y2 = S1 + CH # --
427
428
429 add h, d # d = k + w + h + d # --
430 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
431 add y1, h # h = k + w + h + S0 # --
432
433 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
434
435 ROTATE_ARGS
436
437################################### RND N + 2 ##############################
438
439 add y2, old_h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
440 mov f, y2 # y2 = f # CH
441 rorx $25, e, y0 # y0 = e >> 25 # S1A
442 rorx $11, e, y1 # y1 = e >> 11 # S1B
443 xor g, y2 # y2 = f^g # CH
444
445 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
446 rorx $6, e, y1 # y1 = (e >> 6) # S1
447 and e, y2 # y2 = (f^g)&e # CH
448 add y3, old_h # h = t1 + S0 + MAJ # --
449
450 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
451 rorx $13, a, T1 # T1 = a >> 13 # S0B
452 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
453 rorx $22, a, y1 # y1 = a >> 22 # S0A
454 mov a, y3 # y3 = a # MAJA
455
456 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
457 rorx $2, a, T1 # T1 = (a >> 2) # S0
458 offset = 4*2 + \disp
459 addl offset(%rsp, SRND), h # h = k + w + h # --
460 or c, y3 # y3 = a|c # MAJA
461
462 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
463 mov a, T1 # T1 = a # MAJB
464 and b, y3 # y3 = (a|c)&b # MAJA
465 and c, T1 # T1 = a&c # MAJB
466 add y0, y2 # y2 = S1 + CH # --
467
468
469 add h, d # d = k + w + h + d # --
470 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
471 add y1, h # h = k + w + h + S0 # --
472
473 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
474
475 ROTATE_ARGS
476
477################################### RND N + 3 ###########################
478
479 add y2, old_h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
480 mov f, y2 # y2 = f # CH
481 rorx $25, e, y0 # y0 = e >> 25 # S1A
482 rorx $11, e, y1 # y1 = e >> 11 # S1B
483 xor g, y2 # y2 = f^g # CH
484
485 xor y1, y0 # y0 = (e>>25) ^ (e>>11) # S1
486 rorx $6, e, y1 # y1 = (e >> 6) # S1
487 and e, y2 # y2 = (f^g)&e # CH
488 add y3, old_h # h = t1 + S0 + MAJ # --
489
490 xor y1, y0 # y0 = (e>>25) ^ (e>>11) ^ (e>>6) # S1
491 rorx $13, a, T1 # T1 = a >> 13 # S0B
492 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
493 rorx $22, a, y1 # y1 = a >> 22 # S0A
494 mov a, y3 # y3 = a # MAJA
495
496 xor T1, y1 # y1 = (a>>22) ^ (a>>13) # S0
497 rorx $2, a, T1 # T1 = (a >> 2) # S0
498 offset = 4*3 + \disp
499 addl offset(%rsp, SRND), h # h = k + w + h # --
500 or c, y3 # y3 = a|c # MAJA
501
502 xor T1, y1 # y1 = (a>>22) ^ (a>>13) ^ (a>>2) # S0
503 mov a, T1 # T1 = a # MAJB
504 and b, y3 # y3 = (a|c)&b # MAJA
505 and c, T1 # T1 = a&c # MAJB
506 add y0, y2 # y2 = S1 + CH # --
507
508
509 add h, d # d = k + w + h + d # --
510 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
511 add y1, h # h = k + w + h + S0 # --
512
513 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
514
515
516 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
517
518 add y3, h # h = t1 + S0 + MAJ # --
519
520 ROTATE_ARGS
521
522.endm
523
524########################################################################
525## void sha256_transform_rorx(void *input_data, UINT32 digest[8], UINT64 num_blks)
526## arg 1 : pointer to input data
527## arg 2 : pointer to digest
528## arg 3 : Num blocks
529########################################################################
530.text
531ENTRY(sha256_transform_rorx)
532.align 32
533 pushq %rbx
534 pushq %rbp
535 pushq %r12
536 pushq %r13
537 pushq %r14
538 pushq %r15
539
540 mov %rsp, %rax
541 subq $STACK_SIZE, %rsp
542 and $-32, %rsp # align rsp to 32 byte boundary
543 mov %rax, _RSP(%rsp)
544
545
546 shl $6, NUM_BLKS # convert to bytes
547 jz done_hash
548 lea -64(INP, NUM_BLKS), NUM_BLKS # pointer to last block
549 mov NUM_BLKS, _INP_END(%rsp)
550
551 cmp NUM_BLKS, INP
552 je only_one_block
553
554 ## load initial digest
555 mov (CTX), a
556 mov 4*1(CTX), b
557 mov 4*2(CTX), c
558 mov 4*3(CTX), d
559 mov 4*4(CTX), e
560 mov 4*5(CTX), f
561 mov 4*6(CTX), g
562 mov 4*7(CTX), h
563
564 vmovdqa PSHUFFLE_BYTE_FLIP_MASK(%rip), BYTE_FLIP_MASK
565 vmovdqa _SHUF_00BA(%rip), SHUF_00BA
566 vmovdqa _SHUF_DC00(%rip), SHUF_DC00
567
568 mov CTX, _CTX(%rsp)
569
570loop0:
571 lea K256(%rip), TBL
572
573 ## Load first 16 dwords from two blocks
574 VMOVDQ 0*32(INP),XTMP0
575 VMOVDQ 1*32(INP),XTMP1
576 VMOVDQ 2*32(INP),XTMP2
577 VMOVDQ 3*32(INP),XTMP3
578
579 ## byte swap data
580 vpshufb BYTE_FLIP_MASK, XTMP0, XTMP0
581 vpshufb BYTE_FLIP_MASK, XTMP1, XTMP1
582 vpshufb BYTE_FLIP_MASK, XTMP2, XTMP2
583 vpshufb BYTE_FLIP_MASK, XTMP3, XTMP3
584
585 ## transpose data into high/low halves
586 vperm2i128 $0x20, XTMP2, XTMP0, X0
587 vperm2i128 $0x31, XTMP2, XTMP0, X1
588 vperm2i128 $0x20, XTMP3, XTMP1, X2
589 vperm2i128 $0x31, XTMP3, XTMP1, X3
590
591last_block_enter:
592 add $64, INP
593 mov INP, _INP(%rsp)
594
595 ## schedule 48 input dwords, by doing 3 rounds of 12 each
596 xor SRND, SRND
597
598.align 16
599loop1:
600 vpaddd 0*32(TBL, SRND), X0, XFER
601 vmovdqa XFER, 0*32+_XFER(%rsp, SRND)
602 FOUR_ROUNDS_AND_SCHED _XFER + 0*32
603
604 vpaddd 1*32(TBL, SRND), X0, XFER
605 vmovdqa XFER, 1*32+_XFER(%rsp, SRND)
606 FOUR_ROUNDS_AND_SCHED _XFER + 1*32
607
608 vpaddd 2*32(TBL, SRND), X0, XFER
609 vmovdqa XFER, 2*32+_XFER(%rsp, SRND)
610 FOUR_ROUNDS_AND_SCHED _XFER + 2*32
611
612 vpaddd 3*32(TBL, SRND), X0, XFER
613 vmovdqa XFER, 3*32+_XFER(%rsp, SRND)
614 FOUR_ROUNDS_AND_SCHED _XFER + 3*32
615
616 add $4*32, SRND
617 cmp $3*4*32, SRND
618 jb loop1
619
620loop2:
621 ## Do last 16 rounds with no scheduling
622 vpaddd 0*32(TBL, SRND), X0, XFER
623 vmovdqa XFER, 0*32+_XFER(%rsp, SRND)
624 DO_4ROUNDS _XFER + 0*32
625 vpaddd 1*32(TBL, SRND), X1, XFER
626 vmovdqa XFER, 1*32+_XFER(%rsp, SRND)
627 DO_4ROUNDS _XFER + 1*32
628 add $2*32, SRND
629
630 vmovdqa X2, X0
631 vmovdqa X3, X1
632
633 cmp $4*4*32, SRND
634 jb loop2
635
636 mov _CTX(%rsp), CTX
637 mov _INP(%rsp), INP
638
639 addm (4*0)(CTX),a
640 addm (4*1)(CTX),b
641 addm (4*2)(CTX),c
642 addm (4*3)(CTX),d
643 addm (4*4)(CTX),e
644 addm (4*5)(CTX),f
645 addm (4*6)(CTX),g
646 addm (4*7)(CTX),h
647
648 cmp _INP_END(%rsp), INP
649 ja done_hash
650
651 #### Do second block using previously scheduled results
652 xor SRND, SRND
653.align 16
654loop3:
655 DO_4ROUNDS _XFER + 0*32 + 16
656 DO_4ROUNDS _XFER + 1*32 + 16
657 add $2*32, SRND
658 cmp $4*4*32, SRND
659 jb loop3
660
661 mov _CTX(%rsp), CTX
662 mov _INP(%rsp), INP
663 add $64, INP
664
665 addm (4*0)(CTX),a
666 addm (4*1)(CTX),b
667 addm (4*2)(CTX),c
668 addm (4*3)(CTX),d
669 addm (4*4)(CTX),e
670 addm (4*5)(CTX),f
671 addm (4*6)(CTX),g
672 addm (4*7)(CTX),h
673
674 cmp _INP_END(%rsp), INP
675 jb loop0
676 ja done_hash
677
678do_last_block:
679 #### do last block
680 lea K256(%rip), TBL
681
682 VMOVDQ 0*16(INP),XWORD0
683 VMOVDQ 1*16(INP),XWORD1
684 VMOVDQ 2*16(INP),XWORD2
685 VMOVDQ 3*16(INP),XWORD3
686
687 vpshufb X_BYTE_FLIP_MASK, XWORD0, XWORD0
688 vpshufb X_BYTE_FLIP_MASK, XWORD1, XWORD1
689 vpshufb X_BYTE_FLIP_MASK, XWORD2, XWORD2
690 vpshufb X_BYTE_FLIP_MASK, XWORD3, XWORD3
691
692 jmp last_block_enter
693
694only_one_block:
695
696 ## load initial digest
697 mov (4*0)(CTX),a
698 mov (4*1)(CTX),b
699 mov (4*2)(CTX),c
700 mov (4*3)(CTX),d
701 mov (4*4)(CTX),e
702 mov (4*5)(CTX),f
703 mov (4*6)(CTX),g
704 mov (4*7)(CTX),h
705
706 vmovdqa PSHUFFLE_BYTE_FLIP_MASK(%rip), BYTE_FLIP_MASK
707 vmovdqa _SHUF_00BA(%rip), SHUF_00BA
708 vmovdqa _SHUF_DC00(%rip), SHUF_DC00
709
710 mov CTX, _CTX(%rsp)
711 jmp do_last_block
712
713done_hash:
714
715 mov _RSP(%rsp), %rsp
716
717 popq %r15
718 popq %r14
719 popq %r13
720 popq %r12
721 popq %rbp
722 popq %rbx
723 ret
724ENDPROC(sha256_transform_rorx)
725
726.data
727.align 64
728K256:
729 .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
730 .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
731 .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
732 .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
733 .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
734 .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
735 .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
736 .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
737 .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
738 .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
739 .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
740 .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
741 .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
742 .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
743 .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
744 .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
745 .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
746 .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
747 .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
748 .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
749 .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
750 .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
751 .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
752 .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
753 .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
754 .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
755 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
756 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
757 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
758 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
759 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
760 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
761
762PSHUFFLE_BYTE_FLIP_MASK:
763 .octa 0x0c0d0e0f08090a0b0405060700010203,0x0c0d0e0f08090a0b0405060700010203
764
765# shuffle xBxA -> 00BA
766_SHUF_00BA:
767 .octa 0xFFFFFFFFFFFFFFFF0b0a090803020100,0xFFFFFFFFFFFFFFFF0b0a090803020100
768
769# shuffle xDxC -> DC00
770_SHUF_DC00:
771 .octa 0x0b0a090803020100FFFFFFFFFFFFFFFF,0x0b0a090803020100FFFFFFFFFFFFFFFF
772#endif
diff --git a/arch/x86/crypto/sha256-ssse3-asm.S b/arch/x86/crypto/sha256-ssse3-asm.S
new file mode 100644
index 000000000000..98d3c391da81
--- /dev/null
+++ b/arch/x86/crypto/sha256-ssse3-asm.S
@@ -0,0 +1,506 @@
1########################################################################
2# Implement fast SHA-256 with SSSE3 instructions. (x86_64)
3#
4# Copyright (C) 2013 Intel Corporation.
5#
6# Authors:
7# James Guilford <james.guilford@intel.com>
8# Kirk Yap <kirk.s.yap@intel.com>
9# Tim Chen <tim.c.chen@linux.intel.com>
10#
11# This software is available to you under a choice of one of two
12# licenses. You may choose to be licensed under the terms of the GNU
13# General Public License (GPL) Version 2, available from the file
14# COPYING in the main directory of this source tree, or the
15# OpenIB.org BSD license below:
16#
17# Redistribution and use in source and binary forms, with or
18# without modification, are permitted provided that the following
19# conditions are met:
20#
21# - Redistributions of source code must retain the above
22# copyright notice, this list of conditions and the following
23# disclaimer.
24#
25# - Redistributions in binary form must reproduce the above
26# copyright notice, this list of conditions and the following
27# disclaimer in the documentation and/or other materials
28# provided with the distribution.
29#
30# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
34# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
35# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37# SOFTWARE.
38#
39########################################################################
40#
41# This code is described in an Intel White-Paper:
42# "Fast SHA-256 Implementations on Intel Architecture Processors"
43#
44# To find it, surf to http://www.intel.com/p/en_US/embedded
45# and search for that title.
46#
47########################################################################
48
49#include <linux/linkage.h>
50
51## assume buffers not aligned
52#define MOVDQ movdqu
53
54################################ Define Macros
55
56# addm [mem], reg
57# Add reg to mem using reg-mem add and store
58.macro addm p1 p2
59 add \p1, \p2
60 mov \p2, \p1
61.endm
62
63################################
64
65# COPY_XMM_AND_BSWAP xmm, [mem], byte_flip_mask
66# Load xmm with mem and byte swap each dword
67.macro COPY_XMM_AND_BSWAP p1 p2 p3
68 MOVDQ \p2, \p1
69 pshufb \p3, \p1
70.endm
71
72################################
73
74X0 = %xmm4
75X1 = %xmm5
76X2 = %xmm6
77X3 = %xmm7
78
79XTMP0 = %xmm0
80XTMP1 = %xmm1
81XTMP2 = %xmm2
82XTMP3 = %xmm3
83XTMP4 = %xmm8
84XFER = %xmm9
85
86SHUF_00BA = %xmm10 # shuffle xBxA -> 00BA
87SHUF_DC00 = %xmm11 # shuffle xDxC -> DC00
88BYTE_FLIP_MASK = %xmm12
89
90NUM_BLKS = %rdx # 3rd arg
91CTX = %rsi # 2nd arg
92INP = %rdi # 1st arg
93
94SRND = %rdi # clobbers INP
95c = %ecx
96d = %r8d
97e = %edx
98TBL = %rbp
99a = %eax
100b = %ebx
101
102f = %r9d
103g = %r10d
104h = %r11d
105
106y0 = %r13d
107y1 = %r14d
108y2 = %r15d
109
110
111
112_INP_END_SIZE = 8
113_INP_SIZE = 8
114_XFER_SIZE = 8
115_XMM_SAVE_SIZE = 0
116
117_INP_END = 0
118_INP = _INP_END + _INP_END_SIZE
119_XFER = _INP + _INP_SIZE
120_XMM_SAVE = _XFER + _XFER_SIZE
121STACK_SIZE = _XMM_SAVE + _XMM_SAVE_SIZE
122
123# rotate_Xs
124# Rotate values of symbols X0...X3
125.macro rotate_Xs
126X_ = X0
127X0 = X1
128X1 = X2
129X2 = X3
130X3 = X_
131.endm
132
133# ROTATE_ARGS
134# Rotate values of symbols a...h
135.macro ROTATE_ARGS
136TMP_ = h
137h = g
138g = f
139f = e
140e = d
141d = c
142c = b
143b = a
144a = TMP_
145.endm
146
147.macro FOUR_ROUNDS_AND_SCHED
148 ## compute s0 four at a time and s1 two at a time
149 ## compute W[-16] + W[-7] 4 at a time
150 movdqa X3, XTMP0
151 mov e, y0 # y0 = e
152 ror $(25-11), y0 # y0 = e >> (25-11)
153 mov a, y1 # y1 = a
154 palignr $4, X2, XTMP0 # XTMP0 = W[-7]
155 ror $(22-13), y1 # y1 = a >> (22-13)
156 xor e, y0 # y0 = e ^ (e >> (25-11))
157 mov f, y2 # y2 = f
158 ror $(11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
159 movdqa X1, XTMP1
160 xor a, y1 # y1 = a ^ (a >> (22-13)
161 xor g, y2 # y2 = f^g
162 paddd X0, XTMP0 # XTMP0 = W[-7] + W[-16]
163 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
164 and e, y2 # y2 = (f^g)&e
165 ror $(13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
166 ## compute s0
167 palignr $4, X0, XTMP1 # XTMP1 = W[-15]
168 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
169 ror $6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
170 xor g, y2 # y2 = CH = ((f^g)&e)^g
171 movdqa XTMP1, XTMP2 # XTMP2 = W[-15]
172 ror $2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
173 add y0, y2 # y2 = S1 + CH
174 add _XFER(%rsp) , y2 # y2 = k + w + S1 + CH
175 movdqa XTMP1, XTMP3 # XTMP3 = W[-15]
176 mov a, y0 # y0 = a
177 add y2, h # h = h + S1 + CH + k + w
178 mov a, y2 # y2 = a
179 pslld $(32-7), XTMP1 #
180 or c, y0 # y0 = a|c
181 add h, d # d = d + h + S1 + CH + k + w
182 and c, y2 # y2 = a&c
183 psrld $7, XTMP2 #
184 and b, y0 # y0 = (a|c)&b
185 add y1, h # h = h + S1 + CH + k + w + S0
186 por XTMP2, XTMP1 # XTMP1 = W[-15] ror 7
187 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
188 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
189 #
190 ROTATE_ARGS #
191 movdqa XTMP3, XTMP2 # XTMP2 = W[-15]
192 mov e, y0 # y0 = e
193 mov a, y1 # y1 = a
194 movdqa XTMP3, XTMP4 # XTMP4 = W[-15]
195 ror $(25-11), y0 # y0 = e >> (25-11)
196 xor e, y0 # y0 = e ^ (e >> (25-11))
197 mov f, y2 # y2 = f
198 ror $(22-13), y1 # y1 = a >> (22-13)
199 pslld $(32-18), XTMP3 #
200 xor a, y1 # y1 = a ^ (a >> (22-13)
201 ror $(11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
202 xor g, y2 # y2 = f^g
203 psrld $18, XTMP2 #
204 ror $(13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
205 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
206 and e, y2 # y2 = (f^g)&e
207 ror $6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
208 pxor XTMP3, XTMP1
209 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
210 xor g, y2 # y2 = CH = ((f^g)&e)^g
211 psrld $3, XTMP4 # XTMP4 = W[-15] >> 3
212 add y0, y2 # y2 = S1 + CH
213 add (1*4 + _XFER)(%rsp), y2 # y2 = k + w + S1 + CH
214 ror $2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
215 pxor XTMP2, XTMP1 # XTMP1 = W[-15] ror 7 ^ W[-15] ror 18
216 mov a, y0 # y0 = a
217 add y2, h # h = h + S1 + CH + k + w
218 mov a, y2 # y2 = a
219 pxor XTMP4, XTMP1 # XTMP1 = s0
220 or c, y0 # y0 = a|c
221 add h, d # d = d + h + S1 + CH + k + w
222 and c, y2 # y2 = a&c
223 ## compute low s1
224 pshufd $0b11111010, X3, XTMP2 # XTMP2 = W[-2] {BBAA}
225 and b, y0 # y0 = (a|c)&b
226 add y1, h # h = h + S1 + CH + k + w + S0
227 paddd XTMP1, XTMP0 # XTMP0 = W[-16] + W[-7] + s0
228 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
229 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
230
231 ROTATE_ARGS
232 movdqa XTMP2, XTMP3 # XTMP3 = W[-2] {BBAA}
233 mov e, y0 # y0 = e
234 mov a, y1 # y1 = a
235 ror $(25-11), y0 # y0 = e >> (25-11)
236 movdqa XTMP2, XTMP4 # XTMP4 = W[-2] {BBAA}
237 xor e, y0 # y0 = e ^ (e >> (25-11))
238 ror $(22-13), y1 # y1 = a >> (22-13)
239 mov f, y2 # y2 = f
240 xor a, y1 # y1 = a ^ (a >> (22-13)
241 ror $(11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
242 psrlq $17, XTMP2 # XTMP2 = W[-2] ror 17 {xBxA}
243 xor g, y2 # y2 = f^g
244 psrlq $19, XTMP3 # XTMP3 = W[-2] ror 19 {xBxA}
245 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
246 and e, y2 # y2 = (f^g)&e
247 psrld $10, XTMP4 # XTMP4 = W[-2] >> 10 {BBAA}
248 ror $(13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
249 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
250 xor g, y2 # y2 = CH = ((f^g)&e)^g
251 ror $6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
252 pxor XTMP3, XTMP2
253 add y0, y2 # y2 = S1 + CH
254 ror $2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
255 add (2*4 + _XFER)(%rsp), y2 # y2 = k + w + S1 + CH
256 pxor XTMP2, XTMP4 # XTMP4 = s1 {xBxA}
257 mov a, y0 # y0 = a
258 add y2, h # h = h + S1 + CH + k + w
259 mov a, y2 # y2 = a
260 pshufb SHUF_00BA, XTMP4 # XTMP4 = s1 {00BA}
261 or c, y0 # y0 = a|c
262 add h, d # d = d + h + S1 + CH + k + w
263 and c, y2 # y2 = a&c
264 paddd XTMP4, XTMP0 # XTMP0 = {..., ..., W[1], W[0]}
265 and b, y0 # y0 = (a|c)&b
266 add y1, h # h = h + S1 + CH + k + w + S0
267 ## compute high s1
268 pshufd $0b01010000, XTMP0, XTMP2 # XTMP2 = W[-2] {BBAA}
269 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
270 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
271 #
272 ROTATE_ARGS #
273 movdqa XTMP2, XTMP3 # XTMP3 = W[-2] {DDCC}
274 mov e, y0 # y0 = e
275 ror $(25-11), y0 # y0 = e >> (25-11)
276 mov a, y1 # y1 = a
277 movdqa XTMP2, X0 # X0 = W[-2] {DDCC}
278 ror $(22-13), y1 # y1 = a >> (22-13)
279 xor e, y0 # y0 = e ^ (e >> (25-11))
280 mov f, y2 # y2 = f
281 ror $(11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
282 psrlq $17, XTMP2 # XTMP2 = W[-2] ror 17 {xDxC}
283 xor a, y1 # y1 = a ^ (a >> (22-13)
284 xor g, y2 # y2 = f^g
285 psrlq $19, XTMP3 # XTMP3 = W[-2] ror 19 {xDxC}
286 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25
287 and e, y2 # y2 = (f^g)&e
288 ror $(13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
289 psrld $10, X0 # X0 = W[-2] >> 10 {DDCC}
290 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22
291 ror $6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>2
292 xor g, y2 # y2 = CH = ((f^g)&e)^g
293 pxor XTMP3, XTMP2 #
294 ror $2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>2
295 add y0, y2 # y2 = S1 + CH
296 add (3*4 + _XFER)(%rsp), y2 # y2 = k + w + S1 + CH
297 pxor XTMP2, X0 # X0 = s1 {xDxC}
298 mov a, y0 # y0 = a
299 add y2, h # h = h + S1 + CH + k + w
300 mov a, y2 # y2 = a
301 pshufb SHUF_DC00, X0 # X0 = s1 {DC00}
302 or c, y0 # y0 = a|c
303 add h, d # d = d + h + S1 + CH + k + w
304 and c, y2 # y2 = a&c
305 paddd XTMP0, X0 # X0 = {W[3], W[2], W[1], W[0]}
306 and b, y0 # y0 = (a|c)&b
307 add y1, h # h = h + S1 + CH + k + w + S0
308 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
309 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
310
311 ROTATE_ARGS
312 rotate_Xs
313.endm
314
315## input is [rsp + _XFER + %1 * 4]
316.macro DO_ROUND round
317 mov e, y0 # y0 = e
318 ror $(25-11), y0 # y0 = e >> (25-11)
319 mov a, y1 # y1 = a
320 xor e, y0 # y0 = e ^ (e >> (25-11))
321 ror $(22-13), y1 # y1 = a >> (22-13)
322 mov f, y2 # y2 = f
323 xor a, y1 # y1 = a ^ (a >> (22-13)
324 ror $(11-6), y0 # y0 = (e >> (11-6)) ^ (e >> (25-6))
325 xor g, y2 # y2 = f^g
326 xor e, y0 # y0 = e ^ (e >> (11-6)) ^ (e >> (25-6))
327 ror $(13-2), y1 # y1 = (a >> (13-2)) ^ (a >> (22-2))
328 and e, y2 # y2 = (f^g)&e
329 xor a, y1 # y1 = a ^ (a >> (13-2)) ^ (a >> (22-2))
330 ror $6, y0 # y0 = S1 = (e>>6) & (e>>11) ^ (e>>25)
331 xor g, y2 # y2 = CH = ((f^g)&e)^g
332 add y0, y2 # y2 = S1 + CH
333 ror $2, y1 # y1 = S0 = (a>>2) ^ (a>>13) ^ (a>>22)
334 offset = \round * 4 + _XFER
335 add offset(%rsp), y2 # y2 = k + w + S1 + CH
336 mov a, y0 # y0 = a
337 add y2, h # h = h + S1 + CH + k + w
338 mov a, y2 # y2 = a
339 or c, y0 # y0 = a|c
340 add h, d # d = d + h + S1 + CH + k + w
341 and c, y2 # y2 = a&c
342 and b, y0 # y0 = (a|c)&b
343 add y1, h # h = h + S1 + CH + k + w + S0
344 or y2, y0 # y0 = MAJ = (a|c)&b)|(a&c)
345 add y0, h # h = h + S1 + CH + k + w + S0 + MAJ
346 ROTATE_ARGS
347.endm
348
349########################################################################
350## void sha256_transform_ssse3(void *input_data, UINT32 digest[8], UINT64 num_blks)
351## arg 1 : pointer to input data
352## arg 2 : pointer to digest
353## arg 3 : Num blocks
354########################################################################
355.text
356ENTRY(sha256_transform_ssse3)
357.align 32
358 pushq %rbx
359 pushq %rbp
360 pushq %r13
361 pushq %r14
362 pushq %r15
363 pushq %r12
364
365 mov %rsp, %r12
366 subq $STACK_SIZE, %rsp
367 and $~15, %rsp
368
369 shl $6, NUM_BLKS # convert to bytes
370 jz done_hash
371 add INP, NUM_BLKS
372 mov NUM_BLKS, _INP_END(%rsp) # pointer to end of data
373
374 ## load initial digest
375 mov 4*0(CTX), a
376 mov 4*1(CTX), b
377 mov 4*2(CTX), c
378 mov 4*3(CTX), d
379 mov 4*4(CTX), e
380 mov 4*5(CTX), f
381 mov 4*6(CTX), g
382 mov 4*7(CTX), h
383
384 movdqa PSHUFFLE_BYTE_FLIP_MASK(%rip), BYTE_FLIP_MASK
385 movdqa _SHUF_00BA(%rip), SHUF_00BA
386 movdqa _SHUF_DC00(%rip), SHUF_DC00
387
388loop0:
389 lea K256(%rip), TBL
390
391 ## byte swap first 16 dwords
392 COPY_XMM_AND_BSWAP X0, 0*16(INP), BYTE_FLIP_MASK
393 COPY_XMM_AND_BSWAP X1, 1*16(INP), BYTE_FLIP_MASK
394 COPY_XMM_AND_BSWAP X2, 2*16(INP), BYTE_FLIP_MASK
395 COPY_XMM_AND_BSWAP X3, 3*16(INP), BYTE_FLIP_MASK
396
397 mov INP, _INP(%rsp)
398
399 ## schedule 48 input dwords, by doing 3 rounds of 16 each
400 mov $3, SRND
401.align 16
402loop1:
403 movdqa (TBL), XFER
404 paddd X0, XFER
405 movdqa XFER, _XFER(%rsp)
406 FOUR_ROUNDS_AND_SCHED
407
408 movdqa 1*16(TBL), XFER
409 paddd X0, XFER
410 movdqa XFER, _XFER(%rsp)
411 FOUR_ROUNDS_AND_SCHED
412
413 movdqa 2*16(TBL), XFER
414 paddd X0, XFER
415 movdqa XFER, _XFER(%rsp)
416 FOUR_ROUNDS_AND_SCHED
417
418 movdqa 3*16(TBL), XFER
419 paddd X0, XFER
420 movdqa XFER, _XFER(%rsp)
421 add $4*16, TBL
422 FOUR_ROUNDS_AND_SCHED
423
424 sub $1, SRND
425 jne loop1
426
427 mov $2, SRND
428loop2:
429 paddd (TBL), X0
430 movdqa X0, _XFER(%rsp)
431 DO_ROUND 0
432 DO_ROUND 1
433 DO_ROUND 2
434 DO_ROUND 3
435 paddd 1*16(TBL), X1
436 movdqa X1, _XFER(%rsp)
437 add $2*16, TBL
438 DO_ROUND 0
439 DO_ROUND 1
440 DO_ROUND 2
441 DO_ROUND 3
442
443 movdqa X2, X0
444 movdqa X3, X1
445
446 sub $1, SRND
447 jne loop2
448
449 addm (4*0)(CTX),a
450 addm (4*1)(CTX),b
451 addm (4*2)(CTX),c
452 addm (4*3)(CTX),d
453 addm (4*4)(CTX),e
454 addm (4*5)(CTX),f
455 addm (4*6)(CTX),g
456 addm (4*7)(CTX),h
457
458 mov _INP(%rsp), INP
459 add $64, INP
460 cmp _INP_END(%rsp), INP
461 jne loop0
462
463done_hash:
464
465 mov %r12, %rsp
466
467 popq %r12
468 popq %r15
469 popq %r14
470 popq %r13
471 popq %rbp
472 popq %rbx
473
474 ret
475ENDPROC(sha256_transform_ssse3)
476
477.data
478.align 64
479K256:
480 .long 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5
481 .long 0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5
482 .long 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3
483 .long 0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174
484 .long 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc
485 .long 0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da
486 .long 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7
487 .long 0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967
488 .long 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13
489 .long 0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85
490 .long 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3
491 .long 0xd192e819,0xd6990624,0xf40e3585,0x106aa070
492 .long 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5
493 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
494 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
495 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
496
497PSHUFFLE_BYTE_FLIP_MASK:
498 .octa 0x0c0d0e0f08090a0b0405060700010203
499
500# shuffle xBxA -> 00BA
501_SHUF_00BA:
502 .octa 0xFFFFFFFFFFFFFFFF0b0a090803020100
503
504# shuffle xDxC -> DC00
505_SHUF_DC00:
506 .octa 0x0b0a090803020100FFFFFFFFFFFFFFFF
diff --git a/arch/x86/crypto/sha256_ssse3_glue.c b/arch/x86/crypto/sha256_ssse3_glue.c
new file mode 100644
index 000000000000..597d4da69656
--- /dev/null
+++ b/arch/x86/crypto/sha256_ssse3_glue.c
@@ -0,0 +1,275 @@
1/*
2 * Cryptographic API.
3 *
4 * Glue code for the SHA256 Secure Hash Algorithm assembler
5 * implementation using supplemental SSE3 / AVX / AVX2 instructions.
6 *
7 * This file is based on sha256_generic.c
8 *
9 * Copyright (C) 2013 Intel Corporation.
10 *
11 * Author:
12 * Tim Chen <tim.c.chen@linux.intel.com>
13 *
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at your option)
17 * any later version.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * SOFTWARE.
27 */
28
29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
32#include <crypto/internal/hash.h>
33#include <linux/init.h>
34#include <linux/module.h>
35#include <linux/mm.h>
36#include <linux/cryptohash.h>
37#include <linux/types.h>
38#include <crypto/sha.h>
39#include <asm/byteorder.h>
40#include <asm/i387.h>
41#include <asm/xcr.h>
42#include <asm/xsave.h>
43#include <linux/string.h>
44
45asmlinkage void sha256_transform_ssse3(const char *data, u32 *digest,
46 u64 rounds);
47#ifdef CONFIG_AS_AVX
48asmlinkage void sha256_transform_avx(const char *data, u32 *digest,
49 u64 rounds);
50#endif
51#ifdef CONFIG_AS_AVX2
52asmlinkage void sha256_transform_rorx(const char *data, u32 *digest,
53 u64 rounds);
54#endif
55
56static asmlinkage void (*sha256_transform_asm)(const char *, u32 *, u64);
57
58
59static int sha256_ssse3_init(struct shash_desc *desc)
60{
61 struct sha256_state *sctx = shash_desc_ctx(desc);
62
63 sctx->state[0] = SHA256_H0;
64 sctx->state[1] = SHA256_H1;
65 sctx->state[2] = SHA256_H2;
66 sctx->state[3] = SHA256_H3;
67 sctx->state[4] = SHA256_H4;
68 sctx->state[5] = SHA256_H5;
69 sctx->state[6] = SHA256_H6;
70 sctx->state[7] = SHA256_H7;
71 sctx->count = 0;
72
73 return 0;
74}
75
76static int __sha256_ssse3_update(struct shash_desc *desc, const u8 *data,
77 unsigned int len, unsigned int partial)
78{
79 struct sha256_state *sctx = shash_desc_ctx(desc);
80 unsigned int done = 0;
81
82 sctx->count += len;
83
84 if (partial) {
85 done = SHA256_BLOCK_SIZE - partial;
86 memcpy(sctx->buf + partial, data, done);
87 sha256_transform_asm(sctx->buf, sctx->state, 1);
88 }
89
90 if (len - done >= SHA256_BLOCK_SIZE) {
91 const unsigned int rounds = (len - done) / SHA256_BLOCK_SIZE;
92
93 sha256_transform_asm(data + done, sctx->state, (u64) rounds);
94
95 done += rounds * SHA256_BLOCK_SIZE;
96 }
97
98 memcpy(sctx->buf, data + done, len - done);
99
100 return 0;
101}
102
103static int sha256_ssse3_update(struct shash_desc *desc, const u8 *data,
104 unsigned int len)
105{
106 struct sha256_state *sctx = shash_desc_ctx(desc);
107 unsigned int partial = sctx->count % SHA256_BLOCK_SIZE;
108 int res;
109
110 /* Handle the fast case right here */
111 if (partial + len < SHA256_BLOCK_SIZE) {
112 sctx->count += len;
113 memcpy(sctx->buf + partial, data, len);
114
115 return 0;
116 }
117
118 if (!irq_fpu_usable()) {
119 res = crypto_sha256_update(desc, data, len);
120 } else {
121 kernel_fpu_begin();
122 res = __sha256_ssse3_update(desc, data, len, partial);
123 kernel_fpu_end();
124 }
125
126 return res;
127}
128
129
130/* Add padding and return the message digest. */
131static int sha256_ssse3_final(struct shash_desc *desc, u8 *out)
132{
133 struct sha256_state *sctx = shash_desc_ctx(desc);
134 unsigned int i, index, padlen;
135 __be32 *dst = (__be32 *)out;
136 __be64 bits;
137 static const u8 padding[SHA256_BLOCK_SIZE] = { 0x80, };
138
139 bits = cpu_to_be64(sctx->count << 3);
140
141 /* Pad out to 56 mod 64 and append length */
142 index = sctx->count % SHA256_BLOCK_SIZE;
143 padlen = (index < 56) ? (56 - index) : ((SHA256_BLOCK_SIZE+56)-index);
144
145 if (!irq_fpu_usable()) {
146 crypto_sha256_update(desc, padding, padlen);
147 crypto_sha256_update(desc, (const u8 *)&bits, sizeof(bits));
148 } else {
149 kernel_fpu_begin();
150 /* We need to fill a whole block for __sha256_ssse3_update() */
151 if (padlen <= 56) {
152 sctx->count += padlen;
153 memcpy(sctx->buf + index, padding, padlen);
154 } else {
155 __sha256_ssse3_update(desc, padding, padlen, index);
156 }
157 __sha256_ssse3_update(desc, (const u8 *)&bits,
158 sizeof(bits), 56);
159 kernel_fpu_end();
160 }
161
162 /* Store state in digest */
163 for (i = 0; i < 8; i++)
164 dst[i] = cpu_to_be32(sctx->state[i]);
165
166 /* Wipe context */
167 memset(sctx, 0, sizeof(*sctx));
168
169 return 0;
170}
171
172static int sha256_ssse3_export(struct shash_desc *desc, void *out)
173{
174 struct sha256_state *sctx = shash_desc_ctx(desc);
175
176 memcpy(out, sctx, sizeof(*sctx));
177
178 return 0;
179}
180
181static int sha256_ssse3_import(struct shash_desc *desc, const void *in)
182{
183 struct sha256_state *sctx = shash_desc_ctx(desc);
184
185 memcpy(sctx, in, sizeof(*sctx));
186
187 return 0;
188}
189
190static struct shash_alg alg = {
191 .digestsize = SHA256_DIGEST_SIZE,
192 .init = sha256_ssse3_init,
193 .update = sha256_ssse3_update,
194 .final = sha256_ssse3_final,
195 .export = sha256_ssse3_export,
196 .import = sha256_ssse3_import,
197 .descsize = sizeof(struct sha256_state),
198 .statesize = sizeof(struct sha256_state),
199 .base = {
200 .cra_name = "sha256",
201 .cra_driver_name = "sha256-ssse3",
202 .cra_priority = 150,
203 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
204 .cra_blocksize = SHA256_BLOCK_SIZE,
205 .cra_module = THIS_MODULE,
206 }
207};
208
209#ifdef CONFIG_AS_AVX
210static bool __init avx_usable(void)
211{
212 u64 xcr0;
213
214 if (!cpu_has_avx || !cpu_has_osxsave)
215 return false;
216
217 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
218 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
219 pr_info("AVX detected but unusable.\n");
220
221 return false;
222 }
223
224 return true;
225}
226#endif
227
228static int __init sha256_ssse3_mod_init(void)
229{
230 /* test for SSE3 first */
231 if (cpu_has_ssse3)
232 sha256_transform_asm = sha256_transform_ssse3;
233
234#ifdef CONFIG_AS_AVX
235 /* allow AVX to override SSSE3, it's a little faster */
236 if (avx_usable()) {
237#ifdef CONFIG_AS_AVX2
238 if (boot_cpu_has(X86_FEATURE_AVX2))
239 sha256_transform_asm = sha256_transform_rorx;
240 else
241#endif
242 sha256_transform_asm = sha256_transform_avx;
243 }
244#endif
245
246 if (sha256_transform_asm) {
247#ifdef CONFIG_AS_AVX
248 if (sha256_transform_asm == sha256_transform_avx)
249 pr_info("Using AVX optimized SHA-256 implementation\n");
250#ifdef CONFIG_AS_AVX2
251 else if (sha256_transform_asm == sha256_transform_rorx)
252 pr_info("Using AVX2 optimized SHA-256 implementation\n");
253#endif
254 else
255#endif
256 pr_info("Using SSSE3 optimized SHA-256 implementation\n");
257 return crypto_register_shash(&alg);
258 }
259 pr_info("Neither AVX nor SSSE3 is available/usable.\n");
260
261 return -ENODEV;
262}
263
264static void __exit sha256_ssse3_mod_fini(void)
265{
266 crypto_unregister_shash(&alg);
267}
268
269module_init(sha256_ssse3_mod_init);
270module_exit(sha256_ssse3_mod_fini);
271
272MODULE_LICENSE("GPL");
273MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated");
274
275MODULE_ALIAS("sha256");
diff --git a/arch/x86/crypto/sha512-avx-asm.S b/arch/x86/crypto/sha512-avx-asm.S
new file mode 100644
index 000000000000..974dde9bc6cd
--- /dev/null
+++ b/arch/x86/crypto/sha512-avx-asm.S
@@ -0,0 +1,423 @@
1########################################################################
2# Implement fast SHA-512 with AVX instructions. (x86_64)
3#
4# Copyright (C) 2013 Intel Corporation.
5#
6# Authors:
7# James Guilford <james.guilford@intel.com>
8# Kirk Yap <kirk.s.yap@intel.com>
9# David Cote <david.m.cote@intel.com>
10# Tim Chen <tim.c.chen@linux.intel.com>
11#
12# This software is available to you under a choice of one of two
13# licenses. You may choose to be licensed under the terms of the GNU
14# General Public License (GPL) Version 2, available from the file
15# COPYING in the main directory of this source tree, or the
16# OpenIB.org BSD license below:
17#
18# Redistribution and use in source and binary forms, with or
19# without modification, are permitted provided that the following
20# conditions are met:
21#
22# - Redistributions of source code must retain the above
23# copyright notice, this list of conditions and the following
24# disclaimer.
25#
26# - Redistributions in binary form must reproduce the above
27# copyright notice, this list of conditions and the following
28# disclaimer in the documentation and/or other materials
29# provided with the distribution.
30#
31# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
35# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
36# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38# SOFTWARE.
39#
40########################################################################
41#
42# This code is described in an Intel White-Paper:
43# "Fast SHA-512 Implementations on Intel Architecture Processors"
44#
45# To find it, surf to http://www.intel.com/p/en_US/embedded
46# and search for that title.
47#
48########################################################################
49
50#ifdef CONFIG_AS_AVX
51#include <linux/linkage.h>
52
53.text
54
55# Virtual Registers
56# ARG1
57msg = %rdi
58# ARG2
59digest = %rsi
60# ARG3
61msglen = %rdx
62T1 = %rcx
63T2 = %r8
64a_64 = %r9
65b_64 = %r10
66c_64 = %r11
67d_64 = %r12
68e_64 = %r13
69f_64 = %r14
70g_64 = %r15
71h_64 = %rbx
72tmp0 = %rax
73
74# Local variables (stack frame)
75
76# Message Schedule
77W_SIZE = 80*8
78# W[t] + K[t] | W[t+1] + K[t+1]
79WK_SIZE = 2*8
80RSPSAVE_SIZE = 1*8
81GPRSAVE_SIZE = 5*8
82
83frame_W = 0
84frame_WK = frame_W + W_SIZE
85frame_RSPSAVE = frame_WK + WK_SIZE
86frame_GPRSAVE = frame_RSPSAVE + RSPSAVE_SIZE
87frame_size = frame_GPRSAVE + GPRSAVE_SIZE
88
89# Useful QWORD "arrays" for simpler memory references
90# MSG, DIGEST, K_t, W_t are arrays
91# WK_2(t) points to 1 of 2 qwords at frame.WK depdending on t being odd/even
92
93# Input message (arg1)
94#define MSG(i) 8*i(msg)
95
96# Output Digest (arg2)
97#define DIGEST(i) 8*i(digest)
98
99# SHA Constants (static mem)
100#define K_t(i) 8*i+K512(%rip)
101
102# Message Schedule (stack frame)
103#define W_t(i) 8*i+frame_W(%rsp)
104
105# W[t]+K[t] (stack frame)
106#define WK_2(i) 8*((i%2))+frame_WK(%rsp)
107
108.macro RotateState
109 # Rotate symbols a..h right
110 TMP = h_64
111 h_64 = g_64
112 g_64 = f_64
113 f_64 = e_64
114 e_64 = d_64
115 d_64 = c_64
116 c_64 = b_64
117 b_64 = a_64
118 a_64 = TMP
119.endm
120
121.macro RORQ p1 p2
122 # shld is faster than ror on Sandybridge
123 shld $(64-\p2), \p1, \p1
124.endm
125
126.macro SHA512_Round rnd
127 # Compute Round %%t
128 mov f_64, T1 # T1 = f
129 mov e_64, tmp0 # tmp = e
130 xor g_64, T1 # T1 = f ^ g
131 RORQ tmp0, 23 # 41 # tmp = e ror 23
132 and e_64, T1 # T1 = (f ^ g) & e
133 xor e_64, tmp0 # tmp = (e ror 23) ^ e
134 xor g_64, T1 # T1 = ((f ^ g) & e) ^ g = CH(e,f,g)
135 idx = \rnd
136 add WK_2(idx), T1 # W[t] + K[t] from message scheduler
137 RORQ tmp0, 4 # 18 # tmp = ((e ror 23) ^ e) ror 4
138 xor e_64, tmp0 # tmp = (((e ror 23) ^ e) ror 4) ^ e
139 mov a_64, T2 # T2 = a
140 add h_64, T1 # T1 = CH(e,f,g) + W[t] + K[t] + h
141 RORQ tmp0, 14 # 14 # tmp = ((((e ror23)^e)ror4)^e)ror14 = S1(e)
142 add tmp0, T1 # T1 = CH(e,f,g) + W[t] + K[t] + S1(e)
143 mov a_64, tmp0 # tmp = a
144 xor c_64, T2 # T2 = a ^ c
145 and c_64, tmp0 # tmp = a & c
146 and b_64, T2 # T2 = (a ^ c) & b
147 xor tmp0, T2 # T2 = ((a ^ c) & b) ^ (a & c) = Maj(a,b,c)
148 mov a_64, tmp0 # tmp = a
149 RORQ tmp0, 5 # 39 # tmp = a ror 5
150 xor a_64, tmp0 # tmp = (a ror 5) ^ a
151 add T1, d_64 # e(next_state) = d + T1
152 RORQ tmp0, 6 # 34 # tmp = ((a ror 5) ^ a) ror 6
153 xor a_64, tmp0 # tmp = (((a ror 5) ^ a) ror 6) ^ a
154 lea (T1, T2), h_64 # a(next_state) = T1 + Maj(a,b,c)
155 RORQ tmp0, 28 # 28 # tmp = ((((a ror5)^a)ror6)^a)ror28 = S0(a)
156 add tmp0, h_64 # a(next_state) = T1 + Maj(a,b,c) S0(a)
157 RotateState
158.endm
159
160.macro SHA512_2Sched_2Round_avx rnd
161 # Compute rounds t-2 and t-1
162 # Compute message schedule QWORDS t and t+1
163
164 # Two rounds are computed based on the values for K[t-2]+W[t-2] and
165 # K[t-1]+W[t-1] which were previously stored at WK_2 by the message
166 # scheduler.
167 # The two new schedule QWORDS are stored at [W_t(t)] and [W_t(t+1)].
168 # They are then added to their respective SHA512 constants at
169 # [K_t(t)] and [K_t(t+1)] and stored at dqword [WK_2(t)]
170 # For brievity, the comments following vectored instructions only refer to
171 # the first of a pair of QWORDS.
172 # Eg. XMM4=W[t-2] really means XMM4={W[t-2]|W[t-1]}
173 # The computation of the message schedule and the rounds are tightly
174 # stitched to take advantage of instruction-level parallelism.
175
176 idx = \rnd - 2
177 vmovdqa W_t(idx), %xmm4 # XMM4 = W[t-2]
178 idx = \rnd - 15
179 vmovdqu W_t(idx), %xmm5 # XMM5 = W[t-15]
180 mov f_64, T1
181 vpsrlq $61, %xmm4, %xmm0 # XMM0 = W[t-2]>>61
182 mov e_64, tmp0
183 vpsrlq $1, %xmm5, %xmm6 # XMM6 = W[t-15]>>1
184 xor g_64, T1
185 RORQ tmp0, 23 # 41
186 vpsrlq $19, %xmm4, %xmm1 # XMM1 = W[t-2]>>19
187 and e_64, T1
188 xor e_64, tmp0
189 vpxor %xmm1, %xmm0, %xmm0 # XMM0 = W[t-2]>>61 ^ W[t-2]>>19
190 xor g_64, T1
191 idx = \rnd
192 add WK_2(idx), T1#
193 vpsrlq $8, %xmm5, %xmm7 # XMM7 = W[t-15]>>8
194 RORQ tmp0, 4 # 18
195 vpsrlq $6, %xmm4, %xmm2 # XMM2 = W[t-2]>>6
196 xor e_64, tmp0
197 mov a_64, T2
198 add h_64, T1
199 vpxor %xmm7, %xmm6, %xmm6 # XMM6 = W[t-15]>>1 ^ W[t-15]>>8
200 RORQ tmp0, 14 # 14
201 add tmp0, T1
202 vpsrlq $7, %xmm5, %xmm8 # XMM8 = W[t-15]>>7
203 mov a_64, tmp0
204 xor c_64, T2
205 vpsllq $(64-61), %xmm4, %xmm3 # XMM3 = W[t-2]<<3
206 and c_64, tmp0
207 and b_64, T2
208 vpxor %xmm3, %xmm2, %xmm2 # XMM2 = W[t-2]>>6 ^ W[t-2]<<3
209 xor tmp0, T2
210 mov a_64, tmp0
211 vpsllq $(64-1), %xmm5, %xmm9 # XMM9 = W[t-15]<<63
212 RORQ tmp0, 5 # 39
213 vpxor %xmm9, %xmm8, %xmm8 # XMM8 = W[t-15]>>7 ^ W[t-15]<<63
214 xor a_64, tmp0
215 add T1, d_64
216 RORQ tmp0, 6 # 34
217 xor a_64, tmp0
218 vpxor %xmm8, %xmm6, %xmm6 # XMM6 = W[t-15]>>1 ^ W[t-15]>>8 ^
219 # W[t-15]>>7 ^ W[t-15]<<63
220 lea (T1, T2), h_64
221 RORQ tmp0, 28 # 28
222 vpsllq $(64-19), %xmm4, %xmm4 # XMM4 = W[t-2]<<25
223 add tmp0, h_64
224 RotateState
225 vpxor %xmm4, %xmm0, %xmm0 # XMM0 = W[t-2]>>61 ^ W[t-2]>>19 ^
226 # W[t-2]<<25
227 mov f_64, T1
228 vpxor %xmm2, %xmm0, %xmm0 # XMM0 = s1(W[t-2])
229 mov e_64, tmp0
230 xor g_64, T1
231 idx = \rnd - 16
232 vpaddq W_t(idx), %xmm0, %xmm0 # XMM0 = s1(W[t-2]) + W[t-16]
233 idx = \rnd - 7
234 vmovdqu W_t(idx), %xmm1 # XMM1 = W[t-7]
235 RORQ tmp0, 23 # 41
236 and e_64, T1
237 xor e_64, tmp0
238 xor g_64, T1
239 vpsllq $(64-8), %xmm5, %xmm5 # XMM5 = W[t-15]<<56
240 idx = \rnd + 1
241 add WK_2(idx), T1
242 vpxor %xmm5, %xmm6, %xmm6 # XMM6 = s0(W[t-15])
243 RORQ tmp0, 4 # 18
244 vpaddq %xmm6, %xmm0, %xmm0 # XMM0 = s1(W[t-2]) + W[t-16] + s0(W[t-15])
245 xor e_64, tmp0
246 vpaddq %xmm1, %xmm0, %xmm0 # XMM0 = W[t] = s1(W[t-2]) + W[t-7] +
247 # s0(W[t-15]) + W[t-16]
248 mov a_64, T2
249 add h_64, T1
250 RORQ tmp0, 14 # 14
251 add tmp0, T1
252 idx = \rnd
253 vmovdqa %xmm0, W_t(idx) # Store W[t]
254 vpaddq K_t(idx), %xmm0, %xmm0 # Compute W[t]+K[t]
255 vmovdqa %xmm0, WK_2(idx) # Store W[t]+K[t] for next rounds
256 mov a_64, tmp0
257 xor c_64, T2
258 and c_64, tmp0
259 and b_64, T2
260 xor tmp0, T2
261 mov a_64, tmp0
262 RORQ tmp0, 5 # 39
263 xor a_64, tmp0
264 add T1, d_64
265 RORQ tmp0, 6 # 34
266 xor a_64, tmp0
267 lea (T1, T2), h_64
268 RORQ tmp0, 28 # 28
269 add tmp0, h_64
270 RotateState
271.endm
272
273########################################################################
274# void sha512_transform_avx(const void* M, void* D, u64 L)
275# Purpose: Updates the SHA512 digest stored at D with the message stored in M.
276# The size of the message pointed to by M must be an integer multiple of SHA512
277# message blocks.
278# L is the message length in SHA512 blocks
279########################################################################
280ENTRY(sha512_transform_avx)
281 cmp $0, msglen
282 je nowork
283
284 # Allocate Stack Space
285 mov %rsp, %rax
286 sub $frame_size, %rsp
287 and $~(0x20 - 1), %rsp
288 mov %rax, frame_RSPSAVE(%rsp)
289
290 # Save GPRs
291 mov %rbx, frame_GPRSAVE(%rsp)
292 mov %r12, frame_GPRSAVE +8*1(%rsp)
293 mov %r13, frame_GPRSAVE +8*2(%rsp)
294 mov %r14, frame_GPRSAVE +8*3(%rsp)
295 mov %r15, frame_GPRSAVE +8*4(%rsp)
296
297updateblock:
298
299 # Load state variables
300 mov DIGEST(0), a_64
301 mov DIGEST(1), b_64
302 mov DIGEST(2), c_64
303 mov DIGEST(3), d_64
304 mov DIGEST(4), e_64
305 mov DIGEST(5), f_64
306 mov DIGEST(6), g_64
307 mov DIGEST(7), h_64
308
309 t = 0
310 .rept 80/2 + 1
311 # (80 rounds) / (2 rounds/iteration) + (1 iteration)
312 # +1 iteration because the scheduler leads hashing by 1 iteration
313 .if t < 2
314 # BSWAP 2 QWORDS
315 vmovdqa XMM_QWORD_BSWAP(%rip), %xmm1
316 vmovdqu MSG(t), %xmm0
317 vpshufb %xmm1, %xmm0, %xmm0 # BSWAP
318 vmovdqa %xmm0, W_t(t) # Store Scheduled Pair
319 vpaddq K_t(t), %xmm0, %xmm0 # Compute W[t]+K[t]
320 vmovdqa %xmm0, WK_2(t) # Store into WK for rounds
321 .elseif t < 16
322 # BSWAP 2 QWORDS# Compute 2 Rounds
323 vmovdqu MSG(t), %xmm0
324 vpshufb %xmm1, %xmm0, %xmm0 # BSWAP
325 SHA512_Round t-2 # Round t-2
326 vmovdqa %xmm0, W_t(t) # Store Scheduled Pair
327 vpaddq K_t(t), %xmm0, %xmm0 # Compute W[t]+K[t]
328 SHA512_Round t-1 # Round t-1
329 vmovdqa %xmm0, WK_2(t)# Store W[t]+K[t] into WK
330 .elseif t < 79
331 # Schedule 2 QWORDS# Compute 2 Rounds
332 SHA512_2Sched_2Round_avx t
333 .else
334 # Compute 2 Rounds
335 SHA512_Round t-2
336 SHA512_Round t-1
337 .endif
338 t = t+2
339 .endr
340
341 # Update digest
342 add a_64, DIGEST(0)
343 add b_64, DIGEST(1)
344 add c_64, DIGEST(2)
345 add d_64, DIGEST(3)
346 add e_64, DIGEST(4)
347 add f_64, DIGEST(5)
348 add g_64, DIGEST(6)
349 add h_64, DIGEST(7)
350
351 # Advance to next message block
352 add $16*8, msg
353 dec msglen
354 jnz updateblock
355
356 # Restore GPRs
357 mov frame_GPRSAVE(%rsp), %rbx
358 mov frame_GPRSAVE +8*1(%rsp), %r12
359 mov frame_GPRSAVE +8*2(%rsp), %r13
360 mov frame_GPRSAVE +8*3(%rsp), %r14
361 mov frame_GPRSAVE +8*4(%rsp), %r15
362
363 # Restore Stack Pointer
364 mov frame_RSPSAVE(%rsp), %rsp
365
366nowork:
367 ret
368ENDPROC(sha512_transform_avx)
369
370########################################################################
371### Binary Data
372
373.data
374
375.align 16
376
377# Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
378XMM_QWORD_BSWAP:
379 .octa 0x08090a0b0c0d0e0f0001020304050607
380
381# K[t] used in SHA512 hashing
382K512:
383 .quad 0x428a2f98d728ae22,0x7137449123ef65cd
384 .quad 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc
385 .quad 0x3956c25bf348b538,0x59f111f1b605d019
386 .quad 0x923f82a4af194f9b,0xab1c5ed5da6d8118
387 .quad 0xd807aa98a3030242,0x12835b0145706fbe
388 .quad 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2
389 .quad 0x72be5d74f27b896f,0x80deb1fe3b1696b1
390 .quad 0x9bdc06a725c71235,0xc19bf174cf692694
391 .quad 0xe49b69c19ef14ad2,0xefbe4786384f25e3
392 .quad 0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65
393 .quad 0x2de92c6f592b0275,0x4a7484aa6ea6e483
394 .quad 0x5cb0a9dcbd41fbd4,0x76f988da831153b5
395 .quad 0x983e5152ee66dfab,0xa831c66d2db43210
396 .quad 0xb00327c898fb213f,0xbf597fc7beef0ee4
397 .quad 0xc6e00bf33da88fc2,0xd5a79147930aa725
398 .quad 0x06ca6351e003826f,0x142929670a0e6e70
399 .quad 0x27b70a8546d22ffc,0x2e1b21385c26c926
400 .quad 0x4d2c6dfc5ac42aed,0x53380d139d95b3df
401 .quad 0x650a73548baf63de,0x766a0abb3c77b2a8
402 .quad 0x81c2c92e47edaee6,0x92722c851482353b
403 .quad 0xa2bfe8a14cf10364,0xa81a664bbc423001
404 .quad 0xc24b8b70d0f89791,0xc76c51a30654be30
405 .quad 0xd192e819d6ef5218,0xd69906245565a910
406 .quad 0xf40e35855771202a,0x106aa07032bbd1b8
407 .quad 0x19a4c116b8d2d0c8,0x1e376c085141ab53
408 .quad 0x2748774cdf8eeb99,0x34b0bcb5e19b48a8
409 .quad 0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb
410 .quad 0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3
411 .quad 0x748f82ee5defb2fc,0x78a5636f43172f60
412 .quad 0x84c87814a1f0ab72,0x8cc702081a6439ec
413 .quad 0x90befffa23631e28,0xa4506cebde82bde9
414 .quad 0xbef9a3f7b2c67915,0xc67178f2e372532b
415 .quad 0xca273eceea26619c,0xd186b8c721c0c207
416 .quad 0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178
417 .quad 0x06f067aa72176fba,0x0a637dc5a2c898a6
418 .quad 0x113f9804bef90dae,0x1b710b35131c471b
419 .quad 0x28db77f523047d84,0x32caab7b40c72493
420 .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
421 .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
422 .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
423#endif
diff --git a/arch/x86/crypto/sha512-avx2-asm.S b/arch/x86/crypto/sha512-avx2-asm.S
new file mode 100644
index 000000000000..568b96105f5c
--- /dev/null
+++ b/arch/x86/crypto/sha512-avx2-asm.S
@@ -0,0 +1,743 @@
1########################################################################
2# Implement fast SHA-512 with AVX2 instructions. (x86_64)
3#
4# Copyright (C) 2013 Intel Corporation.
5#
6# Authors:
7# James Guilford <james.guilford@intel.com>
8# Kirk Yap <kirk.s.yap@intel.com>
9# David Cote <david.m.cote@intel.com>
10# Tim Chen <tim.c.chen@linux.intel.com>
11#
12# This software is available to you under a choice of one of two
13# licenses. You may choose to be licensed under the terms of the GNU
14# General Public License (GPL) Version 2, available from the file
15# COPYING in the main directory of this source tree, or the
16# OpenIB.org BSD license below:
17#
18# Redistribution and use in source and binary forms, with or
19# without modification, are permitted provided that the following
20# conditions are met:
21#
22# - Redistributions of source code must retain the above
23# copyright notice, this list of conditions and the following
24# disclaimer.
25#
26# - Redistributions in binary form must reproduce the above
27# copyright notice, this list of conditions and the following
28# disclaimer in the documentation and/or other materials
29# provided with the distribution.
30#
31# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
35# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
36# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38# SOFTWARE.
39#
40########################################################################
41#
42# This code is described in an Intel White-Paper:
43# "Fast SHA-512 Implementations on Intel Architecture Processors"
44#
45# To find it, surf to http://www.intel.com/p/en_US/embedded
46# and search for that title.
47#
48########################################################################
49# This code schedules 1 blocks at a time, with 4 lanes per block
50########################################################################
51
52#ifdef CONFIG_AS_AVX2
53#include <linux/linkage.h>
54
55.text
56
57# Virtual Registers
58Y_0 = %ymm4
59Y_1 = %ymm5
60Y_2 = %ymm6
61Y_3 = %ymm7
62
63YTMP0 = %ymm0
64YTMP1 = %ymm1
65YTMP2 = %ymm2
66YTMP3 = %ymm3
67YTMP4 = %ymm8
68XFER = YTMP0
69
70BYTE_FLIP_MASK = %ymm9
71
72# 1st arg
73INP = %rdi
74# 2nd arg
75CTX = %rsi
76# 3rd arg
77NUM_BLKS = %rdx
78
79c = %rcx
80d = %r8
81e = %rdx
82y3 = %rdi
83
84TBL = %rbp
85
86a = %rax
87b = %rbx
88
89f = %r9
90g = %r10
91h = %r11
92old_h = %r11
93
94T1 = %r12
95y0 = %r13
96y1 = %r14
97y2 = %r15
98
99y4 = %r12
100
101# Local variables (stack frame)
102XFER_SIZE = 4*8
103SRND_SIZE = 1*8
104INP_SIZE = 1*8
105INPEND_SIZE = 1*8
106RSPSAVE_SIZE = 1*8
107GPRSAVE_SIZE = 6*8
108
109frame_XFER = 0
110frame_SRND = frame_XFER + XFER_SIZE
111frame_INP = frame_SRND + SRND_SIZE
112frame_INPEND = frame_INP + INP_SIZE
113frame_RSPSAVE = frame_INPEND + INPEND_SIZE
114frame_GPRSAVE = frame_RSPSAVE + RSPSAVE_SIZE
115frame_size = frame_GPRSAVE + GPRSAVE_SIZE
116
117## assume buffers not aligned
118#define VMOVDQ vmovdqu
119
120# addm [mem], reg
121# Add reg to mem using reg-mem add and store
122.macro addm p1 p2
123 add \p1, \p2
124 mov \p2, \p1
125.endm
126
127
128# COPY_YMM_AND_BSWAP ymm, [mem], byte_flip_mask
129# Load ymm with mem and byte swap each dword
130.macro COPY_YMM_AND_BSWAP p1 p2 p3
131 VMOVDQ \p2, \p1
132 vpshufb \p3, \p1, \p1
133.endm
134# rotate_Ys
135# Rotate values of symbols Y0...Y3
136.macro rotate_Ys
137 Y_ = Y_0
138 Y_0 = Y_1
139 Y_1 = Y_2
140 Y_2 = Y_3
141 Y_3 = Y_
142.endm
143
144# RotateState
145.macro RotateState
146 # Rotate symbols a..h right
147 old_h = h
148 TMP_ = h
149 h = g
150 g = f
151 f = e
152 e = d
153 d = c
154 c = b
155 b = a
156 a = TMP_
157.endm
158
159# macro MY_VPALIGNR YDST, YSRC1, YSRC2, RVAL
160# YDST = {YSRC1, YSRC2} >> RVAL*8
161.macro MY_VPALIGNR YDST YSRC1 YSRC2 RVAL
162 vperm2f128 $0x3, \YSRC2, \YSRC1, \YDST # YDST = {YS1_LO, YS2_HI}
163 vpalignr $\RVAL, \YSRC2, \YDST, \YDST # YDST = {YDS1, YS2} >> RVAL*8
164.endm
165
166.macro FOUR_ROUNDS_AND_SCHED
167################################### RND N + 0 #########################################
168
169 # Extract w[t-7]
170 MY_VPALIGNR YTMP0, Y_3, Y_2, 8 # YTMP0 = W[-7]
171 # Calculate w[t-16] + w[t-7]
172 vpaddq Y_0, YTMP0, YTMP0 # YTMP0 = W[-7] + W[-16]
173 # Extract w[t-15]
174 MY_VPALIGNR YTMP1, Y_1, Y_0, 8 # YTMP1 = W[-15]
175
176 # Calculate sigma0
177
178 # Calculate w[t-15] ror 1
179 vpsrlq $1, YTMP1, YTMP2
180 vpsllq $(64-1), YTMP1, YTMP3
181 vpor YTMP2, YTMP3, YTMP3 # YTMP3 = W[-15] ror 1
182 # Calculate w[t-15] shr 7
183 vpsrlq $7, YTMP1, YTMP4 # YTMP4 = W[-15] >> 7
184
185 mov a, y3 # y3 = a # MAJA
186 rorx $41, e, y0 # y0 = e >> 41 # S1A
187 rorx $18, e, y1 # y1 = e >> 18 # S1B
188 add frame_XFER(%rsp),h # h = k + w + h # --
189 or c, y3 # y3 = a|c # MAJA
190 mov f, y2 # y2 = f # CH
191 rorx $34, a, T1 # T1 = a >> 34 # S0B
192
193 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
194 xor g, y2 # y2 = f^g # CH
195 rorx $14, e, y1 # y1 = (e >> 14) # S1
196
197 and e, y2 # y2 = (f^g)&e # CH
198 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
199 rorx $39, a, y1 # y1 = a >> 39 # S0A
200 add h, d # d = k + w + h + d # --
201
202 and b, y3 # y3 = (a|c)&b # MAJA
203 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
204 rorx $28, a, T1 # T1 = (a >> 28) # S0
205
206 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
207 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
208 mov a, T1 # T1 = a # MAJB
209 and c, T1 # T1 = a&c # MAJB
210
211 add y0, y2 # y2 = S1 + CH # --
212 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
213 add y1, h # h = k + w + h + S0 # --
214
215 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
216
217 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
218 add y3, h # h = t1 + S0 + MAJ # --
219
220 RotateState
221
222################################### RND N + 1 #########################################
223
224 # Calculate w[t-15] ror 8
225 vpsrlq $8, YTMP1, YTMP2
226 vpsllq $(64-8), YTMP1, YTMP1
227 vpor YTMP2, YTMP1, YTMP1 # YTMP1 = W[-15] ror 8
228 # XOR the three components
229 vpxor YTMP4, YTMP3, YTMP3 # YTMP3 = W[-15] ror 1 ^ W[-15] >> 7
230 vpxor YTMP1, YTMP3, YTMP1 # YTMP1 = s0
231
232
233 # Add three components, w[t-16], w[t-7] and sigma0
234 vpaddq YTMP1, YTMP0, YTMP0 # YTMP0 = W[-16] + W[-7] + s0
235 # Move to appropriate lanes for calculating w[16] and w[17]
236 vperm2f128 $0x0, YTMP0, YTMP0, Y_0 # Y_0 = W[-16] + W[-7] + s0 {BABA}
237 # Move to appropriate lanes for calculating w[18] and w[19]
238 vpand MASK_YMM_LO(%rip), YTMP0, YTMP0 # YTMP0 = W[-16] + W[-7] + s0 {DC00}
239
240 # Calculate w[16] and w[17] in both 128 bit lanes
241
242 # Calculate sigma1 for w[16] and w[17] on both 128 bit lanes
243 vperm2f128 $0x11, Y_3, Y_3, YTMP2 # YTMP2 = W[-2] {BABA}
244 vpsrlq $6, YTMP2, YTMP4 # YTMP4 = W[-2] >> 6 {BABA}
245
246
247 mov a, y3 # y3 = a # MAJA
248 rorx $41, e, y0 # y0 = e >> 41 # S1A
249 rorx $18, e, y1 # y1 = e >> 18 # S1B
250 add 1*8+frame_XFER(%rsp), h # h = k + w + h # --
251 or c, y3 # y3 = a|c # MAJA
252
253
254 mov f, y2 # y2 = f # CH
255 rorx $34, a, T1 # T1 = a >> 34 # S0B
256 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
257 xor g, y2 # y2 = f^g # CH
258
259
260 rorx $14, e, y1 # y1 = (e >> 14) # S1
261 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
262 rorx $39, a, y1 # y1 = a >> 39 # S0A
263 and e, y2 # y2 = (f^g)&e # CH
264 add h, d # d = k + w + h + d # --
265
266 and b, y3 # y3 = (a|c)&b # MAJA
267 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
268
269 rorx $28, a, T1 # T1 = (a >> 28) # S0
270 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
271
272 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
273 mov a, T1 # T1 = a # MAJB
274 and c, T1 # T1 = a&c # MAJB
275 add y0, y2 # y2 = S1 + CH # --
276
277 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
278 add y1, h # h = k + w + h + S0 # --
279
280 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
281 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
282 add y3, h # h = t1 + S0 + MAJ # --
283
284 RotateState
285
286
287################################### RND N + 2 #########################################
288
289 vpsrlq $19, YTMP2, YTMP3 # YTMP3 = W[-2] >> 19 {BABA}
290 vpsllq $(64-19), YTMP2, YTMP1 # YTMP1 = W[-2] << 19 {BABA}
291 vpor YTMP1, YTMP3, YTMP3 # YTMP3 = W[-2] ror 19 {BABA}
292 vpxor YTMP3, YTMP4, YTMP4 # YTMP4 = W[-2] ror 19 ^ W[-2] >> 6 {BABA}
293 vpsrlq $61, YTMP2, YTMP3 # YTMP3 = W[-2] >> 61 {BABA}
294 vpsllq $(64-61), YTMP2, YTMP1 # YTMP1 = W[-2] << 61 {BABA}
295 vpor YTMP1, YTMP3, YTMP3 # YTMP3 = W[-2] ror 61 {BABA}
296 vpxor YTMP3, YTMP4, YTMP4 # YTMP4 = s1 = (W[-2] ror 19) ^
297 # (W[-2] ror 61) ^ (W[-2] >> 6) {BABA}
298
299 # Add sigma1 to the other compunents to get w[16] and w[17]
300 vpaddq YTMP4, Y_0, Y_0 # Y_0 = {W[1], W[0], W[1], W[0]}
301
302 # Calculate sigma1 for w[18] and w[19] for upper 128 bit lane
303 vpsrlq $6, Y_0, YTMP4 # YTMP4 = W[-2] >> 6 {DC--}
304
305 mov a, y3 # y3 = a # MAJA
306 rorx $41, e, y0 # y0 = e >> 41 # S1A
307 add 2*8+frame_XFER(%rsp), h # h = k + w + h # --
308
309 rorx $18, e, y1 # y1 = e >> 18 # S1B
310 or c, y3 # y3 = a|c # MAJA
311 mov f, y2 # y2 = f # CH
312 xor g, y2 # y2 = f^g # CH
313
314 rorx $34, a, T1 # T1 = a >> 34 # S0B
315 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
316 and e, y2 # y2 = (f^g)&e # CH
317
318 rorx $14, e, y1 # y1 = (e >> 14) # S1
319 add h, d # d = k + w + h + d # --
320 and b, y3 # y3 = (a|c)&b # MAJA
321
322 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
323 rorx $39, a, y1 # y1 = a >> 39 # S0A
324 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
325
326 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
327 rorx $28, a, T1 # T1 = (a >> 28) # S0
328
329 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
330 mov a, T1 # T1 = a # MAJB
331 and c, T1 # T1 = a&c # MAJB
332 add y0, y2 # y2 = S1 + CH # --
333
334 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
335 add y1, h # h = k + w + h + S0 # --
336 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
337 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
338
339 add y3, h # h = t1 + S0 + MAJ # --
340
341 RotateState
342
343################################### RND N + 3 #########################################
344
345 vpsrlq $19, Y_0, YTMP3 # YTMP3 = W[-2] >> 19 {DC--}
346 vpsllq $(64-19), Y_0, YTMP1 # YTMP1 = W[-2] << 19 {DC--}
347 vpor YTMP1, YTMP3, YTMP3 # YTMP3 = W[-2] ror 19 {DC--}
348 vpxor YTMP3, YTMP4, YTMP4 # YTMP4 = W[-2] ror 19 ^ W[-2] >> 6 {DC--}
349 vpsrlq $61, Y_0, YTMP3 # YTMP3 = W[-2] >> 61 {DC--}
350 vpsllq $(64-61), Y_0, YTMP1 # YTMP1 = W[-2] << 61 {DC--}
351 vpor YTMP1, YTMP3, YTMP3 # YTMP3 = W[-2] ror 61 {DC--}
352 vpxor YTMP3, YTMP4, YTMP4 # YTMP4 = s1 = (W[-2] ror 19) ^
353 # (W[-2] ror 61) ^ (W[-2] >> 6) {DC--}
354
355 # Add the sigma0 + w[t-7] + w[t-16] for w[18] and w[19]
356 # to newly calculated sigma1 to get w[18] and w[19]
357 vpaddq YTMP4, YTMP0, YTMP2 # YTMP2 = {W[3], W[2], --, --}
358
359 # Form w[19, w[18], w17], w[16]
360 vpblendd $0xF0, YTMP2, Y_0, Y_0 # Y_0 = {W[3], W[2], W[1], W[0]}
361
362 mov a, y3 # y3 = a # MAJA
363 rorx $41, e, y0 # y0 = e >> 41 # S1A
364 rorx $18, e, y1 # y1 = e >> 18 # S1B
365 add 3*8+frame_XFER(%rsp), h # h = k + w + h # --
366 or c, y3 # y3 = a|c # MAJA
367
368
369 mov f, y2 # y2 = f # CH
370 rorx $34, a, T1 # T1 = a >> 34 # S0B
371 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
372 xor g, y2 # y2 = f^g # CH
373
374
375 rorx $14, e, y1 # y1 = (e >> 14) # S1
376 and e, y2 # y2 = (f^g)&e # CH
377 add h, d # d = k + w + h + d # --
378 and b, y3 # y3 = (a|c)&b # MAJA
379
380 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
381 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
382
383 rorx $39, a, y1 # y1 = a >> 39 # S0A
384 add y0, y2 # y2 = S1 + CH # --
385
386 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
387 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
388
389 rorx $28, a, T1 # T1 = (a >> 28) # S0
390
391 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
392 mov a, T1 # T1 = a # MAJB
393 and c, T1 # T1 = a&c # MAJB
394 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
395
396 add y1, h # h = k + w + h + S0 # --
397 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
398 add y3, h # h = t1 + S0 + MAJ # --
399
400 RotateState
401
402 rotate_Ys
403.endm
404
405.macro DO_4ROUNDS
406
407################################### RND N + 0 #########################################
408
409 mov f, y2 # y2 = f # CH
410 rorx $41, e, y0 # y0 = e >> 41 # S1A
411 rorx $18, e, y1 # y1 = e >> 18 # S1B
412 xor g, y2 # y2 = f^g # CH
413
414 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
415 rorx $14, e, y1 # y1 = (e >> 14) # S1
416 and e, y2 # y2 = (f^g)&e # CH
417
418 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
419 rorx $34, a, T1 # T1 = a >> 34 # S0B
420 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
421 rorx $39, a, y1 # y1 = a >> 39 # S0A
422 mov a, y3 # y3 = a # MAJA
423
424 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
425 rorx $28, a, T1 # T1 = (a >> 28) # S0
426 add frame_XFER(%rsp), h # h = k + w + h # --
427 or c, y3 # y3 = a|c # MAJA
428
429 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
430 mov a, T1 # T1 = a # MAJB
431 and b, y3 # y3 = (a|c)&b # MAJA
432 and c, T1 # T1 = a&c # MAJB
433 add y0, y2 # y2 = S1 + CH # --
434
435 add h, d # d = k + w + h + d # --
436 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
437 add y1, h # h = k + w + h + S0 # --
438
439 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
440
441 RotateState
442
443################################### RND N + 1 #########################################
444
445 add y2, old_h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
446 mov f, y2 # y2 = f # CH
447 rorx $41, e, y0 # y0 = e >> 41 # S1A
448 rorx $18, e, y1 # y1 = e >> 18 # S1B
449 xor g, y2 # y2 = f^g # CH
450
451 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
452 rorx $14, e, y1 # y1 = (e >> 14) # S1
453 and e, y2 # y2 = (f^g)&e # CH
454 add y3, old_h # h = t1 + S0 + MAJ # --
455
456 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
457 rorx $34, a, T1 # T1 = a >> 34 # S0B
458 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
459 rorx $39, a, y1 # y1 = a >> 39 # S0A
460 mov a, y3 # y3 = a # MAJA
461
462 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
463 rorx $28, a, T1 # T1 = (a >> 28) # S0
464 add 8*1+frame_XFER(%rsp), h # h = k + w + h # --
465 or c, y3 # y3 = a|c # MAJA
466
467 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
468 mov a, T1 # T1 = a # MAJB
469 and b, y3 # y3 = (a|c)&b # MAJA
470 and c, T1 # T1 = a&c # MAJB
471 add y0, y2 # y2 = S1 + CH # --
472
473 add h, d # d = k + w + h + d # --
474 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
475 add y1, h # h = k + w + h + S0 # --
476
477 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
478
479 RotateState
480
481################################### RND N + 2 #########################################
482
483 add y2, old_h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
484 mov f, y2 # y2 = f # CH
485 rorx $41, e, y0 # y0 = e >> 41 # S1A
486 rorx $18, e, y1 # y1 = e >> 18 # S1B
487 xor g, y2 # y2 = f^g # CH
488
489 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
490 rorx $14, e, y1 # y1 = (e >> 14) # S1
491 and e, y2 # y2 = (f^g)&e # CH
492 add y3, old_h # h = t1 + S0 + MAJ # --
493
494 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
495 rorx $34, a, T1 # T1 = a >> 34 # S0B
496 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
497 rorx $39, a, y1 # y1 = a >> 39 # S0A
498 mov a, y3 # y3 = a # MAJA
499
500 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
501 rorx $28, a, T1 # T1 = (a >> 28) # S0
502 add 8*2+frame_XFER(%rsp), h # h = k + w + h # --
503 or c, y3 # y3 = a|c # MAJA
504
505 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
506 mov a, T1 # T1 = a # MAJB
507 and b, y3 # y3 = (a|c)&b # MAJA
508 and c, T1 # T1 = a&c # MAJB
509 add y0, y2 # y2 = S1 + CH # --
510
511 add h, d # d = k + w + h + d # --
512 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
513 add y1, h # h = k + w + h + S0 # --
514
515 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
516
517 RotateState
518
519################################### RND N + 3 #########################################
520
521 add y2, old_h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
522 mov f, y2 # y2 = f # CH
523 rorx $41, e, y0 # y0 = e >> 41 # S1A
524 rorx $18, e, y1 # y1 = e >> 18 # S1B
525 xor g, y2 # y2 = f^g # CH
526
527 xor y1, y0 # y0 = (e>>41) ^ (e>>18) # S1
528 rorx $14, e, y1 # y1 = (e >> 14) # S1
529 and e, y2 # y2 = (f^g)&e # CH
530 add y3, old_h # h = t1 + S0 + MAJ # --
531
532 xor y1, y0 # y0 = (e>>41) ^ (e>>18) ^ (e>>14) # S1
533 rorx $34, a, T1 # T1 = a >> 34 # S0B
534 xor g, y2 # y2 = CH = ((f^g)&e)^g # CH
535 rorx $39, a, y1 # y1 = a >> 39 # S0A
536 mov a, y3 # y3 = a # MAJA
537
538 xor T1, y1 # y1 = (a>>39) ^ (a>>34) # S0
539 rorx $28, a, T1 # T1 = (a >> 28) # S0
540 add 8*3+frame_XFER(%rsp), h # h = k + w + h # --
541 or c, y3 # y3 = a|c # MAJA
542
543 xor T1, y1 # y1 = (a>>39) ^ (a>>34) ^ (a>>28) # S0
544 mov a, T1 # T1 = a # MAJB
545 and b, y3 # y3 = (a|c)&b # MAJA
546 and c, T1 # T1 = a&c # MAJB
547 add y0, y2 # y2 = S1 + CH # --
548
549
550 add h, d # d = k + w + h + d # --
551 or T1, y3 # y3 = MAJ = (a|c)&b)|(a&c) # MAJ
552 add y1, h # h = k + w + h + S0 # --
553
554 add y2, d # d = k + w + h + d + S1 + CH = d + t1 # --
555
556 add y2, h # h = k + w + h + S0 + S1 + CH = t1 + S0# --
557
558 add y3, h # h = t1 + S0 + MAJ # --
559
560 RotateState
561
562.endm
563
564########################################################################
565# void sha512_transform_rorx(const void* M, void* D, uint64_t L)#
566# Purpose: Updates the SHA512 digest stored at D with the message stored in M.
567# The size of the message pointed to by M must be an integer multiple of SHA512
568# message blocks.
569# L is the message length in SHA512 blocks
570########################################################################
571ENTRY(sha512_transform_rorx)
572 # Allocate Stack Space
573 mov %rsp, %rax
574 sub $frame_size, %rsp
575 and $~(0x20 - 1), %rsp
576 mov %rax, frame_RSPSAVE(%rsp)
577
578 # Save GPRs
579 mov %rbp, frame_GPRSAVE(%rsp)
580 mov %rbx, 8*1+frame_GPRSAVE(%rsp)
581 mov %r12, 8*2+frame_GPRSAVE(%rsp)
582 mov %r13, 8*3+frame_GPRSAVE(%rsp)
583 mov %r14, 8*4+frame_GPRSAVE(%rsp)
584 mov %r15, 8*5+frame_GPRSAVE(%rsp)
585
586 shl $7, NUM_BLKS # convert to bytes
587 jz done_hash
588 add INP, NUM_BLKS # pointer to end of data
589 mov NUM_BLKS, frame_INPEND(%rsp)
590
591 ## load initial digest
592 mov 8*0(CTX),a
593 mov 8*1(CTX),b
594 mov 8*2(CTX),c
595 mov 8*3(CTX),d
596 mov 8*4(CTX),e
597 mov 8*5(CTX),f
598 mov 8*6(CTX),g
599 mov 8*7(CTX),h
600
601 vmovdqa PSHUFFLE_BYTE_FLIP_MASK(%rip), BYTE_FLIP_MASK
602
603loop0:
604 lea K512(%rip), TBL
605
606 ## byte swap first 16 dwords
607 COPY_YMM_AND_BSWAP Y_0, (INP), BYTE_FLIP_MASK
608 COPY_YMM_AND_BSWAP Y_1, 1*32(INP), BYTE_FLIP_MASK
609 COPY_YMM_AND_BSWAP Y_2, 2*32(INP), BYTE_FLIP_MASK
610 COPY_YMM_AND_BSWAP Y_3, 3*32(INP), BYTE_FLIP_MASK
611
612 mov INP, frame_INP(%rsp)
613
614 ## schedule 64 input dwords, by doing 12 rounds of 4 each
615 movq $4, frame_SRND(%rsp)
616
617.align 16
618loop1:
619 vpaddq (TBL), Y_0, XFER
620 vmovdqa XFER, frame_XFER(%rsp)
621 FOUR_ROUNDS_AND_SCHED
622
623 vpaddq 1*32(TBL), Y_0, XFER
624 vmovdqa XFER, frame_XFER(%rsp)
625 FOUR_ROUNDS_AND_SCHED
626
627 vpaddq 2*32(TBL), Y_0, XFER
628 vmovdqa XFER, frame_XFER(%rsp)
629 FOUR_ROUNDS_AND_SCHED
630
631 vpaddq 3*32(TBL), Y_0, XFER
632 vmovdqa XFER, frame_XFER(%rsp)
633 add $(4*32), TBL
634 FOUR_ROUNDS_AND_SCHED
635
636 subq $1, frame_SRND(%rsp)
637 jne loop1
638
639 movq $2, frame_SRND(%rsp)
640loop2:
641 vpaddq (TBL), Y_0, XFER
642 vmovdqa XFER, frame_XFER(%rsp)
643 DO_4ROUNDS
644 vpaddq 1*32(TBL), Y_1, XFER
645 vmovdqa XFER, frame_XFER(%rsp)
646 add $(2*32), TBL
647 DO_4ROUNDS
648
649 vmovdqa Y_2, Y_0
650 vmovdqa Y_3, Y_1
651
652 subq $1, frame_SRND(%rsp)
653 jne loop2
654
655 addm 8*0(CTX),a
656 addm 8*1(CTX),b
657 addm 8*2(CTX),c
658 addm 8*3(CTX),d
659 addm 8*4(CTX),e
660 addm 8*5(CTX),f
661 addm 8*6(CTX),g
662 addm 8*7(CTX),h
663
664 mov frame_INP(%rsp), INP
665 add $128, INP
666 cmp frame_INPEND(%rsp), INP
667 jne loop0
668
669done_hash:
670
671# Restore GPRs
672 mov frame_GPRSAVE(%rsp) ,%rbp
673 mov 8*1+frame_GPRSAVE(%rsp) ,%rbx
674 mov 8*2+frame_GPRSAVE(%rsp) ,%r12
675 mov 8*3+frame_GPRSAVE(%rsp) ,%r13
676 mov 8*4+frame_GPRSAVE(%rsp) ,%r14
677 mov 8*5+frame_GPRSAVE(%rsp) ,%r15
678
679 # Restore Stack Pointer
680 mov frame_RSPSAVE(%rsp), %rsp
681 ret
682ENDPROC(sha512_transform_rorx)
683
684########################################################################
685### Binary Data
686
687.data
688
689.align 64
690# K[t] used in SHA512 hashing
691K512:
692 .quad 0x428a2f98d728ae22,0x7137449123ef65cd
693 .quad 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc
694 .quad 0x3956c25bf348b538,0x59f111f1b605d019
695 .quad 0x923f82a4af194f9b,0xab1c5ed5da6d8118
696 .quad 0xd807aa98a3030242,0x12835b0145706fbe
697 .quad 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2
698 .quad 0x72be5d74f27b896f,0x80deb1fe3b1696b1
699 .quad 0x9bdc06a725c71235,0xc19bf174cf692694
700 .quad 0xe49b69c19ef14ad2,0xefbe4786384f25e3
701 .quad 0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65
702 .quad 0x2de92c6f592b0275,0x4a7484aa6ea6e483
703 .quad 0x5cb0a9dcbd41fbd4,0x76f988da831153b5
704 .quad 0x983e5152ee66dfab,0xa831c66d2db43210
705 .quad 0xb00327c898fb213f,0xbf597fc7beef0ee4
706 .quad 0xc6e00bf33da88fc2,0xd5a79147930aa725
707 .quad 0x06ca6351e003826f,0x142929670a0e6e70
708 .quad 0x27b70a8546d22ffc,0x2e1b21385c26c926
709 .quad 0x4d2c6dfc5ac42aed,0x53380d139d95b3df
710 .quad 0x650a73548baf63de,0x766a0abb3c77b2a8
711 .quad 0x81c2c92e47edaee6,0x92722c851482353b
712 .quad 0xa2bfe8a14cf10364,0xa81a664bbc423001
713 .quad 0xc24b8b70d0f89791,0xc76c51a30654be30
714 .quad 0xd192e819d6ef5218,0xd69906245565a910
715 .quad 0xf40e35855771202a,0x106aa07032bbd1b8
716 .quad 0x19a4c116b8d2d0c8,0x1e376c085141ab53
717 .quad 0x2748774cdf8eeb99,0x34b0bcb5e19b48a8
718 .quad 0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb
719 .quad 0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3
720 .quad 0x748f82ee5defb2fc,0x78a5636f43172f60
721 .quad 0x84c87814a1f0ab72,0x8cc702081a6439ec
722 .quad 0x90befffa23631e28,0xa4506cebde82bde9
723 .quad 0xbef9a3f7b2c67915,0xc67178f2e372532b
724 .quad 0xca273eceea26619c,0xd186b8c721c0c207
725 .quad 0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178
726 .quad 0x06f067aa72176fba,0x0a637dc5a2c898a6
727 .quad 0x113f9804bef90dae,0x1b710b35131c471b
728 .quad 0x28db77f523047d84,0x32caab7b40c72493
729 .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
730 .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
731 .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
732
733.align 32
734
735# Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
736PSHUFFLE_BYTE_FLIP_MASK:
737 .octa 0x08090a0b0c0d0e0f0001020304050607
738 .octa 0x18191a1b1c1d1e1f1011121314151617
739
740MASK_YMM_LO:
741 .octa 0x00000000000000000000000000000000
742 .octa 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
743#endif
diff --git a/arch/x86/crypto/sha512-ssse3-asm.S b/arch/x86/crypto/sha512-ssse3-asm.S
new file mode 100644
index 000000000000..fb56855d51f5
--- /dev/null
+++ b/arch/x86/crypto/sha512-ssse3-asm.S
@@ -0,0 +1,421 @@
1########################################################################
2# Implement fast SHA-512 with SSSE3 instructions. (x86_64)
3#
4# Copyright (C) 2013 Intel Corporation.
5#
6# Authors:
7# James Guilford <james.guilford@intel.com>
8# Kirk Yap <kirk.s.yap@intel.com>
9# David Cote <david.m.cote@intel.com>
10# Tim Chen <tim.c.chen@linux.intel.com>
11#
12# This software is available to you under a choice of one of two
13# licenses. You may choose to be licensed under the terms of the GNU
14# General Public License (GPL) Version 2, available from the file
15# COPYING in the main directory of this source tree, or the
16# OpenIB.org BSD license below:
17#
18# Redistribution and use in source and binary forms, with or
19# without modification, are permitted provided that the following
20# conditions are met:
21#
22# - Redistributions of source code must retain the above
23# copyright notice, this list of conditions and the following
24# disclaimer.
25#
26# - Redistributions in binary form must reproduce the above
27# copyright notice, this list of conditions and the following
28# disclaimer in the documentation and/or other materials
29# provided with the distribution.
30#
31# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
35# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
36# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38# SOFTWARE.
39#
40########################################################################
41#
42# This code is described in an Intel White-Paper:
43# "Fast SHA-512 Implementations on Intel Architecture Processors"
44#
45# To find it, surf to http://www.intel.com/p/en_US/embedded
46# and search for that title.
47#
48########################################################################
49
50#include <linux/linkage.h>
51
52.text
53
54# Virtual Registers
55# ARG1
56msg = %rdi
57# ARG2
58digest = %rsi
59# ARG3
60msglen = %rdx
61T1 = %rcx
62T2 = %r8
63a_64 = %r9
64b_64 = %r10
65c_64 = %r11
66d_64 = %r12
67e_64 = %r13
68f_64 = %r14
69g_64 = %r15
70h_64 = %rbx
71tmp0 = %rax
72
73# Local variables (stack frame)
74
75W_SIZE = 80*8
76WK_SIZE = 2*8
77RSPSAVE_SIZE = 1*8
78GPRSAVE_SIZE = 5*8
79
80frame_W = 0
81frame_WK = frame_W + W_SIZE
82frame_RSPSAVE = frame_WK + WK_SIZE
83frame_GPRSAVE = frame_RSPSAVE + RSPSAVE_SIZE
84frame_size = frame_GPRSAVE + GPRSAVE_SIZE
85
86# Useful QWORD "arrays" for simpler memory references
87# MSG, DIGEST, K_t, W_t are arrays
88# WK_2(t) points to 1 of 2 qwords at frame.WK depdending on t being odd/even
89
90# Input message (arg1)
91#define MSG(i) 8*i(msg)
92
93# Output Digest (arg2)
94#define DIGEST(i) 8*i(digest)
95
96# SHA Constants (static mem)
97#define K_t(i) 8*i+K512(%rip)
98
99# Message Schedule (stack frame)
100#define W_t(i) 8*i+frame_W(%rsp)
101
102# W[t]+K[t] (stack frame)
103#define WK_2(i) 8*((i%2))+frame_WK(%rsp)
104
105.macro RotateState
106 # Rotate symbols a..h right
107 TMP = h_64
108 h_64 = g_64
109 g_64 = f_64
110 f_64 = e_64
111 e_64 = d_64
112 d_64 = c_64
113 c_64 = b_64
114 b_64 = a_64
115 a_64 = TMP
116.endm
117
118.macro SHA512_Round rnd
119
120 # Compute Round %%t
121 mov f_64, T1 # T1 = f
122 mov e_64, tmp0 # tmp = e
123 xor g_64, T1 # T1 = f ^ g
124 ror $23, tmp0 # 41 # tmp = e ror 23
125 and e_64, T1 # T1 = (f ^ g) & e
126 xor e_64, tmp0 # tmp = (e ror 23) ^ e
127 xor g_64, T1 # T1 = ((f ^ g) & e) ^ g = CH(e,f,g)
128 idx = \rnd
129 add WK_2(idx), T1 # W[t] + K[t] from message scheduler
130 ror $4, tmp0 # 18 # tmp = ((e ror 23) ^ e) ror 4
131 xor e_64, tmp0 # tmp = (((e ror 23) ^ e) ror 4) ^ e
132 mov a_64, T2 # T2 = a
133 add h_64, T1 # T1 = CH(e,f,g) + W[t] + K[t] + h
134 ror $14, tmp0 # 14 # tmp = ((((e ror23)^e)ror4)^e)ror14 = S1(e)
135 add tmp0, T1 # T1 = CH(e,f,g) + W[t] + K[t] + S1(e)
136 mov a_64, tmp0 # tmp = a
137 xor c_64, T2 # T2 = a ^ c
138 and c_64, tmp0 # tmp = a & c
139 and b_64, T2 # T2 = (a ^ c) & b
140 xor tmp0, T2 # T2 = ((a ^ c) & b) ^ (a & c) = Maj(a,b,c)
141 mov a_64, tmp0 # tmp = a
142 ror $5, tmp0 # 39 # tmp = a ror 5
143 xor a_64, tmp0 # tmp = (a ror 5) ^ a
144 add T1, d_64 # e(next_state) = d + T1
145 ror $6, tmp0 # 34 # tmp = ((a ror 5) ^ a) ror 6
146 xor a_64, tmp0 # tmp = (((a ror 5) ^ a) ror 6) ^ a
147 lea (T1, T2), h_64 # a(next_state) = T1 + Maj(a,b,c)
148 ror $28, tmp0 # 28 # tmp = ((((a ror5)^a)ror6)^a)ror28 = S0(a)
149 add tmp0, h_64 # a(next_state) = T1 + Maj(a,b,c) S0(a)
150 RotateState
151.endm
152
153.macro SHA512_2Sched_2Round_sse rnd
154
155 # Compute rounds t-2 and t-1
156 # Compute message schedule QWORDS t and t+1
157
158 # Two rounds are computed based on the values for K[t-2]+W[t-2] and
159 # K[t-1]+W[t-1] which were previously stored at WK_2 by the message
160 # scheduler.
161 # The two new schedule QWORDS are stored at [W_t(%%t)] and [W_t(%%t+1)].
162 # They are then added to their respective SHA512 constants at
163 # [K_t(%%t)] and [K_t(%%t+1)] and stored at dqword [WK_2(%%t)]
164 # For brievity, the comments following vectored instructions only refer to
165 # the first of a pair of QWORDS.
166 # Eg. XMM2=W[t-2] really means XMM2={W[t-2]|W[t-1]}
167 # The computation of the message schedule and the rounds are tightly
168 # stitched to take advantage of instruction-level parallelism.
169 # For clarity, integer instructions (for the rounds calculation) are indented
170 # by one tab. Vectored instructions (for the message scheduler) are indented
171 # by two tabs.
172
173 mov f_64, T1
174 idx = \rnd -2
175 movdqa W_t(idx), %xmm2 # XMM2 = W[t-2]
176 xor g_64, T1
177 and e_64, T1
178 movdqa %xmm2, %xmm0 # XMM0 = W[t-2]
179 xor g_64, T1
180 idx = \rnd
181 add WK_2(idx), T1
182 idx = \rnd - 15
183 movdqu W_t(idx), %xmm5 # XMM5 = W[t-15]
184 mov e_64, tmp0
185 ror $23, tmp0 # 41
186 movdqa %xmm5, %xmm3 # XMM3 = W[t-15]
187 xor e_64, tmp0
188 ror $4, tmp0 # 18
189 psrlq $61-19, %xmm0 # XMM0 = W[t-2] >> 42
190 xor e_64, tmp0
191 ror $14, tmp0 # 14
192 psrlq $(8-7), %xmm3 # XMM3 = W[t-15] >> 1
193 add tmp0, T1
194 add h_64, T1
195 pxor %xmm2, %xmm0 # XMM0 = (W[t-2] >> 42) ^ W[t-2]
196 mov a_64, T2
197 xor c_64, T2
198 pxor %xmm5, %xmm3 # XMM3 = (W[t-15] >> 1) ^ W[t-15]
199 and b_64, T2
200 mov a_64, tmp0
201 psrlq $(19-6), %xmm0 # XMM0 = ((W[t-2]>>42)^W[t-2])>>13
202 and c_64, tmp0
203 xor tmp0, T2
204 psrlq $(7-1), %xmm3 # XMM3 = ((W[t-15]>>1)^W[t-15])>>6
205 mov a_64, tmp0
206 ror $5, tmp0 # 39
207 pxor %xmm2, %xmm0 # XMM0 = (((W[t-2]>>42)^W[t-2])>>13)^W[t-2]
208 xor a_64, tmp0
209 ror $6, tmp0 # 34
210 pxor %xmm5, %xmm3 # XMM3 = (((W[t-15]>>1)^W[t-15])>>6)^W[t-15]
211 xor a_64, tmp0
212 ror $28, tmp0 # 28
213 psrlq $6, %xmm0 # XMM0 = ((((W[t-2]>>42)^W[t-2])>>13)^W[t-2])>>6
214 add tmp0, T2
215 add T1, d_64
216 psrlq $1, %xmm3 # XMM3 = (((W[t-15]>>1)^W[t-15])>>6)^W[t-15]>>1
217 lea (T1, T2), h_64
218 RotateState
219 movdqa %xmm2, %xmm1 # XMM1 = W[t-2]
220 mov f_64, T1
221 xor g_64, T1
222 movdqa %xmm5, %xmm4 # XMM4 = W[t-15]
223 and e_64, T1
224 xor g_64, T1
225 psllq $(64-19)-(64-61) , %xmm1 # XMM1 = W[t-2] << 42
226 idx = \rnd + 1
227 add WK_2(idx), T1
228 mov e_64, tmp0
229 psllq $(64-1)-(64-8), %xmm4 # XMM4 = W[t-15] << 7
230 ror $23, tmp0 # 41
231 xor e_64, tmp0
232 pxor %xmm2, %xmm1 # XMM1 = (W[t-2] << 42)^W[t-2]
233 ror $4, tmp0 # 18
234 xor e_64, tmp0
235 pxor %xmm5, %xmm4 # XMM4 = (W[t-15]<<7)^W[t-15]
236 ror $14, tmp0 # 14
237 add tmp0, T1
238 psllq $(64-61), %xmm1 # XMM1 = ((W[t-2] << 42)^W[t-2])<<3
239 add h_64, T1
240 mov a_64, T2
241 psllq $(64-8), %xmm4 # XMM4 = ((W[t-15]<<7)^W[t-15])<<56
242 xor c_64, T2
243 and b_64, T2
244 pxor %xmm1, %xmm0 # XMM0 = s1(W[t-2])
245 mov a_64, tmp0
246 and c_64, tmp0
247 idx = \rnd - 7
248 movdqu W_t(idx), %xmm1 # XMM1 = W[t-7]
249 xor tmp0, T2
250 pxor %xmm4, %xmm3 # XMM3 = s0(W[t-15])
251 mov a_64, tmp0
252 paddq %xmm3, %xmm0 # XMM0 = s1(W[t-2]) + s0(W[t-15])
253 ror $5, tmp0 # 39
254 idx =\rnd-16
255 paddq W_t(idx), %xmm0 # XMM0 = s1(W[t-2]) + s0(W[t-15]) + W[t-16]
256 xor a_64, tmp0
257 paddq %xmm1, %xmm0 # XMM0 = s1(W[t-2]) + W[t-7] + s0(W[t-15]) + W[t-16]
258 ror $6, tmp0 # 34
259 movdqa %xmm0, W_t(\rnd) # Store scheduled qwords
260 xor a_64, tmp0
261 paddq K_t(\rnd), %xmm0 # Compute W[t]+K[t]
262 ror $28, tmp0 # 28
263 idx = \rnd
264 movdqa %xmm0, WK_2(idx) # Store W[t]+K[t] for next rounds
265 add tmp0, T2
266 add T1, d_64
267 lea (T1, T2), h_64
268 RotateState
269.endm
270
271########################################################################
272# void sha512_transform_ssse3(const void* M, void* D, u64 L)#
273# Purpose: Updates the SHA512 digest stored at D with the message stored in M.
274# The size of the message pointed to by M must be an integer multiple of SHA512
275# message blocks.
276# L is the message length in SHA512 blocks.
277########################################################################
278ENTRY(sha512_transform_ssse3)
279
280 cmp $0, msglen
281 je nowork
282
283 # Allocate Stack Space
284 mov %rsp, %rax
285 sub $frame_size, %rsp
286 and $~(0x20 - 1), %rsp
287 mov %rax, frame_RSPSAVE(%rsp)
288
289 # Save GPRs
290 mov %rbx, frame_GPRSAVE(%rsp)
291 mov %r12, frame_GPRSAVE +8*1(%rsp)
292 mov %r13, frame_GPRSAVE +8*2(%rsp)
293 mov %r14, frame_GPRSAVE +8*3(%rsp)
294 mov %r15, frame_GPRSAVE +8*4(%rsp)
295
296updateblock:
297
298# Load state variables
299 mov DIGEST(0), a_64
300 mov DIGEST(1), b_64
301 mov DIGEST(2), c_64
302 mov DIGEST(3), d_64
303 mov DIGEST(4), e_64
304 mov DIGEST(5), f_64
305 mov DIGEST(6), g_64
306 mov DIGEST(7), h_64
307
308 t = 0
309 .rept 80/2 + 1
310 # (80 rounds) / (2 rounds/iteration) + (1 iteration)
311 # +1 iteration because the scheduler leads hashing by 1 iteration
312 .if t < 2
313 # BSWAP 2 QWORDS
314 movdqa XMM_QWORD_BSWAP(%rip), %xmm1
315 movdqu MSG(t), %xmm0
316 pshufb %xmm1, %xmm0 # BSWAP
317 movdqa %xmm0, W_t(t) # Store Scheduled Pair
318 paddq K_t(t), %xmm0 # Compute W[t]+K[t]
319 movdqa %xmm0, WK_2(t) # Store into WK for rounds
320 .elseif t < 16
321 # BSWAP 2 QWORDS# Compute 2 Rounds
322 movdqu MSG(t), %xmm0
323 pshufb %xmm1, %xmm0 # BSWAP
324 SHA512_Round t-2 # Round t-2
325 movdqa %xmm0, W_t(t) # Store Scheduled Pair
326 paddq K_t(t), %xmm0 # Compute W[t]+K[t]
327 SHA512_Round t-1 # Round t-1
328 movdqa %xmm0, WK_2(t) # Store W[t]+K[t] into WK
329 .elseif t < 79
330 # Schedule 2 QWORDS# Compute 2 Rounds
331 SHA512_2Sched_2Round_sse t
332 .else
333 # Compute 2 Rounds
334 SHA512_Round t-2
335 SHA512_Round t-1
336 .endif
337 t = t+2
338 .endr
339
340 # Update digest
341 add a_64, DIGEST(0)
342 add b_64, DIGEST(1)
343 add c_64, DIGEST(2)
344 add d_64, DIGEST(3)
345 add e_64, DIGEST(4)
346 add f_64, DIGEST(5)
347 add g_64, DIGEST(6)
348 add h_64, DIGEST(7)
349
350 # Advance to next message block
351 add $16*8, msg
352 dec msglen
353 jnz updateblock
354
355 # Restore GPRs
356 mov frame_GPRSAVE(%rsp), %rbx
357 mov frame_GPRSAVE +8*1(%rsp), %r12
358 mov frame_GPRSAVE +8*2(%rsp), %r13
359 mov frame_GPRSAVE +8*3(%rsp), %r14
360 mov frame_GPRSAVE +8*4(%rsp), %r15
361
362 # Restore Stack Pointer
363 mov frame_RSPSAVE(%rsp), %rsp
364
365nowork:
366 ret
367ENDPROC(sha512_transform_ssse3)
368
369########################################################################
370### Binary Data
371
372.data
373
374.align 16
375
376# Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
377XMM_QWORD_BSWAP:
378 .octa 0x08090a0b0c0d0e0f0001020304050607
379
380# K[t] used in SHA512 hashing
381K512:
382 .quad 0x428a2f98d728ae22,0x7137449123ef65cd
383 .quad 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc
384 .quad 0x3956c25bf348b538,0x59f111f1b605d019
385 .quad 0x923f82a4af194f9b,0xab1c5ed5da6d8118
386 .quad 0xd807aa98a3030242,0x12835b0145706fbe
387 .quad 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2
388 .quad 0x72be5d74f27b896f,0x80deb1fe3b1696b1
389 .quad 0x9bdc06a725c71235,0xc19bf174cf692694
390 .quad 0xe49b69c19ef14ad2,0xefbe4786384f25e3
391 .quad 0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65
392 .quad 0x2de92c6f592b0275,0x4a7484aa6ea6e483
393 .quad 0x5cb0a9dcbd41fbd4,0x76f988da831153b5
394 .quad 0x983e5152ee66dfab,0xa831c66d2db43210
395 .quad 0xb00327c898fb213f,0xbf597fc7beef0ee4
396 .quad 0xc6e00bf33da88fc2,0xd5a79147930aa725
397 .quad 0x06ca6351e003826f,0x142929670a0e6e70
398 .quad 0x27b70a8546d22ffc,0x2e1b21385c26c926
399 .quad 0x4d2c6dfc5ac42aed,0x53380d139d95b3df
400 .quad 0x650a73548baf63de,0x766a0abb3c77b2a8
401 .quad 0x81c2c92e47edaee6,0x92722c851482353b
402 .quad 0xa2bfe8a14cf10364,0xa81a664bbc423001
403 .quad 0xc24b8b70d0f89791,0xc76c51a30654be30
404 .quad 0xd192e819d6ef5218,0xd69906245565a910
405 .quad 0xf40e35855771202a,0x106aa07032bbd1b8
406 .quad 0x19a4c116b8d2d0c8,0x1e376c085141ab53
407 .quad 0x2748774cdf8eeb99,0x34b0bcb5e19b48a8
408 .quad 0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb
409 .quad 0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3
410 .quad 0x748f82ee5defb2fc,0x78a5636f43172f60
411 .quad 0x84c87814a1f0ab72,0x8cc702081a6439ec
412 .quad 0x90befffa23631e28,0xa4506cebde82bde9
413 .quad 0xbef9a3f7b2c67915,0xc67178f2e372532b
414 .quad 0xca273eceea26619c,0xd186b8c721c0c207
415 .quad 0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178
416 .quad 0x06f067aa72176fba,0x0a637dc5a2c898a6
417 .quad 0x113f9804bef90dae,0x1b710b35131c471b
418 .quad 0x28db77f523047d84,0x32caab7b40c72493
419 .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
420 .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
421 .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c
new file mode 100644
index 000000000000..6cbd8df348d2
--- /dev/null
+++ b/arch/x86/crypto/sha512_ssse3_glue.c
@@ -0,0 +1,282 @@
1/*
2 * Cryptographic API.
3 *
4 * Glue code for the SHA512 Secure Hash Algorithm assembler
5 * implementation using supplemental SSE3 / AVX / AVX2 instructions.
6 *
7 * This file is based on sha512_generic.c
8 *
9 * Copyright (C) 2013 Intel Corporation
10 * Author: Tim Chen <tim.c.chen@linux.intel.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
25 *
26 */
27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
30#include <crypto/internal/hash.h>
31#include <linux/init.h>
32#include <linux/module.h>
33#include <linux/mm.h>
34#include <linux/cryptohash.h>
35#include <linux/types.h>
36#include <crypto/sha.h>
37#include <asm/byteorder.h>
38#include <asm/i387.h>
39#include <asm/xcr.h>
40#include <asm/xsave.h>
41
42#include <linux/string.h>
43
44asmlinkage void sha512_transform_ssse3(const char *data, u64 *digest,
45 u64 rounds);
46#ifdef CONFIG_AS_AVX
47asmlinkage void sha512_transform_avx(const char *data, u64 *digest,
48 u64 rounds);
49#endif
50#ifdef CONFIG_AS_AVX2
51asmlinkage void sha512_transform_rorx(const char *data, u64 *digest,
52 u64 rounds);
53#endif
54
55static asmlinkage void (*sha512_transform_asm)(const char *, u64 *, u64);
56
57
58static int sha512_ssse3_init(struct shash_desc *desc)
59{
60 struct sha512_state *sctx = shash_desc_ctx(desc);
61
62 sctx->state[0] = SHA512_H0;
63 sctx->state[1] = SHA512_H1;
64 sctx->state[2] = SHA512_H2;
65 sctx->state[3] = SHA512_H3;
66 sctx->state[4] = SHA512_H4;
67 sctx->state[5] = SHA512_H5;
68 sctx->state[6] = SHA512_H6;
69 sctx->state[7] = SHA512_H7;
70 sctx->count[0] = sctx->count[1] = 0;
71
72 return 0;
73}
74
75static int __sha512_ssse3_update(struct shash_desc *desc, const u8 *data,
76 unsigned int len, unsigned int partial)
77{
78 struct sha512_state *sctx = shash_desc_ctx(desc);
79 unsigned int done = 0;
80
81 sctx->count[0] += len;
82 if (sctx->count[0] < len)
83 sctx->count[1]++;
84
85 if (partial) {
86 done = SHA512_BLOCK_SIZE - partial;
87 memcpy(sctx->buf + partial, data, done);
88 sha512_transform_asm(sctx->buf, sctx->state, 1);
89 }
90
91 if (len - done >= SHA512_BLOCK_SIZE) {
92 const unsigned int rounds = (len - done) / SHA512_BLOCK_SIZE;
93
94 sha512_transform_asm(data + done, sctx->state, (u64) rounds);
95
96 done += rounds * SHA512_BLOCK_SIZE;
97 }
98
99 memcpy(sctx->buf, data + done, len - done);
100
101 return 0;
102}
103
104static int sha512_ssse3_update(struct shash_desc *desc, const u8 *data,
105 unsigned int len)
106{
107 struct sha512_state *sctx = shash_desc_ctx(desc);
108 unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE;
109 int res;
110
111 /* Handle the fast case right here */
112 if (partial + len < SHA512_BLOCK_SIZE) {
113 sctx->count[0] += len;
114 if (sctx->count[0] < len)
115 sctx->count[1]++;
116 memcpy(sctx->buf + partial, data, len);
117
118 return 0;
119 }
120
121 if (!irq_fpu_usable()) {
122 res = crypto_sha512_update(desc, data, len);
123 } else {
124 kernel_fpu_begin();
125 res = __sha512_ssse3_update(desc, data, len, partial);
126 kernel_fpu_end();
127 }
128
129 return res;
130}
131
132
133/* Add padding and return the message digest. */
134static int sha512_ssse3_final(struct shash_desc *desc, u8 *out)
135{
136 struct sha512_state *sctx = shash_desc_ctx(desc);
137 unsigned int i, index, padlen;
138 __be64 *dst = (__be64 *)out;
139 __be64 bits[2];
140 static const u8 padding[SHA512_BLOCK_SIZE] = { 0x80, };
141
142 /* save number of bits */
143 bits[1] = cpu_to_be64(sctx->count[0] << 3);
144 bits[0] = cpu_to_be64(sctx->count[1] << 3) | sctx->count[0] >> 61;
145
146 /* Pad out to 112 mod 128 and append length */
147 index = sctx->count[0] & 0x7f;
148 padlen = (index < 112) ? (112 - index) : ((128+112) - index);
149
150 if (!irq_fpu_usable()) {
151 crypto_sha512_update(desc, padding, padlen);
152 crypto_sha512_update(desc, (const u8 *)&bits, sizeof(bits));
153 } else {
154 kernel_fpu_begin();
155 /* We need to fill a whole block for __sha512_ssse3_update() */
156 if (padlen <= 112) {
157 sctx->count[0] += padlen;
158 if (sctx->count[0] < padlen)
159 sctx->count[1]++;
160 memcpy(sctx->buf + index, padding, padlen);
161 } else {
162 __sha512_ssse3_update(desc, padding, padlen, index);
163 }
164 __sha512_ssse3_update(desc, (const u8 *)&bits,
165 sizeof(bits), 112);
166 kernel_fpu_end();
167 }
168
169 /* Store state in digest */
170 for (i = 0; i < 8; i++)
171 dst[i] = cpu_to_be64(sctx->state[i]);
172
173 /* Wipe context */
174 memset(sctx, 0, sizeof(*sctx));
175
176 return 0;
177}
178
179static int sha512_ssse3_export(struct shash_desc *desc, void *out)
180{
181 struct sha512_state *sctx = shash_desc_ctx(desc);
182
183 memcpy(out, sctx, sizeof(*sctx));
184
185 return 0;
186}
187
188static int sha512_ssse3_import(struct shash_desc *desc, const void *in)
189{
190 struct sha512_state *sctx = shash_desc_ctx(desc);
191
192 memcpy(sctx, in, sizeof(*sctx));
193
194 return 0;
195}
196
197static struct shash_alg alg = {
198 .digestsize = SHA512_DIGEST_SIZE,
199 .init = sha512_ssse3_init,
200 .update = sha512_ssse3_update,
201 .final = sha512_ssse3_final,
202 .export = sha512_ssse3_export,
203 .import = sha512_ssse3_import,
204 .descsize = sizeof(struct sha512_state),
205 .statesize = sizeof(struct sha512_state),
206 .base = {
207 .cra_name = "sha512",
208 .cra_driver_name = "sha512-ssse3",
209 .cra_priority = 150,
210 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
211 .cra_blocksize = SHA512_BLOCK_SIZE,
212 .cra_module = THIS_MODULE,
213 }
214};
215
216#ifdef CONFIG_AS_AVX
217static bool __init avx_usable(void)
218{
219 u64 xcr0;
220
221 if (!cpu_has_avx || !cpu_has_osxsave)
222 return false;
223
224 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
225 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
226 pr_info("AVX detected but unusable.\n");
227
228 return false;
229 }
230
231 return true;
232}
233#endif
234
235static int __init sha512_ssse3_mod_init(void)
236{
237 /* test for SSE3 first */
238 if (cpu_has_ssse3)
239 sha512_transform_asm = sha512_transform_ssse3;
240
241#ifdef CONFIG_AS_AVX
242 /* allow AVX to override SSSE3, it's a little faster */
243 if (avx_usable()) {
244#ifdef CONFIG_AS_AVX2
245 if (boot_cpu_has(X86_FEATURE_AVX2))
246 sha512_transform_asm = sha512_transform_rorx;
247 else
248#endif
249 sha512_transform_asm = sha512_transform_avx;
250 }
251#endif
252
253 if (sha512_transform_asm) {
254#ifdef CONFIG_AS_AVX
255 if (sha512_transform_asm == sha512_transform_avx)
256 pr_info("Using AVX optimized SHA-512 implementation\n");
257#ifdef CONFIG_AS_AVX2
258 else if (sha512_transform_asm == sha512_transform_rorx)
259 pr_info("Using AVX2 optimized SHA-512 implementation\n");
260#endif
261 else
262#endif
263 pr_info("Using SSSE3 optimized SHA-512 implementation\n");
264 return crypto_register_shash(&alg);
265 }
266 pr_info("Neither AVX nor SSSE3 is available/usable.\n");
267
268 return -ENODEV;
269}
270
271static void __exit sha512_ssse3_mod_fini(void)
272{
273 crypto_unregister_shash(&alg);
274}
275
276module_init(sha512_ssse3_mod_init);
277module_exit(sha512_ssse3_mod_fini);
278
279MODULE_LICENSE("GPL");
280MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, Supplemental SSE3 accelerated");
281
282MODULE_ALIAS("sha512");
diff --git a/arch/x86/crypto/twofish-avx-x86_64-asm_64.S b/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
index 8d3e113b2c95..05058134c443 100644
--- a/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
@@ -4,7 +4,7 @@
4 * Copyright (C) 2012 Johannes Goetzfried 4 * Copyright (C) 2012 Johannes Goetzfried
5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
6 * 6 *
7 * Copyright © 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> 7 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -33,6 +33,8 @@
33 33
34.Lbswap128_mask: 34.Lbswap128_mask:
35 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 35 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
36.Lxts_gf128mul_and_shl1_mask:
37 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
36 38
37.text 39.text
38 40
@@ -408,3 +410,47 @@ ENTRY(twofish_ctr_8way)
408 410
409 ret; 411 ret;
410ENDPROC(twofish_ctr_8way) 412ENDPROC(twofish_ctr_8way)
413
414ENTRY(twofish_xts_enc_8way)
415 /* input:
416 * %rdi: ctx, CTX
417 * %rsi: dst
418 * %rdx: src
419 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
420 */
421
422 movq %rsi, %r11;
423
424 /* regs <= src, dst <= IVs, regs <= regs xor IVs */
425 load_xts_8way(%rcx, %rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2,
426 RX0, RX1, RY0, .Lxts_gf128mul_and_shl1_mask);
427
428 call __twofish_enc_blk8;
429
430 /* dst <= regs xor IVs(in dst) */
431 store_xts_8way(%r11, RC1, RD1, RA1, RB1, RC2, RD2, RA2, RB2);
432
433 ret;
434ENDPROC(twofish_xts_enc_8way)
435
436ENTRY(twofish_xts_dec_8way)
437 /* input:
438 * %rdi: ctx, CTX
439 * %rsi: dst
440 * %rdx: src
441 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
442 */
443
444 movq %rsi, %r11;
445
446 /* regs <= src, dst <= IVs, regs <= regs xor IVs */
447 load_xts_8way(%rcx, %rdx, %rsi, RC1, RD1, RA1, RB1, RC2, RD2, RA2, RB2,
448 RX0, RX1, RY0, .Lxts_gf128mul_and_shl1_mask);
449
450 call __twofish_dec_blk8;
451
452 /* dst <= regs xor IVs(in dst) */
453 store_xts_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
454
455 ret;
456ENDPROC(twofish_xts_dec_8way)
diff --git a/arch/x86/crypto/twofish-avx2-asm_64.S b/arch/x86/crypto/twofish-avx2-asm_64.S
new file mode 100644
index 000000000000..e1a83b9cd389
--- /dev/null
+++ b/arch/x86/crypto/twofish-avx2-asm_64.S
@@ -0,0 +1,600 @@
1/*
2 * x86_64/AVX2 assembler optimized version of Twofish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
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#include <linux/linkage.h>
14#include "glue_helper-asm-avx2.S"
15
16.file "twofish-avx2-asm_64.S"
17
18.data
19.align 16
20
21.Lvpshufb_mask0:
22.long 0x80808000
23.long 0x80808004
24.long 0x80808008
25.long 0x8080800c
26
27.Lbswap128_mask:
28 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
29.Lxts_gf128mul_and_shl1_mask_0:
30 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
31.Lxts_gf128mul_and_shl1_mask_1:
32 .byte 0x0e, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0
33
34.text
35
36/* structure of crypto context */
37#define s0 0
38#define s1 1024
39#define s2 2048
40#define s3 3072
41#define w 4096
42#define k 4128
43
44/* register macros */
45#define CTX %rdi
46
47#define RS0 CTX
48#define RS1 %r8
49#define RS2 %r9
50#define RS3 %r10
51#define RK %r11
52#define RW %rax
53#define RROUND %r12
54#define RROUNDd %r12d
55
56#define RA0 %ymm8
57#define RB0 %ymm9
58#define RC0 %ymm10
59#define RD0 %ymm11
60#define RA1 %ymm12
61#define RB1 %ymm13
62#define RC1 %ymm14
63#define RD1 %ymm15
64
65/* temp regs */
66#define RX0 %ymm0
67#define RY0 %ymm1
68#define RX1 %ymm2
69#define RY1 %ymm3
70#define RT0 %ymm4
71#define RIDX %ymm5
72
73#define RX0x %xmm0
74#define RY0x %xmm1
75#define RX1x %xmm2
76#define RY1x %xmm3
77#define RT0x %xmm4
78
79/* vpgatherdd mask and '-1' */
80#define RNOT %ymm6
81
82/* byte mask, (-1 >> 24) */
83#define RBYTE %ymm7
84
85/**********************************************************************
86 16-way AVX2 twofish
87 **********************************************************************/
88#define init_round_constants() \
89 vpcmpeqd RNOT, RNOT, RNOT; \
90 vpsrld $24, RNOT, RBYTE; \
91 leaq k(CTX), RK; \
92 leaq w(CTX), RW; \
93 leaq s1(CTX), RS1; \
94 leaq s2(CTX), RS2; \
95 leaq s3(CTX), RS3; \
96
97#define g16(ab, rs0, rs1, rs2, rs3, xy) \
98 vpand RBYTE, ab ## 0, RIDX; \
99 vpgatherdd RNOT, (rs0, RIDX, 4), xy ## 0; \
100 vpcmpeqd RNOT, RNOT, RNOT; \
101 \
102 vpand RBYTE, ab ## 1, RIDX; \
103 vpgatherdd RNOT, (rs0, RIDX, 4), xy ## 1; \
104 vpcmpeqd RNOT, RNOT, RNOT; \
105 \
106 vpsrld $8, ab ## 0, RIDX; \
107 vpand RBYTE, RIDX, RIDX; \
108 vpgatherdd RNOT, (rs1, RIDX, 4), RT0; \
109 vpcmpeqd RNOT, RNOT, RNOT; \
110 vpxor RT0, xy ## 0, xy ## 0; \
111 \
112 vpsrld $8, ab ## 1, RIDX; \
113 vpand RBYTE, RIDX, RIDX; \
114 vpgatherdd RNOT, (rs1, RIDX, 4), RT0; \
115 vpcmpeqd RNOT, RNOT, RNOT; \
116 vpxor RT0, xy ## 1, xy ## 1; \
117 \
118 vpsrld $16, ab ## 0, RIDX; \
119 vpand RBYTE, RIDX, RIDX; \
120 vpgatherdd RNOT, (rs2, RIDX, 4), RT0; \
121 vpcmpeqd RNOT, RNOT, RNOT; \
122 vpxor RT0, xy ## 0, xy ## 0; \
123 \
124 vpsrld $16, ab ## 1, RIDX; \
125 vpand RBYTE, RIDX, RIDX; \
126 vpgatherdd RNOT, (rs2, RIDX, 4), RT0; \
127 vpcmpeqd RNOT, RNOT, RNOT; \
128 vpxor RT0, xy ## 1, xy ## 1; \
129 \
130 vpsrld $24, ab ## 0, RIDX; \
131 vpgatherdd RNOT, (rs3, RIDX, 4), RT0; \
132 vpcmpeqd RNOT, RNOT, RNOT; \
133 vpxor RT0, xy ## 0, xy ## 0; \
134 \
135 vpsrld $24, ab ## 1, RIDX; \
136 vpgatherdd RNOT, (rs3, RIDX, 4), RT0; \
137 vpcmpeqd RNOT, RNOT, RNOT; \
138 vpxor RT0, xy ## 1, xy ## 1;
139
140#define g1_16(a, x) \
141 g16(a, RS0, RS1, RS2, RS3, x);
142
143#define g2_16(b, y) \
144 g16(b, RS1, RS2, RS3, RS0, y);
145
146#define encrypt_round_end16(a, b, c, d, nk) \
147 vpaddd RY0, RX0, RX0; \
148 vpaddd RX0, RY0, RY0; \
149 vpbroadcastd nk(RK,RROUND,8), RT0; \
150 vpaddd RT0, RX0, RX0; \
151 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
152 vpaddd RT0, RY0, RY0; \
153 \
154 vpxor RY0, d ## 0, d ## 0; \
155 \
156 vpxor RX0, c ## 0, c ## 0; \
157 vpsrld $1, c ## 0, RT0; \
158 vpslld $31, c ## 0, c ## 0; \
159 vpor RT0, c ## 0, c ## 0; \
160 \
161 vpaddd RY1, RX1, RX1; \
162 vpaddd RX1, RY1, RY1; \
163 vpbroadcastd nk(RK,RROUND,8), RT0; \
164 vpaddd RT0, RX1, RX1; \
165 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
166 vpaddd RT0, RY1, RY1; \
167 \
168 vpxor RY1, d ## 1, d ## 1; \
169 \
170 vpxor RX1, c ## 1, c ## 1; \
171 vpsrld $1, c ## 1, RT0; \
172 vpslld $31, c ## 1, c ## 1; \
173 vpor RT0, c ## 1, c ## 1; \
174
175#define encrypt_round16(a, b, c, d, nk) \
176 g2_16(b, RY); \
177 \
178 vpslld $1, b ## 0, RT0; \
179 vpsrld $31, b ## 0, b ## 0; \
180 vpor RT0, b ## 0, b ## 0; \
181 \
182 vpslld $1, b ## 1, RT0; \
183 vpsrld $31, b ## 1, b ## 1; \
184 vpor RT0, b ## 1, b ## 1; \
185 \
186 g1_16(a, RX); \
187 \
188 encrypt_round_end16(a, b, c, d, nk);
189
190#define encrypt_round_first16(a, b, c, d, nk) \
191 vpslld $1, d ## 0, RT0; \
192 vpsrld $31, d ## 0, d ## 0; \
193 vpor RT0, d ## 0, d ## 0; \
194 \
195 vpslld $1, d ## 1, RT0; \
196 vpsrld $31, d ## 1, d ## 1; \
197 vpor RT0, d ## 1, d ## 1; \
198 \
199 encrypt_round16(a, b, c, d, nk);
200
201#define encrypt_round_last16(a, b, c, d, nk) \
202 g2_16(b, RY); \
203 \
204 g1_16(a, RX); \
205 \
206 encrypt_round_end16(a, b, c, d, nk);
207
208#define decrypt_round_end16(a, b, c, d, nk) \
209 vpaddd RY0, RX0, RX0; \
210 vpaddd RX0, RY0, RY0; \
211 vpbroadcastd nk(RK,RROUND,8), RT0; \
212 vpaddd RT0, RX0, RX0; \
213 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
214 vpaddd RT0, RY0, RY0; \
215 \
216 vpxor RX0, c ## 0, c ## 0; \
217 \
218 vpxor RY0, d ## 0, d ## 0; \
219 vpsrld $1, d ## 0, RT0; \
220 vpslld $31, d ## 0, d ## 0; \
221 vpor RT0, d ## 0, d ## 0; \
222 \
223 vpaddd RY1, RX1, RX1; \
224 vpaddd RX1, RY1, RY1; \
225 vpbroadcastd nk(RK,RROUND,8), RT0; \
226 vpaddd RT0, RX1, RX1; \
227 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
228 vpaddd RT0, RY1, RY1; \
229 \
230 vpxor RX1, c ## 1, c ## 1; \
231 \
232 vpxor RY1, d ## 1, d ## 1; \
233 vpsrld $1, d ## 1, RT0; \
234 vpslld $31, d ## 1, d ## 1; \
235 vpor RT0, d ## 1, d ## 1;
236
237#define decrypt_round16(a, b, c, d, nk) \
238 g1_16(a, RX); \
239 \
240 vpslld $1, a ## 0, RT0; \
241 vpsrld $31, a ## 0, a ## 0; \
242 vpor RT0, a ## 0, a ## 0; \
243 \
244 vpslld $1, a ## 1, RT0; \
245 vpsrld $31, a ## 1, a ## 1; \
246 vpor RT0, a ## 1, a ## 1; \
247 \
248 g2_16(b, RY); \
249 \
250 decrypt_round_end16(a, b, c, d, nk);
251
252#define decrypt_round_first16(a, b, c, d, nk) \
253 vpslld $1, c ## 0, RT0; \
254 vpsrld $31, c ## 0, c ## 0; \
255 vpor RT0, c ## 0, c ## 0; \
256 \
257 vpslld $1, c ## 1, RT0; \
258 vpsrld $31, c ## 1, c ## 1; \
259 vpor RT0, c ## 1, c ## 1; \
260 \
261 decrypt_round16(a, b, c, d, nk)
262
263#define decrypt_round_last16(a, b, c, d, nk) \
264 g1_16(a, RX); \
265 \
266 g2_16(b, RY); \
267 \
268 decrypt_round_end16(a, b, c, d, nk);
269
270#define encrypt_cycle16() \
271 encrypt_round16(RA, RB, RC, RD, 0); \
272 encrypt_round16(RC, RD, RA, RB, 8);
273
274#define encrypt_cycle_first16() \
275 encrypt_round_first16(RA, RB, RC, RD, 0); \
276 encrypt_round16(RC, RD, RA, RB, 8);
277
278#define encrypt_cycle_last16() \
279 encrypt_round16(RA, RB, RC, RD, 0); \
280 encrypt_round_last16(RC, RD, RA, RB, 8);
281
282#define decrypt_cycle16(n) \
283 decrypt_round16(RC, RD, RA, RB, 8); \
284 decrypt_round16(RA, RB, RC, RD, 0);
285
286#define decrypt_cycle_first16(n) \
287 decrypt_round_first16(RC, RD, RA, RB, 8); \
288 decrypt_round16(RA, RB, RC, RD, 0);
289
290#define decrypt_cycle_last16(n) \
291 decrypt_round16(RC, RD, RA, RB, 8); \
292 decrypt_round_last16(RA, RB, RC, RD, 0);
293
294#define transpose_4x4(x0,x1,x2,x3,t1,t2) \
295 vpunpckhdq x1, x0, t2; \
296 vpunpckldq x1, x0, x0; \
297 \
298 vpunpckldq x3, x2, t1; \
299 vpunpckhdq x3, x2, x2; \
300 \
301 vpunpckhqdq t1, x0, x1; \
302 vpunpcklqdq t1, x0, x0; \
303 \
304 vpunpckhqdq x2, t2, x3; \
305 vpunpcklqdq x2, t2, x2;
306
307#define read_blocks8(offs,a,b,c,d) \
308 transpose_4x4(a, b, c, d, RX0, RY0);
309
310#define write_blocks8(offs,a,b,c,d) \
311 transpose_4x4(a, b, c, d, RX0, RY0);
312
313#define inpack_enc8(a,b,c,d) \
314 vpbroadcastd 4*0(RW), RT0; \
315 vpxor RT0, a, a; \
316 \
317 vpbroadcastd 4*1(RW), RT0; \
318 vpxor RT0, b, b; \
319 \
320 vpbroadcastd 4*2(RW), RT0; \
321 vpxor RT0, c, c; \
322 \
323 vpbroadcastd 4*3(RW), RT0; \
324 vpxor RT0, d, d;
325
326#define outunpack_enc8(a,b,c,d) \
327 vpbroadcastd 4*4(RW), RX0; \
328 vpbroadcastd 4*5(RW), RY0; \
329 vpxor RX0, c, RX0; \
330 vpxor RY0, d, RY0; \
331 \
332 vpbroadcastd 4*6(RW), RT0; \
333 vpxor RT0, a, c; \
334 vpbroadcastd 4*7(RW), RT0; \
335 vpxor RT0, b, d; \
336 \
337 vmovdqa RX0, a; \
338 vmovdqa RY0, b;
339
340#define inpack_dec8(a,b,c,d) \
341 vpbroadcastd 4*4(RW), RX0; \
342 vpbroadcastd 4*5(RW), RY0; \
343 vpxor RX0, a, RX0; \
344 vpxor RY0, b, RY0; \
345 \
346 vpbroadcastd 4*6(RW), RT0; \
347 vpxor RT0, c, a; \
348 vpbroadcastd 4*7(RW), RT0; \
349 vpxor RT0, d, b; \
350 \
351 vmovdqa RX0, c; \
352 vmovdqa RY0, d;
353
354#define outunpack_dec8(a,b,c,d) \
355 vpbroadcastd 4*0(RW), RT0; \
356 vpxor RT0, a, a; \
357 \
358 vpbroadcastd 4*1(RW), RT0; \
359 vpxor RT0, b, b; \
360 \
361 vpbroadcastd 4*2(RW), RT0; \
362 vpxor RT0, c, c; \
363 \
364 vpbroadcastd 4*3(RW), RT0; \
365 vpxor RT0, d, d;
366
367#define read_blocks16(a,b,c,d) \
368 read_blocks8(0, a ## 0, b ## 0, c ## 0, d ## 0); \
369 read_blocks8(8, a ## 1, b ## 1, c ## 1, d ## 1);
370
371#define write_blocks16(a,b,c,d) \
372 write_blocks8(0, a ## 0, b ## 0, c ## 0, d ## 0); \
373 write_blocks8(8, a ## 1, b ## 1, c ## 1, d ## 1);
374
375#define xor_blocks16(a,b,c,d) \
376 xor_blocks8(0, a ## 0, b ## 0, c ## 0, d ## 0); \
377 xor_blocks8(8, a ## 1, b ## 1, c ## 1, d ## 1);
378
379#define inpack_enc16(a,b,c,d) \
380 inpack_enc8(a ## 0, b ## 0, c ## 0, d ## 0); \
381 inpack_enc8(a ## 1, b ## 1, c ## 1, d ## 1);
382
383#define outunpack_enc16(a,b,c,d) \
384 outunpack_enc8(a ## 0, b ## 0, c ## 0, d ## 0); \
385 outunpack_enc8(a ## 1, b ## 1, c ## 1, d ## 1);
386
387#define inpack_dec16(a,b,c,d) \
388 inpack_dec8(a ## 0, b ## 0, c ## 0, d ## 0); \
389 inpack_dec8(a ## 1, b ## 1, c ## 1, d ## 1);
390
391#define outunpack_dec16(a,b,c,d) \
392 outunpack_dec8(a ## 0, b ## 0, c ## 0, d ## 0); \
393 outunpack_dec8(a ## 1, b ## 1, c ## 1, d ## 1);
394
395.align 8
396__twofish_enc_blk16:
397 /* input:
398 * %rdi: ctx, CTX
399 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: plaintext
400 * output:
401 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: ciphertext
402 */
403 init_round_constants();
404
405 read_blocks16(RA, RB, RC, RD);
406 inpack_enc16(RA, RB, RC, RD);
407
408 xorl RROUNDd, RROUNDd;
409 encrypt_cycle_first16();
410 movl $2, RROUNDd;
411
412.align 4
413.L__enc_loop:
414 encrypt_cycle16();
415
416 addl $2, RROUNDd;
417 cmpl $14, RROUNDd;
418 jne .L__enc_loop;
419
420 encrypt_cycle_last16();
421
422 outunpack_enc16(RA, RB, RC, RD);
423 write_blocks16(RA, RB, RC, RD);
424
425 ret;
426ENDPROC(__twofish_enc_blk16)
427
428.align 8
429__twofish_dec_blk16:
430 /* input:
431 * %rdi: ctx, CTX
432 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: ciphertext
433 * output:
434 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: plaintext
435 */
436 init_round_constants();
437
438 read_blocks16(RA, RB, RC, RD);
439 inpack_dec16(RA, RB, RC, RD);
440
441 movl $14, RROUNDd;
442 decrypt_cycle_first16();
443 movl $12, RROUNDd;
444
445.align 4
446.L__dec_loop:
447 decrypt_cycle16();
448
449 addl $-2, RROUNDd;
450 jnz .L__dec_loop;
451
452 decrypt_cycle_last16();
453
454 outunpack_dec16(RA, RB, RC, RD);
455 write_blocks16(RA, RB, RC, RD);
456
457 ret;
458ENDPROC(__twofish_dec_blk16)
459
460ENTRY(twofish_ecb_enc_16way)
461 /* input:
462 * %rdi: ctx, CTX
463 * %rsi: dst
464 * %rdx: src
465 */
466
467 vzeroupper;
468 pushq %r12;
469
470 load_16way(%rdx, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
471
472 call __twofish_enc_blk16;
473
474 store_16way(%rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
475
476 popq %r12;
477 vzeroupper;
478
479 ret;
480ENDPROC(twofish_ecb_enc_16way)
481
482ENTRY(twofish_ecb_dec_16way)
483 /* input:
484 * %rdi: ctx, CTX
485 * %rsi: dst
486 * %rdx: src
487 */
488
489 vzeroupper;
490 pushq %r12;
491
492 load_16way(%rdx, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
493
494 call __twofish_dec_blk16;
495
496 store_16way(%rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
497
498 popq %r12;
499 vzeroupper;
500
501 ret;
502ENDPROC(twofish_ecb_dec_16way)
503
504ENTRY(twofish_cbc_dec_16way)
505 /* input:
506 * %rdi: ctx, CTX
507 * %rsi: dst
508 * %rdx: src
509 */
510
511 vzeroupper;
512 pushq %r12;
513
514 load_16way(%rdx, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
515
516 call __twofish_dec_blk16;
517
518 store_cbc_16way(%rdx, %rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1,
519 RX0);
520
521 popq %r12;
522 vzeroupper;
523
524 ret;
525ENDPROC(twofish_cbc_dec_16way)
526
527ENTRY(twofish_ctr_16way)
528 /* input:
529 * %rdi: ctx, CTX
530 * %rsi: dst (16 blocks)
531 * %rdx: src (16 blocks)
532 * %rcx: iv (little endian, 128bit)
533 */
534
535 vzeroupper;
536 pushq %r12;
537
538 load_ctr_16way(%rcx, .Lbswap128_mask, RA0, RB0, RC0, RD0, RA1, RB1, RC1,
539 RD1, RX0, RX0x, RX1, RX1x, RY0, RY0x, RY1, RY1x, RNOT,
540 RBYTE);
541
542 call __twofish_enc_blk16;
543
544 store_ctr_16way(%rdx, %rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
545
546 popq %r12;
547 vzeroupper;
548
549 ret;
550ENDPROC(twofish_ctr_16way)
551
552.align 8
553twofish_xts_crypt_16way:
554 /* input:
555 * %rdi: ctx, CTX
556 * %rsi: dst (16 blocks)
557 * %rdx: src (16 blocks)
558 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
559 * %r8: pointer to __twofish_enc_blk16 or __twofish_dec_blk16
560 */
561
562 vzeroupper;
563 pushq %r12;
564
565 load_xts_16way(%rcx, %rdx, %rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1,
566 RD1, RX0, RX0x, RX1, RX1x, RY0, RY0x, RY1, RY1x, RNOT,
567 .Lxts_gf128mul_and_shl1_mask_0,
568 .Lxts_gf128mul_and_shl1_mask_1);
569
570 call *%r8;
571
572 store_xts_16way(%rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
573
574 popq %r12;
575 vzeroupper;
576
577 ret;
578ENDPROC(twofish_xts_crypt_16way)
579
580ENTRY(twofish_xts_enc_16way)
581 /* input:
582 * %rdi: ctx, CTX
583 * %rsi: dst (16 blocks)
584 * %rdx: src (16 blocks)
585 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
586 */
587 leaq __twofish_enc_blk16, %r8;
588 jmp twofish_xts_crypt_16way;
589ENDPROC(twofish_xts_enc_16way)
590
591ENTRY(twofish_xts_dec_16way)
592 /* input:
593 * %rdi: ctx, CTX
594 * %rsi: dst (16 blocks)
595 * %rdx: src (16 blocks)
596 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
597 */
598 leaq __twofish_dec_blk16, %r8;
599 jmp twofish_xts_crypt_16way;
600ENDPROC(twofish_xts_dec_16way)
diff --git a/arch/x86/crypto/twofish_avx2_glue.c b/arch/x86/crypto/twofish_avx2_glue.c
new file mode 100644
index 000000000000..ce33b5be64ee
--- /dev/null
+++ b/arch/x86/crypto/twofish_avx2_glue.c
@@ -0,0 +1,584 @@
1/*
2 * Glue Code for x86_64/AVX2 assembler optimized version of Twofish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
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#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/crypto.h>
16#include <linux/err.h>
17#include <crypto/algapi.h>
18#include <crypto/ctr.h>
19#include <crypto/twofish.h>
20#include <crypto/lrw.h>
21#include <crypto/xts.h>
22#include <asm/xcr.h>
23#include <asm/xsave.h>
24#include <asm/crypto/twofish.h>
25#include <asm/crypto/ablk_helper.h>
26#include <asm/crypto/glue_helper.h>
27#include <crypto/scatterwalk.h>
28
29#define TF_AVX2_PARALLEL_BLOCKS 16
30
31/* 16-way AVX2 parallel cipher functions */
32asmlinkage void twofish_ecb_enc_16way(struct twofish_ctx *ctx, u8 *dst,
33 const u8 *src);
34asmlinkage void twofish_ecb_dec_16way(struct twofish_ctx *ctx, u8 *dst,
35 const u8 *src);
36asmlinkage void twofish_cbc_dec_16way(void *ctx, u128 *dst, const u128 *src);
37
38asmlinkage void twofish_ctr_16way(void *ctx, u128 *dst, const u128 *src,
39 le128 *iv);
40
41asmlinkage void twofish_xts_enc_16way(struct twofish_ctx *ctx, u8 *dst,
42 const u8 *src, le128 *iv);
43asmlinkage void twofish_xts_dec_16way(struct twofish_ctx *ctx, u8 *dst,
44 const u8 *src, le128 *iv);
45
46static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
47 const u8 *src)
48{
49 __twofish_enc_blk_3way(ctx, dst, src, false);
50}
51
52static const struct common_glue_ctx twofish_enc = {
53 .num_funcs = 4,
54 .fpu_blocks_limit = 8,
55
56 .funcs = { {
57 .num_blocks = 16,
58 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_enc_16way) }
59 }, {
60 .num_blocks = 8,
61 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_enc_8way) }
62 }, {
63 .num_blocks = 3,
64 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_enc_blk_3way) }
65 }, {
66 .num_blocks = 1,
67 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_enc_blk) }
68 } }
69};
70
71static const struct common_glue_ctx twofish_ctr = {
72 .num_funcs = 4,
73 .fpu_blocks_limit = 8,
74
75 .funcs = { {
76 .num_blocks = 16,
77 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_ctr_16way) }
78 }, {
79 .num_blocks = 8,
80 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_ctr_8way) }
81 }, {
82 .num_blocks = 3,
83 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_enc_blk_ctr_3way) }
84 }, {
85 .num_blocks = 1,
86 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_enc_blk_ctr) }
87 } }
88};
89
90static const struct common_glue_ctx twofish_enc_xts = {
91 .num_funcs = 3,
92 .fpu_blocks_limit = 8,
93
94 .funcs = { {
95 .num_blocks = 16,
96 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc_16way) }
97 }, {
98 .num_blocks = 8,
99 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc_8way) }
100 }, {
101 .num_blocks = 1,
102 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc) }
103 } }
104};
105
106static const struct common_glue_ctx twofish_dec = {
107 .num_funcs = 4,
108 .fpu_blocks_limit = 8,
109
110 .funcs = { {
111 .num_blocks = 16,
112 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_dec_16way) }
113 }, {
114 .num_blocks = 8,
115 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_dec_8way) }
116 }, {
117 .num_blocks = 3,
118 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_dec_blk_3way) }
119 }, {
120 .num_blocks = 1,
121 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_dec_blk) }
122 } }
123};
124
125static const struct common_glue_ctx twofish_dec_cbc = {
126 .num_funcs = 4,
127 .fpu_blocks_limit = 8,
128
129 .funcs = { {
130 .num_blocks = 16,
131 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_cbc_dec_16way) }
132 }, {
133 .num_blocks = 8,
134 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_cbc_dec_8way) }
135 }, {
136 .num_blocks = 3,
137 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_dec_blk_cbc_3way) }
138 }, {
139 .num_blocks = 1,
140 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_dec_blk) }
141 } }
142};
143
144static const struct common_glue_ctx twofish_dec_xts = {
145 .num_funcs = 3,
146 .fpu_blocks_limit = 8,
147
148 .funcs = { {
149 .num_blocks = 16,
150 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec_16way) }
151 }, {
152 .num_blocks = 8,
153 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec_8way) }
154 }, {
155 .num_blocks = 1,
156 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec) }
157 } }
158};
159
160static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
161 struct scatterlist *src, unsigned int nbytes)
162{
163 return glue_ecb_crypt_128bit(&twofish_enc, desc, dst, src, nbytes);
164}
165
166static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
167 struct scatterlist *src, unsigned int nbytes)
168{
169 return glue_ecb_crypt_128bit(&twofish_dec, desc, dst, src, nbytes);
170}
171
172static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
173 struct scatterlist *src, unsigned int nbytes)
174{
175 return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(twofish_enc_blk), desc,
176 dst, src, nbytes);
177}
178
179static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
180 struct scatterlist *src, unsigned int nbytes)
181{
182 return glue_cbc_decrypt_128bit(&twofish_dec_cbc, desc, dst, src,
183 nbytes);
184}
185
186static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
187 struct scatterlist *src, unsigned int nbytes)
188{
189 return glue_ctr_crypt_128bit(&twofish_ctr, desc, dst, src, nbytes);
190}
191
192static inline bool twofish_fpu_begin(bool fpu_enabled, unsigned int nbytes)
193{
194 /* since reusing AVX functions, starts using FPU at 8 parallel blocks */
195 return glue_fpu_begin(TF_BLOCK_SIZE, 8, NULL, fpu_enabled, nbytes);
196}
197
198static inline void twofish_fpu_end(bool fpu_enabled)
199{
200 glue_fpu_end(fpu_enabled);
201}
202
203struct crypt_priv {
204 struct twofish_ctx *ctx;
205 bool fpu_enabled;
206};
207
208static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
209{
210 const unsigned int bsize = TF_BLOCK_SIZE;
211 struct crypt_priv *ctx = priv;
212 int i;
213
214 ctx->fpu_enabled = twofish_fpu_begin(ctx->fpu_enabled, nbytes);
215
216 while (nbytes >= TF_AVX2_PARALLEL_BLOCKS * bsize) {
217 twofish_ecb_enc_16way(ctx->ctx, srcdst, srcdst);
218 srcdst += bsize * TF_AVX2_PARALLEL_BLOCKS;
219 nbytes -= bsize * TF_AVX2_PARALLEL_BLOCKS;
220 }
221
222 while (nbytes >= 8 * bsize) {
223 twofish_ecb_enc_8way(ctx->ctx, srcdst, srcdst);
224 srcdst += bsize * 8;
225 nbytes -= bsize * 8;
226 }
227
228 while (nbytes >= 3 * bsize) {
229 twofish_enc_blk_3way(ctx->ctx, srcdst, srcdst);
230 srcdst += bsize * 3;
231 nbytes -= bsize * 3;
232 }
233
234 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
235 twofish_enc_blk(ctx->ctx, srcdst, srcdst);
236}
237
238static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
239{
240 const unsigned int bsize = TF_BLOCK_SIZE;
241 struct crypt_priv *ctx = priv;
242 int i;
243
244 ctx->fpu_enabled = twofish_fpu_begin(ctx->fpu_enabled, nbytes);
245
246 while (nbytes >= TF_AVX2_PARALLEL_BLOCKS * bsize) {
247 twofish_ecb_dec_16way(ctx->ctx, srcdst, srcdst);
248 srcdst += bsize * TF_AVX2_PARALLEL_BLOCKS;
249 nbytes -= bsize * TF_AVX2_PARALLEL_BLOCKS;
250 }
251
252 while (nbytes >= 8 * bsize) {
253 twofish_ecb_dec_8way(ctx->ctx, srcdst, srcdst);
254 srcdst += bsize * 8;
255 nbytes -= bsize * 8;
256 }
257
258 while (nbytes >= 3 * bsize) {
259 twofish_dec_blk_3way(ctx->ctx, srcdst, srcdst);
260 srcdst += bsize * 3;
261 nbytes -= bsize * 3;
262 }
263
264 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
265 twofish_dec_blk(ctx->ctx, srcdst, srcdst);
266}
267
268static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
269 struct scatterlist *src, unsigned int nbytes)
270{
271 struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
272 be128 buf[TF_AVX2_PARALLEL_BLOCKS];
273 struct crypt_priv crypt_ctx = {
274 .ctx = &ctx->twofish_ctx,
275 .fpu_enabled = false,
276 };
277 struct lrw_crypt_req req = {
278 .tbuf = buf,
279 .tbuflen = sizeof(buf),
280
281 .table_ctx = &ctx->lrw_table,
282 .crypt_ctx = &crypt_ctx,
283 .crypt_fn = encrypt_callback,
284 };
285 int ret;
286
287 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
288 ret = lrw_crypt(desc, dst, src, nbytes, &req);
289 twofish_fpu_end(crypt_ctx.fpu_enabled);
290
291 return ret;
292}
293
294static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
295 struct scatterlist *src, unsigned int nbytes)
296{
297 struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
298 be128 buf[TF_AVX2_PARALLEL_BLOCKS];
299 struct crypt_priv crypt_ctx = {
300 .ctx = &ctx->twofish_ctx,
301 .fpu_enabled = false,
302 };
303 struct lrw_crypt_req req = {
304 .tbuf = buf,
305 .tbuflen = sizeof(buf),
306
307 .table_ctx = &ctx->lrw_table,
308 .crypt_ctx = &crypt_ctx,
309 .crypt_fn = decrypt_callback,
310 };
311 int ret;
312
313 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
314 ret = lrw_crypt(desc, dst, src, nbytes, &req);
315 twofish_fpu_end(crypt_ctx.fpu_enabled);
316
317 return ret;
318}
319
320static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
321 struct scatterlist *src, unsigned int nbytes)
322{
323 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
324
325 return glue_xts_crypt_128bit(&twofish_enc_xts, desc, dst, src, nbytes,
326 XTS_TWEAK_CAST(twofish_enc_blk),
327 &ctx->tweak_ctx, &ctx->crypt_ctx);
328}
329
330static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
331 struct scatterlist *src, unsigned int nbytes)
332{
333 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
334
335 return glue_xts_crypt_128bit(&twofish_dec_xts, desc, dst, src, nbytes,
336 XTS_TWEAK_CAST(twofish_enc_blk),
337 &ctx->tweak_ctx, &ctx->crypt_ctx);
338}
339
340static struct crypto_alg tf_algs[10] = { {
341 .cra_name = "__ecb-twofish-avx2",
342 .cra_driver_name = "__driver-ecb-twofish-avx2",
343 .cra_priority = 0,
344 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
345 .cra_blocksize = TF_BLOCK_SIZE,
346 .cra_ctxsize = sizeof(struct twofish_ctx),
347 .cra_alignmask = 0,
348 .cra_type = &crypto_blkcipher_type,
349 .cra_module = THIS_MODULE,
350 .cra_u = {
351 .blkcipher = {
352 .min_keysize = TF_MIN_KEY_SIZE,
353 .max_keysize = TF_MAX_KEY_SIZE,
354 .setkey = twofish_setkey,
355 .encrypt = ecb_encrypt,
356 .decrypt = ecb_decrypt,
357 },
358 },
359}, {
360 .cra_name = "__cbc-twofish-avx2",
361 .cra_driver_name = "__driver-cbc-twofish-avx2",
362 .cra_priority = 0,
363 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
364 .cra_blocksize = TF_BLOCK_SIZE,
365 .cra_ctxsize = sizeof(struct twofish_ctx),
366 .cra_alignmask = 0,
367 .cra_type = &crypto_blkcipher_type,
368 .cra_module = THIS_MODULE,
369 .cra_u = {
370 .blkcipher = {
371 .min_keysize = TF_MIN_KEY_SIZE,
372 .max_keysize = TF_MAX_KEY_SIZE,
373 .setkey = twofish_setkey,
374 .encrypt = cbc_encrypt,
375 .decrypt = cbc_decrypt,
376 },
377 },
378}, {
379 .cra_name = "__ctr-twofish-avx2",
380 .cra_driver_name = "__driver-ctr-twofish-avx2",
381 .cra_priority = 0,
382 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
383 .cra_blocksize = 1,
384 .cra_ctxsize = sizeof(struct twofish_ctx),
385 .cra_alignmask = 0,
386 .cra_type = &crypto_blkcipher_type,
387 .cra_module = THIS_MODULE,
388 .cra_u = {
389 .blkcipher = {
390 .min_keysize = TF_MIN_KEY_SIZE,
391 .max_keysize = TF_MAX_KEY_SIZE,
392 .ivsize = TF_BLOCK_SIZE,
393 .setkey = twofish_setkey,
394 .encrypt = ctr_crypt,
395 .decrypt = ctr_crypt,
396 },
397 },
398}, {
399 .cra_name = "__lrw-twofish-avx2",
400 .cra_driver_name = "__driver-lrw-twofish-avx2",
401 .cra_priority = 0,
402 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
403 .cra_blocksize = TF_BLOCK_SIZE,
404 .cra_ctxsize = sizeof(struct twofish_lrw_ctx),
405 .cra_alignmask = 0,
406 .cra_type = &crypto_blkcipher_type,
407 .cra_module = THIS_MODULE,
408 .cra_exit = lrw_twofish_exit_tfm,
409 .cra_u = {
410 .blkcipher = {
411 .min_keysize = TF_MIN_KEY_SIZE +
412 TF_BLOCK_SIZE,
413 .max_keysize = TF_MAX_KEY_SIZE +
414 TF_BLOCK_SIZE,
415 .ivsize = TF_BLOCK_SIZE,
416 .setkey = lrw_twofish_setkey,
417 .encrypt = lrw_encrypt,
418 .decrypt = lrw_decrypt,
419 },
420 },
421}, {
422 .cra_name = "__xts-twofish-avx2",
423 .cra_driver_name = "__driver-xts-twofish-avx2",
424 .cra_priority = 0,
425 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
426 .cra_blocksize = TF_BLOCK_SIZE,
427 .cra_ctxsize = sizeof(struct twofish_xts_ctx),
428 .cra_alignmask = 0,
429 .cra_type = &crypto_blkcipher_type,
430 .cra_module = THIS_MODULE,
431 .cra_u = {
432 .blkcipher = {
433 .min_keysize = TF_MIN_KEY_SIZE * 2,
434 .max_keysize = TF_MAX_KEY_SIZE * 2,
435 .ivsize = TF_BLOCK_SIZE,
436 .setkey = xts_twofish_setkey,
437 .encrypt = xts_encrypt,
438 .decrypt = xts_decrypt,
439 },
440 },
441}, {
442 .cra_name = "ecb(twofish)",
443 .cra_driver_name = "ecb-twofish-avx2",
444 .cra_priority = 500,
445 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
446 .cra_blocksize = TF_BLOCK_SIZE,
447 .cra_ctxsize = sizeof(struct async_helper_ctx),
448 .cra_alignmask = 0,
449 .cra_type = &crypto_ablkcipher_type,
450 .cra_module = THIS_MODULE,
451 .cra_init = ablk_init,
452 .cra_exit = ablk_exit,
453 .cra_u = {
454 .ablkcipher = {
455 .min_keysize = TF_MIN_KEY_SIZE,
456 .max_keysize = TF_MAX_KEY_SIZE,
457 .setkey = ablk_set_key,
458 .encrypt = ablk_encrypt,
459 .decrypt = ablk_decrypt,
460 },
461 },
462}, {
463 .cra_name = "cbc(twofish)",
464 .cra_driver_name = "cbc-twofish-avx2",
465 .cra_priority = 500,
466 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
467 .cra_blocksize = TF_BLOCK_SIZE,
468 .cra_ctxsize = sizeof(struct async_helper_ctx),
469 .cra_alignmask = 0,
470 .cra_type = &crypto_ablkcipher_type,
471 .cra_module = THIS_MODULE,
472 .cra_init = ablk_init,
473 .cra_exit = ablk_exit,
474 .cra_u = {
475 .ablkcipher = {
476 .min_keysize = TF_MIN_KEY_SIZE,
477 .max_keysize = TF_MAX_KEY_SIZE,
478 .ivsize = TF_BLOCK_SIZE,
479 .setkey = ablk_set_key,
480 .encrypt = __ablk_encrypt,
481 .decrypt = ablk_decrypt,
482 },
483 },
484}, {
485 .cra_name = "ctr(twofish)",
486 .cra_driver_name = "ctr-twofish-avx2",
487 .cra_priority = 500,
488 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
489 .cra_blocksize = 1,
490 .cra_ctxsize = sizeof(struct async_helper_ctx),
491 .cra_alignmask = 0,
492 .cra_type = &crypto_ablkcipher_type,
493 .cra_module = THIS_MODULE,
494 .cra_init = ablk_init,
495 .cra_exit = ablk_exit,
496 .cra_u = {
497 .ablkcipher = {
498 .min_keysize = TF_MIN_KEY_SIZE,
499 .max_keysize = TF_MAX_KEY_SIZE,
500 .ivsize = TF_BLOCK_SIZE,
501 .setkey = ablk_set_key,
502 .encrypt = ablk_encrypt,
503 .decrypt = ablk_encrypt,
504 .geniv = "chainiv",
505 },
506 },
507}, {
508 .cra_name = "lrw(twofish)",
509 .cra_driver_name = "lrw-twofish-avx2",
510 .cra_priority = 500,
511 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
512 .cra_blocksize = TF_BLOCK_SIZE,
513 .cra_ctxsize = sizeof(struct async_helper_ctx),
514 .cra_alignmask = 0,
515 .cra_type = &crypto_ablkcipher_type,
516 .cra_module = THIS_MODULE,
517 .cra_init = ablk_init,
518 .cra_exit = ablk_exit,
519 .cra_u = {
520 .ablkcipher = {
521 .min_keysize = TF_MIN_KEY_SIZE +
522 TF_BLOCK_SIZE,
523 .max_keysize = TF_MAX_KEY_SIZE +
524 TF_BLOCK_SIZE,
525 .ivsize = TF_BLOCK_SIZE,
526 .setkey = ablk_set_key,
527 .encrypt = ablk_encrypt,
528 .decrypt = ablk_decrypt,
529 },
530 },
531}, {
532 .cra_name = "xts(twofish)",
533 .cra_driver_name = "xts-twofish-avx2",
534 .cra_priority = 500,
535 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
536 .cra_blocksize = TF_BLOCK_SIZE,
537 .cra_ctxsize = sizeof(struct async_helper_ctx),
538 .cra_alignmask = 0,
539 .cra_type = &crypto_ablkcipher_type,
540 .cra_module = THIS_MODULE,
541 .cra_init = ablk_init,
542 .cra_exit = ablk_exit,
543 .cra_u = {
544 .ablkcipher = {
545 .min_keysize = TF_MIN_KEY_SIZE * 2,
546 .max_keysize = TF_MAX_KEY_SIZE * 2,
547 .ivsize = TF_BLOCK_SIZE,
548 .setkey = ablk_set_key,
549 .encrypt = ablk_encrypt,
550 .decrypt = ablk_decrypt,
551 },
552 },
553} };
554
555static int __init init(void)
556{
557 u64 xcr0;
558
559 if (!cpu_has_avx2 || !cpu_has_osxsave) {
560 pr_info("AVX2 instructions are not detected.\n");
561 return -ENODEV;
562 }
563
564 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
565 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
566 pr_info("AVX2 detected but unusable.\n");
567 return -ENODEV;
568 }
569
570 return crypto_register_algs(tf_algs, ARRAY_SIZE(tf_algs));
571}
572
573static void __exit fini(void)
574{
575 crypto_unregister_algs(tf_algs, ARRAY_SIZE(tf_algs));
576}
577
578module_init(init);
579module_exit(fini);
580
581MODULE_LICENSE("GPL");
582MODULE_DESCRIPTION("Twofish Cipher Algorithm, AVX2 optimized");
583MODULE_ALIAS("twofish");
584MODULE_ALIAS("twofish-asm");
diff --git a/arch/x86/crypto/twofish_avx_glue.c b/arch/x86/crypto/twofish_avx_glue.c
index 94ac91d26e47..2047a562f6b3 100644
--- a/arch/x86/crypto/twofish_avx_glue.c
+++ b/arch/x86/crypto/twofish_avx_glue.c
@@ -4,6 +4,8 @@
4 * Copyright (C) 2012 Johannes Goetzfried 4 * Copyright (C) 2012 Johannes Goetzfried
5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> 5 * <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>
6 * 6 *
7 * Copyright © 2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
@@ -48,13 +50,26 @@
48/* 8-way parallel cipher functions */ 50/* 8-way parallel cipher functions */
49asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst, 51asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst,
50 const u8 *src); 52 const u8 *src);
53EXPORT_SYMBOL_GPL(twofish_ecb_enc_8way);
54
51asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst, 55asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst,
52 const u8 *src); 56 const u8 *src);
57EXPORT_SYMBOL_GPL(twofish_ecb_dec_8way);
53 58
54asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst, 59asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst,
55 const u8 *src); 60 const u8 *src);
61EXPORT_SYMBOL_GPL(twofish_cbc_dec_8way);
62
56asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst, 63asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst,
57 const u8 *src, le128 *iv); 64 const u8 *src, le128 *iv);
65EXPORT_SYMBOL_GPL(twofish_ctr_8way);
66
67asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst,
68 const u8 *src, le128 *iv);
69EXPORT_SYMBOL_GPL(twofish_xts_enc_8way);
70asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst,
71 const u8 *src, le128 *iv);
72EXPORT_SYMBOL_GPL(twofish_xts_dec_8way);
58 73
59static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst, 74static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
60 const u8 *src) 75 const u8 *src)
@@ -62,6 +77,20 @@ static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
62 __twofish_enc_blk_3way(ctx, dst, src, false); 77 __twofish_enc_blk_3way(ctx, dst, src, false);
63} 78}
64 79
80void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
81{
82 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
83 GLUE_FUNC_CAST(twofish_enc_blk));
84}
85EXPORT_SYMBOL_GPL(twofish_xts_enc);
86
87void twofish_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv)
88{
89 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
90 GLUE_FUNC_CAST(twofish_dec_blk));
91}
92EXPORT_SYMBOL_GPL(twofish_xts_dec);
93
65 94
66static const struct common_glue_ctx twofish_enc = { 95static const struct common_glue_ctx twofish_enc = {
67 .num_funcs = 3, 96 .num_funcs = 3,
@@ -95,6 +124,19 @@ static const struct common_glue_ctx twofish_ctr = {
95 } } 124 } }
96}; 125};
97 126
127static const struct common_glue_ctx twofish_enc_xts = {
128 .num_funcs = 2,
129 .fpu_blocks_limit = TWOFISH_PARALLEL_BLOCKS,
130
131 .funcs = { {
132 .num_blocks = TWOFISH_PARALLEL_BLOCKS,
133 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc_8way) }
134 }, {
135 .num_blocks = 1,
136 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc) }
137 } }
138};
139
98static const struct common_glue_ctx twofish_dec = { 140static const struct common_glue_ctx twofish_dec = {
99 .num_funcs = 3, 141 .num_funcs = 3,
100 .fpu_blocks_limit = TWOFISH_PARALLEL_BLOCKS, 142 .fpu_blocks_limit = TWOFISH_PARALLEL_BLOCKS,
@@ -127,6 +169,19 @@ static const struct common_glue_ctx twofish_dec_cbc = {
127 } } 169 } }
128}; 170};
129 171
172static const struct common_glue_ctx twofish_dec_xts = {
173 .num_funcs = 2,
174 .fpu_blocks_limit = TWOFISH_PARALLEL_BLOCKS,
175
176 .funcs = { {
177 .num_blocks = TWOFISH_PARALLEL_BLOCKS,
178 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec_8way) }
179 }, {
180 .num_blocks = 1,
181 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec) }
182 } }
183};
184
130static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 185static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
131 struct scatterlist *src, unsigned int nbytes) 186 struct scatterlist *src, unsigned int nbytes)
132{ 187{
@@ -275,54 +330,20 @@ static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
275 struct scatterlist *src, unsigned int nbytes) 330 struct scatterlist *src, unsigned int nbytes)
276{ 331{
277 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 332 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
278 be128 buf[TWOFISH_PARALLEL_BLOCKS];
279 struct crypt_priv crypt_ctx = {
280 .ctx = &ctx->crypt_ctx,
281 .fpu_enabled = false,
282 };
283 struct xts_crypt_req req = {
284 .tbuf = buf,
285 .tbuflen = sizeof(buf),
286 333
287 .tweak_ctx = &ctx->tweak_ctx, 334 return glue_xts_crypt_128bit(&twofish_enc_xts, desc, dst, src, nbytes,
288 .tweak_fn = XTS_TWEAK_CAST(twofish_enc_blk), 335 XTS_TWEAK_CAST(twofish_enc_blk),
289 .crypt_ctx = &crypt_ctx, 336 &ctx->tweak_ctx, &ctx->crypt_ctx);
290 .crypt_fn = encrypt_callback,
291 };
292 int ret;
293
294 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
295 ret = xts_crypt(desc, dst, src, nbytes, &req);
296 twofish_fpu_end(crypt_ctx.fpu_enabled);
297
298 return ret;
299} 337}
300 338
301static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 339static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
302 struct scatterlist *src, unsigned int nbytes) 340 struct scatterlist *src, unsigned int nbytes)
303{ 341{
304 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); 342 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
305 be128 buf[TWOFISH_PARALLEL_BLOCKS];
306 struct crypt_priv crypt_ctx = {
307 .ctx = &ctx->crypt_ctx,
308 .fpu_enabled = false,
309 };
310 struct xts_crypt_req req = {
311 .tbuf = buf,
312 .tbuflen = sizeof(buf),
313
314 .tweak_ctx = &ctx->tweak_ctx,
315 .tweak_fn = XTS_TWEAK_CAST(twofish_enc_blk),
316 .crypt_ctx = &crypt_ctx,
317 .crypt_fn = decrypt_callback,
318 };
319 int ret;
320 343
321 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; 344 return glue_xts_crypt_128bit(&twofish_dec_xts, desc, dst, src, nbytes,
322 ret = xts_crypt(desc, dst, src, nbytes, &req); 345 XTS_TWEAK_CAST(twofish_enc_blk),
323 twofish_fpu_end(crypt_ctx.fpu_enabled); 346 &ctx->tweak_ctx, &ctx->crypt_ctx);
324
325 return ret;
326} 347}
327 348
328static struct crypto_alg twofish_algs[10] = { { 349static struct crypto_alg twofish_algs[10] = { {
diff --git a/arch/x86/ia32/Makefile b/arch/x86/ia32/Makefile
index 455646e0e532..e785b422b766 100644
--- a/arch/x86/ia32/Makefile
+++ b/arch/x86/ia32/Makefile
@@ -5,9 +5,6 @@
5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o 5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o
6obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o 6obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o
7 7
8sysv-$(CONFIG_SYSVIPC) := ipc32.o
9obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
10
11obj-$(CONFIG_IA32_AOUT) += ia32_aout.o 8obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
12 9
13audit-class-$(CONFIG_AUDIT) := audit.o 10audit-class-$(CONFIG_AUDIT) := audit.o
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 03abf9b70011..805078e08013 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -162,7 +162,6 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
162 fs = get_fs(); 162 fs = get_fs();
163 set_fs(KERNEL_DS); 163 set_fs(KERNEL_DS);
164 has_dumped = 1; 164 has_dumped = 1;
165 current->flags |= PF_DUMPCORE;
166 strncpy(dump.u_comm, current->comm, sizeof(current->comm)); 165 strncpy(dump.u_comm, current->comm, sizeof(current->comm));
167 dump.u_ar0 = offsetof(struct user32, regs); 166 dump.u_ar0 = offsetof(struct user32, regs);
168 dump.signal = signr; 167 dump.signal = signr;
@@ -323,11 +322,8 @@ static int load_aout_binary(struct linux_binprm *bprm)
323 322
324 if (N_MAGIC(ex) == OMAGIC) { 323 if (N_MAGIC(ex) == OMAGIC) {
325 unsigned long text_addr, map_size; 324 unsigned long text_addr, map_size;
326 loff_t pos;
327 325
328 text_addr = N_TXTADDR(ex); 326 text_addr = N_TXTADDR(ex);
329
330 pos = 32;
331 map_size = ex.a_text+ex.a_data; 327 map_size = ex.a_text+ex.a_data;
332 328
333 error = vm_brk(text_addr & PAGE_MASK, map_size); 329 error = vm_brk(text_addr & PAGE_MASK, map_size);
@@ -337,15 +333,12 @@ static int load_aout_binary(struct linux_binprm *bprm)
337 return error; 333 return error;
338 } 334 }
339 335
340 error = bprm->file->f_op->read(bprm->file, 336 error = read_code(bprm->file, text_addr, 32,
341 (char __user *)text_addr, 337 ex.a_text + ex.a_data);
342 ex.a_text+ex.a_data, &pos);
343 if ((signed long)error < 0) { 338 if ((signed long)error < 0) {
344 send_sig(SIGKILL, current, 0); 339 send_sig(SIGKILL, current, 0);
345 return error; 340 return error;
346 } 341 }
347
348 flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data);
349 } else { 342 } else {
350#ifdef WARN_OLD 343#ifdef WARN_OLD
351 static unsigned long error_time, error_time2; 344 static unsigned long error_time, error_time2;
@@ -367,15 +360,9 @@ static int load_aout_binary(struct linux_binprm *bprm)
367#endif 360#endif
368 361
369 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { 362 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) {
370 loff_t pos = fd_offset;
371
372 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); 363 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
373 bprm->file->f_op->read(bprm->file, 364 read_code(bprm->file, N_TXTADDR(ex), fd_offset,
374 (char __user *)N_TXTADDR(ex), 365 ex.a_text+ex.a_data);
375 ex.a_text+ex.a_data, &pos);
376 flush_icache_range((unsigned long) N_TXTADDR(ex),
377 (unsigned long) N_TXTADDR(ex) +
378 ex.a_text+ex.a_data);
379 goto beyond_if; 366 goto beyond_if;
380 } 367 }
381 368
@@ -452,8 +439,6 @@ static int load_aout_library(struct file *file)
452 start_addr = ex.a_entry & 0xfffff000; 439 start_addr = ex.a_entry & 0xfffff000;
453 440
454 if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) { 441 if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
455 loff_t pos = N_TXTOFF(ex);
456
457#ifdef WARN_OLD 442#ifdef WARN_OLD
458 static unsigned long error_time; 443 static unsigned long error_time;
459 if (time_after(jiffies, error_time + 5*HZ)) { 444 if (time_after(jiffies, error_time + 5*HZ)) {
@@ -466,12 +451,8 @@ static int load_aout_library(struct file *file)
466#endif 451#endif
467 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); 452 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
468 453
469 file->f_op->read(file, (char __user *)start_addr, 454 read_code(file, start_addr, N_TXTOFF(ex),
470 ex.a_text + ex.a_data, &pos); 455 ex.a_text + ex.a_data);
471 flush_icache_range((unsigned long) start_addr,
472 (unsigned long) start_addr + ex.a_text +
473 ex.a_data);
474
475 retval = 0; 456 retval = 0;
476 goto out; 457 goto out;
477 } 458 }
diff --git a/arch/x86/ia32/ipc32.c b/arch/x86/ia32/ipc32.c
deleted file mode 100644
index 29cdcd02ead3..000000000000
--- a/arch/x86/ia32/ipc32.c
+++ /dev/null
@@ -1,54 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/spinlock.h>
3#include <linux/list.h>
4#include <linux/syscalls.h>
5#include <linux/time.h>
6#include <linux/sem.h>
7#include <linux/msg.h>
8#include <linux/shm.h>
9#include <linux/ipc.h>
10#include <linux/compat.h>
11#include <asm/sys_ia32.h>
12
13asmlinkage long sys32_ipc(u32 call, int first, int second, int third,
14 compat_uptr_t ptr, u32 fifth)
15{
16 int version;
17
18 version = call >> 16; /* hack for backward compatibility */
19 call &= 0xffff;
20
21 switch (call) {
22 case SEMOP:
23 /* struct sembuf is the same on 32 and 64bit :)) */
24 return sys_semtimedop(first, compat_ptr(ptr), second, NULL);
25 case SEMTIMEDOP:
26 return compat_sys_semtimedop(first, compat_ptr(ptr), second,
27 compat_ptr(fifth));
28 case SEMGET:
29 return sys_semget(first, second, third);
30 case SEMCTL:
31 return compat_sys_semctl(first, second, third, compat_ptr(ptr));
32
33 case MSGSND:
34 return compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
35 case MSGRCV:
36 return compat_sys_msgrcv(first, second, fifth, third,
37 version, compat_ptr(ptr));
38 case MSGGET:
39 return sys_msgget((key_t) first, second);
40 case MSGCTL:
41 return compat_sys_msgctl(first, second, compat_ptr(ptr));
42
43 case SHMAT:
44 return compat_sys_shmat(first, second, third, version,
45 compat_ptr(ptr));
46 case SHMDT:
47 return sys_shmdt(compat_ptr(ptr));
48 case SHMGET:
49 return sys_shmget(first, (unsigned)second, third);
50 case SHMCTL:
51 return compat_sys_shmctl(first, second, compat_ptr(ptr));
52 }
53 return -ENOSYS;
54}
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index ad7a20cbc699..4e4907c67d92 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -166,12 +166,6 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg)
166 a.offset>>PAGE_SHIFT); 166 a.offset>>PAGE_SHIFT);
167} 167}
168 168
169asmlinkage long sys32_mprotect(unsigned long start, size_t len,
170 unsigned long prot)
171{
172 return sys_mprotect(start, len, prot);
173}
174
175asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr, 169asmlinkage long sys32_waitpid(compat_pid_t pid, unsigned int __user *stat_addr,
176 int options) 170 int options)
177{ 171{
@@ -194,35 +188,10 @@ asmlinkage long sys32_pwrite(unsigned int fd, const char __user *ubuf,
194} 188}
195 189
196 190
197asmlinkage long sys32_sendfile(int out_fd, int in_fd,
198 compat_off_t __user *offset, s32 count)
199{
200 mm_segment_t old_fs = get_fs();
201 int ret;
202 off_t of;
203
204 if (offset && get_user(of, offset))
205 return -EFAULT;
206
207 set_fs(KERNEL_DS);
208 ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL,
209 count);
210 set_fs(old_fs);
211
212 if (offset && put_user(of, offset))
213 return -EFAULT;
214 return ret;
215}
216
217/* 191/*
218 * Some system calls that need sign extended arguments. This could be 192 * Some system calls that need sign extended arguments. This could be
219 * done by a generic wrapper. 193 * done by a generic wrapper.
220 */ 194 */
221long sys32_kill(int pid, int sig)
222{
223 return sys_kill(pid, sig);
224}
225
226long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 195long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
227 __u32 len_low, __u32 len_high, int advice) 196 __u32 len_low, __u32 len_high, int advice)
228{ 197{
@@ -246,12 +215,6 @@ long sys32_vm86_warning(void)
246 return -ENOSYS; 215 return -ENOSYS;
247} 216}
248 217
249long sys32_lookup_dcookie(u32 addr_low, u32 addr_high,
250 char __user *buf, size_t len)
251{
252 return sys_lookup_dcookie(((u64)addr_high << 32) | addr_low, buf, len);
253}
254
255asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi, 218asmlinkage ssize_t sys32_readahead(int fd, unsigned off_lo, unsigned off_hi,
256 size_t count) 219 size_t count)
257{ 220{
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 11e1152222d0..2f03ff018d36 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -37,7 +37,4 @@ do { \
37 37
38#include <asm-generic/bug.h> 38#include <asm-generic/bug.h>
39 39
40
41extern void show_regs_common(void);
42
43#endif /* _ASM_X86_BUG_H */ 40#endif /* _ASM_X86_BUG_H */
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index 8d871eaddb66..d47786acb016 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -35,7 +35,7 @@ extern void __add_wrong_size(void)
35 35
36/* 36/*
37 * An exchange-type operation, which takes a value and a pointer, and 37 * An exchange-type operation, which takes a value and a pointer, and
38 * returns a the old value. 38 * returns the old value.
39 */ 39 */
40#define __xchg_op(ptr, arg, op, lock) \ 40#define __xchg_op(ptr, arg, op, lock) \
41 ({ \ 41 ({ \
diff --git a/arch/x86/include/asm/context_tracking.h b/arch/x86/include/asm/context_tracking.h
index 1616562683e9..1fe49704b146 100644
--- a/arch/x86/include/asm/context_tracking.h
+++ b/arch/x86/include/asm/context_tracking.h
@@ -1,31 +1,10 @@
1#ifndef _ASM_X86_CONTEXT_TRACKING_H 1#ifndef _ASM_X86_CONTEXT_TRACKING_H
2#define _ASM_X86_CONTEXT_TRACKING_H 2#define _ASM_X86_CONTEXT_TRACKING_H
3 3
4#ifndef __ASSEMBLY__
5#include <linux/context_tracking.h>
6#include <asm/ptrace.h>
7
8static inline void exception_enter(struct pt_regs *regs)
9{
10 user_exit();
11}
12
13static inline void exception_exit(struct pt_regs *regs)
14{
15#ifdef CONFIG_CONTEXT_TRACKING
16 if (user_mode(regs))
17 user_enter();
18#endif
19}
20
21#else /* __ASSEMBLY__ */
22
23#ifdef CONFIG_CONTEXT_TRACKING 4#ifdef CONFIG_CONTEXT_TRACKING
24# define SCHEDULE_USER call schedule_user 5# define SCHEDULE_USER call schedule_user
25#else 6#else
26# define SCHEDULE_USER call schedule 7# define SCHEDULE_USER call schedule
27#endif 8#endif
28 9
29#endif /* !__ASSEMBLY__ */
30
31#endif 10#endif
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 93fe929d1cee..e99ac27f95b2 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -9,6 +9,7 @@
9#endif 9#endif
10 10
11#define NCAPINTS 10 /* N 32-bit words worth of info */ 11#define NCAPINTS 10 /* N 32-bit words worth of info */
12#define NBUGINTS 1 /* N 32-bit bug flags */
12 13
13/* 14/*
14 * Note: If the comment begins with a quoted string, that string is used 15 * Note: If the comment begins with a quoted string, that string is used
@@ -100,6 +101,7 @@
100#define X86_FEATURE_AMD_DCM (3*32+27) /* multi-node processor */ 101#define X86_FEATURE_AMD_DCM (3*32+27) /* multi-node processor */
101#define X86_FEATURE_APERFMPERF (3*32+28) /* APERFMPERF */ 102#define X86_FEATURE_APERFMPERF (3*32+28) /* APERFMPERF */
102#define X86_FEATURE_EAGER_FPU (3*32+29) /* "eagerfpu" Non lazy FPU restore */ 103#define X86_FEATURE_EAGER_FPU (3*32+29) /* "eagerfpu" Non lazy FPU restore */
104#define X86_FEATURE_NONSTOP_TSC_S3 (3*32+30) /* TSC doesn't stop in S3 state */
103 105
104/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 106/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
105#define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */ 107#define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */
@@ -168,6 +170,7 @@
168#define X86_FEATURE_TOPOEXT (6*32+22) /* topology extensions CPUID leafs */ 170#define X86_FEATURE_TOPOEXT (6*32+22) /* topology extensions CPUID leafs */
169#define X86_FEATURE_PERFCTR_CORE (6*32+23) /* core performance counter extensions */ 171#define X86_FEATURE_PERFCTR_CORE (6*32+23) /* core performance counter extensions */
170#define X86_FEATURE_PERFCTR_NB (6*32+24) /* NB performance counter extensions */ 172#define X86_FEATURE_PERFCTR_NB (6*32+24) /* NB performance counter extensions */
173#define X86_FEATURE_PERFCTR_L2 (6*32+28) /* L2 performance counter extensions */
171 174
172/* 175/*
173 * Auxiliary flags: Linux defined - For features scattered in various 176 * Auxiliary flags: Linux defined - For features scattered in various
@@ -182,6 +185,7 @@
182#define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */ 185#define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */
183#define X86_FEATURE_DTHERM (7*32+ 7) /* Digital Thermal Sensor */ 186#define X86_FEATURE_DTHERM (7*32+ 7) /* Digital Thermal Sensor */
184#define X86_FEATURE_HW_PSTATE (7*32+ 8) /* AMD HW-PState */ 187#define X86_FEATURE_HW_PSTATE (7*32+ 8) /* AMD HW-PState */
188#define X86_FEATURE_PROC_FEEDBACK (7*32+ 9) /* AMD ProcFeedbackInterface */
185 189
186/* Virtualization flags: Linux defined, word 8 */ 190/* Virtualization flags: Linux defined, word 8 */
187#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ 191#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */
@@ -216,6 +220,17 @@
216#define X86_FEATURE_ADX (9*32+19) /* The ADCX and ADOX instructions */ 220#define X86_FEATURE_ADX (9*32+19) /* The ADCX and ADOX instructions */
217#define X86_FEATURE_SMAP (9*32+20) /* Supervisor Mode Access Prevention */ 221#define X86_FEATURE_SMAP (9*32+20) /* Supervisor Mode Access Prevention */
218 222
223/*
224 * BUG word(s)
225 */
226#define X86_BUG(x) (NCAPINTS*32 + (x))
227
228#define X86_BUG_F00F X86_BUG(0) /* Intel F00F */
229#define X86_BUG_FDIV X86_BUG(1) /* FPU FDIV */
230#define X86_BUG_COMA X86_BUG(2) /* Cyrix 6x86 coma */
231#define X86_BUG_AMD_TLB_MMATCH X86_BUG(3) /* AMD Erratum 383 */
232#define X86_BUG_AMD_APIC_C1E X86_BUG(4) /* AMD Erratum 400 */
233
219#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 234#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
220 235
221#include <asm/asm.h> 236#include <asm/asm.h>
@@ -278,6 +293,7 @@ extern const char * const x86_power_flags[32];
278#define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) 293#define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3)
279#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES) 294#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)
280#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX) 295#define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)
296#define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
281#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT) 297#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT)
282#define cpu_has_mp boot_cpu_has(X86_FEATURE_MP) 298#define cpu_has_mp boot_cpu_has(X86_FEATURE_MP)
283#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX) 299#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX)
@@ -311,6 +327,7 @@ extern const char * const x86_power_flags[32];
311#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ) 327#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ)
312#define cpu_has_perfctr_core boot_cpu_has(X86_FEATURE_PERFCTR_CORE) 328#define cpu_has_perfctr_core boot_cpu_has(X86_FEATURE_PERFCTR_CORE)
313#define cpu_has_perfctr_nb boot_cpu_has(X86_FEATURE_PERFCTR_NB) 329#define cpu_has_perfctr_nb boot_cpu_has(X86_FEATURE_PERFCTR_NB)
330#define cpu_has_perfctr_l2 boot_cpu_has(X86_FEATURE_PERFCTR_L2)
314#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8) 331#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8)
315#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16) 332#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16)
316#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU) 333#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU)
@@ -401,6 +418,13 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
401#define static_cpu_has(bit) boot_cpu_has(bit) 418#define static_cpu_has(bit) boot_cpu_has(bit)
402#endif 419#endif
403 420
421#define cpu_has_bug(c, bit) cpu_has(c, (bit))
422#define set_cpu_bug(c, bit) set_cpu_cap(c, (bit))
423#define clear_cpu_bug(c, bit) clear_cpu_cap(c, (bit));
424
425#define static_cpu_has_bug(bit) static_cpu_has((bit))
426#define boot_cpu_has_bug(bit) cpu_has_bug(&boot_cpu_data, (bit))
427
404#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ 428#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
405 429
406#endif /* _ASM_X86_CPUFEATURE_H */ 430#endif /* _ASM_X86_CPUFEATURE_H */
diff --git a/arch/x86/include/asm/crypto/blowfish.h b/arch/x86/include/asm/crypto/blowfish.h
new file mode 100644
index 000000000000..f097b2face10
--- /dev/null
+++ b/arch/x86/include/asm/crypto/blowfish.h
@@ -0,0 +1,43 @@
1#ifndef ASM_X86_BLOWFISH_H
2#define ASM_X86_BLOWFISH_H
3
4#include <linux/crypto.h>
5#include <crypto/blowfish.h>
6
7#define BF_PARALLEL_BLOCKS 4
8
9/* regular block cipher functions */
10asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src,
11 bool xor);
12asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src);
13
14/* 4-way parallel cipher functions */
15asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
16 const u8 *src, bool xor);
17asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst,
18 const u8 *src);
19
20static inline void blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src)
21{
22 __blowfish_enc_blk(ctx, dst, src, false);
23}
24
25static inline void blowfish_enc_blk_xor(struct bf_ctx *ctx, u8 *dst,
26 const u8 *src)
27{
28 __blowfish_enc_blk(ctx, dst, src, true);
29}
30
31static inline void blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
32 const u8 *src)
33{
34 __blowfish_enc_blk_4way(ctx, dst, src, false);
35}
36
37static inline void blowfish_enc_blk_xor_4way(struct bf_ctx *ctx, u8 *dst,
38 const u8 *src)
39{
40 __blowfish_enc_blk_4way(ctx, dst, src, true);
41}
42
43#endif
diff --git a/arch/x86/include/asm/crypto/camellia.h b/arch/x86/include/asm/crypto/camellia.h
index 98038add801e..bb93333d9200 100644
--- a/arch/x86/include/asm/crypto/camellia.h
+++ b/arch/x86/include/asm/crypto/camellia.h
@@ -48,6 +48,22 @@ asmlinkage void __camellia_enc_blk_2way(struct camellia_ctx *ctx, u8 *dst,
48asmlinkage void camellia_dec_blk_2way(struct camellia_ctx *ctx, u8 *dst, 48asmlinkage void camellia_dec_blk_2way(struct camellia_ctx *ctx, u8 *dst,
49 const u8 *src); 49 const u8 *src);
50 50
51/* 16-way parallel cipher functions (avx/aes-ni) */
52asmlinkage void camellia_ecb_enc_16way(struct camellia_ctx *ctx, u8 *dst,
53 const u8 *src);
54asmlinkage void camellia_ecb_dec_16way(struct camellia_ctx *ctx, u8 *dst,
55 const u8 *src);
56
57asmlinkage void camellia_cbc_dec_16way(struct camellia_ctx *ctx, u8 *dst,
58 const u8 *src);
59asmlinkage void camellia_ctr_16way(struct camellia_ctx *ctx, u8 *dst,
60 const u8 *src, le128 *iv);
61
62asmlinkage void camellia_xts_enc_16way(struct camellia_ctx *ctx, u8 *dst,
63 const u8 *src, le128 *iv);
64asmlinkage void camellia_xts_dec_16way(struct camellia_ctx *ctx, u8 *dst,
65 const u8 *src, le128 *iv);
66
51static inline void camellia_enc_blk(struct camellia_ctx *ctx, u8 *dst, 67static inline void camellia_enc_blk(struct camellia_ctx *ctx, u8 *dst,
52 const u8 *src) 68 const u8 *src)
53{ 69{
@@ -79,4 +95,7 @@ extern void camellia_crypt_ctr(void *ctx, u128 *dst, const u128 *src,
79extern void camellia_crypt_ctr_2way(void *ctx, u128 *dst, const u128 *src, 95extern void camellia_crypt_ctr_2way(void *ctx, u128 *dst, const u128 *src,
80 le128 *iv); 96 le128 *iv);
81 97
98extern void camellia_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv);
99extern void camellia_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv);
100
82#endif /* ASM_X86_CAMELLIA_H */ 101#endif /* ASM_X86_CAMELLIA_H */
diff --git a/arch/x86/include/asm/crypto/glue_helper.h b/arch/x86/include/asm/crypto/glue_helper.h
index e2d65b061d27..1eef55596e82 100644
--- a/arch/x86/include/asm/crypto/glue_helper.h
+++ b/arch/x86/include/asm/crypto/glue_helper.h
@@ -14,10 +14,13 @@ typedef void (*common_glue_func_t)(void *ctx, u8 *dst, const u8 *src);
14typedef void (*common_glue_cbc_func_t)(void *ctx, u128 *dst, const u128 *src); 14typedef void (*common_glue_cbc_func_t)(void *ctx, u128 *dst, const u128 *src);
15typedef void (*common_glue_ctr_func_t)(void *ctx, u128 *dst, const u128 *src, 15typedef void (*common_glue_ctr_func_t)(void *ctx, u128 *dst, const u128 *src,
16 le128 *iv); 16 le128 *iv);
17typedef void (*common_glue_xts_func_t)(void *ctx, u128 *dst, const u128 *src,
18 le128 *iv);
17 19
18#define GLUE_FUNC_CAST(fn) ((common_glue_func_t)(fn)) 20#define GLUE_FUNC_CAST(fn) ((common_glue_func_t)(fn))
19#define GLUE_CBC_FUNC_CAST(fn) ((common_glue_cbc_func_t)(fn)) 21#define GLUE_CBC_FUNC_CAST(fn) ((common_glue_cbc_func_t)(fn))
20#define GLUE_CTR_FUNC_CAST(fn) ((common_glue_ctr_func_t)(fn)) 22#define GLUE_CTR_FUNC_CAST(fn) ((common_glue_ctr_func_t)(fn))
23#define GLUE_XTS_FUNC_CAST(fn) ((common_glue_xts_func_t)(fn))
21 24
22struct common_glue_func_entry { 25struct common_glue_func_entry {
23 unsigned int num_blocks; /* number of blocks that @fn will process */ 26 unsigned int num_blocks; /* number of blocks that @fn will process */
@@ -25,6 +28,7 @@ struct common_glue_func_entry {
25 common_glue_func_t ecb; 28 common_glue_func_t ecb;
26 common_glue_cbc_func_t cbc; 29 common_glue_cbc_func_t cbc;
27 common_glue_ctr_func_t ctr; 30 common_glue_ctr_func_t ctr;
31 common_glue_xts_func_t xts;
28 } fn_u; 32 } fn_u;
29}; 33};
30 34
@@ -96,6 +100,16 @@ static inline void le128_inc(le128 *i)
96 i->b = cpu_to_le64(b); 100 i->b = cpu_to_le64(b);
97} 101}
98 102
103static inline void le128_gf128mul_x_ble(le128 *dst, const le128 *src)
104{
105 u64 a = le64_to_cpu(src->a);
106 u64 b = le64_to_cpu(src->b);
107 u64 _tt = ((s64)a >> 63) & 0x87;
108
109 dst->a = cpu_to_le64((a << 1) ^ (b >> 63));
110 dst->b = cpu_to_le64((b << 1) ^ _tt);
111}
112
99extern int glue_ecb_crypt_128bit(const struct common_glue_ctx *gctx, 113extern int glue_ecb_crypt_128bit(const struct common_glue_ctx *gctx,
100 struct blkcipher_desc *desc, 114 struct blkcipher_desc *desc,
101 struct scatterlist *dst, 115 struct scatterlist *dst,
@@ -118,4 +132,14 @@ extern int glue_ctr_crypt_128bit(const struct common_glue_ctx *gctx,
118 struct scatterlist *dst, 132 struct scatterlist *dst,
119 struct scatterlist *src, unsigned int nbytes); 133 struct scatterlist *src, unsigned int nbytes);
120 134
135extern int glue_xts_crypt_128bit(const struct common_glue_ctx *gctx,
136 struct blkcipher_desc *desc,
137 struct scatterlist *dst,
138 struct scatterlist *src, unsigned int nbytes,
139 common_glue_func_t tweak_fn, void *tweak_ctx,
140 void *crypt_ctx);
141
142extern void glue_xts_crypt_128bit_one(void *ctx, u128 *dst, const u128 *src,
143 le128 *iv, common_glue_func_t fn);
144
121#endif /* _CRYPTO_GLUE_HELPER_H */ 145#endif /* _CRYPTO_GLUE_HELPER_H */
diff --git a/arch/x86/include/asm/crypto/serpent-avx.h b/arch/x86/include/asm/crypto/serpent-avx.h
index 0da1d3e2a55c..33c2b8a435da 100644
--- a/arch/x86/include/asm/crypto/serpent-avx.h
+++ b/arch/x86/include/asm/crypto/serpent-avx.h
@@ -6,6 +6,16 @@
6 6
7#define SERPENT_PARALLEL_BLOCKS 8 7#define SERPENT_PARALLEL_BLOCKS 8
8 8
9struct serpent_lrw_ctx {
10 struct lrw_table_ctx lrw_table;
11 struct serpent_ctx serpent_ctx;
12};
13
14struct serpent_xts_ctx {
15 struct serpent_ctx tweak_ctx;
16 struct serpent_ctx crypt_ctx;
17};
18
9asmlinkage void serpent_ecb_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst, 19asmlinkage void serpent_ecb_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst,
10 const u8 *src); 20 const u8 *src);
11asmlinkage void serpent_ecb_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, 21asmlinkage void serpent_ecb_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst,
@@ -16,4 +26,23 @@ asmlinkage void serpent_cbc_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst,
16asmlinkage void serpent_ctr_8way_avx(struct serpent_ctx *ctx, u8 *dst, 26asmlinkage void serpent_ctr_8way_avx(struct serpent_ctx *ctx, u8 *dst,
17 const u8 *src, le128 *iv); 27 const u8 *src, le128 *iv);
18 28
29asmlinkage void serpent_xts_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst,
30 const u8 *src, le128 *iv);
31asmlinkage void serpent_xts_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst,
32 const u8 *src, le128 *iv);
33
34extern void __serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src,
35 le128 *iv);
36
37extern void serpent_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv);
38extern void serpent_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv);
39
40extern int lrw_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
41 unsigned int keylen);
42
43extern void lrw_serpent_exit_tfm(struct crypto_tfm *tfm);
44
45extern int xts_serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
46 unsigned int keylen);
47
19#endif 48#endif
diff --git a/arch/x86/include/asm/crypto/twofish.h b/arch/x86/include/asm/crypto/twofish.h
index 878c51ceebb5..e655c6029b45 100644
--- a/arch/x86/include/asm/crypto/twofish.h
+++ b/arch/x86/include/asm/crypto/twofish.h
@@ -28,6 +28,20 @@ asmlinkage void __twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
28asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst, 28asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst,
29 const u8 *src); 29 const u8 *src);
30 30
31/* 8-way parallel cipher functions */
32asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst,
33 const u8 *src);
34asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst,
35 const u8 *src);
36asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst,
37 const u8 *src);
38asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst,
39 const u8 *src, le128 *iv);
40asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst,
41 const u8 *src, le128 *iv);
42asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst,
43 const u8 *src, le128 *iv);
44
31/* helpers from twofish_x86_64-3way module */ 45/* helpers from twofish_x86_64-3way module */
32extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src); 46extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src);
33extern void twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src, 47extern void twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src,
@@ -43,4 +57,8 @@ extern void lrw_twofish_exit_tfm(struct crypto_tfm *tfm);
43extern int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key, 57extern int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
44 unsigned int keylen); 58 unsigned int keylen);
45 59
60/* helpers from twofish-avx module */
61extern void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv);
62extern void twofish_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv);
63
46#endif /* ASM_X86_TWOFISH_H */ 64#endif /* ASM_X86_TWOFISH_H */
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index 40afa0005c69..9bd4ecac72be 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -19,6 +19,10 @@ BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR)
19 19
20BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR) 20BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR)
21 21
22#ifdef CONFIG_HAVE_KVM
23BUILD_INTERRUPT(kvm_posted_intr_ipi, POSTED_INTR_VECTOR)
24#endif
25
22/* 26/*
23 * every pentium local APIC has two 'local interrupts', with a 27 * every pentium local APIC has two 'local interrupts', with a
24 * soft-definable vector attached to both interrupts, one of 28 * soft-definable vector attached to both interrupts, one of
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index a09c28571064..0dc7d9e21c34 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -104,12 +104,7 @@ enum fixed_addresses {
104 FIX_LI_PCIA, /* Lithium PCI Bridge A */ 104 FIX_LI_PCIA, /* Lithium PCI Bridge A */
105 FIX_LI_PCIB, /* Lithium PCI Bridge B */ 105 FIX_LI_PCIB, /* Lithium PCI Bridge B */
106#endif 106#endif
107#ifdef CONFIG_X86_F00F_BUG 107 FIX_RO_IDT, /* Virtual mapping for read-only IDT */
108 FIX_F00F_IDT, /* Virtual mapping for IDT */
109#endif
110#ifdef CONFIG_X86_CYCLONE_TIMER
111 FIX_CYCLONE_TIMER, /*cyclone timer register*/
112#endif
113#ifdef CONFIG_X86_32 108#ifdef CONFIG_X86_32
114 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 109 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
115 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, 110 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 81f04cee5f74..ab0ae1aa6d0a 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -12,6 +12,9 @@ typedef struct {
12 unsigned int irq_spurious_count; 12 unsigned int irq_spurious_count;
13 unsigned int icr_read_retry_count; 13 unsigned int icr_read_retry_count;
14#endif 14#endif
15#ifdef CONFIG_HAVE_KVM
16 unsigned int kvm_posted_intr_ipis;
17#endif
15 unsigned int x86_platform_ipis; /* arch dependent */ 18 unsigned int x86_platform_ipis; /* arch dependent */
16 unsigned int apic_perf_irqs; 19 unsigned int apic_perf_irqs;
17 unsigned int apic_irq_work_irqs; 20 unsigned int apic_irq_work_irqs;
diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h
index bdd35dbd0605..a8091216963b 100644
--- a/arch/x86/include/asm/hugetlb.h
+++ b/arch/x86/include/asm/hugetlb.h
@@ -2,6 +2,7 @@
2#define _ASM_X86_HUGETLB_H 2#define _ASM_X86_HUGETLB_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm-generic/hugetlb.h>
5 6
6 7
7static inline int is_hugepage_only_range(struct mm_struct *mm, 8static inline int is_hugepage_only_range(struct mm_struct *mm,
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 10a78c3d3d5a..1da97efad08a 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -28,6 +28,7 @@
28/* Interrupt handlers registered during init_IRQ */ 28/* Interrupt handlers registered during init_IRQ */
29extern void apic_timer_interrupt(void); 29extern void apic_timer_interrupt(void);
30extern void x86_platform_ipi(void); 30extern void x86_platform_ipi(void);
31extern void kvm_posted_intr_ipi(void);
31extern void error_interrupt(void); 32extern void error_interrupt(void);
32extern void irq_work_interrupt(void); 33extern void irq_work_interrupt(void);
33 34
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
index 86095ed14135..2d4b5e6107cd 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -20,13 +20,11 @@
20#ifndef _ASM_X86_HYPERVISOR_H 20#ifndef _ASM_X86_HYPERVISOR_H
21#define _ASM_X86_HYPERVISOR_H 21#define _ASM_X86_HYPERVISOR_H
22 22
23#ifdef CONFIG_HYPERVISOR_GUEST
24
23#include <asm/kvm_para.h> 25#include <asm/kvm_para.h>
24#include <asm/xen/hypervisor.h> 26#include <asm/xen/hypervisor.h>
25 27
26extern void init_hypervisor(struct cpuinfo_x86 *c);
27extern void init_hypervisor_platform(void);
28extern bool hypervisor_x2apic_available(void);
29
30/* 28/*
31 * x86 hypervisor information 29 * x86 hypervisor information
32 */ 30 */
@@ -55,4 +53,12 @@ extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
55extern const struct hypervisor_x86 x86_hyper_xen_hvm; 53extern const struct hypervisor_x86 x86_hyper_xen_hvm;
56extern const struct hypervisor_x86 x86_hyper_kvm; 54extern const struct hypervisor_x86 x86_hyper_kvm;
57 55
58#endif 56extern void init_hypervisor(struct cpuinfo_x86 *c);
57extern void init_hypervisor_platform(void);
58extern bool hypervisor_x2apic_available(void);
59#else
60static inline void init_hypervisor(struct cpuinfo_x86 *c) { }
61static inline void init_hypervisor_platform(void) { }
62static inline bool hypervisor_x2apic_available(void) { return false; }
63#endif /* CONFIG_HYPERVISOR_GUEST */
64#endif /* _ASM_X86_HYPERVISOR_H */
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 95fd3527f632..d806b228d2c0 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -24,10 +24,18 @@
24 24
25#include <asm/io_apic.h> 25#include <asm/io_apic.h>
26 26
27struct IO_APIC_route_entry;
28struct io_apic_irq_attr;
29struct irq_chip;
30struct msi_msg;
31struct pci_dev;
32struct irq_cfg;
33
27#ifdef CONFIG_IRQ_REMAP 34#ifdef CONFIG_IRQ_REMAP
28 35
29extern void setup_irq_remapping_ops(void); 36extern void setup_irq_remapping_ops(void);
30extern int irq_remapping_supported(void); 37extern int irq_remapping_supported(void);
38extern void set_irq_remapping_broken(void);
31extern int irq_remapping_prepare(void); 39extern int irq_remapping_prepare(void);
32extern int irq_remapping_enable(void); 40extern int irq_remapping_enable(void);
33extern void irq_remapping_disable(void); 41extern void irq_remapping_disable(void);
@@ -54,6 +62,7 @@ void irq_remap_modify_chip_defaults(struct irq_chip *chip);
54 62
55static inline void setup_irq_remapping_ops(void) { } 63static inline void setup_irq_remapping_ops(void) { }
56static inline int irq_remapping_supported(void) { return 0; } 64static inline int irq_remapping_supported(void) { return 0; }
65static inline void set_irq_remapping_broken(void) { }
57static inline int irq_remapping_prepare(void) { return -ENODEV; } 66static inline int irq_remapping_prepare(void) { return -ENODEV; }
58static inline int irq_remapping_enable(void) { return -ENODEV; } 67static inline int irq_remapping_enable(void) { return -ENODEV; }
59static inline void irq_remapping_disable(void) { } 68static inline void irq_remapping_disable(void) { }
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index aac5fa62a86c..5702d7e3111d 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -102,6 +102,11 @@
102 */ 102 */
103#define X86_PLATFORM_IPI_VECTOR 0xf7 103#define X86_PLATFORM_IPI_VECTOR 0xf7
104 104
105/* Vector for KVM to deliver posted interrupt IPI */
106#ifdef CONFIG_HAVE_KVM
107#define POSTED_INTR_VECTOR 0xf2
108#endif
109
105/* 110/*
106 * IRQ work vector: 111 * IRQ work vector:
107 */ 112 */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 4979778cc7fb..3741c653767c 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -31,7 +31,7 @@
31#include <asm/msr-index.h> 31#include <asm/msr-index.h>
32#include <asm/asm.h> 32#include <asm/asm.h>
33 33
34#define KVM_MAX_VCPUS 254 34#define KVM_MAX_VCPUS 255
35#define KVM_SOFT_MAX_VCPUS 160 35#define KVM_SOFT_MAX_VCPUS 160
36#define KVM_USER_MEM_SLOTS 125 36#define KVM_USER_MEM_SLOTS 125
37/* memory slots that are not exposed to userspace */ 37/* memory slots that are not exposed to userspace */
@@ -43,6 +43,8 @@
43#define KVM_PIO_PAGE_OFFSET 1 43#define KVM_PIO_PAGE_OFFSET 1
44#define KVM_COALESCED_MMIO_PAGE_OFFSET 2 44#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
45 45
46#define KVM_IRQCHIP_NUM_PINS KVM_IOAPIC_NUM_PINS
47
46#define CR0_RESERVED_BITS \ 48#define CR0_RESERVED_BITS \
47 (~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \ 49 (~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
48 | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \ 50 | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \
@@ -94,9 +96,6 @@
94 96
95#define ASYNC_PF_PER_VCPU 64 97#define ASYNC_PF_PER_VCPU 64
96 98
97extern raw_spinlock_t kvm_lock;
98extern struct list_head vm_list;
99
100struct kvm_vcpu; 99struct kvm_vcpu;
101struct kvm; 100struct kvm;
102struct kvm_async_pf; 101struct kvm_async_pf;
@@ -230,6 +229,7 @@ struct kvm_mmu_page {
230#endif 229#endif
231 230
232 int write_flooding_count; 231 int write_flooding_count;
232 bool mmio_cached;
233}; 233};
234 234
235struct kvm_pio_request { 235struct kvm_pio_request {
@@ -345,7 +345,6 @@ struct kvm_vcpu_arch {
345 unsigned long apic_attention; 345 unsigned long apic_attention;
346 int32_t apic_arb_prio; 346 int32_t apic_arb_prio;
347 int mp_state; 347 int mp_state;
348 int sipi_vector;
349 u64 ia32_misc_enable_msr; 348 u64 ia32_misc_enable_msr;
350 bool tpr_access_reporting; 349 bool tpr_access_reporting;
351 350
@@ -643,7 +642,7 @@ struct kvm_x86_ops {
643 /* Create, but do not attach this VCPU */ 642 /* Create, but do not attach this VCPU */
644 struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id); 643 struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id);
645 void (*vcpu_free)(struct kvm_vcpu *vcpu); 644 void (*vcpu_free)(struct kvm_vcpu *vcpu);
646 int (*vcpu_reset)(struct kvm_vcpu *vcpu); 645 void (*vcpu_reset)(struct kvm_vcpu *vcpu);
647 646
648 void (*prepare_guest_switch)(struct kvm_vcpu *vcpu); 647 void (*prepare_guest_switch)(struct kvm_vcpu *vcpu);
649 void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu); 648 void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
@@ -696,14 +695,16 @@ struct kvm_x86_ops {
696 int (*nmi_allowed)(struct kvm_vcpu *vcpu); 695 int (*nmi_allowed)(struct kvm_vcpu *vcpu);
697 bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); 696 bool (*get_nmi_mask)(struct kvm_vcpu *vcpu);
698 void (*set_nmi_mask)(struct kvm_vcpu *vcpu, bool masked); 697 void (*set_nmi_mask)(struct kvm_vcpu *vcpu, bool masked);
699 void (*enable_nmi_window)(struct kvm_vcpu *vcpu); 698 int (*enable_nmi_window)(struct kvm_vcpu *vcpu);
700 void (*enable_irq_window)(struct kvm_vcpu *vcpu); 699 int (*enable_irq_window)(struct kvm_vcpu *vcpu);
701 void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr); 700 void (*update_cr8_intercept)(struct kvm_vcpu *vcpu, int tpr, int irr);
702 int (*vm_has_apicv)(struct kvm *kvm); 701 int (*vm_has_apicv)(struct kvm *kvm);
703 void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr); 702 void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr);
704 void (*hwapic_isr_update)(struct kvm *kvm, int isr); 703 void (*hwapic_isr_update)(struct kvm *kvm, int isr);
705 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); 704 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
706 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set); 705 void (*set_virtual_x2apic_mode)(struct kvm_vcpu *vcpu, bool set);
706 void (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);
707 void (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
707 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); 708 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
708 int (*get_tdp_level)(void); 709 int (*get_tdp_level)(void);
709 u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); 710 u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio);
@@ -730,6 +731,7 @@ struct kvm_x86_ops {
730 int (*check_intercept)(struct kvm_vcpu *vcpu, 731 int (*check_intercept)(struct kvm_vcpu *vcpu,
731 struct x86_instruction_info *info, 732 struct x86_instruction_info *info,
732 enum x86_intercept_stage stage); 733 enum x86_intercept_stage stage);
734 void (*handle_external_intr)(struct kvm_vcpu *vcpu);
733}; 735};
734 736
735struct kvm_arch_async_pf { 737struct kvm_arch_async_pf {
@@ -767,6 +769,7 @@ void kvm_mmu_write_protect_pt_masked(struct kvm *kvm,
767 struct kvm_memory_slot *slot, 769 struct kvm_memory_slot *slot,
768 gfn_t gfn_offset, unsigned long mask); 770 gfn_t gfn_offset, unsigned long mask);
769void kvm_mmu_zap_all(struct kvm *kvm); 771void kvm_mmu_zap_all(struct kvm *kvm);
772void kvm_mmu_zap_mmio_sptes(struct kvm *kvm);
770unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm); 773unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm);
771void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); 774void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages);
772 775
@@ -797,6 +800,7 @@ enum emulation_result {
797#define EMULTYPE_TRAP_UD (1 << 1) 800#define EMULTYPE_TRAP_UD (1 << 1)
798#define EMULTYPE_SKIP (1 << 2) 801#define EMULTYPE_SKIP (1 << 2)
799#define EMULTYPE_RETRY (1 << 3) 802#define EMULTYPE_RETRY (1 << 3)
803#define EMULTYPE_NO_REEXECUTE (1 << 4)
800int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2, 804int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2,
801 int emulation_type, void *insn, int insn_len); 805 int emulation_type, void *insn, int insn_len);
802 806
@@ -807,6 +811,7 @@ static inline int emulate_instruction(struct kvm_vcpu *vcpu,
807} 811}
808 812
809void kvm_enable_efer_bits(u64); 813void kvm_enable_efer_bits(u64);
814bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer);
810int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); 815int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data);
811int kvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr); 816int kvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr);
812 817
@@ -819,6 +824,7 @@ int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu);
819 824
820void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg); 825void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
821int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, int seg); 826int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, int seg);
827void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, unsigned int vector);
822 828
823int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index, 829int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int idt_index,
824 int reason, bool has_error_code, u32 error_code); 830 int reason, bool has_error_code, u32 error_code);
@@ -973,7 +979,6 @@ enum {
973 * Trap the fault and ignore the instruction if that happens. 979 * Trap the fault and ignore the instruction if that happens.
974 */ 980 */
975asmlinkage void kvm_spurious_fault(void); 981asmlinkage void kvm_spurious_fault(void);
976extern bool kvm_rebooting;
977 982
978#define ____kvm_handle_fault_on_reboot(insn, cleanup_insn) \ 983#define ____kvm_handle_fault_on_reboot(insn, cleanup_insn) \
979 "666: " insn "\n\t" \ 984 "666: " insn "\n\t" \
@@ -1002,6 +1007,7 @@ int kvm_cpu_has_injectable_intr(struct kvm_vcpu *v);
1002int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu); 1007int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);
1003int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu); 1008int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
1004int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 1009int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
1010void kvm_vcpu_reset(struct kvm_vcpu *vcpu);
1005 1011
1006void kvm_define_shared_msr(unsigned index, u32 msr); 1012void kvm_define_shared_msr(unsigned index, u32 msr);
1007void kvm_set_shared_msr(unsigned index, u64 val, u64 mask); 1013void kvm_set_shared_msr(unsigned index, u64 val, u64 mask);
@@ -1027,7 +1033,7 @@ void kvm_pmu_reset(struct kvm_vcpu *vcpu);
1027void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu); 1033void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu);
1028bool kvm_pmu_msr(struct kvm_vcpu *vcpu, u32 msr); 1034bool kvm_pmu_msr(struct kvm_vcpu *vcpu, u32 msr);
1029int kvm_pmu_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *data); 1035int kvm_pmu_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *data);
1030int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, u32 msr, u64 data); 1036int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info);
1031int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data); 1037int kvm_pmu_read_pmc(struct kvm_vcpu *vcpu, unsigned pmc, u64 *data);
1032void kvm_handle_pmu_event(struct kvm_vcpu *vcpu); 1038void kvm_handle_pmu_event(struct kvm_vcpu *vcpu);
1033void kvm_deliver_pmi(struct kvm_vcpu *vcpu); 1039void kvm_deliver_pmi(struct kvm_vcpu *vcpu);
diff --git a/arch/x86/include/asm/lguest.h b/arch/x86/include/asm/lguest.h
index 0d97deba1e35..e2d4a4afa8c3 100644
--- a/arch/x86/include/asm/lguest.h
+++ b/arch/x86/include/asm/lguest.h
@@ -11,18 +11,11 @@
11 11
12#define GUEST_PL 1 12#define GUEST_PL 1
13 13
14/* Every guest maps the core switcher code. */ 14/* Page for Switcher text itself, then two pages per cpu */
15#define SHARED_SWITCHER_PAGES \ 15#define TOTAL_SWITCHER_PAGES (1 + 2 * nr_cpu_ids)
16 DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE) 16
17/* Pages for switcher itself, then two pages per cpu */ 17/* Where we map the Switcher, in both Host and Guest. */
18#define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * nr_cpu_ids) 18extern unsigned long switcher_addr;
19
20/* We map at -4M (-2M for PAE) for ease of mapping (one PTE page). */
21#ifdef CONFIG_X86_PAE
22#define SWITCHER_ADDR 0xFFE00000
23#else
24#define SWITCHER_ADDR 0xFFC00000
25#endif
26 19
27/* Found in switcher.S */ 20/* Found in switcher.S */
28extern unsigned long default_idt_entries[]; 21extern unsigned long default_idt_entries[];
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index f4076af1f4ed..fa5f71e021d5 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -146,13 +146,13 @@ DECLARE_PER_CPU(struct device *, mce_device);
146void mce_intel_feature_init(struct cpuinfo_x86 *c); 146void mce_intel_feature_init(struct cpuinfo_x86 *c);
147void cmci_clear(void); 147void cmci_clear(void);
148void cmci_reenable(void); 148void cmci_reenable(void);
149void cmci_rediscover(int dying); 149void cmci_rediscover(void);
150void cmci_recheck(void); 150void cmci_recheck(void);
151#else 151#else
152static inline void mce_intel_feature_init(struct cpuinfo_x86 *c) { } 152static inline void mce_intel_feature_init(struct cpuinfo_x86 *c) { }
153static inline void cmci_clear(void) {} 153static inline void cmci_clear(void) {}
154static inline void cmci_reenable(void) {} 154static inline void cmci_reenable(void) {}
155static inline void cmci_rediscover(int dying) {} 155static inline void cmci_rediscover(void) {}
156static inline void cmci_recheck(void) {} 156static inline void cmci_recheck(void) {}
157#endif 157#endif
158 158
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 9264802e2824..cb7502852acb 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -137,11 +137,11 @@ static inline unsigned long long native_read_pmc(int counter)
137 * pointer indirection), this allows gcc to optimize better 137 * pointer indirection), this allows gcc to optimize better
138 */ 138 */
139 139
140#define rdmsr(msr, val1, val2) \ 140#define rdmsr(msr, low, high) \
141do { \ 141do { \
142 u64 __val = native_read_msr((msr)); \ 142 u64 __val = native_read_msr((msr)); \
143 (void)((val1) = (u32)__val); \ 143 (void)((low) = (u32)__val); \
144 (void)((val2) = (u32)(__val >> 32)); \ 144 (void)((high) = (u32)(__val >> 32)); \
145} while (0) 145} while (0)
146 146
147static inline void wrmsr(unsigned msr, unsigned low, unsigned high) 147static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
@@ -162,12 +162,12 @@ static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high)
162} 162}
163 163
164/* rdmsr with exception handling */ 164/* rdmsr with exception handling */
165#define rdmsr_safe(msr, p1, p2) \ 165#define rdmsr_safe(msr, low, high) \
166({ \ 166({ \
167 int __err; \ 167 int __err; \
168 u64 __val = native_read_msr_safe((msr), &__err); \ 168 u64 __val = native_read_msr_safe((msr), &__err); \
169 (*p1) = (u32)__val; \ 169 (*low) = (u32)__val; \
170 (*p2) = (u32)(__val >> 32); \ 170 (*high) = (u32)(__val >> 32); \
171 __err; \ 171 __err; \
172}) 172})
173 173
@@ -208,7 +208,7 @@ do { \
208#define wrmsrl_safe(msr, val) wrmsr_safe((msr), (u32)(val), \ 208#define wrmsrl_safe(msr, val) wrmsr_safe((msr), (u32)(val), \
209 (u32)((val) >> 32)) 209 (u32)((val) >> 32))
210 210
211#define write_tsc(val1, val2) wrmsr(MSR_IA32_TSC, (val1), (val2)) 211#define write_tsc(low, high) wrmsr(MSR_IA32_TSC, (low), (high))
212 212
213#define write_rdtscp_aux(val) wrmsr(MSR_TSC_AUX, (val), 0) 213#define write_rdtscp_aux(val) wrmsr(MSR_TSC_AUX, (val), 0)
214 214
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 8b491e66eaa8..6c896fbe21db 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -48,6 +48,5 @@
48 * arch/x86/kernel/head_64.S), and it is mapped here: 48 * arch/x86/kernel/head_64.S), and it is mapped here:
49 */ 49 */
50#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) 50#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)
51#define KERNEL_IMAGE_START _AC(0xffffffff80000000, UL)
52 51
53#endif /* _ASM_X86_PAGE_64_DEFS_H */ 52#endif /* _ASM_X86_PAGE_64_DEFS_H */
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 7361e47db79f..cfdc9ee4c900 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -262,10 +262,6 @@ static inline void set_ldt(const void *addr, unsigned entries)
262{ 262{
263 PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries); 263 PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries);
264} 264}
265static inline void store_gdt(struct desc_ptr *dtr)
266{
267 PVOP_VCALL1(pv_cpu_ops.store_gdt, dtr);
268}
269static inline void store_idt(struct desc_ptr *dtr) 265static inline void store_idt(struct desc_ptr *dtr)
270{ 266{
271 PVOP_VCALL1(pv_cpu_ops.store_idt, dtr); 267 PVOP_VCALL1(pv_cpu_ops.store_idt, dtr);
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index b3b0ec1dac86..0db1fcac668c 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -123,7 +123,7 @@ struct pv_cpu_ops {
123 void (*load_tr_desc)(void); 123 void (*load_tr_desc)(void);
124 void (*load_gdt)(const struct desc_ptr *); 124 void (*load_gdt)(const struct desc_ptr *);
125 void (*load_idt)(const struct desc_ptr *); 125 void (*load_idt)(const struct desc_ptr *);
126 void (*store_gdt)(struct desc_ptr *); 126 /* store_gdt has been removed. */
127 void (*store_idt)(struct desc_ptr *); 127 void (*store_idt)(struct desc_ptr *);
128 void (*set_ldt)(const void *desc, unsigned entries); 128 void (*set_ldt)(const void *desc, unsigned entries);
129 unsigned long (*store_tr)(void); 129 unsigned long (*store_tr)(void);
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h
index 4f7e67e2345e..85e13ccf15c4 100644
--- a/arch/x86/include/asm/perf_event_p4.h
+++ b/arch/x86/include/asm/perf_event_p4.h
@@ -24,45 +24,45 @@
24#define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1) 24#define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1)
25#define ARCH_P4_UNFLAGGED_BIT ((1ULL) << (ARCH_P4_CNTRVAL_BITS - 1)) 25#define ARCH_P4_UNFLAGGED_BIT ((1ULL) << (ARCH_P4_CNTRVAL_BITS - 1))
26 26
27#define P4_ESCR_EVENT_MASK 0x7e000000U 27#define P4_ESCR_EVENT_MASK 0x7e000000ULL
28#define P4_ESCR_EVENT_SHIFT 25 28#define P4_ESCR_EVENT_SHIFT 25
29#define P4_ESCR_EVENTMASK_MASK 0x01fffe00U 29#define P4_ESCR_EVENTMASK_MASK 0x01fffe00ULL
30#define P4_ESCR_EVENTMASK_SHIFT 9 30#define P4_ESCR_EVENTMASK_SHIFT 9
31#define P4_ESCR_TAG_MASK 0x000001e0U 31#define P4_ESCR_TAG_MASK 0x000001e0ULL
32#define P4_ESCR_TAG_SHIFT 5 32#define P4_ESCR_TAG_SHIFT 5
33#define P4_ESCR_TAG_ENABLE 0x00000010U 33#define P4_ESCR_TAG_ENABLE 0x00000010ULL
34#define P4_ESCR_T0_OS 0x00000008U 34#define P4_ESCR_T0_OS 0x00000008ULL
35#define P4_ESCR_T0_USR 0x00000004U 35#define P4_ESCR_T0_USR 0x00000004ULL
36#define P4_ESCR_T1_OS 0x00000002U 36#define P4_ESCR_T1_OS 0x00000002ULL
37#define P4_ESCR_T1_USR 0x00000001U 37#define P4_ESCR_T1_USR 0x00000001ULL
38 38
39#define P4_ESCR_EVENT(v) ((v) << P4_ESCR_EVENT_SHIFT) 39#define P4_ESCR_EVENT(v) ((v) << P4_ESCR_EVENT_SHIFT)
40#define P4_ESCR_EMASK(v) ((v) << P4_ESCR_EVENTMASK_SHIFT) 40#define P4_ESCR_EMASK(v) ((v) << P4_ESCR_EVENTMASK_SHIFT)
41#define P4_ESCR_TAG(v) ((v) << P4_ESCR_TAG_SHIFT) 41#define P4_ESCR_TAG(v) ((v) << P4_ESCR_TAG_SHIFT)
42 42
43#define P4_CCCR_OVF 0x80000000U 43#define P4_CCCR_OVF 0x80000000ULL
44#define P4_CCCR_CASCADE 0x40000000U 44#define P4_CCCR_CASCADE 0x40000000ULL
45#define P4_CCCR_OVF_PMI_T0 0x04000000U 45#define P4_CCCR_OVF_PMI_T0 0x04000000ULL
46#define P4_CCCR_OVF_PMI_T1 0x08000000U 46#define P4_CCCR_OVF_PMI_T1 0x08000000ULL
47#define P4_CCCR_FORCE_OVF 0x02000000U 47#define P4_CCCR_FORCE_OVF 0x02000000ULL
48#define P4_CCCR_EDGE 0x01000000U 48#define P4_CCCR_EDGE 0x01000000ULL
49#define P4_CCCR_THRESHOLD_MASK 0x00f00000U 49#define P4_CCCR_THRESHOLD_MASK 0x00f00000ULL
50#define P4_CCCR_THRESHOLD_SHIFT 20 50#define P4_CCCR_THRESHOLD_SHIFT 20
51#define P4_CCCR_COMPLEMENT 0x00080000U 51#define P4_CCCR_COMPLEMENT 0x00080000ULL
52#define P4_CCCR_COMPARE 0x00040000U 52#define P4_CCCR_COMPARE 0x00040000ULL
53#define P4_CCCR_ESCR_SELECT_MASK 0x0000e000U 53#define P4_CCCR_ESCR_SELECT_MASK 0x0000e000ULL
54#define P4_CCCR_ESCR_SELECT_SHIFT 13 54#define P4_CCCR_ESCR_SELECT_SHIFT 13
55#define P4_CCCR_ENABLE 0x00001000U 55#define P4_CCCR_ENABLE 0x00001000ULL
56#define P4_CCCR_THREAD_SINGLE 0x00010000U 56#define P4_CCCR_THREAD_SINGLE 0x00010000ULL
57#define P4_CCCR_THREAD_BOTH 0x00020000U 57#define P4_CCCR_THREAD_BOTH 0x00020000ULL
58#define P4_CCCR_THREAD_ANY 0x00030000U 58#define P4_CCCR_THREAD_ANY 0x00030000ULL
59#define P4_CCCR_RESERVED 0x00000fffU 59#define P4_CCCR_RESERVED 0x00000fffULL
60 60
61#define P4_CCCR_THRESHOLD(v) ((v) << P4_CCCR_THRESHOLD_SHIFT) 61#define P4_CCCR_THRESHOLD(v) ((v) << P4_CCCR_THRESHOLD_SHIFT)
62#define P4_CCCR_ESEL(v) ((v) << P4_CCCR_ESCR_SELECT_SHIFT) 62#define P4_CCCR_ESEL(v) ((v) << P4_CCCR_ESCR_SELECT_SHIFT)
63 63
64#define P4_GEN_ESCR_EMASK(class, name, bit) \ 64#define P4_GEN_ESCR_EMASK(class, name, bit) \
65 class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT) 65 class##__##name = ((1ULL << bit) << P4_ESCR_EVENTMASK_SHIFT)
66#define P4_ESCR_EMASK_BIT(class, name) class##__##name 66#define P4_ESCR_EMASK_BIT(class, name) class##__##name
67 67
68/* 68/*
@@ -107,7 +107,7 @@
107 * P4_PEBS_CONFIG_MASK and related bits on 107 * P4_PEBS_CONFIG_MASK and related bits on
108 * modification.) 108 * modification.)
109 */ 109 */
110#define P4_CONFIG_ALIASABLE (1 << 9) 110#define P4_CONFIG_ALIASABLE (1ULL << 9)
111 111
112/* 112/*
113 * The bits we allow to pass for RAW events 113 * The bits we allow to pass for RAW events
@@ -784,17 +784,17 @@ enum P4_ESCR_EMASKS {
784 * Note we have UOP and PEBS bits reserved for now 784 * Note we have UOP and PEBS bits reserved for now
785 * just in case if we will need them once 785 * just in case if we will need them once
786 */ 786 */
787#define P4_PEBS_CONFIG_ENABLE (1 << 7) 787#define P4_PEBS_CONFIG_ENABLE (1ULL << 7)
788#define P4_PEBS_CONFIG_UOP_TAG (1 << 8) 788#define P4_PEBS_CONFIG_UOP_TAG (1ULL << 8)
789#define P4_PEBS_CONFIG_METRIC_MASK 0x3f 789#define P4_PEBS_CONFIG_METRIC_MASK 0x3FLL
790#define P4_PEBS_CONFIG_MASK 0xff 790#define P4_PEBS_CONFIG_MASK 0xFFLL
791 791
792/* 792/*
793 * mem: Only counters MSR_IQ_COUNTER4 (16) and 793 * mem: Only counters MSR_IQ_COUNTER4 (16) and
794 * MSR_IQ_COUNTER5 (17) are allowed for PEBS sampling 794 * MSR_IQ_COUNTER5 (17) are allowed for PEBS sampling
795 */ 795 */
796#define P4_PEBS_ENABLE 0x02000000U 796#define P4_PEBS_ENABLE 0x02000000ULL
797#define P4_PEBS_ENABLE_UOP_TAG 0x01000000U 797#define P4_PEBS_ENABLE_UOP_TAG 0x01000000ULL
798 798
799#define p4_config_unpack_metric(v) (((u64)(v)) & P4_PEBS_CONFIG_METRIC_MASK) 799#define p4_config_unpack_metric(v) (((u64)(v)) & P4_PEBS_CONFIG_METRIC_MASK)
800#define p4_config_unpack_pebs(v) (((u64)(v)) & P4_PEBS_CONFIG_MASK) 800#define p4_config_unpack_pebs(v) (((u64)(v)) & P4_PEBS_CONFIG_MASK)
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 567b5d0632b2..e6423002c10b 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -351,7 +351,6 @@ static inline void update_page_count(int level, unsigned long pages) { }
351 * as a pte too. 351 * as a pte too.
352 */ 352 */
353extern pte_t *lookup_address(unsigned long address, unsigned int *level); 353extern pte_t *lookup_address(unsigned long address, unsigned int *level);
354extern int __split_large_page(pte_t *kpte, unsigned long address, pte_t *pbase);
355extern phys_addr_t slow_virt_to_phys(void *__address); 354extern phys_addr_t slow_virt_to_phys(void *__address);
356 355
357#endif /* !__ASSEMBLY__ */ 356#endif /* !__ASSEMBLY__ */
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 3270116b1488..22224b3b43bb 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -91,9 +91,6 @@ struct cpuinfo_x86 {
91 /* Problems on some 486Dx4's and old 386's: */ 91 /* Problems on some 486Dx4's and old 386's: */
92 char hard_math; 92 char hard_math;
93 char rfu; 93 char rfu;
94 char fdiv_bug;
95 char f00f_bug;
96 char coma_bug;
97 char pad0; 94 char pad0;
98#else 95#else
99 /* Number of 4K pages in DTLB/ITLB combined(in pages): */ 96 /* Number of 4K pages in DTLB/ITLB combined(in pages): */
@@ -107,7 +104,7 @@ struct cpuinfo_x86 {
107 __u32 extended_cpuid_level; 104 __u32 extended_cpuid_level;
108 /* Maximum supported CPUID level, -1=no CPUID: */ 105 /* Maximum supported CPUID level, -1=no CPUID: */
109 int cpuid_level; 106 int cpuid_level;
110 __u32 x86_capability[NCAPINTS]; 107 __u32 x86_capability[NCAPINTS + NBUGINTS];
111 char x86_vendor_id[16]; 108 char x86_vendor_id[16];
112 char x86_model_id[64]; 109 char x86_model_id[64];
113 /* in KB - valid for CPUS which support this call: */ 110 /* in KB - valid for CPUS which support this call: */
@@ -973,26 +970,6 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
973 return ratio; 970 return ratio;
974} 971}
975 972
976/*
977 * AMD errata checking
978 */
979#ifdef CONFIG_CPU_SUP_AMD
980extern const int amd_erratum_383[];
981extern const int amd_erratum_400[];
982extern bool cpu_has_amd_erratum(const int *);
983
984#define AMD_LEGACY_ERRATUM(...) { -1, __VA_ARGS__, 0 }
985#define AMD_OSVW_ERRATUM(osvw_id, ...) { osvw_id, __VA_ARGS__, 0 }
986#define AMD_MODEL_RANGE(f, m_start, s_start, m_end, s_end) \
987 ((f << 24) | (m_start << 16) | (s_start << 12) | (m_end << 4) | (s_end))
988#define AMD_MODEL_RANGE_FAMILY(range) (((range) >> 24) & 0xff)
989#define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff)
990#define AMD_MODEL_RANGE_END(range) ((range) & 0xfff)
991
992#else
993#define cpu_has_amd_erratum(x) (false)
994#endif /* CONFIG_CPU_SUP_AMD */
995
996extern unsigned long arch_align_stack(unsigned long sp); 973extern unsigned long arch_align_stack(unsigned long sp);
997extern void free_init_pages(char *what, unsigned long begin, unsigned long end); 974extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
998 975
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index 2dbe4a721ce5..cad82c9c2fde 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -105,8 +105,8 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
105 asm volatile("# beginning down_write\n\t" 105 asm volatile("# beginning down_write\n\t"
106 LOCK_PREFIX " xadd %1,(%2)\n\t" 106 LOCK_PREFIX " xadd %1,(%2)\n\t"
107 /* adds 0xffff0001, returns the old value */ 107 /* adds 0xffff0001, returns the old value */
108 " test %1,%1\n\t" 108 " test " __ASM_SEL(%w1,%k1) "," __ASM_SEL(%w1,%k1) "\n\t"
109 /* was the count 0 before? */ 109 /* was the active mask 0 before? */
110 " jz 1f\n" 110 " jz 1f\n"
111 " call call_rwsem_down_write_failed\n" 111 " call call_rwsem_down_write_failed\n"
112 "1:\n" 112 "1:\n"
@@ -126,11 +126,25 @@ static inline void __down_write(struct rw_semaphore *sem)
126 */ 126 */
127static inline int __down_write_trylock(struct rw_semaphore *sem) 127static inline int __down_write_trylock(struct rw_semaphore *sem)
128{ 128{
129 long ret = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, 129 long result, tmp;
130 RWSEM_ACTIVE_WRITE_BIAS); 130 asm volatile("# beginning __down_write_trylock\n\t"
131 if (ret == RWSEM_UNLOCKED_VALUE) 131 " mov %0,%1\n\t"
132 return 1; 132 "1:\n\t"
133 return 0; 133 " test " __ASM_SEL(%w1,%k1) "," __ASM_SEL(%w1,%k1) "\n\t"
134 /* was the active mask 0 before? */
135 " jnz 2f\n\t"
136 " mov %1,%2\n\t"
137 " add %3,%2\n\t"
138 LOCK_PREFIX " cmpxchg %2,%0\n\t"
139 " jnz 1b\n\t"
140 "2:\n\t"
141 " sete %b1\n\t"
142 " movzbl %b1, %k1\n\t"
143 "# ending __down_write_trylock\n\t"
144 : "+m" (sem->count), "=&a" (result), "=&r" (tmp)
145 : "er" (RWSEM_ACTIVE_WRITE_BIAS)
146 : "memory", "cc");
147 return result;
134} 148}
135 149
136/* 150/*
diff --git a/arch/x86/include/asm/suspend_32.h b/arch/x86/include/asm/suspend_32.h
index 487055c8c1aa..552d6c90a6d4 100644
--- a/arch/x86/include/asm/suspend_32.h
+++ b/arch/x86/include/asm/suspend_32.h
@@ -15,7 +15,7 @@ struct saved_context {
15 unsigned long cr0, cr2, cr3, cr4; 15 unsigned long cr0, cr2, cr3, cr4;
16 u64 misc_enable; 16 u64 misc_enable;
17 bool misc_enable_saved; 17 bool misc_enable_saved;
18 struct desc_ptr gdt; 18 struct desc_ptr gdt_desc;
19 struct desc_ptr idt; 19 struct desc_ptr idt;
20 u16 ldt; 20 u16 ldt;
21 u16 tss; 21 u16 tss;
diff --git a/arch/x86/include/asm/suspend_64.h b/arch/x86/include/asm/suspend_64.h
index 09b0bf104156..bc6232834bab 100644
--- a/arch/x86/include/asm/suspend_64.h
+++ b/arch/x86/include/asm/suspend_64.h
@@ -25,9 +25,8 @@ struct saved_context {
25 u64 misc_enable; 25 u64 misc_enable;
26 bool misc_enable_saved; 26 bool misc_enable_saved;
27 unsigned long efer; 27 unsigned long efer;
28 u16 gdt_pad; 28 u16 gdt_pad; /* Unused */
29 u16 gdt_limit; 29 struct desc_ptr gdt_desc;
30 unsigned long gdt_base;
31 u16 idt_pad; 30 u16 idt_pad;
32 u16 idt_limit; 31 u16 idt_limit;
33 unsigned long idt_base; 32 unsigned long idt_base;
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 8459efc39686..0ef202e232d6 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -30,23 +30,14 @@ asmlinkage long sys32_fstatat(unsigned int, const char __user *,
30 struct stat64 __user *, int); 30 struct stat64 __user *, int);
31struct mmap_arg_struct32; 31struct mmap_arg_struct32;
32asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); 32asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *);
33asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long);
34
35asmlinkage long sys32_alarm(unsigned int);
36 33
37asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int); 34asmlinkage long sys32_waitpid(compat_pid_t, unsigned int __user *, int);
38asmlinkage long sys32_sysfs(int, u32, u32);
39 35
40asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32); 36asmlinkage long sys32_pread(unsigned int, char __user *, u32, u32, u32);
41asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32); 37asmlinkage long sys32_pwrite(unsigned int, const char __user *, u32, u32, u32);
42 38
43asmlinkage long sys32_personality(unsigned long);
44asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
45
46long sys32_kill(int, int);
47long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int); 39long sys32_fadvise64_64(int, __u32, __u32, __u32, __u32, int);
48long sys32_vm86_warning(void); 40long sys32_vm86_warning(void);
49long sys32_lookup_dcookie(u32, u32, char __user *, size_t);
50 41
51asmlinkage ssize_t sys32_readahead(int, unsigned, unsigned, size_t); 42asmlinkage ssize_t sys32_readahead(int, unsigned, unsigned, size_t);
52asmlinkage long sys32_sync_file_range(int, unsigned, unsigned, 43asmlinkage long sys32_sync_file_range(int, unsigned, unsigned,
@@ -59,9 +50,6 @@ asmlinkage long sys32_fallocate(int, int, unsigned,
59asmlinkage long sys32_sigreturn(void); 50asmlinkage long sys32_sigreturn(void);
60asmlinkage long sys32_rt_sigreturn(void); 51asmlinkage long sys32_rt_sigreturn(void);
61 52
62/* ia32/ipc32.c */
63asmlinkage long sys32_ipc(u32, int, int, int, compat_uptr_t, u32);
64
65asmlinkage long sys32_fanotify_mark(int, unsigned int, u32, u32, int, 53asmlinkage long sys32_fanotify_mark(int, unsigned int, u32, u32, int,
66 const char __user *); 54 const char __user *);
67 55
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 6cf0a9cc60cd..5f87b35fd2ef 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -27,8 +27,8 @@ asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
27long sys_rt_sigreturn(void); 27long sys_rt_sigreturn(void);
28 28
29/* kernel/tls.c */ 29/* kernel/tls.c */
30asmlinkage int sys_set_thread_area(struct user_desc __user *); 30asmlinkage long sys_set_thread_area(struct user_desc __user *);
31asmlinkage int sys_get_thread_area(struct user_desc __user *); 31asmlinkage long sys_get_thread_area(struct user_desc __user *);
32 32
33/* X86_32 only */ 33/* X86_32 only */
34#ifdef CONFIG_X86_32 34#ifdef CONFIG_X86_32
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 2cd056e3ada3..a1df6e84691f 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -241,8 +241,6 @@ static inline struct thread_info *current_thread_info(void)
241 skip sending interrupt */ 241 skip sending interrupt */
242#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ 242#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */
243 243
244#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
245
246#ifndef __ASSEMBLY__ 244#ifndef __ASSEMBLY__
247#define HAVE_SET_RESTORE_SIGMASK 1 245#define HAVE_SET_RESTORE_SIGMASK 1
248static inline void set_restore_sigmask(void) 246static inline void set_restore_sigmask(void)
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 3d5df1c4447f..c2a48139c340 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -50,12 +50,4 @@
50# define __ARCH_WANT_SYS_VFORK 50# define __ARCH_WANT_SYS_VFORK
51# define __ARCH_WANT_SYS_CLONE 51# define __ARCH_WANT_SYS_CLONE
52 52
53/*
54 * "Conditional" syscalls
55 *
56 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
57 * but it doesn't work on all toolchains, so we just do it by hand
58 */
59# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
60
61#endif /* _ASM_X86_UNISTD_H */ 53#endif /* _ASM_X86_UNISTD_H */
diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
index 8ff8be7835ab..6e5197910fd8 100644
--- a/arch/x86/include/asm/uprobes.h
+++ b/arch/x86/include/asm/uprobes.h
@@ -55,4 +55,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
55extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk); 55extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
56extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 56extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
57extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 57extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
58extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
58#endif /* _ASM_UPROBES_H */ 59#endif /* _ASM_UPROBES_H */
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index b6fbf860e398..f3e01a2cbaa1 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -65,11 +65,16 @@
65#define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY 0x00000200 65#define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY 0x00000200
66#define SECONDARY_EXEC_PAUSE_LOOP_EXITING 0x00000400 66#define SECONDARY_EXEC_PAUSE_LOOP_EXITING 0x00000400
67#define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000 67#define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000
68#define SECONDARY_EXEC_SHADOW_VMCS 0x00004000
68 69
69 70
70#define PIN_BASED_EXT_INTR_MASK 0x00000001 71#define PIN_BASED_EXT_INTR_MASK 0x00000001
71#define PIN_BASED_NMI_EXITING 0x00000008 72#define PIN_BASED_NMI_EXITING 0x00000008
72#define PIN_BASED_VIRTUAL_NMIS 0x00000020 73#define PIN_BASED_VIRTUAL_NMIS 0x00000020
74#define PIN_BASED_VMX_PREEMPTION_TIMER 0x00000040
75#define PIN_BASED_POSTED_INTR 0x00000080
76
77#define PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR 0x00000016
73 78
74#define VM_EXIT_SAVE_DEBUG_CONTROLS 0x00000002 79#define VM_EXIT_SAVE_DEBUG_CONTROLS 0x00000002
75#define VM_EXIT_HOST_ADDR_SPACE_SIZE 0x00000200 80#define VM_EXIT_HOST_ADDR_SPACE_SIZE 0x00000200
@@ -81,6 +86,8 @@
81#define VM_EXIT_LOAD_IA32_EFER 0x00200000 86#define VM_EXIT_LOAD_IA32_EFER 0x00200000
82#define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER 0x00400000 87#define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER 0x00400000
83 88
89#define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR 0x00036dff
90
84#define VM_ENTRY_LOAD_DEBUG_CONTROLS 0x00000002 91#define VM_ENTRY_LOAD_DEBUG_CONTROLS 0x00000002
85#define VM_ENTRY_IA32E_MODE 0x00000200 92#define VM_ENTRY_IA32E_MODE 0x00000200
86#define VM_ENTRY_SMM 0x00000400 93#define VM_ENTRY_SMM 0x00000400
@@ -89,9 +96,15 @@
89#define VM_ENTRY_LOAD_IA32_PAT 0x00004000 96#define VM_ENTRY_LOAD_IA32_PAT 0x00004000
90#define VM_ENTRY_LOAD_IA32_EFER 0x00008000 97#define VM_ENTRY_LOAD_IA32_EFER 0x00008000
91 98
99#define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR 0x000011ff
100
101#define VMX_MISC_PREEMPTION_TIMER_RATE_MASK 0x0000001f
102#define VMX_MISC_SAVE_EFER_LMA 0x00000020
103
92/* VMCS Encodings */ 104/* VMCS Encodings */
93enum vmcs_field { 105enum vmcs_field {
94 VIRTUAL_PROCESSOR_ID = 0x00000000, 106 VIRTUAL_PROCESSOR_ID = 0x00000000,
107 POSTED_INTR_NV = 0x00000002,
95 GUEST_ES_SELECTOR = 0x00000800, 108 GUEST_ES_SELECTOR = 0x00000800,
96 GUEST_CS_SELECTOR = 0x00000802, 109 GUEST_CS_SELECTOR = 0x00000802,
97 GUEST_SS_SELECTOR = 0x00000804, 110 GUEST_SS_SELECTOR = 0x00000804,
@@ -126,6 +139,8 @@ enum vmcs_field {
126 VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, 139 VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013,
127 APIC_ACCESS_ADDR = 0x00002014, 140 APIC_ACCESS_ADDR = 0x00002014,
128 APIC_ACCESS_ADDR_HIGH = 0x00002015, 141 APIC_ACCESS_ADDR_HIGH = 0x00002015,
142 POSTED_INTR_DESC_ADDR = 0x00002016,
143 POSTED_INTR_DESC_ADDR_HIGH = 0x00002017,
129 EPT_POINTER = 0x0000201a, 144 EPT_POINTER = 0x0000201a,
130 EPT_POINTER_HIGH = 0x0000201b, 145 EPT_POINTER_HIGH = 0x0000201b,
131 EOI_EXIT_BITMAP0 = 0x0000201c, 146 EOI_EXIT_BITMAP0 = 0x0000201c,
@@ -136,6 +151,8 @@ enum vmcs_field {
136 EOI_EXIT_BITMAP2_HIGH = 0x00002021, 151 EOI_EXIT_BITMAP2_HIGH = 0x00002021,
137 EOI_EXIT_BITMAP3 = 0x00002022, 152 EOI_EXIT_BITMAP3 = 0x00002022,
138 EOI_EXIT_BITMAP3_HIGH = 0x00002023, 153 EOI_EXIT_BITMAP3_HIGH = 0x00002023,
154 VMREAD_BITMAP = 0x00002026,
155 VMWRITE_BITMAP = 0x00002028,
139 GUEST_PHYSICAL_ADDRESS = 0x00002400, 156 GUEST_PHYSICAL_ADDRESS = 0x00002400,
140 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401, 157 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401,
141 VMCS_LINK_POINTER = 0x00002800, 158 VMCS_LINK_POINTER = 0x00002800,
@@ -209,6 +226,7 @@ enum vmcs_field {
209 GUEST_INTERRUPTIBILITY_INFO = 0x00004824, 226 GUEST_INTERRUPTIBILITY_INFO = 0x00004824,
210 GUEST_ACTIVITY_STATE = 0X00004826, 227 GUEST_ACTIVITY_STATE = 0X00004826,
211 GUEST_SYSENTER_CS = 0x0000482A, 228 GUEST_SYSENTER_CS = 0x0000482A,
229 VMX_PREEMPTION_TIMER_VALUE = 0x0000482E,
212 HOST_IA32_SYSENTER_CS = 0x00004c00, 230 HOST_IA32_SYSENTER_CS = 0x00004c00,
213 CR0_GUEST_HOST_MASK = 0x00006000, 231 CR0_GUEST_HOST_MASK = 0x00006000,
214 CR4_GUEST_HOST_MASK = 0x00006002, 232 CR4_GUEST_HOST_MASK = 0x00006002,
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index a65ec29e6ffb..5d9a3033b3d7 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -29,7 +29,6 @@
29#define __KVM_HAVE_PIT 29#define __KVM_HAVE_PIT
30#define __KVM_HAVE_IOAPIC 30#define __KVM_HAVE_IOAPIC
31#define __KVM_HAVE_IRQ_LINE 31#define __KVM_HAVE_IRQ_LINE
32#define __KVM_HAVE_DEVICE_ASSIGNMENT
33#define __KVM_HAVE_MSI 32#define __KVM_HAVE_MSI
34#define __KVM_HAVE_USER_NMI 33#define __KVM_HAVE_USER_NMI
35#define __KVM_HAVE_GUEST_DEBUG 34#define __KVM_HAVE_GUEST_DEBUG
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index 7a060f4b411f..b3a4866661c5 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -72,6 +72,7 @@
72#define MSR_IA32_PEBS_ENABLE 0x000003f1 72#define MSR_IA32_PEBS_ENABLE 0x000003f1
73#define MSR_IA32_DS_AREA 0x00000600 73#define MSR_IA32_DS_AREA 0x00000600
74#define MSR_IA32_PERF_CAPABILITIES 0x00000345 74#define MSR_IA32_PERF_CAPABILITIES 0x00000345
75#define MSR_PEBS_LD_LAT_THRESHOLD 0x000003f6
75 76
76#define MSR_MTRRfix64K_00000 0x00000250 77#define MSR_MTRRfix64K_00000 0x00000250
77#define MSR_MTRRfix16K_80000 0x00000258 78#define MSR_MTRRfix16K_80000 0x00000258
@@ -195,6 +196,10 @@
195#define MSR_AMD64_IBSBRTARGET 0xc001103b 196#define MSR_AMD64_IBSBRTARGET 0xc001103b
196#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */ 197#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
197 198
199/* Fam 16h MSRs */
200#define MSR_F16H_L2I_PERF_CTL 0xc0010230
201#define MSR_F16H_L2I_PERF_CTR 0xc0010231
202
198/* Fam 15h MSRs */ 203/* Fam 15h MSRs */
199#define MSR_F15H_PERF_CTL 0xc0010200 204#define MSR_F15H_PERF_CTL 0xc0010200
200#define MSR_F15H_PERF_CTR 0xc0010201 205#define MSR_F15H_PERF_CTR 0xc0010201
@@ -523,6 +528,8 @@
523#define VMX_BASIC_MEM_TYPE_WB 6LLU 528#define VMX_BASIC_MEM_TYPE_WB 6LLU
524#define VMX_BASIC_INOUT 0x0040000000000000LLU 529#define VMX_BASIC_INOUT 0x0040000000000000LLU
525 530
531/* MSR_IA32_VMX_MISC bits */
532#define MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS (1ULL << 29)
526/* AMD-V MSRs */ 533/* AMD-V MSRs */
527 534
528#define MSR_VM_CR 0xc0010114 535#define MSR_VM_CR 0xc0010114
diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
index 2871fccfee68..d651082c7cf7 100644
--- a/arch/x86/include/uapi/asm/vmx.h
+++ b/arch/x86/include/uapi/asm/vmx.h
@@ -65,6 +65,7 @@
65#define EXIT_REASON_EOI_INDUCED 45 65#define EXIT_REASON_EOI_INDUCED 45
66#define EXIT_REASON_EPT_VIOLATION 48 66#define EXIT_REASON_EPT_VIOLATION 48
67#define EXIT_REASON_EPT_MISCONFIG 49 67#define EXIT_REASON_EPT_MISCONFIG 49
68#define EXIT_REASON_PREEMPTION_TIMER 52
68#define EXIT_REASON_WBINVD 54 69#define EXIT_REASON_WBINVD 54
69#define EXIT_REASON_XSETBV 55 70#define EXIT_REASON_XSETBV 55
70#define EXIT_REASON_APIC_WRITE 56 71#define EXIT_REASON_APIC_WRITE 56
@@ -110,7 +111,7 @@
110 { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \ 111 { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, \
111 { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ 112 { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \
112 { EXIT_REASON_INVD, "INVD" }, \ 113 { EXIT_REASON_INVD, "INVD" }, \
113 { EXIT_REASON_INVPCID, "INVPCID" } 114 { EXIT_REASON_INVPCID, "INVPCID" }, \
114 115 { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }
115 116
116#endif /* _UAPIVMX_H */ 117#endif /* _UAPIVMX_H */
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 0532f5d6e4ef..b44577bc9744 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -46,7 +46,7 @@ int acpi_suspend_lowlevel(void)
46 header->pmode_behavior = 0; 46 header->pmode_behavior = 0;
47 47
48#ifndef CONFIG_64BIT 48#ifndef CONFIG_64BIT
49 store_gdt((struct desc_ptr *)&header->pmode_gdt); 49 native_store_gdt((struct desc_ptr *)&header->pmode_gdt);
50 50
51 if (!rdmsr_safe(MSR_EFER, 51 if (!rdmsr_safe(MSR_EFER,
52 &header->pmode_efer_low, 52 &header->pmode_efer_low,
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 13ab720573e3..d1daa66ab162 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -1,4 +1,4 @@
1 .section .text..page_aligned 1 .text
2#include <linux/linkage.h> 2#include <linux/linkage.h>
3#include <asm/segment.h> 3#include <asm/segment.h>
4#include <asm/page_types.h> 4#include <asm/page_types.h>
@@ -18,7 +18,6 @@ wakeup_pmode_return:
18 movw %ax, %gs 18 movw %ax, %gs
19 19
20 # reload the gdt, as we need the full 32 bit address 20 # reload the gdt, as we need the full 32 bit address
21 lgdt saved_gdt
22 lidt saved_idt 21 lidt saved_idt
23 lldt saved_ldt 22 lldt saved_ldt
24 ljmp $(__KERNEL_CS), $1f 23 ljmp $(__KERNEL_CS), $1f
@@ -44,7 +43,6 @@ bogus_magic:
44 43
45 44
46save_registers: 45save_registers:
47 sgdt saved_gdt
48 sidt saved_idt 46 sidt saved_idt
49 sldt saved_ldt 47 sldt saved_ldt
50 str saved_tss 48 str saved_tss
@@ -93,7 +91,6 @@ ENTRY(saved_magic) .long 0
93ENTRY(saved_eip) .long 0 91ENTRY(saved_eip) .long 0
94 92
95# saved registers 93# saved registers
96saved_gdt: .long 0,0
97saved_idt: .long 0,0 94saved_idt: .long 0,0
98saved_ldt: .long 0 95saved_ldt: .long 0
99saved_tss: .long 0 96saved_tss: .long 0
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index ef5ccca79a6c..c15cf9a25e27 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -271,7 +271,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
271 replacement = (u8 *)&a->repl_offset + a->repl_offset; 271 replacement = (u8 *)&a->repl_offset + a->repl_offset;
272 BUG_ON(a->replacementlen > a->instrlen); 272 BUG_ON(a->replacementlen > a->instrlen);
273 BUG_ON(a->instrlen > sizeof(insnbuf)); 273 BUG_ON(a->instrlen > sizeof(insnbuf));
274 BUG_ON(a->cpuid >= NCAPINTS*32); 274 BUG_ON(a->cpuid >= (NCAPINTS + NBUGINTS) * 32);
275 if (!boot_cpu_has(a->cpuid)) 275 if (!boot_cpu_has(a->cpuid))
276 continue; 276 continue;
277 277
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index aadf3359e2a7..3048ded1b598 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -20,12 +20,14 @@ const struct pci_device_id amd_nb_misc_ids[] = {
20 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, 20 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
21 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, 21 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) },
22 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, 22 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) },
23 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) },
23 {} 24 {}
24}; 25};
25EXPORT_SYMBOL(amd_nb_misc_ids); 26EXPORT_SYMBOL(amd_nb_misc_ids);
26 27
27static struct pci_device_id amd_nb_link_ids[] = { 28static const struct pci_device_id amd_nb_link_ids[] = {
28 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 29 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
30 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) },
29 {} 31 {}
30}; 32};
31 33
@@ -81,7 +83,6 @@ int amd_cache_northbridges(void)
81 next_northbridge(link, amd_nb_link_ids); 83 next_northbridge(link, amd_nb_link_ids);
82 } 84 }
83 85
84 /* some CPU families (e.g. family 0x11) do not support GART */
85 if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 || 86 if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 ||
86 boot_cpu_data.x86 == 0x15) 87 boot_cpu_data.x86 == 0x15)
87 amd_northbridges.flags |= AMD_NB_GART; 88 amd_northbridges.flags |= AMD_NB_GART;
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index d5fd66f0d4cd..fd972a3e4cbb 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -87,7 +87,7 @@ static u32 __init allocate_aperture(void)
87 */ 87 */
88 addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR, 88 addr = memblock_find_in_range(GART_MIN_ADDR, GART_MAX_ADDR,
89 aper_size, aper_size); 89 aper_size, aper_size);
90 if (!addr || addr + aper_size > GART_MAX_ADDR) { 90 if (!addr) {
91 printk(KERN_ERR 91 printk(KERN_ERR
92 "Cannot allocate aperture memory hole (%lx,%uK)\n", 92 "Cannot allocate aperture memory hole (%lx,%uK)\n",
93 addr, aper_size>>10); 93 addr, aper_size>>10);
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 66b5faffe14a..53a4e2744846 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -373,7 +373,6 @@ static int apm_cpu_idle(struct cpuidle_device *dev,
373static struct cpuidle_driver apm_idle_driver = { 373static struct cpuidle_driver apm_idle_driver = {
374 .name = "apm_idle", 374 .name = "apm_idle",
375 .owner = THIS_MODULE, 375 .owner = THIS_MODULE,
376 .en_core_tk_irqen = 1,
377 .states = { 376 .states = {
378 { /* entry 0 is for polling */ }, 377 { /* entry 0 is for polling */ },
379 { /* entry 1 is for APM idle */ 378 { /* entry 1 is for APM idle */
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 85d98ab15cdc..0ef4bba2acb7 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -60,6 +60,9 @@ void foo(void)
60 OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext); 60 OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
61 BLANK(); 61 BLANK();
62 62
63 OFFSET(saved_context_gdt_desc, saved_context, gdt_desc);
64 BLANK();
65
63 /* Offset from the sysenter stack to tss.sp0 */ 66 /* Offset from the sysenter stack to tss.sp0 */
64 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) - 67 DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
65 sizeof(struct tss_struct)); 68 sizeof(struct tss_struct));
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 1b4754f82ba7..e7c798b354fa 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -73,6 +73,7 @@ int main(void)
73 ENTRY(cr3); 73 ENTRY(cr3);
74 ENTRY(cr4); 74 ENTRY(cr4);
75 ENTRY(cr8); 75 ENTRY(cr8);
76 ENTRY(gdt_desc);
76 BLANK(); 77 BLANK();
77#undef ENTRY 78#undef ENTRY
78 79
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index a0e067d3d96c..b0684e4a73aa 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -14,7 +14,6 @@ CFLAGS_common.o := $(nostackp)
14 14
15obj-y := intel_cacheinfo.o scattered.o topology.o 15obj-y := intel_cacheinfo.o scattered.o topology.o
16obj-y += proc.o capflags.o powerflags.o common.o 16obj-y += proc.o capflags.o powerflags.o common.o
17obj-y += vmware.o hypervisor.o mshyperv.o
18obj-y += rdrand.o 17obj-y += rdrand.o
19obj-y += match.o 18obj-y += match.o
20 19
@@ -31,7 +30,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
31obj-$(CONFIG_PERF_EVENTS) += perf_event.o 30obj-$(CONFIG_PERF_EVENTS) += perf_event.o
32 31
33ifdef CONFIG_PERF_EVENTS 32ifdef CONFIG_PERF_EVENTS
34obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o 33obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o perf_event_amd_uncore.o
35obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o 34obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o
36obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o 35obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
37obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o 36obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o
@@ -42,11 +41,13 @@ obj-$(CONFIG_MTRR) += mtrr/
42 41
43obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o 42obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
44 43
44obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
45
45quiet_cmd_mkcapflags = MKCAP $@ 46quiet_cmd_mkcapflags = MKCAP $@
46 cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ 47 cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
47 48
48cpufeature = $(src)/../../include/asm/cpufeature.h 49cpufeature = $(src)/../../include/asm/cpufeature.h
49 50
50targets += capflags.c 51targets += capflags.c
51$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.pl FORCE 52$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
52 $(call if_changed,mkcapflags) 53 $(call if_changed,mkcapflags)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index fa96eb0d02fb..5013a48d1aff 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -20,11 +20,11 @@
20 20
21static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) 21static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
22{ 22{
23 struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
24 u32 gprs[8] = { 0 }; 23 u32 gprs[8] = { 0 };
25 int err; 24 int err;
26 25
27 WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__); 26 WARN_ONCE((boot_cpu_data.x86 != 0xf),
27 "%s should only be used on K8!\n", __func__);
28 28
29 gprs[1] = msr; 29 gprs[1] = msr;
30 gprs[7] = 0x9c5a203a; 30 gprs[7] = 0x9c5a203a;
@@ -38,10 +38,10 @@ static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p)
38 38
39static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val) 39static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
40{ 40{
41 struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
42 u32 gprs[8] = { 0 }; 41 u32 gprs[8] = { 0 };
43 42
44 WARN_ONCE((c->x86 != 0xf), "%s should only be used on K8!\n", __func__); 43 WARN_ONCE((boot_cpu_data.x86 != 0xf),
44 "%s should only be used on K8!\n", __func__);
45 45
46 gprs[0] = (u32)val; 46 gprs[0] = (u32)val;
47 gprs[1] = msr; 47 gprs[1] = msr;
@@ -192,11 +192,11 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
192 /* Athlon 660/661 is valid. */ 192 /* Athlon 660/661 is valid. */
193 if ((c->x86_model == 6) && ((c->x86_mask == 0) || 193 if ((c->x86_model == 6) && ((c->x86_mask == 0) ||
194 (c->x86_mask == 1))) 194 (c->x86_mask == 1)))
195 goto valid_k7; 195 return;
196 196
197 /* Duron 670 is valid */ 197 /* Duron 670 is valid */
198 if ((c->x86_model == 7) && (c->x86_mask == 0)) 198 if ((c->x86_model == 7) && (c->x86_mask == 0))
199 goto valid_k7; 199 return;
200 200
201 /* 201 /*
202 * Athlon 662, Duron 671, and Athlon >model 7 have capability 202 * Athlon 662, Duron 671, and Athlon >model 7 have capability
@@ -209,7 +209,7 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
209 ((c->x86_model == 7) && (c->x86_mask >= 1)) || 209 ((c->x86_model == 7) && (c->x86_mask >= 1)) ||
210 (c->x86_model > 7)) 210 (c->x86_model > 7))
211 if (cpu_has_mp) 211 if (cpu_has_mp)
212 goto valid_k7; 212 return;
213 213
214 /* If we get here, not a certified SMP capable AMD system. */ 214 /* If we get here, not a certified SMP capable AMD system. */
215 215
@@ -220,9 +220,6 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
220 WARN_ONCE(1, "WARNING: This combination of AMD" 220 WARN_ONCE(1, "WARNING: This combination of AMD"
221 " processors is not suitable for SMP.\n"); 221 " processors is not suitable for SMP.\n");
222 add_taint(TAINT_UNSAFE_SMP, LOCKDEP_NOW_UNRELIABLE); 222 add_taint(TAINT_UNSAFE_SMP, LOCKDEP_NOW_UNRELIABLE);
223
224valid_k7:
225 ;
226} 223}
227 224
228static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) 225static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c)
@@ -513,6 +510,10 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
513#endif 510#endif
514} 511}
515 512
513static const int amd_erratum_383[];
514static const int amd_erratum_400[];
515static bool cpu_has_amd_erratum(const int *erratum);
516
516static void __cpuinit init_amd(struct cpuinfo_x86 *c) 517static void __cpuinit init_amd(struct cpuinfo_x86 *c)
517{ 518{
518 u32 dummy; 519 u32 dummy;
@@ -727,8 +728,14 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
727 rdmsrl_safe(MSR_AMD64_BU_CFG2, &value); 728 rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
728 value &= ~(1ULL << 24); 729 value &= ~(1ULL << 24);
729 wrmsrl_safe(MSR_AMD64_BU_CFG2, value); 730 wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
731
732 if (cpu_has_amd_erratum(amd_erratum_383))
733 set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
730 } 734 }
731 735
736 if (cpu_has_amd_erratum(amd_erratum_400))
737 set_cpu_bug(c, X86_BUG_AMD_APIC_C1E);
738
732 rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy); 739 rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
733} 740}
734 741
@@ -847,8 +854,7 @@ cpu_dev_register(amd_cpu_dev);
847 * AMD_OSVW_ERRATUM() macros. The latter is intended for newer errata that 854 * AMD_OSVW_ERRATUM() macros. The latter is intended for newer errata that
848 * have an OSVW id assigned, which it takes as first argument. Both take a 855 * have an OSVW id assigned, which it takes as first argument. Both take a
849 * variable number of family-specific model-stepping ranges created by 856 * variable number of family-specific model-stepping ranges created by
850 * AMD_MODEL_RANGE(). Each erratum also has to be declared as extern const 857 * AMD_MODEL_RANGE().
851 * int[] in arch/x86/include/asm/processor.h.
852 * 858 *
853 * Example: 859 * Example:
854 * 860 *
@@ -858,16 +864,22 @@ cpu_dev_register(amd_cpu_dev);
858 * AMD_MODEL_RANGE(0x10, 0x9, 0x0, 0x9, 0x0)); 864 * AMD_MODEL_RANGE(0x10, 0x9, 0x0, 0x9, 0x0));
859 */ 865 */
860 866
861const int amd_erratum_400[] = 867#define AMD_LEGACY_ERRATUM(...) { -1, __VA_ARGS__, 0 }
868#define AMD_OSVW_ERRATUM(osvw_id, ...) { osvw_id, __VA_ARGS__, 0 }
869#define AMD_MODEL_RANGE(f, m_start, s_start, m_end, s_end) \
870 ((f << 24) | (m_start << 16) | (s_start << 12) | (m_end << 4) | (s_end))
871#define AMD_MODEL_RANGE_FAMILY(range) (((range) >> 24) & 0xff)
872#define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff)
873#define AMD_MODEL_RANGE_END(range) ((range) & 0xfff)
874
875static const int amd_erratum_400[] =
862 AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), 876 AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),
863 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf)); 877 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));
864EXPORT_SYMBOL_GPL(amd_erratum_400);
865 878
866const int amd_erratum_383[] = 879static const int amd_erratum_383[] =
867 AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf)); 880 AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));
868EXPORT_SYMBOL_GPL(amd_erratum_383);
869 881
870bool cpu_has_amd_erratum(const int *erratum) 882static bool cpu_has_amd_erratum(const int *erratum)
871{ 883{
872 struct cpuinfo_x86 *cpu = __this_cpu_ptr(&cpu_info); 884 struct cpuinfo_x86 *cpu = __this_cpu_ptr(&cpu_info);
873 int osvw_id = *erratum++; 885 int osvw_id = *erratum++;
@@ -908,5 +920,3 @@ bool cpu_has_amd_erratum(const int *erratum)
908 920
909 return false; 921 return false;
910} 922}
911
912EXPORT_SYMBOL_GPL(cpu_has_amd_erratum);
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index af6455e3fcc9..4112be9a4659 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -59,7 +59,7 @@ static void __init check_fpu(void)
59 * trap_init() enabled FXSR and company _before_ testing for FP 59 * trap_init() enabled FXSR and company _before_ testing for FP
60 * problems here. 60 * problems here.
61 * 61 *
62 * Test for the divl bug.. 62 * Test for the divl bug: http://en.wikipedia.org/wiki/Fdiv_bug
63 */ 63 */
64 __asm__("fninit\n\t" 64 __asm__("fninit\n\t"
65 "fldl %1\n\t" 65 "fldl %1\n\t"
@@ -75,26 +75,12 @@ static void __init check_fpu(void)
75 75
76 kernel_fpu_end(); 76 kernel_fpu_end();
77 77
78 boot_cpu_data.fdiv_bug = fdiv_bug; 78 if (fdiv_bug) {
79 if (boot_cpu_data.fdiv_bug) 79 set_cpu_bug(&boot_cpu_data, X86_BUG_FDIV);
80 pr_warn("Hmm, FPU with FDIV bug\n"); 80 pr_warn("Hmm, FPU with FDIV bug\n");
81 }
81} 82}
82 83
83/*
84 * Check whether we are able to run this kernel safely on SMP.
85 *
86 * - i386 is no longer supported.
87 * - In order to run on anything without a TSC, we need to be
88 * compiled for a i486.
89 */
90
91static void __init check_config(void)
92{
93 if (boot_cpu_data.x86 < 4)
94 panic("Kernel requires i486+ for 'invlpg' and other features");
95}
96
97
98void __init check_bugs(void) 84void __init check_bugs(void)
99{ 85{
100 identify_boot_cpu(); 86 identify_boot_cpu();
@@ -102,7 +88,17 @@ void __init check_bugs(void)
102 pr_info("CPU: "); 88 pr_info("CPU: ");
103 print_cpu_info(&boot_cpu_data); 89 print_cpu_info(&boot_cpu_data);
104#endif 90#endif
105 check_config(); 91
92 /*
93 * Check whether we are able to run this kernel safely on SMP.
94 *
95 * - i386 is no longer supported.
96 * - In order to run on anything without a TSC, we need to be
97 * compiled for a i486.
98 */
99 if (boot_cpu_data.x86 < 4)
100 panic("Kernel requires i486+ for 'invlpg' and other features");
101
106 init_utsname()->machine[1] = 102 init_utsname()->machine[1] =
107 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); 103 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
108 alternative_instructions(); 104 alternative_instructions();
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d814772c5bed..22018f70a671 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -920,6 +920,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
920 /* AND the already accumulated flags with these */ 920 /* AND the already accumulated flags with these */
921 for (i = 0; i < NCAPINTS; i++) 921 for (i = 0; i < NCAPINTS; i++)
922 boot_cpu_data.x86_capability[i] &= c->x86_capability[i]; 922 boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
923
924 /* OR, i.e. replicate the bug flags */
925 for (i = NCAPINTS; i < NCAPINTS + NBUGINTS; i++)
926 c->x86_capability[i] |= boot_cpu_data.x86_capability[i];
923 } 927 }
924 928
925 /* Init Machine Check Exception if available. */ 929 /* Init Machine Check Exception if available. */
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 4fbd384fb645..d048d5ca43c1 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -249,7 +249,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
249 /* Emulate MTRRs using Cyrix's ARRs. */ 249 /* Emulate MTRRs using Cyrix's ARRs. */
250 set_cpu_cap(c, X86_FEATURE_CYRIX_ARR); 250 set_cpu_cap(c, X86_FEATURE_CYRIX_ARR);
251 /* 6x86's contain this bug */ 251 /* 6x86's contain this bug */
252 c->coma_bug = 1; 252 set_cpu_bug(c, X86_BUG_COMA);
253 break; 253 break;
254 254
255 case 4: /* MediaGX/GXm or Geode GXM/GXLV/GX1 */ 255 case 4: /* MediaGX/GXm or Geode GXM/GXLV/GX1 */
@@ -317,7 +317,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
317 /* Enable MMX extensions (App note 108) */ 317 /* Enable MMX extensions (App note 108) */
318 setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1); 318 setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1);
319 } else { 319 } else {
320 c->coma_bug = 1; /* 6x86MX, it has the bug. */ 320 /* A 6x86MX - it has the bug. */
321 set_cpu_bug(c, X86_BUG_COMA);
321 } 322 }
322 tmp = (!(dir0_lsn & 7) || dir0_lsn & 1) ? 2 : 0; 323 tmp = (!(dir0_lsn & 7) || dir0_lsn & 1) ? 2 : 0;
323 Cx86_cb[tmp] = cyrix_model_mult2[dir0_lsn & 7]; 324 Cx86_cb[tmp] = cyrix_model_mult2[dir0_lsn & 7];
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 1905ce98bee0..9b0c441c03f5 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -96,6 +96,18 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
96 sched_clock_stable = 1; 96 sched_clock_stable = 1;
97 } 97 }
98 98
99 /* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
100 if (c->x86 == 6) {
101 switch (c->x86_model) {
102 case 0x27: /* Penwell */
103 case 0x35: /* Cloverview */
104 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC_S3);
105 break;
106 default:
107 break;
108 }
109 }
110
99 /* 111 /*
100 * There is a known erratum on Pentium III and Core Solo 112 * There is a known erratum on Pentium III and Core Solo
101 * and Core Duo CPUs. 113 * and Core Duo CPUs.
@@ -164,20 +176,6 @@ int __cpuinit ppro_with_ram_bug(void)
164 return 0; 176 return 0;
165} 177}
166 178
167#ifdef CONFIG_X86_F00F_BUG
168static void __cpuinit trap_init_f00f_bug(void)
169{
170 __set_fixmap(FIX_F00F_IDT, __pa_symbol(idt_table), PAGE_KERNEL_RO);
171
172 /*
173 * Update the IDT descriptor and reload the IDT so that
174 * it uses the read-only mapped virtual address.
175 */
176 idt_descr.address = fix_to_virt(FIX_F00F_IDT);
177 load_idt(&idt_descr);
178}
179#endif
180
181static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c) 179static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c)
182{ 180{
183 /* calling is from identify_secondary_cpu() ? */ 181 /* calling is from identify_secondary_cpu() ? */
@@ -206,16 +204,14 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
206 /* 204 /*
207 * All current models of Pentium and Pentium with MMX technology CPUs 205 * All current models of Pentium and Pentium with MMX technology CPUs
208 * have the F0 0F bug, which lets nonprivileged users lock up the 206 * have the F0 0F bug, which lets nonprivileged users lock up the
209 * system. 207 * system. Announce that the fault handler will be checking for it.
210 * Note that the workaround only should be initialized once...
211 */ 208 */
212 c->f00f_bug = 0; 209 clear_cpu_bug(c, X86_BUG_F00F);
213 if (!paravirt_enabled() && c->x86 == 5) { 210 if (!paravirt_enabled() && c->x86 == 5) {
214 static int f00f_workaround_enabled; 211 static int f00f_workaround_enabled;
215 212
216 c->f00f_bug = 1; 213 set_cpu_bug(c, X86_BUG_F00F);
217 if (!f00f_workaround_enabled) { 214 if (!f00f_workaround_enabled) {
218 trap_init_f00f_bug();
219 printk(KERN_NOTICE "Intel Pentium with F0 0F bug - workaround enabled.\n"); 215 printk(KERN_NOTICE "Intel Pentium with F0 0F bug - workaround enabled.\n");
220 f00f_workaround_enabled = 1; 216 f00f_workaround_enabled = 1;
221 } 217 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 7bc126346ace..9239504b41cb 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2358,7 +2358,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2358 2358
2359 if (action == CPU_POST_DEAD) { 2359 if (action == CPU_POST_DEAD) {
2360 /* intentionally ignoring frozen here */ 2360 /* intentionally ignoring frozen here */
2361 cmci_rediscover(cpu); 2361 cmci_rediscover();
2362 } 2362 }
2363 2363
2364 return NOTIFY_OK; 2364 return NOTIFY_OK;
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 1ac581f38dfa..9cb52767999a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -33,7 +33,6 @@
33#include <asm/mce.h> 33#include <asm/mce.h>
34#include <asm/msr.h> 34#include <asm/msr.h>
35 35
36#define NR_BANKS 6
37#define NR_BLOCKS 9 36#define NR_BLOCKS 9
38#define THRESHOLD_MAX 0xFFF 37#define THRESHOLD_MAX 0xFFF
39#define INT_TYPE_APIC 0x00020000 38#define INT_TYPE_APIC 0x00020000
@@ -57,12 +56,7 @@ static const char * const th_names[] = {
57 "execution_unit", 56 "execution_unit",
58}; 57};
59 58
60static DEFINE_PER_CPU(struct threshold_bank * [NR_BANKS], threshold_banks); 59static DEFINE_PER_CPU(struct threshold_bank **, threshold_banks);
61
62static unsigned char shared_bank[NR_BANKS] = {
63 0, 0, 0, 0, 1
64};
65
66static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */ 60static DEFINE_PER_CPU(unsigned char, bank_map); /* see which banks are on */
67 61
68static void amd_threshold_interrupt(void); 62static void amd_threshold_interrupt(void);
@@ -79,6 +73,12 @@ struct thresh_restart {
79 u16 old_limit; 73 u16 old_limit;
80}; 74};
81 75
76static inline bool is_shared_bank(int bank)
77{
78 /* Bank 4 is for northbridge reporting and is thus shared */
79 return (bank == 4);
80}
81
82static const char * const bank4_names(struct threshold_block *b) 82static const char * const bank4_names(struct threshold_block *b)
83{ 83{
84 switch (b->address) { 84 switch (b->address) {
@@ -214,7 +214,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
214 unsigned int bank, block; 214 unsigned int bank, block;
215 int offset = -1; 215 int offset = -1;
216 216
217 for (bank = 0; bank < NR_BANKS; ++bank) { 217 for (bank = 0; bank < mca_cfg.banks; ++bank) {
218 for (block = 0; block < NR_BLOCKS; ++block) { 218 for (block = 0; block < NR_BLOCKS; ++block) {
219 if (block == 0) 219 if (block == 0)
220 address = MSR_IA32_MC0_MISC + bank * 4; 220 address = MSR_IA32_MC0_MISC + bank * 4;
@@ -276,7 +276,7 @@ static void amd_threshold_interrupt(void)
276 mce_setup(&m); 276 mce_setup(&m);
277 277
278 /* assume first bank caused it */ 278 /* assume first bank caused it */
279 for (bank = 0; bank < NR_BANKS; ++bank) { 279 for (bank = 0; bank < mca_cfg.banks; ++bank) {
280 if (!(per_cpu(bank_map, m.cpu) & (1 << bank))) 280 if (!(per_cpu(bank_map, m.cpu) & (1 << bank)))
281 continue; 281 continue;
282 for (block = 0; block < NR_BLOCKS; ++block) { 282 for (block = 0; block < NR_BLOCKS; ++block) {
@@ -467,7 +467,7 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
467 u32 low, high; 467 u32 low, high;
468 int err; 468 int err;
469 469
470 if ((bank >= NR_BANKS) || (block >= NR_BLOCKS)) 470 if ((bank >= mca_cfg.banks) || (block >= NR_BLOCKS))
471 return 0; 471 return 0;
472 472
473 if (rdmsr_safe_on_cpu(cpu, address, &low, &high)) 473 if (rdmsr_safe_on_cpu(cpu, address, &low, &high))
@@ -575,7 +575,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
575 const char *name = th_names[bank]; 575 const char *name = th_names[bank];
576 int err = 0; 576 int err = 0;
577 577
578 if (shared_bank[bank]) { 578 if (is_shared_bank(bank)) {
579 nb = node_to_amd_nb(amd_get_nb_id(cpu)); 579 nb = node_to_amd_nb(amd_get_nb_id(cpu));
580 580
581 /* threshold descriptor already initialized on this node? */ 581 /* threshold descriptor already initialized on this node? */
@@ -609,7 +609,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
609 609
610 per_cpu(threshold_banks, cpu)[bank] = b; 610 per_cpu(threshold_banks, cpu)[bank] = b;
611 611
612 if (shared_bank[bank]) { 612 if (is_shared_bank(bank)) {
613 atomic_set(&b->cpus, 1); 613 atomic_set(&b->cpus, 1);
614 614
615 /* nb is already initialized, see above */ 615 /* nb is already initialized, see above */
@@ -635,9 +635,17 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
635static __cpuinit int threshold_create_device(unsigned int cpu) 635static __cpuinit int threshold_create_device(unsigned int cpu)
636{ 636{
637 unsigned int bank; 637 unsigned int bank;
638 struct threshold_bank **bp;
638 int err = 0; 639 int err = 0;
639 640
640 for (bank = 0; bank < NR_BANKS; ++bank) { 641 bp = kzalloc(sizeof(struct threshold_bank *) * mca_cfg.banks,
642 GFP_KERNEL);
643 if (!bp)
644 return -ENOMEM;
645
646 per_cpu(threshold_banks, cpu) = bp;
647
648 for (bank = 0; bank < mca_cfg.banks; ++bank) {
641 if (!(per_cpu(bank_map, cpu) & (1 << bank))) 649 if (!(per_cpu(bank_map, cpu) & (1 << bank)))
642 continue; 650 continue;
643 err = threshold_create_bank(cpu, bank); 651 err = threshold_create_bank(cpu, bank);
@@ -691,7 +699,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
691 if (!b->blocks) 699 if (!b->blocks)
692 goto free_out; 700 goto free_out;
693 701
694 if (shared_bank[bank]) { 702 if (is_shared_bank(bank)) {
695 if (!atomic_dec_and_test(&b->cpus)) { 703 if (!atomic_dec_and_test(&b->cpus)) {
696 __threshold_remove_blocks(b); 704 __threshold_remove_blocks(b);
697 per_cpu(threshold_banks, cpu)[bank] = NULL; 705 per_cpu(threshold_banks, cpu)[bank] = NULL;
@@ -719,11 +727,12 @@ static void threshold_remove_device(unsigned int cpu)
719{ 727{
720 unsigned int bank; 728 unsigned int bank;
721 729
722 for (bank = 0; bank < NR_BANKS; ++bank) { 730 for (bank = 0; bank < mca_cfg.banks; ++bank) {
723 if (!(per_cpu(bank_map, cpu) & (1 << bank))) 731 if (!(per_cpu(bank_map, cpu) & (1 << bank)))
724 continue; 732 continue;
725 threshold_remove_bank(cpu, bank); 733 threshold_remove_bank(cpu, bank);
726 } 734 }
735 kfree(per_cpu(threshold_banks, cpu));
727} 736}
728 737
729/* get notified when a cpu comes on/off */ 738/* get notified when a cpu comes on/off */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 402c454fbff0..ae1697c2afe3 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -285,39 +285,24 @@ void cmci_clear(void)
285 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); 285 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
286} 286}
287 287
288static long cmci_rediscover_work_func(void *arg) 288static void cmci_rediscover_work_func(void *arg)
289{ 289{
290 int banks; 290 int banks;
291 291
292 /* Recheck banks in case CPUs don't all have the same */ 292 /* Recheck banks in case CPUs don't all have the same */
293 if (cmci_supported(&banks)) 293 if (cmci_supported(&banks))
294 cmci_discover(banks); 294 cmci_discover(banks);
295
296 return 0;
297} 295}
298 296
299/* 297/* After a CPU went down cycle through all the others and rediscover */
300 * After a CPU went down cycle through all the others and rediscover 298void cmci_rediscover(void)
301 * Must run in process context.
302 */
303void cmci_rediscover(int dying)
304{ 299{
305 int cpu, banks; 300 int banks;
306 301
307 if (!cmci_supported(&banks)) 302 if (!cmci_supported(&banks))
308 return; 303 return;
309 304
310 for_each_online_cpu(cpu) { 305 on_each_cpu(cmci_rediscover_work_func, NULL, 1);
311 if (cpu == dying)
312 continue;
313
314 if (cpu == smp_processor_id()) {
315 cmci_rediscover_work_func(NULL);
316 continue;
317 }
318
319 work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
320 }
321} 306}
322 307
323/* 308/*
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl
deleted file mode 100644
index 091972ef49de..000000000000
--- a/arch/x86/kernel/cpu/mkcapflags.pl
+++ /dev/null
@@ -1,48 +0,0 @@
1#!/usr/bin/perl -w
2#
3# Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h
4#
5
6($in, $out) = @ARGV;
7
8open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n";
9open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
10
11print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
12print OUT "#include <asm/cpufeature.h>\n";
13print OUT "#endif\n";
14print OUT "\n";
15print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
16
17%features = ();
18$err = 0;
19
20while (defined($line = <IN>)) {
21 if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
22 $macro = $1;
23 $feature = "\L$2";
24 $tail = $3;
25 if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
26 $feature = "\L$1";
27 }
28
29 next if ($feature eq '');
30
31 if ($features{$feature}++) {
32 print STDERR "$in: duplicate feature name: $feature\n";
33 $err++;
34 }
35 printf OUT "\t%-32s = \"%s\",\n", "[$macro]", $feature;
36 }
37}
38print OUT "};\n";
39
40close(IN);
41close(OUT);
42
43if ($err) {
44 unlink($out);
45 exit(1);
46}
47
48exit(0);
diff --git a/arch/x86/kernel/cpu/mkcapflags.sh b/arch/x86/kernel/cpu/mkcapflags.sh
new file mode 100644
index 000000000000..2bf616505499
--- /dev/null
+++ b/arch/x86/kernel/cpu/mkcapflags.sh
@@ -0,0 +1,41 @@
1#!/bin/sh
2#
3# Generate the x86_cap_flags[] array from include/asm/cpufeature.h
4#
5
6IN=$1
7OUT=$2
8
9TABS="$(printf '\t\t\t\t\t')"
10trap 'rm "$OUT"' EXIT
11
12(
13 echo "#ifndef _ASM_X86_CPUFEATURE_H"
14 echo "#include <asm/cpufeature.h>"
15 echo "#endif"
16 echo ""
17 echo "const char * const x86_cap_flags[NCAPINTS*32] = {"
18
19 # Iterate through any input lines starting with #define X86_FEATURE_
20 sed -n -e 's/\t/ /g' -e 's/^ *# *define *X86_FEATURE_//p' $IN |
21 while read i
22 do
23 # Name is everything up to the first whitespace
24 NAME="$(echo "$i" | sed 's/ .*//')"
25
26 # If the /* comment */ starts with a quote string, grab that.
27 VALUE="$(echo "$i" | sed -n 's@.*/\* *\("[^"]*"\).*\*/@\1@p')"
28 [ -z "$VALUE" ] && VALUE="\"$NAME\""
29 [ "$VALUE" == '""' ] && continue
30
31 # Name is uppercase, VALUE is all lowercase
32 VALUE="$(echo "$VALUE" | tr A-Z a-z)"
33
34 TABCOUNT=$(( ( 5*8 - 14 - $(echo "$NAME" | wc -c) ) / 8 ))
35 printf "\t[%s]%.*s = %s,\n" \
36 "X86_FEATURE_$NAME" "$TABCOUNT" "$TABS" "$VALUE"
37 done
38 echo "};"
39) > $OUT
40
41trap - EXIT
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index bf0f01aea994..1025f3c99d20 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -180,8 +180,9 @@ static void release_pmc_hardware(void) {}
180 180
181static bool check_hw_exists(void) 181static bool check_hw_exists(void)
182{ 182{
183 u64 val, val_new = ~0; 183 u64 val, val_fail, val_new= ~0;
184 int i, reg, ret = 0; 184 int i, reg, reg_fail, ret = 0;
185 int bios_fail = 0;
185 186
186 /* 187 /*
187 * Check to see if the BIOS enabled any of the counters, if so 188 * Check to see if the BIOS enabled any of the counters, if so
@@ -192,8 +193,11 @@ static bool check_hw_exists(void)
192 ret = rdmsrl_safe(reg, &val); 193 ret = rdmsrl_safe(reg, &val);
193 if (ret) 194 if (ret)
194 goto msr_fail; 195 goto msr_fail;
195 if (val & ARCH_PERFMON_EVENTSEL_ENABLE) 196 if (val & ARCH_PERFMON_EVENTSEL_ENABLE) {
196 goto bios_fail; 197 bios_fail = 1;
198 val_fail = val;
199 reg_fail = reg;
200 }
197 } 201 }
198 202
199 if (x86_pmu.num_counters_fixed) { 203 if (x86_pmu.num_counters_fixed) {
@@ -202,8 +206,11 @@ static bool check_hw_exists(void)
202 if (ret) 206 if (ret)
203 goto msr_fail; 207 goto msr_fail;
204 for (i = 0; i < x86_pmu.num_counters_fixed; i++) { 208 for (i = 0; i < x86_pmu.num_counters_fixed; i++) {
205 if (val & (0x03 << i*4)) 209 if (val & (0x03 << i*4)) {
206 goto bios_fail; 210 bios_fail = 1;
211 val_fail = val;
212 reg_fail = reg;
213 }
207 } 214 }
208 } 215 }
209 216
@@ -221,14 +228,13 @@ static bool check_hw_exists(void)
221 if (ret || val != val_new) 228 if (ret || val != val_new)
222 goto msr_fail; 229 goto msr_fail;
223 230
224 return true;
225
226bios_fail:
227 /* 231 /*
228 * We still allow the PMU driver to operate: 232 * We still allow the PMU driver to operate:
229 */ 233 */
230 printk(KERN_CONT "Broken BIOS detected, complain to your hardware vendor.\n"); 234 if (bios_fail) {
231 printk(KERN_ERR FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n", reg, val); 235 printk(KERN_CONT "Broken BIOS detected, complain to your hardware vendor.\n");
236 printk(KERN_ERR FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n", reg_fail, val_fail);
237 }
232 238
233 return true; 239 return true;
234 240
@@ -1316,9 +1322,16 @@ static struct attribute_group x86_pmu_format_group = {
1316 */ 1322 */
1317static void __init filter_events(struct attribute **attrs) 1323static void __init filter_events(struct attribute **attrs)
1318{ 1324{
1325 struct device_attribute *d;
1326 struct perf_pmu_events_attr *pmu_attr;
1319 int i, j; 1327 int i, j;
1320 1328
1321 for (i = 0; attrs[i]; i++) { 1329 for (i = 0; attrs[i]; i++) {
1330 d = (struct device_attribute *)attrs[i];
1331 pmu_attr = container_of(d, struct perf_pmu_events_attr, attr);
1332 /* str trumps id */
1333 if (pmu_attr->event_str)
1334 continue;
1322 if (x86_pmu.event_map(i)) 1335 if (x86_pmu.event_map(i))
1323 continue; 1336 continue;
1324 1337
@@ -1330,22 +1343,45 @@ static void __init filter_events(struct attribute **attrs)
1330 } 1343 }
1331} 1344}
1332 1345
1333static ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, 1346/* Merge two pointer arrays */
1347static __init struct attribute **merge_attr(struct attribute **a, struct attribute **b)
1348{
1349 struct attribute **new;
1350 int j, i;
1351
1352 for (j = 0; a[j]; j++)
1353 ;
1354 for (i = 0; b[i]; i++)
1355 j++;
1356 j++;
1357
1358 new = kmalloc(sizeof(struct attribute *) * j, GFP_KERNEL);
1359 if (!new)
1360 return NULL;
1361
1362 j = 0;
1363 for (i = 0; a[i]; i++)
1364 new[j++] = a[i];
1365 for (i = 0; b[i]; i++)
1366 new[j++] = b[i];
1367 new[j] = NULL;
1368
1369 return new;
1370}
1371
1372ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
1334 char *page) 1373 char *page)
1335{ 1374{
1336 struct perf_pmu_events_attr *pmu_attr = \ 1375 struct perf_pmu_events_attr *pmu_attr = \
1337 container_of(attr, struct perf_pmu_events_attr, attr); 1376 container_of(attr, struct perf_pmu_events_attr, attr);
1338
1339 u64 config = x86_pmu.event_map(pmu_attr->id); 1377 u64 config = x86_pmu.event_map(pmu_attr->id);
1340 return x86_pmu.events_sysfs_show(page, config);
1341}
1342 1378
1343#define EVENT_VAR(_id) event_attr_##_id 1379 /* string trumps id */
1344#define EVENT_PTR(_id) &event_attr_##_id.attr.attr 1380 if (pmu_attr->event_str)
1381 return sprintf(page, "%s", pmu_attr->event_str);
1345 1382
1346#define EVENT_ATTR(_name, _id) \ 1383 return x86_pmu.events_sysfs_show(page, config);
1347 PMU_EVENT_ATTR(_name, EVENT_VAR(_id), PERF_COUNT_HW_##_id, \ 1384}
1348 events_sysfs_show)
1349 1385
1350EVENT_ATTR(cpu-cycles, CPU_CYCLES ); 1386EVENT_ATTR(cpu-cycles, CPU_CYCLES );
1351EVENT_ATTR(instructions, INSTRUCTIONS ); 1387EVENT_ATTR(instructions, INSTRUCTIONS );
@@ -1459,16 +1495,27 @@ static int __init init_hw_perf_events(void)
1459 1495
1460 unconstrained = (struct event_constraint) 1496 unconstrained = (struct event_constraint)
1461 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1, 1497 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1,
1462 0, x86_pmu.num_counters, 0); 1498 0, x86_pmu.num_counters, 0, 0);
1463 1499
1464 x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */ 1500 x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */
1465 x86_pmu_format_group.attrs = x86_pmu.format_attrs; 1501 x86_pmu_format_group.attrs = x86_pmu.format_attrs;
1466 1502
1503 if (x86_pmu.event_attrs)
1504 x86_pmu_events_group.attrs = x86_pmu.event_attrs;
1505
1467 if (!x86_pmu.events_sysfs_show) 1506 if (!x86_pmu.events_sysfs_show)
1468 x86_pmu_events_group.attrs = &empty_attrs; 1507 x86_pmu_events_group.attrs = &empty_attrs;
1469 else 1508 else
1470 filter_events(x86_pmu_events_group.attrs); 1509 filter_events(x86_pmu_events_group.attrs);
1471 1510
1511 if (x86_pmu.cpu_events) {
1512 struct attribute **tmp;
1513
1514 tmp = merge_attr(x86_pmu_events_group.attrs, x86_pmu.cpu_events);
1515 if (!WARN_ON(!tmp))
1516 x86_pmu_events_group.attrs = tmp;
1517 }
1518
1472 pr_info("... version: %d\n", x86_pmu.version); 1519 pr_info("... version: %d\n", x86_pmu.version);
1473 pr_info("... bit width: %d\n", x86_pmu.cntval_bits); 1520 pr_info("... bit width: %d\n", x86_pmu.cntval_bits);
1474 pr_info("... generic registers: %d\n", x86_pmu.num_counters); 1521 pr_info("... generic registers: %d\n", x86_pmu.num_counters);
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 7f5c75c2afdd..ba9aadfa683b 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -46,6 +46,7 @@ enum extra_reg_type {
46 EXTRA_REG_RSP_0 = 0, /* offcore_response_0 */ 46 EXTRA_REG_RSP_0 = 0, /* offcore_response_0 */
47 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */ 47 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */
48 EXTRA_REG_LBR = 2, /* lbr_select */ 48 EXTRA_REG_LBR = 2, /* lbr_select */
49 EXTRA_REG_LDLAT = 3, /* ld_lat_threshold */
49 50
50 EXTRA_REG_MAX /* number of entries needed */ 51 EXTRA_REG_MAX /* number of entries needed */
51}; 52};
@@ -59,7 +60,13 @@ struct event_constraint {
59 u64 cmask; 60 u64 cmask;
60 int weight; 61 int weight;
61 int overlap; 62 int overlap;
63 int flags;
62}; 64};
65/*
66 * struct event_constraint flags
67 */
68#define PERF_X86_EVENT_PEBS_LDLAT 0x1 /* ld+ldlat data address sampling */
69#define PERF_X86_EVENT_PEBS_ST 0x2 /* st data address sampling */
63 70
64struct amd_nb { 71struct amd_nb {
65 int nb_id; /* NorthBridge id */ 72 int nb_id; /* NorthBridge id */
@@ -170,16 +177,17 @@ struct cpu_hw_events {
170 void *kfree_on_online; 177 void *kfree_on_online;
171}; 178};
172 179
173#define __EVENT_CONSTRAINT(c, n, m, w, o) {\ 180#define __EVENT_CONSTRAINT(c, n, m, w, o, f) {\
174 { .idxmsk64 = (n) }, \ 181 { .idxmsk64 = (n) }, \
175 .code = (c), \ 182 .code = (c), \
176 .cmask = (m), \ 183 .cmask = (m), \
177 .weight = (w), \ 184 .weight = (w), \
178 .overlap = (o), \ 185 .overlap = (o), \
186 .flags = f, \
179} 187}
180 188
181#define EVENT_CONSTRAINT(c, n, m) \ 189#define EVENT_CONSTRAINT(c, n, m) \
182 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n), 0) 190 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n), 0, 0)
183 191
184/* 192/*
185 * The overlap flag marks event constraints with overlapping counter 193 * The overlap flag marks event constraints with overlapping counter
@@ -203,7 +211,7 @@ struct cpu_hw_events {
203 * and its counter masks must be kept at a minimum. 211 * and its counter masks must be kept at a minimum.
204 */ 212 */
205#define EVENT_CONSTRAINT_OVERLAP(c, n, m) \ 213#define EVENT_CONSTRAINT_OVERLAP(c, n, m) \
206 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n), 1) 214 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n), 1, 0)
207 215
208/* 216/*
209 * Constraint on the Event code. 217 * Constraint on the Event code.
@@ -231,6 +239,14 @@ struct cpu_hw_events {
231#define INTEL_UEVENT_CONSTRAINT(c, n) \ 239#define INTEL_UEVENT_CONSTRAINT(c, n) \
232 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK) 240 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
233 241
242#define INTEL_PLD_CONSTRAINT(c, n) \
243 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
244 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LDLAT)
245
246#define INTEL_PST_CONSTRAINT(c, n) \
247 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
248 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST)
249
234#define EVENT_CONSTRAINT_END \ 250#define EVENT_CONSTRAINT_END \
235 EVENT_CONSTRAINT(0, 0, 0) 251 EVENT_CONSTRAINT(0, 0, 0)
236 252
@@ -260,12 +276,22 @@ struct extra_reg {
260 .msr = (ms), \ 276 .msr = (ms), \
261 .config_mask = (m), \ 277 .config_mask = (m), \
262 .valid_mask = (vm), \ 278 .valid_mask = (vm), \
263 .idx = EXTRA_REG_##i \ 279 .idx = EXTRA_REG_##i, \
264 } 280 }
265 281
266#define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \ 282#define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \
267 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm, idx) 283 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm, idx)
268 284
285#define INTEL_UEVENT_EXTRA_REG(event, msr, vm, idx) \
286 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT | \
287 ARCH_PERFMON_EVENTSEL_UMASK, vm, idx)
288
289#define INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(c) \
290 INTEL_UEVENT_EXTRA_REG(c, \
291 MSR_PEBS_LD_LAT_THRESHOLD, \
292 0xffff, \
293 LDLAT)
294
269#define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0) 295#define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0)
270 296
271union perf_capabilities { 297union perf_capabilities {
@@ -355,8 +381,10 @@ struct x86_pmu {
355 */ 381 */
356 int attr_rdpmc; 382 int attr_rdpmc;
357 struct attribute **format_attrs; 383 struct attribute **format_attrs;
384 struct attribute **event_attrs;
358 385
359 ssize_t (*events_sysfs_show)(char *page, u64 config); 386 ssize_t (*events_sysfs_show)(char *page, u64 config);
387 struct attribute **cpu_events;
360 388
361 /* 389 /*
362 * CPU Hotplug hooks 390 * CPU Hotplug hooks
@@ -421,6 +449,23 @@ do { \
421#define ERF_NO_HT_SHARING 1 449#define ERF_NO_HT_SHARING 1
422#define ERF_HAS_RSP_1 2 450#define ERF_HAS_RSP_1 2
423 451
452#define EVENT_VAR(_id) event_attr_##_id
453#define EVENT_PTR(_id) &event_attr_##_id.attr.attr
454
455#define EVENT_ATTR(_name, _id) \
456static struct perf_pmu_events_attr EVENT_VAR(_id) = { \
457 .attr = __ATTR(_name, 0444, events_sysfs_show, NULL), \
458 .id = PERF_COUNT_HW_##_id, \
459 .event_str = NULL, \
460};
461
462#define EVENT_ATTR_STR(_name, v, str) \
463static struct perf_pmu_events_attr event_attr_##v = { \
464 .attr = __ATTR(_name, 0444, events_sysfs_show, NULL), \
465 .id = 0, \
466 .event_str = str, \
467};
468
424extern struct x86_pmu x86_pmu __read_mostly; 469extern struct x86_pmu x86_pmu __read_mostly;
425 470
426DECLARE_PER_CPU(struct cpu_hw_events, cpu_hw_events); 471DECLARE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
@@ -628,6 +673,9 @@ int p6_pmu_init(void);
628 673
629int knc_pmu_init(void); 674int knc_pmu_init(void);
630 675
676ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
677 char *page);
678
631#else /* CONFIG_CPU_SUP_INTEL */ 679#else /* CONFIG_CPU_SUP_INTEL */
632 680
633static inline void reserve_ds_buffers(void) 681static inline void reserve_ds_buffers(void)
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index dfdab42aed27..7e28d9467bb4 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -132,14 +132,11 @@ static u64 amd_pmu_event_map(int hw_event)
132 return amd_perfmon_event_map[hw_event]; 132 return amd_perfmon_event_map[hw_event];
133} 133}
134 134
135static struct event_constraint *amd_nb_event_constraint;
136
137/* 135/*
138 * Previously calculated offsets 136 * Previously calculated offsets
139 */ 137 */
140static unsigned int event_offsets[X86_PMC_IDX_MAX] __read_mostly; 138static unsigned int event_offsets[X86_PMC_IDX_MAX] __read_mostly;
141static unsigned int count_offsets[X86_PMC_IDX_MAX] __read_mostly; 139static unsigned int count_offsets[X86_PMC_IDX_MAX] __read_mostly;
142static unsigned int rdpmc_indexes[X86_PMC_IDX_MAX] __read_mostly;
143 140
144/* 141/*
145 * Legacy CPUs: 142 * Legacy CPUs:
@@ -147,14 +144,10 @@ static unsigned int rdpmc_indexes[X86_PMC_IDX_MAX] __read_mostly;
147 * 144 *
148 * CPUs with core performance counter extensions: 145 * CPUs with core performance counter extensions:
149 * 6 counters starting at 0xc0010200 each offset by 2 146 * 6 counters starting at 0xc0010200 each offset by 2
150 *
151 * CPUs with north bridge performance counter extensions:
152 * 4 additional counters starting at 0xc0010240 each offset by 2
153 * (indexed right above either one of the above core counters)
154 */ 147 */
155static inline int amd_pmu_addr_offset(int index, bool eventsel) 148static inline int amd_pmu_addr_offset(int index, bool eventsel)
156{ 149{
157 int offset, first, base; 150 int offset;
158 151
159 if (!index) 152 if (!index)
160 return index; 153 return index;
@@ -167,23 +160,7 @@ static inline int amd_pmu_addr_offset(int index, bool eventsel)
167 if (offset) 160 if (offset)
168 return offset; 161 return offset;
169 162
170 if (amd_nb_event_constraint && 163 if (!cpu_has_perfctr_core)
171 test_bit(index, amd_nb_event_constraint->idxmsk)) {
172 /*
173 * calculate the offset of NB counters with respect to
174 * base eventsel or perfctr
175 */
176
177 first = find_first_bit(amd_nb_event_constraint->idxmsk,
178 X86_PMC_IDX_MAX);
179
180 if (eventsel)
181 base = MSR_F15H_NB_PERF_CTL - x86_pmu.eventsel;
182 else
183 base = MSR_F15H_NB_PERF_CTR - x86_pmu.perfctr;
184
185 offset = base + ((index - first) << 1);
186 } else if (!cpu_has_perfctr_core)
187 offset = index; 164 offset = index;
188 else 165 else
189 offset = index << 1; 166 offset = index << 1;
@@ -196,36 +173,6 @@ static inline int amd_pmu_addr_offset(int index, bool eventsel)
196 return offset; 173 return offset;
197} 174}
198 175
199static inline int amd_pmu_rdpmc_index(int index)
200{
201 int ret, first;
202
203 if (!index)
204 return index;
205
206 ret = rdpmc_indexes[index];
207
208 if (ret)
209 return ret;
210
211 if (amd_nb_event_constraint &&
212 test_bit(index, amd_nb_event_constraint->idxmsk)) {
213 /*
214 * according to the mnual, ECX value of the NB counters is
215 * the index of the NB counter (0, 1, 2 or 3) plus 6
216 */
217
218 first = find_first_bit(amd_nb_event_constraint->idxmsk,
219 X86_PMC_IDX_MAX);
220 ret = index - first + 6;
221 } else
222 ret = index;
223
224 rdpmc_indexes[index] = ret;
225
226 return ret;
227}
228
229static int amd_core_hw_config(struct perf_event *event) 176static int amd_core_hw_config(struct perf_event *event)
230{ 177{
231 if (event->attr.exclude_host && event->attr.exclude_guest) 178 if (event->attr.exclude_host && event->attr.exclude_guest)
@@ -245,34 +192,6 @@ static int amd_core_hw_config(struct perf_event *event)
245} 192}
246 193
247/* 194/*
248 * NB counters do not support the following event select bits:
249 * Host/Guest only
250 * Counter mask
251 * Invert counter mask
252 * Edge detect
253 * OS/User mode
254 */
255static int amd_nb_hw_config(struct perf_event *event)
256{
257 /* for NB, we only allow system wide counting mode */
258 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
259 return -EINVAL;
260
261 if (event->attr.exclude_user || event->attr.exclude_kernel ||
262 event->attr.exclude_host || event->attr.exclude_guest)
263 return -EINVAL;
264
265 event->hw.config &= ~(ARCH_PERFMON_EVENTSEL_USR |
266 ARCH_PERFMON_EVENTSEL_OS);
267
268 if (event->hw.config & ~(AMD64_RAW_EVENT_MASK_NB |
269 ARCH_PERFMON_EVENTSEL_INT))
270 return -EINVAL;
271
272 return 0;
273}
274
275/*
276 * AMD64 events are detected based on their event codes. 195 * AMD64 events are detected based on their event codes.
277 */ 196 */
278static inline unsigned int amd_get_event_code(struct hw_perf_event *hwc) 197static inline unsigned int amd_get_event_code(struct hw_perf_event *hwc)
@@ -285,11 +204,6 @@ static inline int amd_is_nb_event(struct hw_perf_event *hwc)
285 return (hwc->config & 0xe0) == 0xe0; 204 return (hwc->config & 0xe0) == 0xe0;
286} 205}
287 206
288static inline int amd_is_perfctr_nb_event(struct hw_perf_event *hwc)
289{
290 return amd_nb_event_constraint && amd_is_nb_event(hwc);
291}
292
293static inline int amd_has_nb(struct cpu_hw_events *cpuc) 207static inline int amd_has_nb(struct cpu_hw_events *cpuc)
294{ 208{
295 struct amd_nb *nb = cpuc->amd_nb; 209 struct amd_nb *nb = cpuc->amd_nb;
@@ -315,9 +229,6 @@ static int amd_pmu_hw_config(struct perf_event *event)
315 if (event->attr.type == PERF_TYPE_RAW) 229 if (event->attr.type == PERF_TYPE_RAW)
316 event->hw.config |= event->attr.config & AMD64_RAW_EVENT_MASK; 230 event->hw.config |= event->attr.config & AMD64_RAW_EVENT_MASK;
317 231
318 if (amd_is_perfctr_nb_event(&event->hw))
319 return amd_nb_hw_config(event);
320
321 return amd_core_hw_config(event); 232 return amd_core_hw_config(event);
322} 233}
323 234
@@ -341,19 +252,6 @@ static void __amd_put_nb_event_constraints(struct cpu_hw_events *cpuc,
341 } 252 }
342} 253}
343 254
344static void amd_nb_interrupt_hw_config(struct hw_perf_event *hwc)
345{
346 int core_id = cpu_data(smp_processor_id()).cpu_core_id;
347
348 /* deliver interrupts only to this core */
349 if (hwc->config & ARCH_PERFMON_EVENTSEL_INT) {
350 hwc->config |= AMD64_EVENTSEL_INT_CORE_ENABLE;
351 hwc->config &= ~AMD64_EVENTSEL_INT_CORE_SEL_MASK;
352 hwc->config |= (u64)(core_id) <<
353 AMD64_EVENTSEL_INT_CORE_SEL_SHIFT;
354 }
355}
356
357 /* 255 /*
358 * AMD64 NorthBridge events need special treatment because 256 * AMD64 NorthBridge events need special treatment because
359 * counter access needs to be synchronized across all cores 257 * counter access needs to be synchronized across all cores
@@ -441,9 +339,6 @@ __amd_get_nb_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *ev
441 if (new == -1) 339 if (new == -1)
442 return &emptyconstraint; 340 return &emptyconstraint;
443 341
444 if (amd_is_perfctr_nb_event(hwc))
445 amd_nb_interrupt_hw_config(hwc);
446
447 return &nb->event_constraints[new]; 342 return &nb->event_constraints[new];
448} 343}
449 344
@@ -543,8 +438,7 @@ amd_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
543 if (!(amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))) 438 if (!(amd_has_nb(cpuc) && amd_is_nb_event(&event->hw)))
544 return &unconstrained; 439 return &unconstrained;
545 440
546 return __amd_get_nb_event_constraints(cpuc, event, 441 return __amd_get_nb_event_constraints(cpuc, event, NULL);
547 amd_nb_event_constraint);
548} 442}
549 443
550static void amd_put_event_constraints(struct cpu_hw_events *cpuc, 444static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
@@ -643,9 +537,6 @@ static struct event_constraint amd_f15_PMC30 = EVENT_CONSTRAINT_OVERLAP(0, 0x09,
643static struct event_constraint amd_f15_PMC50 = EVENT_CONSTRAINT(0, 0x3F, 0); 537static struct event_constraint amd_f15_PMC50 = EVENT_CONSTRAINT(0, 0x3F, 0);
644static struct event_constraint amd_f15_PMC53 = EVENT_CONSTRAINT(0, 0x38, 0); 538static struct event_constraint amd_f15_PMC53 = EVENT_CONSTRAINT(0, 0x38, 0);
645 539
646static struct event_constraint amd_NBPMC96 = EVENT_CONSTRAINT(0, 0x3C0, 0);
647static struct event_constraint amd_NBPMC74 = EVENT_CONSTRAINT(0, 0xF0, 0);
648
649static struct event_constraint * 540static struct event_constraint *
650amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *event) 541amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *event)
651{ 542{
@@ -711,8 +602,8 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *ev
711 return &amd_f15_PMC20; 602 return &amd_f15_PMC20;
712 } 603 }
713 case AMD_EVENT_NB: 604 case AMD_EVENT_NB:
714 return __amd_get_nb_event_constraints(cpuc, event, 605 /* moved to perf_event_amd_uncore.c */
715 amd_nb_event_constraint); 606 return &emptyconstraint;
716 default: 607 default:
717 return &emptyconstraint; 608 return &emptyconstraint;
718 } 609 }
@@ -738,7 +629,6 @@ static __initconst const struct x86_pmu amd_pmu = {
738 .eventsel = MSR_K7_EVNTSEL0, 629 .eventsel = MSR_K7_EVNTSEL0,
739 .perfctr = MSR_K7_PERFCTR0, 630 .perfctr = MSR_K7_PERFCTR0,
740 .addr_offset = amd_pmu_addr_offset, 631 .addr_offset = amd_pmu_addr_offset,
741 .rdpmc_index = amd_pmu_rdpmc_index,
742 .event_map = amd_pmu_event_map, 632 .event_map = amd_pmu_event_map,
743 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 633 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
744 .num_counters = AMD64_NUM_COUNTERS, 634 .num_counters = AMD64_NUM_COUNTERS,
@@ -790,23 +680,6 @@ static int setup_perfctr_core(void)
790 return 0; 680 return 0;
791} 681}
792 682
793static int setup_perfctr_nb(void)
794{
795 if (!cpu_has_perfctr_nb)
796 return -ENODEV;
797
798 x86_pmu.num_counters += AMD64_NUM_COUNTERS_NB;
799
800 if (cpu_has_perfctr_core)
801 amd_nb_event_constraint = &amd_NBPMC96;
802 else
803 amd_nb_event_constraint = &amd_NBPMC74;
804
805 printk(KERN_INFO "perf: AMD northbridge performance counters detected\n");
806
807 return 0;
808}
809
810__init int amd_pmu_init(void) 683__init int amd_pmu_init(void)
811{ 684{
812 /* Performance-monitoring supported from K7 and later: */ 685 /* Performance-monitoring supported from K7 and later: */
@@ -817,7 +690,6 @@ __init int amd_pmu_init(void)
817 690
818 setup_event_constraints(); 691 setup_event_constraints();
819 setup_perfctr_core(); 692 setup_perfctr_core();
820 setup_perfctr_nb();
821 693
822 /* Events are common for all AMDs */ 694 /* Events are common for all AMDs */
823 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, 695 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
diff --git a/arch/x86/kernel/cpu/perf_event_amd_uncore.c b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
new file mode 100644
index 000000000000..c0c661adf03e
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
@@ -0,0 +1,547 @@
1/*
2 * Copyright (C) 2013 Advanced Micro Devices, Inc.
3 *
4 * Author: Jacob Shin <jacob.shin@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/perf_event.h>
12#include <linux/percpu.h>
13#include <linux/types.h>
14#include <linux/slab.h>
15#include <linux/init.h>
16#include <linux/cpu.h>
17#include <linux/cpumask.h>
18
19#include <asm/cpufeature.h>
20#include <asm/perf_event.h>
21#include <asm/msr.h>
22
23#define NUM_COUNTERS_NB 4
24#define NUM_COUNTERS_L2 4
25#define MAX_COUNTERS NUM_COUNTERS_NB
26
27#define RDPMC_BASE_NB 6
28#define RDPMC_BASE_L2 10
29
30#define COUNTER_SHIFT 16
31
32struct amd_uncore {
33 int id;
34 int refcnt;
35 int cpu;
36 int num_counters;
37 int rdpmc_base;
38 u32 msr_base;
39 cpumask_t *active_mask;
40 struct pmu *pmu;
41 struct perf_event *events[MAX_COUNTERS];
42 struct amd_uncore *free_when_cpu_online;
43};
44
45static struct amd_uncore * __percpu *amd_uncore_nb;
46static struct amd_uncore * __percpu *amd_uncore_l2;
47
48static struct pmu amd_nb_pmu;
49static struct pmu amd_l2_pmu;
50
51static cpumask_t amd_nb_active_mask;
52static cpumask_t amd_l2_active_mask;
53
54static bool is_nb_event(struct perf_event *event)
55{
56 return event->pmu->type == amd_nb_pmu.type;
57}
58
59static bool is_l2_event(struct perf_event *event)
60{
61 return event->pmu->type == amd_l2_pmu.type;
62}
63
64static struct amd_uncore *event_to_amd_uncore(struct perf_event *event)
65{
66 if (is_nb_event(event) && amd_uncore_nb)
67 return *per_cpu_ptr(amd_uncore_nb, event->cpu);
68 else if (is_l2_event(event) && amd_uncore_l2)
69 return *per_cpu_ptr(amd_uncore_l2, event->cpu);
70
71 return NULL;
72}
73
74static void amd_uncore_read(struct perf_event *event)
75{
76 struct hw_perf_event *hwc = &event->hw;
77 u64 prev, new;
78 s64 delta;
79
80 /*
81 * since we do not enable counter overflow interrupts,
82 * we do not have to worry about prev_count changing on us
83 */
84
85 prev = local64_read(&hwc->prev_count);
86 rdpmcl(hwc->event_base_rdpmc, new);
87 local64_set(&hwc->prev_count, new);
88 delta = (new << COUNTER_SHIFT) - (prev << COUNTER_SHIFT);
89 delta >>= COUNTER_SHIFT;
90 local64_add(delta, &event->count);
91}
92
93static void amd_uncore_start(struct perf_event *event, int flags)
94{
95 struct hw_perf_event *hwc = &event->hw;
96
97 if (flags & PERF_EF_RELOAD)
98 wrmsrl(hwc->event_base, (u64)local64_read(&hwc->prev_count));
99
100 hwc->state = 0;
101 wrmsrl(hwc->config_base, (hwc->config | ARCH_PERFMON_EVENTSEL_ENABLE));
102 perf_event_update_userpage(event);
103}
104
105static void amd_uncore_stop(struct perf_event *event, int flags)
106{
107 struct hw_perf_event *hwc = &event->hw;
108
109 wrmsrl(hwc->config_base, hwc->config);
110 hwc->state |= PERF_HES_STOPPED;
111
112 if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
113 amd_uncore_read(event);
114 hwc->state |= PERF_HES_UPTODATE;
115 }
116}
117
118static int amd_uncore_add(struct perf_event *event, int flags)
119{
120 int i;
121 struct amd_uncore *uncore = event_to_amd_uncore(event);
122 struct hw_perf_event *hwc = &event->hw;
123
124 /* are we already assigned? */
125 if (hwc->idx != -1 && uncore->events[hwc->idx] == event)
126 goto out;
127
128 for (i = 0; i < uncore->num_counters; i++) {
129 if (uncore->events[i] == event) {
130 hwc->idx = i;
131 goto out;
132 }
133 }
134
135 /* if not, take the first available counter */
136 hwc->idx = -1;
137 for (i = 0; i < uncore->num_counters; i++) {
138 if (cmpxchg(&uncore->events[i], NULL, event) == NULL) {
139 hwc->idx = i;
140 break;
141 }
142 }
143
144out:
145 if (hwc->idx == -1)
146 return -EBUSY;
147
148 hwc->config_base = uncore->msr_base + (2 * hwc->idx);
149 hwc->event_base = uncore->msr_base + 1 + (2 * hwc->idx);
150 hwc->event_base_rdpmc = uncore->rdpmc_base + hwc->idx;
151 hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
152
153 if (flags & PERF_EF_START)
154 amd_uncore_start(event, PERF_EF_RELOAD);
155
156 return 0;
157}
158
159static void amd_uncore_del(struct perf_event *event, int flags)
160{
161 int i;
162 struct amd_uncore *uncore = event_to_amd_uncore(event);
163 struct hw_perf_event *hwc = &event->hw;
164
165 amd_uncore_stop(event, PERF_EF_UPDATE);
166
167 for (i = 0; i < uncore->num_counters; i++) {
168 if (cmpxchg(&uncore->events[i], event, NULL) == event)
169 break;
170 }
171
172 hwc->idx = -1;
173}
174
175static int amd_uncore_event_init(struct perf_event *event)
176{
177 struct amd_uncore *uncore;
178 struct hw_perf_event *hwc = &event->hw;
179
180 if (event->attr.type != event->pmu->type)
181 return -ENOENT;
182
183 /*
184 * NB and L2 counters (MSRs) are shared across all cores that share the
185 * same NB / L2 cache. Interrupts can be directed to a single target
186 * core, however, event counts generated by processes running on other
187 * cores cannot be masked out. So we do not support sampling and
188 * per-thread events.
189 */
190 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
191 return -EINVAL;
192
193 /* NB and L2 counters do not have usr/os/guest/host bits */
194 if (event->attr.exclude_user || event->attr.exclude_kernel ||
195 event->attr.exclude_host || event->attr.exclude_guest)
196 return -EINVAL;
197
198 /* and we do not enable counter overflow interrupts */
199 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
200 hwc->idx = -1;
201
202 if (event->cpu < 0)
203 return -EINVAL;
204
205 uncore = event_to_amd_uncore(event);
206 if (!uncore)
207 return -ENODEV;
208
209 /*
210 * since request can come in to any of the shared cores, we will remap
211 * to a single common cpu.
212 */
213 event->cpu = uncore->cpu;
214
215 return 0;
216}
217
218static ssize_t amd_uncore_attr_show_cpumask(struct device *dev,
219 struct device_attribute *attr,
220 char *buf)
221{
222 int n;
223 cpumask_t *active_mask;
224 struct pmu *pmu = dev_get_drvdata(dev);
225
226 if (pmu->type == amd_nb_pmu.type)
227 active_mask = &amd_nb_active_mask;
228 else if (pmu->type == amd_l2_pmu.type)
229 active_mask = &amd_l2_active_mask;
230 else
231 return 0;
232
233 n = cpulist_scnprintf(buf, PAGE_SIZE - 2, active_mask);
234 buf[n++] = '\n';
235 buf[n] = '\0';
236 return n;
237}
238static DEVICE_ATTR(cpumask, S_IRUGO, amd_uncore_attr_show_cpumask, NULL);
239
240static struct attribute *amd_uncore_attrs[] = {
241 &dev_attr_cpumask.attr,
242 NULL,
243};
244
245static struct attribute_group amd_uncore_attr_group = {
246 .attrs = amd_uncore_attrs,
247};
248
249PMU_FORMAT_ATTR(event, "config:0-7,32-35");
250PMU_FORMAT_ATTR(umask, "config:8-15");
251
252static struct attribute *amd_uncore_format_attr[] = {
253 &format_attr_event.attr,
254 &format_attr_umask.attr,
255 NULL,
256};
257
258static struct attribute_group amd_uncore_format_group = {
259 .name = "format",
260 .attrs = amd_uncore_format_attr,
261};
262
263static const struct attribute_group *amd_uncore_attr_groups[] = {
264 &amd_uncore_attr_group,
265 &amd_uncore_format_group,
266 NULL,
267};
268
269static struct pmu amd_nb_pmu = {
270 .attr_groups = amd_uncore_attr_groups,
271 .name = "amd_nb",
272 .event_init = amd_uncore_event_init,
273 .add = amd_uncore_add,
274 .del = amd_uncore_del,
275 .start = amd_uncore_start,
276 .stop = amd_uncore_stop,
277 .read = amd_uncore_read,
278};
279
280static struct pmu amd_l2_pmu = {
281 .attr_groups = amd_uncore_attr_groups,
282 .name = "amd_l2",
283 .event_init = amd_uncore_event_init,
284 .add = amd_uncore_add,
285 .del = amd_uncore_del,
286 .start = amd_uncore_start,
287 .stop = amd_uncore_stop,
288 .read = amd_uncore_read,
289};
290
291static struct amd_uncore * __cpuinit amd_uncore_alloc(unsigned int cpu)
292{
293 return kzalloc_node(sizeof(struct amd_uncore), GFP_KERNEL,
294 cpu_to_node(cpu));
295}
296
297static void __cpuinit amd_uncore_cpu_up_prepare(unsigned int cpu)
298{
299 struct amd_uncore *uncore;
300
301 if (amd_uncore_nb) {
302 uncore = amd_uncore_alloc(cpu);
303 uncore->cpu = cpu;
304 uncore->num_counters = NUM_COUNTERS_NB;
305 uncore->rdpmc_base = RDPMC_BASE_NB;
306 uncore->msr_base = MSR_F15H_NB_PERF_CTL;
307 uncore->active_mask = &amd_nb_active_mask;
308 uncore->pmu = &amd_nb_pmu;
309 *per_cpu_ptr(amd_uncore_nb, cpu) = uncore;
310 }
311
312 if (amd_uncore_l2) {
313 uncore = amd_uncore_alloc(cpu);
314 uncore->cpu = cpu;
315 uncore->num_counters = NUM_COUNTERS_L2;
316 uncore->rdpmc_base = RDPMC_BASE_L2;
317 uncore->msr_base = MSR_F16H_L2I_PERF_CTL;
318 uncore->active_mask = &amd_l2_active_mask;
319 uncore->pmu = &amd_l2_pmu;
320 *per_cpu_ptr(amd_uncore_l2, cpu) = uncore;
321 }
322}
323
324static struct amd_uncore *
325__cpuinit amd_uncore_find_online_sibling(struct amd_uncore *this,
326 struct amd_uncore * __percpu *uncores)
327{
328 unsigned int cpu;
329 struct amd_uncore *that;
330
331 for_each_online_cpu(cpu) {
332 that = *per_cpu_ptr(uncores, cpu);
333
334 if (!that)
335 continue;
336
337 if (this == that)
338 continue;
339
340 if (this->id == that->id) {
341 that->free_when_cpu_online = this;
342 this = that;
343 break;
344 }
345 }
346
347 this->refcnt++;
348 return this;
349}
350
351static void __cpuinit amd_uncore_cpu_starting(unsigned int cpu)
352{
353 unsigned int eax, ebx, ecx, edx;
354 struct amd_uncore *uncore;
355
356 if (amd_uncore_nb) {
357 uncore = *per_cpu_ptr(amd_uncore_nb, cpu);
358 cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
359 uncore->id = ecx & 0xff;
360
361 uncore = amd_uncore_find_online_sibling(uncore, amd_uncore_nb);
362 *per_cpu_ptr(amd_uncore_nb, cpu) = uncore;
363 }
364
365 if (amd_uncore_l2) {
366 unsigned int apicid = cpu_data(cpu).apicid;
367 unsigned int nshared;
368
369 uncore = *per_cpu_ptr(amd_uncore_l2, cpu);
370 cpuid_count(0x8000001d, 2, &eax, &ebx, &ecx, &edx);
371 nshared = ((eax >> 14) & 0xfff) + 1;
372 uncore->id = apicid - (apicid % nshared);
373
374 uncore = amd_uncore_find_online_sibling(uncore, amd_uncore_l2);
375 *per_cpu_ptr(amd_uncore_l2, cpu) = uncore;
376 }
377}
378
379static void __cpuinit uncore_online(unsigned int cpu,
380 struct amd_uncore * __percpu *uncores)
381{
382 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu);
383
384 kfree(uncore->free_when_cpu_online);
385 uncore->free_when_cpu_online = NULL;
386
387 if (cpu == uncore->cpu)
388 cpumask_set_cpu(cpu, uncore->active_mask);
389}
390
391static void __cpuinit amd_uncore_cpu_online(unsigned int cpu)
392{
393 if (amd_uncore_nb)
394 uncore_online(cpu, amd_uncore_nb);
395
396 if (amd_uncore_l2)
397 uncore_online(cpu, amd_uncore_l2);
398}
399
400static void __cpuinit uncore_down_prepare(unsigned int cpu,
401 struct amd_uncore * __percpu *uncores)
402{
403 unsigned int i;
404 struct amd_uncore *this = *per_cpu_ptr(uncores, cpu);
405
406 if (this->cpu != cpu)
407 return;
408
409 /* this cpu is going down, migrate to a shared sibling if possible */
410 for_each_online_cpu(i) {
411 struct amd_uncore *that = *per_cpu_ptr(uncores, i);
412
413 if (cpu == i)
414 continue;
415
416 if (this == that) {
417 perf_pmu_migrate_context(this->pmu, cpu, i);
418 cpumask_clear_cpu(cpu, that->active_mask);
419 cpumask_set_cpu(i, that->active_mask);
420 that->cpu = i;
421 break;
422 }
423 }
424}
425
426static void __cpuinit amd_uncore_cpu_down_prepare(unsigned int cpu)
427{
428 if (amd_uncore_nb)
429 uncore_down_prepare(cpu, amd_uncore_nb);
430
431 if (amd_uncore_l2)
432 uncore_down_prepare(cpu, amd_uncore_l2);
433}
434
435static void __cpuinit uncore_dead(unsigned int cpu,
436 struct amd_uncore * __percpu *uncores)
437{
438 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu);
439
440 if (cpu == uncore->cpu)
441 cpumask_clear_cpu(cpu, uncore->active_mask);
442
443 if (!--uncore->refcnt)
444 kfree(uncore);
445 *per_cpu_ptr(amd_uncore_nb, cpu) = NULL;
446}
447
448static void __cpuinit amd_uncore_cpu_dead(unsigned int cpu)
449{
450 if (amd_uncore_nb)
451 uncore_dead(cpu, amd_uncore_nb);
452
453 if (amd_uncore_l2)
454 uncore_dead(cpu, amd_uncore_l2);
455}
456
457static int __cpuinit
458amd_uncore_cpu_notifier(struct notifier_block *self, unsigned long action,
459 void *hcpu)
460{
461 unsigned int cpu = (long)hcpu;
462
463 switch (action & ~CPU_TASKS_FROZEN) {
464 case CPU_UP_PREPARE:
465 amd_uncore_cpu_up_prepare(cpu);
466 break;
467
468 case CPU_STARTING:
469 amd_uncore_cpu_starting(cpu);
470 break;
471
472 case CPU_ONLINE:
473 amd_uncore_cpu_online(cpu);
474 break;
475
476 case CPU_DOWN_PREPARE:
477 amd_uncore_cpu_down_prepare(cpu);
478 break;
479
480 case CPU_UP_CANCELED:
481 case CPU_DEAD:
482 amd_uncore_cpu_dead(cpu);
483 break;
484
485 default:
486 break;
487 }
488
489 return NOTIFY_OK;
490}
491
492static struct notifier_block amd_uncore_cpu_notifier_block __cpuinitdata = {
493 .notifier_call = amd_uncore_cpu_notifier,
494 .priority = CPU_PRI_PERF + 1,
495};
496
497static void __init init_cpu_already_online(void *dummy)
498{
499 unsigned int cpu = smp_processor_id();
500
501 amd_uncore_cpu_starting(cpu);
502 amd_uncore_cpu_online(cpu);
503}
504
505static int __init amd_uncore_init(void)
506{
507 unsigned int cpu;
508 int ret = -ENODEV;
509
510 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
511 return -ENODEV;
512
513 if (!cpu_has_topoext)
514 return -ENODEV;
515
516 if (cpu_has_perfctr_nb) {
517 amd_uncore_nb = alloc_percpu(struct amd_uncore *);
518 perf_pmu_register(&amd_nb_pmu, amd_nb_pmu.name, -1);
519
520 printk(KERN_INFO "perf: AMD NB counters detected\n");
521 ret = 0;
522 }
523
524 if (cpu_has_perfctr_l2) {
525 amd_uncore_l2 = alloc_percpu(struct amd_uncore *);
526 perf_pmu_register(&amd_l2_pmu, amd_l2_pmu.name, -1);
527
528 printk(KERN_INFO "perf: AMD L2I counters detected\n");
529 ret = 0;
530 }
531
532 if (ret)
533 return -ENODEV;
534
535 get_online_cpus();
536 /* init cpus already online before registering for hotplug notifier */
537 for_each_online_cpu(cpu) {
538 amd_uncore_cpu_up_prepare(cpu);
539 smp_call_function_single(cpu, init_cpu_already_online, NULL, 1);
540 }
541
542 register_cpu_notifier(&amd_uncore_cpu_notifier_block);
543 put_online_cpus();
544
545 return 0;
546}
547device_initcall(amd_uncore_init);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index cc45deb791b0..f60d41ff9a97 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -81,6 +81,7 @@ static struct event_constraint intel_nehalem_event_constraints[] __read_mostly =
81static struct extra_reg intel_nehalem_extra_regs[] __read_mostly = 81static struct extra_reg intel_nehalem_extra_regs[] __read_mostly =
82{ 82{
83 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff, RSP_0), 83 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff, RSP_0),
84 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x100b),
84 EVENT_EXTRA_END 85 EVENT_EXTRA_END
85}; 86};
86 87
@@ -108,6 +109,8 @@ static struct event_constraint intel_snb_event_constraints[] __read_mostly =
108 INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ 109 INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */
109 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ 110 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */
110 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ 111 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */
112 INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */
113 INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */
111 EVENT_CONSTRAINT_END 114 EVENT_CONSTRAINT_END
112}; 115};
113 116
@@ -125,10 +128,15 @@ static struct event_constraint intel_ivb_event_constraints[] __read_mostly =
125 INTEL_UEVENT_CONSTRAINT(0x08a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ 128 INTEL_UEVENT_CONSTRAINT(0x08a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */
126 INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ 129 INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */
127 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ 130 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */
128 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */ 131 /*
129 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ 132 * Errata BV98 -- MEM_*_RETIRED events can leak between counters of SMT
130 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ 133 * siblings; disable these events because they can corrupt unrelated
131 INTEL_EVENT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ 134 * counters.
135 */
136 INTEL_EVENT_CONSTRAINT(0xd0, 0x0), /* MEM_UOPS_RETIRED.* */
137 INTEL_EVENT_CONSTRAINT(0xd1, 0x0), /* MEM_LOAD_UOPS_RETIRED.* */
138 INTEL_EVENT_CONSTRAINT(0xd2, 0x0), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */
139 INTEL_EVENT_CONSTRAINT(0xd3, 0x0), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */
132 EVENT_CONSTRAINT_END 140 EVENT_CONSTRAINT_END
133}; 141};
134 142
@@ -136,6 +144,7 @@ static struct extra_reg intel_westmere_extra_regs[] __read_mostly =
136{ 144{
137 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff, RSP_0), 145 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff, RSP_0),
138 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0xffff, RSP_1), 146 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0xffff, RSP_1),
147 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x100b),
139 EVENT_EXTRA_END 148 EVENT_EXTRA_END
140}; 149};
141 150
@@ -155,6 +164,8 @@ static struct event_constraint intel_gen_event_constraints[] __read_mostly =
155static struct extra_reg intel_snb_extra_regs[] __read_mostly = { 164static struct extra_reg intel_snb_extra_regs[] __read_mostly = {
156 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0), 165 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0),
157 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1), 166 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1),
167 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
168 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
158 EVENT_EXTRA_END 169 EVENT_EXTRA_END
159}; 170};
160 171
@@ -164,6 +175,21 @@ static struct extra_reg intel_snbep_extra_regs[] __read_mostly = {
164 EVENT_EXTRA_END 175 EVENT_EXTRA_END
165}; 176};
166 177
178EVENT_ATTR_STR(mem-loads, mem_ld_nhm, "event=0x0b,umask=0x10,ldlat=3");
179EVENT_ATTR_STR(mem-loads, mem_ld_snb, "event=0xcd,umask=0x1,ldlat=3");
180EVENT_ATTR_STR(mem-stores, mem_st_snb, "event=0xcd,umask=0x2");
181
182struct attribute *nhm_events_attrs[] = {
183 EVENT_PTR(mem_ld_nhm),
184 NULL,
185};
186
187struct attribute *snb_events_attrs[] = {
188 EVENT_PTR(mem_ld_snb),
189 EVENT_PTR(mem_st_snb),
190 NULL,
191};
192
167static u64 intel_pmu_event_map(int hw_event) 193static u64 intel_pmu_event_map(int hw_event)
168{ 194{
169 return intel_perfmon_event_map[hw_event]; 195 return intel_perfmon_event_map[hw_event];
@@ -1398,8 +1424,11 @@ x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1398 1424
1399 if (x86_pmu.event_constraints) { 1425 if (x86_pmu.event_constraints) {
1400 for_each_event_constraint(c, x86_pmu.event_constraints) { 1426 for_each_event_constraint(c, x86_pmu.event_constraints) {
1401 if ((event->hw.config & c->cmask) == c->code) 1427 if ((event->hw.config & c->cmask) == c->code) {
1428 /* hw.flags zeroed at initialization */
1429 event->hw.flags |= c->flags;
1402 return c; 1430 return c;
1431 }
1403 } 1432 }
1404 } 1433 }
1405 1434
@@ -1444,6 +1473,7 @@ intel_put_shared_regs_event_constraints(struct cpu_hw_events *cpuc,
1444static void intel_put_event_constraints(struct cpu_hw_events *cpuc, 1473static void intel_put_event_constraints(struct cpu_hw_events *cpuc,
1445 struct perf_event *event) 1474 struct perf_event *event)
1446{ 1475{
1476 event->hw.flags = 0;
1447 intel_put_shared_regs_event_constraints(cpuc, event); 1477 intel_put_shared_regs_event_constraints(cpuc, event);
1448} 1478}
1449 1479
@@ -1767,6 +1797,8 @@ static void intel_pmu_flush_branch_stack(void)
1767 1797
1768PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); 1798PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63");
1769 1799
1800PMU_FORMAT_ATTR(ldlat, "config1:0-15");
1801
1770static struct attribute *intel_arch3_formats_attr[] = { 1802static struct attribute *intel_arch3_formats_attr[] = {
1771 &format_attr_event.attr, 1803 &format_attr_event.attr,
1772 &format_attr_umask.attr, 1804 &format_attr_umask.attr,
@@ -1777,6 +1809,7 @@ static struct attribute *intel_arch3_formats_attr[] = {
1777 &format_attr_cmask.attr, 1809 &format_attr_cmask.attr,
1778 1810
1779 &format_attr_offcore_rsp.attr, /* XXX do NHM/WSM + SNB breakout */ 1811 &format_attr_offcore_rsp.attr, /* XXX do NHM/WSM + SNB breakout */
1812 &format_attr_ldlat.attr, /* PEBS load latency */
1780 NULL, 1813 NULL,
1781}; 1814};
1782 1815
@@ -2037,6 +2070,8 @@ __init int intel_pmu_init(void)
2037 x86_pmu.enable_all = intel_pmu_nhm_enable_all; 2070 x86_pmu.enable_all = intel_pmu_nhm_enable_all;
2038 x86_pmu.extra_regs = intel_nehalem_extra_regs; 2071 x86_pmu.extra_regs = intel_nehalem_extra_regs;
2039 2072
2073 x86_pmu.cpu_events = nhm_events_attrs;
2074
2040 /* UOPS_ISSUED.STALLED_CYCLES */ 2075 /* UOPS_ISSUED.STALLED_CYCLES */
2041 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 2076 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] =
2042 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1); 2077 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
@@ -2080,6 +2115,8 @@ __init int intel_pmu_init(void)
2080 x86_pmu.extra_regs = intel_westmere_extra_regs; 2115 x86_pmu.extra_regs = intel_westmere_extra_regs;
2081 x86_pmu.er_flags |= ERF_HAS_RSP_1; 2116 x86_pmu.er_flags |= ERF_HAS_RSP_1;
2082 2117
2118 x86_pmu.cpu_events = nhm_events_attrs;
2119
2083 /* UOPS_ISSUED.STALLED_CYCLES */ 2120 /* UOPS_ISSUED.STALLED_CYCLES */
2084 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 2121 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] =
2085 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1); 2122 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
@@ -2111,6 +2148,8 @@ __init int intel_pmu_init(void)
2111 x86_pmu.er_flags |= ERF_HAS_RSP_1; 2148 x86_pmu.er_flags |= ERF_HAS_RSP_1;
2112 x86_pmu.er_flags |= ERF_NO_HT_SHARING; 2149 x86_pmu.er_flags |= ERF_NO_HT_SHARING;
2113 2150
2151 x86_pmu.cpu_events = snb_events_attrs;
2152
2114 /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */ 2153 /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */
2115 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 2154 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] =
2116 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1); 2155 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
@@ -2140,6 +2179,8 @@ __init int intel_pmu_init(void)
2140 x86_pmu.er_flags |= ERF_HAS_RSP_1; 2179 x86_pmu.er_flags |= ERF_HAS_RSP_1;
2141 x86_pmu.er_flags |= ERF_NO_HT_SHARING; 2180 x86_pmu.er_flags |= ERF_NO_HT_SHARING;
2142 2181
2182 x86_pmu.cpu_events = snb_events_attrs;
2183
2143 /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */ 2184 /* UOPS_ISSUED.ANY,c=1,i=1 to count stall cycles */
2144 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 2185 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] =
2145 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1); 2186 X86_CONFIG(.event=0x0e, .umask=0x01, .inv=1, .cmask=1);
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 26830f3af0df..60250f687052 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -24,6 +24,130 @@ struct pebs_record_32 {
24 24
25 */ 25 */
26 26
27union intel_x86_pebs_dse {
28 u64 val;
29 struct {
30 unsigned int ld_dse:4;
31 unsigned int ld_stlb_miss:1;
32 unsigned int ld_locked:1;
33 unsigned int ld_reserved:26;
34 };
35 struct {
36 unsigned int st_l1d_hit:1;
37 unsigned int st_reserved1:3;
38 unsigned int st_stlb_miss:1;
39 unsigned int st_locked:1;
40 unsigned int st_reserved2:26;
41 };
42};
43
44
45/*
46 * Map PEBS Load Latency Data Source encodings to generic
47 * memory data source information
48 */
49#define P(a, b) PERF_MEM_S(a, b)
50#define OP_LH (P(OP, LOAD) | P(LVL, HIT))
51#define SNOOP_NONE_MISS (P(SNOOP, NONE) | P(SNOOP, MISS))
52
53static const u64 pebs_data_source[] = {
54 P(OP, LOAD) | P(LVL, MISS) | P(LVL, L3) | P(SNOOP, NA),/* 0x00:ukn L3 */
55 OP_LH | P(LVL, L1) | P(SNOOP, NONE), /* 0x01: L1 local */
56 OP_LH | P(LVL, LFB) | P(SNOOP, NONE), /* 0x02: LFB hit */
57 OP_LH | P(LVL, L2) | P(SNOOP, NONE), /* 0x03: L2 hit */
58 OP_LH | P(LVL, L3) | P(SNOOP, NONE), /* 0x04: L3 hit */
59 OP_LH | P(LVL, L3) | P(SNOOP, MISS), /* 0x05: L3 hit, snoop miss */
60 OP_LH | P(LVL, L3) | P(SNOOP, HIT), /* 0x06: L3 hit, snoop hit */
61 OP_LH | P(LVL, L3) | P(SNOOP, HITM), /* 0x07: L3 hit, snoop hitm */
62 OP_LH | P(LVL, REM_CCE1) | P(SNOOP, HIT), /* 0x08: L3 miss snoop hit */
63 OP_LH | P(LVL, REM_CCE1) | P(SNOOP, HITM), /* 0x09: L3 miss snoop hitm*/
64 OP_LH | P(LVL, LOC_RAM) | P(SNOOP, HIT), /* 0x0a: L3 miss, shared */
65 OP_LH | P(LVL, REM_RAM1) | P(SNOOP, HIT), /* 0x0b: L3 miss, shared */
66 OP_LH | P(LVL, LOC_RAM) | SNOOP_NONE_MISS,/* 0x0c: L3 miss, excl */
67 OP_LH | P(LVL, REM_RAM1) | SNOOP_NONE_MISS,/* 0x0d: L3 miss, excl */
68 OP_LH | P(LVL, IO) | P(SNOOP, NONE), /* 0x0e: I/O */
69 OP_LH | P(LVL, UNC) | P(SNOOP, NONE), /* 0x0f: uncached */
70};
71
72static u64 precise_store_data(u64 status)
73{
74 union intel_x86_pebs_dse dse;
75 u64 val = P(OP, STORE) | P(SNOOP, NA) | P(LVL, L1) | P(TLB, L2);
76
77 dse.val = status;
78
79 /*
80 * bit 4: TLB access
81 * 1 = stored missed 2nd level TLB
82 *
83 * so it either hit the walker or the OS
84 * otherwise hit 2nd level TLB
85 */
86 if (dse.st_stlb_miss)
87 val |= P(TLB, MISS);
88 else
89 val |= P(TLB, HIT);
90
91 /*
92 * bit 0: hit L1 data cache
93 * if not set, then all we know is that
94 * it missed L1D
95 */
96 if (dse.st_l1d_hit)
97 val |= P(LVL, HIT);
98 else
99 val |= P(LVL, MISS);
100
101 /*
102 * bit 5: Locked prefix
103 */
104 if (dse.st_locked)
105 val |= P(LOCK, LOCKED);
106
107 return val;
108}
109
110static u64 load_latency_data(u64 status)
111{
112 union intel_x86_pebs_dse dse;
113 u64 val;
114 int model = boot_cpu_data.x86_model;
115 int fam = boot_cpu_data.x86;
116
117 dse.val = status;
118
119 /*
120 * use the mapping table for bit 0-3
121 */
122 val = pebs_data_source[dse.ld_dse];
123
124 /*
125 * Nehalem models do not support TLB, Lock infos
126 */
127 if (fam == 0x6 && (model == 26 || model == 30
128 || model == 31 || model == 46)) {
129 val |= P(TLB, NA) | P(LOCK, NA);
130 return val;
131 }
132 /*
133 * bit 4: TLB access
134 * 0 = did not miss 2nd level TLB
135 * 1 = missed 2nd level TLB
136 */
137 if (dse.ld_stlb_miss)
138 val |= P(TLB, MISS) | P(TLB, L2);
139 else
140 val |= P(TLB, HIT) | P(TLB, L1) | P(TLB, L2);
141
142 /*
143 * bit 5: locked prefix
144 */
145 if (dse.ld_locked)
146 val |= P(LOCK, LOCKED);
147
148 return val;
149}
150
27struct pebs_record_core { 151struct pebs_record_core {
28 u64 flags, ip; 152 u64 flags, ip;
29 u64 ax, bx, cx, dx; 153 u64 ax, bx, cx, dx;
@@ -365,7 +489,7 @@ struct event_constraint intel_atom_pebs_event_constraints[] = {
365}; 489};
366 490
367struct event_constraint intel_nehalem_pebs_event_constraints[] = { 491struct event_constraint intel_nehalem_pebs_event_constraints[] = {
368 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */ 492 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */
369 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 493 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
370 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 494 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
371 INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INST_RETIRED.ANY */ 495 INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INST_RETIRED.ANY */
@@ -380,7 +504,7 @@ struct event_constraint intel_nehalem_pebs_event_constraints[] = {
380}; 504};
381 505
382struct event_constraint intel_westmere_pebs_event_constraints[] = { 506struct event_constraint intel_westmere_pebs_event_constraints[] = {
383 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */ 507 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */
384 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 508 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
385 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 509 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
386 INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INSTR_RETIRED.* */ 510 INTEL_EVENT_CONSTRAINT(0xc0, 0xf), /* INSTR_RETIRED.* */
@@ -400,7 +524,8 @@ struct event_constraint intel_snb_pebs_event_constraints[] = {
400 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ 524 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */
401 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ 525 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */
402 INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ 526 INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */
403 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ 527 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */
528 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */
404 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ 529 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */
405 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ 530 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */
406 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ 531 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */
@@ -414,7 +539,8 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = {
414 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ 539 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */
415 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ 540 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */
416 INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ 541 INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */
417 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ 542 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.LAT_ABOVE_THR */
543 INTEL_PST_CONSTRAINT(0x02cd, 0x8), /* MEM_TRANS_RETIRED.PRECISE_STORES */
418 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ 544 INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */
419 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ 545 INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */
420 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ 546 INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */
@@ -431,8 +557,10 @@ struct event_constraint *intel_pebs_constraints(struct perf_event *event)
431 557
432 if (x86_pmu.pebs_constraints) { 558 if (x86_pmu.pebs_constraints) {
433 for_each_event_constraint(c, x86_pmu.pebs_constraints) { 559 for_each_event_constraint(c, x86_pmu.pebs_constraints) {
434 if ((event->hw.config & c->cmask) == c->code) 560 if ((event->hw.config & c->cmask) == c->code) {
561 event->hw.flags |= c->flags;
435 return c; 562 return c;
563 }
436 } 564 }
437 } 565 }
438 566
@@ -447,6 +575,11 @@ void intel_pmu_pebs_enable(struct perf_event *event)
447 hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT; 575 hwc->config &= ~ARCH_PERFMON_EVENTSEL_INT;
448 576
449 cpuc->pebs_enabled |= 1ULL << hwc->idx; 577 cpuc->pebs_enabled |= 1ULL << hwc->idx;
578
579 if (event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT)
580 cpuc->pebs_enabled |= 1ULL << (hwc->idx + 32);
581 else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST)
582 cpuc->pebs_enabled |= 1ULL << 63;
450} 583}
451 584
452void intel_pmu_pebs_disable(struct perf_event *event) 585void intel_pmu_pebs_disable(struct perf_event *event)
@@ -559,20 +692,51 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
559 struct pt_regs *iregs, void *__pebs) 692 struct pt_regs *iregs, void *__pebs)
560{ 693{
561 /* 694 /*
562 * We cast to pebs_record_core since that is a subset of 695 * We cast to pebs_record_nhm to get the load latency data
563 * both formats and we don't use the other fields in this 696 * if extra_reg MSR_PEBS_LD_LAT_THRESHOLD used
564 * routine.
565 */ 697 */
566 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 698 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
567 struct pebs_record_core *pebs = __pebs; 699 struct pebs_record_nhm *pebs = __pebs;
568 struct perf_sample_data data; 700 struct perf_sample_data data;
569 struct pt_regs regs; 701 struct pt_regs regs;
702 u64 sample_type;
703 int fll, fst;
570 704
571 if (!intel_pmu_save_and_restart(event)) 705 if (!intel_pmu_save_and_restart(event))
572 return; 706 return;
573 707
708 fll = event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT;
709 fst = event->hw.flags & PERF_X86_EVENT_PEBS_ST;
710
574 perf_sample_data_init(&data, 0, event->hw.last_period); 711 perf_sample_data_init(&data, 0, event->hw.last_period);
575 712
713 data.period = event->hw.last_period;
714 sample_type = event->attr.sample_type;
715
716 /*
717 * if PEBS-LL or PreciseStore
718 */
719 if (fll || fst) {
720 if (sample_type & PERF_SAMPLE_ADDR)
721 data.addr = pebs->dla;
722
723 /*
724 * Use latency for weight (only avail with PEBS-LL)
725 */
726 if (fll && (sample_type & PERF_SAMPLE_WEIGHT))
727 data.weight = pebs->lat;
728
729 /*
730 * data.data_src encodes the data source
731 */
732 if (sample_type & PERF_SAMPLE_DATA_SRC) {
733 if (fll)
734 data.data_src.val = load_latency_data(pebs->dse);
735 else
736 data.data_src.val = precise_store_data(pebs->dse);
737 }
738 }
739
576 /* 740 /*
577 * We use the interrupt regs as a base because the PEBS record 741 * We use the interrupt regs as a base because the PEBS record
578 * does not contain a full regs set, specifically it seems to 742 * does not contain a full regs set, specifically it seems to
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index da02e9cc3754..d978353c939b 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -310,7 +310,7 @@ void intel_pmu_lbr_read(void)
310 * - in case there is no HW filter 310 * - in case there is no HW filter
311 * - in case the HW filter has errata or limitations 311 * - in case the HW filter has errata or limitations
312 */ 312 */
313static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event) 313static int intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
314{ 314{
315 u64 br_type = event->attr.branch_sample_type; 315 u64 br_type = event->attr.branch_sample_type;
316 int mask = 0; 316 int mask = 0;
@@ -318,8 +318,11 @@ static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
318 if (br_type & PERF_SAMPLE_BRANCH_USER) 318 if (br_type & PERF_SAMPLE_BRANCH_USER)
319 mask |= X86_BR_USER; 319 mask |= X86_BR_USER;
320 320
321 if (br_type & PERF_SAMPLE_BRANCH_KERNEL) 321 if (br_type & PERF_SAMPLE_BRANCH_KERNEL) {
322 if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))
323 return -EACCES;
322 mask |= X86_BR_KERNEL; 324 mask |= X86_BR_KERNEL;
325 }
323 326
324 /* we ignore BRANCH_HV here */ 327 /* we ignore BRANCH_HV here */
325 328
@@ -339,6 +342,8 @@ static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
339 * be used by fixup code for some CPU 342 * be used by fixup code for some CPU
340 */ 343 */
341 event->hw.branch_reg.reg = mask; 344 event->hw.branch_reg.reg = mask;
345
346 return 0;
342} 347}
343 348
344/* 349/*
@@ -386,7 +391,9 @@ int intel_pmu_setup_lbr_filter(struct perf_event *event)
386 /* 391 /*
387 * setup SW LBR filter 392 * setup SW LBR filter
388 */ 393 */
389 intel_pmu_setup_sw_lbr_filter(event); 394 ret = intel_pmu_setup_sw_lbr_filter(event);
395 if (ret)
396 return ret;
390 397
391 /* 398 /*
392 * setup HW LBR filter, if any 399 * setup HW LBR filter, if any
@@ -442,8 +449,18 @@ static int branch_type(unsigned long from, unsigned long to)
442 return X86_BR_NONE; 449 return X86_BR_NONE;
443 450
444 addr = buf; 451 addr = buf;
445 } else 452 } else {
446 addr = (void *)from; 453 /*
454 * The LBR logs any address in the IP, even if the IP just
455 * faulted. This means userspace can control the from address.
456 * Ensure we don't blindy read any address by validating it is
457 * a known text address.
458 */
459 if (kernel_text_address(from))
460 addr = (void *)from;
461 else
462 return X86_BR_NONE;
463 }
447 464
448 /* 465 /*
449 * decoder needs to know the ABI especially 466 * decoder needs to know the ABI especially
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index b43200dbfe7e..52441a2af538 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -17,6 +17,9 @@ static struct event_constraint constraint_fixed =
17static struct event_constraint constraint_empty = 17static struct event_constraint constraint_empty =
18 EVENT_CONSTRAINT(0, 0, 0); 18 EVENT_CONSTRAINT(0, 0, 0);
19 19
20#define __BITS_VALUE(x, i, n) ((typeof(x))(((x) >> ((i) * (n))) & \
21 ((1ULL << (n)) - 1)))
22
20DEFINE_UNCORE_FORMAT_ATTR(event, event, "config:0-7"); 23DEFINE_UNCORE_FORMAT_ATTR(event, event, "config:0-7");
21DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21"); 24DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21");
22DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15"); 25DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15");
@@ -31,9 +34,13 @@ DEFINE_UNCORE_FORMAT_ATTR(occ_sel, occ_sel, "config:14-15");
31DEFINE_UNCORE_FORMAT_ATTR(occ_invert, occ_invert, "config:30"); 34DEFINE_UNCORE_FORMAT_ATTR(occ_invert, occ_invert, "config:30");
32DEFINE_UNCORE_FORMAT_ATTR(occ_edge, occ_edge, "config:14-51"); 35DEFINE_UNCORE_FORMAT_ATTR(occ_edge, occ_edge, "config:14-51");
33DEFINE_UNCORE_FORMAT_ATTR(filter_tid, filter_tid, "config1:0-4"); 36DEFINE_UNCORE_FORMAT_ATTR(filter_tid, filter_tid, "config1:0-4");
37DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8");
34DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17"); 38DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17");
39DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47");
35DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22"); 40DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22");
41DEFINE_UNCORE_FORMAT_ATTR(filter_state2, filter_state, "config1:17-22");
36DEFINE_UNCORE_FORMAT_ATTR(filter_opc, filter_opc, "config1:23-31"); 42DEFINE_UNCORE_FORMAT_ATTR(filter_opc, filter_opc, "config1:23-31");
43DEFINE_UNCORE_FORMAT_ATTR(filter_opc2, filter_opc, "config1:52-60");
37DEFINE_UNCORE_FORMAT_ATTR(filter_band0, filter_band0, "config1:0-7"); 44DEFINE_UNCORE_FORMAT_ATTR(filter_band0, filter_band0, "config1:0-7");
38DEFINE_UNCORE_FORMAT_ATTR(filter_band1, filter_band1, "config1:8-15"); 45DEFINE_UNCORE_FORMAT_ATTR(filter_band1, filter_band1, "config1:8-15");
39DEFINE_UNCORE_FORMAT_ATTR(filter_band2, filter_band2, "config1:16-23"); 46DEFINE_UNCORE_FORMAT_ATTR(filter_band2, filter_band2, "config1:16-23");
@@ -110,6 +117,21 @@ static void uncore_put_constraint(struct intel_uncore_box *box, struct perf_even
110 reg1->alloc = 0; 117 reg1->alloc = 0;
111} 118}
112 119
120static u64 uncore_shared_reg_config(struct intel_uncore_box *box, int idx)
121{
122 struct intel_uncore_extra_reg *er;
123 unsigned long flags;
124 u64 config;
125
126 er = &box->shared_regs[idx];
127
128 raw_spin_lock_irqsave(&er->lock, flags);
129 config = er->config;
130 raw_spin_unlock_irqrestore(&er->lock, flags);
131
132 return config;
133}
134
113/* Sandy Bridge-EP uncore support */ 135/* Sandy Bridge-EP uncore support */
114static struct intel_uncore_type snbep_uncore_cbox; 136static struct intel_uncore_type snbep_uncore_cbox;
115static struct intel_uncore_type snbep_uncore_pcu; 137static struct intel_uncore_type snbep_uncore_pcu;
@@ -205,7 +227,7 @@ static void snbep_uncore_msr_enable_event(struct intel_uncore_box *box, struct p
205 struct hw_perf_event_extra *reg1 = &hwc->extra_reg; 227 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
206 228
207 if (reg1->idx != EXTRA_REG_NONE) 229 if (reg1->idx != EXTRA_REG_NONE)
208 wrmsrl(reg1->reg, reg1->config); 230 wrmsrl(reg1->reg, uncore_shared_reg_config(box, 0));
209 231
210 wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN); 232 wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
211} 233}
@@ -226,29 +248,6 @@ static void snbep_uncore_msr_init_box(struct intel_uncore_box *box)
226 wrmsrl(msr, SNBEP_PMON_BOX_CTL_INT); 248 wrmsrl(msr, SNBEP_PMON_BOX_CTL_INT);
227} 249}
228 250
229static int snbep_uncore_hw_config(struct intel_uncore_box *box, struct perf_event *event)
230{
231 struct hw_perf_event *hwc = &event->hw;
232 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
233
234 if (box->pmu->type == &snbep_uncore_cbox) {
235 reg1->reg = SNBEP_C0_MSR_PMON_BOX_FILTER +
236 SNBEP_CBO_MSR_OFFSET * box->pmu->pmu_idx;
237 reg1->config = event->attr.config1 &
238 SNBEP_CB0_MSR_PMON_BOX_FILTER_MASK;
239 } else {
240 if (box->pmu->type == &snbep_uncore_pcu) {
241 reg1->reg = SNBEP_PCU_MSR_PMON_BOX_FILTER;
242 reg1->config = event->attr.config1 & SNBEP_PCU_MSR_PMON_BOX_FILTER_MASK;
243 } else {
244 return 0;
245 }
246 }
247 reg1->idx = 0;
248
249 return 0;
250}
251
252static struct attribute *snbep_uncore_formats_attr[] = { 251static struct attribute *snbep_uncore_formats_attr[] = {
253 &format_attr_event.attr, 252 &format_attr_event.attr,
254 &format_attr_umask.attr, 253 &format_attr_umask.attr,
@@ -345,16 +344,16 @@ static struct attribute_group snbep_uncore_qpi_format_group = {
345 .attrs = snbep_uncore_qpi_formats_attr, 344 .attrs = snbep_uncore_qpi_formats_attr,
346}; 345};
347 346
347#define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \
348 .init_box = snbep_uncore_msr_init_box, \
349 .disable_box = snbep_uncore_msr_disable_box, \
350 .enable_box = snbep_uncore_msr_enable_box, \
351 .disable_event = snbep_uncore_msr_disable_event, \
352 .enable_event = snbep_uncore_msr_enable_event, \
353 .read_counter = uncore_msr_read_counter
354
348static struct intel_uncore_ops snbep_uncore_msr_ops = { 355static struct intel_uncore_ops snbep_uncore_msr_ops = {
349 .init_box = snbep_uncore_msr_init_box, 356 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
350 .disable_box = snbep_uncore_msr_disable_box,
351 .enable_box = snbep_uncore_msr_enable_box,
352 .disable_event = snbep_uncore_msr_disable_event,
353 .enable_event = snbep_uncore_msr_enable_event,
354 .read_counter = uncore_msr_read_counter,
355 .get_constraint = uncore_get_constraint,
356 .put_constraint = uncore_put_constraint,
357 .hw_config = snbep_uncore_hw_config,
358}; 357};
359 358
360static struct intel_uncore_ops snbep_uncore_pci_ops = { 359static struct intel_uncore_ops snbep_uncore_pci_ops = {
@@ -372,6 +371,7 @@ static struct event_constraint snbep_uncore_cbox_constraints[] = {
372 UNCORE_EVENT_CONSTRAINT(0x04, 0x3), 371 UNCORE_EVENT_CONSTRAINT(0x04, 0x3),
373 UNCORE_EVENT_CONSTRAINT(0x05, 0x3), 372 UNCORE_EVENT_CONSTRAINT(0x05, 0x3),
374 UNCORE_EVENT_CONSTRAINT(0x07, 0x3), 373 UNCORE_EVENT_CONSTRAINT(0x07, 0x3),
374 UNCORE_EVENT_CONSTRAINT(0x09, 0x3),
375 UNCORE_EVENT_CONSTRAINT(0x11, 0x1), 375 UNCORE_EVENT_CONSTRAINT(0x11, 0x1),
376 UNCORE_EVENT_CONSTRAINT(0x12, 0x3), 376 UNCORE_EVENT_CONSTRAINT(0x12, 0x3),
377 UNCORE_EVENT_CONSTRAINT(0x13, 0x3), 377 UNCORE_EVENT_CONSTRAINT(0x13, 0x3),
@@ -421,6 +421,14 @@ static struct event_constraint snbep_uncore_r3qpi_constraints[] = {
421 UNCORE_EVENT_CONSTRAINT(0x24, 0x3), 421 UNCORE_EVENT_CONSTRAINT(0x24, 0x3),
422 UNCORE_EVENT_CONSTRAINT(0x25, 0x3), 422 UNCORE_EVENT_CONSTRAINT(0x25, 0x3),
423 UNCORE_EVENT_CONSTRAINT(0x26, 0x3), 423 UNCORE_EVENT_CONSTRAINT(0x26, 0x3),
424 UNCORE_EVENT_CONSTRAINT(0x28, 0x3),
425 UNCORE_EVENT_CONSTRAINT(0x29, 0x3),
426 UNCORE_EVENT_CONSTRAINT(0x2a, 0x3),
427 UNCORE_EVENT_CONSTRAINT(0x2b, 0x3),
428 UNCORE_EVENT_CONSTRAINT(0x2c, 0x3),
429 UNCORE_EVENT_CONSTRAINT(0x2d, 0x3),
430 UNCORE_EVENT_CONSTRAINT(0x2e, 0x3),
431 UNCORE_EVENT_CONSTRAINT(0x2f, 0x3),
424 UNCORE_EVENT_CONSTRAINT(0x30, 0x3), 432 UNCORE_EVENT_CONSTRAINT(0x30, 0x3),
425 UNCORE_EVENT_CONSTRAINT(0x31, 0x3), 433 UNCORE_EVENT_CONSTRAINT(0x31, 0x3),
426 UNCORE_EVENT_CONSTRAINT(0x32, 0x3), 434 UNCORE_EVENT_CONSTRAINT(0x32, 0x3),
@@ -428,6 +436,8 @@ static struct event_constraint snbep_uncore_r3qpi_constraints[] = {
428 UNCORE_EVENT_CONSTRAINT(0x34, 0x3), 436 UNCORE_EVENT_CONSTRAINT(0x34, 0x3),
429 UNCORE_EVENT_CONSTRAINT(0x36, 0x3), 437 UNCORE_EVENT_CONSTRAINT(0x36, 0x3),
430 UNCORE_EVENT_CONSTRAINT(0x37, 0x3), 438 UNCORE_EVENT_CONSTRAINT(0x37, 0x3),
439 UNCORE_EVENT_CONSTRAINT(0x38, 0x3),
440 UNCORE_EVENT_CONSTRAINT(0x39, 0x3),
431 EVENT_CONSTRAINT_END 441 EVENT_CONSTRAINT_END
432}; 442};
433 443
@@ -446,6 +456,145 @@ static struct intel_uncore_type snbep_uncore_ubox = {
446 .format_group = &snbep_uncore_ubox_format_group, 456 .format_group = &snbep_uncore_ubox_format_group,
447}; 457};
448 458
459static struct extra_reg snbep_uncore_cbox_extra_regs[] = {
460 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
461 SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
462 SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
463 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
464 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
465 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0x6),
466 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x8),
467 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x8),
468 SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0xc),
469 SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0xc),
470 SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x2),
471 SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x2),
472 SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x2),
473 SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x2),
474 SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x8),
475 SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x8),
476 SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0xc),
477 SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0xc),
478 SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x2),
479 SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x2),
480 SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x2),
481 SNBEP_CBO_EVENT_EXTRA_REG(0x4037, 0x40ff, 0x2),
482 EVENT_EXTRA_END
483};
484
485static void snbep_cbox_put_constraint(struct intel_uncore_box *box, struct perf_event *event)
486{
487 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
488 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
489 int i;
490
491 if (uncore_box_is_fake(box))
492 return;
493
494 for (i = 0; i < 5; i++) {
495 if (reg1->alloc & (0x1 << i))
496 atomic_sub(1 << (i * 6), &er->ref);
497 }
498 reg1->alloc = 0;
499}
500
501static struct event_constraint *
502__snbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event,
503 u64 (*cbox_filter_mask)(int fields))
504{
505 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
506 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
507 int i, alloc = 0;
508 unsigned long flags;
509 u64 mask;
510
511 if (reg1->idx == EXTRA_REG_NONE)
512 return NULL;
513
514 raw_spin_lock_irqsave(&er->lock, flags);
515 for (i = 0; i < 5; i++) {
516 if (!(reg1->idx & (0x1 << i)))
517 continue;
518 if (!uncore_box_is_fake(box) && (reg1->alloc & (0x1 << i)))
519 continue;
520
521 mask = cbox_filter_mask(0x1 << i);
522 if (!__BITS_VALUE(atomic_read(&er->ref), i, 6) ||
523 !((reg1->config ^ er->config) & mask)) {
524 atomic_add(1 << (i * 6), &er->ref);
525 er->config &= ~mask;
526 er->config |= reg1->config & mask;
527 alloc |= (0x1 << i);
528 } else {
529 break;
530 }
531 }
532 raw_spin_unlock_irqrestore(&er->lock, flags);
533 if (i < 5)
534 goto fail;
535
536 if (!uncore_box_is_fake(box))
537 reg1->alloc |= alloc;
538
539 return 0;
540fail:
541 for (; i >= 0; i--) {
542 if (alloc & (0x1 << i))
543 atomic_sub(1 << (i * 6), &er->ref);
544 }
545 return &constraint_empty;
546}
547
548static u64 snbep_cbox_filter_mask(int fields)
549{
550 u64 mask = 0;
551
552 if (fields & 0x1)
553 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_TID;
554 if (fields & 0x2)
555 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_NID;
556 if (fields & 0x4)
557 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_STATE;
558 if (fields & 0x8)
559 mask |= SNBEP_CB0_MSR_PMON_BOX_FILTER_OPC;
560
561 return mask;
562}
563
564static struct event_constraint *
565snbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
566{
567 return __snbep_cbox_get_constraint(box, event, snbep_cbox_filter_mask);
568}
569
570static int snbep_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
571{
572 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
573 struct extra_reg *er;
574 int idx = 0;
575
576 for (er = snbep_uncore_cbox_extra_regs; er->msr; er++) {
577 if (er->event != (event->hw.config & er->config_mask))
578 continue;
579 idx |= er->idx;
580 }
581
582 if (idx) {
583 reg1->reg = SNBEP_C0_MSR_PMON_BOX_FILTER +
584 SNBEP_CBO_MSR_OFFSET * box->pmu->pmu_idx;
585 reg1->config = event->attr.config1 & snbep_cbox_filter_mask(idx);
586 reg1->idx = idx;
587 }
588 return 0;
589}
590
591static struct intel_uncore_ops snbep_uncore_cbox_ops = {
592 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
593 .hw_config = snbep_cbox_hw_config,
594 .get_constraint = snbep_cbox_get_constraint,
595 .put_constraint = snbep_cbox_put_constraint,
596};
597
449static struct intel_uncore_type snbep_uncore_cbox = { 598static struct intel_uncore_type snbep_uncore_cbox = {
450 .name = "cbox", 599 .name = "cbox",
451 .num_counters = 4, 600 .num_counters = 4,
@@ -458,10 +607,104 @@ static struct intel_uncore_type snbep_uncore_cbox = {
458 .msr_offset = SNBEP_CBO_MSR_OFFSET, 607 .msr_offset = SNBEP_CBO_MSR_OFFSET,
459 .num_shared_regs = 1, 608 .num_shared_regs = 1,
460 .constraints = snbep_uncore_cbox_constraints, 609 .constraints = snbep_uncore_cbox_constraints,
461 .ops = &snbep_uncore_msr_ops, 610 .ops = &snbep_uncore_cbox_ops,
462 .format_group = &snbep_uncore_cbox_format_group, 611 .format_group = &snbep_uncore_cbox_format_group,
463}; 612};
464 613
614static u64 snbep_pcu_alter_er(struct perf_event *event, int new_idx, bool modify)
615{
616 struct hw_perf_event *hwc = &event->hw;
617 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
618 u64 config = reg1->config;
619
620 if (new_idx > reg1->idx)
621 config <<= 8 * (new_idx - reg1->idx);
622 else
623 config >>= 8 * (reg1->idx - new_idx);
624
625 if (modify) {
626 hwc->config += new_idx - reg1->idx;
627 reg1->config = config;
628 reg1->idx = new_idx;
629 }
630 return config;
631}
632
633static struct event_constraint *
634snbep_pcu_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
635{
636 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
637 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
638 unsigned long flags;
639 int idx = reg1->idx;
640 u64 mask, config1 = reg1->config;
641 bool ok = false;
642
643 if (reg1->idx == EXTRA_REG_NONE ||
644 (!uncore_box_is_fake(box) && reg1->alloc))
645 return NULL;
646again:
647 mask = 0xff << (idx * 8);
648 raw_spin_lock_irqsave(&er->lock, flags);
649 if (!__BITS_VALUE(atomic_read(&er->ref), idx, 8) ||
650 !((config1 ^ er->config) & mask)) {
651 atomic_add(1 << (idx * 8), &er->ref);
652 er->config &= ~mask;
653 er->config |= config1 & mask;
654 ok = true;
655 }
656 raw_spin_unlock_irqrestore(&er->lock, flags);
657
658 if (!ok) {
659 idx = (idx + 1) % 4;
660 if (idx != reg1->idx) {
661 config1 = snbep_pcu_alter_er(event, idx, false);
662 goto again;
663 }
664 return &constraint_empty;
665 }
666
667 if (!uncore_box_is_fake(box)) {
668 if (idx != reg1->idx)
669 snbep_pcu_alter_er(event, idx, true);
670 reg1->alloc = 1;
671 }
672 return NULL;
673}
674
675static void snbep_pcu_put_constraint(struct intel_uncore_box *box, struct perf_event *event)
676{
677 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
678 struct intel_uncore_extra_reg *er = &box->shared_regs[0];
679
680 if (uncore_box_is_fake(box) || !reg1->alloc)
681 return;
682
683 atomic_sub(1 << (reg1->idx * 8), &er->ref);
684 reg1->alloc = 0;
685}
686
687static int snbep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *event)
688{
689 struct hw_perf_event *hwc = &event->hw;
690 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
691 int ev_sel = hwc->config & SNBEP_PMON_CTL_EV_SEL_MASK;
692
693 if (ev_sel >= 0xb && ev_sel <= 0xe) {
694 reg1->reg = SNBEP_PCU_MSR_PMON_BOX_FILTER;
695 reg1->idx = ev_sel - 0xb;
696 reg1->config = event->attr.config1 & (0xff << reg1->idx);
697 }
698 return 0;
699}
700
701static struct intel_uncore_ops snbep_uncore_pcu_ops = {
702 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
703 .hw_config = snbep_pcu_hw_config,
704 .get_constraint = snbep_pcu_get_constraint,
705 .put_constraint = snbep_pcu_put_constraint,
706};
707
465static struct intel_uncore_type snbep_uncore_pcu = { 708static struct intel_uncore_type snbep_uncore_pcu = {
466 .name = "pcu", 709 .name = "pcu",
467 .num_counters = 4, 710 .num_counters = 4,
@@ -472,7 +715,7 @@ static struct intel_uncore_type snbep_uncore_pcu = {
472 .event_mask = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK, 715 .event_mask = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
473 .box_ctl = SNBEP_PCU_MSR_PMON_BOX_CTL, 716 .box_ctl = SNBEP_PCU_MSR_PMON_BOX_CTL,
474 .num_shared_regs = 1, 717 .num_shared_regs = 1,
475 .ops = &snbep_uncore_msr_ops, 718 .ops = &snbep_uncore_pcu_ops,
476 .format_group = &snbep_uncore_pcu_format_group, 719 .format_group = &snbep_uncore_pcu_format_group,
477}; 720};
478 721
@@ -544,55 +787,63 @@ static struct intel_uncore_type snbep_uncore_r3qpi = {
544 SNBEP_UNCORE_PCI_COMMON_INIT(), 787 SNBEP_UNCORE_PCI_COMMON_INIT(),
545}; 788};
546 789
790enum {
791 SNBEP_PCI_UNCORE_HA,
792 SNBEP_PCI_UNCORE_IMC,
793 SNBEP_PCI_UNCORE_QPI,
794 SNBEP_PCI_UNCORE_R2PCIE,
795 SNBEP_PCI_UNCORE_R3QPI,
796};
797
547static struct intel_uncore_type *snbep_pci_uncores[] = { 798static struct intel_uncore_type *snbep_pci_uncores[] = {
548 &snbep_uncore_ha, 799 [SNBEP_PCI_UNCORE_HA] = &snbep_uncore_ha,
549 &snbep_uncore_imc, 800 [SNBEP_PCI_UNCORE_IMC] = &snbep_uncore_imc,
550 &snbep_uncore_qpi, 801 [SNBEP_PCI_UNCORE_QPI] = &snbep_uncore_qpi,
551 &snbep_uncore_r2pcie, 802 [SNBEP_PCI_UNCORE_R2PCIE] = &snbep_uncore_r2pcie,
552 &snbep_uncore_r3qpi, 803 [SNBEP_PCI_UNCORE_R3QPI] = &snbep_uncore_r3qpi,
553 NULL, 804 NULL,
554}; 805};
555 806
556static DEFINE_PCI_DEVICE_TABLE(snbep_uncore_pci_ids) = { 807static DEFINE_PCI_DEVICE_TABLE(snbep_uncore_pci_ids) = {
557 { /* Home Agent */ 808 { /* Home Agent */
558 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_HA), 809 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_HA),
559 .driver_data = (unsigned long)&snbep_uncore_ha, 810 .driver_data = SNBEP_PCI_UNCORE_HA,
560 }, 811 },
561 { /* MC Channel 0 */ 812 { /* MC Channel 0 */
562 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC0), 813 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC0),
563 .driver_data = (unsigned long)&snbep_uncore_imc, 814 .driver_data = SNBEP_PCI_UNCORE_IMC,
564 }, 815 },
565 { /* MC Channel 1 */ 816 { /* MC Channel 1 */
566 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC1), 817 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC1),
567 .driver_data = (unsigned long)&snbep_uncore_imc, 818 .driver_data = SNBEP_PCI_UNCORE_IMC,
568 }, 819 },
569 { /* MC Channel 2 */ 820 { /* MC Channel 2 */
570 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC2), 821 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC2),
571 .driver_data = (unsigned long)&snbep_uncore_imc, 822 .driver_data = SNBEP_PCI_UNCORE_IMC,
572 }, 823 },
573 { /* MC Channel 3 */ 824 { /* MC Channel 3 */
574 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC3), 825 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_IMC3),
575 .driver_data = (unsigned long)&snbep_uncore_imc, 826 .driver_data = SNBEP_PCI_UNCORE_IMC,
576 }, 827 },
577 { /* QPI Port 0 */ 828 { /* QPI Port 0 */
578 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_QPI0), 829 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_QPI0),
579 .driver_data = (unsigned long)&snbep_uncore_qpi, 830 .driver_data = SNBEP_PCI_UNCORE_QPI,
580 }, 831 },
581 { /* QPI Port 1 */ 832 { /* QPI Port 1 */
582 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_QPI1), 833 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_QPI1),
583 .driver_data = (unsigned long)&snbep_uncore_qpi, 834 .driver_data = SNBEP_PCI_UNCORE_QPI,
584 }, 835 },
585 { /* P2PCIe */ 836 { /* R2PCIe */
586 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R2PCIE), 837 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R2PCIE),
587 .driver_data = (unsigned long)&snbep_uncore_r2pcie, 838 .driver_data = SNBEP_PCI_UNCORE_R2PCIE,
588 }, 839 },
589 { /* R3QPI Link 0 */ 840 { /* R3QPI Link 0 */
590 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R3QPI0), 841 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R3QPI0),
591 .driver_data = (unsigned long)&snbep_uncore_r3qpi, 842 .driver_data = SNBEP_PCI_UNCORE_R3QPI,
592 }, 843 },
593 { /* R3QPI Link 1 */ 844 { /* R3QPI Link 1 */
594 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R3QPI1), 845 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_UNC_R3QPI1),
595 .driver_data = (unsigned long)&snbep_uncore_r3qpi, 846 .driver_data = SNBEP_PCI_UNCORE_R3QPI,
596 }, 847 },
597 { /* end: all zeroes */ } 848 { /* end: all zeroes */ }
598}; 849};
@@ -605,7 +856,7 @@ static struct pci_driver snbep_uncore_pci_driver = {
605/* 856/*
606 * build pci bus to socket mapping 857 * build pci bus to socket mapping
607 */ 858 */
608static int snbep_pci2phy_map_init(void) 859static int snbep_pci2phy_map_init(int devid)
609{ 860{
610 struct pci_dev *ubox_dev = NULL; 861 struct pci_dev *ubox_dev = NULL;
611 int i, bus, nodeid; 862 int i, bus, nodeid;
@@ -614,9 +865,7 @@ static int snbep_pci2phy_map_init(void)
614 865
615 while (1) { 866 while (1) {
616 /* find the UBOX device */ 867 /* find the UBOX device */
617 ubox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 868 ubox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, devid, ubox_dev);
618 PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX,
619 ubox_dev);
620 if (!ubox_dev) 869 if (!ubox_dev)
621 break; 870 break;
622 bus = ubox_dev->bus->number; 871 bus = ubox_dev->bus->number;
@@ -639,7 +888,7 @@ static int snbep_pci2phy_map_init(void)
639 break; 888 break;
640 } 889 }
641 } 890 }
642 }; 891 }
643 892
644 if (ubox_dev) 893 if (ubox_dev)
645 pci_dev_put(ubox_dev); 894 pci_dev_put(ubox_dev);
@@ -648,6 +897,440 @@ static int snbep_pci2phy_map_init(void)
648} 897}
649/* end of Sandy Bridge-EP uncore support */ 898/* end of Sandy Bridge-EP uncore support */
650 899
900/* IvyTown uncore support */
901static void ivt_uncore_msr_init_box(struct intel_uncore_box *box)
902{
903 unsigned msr = uncore_msr_box_ctl(box);
904 if (msr)
905 wrmsrl(msr, IVT_PMON_BOX_CTL_INT);
906}
907
908static void ivt_uncore_pci_init_box(struct intel_uncore_box *box)
909{
910 struct pci_dev *pdev = box->pci_dev;
911
912 pci_write_config_dword(pdev, SNBEP_PCI_PMON_BOX_CTL, IVT_PMON_BOX_CTL_INT);
913}
914
915#define IVT_UNCORE_MSR_OPS_COMMON_INIT() \
916 .init_box = ivt_uncore_msr_init_box, \
917 .disable_box = snbep_uncore_msr_disable_box, \
918 .enable_box = snbep_uncore_msr_enable_box, \
919 .disable_event = snbep_uncore_msr_disable_event, \
920 .enable_event = snbep_uncore_msr_enable_event, \
921 .read_counter = uncore_msr_read_counter
922
923static struct intel_uncore_ops ivt_uncore_msr_ops = {
924 IVT_UNCORE_MSR_OPS_COMMON_INIT(),
925};
926
927static struct intel_uncore_ops ivt_uncore_pci_ops = {
928 .init_box = ivt_uncore_pci_init_box,
929 .disable_box = snbep_uncore_pci_disable_box,
930 .enable_box = snbep_uncore_pci_enable_box,
931 .disable_event = snbep_uncore_pci_disable_event,
932 .enable_event = snbep_uncore_pci_enable_event,
933 .read_counter = snbep_uncore_pci_read_counter,
934};
935
936#define IVT_UNCORE_PCI_COMMON_INIT() \
937 .perf_ctr = SNBEP_PCI_PMON_CTR0, \
938 .event_ctl = SNBEP_PCI_PMON_CTL0, \
939 .event_mask = IVT_PMON_RAW_EVENT_MASK, \
940 .box_ctl = SNBEP_PCI_PMON_BOX_CTL, \
941 .ops = &ivt_uncore_pci_ops, \
942 .format_group = &ivt_uncore_format_group
943
944static struct attribute *ivt_uncore_formats_attr[] = {
945 &format_attr_event.attr,
946 &format_attr_umask.attr,
947 &format_attr_edge.attr,
948 &format_attr_inv.attr,
949 &format_attr_thresh8.attr,
950 NULL,
951};
952
953static struct attribute *ivt_uncore_ubox_formats_attr[] = {
954 &format_attr_event.attr,
955 &format_attr_umask.attr,
956 &format_attr_edge.attr,
957 &format_attr_inv.attr,
958 &format_attr_thresh5.attr,
959 NULL,
960};
961
962static struct attribute *ivt_uncore_cbox_formats_attr[] = {
963 &format_attr_event.attr,
964 &format_attr_umask.attr,
965 &format_attr_edge.attr,
966 &format_attr_tid_en.attr,
967 &format_attr_thresh8.attr,
968 &format_attr_filter_tid.attr,
969 &format_attr_filter_link.attr,
970 &format_attr_filter_state2.attr,
971 &format_attr_filter_nid2.attr,
972 &format_attr_filter_opc2.attr,
973 NULL,
974};
975
976static struct attribute *ivt_uncore_pcu_formats_attr[] = {
977 &format_attr_event_ext.attr,
978 &format_attr_occ_sel.attr,
979 &format_attr_edge.attr,
980 &format_attr_thresh5.attr,
981 &format_attr_occ_invert.attr,
982 &format_attr_occ_edge.attr,
983 &format_attr_filter_band0.attr,
984 &format_attr_filter_band1.attr,
985 &format_attr_filter_band2.attr,
986 &format_attr_filter_band3.attr,
987 NULL,
988};
989
990static struct attribute *ivt_uncore_qpi_formats_attr[] = {
991 &format_attr_event_ext.attr,
992 &format_attr_umask.attr,
993 &format_attr_edge.attr,
994 &format_attr_thresh8.attr,
995 NULL,
996};
997
998static struct attribute_group ivt_uncore_format_group = {
999 .name = "format",
1000 .attrs = ivt_uncore_formats_attr,
1001};
1002
1003static struct attribute_group ivt_uncore_ubox_format_group = {
1004 .name = "format",
1005 .attrs = ivt_uncore_ubox_formats_attr,
1006};
1007
1008static struct attribute_group ivt_uncore_cbox_format_group = {
1009 .name = "format",
1010 .attrs = ivt_uncore_cbox_formats_attr,
1011};
1012
1013static struct attribute_group ivt_uncore_pcu_format_group = {
1014 .name = "format",
1015 .attrs = ivt_uncore_pcu_formats_attr,
1016};
1017
1018static struct attribute_group ivt_uncore_qpi_format_group = {
1019 .name = "format",
1020 .attrs = ivt_uncore_qpi_formats_attr,
1021};
1022
1023static struct intel_uncore_type ivt_uncore_ubox = {
1024 .name = "ubox",
1025 .num_counters = 2,
1026 .num_boxes = 1,
1027 .perf_ctr_bits = 44,
1028 .fixed_ctr_bits = 48,
1029 .perf_ctr = SNBEP_U_MSR_PMON_CTR0,
1030 .event_ctl = SNBEP_U_MSR_PMON_CTL0,
1031 .event_mask = IVT_U_MSR_PMON_RAW_EVENT_MASK,
1032 .fixed_ctr = SNBEP_U_MSR_PMON_UCLK_FIXED_CTR,
1033 .fixed_ctl = SNBEP_U_MSR_PMON_UCLK_FIXED_CTL,
1034 .ops = &ivt_uncore_msr_ops,
1035 .format_group = &ivt_uncore_ubox_format_group,
1036};
1037
1038static struct extra_reg ivt_uncore_cbox_extra_regs[] = {
1039 SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN,
1040 SNBEP_CBO_PMON_CTL_TID_EN, 0x1),
1041 SNBEP_CBO_EVENT_EXTRA_REG(0x1031, 0x10ff, 0x2),
1042 SNBEP_CBO_EVENT_EXTRA_REG(0x0334, 0xffff, 0x4),
1043 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
1044 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
1045 SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0xc),
1046 SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x10),
1047 SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x10),
1048 SNBEP_CBO_EVENT_EXTRA_REG(0x2135, 0xffff, 0x10),
1049 SNBEP_CBO_EVENT_EXTRA_REG(0x2335, 0xffff, 0x10),
1050 SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0x18),
1051 SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0x18),
1052 SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x8),
1053 SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x8),
1054 SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x8),
1055 SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x8),
1056 SNBEP_CBO_EVENT_EXTRA_REG(0x8135, 0xffff, 0x10),
1057 SNBEP_CBO_EVENT_EXTRA_REG(0x8335, 0xffff, 0x10),
1058 SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x10),
1059 SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x10),
1060 SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10),
1061 SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10),
1062 SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0x18),
1063 SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0x18),
1064 SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x8),
1065 SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x8),
1066 SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x8),
1067 SNBEP_CBO_EVENT_EXTRA_REG(0x5036, 0xffff, 0x8),
1068 SNBEP_CBO_EVENT_EXTRA_REG(0x8136, 0xffff, 0x10),
1069 SNBEP_CBO_EVENT_EXTRA_REG(0x8336, 0xffff, 0x10),
1070 SNBEP_CBO_EVENT_EXTRA_REG(0x4037, 0x40ff, 0x8),
1071 EVENT_EXTRA_END
1072};
1073
1074static u64 ivt_cbox_filter_mask(int fields)
1075{
1076 u64 mask = 0;
1077
1078 if (fields & 0x1)
1079 mask |= IVT_CB0_MSR_PMON_BOX_FILTER_TID;
1080 if (fields & 0x2)
1081 mask |= IVT_CB0_MSR_PMON_BOX_FILTER_LINK;
1082 if (fields & 0x4)
1083 mask |= IVT_CB0_MSR_PMON_BOX_FILTER_STATE;
1084 if (fields & 0x8)
1085 mask |= IVT_CB0_MSR_PMON_BOX_FILTER_NID;
1086 if (fields & 0x10)
1087 mask |= IVT_CB0_MSR_PMON_BOX_FILTER_OPC;
1088
1089 return mask;
1090}
1091
1092static struct event_constraint *
1093ivt_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
1094{
1095 return __snbep_cbox_get_constraint(box, event, ivt_cbox_filter_mask);
1096}
1097
1098static int ivt_cbox_hw_config(struct intel_uncore_box *box, struct perf_event *event)
1099{
1100 struct hw_perf_event_extra *reg1 = &event->hw.extra_reg;
1101 struct extra_reg *er;
1102 int idx = 0;
1103
1104 for (er = ivt_uncore_cbox_extra_regs; er->msr; er++) {
1105 if (er->event != (event->hw.config & er->config_mask))
1106 continue;
1107 idx |= er->idx;
1108 }
1109
1110 if (idx) {
1111 reg1->reg = SNBEP_C0_MSR_PMON_BOX_FILTER +
1112 SNBEP_CBO_MSR_OFFSET * box->pmu->pmu_idx;
1113 reg1->config = event->attr.config1 & ivt_cbox_filter_mask(idx);
1114 reg1->idx = idx;
1115 }
1116 return 0;
1117}
1118
1119static void ivt_cbox_enable_event(struct intel_uncore_box *box, struct perf_event *event)
1120{
1121 struct hw_perf_event *hwc = &event->hw;
1122 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
1123
1124 if (reg1->idx != EXTRA_REG_NONE) {
1125 u64 filter = uncore_shared_reg_config(box, 0);
1126 wrmsrl(reg1->reg, filter & 0xffffffff);
1127 wrmsrl(reg1->reg + 6, filter >> 32);
1128 }
1129
1130 wrmsrl(hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
1131}
1132
1133static struct intel_uncore_ops ivt_uncore_cbox_ops = {
1134 .init_box = ivt_uncore_msr_init_box,
1135 .disable_box = snbep_uncore_msr_disable_box,
1136 .enable_box = snbep_uncore_msr_enable_box,
1137 .disable_event = snbep_uncore_msr_disable_event,
1138 .enable_event = ivt_cbox_enable_event,
1139 .read_counter = uncore_msr_read_counter,
1140 .hw_config = ivt_cbox_hw_config,
1141 .get_constraint = ivt_cbox_get_constraint,
1142 .put_constraint = snbep_cbox_put_constraint,
1143};
1144
1145static struct intel_uncore_type ivt_uncore_cbox = {
1146 .name = "cbox",
1147 .num_counters = 4,
1148 .num_boxes = 15,
1149 .perf_ctr_bits = 44,
1150 .event_ctl = SNBEP_C0_MSR_PMON_CTL0,
1151 .perf_ctr = SNBEP_C0_MSR_PMON_CTR0,
1152 .event_mask = IVT_CBO_MSR_PMON_RAW_EVENT_MASK,
1153 .box_ctl = SNBEP_C0_MSR_PMON_BOX_CTL,
1154 .msr_offset = SNBEP_CBO_MSR_OFFSET,
1155 .num_shared_regs = 1,
1156 .constraints = snbep_uncore_cbox_constraints,
1157 .ops = &ivt_uncore_cbox_ops,
1158 .format_group = &ivt_uncore_cbox_format_group,
1159};
1160
1161static struct intel_uncore_ops ivt_uncore_pcu_ops = {
1162 IVT_UNCORE_MSR_OPS_COMMON_INIT(),
1163 .hw_config = snbep_pcu_hw_config,
1164 .get_constraint = snbep_pcu_get_constraint,
1165 .put_constraint = snbep_pcu_put_constraint,
1166};
1167
1168static struct intel_uncore_type ivt_uncore_pcu = {
1169 .name = "pcu",
1170 .num_counters = 4,
1171 .num_boxes = 1,
1172 .perf_ctr_bits = 48,
1173 .perf_ctr = SNBEP_PCU_MSR_PMON_CTR0,
1174 .event_ctl = SNBEP_PCU_MSR_PMON_CTL0,
1175 .event_mask = IVT_PCU_MSR_PMON_RAW_EVENT_MASK,
1176 .box_ctl = SNBEP_PCU_MSR_PMON_BOX_CTL,
1177 .num_shared_regs = 1,
1178 .ops = &ivt_uncore_pcu_ops,
1179 .format_group = &ivt_uncore_pcu_format_group,
1180};
1181
1182static struct intel_uncore_type *ivt_msr_uncores[] = {
1183 &ivt_uncore_ubox,
1184 &ivt_uncore_cbox,
1185 &ivt_uncore_pcu,
1186 NULL,
1187};
1188
1189static struct intel_uncore_type ivt_uncore_ha = {
1190 .name = "ha",
1191 .num_counters = 4,
1192 .num_boxes = 2,
1193 .perf_ctr_bits = 48,
1194 IVT_UNCORE_PCI_COMMON_INIT(),
1195};
1196
1197static struct intel_uncore_type ivt_uncore_imc = {
1198 .name = "imc",
1199 .num_counters = 4,
1200 .num_boxes = 8,
1201 .perf_ctr_bits = 48,
1202 .fixed_ctr_bits = 48,
1203 .fixed_ctr = SNBEP_MC_CHy_PCI_PMON_FIXED_CTR,
1204 .fixed_ctl = SNBEP_MC_CHy_PCI_PMON_FIXED_CTL,
1205 IVT_UNCORE_PCI_COMMON_INIT(),
1206};
1207
1208static struct intel_uncore_type ivt_uncore_qpi = {
1209 .name = "qpi",
1210 .num_counters = 4,
1211 .num_boxes = 3,
1212 .perf_ctr_bits = 48,
1213 .perf_ctr = SNBEP_PCI_PMON_CTR0,
1214 .event_ctl = SNBEP_PCI_PMON_CTL0,
1215 .event_mask = IVT_QPI_PCI_PMON_RAW_EVENT_MASK,
1216 .box_ctl = SNBEP_PCI_PMON_BOX_CTL,
1217 .ops = &ivt_uncore_pci_ops,
1218 .format_group = &ivt_uncore_qpi_format_group,
1219};
1220
1221static struct intel_uncore_type ivt_uncore_r2pcie = {
1222 .name = "r2pcie",
1223 .num_counters = 4,
1224 .num_boxes = 1,
1225 .perf_ctr_bits = 44,
1226 .constraints = snbep_uncore_r2pcie_constraints,
1227 IVT_UNCORE_PCI_COMMON_INIT(),
1228};
1229
1230static struct intel_uncore_type ivt_uncore_r3qpi = {
1231 .name = "r3qpi",
1232 .num_counters = 3,
1233 .num_boxes = 2,
1234 .perf_ctr_bits = 44,
1235 .constraints = snbep_uncore_r3qpi_constraints,
1236 IVT_UNCORE_PCI_COMMON_INIT(),
1237};
1238
1239enum {
1240 IVT_PCI_UNCORE_HA,
1241 IVT_PCI_UNCORE_IMC,
1242 IVT_PCI_UNCORE_QPI,
1243 IVT_PCI_UNCORE_R2PCIE,
1244 IVT_PCI_UNCORE_R3QPI,
1245};
1246
1247static struct intel_uncore_type *ivt_pci_uncores[] = {
1248 [IVT_PCI_UNCORE_HA] = &ivt_uncore_ha,
1249 [IVT_PCI_UNCORE_IMC] = &ivt_uncore_imc,
1250 [IVT_PCI_UNCORE_QPI] = &ivt_uncore_qpi,
1251 [IVT_PCI_UNCORE_R2PCIE] = &ivt_uncore_r2pcie,
1252 [IVT_PCI_UNCORE_R3QPI] = &ivt_uncore_r3qpi,
1253 NULL,
1254};
1255
1256static DEFINE_PCI_DEVICE_TABLE(ivt_uncore_pci_ids) = {
1257 { /* Home Agent 0 */
1258 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe30),
1259 .driver_data = IVT_PCI_UNCORE_HA,
1260 },
1261 { /* Home Agent 1 */
1262 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe38),
1263 .driver_data = IVT_PCI_UNCORE_HA,
1264 },
1265 { /* MC0 Channel 0 */
1266 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb4),
1267 .driver_data = IVT_PCI_UNCORE_IMC,
1268 },
1269 { /* MC0 Channel 1 */
1270 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb5),
1271 .driver_data = IVT_PCI_UNCORE_IMC,
1272 },
1273 { /* MC0 Channel 3 */
1274 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb0),
1275 .driver_data = IVT_PCI_UNCORE_IMC,
1276 },
1277 { /* MC0 Channel 4 */
1278 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xeb1),
1279 .driver_data = IVT_PCI_UNCORE_IMC,
1280 },
1281 { /* MC1 Channel 0 */
1282 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef4),
1283 .driver_data = IVT_PCI_UNCORE_IMC,
1284 },
1285 { /* MC1 Channel 1 */
1286 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef5),
1287 .driver_data = IVT_PCI_UNCORE_IMC,
1288 },
1289 { /* MC1 Channel 3 */
1290 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef0),
1291 .driver_data = IVT_PCI_UNCORE_IMC,
1292 },
1293 { /* MC1 Channel 4 */
1294 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xef1),
1295 .driver_data = IVT_PCI_UNCORE_IMC,
1296 },
1297 { /* QPI0 Port 0 */
1298 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe32),
1299 .driver_data = IVT_PCI_UNCORE_QPI,
1300 },
1301 { /* QPI0 Port 1 */
1302 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe33),
1303 .driver_data = IVT_PCI_UNCORE_QPI,
1304 },
1305 { /* QPI1 Port 2 */
1306 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe3a),
1307 .driver_data = IVT_PCI_UNCORE_QPI,
1308 },
1309 { /* R2PCIe */
1310 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe34),
1311 .driver_data = IVT_PCI_UNCORE_R2PCIE,
1312 },
1313 { /* R3QPI0 Link 0 */
1314 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe36),
1315 .driver_data = IVT_PCI_UNCORE_R3QPI,
1316 },
1317 { /* R3QPI0 Link 1 */
1318 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe37),
1319 .driver_data = IVT_PCI_UNCORE_R3QPI,
1320 },
1321 { /* R3QPI1 Link 2 */
1322 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe3e),
1323 .driver_data = IVT_PCI_UNCORE_R3QPI,
1324 },
1325 { /* end: all zeroes */ }
1326};
1327
1328static struct pci_driver ivt_uncore_pci_driver = {
1329 .name = "ivt_uncore",
1330 .id_table = ivt_uncore_pci_ids,
1331};
1332/* end of IvyTown uncore support */
1333
651/* Sandy Bridge uncore support */ 1334/* Sandy Bridge uncore support */
652static void snb_uncore_msr_enable_event(struct intel_uncore_box *box, struct perf_event *event) 1335static void snb_uncore_msr_enable_event(struct intel_uncore_box *box, struct perf_event *event)
653{ 1336{
@@ -808,9 +1491,6 @@ static struct intel_uncore_type *nhm_msr_uncores[] = {
808/* end of Nehalem uncore support */ 1491/* end of Nehalem uncore support */
809 1492
810/* Nehalem-EX uncore support */ 1493/* Nehalem-EX uncore support */
811#define __BITS_VALUE(x, i, n) ((typeof(x))(((x) >> ((i) * (n))) & \
812 ((1ULL << (n)) - 1)))
813
814DEFINE_UNCORE_FORMAT_ATTR(event5, event, "config:1-5"); 1494DEFINE_UNCORE_FORMAT_ATTR(event5, event, "config:1-5");
815DEFINE_UNCORE_FORMAT_ATTR(counter, counter, "config:6-7"); 1495DEFINE_UNCORE_FORMAT_ATTR(counter, counter, "config:6-7");
816DEFINE_UNCORE_FORMAT_ATTR(match, match, "config1:0-63"); 1496DEFINE_UNCORE_FORMAT_ATTR(match, match, "config1:0-63");
@@ -1161,7 +1841,7 @@ static struct extra_reg nhmex_uncore_mbox_extra_regs[] = {
1161}; 1841};
1162 1842
1163/* Nehalem-EX or Westmere-EX ? */ 1843/* Nehalem-EX or Westmere-EX ? */
1164bool uncore_nhmex; 1844static bool uncore_nhmex;
1165 1845
1166static bool nhmex_mbox_get_shared_reg(struct intel_uncore_box *box, int idx, u64 config) 1846static bool nhmex_mbox_get_shared_reg(struct intel_uncore_box *box, int idx, u64 config)
1167{ 1847{
@@ -1239,7 +1919,7 @@ static void nhmex_mbox_put_shared_reg(struct intel_uncore_box *box, int idx)
1239 atomic_sub(1 << (idx * 8), &er->ref); 1919 atomic_sub(1 << (idx * 8), &er->ref);
1240} 1920}
1241 1921
1242u64 nhmex_mbox_alter_er(struct perf_event *event, int new_idx, bool modify) 1922static u64 nhmex_mbox_alter_er(struct perf_event *event, int new_idx, bool modify)
1243{ 1923{
1244 struct hw_perf_event *hwc = &event->hw; 1924 struct hw_perf_event *hwc = &event->hw;
1245 struct hw_perf_event_extra *reg1 = &hwc->extra_reg; 1925 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
@@ -1554,7 +2234,7 @@ static struct intel_uncore_type nhmex_uncore_mbox = {
1554 .format_group = &nhmex_uncore_mbox_format_group, 2234 .format_group = &nhmex_uncore_mbox_format_group,
1555}; 2235};
1556 2236
1557void nhmex_rbox_alter_er(struct intel_uncore_box *box, struct perf_event *event) 2237static void nhmex_rbox_alter_er(struct intel_uncore_box *box, struct perf_event *event)
1558{ 2238{
1559 struct hw_perf_event *hwc = &event->hw; 2239 struct hw_perf_event *hwc = &event->hw;
1560 struct hw_perf_event_extra *reg1 = &hwc->extra_reg; 2240 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
@@ -1724,21 +2404,6 @@ static int nhmex_rbox_hw_config(struct intel_uncore_box *box, struct perf_event
1724 return 0; 2404 return 0;
1725} 2405}
1726 2406
1727static u64 nhmex_rbox_shared_reg_config(struct intel_uncore_box *box, int idx)
1728{
1729 struct intel_uncore_extra_reg *er;
1730 unsigned long flags;
1731 u64 config;
1732
1733 er = &box->shared_regs[idx];
1734
1735 raw_spin_lock_irqsave(&er->lock, flags);
1736 config = er->config;
1737 raw_spin_unlock_irqrestore(&er->lock, flags);
1738
1739 return config;
1740}
1741
1742static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct perf_event *event) 2407static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct perf_event *event)
1743{ 2408{
1744 struct hw_perf_event *hwc = &event->hw; 2409 struct hw_perf_event *hwc = &event->hw;
@@ -1759,7 +2424,7 @@ static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct per
1759 case 2: 2424 case 2:
1760 case 3: 2425 case 3:
1761 wrmsrl(NHMEX_R_MSR_PORTN_QLX_CFG(port), 2426 wrmsrl(NHMEX_R_MSR_PORTN_QLX_CFG(port),
1762 nhmex_rbox_shared_reg_config(box, 2 + (idx / 6) * 5)); 2427 uncore_shared_reg_config(box, 2 + (idx / 6) * 5));
1763 break; 2428 break;
1764 case 4: 2429 case 4:
1765 wrmsrl(NHMEX_R_MSR_PORTN_XBR_SET1_MM_CFG(port), 2430 wrmsrl(NHMEX_R_MSR_PORTN_XBR_SET1_MM_CFG(port),
@@ -2285,7 +2950,7 @@ out:
2285 return ret; 2950 return ret;
2286} 2951}
2287 2952
2288int uncore_pmu_event_init(struct perf_event *event) 2953static int uncore_pmu_event_init(struct perf_event *event)
2289{ 2954{
2290 struct intel_uncore_pmu *pmu; 2955 struct intel_uncore_pmu *pmu;
2291 struct intel_uncore_box *box; 2956 struct intel_uncore_box *box;
@@ -2428,7 +3093,7 @@ static void __init uncore_types_exit(struct intel_uncore_type **types)
2428static int __init uncore_type_init(struct intel_uncore_type *type) 3093static int __init uncore_type_init(struct intel_uncore_type *type)
2429{ 3094{
2430 struct intel_uncore_pmu *pmus; 3095 struct intel_uncore_pmu *pmus;
2431 struct attribute_group *events_group; 3096 struct attribute_group *attr_group;
2432 struct attribute **attrs; 3097 struct attribute **attrs;
2433 int i, j; 3098 int i, j;
2434 3099
@@ -2438,7 +3103,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
2438 3103
2439 type->unconstrainted = (struct event_constraint) 3104 type->unconstrainted = (struct event_constraint)
2440 __EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1, 3105 __EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1,
2441 0, type->num_counters, 0); 3106 0, type->num_counters, 0, 0);
2442 3107
2443 for (i = 0; i < type->num_boxes; i++) { 3108 for (i = 0; i < type->num_boxes; i++) {
2444 pmus[i].func_id = -1; 3109 pmus[i].func_id = -1;
@@ -2455,19 +3120,19 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
2455 while (type->event_descs[i].attr.attr.name) 3120 while (type->event_descs[i].attr.attr.name)
2456 i++; 3121 i++;
2457 3122
2458 events_group = kzalloc(sizeof(struct attribute *) * (i + 1) + 3123 attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
2459 sizeof(*events_group), GFP_KERNEL); 3124 sizeof(*attr_group), GFP_KERNEL);
2460 if (!events_group) 3125 if (!attr_group)
2461 goto fail; 3126 goto fail;
2462 3127
2463 attrs = (struct attribute **)(events_group + 1); 3128 attrs = (struct attribute **)(attr_group + 1);
2464 events_group->name = "events"; 3129 attr_group->name = "events";
2465 events_group->attrs = attrs; 3130 attr_group->attrs = attrs;
2466 3131
2467 for (j = 0; j < i; j++) 3132 for (j = 0; j < i; j++)
2468 attrs[j] = &type->event_descs[j].attr.attr; 3133 attrs[j] = &type->event_descs[j].attr.attr;
2469 3134
2470 type->events_group = events_group; 3135 type->events_group = attr_group;
2471 } 3136 }
2472 3137
2473 type->pmu_group = &uncore_pmu_attr_group; 3138 type->pmu_group = &uncore_pmu_attr_group;
@@ -2556,6 +3221,8 @@ static void uncore_pci_remove(struct pci_dev *pdev)
2556 if (WARN_ON_ONCE(phys_id != box->phys_id)) 3221 if (WARN_ON_ONCE(phys_id != box->phys_id))
2557 return; 3222 return;
2558 3223
3224 pci_set_drvdata(pdev, NULL);
3225
2559 raw_spin_lock(&uncore_box_lock); 3226 raw_spin_lock(&uncore_box_lock);
2560 list_del(&box->list); 3227 list_del(&box->list);
2561 raw_spin_unlock(&uncore_box_lock); 3228 raw_spin_unlock(&uncore_box_lock);
@@ -2574,11 +3241,7 @@ static void uncore_pci_remove(struct pci_dev *pdev)
2574static int uncore_pci_probe(struct pci_dev *pdev, 3241static int uncore_pci_probe(struct pci_dev *pdev,
2575 const struct pci_device_id *id) 3242 const struct pci_device_id *id)
2576{ 3243{
2577 struct intel_uncore_type *type; 3244 return uncore_pci_add(pci_uncores[id->driver_data], pdev);
2578
2579 type = (struct intel_uncore_type *)id->driver_data;
2580
2581 return uncore_pci_add(type, pdev);
2582} 3245}
2583 3246
2584static int __init uncore_pci_init(void) 3247static int __init uncore_pci_init(void)
@@ -2587,12 +3250,19 @@ static int __init uncore_pci_init(void)
2587 3250
2588 switch (boot_cpu_data.x86_model) { 3251 switch (boot_cpu_data.x86_model) {
2589 case 45: /* Sandy Bridge-EP */ 3252 case 45: /* Sandy Bridge-EP */
2590 ret = snbep_pci2phy_map_init(); 3253 ret = snbep_pci2phy_map_init(0x3ce0);
2591 if (ret) 3254 if (ret)
2592 return ret; 3255 return ret;
2593 pci_uncores = snbep_pci_uncores; 3256 pci_uncores = snbep_pci_uncores;
2594 uncore_pci_driver = &snbep_uncore_pci_driver; 3257 uncore_pci_driver = &snbep_uncore_pci_driver;
2595 break; 3258 break;
3259 case 62: /* IvyTown */
3260 ret = snbep_pci2phy_map_init(0x0e1e);
3261 if (ret)
3262 return ret;
3263 pci_uncores = ivt_pci_uncores;
3264 uncore_pci_driver = &ivt_uncore_pci_driver;
3265 break;
2596 default: 3266 default:
2597 return 0; 3267 return 0;
2598 } 3268 }
@@ -2622,6 +3292,21 @@ static void __init uncore_pci_exit(void)
2622 } 3292 }
2623} 3293}
2624 3294
3295/* CPU hot plug/unplug are serialized by cpu_add_remove_lock mutex */
3296static LIST_HEAD(boxes_to_free);
3297
3298static void __cpuinit uncore_kfree_boxes(void)
3299{
3300 struct intel_uncore_box *box;
3301
3302 while (!list_empty(&boxes_to_free)) {
3303 box = list_entry(boxes_to_free.next,
3304 struct intel_uncore_box, list);
3305 list_del(&box->list);
3306 kfree(box);
3307 }
3308}
3309
2625static void __cpuinit uncore_cpu_dying(int cpu) 3310static void __cpuinit uncore_cpu_dying(int cpu)
2626{ 3311{
2627 struct intel_uncore_type *type; 3312 struct intel_uncore_type *type;
@@ -2636,7 +3321,7 @@ static void __cpuinit uncore_cpu_dying(int cpu)
2636 box = *per_cpu_ptr(pmu->box, cpu); 3321 box = *per_cpu_ptr(pmu->box, cpu);
2637 *per_cpu_ptr(pmu->box, cpu) = NULL; 3322 *per_cpu_ptr(pmu->box, cpu) = NULL;
2638 if (box && atomic_dec_and_test(&box->refcnt)) 3323 if (box && atomic_dec_and_test(&box->refcnt))
2639 kfree(box); 3324 list_add(&box->list, &boxes_to_free);
2640 } 3325 }
2641 } 3326 }
2642} 3327}
@@ -2666,8 +3351,11 @@ static int __cpuinit uncore_cpu_starting(int cpu)
2666 if (exist && exist->phys_id == phys_id) { 3351 if (exist && exist->phys_id == phys_id) {
2667 atomic_inc(&exist->refcnt); 3352 atomic_inc(&exist->refcnt);
2668 *per_cpu_ptr(pmu->box, cpu) = exist; 3353 *per_cpu_ptr(pmu->box, cpu) = exist;
2669 kfree(box); 3354 if (box) {
2670 box = NULL; 3355 list_add(&box->list,
3356 &boxes_to_free);
3357 box = NULL;
3358 }
2671 break; 3359 break;
2672 } 3360 }
2673 } 3361 }
@@ -2806,6 +3494,10 @@ static int
2806 case CPU_DYING: 3494 case CPU_DYING:
2807 uncore_cpu_dying(cpu); 3495 uncore_cpu_dying(cpu);
2808 break; 3496 break;
3497 case CPU_ONLINE:
3498 case CPU_DEAD:
3499 uncore_kfree_boxes();
3500 break;
2809 default: 3501 default:
2810 break; 3502 break;
2811 } 3503 }
@@ -2853,11 +3545,12 @@ static int __init uncore_cpu_init(void)
2853 msr_uncores = nhm_msr_uncores; 3545 msr_uncores = nhm_msr_uncores;
2854 break; 3546 break;
2855 case 42: /* Sandy Bridge */ 3547 case 42: /* Sandy Bridge */
3548 case 58: /* Ivy Bridge */
2856 if (snb_uncore_cbox.num_boxes > max_cores) 3549 if (snb_uncore_cbox.num_boxes > max_cores)
2857 snb_uncore_cbox.num_boxes = max_cores; 3550 snb_uncore_cbox.num_boxes = max_cores;
2858 msr_uncores = snb_msr_uncores; 3551 msr_uncores = snb_msr_uncores;
2859 break; 3552 break;
2860 case 45: /* Sandy Birdge-EP */ 3553 case 45: /* Sandy Bridge-EP */
2861 if (snbep_uncore_cbox.num_boxes > max_cores) 3554 if (snbep_uncore_cbox.num_boxes > max_cores)
2862 snbep_uncore_cbox.num_boxes = max_cores; 3555 snbep_uncore_cbox.num_boxes = max_cores;
2863 msr_uncores = snbep_msr_uncores; 3556 msr_uncores = snbep_msr_uncores;
@@ -2871,6 +3564,12 @@ static int __init uncore_cpu_init(void)
2871 nhmex_uncore_cbox.num_boxes = max_cores; 3564 nhmex_uncore_cbox.num_boxes = max_cores;
2872 msr_uncores = nhmex_msr_uncores; 3565 msr_uncores = nhmex_msr_uncores;
2873 break; 3566 break;
3567 case 62: /* IvyTown */
3568 if (ivt_uncore_cbox.num_boxes > max_cores)
3569 ivt_uncore_cbox.num_boxes = max_cores;
3570 msr_uncores = ivt_msr_uncores;
3571 break;
3572
2874 default: 3573 default:
2875 return 0; 3574 return 0;
2876 } 3575 }
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index e68a4550e952..f9528917f6e8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -76,7 +76,7 @@
76#define SNBEP_PMON_CTL_UMASK_MASK 0x0000ff00 76#define SNBEP_PMON_CTL_UMASK_MASK 0x0000ff00
77#define SNBEP_PMON_CTL_RST (1 << 17) 77#define SNBEP_PMON_CTL_RST (1 << 17)
78#define SNBEP_PMON_CTL_EDGE_DET (1 << 18) 78#define SNBEP_PMON_CTL_EDGE_DET (1 << 18)
79#define SNBEP_PMON_CTL_EV_SEL_EXT (1 << 21) /* only for QPI */ 79#define SNBEP_PMON_CTL_EV_SEL_EXT (1 << 21)
80#define SNBEP_PMON_CTL_EN (1 << 22) 80#define SNBEP_PMON_CTL_EN (1 << 22)
81#define SNBEP_PMON_CTL_INVERT (1 << 23) 81#define SNBEP_PMON_CTL_INVERT (1 << 23)
82#define SNBEP_PMON_CTL_TRESH_MASK 0xff000000 82#define SNBEP_PMON_CTL_TRESH_MASK 0xff000000
@@ -148,9 +148,20 @@
148#define SNBEP_C0_MSR_PMON_CTL0 0xd10 148#define SNBEP_C0_MSR_PMON_CTL0 0xd10
149#define SNBEP_C0_MSR_PMON_BOX_CTL 0xd04 149#define SNBEP_C0_MSR_PMON_BOX_CTL 0xd04
150#define SNBEP_C0_MSR_PMON_BOX_FILTER 0xd14 150#define SNBEP_C0_MSR_PMON_BOX_FILTER 0xd14
151#define SNBEP_CB0_MSR_PMON_BOX_FILTER_MASK 0xfffffc1f
152#define SNBEP_CBO_MSR_OFFSET 0x20 151#define SNBEP_CBO_MSR_OFFSET 0x20
153 152
153#define SNBEP_CB0_MSR_PMON_BOX_FILTER_TID 0x1f
154#define SNBEP_CB0_MSR_PMON_BOX_FILTER_NID 0x3fc00
155#define SNBEP_CB0_MSR_PMON_BOX_FILTER_STATE 0x7c0000
156#define SNBEP_CB0_MSR_PMON_BOX_FILTER_OPC 0xff800000
157
158#define SNBEP_CBO_EVENT_EXTRA_REG(e, m, i) { \
159 .event = (e), \
160 .msr = SNBEP_C0_MSR_PMON_BOX_FILTER, \
161 .config_mask = (m), \
162 .idx = (i) \
163}
164
154/* SNB-EP PCU register */ 165/* SNB-EP PCU register */
155#define SNBEP_PCU_MSR_PMON_CTR0 0xc36 166#define SNBEP_PCU_MSR_PMON_CTR0 0xc36
156#define SNBEP_PCU_MSR_PMON_CTL0 0xc30 167#define SNBEP_PCU_MSR_PMON_CTL0 0xc30
@@ -160,6 +171,55 @@
160#define SNBEP_PCU_MSR_CORE_C3_CTR 0x3fc 171#define SNBEP_PCU_MSR_CORE_C3_CTR 0x3fc
161#define SNBEP_PCU_MSR_CORE_C6_CTR 0x3fd 172#define SNBEP_PCU_MSR_CORE_C6_CTR 0x3fd
162 173
174/* IVT event control */
175#define IVT_PMON_BOX_CTL_INT (SNBEP_PMON_BOX_CTL_RST_CTRL | \
176 SNBEP_PMON_BOX_CTL_RST_CTRS)
177#define IVT_PMON_RAW_EVENT_MASK (SNBEP_PMON_CTL_EV_SEL_MASK | \
178 SNBEP_PMON_CTL_UMASK_MASK | \
179 SNBEP_PMON_CTL_EDGE_DET | \
180 SNBEP_PMON_CTL_TRESH_MASK)
181/* IVT Ubox */
182#define IVT_U_MSR_PMON_GLOBAL_CTL 0xc00
183#define IVT_U_PMON_GLOBAL_FRZ_ALL (1 << 31)
184#define IVT_U_PMON_GLOBAL_UNFRZ_ALL (1 << 29)
185
186#define IVT_U_MSR_PMON_RAW_EVENT_MASK \
187 (SNBEP_PMON_CTL_EV_SEL_MASK | \
188 SNBEP_PMON_CTL_UMASK_MASK | \
189 SNBEP_PMON_CTL_EDGE_DET | \
190 SNBEP_U_MSR_PMON_CTL_TRESH_MASK)
191/* IVT Cbo */
192#define IVT_CBO_MSR_PMON_RAW_EVENT_MASK (IVT_PMON_RAW_EVENT_MASK | \
193 SNBEP_CBO_PMON_CTL_TID_EN)
194
195#define IVT_CB0_MSR_PMON_BOX_FILTER_TID (0x1fULL << 0)
196#define IVT_CB0_MSR_PMON_BOX_FILTER_LINK (0xfULL << 5)
197#define IVT_CB0_MSR_PMON_BOX_FILTER_STATE (0x3fULL << 17)
198#define IVT_CB0_MSR_PMON_BOX_FILTER_NID (0xffffULL << 32)
199#define IVT_CB0_MSR_PMON_BOX_FILTER_OPC (0x1ffULL << 52)
200#define IVT_CB0_MSR_PMON_BOX_FILTER_C6 (0x1ULL << 61)
201#define IVT_CB0_MSR_PMON_BOX_FILTER_NC (0x1ULL << 62)
202#define IVT_CB0_MSR_PMON_BOX_FILTER_IOSC (0x1ULL << 63)
203
204/* IVT home agent */
205#define IVT_HA_PCI_PMON_CTL_Q_OCC_RST (1 << 16)
206#define IVT_HA_PCI_PMON_RAW_EVENT_MASK \
207 (IVT_PMON_RAW_EVENT_MASK | \
208 IVT_HA_PCI_PMON_CTL_Q_OCC_RST)
209/* IVT PCU */
210#define IVT_PCU_MSR_PMON_RAW_EVENT_MASK \
211 (SNBEP_PMON_CTL_EV_SEL_MASK | \
212 SNBEP_PMON_CTL_EV_SEL_EXT | \
213 SNBEP_PCU_MSR_PMON_CTL_OCC_SEL_MASK | \
214 SNBEP_PMON_CTL_EDGE_DET | \
215 SNBEP_PCU_MSR_PMON_CTL_TRESH_MASK | \
216 SNBEP_PCU_MSR_PMON_CTL_OCC_INVERT | \
217 SNBEP_PCU_MSR_PMON_CTL_OCC_EDGE_DET)
218/* IVT QPI */
219#define IVT_QPI_PCI_PMON_RAW_EVENT_MASK \
220 (IVT_PMON_RAW_EVENT_MASK | \
221 SNBEP_PMON_CTL_EV_SEL_EXT)
222
163/* NHM-EX event control */ 223/* NHM-EX event control */
164#define NHMEX_PMON_CTL_EV_SEL_MASK 0x000000ff 224#define NHMEX_PMON_CTL_EV_SEL_MASK 0x000000ff
165#define NHMEX_PMON_CTL_UMASK_MASK 0x0000ff00 225#define NHMEX_PMON_CTL_UMASK_MASK 0x0000ff00
diff --git a/arch/x86/kernel/cpu/perf_event_knc.c b/arch/x86/kernel/cpu/perf_event_knc.c
index 4b7731bf23a8..838fa8772c62 100644
--- a/arch/x86/kernel/cpu/perf_event_knc.c
+++ b/arch/x86/kernel/cpu/perf_event_knc.c
@@ -17,7 +17,7 @@ static const u64 knc_perfmon_event_map[] =
17 [PERF_COUNT_HW_BRANCH_MISSES] = 0x002b, 17 [PERF_COUNT_HW_BRANCH_MISSES] = 0x002b,
18}; 18};
19 19
20static __initconst u64 knc_hw_cache_event_ids 20static const u64 __initconst knc_hw_cache_event_ids
21 [PERF_COUNT_HW_CACHE_MAX] 21 [PERF_COUNT_HW_CACHE_MAX]
22 [PERF_COUNT_HW_CACHE_OP_MAX] 22 [PERF_COUNT_HW_CACHE_OP_MAX]
23 [PERF_COUNT_HW_CACHE_RESULT_MAX] = 23 [PERF_COUNT_HW_CACHE_RESULT_MAX] =
@@ -284,7 +284,7 @@ static struct attribute *intel_knc_formats_attr[] = {
284 NULL, 284 NULL,
285}; 285};
286 286
287static __initconst struct x86_pmu knc_pmu = { 287static const struct x86_pmu knc_pmu __initconst = {
288 .name = "knc", 288 .name = "knc",
289 .handle_irq = knc_pmu_handle_irq, 289 .handle_irq = knc_pmu_handle_irq,
290 .disable_all = knc_pmu_disable_all, 290 .disable_all = knc_pmu_disable_all,
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index 92c7e39a079f..3486e6660357 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -895,8 +895,8 @@ static void p4_pmu_disable_pebs(void)
895 * So at moment let leave metrics turned on forever -- it's 895 * So at moment let leave metrics turned on forever -- it's
896 * ok for now but need to be revisited! 896 * ok for now but need to be revisited!
897 * 897 *
898 * (void)wrmsrl_safe(MSR_IA32_PEBS_ENABLE, (u64)0); 898 * (void)wrmsrl_safe(MSR_IA32_PEBS_ENABLE, 0);
899 * (void)wrmsrl_safe(MSR_P4_PEBS_MATRIX_VERT, (u64)0); 899 * (void)wrmsrl_safe(MSR_P4_PEBS_MATRIX_VERT, 0);
900 */ 900 */
901} 901}
902 902
@@ -910,8 +910,7 @@ static inline void p4_pmu_disable_event(struct perf_event *event)
910 * asserted again and again 910 * asserted again and again
911 */ 911 */
912 (void)wrmsrl_safe(hwc->config_base, 912 (void)wrmsrl_safe(hwc->config_base,
913 (u64)(p4_config_unpack_cccr(hwc->config)) & 913 p4_config_unpack_cccr(hwc->config) & ~P4_CCCR_ENABLE & ~P4_CCCR_OVF & ~P4_CCCR_RESERVED);
914 ~P4_CCCR_ENABLE & ~P4_CCCR_OVF & ~P4_CCCR_RESERVED);
915} 914}
916 915
917static void p4_pmu_disable_all(void) 916static void p4_pmu_disable_all(void)
@@ -957,7 +956,7 @@ static void p4_pmu_enable_event(struct perf_event *event)
957 u64 escr_addr, cccr; 956 u64 escr_addr, cccr;
958 957
959 bind = &p4_event_bind_map[idx]; 958 bind = &p4_event_bind_map[idx];
960 escr_addr = (u64)bind->escr_msr[thread]; 959 escr_addr = bind->escr_msr[thread];
961 960
962 /* 961 /*
963 * - we dont support cascaded counters yet 962 * - we dont support cascaded counters yet
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
index 4820c232a0b9..b1e2fe115323 100644
--- a/arch/x86/kernel/cpu/perf_event_p6.c
+++ b/arch/x86/kernel/cpu/perf_event_p6.c
@@ -19,7 +19,7 @@ static const u64 p6_perfmon_event_map[] =
19 19
20}; 20};
21 21
22static u64 p6_hw_cache_event_ids 22static const u64 __initconst p6_hw_cache_event_ids
23 [PERF_COUNT_HW_CACHE_MAX] 23 [PERF_COUNT_HW_CACHE_MAX]
24 [PERF_COUNT_HW_CACHE_OP_MAX] 24 [PERF_COUNT_HW_CACHE_OP_MAX]
25 [PERF_COUNT_HW_CACHE_RESULT_MAX] = 25 [PERF_COUNT_HW_CACHE_RESULT_MAX] =
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index e280253f6f94..37a198bd48c8 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -34,9 +34,9 @@ static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c)
34 "fpu_exception\t: %s\n" 34 "fpu_exception\t: %s\n"
35 "cpuid level\t: %d\n" 35 "cpuid level\t: %d\n"
36 "wp\t\t: %s\n", 36 "wp\t\t: %s\n",
37 c->fdiv_bug ? "yes" : "no", 37 static_cpu_has_bug(X86_BUG_FDIV) ? "yes" : "no",
38 c->f00f_bug ? "yes" : "no", 38 static_cpu_has_bug(X86_BUG_F00F) ? "yes" : "no",
39 c->coma_bug ? "yes" : "no", 39 static_cpu_has_bug(X86_BUG_COMA) ? "yes" : "no",
40 c->hard_math ? "yes" : "no", 40 c->hard_math ? "yes" : "no",
41 c->hard_math ? "yes" : "no", 41 c->hard_math ? "yes" : "no",
42 c->cpuid_level, 42 c->cpuid_level,
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index ee8e9abc859f..d92b5dad15dd 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -39,8 +39,9 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
39 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006, 0 }, 39 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006, 0 },
40 { X86_FEATURE_EPB, CR_ECX, 3, 0x00000006, 0 }, 40 { X86_FEATURE_EPB, CR_ECX, 3, 0x00000006, 0 },
41 { X86_FEATURE_XSAVEOPT, CR_EAX, 0, 0x0000000d, 1 }, 41 { X86_FEATURE_XSAVEOPT, CR_EAX, 0, 0x0000000d, 1 },
42 { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007, 0 },
43 { X86_FEATURE_HW_PSTATE, CR_EDX, 7, 0x80000007, 0 }, 42 { X86_FEATURE_HW_PSTATE, CR_EDX, 7, 0x80000007, 0 },
43 { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007, 0 },
44 { X86_FEATURE_PROC_FEEDBACK, CR_EDX,11, 0x80000007, 0 },
44 { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a, 0 }, 45 { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a, 0 },
45 { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a, 0 }, 46 { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a, 0 },
46 { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a, 0 }, 47 { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a, 0 },
diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
index 37250fe490b1..155a13f33ed8 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault_32.c
@@ -20,7 +20,7 @@ static void doublefault_fn(void)
20 struct desc_ptr gdt_desc = {0, 0}; 20 struct desc_ptr gdt_desc = {0, 0};
21 unsigned long gdt, tss; 21 unsigned long gdt, tss;
22 22
23 store_gdt(&gdt_desc); 23 native_store_gdt(&gdt_desc);
24 gdt = gdt_desc.address; 24 gdt = gdt_desc.address;
25 25
26 printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size); 26 printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index c8797d55b245..deb6421c9e69 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -176,26 +176,20 @@ void show_trace(struct task_struct *task, struct pt_regs *regs,
176 176
177void show_stack(struct task_struct *task, unsigned long *sp) 177void show_stack(struct task_struct *task, unsigned long *sp)
178{ 178{
179 show_stack_log_lvl(task, NULL, sp, 0, ""); 179 unsigned long bp = 0;
180}
181
182/*
183 * The architecture-independent dump_stack generator
184 */
185void dump_stack(void)
186{
187 unsigned long bp;
188 unsigned long stack; 180 unsigned long stack;
189 181
190 bp = stack_frame(current, NULL); 182 /*
191 printk("Pid: %d, comm: %.20s %s %s %.*s\n", 183 * Stack frames below this one aren't interesting. Don't show them
192 current->pid, current->comm, print_tainted(), 184 * if we're printing for %current.
193 init_utsname()->release, 185 */
194 (int)strcspn(init_utsname()->version, " "), 186 if (!sp && (!task || task == current)) {
195 init_utsname()->version); 187 sp = &stack;
196 show_trace(NULL, NULL, &stack, bp); 188 bp = stack_frame(current, NULL);
189 }
190
191 show_stack_log_lvl(task, NULL, sp, bp, "");
197} 192}
198EXPORT_SYMBOL(dump_stack);
199 193
200static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED; 194static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
201static int die_owner = -1; 195static int die_owner = -1;
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 1038a417ea53..f2a1770ca176 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -86,11 +86,9 @@ void show_regs(struct pt_regs *regs)
86{ 86{
87 int i; 87 int i;
88 88
89 show_regs_print_info(KERN_EMERG);
89 __show_regs(regs, !user_mode_vm(regs)); 90 __show_regs(regs, !user_mode_vm(regs));
90 91
91 pr_emerg("Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n",
92 TASK_COMM_LEN, current->comm, task_pid_nr(current),
93 current_thread_info(), current, task_thread_info(current));
94 /* 92 /*
95 * When in-kernel, we also print out the stack and code at the 93 * When in-kernel, we also print out the stack and code at the
96 * time of the fault.. 94 * time of the fault..
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index b653675d5288..addb207dab92 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -249,14 +249,10 @@ void show_regs(struct pt_regs *regs)
249{ 249{
250 int i; 250 int i;
251 unsigned long sp; 251 unsigned long sp;
252 const int cpu = smp_processor_id();
253 struct task_struct *cur = current;
254 252
255 sp = regs->sp; 253 sp = regs->sp;
256 printk("CPU %d ", cpu); 254 show_regs_print_info(KERN_DEFAULT);
257 __show_regs(regs, 1); 255 __show_regs(regs, 1);
258 printk(KERN_DEFAULT "Process %s (pid: %d, threadinfo %p, task %p)\n",
259 cur->comm, cur->pid, task_thread_info(cur), cur);
260 256
261 /* 257 /*
262 * When in-kernel, we also print out the stack and code at the 258 * When in-kernel, we also print out the stack and code at the
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 3755ef494390..94ab6b90dd3f 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -18,6 +18,7 @@
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/iommu.h> 19#include <asm/iommu.h>
20#include <asm/gart.h> 20#include <asm/gart.h>
21#include <asm/irq_remapping.h>
21 22
22static void __init fix_hypertransport_config(int num, int slot, int func) 23static void __init fix_hypertransport_config(int num, int slot, int func)
23{ 24{
@@ -192,6 +193,21 @@ static void __init ati_bugs_contd(int num, int slot, int func)
192} 193}
193#endif 194#endif
194 195
196static void __init intel_remapping_check(int num, int slot, int func)
197{
198 u8 revision;
199
200 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID);
201
202 /*
203 * Revision 0x13 of this chipset supports irq remapping
204 * but has an erratum that breaks its behavior, flag it as such
205 */
206 if (revision == 0x13)
207 set_irq_remapping_broken();
208
209}
210
195#define QFLAG_APPLY_ONCE 0x1 211#define QFLAG_APPLY_ONCE 0x1
196#define QFLAG_APPLIED 0x2 212#define QFLAG_APPLIED 0x2
197#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) 213#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -221,6 +237,10 @@ static struct chipset early_qrk[] __initdata = {
221 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, 237 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
222 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, 238 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
223 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, 239 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
240 { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST,
241 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
242 { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST,
243 PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check },
224 {} 244 {}
225}; 245};
226 246
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 9b9f18b49918..d15f575a861b 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -169,25 +169,9 @@ static struct console early_serial_console = {
169 .index = -1, 169 .index = -1,
170}; 170};
171 171
172/* Direct interface for emergencies */
173static struct console *early_console = &early_vga_console;
174static int __initdata early_console_initialized;
175
176asmlinkage void early_printk(const char *fmt, ...)
177{
178 char buf[512];
179 int n;
180 va_list ap;
181
182 va_start(ap, fmt);
183 n = vscnprintf(buf, sizeof(buf), fmt, ap);
184 early_console->write(early_console, buf, n);
185 va_end(ap);
186}
187
188static inline void early_console_register(struct console *con, int keep_early) 172static inline void early_console_register(struct console *con, int keep_early)
189{ 173{
190 if (early_console->index != -1) { 174 if (con->index != -1) {
191 printk(KERN_CRIT "ERROR: earlyprintk= %s already used\n", 175 printk(KERN_CRIT "ERROR: earlyprintk= %s already used\n",
192 con->name); 176 con->name);
193 return; 177 return;
@@ -207,9 +191,8 @@ static int __init setup_early_printk(char *buf)
207 if (!buf) 191 if (!buf)
208 return 0; 192 return 0;
209 193
210 if (early_console_initialized) 194 if (early_console)
211 return 0; 195 return 0;
212 early_console_initialized = 1;
213 196
214 keep = (strstr(buf, "keep") != NULL); 197 keep = (strstr(buf, "keep") != NULL);
215 198
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index c1d01e6ca790..727208941030 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1166,6 +1166,11 @@ apicinterrupt LOCAL_TIMER_VECTOR \
1166apicinterrupt X86_PLATFORM_IPI_VECTOR \ 1166apicinterrupt X86_PLATFORM_IPI_VECTOR \
1167 x86_platform_ipi smp_x86_platform_ipi 1167 x86_platform_ipi smp_x86_platform_ipi
1168 1168
1169#ifdef CONFIG_HAVE_KVM
1170apicinterrupt POSTED_INTR_VECTOR \
1171 kvm_posted_intr_ipi smp_kvm_posted_intr_ipi
1172#endif
1173
1169apicinterrupt THRESHOLD_APIC_VECTOR \ 1174apicinterrupt THRESHOLD_APIC_VECTOR \
1170 threshold_interrupt smp_threshold_interrupt 1175 threshold_interrupt smp_threshold_interrupt
1171apicinterrupt THERMAL_APIC_VECTOR \ 1176apicinterrupt THERMAL_APIC_VECTOR \
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index c5e403f6d869..dab95a85f7f8 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -34,6 +34,7 @@
34extern pgd_t early_level4_pgt[PTRS_PER_PGD]; 34extern pgd_t early_level4_pgt[PTRS_PER_PGD];
35extern pmd_t early_dynamic_pgts[EARLY_DYNAMIC_PAGE_TABLES][PTRS_PER_PMD]; 35extern pmd_t early_dynamic_pgts[EARLY_DYNAMIC_PAGE_TABLES][PTRS_PER_PMD];
36static unsigned int __initdata next_early_pgt = 2; 36static unsigned int __initdata next_early_pgt = 2;
37pmdval_t __initdata early_pmd_flags = __PAGE_KERNEL_LARGE & ~(_PAGE_GLOBAL | _PAGE_NX);
37 38
38/* Wipe all early page tables except for the kernel symbol map */ 39/* Wipe all early page tables except for the kernel symbol map */
39static void __init reset_early_page_tables(void) 40static void __init reset_early_page_tables(void)
@@ -99,7 +100,7 @@ again:
99 pmd_p[i] = 0; 100 pmd_p[i] = 0;
100 *pud_p = (pudval_t)pmd_p - __START_KERNEL_map + phys_base + _KERNPG_TABLE; 101 *pud_p = (pudval_t)pmd_p - __START_KERNEL_map + phys_base + _KERNPG_TABLE;
101 } 102 }
102 pmd = (physaddr & PMD_MASK) + (__PAGE_KERNEL_LARGE & ~_PAGE_GLOBAL); 103 pmd = (physaddr & PMD_MASK) + early_pmd_flags;
103 pmd_p[pmd_index(address)] = pmd; 104 pmd_p[pmd_index(address)] = pmd;
104 105
105 return 0; 106 return 0;
@@ -144,10 +145,10 @@ void __init x86_64_start_kernel(char * real_mode_data)
144 * Build-time sanity checks on the kernel image and module 145 * Build-time sanity checks on the kernel image and module
145 * area mappings. (these are purely build-time and produce no code) 146 * area mappings. (these are purely build-time and produce no code)
146 */ 147 */
147 BUILD_BUG_ON(MODULES_VADDR < KERNEL_IMAGE_START); 148 BUILD_BUG_ON(MODULES_VADDR < __START_KERNEL_map);
148 BUILD_BUG_ON(MODULES_VADDR-KERNEL_IMAGE_START < KERNEL_IMAGE_SIZE); 149 BUILD_BUG_ON(MODULES_VADDR - __START_KERNEL_map < KERNEL_IMAGE_SIZE);
149 BUILD_BUG_ON(MODULES_LEN + KERNEL_IMAGE_SIZE > 2*PUD_SIZE); 150 BUILD_BUG_ON(MODULES_LEN + KERNEL_IMAGE_SIZE > 2*PUD_SIZE);
150 BUILD_BUG_ON((KERNEL_IMAGE_START & ~PMD_MASK) != 0); 151 BUILD_BUG_ON((__START_KERNEL_map & ~PMD_MASK) != 0);
151 BUILD_BUG_ON((MODULES_VADDR & ~PMD_MASK) != 0); 152 BUILD_BUG_ON((MODULES_VADDR & ~PMD_MASK) != 0);
152 BUILD_BUG_ON(!(MODULES_VADDR > __START_KERNEL)); 153 BUILD_BUG_ON(!(MODULES_VADDR > __START_KERNEL));
153 BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == 154 BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) ==
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 6859e9626442..08f7e8039099 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -200,6 +200,7 @@ ENTRY(secondary_startup_64)
200 btl $20,%edi /* No Execute supported? */ 200 btl $20,%edi /* No Execute supported? */
201 jnc 1f 201 jnc 1f
202 btsl $_EFER_NX, %eax 202 btsl $_EFER_NX, %eax
203 btsq $_PAGE_BIT_NX,early_pmd_flags(%rip)
2031: wrmsr /* Make changes effective */ 2041: wrmsr /* Make changes effective */
204 205
205 /* Setup cr0 */ 206 /* Setup cr0 */
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index e4595f105910..ac0631d8996f 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -165,10 +165,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
165u64 arch_irq_stat(void) 165u64 arch_irq_stat(void)
166{ 166{
167 u64 sum = atomic_read(&irq_err_count); 167 u64 sum = atomic_read(&irq_err_count);
168
169#ifdef CONFIG_X86_IO_APIC
170 sum += atomic_read(&irq_mis_count);
171#endif
172 return sum; 168 return sum;
173} 169}
174 170
@@ -228,6 +224,28 @@ void smp_x86_platform_ipi(struct pt_regs *regs)
228 set_irq_regs(old_regs); 224 set_irq_regs(old_regs);
229} 225}
230 226
227#ifdef CONFIG_HAVE_KVM
228/*
229 * Handler for POSTED_INTERRUPT_VECTOR.
230 */
231void smp_kvm_posted_intr_ipi(struct pt_regs *regs)
232{
233 struct pt_regs *old_regs = set_irq_regs(regs);
234
235 ack_APIC_irq();
236
237 irq_enter();
238
239 exit_idle();
240
241 inc_irq_stat(kvm_posted_intr_ipis);
242
243 irq_exit();
244
245 set_irq_regs(old_regs);
246}
247#endif
248
231EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); 249EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
232 250
233#ifdef CONFIG_HOTPLUG_CPU 251#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 7dc4e459c2b3..a2a1fbc594ff 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -172,6 +172,10 @@ static void __init apic_intr_init(void)
172 172
173 /* IPI for X86 platform specific use */ 173 /* IPI for X86 platform specific use */
174 alloc_intr_gate(X86_PLATFORM_IPI_VECTOR, x86_platform_ipi); 174 alloc_intr_gate(X86_PLATFORM_IPI_VECTOR, x86_platform_ipi);
175#ifdef CONFIG_HAVE_KVM
176 /* IPI for KVM to deliver posted interrupt */
177 alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi);
178#endif
175 179
176 /* IPI vectors for APIC spurious and error interrupts */ 180 /* IPI vectors for APIC spurious and error interrupts */
177 alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); 181 alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 7bfe318d3d8a..9895a9a41380 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -353,7 +353,11 @@ int __kprobes __copy_instruction(u8 *dest, u8 *src)
353 * have given. 353 * have given.
354 */ 354 */
355 newdisp = (u8 *) src + (s64) insn.displacement.value - (u8 *) dest; 355 newdisp = (u8 *) src + (s64) insn.displacement.value - (u8 *) dest;
356 BUG_ON((s64) (s32) newdisp != newdisp); /* Sanity check. */ 356 if ((s64) (s32) newdisp != newdisp) {
357 pr_err("Kprobes error: new displacement does not fit into s32 (%llx)\n", newdisp);
358 pr_err("\tSrc: %p, Dest: %p, old disp: %x\n", src, dest, insn.displacement.value);
359 return 0;
360 }
357 disp = (u8 *) dest + insn_offset_displacement(&insn); 361 disp = (u8 *) dest + insn_offset_displacement(&insn);
358 *(s32 *) disp = (s32) newdisp; 362 *(s32 *) disp = (s32) newdisp;
359 } 363 }
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index b686a904d7c3..cd6d9a5a42f6 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -20,6 +20,7 @@
20 * Authors: Anthony Liguori <aliguori@us.ibm.com> 20 * Authors: Anthony Liguori <aliguori@us.ibm.com>
21 */ 21 */
22 22
23#include <linux/context_tracking.h>
23#include <linux/module.h> 24#include <linux/module.h>
24#include <linux/kernel.h> 25#include <linux/kernel.h>
25#include <linux/kvm_para.h> 26#include <linux/kvm_para.h>
@@ -43,7 +44,6 @@
43#include <asm/apicdef.h> 44#include <asm/apicdef.h>
44#include <asm/hypervisor.h> 45#include <asm/hypervisor.h>
45#include <asm/kvm_guest.h> 46#include <asm/kvm_guest.h>
46#include <asm/context_tracking.h>
47 47
48static int kvmapf = 1; 48static int kvmapf = 1;
49 49
@@ -254,16 +254,18 @@ EXPORT_SYMBOL_GPL(kvm_read_and_reset_pf_reason);
254dotraplinkage void __kprobes 254dotraplinkage void __kprobes
255do_async_page_fault(struct pt_regs *regs, unsigned long error_code) 255do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
256{ 256{
257 enum ctx_state prev_state;
258
257 switch (kvm_read_and_reset_pf_reason()) { 259 switch (kvm_read_and_reset_pf_reason()) {
258 default: 260 default:
259 do_page_fault(regs, error_code); 261 do_page_fault(regs, error_code);
260 break; 262 break;
261 case KVM_PV_REASON_PAGE_NOT_PRESENT: 263 case KVM_PV_REASON_PAGE_NOT_PRESENT:
262 /* page is swapped out by the host. */ 264 /* page is swapped out by the host. */
263 exception_enter(regs); 265 prev_state = exception_enter();
264 exit_idle(); 266 exit_idle();
265 kvm_async_pf_task_wait((u32)read_cr2()); 267 kvm_async_pf_task_wait((u32)read_cr2());
266 exception_exit(regs); 268 exception_exit(prev_state);
267 break; 269 break;
268 case KVM_PV_REASON_PAGE_READY: 270 case KVM_PV_REASON_PAGE_READY:
269 rcu_irq_enter(); 271 rcu_irq_enter();
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 0732f0089a3d..d2c381280e3c 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -160,8 +160,12 @@ int kvm_register_clock(char *txt)
160{ 160{
161 int cpu = smp_processor_id(); 161 int cpu = smp_processor_id();
162 int low, high, ret; 162 int low, high, ret;
163 struct pvclock_vcpu_time_info *src = &hv_clock[cpu].pvti; 163 struct pvclock_vcpu_time_info *src;
164
165 if (!hv_clock)
166 return 0;
164 167
168 src = &hv_clock[cpu].pvti;
165 low = (int)slow_virt_to_phys(src) | 1; 169 low = (int)slow_virt_to_phys(src) | 1;
166 high = ((u64)slow_virt_to_phys(src) >> 32); 170 high = ((u64)slow_virt_to_phys(src) >> 32);
167 ret = native_write_msr_safe(msr_kvm_system_time, low, high); 171 ret = native_write_msr_safe(msr_kvm_system_time, low, high);
@@ -276,6 +280,9 @@ int __init kvm_setup_vsyscall_timeinfo(void)
276 struct pvclock_vcpu_time_info *vcpu_time; 280 struct pvclock_vcpu_time_info *vcpu_time;
277 unsigned int size; 281 unsigned int size;
278 282
283 if (!hv_clock)
284 return 0;
285
279 size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); 286 size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);
280 287
281 preempt_disable(); 288 preempt_disable();
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 8bfb335f74bb..cd6de64cc480 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -360,7 +360,6 @@ struct pv_cpu_ops pv_cpu_ops = {
360 .set_ldt = native_set_ldt, 360 .set_ldt = native_set_ldt,
361 .load_gdt = native_load_gdt, 361 .load_gdt = native_load_gdt,
362 .load_idt = native_load_idt, 362 .load_idt = native_load_idt,
363 .store_gdt = native_store_gdt,
364 .store_idt = native_store_idt, 363 .store_idt = native_store_idt,
365 .store_tr = native_store_tr, 364 .store_tr = native_store_tr,
366 .load_tls = native_load_tls, 365 .load_tls = native_load_tls,
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 14ae10031ff0..607af0d4d5ef 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -121,30 +121,6 @@ void exit_thread(void)
121 drop_fpu(me); 121 drop_fpu(me);
122} 122}
123 123
124void show_regs_common(void)
125{
126 const char *vendor, *product, *board;
127
128 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
129 if (!vendor)
130 vendor = "";
131 product = dmi_get_system_info(DMI_PRODUCT_NAME);
132 if (!product)
133 product = "";
134
135 /* Board Name is optional */
136 board = dmi_get_system_info(DMI_BOARD_NAME);
137
138 printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
139 current->pid, current->comm, print_tainted(),
140 init_utsname()->release,
141 (int)strcspn(init_utsname()->version, " "),
142 init_utsname()->version,
143 vendor, product,
144 board ? "/" : "",
145 board ? board : "");
146}
147
148void flush_thread(void) 124void flush_thread(void)
149{ 125{
150 struct task_struct *tsk = current; 126 struct task_struct *tsk = current;
@@ -301,13 +277,7 @@ void exit_idle(void)
301} 277}
302#endif 278#endif
303 279
304/* 280void arch_cpu_idle_prepare(void)
305 * The idle thread. There's no useful work to be
306 * done, so just try to conserve power and have a
307 * low exit latency (ie sit in a loop waiting for
308 * somebody to say that they'd like to reschedule)
309 */
310void cpu_idle(void)
311{ 281{
312 /* 282 /*
313 * If we're the non-boot CPU, nothing set the stack canary up 283 * If we're the non-boot CPU, nothing set the stack canary up
@@ -317,71 +287,40 @@ void cpu_idle(void)
317 * canaries already on the stack wont ever trigger). 287 * canaries already on the stack wont ever trigger).
318 */ 288 */
319 boot_init_stack_canary(); 289 boot_init_stack_canary();
320 current_thread_info()->status |= TS_POLLING; 290}
321
322 while (1) {
323 tick_nohz_idle_enter();
324
325 while (!need_resched()) {
326 rmb();
327
328 if (cpu_is_offline(smp_processor_id()))
329 play_dead();
330
331 /*
332 * Idle routines should keep interrupts disabled
333 * from here on, until they go to idle.
334 * Otherwise, idle callbacks can misfire.
335 */
336 local_touch_nmi();
337 local_irq_disable();
338
339 enter_idle();
340
341 /* Don't trace irqs off for idle */
342 stop_critical_timings();
343
344 /* enter_idle() needs rcu for notifiers */
345 rcu_idle_enter();
346 291
347 if (cpuidle_idle_call()) 292void arch_cpu_idle_enter(void)
348 x86_idle(); 293{
294 local_touch_nmi();
295 enter_idle();
296}
349 297
350 rcu_idle_exit(); 298void arch_cpu_idle_exit(void)
351 start_critical_timings(); 299{
300 __exit_idle();
301}
352 302
353 /* In many cases the interrupt that ended idle 303void arch_cpu_idle_dead(void)
354 has already called exit_idle. But some idle 304{
355 loops can be woken up without interrupt. */ 305 play_dead();
356 __exit_idle(); 306}
357 }
358 307
359 tick_nohz_idle_exit(); 308/*
360 preempt_enable_no_resched(); 309 * Called from the generic idle code.
361 schedule(); 310 */
362 preempt_disable(); 311void arch_cpu_idle(void)
363 } 312{
313 if (cpuidle_idle_call())
314 x86_idle();
364} 315}
365 316
366/* 317/*
367 * We use this if we don't have any better 318 * We use this if we don't have any better idle routine..
368 * idle routine..
369 */ 319 */
370void default_idle(void) 320void default_idle(void)
371{ 321{
372 trace_cpu_idle_rcuidle(1, smp_processor_id()); 322 trace_cpu_idle_rcuidle(1, smp_processor_id());
373 current_thread_info()->status &= ~TS_POLLING; 323 safe_halt();
374 /*
375 * TS_POLLING-cleared state must be visible before we
376 * test NEED_RESCHED:
377 */
378 smp_mb();
379
380 if (!need_resched())
381 safe_halt(); /* enables interrupts racelessly */
382 else
383 local_irq_enable();
384 current_thread_info()->status |= TS_POLLING;
385 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); 324 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
386} 325}
387#ifdef CONFIG_APM_MODULE 326#ifdef CONFIG_APM_MODULE
@@ -411,20 +350,6 @@ void stop_this_cpu(void *dummy)
411 halt(); 350 halt();
412} 351}
413 352
414/*
415 * On SMP it's slightly faster (but much more power-consuming!)
416 * to poll the ->work.need_resched flag instead of waiting for the
417 * cross-CPU IPI to arrive. Use this option with caution.
418 */
419static void poll_idle(void)
420{
421 trace_cpu_idle_rcuidle(0, smp_processor_id());
422 local_irq_enable();
423 while (!need_resched())
424 cpu_relax();
425 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
426}
427
428bool amd_e400_c1e_detected; 353bool amd_e400_c1e_detected;
429EXPORT_SYMBOL(amd_e400_c1e_detected); 354EXPORT_SYMBOL(amd_e400_c1e_detected);
430 355
@@ -489,13 +414,13 @@ static void amd_e400_idle(void)
489void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 414void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
490{ 415{
491#ifdef CONFIG_SMP 416#ifdef CONFIG_SMP
492 if (x86_idle == poll_idle && smp_num_siblings > 1) 417 if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1)
493 pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n"); 418 pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n");
494#endif 419#endif
495 if (x86_idle) 420 if (x86_idle || boot_option_idle_override == IDLE_POLL)
496 return; 421 return;
497 422
498 if (cpu_has_amd_erratum(amd_erratum_400)) { 423 if (cpu_has_bug(c, X86_BUG_AMD_APIC_C1E)) {
499 /* E400: APIC timer interrupt does not wake up CPU from C1e */ 424 /* E400: APIC timer interrupt does not wake up CPU from C1e */
500 pr_info("using AMD E400 aware idle routine\n"); 425 pr_info("using AMD E400 aware idle routine\n");
501 x86_idle = amd_e400_idle; 426 x86_idle = amd_e400_idle;
@@ -517,8 +442,8 @@ static int __init idle_setup(char *str)
517 442
518 if (!strcmp(str, "poll")) { 443 if (!strcmp(str, "poll")) {
519 pr_info("using polling idle threads\n"); 444 pr_info("using polling idle threads\n");
520 x86_idle = poll_idle;
521 boot_option_idle_override = IDLE_POLL; 445 boot_option_idle_override = IDLE_POLL;
446 cpu_idle_poll_ctrl(true);
522 } else if (!strcmp(str, "halt")) { 447 } else if (!strcmp(str, "halt")) {
523 /* 448 /*
524 * When the boot option of idle=halt is added, halt is 449 * When the boot option of idle=halt is added, halt is
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index b5a8905785e6..7305f7dfc7ab 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -84,8 +84,6 @@ void __show_regs(struct pt_regs *regs, int all)
84 savesegment(gs, gs); 84 savesegment(gs, gs);
85 } 85 }
86 86
87 show_regs_common();
88
89 printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", 87 printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
90 (u16)regs->cs, regs->ip, regs->flags, 88 (u16)regs->cs, regs->ip, regs->flags,
91 smp_processor_id()); 89 smp_processor_id());
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 0f49677da51e..355ae06dbf94 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -62,7 +62,6 @@ void __show_regs(struct pt_regs *regs, int all)
62 unsigned int fsindex, gsindex; 62 unsigned int fsindex, gsindex;
63 unsigned int ds, cs, es; 63 unsigned int ds, cs, es;
64 64
65 show_regs_common();
66 printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); 65 printk(KERN_DEFAULT "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
67 printk_address(regs->ip, 1); 66 printk_address(regs->ip, 1);
68 printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, 67 printk(KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 26ee48a33dc4..04ee1e2e4c02 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -354,18 +354,22 @@ static void ati_force_hpet_resume(void)
354 354
355static u32 ati_ixp4x0_rev(struct pci_dev *dev) 355static u32 ati_ixp4x0_rev(struct pci_dev *dev)
356{ 356{
357 u32 d; 357 int err = 0;
358 u8 b; 358 u32 d = 0;
359 u8 b = 0;
359 360
360 pci_read_config_byte(dev, 0xac, &b); 361 err = pci_read_config_byte(dev, 0xac, &b);
361 b &= ~(1<<5); 362 b &= ~(1<<5);
362 pci_write_config_byte(dev, 0xac, b); 363 err |= pci_write_config_byte(dev, 0xac, b);
363 pci_read_config_dword(dev, 0x70, &d); 364 err |= pci_read_config_dword(dev, 0x70, &d);
364 d |= 1<<8; 365 d |= 1<<8;
365 pci_write_config_dword(dev, 0x70, d); 366 err |= pci_write_config_dword(dev, 0x70, d);
366 pci_read_config_dword(dev, 0x8, &d); 367 err |= pci_read_config_dword(dev, 0x8, &d);
367 d &= 0xff; 368 d &= 0xff;
368 dev_printk(KERN_DEBUG, &dev->dev, "SB4X0 revision 0x%x\n", d); 369 dev_printk(KERN_DEBUG, &dev->dev, "SB4X0 revision 0x%x\n", d);
370
371 WARN_ON_ONCE(err);
372
369 return d; 373 return d;
370} 374}
371 375
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 2e8f3d3b5641..198eb201ed3b 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -13,6 +13,7 @@
13#include <asm/x86_init.h> 13#include <asm/x86_init.h>
14#include <asm/time.h> 14#include <asm/time.h>
15#include <asm/mrst.h> 15#include <asm/mrst.h>
16#include <asm/rtc.h>
16 17
17#ifdef CONFIG_X86_32 18#ifdef CONFIG_X86_32
18/* 19/*
@@ -36,70 +37,24 @@ EXPORT_SYMBOL(rtc_lock);
36 * nowtime is written into the registers of the CMOS clock, it will 37 * nowtime is written into the registers of the CMOS clock, it will
37 * jump to the next second precisely 500 ms later. Check the Motorola 38 * jump to the next second precisely 500 ms later. Check the Motorola
38 * MC146818A or Dallas DS12887 data sheet for details. 39 * MC146818A or Dallas DS12887 data sheet for details.
39 *
40 * BUG: This routine does not handle hour overflow properly; it just
41 * sets the minutes. Usually you'll only notice that after reboot!
42 */ 40 */
43int mach_set_rtc_mmss(unsigned long nowtime) 41int mach_set_rtc_mmss(unsigned long nowtime)
44{ 42{
45 int real_seconds, real_minutes, cmos_minutes; 43 struct rtc_time tm;
46 unsigned char save_control, save_freq_select;
47 unsigned long flags;
48 int retval = 0; 44 int retval = 0;
49 45
50 spin_lock_irqsave(&rtc_lock, flags); 46 rtc_time_to_tm(nowtime, &tm);
51 47 if (!rtc_valid_tm(&tm)) {
52 /* tell the clock it's being set */ 48 retval = set_rtc_time(&tm);
53 save_control = CMOS_READ(RTC_CONTROL); 49 if (retval)
54 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); 50 printk(KERN_ERR "%s: RTC write failed with error %d\n",
55 51 __FUNCTION__, retval);
56 /* stop and reset prescaler */
57 save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
58 CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
59
60 cmos_minutes = CMOS_READ(RTC_MINUTES);
61 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
62 cmos_minutes = bcd2bin(cmos_minutes);
63
64 /*
65 * since we're only adjusting minutes and seconds,
66 * don't interfere with hour overflow. This avoids
67 * messing with unknown time zones but requires your
68 * RTC not to be off by more than 15 minutes
69 */
70 real_seconds = nowtime % 60;
71 real_minutes = nowtime / 60;
72 /* correct for half hour time zone */
73 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
74 real_minutes += 30;
75 real_minutes %= 60;
76
77 if (abs(real_minutes - cmos_minutes) < 30) {
78 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
79 real_seconds = bin2bcd(real_seconds);
80 real_minutes = bin2bcd(real_minutes);
81 }
82 CMOS_WRITE(real_seconds, RTC_SECONDS);
83 CMOS_WRITE(real_minutes, RTC_MINUTES);
84 } else { 52 } else {
85 printk_once(KERN_NOTICE 53 printk(KERN_ERR
86 "set_rtc_mmss: can't update from %d to %d\n", 54 "%s: Invalid RTC value: write of %lx to RTC failed\n",
87 cmos_minutes, real_minutes); 55 __FUNCTION__, nowtime);
88 retval = -1; 56 retval = -EINVAL;
89 } 57 }
90
91 /* The following flags have to be released exactly in this order,
92 * otherwise the DS12887 (popular MC146818A clone with integrated
93 * battery and quartz) will not reset the oscillator and will not
94 * update precisely 500 ms later. You won't find this mentioned in
95 * the Dallas Semiconductor data sheets, but who believes data
96 * sheets anyway ... -- Markus Kuhn
97 */
98 CMOS_WRITE(save_control, RTC_CONTROL);
99 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
100
101 spin_unlock_irqrestore(&rtc_lock, flags);
102
103 return retval; 58 return retval;
104} 59}
105 60
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index fae9134a2de9..56f7fcfe7fa2 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -82,7 +82,6 @@
82#include <asm/timer.h> 82#include <asm/timer.h>
83#include <asm/i8259.h> 83#include <asm/i8259.h>
84#include <asm/sections.h> 84#include <asm/sections.h>
85#include <asm/dmi.h>
86#include <asm/io_apic.h> 85#include <asm/io_apic.h>
87#include <asm/ist.h> 86#include <asm/ist.h>
88#include <asm/setup_arch.h> 87#include <asm/setup_arch.h>
@@ -173,12 +172,10 @@ static struct resource bss_resource = {
173/* cpu data as detected by the assembly code in head.S */ 172/* cpu data as detected by the assembly code in head.S */
174struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 173struct cpuinfo_x86 new_cpu_data __cpuinitdata = {
175 .wp_works_ok = -1, 174 .wp_works_ok = -1,
176 .fdiv_bug = -1,
177}; 175};
178/* common cpu data for all cpus */ 176/* common cpu data for all cpus */
179struct cpuinfo_x86 boot_cpu_data __read_mostly = { 177struct cpuinfo_x86 boot_cpu_data __read_mostly = {
180 .wp_works_ok = -1, 178 .wp_works_ok = -1,
181 .fdiv_bug = -1,
182}; 179};
183EXPORT_SYMBOL(boot_cpu_data); 180EXPORT_SYMBOL(boot_cpu_data);
184 181
@@ -999,6 +996,7 @@ void __init setup_arch(char **cmdline_p)
999 efi_init(); 996 efi_init();
1000 997
1001 dmi_scan_machine(); 998 dmi_scan_machine();
999 dmi_set_dump_stack_arch_desc();
1002 1000
1003 /* 1001 /*
1004 * VMware detection requires dmi to be available, so this 1002 * VMware detection requires dmi to be available, so this
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 9f190a2a00e9..9c73b51817e4 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -284,7 +284,7 @@ notrace static void __cpuinit start_secondary(void *unused)
284 x86_cpuinit.setup_percpu_clockev(); 284 x86_cpuinit.setup_percpu_clockev();
285 285
286 wmb(); 286 wmb();
287 cpu_idle(); 287 cpu_startup_entry(CPUHP_ONLINE);
288} 288}
289 289
290void __init smp_store_boot_cpu_info(void) 290void __init smp_store_boot_cpu_info(void)
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 9d9d2f9e77a5..f7fec09e3e3a 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -3,13 +3,13 @@
3#include <linux/sched.h> 3#include <linux/sched.h>
4#include <linux/user.h> 4#include <linux/user.h>
5#include <linux/regset.h> 5#include <linux/regset.h>
6#include <linux/syscalls.h>
6 7
7#include <asm/uaccess.h> 8#include <asm/uaccess.h>
8#include <asm/desc.h> 9#include <asm/desc.h>
9#include <asm/ldt.h> 10#include <asm/ldt.h>
10#include <asm/processor.h> 11#include <asm/processor.h>
11#include <asm/proto.h> 12#include <asm/proto.h>
12#include <asm/syscalls.h>
13 13
14#include "tls.h" 14#include "tls.h"
15 15
@@ -89,11 +89,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
89 return 0; 89 return 0;
90} 90}
91 91
92asmlinkage int sys_set_thread_area(struct user_desc __user *u_info) 92SYSCALL_DEFINE1(set_thread_area, struct user_desc __user *, u_info)
93{ 93{
94 int ret = do_set_thread_area(current, -1, u_info, 1); 94 return do_set_thread_area(current, -1, u_info, 1);
95 asmlinkage_protect(1, ret, u_info);
96 return ret;
97} 95}
98 96
99 97
@@ -139,11 +137,9 @@ int do_get_thread_area(struct task_struct *p, int idx,
139 return 0; 137 return 0;
140} 138}
141 139
142asmlinkage int sys_get_thread_area(struct user_desc __user *u_info) 140SYSCALL_DEFINE1(get_thread_area, struct user_desc __user *, u_info)
143{ 141{
144 int ret = do_get_thread_area(current, -1, u_info); 142 return do_get_thread_area(current, -1, u_info);
145 asmlinkage_protect(1, ret, u_info);
146 return ret;
147} 143}
148 144
149int regset_tls_active(struct task_struct *target, 145int regset_tls_active(struct task_struct *target,
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 68bda7a84159..772e2a846dec 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -12,6 +12,7 @@
12 12
13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 14
15#include <linux/context_tracking.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/kallsyms.h> 17#include <linux/kallsyms.h>
17#include <linux/spinlock.h> 18#include <linux/spinlock.h>
@@ -55,8 +56,7 @@
55#include <asm/i387.h> 56#include <asm/i387.h>
56#include <asm/fpu-internal.h> 57#include <asm/fpu-internal.h>
57#include <asm/mce.h> 58#include <asm/mce.h>
58#include <asm/context_tracking.h> 59#include <asm/fixmap.h>
59
60#include <asm/mach_traps.h> 60#include <asm/mach_traps.h>
61 61
62#ifdef CONFIG_X86_64 62#ifdef CONFIG_X86_64
@@ -176,34 +176,38 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
176#define DO_ERROR(trapnr, signr, str, name) \ 176#define DO_ERROR(trapnr, signr, str, name) \
177dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ 177dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \
178{ \ 178{ \
179 exception_enter(regs); \ 179 enum ctx_state prev_state; \
180 \
181 prev_state = exception_enter(); \
180 if (notify_die(DIE_TRAP, str, regs, error_code, \ 182 if (notify_die(DIE_TRAP, str, regs, error_code, \
181 trapnr, signr) == NOTIFY_STOP) { \ 183 trapnr, signr) == NOTIFY_STOP) { \
182 exception_exit(regs); \ 184 exception_exit(prev_state); \
183 return; \ 185 return; \
184 } \ 186 } \
185 conditional_sti(regs); \ 187 conditional_sti(regs); \
186 do_trap(trapnr, signr, str, regs, error_code, NULL); \ 188 do_trap(trapnr, signr, str, regs, error_code, NULL); \
187 exception_exit(regs); \ 189 exception_exit(prev_state); \
188} 190}
189 191
190#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ 192#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
191dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ 193dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \
192{ \ 194{ \
193 siginfo_t info; \ 195 siginfo_t info; \
196 enum ctx_state prev_state; \
197 \
194 info.si_signo = signr; \ 198 info.si_signo = signr; \
195 info.si_errno = 0; \ 199 info.si_errno = 0; \
196 info.si_code = sicode; \ 200 info.si_code = sicode; \
197 info.si_addr = (void __user *)siaddr; \ 201 info.si_addr = (void __user *)siaddr; \
198 exception_enter(regs); \ 202 prev_state = exception_enter(); \
199 if (notify_die(DIE_TRAP, str, regs, error_code, \ 203 if (notify_die(DIE_TRAP, str, regs, error_code, \
200 trapnr, signr) == NOTIFY_STOP) { \ 204 trapnr, signr) == NOTIFY_STOP) { \
201 exception_exit(regs); \ 205 exception_exit(prev_state); \
202 return; \ 206 return; \
203 } \ 207 } \
204 conditional_sti(regs); \ 208 conditional_sti(regs); \
205 do_trap(trapnr, signr, str, regs, error_code, &info); \ 209 do_trap(trapnr, signr, str, regs, error_code, &info); \
206 exception_exit(regs); \ 210 exception_exit(prev_state); \
207} 211}
208 212
209DO_ERROR_INFO(X86_TRAP_DE, SIGFPE, "divide error", divide_error, FPE_INTDIV, 213DO_ERROR_INFO(X86_TRAP_DE, SIGFPE, "divide error", divide_error, FPE_INTDIV,
@@ -226,14 +230,16 @@ DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check,
226/* Runs on IST stack */ 230/* Runs on IST stack */
227dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) 231dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
228{ 232{
229 exception_enter(regs); 233 enum ctx_state prev_state;
234
235 prev_state = exception_enter();
230 if (notify_die(DIE_TRAP, "stack segment", regs, error_code, 236 if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
231 X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) { 237 X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
232 preempt_conditional_sti(regs); 238 preempt_conditional_sti(regs);
233 do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL); 239 do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL);
234 preempt_conditional_cli(regs); 240 preempt_conditional_cli(regs);
235 } 241 }
236 exception_exit(regs); 242 exception_exit(prev_state);
237} 243}
238 244
239dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) 245dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
@@ -241,7 +247,7 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
241 static const char str[] = "double fault"; 247 static const char str[] = "double fault";
242 struct task_struct *tsk = current; 248 struct task_struct *tsk = current;
243 249
244 exception_enter(regs); 250 exception_enter();
245 /* Return not checked because double check cannot be ignored */ 251 /* Return not checked because double check cannot be ignored */
246 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); 252 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
247 253
@@ -261,8 +267,9 @@ dotraplinkage void __kprobes
261do_general_protection(struct pt_regs *regs, long error_code) 267do_general_protection(struct pt_regs *regs, long error_code)
262{ 268{
263 struct task_struct *tsk; 269 struct task_struct *tsk;
270 enum ctx_state prev_state;
264 271
265 exception_enter(regs); 272 prev_state = exception_enter();
266 conditional_sti(regs); 273 conditional_sti(regs);
267 274
268#ifdef CONFIG_X86_32 275#ifdef CONFIG_X86_32
@@ -300,12 +307,14 @@ do_general_protection(struct pt_regs *regs, long error_code)
300 307
301 force_sig(SIGSEGV, tsk); 308 force_sig(SIGSEGV, tsk);
302exit: 309exit:
303 exception_exit(regs); 310 exception_exit(prev_state);
304} 311}
305 312
306/* May run on IST stack. */ 313/* May run on IST stack. */
307dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_code) 314dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_code)
308{ 315{
316 enum ctx_state prev_state;
317
309#ifdef CONFIG_DYNAMIC_FTRACE 318#ifdef CONFIG_DYNAMIC_FTRACE
310 /* 319 /*
311 * ftrace must be first, everything else may cause a recursive crash. 320 * ftrace must be first, everything else may cause a recursive crash.
@@ -315,7 +324,7 @@ dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_co
315 ftrace_int3_handler(regs)) 324 ftrace_int3_handler(regs))
316 return; 325 return;
317#endif 326#endif
318 exception_enter(regs); 327 prev_state = exception_enter();
319#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 328#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
320 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 329 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
321 SIGTRAP) == NOTIFY_STOP) 330 SIGTRAP) == NOTIFY_STOP)
@@ -336,7 +345,7 @@ dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_co
336 preempt_conditional_cli(regs); 345 preempt_conditional_cli(regs);
337 debug_stack_usage_dec(); 346 debug_stack_usage_dec();
338exit: 347exit:
339 exception_exit(regs); 348 exception_exit(prev_state);
340} 349}
341 350
342#ifdef CONFIG_X86_64 351#ifdef CONFIG_X86_64
@@ -393,11 +402,12 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
393dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code) 402dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
394{ 403{
395 struct task_struct *tsk = current; 404 struct task_struct *tsk = current;
405 enum ctx_state prev_state;
396 int user_icebp = 0; 406 int user_icebp = 0;
397 unsigned long dr6; 407 unsigned long dr6;
398 int si_code; 408 int si_code;
399 409
400 exception_enter(regs); 410 prev_state = exception_enter();
401 411
402 get_debugreg(dr6, 6); 412 get_debugreg(dr6, 6);
403 413
@@ -467,7 +477,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
467 debug_stack_usage_dec(); 477 debug_stack_usage_dec();
468 478
469exit: 479exit:
470 exception_exit(regs); 480 exception_exit(prev_state);
471} 481}
472 482
473/* 483/*
@@ -561,17 +571,21 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
561 571
562dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code) 572dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code)
563{ 573{
564 exception_enter(regs); 574 enum ctx_state prev_state;
575
576 prev_state = exception_enter();
565 math_error(regs, error_code, X86_TRAP_MF); 577 math_error(regs, error_code, X86_TRAP_MF);
566 exception_exit(regs); 578 exception_exit(prev_state);
567} 579}
568 580
569dotraplinkage void 581dotraplinkage void
570do_simd_coprocessor_error(struct pt_regs *regs, long error_code) 582do_simd_coprocessor_error(struct pt_regs *regs, long error_code)
571{ 583{
572 exception_enter(regs); 584 enum ctx_state prev_state;
585
586 prev_state = exception_enter();
573 math_error(regs, error_code, X86_TRAP_XF); 587 math_error(regs, error_code, X86_TRAP_XF);
574 exception_exit(regs); 588 exception_exit(prev_state);
575} 589}
576 590
577dotraplinkage void 591dotraplinkage void
@@ -639,7 +653,9 @@ EXPORT_SYMBOL_GPL(math_state_restore);
639dotraplinkage void __kprobes 653dotraplinkage void __kprobes
640do_device_not_available(struct pt_regs *regs, long error_code) 654do_device_not_available(struct pt_regs *regs, long error_code)
641{ 655{
642 exception_enter(regs); 656 enum ctx_state prev_state;
657
658 prev_state = exception_enter();
643 BUG_ON(use_eager_fpu()); 659 BUG_ON(use_eager_fpu());
644 660
645#ifdef CONFIG_MATH_EMULATION 661#ifdef CONFIG_MATH_EMULATION
@@ -650,7 +666,7 @@ do_device_not_available(struct pt_regs *regs, long error_code)
650 666
651 info.regs = regs; 667 info.regs = regs;
652 math_emulate(&info); 668 math_emulate(&info);
653 exception_exit(regs); 669 exception_exit(prev_state);
654 return; 670 return;
655 } 671 }
656#endif 672#endif
@@ -658,15 +674,16 @@ do_device_not_available(struct pt_regs *regs, long error_code)
658#ifdef CONFIG_X86_32 674#ifdef CONFIG_X86_32
659 conditional_sti(regs); 675 conditional_sti(regs);
660#endif 676#endif
661 exception_exit(regs); 677 exception_exit(prev_state);
662} 678}
663 679
664#ifdef CONFIG_X86_32 680#ifdef CONFIG_X86_32
665dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) 681dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code)
666{ 682{
667 siginfo_t info; 683 siginfo_t info;
684 enum ctx_state prev_state;
668 685
669 exception_enter(regs); 686 prev_state = exception_enter();
670 local_irq_enable(); 687 local_irq_enable();
671 688
672 info.si_signo = SIGILL; 689 info.si_signo = SIGILL;
@@ -678,7 +695,7 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code)
678 do_trap(X86_TRAP_IRET, SIGILL, "iret exception", regs, error_code, 695 do_trap(X86_TRAP_IRET, SIGILL, "iret exception", regs, error_code,
679 &info); 696 &info);
680 } 697 }
681 exception_exit(regs); 698 exception_exit(prev_state);
682} 699}
683#endif 700#endif
684 701
@@ -753,6 +770,14 @@ void __init trap_init(void)
753#endif 770#endif
754 771
755 /* 772 /*
773 * Set the IDT descriptor to a fixed read-only location, so that the
774 * "sidt" instruction will not leak the location of the kernel, and
775 * to defend the IDT against arbitrary memory write vulnerabilities.
776 * It will be reloaded in cpu_init() */
777 __set_fixmap(FIX_RO_IDT, __pa_symbol(idt_table), PAGE_KERNEL_RO);
778 idt_descr.address = fix_to_virt(FIX_RO_IDT);
779
780 /*
756 * Should be a barrier for any external CPU state: 781 * Should be a barrier for any external CPU state:
757 */ 782 */
758 cpu_init(); 783 cpu_init();
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 4b9ea101fe3b..098b3cfda72e 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -768,7 +768,8 @@ static cycle_t read_tsc(struct clocksource *cs)
768 768
769static void resume_tsc(struct clocksource *cs) 769static void resume_tsc(struct clocksource *cs)
770{ 770{
771 clocksource_tsc.cycle_last = 0; 771 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC_S3))
772 clocksource_tsc.cycle_last = 0;
772} 773}
773 774
774static struct clocksource clocksource_tsc = { 775static struct clocksource clocksource_tsc = {
@@ -939,6 +940,9 @@ static int __init init_tsc_clocksource(void)
939 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 940 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
940 } 941 }
941 942
943 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC_S3))
944 clocksource_tsc.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP;
945
942 /* 946 /*
943 * Trust the results of the earlier calibration on systems 947 * Trust the results of the earlier calibration on systems
944 * exporting a reliable TSC. 948 * exporting a reliable TSC.
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index 0ba4cfb4f412..2ed845928b5f 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -697,3 +697,32 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
697 send_sig(SIGTRAP, current, 0); 697 send_sig(SIGTRAP, current, 0);
698 return ret; 698 return ret;
699} 699}
700
701unsigned long
702arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs)
703{
704 int rasize, ncopied;
705 unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */
706
707 rasize = is_ia32_task() ? 4 : 8;
708 ncopied = copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize);
709 if (unlikely(ncopied))
710 return -1;
711
712 /* check whether address has been already hijacked */
713 if (orig_ret_vaddr == trampoline_vaddr)
714 return orig_ret_vaddr;
715
716 ncopied = copy_to_user((void __user *)regs->sp, &trampoline_vaddr, rasize);
717 if (likely(!ncopied))
718 return orig_ret_vaddr;
719
720 if (ncopied != rasize) {
721 pr_err("uprobe: return address clobbered: pid=%d, %%sp=%#lx, "
722 "%%ip=%#lx\n", current->pid, regs->sp, regs->ip);
723
724 force_sig_info(SIGSEGV, SEND_SIG_FORCED, current);
725 }
726
727 return -1;
728}
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 22a1530146a8..10c4f3006afd 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -94,10 +94,6 @@ SECTIONS
94 _text = .; 94 _text = .;
95 /* bootstrapping code */ 95 /* bootstrapping code */
96 HEAD_TEXT 96 HEAD_TEXT
97#ifdef CONFIG_X86_32
98 . = ALIGN(PAGE_SIZE);
99 *(.text..page_aligned)
100#endif
101 . = ALIGN(8); 97 . = ALIGN(8);
102 _stext = .; 98 _stext = .;
103 TEXT_TEXT 99 TEXT_TEXT
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 586f00059805..a47a3e54b964 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -21,14 +21,13 @@ config KVM
21 tristate "Kernel-based Virtual Machine (KVM) support" 21 tristate "Kernel-based Virtual Machine (KVM) support"
22 depends on HAVE_KVM 22 depends on HAVE_KVM
23 depends on HIGH_RES_TIMERS 23 depends on HIGH_RES_TIMERS
24 # for device assignment:
25 depends on PCI
26 # for TASKSTATS/TASK_DELAY_ACCT: 24 # for TASKSTATS/TASK_DELAY_ACCT:
27 depends on NET 25 depends on NET
28 select PREEMPT_NOTIFIERS 26 select PREEMPT_NOTIFIERS
29 select MMU_NOTIFIER 27 select MMU_NOTIFIER
30 select ANON_INODES 28 select ANON_INODES
31 select HAVE_KVM_IRQCHIP 29 select HAVE_KVM_IRQCHIP
30 select HAVE_KVM_IRQ_ROUTING
32 select HAVE_KVM_EVENTFD 31 select HAVE_KVM_EVENTFD
33 select KVM_APIC_ARCHITECTURE 32 select KVM_APIC_ARCHITECTURE
34 select KVM_ASYNC_PF 33 select KVM_ASYNC_PF
@@ -82,6 +81,17 @@ config KVM_MMU_AUDIT
82 This option adds a R/W kVM module parameter 'mmu_audit', which allows 81 This option adds a R/W kVM module parameter 'mmu_audit', which allows
83 audit KVM MMU at runtime. 82 audit KVM MMU at runtime.
84 83
84config KVM_DEVICE_ASSIGNMENT
85 bool "KVM legacy PCI device assignment support"
86 depends on KVM && PCI && IOMMU_API
87 default y
88 ---help---
89 Provide support for legacy PCI device assignment through KVM. The
90 kernel now also supports a full featured userspace device driver
91 framework through VFIO, which supersedes much of this support.
92
93 If unsure, say Y.
94
85# OK, it's a little counter-intuitive to do this, but it puts it neatly under 95# OK, it's a little counter-intuitive to do this, but it puts it neatly under
86# the virtualization menu. 96# the virtualization menu.
87source drivers/vhost/Kconfig 97source drivers/vhost/Kconfig
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index 04d30401c5cb..d609e1d84048 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -7,8 +7,9 @@ CFLAGS_vmx.o := -I.
7 7
8kvm-y += $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 8kvm-y += $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
9 coalesced_mmio.o irq_comm.o eventfd.o \ 9 coalesced_mmio.o irq_comm.o eventfd.o \
10 assigned-dev.o) 10 irqchip.o)
11kvm-$(CONFIG_IOMMU_API) += $(addprefix ../../../virt/kvm/, iommu.o) 11kvm-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += $(addprefix ../../../virt/kvm/, \
12 assigned-dev.o iommu.o)
12kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o) 13kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o)
13 14
14kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o \ 15kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o \
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a335cc6cde72..8e517bba6a7c 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -132,8 +132,9 @@
132#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */ 132#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */
133#define No64 (1<<28) 133#define No64 (1<<28)
134#define PageTable (1 << 29) /* instruction used to write page table */ 134#define PageTable (1 << 29) /* instruction used to write page table */
135#define NotImpl (1 << 30) /* instruction is not implemented */
135/* Source 2 operand type */ 136/* Source 2 operand type */
136#define Src2Shift (30) 137#define Src2Shift (31)
137#define Src2None (OpNone << Src2Shift) 138#define Src2None (OpNone << Src2Shift)
138#define Src2CL (OpCL << Src2Shift) 139#define Src2CL (OpCL << Src2Shift)
139#define Src2ImmByte (OpImmByte << Src2Shift) 140#define Src2ImmByte (OpImmByte << Src2Shift)
@@ -1578,12 +1579,21 @@ static int load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1578 1579
1579 memset(&seg_desc, 0, sizeof seg_desc); 1580 memset(&seg_desc, 0, sizeof seg_desc);
1580 1581
1581 if ((seg <= VCPU_SREG_GS && ctxt->mode == X86EMUL_MODE_VM86) 1582 if (ctxt->mode == X86EMUL_MODE_REAL) {
1582 || ctxt->mode == X86EMUL_MODE_REAL) { 1583 /* set real mode segment descriptor (keep limit etc. for
1583 /* set real mode segment descriptor */ 1584 * unreal mode) */
1584 ctxt->ops->get_segment(ctxt, &dummy, &seg_desc, NULL, seg); 1585 ctxt->ops->get_segment(ctxt, &dummy, &seg_desc, NULL, seg);
1585 set_desc_base(&seg_desc, selector << 4); 1586 set_desc_base(&seg_desc, selector << 4);
1586 goto load; 1587 goto load;
1588 } else if (seg <= VCPU_SREG_GS && ctxt->mode == X86EMUL_MODE_VM86) {
1589 /* VM86 needs a clean new segment descriptor */
1590 set_desc_base(&seg_desc, selector << 4);
1591 set_desc_limit(&seg_desc, 0xffff);
1592 seg_desc.type = 3;
1593 seg_desc.p = 1;
1594 seg_desc.s = 1;
1595 seg_desc.dpl = 3;
1596 goto load;
1587 } 1597 }
1588 1598
1589 rpl = selector & 3; 1599 rpl = selector & 3;
@@ -3615,7 +3625,7 @@ static int check_perm_out(struct x86_emulate_ctxt *ctxt)
3615#define DI(_y, _i) { .flags = (_y), .intercept = x86_intercept_##_i } 3625#define DI(_y, _i) { .flags = (_y), .intercept = x86_intercept_##_i }
3616#define DIP(_y, _i, _p) { .flags = (_y), .intercept = x86_intercept_##_i, \ 3626#define DIP(_y, _i, _p) { .flags = (_y), .intercept = x86_intercept_##_i, \
3617 .check_perm = (_p) } 3627 .check_perm = (_p) }
3618#define N D(0) 3628#define N D(NotImpl)
3619#define EXT(_f, _e) { .flags = ((_f) | RMExt), .u.group = (_e) } 3629#define EXT(_f, _e) { .flags = ((_f) | RMExt), .u.group = (_e) }
3620#define G(_f, _g) { .flags = ((_f) | Group | ModRM), .u.group = (_g) } 3630#define G(_f, _g) { .flags = ((_f) | Group | ModRM), .u.group = (_g) }
3621#define GD(_f, _g) { .flags = ((_f) | GroupDual | ModRM), .u.gdual = (_g) } 3631#define GD(_f, _g) { .flags = ((_f) | GroupDual | ModRM), .u.gdual = (_g) }
@@ -3713,7 +3723,7 @@ static const struct opcode group5[] = {
3713 I(SrcMemFAddr | ImplicitOps | Stack, em_call_far), 3723 I(SrcMemFAddr | ImplicitOps | Stack, em_call_far),
3714 I(SrcMem | Stack, em_grp45), 3724 I(SrcMem | Stack, em_grp45),
3715 I(SrcMemFAddr | ImplicitOps, em_grp45), 3725 I(SrcMemFAddr | ImplicitOps, em_grp45),
3716 I(SrcMem | Stack, em_grp45), N, 3726 I(SrcMem | Stack, em_grp45), D(Undefined),
3717}; 3727};
3718 3728
3719static const struct opcode group6[] = { 3729static const struct opcode group6[] = {
@@ -4162,6 +4172,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4162 break; 4172 break;
4163 case OpMem8: 4173 case OpMem8:
4164 ctxt->memop.bytes = 1; 4174 ctxt->memop.bytes = 1;
4175 if (ctxt->memop.type == OP_REG) {
4176 ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1);
4177 fetch_register_operand(&ctxt->memop);
4178 }
4165 goto mem_common; 4179 goto mem_common;
4166 case OpMem16: 4180 case OpMem16:
4167 ctxt->memop.bytes = 2; 4181 ctxt->memop.bytes = 2;
@@ -4373,7 +4387,7 @@ done_prefixes:
4373 ctxt->intercept = opcode.intercept; 4387 ctxt->intercept = opcode.intercept;
4374 4388
4375 /* Unrecognised? */ 4389 /* Unrecognised? */
4376 if (ctxt->d == 0 || (ctxt->d & Undefined)) 4390 if (ctxt->d == 0 || (ctxt->d & NotImpl))
4377 return EMULATION_FAILED; 4391 return EMULATION_FAILED;
4378 4392
4379 if (!(ctxt->d & VendorSpecific) && ctxt->only_vendor_specific_insn) 4393 if (!(ctxt->d & VendorSpecific) && ctxt->only_vendor_specific_insn)
@@ -4511,7 +4525,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
4511 4525
4512 ctxt->mem_read.pos = 0; 4526 ctxt->mem_read.pos = 0;
4513 4527
4514 if (ctxt->mode == X86EMUL_MODE_PROT64 && (ctxt->d & No64)) { 4528 if ((ctxt->mode == X86EMUL_MODE_PROT64 && (ctxt->d & No64)) ||
4529 (ctxt->d & Undefined)) {
4515 rc = emulate_ud(ctxt); 4530 rc = emulate_ud(ctxt);
4516 goto done; 4531 goto done;
4517 } 4532 }
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index c1d30b2fc9bb..412a5aa0ef94 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -290,8 +290,8 @@ static void pit_do_work(struct kthread_work *work)
290 } 290 }
291 spin_unlock(&ps->inject_lock); 291 spin_unlock(&ps->inject_lock);
292 if (inject) { 292 if (inject) {
293 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1); 293 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1, false);
294 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0); 294 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0, false);
295 295
296 /* 296 /*
297 * Provides NMI watchdog support via Virtual Wire mode. 297 * Provides NMI watchdog support via Virtual Wire mode.
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index f77df1c5de6e..e1adbb4aca75 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -94,6 +94,14 @@ static inline int apic_test_vector(int vec, void *bitmap)
94 return test_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); 94 return test_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
95} 95}
96 96
97bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector)
98{
99 struct kvm_lapic *apic = vcpu->arch.apic;
100
101 return apic_test_vector(vector, apic->regs + APIC_ISR) ||
102 apic_test_vector(vector, apic->regs + APIC_IRR);
103}
104
97static inline void apic_set_vector(int vec, void *bitmap) 105static inline void apic_set_vector(int vec, void *bitmap)
98{ 106{
99 set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); 107 set_bit(VEC_POS(vec), (bitmap) + REG_POS(vec));
@@ -145,53 +153,6 @@ static inline int kvm_apic_id(struct kvm_lapic *apic)
145 return (kvm_apic_get_reg(apic, APIC_ID) >> 24) & 0xff; 153 return (kvm_apic_get_reg(apic, APIC_ID) >> 24) & 0xff;
146} 154}
147 155
148void kvm_calculate_eoi_exitmap(struct kvm_vcpu *vcpu,
149 struct kvm_lapic_irq *irq,
150 u64 *eoi_exit_bitmap)
151{
152 struct kvm_lapic **dst;
153 struct kvm_apic_map *map;
154 unsigned long bitmap = 1;
155 int i;
156
157 rcu_read_lock();
158 map = rcu_dereference(vcpu->kvm->arch.apic_map);
159
160 if (unlikely(!map)) {
161 __set_bit(irq->vector, (unsigned long *)eoi_exit_bitmap);
162 goto out;
163 }
164
165 if (irq->dest_mode == 0) { /* physical mode */
166 if (irq->delivery_mode == APIC_DM_LOWEST ||
167 irq->dest_id == 0xff) {
168 __set_bit(irq->vector,
169 (unsigned long *)eoi_exit_bitmap);
170 goto out;
171 }
172 dst = &map->phys_map[irq->dest_id & 0xff];
173 } else {
174 u32 mda = irq->dest_id << (32 - map->ldr_bits);
175
176 dst = map->logical_map[apic_cluster_id(map, mda)];
177
178 bitmap = apic_logical_id(map, mda);
179 }
180
181 for_each_set_bit(i, &bitmap, 16) {
182 if (!dst[i])
183 continue;
184 if (dst[i]->vcpu == vcpu) {
185 __set_bit(irq->vector,
186 (unsigned long *)eoi_exit_bitmap);
187 break;
188 }
189 }
190
191out:
192 rcu_read_unlock();
193}
194
195static void recalculate_apic_map(struct kvm *kvm) 156static void recalculate_apic_map(struct kvm *kvm)
196{ 157{
197 struct kvm_apic_map *new, *old = NULL; 158 struct kvm_apic_map *new, *old = NULL;
@@ -256,7 +217,7 @@ out:
256 if (old) 217 if (old)
257 kfree_rcu(old, rcu); 218 kfree_rcu(old, rcu);
258 219
259 kvm_ioapic_make_eoibitmap_request(kvm); 220 kvm_vcpu_request_scan_ioapic(kvm);
260} 221}
261 222
262static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id) 223static inline void kvm_apic_set_id(struct kvm_lapic *apic, u8 id)
@@ -357,6 +318,19 @@ static u8 count_vectors(void *bitmap)
357 return count; 318 return count;
358} 319}
359 320
321void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir)
322{
323 u32 i, pir_val;
324 struct kvm_lapic *apic = vcpu->arch.apic;
325
326 for (i = 0; i <= 7; i++) {
327 pir_val = xchg(&pir[i], 0);
328 if (pir_val)
329 *((u32 *)(apic->regs + APIC_IRR + i * 0x10)) |= pir_val;
330 }
331}
332EXPORT_SYMBOL_GPL(kvm_apic_update_irr);
333
360static inline int apic_test_and_set_irr(int vec, struct kvm_lapic *apic) 334static inline int apic_test_and_set_irr(int vec, struct kvm_lapic *apic)
361{ 335{
362 apic->irr_pending = true; 336 apic->irr_pending = true;
@@ -379,6 +353,7 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic)
379 if (!apic->irr_pending) 353 if (!apic->irr_pending)
380 return -1; 354 return -1;
381 355
356 kvm_x86_ops->sync_pir_to_irr(apic->vcpu);
382 result = apic_search_irr(apic); 357 result = apic_search_irr(apic);
383 ASSERT(result == -1 || result >= 16); 358 ASSERT(result == -1 || result >= 16);
384 359
@@ -431,14 +406,16 @@ int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu)
431} 406}
432 407
433static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, 408static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
434 int vector, int level, int trig_mode); 409 int vector, int level, int trig_mode,
410 unsigned long *dest_map);
435 411
436int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq) 412int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq,
413 unsigned long *dest_map)
437{ 414{
438 struct kvm_lapic *apic = vcpu->arch.apic; 415 struct kvm_lapic *apic = vcpu->arch.apic;
439 416
440 return __apic_accept_irq(apic, irq->delivery_mode, irq->vector, 417 return __apic_accept_irq(apic, irq->delivery_mode, irq->vector,
441 irq->level, irq->trig_mode); 418 irq->level, irq->trig_mode, dest_map);
442} 419}
443 420
444static int pv_eoi_put_user(struct kvm_vcpu *vcpu, u8 val) 421static int pv_eoi_put_user(struct kvm_vcpu *vcpu, u8 val)
@@ -505,6 +482,15 @@ static inline int apic_find_highest_isr(struct kvm_lapic *apic)
505 return result; 482 return result;
506} 483}
507 484
485void kvm_apic_update_tmr(struct kvm_vcpu *vcpu, u32 *tmr)
486{
487 struct kvm_lapic *apic = vcpu->arch.apic;
488 int i;
489
490 for (i = 0; i < 8; i++)
491 apic_set_reg(apic, APIC_TMR + 0x10 * i, tmr[i]);
492}
493
508static void apic_update_ppr(struct kvm_lapic *apic) 494static void apic_update_ppr(struct kvm_lapic *apic)
509{ 495{
510 u32 tpr, isrv, ppr, old_ppr; 496 u32 tpr, isrv, ppr, old_ppr;
@@ -611,7 +597,7 @@ int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
611} 597}
612 598
613bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, 599bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
614 struct kvm_lapic_irq *irq, int *r) 600 struct kvm_lapic_irq *irq, int *r, unsigned long *dest_map)
615{ 601{
616 struct kvm_apic_map *map; 602 struct kvm_apic_map *map;
617 unsigned long bitmap = 1; 603 unsigned long bitmap = 1;
@@ -622,7 +608,7 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
622 *r = -1; 608 *r = -1;
623 609
624 if (irq->shorthand == APIC_DEST_SELF) { 610 if (irq->shorthand == APIC_DEST_SELF) {
625 *r = kvm_apic_set_irq(src->vcpu, irq); 611 *r = kvm_apic_set_irq(src->vcpu, irq, dest_map);
626 return true; 612 return true;
627 } 613 }
628 614
@@ -667,7 +653,7 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
667 continue; 653 continue;
668 if (*r < 0) 654 if (*r < 0)
669 *r = 0; 655 *r = 0;
670 *r += kvm_apic_set_irq(dst[i]->vcpu, irq); 656 *r += kvm_apic_set_irq(dst[i]->vcpu, irq, dest_map);
671 } 657 }
672 658
673 ret = true; 659 ret = true;
@@ -681,7 +667,8 @@ out:
681 * Return 1 if successfully added and 0 if discarded. 667 * Return 1 if successfully added and 0 if discarded.
682 */ 668 */
683static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, 669static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
684 int vector, int level, int trig_mode) 670 int vector, int level, int trig_mode,
671 unsigned long *dest_map)
685{ 672{
686 int result = 0; 673 int result = 0;
687 struct kvm_vcpu *vcpu = apic->vcpu; 674 struct kvm_vcpu *vcpu = apic->vcpu;
@@ -694,24 +681,28 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
694 if (unlikely(!apic_enabled(apic))) 681 if (unlikely(!apic_enabled(apic)))
695 break; 682 break;
696 683
697 if (trig_mode) { 684 if (dest_map)
698 apic_debug("level trig mode for vector %d", vector); 685 __set_bit(vcpu->vcpu_id, dest_map);
699 apic_set_vector(vector, apic->regs + APIC_TMR);
700 } else
701 apic_clear_vector(vector, apic->regs + APIC_TMR);
702 686
703 result = !apic_test_and_set_irr(vector, apic); 687 if (kvm_x86_ops->deliver_posted_interrupt) {
704 trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode, 688 result = 1;
705 trig_mode, vector, !result); 689 kvm_x86_ops->deliver_posted_interrupt(vcpu, vector);
706 if (!result) { 690 } else {
707 if (trig_mode) 691 result = !apic_test_and_set_irr(vector, apic);
708 apic_debug("level trig mode repeatedly for "
709 "vector %d", vector);
710 break;
711 }
712 692
713 kvm_make_request(KVM_REQ_EVENT, vcpu); 693 if (!result) {
714 kvm_vcpu_kick(vcpu); 694 if (trig_mode)
695 apic_debug("level trig mode repeatedly "
696 "for vector %d", vector);
697 goto out;
698 }
699
700 kvm_make_request(KVM_REQ_EVENT, vcpu);
701 kvm_vcpu_kick(vcpu);
702 }
703out:
704 trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode,
705 trig_mode, vector, !result);
715 break; 706 break;
716 707
717 case APIC_DM_REMRD: 708 case APIC_DM_REMRD:
@@ -731,7 +722,11 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
731 case APIC_DM_INIT: 722 case APIC_DM_INIT:
732 if (!trig_mode || level) { 723 if (!trig_mode || level) {
733 result = 1; 724 result = 1;
734 vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED; 725 /* assumes that there are only KVM_APIC_INIT/SIPI */
726 apic->pending_events = (1UL << KVM_APIC_INIT);
727 /* make sure pending_events is visible before sending
728 * the request */
729 smp_wmb();
735 kvm_make_request(KVM_REQ_EVENT, vcpu); 730 kvm_make_request(KVM_REQ_EVENT, vcpu);
736 kvm_vcpu_kick(vcpu); 731 kvm_vcpu_kick(vcpu);
737 } else { 732 } else {
@@ -743,13 +738,13 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
743 case APIC_DM_STARTUP: 738 case APIC_DM_STARTUP:
744 apic_debug("SIPI to vcpu %d vector 0x%02x\n", 739 apic_debug("SIPI to vcpu %d vector 0x%02x\n",
745 vcpu->vcpu_id, vector); 740 vcpu->vcpu_id, vector);
746 if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) { 741 result = 1;
747 result = 1; 742 apic->sipi_vector = vector;
748 vcpu->arch.sipi_vector = vector; 743 /* make sure sipi_vector is visible for the receiver */
749 vcpu->arch.mp_state = KVM_MP_STATE_SIPI_RECEIVED; 744 smp_wmb();
750 kvm_make_request(KVM_REQ_EVENT, vcpu); 745 set_bit(KVM_APIC_SIPI, &apic->pending_events);
751 kvm_vcpu_kick(vcpu); 746 kvm_make_request(KVM_REQ_EVENT, vcpu);
752 } 747 kvm_vcpu_kick(vcpu);
753 break; 748 break;
754 749
755 case APIC_DM_EXTINT: 750 case APIC_DM_EXTINT:
@@ -782,7 +777,7 @@ static void kvm_ioapic_send_eoi(struct kvm_lapic *apic, int vector)
782 trigger_mode = IOAPIC_LEVEL_TRIG; 777 trigger_mode = IOAPIC_LEVEL_TRIG;
783 else 778 else
784 trigger_mode = IOAPIC_EDGE_TRIG; 779 trigger_mode = IOAPIC_EDGE_TRIG;
785 kvm_ioapic_update_eoi(apic->vcpu->kvm, vector, trigger_mode); 780 kvm_ioapic_update_eoi(apic->vcpu, vector, trigger_mode);
786 } 781 }
787} 782}
788 783
@@ -848,7 +843,7 @@ static void apic_send_ipi(struct kvm_lapic *apic)
848 irq.trig_mode, irq.level, irq.dest_mode, irq.delivery_mode, 843 irq.trig_mode, irq.level, irq.dest_mode, irq.delivery_mode,
849 irq.vector); 844 irq.vector);
850 845
851 kvm_irq_delivery_to_apic(apic->vcpu->kvm, apic, &irq); 846 kvm_irq_delivery_to_apic(apic->vcpu->kvm, apic, &irq, NULL);
852} 847}
853 848
854static u32 apic_get_tmcct(struct kvm_lapic *apic) 849static u32 apic_get_tmcct(struct kvm_lapic *apic)
@@ -1484,7 +1479,8 @@ int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type)
1484 vector = reg & APIC_VECTOR_MASK; 1479 vector = reg & APIC_VECTOR_MASK;
1485 mode = reg & APIC_MODE_MASK; 1480 mode = reg & APIC_MODE_MASK;
1486 trig_mode = reg & APIC_LVT_LEVEL_TRIGGER; 1481 trig_mode = reg & APIC_LVT_LEVEL_TRIGGER;
1487 return __apic_accept_irq(apic, mode, vector, 1, trig_mode); 1482 return __apic_accept_irq(apic, mode, vector, 1, trig_mode,
1483 NULL);
1488 } 1484 }
1489 return 0; 1485 return 0;
1490} 1486}
@@ -1654,6 +1650,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu,
1654 apic->highest_isr_cache = -1; 1650 apic->highest_isr_cache = -1;
1655 kvm_x86_ops->hwapic_isr_update(vcpu->kvm, apic_find_highest_isr(apic)); 1651 kvm_x86_ops->hwapic_isr_update(vcpu->kvm, apic_find_highest_isr(apic));
1656 kvm_make_request(KVM_REQ_EVENT, vcpu); 1652 kvm_make_request(KVM_REQ_EVENT, vcpu);
1653 kvm_rtc_eoi_tracking_restore_one(vcpu);
1657} 1654}
1658 1655
1659void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu) 1656void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
@@ -1860,6 +1857,34 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data)
1860 addr, sizeof(u8)); 1857 addr, sizeof(u8));
1861} 1858}
1862 1859
1860void kvm_apic_accept_events(struct kvm_vcpu *vcpu)
1861{
1862 struct kvm_lapic *apic = vcpu->arch.apic;
1863 unsigned int sipi_vector;
1864
1865 if (!kvm_vcpu_has_lapic(vcpu))
1866 return;
1867
1868 if (test_and_clear_bit(KVM_APIC_INIT, &apic->pending_events)) {
1869 kvm_lapic_reset(vcpu);
1870 kvm_vcpu_reset(vcpu);
1871 if (kvm_vcpu_is_bsp(apic->vcpu))
1872 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
1873 else
1874 vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED;
1875 }
1876 if (test_and_clear_bit(KVM_APIC_SIPI, &apic->pending_events) &&
1877 vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
1878 /* evaluate pending_events before reading the vector */
1879 smp_rmb();
1880 sipi_vector = apic->sipi_vector;
1881 pr_debug("vcpu %d received sipi with vector # %x\n",
1882 vcpu->vcpu_id, sipi_vector);
1883 kvm_vcpu_deliver_sipi_vector(vcpu, sipi_vector);
1884 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
1885 }
1886}
1887
1863void kvm_lapic_init(void) 1888void kvm_lapic_init(void)
1864{ 1889{
1865 /* do not patch jump label more than once per second */ 1890 /* do not patch jump label more than once per second */
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
index 1676d34ddb4e..c730ac9fe801 100644
--- a/arch/x86/kvm/lapic.h
+++ b/arch/x86/kvm/lapic.h
@@ -5,6 +5,9 @@
5 5
6#include <linux/kvm_host.h> 6#include <linux/kvm_host.h>
7 7
8#define KVM_APIC_INIT 0
9#define KVM_APIC_SIPI 1
10
8struct kvm_timer { 11struct kvm_timer {
9 struct hrtimer timer; 12 struct hrtimer timer;
10 s64 period; /* unit: ns */ 13 s64 period; /* unit: ns */
@@ -32,6 +35,8 @@ struct kvm_lapic {
32 void *regs; 35 void *regs;
33 gpa_t vapic_addr; 36 gpa_t vapic_addr;
34 struct page *vapic_page; 37 struct page *vapic_page;
38 unsigned long pending_events;
39 unsigned int sipi_vector;
35}; 40};
36int kvm_create_lapic(struct kvm_vcpu *vcpu); 41int kvm_create_lapic(struct kvm_vcpu *vcpu);
37void kvm_free_lapic(struct kvm_vcpu *vcpu); 42void kvm_free_lapic(struct kvm_vcpu *vcpu);
@@ -39,6 +44,7 @@ void kvm_free_lapic(struct kvm_vcpu *vcpu);
39int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu); 44int kvm_apic_has_interrupt(struct kvm_vcpu *vcpu);
40int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu); 45int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu);
41int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu); 46int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu);
47void kvm_apic_accept_events(struct kvm_vcpu *vcpu);
42void kvm_lapic_reset(struct kvm_vcpu *vcpu); 48void kvm_lapic_reset(struct kvm_vcpu *vcpu);
43u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu); 49u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu);
44void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8); 50void kvm_lapic_set_tpr(struct kvm_vcpu *vcpu, unsigned long cr8);
@@ -47,13 +53,16 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value);
47u64 kvm_lapic_get_base(struct kvm_vcpu *vcpu); 53u64 kvm_lapic_get_base(struct kvm_vcpu *vcpu);
48void kvm_apic_set_version(struct kvm_vcpu *vcpu); 54void kvm_apic_set_version(struct kvm_vcpu *vcpu);
49 55
56void kvm_apic_update_tmr(struct kvm_vcpu *vcpu, u32 *tmr);
57void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir);
50int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest); 58int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest);
51int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda); 59int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda);
52int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq); 60int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq,
61 unsigned long *dest_map);
53int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type); 62int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type);
54 63
55bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src, 64bool kvm_irq_delivery_to_apic_fast(struct kvm *kvm, struct kvm_lapic *src,
56 struct kvm_lapic_irq *irq, int *r); 65 struct kvm_lapic_irq *irq, int *r, unsigned long *dest_map);
57 66
58u64 kvm_get_apic_base(struct kvm_vcpu *vcpu); 67u64 kvm_get_apic_base(struct kvm_vcpu *vcpu);
59void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); 68void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data);
@@ -154,8 +163,11 @@ static inline u16 apic_logical_id(struct kvm_apic_map *map, u32 ldr)
154 return ldr & map->lid_mask; 163 return ldr & map->lid_mask;
155} 164}
156 165
157void kvm_calculate_eoi_exitmap(struct kvm_vcpu *vcpu, 166static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu)
158 struct kvm_lapic_irq *irq, 167{
159 u64 *eoi_bitmap); 168 return vcpu->arch.apic->pending_events;
169}
170
171bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector);
160 172
161#endif 173#endif
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 956ca358108a..004cc87b781c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -199,8 +199,11 @@ EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask);
199 199
200static void mark_mmio_spte(u64 *sptep, u64 gfn, unsigned access) 200static void mark_mmio_spte(u64 *sptep, u64 gfn, unsigned access)
201{ 201{
202 struct kvm_mmu_page *sp = page_header(__pa(sptep));
203
202 access &= ACC_WRITE_MASK | ACC_USER_MASK; 204 access &= ACC_WRITE_MASK | ACC_USER_MASK;
203 205
206 sp->mmio_cached = true;
204 trace_mark_mmio_spte(sptep, gfn, access); 207 trace_mark_mmio_spte(sptep, gfn, access);
205 mmu_spte_set(sptep, shadow_mmio_mask | access | gfn << PAGE_SHIFT); 208 mmu_spte_set(sptep, shadow_mmio_mask | access | gfn << PAGE_SHIFT);
206} 209}
@@ -1502,6 +1505,7 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu,
1502 u64 *parent_pte, int direct) 1505 u64 *parent_pte, int direct)
1503{ 1506{
1504 struct kvm_mmu_page *sp; 1507 struct kvm_mmu_page *sp;
1508
1505 sp = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_header_cache); 1509 sp = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_header_cache);
1506 sp->spt = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache); 1510 sp->spt = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache);
1507 if (!direct) 1511 if (!direct)
@@ -1644,16 +1648,14 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
1644static void kvm_mmu_commit_zap_page(struct kvm *kvm, 1648static void kvm_mmu_commit_zap_page(struct kvm *kvm,
1645 struct list_head *invalid_list); 1649 struct list_head *invalid_list);
1646 1650
1647#define for_each_gfn_sp(kvm, sp, gfn) \ 1651#define for_each_gfn_sp(_kvm, _sp, _gfn) \
1648 hlist_for_each_entry(sp, \ 1652 hlist_for_each_entry(_sp, \
1649 &(kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)], hash_link) \ 1653 &(_kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(_gfn)], hash_link) \
1650 if ((sp)->gfn != (gfn)) {} else 1654 if ((_sp)->gfn != (_gfn)) {} else
1651 1655
1652#define for_each_gfn_indirect_valid_sp(kvm, sp, gfn) \ 1656#define for_each_gfn_indirect_valid_sp(_kvm, _sp, _gfn) \
1653 hlist_for_each_entry(sp, \ 1657 for_each_gfn_sp(_kvm, _sp, _gfn) \
1654 &(kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)], hash_link) \ 1658 if ((_sp)->role.direct || (_sp)->role.invalid) {} else
1655 if ((sp)->gfn != (gfn) || (sp)->role.direct || \
1656 (sp)->role.invalid) {} else
1657 1659
1658/* @sp->gfn should be write-protected at the call site */ 1660/* @sp->gfn should be write-protected at the call site */
1659static int __kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, 1661static int __kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
@@ -2089,7 +2091,7 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
2089static void kvm_mmu_commit_zap_page(struct kvm *kvm, 2091static void kvm_mmu_commit_zap_page(struct kvm *kvm,
2090 struct list_head *invalid_list) 2092 struct list_head *invalid_list)
2091{ 2093{
2092 struct kvm_mmu_page *sp; 2094 struct kvm_mmu_page *sp, *nsp;
2093 2095
2094 if (list_empty(invalid_list)) 2096 if (list_empty(invalid_list))
2095 return; 2097 return;
@@ -2106,11 +2108,25 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
2106 */ 2108 */
2107 kvm_flush_remote_tlbs(kvm); 2109 kvm_flush_remote_tlbs(kvm);
2108 2110
2109 do { 2111 list_for_each_entry_safe(sp, nsp, invalid_list, link) {
2110 sp = list_first_entry(invalid_list, struct kvm_mmu_page, link);
2111 WARN_ON(!sp->role.invalid || sp->root_count); 2112 WARN_ON(!sp->role.invalid || sp->root_count);
2112 kvm_mmu_free_page(sp); 2113 kvm_mmu_free_page(sp);
2113 } while (!list_empty(invalid_list)); 2114 }
2115}
2116
2117static bool prepare_zap_oldest_mmu_page(struct kvm *kvm,
2118 struct list_head *invalid_list)
2119{
2120 struct kvm_mmu_page *sp;
2121
2122 if (list_empty(&kvm->arch.active_mmu_pages))
2123 return false;
2124
2125 sp = list_entry(kvm->arch.active_mmu_pages.prev,
2126 struct kvm_mmu_page, link);
2127 kvm_mmu_prepare_zap_page(kvm, sp, invalid_list);
2128
2129 return true;
2114} 2130}
2115 2131
2116/* 2132/*
@@ -2120,23 +2136,15 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
2120void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int goal_nr_mmu_pages) 2136void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int goal_nr_mmu_pages)
2121{ 2137{
2122 LIST_HEAD(invalid_list); 2138 LIST_HEAD(invalid_list);
2123 /*
2124 * If we set the number of mmu pages to be smaller be than the
2125 * number of actived pages , we must to free some mmu pages before we
2126 * change the value
2127 */
2128 2139
2129 spin_lock(&kvm->mmu_lock); 2140 spin_lock(&kvm->mmu_lock);
2130 2141
2131 if (kvm->arch.n_used_mmu_pages > goal_nr_mmu_pages) { 2142 if (kvm->arch.n_used_mmu_pages > goal_nr_mmu_pages) {
2132 while (kvm->arch.n_used_mmu_pages > goal_nr_mmu_pages && 2143 /* Need to free some mmu pages to achieve the goal. */
2133 !list_empty(&kvm->arch.active_mmu_pages)) { 2144 while (kvm->arch.n_used_mmu_pages > goal_nr_mmu_pages)
2134 struct kvm_mmu_page *page; 2145 if (!prepare_zap_oldest_mmu_page(kvm, &invalid_list))
2146 break;
2135 2147
2136 page = container_of(kvm->arch.active_mmu_pages.prev,
2137 struct kvm_mmu_page, link);
2138 kvm_mmu_prepare_zap_page(kvm, page, &invalid_list);
2139 }
2140 kvm_mmu_commit_zap_page(kvm, &invalid_list); 2148 kvm_mmu_commit_zap_page(kvm, &invalid_list);
2141 goal_nr_mmu_pages = kvm->arch.n_used_mmu_pages; 2149 goal_nr_mmu_pages = kvm->arch.n_used_mmu_pages;
2142 } 2150 }
@@ -2794,6 +2802,7 @@ exit:
2794 2802
2795static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, 2803static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn,
2796 gva_t gva, pfn_t *pfn, bool write, bool *writable); 2804 gva_t gva, pfn_t *pfn, bool write, bool *writable);
2805static void make_mmu_pages_available(struct kvm_vcpu *vcpu);
2797 2806
2798static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, u32 error_code, 2807static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, u32 error_code,
2799 gfn_t gfn, bool prefault) 2808 gfn_t gfn, bool prefault)
@@ -2835,7 +2844,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, u32 error_code,
2835 spin_lock(&vcpu->kvm->mmu_lock); 2844 spin_lock(&vcpu->kvm->mmu_lock);
2836 if (mmu_notifier_retry(vcpu->kvm, mmu_seq)) 2845 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
2837 goto out_unlock; 2846 goto out_unlock;
2838 kvm_mmu_free_some_pages(vcpu); 2847 make_mmu_pages_available(vcpu);
2839 if (likely(!force_pt_level)) 2848 if (likely(!force_pt_level))
2840 transparent_hugepage_adjust(vcpu, &gfn, &pfn, &level); 2849 transparent_hugepage_adjust(vcpu, &gfn, &pfn, &level);
2841 r = __direct_map(vcpu, v, write, map_writable, level, gfn, pfn, 2850 r = __direct_map(vcpu, v, write, map_writable, level, gfn, pfn,
@@ -2913,7 +2922,7 @@ static int mmu_alloc_direct_roots(struct kvm_vcpu *vcpu)
2913 2922
2914 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { 2923 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) {
2915 spin_lock(&vcpu->kvm->mmu_lock); 2924 spin_lock(&vcpu->kvm->mmu_lock);
2916 kvm_mmu_free_some_pages(vcpu); 2925 make_mmu_pages_available(vcpu);
2917 sp = kvm_mmu_get_page(vcpu, 0, 0, PT64_ROOT_LEVEL, 2926 sp = kvm_mmu_get_page(vcpu, 0, 0, PT64_ROOT_LEVEL,
2918 1, ACC_ALL, NULL); 2927 1, ACC_ALL, NULL);
2919 ++sp->root_count; 2928 ++sp->root_count;
@@ -2925,7 +2934,7 @@ static int mmu_alloc_direct_roots(struct kvm_vcpu *vcpu)
2925 2934
2926 ASSERT(!VALID_PAGE(root)); 2935 ASSERT(!VALID_PAGE(root));
2927 spin_lock(&vcpu->kvm->mmu_lock); 2936 spin_lock(&vcpu->kvm->mmu_lock);
2928 kvm_mmu_free_some_pages(vcpu); 2937 make_mmu_pages_available(vcpu);
2929 sp = kvm_mmu_get_page(vcpu, i << (30 - PAGE_SHIFT), 2938 sp = kvm_mmu_get_page(vcpu, i << (30 - PAGE_SHIFT),
2930 i << 30, 2939 i << 30,
2931 PT32_ROOT_LEVEL, 1, ACC_ALL, 2940 PT32_ROOT_LEVEL, 1, ACC_ALL,
@@ -2964,7 +2973,7 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
2964 ASSERT(!VALID_PAGE(root)); 2973 ASSERT(!VALID_PAGE(root));
2965 2974
2966 spin_lock(&vcpu->kvm->mmu_lock); 2975 spin_lock(&vcpu->kvm->mmu_lock);
2967 kvm_mmu_free_some_pages(vcpu); 2976 make_mmu_pages_available(vcpu);
2968 sp = kvm_mmu_get_page(vcpu, root_gfn, 0, PT64_ROOT_LEVEL, 2977 sp = kvm_mmu_get_page(vcpu, root_gfn, 0, PT64_ROOT_LEVEL,
2969 0, ACC_ALL, NULL); 2978 0, ACC_ALL, NULL);
2970 root = __pa(sp->spt); 2979 root = __pa(sp->spt);
@@ -2998,7 +3007,7 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
2998 return 1; 3007 return 1;
2999 } 3008 }
3000 spin_lock(&vcpu->kvm->mmu_lock); 3009 spin_lock(&vcpu->kvm->mmu_lock);
3001 kvm_mmu_free_some_pages(vcpu); 3010 make_mmu_pages_available(vcpu);
3002 sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30, 3011 sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
3003 PT32_ROOT_LEVEL, 0, 3012 PT32_ROOT_LEVEL, 0,
3004 ACC_ALL, NULL); 3013 ACC_ALL, NULL);
@@ -3304,7 +3313,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, u32 error_code,
3304 spin_lock(&vcpu->kvm->mmu_lock); 3313 spin_lock(&vcpu->kvm->mmu_lock);
3305 if (mmu_notifier_retry(vcpu->kvm, mmu_seq)) 3314 if (mmu_notifier_retry(vcpu->kvm, mmu_seq))
3306 goto out_unlock; 3315 goto out_unlock;
3307 kvm_mmu_free_some_pages(vcpu); 3316 make_mmu_pages_available(vcpu);
3308 if (likely(!force_pt_level)) 3317 if (likely(!force_pt_level))
3309 transparent_hugepage_adjust(vcpu, &gfn, &pfn, &level); 3318 transparent_hugepage_adjust(vcpu, &gfn, &pfn, &level);
3310 r = __direct_map(vcpu, gpa, write, map_writable, 3319 r = __direct_map(vcpu, gpa, write, map_writable,
@@ -4006,17 +4015,17 @@ int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva)
4006} 4015}
4007EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt); 4016EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt);
4008 4017
4009void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) 4018static void make_mmu_pages_available(struct kvm_vcpu *vcpu)
4010{ 4019{
4011 LIST_HEAD(invalid_list); 4020 LIST_HEAD(invalid_list);
4012 4021
4013 while (kvm_mmu_available_pages(vcpu->kvm) < KVM_REFILL_PAGES && 4022 if (likely(kvm_mmu_available_pages(vcpu->kvm) >= KVM_MIN_FREE_MMU_PAGES))
4014 !list_empty(&vcpu->kvm->arch.active_mmu_pages)) { 4023 return;
4015 struct kvm_mmu_page *sp; 4024
4025 while (kvm_mmu_available_pages(vcpu->kvm) < KVM_REFILL_PAGES) {
4026 if (!prepare_zap_oldest_mmu_page(vcpu->kvm, &invalid_list))
4027 break;
4016 4028
4017 sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
4018 struct kvm_mmu_page, link);
4019 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, &invalid_list);
4020 ++vcpu->kvm->stat.mmu_recycled; 4029 ++vcpu->kvm->stat.mmu_recycled;
4021 } 4030 }
4022 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list); 4031 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
@@ -4185,17 +4194,22 @@ restart:
4185 spin_unlock(&kvm->mmu_lock); 4194 spin_unlock(&kvm->mmu_lock);
4186} 4195}
4187 4196
4188static void kvm_mmu_remove_some_alloc_mmu_pages(struct kvm *kvm, 4197void kvm_mmu_zap_mmio_sptes(struct kvm *kvm)
4189 struct list_head *invalid_list)
4190{ 4198{
4191 struct kvm_mmu_page *page; 4199 struct kvm_mmu_page *sp, *node;
4200 LIST_HEAD(invalid_list);
4192 4201
4193 if (list_empty(&kvm->arch.active_mmu_pages)) 4202 spin_lock(&kvm->mmu_lock);
4194 return; 4203restart:
4204 list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link) {
4205 if (!sp->mmio_cached)
4206 continue;
4207 if (kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list))
4208 goto restart;
4209 }
4195 4210
4196 page = container_of(kvm->arch.active_mmu_pages.prev, 4211 kvm_mmu_commit_zap_page(kvm, &invalid_list);
4197 struct kvm_mmu_page, link); 4212 spin_unlock(&kvm->mmu_lock);
4198 kvm_mmu_prepare_zap_page(kvm, page, invalid_list);
4199} 4213}
4200 4214
4201static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc) 4215static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)
@@ -4232,7 +4246,7 @@ static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)
4232 idx = srcu_read_lock(&kvm->srcu); 4246 idx = srcu_read_lock(&kvm->srcu);
4233 spin_lock(&kvm->mmu_lock); 4247 spin_lock(&kvm->mmu_lock);
4234 4248
4235 kvm_mmu_remove_some_alloc_mmu_pages(kvm, &invalid_list); 4249 prepare_zap_oldest_mmu_page(kvm, &invalid_list);
4236 kvm_mmu_commit_zap_page(kvm, &invalid_list); 4250 kvm_mmu_commit_zap_page(kvm, &invalid_list);
4237 4251
4238 spin_unlock(&kvm->mmu_lock); 4252 spin_unlock(&kvm->mmu_lock);
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 69871080e866..2adcbc2cac6d 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -57,14 +57,11 @@ int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context);
57 57
58static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) 58static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm)
59{ 59{
60 return kvm->arch.n_max_mmu_pages - 60 if (kvm->arch.n_max_mmu_pages > kvm->arch.n_used_mmu_pages)
61 kvm->arch.n_used_mmu_pages; 61 return kvm->arch.n_max_mmu_pages -
62} 62 kvm->arch.n_used_mmu_pages;
63 63
64static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) 64 return 0;
65{
66 if (unlikely(kvm_mmu_available_pages(vcpu->kvm)< KVM_MIN_FREE_MMU_PAGES))
67 __kvm_mmu_free_some_pages(vcpu);
68} 65}
69 66
70static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu) 67static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 105dd5bd550e..da20860b457a 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -627,7 +627,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
627 goto out_unlock; 627 goto out_unlock;
628 628
629 kvm_mmu_audit(vcpu, AUDIT_PRE_PAGE_FAULT); 629 kvm_mmu_audit(vcpu, AUDIT_PRE_PAGE_FAULT);
630 kvm_mmu_free_some_pages(vcpu); 630 make_mmu_pages_available(vcpu);
631 if (!force_pt_level) 631 if (!force_pt_level)
632 transparent_hugepage_adjust(vcpu, &walker.gfn, &pfn, &level); 632 transparent_hugepage_adjust(vcpu, &walker.gfn, &pfn, &level);
633 r = FNAME(fetch)(vcpu, addr, &walker, write_fault, 633 r = FNAME(fetch)(vcpu, addr, &walker, write_fault,
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index cfc258a6bf97..c53e797e7369 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -360,10 +360,12 @@ int kvm_pmu_get_msr(struct kvm_vcpu *vcpu, u32 index, u64 *data)
360 return 1; 360 return 1;
361} 361}
362 362
363int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, u32 index, u64 data) 363int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
364{ 364{
365 struct kvm_pmu *pmu = &vcpu->arch.pmu; 365 struct kvm_pmu *pmu = &vcpu->arch.pmu;
366 struct kvm_pmc *pmc; 366 struct kvm_pmc *pmc;
367 u32 index = msr_info->index;
368 u64 data = msr_info->data;
367 369
368 switch (index) { 370 switch (index) {
369 case MSR_CORE_PERF_FIXED_CTR_CTRL: 371 case MSR_CORE_PERF_FIXED_CTR_CTRL:
@@ -375,6 +377,10 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, u32 index, u64 data)
375 } 377 }
376 break; 378 break;
377 case MSR_CORE_PERF_GLOBAL_STATUS: 379 case MSR_CORE_PERF_GLOBAL_STATUS:
380 if (msr_info->host_initiated) {
381 pmu->global_status = data;
382 return 0;
383 }
378 break; /* RO MSR */ 384 break; /* RO MSR */
379 case MSR_CORE_PERF_GLOBAL_CTRL: 385 case MSR_CORE_PERF_GLOBAL_CTRL:
380 if (pmu->global_ctrl == data) 386 if (pmu->global_ctrl == data)
@@ -386,7 +392,8 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, u32 index, u64 data)
386 break; 392 break;
387 case MSR_CORE_PERF_GLOBAL_OVF_CTRL: 393 case MSR_CORE_PERF_GLOBAL_OVF_CTRL:
388 if (!(data & (pmu->global_ctrl_mask & ~(3ull<<62)))) { 394 if (!(data & (pmu->global_ctrl_mask & ~(3ull<<62)))) {
389 pmu->global_status &= ~data; 395 if (!msr_info->host_initiated)
396 pmu->global_status &= ~data;
390 pmu->global_ovf_ctrl = data; 397 pmu->global_ovf_ctrl = data;
391 return 0; 398 return 0;
392 } 399 }
@@ -394,7 +401,8 @@ int kvm_pmu_set_msr(struct kvm_vcpu *vcpu, u32 index, u64 data)
394 default: 401 default:
395 if ((pmc = get_gp_pmc(pmu, index, MSR_IA32_PERFCTR0)) || 402 if ((pmc = get_gp_pmc(pmu, index, MSR_IA32_PERFCTR0)) ||
396 (pmc = get_fixed_pmc(pmu, index))) { 403 (pmc = get_fixed_pmc(pmu, index))) {
397 data = (s64)(s32)data; 404 if (!msr_info->host_initiated)
405 data = (s64)(s32)data;
398 pmc->counter += data - read_pmc(pmc); 406 pmc->counter += data - read_pmc(pmc);
399 return 0; 407 return 0;
400 } else if ((pmc = get_gp_pmc(pmu, index, MSR_P6_EVNTSEL0))) { 408 } else if ((pmc = get_gp_pmc(pmu, index, MSR_P6_EVNTSEL0))) {
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index e1b1ce21bc00..a14a6eaf871d 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -555,7 +555,7 @@ static void svm_init_erratum_383(void)
555 int err; 555 int err;
556 u64 val; 556 u64 val;
557 557
558 if (!cpu_has_amd_erratum(amd_erratum_383)) 558 if (!static_cpu_has_bug(X86_BUG_AMD_TLB_MMATCH))
559 return; 559 return;
560 560
561 /* Use _safe variants to not break nested virtualization */ 561 /* Use _safe variants to not break nested virtualization */
@@ -1131,17 +1131,11 @@ static void init_vmcb(struct vcpu_svm *svm)
1131 init_seg(&save->gs); 1131 init_seg(&save->gs);
1132 1132
1133 save->cs.selector = 0xf000; 1133 save->cs.selector = 0xf000;
1134 save->cs.base = 0xffff0000;
1134 /* Executable/Readable Code Segment */ 1135 /* Executable/Readable Code Segment */
1135 save->cs.attrib = SVM_SELECTOR_READ_MASK | SVM_SELECTOR_P_MASK | 1136 save->cs.attrib = SVM_SELECTOR_READ_MASK | SVM_SELECTOR_P_MASK |
1136 SVM_SELECTOR_S_MASK | SVM_SELECTOR_CODE_MASK; 1137 SVM_SELECTOR_S_MASK | SVM_SELECTOR_CODE_MASK;
1137 save->cs.limit = 0xffff; 1138 save->cs.limit = 0xffff;
1138 /*
1139 * cs.base should really be 0xffff0000, but vmx can't handle that, so
1140 * be consistent with it.
1141 *
1142 * Replace when we have real mode working for vmx.
1143 */
1144 save->cs.base = 0xf0000;
1145 1139
1146 save->gdtr.limit = 0xffff; 1140 save->gdtr.limit = 0xffff;
1147 save->idtr.limit = 0xffff; 1141 save->idtr.limit = 0xffff;
@@ -1191,7 +1185,7 @@ static void init_vmcb(struct vcpu_svm *svm)
1191 enable_gif(svm); 1185 enable_gif(svm);
1192} 1186}
1193 1187
1194static int svm_vcpu_reset(struct kvm_vcpu *vcpu) 1188static void svm_vcpu_reset(struct kvm_vcpu *vcpu)
1195{ 1189{
1196 struct vcpu_svm *svm = to_svm(vcpu); 1190 struct vcpu_svm *svm = to_svm(vcpu);
1197 u32 dummy; 1191 u32 dummy;
@@ -1199,16 +1193,8 @@ static int svm_vcpu_reset(struct kvm_vcpu *vcpu)
1199 1193
1200 init_vmcb(svm); 1194 init_vmcb(svm);
1201 1195
1202 if (!kvm_vcpu_is_bsp(vcpu)) {
1203 kvm_rip_write(vcpu, 0);
1204 svm->vmcb->save.cs.base = svm->vcpu.arch.sipi_vector << 12;
1205 svm->vmcb->save.cs.selector = svm->vcpu.arch.sipi_vector << 8;
1206 }
1207
1208 kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy); 1196 kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy);
1209 kvm_register_write(vcpu, VCPU_REGS_RDX, eax); 1197 kvm_register_write(vcpu, VCPU_REGS_RDX, eax);
1210
1211 return 0;
1212} 1198}
1213 1199
1214static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) 1200static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
@@ -3487,7 +3473,7 @@ static int handle_exit(struct kvm_vcpu *vcpu)
3487 exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR && 3473 exit_code != SVM_EXIT_EXCP_BASE + PF_VECTOR &&
3488 exit_code != SVM_EXIT_NPF && exit_code != SVM_EXIT_TASK_SWITCH && 3474 exit_code != SVM_EXIT_NPF && exit_code != SVM_EXIT_TASK_SWITCH &&
3489 exit_code != SVM_EXIT_INTR && exit_code != SVM_EXIT_NMI) 3475 exit_code != SVM_EXIT_INTR && exit_code != SVM_EXIT_NMI)
3490 printk(KERN_ERR "%s: unexpected exit_ini_info 0x%x " 3476 printk(KERN_ERR "%s: unexpected exit_int_info 0x%x "
3491 "exit_code 0x%x\n", 3477 "exit_code 0x%x\n",
3492 __func__, svm->vmcb->control.exit_int_info, 3478 __func__, svm->vmcb->control.exit_int_info,
3493 exit_code); 3479 exit_code);
@@ -3591,6 +3577,11 @@ static void svm_hwapic_isr_update(struct kvm *kvm, int isr)
3591 return; 3577 return;
3592} 3578}
3593 3579
3580static void svm_sync_pir_to_irr(struct kvm_vcpu *vcpu)
3581{
3582 return;
3583}
3584
3594static int svm_nmi_allowed(struct kvm_vcpu *vcpu) 3585static int svm_nmi_allowed(struct kvm_vcpu *vcpu)
3595{ 3586{
3596 struct vcpu_svm *svm = to_svm(vcpu); 3587 struct vcpu_svm *svm = to_svm(vcpu);
@@ -3641,7 +3632,7 @@ static int svm_interrupt_allowed(struct kvm_vcpu *vcpu)
3641 return ret; 3632 return ret;
3642} 3633}
3643 3634
3644static void enable_irq_window(struct kvm_vcpu *vcpu) 3635static int enable_irq_window(struct kvm_vcpu *vcpu)
3645{ 3636{
3646 struct vcpu_svm *svm = to_svm(vcpu); 3637 struct vcpu_svm *svm = to_svm(vcpu);
3647 3638
@@ -3655,15 +3646,16 @@ static void enable_irq_window(struct kvm_vcpu *vcpu)
3655 svm_set_vintr(svm); 3646 svm_set_vintr(svm);
3656 svm_inject_irq(svm, 0x0); 3647 svm_inject_irq(svm, 0x0);
3657 } 3648 }
3649 return 0;
3658} 3650}
3659 3651
3660static void enable_nmi_window(struct kvm_vcpu *vcpu) 3652static int enable_nmi_window(struct kvm_vcpu *vcpu)
3661{ 3653{
3662 struct vcpu_svm *svm = to_svm(vcpu); 3654 struct vcpu_svm *svm = to_svm(vcpu);
3663 3655
3664 if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK)) 3656 if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK))
3665 == HF_NMI_MASK) 3657 == HF_NMI_MASK)
3666 return; /* IRET will cause a vm exit */ 3658 return 0; /* IRET will cause a vm exit */
3667 3659
3668 /* 3660 /*
3669 * Something prevents NMI from been injected. Single step over possible 3661 * Something prevents NMI from been injected. Single step over possible
@@ -3672,6 +3664,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
3672 svm->nmi_singlestep = true; 3664 svm->nmi_singlestep = true;
3673 svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF); 3665 svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF);
3674 update_db_bp_intercept(vcpu); 3666 update_db_bp_intercept(vcpu);
3667 return 0;
3675} 3668}
3676 3669
3677static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr) 3670static int svm_set_tss_addr(struct kvm *kvm, unsigned int addr)
@@ -4247,6 +4240,11 @@ out:
4247 return ret; 4240 return ret;
4248} 4241}
4249 4242
4243static void svm_handle_external_intr(struct kvm_vcpu *vcpu)
4244{
4245 local_irq_enable();
4246}
4247
4250static struct kvm_x86_ops svm_x86_ops = { 4248static struct kvm_x86_ops svm_x86_ops = {
4251 .cpu_has_kvm_support = has_svm, 4249 .cpu_has_kvm_support = has_svm,
4252 .disabled_by_bios = is_disabled, 4250 .disabled_by_bios = is_disabled,
@@ -4314,6 +4312,7 @@ static struct kvm_x86_ops svm_x86_ops = {
4314 .vm_has_apicv = svm_vm_has_apicv, 4312 .vm_has_apicv = svm_vm_has_apicv,
4315 .load_eoi_exitmap = svm_load_eoi_exitmap, 4313 .load_eoi_exitmap = svm_load_eoi_exitmap,
4316 .hwapic_isr_update = svm_hwapic_isr_update, 4314 .hwapic_isr_update = svm_hwapic_isr_update,
4315 .sync_pir_to_irr = svm_sync_pir_to_irr,
4317 4316
4318 .set_tss_addr = svm_set_tss_addr, 4317 .set_tss_addr = svm_set_tss_addr,
4319 .get_tdp_level = get_npt_level, 4318 .get_tdp_level = get_npt_level,
@@ -4342,6 +4341,7 @@ static struct kvm_x86_ops svm_x86_ops = {
4342 .set_tdp_cr3 = set_tdp_cr3, 4341 .set_tdp_cr3 = set_tdp_cr3,
4343 4342
4344 .check_intercept = svm_check_intercept, 4343 .check_intercept = svm_check_intercept,
4344 .handle_external_intr = svm_handle_external_intr,
4345}; 4345};
4346 4346
4347static int __init svm_init(void) 4347static int __init svm_init(void)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 6667042714cc..25a791ed21c8 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -84,8 +84,11 @@ module_param(vmm_exclusive, bool, S_IRUGO);
84static bool __read_mostly fasteoi = 1; 84static bool __read_mostly fasteoi = 1;
85module_param(fasteoi, bool, S_IRUGO); 85module_param(fasteoi, bool, S_IRUGO);
86 86
87static bool __read_mostly enable_apicv_reg_vid; 87static bool __read_mostly enable_apicv = 1;
88module_param(enable_apicv, bool, S_IRUGO);
88 89
90static bool __read_mostly enable_shadow_vmcs = 1;
91module_param_named(enable_shadow_vmcs, enable_shadow_vmcs, bool, S_IRUGO);
89/* 92/*
90 * If nested=1, nested virtualization is supported, i.e., guests may use 93 * If nested=1, nested virtualization is supported, i.e., guests may use
91 * VMX and be a hypervisor for its own guests. If nested=0, guests may not 94 * VMX and be a hypervisor for its own guests. If nested=0, guests may not
@@ -298,7 +301,8 @@ struct __packed vmcs12 {
298 u32 guest_activity_state; 301 u32 guest_activity_state;
299 u32 guest_sysenter_cs; 302 u32 guest_sysenter_cs;
300 u32 host_ia32_sysenter_cs; 303 u32 host_ia32_sysenter_cs;
301 u32 padding32[8]; /* room for future expansion */ 304 u32 vmx_preemption_timer_value;
305 u32 padding32[7]; /* room for future expansion */
302 u16 virtual_processor_id; 306 u16 virtual_processor_id;
303 u16 guest_es_selector; 307 u16 guest_es_selector;
304 u16 guest_cs_selector; 308 u16 guest_cs_selector;
@@ -351,6 +355,12 @@ struct nested_vmx {
351 /* The host-usable pointer to the above */ 355 /* The host-usable pointer to the above */
352 struct page *current_vmcs12_page; 356 struct page *current_vmcs12_page;
353 struct vmcs12 *current_vmcs12; 357 struct vmcs12 *current_vmcs12;
358 struct vmcs *current_shadow_vmcs;
359 /*
360 * Indicates if the shadow vmcs must be updated with the
361 * data hold by vmcs12
362 */
363 bool sync_shadow_vmcs;
354 364
355 /* vmcs02_list cache of VMCSs recently used to run L2 guests */ 365 /* vmcs02_list cache of VMCSs recently used to run L2 guests */
356 struct list_head vmcs02_pool; 366 struct list_head vmcs02_pool;
@@ -365,6 +375,31 @@ struct nested_vmx {
365 struct page *apic_access_page; 375 struct page *apic_access_page;
366}; 376};
367 377
378#define POSTED_INTR_ON 0
379/* Posted-Interrupt Descriptor */
380struct pi_desc {
381 u32 pir[8]; /* Posted interrupt requested */
382 u32 control; /* bit 0 of control is outstanding notification bit */
383 u32 rsvd[7];
384} __aligned(64);
385
386static bool pi_test_and_set_on(struct pi_desc *pi_desc)
387{
388 return test_and_set_bit(POSTED_INTR_ON,
389 (unsigned long *)&pi_desc->control);
390}
391
392static bool pi_test_and_clear_on(struct pi_desc *pi_desc)
393{
394 return test_and_clear_bit(POSTED_INTR_ON,
395 (unsigned long *)&pi_desc->control);
396}
397
398static int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc)
399{
400 return test_and_set_bit(vector, (unsigned long *)pi_desc->pir);
401}
402
368struct vcpu_vmx { 403struct vcpu_vmx {
369 struct kvm_vcpu vcpu; 404 struct kvm_vcpu vcpu;
370 unsigned long host_rsp; 405 unsigned long host_rsp;
@@ -377,6 +412,7 @@ struct vcpu_vmx {
377 struct shared_msr_entry *guest_msrs; 412 struct shared_msr_entry *guest_msrs;
378 int nmsrs; 413 int nmsrs;
379 int save_nmsrs; 414 int save_nmsrs;
415 unsigned long host_idt_base;
380#ifdef CONFIG_X86_64 416#ifdef CONFIG_X86_64
381 u64 msr_host_kernel_gs_base; 417 u64 msr_host_kernel_gs_base;
382 u64 msr_guest_kernel_gs_base; 418 u64 msr_guest_kernel_gs_base;
@@ -428,6 +464,9 @@ struct vcpu_vmx {
428 464
429 bool rdtscp_enabled; 465 bool rdtscp_enabled;
430 466
467 /* Posted interrupt descriptor */
468 struct pi_desc pi_desc;
469
431 /* Support for a guest hypervisor (nested VMX) */ 470 /* Support for a guest hypervisor (nested VMX) */
432 struct nested_vmx nested; 471 struct nested_vmx nested;
433}; 472};
@@ -451,6 +490,64 @@ static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
451#define FIELD64(number, name) [number] = VMCS12_OFFSET(name), \ 490#define FIELD64(number, name) [number] = VMCS12_OFFSET(name), \
452 [number##_HIGH] = VMCS12_OFFSET(name)+4 491 [number##_HIGH] = VMCS12_OFFSET(name)+4
453 492
493
494static const unsigned long shadow_read_only_fields[] = {
495 /*
496 * We do NOT shadow fields that are modified when L0
497 * traps and emulates any vmx instruction (e.g. VMPTRLD,
498 * VMXON...) executed by L1.
499 * For example, VM_INSTRUCTION_ERROR is read
500 * by L1 if a vmx instruction fails (part of the error path).
501 * Note the code assumes this logic. If for some reason
502 * we start shadowing these fields then we need to
503 * force a shadow sync when L0 emulates vmx instructions
504 * (e.g. force a sync if VM_INSTRUCTION_ERROR is modified
505 * by nested_vmx_failValid)
506 */
507 VM_EXIT_REASON,
508 VM_EXIT_INTR_INFO,
509 VM_EXIT_INSTRUCTION_LEN,
510 IDT_VECTORING_INFO_FIELD,
511 IDT_VECTORING_ERROR_CODE,
512 VM_EXIT_INTR_ERROR_CODE,
513 EXIT_QUALIFICATION,
514 GUEST_LINEAR_ADDRESS,
515 GUEST_PHYSICAL_ADDRESS
516};
517static const int max_shadow_read_only_fields =
518 ARRAY_SIZE(shadow_read_only_fields);
519
520static const unsigned long shadow_read_write_fields[] = {
521 GUEST_RIP,
522 GUEST_RSP,
523 GUEST_CR0,
524 GUEST_CR3,
525 GUEST_CR4,
526 GUEST_INTERRUPTIBILITY_INFO,
527 GUEST_RFLAGS,
528 GUEST_CS_SELECTOR,
529 GUEST_CS_AR_BYTES,
530 GUEST_CS_LIMIT,
531 GUEST_CS_BASE,
532 GUEST_ES_BASE,
533 CR0_GUEST_HOST_MASK,
534 CR0_READ_SHADOW,
535 CR4_READ_SHADOW,
536 TSC_OFFSET,
537 EXCEPTION_BITMAP,
538 CPU_BASED_VM_EXEC_CONTROL,
539 VM_ENTRY_EXCEPTION_ERROR_CODE,
540 VM_ENTRY_INTR_INFO_FIELD,
541 VM_ENTRY_INSTRUCTION_LEN,
542 VM_ENTRY_EXCEPTION_ERROR_CODE,
543 HOST_FS_BASE,
544 HOST_GS_BASE,
545 HOST_FS_SELECTOR,
546 HOST_GS_SELECTOR
547};
548static const int max_shadow_read_write_fields =
549 ARRAY_SIZE(shadow_read_write_fields);
550
454static const unsigned short vmcs_field_to_offset_table[] = { 551static const unsigned short vmcs_field_to_offset_table[] = {
455 FIELD(VIRTUAL_PROCESSOR_ID, virtual_processor_id), 552 FIELD(VIRTUAL_PROCESSOR_ID, virtual_processor_id),
456 FIELD(GUEST_ES_SELECTOR, guest_es_selector), 553 FIELD(GUEST_ES_SELECTOR, guest_es_selector),
@@ -537,6 +634,7 @@ static const unsigned short vmcs_field_to_offset_table[] = {
537 FIELD(GUEST_ACTIVITY_STATE, guest_activity_state), 634 FIELD(GUEST_ACTIVITY_STATE, guest_activity_state),
538 FIELD(GUEST_SYSENTER_CS, guest_sysenter_cs), 635 FIELD(GUEST_SYSENTER_CS, guest_sysenter_cs),
539 FIELD(HOST_IA32_SYSENTER_CS, host_ia32_sysenter_cs), 636 FIELD(HOST_IA32_SYSENTER_CS, host_ia32_sysenter_cs),
637 FIELD(VMX_PREEMPTION_TIMER_VALUE, vmx_preemption_timer_value),
540 FIELD(CR0_GUEST_HOST_MASK, cr0_guest_host_mask), 638 FIELD(CR0_GUEST_HOST_MASK, cr0_guest_host_mask),
541 FIELD(CR4_GUEST_HOST_MASK, cr4_guest_host_mask), 639 FIELD(CR4_GUEST_HOST_MASK, cr4_guest_host_mask),
542 FIELD(CR0_READ_SHADOW, cr0_read_shadow), 640 FIELD(CR0_READ_SHADOW, cr0_read_shadow),
@@ -624,6 +722,9 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
624 struct kvm_segment *var, int seg); 722 struct kvm_segment *var, int seg);
625static bool guest_state_valid(struct kvm_vcpu *vcpu); 723static bool guest_state_valid(struct kvm_vcpu *vcpu);
626static u32 vmx_segment_access_rights(struct kvm_segment *var); 724static u32 vmx_segment_access_rights(struct kvm_segment *var);
725static void vmx_sync_pir_to_irr_dummy(struct kvm_vcpu *vcpu);
726static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx);
727static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx);
627 728
628static DEFINE_PER_CPU(struct vmcs *, vmxarea); 729static DEFINE_PER_CPU(struct vmcs *, vmxarea);
629static DEFINE_PER_CPU(struct vmcs *, current_vmcs); 730static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
@@ -640,6 +741,8 @@ static unsigned long *vmx_msr_bitmap_legacy;
640static unsigned long *vmx_msr_bitmap_longmode; 741static unsigned long *vmx_msr_bitmap_longmode;
641static unsigned long *vmx_msr_bitmap_legacy_x2apic; 742static unsigned long *vmx_msr_bitmap_legacy_x2apic;
642static unsigned long *vmx_msr_bitmap_longmode_x2apic; 743static unsigned long *vmx_msr_bitmap_longmode_x2apic;
744static unsigned long *vmx_vmread_bitmap;
745static unsigned long *vmx_vmwrite_bitmap;
643 746
644static bool cpu_has_load_ia32_efer; 747static bool cpu_has_load_ia32_efer;
645static bool cpu_has_load_perf_global_ctrl; 748static bool cpu_has_load_perf_global_ctrl;
@@ -782,6 +885,18 @@ static inline bool cpu_has_vmx_virtual_intr_delivery(void)
782 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY; 885 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY;
783} 886}
784 887
888static inline bool cpu_has_vmx_posted_intr(void)
889{
890 return vmcs_config.pin_based_exec_ctrl & PIN_BASED_POSTED_INTR;
891}
892
893static inline bool cpu_has_vmx_apicv(void)
894{
895 return cpu_has_vmx_apic_register_virt() &&
896 cpu_has_vmx_virtual_intr_delivery() &&
897 cpu_has_vmx_posted_intr();
898}
899
785static inline bool cpu_has_vmx_flexpriority(void) 900static inline bool cpu_has_vmx_flexpriority(void)
786{ 901{
787 return cpu_has_vmx_tpr_shadow() && 902 return cpu_has_vmx_tpr_shadow() &&
@@ -895,6 +1010,18 @@ static inline bool cpu_has_vmx_wbinvd_exit(void)
895 SECONDARY_EXEC_WBINVD_EXITING; 1010 SECONDARY_EXEC_WBINVD_EXITING;
896} 1011}
897 1012
1013static inline bool cpu_has_vmx_shadow_vmcs(void)
1014{
1015 u64 vmx_msr;
1016 rdmsrl(MSR_IA32_VMX_MISC, vmx_msr);
1017 /* check if the cpu supports writing r/o exit information fields */
1018 if (!(vmx_msr & MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS))
1019 return false;
1020
1021 return vmcs_config.cpu_based_2nd_exec_ctrl &
1022 SECONDARY_EXEC_SHADOW_VMCS;
1023}
1024
898static inline bool report_flexpriority(void) 1025static inline bool report_flexpriority(void)
899{ 1026{
900 return flexpriority_enabled; 1027 return flexpriority_enabled;
@@ -1790,7 +1917,7 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,
1790 u32 intr_info = nr | INTR_INFO_VALID_MASK; 1917 u32 intr_info = nr | INTR_INFO_VALID_MASK;
1791 1918
1792 if (nr == PF_VECTOR && is_guest_mode(vcpu) && 1919 if (nr == PF_VECTOR && is_guest_mode(vcpu) &&
1793 nested_pf_handled(vcpu)) 1920 !vmx->nested.nested_run_pending && nested_pf_handled(vcpu))
1794 return; 1921 return;
1795 1922
1796 if (has_error_code) { 1923 if (has_error_code) {
@@ -2022,6 +2149,7 @@ static u32 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high;
2022static u32 nested_vmx_pinbased_ctls_low, nested_vmx_pinbased_ctls_high; 2149static u32 nested_vmx_pinbased_ctls_low, nested_vmx_pinbased_ctls_high;
2023static u32 nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high; 2150static u32 nested_vmx_exit_ctls_low, nested_vmx_exit_ctls_high;
2024static u32 nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high; 2151static u32 nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high;
2152static u32 nested_vmx_misc_low, nested_vmx_misc_high;
2025static __init void nested_vmx_setup_ctls_msrs(void) 2153static __init void nested_vmx_setup_ctls_msrs(void)
2026{ 2154{
2027 /* 2155 /*
@@ -2040,30 +2168,40 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2040 */ 2168 */
2041 2169
2042 /* pin-based controls */ 2170 /* pin-based controls */
2171 rdmsr(MSR_IA32_VMX_PINBASED_CTLS,
2172 nested_vmx_pinbased_ctls_low, nested_vmx_pinbased_ctls_high);
2043 /* 2173 /*
2044 * According to the Intel spec, if bit 55 of VMX_BASIC is off (as it is 2174 * According to the Intel spec, if bit 55 of VMX_BASIC is off (as it is
2045 * in our case), bits 1, 2 and 4 (i.e., 0x16) must be 1 in this MSR. 2175 * in our case), bits 1, 2 and 4 (i.e., 0x16) must be 1 in this MSR.
2046 */ 2176 */
2047 nested_vmx_pinbased_ctls_low = 0x16 ; 2177 nested_vmx_pinbased_ctls_low |= PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR;
2048 nested_vmx_pinbased_ctls_high = 0x16 | 2178 nested_vmx_pinbased_ctls_high &= PIN_BASED_EXT_INTR_MASK |
2049 PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING | 2179 PIN_BASED_NMI_EXITING | PIN_BASED_VIRTUAL_NMIS |
2050 PIN_BASED_VIRTUAL_NMIS; 2180 PIN_BASED_VMX_PREEMPTION_TIMER;
2181 nested_vmx_pinbased_ctls_high |= PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR;
2051 2182
2052 /* exit controls */ 2183 /*
2053 nested_vmx_exit_ctls_low = 0; 2184 * Exit controls
2185 * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and
2186 * 17 must be 1.
2187 */
2188 nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
2054 /* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */ 2189 /* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
2055#ifdef CONFIG_X86_64 2190#ifdef CONFIG_X86_64
2056 nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE; 2191 nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
2057#else 2192#else
2058 nested_vmx_exit_ctls_high = 0; 2193 nested_vmx_exit_ctls_high = 0;
2059#endif 2194#endif
2195 nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
2060 2196
2061 /* entry controls */ 2197 /* entry controls */
2062 rdmsr(MSR_IA32_VMX_ENTRY_CTLS, 2198 rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
2063 nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high); 2199 nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high);
2064 nested_vmx_entry_ctls_low = 0; 2200 /* If bit 55 of VMX_BASIC is off, bits 0-8 and 12 must be 1. */
2201 nested_vmx_entry_ctls_low = VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
2065 nested_vmx_entry_ctls_high &= 2202 nested_vmx_entry_ctls_high &=
2066 VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE; 2203 VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE;
2204 nested_vmx_entry_ctls_high |= VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
2067 2205
2068 /* cpu-based controls */ 2206 /* cpu-based controls */
2069 rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, 2207 rdmsr(MSR_IA32_VMX_PROCBASED_CTLS,
@@ -2080,6 +2218,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2080 CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING | 2218 CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING |
2081 CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING | 2219 CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING |
2082 CPU_BASED_RDPMC_EXITING | CPU_BASED_RDTSC_EXITING | 2220 CPU_BASED_RDPMC_EXITING | CPU_BASED_RDTSC_EXITING |
2221 CPU_BASED_PAUSE_EXITING |
2083 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; 2222 CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
2084 /* 2223 /*
2085 * We can allow some features even when not supported by the 2224 * We can allow some features even when not supported by the
@@ -2094,7 +2233,14 @@ static __init void nested_vmx_setup_ctls_msrs(void)
2094 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high); 2233 nested_vmx_secondary_ctls_low, nested_vmx_secondary_ctls_high);
2095 nested_vmx_secondary_ctls_low = 0; 2234 nested_vmx_secondary_ctls_low = 0;
2096 nested_vmx_secondary_ctls_high &= 2235 nested_vmx_secondary_ctls_high &=
2097 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; 2236 SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
2237 SECONDARY_EXEC_WBINVD_EXITING;
2238
2239 /* miscellaneous data */
2240 rdmsr(MSR_IA32_VMX_MISC, nested_vmx_misc_low, nested_vmx_misc_high);
2241 nested_vmx_misc_low &= VMX_MISC_PREEMPTION_TIMER_RATE_MASK |
2242 VMX_MISC_SAVE_EFER_LMA;
2243 nested_vmx_misc_high = 0;
2098} 2244}
2099 2245
2100static inline bool vmx_control_verify(u32 control, u32 low, u32 high) 2246static inline bool vmx_control_verify(u32 control, u32 low, u32 high)
@@ -2165,7 +2311,8 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
2165 nested_vmx_entry_ctls_high); 2311 nested_vmx_entry_ctls_high);
2166 break; 2312 break;
2167 case MSR_IA32_VMX_MISC: 2313 case MSR_IA32_VMX_MISC:
2168 *pdata = 0; 2314 *pdata = vmx_control_msr(nested_vmx_misc_low,
2315 nested_vmx_misc_high);
2169 break; 2316 break;
2170 /* 2317 /*
2171 * These MSRs specify bits which the guest must keep fixed (on or off) 2318 * These MSRs specify bits which the guest must keep fixed (on or off)
@@ -2459,7 +2606,7 @@ static int hardware_enable(void *garbage)
2459 ept_sync_global(); 2606 ept_sync_global();
2460 } 2607 }
2461 2608
2462 store_gdt(&__get_cpu_var(host_gdt)); 2609 native_store_gdt(&__get_cpu_var(host_gdt));
2463 2610
2464 return 0; 2611 return 0;
2465} 2612}
@@ -2529,12 +2676,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
2529 u32 _vmexit_control = 0; 2676 u32 _vmexit_control = 0;
2530 u32 _vmentry_control = 0; 2677 u32 _vmentry_control = 0;
2531 2678
2532 min = PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING;
2533 opt = PIN_BASED_VIRTUAL_NMIS;
2534 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PINBASED_CTLS,
2535 &_pin_based_exec_control) < 0)
2536 return -EIO;
2537
2538 min = CPU_BASED_HLT_EXITING | 2679 min = CPU_BASED_HLT_EXITING |
2539#ifdef CONFIG_X86_64 2680#ifdef CONFIG_X86_64
2540 CPU_BASED_CR8_LOAD_EXITING | 2681 CPU_BASED_CR8_LOAD_EXITING |
@@ -2573,7 +2714,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
2573 SECONDARY_EXEC_RDTSCP | 2714 SECONDARY_EXEC_RDTSCP |
2574 SECONDARY_EXEC_ENABLE_INVPCID | 2715 SECONDARY_EXEC_ENABLE_INVPCID |
2575 SECONDARY_EXEC_APIC_REGISTER_VIRT | 2716 SECONDARY_EXEC_APIC_REGISTER_VIRT |
2576 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY; 2717 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
2718 SECONDARY_EXEC_SHADOW_VMCS;
2577 if (adjust_vmx_controls(min2, opt2, 2719 if (adjust_vmx_controls(min2, opt2,
2578 MSR_IA32_VMX_PROCBASED_CTLS2, 2720 MSR_IA32_VMX_PROCBASED_CTLS2,
2579 &_cpu_based_2nd_exec_control) < 0) 2721 &_cpu_based_2nd_exec_control) < 0)
@@ -2605,11 +2747,23 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
2605#ifdef CONFIG_X86_64 2747#ifdef CONFIG_X86_64
2606 min |= VM_EXIT_HOST_ADDR_SPACE_SIZE; 2748 min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
2607#endif 2749#endif
2608 opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT; 2750 opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT |
2751 VM_EXIT_ACK_INTR_ON_EXIT;
2609 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS, 2752 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS,
2610 &_vmexit_control) < 0) 2753 &_vmexit_control) < 0)
2611 return -EIO; 2754 return -EIO;
2612 2755
2756 min = PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING;
2757 opt = PIN_BASED_VIRTUAL_NMIS | PIN_BASED_POSTED_INTR;
2758 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PINBASED_CTLS,
2759 &_pin_based_exec_control) < 0)
2760 return -EIO;
2761
2762 if (!(_cpu_based_2nd_exec_control &
2763 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) ||
2764 !(_vmexit_control & VM_EXIT_ACK_INTR_ON_EXIT))
2765 _pin_based_exec_control &= ~PIN_BASED_POSTED_INTR;
2766
2613 min = 0; 2767 min = 0;
2614 opt = VM_ENTRY_LOAD_IA32_PAT; 2768 opt = VM_ENTRY_LOAD_IA32_PAT;
2615 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS, 2769 if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS,
@@ -2762,6 +2916,8 @@ static __init int hardware_setup(void)
2762 2916
2763 if (!cpu_has_vmx_vpid()) 2917 if (!cpu_has_vmx_vpid())
2764 enable_vpid = 0; 2918 enable_vpid = 0;
2919 if (!cpu_has_vmx_shadow_vmcs())
2920 enable_shadow_vmcs = 0;
2765 2921
2766 if (!cpu_has_vmx_ept() || 2922 if (!cpu_has_vmx_ept() ||
2767 !cpu_has_vmx_ept_4levels()) { 2923 !cpu_has_vmx_ept_4levels()) {
@@ -2788,14 +2944,16 @@ static __init int hardware_setup(void)
2788 if (!cpu_has_vmx_ple()) 2944 if (!cpu_has_vmx_ple())
2789 ple_gap = 0; 2945 ple_gap = 0;
2790 2946
2791 if (!cpu_has_vmx_apic_register_virt() || 2947 if (!cpu_has_vmx_apicv())
2792 !cpu_has_vmx_virtual_intr_delivery()) 2948 enable_apicv = 0;
2793 enable_apicv_reg_vid = 0;
2794 2949
2795 if (enable_apicv_reg_vid) 2950 if (enable_apicv)
2796 kvm_x86_ops->update_cr8_intercept = NULL; 2951 kvm_x86_ops->update_cr8_intercept = NULL;
2797 else 2952 else {
2798 kvm_x86_ops->hwapic_irr_update = NULL; 2953 kvm_x86_ops->hwapic_irr_update = NULL;
2954 kvm_x86_ops->deliver_posted_interrupt = NULL;
2955 kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
2956 }
2799 2957
2800 if (nested) 2958 if (nested)
2801 nested_vmx_setup_ctls_msrs(); 2959 nested_vmx_setup_ctls_msrs();
@@ -2876,22 +3034,6 @@ static void enter_pmode(struct kvm_vcpu *vcpu)
2876 vmx->cpl = 0; 3034 vmx->cpl = 0;
2877} 3035}
2878 3036
2879static gva_t rmode_tss_base(struct kvm *kvm)
2880{
2881 if (!kvm->arch.tss_addr) {
2882 struct kvm_memslots *slots;
2883 struct kvm_memory_slot *slot;
2884 gfn_t base_gfn;
2885
2886 slots = kvm_memslots(kvm);
2887 slot = id_to_memslot(slots, 0);
2888 base_gfn = slot->base_gfn + slot->npages - 3;
2889
2890 return base_gfn << PAGE_SHIFT;
2891 }
2892 return kvm->arch.tss_addr;
2893}
2894
2895static void fix_rmode_seg(int seg, struct kvm_segment *save) 3037static void fix_rmode_seg(int seg, struct kvm_segment *save)
2896{ 3038{
2897 const struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; 3039 const struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
@@ -2942,19 +3084,15 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
2942 3084
2943 /* 3085 /*
2944 * Very old userspace does not call KVM_SET_TSS_ADDR before entering 3086 * Very old userspace does not call KVM_SET_TSS_ADDR before entering
2945 * vcpu. Call it here with phys address pointing 16M below 4G. 3087 * vcpu. Warn the user that an update is overdue.
2946 */ 3088 */
2947 if (!vcpu->kvm->arch.tss_addr) { 3089 if (!vcpu->kvm->arch.tss_addr)
2948 printk_once(KERN_WARNING "kvm: KVM_SET_TSS_ADDR need to be " 3090 printk_once(KERN_WARNING "kvm: KVM_SET_TSS_ADDR need to be "
2949 "called before entering vcpu\n"); 3091 "called before entering vcpu\n");
2950 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
2951 vmx_set_tss_addr(vcpu->kvm, 0xfeffd000);
2952 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
2953 }
2954 3092
2955 vmx_segment_cache_clear(vmx); 3093 vmx_segment_cache_clear(vmx);
2956 3094
2957 vmcs_writel(GUEST_TR_BASE, rmode_tss_base(vcpu->kvm)); 3095 vmcs_writel(GUEST_TR_BASE, vcpu->kvm->arch.tss_addr);
2958 vmcs_write32(GUEST_TR_LIMIT, RMODE_TSS_SIZE - 1); 3096 vmcs_write32(GUEST_TR_LIMIT, RMODE_TSS_SIZE - 1);
2959 vmcs_write32(GUEST_TR_AR_BYTES, 0x008b); 3097 vmcs_write32(GUEST_TR_AR_BYTES, 0x008b);
2960 3098
@@ -3214,7 +3352,9 @@ static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
3214 */ 3352 */
3215 if (!nested_vmx_allowed(vcpu)) 3353 if (!nested_vmx_allowed(vcpu))
3216 return 1; 3354 return 1;
3217 } else if (to_vmx(vcpu)->nested.vmxon) 3355 }
3356 if (to_vmx(vcpu)->nested.vmxon &&
3357 ((cr4 & VMXON_CR4_ALWAYSON) != VMXON_CR4_ALWAYSON))
3218 return 1; 3358 return 1;
3219 3359
3220 vcpu->arch.cr4 = cr4; 3360 vcpu->arch.cr4 = cr4;
@@ -3550,7 +3690,7 @@ static bool guest_state_valid(struct kvm_vcpu *vcpu)
3550 return true; 3690 return true;
3551 3691
3552 /* real mode guest state checks */ 3692 /* real mode guest state checks */
3553 if (!is_protmode(vcpu)) { 3693 if (!is_protmode(vcpu) || (vmx_get_rflags(vcpu) & X86_EFLAGS_VM)) {
3554 if (!rmode_segment_valid(vcpu, VCPU_SREG_CS)) 3694 if (!rmode_segment_valid(vcpu, VCPU_SREG_CS))
3555 return false; 3695 return false;
3556 if (!rmode_segment_valid(vcpu, VCPU_SREG_SS)) 3696 if (!rmode_segment_valid(vcpu, VCPU_SREG_SS))
@@ -3599,7 +3739,7 @@ static int init_rmode_tss(struct kvm *kvm)
3599 int r, idx, ret = 0; 3739 int r, idx, ret = 0;
3600 3740
3601 idx = srcu_read_lock(&kvm->srcu); 3741 idx = srcu_read_lock(&kvm->srcu);
3602 fn = rmode_tss_base(kvm) >> PAGE_SHIFT; 3742 fn = kvm->arch.tss_addr >> PAGE_SHIFT;
3603 r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE); 3743 r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE);
3604 if (r < 0) 3744 if (r < 0)
3605 goto out; 3745 goto out;
@@ -3692,7 +3832,7 @@ static int alloc_apic_access_page(struct kvm *kvm)
3692 kvm_userspace_mem.flags = 0; 3832 kvm_userspace_mem.flags = 0;
3693 kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL; 3833 kvm_userspace_mem.guest_phys_addr = 0xfee00000ULL;
3694 kvm_userspace_mem.memory_size = PAGE_SIZE; 3834 kvm_userspace_mem.memory_size = PAGE_SIZE;
3695 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, false); 3835 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem);
3696 if (r) 3836 if (r)
3697 goto out; 3837 goto out;
3698 3838
@@ -3722,7 +3862,7 @@ static int alloc_identity_pagetable(struct kvm *kvm)
3722 kvm_userspace_mem.guest_phys_addr = 3862 kvm_userspace_mem.guest_phys_addr =
3723 kvm->arch.ept_identity_map_addr; 3863 kvm->arch.ept_identity_map_addr;
3724 kvm_userspace_mem.memory_size = PAGE_SIZE; 3864 kvm_userspace_mem.memory_size = PAGE_SIZE;
3725 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, false); 3865 r = __kvm_set_memory_region(kvm, &kvm_userspace_mem);
3726 if (r) 3866 if (r)
3727 goto out; 3867 goto out;
3728 3868
@@ -3869,13 +4009,59 @@ static void vmx_disable_intercept_msr_write_x2apic(u32 msr)
3869 msr, MSR_TYPE_W); 4009 msr, MSR_TYPE_W);
3870} 4010}
3871 4011
4012static int vmx_vm_has_apicv(struct kvm *kvm)
4013{
4014 return enable_apicv && irqchip_in_kernel(kvm);
4015}
4016
4017/*
4018 * Send interrupt to vcpu via posted interrupt way.
4019 * 1. If target vcpu is running(non-root mode), send posted interrupt
4020 * notification to vcpu and hardware will sync PIR to vIRR atomically.
4021 * 2. If target vcpu isn't running(root mode), kick it to pick up the
4022 * interrupt from PIR in next vmentry.
4023 */
4024static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector)
4025{
4026 struct vcpu_vmx *vmx = to_vmx(vcpu);
4027 int r;
4028
4029 if (pi_test_and_set_pir(vector, &vmx->pi_desc))
4030 return;
4031
4032 r = pi_test_and_set_on(&vmx->pi_desc);
4033 kvm_make_request(KVM_REQ_EVENT, vcpu);
4034#ifdef CONFIG_SMP
4035 if (!r && (vcpu->mode == IN_GUEST_MODE))
4036 apic->send_IPI_mask(get_cpu_mask(vcpu->cpu),
4037 POSTED_INTR_VECTOR);
4038 else
4039#endif
4040 kvm_vcpu_kick(vcpu);
4041}
4042
4043static void vmx_sync_pir_to_irr(struct kvm_vcpu *vcpu)
4044{
4045 struct vcpu_vmx *vmx = to_vmx(vcpu);
4046
4047 if (!pi_test_and_clear_on(&vmx->pi_desc))
4048 return;
4049
4050 kvm_apic_update_irr(vcpu, vmx->pi_desc.pir);
4051}
4052
4053static void vmx_sync_pir_to_irr_dummy(struct kvm_vcpu *vcpu)
4054{
4055 return;
4056}
4057
3872/* 4058/*
3873 * Set up the vmcs's constant host-state fields, i.e., host-state fields that 4059 * Set up the vmcs's constant host-state fields, i.e., host-state fields that
3874 * will not change in the lifetime of the guest. 4060 * will not change in the lifetime of the guest.
3875 * Note that host-state that does change is set elsewhere. E.g., host-state 4061 * Note that host-state that does change is set elsewhere. E.g., host-state
3876 * that is set differently for each CPU is set in vmx_vcpu_load(), not here. 4062 * that is set differently for each CPU is set in vmx_vcpu_load(), not here.
3877 */ 4063 */
3878static void vmx_set_constant_host_state(void) 4064static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
3879{ 4065{
3880 u32 low32, high32; 4066 u32 low32, high32;
3881 unsigned long tmpl; 4067 unsigned long tmpl;
@@ -3903,6 +4089,7 @@ static void vmx_set_constant_host_state(void)
3903 4089
3904 native_store_idt(&dt); 4090 native_store_idt(&dt);
3905 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */ 4091 vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */
4092 vmx->host_idt_base = dt.address;
3906 4093
3907 vmcs_writel(HOST_RIP, vmx_return); /* 22.2.5 */ 4094 vmcs_writel(HOST_RIP, vmx_return); /* 22.2.5 */
3908 4095
@@ -3928,6 +4115,15 @@ static void set_cr4_guest_host_mask(struct vcpu_vmx *vmx)
3928 vmcs_writel(CR4_GUEST_HOST_MASK, ~vmx->vcpu.arch.cr4_guest_owned_bits); 4115 vmcs_writel(CR4_GUEST_HOST_MASK, ~vmx->vcpu.arch.cr4_guest_owned_bits);
3929} 4116}
3930 4117
4118static u32 vmx_pin_based_exec_ctrl(struct vcpu_vmx *vmx)
4119{
4120 u32 pin_based_exec_ctrl = vmcs_config.pin_based_exec_ctrl;
4121
4122 if (!vmx_vm_has_apicv(vmx->vcpu.kvm))
4123 pin_based_exec_ctrl &= ~PIN_BASED_POSTED_INTR;
4124 return pin_based_exec_ctrl;
4125}
4126
3931static u32 vmx_exec_control(struct vcpu_vmx *vmx) 4127static u32 vmx_exec_control(struct vcpu_vmx *vmx)
3932{ 4128{
3933 u32 exec_control = vmcs_config.cpu_based_exec_ctrl; 4129 u32 exec_control = vmcs_config.cpu_based_exec_ctrl;
@@ -3945,11 +4141,6 @@ static u32 vmx_exec_control(struct vcpu_vmx *vmx)
3945 return exec_control; 4141 return exec_control;
3946} 4142}
3947 4143
3948static int vmx_vm_has_apicv(struct kvm *kvm)
3949{
3950 return enable_apicv_reg_vid && irqchip_in_kernel(kvm);
3951}
3952
3953static u32 vmx_secondary_exec_control(struct vcpu_vmx *vmx) 4144static u32 vmx_secondary_exec_control(struct vcpu_vmx *vmx)
3954{ 4145{
3955 u32 exec_control = vmcs_config.cpu_based_2nd_exec_ctrl; 4146 u32 exec_control = vmcs_config.cpu_based_2nd_exec_ctrl;
@@ -3971,6 +4162,12 @@ static u32 vmx_secondary_exec_control(struct vcpu_vmx *vmx)
3971 exec_control &= ~(SECONDARY_EXEC_APIC_REGISTER_VIRT | 4162 exec_control &= ~(SECONDARY_EXEC_APIC_REGISTER_VIRT |
3972 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY); 4163 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);
3973 exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE; 4164 exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE;
4165 /* SECONDARY_EXEC_SHADOW_VMCS is enabled when L1 executes VMPTRLD
4166 (handle_vmptrld).
4167 We can NOT enable shadow_vmcs here because we don't have yet
4168 a current VMCS12
4169 */
4170 exec_control &= ~SECONDARY_EXEC_SHADOW_VMCS;
3974 return exec_control; 4171 return exec_control;
3975} 4172}
3976 4173
@@ -3999,14 +4196,17 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
3999 vmcs_write64(IO_BITMAP_A, __pa(vmx_io_bitmap_a)); 4196 vmcs_write64(IO_BITMAP_A, __pa(vmx_io_bitmap_a));
4000 vmcs_write64(IO_BITMAP_B, __pa(vmx_io_bitmap_b)); 4197 vmcs_write64(IO_BITMAP_B, __pa(vmx_io_bitmap_b));
4001 4198
4199 if (enable_shadow_vmcs) {
4200 vmcs_write64(VMREAD_BITMAP, __pa(vmx_vmread_bitmap));
4201 vmcs_write64(VMWRITE_BITMAP, __pa(vmx_vmwrite_bitmap));
4202 }
4002 if (cpu_has_vmx_msr_bitmap()) 4203 if (cpu_has_vmx_msr_bitmap())
4003 vmcs_write64(MSR_BITMAP, __pa(vmx_msr_bitmap_legacy)); 4204 vmcs_write64(MSR_BITMAP, __pa(vmx_msr_bitmap_legacy));
4004 4205
4005 vmcs_write64(VMCS_LINK_POINTER, -1ull); /* 22.3.1.5 */ 4206 vmcs_write64(VMCS_LINK_POINTER, -1ull); /* 22.3.1.5 */
4006 4207
4007 /* Control */ 4208 /* Control */
4008 vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, 4209 vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx));
4009 vmcs_config.pin_based_exec_ctrl);
4010 4210
4011 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, vmx_exec_control(vmx)); 4211 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, vmx_exec_control(vmx));
4012 4212
@@ -4015,13 +4215,16 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4015 vmx_secondary_exec_control(vmx)); 4215 vmx_secondary_exec_control(vmx));
4016 } 4216 }
4017 4217
4018 if (enable_apicv_reg_vid) { 4218 if (vmx_vm_has_apicv(vmx->vcpu.kvm)) {
4019 vmcs_write64(EOI_EXIT_BITMAP0, 0); 4219 vmcs_write64(EOI_EXIT_BITMAP0, 0);
4020 vmcs_write64(EOI_EXIT_BITMAP1, 0); 4220 vmcs_write64(EOI_EXIT_BITMAP1, 0);
4021 vmcs_write64(EOI_EXIT_BITMAP2, 0); 4221 vmcs_write64(EOI_EXIT_BITMAP2, 0);
4022 vmcs_write64(EOI_EXIT_BITMAP3, 0); 4222 vmcs_write64(EOI_EXIT_BITMAP3, 0);
4023 4223
4024 vmcs_write16(GUEST_INTR_STATUS, 0); 4224 vmcs_write16(GUEST_INTR_STATUS, 0);
4225
4226 vmcs_write64(POSTED_INTR_NV, POSTED_INTR_VECTOR);
4227 vmcs_write64(POSTED_INTR_DESC_ADDR, __pa((&vmx->pi_desc)));
4025 } 4228 }
4026 4229
4027 if (ple_gap) { 4230 if (ple_gap) {
@@ -4035,7 +4238,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4035 4238
4036 vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */ 4239 vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */
4037 vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */ 4240 vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */
4038 vmx_set_constant_host_state(); 4241 vmx_set_constant_host_state(vmx);
4039#ifdef CONFIG_X86_64 4242#ifdef CONFIG_X86_64
4040 rdmsrl(MSR_FS_BASE, a); 4243 rdmsrl(MSR_FS_BASE, a);
4041 vmcs_writel(HOST_FS_BASE, a); /* 22.2.4 */ 4244 vmcs_writel(HOST_FS_BASE, a); /* 22.2.4 */
@@ -4089,11 +4292,10 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4089 return 0; 4292 return 0;
4090} 4293}
4091 4294
4092static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) 4295static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4093{ 4296{
4094 struct vcpu_vmx *vmx = to_vmx(vcpu); 4297 struct vcpu_vmx *vmx = to_vmx(vcpu);
4095 u64 msr; 4298 u64 msr;
4096 int ret;
4097 4299
4098 vmx->rmode.vm86_active = 0; 4300 vmx->rmode.vm86_active = 0;
4099 4301
@@ -4109,12 +4311,8 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4109 vmx_segment_cache_clear(vmx); 4311 vmx_segment_cache_clear(vmx);
4110 4312
4111 seg_setup(VCPU_SREG_CS); 4313 seg_setup(VCPU_SREG_CS);
4112 if (kvm_vcpu_is_bsp(&vmx->vcpu)) 4314 vmcs_write16(GUEST_CS_SELECTOR, 0xf000);
4113 vmcs_write16(GUEST_CS_SELECTOR, 0xf000); 4315 vmcs_write32(GUEST_CS_BASE, 0xffff0000);
4114 else {
4115 vmcs_write16(GUEST_CS_SELECTOR, vmx->vcpu.arch.sipi_vector << 8);
4116 vmcs_writel(GUEST_CS_BASE, vmx->vcpu.arch.sipi_vector << 12);
4117 }
4118 4316
4119 seg_setup(VCPU_SREG_DS); 4317 seg_setup(VCPU_SREG_DS);
4120 seg_setup(VCPU_SREG_ES); 4318 seg_setup(VCPU_SREG_ES);
@@ -4137,10 +4335,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4137 vmcs_writel(GUEST_SYSENTER_EIP, 0); 4335 vmcs_writel(GUEST_SYSENTER_EIP, 0);
4138 4336
4139 vmcs_writel(GUEST_RFLAGS, 0x02); 4337 vmcs_writel(GUEST_RFLAGS, 0x02);
4140 if (kvm_vcpu_is_bsp(&vmx->vcpu)) 4338 kvm_rip_write(vcpu, 0xfff0);
4141 kvm_rip_write(vcpu, 0xfff0);
4142 else
4143 kvm_rip_write(vcpu, 0);
4144 4339
4145 vmcs_writel(GUEST_GDTR_BASE, 0); 4340 vmcs_writel(GUEST_GDTR_BASE, 0);
4146 vmcs_write32(GUEST_GDTR_LIMIT, 0xffff); 4341 vmcs_write32(GUEST_GDTR_LIMIT, 0xffff);
@@ -4171,23 +4366,20 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
4171 vmcs_write64(APIC_ACCESS_ADDR, 4366 vmcs_write64(APIC_ACCESS_ADDR,
4172 page_to_phys(vmx->vcpu.kvm->arch.apic_access_page)); 4367 page_to_phys(vmx->vcpu.kvm->arch.apic_access_page));
4173 4368
4369 if (vmx_vm_has_apicv(vcpu->kvm))
4370 memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
4371
4174 if (vmx->vpid != 0) 4372 if (vmx->vpid != 0)
4175 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid); 4373 vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
4176 4374
4177 vmx->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET; 4375 vmx->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET;
4178 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
4179 vmx_set_cr0(&vmx->vcpu, kvm_read_cr0(vcpu)); /* enter rmode */ 4376 vmx_set_cr0(&vmx->vcpu, kvm_read_cr0(vcpu)); /* enter rmode */
4180 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
4181 vmx_set_cr4(&vmx->vcpu, 0); 4377 vmx_set_cr4(&vmx->vcpu, 0);
4182 vmx_set_efer(&vmx->vcpu, 0); 4378 vmx_set_efer(&vmx->vcpu, 0);
4183 vmx_fpu_activate(&vmx->vcpu); 4379 vmx_fpu_activate(&vmx->vcpu);
4184 update_exception_bitmap(&vmx->vcpu); 4380 update_exception_bitmap(&vmx->vcpu);
4185 4381
4186 vpid_sync_context(vmx); 4382 vpid_sync_context(vmx);
4187
4188 ret = 0;
4189
4190 return ret;
4191} 4383}
4192 4384
4193/* 4385/*
@@ -4200,40 +4392,45 @@ static bool nested_exit_on_intr(struct kvm_vcpu *vcpu)
4200 PIN_BASED_EXT_INTR_MASK; 4392 PIN_BASED_EXT_INTR_MASK;
4201} 4393}
4202 4394
4203static void enable_irq_window(struct kvm_vcpu *vcpu) 4395static bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
4396{
4397 return get_vmcs12(vcpu)->pin_based_vm_exec_control &
4398 PIN_BASED_NMI_EXITING;
4399}
4400
4401static int enable_irq_window(struct kvm_vcpu *vcpu)
4204{ 4402{
4205 u32 cpu_based_vm_exec_control; 4403 u32 cpu_based_vm_exec_control;
4206 if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) { 4404
4405 if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu))
4207 /* 4406 /*
4208 * We get here if vmx_interrupt_allowed() said we can't 4407 * We get here if vmx_interrupt_allowed() said we can't
4209 * inject to L1 now because L2 must run. Ask L2 to exit 4408 * inject to L1 now because L2 must run. The caller will have
4210 * right after entry, so we can inject to L1 more promptly. 4409 * to make L2 exit right after entry, so we can inject to L1
4410 * more promptly.
4211 */ 4411 */
4212 kvm_make_request(KVM_REQ_IMMEDIATE_EXIT, vcpu); 4412 return -EBUSY;
4213 return;
4214 }
4215 4413
4216 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 4414 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
4217 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING; 4415 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
4218 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); 4416 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
4417 return 0;
4219} 4418}
4220 4419
4221static void enable_nmi_window(struct kvm_vcpu *vcpu) 4420static int enable_nmi_window(struct kvm_vcpu *vcpu)
4222{ 4421{
4223 u32 cpu_based_vm_exec_control; 4422 u32 cpu_based_vm_exec_control;
4224 4423
4225 if (!cpu_has_virtual_nmis()) { 4424 if (!cpu_has_virtual_nmis())
4226 enable_irq_window(vcpu); 4425 return enable_irq_window(vcpu);
4227 return; 4426
4228 } 4427 if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI)
4428 return enable_irq_window(vcpu);
4229 4429
4230 if (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) {
4231 enable_irq_window(vcpu);
4232 return;
4233 }
4234 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 4430 cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
4235 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING; 4431 cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING;
4236 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); 4432 vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
4433 return 0;
4237} 4434}
4238 4435
4239static void vmx_inject_irq(struct kvm_vcpu *vcpu) 4436static void vmx_inject_irq(struct kvm_vcpu *vcpu)
@@ -4294,16 +4491,6 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
4294 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR); 4491 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR);
4295} 4492}
4296 4493
4297static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
4298{
4299 if (!cpu_has_virtual_nmis() && to_vmx(vcpu)->soft_vnmi_blocked)
4300 return 0;
4301
4302 return !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
4303 (GUEST_INTR_STATE_MOV_SS | GUEST_INTR_STATE_STI
4304 | GUEST_INTR_STATE_NMI));
4305}
4306
4307static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu) 4494static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu)
4308{ 4495{
4309 if (!cpu_has_virtual_nmis()) 4496 if (!cpu_has_virtual_nmis())
@@ -4333,18 +4520,52 @@ static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked)
4333 } 4520 }
4334} 4521}
4335 4522
4523static int vmx_nmi_allowed(struct kvm_vcpu *vcpu)
4524{
4525 if (is_guest_mode(vcpu)) {
4526 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
4527
4528 if (to_vmx(vcpu)->nested.nested_run_pending)
4529 return 0;
4530 if (nested_exit_on_nmi(vcpu)) {
4531 nested_vmx_vmexit(vcpu);
4532 vmcs12->vm_exit_reason = EXIT_REASON_EXCEPTION_NMI;
4533 vmcs12->vm_exit_intr_info = NMI_VECTOR |
4534 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK;
4535 /*
4536 * The NMI-triggered VM exit counts as injection:
4537 * clear this one and block further NMIs.
4538 */
4539 vcpu->arch.nmi_pending = 0;
4540 vmx_set_nmi_mask(vcpu, true);
4541 return 0;
4542 }
4543 }
4544
4545 if (!cpu_has_virtual_nmis() && to_vmx(vcpu)->soft_vnmi_blocked)
4546 return 0;
4547
4548 return !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
4549 (GUEST_INTR_STATE_MOV_SS | GUEST_INTR_STATE_STI
4550 | GUEST_INTR_STATE_NMI));
4551}
4552
4336static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu) 4553static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu)
4337{ 4554{
4338 if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) { 4555 if (is_guest_mode(vcpu)) {
4339 struct vmcs12 *vmcs12 = get_vmcs12(vcpu); 4556 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
4340 if (to_vmx(vcpu)->nested.nested_run_pending || 4557
4341 (vmcs12->idt_vectoring_info_field & 4558 if (to_vmx(vcpu)->nested.nested_run_pending)
4342 VECTORING_INFO_VALID_MASK))
4343 return 0; 4559 return 0;
4344 nested_vmx_vmexit(vcpu); 4560 if (nested_exit_on_intr(vcpu)) {
4345 vmcs12->vm_exit_reason = EXIT_REASON_EXTERNAL_INTERRUPT; 4561 nested_vmx_vmexit(vcpu);
4346 vmcs12->vm_exit_intr_info = 0; 4562 vmcs12->vm_exit_reason =
4347 /* fall through to normal code, but now in L1, not L2 */ 4563 EXIT_REASON_EXTERNAL_INTERRUPT;
4564 vmcs12->vm_exit_intr_info = 0;
4565 /*
4566 * fall through to normal code, but now in L1, not L2
4567 */
4568 }
4348 } 4569 }
4349 4570
4350 return (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) && 4571 return (vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) &&
@@ -4362,7 +4583,7 @@ static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr)
4362 .flags = 0, 4583 .flags = 0,
4363 }; 4584 };
4364 4585
4365 ret = kvm_set_memory_region(kvm, &tss_mem, false); 4586 ret = kvm_set_memory_region(kvm, &tss_mem);
4366 if (ret) 4587 if (ret)
4367 return ret; 4588 return ret;
4368 kvm->arch.tss_addr = addr; 4589 kvm->arch.tss_addr = addr;
@@ -4603,34 +4824,50 @@ vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall)
4603/* called to set cr0 as appropriate for a mov-to-cr0 exit. */ 4824/* called to set cr0 as appropriate for a mov-to-cr0 exit. */
4604static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val) 4825static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val)
4605{ 4826{
4606 if (to_vmx(vcpu)->nested.vmxon &&
4607 ((val & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON))
4608 return 1;
4609
4610 if (is_guest_mode(vcpu)) { 4827 if (is_guest_mode(vcpu)) {
4828 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
4829 unsigned long orig_val = val;
4830
4611 /* 4831 /*
4612 * We get here when L2 changed cr0 in a way that did not change 4832 * We get here when L2 changed cr0 in a way that did not change
4613 * any of L1's shadowed bits (see nested_vmx_exit_handled_cr), 4833 * any of L1's shadowed bits (see nested_vmx_exit_handled_cr),
4614 * but did change L0 shadowed bits. This can currently happen 4834 * but did change L0 shadowed bits. So we first calculate the
4615 * with the TS bit: L0 may want to leave TS on (for lazy fpu 4835 * effective cr0 value that L1 would like to write into the
4616 * loading) while pretending to allow the guest to change it. 4836 * hardware. It consists of the L2-owned bits from the new
4837 * value combined with the L1-owned bits from L1's guest_cr0.
4617 */ 4838 */
4618 if (kvm_set_cr0(vcpu, (val & vcpu->arch.cr0_guest_owned_bits) | 4839 val = (val & ~vmcs12->cr0_guest_host_mask) |
4619 (vcpu->arch.cr0 & ~vcpu->arch.cr0_guest_owned_bits))) 4840 (vmcs12->guest_cr0 & vmcs12->cr0_guest_host_mask);
4841
4842 /* TODO: will have to take unrestricted guest mode into
4843 * account */
4844 if ((val & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON)
4620 return 1; 4845 return 1;
4621 vmcs_writel(CR0_READ_SHADOW, val); 4846
4847 if (kvm_set_cr0(vcpu, val))
4848 return 1;
4849 vmcs_writel(CR0_READ_SHADOW, orig_val);
4622 return 0; 4850 return 0;
4623 } else 4851 } else {
4852 if (to_vmx(vcpu)->nested.vmxon &&
4853 ((val & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON))
4854 return 1;
4624 return kvm_set_cr0(vcpu, val); 4855 return kvm_set_cr0(vcpu, val);
4856 }
4625} 4857}
4626 4858
4627static int handle_set_cr4(struct kvm_vcpu *vcpu, unsigned long val) 4859static int handle_set_cr4(struct kvm_vcpu *vcpu, unsigned long val)
4628{ 4860{
4629 if (is_guest_mode(vcpu)) { 4861 if (is_guest_mode(vcpu)) {
4630 if (kvm_set_cr4(vcpu, (val & vcpu->arch.cr4_guest_owned_bits) | 4862 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
4631 (vcpu->arch.cr4 & ~vcpu->arch.cr4_guest_owned_bits))) 4863 unsigned long orig_val = val;
4864
4865 /* analogously to handle_set_cr0 */
4866 val = (val & ~vmcs12->cr4_guest_host_mask) |
4867 (vmcs12->guest_cr4 & vmcs12->cr4_guest_host_mask);
4868 if (kvm_set_cr4(vcpu, val))
4632 return 1; 4869 return 1;
4633 vmcs_writel(CR4_READ_SHADOW, val); 4870 vmcs_writel(CR4_READ_SHADOW, orig_val);
4634 return 0; 4871 return 0;
4635 } else 4872 } else
4636 return kvm_set_cr4(vcpu, val); 4873 return kvm_set_cr4(vcpu, val);
@@ -5183,7 +5420,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
5183 if (test_bit(KVM_REQ_EVENT, &vcpu->requests)) 5420 if (test_bit(KVM_REQ_EVENT, &vcpu->requests))
5184 return 1; 5421 return 1;
5185 5422
5186 err = emulate_instruction(vcpu, 0); 5423 err = emulate_instruction(vcpu, EMULTYPE_NO_REEXECUTE);
5187 5424
5188 if (err == EMULATE_DO_MMIO) { 5425 if (err == EMULATE_DO_MMIO) {
5189 ret = 0; 5426 ret = 0;
@@ -5259,8 +5496,7 @@ static struct loaded_vmcs *nested_get_current_vmcs02(struct vcpu_vmx *vmx)
5259 } 5496 }
5260 5497
5261 /* Create a new VMCS */ 5498 /* Create a new VMCS */
5262 item = (struct vmcs02_list *) 5499 item = kmalloc(sizeof(struct vmcs02_list), GFP_KERNEL);
5263 kmalloc(sizeof(struct vmcs02_list), GFP_KERNEL);
5264 if (!item) 5500 if (!item)
5265 return NULL; 5501 return NULL;
5266 item->vmcs02.vmcs = alloc_vmcs(); 5502 item->vmcs02.vmcs = alloc_vmcs();
@@ -5309,6 +5545,9 @@ static void nested_free_all_saved_vmcss(struct vcpu_vmx *vmx)
5309 free_loaded_vmcs(&vmx->vmcs01); 5545 free_loaded_vmcs(&vmx->vmcs01);
5310} 5546}
5311 5547
5548static void nested_vmx_failValid(struct kvm_vcpu *vcpu,
5549 u32 vm_instruction_error);
5550
5312/* 5551/*
5313 * Emulate the VMXON instruction. 5552 * Emulate the VMXON instruction.
5314 * Currently, we just remember that VMX is active, and do not save or even 5553 * Currently, we just remember that VMX is active, and do not save or even
@@ -5321,6 +5560,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
5321{ 5560{
5322 struct kvm_segment cs; 5561 struct kvm_segment cs;
5323 struct vcpu_vmx *vmx = to_vmx(vcpu); 5562 struct vcpu_vmx *vmx = to_vmx(vcpu);
5563 struct vmcs *shadow_vmcs;
5324 5564
5325 /* The Intel VMX Instruction Reference lists a bunch of bits that 5565 /* The Intel VMX Instruction Reference lists a bunch of bits that
5326 * are prerequisite to running VMXON, most notably cr4.VMXE must be 5566 * are prerequisite to running VMXON, most notably cr4.VMXE must be
@@ -5344,6 +5584,21 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
5344 kvm_inject_gp(vcpu, 0); 5584 kvm_inject_gp(vcpu, 0);
5345 return 1; 5585 return 1;
5346 } 5586 }
5587 if (vmx->nested.vmxon) {
5588 nested_vmx_failValid(vcpu, VMXERR_VMXON_IN_VMX_ROOT_OPERATION);
5589 skip_emulated_instruction(vcpu);
5590 return 1;
5591 }
5592 if (enable_shadow_vmcs) {
5593 shadow_vmcs = alloc_vmcs();
5594 if (!shadow_vmcs)
5595 return -ENOMEM;
5596 /* mark vmcs as shadow */
5597 shadow_vmcs->revision_id |= (1u << 31);
5598 /* init shadow vmcs */
5599 vmcs_clear(shadow_vmcs);
5600 vmx->nested.current_shadow_vmcs = shadow_vmcs;
5601 }
5347 5602
5348 INIT_LIST_HEAD(&(vmx->nested.vmcs02_pool)); 5603 INIT_LIST_HEAD(&(vmx->nested.vmcs02_pool));
5349 vmx->nested.vmcs02_num = 0; 5604 vmx->nested.vmcs02_num = 0;
@@ -5384,6 +5639,25 @@ static int nested_vmx_check_permission(struct kvm_vcpu *vcpu)
5384 return 1; 5639 return 1;
5385} 5640}
5386 5641
5642static inline void nested_release_vmcs12(struct vcpu_vmx *vmx)
5643{
5644 u32 exec_control;
5645 if (enable_shadow_vmcs) {
5646 if (vmx->nested.current_vmcs12 != NULL) {
5647 /* copy to memory all shadowed fields in case
5648 they were modified */
5649 copy_shadow_to_vmcs12(vmx);
5650 vmx->nested.sync_shadow_vmcs = false;
5651 exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
5652 exec_control &= ~SECONDARY_EXEC_SHADOW_VMCS;
5653 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
5654 vmcs_write64(VMCS_LINK_POINTER, -1ull);
5655 }
5656 }
5657 kunmap(vmx->nested.current_vmcs12_page);
5658 nested_release_page(vmx->nested.current_vmcs12_page);
5659}
5660
5387/* 5661/*
5388 * Free whatever needs to be freed from vmx->nested when L1 goes down, or 5662 * Free whatever needs to be freed from vmx->nested when L1 goes down, or
5389 * just stops using VMX. 5663 * just stops using VMX.
@@ -5394,11 +5668,12 @@ static void free_nested(struct vcpu_vmx *vmx)
5394 return; 5668 return;
5395 vmx->nested.vmxon = false; 5669 vmx->nested.vmxon = false;
5396 if (vmx->nested.current_vmptr != -1ull) { 5670 if (vmx->nested.current_vmptr != -1ull) {
5397 kunmap(vmx->nested.current_vmcs12_page); 5671 nested_release_vmcs12(vmx);
5398 nested_release_page(vmx->nested.current_vmcs12_page);
5399 vmx->nested.current_vmptr = -1ull; 5672 vmx->nested.current_vmptr = -1ull;
5400 vmx->nested.current_vmcs12 = NULL; 5673 vmx->nested.current_vmcs12 = NULL;
5401 } 5674 }
5675 if (enable_shadow_vmcs)
5676 free_vmcs(vmx->nested.current_shadow_vmcs);
5402 /* Unpin physical memory we referred to in current vmcs02 */ 5677 /* Unpin physical memory we referred to in current vmcs02 */
5403 if (vmx->nested.apic_access_page) { 5678 if (vmx->nested.apic_access_page) {
5404 nested_release_page(vmx->nested.apic_access_page); 5679 nested_release_page(vmx->nested.apic_access_page);
@@ -5507,6 +5782,10 @@ static void nested_vmx_failValid(struct kvm_vcpu *vcpu,
5507 X86_EFLAGS_SF | X86_EFLAGS_OF)) 5782 X86_EFLAGS_SF | X86_EFLAGS_OF))
5508 | X86_EFLAGS_ZF); 5783 | X86_EFLAGS_ZF);
5509 get_vmcs12(vcpu)->vm_instruction_error = vm_instruction_error; 5784 get_vmcs12(vcpu)->vm_instruction_error = vm_instruction_error;
5785 /*
5786 * We don't need to force a shadow sync because
5787 * VM_INSTRUCTION_ERROR is not shadowed
5788 */
5510} 5789}
5511 5790
5512/* Emulate the VMCLEAR instruction */ 5791/* Emulate the VMCLEAR instruction */
@@ -5539,8 +5818,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
5539 } 5818 }
5540 5819
5541 if (vmptr == vmx->nested.current_vmptr) { 5820 if (vmptr == vmx->nested.current_vmptr) {
5542 kunmap(vmx->nested.current_vmcs12_page); 5821 nested_release_vmcs12(vmx);
5543 nested_release_page(vmx->nested.current_vmcs12_page);
5544 vmx->nested.current_vmptr = -1ull; 5822 vmx->nested.current_vmptr = -1ull;
5545 vmx->nested.current_vmcs12 = NULL; 5823 vmx->nested.current_vmcs12 = NULL;
5546 } 5824 }
@@ -5639,6 +5917,111 @@ static inline bool vmcs12_read_any(struct kvm_vcpu *vcpu,
5639 } 5917 }
5640} 5918}
5641 5919
5920
5921static inline bool vmcs12_write_any(struct kvm_vcpu *vcpu,
5922 unsigned long field, u64 field_value){
5923 short offset = vmcs_field_to_offset(field);
5924 char *p = ((char *) get_vmcs12(vcpu)) + offset;
5925 if (offset < 0)
5926 return false;
5927
5928 switch (vmcs_field_type(field)) {
5929 case VMCS_FIELD_TYPE_U16:
5930 *(u16 *)p = field_value;
5931 return true;
5932 case VMCS_FIELD_TYPE_U32:
5933 *(u32 *)p = field_value;
5934 return true;
5935 case VMCS_FIELD_TYPE_U64:
5936 *(u64 *)p = field_value;
5937 return true;
5938 case VMCS_FIELD_TYPE_NATURAL_WIDTH:
5939 *(natural_width *)p = field_value;
5940 return true;
5941 default:
5942 return false; /* can never happen. */
5943 }
5944
5945}
5946
5947static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx)
5948{
5949 int i;
5950 unsigned long field;
5951 u64 field_value;
5952 struct vmcs *shadow_vmcs = vmx->nested.current_shadow_vmcs;
5953 unsigned long *fields = (unsigned long *)shadow_read_write_fields;
5954 int num_fields = max_shadow_read_write_fields;
5955
5956 vmcs_load(shadow_vmcs);
5957
5958 for (i = 0; i < num_fields; i++) {
5959 field = fields[i];
5960 switch (vmcs_field_type(field)) {
5961 case VMCS_FIELD_TYPE_U16:
5962 field_value = vmcs_read16(field);
5963 break;
5964 case VMCS_FIELD_TYPE_U32:
5965 field_value = vmcs_read32(field);
5966 break;
5967 case VMCS_FIELD_TYPE_U64:
5968 field_value = vmcs_read64(field);
5969 break;
5970 case VMCS_FIELD_TYPE_NATURAL_WIDTH:
5971 field_value = vmcs_readl(field);
5972 break;
5973 }
5974 vmcs12_write_any(&vmx->vcpu, field, field_value);
5975 }
5976
5977 vmcs_clear(shadow_vmcs);
5978 vmcs_load(vmx->loaded_vmcs->vmcs);
5979}
5980
5981static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)
5982{
5983 unsigned long *fields[] = {
5984 (unsigned long *)shadow_read_write_fields,
5985 (unsigned long *)shadow_read_only_fields
5986 };
5987 int num_lists = ARRAY_SIZE(fields);
5988 int max_fields[] = {
5989 max_shadow_read_write_fields,
5990 max_shadow_read_only_fields
5991 };
5992 int i, q;
5993 unsigned long field;
5994 u64 field_value = 0;
5995 struct vmcs *shadow_vmcs = vmx->nested.current_shadow_vmcs;
5996
5997 vmcs_load(shadow_vmcs);
5998
5999 for (q = 0; q < num_lists; q++) {
6000 for (i = 0; i < max_fields[q]; i++) {
6001 field = fields[q][i];
6002 vmcs12_read_any(&vmx->vcpu, field, &field_value);
6003
6004 switch (vmcs_field_type(field)) {
6005 case VMCS_FIELD_TYPE_U16:
6006 vmcs_write16(field, (u16)field_value);
6007 break;
6008 case VMCS_FIELD_TYPE_U32:
6009 vmcs_write32(field, (u32)field_value);
6010 break;
6011 case VMCS_FIELD_TYPE_U64:
6012 vmcs_write64(field, (u64)field_value);
6013 break;
6014 case VMCS_FIELD_TYPE_NATURAL_WIDTH:
6015 vmcs_writel(field, (long)field_value);
6016 break;
6017 }
6018 }
6019 }
6020
6021 vmcs_clear(shadow_vmcs);
6022 vmcs_load(vmx->loaded_vmcs->vmcs);
6023}
6024
5642/* 6025/*
5643 * VMX instructions which assume a current vmcs12 (i.e., that VMPTRLD was 6026 * VMX instructions which assume a current vmcs12 (i.e., that VMPTRLD was
5644 * used before) all generate the same failure when it is missing. 6027 * used before) all generate the same failure when it is missing.
@@ -5703,8 +6086,6 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
5703 gva_t gva; 6086 gva_t gva;
5704 unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 6087 unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
5705 u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); 6088 u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
5706 char *p;
5707 short offset;
5708 /* The value to write might be 32 or 64 bits, depending on L1's long 6089 /* The value to write might be 32 or 64 bits, depending on L1's long
5709 * mode, and eventually we need to write that into a field of several 6090 * mode, and eventually we need to write that into a field of several
5710 * possible lengths. The code below first zero-extends the value to 64 6091 * possible lengths. The code below first zero-extends the value to 64
@@ -5741,28 +6122,7 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
5741 return 1; 6122 return 1;
5742 } 6123 }
5743 6124
5744 offset = vmcs_field_to_offset(field); 6125 if (!vmcs12_write_any(vcpu, field, field_value)) {
5745 if (offset < 0) {
5746 nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
5747 skip_emulated_instruction(vcpu);
5748 return 1;
5749 }
5750 p = ((char *) get_vmcs12(vcpu)) + offset;
5751
5752 switch (vmcs_field_type(field)) {
5753 case VMCS_FIELD_TYPE_U16:
5754 *(u16 *)p = field_value;
5755 break;
5756 case VMCS_FIELD_TYPE_U32:
5757 *(u32 *)p = field_value;
5758 break;
5759 case VMCS_FIELD_TYPE_U64:
5760 *(u64 *)p = field_value;
5761 break;
5762 case VMCS_FIELD_TYPE_NATURAL_WIDTH:
5763 *(natural_width *)p = field_value;
5764 break;
5765 default:
5766 nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); 6126 nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
5767 skip_emulated_instruction(vcpu); 6127 skip_emulated_instruction(vcpu);
5768 return 1; 6128 return 1;
@@ -5780,6 +6140,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
5780 gva_t gva; 6140 gva_t gva;
5781 gpa_t vmptr; 6141 gpa_t vmptr;
5782 struct x86_exception e; 6142 struct x86_exception e;
6143 u32 exec_control;
5783 6144
5784 if (!nested_vmx_check_permission(vcpu)) 6145 if (!nested_vmx_check_permission(vcpu))
5785 return 1; 6146 return 1;
@@ -5818,14 +6179,20 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
5818 skip_emulated_instruction(vcpu); 6179 skip_emulated_instruction(vcpu);
5819 return 1; 6180 return 1;
5820 } 6181 }
5821 if (vmx->nested.current_vmptr != -1ull) { 6182 if (vmx->nested.current_vmptr != -1ull)
5822 kunmap(vmx->nested.current_vmcs12_page); 6183 nested_release_vmcs12(vmx);
5823 nested_release_page(vmx->nested.current_vmcs12_page);
5824 }
5825 6184
5826 vmx->nested.current_vmptr = vmptr; 6185 vmx->nested.current_vmptr = vmptr;
5827 vmx->nested.current_vmcs12 = new_vmcs12; 6186 vmx->nested.current_vmcs12 = new_vmcs12;
5828 vmx->nested.current_vmcs12_page = page; 6187 vmx->nested.current_vmcs12_page = page;
6188 if (enable_shadow_vmcs) {
6189 exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
6190 exec_control |= SECONDARY_EXEC_SHADOW_VMCS;
6191 vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
6192 vmcs_write64(VMCS_LINK_POINTER,
6193 __pa(vmx->nested.current_shadow_vmcs));
6194 vmx->nested.sync_shadow_vmcs = true;
6195 }
5829 } 6196 }
5830 6197
5831 nested_vmx_succeed(vcpu); 6198 nested_vmx_succeed(vcpu);
@@ -5908,6 +6275,52 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
5908static const int kvm_vmx_max_exit_handlers = 6275static const int kvm_vmx_max_exit_handlers =
5909 ARRAY_SIZE(kvm_vmx_exit_handlers); 6276 ARRAY_SIZE(kvm_vmx_exit_handlers);
5910 6277
6278static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu,
6279 struct vmcs12 *vmcs12)
6280{
6281 unsigned long exit_qualification;
6282 gpa_t bitmap, last_bitmap;
6283 unsigned int port;
6284 int size;
6285 u8 b;
6286
6287 if (nested_cpu_has(vmcs12, CPU_BASED_UNCOND_IO_EXITING))
6288 return 1;
6289
6290 if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS))
6291 return 0;
6292
6293 exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
6294
6295 port = exit_qualification >> 16;
6296 size = (exit_qualification & 7) + 1;
6297
6298 last_bitmap = (gpa_t)-1;
6299 b = -1;
6300
6301 while (size > 0) {
6302 if (port < 0x8000)
6303 bitmap = vmcs12->io_bitmap_a;
6304 else if (port < 0x10000)
6305 bitmap = vmcs12->io_bitmap_b;
6306 else
6307 return 1;
6308 bitmap += (port & 0x7fff) / 8;
6309
6310 if (last_bitmap != bitmap)
6311 if (kvm_read_guest(vcpu->kvm, bitmap, &b, 1))
6312 return 1;
6313 if (b & (1 << (port & 7)))
6314 return 1;
6315
6316 port++;
6317 size--;
6318 last_bitmap = bitmap;
6319 }
6320
6321 return 0;
6322}
6323
5911/* 6324/*
5912 * Return 1 if we should exit from L2 to L1 to handle an MSR access access, 6325 * Return 1 if we should exit from L2 to L1 to handle an MSR access access,
5913 * rather than handle it ourselves in L0. I.e., check whether L1 expressed 6326 * rather than handle it ourselves in L0. I.e., check whether L1 expressed
@@ -5939,7 +6352,8 @@ static bool nested_vmx_exit_handled_msr(struct kvm_vcpu *vcpu,
5939 /* Then read the msr_index'th bit from this bitmap: */ 6352 /* Then read the msr_index'th bit from this bitmap: */
5940 if (msr_index < 1024*8) { 6353 if (msr_index < 1024*8) {
5941 unsigned char b; 6354 unsigned char b;
5942 kvm_read_guest(vcpu->kvm, bitmap + msr_index/8, &b, 1); 6355 if (kvm_read_guest(vcpu->kvm, bitmap + msr_index/8, &b, 1))
6356 return 1;
5943 return 1 & (b >> (msr_index & 7)); 6357 return 1 & (b >> (msr_index & 7));
5944 } else 6358 } else
5945 return 1; /* let L1 handle the wrong parameter */ 6359 return 1; /* let L1 handle the wrong parameter */
@@ -6033,10 +6447,10 @@ static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,
6033 */ 6447 */
6034static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) 6448static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6035{ 6449{
6036 u32 exit_reason = vmcs_read32(VM_EXIT_REASON);
6037 u32 intr_info = vmcs_read32(VM_EXIT_INTR_INFO); 6450 u32 intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
6038 struct vcpu_vmx *vmx = to_vmx(vcpu); 6451 struct vcpu_vmx *vmx = to_vmx(vcpu);
6039 struct vmcs12 *vmcs12 = get_vmcs12(vcpu); 6452 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
6453 u32 exit_reason = vmx->exit_reason;
6040 6454
6041 if (vmx->nested.nested_run_pending) 6455 if (vmx->nested.nested_run_pending)
6042 return 0; 6456 return 0;
@@ -6060,14 +6474,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6060 case EXIT_REASON_TRIPLE_FAULT: 6474 case EXIT_REASON_TRIPLE_FAULT:
6061 return 1; 6475 return 1;
6062 case EXIT_REASON_PENDING_INTERRUPT: 6476 case EXIT_REASON_PENDING_INTERRUPT:
6477 return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_INTR_PENDING);
6063 case EXIT_REASON_NMI_WINDOW: 6478 case EXIT_REASON_NMI_WINDOW:
6064 /* 6479 return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_NMI_PENDING);
6065 * prepare_vmcs02() set the CPU_BASED_VIRTUAL_INTR_PENDING bit
6066 * (aka Interrupt Window Exiting) only when L1 turned it on,
6067 * so if we got a PENDING_INTERRUPT exit, this must be for L1.
6068 * Same for NMI Window Exiting.
6069 */
6070 return 1;
6071 case EXIT_REASON_TASK_SWITCH: 6480 case EXIT_REASON_TASK_SWITCH:
6072 return 1; 6481 return 1;
6073 case EXIT_REASON_CPUID: 6482 case EXIT_REASON_CPUID:
@@ -6097,8 +6506,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6097 case EXIT_REASON_DR_ACCESS: 6506 case EXIT_REASON_DR_ACCESS:
6098 return nested_cpu_has(vmcs12, CPU_BASED_MOV_DR_EXITING); 6507 return nested_cpu_has(vmcs12, CPU_BASED_MOV_DR_EXITING);
6099 case EXIT_REASON_IO_INSTRUCTION: 6508 case EXIT_REASON_IO_INSTRUCTION:
6100 /* TODO: support IO bitmaps */ 6509 return nested_vmx_exit_handled_io(vcpu, vmcs12);
6101 return 1;
6102 case EXIT_REASON_MSR_READ: 6510 case EXIT_REASON_MSR_READ:
6103 case EXIT_REASON_MSR_WRITE: 6511 case EXIT_REASON_MSR_WRITE:
6104 return nested_vmx_exit_handled_msr(vcpu, vmcs12, exit_reason); 6512 return nested_vmx_exit_handled_msr(vcpu, vmcs12, exit_reason);
@@ -6122,6 +6530,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
6122 case EXIT_REASON_EPT_VIOLATION: 6530 case EXIT_REASON_EPT_VIOLATION:
6123 case EXIT_REASON_EPT_MISCONFIG: 6531 case EXIT_REASON_EPT_MISCONFIG:
6124 return 0; 6532 return 0;
6533 case EXIT_REASON_PREEMPTION_TIMER:
6534 return vmcs12->pin_based_vm_exec_control &
6535 PIN_BASED_VMX_PREEMPTION_TIMER;
6125 case EXIT_REASON_WBINVD: 6536 case EXIT_REASON_WBINVD:
6126 return nested_cpu_has2(vmcs12, SECONDARY_EXEC_WBINVD_EXITING); 6537 return nested_cpu_has2(vmcs12, SECONDARY_EXEC_WBINVD_EXITING);
6127 case EXIT_REASON_XSETBV: 6538 case EXIT_REASON_XSETBV:
@@ -6316,6 +6727,9 @@ static void vmx_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr)
6316 6727
6317static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) 6728static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap)
6318{ 6729{
6730 if (!vmx_vm_has_apicv(vcpu->kvm))
6731 return;
6732
6319 vmcs_write64(EOI_EXIT_BITMAP0, eoi_exit_bitmap[0]); 6733 vmcs_write64(EOI_EXIT_BITMAP0, eoi_exit_bitmap[0]);
6320 vmcs_write64(EOI_EXIT_BITMAP1, eoi_exit_bitmap[1]); 6734 vmcs_write64(EOI_EXIT_BITMAP1, eoi_exit_bitmap[1]);
6321 vmcs_write64(EOI_EXIT_BITMAP2, eoi_exit_bitmap[2]); 6735 vmcs_write64(EOI_EXIT_BITMAP2, eoi_exit_bitmap[2]);
@@ -6346,6 +6760,52 @@ static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)
6346 } 6760 }
6347} 6761}
6348 6762
6763static void vmx_handle_external_intr(struct kvm_vcpu *vcpu)
6764{
6765 u32 exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
6766
6767 /*
6768 * If external interrupt exists, IF bit is set in rflags/eflags on the
6769 * interrupt stack frame, and interrupt will be enabled on a return
6770 * from interrupt handler.
6771 */
6772 if ((exit_intr_info & (INTR_INFO_VALID_MASK | INTR_INFO_INTR_TYPE_MASK))
6773 == (INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR)) {
6774 unsigned int vector;
6775 unsigned long entry;
6776 gate_desc *desc;
6777 struct vcpu_vmx *vmx = to_vmx(vcpu);
6778#ifdef CONFIG_X86_64
6779 unsigned long tmp;
6780#endif
6781
6782 vector = exit_intr_info & INTR_INFO_VECTOR_MASK;
6783 desc = (gate_desc *)vmx->host_idt_base + vector;
6784 entry = gate_offset(*desc);
6785 asm volatile(
6786#ifdef CONFIG_X86_64
6787 "mov %%" _ASM_SP ", %[sp]\n\t"
6788 "and $0xfffffffffffffff0, %%" _ASM_SP "\n\t"
6789 "push $%c[ss]\n\t"
6790 "push %[sp]\n\t"
6791#endif
6792 "pushf\n\t"
6793 "orl $0x200, (%%" _ASM_SP ")\n\t"
6794 __ASM_SIZE(push) " $%c[cs]\n\t"
6795 "call *%[entry]\n\t"
6796 :
6797#ifdef CONFIG_X86_64
6798 [sp]"=&r"(tmp)
6799#endif
6800 :
6801 [entry]"r"(entry),
6802 [ss]"i"(__KERNEL_DS),
6803 [cs]"i"(__KERNEL_CS)
6804 );
6805 } else
6806 local_irq_enable();
6807}
6808
6349static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx) 6809static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx)
6350{ 6810{
6351 u32 exit_intr_info; 6811 u32 exit_intr_info;
@@ -6388,7 +6848,7 @@ static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx)
6388 ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time)); 6848 ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time));
6389} 6849}
6390 6850
6391static void __vmx_complete_interrupts(struct vcpu_vmx *vmx, 6851static void __vmx_complete_interrupts(struct kvm_vcpu *vcpu,
6392 u32 idt_vectoring_info, 6852 u32 idt_vectoring_info,
6393 int instr_len_field, 6853 int instr_len_field,
6394 int error_code_field) 6854 int error_code_field)
@@ -6399,46 +6859,43 @@ static void __vmx_complete_interrupts(struct vcpu_vmx *vmx,
6399 6859
6400 idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; 6860 idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK;
6401 6861
6402 vmx->vcpu.arch.nmi_injected = false; 6862 vcpu->arch.nmi_injected = false;
6403 kvm_clear_exception_queue(&vmx->vcpu); 6863 kvm_clear_exception_queue(vcpu);
6404 kvm_clear_interrupt_queue(&vmx->vcpu); 6864 kvm_clear_interrupt_queue(vcpu);
6405 6865
6406 if (!idtv_info_valid) 6866 if (!idtv_info_valid)
6407 return; 6867 return;
6408 6868
6409 kvm_make_request(KVM_REQ_EVENT, &vmx->vcpu); 6869 kvm_make_request(KVM_REQ_EVENT, vcpu);
6410 6870
6411 vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; 6871 vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK;
6412 type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; 6872 type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK;
6413 6873
6414 switch (type) { 6874 switch (type) {
6415 case INTR_TYPE_NMI_INTR: 6875 case INTR_TYPE_NMI_INTR:
6416 vmx->vcpu.arch.nmi_injected = true; 6876 vcpu->arch.nmi_injected = true;
6417 /* 6877 /*
6418 * SDM 3: 27.7.1.2 (September 2008) 6878 * SDM 3: 27.7.1.2 (September 2008)
6419 * Clear bit "block by NMI" before VM entry if a NMI 6879 * Clear bit "block by NMI" before VM entry if a NMI
6420 * delivery faulted. 6880 * delivery faulted.
6421 */ 6881 */
6422 vmx_set_nmi_mask(&vmx->vcpu, false); 6882 vmx_set_nmi_mask(vcpu, false);
6423 break; 6883 break;
6424 case INTR_TYPE_SOFT_EXCEPTION: 6884 case INTR_TYPE_SOFT_EXCEPTION:
6425 vmx->vcpu.arch.event_exit_inst_len = 6885 vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
6426 vmcs_read32(instr_len_field);
6427 /* fall through */ 6886 /* fall through */
6428 case INTR_TYPE_HARD_EXCEPTION: 6887 case INTR_TYPE_HARD_EXCEPTION:
6429 if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) { 6888 if (idt_vectoring_info & VECTORING_INFO_DELIVER_CODE_MASK) {
6430 u32 err = vmcs_read32(error_code_field); 6889 u32 err = vmcs_read32(error_code_field);
6431 kvm_queue_exception_e(&vmx->vcpu, vector, err); 6890 kvm_queue_exception_e(vcpu, vector, err);
6432 } else 6891 } else
6433 kvm_queue_exception(&vmx->vcpu, vector); 6892 kvm_queue_exception(vcpu, vector);
6434 break; 6893 break;
6435 case INTR_TYPE_SOFT_INTR: 6894 case INTR_TYPE_SOFT_INTR:
6436 vmx->vcpu.arch.event_exit_inst_len = 6895 vcpu->arch.event_exit_inst_len = vmcs_read32(instr_len_field);
6437 vmcs_read32(instr_len_field);
6438 /* fall through */ 6896 /* fall through */
6439 case INTR_TYPE_EXT_INTR: 6897 case INTR_TYPE_EXT_INTR:
6440 kvm_queue_interrupt(&vmx->vcpu, vector, 6898 kvm_queue_interrupt(vcpu, vector, type == INTR_TYPE_SOFT_INTR);
6441 type == INTR_TYPE_SOFT_INTR);
6442 break; 6899 break;
6443 default: 6900 default:
6444 break; 6901 break;
@@ -6447,18 +6904,14 @@ static void __vmx_complete_interrupts(struct vcpu_vmx *vmx,
6447 6904
6448static void vmx_complete_interrupts(struct vcpu_vmx *vmx) 6905static void vmx_complete_interrupts(struct vcpu_vmx *vmx)
6449{ 6906{
6450 if (is_guest_mode(&vmx->vcpu)) 6907 __vmx_complete_interrupts(&vmx->vcpu, vmx->idt_vectoring_info,
6451 return;
6452 __vmx_complete_interrupts(vmx, vmx->idt_vectoring_info,
6453 VM_EXIT_INSTRUCTION_LEN, 6908 VM_EXIT_INSTRUCTION_LEN,
6454 IDT_VECTORING_ERROR_CODE); 6909 IDT_VECTORING_ERROR_CODE);
6455} 6910}
6456 6911
6457static void vmx_cancel_injection(struct kvm_vcpu *vcpu) 6912static void vmx_cancel_injection(struct kvm_vcpu *vcpu)
6458{ 6913{
6459 if (is_guest_mode(vcpu)) 6914 __vmx_complete_interrupts(vcpu,
6460 return;
6461 __vmx_complete_interrupts(to_vmx(vcpu),
6462 vmcs_read32(VM_ENTRY_INTR_INFO_FIELD), 6915 vmcs_read32(VM_ENTRY_INTR_INFO_FIELD),
6463 VM_ENTRY_INSTRUCTION_LEN, 6916 VM_ENTRY_INSTRUCTION_LEN,
6464 VM_ENTRY_EXCEPTION_ERROR_CODE); 6917 VM_ENTRY_EXCEPTION_ERROR_CODE);
@@ -6489,21 +6942,6 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
6489 struct vcpu_vmx *vmx = to_vmx(vcpu); 6942 struct vcpu_vmx *vmx = to_vmx(vcpu);
6490 unsigned long debugctlmsr; 6943 unsigned long debugctlmsr;
6491 6944
6492 if (is_guest_mode(vcpu) && !vmx->nested.nested_run_pending) {
6493 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
6494 if (vmcs12->idt_vectoring_info_field &
6495 VECTORING_INFO_VALID_MASK) {
6496 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
6497 vmcs12->idt_vectoring_info_field);
6498 vmcs_write32(VM_ENTRY_INSTRUCTION_LEN,
6499 vmcs12->vm_exit_instruction_len);
6500 if (vmcs12->idt_vectoring_info_field &
6501 VECTORING_INFO_DELIVER_CODE_MASK)
6502 vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE,
6503 vmcs12->idt_vectoring_error_code);
6504 }
6505 }
6506
6507 /* Record the guest's net vcpu time for enforced NMI injections. */ 6945 /* Record the guest's net vcpu time for enforced NMI injections. */
6508 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) 6946 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
6509 vmx->entry_time = ktime_get(); 6947 vmx->entry_time = ktime_get();
@@ -6513,6 +6951,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
6513 if (vmx->emulation_required) 6951 if (vmx->emulation_required)
6514 return; 6952 return;
6515 6953
6954 if (vmx->nested.sync_shadow_vmcs) {
6955 copy_vmcs12_to_shadow(vmx);
6956 vmx->nested.sync_shadow_vmcs = false;
6957 }
6958
6516 if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) 6959 if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty))
6517 vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); 6960 vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]);
6518 if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) 6961 if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty))
@@ -6662,17 +7105,6 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
6662 7105
6663 vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); 7106 vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
6664 7107
6665 if (is_guest_mode(vcpu)) {
6666 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
6667 vmcs12->idt_vectoring_info_field = vmx->idt_vectoring_info;
6668 if (vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK) {
6669 vmcs12->idt_vectoring_error_code =
6670 vmcs_read32(IDT_VECTORING_ERROR_CODE);
6671 vmcs12->vm_exit_instruction_len =
6672 vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
6673 }
6674 }
6675
6676 vmx->loaded_vmcs->launched = 1; 7108 vmx->loaded_vmcs->launched = 1;
6677 7109
6678 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); 7110 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
@@ -6734,10 +7166,11 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
6734 put_cpu(); 7166 put_cpu();
6735 if (err) 7167 if (err)
6736 goto free_vmcs; 7168 goto free_vmcs;
6737 if (vm_need_virtualize_apic_accesses(kvm)) 7169 if (vm_need_virtualize_apic_accesses(kvm)) {
6738 err = alloc_apic_access_page(kvm); 7170 err = alloc_apic_access_page(kvm);
6739 if (err) 7171 if (err)
6740 goto free_vmcs; 7172 goto free_vmcs;
7173 }
6741 7174
6742 if (enable_ept) { 7175 if (enable_ept) {
6743 if (!kvm->arch.ept_identity_map_addr) 7176 if (!kvm->arch.ept_identity_map_addr)
@@ -6931,9 +7364,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
6931 vmcs12->vm_entry_instruction_len); 7364 vmcs12->vm_entry_instruction_len);
6932 vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 7365 vmcs_write32(GUEST_INTERRUPTIBILITY_INFO,
6933 vmcs12->guest_interruptibility_info); 7366 vmcs12->guest_interruptibility_info);
6934 vmcs_write32(GUEST_ACTIVITY_STATE, vmcs12->guest_activity_state);
6935 vmcs_write32(GUEST_SYSENTER_CS, vmcs12->guest_sysenter_cs); 7367 vmcs_write32(GUEST_SYSENTER_CS, vmcs12->guest_sysenter_cs);
6936 vmcs_writel(GUEST_DR7, vmcs12->guest_dr7); 7368 kvm_set_dr(vcpu, 7, vmcs12->guest_dr7);
6937 vmcs_writel(GUEST_RFLAGS, vmcs12->guest_rflags); 7369 vmcs_writel(GUEST_RFLAGS, vmcs12->guest_rflags);
6938 vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, 7370 vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS,
6939 vmcs12->guest_pending_dbg_exceptions); 7371 vmcs12->guest_pending_dbg_exceptions);
@@ -6946,6 +7378,10 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
6946 (vmcs_config.pin_based_exec_ctrl | 7378 (vmcs_config.pin_based_exec_ctrl |
6947 vmcs12->pin_based_vm_exec_control)); 7379 vmcs12->pin_based_vm_exec_control));
6948 7380
7381 if (vmcs12->pin_based_vm_exec_control & PIN_BASED_VMX_PREEMPTION_TIMER)
7382 vmcs_write32(VMX_PREEMPTION_TIMER_VALUE,
7383 vmcs12->vmx_preemption_timer_value);
7384
6949 /* 7385 /*
6950 * Whether page-faults are trapped is determined by a combination of 7386 * Whether page-faults are trapped is determined by a combination of
6951 * 3 settings: PFEC_MASK, PFEC_MATCH and EXCEPTION_BITMAP.PF. 7387 * 3 settings: PFEC_MASK, PFEC_MATCH and EXCEPTION_BITMAP.PF.
@@ -7016,7 +7452,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7016 * Other fields are different per CPU, and will be set later when 7452 * Other fields are different per CPU, and will be set later when
7017 * vmx_vcpu_load() is called, and when vmx_save_host_state() is called. 7453 * vmx_vcpu_load() is called, and when vmx_save_host_state() is called.
7018 */ 7454 */
7019 vmx_set_constant_host_state(); 7455 vmx_set_constant_host_state(vmx);
7020 7456
7021 /* 7457 /*
7022 * HOST_RSP is normally set correctly in vmx_vcpu_run() just before 7458 * HOST_RSP is normally set correctly in vmx_vcpu_run() just before
@@ -7082,7 +7518,7 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7082 7518
7083 if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER) 7519 if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER)
7084 vcpu->arch.efer = vmcs12->guest_ia32_efer; 7520 vcpu->arch.efer = vmcs12->guest_ia32_efer;
7085 if (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) 7521 else if (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE)
7086 vcpu->arch.efer |= (EFER_LMA | EFER_LME); 7522 vcpu->arch.efer |= (EFER_LMA | EFER_LME);
7087 else 7523 else
7088 vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); 7524 vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
@@ -7121,6 +7557,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7121 struct vcpu_vmx *vmx = to_vmx(vcpu); 7557 struct vcpu_vmx *vmx = to_vmx(vcpu);
7122 int cpu; 7558 int cpu;
7123 struct loaded_vmcs *vmcs02; 7559 struct loaded_vmcs *vmcs02;
7560 bool ia32e;
7124 7561
7125 if (!nested_vmx_check_permission(vcpu) || 7562 if (!nested_vmx_check_permission(vcpu) ||
7126 !nested_vmx_check_vmcs12(vcpu)) 7563 !nested_vmx_check_vmcs12(vcpu))
@@ -7129,6 +7566,9 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7129 skip_emulated_instruction(vcpu); 7566 skip_emulated_instruction(vcpu);
7130 vmcs12 = get_vmcs12(vcpu); 7567 vmcs12 = get_vmcs12(vcpu);
7131 7568
7569 if (enable_shadow_vmcs)
7570 copy_shadow_to_vmcs12(vmx);
7571
7132 /* 7572 /*
7133 * The nested entry process starts with enforcing various prerequisites 7573 * The nested entry process starts with enforcing various prerequisites
7134 * on vmcs12 as required by the Intel SDM, and act appropriately when 7574 * on vmcs12 as required by the Intel SDM, and act appropriately when
@@ -7146,6 +7586,11 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7146 return 1; 7586 return 1;
7147 } 7587 }
7148 7588
7589 if (vmcs12->guest_activity_state != GUEST_ACTIVITY_ACTIVE) {
7590 nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD);
7591 return 1;
7592 }
7593
7149 if ((vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_MSR_BITMAPS) && 7594 if ((vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_MSR_BITMAPS) &&
7150 !IS_ALIGNED(vmcs12->msr_bitmap, PAGE_SIZE)) { 7595 !IS_ALIGNED(vmcs12->msr_bitmap, PAGE_SIZE)) {
7151 /*TODO: Also verify bits beyond physical address width are 0*/ 7596 /*TODO: Also verify bits beyond physical address width are 0*/
@@ -7204,6 +7649,45 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7204 } 7649 }
7205 7650
7206 /* 7651 /*
7652 * If the load IA32_EFER VM-entry control is 1, the following checks
7653 * are performed on the field for the IA32_EFER MSR:
7654 * - Bits reserved in the IA32_EFER MSR must be 0.
7655 * - Bit 10 (corresponding to IA32_EFER.LMA) must equal the value of
7656 * the IA-32e mode guest VM-exit control. It must also be identical
7657 * to bit 8 (LME) if bit 31 in the CR0 field (corresponding to
7658 * CR0.PG) is 1.
7659 */
7660 if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER) {
7661 ia32e = (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) != 0;
7662 if (!kvm_valid_efer(vcpu, vmcs12->guest_ia32_efer) ||
7663 ia32e != !!(vmcs12->guest_ia32_efer & EFER_LMA) ||
7664 ((vmcs12->guest_cr0 & X86_CR0_PG) &&
7665 ia32e != !!(vmcs12->guest_ia32_efer & EFER_LME))) {
7666 nested_vmx_entry_failure(vcpu, vmcs12,
7667 EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
7668 return 1;
7669 }
7670 }
7671
7672 /*
7673 * If the load IA32_EFER VM-exit control is 1, bits reserved in the
7674 * IA32_EFER MSR must be 0 in the field for that register. In addition,
7675 * the values of the LMA and LME bits in the field must each be that of
7676 * the host address-space size VM-exit control.
7677 */
7678 if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_EFER) {
7679 ia32e = (vmcs12->vm_exit_controls &
7680 VM_EXIT_HOST_ADDR_SPACE_SIZE) != 0;
7681 if (!kvm_valid_efer(vcpu, vmcs12->host_ia32_efer) ||
7682 ia32e != !!(vmcs12->host_ia32_efer & EFER_LMA) ||
7683 ia32e != !!(vmcs12->host_ia32_efer & EFER_LME)) {
7684 nested_vmx_entry_failure(vcpu, vmcs12,
7685 EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
7686 return 1;
7687 }
7688 }
7689
7690 /*
7207 * We're finally done with prerequisite checking, and can start with 7691 * We're finally done with prerequisite checking, and can start with
7208 * the nested entry. 7692 * the nested entry.
7209 */ 7693 */
@@ -7223,6 +7707,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
7223 vcpu->cpu = cpu; 7707 vcpu->cpu = cpu;
7224 put_cpu(); 7708 put_cpu();
7225 7709
7710 vmx_segment_cache_clear(vmx);
7711
7226 vmcs12->launch_state = 1; 7712 vmcs12->launch_state = 1;
7227 7713
7228 prepare_vmcs02(vcpu, vmcs12); 7714 prepare_vmcs02(vcpu, vmcs12);
@@ -7273,6 +7759,48 @@ vmcs12_guest_cr4(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7273 vcpu->arch.cr4_guest_owned_bits)); 7759 vcpu->arch.cr4_guest_owned_bits));
7274} 7760}
7275 7761
7762static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
7763 struct vmcs12 *vmcs12)
7764{
7765 u32 idt_vectoring;
7766 unsigned int nr;
7767
7768 if (vcpu->arch.exception.pending) {
7769 nr = vcpu->arch.exception.nr;
7770 idt_vectoring = nr | VECTORING_INFO_VALID_MASK;
7771
7772 if (kvm_exception_is_soft(nr)) {
7773 vmcs12->vm_exit_instruction_len =
7774 vcpu->arch.event_exit_inst_len;
7775 idt_vectoring |= INTR_TYPE_SOFT_EXCEPTION;
7776 } else
7777 idt_vectoring |= INTR_TYPE_HARD_EXCEPTION;
7778
7779 if (vcpu->arch.exception.has_error_code) {
7780 idt_vectoring |= VECTORING_INFO_DELIVER_CODE_MASK;
7781 vmcs12->idt_vectoring_error_code =
7782 vcpu->arch.exception.error_code;
7783 }
7784
7785 vmcs12->idt_vectoring_info_field = idt_vectoring;
7786 } else if (vcpu->arch.nmi_pending) {
7787 vmcs12->idt_vectoring_info_field =
7788 INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR;
7789 } else if (vcpu->arch.interrupt.pending) {
7790 nr = vcpu->arch.interrupt.nr;
7791 idt_vectoring = nr | VECTORING_INFO_VALID_MASK;
7792
7793 if (vcpu->arch.interrupt.soft) {
7794 idt_vectoring |= INTR_TYPE_SOFT_INTR;
7795 vmcs12->vm_entry_instruction_len =
7796 vcpu->arch.event_exit_inst_len;
7797 } else
7798 idt_vectoring |= INTR_TYPE_EXT_INTR;
7799
7800 vmcs12->idt_vectoring_info_field = idt_vectoring;
7801 }
7802}
7803
7276/* 7804/*
7277 * prepare_vmcs12 is part of what we need to do when the nested L2 guest exits 7805 * prepare_vmcs12 is part of what we need to do when the nested L2 guest exits
7278 * and we want to prepare to run its L1 parent. L1 keeps a vmcs for L2 (vmcs12), 7806 * and we want to prepare to run its L1 parent. L1 keeps a vmcs for L2 (vmcs12),
@@ -7284,7 +7812,7 @@ vmcs12_guest_cr4(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7284 * exit-information fields only. Other fields are modified by L1 with VMWRITE, 7812 * exit-information fields only. Other fields are modified by L1 with VMWRITE,
7285 * which already writes to vmcs12 directly. 7813 * which already writes to vmcs12 directly.
7286 */ 7814 */
7287void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) 7815static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7288{ 7816{
7289 /* update guest state fields: */ 7817 /* update guest state fields: */
7290 vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12); 7818 vmcs12->guest_cr0 = vmcs12_guest_cr0(vcpu, vmcs12);
@@ -7332,16 +7860,19 @@ void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7332 vmcs12->guest_gdtr_base = vmcs_readl(GUEST_GDTR_BASE); 7860 vmcs12->guest_gdtr_base = vmcs_readl(GUEST_GDTR_BASE);
7333 vmcs12->guest_idtr_base = vmcs_readl(GUEST_IDTR_BASE); 7861 vmcs12->guest_idtr_base = vmcs_readl(GUEST_IDTR_BASE);
7334 7862
7335 vmcs12->guest_activity_state = vmcs_read32(GUEST_ACTIVITY_STATE);
7336 vmcs12->guest_interruptibility_info = 7863 vmcs12->guest_interruptibility_info =
7337 vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); 7864 vmcs_read32(GUEST_INTERRUPTIBILITY_INFO);
7338 vmcs12->guest_pending_dbg_exceptions = 7865 vmcs12->guest_pending_dbg_exceptions =
7339 vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS); 7866 vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS);
7340 7867
7868 vmcs12->vm_entry_controls =
7869 (vmcs12->vm_entry_controls & ~VM_ENTRY_IA32E_MODE) |
7870 (vmcs_read32(VM_ENTRY_CONTROLS) & VM_ENTRY_IA32E_MODE);
7871
7341 /* TODO: These cannot have changed unless we have MSR bitmaps and 7872 /* TODO: These cannot have changed unless we have MSR bitmaps and
7342 * the relevant bit asks not to trap the change */ 7873 * the relevant bit asks not to trap the change */
7343 vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); 7874 vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL);
7344 if (vmcs12->vm_entry_controls & VM_EXIT_SAVE_IA32_PAT) 7875 if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT)
7345 vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT); 7876 vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT);
7346 vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS); 7877 vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS);
7347 vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP); 7878 vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP);
@@ -7349,21 +7880,38 @@ void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7349 7880
7350 /* update exit information fields: */ 7881 /* update exit information fields: */
7351 7882
7352 vmcs12->vm_exit_reason = vmcs_read32(VM_EXIT_REASON); 7883 vmcs12->vm_exit_reason = to_vmx(vcpu)->exit_reason;
7353 vmcs12->exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 7884 vmcs12->exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
7354 7885
7355 vmcs12->vm_exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); 7886 vmcs12->vm_exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
7356 vmcs12->vm_exit_intr_error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); 7887 if ((vmcs12->vm_exit_intr_info &
7357 vmcs12->idt_vectoring_info_field = 7888 (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK)) ==
7358 vmcs_read32(IDT_VECTORING_INFO_FIELD); 7889 (INTR_INFO_VALID_MASK | INTR_INFO_DELIVER_CODE_MASK))
7359 vmcs12->idt_vectoring_error_code = 7890 vmcs12->vm_exit_intr_error_code =
7360 vmcs_read32(IDT_VECTORING_ERROR_CODE); 7891 vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
7892 vmcs12->idt_vectoring_info_field = 0;
7361 vmcs12->vm_exit_instruction_len = vmcs_read32(VM_EXIT_INSTRUCTION_LEN); 7893 vmcs12->vm_exit_instruction_len = vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
7362 vmcs12->vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); 7894 vmcs12->vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
7363 7895
7364 /* clear vm-entry fields which are to be cleared on exit */ 7896 if (!(vmcs12->vm_exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) {
7365 if (!(vmcs12->vm_exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) 7897 /* vm_entry_intr_info_field is cleared on exit. Emulate this
7898 * instead of reading the real value. */
7366 vmcs12->vm_entry_intr_info_field &= ~INTR_INFO_VALID_MASK; 7899 vmcs12->vm_entry_intr_info_field &= ~INTR_INFO_VALID_MASK;
7900
7901 /*
7902 * Transfer the event that L0 or L1 may wanted to inject into
7903 * L2 to IDT_VECTORING_INFO_FIELD.
7904 */
7905 vmcs12_save_pending_event(vcpu, vmcs12);
7906 }
7907
7908 /*
7909 * Drop what we picked up for L2 via vmx_complete_interrupts. It is
7910 * preserved above and would only end up incorrectly in L1.
7911 */
7912 vcpu->arch.nmi_injected = false;
7913 kvm_clear_exception_queue(vcpu);
7914 kvm_clear_interrupt_queue(vcpu);
7367} 7915}
7368 7916
7369/* 7917/*
@@ -7375,11 +7923,12 @@ void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7375 * Failures During or After Loading Guest State"). 7923 * Failures During or After Loading Guest State").
7376 * This function should be called when the active VMCS is L1's (vmcs01). 7924 * This function should be called when the active VMCS is L1's (vmcs01).
7377 */ 7925 */
7378void load_vmcs12_host_state(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) 7926static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
7927 struct vmcs12 *vmcs12)
7379{ 7928{
7380 if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_EFER) 7929 if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_EFER)
7381 vcpu->arch.efer = vmcs12->host_ia32_efer; 7930 vcpu->arch.efer = vmcs12->host_ia32_efer;
7382 if (vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE) 7931 else if (vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE)
7383 vcpu->arch.efer |= (EFER_LMA | EFER_LME); 7932 vcpu->arch.efer |= (EFER_LMA | EFER_LME);
7384 else 7933 else
7385 vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); 7934 vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
@@ -7387,6 +7936,7 @@ void load_vmcs12_host_state(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7387 7936
7388 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp); 7937 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
7389 kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip); 7938 kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
7939 vmx_set_rflags(vcpu, X86_EFLAGS_BIT1);
7390 /* 7940 /*
7391 * Note that calling vmx_set_cr0 is important, even if cr0 hasn't 7941 * Note that calling vmx_set_cr0 is important, even if cr0 hasn't
7392 * actually changed, because it depends on the current state of 7942 * actually changed, because it depends on the current state of
@@ -7445,6 +7995,9 @@ void load_vmcs12_host_state(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7445 if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) 7995 if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL)
7446 vmcs_write64(GUEST_IA32_PERF_GLOBAL_CTRL, 7996 vmcs_write64(GUEST_IA32_PERF_GLOBAL_CTRL,
7447 vmcs12->host_ia32_perf_global_ctrl); 7997 vmcs12->host_ia32_perf_global_ctrl);
7998
7999 kvm_set_dr(vcpu, 7, 0x400);
8000 vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
7448} 8001}
7449 8002
7450/* 8003/*
@@ -7458,6 +8011,9 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
7458 int cpu; 8011 int cpu;
7459 struct vmcs12 *vmcs12 = get_vmcs12(vcpu); 8012 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
7460 8013
8014 /* trying to cancel vmlaunch/vmresume is a bug */
8015 WARN_ON_ONCE(vmx->nested.nested_run_pending);
8016
7461 leave_guest_mode(vcpu); 8017 leave_guest_mode(vcpu);
7462 prepare_vmcs12(vcpu, vmcs12); 8018 prepare_vmcs12(vcpu, vmcs12);
7463 8019
@@ -7468,6 +8024,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
7468 vcpu->cpu = cpu; 8024 vcpu->cpu = cpu;
7469 put_cpu(); 8025 put_cpu();
7470 8026
8027 vmx_segment_cache_clear(vmx);
8028
7471 /* if no vmcs02 cache requested, remove the one we used */ 8029 /* if no vmcs02 cache requested, remove the one we used */
7472 if (VMCS02_POOL_SIZE == 0) 8030 if (VMCS02_POOL_SIZE == 0)
7473 nested_free_vmcs02(vmx, vmx->nested.current_vmptr); 8031 nested_free_vmcs02(vmx, vmx->nested.current_vmptr);
@@ -7496,6 +8054,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
7496 nested_vmx_failValid(vcpu, vmcs_read32(VM_INSTRUCTION_ERROR)); 8054 nested_vmx_failValid(vcpu, vmcs_read32(VM_INSTRUCTION_ERROR));
7497 } else 8055 } else
7498 nested_vmx_succeed(vcpu); 8056 nested_vmx_succeed(vcpu);
8057 if (enable_shadow_vmcs)
8058 vmx->nested.sync_shadow_vmcs = true;
7499} 8059}
7500 8060
7501/* 8061/*
@@ -7513,6 +8073,8 @@ static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu,
7513 vmcs12->vm_exit_reason = reason | VMX_EXIT_REASONS_FAILED_VMENTRY; 8073 vmcs12->vm_exit_reason = reason | VMX_EXIT_REASONS_FAILED_VMENTRY;
7514 vmcs12->exit_qualification = qualification; 8074 vmcs12->exit_qualification = qualification;
7515 nested_vmx_succeed(vcpu); 8075 nested_vmx_succeed(vcpu);
8076 if (enable_shadow_vmcs)
8077 to_vmx(vcpu)->nested.sync_shadow_vmcs = true;
7516} 8078}
7517 8079
7518static int vmx_check_intercept(struct kvm_vcpu *vcpu, 8080static int vmx_check_intercept(struct kvm_vcpu *vcpu,
@@ -7590,6 +8152,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
7590 .load_eoi_exitmap = vmx_load_eoi_exitmap, 8152 .load_eoi_exitmap = vmx_load_eoi_exitmap,
7591 .hwapic_irr_update = vmx_hwapic_irr_update, 8153 .hwapic_irr_update = vmx_hwapic_irr_update,
7592 .hwapic_isr_update = vmx_hwapic_isr_update, 8154 .hwapic_isr_update = vmx_hwapic_isr_update,
8155 .sync_pir_to_irr = vmx_sync_pir_to_irr,
8156 .deliver_posted_interrupt = vmx_deliver_posted_interrupt,
7593 8157
7594 .set_tss_addr = vmx_set_tss_addr, 8158 .set_tss_addr = vmx_set_tss_addr,
7595 .get_tdp_level = get_ept_level, 8159 .get_tdp_level = get_ept_level,
@@ -7618,6 +8182,7 @@ static struct kvm_x86_ops vmx_x86_ops = {
7618 .set_tdp_cr3 = vmx_set_cr3, 8182 .set_tdp_cr3 = vmx_set_cr3,
7619 8183
7620 .check_intercept = vmx_check_intercept, 8184 .check_intercept = vmx_check_intercept,
8185 .handle_external_intr = vmx_handle_external_intr,
7621}; 8186};
7622 8187
7623static int __init vmx_init(void) 8188static int __init vmx_init(void)
@@ -7656,6 +8221,24 @@ static int __init vmx_init(void)
7656 (unsigned long *)__get_free_page(GFP_KERNEL); 8221 (unsigned long *)__get_free_page(GFP_KERNEL);
7657 if (!vmx_msr_bitmap_longmode_x2apic) 8222 if (!vmx_msr_bitmap_longmode_x2apic)
7658 goto out4; 8223 goto out4;
8224 vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
8225 if (!vmx_vmread_bitmap)
8226 goto out5;
8227
8228 vmx_vmwrite_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
8229 if (!vmx_vmwrite_bitmap)
8230 goto out6;
8231
8232 memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE);
8233 memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE);
8234 /* shadowed read/write fields */
8235 for (i = 0; i < max_shadow_read_write_fields; i++) {
8236 clear_bit(shadow_read_write_fields[i], vmx_vmwrite_bitmap);
8237 clear_bit(shadow_read_write_fields[i], vmx_vmread_bitmap);
8238 }
8239 /* shadowed read only fields */
8240 for (i = 0; i < max_shadow_read_only_fields; i++)
8241 clear_bit(shadow_read_only_fields[i], vmx_vmread_bitmap);
7659 8242
7660 /* 8243 /*
7661 * Allow direct access to the PC debug port (it is often used for I/O 8244 * Allow direct access to the PC debug port (it is often used for I/O
@@ -7674,7 +8257,7 @@ static int __init vmx_init(void)
7674 r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx), 8257 r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
7675 __alignof__(struct vcpu_vmx), THIS_MODULE); 8258 __alignof__(struct vcpu_vmx), THIS_MODULE);
7676 if (r) 8259 if (r)
7677 goto out3; 8260 goto out7;
7678 8261
7679#ifdef CONFIG_KEXEC 8262#ifdef CONFIG_KEXEC
7680 rcu_assign_pointer(crash_vmclear_loaded_vmcss, 8263 rcu_assign_pointer(crash_vmclear_loaded_vmcss,
@@ -7692,7 +8275,7 @@ static int __init vmx_init(void)
7692 memcpy(vmx_msr_bitmap_longmode_x2apic, 8275 memcpy(vmx_msr_bitmap_longmode_x2apic,
7693 vmx_msr_bitmap_longmode, PAGE_SIZE); 8276 vmx_msr_bitmap_longmode, PAGE_SIZE);
7694 8277
7695 if (enable_apicv_reg_vid) { 8278 if (enable_apicv) {
7696 for (msr = 0x800; msr <= 0x8ff; msr++) 8279 for (msr = 0x800; msr <= 0x8ff; msr++)
7697 vmx_disable_intercept_msr_read_x2apic(msr); 8280 vmx_disable_intercept_msr_read_x2apic(msr);
7698 8281
@@ -7722,6 +8305,12 @@ static int __init vmx_init(void)
7722 8305
7723 return 0; 8306 return 0;
7724 8307
8308out7:
8309 free_page((unsigned long)vmx_vmwrite_bitmap);
8310out6:
8311 free_page((unsigned long)vmx_vmread_bitmap);
8312out5:
8313 free_page((unsigned long)vmx_msr_bitmap_longmode_x2apic);
7725out4: 8314out4:
7726 free_page((unsigned long)vmx_msr_bitmap_longmode); 8315 free_page((unsigned long)vmx_msr_bitmap_longmode);
7727out3: 8316out3:
@@ -7743,6 +8332,8 @@ static void __exit vmx_exit(void)
7743 free_page((unsigned long)vmx_msr_bitmap_longmode); 8332 free_page((unsigned long)vmx_msr_bitmap_longmode);
7744 free_page((unsigned long)vmx_io_bitmap_b); 8333 free_page((unsigned long)vmx_io_bitmap_b);
7745 free_page((unsigned long)vmx_io_bitmap_a); 8334 free_page((unsigned long)vmx_io_bitmap_a);
8335 free_page((unsigned long)vmx_vmwrite_bitmap);
8336 free_page((unsigned long)vmx_vmread_bitmap);
7746 8337
7747#ifdef CONFIG_KEXEC 8338#ifdef CONFIG_KEXEC
7748 rcu_assign_pointer(crash_vmclear_loaded_vmcss, NULL); 8339 rcu_assign_pointer(crash_vmclear_loaded_vmcss, NULL);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e1721324c271..05a8b1a2300d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -162,8 +162,6 @@ u64 __read_mostly host_xcr0;
162 162
163static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt); 163static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt);
164 164
165static int kvm_vcpu_reset(struct kvm_vcpu *vcpu);
166
167static inline void kvm_async_pf_hash_reset(struct kvm_vcpu *vcpu) 165static inline void kvm_async_pf_hash_reset(struct kvm_vcpu *vcpu)
168{ 166{
169 int i; 167 int i;
@@ -263,6 +261,13 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data)
263} 261}
264EXPORT_SYMBOL_GPL(kvm_set_apic_base); 262EXPORT_SYMBOL_GPL(kvm_set_apic_base);
265 263
264asmlinkage void kvm_spurious_fault(void)
265{
266 /* Fault while not rebooting. We want the trace. */
267 BUG();
268}
269EXPORT_SYMBOL_GPL(kvm_spurious_fault);
270
266#define EXCPT_BENIGN 0 271#define EXCPT_BENIGN 0
267#define EXCPT_CONTRIBUTORY 1 272#define EXCPT_CONTRIBUTORY 1
268#define EXCPT_PF 2 273#define EXCPT_PF 2
@@ -840,23 +845,17 @@ static const u32 emulated_msrs[] = {
840 MSR_IA32_MCG_CTL, 845 MSR_IA32_MCG_CTL,
841}; 846};
842 847
843static int set_efer(struct kvm_vcpu *vcpu, u64 efer) 848bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
844{ 849{
845 u64 old_efer = vcpu->arch.efer;
846
847 if (efer & efer_reserved_bits) 850 if (efer & efer_reserved_bits)
848 return 1; 851 return false;
849
850 if (is_paging(vcpu)
851 && (vcpu->arch.efer & EFER_LME) != (efer & EFER_LME))
852 return 1;
853 852
854 if (efer & EFER_FFXSR) { 853 if (efer & EFER_FFXSR) {
855 struct kvm_cpuid_entry2 *feat; 854 struct kvm_cpuid_entry2 *feat;
856 855
857 feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0); 856 feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
858 if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT))) 857 if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT)))
859 return 1; 858 return false;
860 } 859 }
861 860
862 if (efer & EFER_SVME) { 861 if (efer & EFER_SVME) {
@@ -864,9 +863,24 @@ static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
864 863
865 feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0); 864 feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
866 if (!feat || !(feat->ecx & bit(X86_FEATURE_SVM))) 865 if (!feat || !(feat->ecx & bit(X86_FEATURE_SVM)))
867 return 1; 866 return false;
868 } 867 }
869 868
869 return true;
870}
871EXPORT_SYMBOL_GPL(kvm_valid_efer);
872
873static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
874{
875 u64 old_efer = vcpu->arch.efer;
876
877 if (!kvm_valid_efer(vcpu, efer))
878 return 1;
879
880 if (is_paging(vcpu)
881 && (vcpu->arch.efer & EFER_LME) != (efer & EFER_LME))
882 return 1;
883
870 efer &= ~EFER_LMA; 884 efer &= ~EFER_LMA;
871 efer |= vcpu->arch.efer & EFER_LMA; 885 efer |= vcpu->arch.efer & EFER_LMA;
872 886
@@ -1079,6 +1093,10 @@ static void kvm_set_tsc_khz(struct kvm_vcpu *vcpu, u32 this_tsc_khz)
1079 u32 thresh_lo, thresh_hi; 1093 u32 thresh_lo, thresh_hi;
1080 int use_scaling = 0; 1094 int use_scaling = 0;
1081 1095
1096 /* tsc_khz can be zero if TSC calibration fails */
1097 if (this_tsc_khz == 0)
1098 return;
1099
1082 /* Compute a scale to convert nanoseconds in TSC cycles */ 1100 /* Compute a scale to convert nanoseconds in TSC cycles */
1083 kvm_get_time_scale(this_tsc_khz, NSEC_PER_SEC / 1000, 1101 kvm_get_time_scale(this_tsc_khz, NSEC_PER_SEC / 1000,
1084 &vcpu->arch.virtual_tsc_shift, 1102 &vcpu->arch.virtual_tsc_shift,
@@ -1156,20 +1174,23 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
1156 ns = get_kernel_ns(); 1174 ns = get_kernel_ns();
1157 elapsed = ns - kvm->arch.last_tsc_nsec; 1175 elapsed = ns - kvm->arch.last_tsc_nsec;
1158 1176
1159 /* n.b - signed multiplication and division required */ 1177 if (vcpu->arch.virtual_tsc_khz) {
1160 usdiff = data - kvm->arch.last_tsc_write; 1178 /* n.b - signed multiplication and division required */
1179 usdiff = data - kvm->arch.last_tsc_write;
1161#ifdef CONFIG_X86_64 1180#ifdef CONFIG_X86_64
1162 usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz; 1181 usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz;
1163#else 1182#else
1164 /* do_div() only does unsigned */ 1183 /* do_div() only does unsigned */
1165 asm("idivl %2; xor %%edx, %%edx" 1184 asm("idivl %2; xor %%edx, %%edx"
1166 : "=A"(usdiff) 1185 : "=A"(usdiff)
1167 : "A"(usdiff * 1000), "rm"(vcpu->arch.virtual_tsc_khz)); 1186 : "A"(usdiff * 1000), "rm"(vcpu->arch.virtual_tsc_khz));
1168#endif 1187#endif
1169 do_div(elapsed, 1000); 1188 do_div(elapsed, 1000);
1170 usdiff -= elapsed; 1189 usdiff -= elapsed;
1171 if (usdiff < 0) 1190 if (usdiff < 0)
1172 usdiff = -usdiff; 1191 usdiff = -usdiff;
1192 } else
1193 usdiff = USEC_PER_SEC; /* disable TSC match window below */
1173 1194
1174 /* 1195 /*
1175 * Special case: TSC write with a small delta (1 second) of virtual 1196 * Special case: TSC write with a small delta (1 second) of virtual
@@ -2034,7 +2055,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2034 case MSR_P6_EVNTSEL0: 2055 case MSR_P6_EVNTSEL0:
2035 case MSR_P6_EVNTSEL1: 2056 case MSR_P6_EVNTSEL1:
2036 if (kvm_pmu_msr(vcpu, msr)) 2057 if (kvm_pmu_msr(vcpu, msr))
2037 return kvm_pmu_set_msr(vcpu, msr, data); 2058 return kvm_pmu_set_msr(vcpu, msr_info);
2038 2059
2039 if (pr || data != 0) 2060 if (pr || data != 0)
2040 vcpu_unimpl(vcpu, "disabled perfctr wrmsr: " 2061 vcpu_unimpl(vcpu, "disabled perfctr wrmsr: "
@@ -2080,7 +2101,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
2080 if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr)) 2101 if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr))
2081 return xen_hvm_config(vcpu, data); 2102 return xen_hvm_config(vcpu, data);
2082 if (kvm_pmu_msr(vcpu, msr)) 2103 if (kvm_pmu_msr(vcpu, msr))
2083 return kvm_pmu_set_msr(vcpu, msr, data); 2104 return kvm_pmu_set_msr(vcpu, msr_info);
2084 if (!ignore_msrs) { 2105 if (!ignore_msrs) {
2085 vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n", 2106 vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n",
2086 msr, data); 2107 msr, data);
@@ -2479,7 +2500,6 @@ int kvm_dev_ioctl_check_extension(long ext)
2479 case KVM_CAP_USER_NMI: 2500 case KVM_CAP_USER_NMI:
2480 case KVM_CAP_REINJECT_CONTROL: 2501 case KVM_CAP_REINJECT_CONTROL:
2481 case KVM_CAP_IRQ_INJECT_STATUS: 2502 case KVM_CAP_IRQ_INJECT_STATUS:
2482 case KVM_CAP_ASSIGN_DEV_IRQ:
2483 case KVM_CAP_IRQFD: 2503 case KVM_CAP_IRQFD:
2484 case KVM_CAP_IOEVENTFD: 2504 case KVM_CAP_IOEVENTFD:
2485 case KVM_CAP_PIT2: 2505 case KVM_CAP_PIT2:
@@ -2497,10 +2517,12 @@ int kvm_dev_ioctl_check_extension(long ext)
2497 case KVM_CAP_XSAVE: 2517 case KVM_CAP_XSAVE:
2498 case KVM_CAP_ASYNC_PF: 2518 case KVM_CAP_ASYNC_PF:
2499 case KVM_CAP_GET_TSC_KHZ: 2519 case KVM_CAP_GET_TSC_KHZ:
2500 case KVM_CAP_PCI_2_3:
2501 case KVM_CAP_KVMCLOCK_CTRL: 2520 case KVM_CAP_KVMCLOCK_CTRL:
2502 case KVM_CAP_READONLY_MEM: 2521 case KVM_CAP_READONLY_MEM:
2503 case KVM_CAP_IRQFD_RESAMPLE: 2522#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
2523 case KVM_CAP_ASSIGN_DEV_IRQ:
2524 case KVM_CAP_PCI_2_3:
2525#endif
2504 r = 1; 2526 r = 1;
2505 break; 2527 break;
2506 case KVM_CAP_COALESCED_MMIO: 2528 case KVM_CAP_COALESCED_MMIO:
@@ -2521,9 +2543,11 @@ int kvm_dev_ioctl_check_extension(long ext)
2521 case KVM_CAP_PV_MMU: /* obsolete */ 2543 case KVM_CAP_PV_MMU: /* obsolete */
2522 r = 0; 2544 r = 0;
2523 break; 2545 break;
2546#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
2524 case KVM_CAP_IOMMU: 2547 case KVM_CAP_IOMMU:
2525 r = iommu_present(&pci_bus_type); 2548 r = iommu_present(&pci_bus_type);
2526 break; 2549 break;
2550#endif
2527 case KVM_CAP_MCE: 2551 case KVM_CAP_MCE:
2528 r = KVM_MAX_MCE_BANKS; 2552 r = KVM_MAX_MCE_BANKS;
2529 break; 2553 break;
@@ -2679,6 +2703,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
2679static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, 2703static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu,
2680 struct kvm_lapic_state *s) 2704 struct kvm_lapic_state *s)
2681{ 2705{
2706 kvm_x86_ops->sync_pir_to_irr(vcpu);
2682 memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s); 2707 memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s);
2683 2708
2684 return 0; 2709 return 0;
@@ -2696,7 +2721,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
2696static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, 2721static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
2697 struct kvm_interrupt *irq) 2722 struct kvm_interrupt *irq)
2698{ 2723{
2699 if (irq->irq < 0 || irq->irq >= KVM_NR_INTERRUPTS) 2724 if (irq->irq >= KVM_NR_INTERRUPTS)
2700 return -EINVAL; 2725 return -EINVAL;
2701 if (irqchip_in_kernel(vcpu->kvm)) 2726 if (irqchip_in_kernel(vcpu->kvm))
2702 return -ENXIO; 2727 return -ENXIO;
@@ -2819,10 +2844,9 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
2819 events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu); 2844 events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu);
2820 events->nmi.pad = 0; 2845 events->nmi.pad = 0;
2821 2846
2822 events->sipi_vector = vcpu->arch.sipi_vector; 2847 events->sipi_vector = 0; /* never valid when reporting to user space */
2823 2848
2824 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING 2849 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING
2825 | KVM_VCPUEVENT_VALID_SIPI_VECTOR
2826 | KVM_VCPUEVENT_VALID_SHADOW); 2850 | KVM_VCPUEVENT_VALID_SHADOW);
2827 memset(&events->reserved, 0, sizeof(events->reserved)); 2851 memset(&events->reserved, 0, sizeof(events->reserved));
2828} 2852}
@@ -2853,8 +2877,9 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
2853 vcpu->arch.nmi_pending = events->nmi.pending; 2877 vcpu->arch.nmi_pending = events->nmi.pending;
2854 kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked); 2878 kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked);
2855 2879
2856 if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR) 2880 if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR &&
2857 vcpu->arch.sipi_vector = events->sipi_vector; 2881 kvm_vcpu_has_lapic(vcpu))
2882 vcpu->arch.apic->sipi_vector = events->sipi_vector;
2858 2883
2859 kvm_make_request(KVM_REQ_EVENT, vcpu); 2884 kvm_make_request(KVM_REQ_EVENT, vcpu);
2860 2885
@@ -3478,13 +3503,15 @@ out:
3478 return r; 3503 return r;
3479} 3504}
3480 3505
3481int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event) 3506int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event,
3507 bool line_status)
3482{ 3508{
3483 if (!irqchip_in_kernel(kvm)) 3509 if (!irqchip_in_kernel(kvm))
3484 return -ENXIO; 3510 return -ENXIO;
3485 3511
3486 irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 3512 irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
3487 irq_event->irq, irq_event->level); 3513 irq_event->irq, irq_event->level,
3514 line_status);
3488 return 0; 3515 return 0;
3489} 3516}
3490 3517
@@ -4752,11 +4779,15 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu)
4752} 4779}
4753 4780
4754static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2, 4781static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t cr2,
4755 bool write_fault_to_shadow_pgtable) 4782 bool write_fault_to_shadow_pgtable,
4783 int emulation_type)
4756{ 4784{
4757 gpa_t gpa = cr2; 4785 gpa_t gpa = cr2;
4758 pfn_t pfn; 4786 pfn_t pfn;
4759 4787
4788 if (emulation_type & EMULTYPE_NO_REEXECUTE)
4789 return false;
4790
4760 if (!vcpu->arch.mmu.direct_map) { 4791 if (!vcpu->arch.mmu.direct_map) {
4761 /* 4792 /*
4762 * Write permission should be allowed since only 4793 * Write permission should be allowed since only
@@ -4899,8 +4930,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,
4899 if (r != EMULATION_OK) { 4930 if (r != EMULATION_OK) {
4900 if (emulation_type & EMULTYPE_TRAP_UD) 4931 if (emulation_type & EMULTYPE_TRAP_UD)
4901 return EMULATE_FAIL; 4932 return EMULATE_FAIL;
4902 if (reexecute_instruction(vcpu, cr2, 4933 if (reexecute_instruction(vcpu, cr2, write_fault_to_spt,
4903 write_fault_to_spt)) 4934 emulation_type))
4904 return EMULATE_DONE; 4935 return EMULATE_DONE;
4905 if (emulation_type & EMULTYPE_SKIP) 4936 if (emulation_type & EMULTYPE_SKIP)
4906 return EMULATE_FAIL; 4937 return EMULATE_FAIL;
@@ -4930,7 +4961,8 @@ restart:
4930 return EMULATE_DONE; 4961 return EMULATE_DONE;
4931 4962
4932 if (r == EMULATION_FAILED) { 4963 if (r == EMULATION_FAILED) {
4933 if (reexecute_instruction(vcpu, cr2, write_fault_to_spt)) 4964 if (reexecute_instruction(vcpu, cr2, write_fault_to_spt,
4965 emulation_type))
4934 return EMULATE_DONE; 4966 return EMULATE_DONE;
4935 4967
4936 return handle_emulation_failure(vcpu); 4968 return handle_emulation_failure(vcpu);
@@ -5641,14 +5673,20 @@ static void kvm_gen_update_masterclock(struct kvm *kvm)
5641#endif 5673#endif
5642} 5674}
5643 5675
5644static void update_eoi_exitmap(struct kvm_vcpu *vcpu) 5676static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
5645{ 5677{
5646 u64 eoi_exit_bitmap[4]; 5678 u64 eoi_exit_bitmap[4];
5679 u32 tmr[8];
5680
5681 if (!kvm_apic_hw_enabled(vcpu->arch.apic))
5682 return;
5647 5683
5648 memset(eoi_exit_bitmap, 0, 32); 5684 memset(eoi_exit_bitmap, 0, 32);
5685 memset(tmr, 0, 32);
5649 5686
5650 kvm_ioapic_calculate_eoi_exitmap(vcpu, eoi_exit_bitmap); 5687 kvm_ioapic_scan_entry(vcpu, eoi_exit_bitmap, tmr);
5651 kvm_x86_ops->load_eoi_exitmap(vcpu, eoi_exit_bitmap); 5688 kvm_x86_ops->load_eoi_exitmap(vcpu, eoi_exit_bitmap);
5689 kvm_apic_update_tmr(vcpu, tmr);
5652} 5690}
5653 5691
5654static int vcpu_enter_guest(struct kvm_vcpu *vcpu) 5692static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
@@ -5656,7 +5694,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5656 int r; 5694 int r;
5657 bool req_int_win = !irqchip_in_kernel(vcpu->kvm) && 5695 bool req_int_win = !irqchip_in_kernel(vcpu->kvm) &&
5658 vcpu->run->request_interrupt_window; 5696 vcpu->run->request_interrupt_window;
5659 bool req_immediate_exit = 0; 5697 bool req_immediate_exit = false;
5660 5698
5661 if (vcpu->requests) { 5699 if (vcpu->requests) {
5662 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) 5700 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
@@ -5698,24 +5736,30 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5698 record_steal_time(vcpu); 5736 record_steal_time(vcpu);
5699 if (kvm_check_request(KVM_REQ_NMI, vcpu)) 5737 if (kvm_check_request(KVM_REQ_NMI, vcpu))
5700 process_nmi(vcpu); 5738 process_nmi(vcpu);
5701 req_immediate_exit =
5702 kvm_check_request(KVM_REQ_IMMEDIATE_EXIT, vcpu);
5703 if (kvm_check_request(KVM_REQ_PMU, vcpu)) 5739 if (kvm_check_request(KVM_REQ_PMU, vcpu))
5704 kvm_handle_pmu_event(vcpu); 5740 kvm_handle_pmu_event(vcpu);
5705 if (kvm_check_request(KVM_REQ_PMI, vcpu)) 5741 if (kvm_check_request(KVM_REQ_PMI, vcpu))
5706 kvm_deliver_pmi(vcpu); 5742 kvm_deliver_pmi(vcpu);
5707 if (kvm_check_request(KVM_REQ_EOIBITMAP, vcpu)) 5743 if (kvm_check_request(KVM_REQ_SCAN_IOAPIC, vcpu))
5708 update_eoi_exitmap(vcpu); 5744 vcpu_scan_ioapic(vcpu);
5709 } 5745 }
5710 5746
5711 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) { 5747 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
5748 kvm_apic_accept_events(vcpu);
5749 if (vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) {
5750 r = 1;
5751 goto out;
5752 }
5753
5712 inject_pending_event(vcpu); 5754 inject_pending_event(vcpu);
5713 5755
5714 /* enable NMI/IRQ window open exits if needed */ 5756 /* enable NMI/IRQ window open exits if needed */
5715 if (vcpu->arch.nmi_pending) 5757 if (vcpu->arch.nmi_pending)
5716 kvm_x86_ops->enable_nmi_window(vcpu); 5758 req_immediate_exit =
5759 kvm_x86_ops->enable_nmi_window(vcpu) != 0;
5717 else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win) 5760 else if (kvm_cpu_has_injectable_intr(vcpu) || req_int_win)
5718 kvm_x86_ops->enable_irq_window(vcpu); 5761 req_immediate_exit =
5762 kvm_x86_ops->enable_irq_window(vcpu) != 0;
5719 5763
5720 if (kvm_lapic_enabled(vcpu)) { 5764 if (kvm_lapic_enabled(vcpu)) {
5721 /* 5765 /*
@@ -5794,7 +5838,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5794 5838
5795 vcpu->mode = OUTSIDE_GUEST_MODE; 5839 vcpu->mode = OUTSIDE_GUEST_MODE;
5796 smp_wmb(); 5840 smp_wmb();
5797 local_irq_enable(); 5841
5842 /* Interrupt is enabled by handle_external_intr() */
5843 kvm_x86_ops->handle_external_intr(vcpu);
5798 5844
5799 ++vcpu->stat.exits; 5845 ++vcpu->stat.exits;
5800 5846
@@ -5843,16 +5889,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
5843 int r; 5889 int r;
5844 struct kvm *kvm = vcpu->kvm; 5890 struct kvm *kvm = vcpu->kvm;
5845 5891
5846 if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED)) {
5847 pr_debug("vcpu %d received sipi with vector # %x\n",
5848 vcpu->vcpu_id, vcpu->arch.sipi_vector);
5849 kvm_lapic_reset(vcpu);
5850 r = kvm_vcpu_reset(vcpu);
5851 if (r)
5852 return r;
5853 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
5854 }
5855
5856 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); 5892 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
5857 r = vapic_enter(vcpu); 5893 r = vapic_enter(vcpu);
5858 if (r) { 5894 if (r) {
@@ -5869,8 +5905,8 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
5869 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); 5905 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
5870 kvm_vcpu_block(vcpu); 5906 kvm_vcpu_block(vcpu);
5871 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); 5907 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
5872 if (kvm_check_request(KVM_REQ_UNHALT, vcpu)) 5908 if (kvm_check_request(KVM_REQ_UNHALT, vcpu)) {
5873 { 5909 kvm_apic_accept_events(vcpu);
5874 switch(vcpu->arch.mp_state) { 5910 switch(vcpu->arch.mp_state) {
5875 case KVM_MP_STATE_HALTED: 5911 case KVM_MP_STATE_HALTED:
5876 vcpu->arch.mp_state = 5912 vcpu->arch.mp_state =
@@ -5878,7 +5914,8 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
5878 case KVM_MP_STATE_RUNNABLE: 5914 case KVM_MP_STATE_RUNNABLE:
5879 vcpu->arch.apf.halted = false; 5915 vcpu->arch.apf.halted = false;
5880 break; 5916 break;
5881 case KVM_MP_STATE_SIPI_RECEIVED: 5917 case KVM_MP_STATE_INIT_RECEIVED:
5918 break;
5882 default: 5919 default:
5883 r = -EINTR; 5920 r = -EINTR;
5884 break; 5921 break;
@@ -6013,6 +6050,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
6013 6050
6014 if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { 6051 if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
6015 kvm_vcpu_block(vcpu); 6052 kvm_vcpu_block(vcpu);
6053 kvm_apic_accept_events(vcpu);
6016 clear_bit(KVM_REQ_UNHALT, &vcpu->requests); 6054 clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
6017 r = -EAGAIN; 6055 r = -EAGAIN;
6018 goto out; 6056 goto out;
@@ -6169,6 +6207,7 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
6169int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 6207int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
6170 struct kvm_mp_state *mp_state) 6208 struct kvm_mp_state *mp_state)
6171{ 6209{
6210 kvm_apic_accept_events(vcpu);
6172 mp_state->mp_state = vcpu->arch.mp_state; 6211 mp_state->mp_state = vcpu->arch.mp_state;
6173 return 0; 6212 return 0;
6174} 6213}
@@ -6176,7 +6215,15 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
6176int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, 6215int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
6177 struct kvm_mp_state *mp_state) 6216 struct kvm_mp_state *mp_state)
6178{ 6217{
6179 vcpu->arch.mp_state = mp_state->mp_state; 6218 if (!kvm_vcpu_has_lapic(vcpu) &&
6219 mp_state->mp_state != KVM_MP_STATE_RUNNABLE)
6220 return -EINVAL;
6221
6222 if (mp_state->mp_state == KVM_MP_STATE_SIPI_RECEIVED) {
6223 vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED;
6224 set_bit(KVM_APIC_SIPI, &vcpu->arch.apic->pending_events);
6225 } else
6226 vcpu->arch.mp_state = mp_state->mp_state;
6180 kvm_make_request(KVM_REQ_EVENT, vcpu); 6227 kvm_make_request(KVM_REQ_EVENT, vcpu);
6181 return 0; 6228 return 0;
6182} 6229}
@@ -6475,9 +6522,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
6475 r = vcpu_load(vcpu); 6522 r = vcpu_load(vcpu);
6476 if (r) 6523 if (r)
6477 return r; 6524 return r;
6478 r = kvm_vcpu_reset(vcpu); 6525 kvm_vcpu_reset(vcpu);
6479 if (r == 0) 6526 r = kvm_mmu_setup(vcpu);
6480 r = kvm_mmu_setup(vcpu);
6481 vcpu_put(vcpu); 6527 vcpu_put(vcpu);
6482 6528
6483 return r; 6529 return r;
@@ -6514,7 +6560,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
6514 kvm_x86_ops->vcpu_free(vcpu); 6560 kvm_x86_ops->vcpu_free(vcpu);
6515} 6561}
6516 6562
6517static int kvm_vcpu_reset(struct kvm_vcpu *vcpu) 6563void kvm_vcpu_reset(struct kvm_vcpu *vcpu)
6518{ 6564{
6519 atomic_set(&vcpu->arch.nmi_queued, 0); 6565 atomic_set(&vcpu->arch.nmi_queued, 0);
6520 vcpu->arch.nmi_pending = 0; 6566 vcpu->arch.nmi_pending = 0;
@@ -6541,7 +6587,18 @@ static int kvm_vcpu_reset(struct kvm_vcpu *vcpu)
6541 vcpu->arch.regs_avail = ~0; 6587 vcpu->arch.regs_avail = ~0;
6542 vcpu->arch.regs_dirty = ~0; 6588 vcpu->arch.regs_dirty = ~0;
6543 6589
6544 return kvm_x86_ops->vcpu_reset(vcpu); 6590 kvm_x86_ops->vcpu_reset(vcpu);
6591}
6592
6593void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, unsigned int vector)
6594{
6595 struct kvm_segment cs;
6596
6597 kvm_get_segment(vcpu, &cs, VCPU_SREG_CS);
6598 cs.selector = vector << 8;
6599 cs.base = vector << 12;
6600 kvm_set_segment(vcpu, &cs, VCPU_SREG_CS);
6601 kvm_rip_write(vcpu, 0);
6545} 6602}
6546 6603
6547int kvm_arch_hardware_enable(void *garbage) 6604int kvm_arch_hardware_enable(void *garbage)
@@ -6706,8 +6763,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
6706 } 6763 }
6707 vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS; 6764 vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
6708 6765
6709 if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) 6766 if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) {
6767 r = -ENOMEM;
6710 goto fail_free_mce_banks; 6768 goto fail_free_mce_banks;
6769 }
6711 6770
6712 r = fx_init(vcpu); 6771 r = fx_init(vcpu);
6713 if (r) 6772 if (r)
@@ -6811,6 +6870,23 @@ void kvm_arch_sync_events(struct kvm *kvm)
6811 6870
6812void kvm_arch_destroy_vm(struct kvm *kvm) 6871void kvm_arch_destroy_vm(struct kvm *kvm)
6813{ 6872{
6873 if (current->mm == kvm->mm) {
6874 /*
6875 * Free memory regions allocated on behalf of userspace,
6876 * unless the the memory map has changed due to process exit
6877 * or fd copying.
6878 */
6879 struct kvm_userspace_memory_region mem;
6880 memset(&mem, 0, sizeof(mem));
6881 mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT;
6882 kvm_set_memory_region(kvm, &mem);
6883
6884 mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT;
6885 kvm_set_memory_region(kvm, &mem);
6886
6887 mem.slot = TSS_PRIVATE_MEMSLOT;
6888 kvm_set_memory_region(kvm, &mem);
6889 }
6814 kvm_iommu_unmap_guest(kvm); 6890 kvm_iommu_unmap_guest(kvm);
6815 kfree(kvm->arch.vpic); 6891 kfree(kvm->arch.vpic);
6816 kfree(kvm->arch.vioapic); 6892 kfree(kvm->arch.vioapic);
@@ -6903,24 +6979,21 @@ out_free:
6903 6979
6904int kvm_arch_prepare_memory_region(struct kvm *kvm, 6980int kvm_arch_prepare_memory_region(struct kvm *kvm,
6905 struct kvm_memory_slot *memslot, 6981 struct kvm_memory_slot *memslot,
6906 struct kvm_memory_slot old,
6907 struct kvm_userspace_memory_region *mem, 6982 struct kvm_userspace_memory_region *mem,
6908 bool user_alloc) 6983 enum kvm_mr_change change)
6909{ 6984{
6910 int npages = memslot->npages;
6911
6912 /* 6985 /*
6913 * Only private memory slots need to be mapped here since 6986 * Only private memory slots need to be mapped here since
6914 * KVM_SET_MEMORY_REGION ioctl is no longer supported. 6987 * KVM_SET_MEMORY_REGION ioctl is no longer supported.
6915 */ 6988 */
6916 if ((memslot->id >= KVM_USER_MEM_SLOTS) && npages && !old.npages) { 6989 if ((memslot->id >= KVM_USER_MEM_SLOTS) && (change == KVM_MR_CREATE)) {
6917 unsigned long userspace_addr; 6990 unsigned long userspace_addr;
6918 6991
6919 /* 6992 /*
6920 * MAP_SHARED to prevent internal slot pages from being moved 6993 * MAP_SHARED to prevent internal slot pages from being moved
6921 * by fork()/COW. 6994 * by fork()/COW.
6922 */ 6995 */
6923 userspace_addr = vm_mmap(NULL, 0, npages * PAGE_SIZE, 6996 userspace_addr = vm_mmap(NULL, 0, memslot->npages * PAGE_SIZE,
6924 PROT_READ | PROT_WRITE, 6997 PROT_READ | PROT_WRITE,
6925 MAP_SHARED | MAP_ANONYMOUS, 0); 6998 MAP_SHARED | MAP_ANONYMOUS, 0);
6926 6999
@@ -6935,17 +7008,17 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
6935 7008
6936void kvm_arch_commit_memory_region(struct kvm *kvm, 7009void kvm_arch_commit_memory_region(struct kvm *kvm,
6937 struct kvm_userspace_memory_region *mem, 7010 struct kvm_userspace_memory_region *mem,
6938 struct kvm_memory_slot old, 7011 const struct kvm_memory_slot *old,
6939 bool user_alloc) 7012 enum kvm_mr_change change)
6940{ 7013{
6941 7014
6942 int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT; 7015 int nr_mmu_pages = 0;
6943 7016
6944 if ((mem->slot >= KVM_USER_MEM_SLOTS) && old.npages && !npages) { 7017 if ((mem->slot >= KVM_USER_MEM_SLOTS) && (change == KVM_MR_DELETE)) {
6945 int ret; 7018 int ret;
6946 7019
6947 ret = vm_munmap(old.userspace_addr, 7020 ret = vm_munmap(old->userspace_addr,
6948 old.npages * PAGE_SIZE); 7021 old->npages * PAGE_SIZE);
6949 if (ret < 0) 7022 if (ret < 0)
6950 printk(KERN_WARNING 7023 printk(KERN_WARNING
6951 "kvm_vm_ioctl_set_memory_region: " 7024 "kvm_vm_ioctl_set_memory_region: "
@@ -6962,14 +7035,14 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
6962 * Existing largepage mappings are destroyed here and new ones will 7035 * Existing largepage mappings are destroyed here and new ones will
6963 * not be created until the end of the logging. 7036 * not be created until the end of the logging.
6964 */ 7037 */
6965 if (npages && (mem->flags & KVM_MEM_LOG_DIRTY_PAGES)) 7038 if ((change != KVM_MR_DELETE) && (mem->flags & KVM_MEM_LOG_DIRTY_PAGES))
6966 kvm_mmu_slot_remove_write_access(kvm, mem->slot); 7039 kvm_mmu_slot_remove_write_access(kvm, mem->slot);
6967 /* 7040 /*
6968 * If memory slot is created, or moved, we need to clear all 7041 * If memory slot is created, or moved, we need to clear all
6969 * mmio sptes. 7042 * mmio sptes.
6970 */ 7043 */
6971 if (npages && old.base_gfn != mem->guest_phys_addr >> PAGE_SHIFT) { 7044 if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) {
6972 kvm_mmu_zap_all(kvm); 7045 kvm_mmu_zap_mmio_sptes(kvm);
6973 kvm_reload_remote_mmus(kvm); 7046 kvm_reload_remote_mmus(kvm);
6974 } 7047 }
6975} 7048}
@@ -6991,7 +7064,7 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
6991 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE && 7064 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE &&
6992 !vcpu->arch.apf.halted) 7065 !vcpu->arch.apf.halted)
6993 || !list_empty_careful(&vcpu->async_pf.done) 7066 || !list_empty_careful(&vcpu->async_pf.done)
6994 || vcpu->arch.mp_state == KVM_MP_STATE_SIPI_RECEIVED 7067 || kvm_apic_has_events(vcpu)
6995 || atomic_read(&vcpu->arch.nmi_queued) || 7068 || atomic_read(&vcpu->arch.nmi_queued) ||
6996 (kvm_arch_interrupt_allowed(vcpu) && 7069 (kvm_arch_interrupt_allowed(vcpu) &&
6997 kvm_cpu_has_interrupt(vcpu)); 7070 kvm_cpu_has_interrupt(vcpu));
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index 29043d2048a0..4a0890f815c4 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -1,7 +1,6 @@
1config LGUEST_GUEST 1config LGUEST_GUEST
2 bool "Lguest guest support" 2 bool "Lguest guest support"
3 select PARAVIRT 3 depends on X86_32 && PARAVIRT
4 depends on X86_32
5 select TTY 4 select TTY
6 select VIRTUALIZATION 5 select VIRTUALIZATION
7 select VIRTIO 6 select VIRTIO
diff --git a/arch/x86/lib/checksum_32.S b/arch/x86/lib/checksum_32.S
index 2af5df3ade7c..e78b8eee6615 100644
--- a/arch/x86/lib/checksum_32.S
+++ b/arch/x86/lib/checksum_32.S
@@ -61,7 +61,7 @@ ENTRY(csum_partial)
61 testl $3, %esi # Check alignment. 61 testl $3, %esi # Check alignment.
62 jz 2f # Jump if alignment is ok. 62 jz 2f # Jump if alignment is ok.
63 testl $1, %esi # Check alignment. 63 testl $1, %esi # Check alignment.
64 jz 10f # Jump if alignment is boundary of 2bytes. 64 jz 10f # Jump if alignment is boundary of 2 bytes.
65 65
66 # buf is odd 66 # buf is odd
67 dec %ecx 67 dec %ecx
diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c
index b908a59eccf5..e78761d6b7f8 100644
--- a/arch/x86/lib/memcpy_32.c
+++ b/arch/x86/lib/memcpy_32.c
@@ -26,7 +26,7 @@ void *memmove(void *dest, const void *src, size_t n)
26 char *ret = dest; 26 char *ret = dest;
27 27
28 __asm__ __volatile__( 28 __asm__ __volatile__(
29 /* Handle more 16bytes in loop */ 29 /* Handle more 16 bytes in loop */
30 "cmp $0x10, %0\n\t" 30 "cmp $0x10, %0\n\t"
31 "jb 1f\n\t" 31 "jb 1f\n\t"
32 32
@@ -51,7 +51,7 @@ void *memmove(void *dest, const void *src, size_t n)
51 "sub $0x10, %0\n\t" 51 "sub $0x10, %0\n\t"
52 52
53 /* 53 /*
54 * We gobble 16byts forward in each loop. 54 * We gobble 16 bytes forward in each loop.
55 */ 55 */
56 "3:\n\t" 56 "3:\n\t"
57 "sub $0x10, %0\n\t" 57 "sub $0x10, %0\n\t"
@@ -117,7 +117,7 @@ void *memmove(void *dest, const void *src, size_t n)
117 "sub $0x10, %0\n\t" 117 "sub $0x10, %0\n\t"
118 118
119 /* 119 /*
120 * We gobble 16byts backward in each loop. 120 * We gobble 16 bytes backward in each loop.
121 */ 121 */
122 "7:\n\t" 122 "7:\n\t"
123 "sub $0x10, %0\n\t" 123 "sub $0x10, %0\n\t"
diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S
index 1c273be7c97e..56313a326188 100644
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@ -98,7 +98,7 @@ ENTRY(memcpy)
98 subq $0x20, %rdx 98 subq $0x20, %rdx
99 /* 99 /*
100 * At most 3 ALU operations in one cycle, 100 * At most 3 ALU operations in one cycle,
101 * so append NOPS in the same 16bytes trunk. 101 * so append NOPS in the same 16 bytes trunk.
102 */ 102 */
103 .p2align 4 103 .p2align 4
104.Lcopy_backward_loop: 104.Lcopy_backward_loop:
diff --git a/arch/x86/lib/memmove_64.S b/arch/x86/lib/memmove_64.S
index ee164610ec46..65268a6104f4 100644
--- a/arch/x86/lib/memmove_64.S
+++ b/arch/x86/lib/memmove_64.S
@@ -27,7 +27,7 @@
27ENTRY(memmove) 27ENTRY(memmove)
28 CFI_STARTPROC 28 CFI_STARTPROC
29 29
30 /* Handle more 32bytes in loop */ 30 /* Handle more 32 bytes in loop */
31 mov %rdi, %rax 31 mov %rdi, %rax
32 cmp $0x20, %rdx 32 cmp $0x20, %rdx
33 jb 1f 33 jb 1f
@@ -56,7 +56,7 @@ ENTRY(memmove)
563: 563:
57 sub $0x20, %rdx 57 sub $0x20, %rdx
58 /* 58 /*
59 * We gobble 32byts forward in each loop. 59 * We gobble 32 bytes forward in each loop.
60 */ 60 */
615: 615:
62 sub $0x20, %rdx 62 sub $0x20, %rdx
@@ -122,7 +122,7 @@ ENTRY(memmove)
122 addq %rdx, %rdi 122 addq %rdx, %rdi
123 subq $0x20, %rdx 123 subq $0x20, %rdx
124 /* 124 /*
125 * We gobble 32byts backward in each loop. 125 * We gobble 32 bytes backward in each loop.
126 */ 126 */
1278: 1278:
128 subq $0x20, %rdx 128 subq $0x20, %rdx
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index f0312d746402..3eb18acd0e40 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -689,9 +689,3 @@ _copy_from_user(void *to, const void __user *from, unsigned long n)
689 return n; 689 return n;
690} 690}
691EXPORT_SYMBOL(_copy_from_user); 691EXPORT_SYMBOL(_copy_from_user);
692
693void copy_from_user_overflow(void)
694{
695 WARN(1, "Buffer overflow detected!\n");
696}
697EXPORT_SYMBOL(copy_from_user_overflow);
diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c
index 5247d01329ca..2ca15b59fb3f 100644
--- a/arch/x86/mm/amdtopology.c
+++ b/arch/x86/mm/amdtopology.c
@@ -130,9 +130,8 @@ int __init amd_numa_init(void)
130 } 130 }
131 131
132 limit >>= 16; 132 limit >>= 16;
133 limit <<= 24;
134 limit |= (1<<24)-1;
135 limit++; 133 limit++;
134 limit <<= 24;
136 135
137 if (limit > end) 136 if (limit > end)
138 limit = end; 137 limit = end;
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 0e883364abb5..654be4ae3047 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -13,12 +13,12 @@
13#include <linux/perf_event.h> /* perf_sw_event */ 13#include <linux/perf_event.h> /* perf_sw_event */
14#include <linux/hugetlb.h> /* hstate_index_to_shift */ 14#include <linux/hugetlb.h> /* hstate_index_to_shift */
15#include <linux/prefetch.h> /* prefetchw */ 15#include <linux/prefetch.h> /* prefetchw */
16#include <linux/context_tracking.h> /* exception_enter(), ... */
16 17
17#include <asm/traps.h> /* dotraplinkage, ... */ 18#include <asm/traps.h> /* dotraplinkage, ... */
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 19#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 20#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/fixmap.h> /* VSYSCALL_START */ 21#include <asm/fixmap.h> /* VSYSCALL_START */
21#include <asm/context_tracking.h> /* exception_enter(), ... */
22 22
23/* 23/*
24 * Page fault error code bits: 24 * Page fault error code bits:
@@ -557,7 +557,7 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
557 /* 557 /*
558 * Pentium F0 0F C7 C8 bug workaround: 558 * Pentium F0 0F C7 C8 bug workaround:
559 */ 559 */
560 if (boot_cpu_data.f00f_bug) { 560 if (boot_cpu_has_bug(X86_BUG_F00F)) {
561 nr = (address - idt_descr.address) >> 3; 561 nr = (address - idt_descr.address) >> 3;
562 562
563 if (nr == 6) { 563 if (nr == 6) {
@@ -1224,7 +1224,9 @@ good_area:
1224dotraplinkage void __kprobes 1224dotraplinkage void __kprobes
1225do_page_fault(struct pt_regs *regs, unsigned long error_code) 1225do_page_fault(struct pt_regs *regs, unsigned long error_code)
1226{ 1226{
1227 exception_enter(regs); 1227 enum ctx_state prev_state;
1228
1229 prev_state = exception_enter();
1228 __do_page_fault(regs, error_code); 1230 __do_page_fault(regs, error_code);
1229 exception_exit(regs); 1231 exception_exit(prev_state);
1230} 1232}
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 6f31ee56c008..252b8f5489ba 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -137,5 +137,4 @@ void __init set_highmem_pages_init(void)
137 add_highpages_with_active_regions(nid, zone_start_pfn, 137 add_highpages_with_active_regions(nid, zone_start_pfn,
138 zone_end_pfn); 138 zone_end_pfn);
139 } 139 }
140 totalram_pages += totalhigh_pages;
141} 140}
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 59b7fc453277..fdc5dca14fb3 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -515,11 +515,8 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
515 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); 515 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
516 516
517 for (; addr < end; addr += PAGE_SIZE) { 517 for (; addr < end; addr += PAGE_SIZE) {
518 ClearPageReserved(virt_to_page(addr));
519 init_page_count(virt_to_page(addr));
520 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); 518 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
521 free_page(addr); 519 free_reserved_page(virt_to_page(addr));
522 totalram_pages++;
523 } 520 }
524#endif 521#endif
525} 522}
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 2d19001151d5..3ac7e319918d 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -427,14 +427,6 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
427 pkmap_page_table = pte; 427 pkmap_page_table = pte;
428} 428}
429 429
430static void __init add_one_highpage_init(struct page *page)
431{
432 ClearPageReserved(page);
433 init_page_count(page);
434 __free_page(page);
435 totalhigh_pages++;
436}
437
438void __init add_highpages_with_active_regions(int nid, 430void __init add_highpages_with_active_regions(int nid,
439 unsigned long start_pfn, unsigned long end_pfn) 431 unsigned long start_pfn, unsigned long end_pfn)
440{ 432{
@@ -448,7 +440,7 @@ void __init add_highpages_with_active_regions(int nid,
448 start_pfn, end_pfn); 440 start_pfn, end_pfn);
449 for ( ; pfn < e_pfn; pfn++) 441 for ( ; pfn < e_pfn; pfn++)
450 if (pfn_valid(pfn)) 442 if (pfn_valid(pfn))
451 add_one_highpage_init(pfn_to_page(pfn)); 443 free_highmem_page(pfn_to_page(pfn));
452 } 444 }
453} 445}
454#else 446#else
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 474e28f10815..bb00c4672ad6 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -32,6 +32,7 @@
32#include <linux/memory_hotplug.h> 32#include <linux/memory_hotplug.h>
33#include <linux/nmi.h> 33#include <linux/nmi.h>
34#include <linux/gfp.h> 34#include <linux/gfp.h>
35#include <linux/kcore.h>
35 36
36#include <asm/processor.h> 37#include <asm/processor.h>
37#include <asm/bios_ebda.h> 38#include <asm/bios_ebda.h>
@@ -1011,14 +1012,12 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct)
1011 flush_tlb_all(); 1012 flush_tlb_all();
1012} 1013}
1013 1014
1014void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages) 1015void __ref vmemmap_free(unsigned long start, unsigned long end)
1015{ 1016{
1016 unsigned long start = (unsigned long)memmap;
1017 unsigned long end = (unsigned long)(memmap + nr_pages);
1018
1019 remove_pagetable(start, end, false); 1017 remove_pagetable(start, end, false);
1020} 1018}
1021 1019
1020#ifdef CONFIG_MEMORY_HOTREMOVE
1022static void __meminit 1021static void __meminit
1023kernel_physical_mapping_remove(unsigned long start, unsigned long end) 1022kernel_physical_mapping_remove(unsigned long start, unsigned long end)
1024{ 1023{
@@ -1028,7 +1027,6 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
1028 remove_pagetable(start, end, true); 1027 remove_pagetable(start, end, true);
1029} 1028}
1030 1029
1031#ifdef CONFIG_MEMORY_HOTREMOVE
1032int __ref arch_remove_memory(u64 start, u64 size) 1030int __ref arch_remove_memory(u64 start, u64 size)
1033{ 1031{
1034 unsigned long start_pfn = start >> PAGE_SHIFT; 1032 unsigned long start_pfn = start >> PAGE_SHIFT;
@@ -1067,10 +1065,9 @@ void __init mem_init(void)
1067 1065
1068 /* clear_bss() already clear the empty_zero_page */ 1066 /* clear_bss() already clear the empty_zero_page */
1069 1067
1070 reservedpages = 0;
1071
1072 /* this will put all low memory onto the freelists */
1073 register_page_bootmem_info(); 1068 register_page_bootmem_info();
1069
1070 /* this will put all memory onto the freelists */
1074 totalram_pages = free_all_bootmem(); 1071 totalram_pages = free_all_bootmem();
1075 1072
1076 absent_pages = absent_pages_in_range(0, max_pfn); 1073 absent_pages = absent_pages_in_range(0, max_pfn);
@@ -1285,18 +1282,17 @@ static long __meminitdata addr_start, addr_end;
1285static void __meminitdata *p_start, *p_end; 1282static void __meminitdata *p_start, *p_end;
1286static int __meminitdata node_start; 1283static int __meminitdata node_start;
1287 1284
1288int __meminit 1285static int __meminit vmemmap_populate_hugepages(unsigned long start,
1289vmemmap_populate(struct page *start_page, unsigned long size, int node) 1286 unsigned long end, int node)
1290{ 1287{
1291 unsigned long addr = (unsigned long)start_page; 1288 unsigned long addr;
1292 unsigned long end = (unsigned long)(start_page + size);
1293 unsigned long next; 1289 unsigned long next;
1294 pgd_t *pgd; 1290 pgd_t *pgd;
1295 pud_t *pud; 1291 pud_t *pud;
1296 pmd_t *pmd; 1292 pmd_t *pmd;
1297 1293
1298 for (; addr < end; addr = next) { 1294 for (addr = start; addr < end; addr = next) {
1299 void *p = NULL; 1295 next = pmd_addr_end(addr, end);
1300 1296
1301 pgd = vmemmap_pgd_populate(addr, node); 1297 pgd = vmemmap_pgd_populate(addr, node);
1302 if (!pgd) 1298 if (!pgd)
@@ -1306,31 +1302,14 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
1306 if (!pud) 1302 if (!pud)
1307 return -ENOMEM; 1303 return -ENOMEM;
1308 1304
1309 if (!cpu_has_pse) { 1305 pmd = pmd_offset(pud, addr);
1310 next = (addr + PAGE_SIZE) & PAGE_MASK; 1306 if (pmd_none(*pmd)) {
1311 pmd = vmemmap_pmd_populate(pud, addr, node); 1307 void *p;
1312
1313 if (!pmd)
1314 return -ENOMEM;
1315
1316 p = vmemmap_pte_populate(pmd, addr, node);
1317 1308
1318 if (!p) 1309 p = vmemmap_alloc_block_buf(PMD_SIZE, node);
1319 return -ENOMEM; 1310 if (p) {
1320
1321 addr_end = addr + PAGE_SIZE;
1322 p_end = p + PAGE_SIZE;
1323 } else {
1324 next = pmd_addr_end(addr, end);
1325
1326 pmd = pmd_offset(pud, addr);
1327 if (pmd_none(*pmd)) {
1328 pte_t entry; 1311 pte_t entry;
1329 1312
1330 p = vmemmap_alloc_block_buf(PMD_SIZE, node);
1331 if (!p)
1332 return -ENOMEM;
1333
1334 entry = pfn_pte(__pa(p) >> PAGE_SHIFT, 1313 entry = pfn_pte(__pa(p) >> PAGE_SHIFT,
1335 PAGE_KERNEL_LARGE); 1314 PAGE_KERNEL_LARGE);
1336 set_pmd(pmd, __pmd(pte_val(entry))); 1315 set_pmd(pmd, __pmd(pte_val(entry)));
@@ -1347,15 +1326,32 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
1347 1326
1348 addr_end = addr + PMD_SIZE; 1327 addr_end = addr + PMD_SIZE;
1349 p_end = p + PMD_SIZE; 1328 p_end = p + PMD_SIZE;
1350 } else 1329 continue;
1351 vmemmap_verify((pte_t *)pmd, node, addr, next); 1330 }
1331 } else if (pmd_large(*pmd)) {
1332 vmemmap_verify((pte_t *)pmd, node, addr, next);
1333 continue;
1352 } 1334 }
1353 1335 pr_warn_once("vmemmap: falling back to regular page backing\n");
1336 if (vmemmap_populate_basepages(addr, next, node))
1337 return -ENOMEM;
1354 } 1338 }
1355 sync_global_pgds((unsigned long)start_page, end - 1);
1356 return 0; 1339 return 0;
1357} 1340}
1358 1341
1342int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
1343{
1344 int err;
1345
1346 if (cpu_has_pse)
1347 err = vmemmap_populate_hugepages(start, end, node);
1348 else
1349 err = vmemmap_populate_basepages(start, end, node);
1350 if (!err)
1351 sync_global_pgds(start, end - 1);
1352 return err;
1353}
1354
1359#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE) 1355#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
1360void register_page_bootmem_memmap(unsigned long section_nr, 1356void register_page_bootmem_memmap(unsigned long section_nr,
1361 struct page *start_page, unsigned long size) 1357 struct page *start_page, unsigned long size)
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 78fe3f1ac49f..9a1e6583910c 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -282,12 +282,7 @@ void iounmap(volatile void __iomem *addr)
282 in parallel. Reuse of the virtual address is prevented by 282 in parallel. Reuse of the virtual address is prevented by
283 leaving it in the global lists until we're done with it. 283 leaving it in the global lists until we're done with it.
284 cpa takes care of the direct mappings. */ 284 cpa takes care of the direct mappings. */
285 read_lock(&vmlist_lock); 285 p = find_vm_area((void __force *)addr);
286 for (p = vmlist; p; p = p->next) {
287 if (p->addr == (void __force *)addr)
288 break;
289 }
290 read_unlock(&vmlist_lock);
291 286
292 if (!p) { 287 if (!p) {
293 printk(KERN_ERR "iounmap: bad address %p\n", addr); 288 printk(KERN_ERR "iounmap: bad address %p\n", addr);
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 72fe01e9e414..a71c4e207679 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -114,14 +114,11 @@ void numa_clear_node(int cpu)
114 */ 114 */
115void __init setup_node_to_cpumask_map(void) 115void __init setup_node_to_cpumask_map(void)
116{ 116{
117 unsigned int node, num = 0; 117 unsigned int node;
118 118
119 /* setup nr_node_ids if not done yet */ 119 /* setup nr_node_ids if not done yet */
120 if (nr_node_ids == MAX_NUMNODES) { 120 if (nr_node_ids == MAX_NUMNODES)
121 for_each_node_mask(node, node_possible_map) 121 setup_nr_node_ids();
122 num = node;
123 nr_node_ids = num + 1;
124 }
125 122
126 /* allocate the map */ 123 /* allocate the map */
127 for (node = 0; node < nr_node_ids; node++) 124 for (node = 0; node < nr_node_ids; node++)
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 0e38951e65eb..d0b1773d9d2e 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -130,13 +130,12 @@ static int pageattr_test(void)
130 } 130 }
131 131
132 failed += print_split(&sa); 132 failed += print_split(&sa);
133 srandom32(100);
134 133
135 for (i = 0; i < NTEST; i++) { 134 for (i = 0; i < NTEST; i++) {
136 unsigned long pfn = random32() % max_pfn_mapped; 135 unsigned long pfn = prandom_u32() % max_pfn_mapped;
137 136
138 addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT); 137 addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT);
139 len[i] = random32() % 100; 138 len[i] = prandom_u32() % 100;
140 len[i] = min_t(unsigned long, len[i], max_pfn_mapped - pfn - 1); 139 len[i] = min_t(unsigned long, len[i], max_pfn_mapped - pfn - 1);
141 140
142 if (len[i] == 0) 141 if (len[i] == 0)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index fb4e73ec24d8..bb32480c2d71 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -542,13 +542,14 @@ out_unlock:
542 return do_split; 542 return do_split;
543} 543}
544 544
545int __split_large_page(pte_t *kpte, unsigned long address, pte_t *pbase) 545static int
546__split_large_page(pte_t *kpte, unsigned long address, struct page *base)
546{ 547{
548 pte_t *pbase = (pte_t *)page_address(base);
547 unsigned long pfn, pfninc = 1; 549 unsigned long pfn, pfninc = 1;
548 unsigned int i, level; 550 unsigned int i, level;
549 pte_t *tmp; 551 pte_t *tmp;
550 pgprot_t ref_prot; 552 pgprot_t ref_prot;
551 struct page *base = virt_to_page(pbase);
552 553
553 spin_lock(&pgd_lock); 554 spin_lock(&pgd_lock);
554 /* 555 /*
@@ -633,7 +634,6 @@ int __split_large_page(pte_t *kpte, unsigned long address, pte_t *pbase)
633 634
634static int split_large_page(pte_t *kpte, unsigned long address) 635static int split_large_page(pte_t *kpte, unsigned long address)
635{ 636{
636 pte_t *pbase;
637 struct page *base; 637 struct page *base;
638 638
639 if (!debug_pagealloc) 639 if (!debug_pagealloc)
@@ -644,8 +644,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
644 if (!base) 644 if (!base)
645 return -ENOMEM; 645 return -ENOMEM;
646 646
647 pbase = (pte_t *)page_address(base); 647 if (__split_large_page(kpte, address, base))
648 if (__split_large_page(kpte, address, pbase))
649 __free_page(base); 648 __free_page(base);
650 649
651 return 0; 650 return 0;
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 901177d75ff5..305c68b8d538 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/pci-acpi.h>
9#include <linux/ioport.h> 10#include <linux/ioport.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/dmi.h> 12#include <linux/dmi.h>
@@ -170,6 +171,16 @@ void pcibios_fixup_bus(struct pci_bus *b)
170 pcibios_fixup_device_resources(dev); 171 pcibios_fixup_device_resources(dev);
171} 172}
172 173
174void pcibios_add_bus(struct pci_bus *bus)
175{
176 acpi_pci_add_bus(bus);
177}
178
179void pcibios_remove_bus(struct pci_bus *bus)
180{
181 acpi_pci_remove_bus(bus);
182}
183
173/* 184/*
174 * Only use DMI information to set this if nothing was passed 185 * Only use DMI information to set this if nothing was passed
175 * on the kernel command line (which was parsed earlier). 186 * on the kernel command line (which was parsed earlier).
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 94e76620460f..4a9be6ddf054 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -177,7 +177,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
177 goto error; 177 goto error;
178 i = 0; 178 i = 0;
179 list_for_each_entry(msidesc, &dev->msi_list, list) { 179 list_for_each_entry(msidesc, &dev->msi_list, list) {
180 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i], 0, 180 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i],
181 (type == PCI_CAP_ID_MSIX) ? 181 (type == PCI_CAP_ID_MSIX) ?
182 "pcifront-msi-x" : 182 "pcifront-msi-x" :
183 "pcifront-msi", 183 "pcifront-msi",
@@ -244,7 +244,7 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
244 dev_dbg(&dev->dev, 244 dev_dbg(&dev->dev,
245 "xen: msi already bound to pirq=%d\n", pirq); 245 "xen: msi already bound to pirq=%d\n", pirq);
246 } 246 }
247 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq, 0, 247 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq,
248 (type == PCI_CAP_ID_MSIX) ? 248 (type == PCI_CAP_ID_MSIX) ?
249 "msi-x" : "msi", 249 "msi-x" : "msi",
250 DOMID_SELF); 250 DOMID_SELF);
@@ -326,7 +326,7 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
326 } 326 }
327 327
328 ret = xen_bind_pirq_msi_to_irq(dev, msidesc, 328 ret = xen_bind_pirq_msi_to_irq(dev, msidesc,
329 map_irq.pirq, map_irq.index, 329 map_irq.pirq,
330 (type == PCI_CAP_ID_MSIX) ? 330 (type == PCI_CAP_ID_MSIX) ?
331 "msi-x" : "msi", 331 "msi-x" : "msi",
332 domid); 332 domid);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index e4a86a677ce1..55856b2310d3 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -34,6 +34,7 @@
34#include <linux/efi-bgrt.h> 34#include <linux/efi-bgrt.h>
35#include <linux/export.h> 35#include <linux/export.h>
36#include <linux/bootmem.h> 36#include <linux/bootmem.h>
37#include <linux/slab.h>
37#include <linux/memblock.h> 38#include <linux/memblock.h>
38#include <linux/spinlock.h> 39#include <linux/spinlock.h>
39#include <linux/uaccess.h> 40#include <linux/uaccess.h>
@@ -49,6 +50,7 @@
49#include <asm/cacheflush.h> 50#include <asm/cacheflush.h>
50#include <asm/tlbflush.h> 51#include <asm/tlbflush.h>
51#include <asm/x86_init.h> 52#include <asm/x86_init.h>
53#include <asm/rtc.h>
52 54
53#define EFI_DEBUG 1 55#define EFI_DEBUG 1
54 56
@@ -352,10 +354,10 @@ static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
352 354
353int efi_set_rtc_mmss(unsigned long nowtime) 355int efi_set_rtc_mmss(unsigned long nowtime)
354{ 356{
355 int real_seconds, real_minutes;
356 efi_status_t status; 357 efi_status_t status;
357 efi_time_t eft; 358 efi_time_t eft;
358 efi_time_cap_t cap; 359 efi_time_cap_t cap;
360 struct rtc_time tm;
359 361
360 status = efi.get_time(&eft, &cap); 362 status = efi.get_time(&eft, &cap);
361 if (status != EFI_SUCCESS) { 363 if (status != EFI_SUCCESS) {
@@ -363,13 +365,20 @@ int efi_set_rtc_mmss(unsigned long nowtime)
363 return -1; 365 return -1;
364 } 366 }
365 367
366 real_seconds = nowtime % 60; 368 rtc_time_to_tm(nowtime, &tm);
367 real_minutes = nowtime / 60; 369 if (!rtc_valid_tm(&tm)) {
368 if (((abs(real_minutes - eft.minute) + 15)/30) & 1) 370 eft.year = tm.tm_year + 1900;
369 real_minutes += 30; 371 eft.month = tm.tm_mon + 1;
370 real_minutes %= 60; 372 eft.day = tm.tm_mday;
371 eft.minute = real_minutes; 373 eft.minute = tm.tm_min;
372 eft.second = real_seconds; 374 eft.second = tm.tm_sec;
375 eft.nanosecond = 0;
376 } else {
377 printk(KERN_ERR
378 "%s: Invalid EFI RTC value: write of %lx to EFI RTC failed\n",
379 __FUNCTION__, nowtime);
380 return -1;
381 }
373 382
374 status = efi.set_time(&eft); 383 status = efi.set_time(&eft);
375 if (status != EFI_SUCCESS) { 384 if (status != EFI_SUCCESS) {
@@ -445,24 +454,25 @@ static void __init do_add_efi_memmap(void)
445 454
446int __init efi_memblock_x86_reserve_range(void) 455int __init efi_memblock_x86_reserve_range(void)
447{ 456{
457 struct efi_info *e = &boot_params.efi_info;
448 unsigned long pmap; 458 unsigned long pmap;
449 459
450#ifdef CONFIG_X86_32 460#ifdef CONFIG_X86_32
451 /* Can't handle data above 4GB at this time */ 461 /* Can't handle data above 4GB at this time */
452 if (boot_params.efi_info.efi_memmap_hi) { 462 if (e->efi_memmap_hi) {
453 pr_err("Memory map is above 4GB, disabling EFI.\n"); 463 pr_err("Memory map is above 4GB, disabling EFI.\n");
454 return -EINVAL; 464 return -EINVAL;
455 } 465 }
456 pmap = boot_params.efi_info.efi_memmap; 466 pmap = e->efi_memmap;
457#else 467#else
458 pmap = (boot_params.efi_info.efi_memmap | 468 pmap = (e->efi_memmap | ((__u64)e->efi_memmap_hi << 32));
459 ((__u64)boot_params.efi_info.efi_memmap_hi<<32));
460#endif 469#endif
461 memmap.phys_map = (void *)pmap; 470 memmap.phys_map = (void *)pmap;
462 memmap.nr_map = boot_params.efi_info.efi_memmap_size / 471 memmap.nr_map = e->efi_memmap_size /
463 boot_params.efi_info.efi_memdesc_size; 472 e->efi_memdesc_size;
464 memmap.desc_version = boot_params.efi_info.efi_memdesc_version; 473 memmap.desc_size = e->efi_memdesc_size;
465 memmap.desc_size = boot_params.efi_info.efi_memdesc_size; 474 memmap.desc_version = e->efi_memdesc_version;
475
466 memblock_reserve(pmap, memmap.nr_map * memmap.desc_size); 476 memblock_reserve(pmap, memmap.nr_map * memmap.desc_size);
467 477
468 return 0; 478 return 0;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 2b2003860615..39a0e7f1f0a3 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -27,6 +27,7 @@
27#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/reboot.h> 29#include <linux/reboot.h>
30#include <linux/slab.h>
30 31
31#include <asm/setup.h> 32#include <asm/setup.h>
32#include <asm/page.h> 33#include <asm/page.h>
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index e31bcd8f2eee..a0a0a4389bbd 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -356,8 +356,7 @@ static int __init sfi_parse_gpio(struct sfi_table_header *table)
356 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry); 356 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry);
357 pentry = (struct sfi_gpio_table_entry *)sb->pentry; 357 pentry = (struct sfi_gpio_table_entry *)sb->pentry;
358 358
359 gpio_table = (struct sfi_gpio_table_entry *) 359 gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
360 kmalloc(num * sizeof(*pentry), GFP_KERNEL);
361 if (!gpio_table) 360 if (!gpio_table)
362 return -1; 361 return -1;
363 memcpy(gpio_table, pentry, num * sizeof(*pentry)); 362 memcpy(gpio_table, pentry, num * sizeof(*pentry));
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c
index 225bd0f0f675..d62b0a3b5c14 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/mrst/vrtc.c
@@ -85,27 +85,35 @@ unsigned long vrtc_get_time(void)
85 return mktime(year, mon, mday, hour, min, sec); 85 return mktime(year, mon, mday, hour, min, sec);
86} 86}
87 87
88/* Only care about the minutes and seconds */
89int vrtc_set_mmss(unsigned long nowtime) 88int vrtc_set_mmss(unsigned long nowtime)
90{ 89{
91 int real_sec, real_min;
92 unsigned long flags; 90 unsigned long flags;
93 int vrtc_min; 91 struct rtc_time tm;
94 92 int year;
95 spin_lock_irqsave(&rtc_lock, flags); 93 int retval = 0;
96 vrtc_min = vrtc_cmos_read(RTC_MINUTES); 94
97 95 rtc_time_to_tm(nowtime, &tm);
98 real_sec = nowtime % 60; 96 if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) {
99 real_min = nowtime / 60; 97 /*
100 if (((abs(real_min - vrtc_min) + 15)/30) & 1) 98 * tm.year is the number of years since 1900, and the
101 real_min += 30; 99 * vrtc need the years since 1972.
102 real_min %= 60; 100 */
103 101 year = tm.tm_year - 72;
104 vrtc_cmos_write(real_sec, RTC_SECONDS); 102 spin_lock_irqsave(&rtc_lock, flags);
105 vrtc_cmos_write(real_min, RTC_MINUTES); 103 vrtc_cmos_write(year, RTC_YEAR);
106 spin_unlock_irqrestore(&rtc_lock, flags); 104 vrtc_cmos_write(tm.tm_mon, RTC_MONTH);
107 105 vrtc_cmos_write(tm.tm_mday, RTC_DAY_OF_MONTH);
108 return 0; 106 vrtc_cmos_write(tm.tm_hour, RTC_HOURS);
107 vrtc_cmos_write(tm.tm_min, RTC_MINUTES);
108 vrtc_cmos_write(tm.tm_sec, RTC_SECONDS);
109 spin_unlock_irqrestore(&rtc_lock, flags);
110 } else {
111 printk(KERN_ERR
112 "%s: Invalid vRTC value: write of %lx to vRTC failed\n",
113 __FUNCTION__, nowtime);
114 retval = -EINVAL;
115 }
116 return retval;
109} 117}
110 118
111void __init mrst_rtc_init(void) 119void __init mrst_rtc_init(void)
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 74704be7b1fe..9a2e590dd202 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -460,7 +460,6 @@ static int setup_power_button(struct platform_device *pdev)
460static void free_power_button(void) 460static void free_power_button(void)
461{ 461{
462 input_unregister_device(power_button_idev); 462 input_unregister_device(power_button_idev);
463 input_free_device(power_button_idev);
464} 463}
465 464
466static int setup_ebook_switch(struct platform_device *pdev) 465static int setup_ebook_switch(struct platform_device *pdev)
@@ -491,7 +490,6 @@ static int setup_ebook_switch(struct platform_device *pdev)
491static void free_ebook_switch(void) 490static void free_ebook_switch(void)
492{ 491{
493 input_unregister_device(ebook_switch_idev); 492 input_unregister_device(ebook_switch_idev);
494 input_free_device(ebook_switch_idev);
495} 493}
496 494
497static int setup_lid_switch(struct platform_device *pdev) 495static int setup_lid_switch(struct platform_device *pdev)
@@ -526,6 +524,7 @@ static int setup_lid_switch(struct platform_device *pdev)
526 524
527err_create_attr: 525err_create_attr:
528 input_unregister_device(lid_switch_idev); 526 input_unregister_device(lid_switch_idev);
527 lid_switch_idev = NULL;
529err_register: 528err_register:
530 input_free_device(lid_switch_idev); 529 input_free_device(lid_switch_idev);
531 return r; 530 return r;
@@ -535,7 +534,6 @@ static void free_lid_switch(void)
535{ 534{
536 device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode); 535 device_remove_file(&lid_switch_idev->dev, &dev_attr_lid_wake_mode);
537 input_unregister_device(lid_switch_idev); 536 input_unregister_device(lid_switch_idev);
538 input_free_device(lid_switch_idev);
539} 537}
540 538
541static int xo1_sci_probe(struct platform_device *pdev) 539static int xo1_sci_probe(struct platform_device *pdev)
diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c
index 98718f604eb6..5c86786bbfd2 100644
--- a/arch/x86/platform/uv/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
@@ -159,10 +159,9 @@ static __init int uv_rtc_allocate_timers(void)
159{ 159{
160 int cpu; 160 int cpu;
161 161
162 blade_info = kmalloc(uv_possible_blades * sizeof(void *), GFP_KERNEL); 162 blade_info = kzalloc(uv_possible_blades * sizeof(void *), GFP_KERNEL);
163 if (!blade_info) 163 if (!blade_info)
164 return -ENOMEM; 164 return -ENOMEM;
165 memset(blade_info, 0, uv_possible_blades * sizeof(void *));
166 165
167 for_each_present_cpu(cpu) { 166 for_each_present_cpu(cpu) {
168 int nid = cpu_to_node(cpu); 167 int nid = cpu_to_node(cpu);
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
index 3c68768d7a75..1cf5b300305e 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -25,16 +25,12 @@
25#include <asm/cpu.h> 25#include <asm/cpu.h>
26 26
27#ifdef CONFIG_X86_32 27#ifdef CONFIG_X86_32
28static struct saved_context saved_context;
29
30unsigned long saved_context_ebx; 28unsigned long saved_context_ebx;
31unsigned long saved_context_esp, saved_context_ebp; 29unsigned long saved_context_esp, saved_context_ebp;
32unsigned long saved_context_esi, saved_context_edi; 30unsigned long saved_context_esi, saved_context_edi;
33unsigned long saved_context_eflags; 31unsigned long saved_context_eflags;
34#else
35/* CONFIG_X86_64 */
36struct saved_context saved_context;
37#endif 32#endif
33struct saved_context saved_context;
38 34
39/** 35/**
40 * __save_processor_state - save CPU registers before creating a 36 * __save_processor_state - save CPU registers before creating a
@@ -62,13 +58,20 @@ static void __save_processor_state(struct saved_context *ctxt)
62 * descriptor tables 58 * descriptor tables
63 */ 59 */
64#ifdef CONFIG_X86_32 60#ifdef CONFIG_X86_32
65 store_gdt(&ctxt->gdt);
66 store_idt(&ctxt->idt); 61 store_idt(&ctxt->idt);
67#else 62#else
68/* CONFIG_X86_64 */ 63/* CONFIG_X86_64 */
69 store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
70 store_idt((struct desc_ptr *)&ctxt->idt_limit); 64 store_idt((struct desc_ptr *)&ctxt->idt_limit);
71#endif 65#endif
66 /*
67 * We save it here, but restore it only in the hibernate case.
68 * For ACPI S3 resume, this is loaded via 'early_gdt_desc' in 64-bit
69 * mode in "secondary_startup_64". In 32-bit mode it is done via
70 * 'pmode_gdt' in wakeup_start.
71 */
72 ctxt->gdt_desc.size = GDT_SIZE - 1;
73 ctxt->gdt_desc.address = (unsigned long)get_cpu_gdt_table(smp_processor_id());
74
72 store_tr(ctxt->tr); 75 store_tr(ctxt->tr);
73 76
74 /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */ 77 /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */
@@ -135,7 +138,10 @@ static void fix_processor_context(void)
135{ 138{
136 int cpu = smp_processor_id(); 139 int cpu = smp_processor_id();
137 struct tss_struct *t = &per_cpu(init_tss, cpu); 140 struct tss_struct *t = &per_cpu(init_tss, cpu);
138 141#ifdef CONFIG_X86_64
142 struct desc_struct *desc = get_cpu_gdt_table(cpu);
143 tss_desc tss;
144#endif
139 set_tss_desc(cpu, t); /* 145 set_tss_desc(cpu, t); /*
140 * This just modifies memory; should not be 146 * This just modifies memory; should not be
141 * necessary. But... This is necessary, because 147 * necessary. But... This is necessary, because
@@ -144,7 +150,9 @@ static void fix_processor_context(void)
144 */ 150 */
145 151
146#ifdef CONFIG_X86_64 152#ifdef CONFIG_X86_64
147 get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9; 153 memcpy(&tss, &desc[GDT_ENTRY_TSS], sizeof(tss_desc));
154 tss.type = 0x9; /* The available 64-bit TSS (see AMD vol 2, pg 91 */
155 write_gdt_entry(desc, GDT_ENTRY_TSS, &tss, DESC_TSS);
148 156
149 syscall_init(); /* This sets MSR_*STAR and related */ 157 syscall_init(); /* This sets MSR_*STAR and related */
150#endif 158#endif
@@ -183,11 +191,9 @@ static void __restore_processor_state(struct saved_context *ctxt)
183 * ltr is done i fix_processor_context(). 191 * ltr is done i fix_processor_context().
184 */ 192 */
185#ifdef CONFIG_X86_32 193#ifdef CONFIG_X86_32
186 load_gdt(&ctxt->gdt);
187 load_idt(&ctxt->idt); 194 load_idt(&ctxt->idt);
188#else 195#else
189/* CONFIG_X86_64 */ 196/* CONFIG_X86_64 */
190 load_gdt((const struct desc_ptr *)&ctxt->gdt_limit);
191 load_idt((const struct desc_ptr *)&ctxt->idt_limit); 197 load_idt((const struct desc_ptr *)&ctxt->idt_limit);
192#endif 198#endif
193 199
diff --git a/arch/x86/power/hibernate_asm_32.S b/arch/x86/power/hibernate_asm_32.S
index ad47daeafa4e..1d0fa0e24070 100644
--- a/arch/x86/power/hibernate_asm_32.S
+++ b/arch/x86/power/hibernate_asm_32.S
@@ -75,6 +75,10 @@ done:
75 pushl saved_context_eflags 75 pushl saved_context_eflags
76 popfl 76 popfl
77 77
78 /* Saved in save_processor_state. */
79 movl $saved_context, %eax
80 lgdt saved_context_gdt_desc(%eax)
81
78 xorl %eax, %eax 82 xorl %eax, %eax
79 83
80 ret 84 ret
diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S
index 9356547d8c01..3c4469a7a929 100644
--- a/arch/x86/power/hibernate_asm_64.S
+++ b/arch/x86/power/hibernate_asm_64.S
@@ -139,6 +139,9 @@ ENTRY(restore_registers)
139 pushq pt_regs_flags(%rax) 139 pushq pt_regs_flags(%rax)
140 popfq 140 popfq
141 141
142 /* Saved in save_processor_state. */
143 lgdt saved_context_gdt_desc(%rax)
144
142 xorq %rax, %rax 145 xorq %rax, %rax
143 146
144 /* tell the hibernation core that we've just restored the memory */ 147 /* tell the hibernation core that we've just restored the memory */
diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl
index e6d55f0064df..d0d59bfbccce 100644
--- a/arch/x86/syscalls/syscall_32.tbl
+++ b/arch/x86/syscalls/syscall_32.tbl
@@ -43,7 +43,7 @@
4334 i386 nice sys_nice 4334 i386 nice sys_nice
4435 i386 ftime 4435 i386 ftime
4536 i386 sync sys_sync 4536 i386 sync sys_sync
4637 i386 kill sys_kill sys32_kill 4637 i386 kill sys_kill
4738 i386 rename sys_rename 4738 i386 rename sys_rename
4839 i386 mkdir sys_mkdir 4839 i386 mkdir sys_mkdir
4940 i386 rmdir sys_rmdir 4940 i386 rmdir sys_rmdir
@@ -123,7 +123,7 @@
123114 i386 wait4 sys_wait4 compat_sys_wait4 123114 i386 wait4 sys_wait4 compat_sys_wait4
124115 i386 swapoff sys_swapoff 124115 i386 swapoff sys_swapoff
125116 i386 sysinfo sys_sysinfo compat_sys_sysinfo 125116 i386 sysinfo sys_sysinfo compat_sys_sysinfo
126117 i386 ipc sys_ipc sys32_ipc 126117 i386 ipc sys_ipc compat_sys_ipc
127118 i386 fsync sys_fsync 127118 i386 fsync sys_fsync
128119 i386 sigreturn sys_sigreturn stub32_sigreturn 128119 i386 sigreturn sys_sigreturn stub32_sigreturn
129120 i386 clone sys_clone stub32_clone 129120 i386 clone sys_clone stub32_clone
@@ -131,7 +131,7 @@
131122 i386 uname sys_newuname 131122 i386 uname sys_newuname
132123 i386 modify_ldt sys_modify_ldt 132123 i386 modify_ldt sys_modify_ldt
133124 i386 adjtimex sys_adjtimex compat_sys_adjtimex 133124 i386 adjtimex sys_adjtimex compat_sys_adjtimex
134125 i386 mprotect sys_mprotect sys32_mprotect 134125 i386 mprotect sys_mprotect
135126 i386 sigprocmask sys_sigprocmask compat_sys_sigprocmask 135126 i386 sigprocmask sys_sigprocmask compat_sys_sigprocmask
136127 i386 create_module 136127 i386 create_module
137128 i386 init_module sys_init_module 137128 i386 init_module sys_init_module
@@ -193,7 +193,7 @@
193184 i386 capget sys_capget 193184 i386 capget sys_capget
194185 i386 capset sys_capset 194185 i386 capset sys_capset
195186 i386 sigaltstack sys_sigaltstack compat_sys_sigaltstack 195186 i386 sigaltstack sys_sigaltstack compat_sys_sigaltstack
196187 i386 sendfile sys_sendfile sys32_sendfile 196187 i386 sendfile sys_sendfile compat_sys_sendfile
197188 i386 getpmsg 197188 i386 getpmsg
198189 i386 putpmsg 198189 i386 putpmsg
199190 i386 vfork sys_vfork stub32_vfork 199190 i386 vfork sys_vfork stub32_vfork
@@ -259,7 +259,7 @@
259250 i386 fadvise64 sys_fadvise64 sys32_fadvise64 259250 i386 fadvise64 sys_fadvise64 sys32_fadvise64
260# 251 is available for reuse (was briefly sys_set_zone_reclaim) 260# 251 is available for reuse (was briefly sys_set_zone_reclaim)
261252 i386 exit_group sys_exit_group 261252 i386 exit_group sys_exit_group
262253 i386 lookup_dcookie sys_lookup_dcookie sys32_lookup_dcookie 262253 i386 lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie
263254 i386 epoll_create sys_epoll_create 263254 i386 epoll_create sys_epoll_create
264255 i386 epoll_ctl sys_epoll_ctl 264255 i386 epoll_ctl sys_epoll_ctl
265256 i386 epoll_wait sys_epoll_wait 265256 i386 epoll_wait sys_epoll_wait
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index bae601f900ef..e8120346903b 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -39,4 +39,5 @@ $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/ina
39 39
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include 40HOST_EXTRACFLAGS += -I$(srctree)/tools/include
41hostprogs-y += relocs 41hostprogs-y += relocs
42relocs-objs := relocs_32.o relocs_64.o relocs_common.o
42relocs: $(obj)/relocs 43relocs: $(obj)/relocs
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 79d67bd507fa..590be1090892 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -1,43 +1,36 @@
1#include <stdio.h> 1/* This is included from relocs_32/64.c */
2#include <stdarg.h> 2
3#include <stdlib.h> 3#define ElfW(type) _ElfW(ELF_BITS, type)
4#include <stdint.h> 4#define _ElfW(bits, type) __ElfW(bits, type)
5#include <string.h> 5#define __ElfW(bits, type) Elf##bits##_##type
6#include <errno.h> 6
7#include <unistd.h> 7#define Elf_Addr ElfW(Addr)
8#include <elf.h> 8#define Elf_Ehdr ElfW(Ehdr)
9#include <byteswap.h> 9#define Elf_Phdr ElfW(Phdr)
10#define USE_BSD 10#define Elf_Shdr ElfW(Shdr)
11#include <endian.h> 11#define Elf_Sym ElfW(Sym)
12#include <regex.h> 12
13#include <tools/le_byteshift.h> 13static Elf_Ehdr ehdr;
14 14
15static void die(char *fmt, ...); 15struct relocs {
16 16 uint32_t *offset;
17#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 17 unsigned long count;
18static Elf32_Ehdr ehdr; 18 unsigned long size;
19static unsigned long reloc_count, reloc_idx; 19};
20static unsigned long *relocs; 20
21static unsigned long reloc16_count, reloc16_idx; 21static struct relocs relocs16;
22static unsigned long *relocs16; 22static struct relocs relocs32;
23static struct relocs relocs64;
23 24
24struct section { 25struct section {
25 Elf32_Shdr shdr; 26 Elf_Shdr shdr;
26 struct section *link; 27 struct section *link;
27 Elf32_Sym *symtab; 28 Elf_Sym *symtab;
28 Elf32_Rel *reltab; 29 Elf_Rel *reltab;
29 char *strtab; 30 char *strtab;
30}; 31};
31static struct section *secs; 32static struct section *secs;
32 33
33enum symtype {
34 S_ABS,
35 S_REL,
36 S_SEG,
37 S_LIN,
38 S_NSYMTYPES
39};
40
41static const char * const sym_regex_kernel[S_NSYMTYPES] = { 34static const char * const sym_regex_kernel[S_NSYMTYPES] = {
42/* 35/*
43 * Following symbols have been audited. There values are constant and do 36 * Following symbols have been audited. There values are constant and do
@@ -49,6 +42,9 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
49 "^(xen_irq_disable_direct_reloc$|" 42 "^(xen_irq_disable_direct_reloc$|"
50 "xen_save_fl_direct_reloc$|" 43 "xen_save_fl_direct_reloc$|"
51 "VDSO|" 44 "VDSO|"
45#if ELF_BITS == 64
46 "__vvar_page|"
47#endif
52 "__crc_)", 48 "__crc_)",
53 49
54/* 50/*
@@ -72,6 +68,11 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
72 "__end_rodata|" 68 "__end_rodata|"
73 "__initramfs_start|" 69 "__initramfs_start|"
74 "(jiffies|jiffies_64)|" 70 "(jiffies|jiffies_64)|"
71#if ELF_BITS == 64
72 "__per_cpu_load|"
73 "init_per_cpu__.*|"
74 "__end_rodata_hpage_align|"
75#endif
75 "_end)$" 76 "_end)$"
76}; 77};
77 78
@@ -132,15 +133,6 @@ static void regex_init(int use_real_mode)
132 } 133 }
133} 134}
134 135
135static void die(char *fmt, ...)
136{
137 va_list ap;
138 va_start(ap, fmt);
139 vfprintf(stderr, fmt, ap);
140 va_end(ap);
141 exit(1);
142}
143
144static const char *sym_type(unsigned type) 136static const char *sym_type(unsigned type)
145{ 137{
146 static const char *type_name[] = { 138 static const char *type_name[] = {
@@ -198,6 +190,24 @@ static const char *rel_type(unsigned type)
198{ 190{
199 static const char *type_name[] = { 191 static const char *type_name[] = {
200#define REL_TYPE(X) [X] = #X 192#define REL_TYPE(X) [X] = #X
193#if ELF_BITS == 64
194 REL_TYPE(R_X86_64_NONE),
195 REL_TYPE(R_X86_64_64),
196 REL_TYPE(R_X86_64_PC32),
197 REL_TYPE(R_X86_64_GOT32),
198 REL_TYPE(R_X86_64_PLT32),
199 REL_TYPE(R_X86_64_COPY),
200 REL_TYPE(R_X86_64_GLOB_DAT),
201 REL_TYPE(R_X86_64_JUMP_SLOT),
202 REL_TYPE(R_X86_64_RELATIVE),
203 REL_TYPE(R_X86_64_GOTPCREL),
204 REL_TYPE(R_X86_64_32),
205 REL_TYPE(R_X86_64_32S),
206 REL_TYPE(R_X86_64_16),
207 REL_TYPE(R_X86_64_PC16),
208 REL_TYPE(R_X86_64_8),
209 REL_TYPE(R_X86_64_PC8),
210#else
201 REL_TYPE(R_386_NONE), 211 REL_TYPE(R_386_NONE),
202 REL_TYPE(R_386_32), 212 REL_TYPE(R_386_32),
203 REL_TYPE(R_386_PC32), 213 REL_TYPE(R_386_PC32),
@@ -213,6 +223,7 @@ static const char *rel_type(unsigned type)
213 REL_TYPE(R_386_PC8), 223 REL_TYPE(R_386_PC8),
214 REL_TYPE(R_386_16), 224 REL_TYPE(R_386_16),
215 REL_TYPE(R_386_PC16), 225 REL_TYPE(R_386_PC16),
226#endif
216#undef REL_TYPE 227#undef REL_TYPE
217 }; 228 };
218 const char *name = "unknown type rel type name"; 229 const char *name = "unknown type rel type name";
@@ -240,7 +251,7 @@ static const char *sec_name(unsigned shndx)
240 return name; 251 return name;
241} 252}
242 253
243static const char *sym_name(const char *sym_strtab, Elf32_Sym *sym) 254static const char *sym_name(const char *sym_strtab, Elf_Sym *sym)
244{ 255{
245 const char *name; 256 const char *name;
246 name = "<noname>"; 257 name = "<noname>";
@@ -253,15 +264,42 @@ static const char *sym_name(const char *sym_strtab, Elf32_Sym *sym)
253 return name; 264 return name;
254} 265}
255 266
267static Elf_Sym *sym_lookup(const char *symname)
268{
269 int i;
270 for (i = 0; i < ehdr.e_shnum; i++) {
271 struct section *sec = &secs[i];
272 long nsyms;
273 char *strtab;
274 Elf_Sym *symtab;
275 Elf_Sym *sym;
276
277 if (sec->shdr.sh_type != SHT_SYMTAB)
278 continue;
256 279
280 nsyms = sec->shdr.sh_size/sizeof(Elf_Sym);
281 symtab = sec->symtab;
282 strtab = sec->link->strtab;
283
284 for (sym = symtab; --nsyms >= 0; sym++) {
285 if (!sym->st_name)
286 continue;
287 if (strcmp(symname, strtab + sym->st_name) == 0)
288 return sym;
289 }
290 }
291 return 0;
292}
257 293
258#if BYTE_ORDER == LITTLE_ENDIAN 294#if BYTE_ORDER == LITTLE_ENDIAN
259#define le16_to_cpu(val) (val) 295#define le16_to_cpu(val) (val)
260#define le32_to_cpu(val) (val) 296#define le32_to_cpu(val) (val)
297#define le64_to_cpu(val) (val)
261#endif 298#endif
262#if BYTE_ORDER == BIG_ENDIAN 299#if BYTE_ORDER == BIG_ENDIAN
263#define le16_to_cpu(val) bswap_16(val) 300#define le16_to_cpu(val) bswap_16(val)
264#define le32_to_cpu(val) bswap_32(val) 301#define le32_to_cpu(val) bswap_32(val)
302#define le64_to_cpu(val) bswap_64(val)
265#endif 303#endif
266 304
267static uint16_t elf16_to_cpu(uint16_t val) 305static uint16_t elf16_to_cpu(uint16_t val)
@@ -274,6 +312,23 @@ static uint32_t elf32_to_cpu(uint32_t val)
274 return le32_to_cpu(val); 312 return le32_to_cpu(val);
275} 313}
276 314
315#define elf_half_to_cpu(x) elf16_to_cpu(x)
316#define elf_word_to_cpu(x) elf32_to_cpu(x)
317
318#if ELF_BITS == 64
319static uint64_t elf64_to_cpu(uint64_t val)
320{
321 return le64_to_cpu(val);
322}
323#define elf_addr_to_cpu(x) elf64_to_cpu(x)
324#define elf_off_to_cpu(x) elf64_to_cpu(x)
325#define elf_xword_to_cpu(x) elf64_to_cpu(x)
326#else
327#define elf_addr_to_cpu(x) elf32_to_cpu(x)
328#define elf_off_to_cpu(x) elf32_to_cpu(x)
329#define elf_xword_to_cpu(x) elf32_to_cpu(x)
330#endif
331
277static void read_ehdr(FILE *fp) 332static void read_ehdr(FILE *fp)
278{ 333{
279 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { 334 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) {
@@ -283,8 +338,8 @@ static void read_ehdr(FILE *fp)
283 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { 338 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
284 die("No ELF magic\n"); 339 die("No ELF magic\n");
285 } 340 }
286 if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) { 341 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) {
287 die("Not a 32 bit executable\n"); 342 die("Not a %d bit executable\n", ELF_BITS);
288 } 343 }
289 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { 344 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) {
290 die("Not a LSB ELF executable\n"); 345 die("Not a LSB ELF executable\n");
@@ -293,36 +348,36 @@ static void read_ehdr(FILE *fp)
293 die("Unknown ELF version\n"); 348 die("Unknown ELF version\n");
294 } 349 }
295 /* Convert the fields to native endian */ 350 /* Convert the fields to native endian */
296 ehdr.e_type = elf16_to_cpu(ehdr.e_type); 351 ehdr.e_type = elf_half_to_cpu(ehdr.e_type);
297 ehdr.e_machine = elf16_to_cpu(ehdr.e_machine); 352 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine);
298 ehdr.e_version = elf32_to_cpu(ehdr.e_version); 353 ehdr.e_version = elf_word_to_cpu(ehdr.e_version);
299 ehdr.e_entry = elf32_to_cpu(ehdr.e_entry); 354 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry);
300 ehdr.e_phoff = elf32_to_cpu(ehdr.e_phoff); 355 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff);
301 ehdr.e_shoff = elf32_to_cpu(ehdr.e_shoff); 356 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff);
302 ehdr.e_flags = elf32_to_cpu(ehdr.e_flags); 357 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags);
303 ehdr.e_ehsize = elf16_to_cpu(ehdr.e_ehsize); 358 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize);
304 ehdr.e_phentsize = elf16_to_cpu(ehdr.e_phentsize); 359 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize);
305 ehdr.e_phnum = elf16_to_cpu(ehdr.e_phnum); 360 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum);
306 ehdr.e_shentsize = elf16_to_cpu(ehdr.e_shentsize); 361 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize);
307 ehdr.e_shnum = elf16_to_cpu(ehdr.e_shnum); 362 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum);
308 ehdr.e_shstrndx = elf16_to_cpu(ehdr.e_shstrndx); 363 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx);
309 364
310 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) { 365 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) {
311 die("Unsupported ELF header type\n"); 366 die("Unsupported ELF header type\n");
312 } 367 }
313 if (ehdr.e_machine != EM_386) { 368 if (ehdr.e_machine != ELF_MACHINE) {
314 die("Not for x86\n"); 369 die("Not for %s\n", ELF_MACHINE_NAME);
315 } 370 }
316 if (ehdr.e_version != EV_CURRENT) { 371 if (ehdr.e_version != EV_CURRENT) {
317 die("Unknown ELF version\n"); 372 die("Unknown ELF version\n");
318 } 373 }
319 if (ehdr.e_ehsize != sizeof(Elf32_Ehdr)) { 374 if (ehdr.e_ehsize != sizeof(Elf_Ehdr)) {
320 die("Bad Elf header size\n"); 375 die("Bad Elf header size\n");
321 } 376 }
322 if (ehdr.e_phentsize != sizeof(Elf32_Phdr)) { 377 if (ehdr.e_phentsize != sizeof(Elf_Phdr)) {
323 die("Bad program header entry\n"); 378 die("Bad program header entry\n");
324 } 379 }
325 if (ehdr.e_shentsize != sizeof(Elf32_Shdr)) { 380 if (ehdr.e_shentsize != sizeof(Elf_Shdr)) {
326 die("Bad section header entry\n"); 381 die("Bad section header entry\n");
327 } 382 }
328 if (ehdr.e_shstrndx >= ehdr.e_shnum) { 383 if (ehdr.e_shstrndx >= ehdr.e_shnum) {
@@ -333,7 +388,7 @@ static void read_ehdr(FILE *fp)
333static void read_shdrs(FILE *fp) 388static void read_shdrs(FILE *fp)
334{ 389{
335 int i; 390 int i;
336 Elf32_Shdr shdr; 391 Elf_Shdr shdr;
337 392
338 secs = calloc(ehdr.e_shnum, sizeof(struct section)); 393 secs = calloc(ehdr.e_shnum, sizeof(struct section));
339 if (!secs) { 394 if (!secs) {
@@ -349,16 +404,16 @@ static void read_shdrs(FILE *fp)
349 if (fread(&shdr, sizeof shdr, 1, fp) != 1) 404 if (fread(&shdr, sizeof shdr, 1, fp) != 1)
350 die("Cannot read ELF section headers %d/%d: %s\n", 405 die("Cannot read ELF section headers %d/%d: %s\n",
351 i, ehdr.e_shnum, strerror(errno)); 406 i, ehdr.e_shnum, strerror(errno));
352 sec->shdr.sh_name = elf32_to_cpu(shdr.sh_name); 407 sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name);
353 sec->shdr.sh_type = elf32_to_cpu(shdr.sh_type); 408 sec->shdr.sh_type = elf_word_to_cpu(shdr.sh_type);
354 sec->shdr.sh_flags = elf32_to_cpu(shdr.sh_flags); 409 sec->shdr.sh_flags = elf_xword_to_cpu(shdr.sh_flags);
355 sec->shdr.sh_addr = elf32_to_cpu(shdr.sh_addr); 410 sec->shdr.sh_addr = elf_addr_to_cpu(shdr.sh_addr);
356 sec->shdr.sh_offset = elf32_to_cpu(shdr.sh_offset); 411 sec->shdr.sh_offset = elf_off_to_cpu(shdr.sh_offset);
357 sec->shdr.sh_size = elf32_to_cpu(shdr.sh_size); 412 sec->shdr.sh_size = elf_xword_to_cpu(shdr.sh_size);
358 sec->shdr.sh_link = elf32_to_cpu(shdr.sh_link); 413 sec->shdr.sh_link = elf_word_to_cpu(shdr.sh_link);
359 sec->shdr.sh_info = elf32_to_cpu(shdr.sh_info); 414 sec->shdr.sh_info = elf_word_to_cpu(shdr.sh_info);
360 sec->shdr.sh_addralign = elf32_to_cpu(shdr.sh_addralign); 415 sec->shdr.sh_addralign = elf_xword_to_cpu(shdr.sh_addralign);
361 sec->shdr.sh_entsize = elf32_to_cpu(shdr.sh_entsize); 416 sec->shdr.sh_entsize = elf_xword_to_cpu(shdr.sh_entsize);
362 if (sec->shdr.sh_link < ehdr.e_shnum) 417 if (sec->shdr.sh_link < ehdr.e_shnum)
363 sec->link = &secs[sec->shdr.sh_link]; 418 sec->link = &secs[sec->shdr.sh_link];
364 } 419 }
@@ -412,12 +467,12 @@ static void read_symtabs(FILE *fp)
412 die("Cannot read symbol table: %s\n", 467 die("Cannot read symbol table: %s\n",
413 strerror(errno)); 468 strerror(errno));
414 } 469 }
415 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { 470 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Sym); j++) {
416 Elf32_Sym *sym = &sec->symtab[j]; 471 Elf_Sym *sym = &sec->symtab[j];
417 sym->st_name = elf32_to_cpu(sym->st_name); 472 sym->st_name = elf_word_to_cpu(sym->st_name);
418 sym->st_value = elf32_to_cpu(sym->st_value); 473 sym->st_value = elf_addr_to_cpu(sym->st_value);
419 sym->st_size = elf32_to_cpu(sym->st_size); 474 sym->st_size = elf_xword_to_cpu(sym->st_size);
420 sym->st_shndx = elf16_to_cpu(sym->st_shndx); 475 sym->st_shndx = elf_half_to_cpu(sym->st_shndx);
421 } 476 }
422 } 477 }
423} 478}
@@ -428,7 +483,7 @@ static void read_relocs(FILE *fp)
428 int i,j; 483 int i,j;
429 for (i = 0; i < ehdr.e_shnum; i++) { 484 for (i = 0; i < ehdr.e_shnum; i++) {
430 struct section *sec = &secs[i]; 485 struct section *sec = &secs[i];
431 if (sec->shdr.sh_type != SHT_REL) { 486 if (sec->shdr.sh_type != SHT_REL_TYPE) {
432 continue; 487 continue;
433 } 488 }
434 sec->reltab = malloc(sec->shdr.sh_size); 489 sec->reltab = malloc(sec->shdr.sh_size);
@@ -445,10 +500,13 @@ static void read_relocs(FILE *fp)
445 die("Cannot read symbol table: %s\n", 500 die("Cannot read symbol table: %s\n",
446 strerror(errno)); 501 strerror(errno));
447 } 502 }
448 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) { 503 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) {
449 Elf32_Rel *rel = &sec->reltab[j]; 504 Elf_Rel *rel = &sec->reltab[j];
450 rel->r_offset = elf32_to_cpu(rel->r_offset); 505 rel->r_offset = elf_addr_to_cpu(rel->r_offset);
451 rel->r_info = elf32_to_cpu(rel->r_info); 506 rel->r_info = elf_xword_to_cpu(rel->r_info);
507#if (SHT_REL_TYPE == SHT_RELA)
508 rel->r_addend = elf_xword_to_cpu(rel->r_addend);
509#endif
452 } 510 }
453 } 511 }
454} 512}
@@ -457,6 +515,13 @@ static void read_relocs(FILE *fp)
457static void print_absolute_symbols(void) 515static void print_absolute_symbols(void)
458{ 516{
459 int i; 517 int i;
518 const char *format;
519
520 if (ELF_BITS == 64)
521 format = "%5d %016"PRIx64" %5"PRId64" %10s %10s %12s %s\n";
522 else
523 format = "%5d %08"PRIx32" %5"PRId32" %10s %10s %12s %s\n";
524
460 printf("Absolute symbols\n"); 525 printf("Absolute symbols\n");
461 printf(" Num: Value Size Type Bind Visibility Name\n"); 526 printf(" Num: Value Size Type Bind Visibility Name\n");
462 for (i = 0; i < ehdr.e_shnum; i++) { 527 for (i = 0; i < ehdr.e_shnum; i++) {
@@ -468,19 +533,19 @@ static void print_absolute_symbols(void)
468 continue; 533 continue;
469 } 534 }
470 sym_strtab = sec->link->strtab; 535 sym_strtab = sec->link->strtab;
471 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { 536 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Sym); j++) {
472 Elf32_Sym *sym; 537 Elf_Sym *sym;
473 const char *name; 538 const char *name;
474 sym = &sec->symtab[j]; 539 sym = &sec->symtab[j];
475 name = sym_name(sym_strtab, sym); 540 name = sym_name(sym_strtab, sym);
476 if (sym->st_shndx != SHN_ABS) { 541 if (sym->st_shndx != SHN_ABS) {
477 continue; 542 continue;
478 } 543 }
479 printf("%5d %08x %5d %10s %10s %12s %s\n", 544 printf(format,
480 j, sym->st_value, sym->st_size, 545 j, sym->st_value, sym->st_size,
481 sym_type(ELF32_ST_TYPE(sym->st_info)), 546 sym_type(ELF_ST_TYPE(sym->st_info)),
482 sym_bind(ELF32_ST_BIND(sym->st_info)), 547 sym_bind(ELF_ST_BIND(sym->st_info)),
483 sym_visibility(ELF32_ST_VISIBILITY(sym->st_other)), 548 sym_visibility(ELF_ST_VISIBILITY(sym->st_other)),
484 name); 549 name);
485 } 550 }
486 } 551 }
@@ -490,14 +555,20 @@ static void print_absolute_symbols(void)
490static void print_absolute_relocs(void) 555static void print_absolute_relocs(void)
491{ 556{
492 int i, printed = 0; 557 int i, printed = 0;
558 const char *format;
559
560 if (ELF_BITS == 64)
561 format = "%016"PRIx64" %016"PRIx64" %10s %016"PRIx64" %s\n";
562 else
563 format = "%08"PRIx32" %08"PRIx32" %10s %08"PRIx32" %s\n";
493 564
494 for (i = 0; i < ehdr.e_shnum; i++) { 565 for (i = 0; i < ehdr.e_shnum; i++) {
495 struct section *sec = &secs[i]; 566 struct section *sec = &secs[i];
496 struct section *sec_applies, *sec_symtab; 567 struct section *sec_applies, *sec_symtab;
497 char *sym_strtab; 568 char *sym_strtab;
498 Elf32_Sym *sh_symtab; 569 Elf_Sym *sh_symtab;
499 int j; 570 int j;
500 if (sec->shdr.sh_type != SHT_REL) { 571 if (sec->shdr.sh_type != SHT_REL_TYPE) {
501 continue; 572 continue;
502 } 573 }
503 sec_symtab = sec->link; 574 sec_symtab = sec->link;
@@ -507,12 +578,12 @@ static void print_absolute_relocs(void)
507 } 578 }
508 sh_symtab = sec_symtab->symtab; 579 sh_symtab = sec_symtab->symtab;
509 sym_strtab = sec_symtab->link->strtab; 580 sym_strtab = sec_symtab->link->strtab;
510 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) { 581 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) {
511 Elf32_Rel *rel; 582 Elf_Rel *rel;
512 Elf32_Sym *sym; 583 Elf_Sym *sym;
513 const char *name; 584 const char *name;
514 rel = &sec->reltab[j]; 585 rel = &sec->reltab[j];
515 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; 586 sym = &sh_symtab[ELF_R_SYM(rel->r_info)];
516 name = sym_name(sym_strtab, sym); 587 name = sym_name(sym_strtab, sym);
517 if (sym->st_shndx != SHN_ABS) { 588 if (sym->st_shndx != SHN_ABS) {
518 continue; 589 continue;
@@ -542,10 +613,10 @@ static void print_absolute_relocs(void)
542 printed = 1; 613 printed = 1;
543 } 614 }
544 615
545 printf("%08x %08x %10s %08x %s\n", 616 printf(format,
546 rel->r_offset, 617 rel->r_offset,
547 rel->r_info, 618 rel->r_info,
548 rel_type(ELF32_R_TYPE(rel->r_info)), 619 rel_type(ELF_R_TYPE(rel->r_info)),
549 sym->st_value, 620 sym->st_value,
550 name); 621 name);
551 } 622 }
@@ -555,19 +626,34 @@ static void print_absolute_relocs(void)
555 printf("\n"); 626 printf("\n");
556} 627}
557 628
558static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym), 629static void add_reloc(struct relocs *r, uint32_t offset)
559 int use_real_mode) 630{
631 if (r->count == r->size) {
632 unsigned long newsize = r->size + 50000;
633 void *mem = realloc(r->offset, newsize * sizeof(r->offset[0]));
634
635 if (!mem)
636 die("realloc of %ld entries for relocs failed\n",
637 newsize);
638 r->offset = mem;
639 r->size = newsize;
640 }
641 r->offset[r->count++] = offset;
642}
643
644static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
645 Elf_Sym *sym, const char *symname))
560{ 646{
561 int i; 647 int i;
562 /* Walk through the relocations */ 648 /* Walk through the relocations */
563 for (i = 0; i < ehdr.e_shnum; i++) { 649 for (i = 0; i < ehdr.e_shnum; i++) {
564 char *sym_strtab; 650 char *sym_strtab;
565 Elf32_Sym *sh_symtab; 651 Elf_Sym *sh_symtab;
566 struct section *sec_applies, *sec_symtab; 652 struct section *sec_applies, *sec_symtab;
567 int j; 653 int j;
568 struct section *sec = &secs[i]; 654 struct section *sec = &secs[i];
569 655
570 if (sec->shdr.sh_type != SHT_REL) { 656 if (sec->shdr.sh_type != SHT_REL_TYPE) {
571 continue; 657 continue;
572 } 658 }
573 sec_symtab = sec->link; 659 sec_symtab = sec->link;
@@ -577,101 +663,281 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
577 } 663 }
578 sh_symtab = sec_symtab->symtab; 664 sh_symtab = sec_symtab->symtab;
579 sym_strtab = sec_symtab->link->strtab; 665 sym_strtab = sec_symtab->link->strtab;
580 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) { 666 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) {
581 Elf32_Rel *rel; 667 Elf_Rel *rel = &sec->reltab[j];
582 Elf32_Sym *sym; 668 Elf_Sym *sym = &sh_symtab[ELF_R_SYM(rel->r_info)];
583 unsigned r_type; 669 const char *symname = sym_name(sym_strtab, sym);
584 const char *symname;
585 int shn_abs;
586 670
587 rel = &sec->reltab[j]; 671 process(sec, rel, sym, symname);
588 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; 672 }
589 r_type = ELF32_R_TYPE(rel->r_info); 673 }
590 674}
591 shn_abs = sym->st_shndx == SHN_ABS;
592
593 switch (r_type) {
594 case R_386_NONE:
595 case R_386_PC32:
596 case R_386_PC16:
597 case R_386_PC8:
598 /*
599 * NONE can be ignored and and PC relative
600 * relocations don't need to be adjusted.
601 */
602 break;
603 675
604 case R_386_16: 676/*
605 symname = sym_name(sym_strtab, sym); 677 * The .data..percpu section is a special case for x86_64 SMP kernels.
606 if (!use_real_mode) 678 * It is used to initialize the actual per_cpu areas and to provide
607 goto bad; 679 * definitions for the per_cpu variables that correspond to their offsets
608 if (shn_abs) { 680 * within the percpu area. Since the values of all of the symbols need
609 if (is_reloc(S_ABS, symname)) 681 * to be offsets from the start of the per_cpu area the virtual address
610 break; 682 * (sh_addr) of .data..percpu is 0 in SMP kernels.
611 else if (!is_reloc(S_SEG, symname)) 683 *
612 goto bad; 684 * This means that:
613 } else { 685 *
614 if (is_reloc(S_LIN, symname)) 686 * Relocations that reference symbols in the per_cpu area do not
615 goto bad; 687 * need further relocation (since the value is an offset relative
616 else 688 * to the start of the per_cpu area that does not change).
617 break; 689 *
618 } 690 * Relocations that apply to the per_cpu area need to have their
619 visit(rel, sym); 691 * offset adjusted by by the value of __per_cpu_load to make them
620 break; 692 * point to the correct place in the loaded image (because the
693 * virtual address of .data..percpu is 0).
694 *
695 * For non SMP kernels .data..percpu is linked as part of the normal
696 * kernel data and does not require special treatment.
697 *
698 */
699static int per_cpu_shndx = -1;
700Elf_Addr per_cpu_load_addr;
621 701
622 case R_386_32: 702static void percpu_init(void)
623 symname = sym_name(sym_strtab, sym); 703{
624 if (shn_abs) { 704 int i;
625 if (is_reloc(S_ABS, symname)) 705 for (i = 0; i < ehdr.e_shnum; i++) {
626 break; 706 ElfW(Sym) *sym;
627 else if (!is_reloc(S_REL, symname)) 707 if (strcmp(sec_name(i), ".data..percpu"))
628 goto bad; 708 continue;
629 } else { 709
630 if (use_real_mode && 710 if (secs[i].shdr.sh_addr != 0) /* non SMP kernel */
631 !is_reloc(S_LIN, symname)) 711 return;
632 break; 712
633 } 713 sym = sym_lookup("__per_cpu_load");
634 visit(rel, sym); 714 if (!sym)
635 break; 715 die("can't find __per_cpu_load\n");
636 default: 716
637 die("Unsupported relocation type: %s (%d)\n", 717 per_cpu_shndx = i;
638 rel_type(r_type), r_type); 718 per_cpu_load_addr = sym->st_value;
719 return;
720 }
721}
722
723#if ELF_BITS == 64
724
725/*
726 * Check to see if a symbol lies in the .data..percpu section.
727 * For some as yet not understood reason the "__init_begin"
728 * symbol which immediately preceeds the .data..percpu section
729 * also shows up as it it were part of it so we do an explict
730 * check for that symbol name and ignore it.
731 */
732static int is_percpu_sym(ElfW(Sym) *sym, const char *symname)
733{
734 return (sym->st_shndx == per_cpu_shndx) &&
735 strcmp(symname, "__init_begin");
736}
737
738
739static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,
740 const char *symname)
741{
742 unsigned r_type = ELF64_R_TYPE(rel->r_info);
743 ElfW(Addr) offset = rel->r_offset;
744 int shn_abs = (sym->st_shndx == SHN_ABS) && !is_reloc(S_REL, symname);
745
746 if (sym->st_shndx == SHN_UNDEF)
747 return 0;
748
749 /*
750 * Adjust the offset if this reloc applies to the percpu section.
751 */
752 if (sec->shdr.sh_info == per_cpu_shndx)
753 offset += per_cpu_load_addr;
754
755 switch (r_type) {
756 case R_X86_64_NONE:
757 case R_X86_64_PC32:
758 /*
759 * NONE can be ignored and PC relative relocations don't
760 * need to be adjusted.
761 */
762 break;
763
764 case R_X86_64_32:
765 case R_X86_64_32S:
766 case R_X86_64_64:
767 /*
768 * References to the percpu area don't need to be adjusted.
769 */
770 if (is_percpu_sym(sym, symname))
771 break;
772
773 if (shn_abs) {
774 /*
775 * Whitelisted absolute symbols do not require
776 * relocation.
777 */
778 if (is_reloc(S_ABS, symname))
639 break; 779 break;
640 bad: 780
641 symname = sym_name(sym_strtab, sym); 781 die("Invalid absolute %s relocation: %s\n",
642 die("Invalid %s %s relocation: %s\n", 782 rel_type(r_type), symname);
643 shn_abs ? "absolute" : "relative", 783 break;
644 rel_type(r_type), symname);
645 }
646 } 784 }
785
786 /*
787 * Relocation offsets for 64 bit kernels are output
788 * as 32 bits and sign extended back to 64 bits when
789 * the relocations are processed.
790 * Make sure that the offset will fit.
791 */
792 if ((int32_t)offset != (int64_t)offset)
793 die("Relocation offset doesn't fit in 32 bits\n");
794
795 if (r_type == R_X86_64_64)
796 add_reloc(&relocs64, offset);
797 else
798 add_reloc(&relocs32, offset);
799 break;
800
801 default:
802 die("Unsupported relocation type: %s (%d)\n",
803 rel_type(r_type), r_type);
804 break;
647 } 805 }
806
807 return 0;
648} 808}
649 809
650static void count_reloc(Elf32_Rel *rel, Elf32_Sym *sym) 810#else
811
812static int do_reloc32(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
813 const char *symname)
651{ 814{
652 if (ELF32_R_TYPE(rel->r_info) == R_386_16) 815 unsigned r_type = ELF32_R_TYPE(rel->r_info);
653 reloc16_count++; 816 int shn_abs = (sym->st_shndx == SHN_ABS) && !is_reloc(S_REL, symname);
654 else 817
655 reloc_count++; 818 switch (r_type) {
819 case R_386_NONE:
820 case R_386_PC32:
821 case R_386_PC16:
822 case R_386_PC8:
823 /*
824 * NONE can be ignored and PC relative relocations don't
825 * need to be adjusted.
826 */
827 break;
828
829 case R_386_32:
830 if (shn_abs) {
831 /*
832 * Whitelisted absolute symbols do not require
833 * relocation.
834 */
835 if (is_reloc(S_ABS, symname))
836 break;
837
838 die("Invalid absolute %s relocation: %s\n",
839 rel_type(r_type), symname);
840 break;
841 }
842
843 add_reloc(&relocs32, rel->r_offset);
844 break;
845
846 default:
847 die("Unsupported relocation type: %s (%d)\n",
848 rel_type(r_type), r_type);
849 break;
850 }
851
852 return 0;
656} 853}
657 854
658static void collect_reloc(Elf32_Rel *rel, Elf32_Sym *sym) 855static int do_reloc_real(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
856 const char *symname)
659{ 857{
660 /* Remember the address that needs to be adjusted. */ 858 unsigned r_type = ELF32_R_TYPE(rel->r_info);
661 if (ELF32_R_TYPE(rel->r_info) == R_386_16) 859 int shn_abs = (sym->st_shndx == SHN_ABS) && !is_reloc(S_REL, symname);
662 relocs16[reloc16_idx++] = rel->r_offset; 860
663 else 861 switch (r_type) {
664 relocs[reloc_idx++] = rel->r_offset; 862 case R_386_NONE:
863 case R_386_PC32:
864 case R_386_PC16:
865 case R_386_PC8:
866 /*
867 * NONE can be ignored and PC relative relocations don't
868 * need to be adjusted.
869 */
870 break;
871
872 case R_386_16:
873 if (shn_abs) {
874 /*
875 * Whitelisted absolute symbols do not require
876 * relocation.
877 */
878 if (is_reloc(S_ABS, symname))
879 break;
880
881 if (is_reloc(S_SEG, symname)) {
882 add_reloc(&relocs16, rel->r_offset);
883 break;
884 }
885 } else {
886 if (!is_reloc(S_LIN, symname))
887 break;
888 }
889 die("Invalid %s %s relocation: %s\n",
890 shn_abs ? "absolute" : "relative",
891 rel_type(r_type), symname);
892 break;
893
894 case R_386_32:
895 if (shn_abs) {
896 /*
897 * Whitelisted absolute symbols do not require
898 * relocation.
899 */
900 if (is_reloc(S_ABS, symname))
901 break;
902
903 if (is_reloc(S_REL, symname)) {
904 add_reloc(&relocs32, rel->r_offset);
905 break;
906 }
907 } else {
908 if (is_reloc(S_LIN, symname))
909 add_reloc(&relocs32, rel->r_offset);
910 break;
911 }
912 die("Invalid %s %s relocation: %s\n",
913 shn_abs ? "absolute" : "relative",
914 rel_type(r_type), symname);
915 break;
916
917 default:
918 die("Unsupported relocation type: %s (%d)\n",
919 rel_type(r_type), r_type);
920 break;
921 }
922
923 return 0;
665} 924}
666 925
926#endif
927
667static int cmp_relocs(const void *va, const void *vb) 928static int cmp_relocs(const void *va, const void *vb)
668{ 929{
669 const unsigned long *a, *b; 930 const uint32_t *a, *b;
670 a = va; b = vb; 931 a = va; b = vb;
671 return (*a == *b)? 0 : (*a > *b)? 1 : -1; 932 return (*a == *b)? 0 : (*a > *b)? 1 : -1;
672} 933}
673 934
674static int write32(unsigned int v, FILE *f) 935static void sort_relocs(struct relocs *r)
936{
937 qsort(r->offset, r->count, sizeof(r->offset[0]), cmp_relocs);
938}
939
940static int write32(uint32_t v, FILE *f)
675{ 941{
676 unsigned char buf[4]; 942 unsigned char buf[4];
677 943
@@ -679,33 +945,40 @@ static int write32(unsigned int v, FILE *f)
679 return fwrite(buf, 1, 4, f) == 4 ? 0 : -1; 945 return fwrite(buf, 1, 4, f) == 4 ? 0 : -1;
680} 946}
681 947
948static int write32_as_text(uint32_t v, FILE *f)
949{
950 return fprintf(f, "\t.long 0x%08"PRIx32"\n", v) > 0 ? 0 : -1;
951}
952
682static void emit_relocs(int as_text, int use_real_mode) 953static void emit_relocs(int as_text, int use_real_mode)
683{ 954{
684 int i; 955 int i;
685 /* Count how many relocations I have and allocate space for them. */ 956 int (*write_reloc)(uint32_t, FILE *) = write32;
686 reloc_count = 0; 957 int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
687 walk_relocs(count_reloc, use_real_mode); 958 const char *symname);
688 relocs = malloc(reloc_count * sizeof(relocs[0])); 959
689 if (!relocs) { 960#if ELF_BITS == 64
690 die("malloc of %d entries for relocs failed\n", 961 if (!use_real_mode)
691 reloc_count); 962 do_reloc = do_reloc64;
692 } 963 else
964 die("--realmode not valid for a 64-bit ELF file");
965#else
966 if (!use_real_mode)
967 do_reloc = do_reloc32;
968 else
969 do_reloc = do_reloc_real;
970#endif
693 971
694 relocs16 = malloc(reloc16_count * sizeof(relocs[0]));
695 if (!relocs16) {
696 die("malloc of %d entries for relocs16 failed\n",
697 reloc16_count);
698 }
699 /* Collect up the relocations */ 972 /* Collect up the relocations */
700 reloc_idx = 0; 973 walk_relocs(do_reloc);
701 walk_relocs(collect_reloc, use_real_mode);
702 974
703 if (reloc16_count && !use_real_mode) 975 if (relocs16.count && !use_real_mode)
704 die("Segment relocations found but --realmode not specified\n"); 976 die("Segment relocations found but --realmode not specified\n");
705 977
706 /* Order the relocations for more efficient processing */ 978 /* Order the relocations for more efficient processing */
707 qsort(relocs, reloc_count, sizeof(relocs[0]), cmp_relocs); 979 sort_relocs(&relocs16);
708 qsort(relocs16, reloc16_count, sizeof(relocs16[0]), cmp_relocs); 980 sort_relocs(&relocs32);
981 sort_relocs(&relocs64);
709 982
710 /* Print the relocations */ 983 /* Print the relocations */
711 if (as_text) { 984 if (as_text) {
@@ -714,114 +987,60 @@ static void emit_relocs(int as_text, int use_real_mode)
714 */ 987 */
715 printf(".section \".data.reloc\",\"a\"\n"); 988 printf(".section \".data.reloc\",\"a\"\n");
716 printf(".balign 4\n"); 989 printf(".balign 4\n");
717 if (use_real_mode) { 990 write_reloc = write32_as_text;
718 printf("\t.long %lu\n", reloc16_count);
719 for (i = 0; i < reloc16_count; i++)
720 printf("\t.long 0x%08lx\n", relocs16[i]);
721 printf("\t.long %lu\n", reloc_count);
722 for (i = 0; i < reloc_count; i++) {
723 printf("\t.long 0x%08lx\n", relocs[i]);
724 }
725 } else {
726 /* Print a stop */
727 printf("\t.long 0x%08lx\n", (unsigned long)0);
728 for (i = 0; i < reloc_count; i++) {
729 printf("\t.long 0x%08lx\n", relocs[i]);
730 }
731 }
732
733 printf("\n");
734 } 991 }
735 else {
736 if (use_real_mode) {
737 write32(reloc16_count, stdout);
738 for (i = 0; i < reloc16_count; i++)
739 write32(relocs16[i], stdout);
740 write32(reloc_count, stdout);
741 992
742 /* Now print each relocation */ 993 if (use_real_mode) {
743 for (i = 0; i < reloc_count; i++) 994 write_reloc(relocs16.count, stdout);
744 write32(relocs[i], stdout); 995 for (i = 0; i < relocs16.count; i++)
745 } else { 996 write_reloc(relocs16.offset[i], stdout);
997
998 write_reloc(relocs32.count, stdout);
999 for (i = 0; i < relocs32.count; i++)
1000 write_reloc(relocs32.offset[i], stdout);
1001 } else {
1002 if (ELF_BITS == 64) {
746 /* Print a stop */ 1003 /* Print a stop */
747 write32(0, stdout); 1004 write_reloc(0, stdout);
748 1005
749 /* Now print each relocation */ 1006 /* Now print each relocation */
750 for (i = 0; i < reloc_count; i++) { 1007 for (i = 0; i < relocs64.count; i++)
751 write32(relocs[i], stdout); 1008 write_reloc(relocs64.offset[i], stdout);
752 }
753 } 1009 }
1010
1011 /* Print a stop */
1012 write_reloc(0, stdout);
1013
1014 /* Now print each relocation */
1015 for (i = 0; i < relocs32.count; i++)
1016 write_reloc(relocs32.offset[i], stdout);
754 } 1017 }
755} 1018}
756 1019
757static void usage(void) 1020#if ELF_BITS == 64
758{ 1021# define process process_64
759 die("relocs [--abs-syms|--abs-relocs|--text|--realmode] vmlinux\n"); 1022#else
760} 1023# define process process_32
1024#endif
761 1025
762int main(int argc, char **argv) 1026void process(FILE *fp, int use_real_mode, int as_text,
1027 int show_absolute_syms, int show_absolute_relocs)
763{ 1028{
764 int show_absolute_syms, show_absolute_relocs;
765 int as_text, use_real_mode;
766 const char *fname;
767 FILE *fp;
768 int i;
769
770 show_absolute_syms = 0;
771 show_absolute_relocs = 0;
772 as_text = 0;
773 use_real_mode = 0;
774 fname = NULL;
775 for (i = 1; i < argc; i++) {
776 char *arg = argv[i];
777 if (*arg == '-') {
778 if (strcmp(arg, "--abs-syms") == 0) {
779 show_absolute_syms = 1;
780 continue;
781 }
782 if (strcmp(arg, "--abs-relocs") == 0) {
783 show_absolute_relocs = 1;
784 continue;
785 }
786 if (strcmp(arg, "--text") == 0) {
787 as_text = 1;
788 continue;
789 }
790 if (strcmp(arg, "--realmode") == 0) {
791 use_real_mode = 1;
792 continue;
793 }
794 }
795 else if (!fname) {
796 fname = arg;
797 continue;
798 }
799 usage();
800 }
801 if (!fname) {
802 usage();
803 }
804 regex_init(use_real_mode); 1029 regex_init(use_real_mode);
805 fp = fopen(fname, "r");
806 if (!fp) {
807 die("Cannot open %s: %s\n",
808 fname, strerror(errno));
809 }
810 read_ehdr(fp); 1030 read_ehdr(fp);
811 read_shdrs(fp); 1031 read_shdrs(fp);
812 read_strtabs(fp); 1032 read_strtabs(fp);
813 read_symtabs(fp); 1033 read_symtabs(fp);
814 read_relocs(fp); 1034 read_relocs(fp);
1035 if (ELF_BITS == 64)
1036 percpu_init();
815 if (show_absolute_syms) { 1037 if (show_absolute_syms) {
816 print_absolute_symbols(); 1038 print_absolute_symbols();
817 goto out; 1039 return;
818 } 1040 }
819 if (show_absolute_relocs) { 1041 if (show_absolute_relocs) {
820 print_absolute_relocs(); 1042 print_absolute_relocs();
821 goto out; 1043 return;
822 } 1044 }
823 emit_relocs(as_text, use_real_mode); 1045 emit_relocs(as_text, use_real_mode);
824out:
825 fclose(fp);
826 return 0;
827} 1046}
diff --git a/arch/x86/tools/relocs.h b/arch/x86/tools/relocs.h
new file mode 100644
index 000000000000..07cdb1eca4fa
--- /dev/null
+++ b/arch/x86/tools/relocs.h
@@ -0,0 +1,36 @@
1#ifndef RELOCS_H
2#define RELOCS_H
3
4#include <stdio.h>
5#include <stdarg.h>
6#include <stdlib.h>
7#include <stdint.h>
8#include <inttypes.h>
9#include <string.h>
10#include <errno.h>
11#include <unistd.h>
12#include <elf.h>
13#include <byteswap.h>
14#define USE_BSD
15#include <endian.h>
16#include <regex.h>
17#include <tools/le_byteshift.h>
18
19void die(char *fmt, ...);
20
21#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
22
23enum symtype {
24 S_ABS,
25 S_REL,
26 S_SEG,
27 S_LIN,
28 S_NSYMTYPES
29};
30
31void process_32(FILE *fp, int use_real_mode, int as_text,
32 int show_absolute_syms, int show_absolute_relocs);
33void process_64(FILE *fp, int use_real_mode, int as_text,
34 int show_absolute_syms, int show_absolute_relocs);
35
36#endif /* RELOCS_H */
diff --git a/arch/x86/tools/relocs_32.c b/arch/x86/tools/relocs_32.c
new file mode 100644
index 000000000000..b2ade2bb4162
--- /dev/null
+++ b/arch/x86/tools/relocs_32.c
@@ -0,0 +1,17 @@
1#include "relocs.h"
2
3#define ELF_BITS 32
4
5#define ELF_MACHINE EM_386
6#define ELF_MACHINE_NAME "i386"
7#define SHT_REL_TYPE SHT_REL
8#define Elf_Rel ElfW(Rel)
9
10#define ELF_CLASS ELFCLASS32
11#define ELF_R_SYM(val) ELF32_R_SYM(val)
12#define ELF_R_TYPE(val) ELF32_R_TYPE(val)
13#define ELF_ST_TYPE(o) ELF32_ST_TYPE(o)
14#define ELF_ST_BIND(o) ELF32_ST_BIND(o)
15#define ELF_ST_VISIBILITY(o) ELF32_ST_VISIBILITY(o)
16
17#include "relocs.c"
diff --git a/arch/x86/tools/relocs_64.c b/arch/x86/tools/relocs_64.c
new file mode 100644
index 000000000000..56b61b743c4c
--- /dev/null
+++ b/arch/x86/tools/relocs_64.c
@@ -0,0 +1,17 @@
1#include "relocs.h"
2
3#define ELF_BITS 64
4
5#define ELF_MACHINE EM_X86_64
6#define ELF_MACHINE_NAME "x86_64"
7#define SHT_REL_TYPE SHT_RELA
8#define Elf_Rel Elf64_Rela
9
10#define ELF_CLASS ELFCLASS64
11#define ELF_R_SYM(val) ELF64_R_SYM(val)
12#define ELF_R_TYPE(val) ELF64_R_TYPE(val)
13#define ELF_ST_TYPE(o) ELF64_ST_TYPE(o)
14#define ELF_ST_BIND(o) ELF64_ST_BIND(o)
15#define ELF_ST_VISIBILITY(o) ELF64_ST_VISIBILITY(o)
16
17#include "relocs.c"
diff --git a/arch/x86/tools/relocs_common.c b/arch/x86/tools/relocs_common.c
new file mode 100644
index 000000000000..44d396823a53
--- /dev/null
+++ b/arch/x86/tools/relocs_common.c
@@ -0,0 +1,76 @@
1#include "relocs.h"
2
3void die(char *fmt, ...)
4{
5 va_list ap;
6 va_start(ap, fmt);
7 vfprintf(stderr, fmt, ap);
8 va_end(ap);
9 exit(1);
10}
11
12static void usage(void)
13{
14 die("relocs [--abs-syms|--abs-relocs|--text|--realmode] vmlinux\n");
15}
16
17int main(int argc, char **argv)
18{
19 int show_absolute_syms, show_absolute_relocs;
20 int as_text, use_real_mode;
21 const char *fname;
22 FILE *fp;
23 int i;
24 unsigned char e_ident[EI_NIDENT];
25
26 show_absolute_syms = 0;
27 show_absolute_relocs = 0;
28 as_text = 0;
29 use_real_mode = 0;
30 fname = NULL;
31 for (i = 1; i < argc; i++) {
32 char *arg = argv[i];
33 if (*arg == '-') {
34 if (strcmp(arg, "--abs-syms") == 0) {
35 show_absolute_syms = 1;
36 continue;
37 }
38 if (strcmp(arg, "--abs-relocs") == 0) {
39 show_absolute_relocs = 1;
40 continue;
41 }
42 if (strcmp(arg, "--text") == 0) {
43 as_text = 1;
44 continue;
45 }
46 if (strcmp(arg, "--realmode") == 0) {
47 use_real_mode = 1;
48 continue;
49 }
50 }
51 else if (!fname) {
52 fname = arg;
53 continue;
54 }
55 usage();
56 }
57 if (!fname) {
58 usage();
59 }
60 fp = fopen(fname, "r");
61 if (!fp) {
62 die("Cannot open %s: %s\n", fname, strerror(errno));
63 }
64 if (fread(&e_ident, 1, EI_NIDENT, fp) != EI_NIDENT) {
65 die("Cannot read %s: %s", fname, strerror(errno));
66 }
67 rewind(fp);
68 if (e_ident[EI_CLASS] == ELFCLASS64)
69 process_64(fp, use_real_mode, as_text,
70 show_absolute_syms, show_absolute_relocs);
71 else
72 process_32(fp, use_real_mode, as_text,
73 show_absolute_syms, show_absolute_relocs);
74 fclose(fp);
75 return 0;
76}
diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c
index 5f5feff3d24c..80ffa5b9982d 100644
--- a/arch/x86/um/tls_32.c
+++ b/arch/x86/um/tls_32.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/syscalls.h>
8#include <asm/uaccess.h> 9#include <asm/uaccess.h>
9#include <os.h> 10#include <os.h>
10#include <skas.h> 11#include <skas.h>
@@ -274,7 +275,7 @@ clear:
274 goto out; 275 goto out;
275} 276}
276 277
277int sys_set_thread_area(struct user_desc __user *user_desc) 278SYSCALL_DEFINE1(set_thread_area, struct user_desc __user *, user_desc)
278{ 279{
279 struct user_desc info; 280 struct user_desc info;
280 int idx, ret; 281 int idx, ret;
@@ -322,7 +323,7 @@ int ptrace_set_thread_area(struct task_struct *child, int idx,
322 return set_tls_entry(child, &info, idx, 0); 323 return set_tls_entry(child, &info, idx, 0);
323} 324}
324 325
325int sys_get_thread_area(struct user_desc __user *user_desc) 326SYSCALL_DEFINE1(get_thread_area, struct user_desc __user *, user_desc)
326{ 327{
327 struct user_desc info; 328 struct user_desc info;
328 int idx, ret; 329 int idx, ret;
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 131dacd2748a..1a3c76505649 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -4,7 +4,7 @@
4 4
5config XEN 5config XEN
6 bool "Xen guest support" 6 bool "Xen guest support"
7 select PARAVIRT 7 depends on PARAVIRT
8 select PARAVIRT_CLOCK 8 select PARAVIRT_CLOCK
9 select XEN_HAVE_PVMMU 9 select XEN_HAVE_PVMMU
10 depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) 10 depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c8e1c7b95c3b..53d4f680c9b5 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -31,6 +31,7 @@
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/gfp.h> 32#include <linux/gfp.h>
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34#include <linux/edd.h>
34 35
35#include <xen/xen.h> 36#include <xen/xen.h>
36#include <xen/events.h> 37#include <xen/events.h>
@@ -1220,7 +1221,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
1220 .alloc_ldt = xen_alloc_ldt, 1221 .alloc_ldt = xen_alloc_ldt,
1221 .free_ldt = xen_free_ldt, 1222 .free_ldt = xen_free_ldt,
1222 1223
1223 .store_gdt = native_store_gdt,
1224 .store_idt = native_store_idt, 1224 .store_idt = native_store_idt,
1225 .store_tr = xen_store_tr, 1225 .store_tr = xen_store_tr,
1226 1226
@@ -1306,6 +1306,55 @@ static const struct machine_ops xen_machine_ops __initconst = {
1306 .emergency_restart = xen_emergency_restart, 1306 .emergency_restart = xen_emergency_restart,
1307}; 1307};
1308 1308
1309static void __init xen_boot_params_init_edd(void)
1310{
1311#if IS_ENABLED(CONFIG_EDD)
1312 struct xen_platform_op op;
1313 struct edd_info *edd_info;
1314 u32 *mbr_signature;
1315 unsigned nr;
1316 int ret;
1317
1318 edd_info = boot_params.eddbuf;
1319 mbr_signature = boot_params.edd_mbr_sig_buffer;
1320
1321 op.cmd = XENPF_firmware_info;
1322
1323 op.u.firmware_info.type = XEN_FW_DISK_INFO;
1324 for (nr = 0; nr < EDDMAXNR; nr++) {
1325 struct edd_info *info = edd_info + nr;
1326
1327 op.u.firmware_info.index = nr;
1328 info->params.length = sizeof(info->params);
1329 set_xen_guest_handle(op.u.firmware_info.u.disk_info.edd_params,
1330 &info->params);
1331 ret = HYPERVISOR_dom0_op(&op);
1332 if (ret)
1333 break;
1334
1335#define C(x) info->x = op.u.firmware_info.u.disk_info.x
1336 C(device);
1337 C(version);
1338 C(interface_support);
1339 C(legacy_max_cylinder);
1340 C(legacy_max_head);
1341 C(legacy_sectors_per_track);
1342#undef C
1343 }
1344 boot_params.eddbuf_entries = nr;
1345
1346 op.u.firmware_info.type = XEN_FW_DISK_MBR_SIGNATURE;
1347 for (nr = 0; nr < EDD_MBR_SIG_MAX; nr++) {
1348 op.u.firmware_info.index = nr;
1349 ret = HYPERVISOR_dom0_op(&op);
1350 if (ret)
1351 break;
1352 mbr_signature[nr] = op.u.firmware_info.u.disk_mbr_signature.mbr_signature;
1353 }
1354 boot_params.edd_mbr_sig_buf_entries = nr;
1355#endif
1356}
1357
1309/* 1358/*
1310 * Set up the GDT and segment registers for -fstack-protector. Until 1359 * Set up the GDT and segment registers for -fstack-protector. Until
1311 * we do this, we have to be careful not to call any stack-protected 1360 * we do this, we have to be careful not to call any stack-protected
@@ -1508,6 +1557,8 @@ asmlinkage void __init xen_start_kernel(void)
1508 /* Avoid searching for BIOS MP tables */ 1557 /* Avoid searching for BIOS MP tables */
1509 x86_init.mpparse.find_smp_config = x86_init_noop; 1558 x86_init.mpparse.find_smp_config = x86_init_noop;
1510 x86_init.mpparse.get_smp_config = x86_init_uint_noop; 1559 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
1560
1561 xen_boot_params_init_edd();
1511 } 1562 }
1512#ifdef CONFIG_PCI 1563#ifdef CONFIG_PCI
1513 /* PCI BIOS service won't work from a PV guest. */ 1564 /* PCI BIOS service won't work from a PV guest. */
@@ -1589,8 +1640,11 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
1589 switch (action) { 1640 switch (action) {
1590 case CPU_UP_PREPARE: 1641 case CPU_UP_PREPARE:
1591 xen_vcpu_setup(cpu); 1642 xen_vcpu_setup(cpu);
1592 if (xen_have_vector_callback) 1643 if (xen_have_vector_callback) {
1593 xen_init_lock_cpu(cpu); 1644 xen_init_lock_cpu(cpu);
1645 if (xen_feature(XENFEAT_hvm_safe_pvclock))
1646 xen_setup_timer(cpu);
1647 }
1594 break; 1648 break;
1595 default: 1649 default:
1596 break; 1650 break;
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index e006c18d288a..fdc3ba28ca38 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -2043,9 +2043,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2043 2043
2044 switch (idx) { 2044 switch (idx) {
2045 case FIX_BTMAP_END ... FIX_BTMAP_BEGIN: 2045 case FIX_BTMAP_END ... FIX_BTMAP_BEGIN:
2046#ifdef CONFIG_X86_F00F_BUG 2046 case FIX_RO_IDT:
2047 case FIX_F00F_IDT:
2048#endif
2049#ifdef CONFIG_X86_32 2047#ifdef CONFIG_X86_32
2050 case FIX_WP_TEST: 2048 case FIX_WP_TEST:
2051 case FIX_VDSO: 2049 case FIX_VDSO:
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 09ea61d2e02f..8ff37995d54e 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -95,7 +95,7 @@ static void __cpuinit cpu_bringup(void)
95static void __cpuinit cpu_bringup_and_idle(void) 95static void __cpuinit cpu_bringup_and_idle(void)
96{ 96{
97 cpu_bringup(); 97 cpu_bringup();
98 cpu_idle(); 98 cpu_startup_entry(CPUHP_ONLINE);
99} 99}
100 100
101static int xen_smp_intr_init(unsigned int cpu) 101static int xen_smp_intr_init(unsigned int cpu)
@@ -144,6 +144,13 @@ static int xen_smp_intr_init(unsigned int cpu)
144 goto fail; 144 goto fail;
145 per_cpu(xen_callfuncsingle_irq, cpu) = rc; 145 per_cpu(xen_callfuncsingle_irq, cpu) = rc;
146 146
147 /*
148 * The IRQ worker on PVHVM goes through the native path and uses the
149 * IPI mechanism.
150 */
151 if (xen_hvm_domain())
152 return 0;
153
147 callfunc_name = kasprintf(GFP_KERNEL, "irqwork%d", cpu); 154 callfunc_name = kasprintf(GFP_KERNEL, "irqwork%d", cpu);
148 rc = bind_ipi_to_irqhandler(XEN_IRQ_WORK_VECTOR, 155 rc = bind_ipi_to_irqhandler(XEN_IRQ_WORK_VECTOR,
149 cpu, 156 cpu,
@@ -167,6 +174,9 @@ static int xen_smp_intr_init(unsigned int cpu)
167 if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0) 174 if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
168 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), 175 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
169 NULL); 176 NULL);
177 if (xen_hvm_domain())
178 return rc;
179
170 if (per_cpu(xen_irq_work, cpu) >= 0) 180 if (per_cpu(xen_irq_work, cpu) >= 0)
171 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL); 181 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
172 182
@@ -418,7 +428,7 @@ static int xen_cpu_disable(void)
418 428
419static void xen_cpu_die(unsigned int cpu) 429static void xen_cpu_die(unsigned int cpu)
420{ 430{
421 while (HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL)) { 431 while (xen_pv_domain() && HYPERVISOR_vcpu_op(VCPUOP_is_up, cpu, NULL)) {
422 current->state = TASK_UNINTERRUPTIBLE; 432 current->state = TASK_UNINTERRUPTIBLE;
423 schedule_timeout(HZ/10); 433 schedule_timeout(HZ/10);
424 } 434 }
@@ -426,7 +436,8 @@ static void xen_cpu_die(unsigned int cpu)
426 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); 436 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
427 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); 437 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
428 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL); 438 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
429 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL); 439 if (!xen_hvm_domain())
440 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
430 xen_uninit_lock_cpu(cpu); 441 xen_uninit_lock_cpu(cpu);
431 xen_teardown_timer(cpu); 442 xen_teardown_timer(cpu);
432} 443}
@@ -657,11 +668,7 @@ static int __cpuinit xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle)
657 668
658static void xen_hvm_cpu_die(unsigned int cpu) 669static void xen_hvm_cpu_die(unsigned int cpu)
659{ 670{
660 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); 671 xen_cpu_die(cpu);
661 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
662 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
663 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
664 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
665 native_cpu_die(cpu); 672 native_cpu_die(cpu);
666} 673}
667 674
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index f7a080ef0354..8b54603ce816 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -364,6 +364,16 @@ void __cpuinit xen_init_lock_cpu(int cpu)
364 int irq; 364 int irq;
365 const char *name; 365 const char *name;
366 366
367 WARN(per_cpu(lock_kicker_irq, cpu) > 0, "spinlock on CPU%d exists on IRQ%d!\n",
368 cpu, per_cpu(lock_kicker_irq, cpu));
369
370 /*
371 * See git commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23
372 * (xen: disable PV spinlocks on HVM)
373 */
374 if (xen_hvm_domain())
375 return;
376
367 name = kasprintf(GFP_KERNEL, "spinlock%d", cpu); 377 name = kasprintf(GFP_KERNEL, "spinlock%d", cpu);
368 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR, 378 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR,
369 cpu, 379 cpu,
@@ -382,11 +392,26 @@ void __cpuinit xen_init_lock_cpu(int cpu)
382 392
383void xen_uninit_lock_cpu(int cpu) 393void xen_uninit_lock_cpu(int cpu)
384{ 394{
395 /*
396 * See git commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23
397 * (xen: disable PV spinlocks on HVM)
398 */
399 if (xen_hvm_domain())
400 return;
401
385 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL); 402 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
403 per_cpu(lock_kicker_irq, cpu) = -1;
386} 404}
387 405
388void __init xen_init_spinlocks(void) 406void __init xen_init_spinlocks(void)
389{ 407{
408 /*
409 * See git commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23
410 * (xen: disable PV spinlocks on HVM)
411 */
412 if (xen_hvm_domain())
413 return;
414
390 BUILD_BUG_ON(sizeof(struct xen_spinlock) > sizeof(arch_spinlock_t)); 415 BUILD_BUG_ON(sizeof(struct xen_spinlock) > sizeof(arch_spinlock_t));
391 416
392 pv_lock_ops.spin_is_locked = xen_spin_is_locked; 417 pv_lock_ops.spin_is_locked = xen_spin_is_locked;
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 0296a9522501..3d88bfdf9e1c 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -377,7 +377,7 @@ static const struct clock_event_device xen_vcpuop_clockevent = {
377 377
378static const struct clock_event_device *xen_clockevent = 378static const struct clock_event_device *xen_clockevent =
379 &xen_timerop_clockevent; 379 &xen_timerop_clockevent;
380static DEFINE_PER_CPU(struct clock_event_device, xen_clock_events); 380static DEFINE_PER_CPU(struct clock_event_device, xen_clock_events) = { .irq = -1 };
381 381
382static irqreturn_t xen_timer_interrupt(int irq, void *dev_id) 382static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
383{ 383{
@@ -401,6 +401,9 @@ void xen_setup_timer(int cpu)
401 struct clock_event_device *evt; 401 struct clock_event_device *evt;
402 int irq; 402 int irq;
403 403
404 evt = &per_cpu(xen_clock_events, cpu);
405 WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu);
406
404 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu); 407 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu);
405 408
406 name = kasprintf(GFP_KERNEL, "timer%d", cpu); 409 name = kasprintf(GFP_KERNEL, "timer%d", cpu);
@@ -413,7 +416,6 @@ void xen_setup_timer(int cpu)
413 IRQF_FORCE_RESUME, 416 IRQF_FORCE_RESUME,
414 name, NULL); 417 name, NULL);
415 418
416 evt = &per_cpu(xen_clock_events, cpu);
417 memcpy(evt, xen_clockevent, sizeof(*evt)); 419 memcpy(evt, xen_clockevent, sizeof(*evt));
418 420
419 evt->cpumask = cpumask_of(cpu); 421 evt->cpumask = cpumask_of(cpu);
@@ -426,6 +428,7 @@ void xen_teardown_timer(int cpu)
426 BUG_ON(cpu == 0); 428 BUG_ON(cpu == 0);
427 evt = &per_cpu(xen_clock_events, cpu); 429 evt = &per_cpu(xen_clock_events, cpu);
428 unbind_from_irqhandler(evt->irq, NULL); 430 unbind_from_irqhandler(evt->irq, NULL);
431 evt->irq = -1;
429} 432}
430 433
431void xen_setup_cpu_clockevents(void) 434void xen_setup_cpu_clockevents(void)
@@ -497,7 +500,11 @@ static void xen_hvm_setup_cpu_clockevents(void)
497{ 500{
498 int cpu = smp_processor_id(); 501 int cpu = smp_processor_id();
499 xen_setup_runstate_info(cpu); 502 xen_setup_runstate_info(cpu);
500 xen_setup_timer(cpu); 503 /*
504 * xen_setup_timer(cpu) - snprintf is bad in atomic context. Hence
505 * doing it xen_hvm_cpu_notify (which gets called by smp_init during
506 * early bootup and also during CPU hotplug events).
507 */
501 xen_setup_cpu_clockevents(); 508 xen_setup_cpu_clockevents();
502} 509}
503 510
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index c38834de9ac7..cb4c2ce8d447 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -4,14 +4,6 @@
4#define __ARCH_WANT_SYS_CLONE 4#define __ARCH_WANT_SYS_CLONE
5#include <uapi/asm/unistd.h> 5#include <uapi/asm/unistd.h>
6 6
7/*
8 * "Conditional" syscalls
9 *
10 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
11 * but it doesn't work on all toolchains, so we just do it by hand
12 */
13#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
14
15#define __ARCH_WANT_STAT64 7#define __ARCH_WANT_STAT64
16#define __ARCH_WANT_SYS_UTIME 8#define __ARCH_WANT_SYS_UTIME
17#define __ARCH_WANT_SYS_LLSEEK 9#define __ARCH_WANT_SYS_LLSEEK
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 5cd82e9f601c..1c85323f01d7 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -105,19 +105,9 @@ void coprocessor_flush_all(struct thread_info *ti)
105/* 105/*
106 * Powermanagement idle function, if any is provided by the platform. 106 * Powermanagement idle function, if any is provided by the platform.
107 */ 107 */
108 108void arch_cpu_idle(void)
109void cpu_idle(void)
110{ 109{
111 local_irq_enable(); 110 platform_idle();
112
113 /* endless idle loop with no priority at all */
114 while (1) {
115 rcu_idle_enter();
116 while (!need_resched())
117 platform_idle();
118 rcu_idle_exit();
119 schedule_preempt_disabled();
120 }
121} 111}
122 112
123/* 113/*
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 923db5c15278..458186dab5dc 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -383,6 +383,8 @@ void show_regs(struct pt_regs * regs)
383{ 383{
384 int i, wmask; 384 int i, wmask;
385 385
386 show_regs_print_info(KERN_DEFAULT);
387
386 wmask = regs->wmask & ~1; 388 wmask = regs->wmask & ~1;
387 389
388 for (i = 0; i < 16; i++) { 390 for (i = 0; i < 16; i++) {
@@ -481,14 +483,6 @@ void show_stack(struct task_struct *task, unsigned long *sp)
481 show_trace(task, stack); 483 show_trace(task, stack);
482} 484}
483 485
484void dump_stack(void)
485{
486 show_stack(current, NULL);
487}
488
489EXPORT_SYMBOL(dump_stack);
490
491
492void show_code(unsigned int *pc) 486void show_code(unsigned int *pc)
493{ 487{
494 long i; 488 long i;
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 7a5156ffebb6..bba125b4bb06 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -208,32 +208,17 @@ void __init mem_init(void)
208 highmemsize >> 10); 208 highmemsize >> 10);
209} 209}
210 210
211void
212free_reserved_mem(void *start, void *end)
213{
214 for (; start < end; start += PAGE_SIZE) {
215 ClearPageReserved(virt_to_page(start));
216 init_page_count(virt_to_page(start));
217 free_page((unsigned long)start);
218 totalram_pages++;
219 }
220}
221
222#ifdef CONFIG_BLK_DEV_INITRD 211#ifdef CONFIG_BLK_DEV_INITRD
223extern int initrd_is_mapped; 212extern int initrd_is_mapped;
224 213
225void free_initrd_mem(unsigned long start, unsigned long end) 214void free_initrd_mem(unsigned long start, unsigned long end)
226{ 215{
227 if (initrd_is_mapped) { 216 if (initrd_is_mapped)
228 free_reserved_mem((void*)start, (void*)end); 217 free_reserved_area(start, end, 0, "initrd");
229 printk ("Freeing initrd memory: %ldk freed\n",(end-start)>>10);
230 }
231} 218}
232#endif 219#endif
233 220
234void free_initmem(void) 221void free_initmem(void)
235{ 222{
236 free_reserved_mem(__init_begin, __init_end); 223 free_initmem_default(0);
237 printk("Freeing unused kernel memory: %zuk freed\n",
238 (__init_end - __init_begin) >> 10);
239} 224}
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c
index f58ffc3b68a8..88608cc11b8c 100644
--- a/arch/xtensa/platforms/iss/simdisk.c
+++ b/arch/xtensa/platforms/iss/simdisk.c
@@ -214,20 +214,27 @@ static int simdisk_detach(struct simdisk *dev)
214 return err; 214 return err;
215} 215}
216 216
217static int proc_read_simdisk(char *page, char **start, off_t off, 217static ssize_t proc_read_simdisk(struct file *file, char __user *buf,
218 int count, int *eof, void *data) 218 size_t size, loff_t *ppos)
219{ 219{
220 int len; 220 struct simdisk *dev = PDE_DATA(file_inode(file));
221 struct simdisk *dev = (struct simdisk *) data; 221 char *s = dev->filename;
222 len = sprintf(page, "%s\n", dev->filename ? dev->filename : ""); 222 if (s) {
223 return len; 223 ssize_t n = simple_read_from_buffer(buf, size, ppos,
224 s, strlen(s));
225 if (n < 0)
226 return n;
227 buf += n;
228 size -= n;
229 }
230 return simple_read_from_buffer(buf, size, ppos, "\n", 1);
224} 231}
225 232
226static int proc_write_simdisk(struct file *file, const char *buffer, 233static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
227 unsigned long count, void *data) 234 size_t count, loff_t *ppos)
228{ 235{
229 char *tmp = kmalloc(count + 1, GFP_KERNEL); 236 char *tmp = kmalloc(count + 1, GFP_KERNEL);
230 struct simdisk *dev = (struct simdisk *) data; 237 struct simdisk *dev = PDE_DATA(file_inode(file));
231 int err; 238 int err;
232 239
233 if (tmp == NULL) 240 if (tmp == NULL)
@@ -256,6 +263,12 @@ out_free:
256 return err; 263 return err;
257} 264}
258 265
266static const struct file_operations fops = {
267 .read = proc_read_simdisk,
268 .write = proc_write_simdisk,
269 .llseek = default_llseek,
270};
271
259static int __init simdisk_setup(struct simdisk *dev, int which, 272static int __init simdisk_setup(struct simdisk *dev, int which,
260 struct proc_dir_entry *procdir) 273 struct proc_dir_entry *procdir)
261{ 274{
@@ -289,10 +302,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
289 set_capacity(dev->gd, 0); 302 set_capacity(dev->gd, 0);
290 add_disk(dev->gd); 303 add_disk(dev->gd);
291 304
292 dev->procfile = create_proc_entry(tmp, 0644, procdir); 305 dev->procfile = proc_create_data(tmp, 0644, procdir, &fops, dev);
293 dev->procfile->data = dev;
294 dev->procfile->read_proc = proc_read_simdisk;
295 dev->procfile->write_proc = proc_write_simdisk;
296 return 0; 306 return 0;
297 307
298out_alloc_disk: 308out_alloc_disk: